/* ------------------------------------------------------------
   KeelStone — main stylesheet
   Colours and fonts come from config/brand.js as CSS variables
   (see views/layout.ejs). Do not hard-code colours here.
   ------------------------------------------------------------ */

/* Self-hosted open-source fonts (SIL Open Font Licence, see /fonts/LICENSE-*.txt).
   No requests to Google or other third parties. */

@font-face {
  font-family: 'Archivo';
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  font-stretch: 62% 125%;
  src: url('/fonts/archivo-latin-wdth-normal.woff2') format('woff2');
}

@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-display: swap;
  font-weight: 100 800;
  src: url('/fonts/jetbrains-mono-latin-wght-normal.woff2') format('woff2');
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--deep-water);
  color: var(--text-on-dark);
  font-family: var(--font-sans);
  font-size: 17px;
  line-height: 1.6;
}

img { max-width: 100%; display: block; }

a { color: var(--waterline-teal); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3 {
  font-stretch: 87.5%;           /* Archivo semi-condensed */
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -0.01em;
  margin: 0 0 0.6em;
}
h1 { font-size: clamp(2.2rem, 6vw, 4rem); }
h2 { font-size: clamp(1.6rem, 3.5vw, 2.4rem); }
h3 { font-size: 1.25rem; }

p { margin: 0 0 1em; }

/* Monospace text; these classes are always monospace */
.mono, .eyebrow, .status, .timeline-step, .step-number, .card-index, .faq-group, .footer-title {
  font-family: var(--font-mono);
  font-size: 0.85em;
}
.muted { color: var(--muted-on-dark); }
.accent { color: var(--signal-orange); }

.container {
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 16px;
}
.narrow { max-width: 720px; }

/* ---------- Buttons ---------- */

.button {
  display: inline-block;
  background: var(--signal-orange);
  color: var(--basalt);
  font-weight: 600;
  padding: 0.8em 1.4em;
  border-radius: 4px;
  border: 1px solid var(--signal-orange);
  transition: transform 0.15s ease, background 0.15s ease;
}
.button:hover { text-decoration: none; transform: translateY(-1px); }
.button-ghost {
  background: transparent;
  color: var(--text-on-dark);
  border-color: var(--keel-slate);
}
.button-small { padding: 0.45em 0.9em; font-size: 0.9rem; }

.link-arrow { font-weight: 600; }
.link-arrow::after { content: " →"; }

/* ---------- Header ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--deep-water);
  border-bottom: 1px solid var(--line);
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 68px;
}
.logo img { height: 48px; width: auto; }

.site-nav { display: flex; align-items: center; gap: 28px; }
.site-nav a { color: var(--text-on-dark); font-size: 0.95rem; }
.site-nav a.active { color: var(--signal-orange); }
.site-nav a.button { color: var(--basalt); }

.nav-toggle, .nav-button { display: none; }

@media (max-width: 820px) {
  .nav-button {
    display: flex;
    flex-direction: column;
    gap: 5px;
    cursor: pointer;
    padding: 8px;
  }
  .nav-button span {
    width: 22px; height: 2px;
    background: var(--text-on-dark);
  }
  .site-nav {
    display: none;
    position: absolute;
    top: 68px; left: 0; right: 0;
    flex-direction: column;
    align-items: flex-start;
    gap: 18px;
    padding: 24px 16px;
    background: var(--deep-water);
    border-bottom: 1px solid var(--line);
  }
  .nav-toggle:checked ~ .site-nav { display: flex; }
}

/* ---------- Hero with waterline ---------- */

.hero, .page-hero { position: relative; overflow: hidden; }
.hero { padding: 88px 0 112px; }
.page-hero { padding: 72px 0 96px; }
.page-hero-small { padding: 64px 0 72px; }

.hero .container, .page-hero .container { position: relative; z-index: 1; }

.hero-grid {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 48px;
  align-items: center;
}
@media (max-width: 900px) {
  .hero-grid { grid-template-columns: 1fr; gap: 40px; }
}
.hero-image { margin: 0; }
.hero-image img { width: 100%; height: auto; border-radius: 8px; }

.hero-facts {
  list-style: none;
  padding: 0;
  margin: 2.2em 0 0;
  display: flex;
  flex-wrap: wrap;
  gap: 10px 24px;
  color: var(--muted-on-dark);
}
.hero-facts li { display: flex; align-items: center; gap: 8px; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; background: var(--waterline-teal); }

.eyebrow {
  color: var(--signal-orange);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 1.2em;
}
.lead { font-size: 1.2rem; color: var(--muted-on-dark); max-width: 640px; }
.lead-narrow { color: var(--muted-on-dark); max-width: 720px; margin-bottom: 2em; }

.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 2em; }

/* Flowing lines above the waterline: movement on the surface */
.hero-flow { position: absolute; inset: 0; pointer-events: none; }
.hero-flow span {
  position: absolute;
  left: -10%;
  width: 120%;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--keel-slate), transparent);
  opacity: 0.6;
  animation: drift 14s ease-in-out infinite alternate;
}
.hero-flow span:nth-child(1) { top: 22%; }
.hero-flow span:nth-child(2) { top: 48%; animation-duration: 18s; opacity: 0.4; }
.hero-flow span:nth-child(3) { top: 72%; animation-duration: 22s; opacity: 0.3; }

@keyframes drift {
  from { transform: translateX(-4%); }
  to   { transform: translateX(4%); }
}

/* The waterline: one still line, the keel below never moves */
.waterline {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 1px;
  background: var(--keel-slate);
}
.waterline::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 0;
  width: 2px;
  height: 40px;
  margin-left: -1px;
  background: var(--signal-orange);
}

@media (prefers-reduced-motion: reduce) {
  .hero-flow span { animation: none; }
}

/* ---------- Sections ---------- */

.section { padding: 88px 0; }
.section-alt { background: var(--basalt); }

.grid { display: grid; gap: 20px; margin-top: 2em; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }

@media (max-width: 820px) {
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
}

.split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 48px;
  align-items: center;
}
@media (max-width: 820px) {
  .split { grid-template-columns: 1fr; gap: 32px; }
}

/* ---------- Cards ---------- */

/* Shared panel look */
.card, .problem-list li, .ladder-step, .principle-row {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
}
.card { padding: 28px; }
.card p:last-child { margin-bottom: 0; }
.card-featured { border-color: var(--signal-orange); }
.card-index { color: var(--signal-orange); display: block; margin-bottom: 1em; }

.status {
  display: inline-block;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0.25em 0.7em;
  border-radius: 999px;
  margin-bottom: 1em;
  border: 1px solid currentColor;
}
.status-live  { color: var(--waterline-teal); }
.status-pilot { color: var(--signal-orange); }
.status-soon  { color: var(--muted-on-dark); }

/* ---------- Steps and lists ---------- */

.steps { list-style: none; padding: 0; margin: 2em 0 0; display: grid; gap: 28px; }
.steps li {
  display: grid;
  grid-template-columns: 56px 1fr;
  gap: 16px;
  padding-bottom: 28px;
  border-bottom: 1px solid var(--line);
}
.step-number { color: var(--signal-orange); font-size: 1rem; padding-top: 4px; }

.check-list { list-style: none; padding: 0; margin: 0; }
.check-list li { padding-left: 1.6em; position: relative; margin-bottom: 0.6em; }
.check-list li::before {
  content: "✓";
  position: absolute; left: 0;
  color: var(--waterline-teal);
  font-family: var(--font-mono);
}

/* ---------- Terminal ---------- */

.terminal {
  background: var(--basalt);
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
}
.terminal-bar { display: flex; gap: 6px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.terminal-bar span { width: 10px; height: 10px; border-radius: 50%; background: var(--keel-slate); }
.terminal pre {
  margin: 0;
  padding: 20px;
  font-size: 0.85rem;
  line-height: 1.8;
  white-space: pre-wrap;
  color: var(--text-on-dark);
}
.terminal .prompt { color: var(--muted-on-dark); }
.terminal .ok { color: var(--waterline-teal); }
.terminal .warn { color: var(--signal-orange); }
.cursor {
  display: inline-block;
  width: 0.6em; height: 1.1em;
  vertical-align: text-bottom;
  background: var(--signal-orange);
  animation: blink 1s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

/* ---------- CTA ---------- */

.cta {
  position: relative;
  overflow: hidden;
  border-top: 1px solid var(--line);
  text-align: center;
}
.cta-bg {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  opacity: 0.7;
  pointer-events: none;
}
.cta-inner { position: relative; max-width: 680px; }
.cta p { color: var(--muted-on-dark); margin-bottom: 2em; }

/* ---------- Legal pages ---------- */

.legal h1 { font-size: clamp(2rem, 5vw, 3rem); }
.legal h2 { font-size: 1.3rem; margin-top: 1.6em; }
.note {
  border-left: 2px solid var(--signal-orange);
  padding: 0.6em 1em;
  background: var(--surface);
  color: var(--muted-on-dark);
}

/* ---------- Footer ---------- */

.site-footer { background: var(--basalt); border-top: 1px solid var(--line); padding: 56px 0 24px; }
.footer-inner {
  display: grid;
  grid-template-columns: 1.6fr 1fr 1fr 1fr;
  gap: 32px;
}
.footer-brand img { height: 24px; width: auto; margin-bottom: 1em; }
.footer-brand p { max-width: 320px; }
.footer-col { display: flex; flex-direction: column; gap: 10px; font-size: 0.95rem; }
.footer-col a { color: var(--text-on-dark); }
.footer-title { color: var(--signal-orange); text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 4px; }
.footer-bottom {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px;
  margin-top: 40px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}

@media (max-width: 900px) {
  .footer-inner { grid-template-columns: 1fr 1fr; }
  .footer-brand { grid-column: 1 / -1; }
}
@media (max-width: 520px) {
  .footer-inner { grid-template-columns: 1fr; }
}

/* ---------- Utilities ---------- */

.small { font-size: 0.9rem; }
.center { text-align: center; justify-content: center; }
.center-block { margin-left: auto; margin-right: auto; }
.icon { color: var(--waterline-teal); flex-shrink: 0; }

.skip-link {
  position: absolute;
  left: -9999px;
  top: 8px;
  z-index: 100;
  background: var(--signal-orange);
  color: var(--basalt);
  padding: 8px 14px;
  border-radius: 4px;
}
.skip-link:focus { left: 16px; }

:focus-visible { outline: 2px solid var(--signal-orange); outline-offset: 3px; }

.section-tight { padding: 40px 0; border-bottom: 1px solid var(--line); }
.grid-1 { grid-template-columns: 1fr; margin-top: 0; }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 1000px) { .grid-4 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .grid-4 { grid-template-columns: 1fr; } }

/* ---------- Audience strip ---------- */

.audience-label { text-align: center; margin-bottom: 20px; }
.audience {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}
.audience-item {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  font-weight: 600;
  font-stretch: 87.5%;
  font-size: 1.05rem;
}
@media (max-width: 820px) {
  .audience { grid-template-columns: repeat(2, 1fr); }
  .audience-item { justify-content: flex-start; }
}

/* ---------- Problem list ---------- */

.problem-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 14px; }
.problem-list li, .principle-row { display: flex; gap: 16px; padding: 20px; }
.problem-list strong { display: block; font-stretch: 87.5%; font-size: 1.1rem; margin-bottom: 2px; }
.problem-list span { color: var(--muted-on-dark); }

/* ---------- Timeline ---------- */

.timeline {
  list-style: none;
  padding: 0;
  margin: 2.4em 0 0;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 24px;
  position: relative;
}
.timeline::before {
  content: "";
  position: absolute;
  top: 18px;
  left: 0;
  right: 0;
  height: 1px;
  background: var(--line);
}
.timeline li { position: relative; }
.timeline-step {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--deep-water);
  border: 1px solid var(--signal-orange);
  color: var(--signal-orange);
  margin-bottom: 18px;
  position: relative;
}
.timeline p, .ladder p { color: var(--muted-on-dark); }
@media (max-width: 900px) {
  .timeline { grid-template-columns: 1fr 1fr; }
  .timeline::before { display: none; }
}
@media (max-width: 560px) {
  .timeline { grid-template-columns: 1fr; }
}

/* ---------- Images ---------- */

.framed-image { margin: 0; }
.framed-image img {
  width: 100%;
  height: auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
}
.framed-image figcaption { margin-top: 10px; }

.portrait { margin: 0; }
.portrait img { width: 100%; height: auto; border-radius: 8px; border: 1px solid var(--line); }

/* ---------- Stats ---------- */

.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-top: 2em;
}
.stats > div { border-top: 1px solid var(--signal-orange); padding-top: 12px; }
.stat-number { display: block; font-size: 2rem; font-weight: 600; font-stretch: 87.5%; }
.stat-label { display: block; color: var(--muted-on-dark); font-size: 0.9rem; line-height: 1.4; }
@media (max-width: 520px) { .stats { grid-template-columns: 1fr; } }

/* ---------- Principle quote ---------- */

.principle { margin: 0; text-align: center; }
.principle p {
  font-size: clamp(1.4rem, 3vw, 1.9rem);
  font-stretch: 87.5%;
  line-height: 1.35;
  font-weight: 500;
}

/* ---------- FAQ ---------- */

.faq { margin: 1.6em 0 2em; border-top: 1px solid var(--line); }
.faq details { border-bottom: 1px solid var(--line); }
.faq summary {
  cursor: pointer;
  list-style: none;
  padding: 20px 40px 20px 0;
  font-weight: 600;
  position: relative;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
  content: "+";
  position: absolute;
  right: 4px;
  top: 16px;
  font-family: var(--font-mono);
  font-size: 1.3rem;
  color: var(--signal-orange);
}
.faq details[open] summary::after { content: "–"; }
.faq details p { color: var(--muted-on-dark); padding-bottom: 20px; margin: 0; }
.faq-group { color: var(--signal-orange); text-transform: uppercase; letter-spacing: 0.08em; font-size: 0.85rem; margin-top: 2.4em; }

/* ---------- Cards extras ---------- */

.card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 0.6em; }
.card-head .status { margin-bottom: 0; }
.card .icon { margin-bottom: 0.8em; }
.card-head .icon { margin-bottom: 0; }
.card-link { display: flex; flex-direction: column; }
.card-link p { flex: 1; }

.promise .icon { margin-bottom: 0.6em; }
.promise h3 { font-size: 1.1rem; margin-bottom: 0.3em; }
.promise p { color: var(--muted-on-dark); font-size: 0.95rem; }

.facts { margin: 0; }
.facts > div {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}
.facts > div:last-child { border-bottom: 0; }
.facts dt { color: var(--signal-orange); }
.facts dd { margin: 0; }

.notice {
  display: flex;
  gap: 20px;
  align-items: flex-start;
  padding: 24px;
  border: 1px solid var(--signal-orange);
  border-radius: 6px;
  background: var(--surface);
}
.notice p { margin: 0; }
.notice .status { flex-shrink: 0; }
@media (max-width: 600px) { .notice { flex-direction: column; } }

.exit-card { text-align: center; padding: 40px 28px; }
.exit-card .icon { width: 40px; height: 40px; color: var(--signal-orange); margin: 0 auto 12px; }
.exit-number { font-size: 3rem; font-weight: 600; font-stretch: 87.5%; margin: 0; }

.ladder {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin: 2em 0 1.4em;
  align-items: end;
}
.ladder-step { padding: 24px; }
.ladder-step:nth-child(2) { padding-top: 48px; }
.ladder-step:nth-child(3) { padding-top: 72px; border-color: var(--waterline-teal); }
@media (max-width: 820px) {
  .ladder { grid-template-columns: 1fr; }
  .ladder-step:nth-child(n) { padding-top: 24px; }
}

.principle-row h3 { font-size: 1.1rem; margin-bottom: 0.2em; }
.principle-row p { margin: 0; color: var(--muted-on-dark); }

.note-inline {
  border-left: 2px solid var(--waterline-teal);
  padding-left: 14px;
}

/* ---------- Contact & form ---------- */

.contact-grid {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 40px;
  align-items: start;
}
@media (max-width: 900px) { .contact-grid { grid-template-columns: 1fr; } }

.form { padding: 32px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 600px) { .form-row { grid-template-columns: 1fr; gap: 0; } .form { padding: 22px; } }

.field { margin-bottom: 18px; }
.field label { display: block; font-weight: 600; font-size: 0.95rem; margin-bottom: 6px; }
.req { color: var(--signal-orange); }

.field input[type="text"],
.field input[type="email"],
.field input[type="tel"],
.field select,
.field textarea {
  width: 100%;
  font: inherit;
  font-size: 1rem;
  color: var(--text-on-dark);
  background: var(--deep-water);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 11px 12px;
}
.field textarea { resize: vertical; min-height: 140px; }
.field select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted-on-dark) 50%), linear-gradient(135deg, var(--muted-on-dark) 50%, transparent 50%); background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 36px; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--waterline-teal); outline: none; }
.field ::placeholder { color: var(--muted-on-dark); opacity: 0.7; }

.field.has-error input,
.field.has-error select,
.field.has-error textarea { border-color: var(--signal-orange); }
.field-error { color: var(--signal-orange); font-size: 0.88rem; margin: 6px 0 0; }

.checkbox label { display: flex; gap: 12px; align-items: flex-start; font-weight: 400; }
.checkbox input { width: 18px; height: 18px; margin-top: 4px; accent-color: var(--signal-orange); flex-shrink: 0; }

.form-alert {
  border-left: 2px solid var(--signal-orange);
  background: var(--deep-water);
  padding: 10px 14px;
  margin-bottom: 22px;
}
.form-actions { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin-top: 8px; }
button.button { font: inherit; font-weight: 600; cursor: pointer; }

.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

.contact-aside { display: grid; gap: 24px; }
.contact-item { display: flex; gap: 16px; }
.contact-item h3 { font-size: 1.05rem; margin-bottom: 0.2em; }
.contact-item p { margin: 0 0 0.3em; }
.next-steps ol { margin: 0; padding-left: 1.2em; color: var(--muted-on-dark); }
.next-steps li { margin-bottom: 0.4em; }

.thanks-icon .icon { width: 112px; height: 112px; margin: 0 auto 20px; }

/* Keep status pills and links their natural width inside flex cards */
.card-link .status, .card-link .link-arrow { align-self: flex-start; }
