/* Tokens copied from prototype/gis-console/styles.css so the start page reads as the front
   door of the same product, not a separate marketing site. Keep these two in sync by hand;
   there is no shared stylesheet in this prototype. */
:root {
  --paper: #e4e9e5;
  --surface: #f7f9f7;
  --surface-2: #edf1ee;
  --line: #c6d0cb;
  --ink: #14201d;
  --ink-2: #42544e;
  --ink-3: #5c6d67;
  --chart: #1f6f8b;
  --chart-soft: #d5e4e9;
  --swash: #5f8f86;
  --collision: #c89434;
  --overwash: #b85a2a;
  --inundation: #8c2f39;
  --nodata: #5c6a65;
  --band: #b9c7c1;
  --warn-bg: #f5e7d2;
  --warn-ink: #7a4c13;
  --warn-line: #d9b67a;
  --shadow: 0 1px 2px rgba(20,32,29,.08), 0 8px 24px rgba(20,32,29,.06);
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { height: 100%; }

/* One screen, no scroll: this page is a single above-the-fold workspace home, so the
   column stack (strip / topbar / workspace / footer) owns the viewport height exactly. */
body {
  display: flex;
  flex-direction: column;
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: "IBM Plex Sans", Arial, sans-serif;
  font-size: 14px;
}
button, select, input { font: inherit; }
button, select, input[type="file"] { cursor: pointer; }
button:focus-visible, select:focus-visible, input:focus-visible, [tabindex]:focus-visible { outline: 2px solid var(--chart); outline-offset: 2px; }
.eyebrow { margin: 0; color: var(--chart); font: 600 9.5px/1 "IBM Plex Mono", monospace; letter-spacing: .1em; text-transform: uppercase; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

/* Disclosure strip, same convention as the console's fixture-strip: the required label sits
   on the primary display, never only in a footnote. */
.fixture-strip {
  flex: none;
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 0;
  padding: 6px 3vw;
  background: var(--warn-bg);
  border-bottom: 1px solid var(--warn-line);
  color: var(--warn-ink);
  font: 400 10.5px/1.4 "IBM Plex Mono", monospace;
  letter-spacing: .015em;
}
.fixture-strip b {
  flex: none;
  padding: 3px 6px;
  border: 1px solid var(--warn-ink);
  border-radius: 2px;
  background: var(--warn-line);
  color: var(--warn-ink);
  font-weight: 700;
  letter-spacing: .09em;
  text-transform: uppercase;
}

.topbar {
  flex: none;
  display: flex;
  height: 58px;
  align-items: center;
  justify-content: space-between;
  padding: 0 3vw;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}
/* The logo artwork already contains the CoastLens wordmark, so the name is never set twice:
   it carries in the alt text and the context line stays a plain operating context. */
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark { height: 32px; width: auto; flex: none; object-fit: contain; }
.brand-context { color: var(--ink-3); font: 500 11px/1 "IBM Plex Mono", monospace; letter-spacing: .04em; }
.brand-context i { color: var(--line); font-style: normal; }

.topbar-actions { display: flex; align-items: center; gap: 8px; }
.pill-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 34px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 17px;
  background: var(--surface-2);
  color: var(--ink-2);
  font: 600 12px/1 "IBM Plex Sans", sans-serif;
  white-space: nowrap;
}
.pill-btn svg { width: 15px; height: 15px; flex: none; color: var(--chart); }
.pill-btn:hover { border-color: var(--chart); background: var(--chart-soft); color: var(--ink); }
.pill-btn[aria-expanded="true"] { border-color: var(--chart); background: var(--chart-soft); color: var(--ink); }

.workspace { flex: 1; display: flex; min-height: 0; }

main {
  flex: 1;
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(280px, 1fr) minmax(390px, 520px);
  gap: 4vw;
  align-items: center;
  padding: 0 3vw;
}

.intro { max-width: 520px; }
.intro h1 { max-width: 10ch; margin: 10px 0 0; font-size: clamp(34px, 3.6vw, 52px); font-weight: 600; line-height: 1.02; letter-spacing: -.03em; }
.intro-copy { max-width: 38ch; margin: 16px 0 0; color: var(--ink-2); font-size: clamp(13px, 1vw, 15px); line-height: 1.55; }

.mode-summary {
  display: grid;
  max-width: 420px;
  grid-template-columns: auto 1fr;
  gap: 6px 14px;
  margin-top: 26px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}
.mode-summary span { color: var(--chart); font: 600 9.5px/1.4 "IBM Plex Mono", monospace; letter-spacing: .1em; }
.mode-summary b { font-size: 14px; font-weight: 600; }
.mode-summary i { grid-column: 1 / -1; height: 4px; }

/* Shared card treatment: every surface on this page (analysis panel, assistant rail, upload
   dialog) uses the same border/radius/shadow as a console pane so the hand-off doesn't feel
   like a new app. */
.panel {
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.analysis-panel { width: 100%; padding: 18px; }

.mode-picker { display: grid; grid-template-columns: 1fr 1fr; overflow: hidden; border: 1px solid var(--line); border-radius: 5px; background: var(--surface-2); }
.mode-picker button { min-height: 70px; padding: 11px 14px; border: 0; border-right: 1px solid var(--line); background: transparent; color: var(--ink-3); text-align: left; }
.mode-picker button:last-child { border-right: 0; }
.mode-picker button:hover { color: var(--ink); }
.mode-picker button.active { box-shadow: inset 0 -3px 0 var(--chart); background: var(--chart-soft); color: var(--ink); }
.mode-picker span, .mode-picker strong, .mode-picker small { display: block; }
.mode-picker span { color: var(--chart); font: 600 9px/1 "IBM Plex Mono", monospace; letter-spacing: .1em; text-transform: uppercase; }
.mode-picker strong { margin-top: 6px; font-size: 15.5px; }
.mode-picker small { margin-top: 3px; color: var(--ink-3); font-size: 11.5px; }

#analysis-form { display: grid; grid-template-columns: .8fr 1.2fr; gap: 11px; margin-top: 14px; }
#analysis-form label { display: block; }
#analysis-form label > span { display: block; margin: 0 0 6px; color: var(--ink-3); font: 600 9.5px/1 "IBM Plex Mono", monospace; letter-spacing: .08em; text-transform: uppercase; }
#analysis-form label:nth-child(3) { grid-column: 1 / -1; }
select { width: 100%; height: 44px; padding: 0 12px; border: 1px solid var(--line); border-radius: 5px; background: var(--surface); color: var(--ink); font: 600 13.5px/1 "IBM Plex Sans", sans-serif; }
.field-value { display: flex; width: 100%; height: 44px; align-items: center; padding: 0 12px; border: 1px solid var(--line); border-radius: 5px; background: var(--surface-2); color: var(--ink); font: 600 13.5px/1 "IBM Plex Sans", sans-serif; }
.event-field select { border: 2px solid var(--collision); box-shadow: 0 0 0 3px color-mix(in srgb, var(--collision) 16%, transparent); }
body[data-mode="forecast"] .event-field select { border-color: var(--chart); box-shadow: 0 0 0 3px var(--chart-soft); }

.open-analysis { grid-column: 1 / -1; height: 46px; border: 0; border-radius: 5px; background: var(--ink); color: var(--surface); font: 700 14px/1 "IBM Plex Sans", sans-serif; }
.open-analysis:hover, .open-analysis:focus-visible { background: var(--chart); }

.readiness { margin-top: 13px; padding: 10px 12px; border: 1px solid var(--line); border-left: 3px solid var(--chart); border-radius: 5px; background: var(--surface-2); }
.readiness-heading { margin: 0; color: var(--chart); font: 600 9px/1 "IBM Plex Mono", monospace; letter-spacing: .1em; text-transform: uppercase; }
.readiness-summary { min-height: 30px; margin: 6px 0 8px; color: var(--ink); font-size: 12px; line-height: 1.42; }
.readiness-status { display: flex; flex-wrap: wrap; gap: 5px 12px; color: var(--ink-3); font: 500 9px/1.35 "IBM Plex Mono", monospace; }
.readiness-status span { display: flex; gap: 5px; }
.readiness-status b { color: var(--ink); font-weight: 600; }
.readiness-status b[data-state="pending"] { color: var(--warn-ink); }

.next-cue { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin-top: 12px; color: var(--ink-3); font: 500 9.5px/1.2 "IBM Plex Mono", monospace; }
.next-cue span { margin-right: 3px; color: var(--chart); font-weight: 600; letter-spacing: .08em; text-transform: uppercase; }
.next-cue b { color: var(--ink); font-weight: 600; }
.next-cue i { color: var(--collision); font-size: 12px; font-style: normal; }

.plain-button { border: 1px solid var(--line); color: var(--ink-2); background: var(--surface-2); border-radius: 4px; padding: 7px 12px; font-size: 11.5px; }
.plain-button:hover:not(:disabled) { border-color: var(--ink-3); color: var(--ink); }
.plain-button.compact { font-size: 10px; padding: 4px 8px; }
.plain-button:disabled { opacity: .55; cursor: default; }

/* --- Manannán rail ---------------------------------------------------------------------
   Docked to the right edge rather than sitting in the page flow, so the assistant is always
   reachable without pushing the analysis panel below the fold. */
.assistant-rail {
  flex: none;
  width: 336px;
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 16px 18px 18px;
  border-left: 1px solid var(--line);
  background: var(--surface);
}
body[data-assistant="closed"] .assistant-rail { display: none; }

.rail-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; flex: none; }
.rail-head h2 { margin: 7px 0 0; font-size: 18px; letter-spacing: -.02em; }
.assistant-gloss { margin: 5px 0 0; color: var(--ink-3); font: 500 10.5px/1.45 "IBM Plex Mono", monospace; }
.rail-close { flex: none; width: 26px; height: 26px; border: 1px solid var(--line); border-radius: 4px; background: var(--surface-2); color: var(--ink-3); font-size: 16px; line-height: 1; }
.rail-close:hover { border-color: var(--ink-3); color: var(--ink); }

.assistant-messages { flex: 1; min-height: 90px; overflow-y: auto; margin: 14px 0 0; padding-right: 4px; display: flex; flex-direction: column; gap: 10px; }
.msg { padding: 9px 11px; border-radius: 6px; font-size: 12.5px; line-height: 1.48; max-width: 94%; }
.msg strong { display: block; margin-bottom: 3px; font: 600 9.5px/1 "IBM Plex Mono", monospace; letter-spacing: .05em; text-transform: uppercase; }
.msg p { margin: 0; }
.msg-assistant { align-self: flex-start; background: var(--surface-2); border: 1px solid var(--line); color: var(--ink); }
.msg-assistant strong { color: var(--chart); }
.msg-user { align-self: flex-end; background: var(--chart); color: #fff; }
.msg-user strong { color: rgba(255,255,255,.82); }
.msg-system { align-self: center; max-width: 100%; background: var(--warn-bg); border: 1px solid var(--warn-line); color: var(--warn-ink); font-size: 11px; }

.suggested-questions { flex: none; margin-top: 12px; }
.suggested-list { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 7px; }
.chip-btn { border: 1px solid var(--line); border-radius: 14px; padding: 5px 10px; background: var(--surface-2); color: var(--ink-2); font-size: 10.5px; line-height: 1.35; text-align: left; }
.chip-btn:hover { border-color: var(--chart); color: var(--ink); }

.assistant-input-row { flex: none; display: flex; gap: 8px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.assistant-input-row input { flex: 1; min-width: 0; height: 40px; padding: 0 11px; border: 1px solid var(--line); border-radius: 5px; background: var(--surface); color: var(--ink); font-size: 12.5px; }
.assistant-input-row button { flex: none; height: 40px; padding: 0 16px; border: 0; border-radius: 5px; background: var(--ink); color: var(--surface); font-weight: 600; font-size: 12.5px; }
.assistant-input-row button:hover, .assistant-input-row button:focus-visible { background: var(--chart); }

/* --- Add data dialog -------------------------------------------------------------------
   Upload is an occasional task, not a standing one, so it lives behind the topbar pill and
   overlays the workspace instead of taking permanent space on the home screen. */
.modal-backdrop { position: fixed; inset: 0; z-index: 40; background: rgba(20,32,29,.55); }
.upload-dialog {
  position: fixed;
  z-index: 41;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(620px, 92vw);
  max-height: 86vh;
  overflow-y: auto;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 24px 60px rgba(20,32,29,.28);
}
.dialog-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding-bottom: 14px; }
.dialog-head h2 { margin: 8px 0 0; font-size: 19px; letter-spacing: -.02em; }
.panel-lede { margin: 8px 0 0; color: var(--ink-2); font-size: 12px; line-height: 1.5; }

.dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 26px 16px;
  border: 1.5px dashed var(--line);
  border-radius: 6px;
  background: var(--surface-2);
  color: var(--ink-2);
  text-align: center;
}
.dropzone:hover, .dropzone.is-dragover { border-color: var(--chart); background: var(--chart-soft); color: var(--ink); }
.dropzone-icon { width: 26px; height: 26px; color: var(--chart); }
.dropzone-label { margin: 2px 0 0; font-size: 13px; }
.link-like { color: var(--chart); font-weight: 600; text-decoration: underline; }
.dropzone-hint { margin: 0; color: var(--ink-3); font: 400 10px/1.4 "IBM Plex Mono", monospace; }

.validation-report { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }
.report-head { display: flex; align-items: center; justify-content: space-between; }
.report-file { margin: 8px 0 10px; padding: 9px 10px; border: 1px solid var(--line); border-radius: 5px; background: var(--surface-2); font-size: 11.5px; color: var(--ink); }
.report-file b { display: block; font-size: 12.5px; }
.report-file span { display: block; margin-top: 3px; color: var(--ink-3); font: 400 10px/1.4 "IBM Plex Mono", monospace; }

.file-report + .file-report { margin-top: 14px; padding-top: 14px; border-top: 1px dashed var(--line); }
.check-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 7px; max-height: 260px; overflow-y: auto; }
.check-row { display: grid; grid-template-columns: auto 1fr; gap: 8px; align-items: start; padding: 7px 8px; border: 1px solid var(--line); border-radius: 4px; background: var(--surface); }
.check-status { align-self: start; margin-top: 1px; padding: 2px 6px; border-radius: 2px; font: 600 8.5px/1.4 "IBM Plex Mono", monospace; letter-spacing: .03em; text-transform: uppercase; white-space: nowrap; }
.check-status.ok { background: var(--swash); color: #fff; }
.check-status.info { background: var(--surface-2); border: 1px solid var(--line); color: var(--ink-3); }
.check-status.warn { background: var(--warn-bg); border: 1px solid var(--warn-line); color: var(--warn-ink); }
.check-status.block { background: var(--inundation); color: #fff; }
.check-copy strong { display: block; font-size: 11.5px; font-weight: 600; }
.check-copy span { display: block; margin-top: 2px; color: var(--ink-2); font-size: 11px; line-height: 1.4; }

.ai-validation-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); }
.ai-validation-row strong { display: block; font-size: 12px; }
.ai-validation-row p { margin: 5px 0 0; max-width: 42ch; color: var(--ink-3); font-size: 10.5px; line-height: 1.45; }
.ai-validation-row button { flex: none; }

footer { flex: none; display: flex; min-height: 40px; align-items: center; justify-content: space-between; padding: 0 3vw; background: var(--ink); color: var(--paper); font: 500 10px/1 "IBM Plex Mono", monospace; letter-spacing: .07em; text-transform: uppercase; }

/* Below this width the single-screen layout stops being honest, so the page is allowed to
   scroll again and the rail drops under the analysis panel. */
@media (max-width: 1180px) {
  html, body { height: auto; }
  body { min-height: 100%; }
  .workspace { flex-direction: column; }
  main { grid-template-columns: 1fr; gap: 28px; padding: 32px 4vw; }
  .intro { max-width: none; }
  .assistant-rail { width: auto; border-left: 0; border-top: 1px solid var(--line); }
  .assistant-messages { min-height: 140px; max-height: 260px; }
}

@media (max-width: 900px) {
  .topbar { padding-inline: 20px; height: auto; min-height: 56px; flex-wrap: wrap; gap: 8px; padding-block: 10px; }
  .brand-context { display: none; }
  main { padding: 24px 20px; }
  .intro h1 { max-width: none; font-size: clamp(30px, 10vw, 44px); }
  .mode-summary { display: none; }
  footer { flex-direction: column; gap: 4px; padding: 12px 20px; align-items: flex-start; }
}

@media (max-width: 560px) {
  .mode-picker, #analysis-form { grid-template-columns: 1fr; }
  .mode-picker button { border-right: 0; border-bottom: 1px solid var(--line); }
  .mode-picker button:last-child { border-bottom: 0; }
  #analysis-form label:nth-child(3), .open-analysis { grid-column: 1; }
  .ai-validation-row { flex-direction: column; align-items: flex-start; }
}

/* Short laptop screens (1366x768 and similar) still have to hold the whole page. */
@media (max-height: 800px) and (min-width: 1181px) {
  .analysis-panel { padding: 15px; }
  .mode-picker button { min-height: 62px; padding: 9px 13px; }
  .mode-picker strong { font-size: 14.5px; }
  #analysis-form { gap: 9px; margin-top: 11px; }
  select, .field-value { height: 40px; }
  .open-analysis { height: 42px; }
  .readiness { margin-top: 11px; }
  .intro h1 { font-size: clamp(30px, 3vw, 42px); }
  .intro-copy { margin-top: 12px; }
  .mode-summary { margin-top: 18px; padding-top: 12px; }
}
