/* =============================================================================
   Bedrock Airfield Wedge — microsite styles
   Design tokens derived from bedrockrobotics.com (computed CSS), recreated as
   original styling. Fine-tune the brand by editing the :root block below.
   ============================================================================= */

/* ---- Self-hosted substitute font ----------------------------------------- */
/* Bedrock ships Replica LL Web (Lineto, licensed). Substituted with
   Space Grotesk (SIL OFL) — closest free technical-grotesque rhyme. */
@font-face {
  font-family: "Space Grotesk";
  src: url("fonts/space-grotesk-400.woff2") format("woff2");
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Space Grotesk";
  src: url("fonts/space-grotesk-500.woff2") format("woff2");
  font-weight: 500; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Space Grotesk";
  src: url("fonts/space-grotesk-700.woff2") format("woff2");
  font-weight: 700; font-style: normal; font-display: swap;
}

/* ---- Design tokens -------------------------------------------------------- */
:root {
  /* COLOR — source: bedrockrobotics.com computed CSS (warm, earthy palette) */
  --bg:           #f0ebe5;  /* page background — warm cream (--background) */
  --surface:      #fcf6ee;  /* lightest cream — cards, table head */
  --surface-2:    #ede7df;  /* cream step — hover, accordion bodies */
  --surface-3:    #e2dbd5;  /* deeper cream */
  --ink:          #45413a;  /* primary body text (deepened from brand #575349 for AA) */
  --ink-strong:   #2b2823;  /* headings — near-black warm */
  --ink-soft:     #6a6457;  /* secondary text / meta */
  --ink-muted:    #8c8073;  /* decorative only (brand --lines) */
  --line:         #ddd5ca;  /* hairline rules on cream */
  --line-strong:  #b4ac9d;  /* stronger borders (brand) */
  --accent:       #ffe29b;  /* amber highlight fill (--highlight) */
  --accent-2:     #f3cd72;  /* mid amber */
  --accent-deep:  #86590a;  /* dark gold — text/icon accents on cream (AA on cream) */
  --bg-dark:      #4f4a40;  /* dark warm taupe — footer (brand --background dark) */
  --on-dark:      #f0ebe5;  /* text on dark */
  --on-dark-soft: #c9c1b3;  /* muted text on dark */

  /* TYPE */
  --font: "Space Grotesk", ui-sans-serif, system-ui, -apple-system, "Segoe UI",
          Roboto, Helvetica, Arial, sans-serif;
  --fw-reg: 400; --fw-med: 500; --fw-bold: 700;

  /* SPACE — adapted from brand --s-* scale */
  --s-1: .5rem;  --s-2: 1rem;   --s-3: 1.5rem; --s-4: 2rem;
  --s-5: 3rem;   --s-6: 4.5rem; --s-7: 7rem;
  --maxw: 50rem;          /* reading column */
  --maxw-wide: 72rem;     /* nav / full-bleed inner */
  --header-h: 3.5rem;

  /* RADII + MOTION — brand */
  --radius: .375rem; --radius-sm: .125rem;
  --ease: cubic-bezier(.165, .84, .44, 1);
}

/* ---- Reset / base --------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 1rem);
  color-scheme: light;
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}
body {
  font-family: var(--font);
  font-weight: var(--fw-reg);
  font-size: 1.1875rem;       /* ~19px — Bedrock body scale */
  line-height: 1.5;
  letter-spacing: -.01em;     /* Bedrock copy tracking */
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
::selection { background: var(--accent); color: var(--ink-strong); }

img, svg { display: block; max-width: 100%; }
strong { font-weight: var(--fw-med); color: var(--ink-strong); }
em { font-style: italic; }

/* ---- Links ---------------------------------------------------------------- */
a { color: var(--ink-strong); }
.section a:not(.btn-ghost),
.memo-header a,
.source-list a {
  color: var(--ink-strong);
  text-decoration: underline;
  text-decoration-color: var(--accent-2);
  text-decoration-thickness: .12em;
  text-underline-offset: .18em;
  transition: text-decoration-color .18s var(--ease), color .18s var(--ease);
}
.section a:not(.btn-ghost):hover,
.memo-header a:hover,
.source-list a:hover {
  text-decoration-color: var(--accent-deep);
  color: var(--accent-deep);
}

/* ---- Focus ---------------------------------------------------------------- */
:focus-visible {
  outline: 2.5px solid var(--accent-deep);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* ---- Skip link ------------------------------------------------------------ */
.skip-link {
  position: absolute; left: .75rem; top: -3.5rem;
  z-index: 100;
  background: var(--ink-strong); color: var(--bg);
  padding: .6rem 1rem; border-radius: var(--radius);
  text-decoration: none; font-weight: var(--fw-med);
  transition: top .2s var(--ease);
}
.skip-link:focus { top: .75rem; }

/* ---- Sticky nav ----------------------------------------------------------- */
.nav {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(140%) blur(8px);
  -webkit-backdrop-filter: saturate(140%) blur(8px);
  border-bottom: 1px solid var(--line);
}
.nav-inner {
  max-width: var(--maxw-wide); margin-inline: auto;
  height: var(--header-h);
  padding-inline: clamp(1rem, 4vw, 2rem);
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
}
.nav-brand {
  display: inline-flex; align-items: center; gap: .55rem;
  text-decoration: none; color: var(--ink-strong);
  font-weight: var(--fw-med); white-space: nowrap;
}
.nav-brand-mark {
  display: inline-grid; place-items: center;
  width: 1.7rem; height: 1.7rem;
  background: var(--ink-strong); color: var(--bg);
  border-radius: var(--radius-sm);
  font-size: .72rem; font-weight: var(--fw-bold); letter-spacing: .02em;
}
.nav-brand-text { font-size: .95rem; letter-spacing: -.01em; }
.nav-links { display: flex; gap: clamp(.4rem, 2vw, 1.4rem); align-items: center; }
.nav-link {
  position: relative;
  text-decoration: none; color: var(--ink-soft);
  font-size: .88rem; font-weight: var(--fw-med);
  padding: .35rem .1rem;
  white-space: nowrap;
  transition: color .18s var(--ease);
}
.nav-link::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -2px; height: 2px;
  background: var(--accent-deep); transform: scaleX(0); transform-origin: left;
  transition: transform .2s var(--ease);
}
.nav-link:hover { color: var(--ink-strong); }
.nav-link.is-active { color: var(--ink-strong); }
.nav-link.is-active::after { transform: scaleX(1); }

/* ---- Layout containers ---------------------------------------------------- */
main { display: block; }
.hero-inner, .disclaimer, .memo-header, .section {
  max-width: var(--maxw);
  margin-inline: auto;
  padding-inline: clamp(1.1rem, 5vw, 2rem);
}

/* ---- Hero ----------------------------------------------------------------- */
.hero { padding-top: clamp(3rem, 8vw, var(--s-7)); padding-bottom: var(--s-2); }
.eyebrow {
  text-transform: uppercase; letter-spacing: .16em;
  font-size: .74rem; font-weight: var(--fw-med);
  color: var(--ink-soft);
  margin-bottom: var(--s-4);
}
.hero-title {
  font-weight: var(--fw-med);
  font-size: clamp(2.7rem, 7vw, 4.75rem);   /* Bedrock-scale display */
  line-height: .96; letter-spacing: -.03em;
  color: var(--ink-strong);
  max-width: 19ch;
}
.hero-lede {
  margin-top: var(--s-4);
  font-size: clamp(1.3rem, 2.6vw, 1.6rem);  /* copy-lg subtitle */
  line-height: 1.3; letter-spacing: -.01em;
  color: var(--ink-soft);                   /* muted subtitle, Bedrock style */
  max-width: 40ch;
}
/* article meta row: author (name + role) | read-time · date */
.article-meta {
  margin-top: var(--s-5);
  padding-top: var(--s-3);
  border-top: 1px solid var(--line);
  display: flex; flex-wrap: wrap; justify-content: space-between;
  align-items: baseline; gap: .4rem 2rem;
  letter-spacing: 0;
}
.author { display: flex; flex-direction: column; gap: .15rem; }
.author-name { font-weight: var(--fw-med); color: var(--ink); font-size: 1rem; }
.author-role { color: var(--ink-soft); font-size: .9rem; max-width: 52ch; line-height: 1.35; }
.article-meta-right {
  display: flex; align-items: baseline; gap: .5rem;
  font-size: .9rem; color: var(--ink-soft); white-space: nowrap;
}
.read-time { color: var(--ink); font-weight: var(--fw-med); }
.meta-sep { color: var(--line-strong); }

/* ---- Disclaimer ----------------------------------------------------------- */
.disclaimer { margin-top: var(--s-5); }
.disclaimer p {
  border-left: 3px solid var(--accent-deep);
  background: var(--surface);
  padding: var(--s-3) var(--s-3);
  border-radius: 0 var(--radius) var(--radius) 0;
  font-size: .92rem; line-height: 1.5; color: var(--ink-soft);
}

/* ---- Memo header (To / From / Date / Re) ---------------------------------- */
.memo-header {
  margin-top: var(--s-5);
  border-top: 1px solid var(--line);
  padding-top: var(--s-3);
}
.memo-to { font-size: .95rem; color: var(--ink); }
.memo-to-label {
  text-transform: uppercase; letter-spacing: .1em;
  font-size: .7rem; font-weight: var(--fw-med);
  color: var(--ink-soft); margin-right: .7rem;
}
.memo-probono {
  margin-top: var(--s-3);
  font-size: .88rem; color: var(--ink-soft); line-height: 1.45;
}

/* ---- Sections ------------------------------------------------------------- */
.section { padding-top: var(--s-6); }
.section--appendices, #sources { padding-top: var(--s-6); }
.section-head {
  display: flex; align-items: baseline; gap: 1rem;
  padding-bottom: var(--s-3); margin-bottom: var(--s-4);
  border-bottom: 1.5px solid var(--ink-strong);
}
.section-index {
  font-size: .8rem; font-weight: var(--fw-med);
  color: var(--accent-deep); letter-spacing: .05em;
  font-variant-numeric: tabular-nums;
}
.section-h {
  font-size: clamp(1.7rem, 3.4vw, 2.3rem);
  font-weight: var(--fw-med); letter-spacing: -.02em;
  color: var(--ink-strong); line-height: 1.1;
}

/* memo subsection headings (Bottom line, Why now, ...) */
.section-title {
  font-size: clamp(1.3rem, 2.6vw, 1.55rem);
  font-weight: var(--fw-med); letter-spacing: -.01em;
  color: var(--ink-strong);
  margin-top: var(--s-5); margin-bottom: var(--s-2);
  padding-top: var(--s-2);
  scroll-margin-top: calc(var(--header-h) + 1rem);
}
.section-title:first-of-type { margin-top: var(--s-2); }

/* ---- Body copy ------------------------------------------------------------ */
.section p { margin-bottom: var(--s-3); max-width: 64ch; }
.section p.lead { color: var(--ink-soft); font-style: italic; }
.bullets {
  list-style: none; padding: 0;
  margin: 0 0 var(--s-3);
  max-width: 66ch;
}
.bullets li {
  position: relative;
  padding-left: 1.5rem;
  margin-bottom: var(--s-2);
  line-height: 1.55;
}
.bullets li:last-child { margin-bottom: 0; }
.bullets li::before {
  content: ""; position: absolute; left: 0; top: .62em;
  width: .5rem; height: .5rem;
  background: var(--accent-2);
  border: 1px solid var(--accent-deep);
  border-radius: 1px;
  transform: rotate(45deg);
}
/* nested sub-bullets: no default marker, indented, subtler hollow diamond */
.bullets ul {
  list-style: none;
  margin: var(--s-2) 0 0 .6rem;
  padding-left: 0;
}
.bullets ul li { margin-bottom: var(--s-1); }
.bullets ul li::before {
  width: .42rem; height: .42rem;
  top: .6em;
  background: transparent;
  border-color: var(--ink-muted);
}

/* ---- Sizing tables -------------------------------------------------------- */
.table-wrap {
  margin: var(--s-4) 0;
  overflow-x: auto;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  -webkit-overflow-scrolling: touch;
}
.table-wrap:focus-visible { outline-offset: -2px; }
table.sizing {
  width: 100%; border-collapse: collapse;
  font-size: .94rem; min-width: 34rem;
  background: var(--surface);
}
table.sizing thead th {
  text-align: left;
  background: var(--surface-3);
  color: var(--ink-strong);
  font-weight: var(--fw-med);
  font-size: .76rem; text-transform: uppercase; letter-spacing: .07em;
  padding: .7rem .9rem;
  border-bottom: 1.5px solid var(--line-strong);
}
table.sizing tbody th[scope="row"] {
  text-align: left; vertical-align: top;
  font-weight: var(--fw-med); color: var(--ink-strong);
  padding: .8rem .9rem;
  white-space: nowrap;
  border-left: 3px solid var(--accent-2);
}
table.sizing tbody td {
  vertical-align: top; padding: .8rem .9rem;
  border-top: 1px solid var(--line);
  color: var(--ink);
}
table.sizing tbody th[scope="row"] { border-top: 1px solid var(--line); }
table.sizing tbody tr:first-child th,
table.sizing tbody tr:first-child td { border-top: 0; }
.sizing-amount {
  font-weight: var(--fw-med); color: var(--ink-strong);
  font-variant-numeric: tabular-nums; white-space: nowrap;
}
.sizing-note {
  font-size: .88rem; color: var(--ink-soft);
  margin-top: calc(var(--s-4) * -.4) !important;
  margin-bottom: var(--s-3);
}

/* ---- Appendices (collapsible) -------------------------------------------- */
.appendices-intro { color: var(--ink-soft); font-size: .95rem; margin-bottom: var(--s-4); }
.appendix {
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
  margin-bottom: var(--s-3);
  scroll-margin-top: calc(var(--header-h) + 1rem);
  overflow: hidden;
}
.appendix[open] { background: var(--bg); }
.appendix-summary {
  list-style: none; cursor: pointer;
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-areas: "kicker chevron" "name chevron";
  align-items: center; gap: .1rem 1rem;
  padding: var(--s-3) var(--s-4);
  transition: background .18s var(--ease);
}
.appendix-summary::-webkit-details-marker { display: none; }
.appendix-summary:hover { background: var(--surface-2); }
.appendix-kicker {
  grid-area: kicker;
  text-transform: uppercase; letter-spacing: .12em;
  font-size: .72rem; font-weight: var(--fw-med); color: var(--accent-deep);
}
.appendix-name {
  grid-area: name;
  font-size: clamp(1.15rem, 2.4vw, 1.4rem); font-weight: var(--fw-med);
  color: var(--ink-strong); letter-spacing: -.01em; line-height: 1.2;
}
.appendix-chevron {
  grid-area: chevron;
  width: .85rem; height: .85rem;
  border-right: 2px solid var(--ink-soft); border-bottom: 2px solid var(--ink-soft);
  transform: rotate(45deg); transition: transform .2s var(--ease);
}
.appendix[open] .appendix-chevron { transform: rotate(-135deg); }
.appendix-body {
  padding: 0 var(--s-4) var(--s-4);
  border-top: 1px solid var(--line);
  margin-top: 0;
}
.appendix-body > *:first-child { margin-top: var(--s-3); }
.appendix-body p { max-width: 64ch; }

/* ---- Footnote references (inline superscripts) --------------------------- */
sup.ref { line-height: 0; font-size: .68em; white-space: nowrap; }
.section sup.ref a,
sup.ref a {
  text-decoration: none;
  color: var(--accent-deep);
  font-weight: var(--fw-med);
  padding: 0 .15em;
  font-variant-numeric: tabular-nums;
  border-radius: 2px;
}
.section sup.ref a:hover,
sup.ref a:hover { color: var(--ink-strong); background: var(--accent); }

/* ---- Margin sidenotes (hidden by default; shown in margin >= 1000px) ----- */
.sidenote { display: none; }
.sidenote-num {
  color: var(--accent-deep); font-weight: var(--fw-med);
  text-decoration: none; margin-right: .4em;
  font-variant-numeric: tabular-nums;
}
.sidenote .src-link { display: inline; }

/* ---- Sources / numbered References list ---------------------------------- */
.sources-intro {
  color: var(--ink); font-size: .96rem;
  max-width: 64ch; margin-bottom: var(--s-4);
}
.ref-list { list-style: none; padding: 0; margin: 0; }
.ref-item {
  display: grid; grid-template-columns: 2rem 1fr; gap: .2rem 1rem;
  padding: var(--s-3) 0;
  border-top: 1px solid var(--line);
  scroll-margin-top: calc(var(--header-h) + 1rem);
  border-radius: var(--radius);
}
.ref-item:first-child { border-top: 0; }
.ref-num {
  font-weight: var(--fw-med); color: var(--accent-deep);
  font-variant-numeric: tabular-nums; font-size: .95rem;
}
.ref-content { min-width: 0; }
.ref-text { margin: 0 0 .35rem !important; font-size: .95rem; max-width: 62ch; }
.ref-tag {
  display: inline-block; margin-left: .35rem;
  font-size: .66rem; text-transform: uppercase; letter-spacing: .08em;
  color: var(--ink-soft); background: var(--surface-2);
  border: 1px solid var(--line); border-radius: 999px;
  padding: .05rem .5rem; vertical-align: middle; white-space: nowrap;
}
.ref-links { margin: 0 !important; display: flex; flex-wrap: wrap; gap: .1rem 1.1rem; }
.src-link {
  word-break: break-word; overflow-wrap: anywhere;
  font-size: .82rem; color: var(--ink-soft);
}
.ref-item:target {
  background: color-mix(in srgb, var(--accent) 32%, transparent);
  animation: ref-flash 1.8s var(--ease);
  padding-inline: .6rem; margin-inline: -.6rem;
}
@keyframes ref-flash {
  0% { background: var(--accent); }
  100% { background: color-mix(in srgb, var(--accent) 20%, transparent); }
}

/* ---- Annotated two-column layout (text + margin citations) --------------- */
@media (min-width: 1080px) {
  .nav-inner, .hero-inner, .disclaimer, .memo-header,
  .section { max-width: 64rem; }
  /* reading column ~42rem (frame 64 - 4 section padding - 18 gutter); gutter = 18rem */
  .annotated { padding-right: 18rem; }
  /* let body text fill the reading column instead of a narrow ch cap */
  .annotated p, .annotated .bullets, .annotated .sizing-note,
  .appendix-body p { max-width: none; }
  .annotated .table-wrap { clear: right; margin-right: -12rem; } /* tables span wider, no notes here */
  .sidenote {
    display: block;
    float: right; clear: right;
    width: 16rem; margin-right: -18rem;
    margin-top: .1rem; margin-bottom: 1.4rem;
    padding: .35rem 0 .35rem .85rem;
    border-left: 2px solid var(--accent-2);
    font-size: .78rem; line-height: 1.5; color: var(--ink-soft);
    text-indent: 0;
  }
  .sidenote .src-link { font-size: .74rem; }
}

/* ---- Footer --------------------------------------------------------------- */
.footer {
  margin-top: var(--s-7);
  background: var(--bg-dark); color: var(--on-dark);
}
.footer-inner {
  max-width: var(--maxw); margin-inline: auto;
  padding: var(--s-6) clamp(1.1rem, 5vw, 2rem) var(--s-5);
}
.footer-title { font-weight: var(--fw-med); font-size: 1.05rem; color: var(--on-dark); max-width: 30ch; }
.footer-byline { margin-top: var(--s-3); color: var(--on-dark-soft); font-size: .92rem; }
.footer-date { color: var(--on-dark-soft); font-size: .92rem; }
.footer-disclaimer {
  margin-top: var(--s-3); padding-top: var(--s-3);
  border-top: 1px solid color-mix(in srgb, var(--on-dark) 22%, transparent);
  color: var(--on-dark-soft); font-size: .82rem; max-width: 60ch; line-height: 1.5;
}
.footer-link { margin-top: var(--s-3); }
.footer-link a {
  color: var(--accent); text-decoration: underline;
  text-decoration-color: color-mix(in srgb, var(--accent) 45%, transparent);
  text-underline-offset: .18em; font-size: .92rem;
}
.footer-link a:hover { text-decoration-color: var(--accent); }

/* ---- Responsive ----------------------------------------------------------- */
@media (max-width: 600px) {
  .nav-brand-text { display: none; }
  .nav-links { gap: .9rem; }
  .article-meta { gap: .6rem 1.5rem; }
  table.sizing { font-size: .88rem; }
}
@media (max-width: 400px) {
  .nav-link { font-size: .82rem; }
}

/* ---- Print ---------------------------------------------------------------- */
@media print {
  :root { --bg: #fff; --ink: #1a1a1a; --ink-strong: #000; --ink-soft: #333; }
  html { scroll-behavior: auto; }
  body { font-size: 11pt; line-height: 1.4; background: #fff; color: #000; }
  .nav, .skip-link, .sources-controls, .nav-brand-mark { display: none !important; }
  .footer { background: #fff; color: #000; border-top: 1.5px solid #000; }
  .footer-byline, .footer-date, .footer-disclaimer, .footer-title { color: #000; }
  .footer-link a { color: #000; }
  a { color: #000 !important; }
  .hero-inner, .disclaimer, .memo-header, .section, .footer-inner { max-width: none; }
  .disclaimer p { background: none; border-left: 2px solid #000; }
  /* expand all collapsibles for print (JS also forces open on beforeprint) */
  details { border-color: #888 !important; background: #fff !important; }
  .appendix-chevron { display: none; }
  table.sizing { background: #fff; }
  table.sizing thead th { background: #f0f0f0; }
  .section, .appendix, .ref-item, table.sizing tr { page-break-inside: avoid; }
  .section-head { border-bottom: 1.5px solid #000; }
  /* citations: drop the margin gutter, render sidenotes inline as footnotes */
  .annotated { padding-right: 0; }
  .annotated .table-wrap { margin-right: 0; }
  .sidenote {
    display: block; float: none; clear: both;
    width: auto; margin: .4rem 0 .8rem;
    padding-left: .8rem; border-left: 2px solid #888;
    font-size: 9.5pt; color: #222;
  }
  sup.ref a { color: #000; }
  .ref-item:target { background: none; }
  .src-link { color: #000; }
}
