/* evolvix.coder landing page, shared by narratives A and B */

:root {
  --paper: #EEF1F3;
  --panel: #F8FAFB;
  --ink: #17202B;
  --secondary: #59636E;
  --rule: #C9D0D6;
  --accent: #0E6B70;
  --accent-tint: #DCEBEC;   /* teal at low strength, highlight backgrounds only */
  --accent-ink: #0A5357;    /* hover state for actions */
  --danger: #9B2C1F;

  --font: "Schibsted Grotesk", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --wrap: 72rem;
  --gutter: 1rem;
  --topbar-h: 3.5rem;
  --measure: 62ch;
}

*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-padding-top: calc(var(--topbar-h) + 1rem);
}
@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font);
  font-size: 1.0625rem;
  line-height: 1.55;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, p, ol, ul, figure, fieldset { margin: 0; }
ol, ul { padding: 0; list-style: none; }

a { color: var(--accent); }
a:hover { color: var(--accent-ink); }

:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 3px;
  border-radius: 2px;
}

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  margin: -1px; padding: 0; border: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
}

.skip-link {
  position: absolute; left: var(--gutter); top: -3rem;
  background: var(--ink); color: var(--panel);
  padding: .5rem .75rem; z-index: 20; text-decoration: none;
}
.skip-link:focus { top: .5rem; color: var(--panel); }

.wrap {
  max-width: var(--wrap);
  margin: 0 auto;
  padding: 0 var(--gutter);
}
@media (min-width: 48rem) { :root { --gutter: 2rem; } }

/* ---------- top bar ---------- */

.topbar {
  position: sticky; top: 0; z-index: 10;
  background: var(--paper);
  border-bottom: 1px solid var(--rule);
}
.topbar-inner {
  max-width: var(--wrap); margin: 0 auto; padding: 0 var(--gutter);
  min-height: var(--topbar-h);
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  column-gap: 1rem;
}
.wordmark {
  color: var(--ink); text-decoration: none;
  font-weight: 600; font-size: 1.0625rem; letter-spacing: -0.01em;
}
.wordmark:hover { color: var(--ink); }
.topbar-line { color: var(--secondary); font-size: .9375rem; }
.topbar-cta {
  font-size: .9375rem; font-weight: 500;
  text-decoration: none;
  padding: .625rem 0;           /* 44px touch target with line-height */
  border-bottom: 1px solid transparent;
}
.topbar-cta:hover { border-bottom-color: currentColor; }

@media (max-width: 34rem) {
  .topbar-inner {
    grid-template-columns: 1fr auto;
    grid-template-rows: auto auto;
    padding-top: .375rem; padding-bottom: .375rem;
    row-gap: 0;
  }
  .wordmark { grid-column: 1; grid-row: 1; line-height: 1.3; }
  .topbar-line { grid-column: 1; grid-row: 2; font-size: .8125rem; line-height: 1.3; }
  .topbar-cta { grid-column: 2; grid-row: 1 / span 2; font-size: .875rem; }
}

/* ---------- buttons ---------- */

.button {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 2.875rem;
  padding: .625rem 1.25rem;
  border: 1px solid var(--accent);
  border-radius: 4px;
  background: var(--accent);
  color: #fff;
  font: inherit; font-size: 1rem; font-weight: 500;
  text-decoration: none;
  cursor: pointer;
}
.button:hover { background: var(--accent-ink); border-color: var(--accent-ink); color: #fff; }
.button[disabled] { cursor: progress; opacity: .75; }

/* ---------- story: hero + three stages beside one console ---------- */

.story {
  max-width: var(--wrap);
  margin: 0 auto;
  padding: 0 var(--gutter);
  display: grid;
  grid-template-columns: minmax(0, 1fr);
}
.story-console { display: none; }      /* below 60rem each stage carries its own console */

.hero { padding: 3.5rem 0 3rem; }
.hero-eyebrow {                  /* shared by pages A and B: names the product category */
  font-size: clamp(1.0625rem, .95rem + .45vw, 1.3125rem);
  line-height: 1.3;
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 1.25rem;
  text-wrap: balance;
}
.hero-title {
  font-size: clamp(2.25rem, 1.1rem + 4.2vw, 3.875rem);
  line-height: 1.04;
  letter-spacing: -0.03em;
  font-weight: 600;
  max-width: 18ch;
  text-wrap: balance;
  min-height: 6.24em;            /* reserved for the longer of the page A and B headlines (measured, 6 lines) */
}
.hero-sub {
  margin-top: 1.5rem;
  font-size: clamp(1.1875rem, 1rem + .6vw, 1.4375rem);
  line-height: 1.45;
  color: var(--ink);
  max-width: 38ch;
  min-height: 10.15em;           /* reserved for the longer of the page A and B sublines (measured, 7 lines) */
  text-wrap: balance;
}
.hero-copy .button { margin-top: 2.25rem; }
/* Hero reserves, measured for pages A and B from 320 to 1920 px (re-measure when either text changes) */
@media (min-width: 20.625rem) { .hero-title { min-height: 5.2em; } }                  /* 5 lines */
@media (min-width: 23.75rem) {
  .hero-title { min-height: 4.16em; }   /* 4 lines */
  .hero-sub { min-height: 8.7em; }      /* 6 lines */
}
@media (min-width: 26.25rem) { .hero-sub { min-height: 7.25em; } }                    /* 5 lines */
@media (min-width: 60rem) { .hero .hero-sub { min-height: 8.7em; } }                  /* 6 lines: half-width column */
@media (min-width: 63.75rem) { .hero .hero-sub { min-height: 7.25em; } }              /* 5 lines */

.stage { padding: 3rem 0; border-top: 1px solid var(--rule); }
.stage-title {
  font-size: clamp(1.625rem, 1.2rem + 1.6vw, 2.25rem);
  line-height: 1.15;
  letter-spacing: -0.02em;
  font-weight: 600;
}
.stage-text p { margin-top: 1rem; font-size: 1.125rem; max-width: 36rem; }
.design-steps {
  margin-top: 1.5rem;
  padding-left: 1.5rem;
  list-style: decimal;
  max-width: 36rem;
}
.design-steps li { padding-left: .375rem; margin-top: .75rem; }
.design-steps li::marker { color: var(--accent); font-weight: 600; }
.console-static { margin-top: 2rem; }

/* An estimate: figure, what it is, and its basis, always together as one block */
.estimate {
  margin-top: 2.25rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--rule);
  max-width: 30rem;
  break-inside: avoid;
}
.estimate[hidden] { display: none; }
.stage-text .estimate-figure {
  margin: 0;
  font-size: clamp(2.25rem, 1.6rem + 2vw, 3rem);
  line-height: 1;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.stage-text .estimate-line { margin-top: .5rem; font-size: 1.0625rem; line-height: 1.45; color: var(--ink); }
.stage-text .estimate-basis { margin-top: .375rem; font-size: .875rem; line-height: 1.5; color: var(--secondary); }

@media (min-width: 60rem) {
  .story {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    column-gap: 4rem;
  }
  .story-console { display: block; }
  .console-static { display: none; }
  .hero-title { font-size: clamp(2.5rem, .9rem + 2.7vw, 3.25rem); }
  .hero {
    min-height: calc(100vh - var(--topbar-h));
    display: flex; flex-direction: column; justify-content: center;
    padding: 4rem 0;
  }
  .stage {
    min-height: 100vh;             /* time with each diagram state */
    display: flex; flex-direction: column; justify-content: center;
    padding: 6rem 0;
    border-top: 0;
  }
  /* The console stays in place, centred under the top bar, until the story column ends. */
  .console-sticky {
    position: sticky;
    top: var(--topbar-h);
    height: calc(100vh - var(--topbar-h));
    display: flex; align-items: center;
  }
  .console-sticky .console { width: 100%; }
}

/* ---------- query console ---------- */

.console {
  background: var(--panel);
  border: 1px solid var(--rule);
  border-radius: 6px;
  font-family: var(--mono);
  font-size: .8125rem;
  line-height: 1.6;
  min-width: 0;
}
.console-bar {
  display: flex; justify-content: space-between; gap: 1rem;
  padding: .5rem 1rem;
  border-bottom: 1px solid var(--rule);
  color: var(--secondary);
  font-size: .75rem;
}
.console-body { padding: 1rem 1rem 1.25rem; }
.console-body { padding: .875rem .75rem 1rem; }
@media (min-width: 30rem) {
  .console { font-size: .875rem; }
  .console-body { padding: 1.25rem 1.5rem 1.5rem; }
}
.q { color: var(--ink); white-space: pre-wrap; overflow-wrap: anywhere; min-height: 1.6em; }
@media (max-width: 30rem) { .q { min-height: 3.2em; } }
.prompt { color: var(--accent); font-weight: 500; }
.typed .rest { visibility: hidden; }
.typed .caret {
  display: inline-block; width: .55em; height: 1.1em;
  margin-left: 1px; vertical-align: -0.2em;
  background: var(--ink);
}

.q { margin-bottom: .875rem; }
.q-placeholder { color: var(--secondary); }
.q-placeholder.off { display: none; }
.caret-blink {
  display: inline-block; width: .55em; height: 1.1em;
  margin-right: .35em; vertical-align: -0.2em;
  background: var(--ink);
}
@media (prefers-reduced-motion: no-preference) {
  .caret-blink { animation: caret-blink 1.1s steps(1) infinite; }
}
@keyframes caret-blink { 50% { opacity: 0; } }

.stage-art { display: grid; max-width: 26rem; margin: 0 auto; }
.stage-art > svg { grid-area: 1 / 1; width: 100%; height: auto; display: block; overflow: visible; }
.diagram text { font-family: var(--mono); font-size: 10px; fill: var(--ink); text-anchor: middle; }
.d-lanes line { stroke: var(--rule); stroke-dasharray: 3 3; }
.d-lanes text { fill: var(--secondary); }
.d-box rect { fill: #fff; stroke: var(--rule); }
.d-hit rect { fill: var(--accent-tint); stroke: var(--accent); }
.d-dep rect { stroke: var(--accent); stroke-width: 1.5; }
.diagram .d-sub { fill: var(--accent); }
.d-edge { fill: none; stroke: var(--secondary); stroke-width: 1.2; }
.d-edge-accent { stroke: var(--accent); }
.d-head { fill: var(--secondary); }
.d-head-accent { fill: var(--accent); }
.diagram .d-label { fill: var(--secondary); text-anchor: start; font-size: 9px; }
.diagram .d-label[text-anchor="end"] { text-anchor: end; }
.diagram .d-plan { fill: var(--secondary); font-size: 10.5px; }
.diagram .d-missed { fill: var(--accent); font-size: 10.5px; font-weight: 500; }
.diagram .d-covered { fill: var(--accent); font-size: 10.5px; font-weight: 500; }

/* swimlane objects and object flows */
.d-obj rect { fill: var(--paper); stroke: var(--secondary); stroke-width: .8; }
.diagram .d-obj text { fill: var(--secondary); font-size: 9.5px; }
.d-flow { fill: none; stroke: var(--secondary); stroke-width: 1; stroke-dasharray: 3 2; }

.explain {
  display: grid;
  margin-top: .875rem; padding-top: .75rem;
  border-top: 1px solid var(--rule);
  font-family: var(--font);
  font-size: .875rem; line-height: 1.5;
  color: var(--ink);
}
.explain p { grid-area: 1 / 1; }

/* The plan: grows as the session goes; every line keeps its space so nothing shifts */
.plan {
  margin-top: .75rem; padding-top: .625rem;
  border-top: 1px solid var(--rule);
  font-size: .75rem; line-height: 1.55;
}
.plan-head { color: var(--secondary); font-size: .6875rem; margin-bottom: .25rem; }
.plan-list { display: grid; gap: .125rem; }
.plan-list li { display: flex; flex-wrap: wrap; column-gap: .5rem; color: var(--ink); }
.plan-n { color: var(--secondary); min-width: 1ch; }
.plan-added .plan-n { color: var(--accent); }
.plan-tag { color: var(--accent); }
.plan-check { margin-top: .375rem; color: var(--accent); font-weight: 500; }
@media (min-width: 30rem) { .plan { font-size: .8125rem; } }

/* Stacked views: the hidden one keeps its space so nothing shifts */
.off { visibility: hidden; }

/* Hidden-but-reserved: elements keep their space so the demo never shifts layout */
.pending { visibility: hidden; }

/* ---------- shared section type ---------- */

.section-title {
  font-size: clamp(1.625rem, 1.2rem + 1.6vw, 2.25rem);
  line-height: 1.15;
  letter-spacing: -0.02em;
  font-weight: 600;
}
.section-line {
  margin-top: .75rem;
  color: var(--secondary);
  font-size: 1.125rem;
  max-width: var(--measure);
}

/* ---------- early access ---------- */

.cta {
  padding: 4.5rem 0 5rem;
  border-top: 1px solid var(--rule);
  background: var(--panel);
}
@media (min-width: 60rem) { .cta { padding: 6.5rem 0 7rem; } }
.ea-form { margin-top: 2.5rem; max-width: 48rem; }
.goals { border: 0; padding: 0; min-width: 0; }
.goals legend { padding: 0; font-weight: 600; font-size: 1.125rem; margin-bottom: .875rem; }
.pills { display: flex; flex-wrap: wrap; gap: .5rem; }
.pills input {
  position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0;
}
.pills label {
  display: inline-flex; align-items: center; gap: .5rem;
  min-height: 2.75rem;
  padding: .5rem 1rem .5rem .875rem;
  border: 1px solid var(--rule);
  border-radius: 999px;
  background: var(--paper);
  cursor: pointer;
  font-size: .9375rem;
  user-select: none;
}
.pills label::before {
  content: ""; flex: none;
  width: .75rem; height: .75rem; border-radius: 50%;
  border: 1px solid var(--secondary);
  background: transparent;
}
.pills label:hover { border-color: var(--secondary); }
.pills input:checked + label {
  border-color: var(--accent);
  background: var(--accent-tint);
  font-weight: 500;
}
.pills input:checked + label::before {
  border-color: var(--accent);
  background: var(--accent);
  box-shadow: inset 0 0 0 2px var(--accent-tint);
}
.pills input:focus-visible + label { outline: 2px solid var(--ink); outline-offset: 3px; }

.email-row { margin-top: 2rem; }
.email-label { display: block; font-weight: 600; margin-bottom: .5rem; }
.email-controls { display: flex; flex-wrap: wrap; gap: .5rem; }
.email-controls input {
  flex: 1 1 16rem; min-width: 0;
  min-height: 2.875rem;
  padding: .5rem .875rem;
  border: 1px solid var(--secondary);
  border-radius: 4px;
  background: #fff;
  color: var(--ink);
  font: inherit;
}
.email-controls input[aria-invalid="true"] { border-color: var(--danger); }
.email-controls .button { flex: 0 0 auto; }
@media (max-width: 30rem) { .email-controls .button { flex: 1 1 100%; } }

.form-status { margin-top: .75rem; min-height: 1.55em; font-size: .9375rem; color: var(--secondary); }
.form-status.error { color: var(--danger); }
.form-done { margin-top: 2.5rem; max-width: 48rem; }
.done-msg {
  padding: 1.25rem 1.5rem;
  border: 1px solid var(--accent);
  border-radius: 6px;
  background: var(--paper);
  font-weight: 500;
  max-width: var(--measure);
}

/* ---------- footer ---------- */

.footer {
  padding: 2rem 0 2.5rem;
  border-top: 1px solid var(--rule);
  color: var(--secondary);
  font-size: .9375rem;
  font-weight: 500;
}

/* ---------- debug panel (only with ?debug=1) ---------- */

.evx-debug {
  position: fixed; right: .75rem; bottom: .75rem; z-index: 50;
  background: var(--ink); color: #E8ECEF;
  font: 12px/1.45 var(--mono);
  padding: .625rem .75rem;
  border-radius: 6px;
  max-width: calc(100vw - 1.5rem);
  pointer-events: none;
}
.evx-debug table { border-collapse: collapse; }
.evx-debug th, .evx-debug td { padding: 1px 8px 1px 0; text-align: left; font-weight: 400; }
.evx-debug th { color: #9AA6B2; }
.evx-debug .dom td { color: #7FD4D8; }
.evx-debug .meta { margin-top: .375rem; color: #9AA6B2; }

/* company and codebase size questions */
.size-q { margin-top: 1.75rem; }
.size-note { margin-top: .625rem; font-size: .875rem; color: var(--secondary); }
