/* Flankline site styles. Brand tokens live in :root so a future rebrand is one edit. */
:root {
  --paper: #FCFCFD;
  --paper-2: #F1F3F6;
  --ink: #151B2C;
  --ink-2: #3B4457;
  --muted: #5F6878;
  --rule: #D9DDE4;
  --hl: #FFE14D;           /* highlighter: marks checked facts and active sources */
  --hl-soft: rgba(255, 225, 77, 0.55);
  --link: #2443B0;
  --btn-bg: #151B2C;
  --btn-fg: #FCFCFD;
  --radius: 8px;
  --measure: 40rem;
  --wide: 64rem;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI Variable Text", "Segoe UI", system-ui, Roboto, "Helvetica Neue", Arial, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #0F131C;
    --paper-2: #171C27;
    --ink: #E9ECF2;
    --ink-2: #C5CBD6;
    --muted: #98A1B2;
    --rule: #2A3242;
    --hl: #FFD83D;
    --hl-soft: rgba(255, 216, 61, 0.28);
    --link: #93A9FF;
    --btn-bg: #E9ECF2;
    --btn-fg: #0F131C;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 1rem; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font);
  font-size: 1.0625rem;
  line-height: 1.6;
  padding-left: env(safe-area-inset-left, 0px);
  padding-right: env(safe-area-inset-right, 0px);
}
img { max-width: 100%; }
a { color: var(--link); text-underline-offset: 0.18em; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--link); outline-offset: 3px; border-radius: 3px; }

.skip { position: absolute; left: -999px; top: 0.5rem; background: var(--ink); color: var(--paper); padding: 0.5rem 0.9rem; border-radius: var(--radius); z-index: 100; }
.skip:focus { left: 0.75rem; }

.wrap { max-width: var(--wide); margin: 0 auto; padding: 0 1.25rem; }
.prose { max-width: var(--measure); }
.wrap.prose { max-width: var(--wide); }
.wrap.prose > * { max-width: var(--measure); }

/* Header */
.top {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding-top: calc(1rem + env(safe-area-inset-top, 0px)); padding-bottom: 1rem;
}
.brand {
  font-weight: 800; font-size: 1.25rem; letter-spacing: -0.02em; color: var(--ink); text-decoration: none;
  background: linear-gradient(transparent 82%, var(--hl) 82%, var(--hl) 96%, transparent 96%);
  padding: 0 0.05em 0.1em;
}
.top nav { display: flex; align-items: center; gap: 1.1rem; font-size: 0.95rem; }
.top nav a:not(.btn) { color: var(--ink-2); text-decoration: none; }
.top nav a:not(.btn):hover { color: var(--ink); text-decoration: underline; }

/* Type */
h1, h2, h3 { line-height: 1.15; letter-spacing: -0.02em; margin: 0 0 0.75rem; }
h1 { font-size: clamp(2.2rem, 6vw, 3.5rem); font-weight: 800; letter-spacing: -0.035em; max-width: 14ch; }
h2 { font-size: clamp(1.5rem, 3.4vw, 1.9rem); font-weight: 760; }
h3 { font-size: 1.15rem; font-weight: 720; }
p { margin: 0 0 1rem; }
.lede { font-size: 1.2rem; color: var(--ink-2); max-width: 36rem; }
.small { font-size: 0.9rem; color: var(--muted); }
strong { font-weight: 700; }

/* Buttons */
.btn {
  display: inline-block; background: var(--btn-bg); color: var(--btn-fg); text-decoration: none;
  font-weight: 650; padding: 0.85rem 1.2rem; border-radius: var(--radius); line-height: 1.25;
  border: 2px solid var(--btn-bg);
}
.btn:hover { background: transparent; color: var(--ink); }
.btn-small { padding: 0.5rem 0.8rem; font-size: 0.9rem; }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem 1.25rem; margin: 1.5rem 0 0.75rem; }

/* Sections */
main section { padding: 3.25rem 0; border-top: 1px solid var(--rule); }
main section.hero { border-top: 0; padding-top: 2rem; }
.alt { background: var(--paper-2); }
ul.plain, ol.steps { padding-left: 1.2rem; margin: 0 0 1rem; }
ul.plain li, ol.steps li { margin-bottom: 0.6rem; }
ol.steps li::marker { font-weight: 800; color: var(--ink); }

/* Hero */
.hero-grid { display: grid; gap: 2.25rem; align-items: start; }
@media (min-width: 900px) { .hero-grid { grid-template-columns: 1.15fr 0.85fr; gap: 3rem; } }
.proof {
  border: 1px solid var(--rule); border-radius: 12px; background: var(--paper-2); padding: 1.25rem 1.25rem 1rem;
}
.proof h2 { font-size: 1.05rem; font-weight: 720; margin-bottom: 0.6rem; }
.proof p.claim { font-size: 1.12rem; line-height: 1.7; }
.proof ol { font-size: 0.85rem; color: var(--muted); list-style: none; padding-left: 0; margin: 0.75rem 0 0; }
.proof ol li { margin-bottom: 0.25rem; }

mark { background: linear-gradient(transparent 38%, var(--hl-soft) 38%); color: inherit; padding: 0 0.05em; }

/* Source chips: tap to open the source drawer */
a.cite {
  position: relative; display: inline-flex; align-items: center; justify-content: center;
  min-width: 1.45em; height: 1.45em; padding: 0 0.3em; margin-left: 0.12em;
  font-size: 0.72em; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1;
  color: var(--ink); background: var(--paper); border: 1px solid var(--rule); border-radius: 4px;
  text-decoration: none; vertical-align: 0.18em;
}
a.cite::after { content: ""; position: absolute; inset: -9px -5px; } /* bigger tap target */
a.cite:hover, a.cite[aria-expanded="true"] { background: var(--hl); border-color: var(--hl); color: #151B2C; }

.ours-tag {
  display: inline-block; font-size: 0.78em; font-weight: 700; color: var(--ink-2);
  border: 1px dashed var(--muted); border-radius: 4px; padding: 0 0.35em; margin-right: 0.3em; line-height: 1.5;
}
.ours { color: var(--ink-2); }

/* Tables */
.table-wrap { overflow-x: auto; margin: 0 0 1.25rem; -webkit-overflow-scrolling: touch; }
table { border-collapse: collapse; width: 100%; font-size: 0.95rem; }
.table-wrap table { min-width: 34rem; }
th, td { text-align: left; vertical-align: top; padding: 0.7rem 0.75rem 0.7rem 0; border-bottom: 1px solid var(--rule); }
thead th { font-size: 0.85rem; color: var(--muted); font-weight: 650; border-bottom: 2px solid var(--ink); }
tbody th { font-weight: 700; }
td.num { font-variant-numeric: tabular-nums; font-weight: 700; white-space: nowrap; }

.plans td.num { font-size: 1.15rem; }
.callout { border-left: 4px solid var(--hl); padding: 0.25rem 0 0.25rem 1rem; margin: 1.5rem 0; }
.callout h3 { margin-bottom: 0.4rem; }

/* Sample teardown */
.doc-head { padding: 2rem 0 1.5rem; }
.doc-head h1 { max-width: 20ch; }
.doc-meta { font-size: 0.92rem; color: var(--muted); max-width: var(--measure); }
.doc section { padding: 2.25rem 0; }
.doc h2 .n { font-variant-numeric: tabular-nums; color: var(--muted); font-weight: 700; margin-right: 0.35em; }
.doc ul { padding-left: 1.2rem; }
.doc li { margin-bottom: 0.55rem; }
.doc li ul { margin-top: 0.5rem; }
.side { font-weight: 700; margin: 1.25rem 0 0.5rem; }
blockquote.say { margin: 0.25rem 0 0; padding-left: 0.9rem; border-left: 2px solid var(--rule); color: var(--ink-2); }
ol.sources { padding-left: 0; list-style: none; font-size: 0.95rem; }
ol.sources li { margin-bottom: 0.6rem; }
ol.sources li:target { background: var(--hl-soft); border-radius: 4px; }
ol.sources .sn { font-variant-numeric: tabular-nums; font-weight: 700; margin-right: 0.4em; }

.cta-box { border: 2px solid var(--ink); border-radius: 12px; padding: 1.5rem; margin-top: 0.5rem; }
.cta-box p:last-child { margin-bottom: 0; }

/* Source drawer */
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 60;
  background: var(--paper); color: var(--ink);
  border-top: 4px solid var(--hl);
  box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.18);
  padding: 1rem 1.25rem calc(1.1rem + env(safe-area-inset-bottom, 0px));
  transform: translateY(110%); visibility: hidden;
  transition: transform 0.2s ease, visibility 0s linear 0.2s;
}
.sheet.open { transform: none; visibility: visible; transition: transform 0.2s ease; }
.sheet-inner { max-width: var(--measure); margin: 0 auto; display: grid; grid-template-columns: 1fr auto; gap: 0.25rem 1rem; align-items: start; }
.sheet-label { font-size: 0.85rem; font-weight: 700; color: var(--muted); margin: 0; }
.sheet-body { grid-column: 1 / 2; margin: 0; }
.sheet-close {
  grid-column: 2; grid-row: 1 / span 2; background: transparent; color: var(--ink);
  border: 1px solid var(--rule); border-radius: var(--radius); font: inherit; font-size: 0.9rem; padding: 0.4rem 0.75rem; cursor: pointer;
}
@media (prefers-reduced-motion: reduce) { .sheet, .sheet.open { transition: none; } }

/* Footer */
.foot { border-top: 1px solid var(--rule); padding: 2rem 0 calc(2.5rem + env(safe-area-inset-bottom, 0px)); font-size: 0.9rem; color: var(--muted); }
.foot p { margin-bottom: 0.4rem; }
.foot a { color: var(--ink-2); }

@media (max-width: 520px) {
  body { font-size: 1rem; }
  .top nav .hide-sm { display: none; }
  .lede { font-size: 1.1rem; }
  .btn { width: 100%; text-align: center; }
  .top .btn { width: auto; }
}
