/* KEEP — site styles (V1 prototype) */

/* ---------- Fonts (self-hosted, latin subset, SIL OFL) ---------- */

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

@font-face {
  font-family: "IBM Plex Mono";
  src: url("../fonts/ibm-plex-mono-latin-400.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "IBM Plex Mono";
  src: url("../fonts/ibm-plex-mono-latin-500.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

/* ---------- Tokens ---------- */

:root {
  --ink: #0a0d11;
  --ink-raised: #10151b;
  --line: #1e262f;
  --line-strong: #2e3843;
  --text: #e9ecef;
  --muted: #9aa4ae;
  --drawing: #56616d;
  --accent: #5b95f5;
  --accent-hover: #7eacf8;
  --accent-text: #8db5fa;
  --danger: #f2998d;

  --font-sans: "Archivo", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;

  --gutter: clamp(1.25rem, 4vw, 3rem);
  --max: 1240px;
  --section-space: clamp(4rem, 8vw, 6.5rem);

  color-scheme: dark;
}

/* ---------- Base ---------- */

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

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

body {
  margin: 0;
  background: var(--ink);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 1.0625rem;
  line-height: 1.6;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1,
h2,
h3,
p,
ol,
ul,
figure {
  margin: 0;
}

ol,
ul {
  padding: 0;
  list-style: none;
}

a {
  color: inherit;
}

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

.wrap {
  width: 100%;
  max-width: var(--max);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.skip-link {
  position: absolute;
  left: var(--gutter);
  top: -100px;
  z-index: 10;
  padding: 0.6rem 1rem;
  background: var(--accent);
  color: var(--ink);
  font-weight: 600;
  text-decoration: none;
}

.skip-link:focus {
  top: 1rem;
}

/* ---------- Type ---------- */

.label {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent-text);
  line-height: 1.4;
}

.section-title {
  font-size: clamp(1.75rem, 3.2vw, 2.625rem);
  font-weight: 600;
  font-stretch: 94%;
  letter-spacing: -0.02em;
  line-height: 1.08;
  text-wrap: balance;
}

.lead {
  font-size: clamp(1.125rem, 1.6vw, 1.3125rem);
  line-height: 1.55;
  color: var(--muted);
  text-wrap: pretty;
}

.lead strong {
  color: var(--text);
  font-weight: 500;
}

/* ---------- Buttons and links ---------- */

.button {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  min-height: 3rem;
  padding: 0.75rem 1.4rem;
  background: var(--accent);
  color: var(--ink);
  border-radius: 2px;
  font-size: 1rem;
  font-weight: 600;
  text-decoration: none;
  transition: background-color 160ms ease;
}

.button:hover {
  background: var(--accent-hover);
}

.button .arrow {
  transition: transform 160ms ease;
}

.button:hover .arrow,
.text-link:hover .arrow {
  transform: translateX(3px);
}

.button--small {
  min-height: 2.5rem;
  padding: 0.5rem 1rem;
  font-size: 0.9375rem;
}

.text-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text);
  font-weight: 500;
  text-decoration: none;
  border-bottom: 1px solid var(--line-strong);
  padding-block: 0.25rem;
  transition: border-color 160ms ease, color 160ms ease;
}

.text-link:hover {
  border-color: var(--accent);
}

.text-link .arrow {
  display: inline-block;
  transition: transform 160ms ease;
}

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

.site-header {
  border-bottom: 1px solid var(--line);
}

.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  min-height: 4.5rem;
}

.wordmark {
  font-size: 1.375rem;
  font-weight: 600;
  font-stretch: 112%;
  letter-spacing: 0.32em;
  margin-right: -0.32em; /* optically remove trailing tracking */
  text-decoration: none;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: clamp(1.25rem, 3vw, 2.25rem);
}

.site-nav a:not(.button) {
  color: var(--muted);
  font-size: 0.9375rem;
  text-decoration: none;
  transition: color 160ms ease;
}

.site-nav a:not(.button):hover {
  color: var(--text);
}

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

.section {
  padding-block: var(--section-space);
  border-top: 1px solid var(--line);
}

.section-grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  column-gap: clamp(1.5rem, 3vw, 3rem);
  row-gap: 2.5rem;
}

.section-head {
  grid-column: 1 / span 4;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.section-body {
  grid-column: 5 / span 8;
}

/* ---------- Hero ---------- */

.hero {
  padding-block: clamp(4rem, 9vw, 7rem) 0;
  overflow: hidden;
}

.hero .section-grid {
  align-items: end;
}

.hero-copy {
  grid-column: 1 / span 7;
  padding-bottom: clamp(3.5rem, 8vw, 6.5rem);
}

.hero-title {
  font-size: clamp(3.25rem, 8.4vw, 7.25rem);
  font-weight: 700;
  font-stretch: 88%;
  letter-spacing: -0.035em;
  line-height: 0.94;
  text-wrap: balance;
}

.hero .lead {
  max-width: 36rem;
  margin-top: clamp(1.75rem, 3vw, 2.5rem);
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem 2rem;
  margin-top: clamp(2rem, 4vw, 3rem);
}

.hero-figure {
  grid-column: 8 / span 5;
  align-self: end;
}

/* The keep: a hairline section drawing. The ground line sits on the hero's bottom edge. */
.keep-drawing {
  display: block;
  width: 100%;
  max-width: 480px;
  height: auto;
  margin-left: auto;
  margin-bottom: -1px;
  overflow: visible;
}

.keep-drawing .structure {
  fill: none;
  stroke: var(--drawing);
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
}

.keep-drawing .ground {
  stroke: var(--line-strong);
}

.keep-drawing .earth {
  stroke: var(--line-strong);
}

.keep-drawing .foundation {
  fill: none;
  stroke: var(--accent);
  stroke-width: 1.25;
  vector-effect: non-scaling-stroke;
}

.keep-drawing .foundation-hatch {
  stroke: var(--accent);
  stroke-width: 1;
  opacity: 0.45;
  vector-effect: non-scaling-stroke;
}

.keep-drawing .annotation {
  fill: var(--muted);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.08em;
}

.keep-drawing .annotation--accent {
  fill: var(--accent-text);
}

.keep-drawing .dimension {
  stroke: var(--accent);
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
}

@media (prefers-reduced-motion: no-preference) {
  .keep-drawing .draw {
    /* 1.1, not 1: the margin stops rounding from clipping line ends. */
    stroke-dasharray: 1.1;
    stroke-dashoffset: 1.1;
    animation: draw 1.4s cubic-bezier(0.65, 0, 0.35, 1) forwards;
  }

  .keep-drawing .draw--late {
    animation-delay: 0.9s;
    animation-duration: 1s;
  }

  .keep-drawing .fade-late {
    opacity: 0;
    animation: fade 0.6s ease 1.7s forwards;
  }

  @keyframes draw {
    to {
      stroke-dashoffset: 0;
    }
  }

  @keyframes fade {
    to {
      opacity: 1;
    }
  }

  .keep-drawing .foundation-hatch.fade-late {
    animation-name: fade-hatch;
  }

  @keyframes fade-hatch {
    to {
      opacity: 0.45;
    }
  }
}

/* ---------- Situations ---------- */

.situations li {
  padding-block: 1.35rem;
  border-top: 1px solid var(--line);
  font-size: clamp(1.125rem, 1.7vw, 1.375rem);
  line-height: 1.45;
  font-weight: 400;
  text-wrap: pretty;
}

.situations li:last-child {
  border-bottom: 1px solid var(--line);
}

/* ---------- Problem → work → outcome ---------- */

.flow {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.flow th {
  text-align: left;
  padding: 0 1.25rem 1rem 0;
  vertical-align: bottom;
}

.flow td {
  padding: 1.5rem 1.25rem 1.5rem 0;
  border-top: 1px solid var(--line);
  vertical-align: top;
  line-height: 1.5;
}

.flow tr:last-child td {
  border-bottom: 1px solid var(--line);
}

.flow td:nth-child(1) {
  color: var(--muted);
}

.flow td:nth-child(3) {
  color: var(--text);
  font-weight: 500;
}

.flow td:nth-child(2),
.flow td:nth-child(3) {
  position: relative;
  padding-left: 1.75rem;
}

.flow th:nth-child(2),
.flow th:nth-child(3) {
  padding-left: 1.75rem;
}

.flow td:nth-child(2)::before,
.flow td:nth-child(3)::before {
  content: "→";
  position: absolute;
  left: 0;
  top: 1.5rem;
  color: var(--accent);
  font-family: var(--font-mono);
}

.flow-note {
  margin-top: 2rem;
  color: var(--muted);
}

/* ---------- Where we work ---------- */

.cap-group + .cap-group,
.cap-split {
  margin-top: clamp(2.5rem, 5vw, 3.5rem);
}

.cap-group > .label {
  margin-bottom: 1.25rem;
}

.cap-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(1.25rem, 2.5vw, 2rem);
}

.cap {
  position: relative;
  padding-top: 1.25rem;
  border-top: 1px solid var(--line-strong);
}

.cap::before {
  content: "";
  position: absolute;
  top: -1px;
  left: 0;
  width: 2rem;
  height: 1px;
  background: var(--accent);
}

.cap h3 {
  font-size: 1.1875rem;
  font-weight: 600;
  font-stretch: 96%;
  letter-spacing: -0.005em;
  line-height: 1.25;
}

.cap p {
  margin-top: 0.6rem;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.55;
}

.cap-split {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
  gap: clamp(1.25rem, 2.5vw, 2rem);
}

.cap-split .cap-group + .cap-group {
  margin-top: 0;
}

.cap--secondary {
  border-top-color: var(--line);
}

.cap--secondary::before {
  display: none;
}

.cap--secondary h3 {
  font-size: 1.0625rem;
  font-weight: 500;
  color: var(--muted);
}

.cap-note {
  margin-top: clamp(2.5rem, 5vw, 3.5rem);
  padding-top: 1.25rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
}

/* ---------- How we work ---------- */

.steps {
  counter-reset: step;
}

.steps li {
  counter-increment: step;
  display: grid;
  grid-template-columns: 3rem minmax(0, 15rem) minmax(0, 1fr);
  gap: 0.25rem 1.5rem;
  align-items: baseline;
  padding-block: 1.25rem;
  border-top: 1px solid var(--line);
}

.steps li:last-child {
  border-bottom: 1px solid var(--line);
}

.steps li::before {
  content: counter(step, decimal-leading-zero);
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  color: var(--accent-text);
}

.steps h3 {
  font-size: 1.125rem;
  font-weight: 600;
  font-stretch: 96%;
  line-height: 1.35;
}

.steps p {
  color: var(--muted);
  line-height: 1.55;
}

.commitment {
  margin-top: clamp(2.5rem, 5vw, 3.5rem);
  padding-left: 1.5rem;
  border-left: 1px solid var(--accent);
  font-size: clamp(1.1875rem, 1.9vw, 1.5rem);
  line-height: 1.45;
  font-weight: 500;
  max-width: 40rem;
  text-wrap: pretty;
}

.commitment span {
  display: block;
  margin-top: 0.5rem;
  color: var(--muted);
  font-weight: 400;
  font-size: 0.82em;
}

/* ---------- Founder ---------- */

.founder p + p {
  margin-top: 1.5rem;
}

.founder-intro {
  font-size: clamp(1.1875rem, 1.9vw, 1.5rem);
  line-height: 1.45;
  max-width: 42rem;
  text-wrap: pretty;
}

.founder-conviction {
  font-size: clamp(1.0625rem, 1.5vw, 1.1875rem);
  color: var(--muted);
  max-width: 40rem;
}

.founder-conviction em {
  font-style: normal;
  color: var(--text);
}

.founder-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem 2rem;
  margin-top: 2.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
  max-width: 42rem;
}

/* Unresolved facts are visible in the prototype on purpose. */
.placeholder {
  background: transparent;
  color: var(--accent-text);
  border: 1px dashed var(--accent);
  padding: 0 0.3em;
  font-family: var(--font-mono);
  font-size: 0.7em;
  vertical-align: 0.12em;
  white-space: nowrap;
}

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

.cta-body {
  grid-column: 1 / span 9;
}

.cta-title {
  font-size: clamp(2.25rem, 5.4vw, 4.5rem);
  font-weight: 700;
  font-stretch: 90%;
  letter-spacing: -0.03em;
  line-height: 1;
  text-wrap: balance;
}

.cta .lead {
  margin-top: 1.75rem;
  max-width: 38rem;
}

.cta .button {
  margin-top: 2.25rem;
}

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

.site-footer {
  border-top: 1px solid var(--line);
  padding-block: 2rem;
  color: var(--muted);
  font-size: 0.875rem;
}

.site-footer .wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem 2rem;
}

.site-footer nav {
  display: flex;
  gap: 1.75rem;
}

.site-footer a {
  text-decoration: none;
  transition: color 160ms ease;
}

.site-footer a:hover {
  color: var(--text);
}

/* ---------- Placeholder pages ---------- */

.stub {
  min-height: 60vh;
  padding-block: var(--section-space);
}

.stub .section-title {
  margin-top: 1.25rem;
}

.stub .lead {
  margin-top: 1.25rem;
  max-width: 34rem;
}

.stub .text-link {
  margin-top: 2.5rem;
}

/* ---------- Request page ---------- */

.request {
  padding-block: clamp(3.5rem, 7vw, 5.5rem) var(--section-space);
}

.request-intro {
  align-self: start;
  position: sticky;
  top: 2rem;
}

.request-intro .lead {
  font-size: clamp(1.0625rem, 1.4vw, 1.1875rem);
}

.request-next {
  margin-top: 1rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--line);
}

.request-next ol {
  margin-top: 0.85rem;
  counter-reset: next;
}

.request-next li {
  counter-increment: next;
  display: grid;
  grid-template-columns: 2rem minmax(0, 1fr);
  padding-block: 0.3rem;
  color: var(--muted);
  font-size: 0.9375rem;
  line-height: 1.5;
}

.request-next li::before {
  content: counter(next, decimal-leading-zero);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  line-height: 1.9;
  color: var(--accent-text);
}

.form-notice {
  padding: 1rem 1.25rem;
  border-left: 1px solid var(--accent);
  background: var(--ink-raised);
  color: var(--muted);
  font-size: 0.9375rem;
  line-height: 1.55;
}

.form-group {
  margin: clamp(2.25rem, 4vw, 3rem) 0 0;
  padding: 0;
  border: 0;
  min-width: 0;
}

.form-group > legend {
  width: 100%;
  padding: 0 0 1rem;
  border-bottom: 1px solid var(--line);
  margin-bottom: 1.5rem;
}

.field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.5rem;
}

.field + .field,
.choices + .field-error + .field,
.choices + .field {
  margin-top: 1.75rem;
}

.field-grid .field + .field {
  margin-top: 0;
}

.field label,
.field-question {
  display: block;
  font-size: 0.9375rem;
  font-weight: 500;
  line-height: 1.4;
  margin-bottom: 0.5rem;
}

.optional {
  margin-left: 0.35rem;
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  font-weight: 400;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.field-hint {
  margin: -0.25rem 0 0.6rem;
  color: var(--muted);
  font-size: 0.875rem;
  line-height: 1.5;
}

.field input,
.field textarea {
  display: block;
  width: 100%;
  padding: 0.75rem 0.9rem;
  background: var(--ink-raised);
  color: var(--text);
  border: 1px solid var(--line-strong);
  border-radius: 2px;
  font: inherit;
  font-size: 1rem;
  line-height: 1.5;
  transition: border-color 160ms ease;
}

.field textarea {
  resize: vertical;
  min-height: 7rem;
}

.field input:hover,
.field textarea:hover {
  border-color: var(--drawing);
}

.field input:focus-visible,
.field textarea:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
  border-color: var(--accent);
}

.field [aria-invalid="true"] {
  border-color: var(--danger);
}

.field-error {
  margin-top: 0.5rem;
  color: var(--danger);
  font-size: 0.875rem;
  line-height: 1.45;
}

.choices {
  display: grid;
  gap: 0;
}

.choice {
  display: flex;
  align-items: baseline;
  gap: 0.85rem;
  padding: 0.85rem 1rem;
  border: 1px solid var(--line);
  margin-top: -1px;
  color: var(--muted);
  line-height: 1.45;
  cursor: pointer;
  transition: border-color 160ms ease, color 160ms ease, background-color 160ms ease;
}

.choice:hover {
  color: var(--text);
  border-color: var(--line-strong);
  position: relative;
}

.choice:has(input:checked) {
  position: relative;
  color: var(--text);
  border-color: var(--accent);
  background: var(--ink-raised);
}

.choice input {
  flex: none;
  margin: 0;
  accent-color: var(--accent);
  transform: translateY(0.1em);
}

.choice:has(input:focus-visible) {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
  position: relative;
}

.choice input:focus-visible {
  outline: none;
}

.choices--inline {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.choices--inline .choice {
  margin-left: -1px;
}

.choices--inline .choice:first-child {
  margin-left: 0;
}

.form-submit {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem 1.75rem;
  margin-top: clamp(2.5rem, 5vw, 3.25rem);
  padding-top: 1.75rem;
  border-top: 1px solid var(--line);
}

.form-submit .button {
  border: 0;
  cursor: pointer;
  font-family: inherit;
}

.form-privacy {
  color: var(--muted);
  font-size: 0.875rem;
  line-height: 1.5;
  max-width: 26rem;
}

.form-privacy a {
  color: var(--text);
  text-decoration-color: var(--line-strong);
  text-underline-offset: 0.2em;
}

.form-privacy a:hover {
  text-decoration-color: var(--accent);
}

.form-status {
  margin-top: 1.5rem;
  padding: 1rem 1.25rem;
  border: 1px solid var(--line-strong);
  border-left-color: var(--accent);
  color: var(--text);
  font-size: 0.9375rem;
}

/* ---------- Responsive ---------- */

@media (max-width: 960px) {
  .section-head,
  .section-body,
  .cta-body,
  .hero-copy,
  .hero-figure {
    grid-column: 1 / -1;
  }

  .section-grid {
    row-gap: 2rem;
  }

  .hero-copy {
    padding-bottom: 0;
  }

  .request-intro {
    position: static;
  }

  .keep-drawing {
    max-width: 300px;
    margin-inline: auto 0;
  }

  .site-nav .nav-link {
    display: none;
  }
}

@media (max-width: 720px) {
  .field-grid,
  .choices--inline {
    grid-template-columns: minmax(0, 1fr);
  }

  .choices--inline .choice {
    margin-left: 0;
  }

  .cap-grid,
  .cap-split {
    grid-template-columns: minmax(0, 1fr);
  }

  .steps li {
    grid-template-columns: 2.5rem minmax(0, 1fr);
  }

  .steps li p {
    grid-column: 2;
  }

  /* Table becomes stacked rows; column names move into each cell. */
  .flow,
  .flow tbody,
  .flow tr,
  .flow td {
    display: block;
  }

  .flow thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
  }

  .flow tr {
    padding-block: 1.25rem;
    border-top: 1px solid var(--line);
  }

  .flow tr:last-child {
    border-bottom: 1px solid var(--line);
  }

  .flow td,
  .flow tr:last-child td {
    border: 0;
    padding: 0.35rem 0;
  }

  .flow td:nth-child(2),
  .flow td:nth-child(3) {
    padding-left: 0;
  }

  /* Same specificity as the desktop arrow rule; declared later, so it wins. */
  .flow td[data-label]::before {
    content: attr(data-label);
    display: block;
    position: static;
    margin-bottom: 0.15rem;
    font-family: var(--font-mono);
    font-size: 0.6875rem;
    font-weight: 500;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--accent-text);
  }

  .site-nav .nav-about {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    transition: none !important;
    animation: none !important;
  }
}
