/* Field Notes, shared layout. Extends the Helocast design system used across
   the static site (see capabilities.html). Tokens and header/footer match the
   rest of helocast.io exactly; this file only adds the long-form reading,
   card, code, diagram, and table-of-contents patterns the section needs. */

@font-face { font-family: 'Space Grotesk'; font-style: normal; font-weight: 700; font-display: swap;
  src: url('/public/assets/fonts/space-grotesk-700.woff2') format('woff2'); }
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 400; font-display: swap;
  src: url('/public/assets/fonts/inter-400.woff2') format('woff2'); }
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 500; font-display: swap;
  src: url('/public/assets/fonts/inter-500.woff2') format('woff2'); }
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 600; font-display: swap;
  src: url('/public/assets/fonts/inter-600.woff2') format('woff2'); }

:root {
  --night-water: #0A0E12; --signal-white: #E9EBE7; --teal: #2FA79B; --teal-deep: #176B63;
  --muted: #8B959D; --hairline: #1C232A; --panel: #0D1319;
  --display: 'Space Grotesk', -apple-system, 'Segoe UI', Roboto, sans-serif;
  --body: 'Inter', -apple-system, 'Segoe UI', Roboto, sans-serif;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
body { background: var(--night-water); color: var(--signal-white); font-family: var(--body); line-height: 1.6; -webkit-font-smoothing: antialiased; }
a { color: var(--teal); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
:focus-visible { outline: 2px solid var(--teal); outline-offset: 3px; border-radius: 2px; }
.container { max-width: 880px; margin: 0 auto; padding: 0 24px; }

/* Header / footer, identical to the rest of the site */
header { border-bottom: 1px solid var(--hairline); }
.header-inner { display: flex; align-items: center; justify-content: space-between; height: 64px; }
.brand { display: flex; align-items: center; gap: 12px; color: var(--signal-white); }
.brand:hover { text-decoration: none; }
.brand svg { width: 26px; height: 26px; display: block; }
.wordmark { font-family: var(--display); font-weight: 700; font-size: 15px; letter-spacing: 0.14em; }
.back { font-size: 14px; font-weight: 500; }
footer { border-top: 1px solid var(--hairline); padding: 32px 0 40px; margin-top: 80px; }
.footer-meta { color: var(--muted); font-size: 13px; line-height: 1.8; }

.page-label { color: var(--muted); font-size: 13px; font-weight: 500; letter-spacing: 0.14em; text-transform: uppercase; }

/* Index / landing */
main { padding: 64px 0 40px; }
h1 { font-family: var(--display); font-weight: 700; font-size: clamp(1.9rem, 4vw, 2.4rem); line-height: 1.2; margin-top: 12px; }
.lede { color: var(--muted); font-size: 1.02rem; margin-top: 16px; max-width: 640px; }

.group { margin-top: 56px; }
.group > h2 { font-family: var(--display); font-weight: 700; font-size: 1.15rem; padding-top: 22px; border-top: 1px solid var(--hairline); }
.group-note { color: var(--muted); font-size: 14px; margin-top: 6px; max-width: 640px; }
.card-grid { display: grid; grid-template-columns: 1fr; gap: 16px; margin-top: 22px; }
.card {
  display: block; border: 1px solid var(--hairline); background: var(--panel);
  border-radius: 6px; padding: 22px 20px; color: var(--signal-white);
}
.card:hover { text-decoration: none; border-color: var(--teal-deep); }
.card-type { color: var(--teal); font-size: 12px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; }
.card h3 { font-family: var(--display); font-weight: 700; font-size: 1.08rem; line-height: 1.3; margin-top: 8px; }
.card p { color: var(--muted); font-size: 14px; margin-top: 8px; }
.card-meta { color: var(--muted); font-size: 12.5px; margin-top: 14px; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.tag { border: 1px solid var(--hairline); border-radius: 999px; padding: 2px 10px; font-size: 11.5px; color: var(--muted); }

/* Article */
.article-head { padding: 56px 0 0; }
.article-title { font-family: var(--display); font-weight: 700; font-size: clamp(1.7rem, 3.6vw, 2.2rem); line-height: 1.22; margin-top: 12px; max-width: 760px; }
.article-summary { color: var(--muted); font-size: 1.05rem; margin-top: 18px; max-width: 680px; }
.article-meta { color: var(--muted); font-size: 13px; margin-top: 18px; display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

/* Two-column: sticky TOC + prose, collapses on mobile */
.article-body { display: grid; grid-template-columns: 200px 1fr; gap: 40px; margin-top: 48px; align-items: start; }
/* Grid items default to min-width:auto, so a wide diagram or table would force
   the column wider than the viewport and push the whole page sideways. */
.article-body > * { min-width: 0; }
.toc { position: sticky; top: 24px; font-size: 13.5px; }
.toc-label { color: var(--muted); font-size: 11.5px; letter-spacing: 0.12em; text-transform: uppercase; margin-bottom: 12px; }
.toc a { display: block; color: var(--muted); padding: 5px 0; line-height: 1.35; border-left: 2px solid transparent; padding-left: 12px; margin-left: -14px; }
.toc a:hover { color: var(--signal-white); text-decoration: none; }
.toc a.active { color: var(--teal); border-left-color: var(--teal); }

.prose { max-width: 680px; font-size: 1.02rem; }
.prose h2 { font-family: var(--display); font-weight: 700; font-size: 1.4rem; line-height: 1.25; margin: 44px 0 4px; scroll-margin-top: 24px; }
.prose h3 { font-family: var(--display); font-weight: 700; font-size: 1.08rem; margin: 28px 0 4px; scroll-margin-top: 24px; }
.prose p { margin-top: 14px; color: #C9CFD3; }
.prose strong { color: var(--signal-white); font-weight: 600; }
.prose ul, .prose ol { margin: 14px 0 14px 22px; color: #C9CFD3; }
.prose li { margin: 6px 0; }
.prose li strong { color: var(--signal-white); }
.prose a { text-decoration: underline; text-underline-offset: 3px; }
.prose blockquote { border-left: 2px solid var(--teal); padding-left: 16px; margin: 18px 0; color: var(--muted); }
.prose hr { border: 0; border-top: 1px solid var(--hairline); margin: 40px 0; }

/* Inline + block code */
.prose code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.88em; background: #11171d; border: 1px solid var(--hairline); border-radius: 3px; padding: 1px 5px; color: #cdd6da; }
.prose pre { background: #0b1116; border: 1px solid var(--hairline); border-radius: 6px; padding: 16px 18px; overflow-x: auto; margin: 20px 0; font-size: 13.5px; line-height: 1.6; }
.prose pre code { background: none; border: 0; padding: 0; color: #cdd6da; font-size: inherit; }
.tok-comment { color: #6f7a82; }
.tok-key { color: var(--teal); }
.tok-str { color: #9ec7a0; }
.code-cap { color: var(--muted); font-size: 12.5px; margin: -8px 0 20px; }

/* Mermaid diagrams */
.diagram { background: var(--panel); border: 1px solid var(--hairline); border-radius: 8px; padding: 18px; margin: 24px 0; overflow-x: auto; }
/* The Mermaid source lives in a <pre>, which would otherwise pick up the code
   block's border, background and its own overflow, nesting a second panel
   inside the diagram and stealing the horizontal scroll from .diagram. */
.diagram .mermaid { text-align: center; background: none; border: 0; border-radius: 0; padding: 0; margin: 0; overflow: visible; }
.diagram svg { max-width: 100%; height: auto; }
.fig-cap { color: var(--muted); font-size: 12.5px; margin-top: 10px; text-align: center; }

/* Tables in prose */
.prose table { border-collapse: collapse; width: 100%; margin: 20px 0; font-size: 13.5px; display: block; overflow-x: auto; }
.prose th, .prose td { border: 1px solid var(--hairline); padding: 8px 12px; text-align: left; vertical-align: top; }
.prose th { font-family: var(--display); font-size: 12px; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); }

/* Footer CTA, reuses the site's button and wording */
.cta { border-top: 1px solid var(--hairline); margin-top: 56px; padding-top: 40px; }
.cta h2 { font-family: var(--display); font-weight: 700; font-size: 1.3rem; }
.cta p { color: var(--muted); margin-top: 10px; max-width: 560px; }
.btn { display: inline-block; margin-top: 22px; background: var(--teal); color: var(--night-water); font-family: var(--display); font-weight: 700; font-size: 15px; letter-spacing: 0.02em; padding: 14px 28px; border-radius: 4px; }
.btn:hover { background: var(--teal-deep); color: var(--signal-white); text-decoration: none; }

/* Wide content: tables get a scroll container so columns keep readable widths
   instead of being squeezed. overscroll-behavior-x stops a horizontal swipe
   from chaining into the browser's back gesture. */
.table-wrap { overflow-x: auto; overscroll-behavior-x: contain; margin: 20px 0; }
.table-wrap table { display: table; margin: 0; min-width: 100%; }
.diagram, .prose pre { overscroll-behavior-x: contain; }

/* "Swipe to explore" affordance, only rendered when content actually overflows
   and only shown on the narrow breakpoint. */
.scroll-hint { display: none; color: var(--muted); font-size: 12px; letter-spacing: 0.04em; margin: -10px 0 20px; }
.scroll-hint::before { content: "\2194\00a0\00a0"; color: var(--teal); }

/* Table of contents: static sticky rail on desktop, collapsible panel on mobile */
.toc summary { list-style: none; }
.toc summary::-webkit-details-marker { display: none; }
.toc details > .toc-label { margin-bottom: 12px; }

/* Series navigation at the end of an article */
.series-nav { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 52px; padding-top: 28px; border-top: 1px solid var(--hairline); }
.series-nav a { display: block; border: 1px solid var(--hairline); background: var(--panel); border-radius: 6px; padding: 14px 16px; color: var(--signal-white); }
.series-nav a:hover { text-decoration: none; border-color: var(--teal-deep); }
.series-nav .dir { display: block; color: var(--muted); font-size: 11.5px; font-weight: 500; letter-spacing: 0.12em; text-transform: uppercase; margin-bottom: 6px; }
.series-nav .next { text-align: right; }
.series-nav .t { font-family: var(--display); font-weight: 700; font-size: 0.95rem; line-height: 1.3; }

@media (max-width: 820px) {
  .article-body { grid-template-columns: 1fr; gap: 0; }

  /* TOC becomes a tappable disclosure above the article rather than vanishing */
  .toc {
    position: static; top: auto; margin: 0 0 30px;
    border: 1px solid var(--hairline); background: var(--panel); border-radius: 6px;
  }
  .toc details > .toc-label {
    margin: 0; padding: 14px 16px; cursor: pointer;
    display: flex; align-items: center; justify-content: space-between;
    color: var(--signal-white); font-size: 12px;
  }
  .toc details > .toc-label::after {
    content: ""; width: 8px; height: 8px; margin-left: 12px; flex: none;
    border-right: 2px solid var(--teal); border-bottom: 2px solid var(--teal);
    transform: rotate(45deg) translate(-2px, -2px); transition: transform 0.15s ease;
  }
  .toc details[open] > .toc-label::after { transform: rotate(-135deg) translate(-2px, -2px); }
  .toc details > a { padding: 9px 16px; margin-left: 0; border-left: 0; }
  .toc details > a:first-of-type { padding-top: 4px; }
  .toc details > a:last-child { padding-bottom: 16px; }
  .toc a.active { border-left: 0; }

  /* Diagrams render at native size and pan horizontally, so labels stay legible
     instead of being scaled down to a few pixels tall. */
  .diagram { padding: 12px; overflow-x: auto; }
  .diagram svg { max-width: none; width: auto; height: auto; }
  .diagram .mermaid { text-align: left; }
  .fig-cap { text-align: left; }

  .table-wrap table { min-width: 560px; }
  .scroll-hint { display: block; }

  .prose pre { font-size: 12.5px; padding: 14px; }
  .series-nav { grid-template-columns: 1fr; }
  .series-nav .next { text-align: left; }
}
