/* FervorAI — an editorial signal desk */
:root {
  color-scheme: light;
  --paper: #f8f9fc;
  --paper-deep: #f0f2f7;
  --surface: #fff;
  --ink: #0f1b3d;
  --ink-soft: #4a5578;
  --signal: #007c98;
  --signal-hover: #005f76;
  --signal-bright: #00d4ff;
  --signal-hot: #c8ff00;
  --accent-ink: #0f1b3d;
  --rule: #e4e8f0;
  --rule-strong: #8892a8;
  --background-rule-opacity: 55%;
  --display: "Iowan Old Style", "Baskerville", "Times New Roman", serif;
  --sans: "Avenir Next", Avenir, "Helvetica Neue", sans-serif;
  --mono: "IBM Plex Mono", "SFMono-Regular", Consolas, monospace;
  --shell: 74rem;
  --ease-out: cubic-bezier(.16, 1, .3, 1);
}

html[data-theme="dark"] {
  color-scheme: dark;
  --paper: #0b1530;
  --paper-deep: #071022;
  --surface: #0f1b3d;
  --ink: #f0f2f7;
  --ink-soft: #8892a8;
  --signal: #00d4ff;
  --signal-hover: #c8ff00;
  --signal-bright: #00d4ff;
  --signal-hot: #c8ff00;
  --accent-ink: #0f1b3d;
  --rule: #263453;
  --rule-strong: #4a5578;
  --background-rule-opacity: 34%;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-width: 18rem;
  background-color: var(--paper);
  background-image: linear-gradient(color-mix(in oklch, var(--rule) var(--background-rule-opacity), transparent) 1px, transparent 1px);
  background-size: 100% 3rem;
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1rem;
  font-kerning: normal;
  line-height: 1.65;
}

::selection { background: var(--signal-hot); color: var(--accent-ink); }
.site-shell { width: min(100% - 2rem, var(--shell)); margin-inline: auto; }
a { color: var(--signal); text-decoration-thickness: .08em; text-underline-offset: .18em; }
a:hover { color: var(--signal-hover); }
a:focus-visible, summary:focus-visible { outline: .18rem solid var(--signal); outline-offset: .2rem; }
.skip-link { position: fixed; left: 1rem; top: 1rem; z-index: 100; padding: .6rem 1rem; background: var(--ink); color: var(--paper); transform: translateY(-200%); }
.skip-link:focus { transform: translateY(0); }

/* Header */
.masthead { position: sticky; top: 0; z-index: 20; background: color-mix(in oklch, var(--paper) 94%, transparent); border-bottom: 1px solid var(--ink); }
.utility-bar { background: var(--ink); color: var(--paper); font: 700 .75rem/1.2 var(--mono); letter-spacing: .09em; text-transform: uppercase; }
.utility-inner { min-height: 1.75rem; display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.utility-status { display: flex; align-items: center; gap: .45rem; }
.utility-status i { width: .43rem; aspect-ratio: 1; border-radius: 50%; background: var(--signal-hot); box-shadow: 0 0 0 .2rem color-mix(in oklch, var(--signal-hot) 20%, transparent); }
.masthead-inner { min-height: 4.7rem; display: flex; align-items: center; justify-content: space-between; gap: 1.5rem; }
.brand { display: inline-flex; align-items: center; gap: .7rem; color: var(--ink); font-family: var(--display); font-size: 1.65rem; line-height: 1; letter-spacing: -.045em; text-decoration: none; }
.brand:hover { color: var(--ink); }
.brand b { color: var(--signal); font-weight: 800; }
.brand-signal { width: 1.75rem; height: 1.75rem; display: block; object-fit: contain; }
.header-actions { display: flex; align-self: stretch; align-items: stretch; gap: .65rem; }
.nav-menu { display: contents; }
.nav-menu summary { display: none; }
.nav { display: flex; align-self: stretch; align-items: stretch; gap: clamp(.15rem, 1.4vw, 1.25rem); }
.nav a { position: relative; display: grid; place-items: center; min-height: 2.75rem; padding-inline: .45rem; color: var(--ink-soft); font-size: .82rem; font-weight: 750; letter-spacing: .04em; text-decoration: none; text-transform: uppercase; }
.nav a::after { content: ""; position: absolute; inset: auto .45rem -.05rem; height: .22rem; background: linear-gradient(90deg, var(--signal-bright) 0 68%, var(--signal-hot) 68% 100%); transform: scaleX(0); transform-origin: left; transition: transform 220ms var(--ease-out); }
.nav a:hover, .nav a[aria-current="page"] { color: var(--ink); }
.nav a:hover::after, .nav a[aria-current="page"]::after { transform: scaleX(1); }
.theme-toggle { align-self: center; display: inline-flex; align-items: center; justify-content: center; gap: .4rem; min-height: 2.35rem; padding: .35rem .55rem; border: 1px solid var(--rule-strong); border-radius: 0; background: transparent; color: var(--ink); cursor: pointer; font: 750 .75rem/1.2 var(--mono); letter-spacing: .05em; text-transform: uppercase; transition: background 120ms, color 120ms, border-color 120ms; }
.theme-toggle:hover { border-color: var(--ink); background: var(--ink); color: var(--paper); }
.theme-toggle:focus-visible { outline: .18rem solid var(--signal); outline-offset: .2rem; }
.theme-icon { width: .85rem; height: .85rem; fill: none; stroke: currentColor; stroke-linecap: square; stroke-width: 1.8; }
.theme-icon-moon { fill: currentColor; stroke: none; }
.theme-icon-sun { display: none; }
html[data-theme="dark"] .theme-icon-moon { display: none; }
html[data-theme="dark"] .theme-icon-sun { display: block; }

main { min-height: 60vh; padding-block: clamp(2.5rem, 6vw, 5.5rem) clamp(4rem, 9vw, 8rem); }
main > h1 { max-width: 15ch; margin: 0; font: 700 clamp(2.8rem, 8vw, 6.6rem)/.93 var(--display); letter-spacing: -.065em; text-wrap: balance; }
main > h1::before { content: "Index / "; display: block; margin-bottom: 1rem; color: var(--signal); font: 700 .75rem/1.2 var(--mono); letter-spacing: .1em; text-transform: uppercase; }
main > h1 + .section-sub { max-width: 52rem; margin: 1.5rem 0 3.5rem; font: 500 clamp(1.05rem, 2vw, 1.35rem)/1.5 var(--sans); }

/* Homepage lead */
.lead-story { display: grid; grid-template-columns: minmax(0, 1fr); border-block: 1px solid var(--ink); background-image: radial-gradient(circle at 92% 14%, color-mix(in oklch, var(--signal-bright) 9%, transparent) 0, transparent 28%), radial-gradient(circle at 4% 96%, color-mix(in oklch, var(--signal-hot) 6%, transparent) 0, transparent 24%); }
.lead-copy { padding-block: clamp(2rem, 6vw, 5.5rem); }
.kicker { margin: 0 0 1.2rem; color: var(--ink-soft); font: 700 .78rem/1.45 var(--mono); letter-spacing: .07em; text-transform: uppercase; }
.kicker span { display: inline-block; margin-right: .6rem; padding: .35rem .55rem; background: var(--signal-bright); color: var(--accent-ink); letter-spacing: .1em; }
.kicker a { color: inherit; }
.lead-title { max-width: 28ch; margin: 0; font: 400 clamp(2rem, calc(1.45rem + 2.6vw), 3.35rem)/1.08 var(--display); letter-spacing: -.025em; text-wrap: balance; }
.lead-title a { color: var(--ink); text-decoration: none; }
.lead-title a:hover { color: var(--signal); }
.lead-cta { display: flex; align-items: center; flex-wrap: wrap; gap: 1.25rem; margin: 2rem 0 0; }
.button { display: inline-flex; align-items: center; gap: 1.4rem; min-height: 3.25rem; padding: .7rem 1rem .7rem 1.15rem; background: var(--ink); color: var(--paper); font-size: .84rem; font-weight: 800; letter-spacing: .035em; text-decoration: none; text-transform: uppercase; transition: background 120ms, color 120ms, transform 120ms; }
.button span { font-size: 1.15rem; }
.button:hover { background: var(--signal-hot); color: var(--accent-ink); transform: translateY(-.12rem); }
.text-link { color: var(--ink); font-size: .9rem; font-weight: 750; text-decoration-color: var(--signal); }
.lead-index { display: none; }

.home-grid { display: grid; grid-template-columns: 1fr; gap: 4rem; padding-block: clamp(4rem, 8vw, 7rem); }
.section-heading { margin-bottom: 1.2rem; }
.section-heading::after { content: ""; display: block; width: clamp(3.5rem, 8vw, 6rem); height: .22rem; margin-top: 1rem; background: linear-gradient(90deg, var(--signal-bright) 0 72%, var(--signal-hot) 72% 100%); }
.section-heading > p, .section-heading > div > p { margin: 0 0 .65rem; color: var(--signal); font: 700 .75rem/1.2 var(--mono); letter-spacing: .1em; text-transform: uppercase; }
.section-title { margin: 0; font: 700 clamp(2rem, 4vw, 3.45rem)/1 var(--display); letter-spacing: -.045em; }
.section-title a { color: var(--ink); text-decoration: none; }
.section-title a:hover { color: var(--signal); }
.section-sub { max-width: 48rem; color: var(--ink-soft); }

/* Lists */
.post-list { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--ink); counter-reset: wire; }
.post-list li { position: relative; display: grid; gap: .3rem; padding: 1.15rem 0 1.25rem 2.3rem; border-bottom: 1px solid var(--rule); counter-increment: wire; transition: padding 220ms var(--ease-out), border-color 120ms; }
.post-list li::before { content: counter(wire, decimal-leading-zero); position: absolute; top: 1.32rem; left: 0; color: var(--signal); font: 700 .75rem/1.2 var(--mono); }
.post-list li > a { color: var(--ink); font-family: var(--display); font-size: 1.08rem; line-height: 1.25; text-decoration: none; }
.post-list li p { margin: 0; color: var(--ink-soft); font-size: .94rem; line-height: 1.6; }
.post-list .meta { color: var(--signal); font: 700 .75rem/1.5 var(--mono); letter-spacing: .04em; text-transform: uppercase; }
.archive { max-width: 58rem; }
.archive li { padding-block: 1.5rem; }
.archive li::before { top: 1.7rem; }
.archive li > a { font-size: clamp(1.15rem, 2.5vw, 1.55rem); }

@media (hover: hover) {
  .post-list li:hover { padding-left: 2.7rem; border-bottom-color: var(--ink); background: linear-gradient(90deg, color-mix(in oklch, var(--signal-bright) 8%, transparent), transparent 58%); }
  .post-list li:hover > a { color: var(--signal); }
}

/* Topics */
.chips { display: flex; flex-wrap: wrap; gap: .5rem; margin: 1.25rem 0; }
.chip { display: inline-flex; align-items: center; min-height: 2.1rem; padding: .35rem .7rem; border: 1px solid var(--rule); background: color-mix(in oklch, var(--surface) 65%, transparent); color: var(--ink-soft); font: 650 .78rem/1.2 var(--mono); text-decoration: none; text-transform: uppercase; }
.chip:hover { border-color: var(--signal-hot); background: var(--signal-hot); color: var(--accent-ink); }
.chip-entity { border-color: var(--rule-strong); color: var(--ink); }
.chip .count { margin-left: .55rem; color: var(--signal); font-weight: 800; }
.chip:hover .count { color: inherit; }
.chips.big { max-width: 62rem; margin-block: 2rem 4rem; }

/* Data table */
.repo-teaser { scroll-margin-top: 7rem; padding: clamp(3.5rem, 7vw, 6rem) clamp(1.25rem, 4vw, 3rem); border-block: 1px solid var(--signal-bright); background: linear-gradient(90deg, rgb(7 16 34 / 96%) 0 44%, rgb(7 16 34 / 76%) 100%), url("/assets/img/signal-field-v1.webp") center / cover; color: #f0f2f7; }
.repo-teaser .section-title, .repo-teaser .section-title a, .repo-teaser .text-link, .repo-teaser table td:first-child a { color: #f0f2f7; }
.repo-teaser .section-sub, .repo-teaser th { color: #aab5d0; }
.repo-teaser .table-wrap { border-top-color: rgb(240 242 247 / 72%); }
.repo-teaser table { background: rgb(15 27 61 / 62%); }
.repo-teaser th, .repo-teaser td { border-bottom-color: rgb(240 242 247 / 18%); }
.split-heading { display: grid; gap: 1.2rem; }
.split-heading .section-sub { margin: 0; }
.table-wrap { overflow-x: auto; margin: 1.75rem 0 0; border-top: 1px solid var(--ink); }
table { width: 100%; border-collapse: collapse; background: color-mix(in oklch, var(--surface) 40%, transparent); font-size: .9rem; font-variant-numeric: tabular-nums; }
th { color: var(--ink-soft); font: 700 .75rem/1.2 var(--mono); letter-spacing: .08em; text-align: left; text-transform: uppercase; }
th, td { padding: .9rem .75rem; border-bottom: 1px solid var(--rule); vertical-align: top; }
tbody tr { transition: background 120ms; }
tbody tr:hover { background: color-mix(in oklch, var(--signal-bright) 9%, transparent); }
table td:first-child { font: 650 .82rem/1.5 var(--mono); }
table td:first-child a { color: var(--ink); }
table td:nth-child(n+3), table th:nth-child(n+3) { white-space: nowrap; }
table td:nth-child(2), table th:nth-child(2) { min-width: 18rem; }
.section-action { margin: 1.2rem 0 0; text-align: right; }
.topic-cloud { padding-top: clamp(4rem, 8vw, 7rem); }

/* Articles */
.post { max-width: 68rem; margin-inline: auto; }
.post-header { margin-bottom: 2rem; }
.post-header > .kicker { padding-bottom: 1rem; border-bottom: 1px solid var(--ink); }
.hero { display: block; width: 100%; height: auto; margin: 1.5rem 0; border: 1px solid var(--ink); filter: saturate(.88) contrast(1.03); }
.thesis { max-width: 50rem; margin: 2rem 0; padding-left: 1.25rem; border-left: .3rem solid var(--signal); font: 600 clamp(1.2rem, 2.5vw, 1.55rem)/1.45 var(--display); }
.post-body { max-width: 46rem; margin-inline: auto; font-family: var(--display); font-size: clamp(1.05rem, 1.8vw, 1.17rem); line-height: 1.72; }
.post-body h1 { margin: 0 0 2.5rem; font: 700 clamp(2.5rem, 7vw, 5.5rem)/.97 var(--display); letter-spacing: -.06em; text-wrap: balance; }
.post-body h2 { margin: 3.5rem 0 1.1rem; padding-top: 1rem; border-top: 1px solid var(--ink); font: 700 clamp(1.7rem, 4vw, 2.4rem)/1.05 var(--display); letter-spacing: -.035em; }
.post-body h3 { margin-top: 2.5rem; font-size: 1.3rem; line-height: 1.25; }
.post-body h4 { margin-top: 2rem; font: 800 .9rem/1.35 var(--sans); letter-spacing: .05em; text-transform: uppercase; }
.post-body a { text-decoration-color: color-mix(in oklch, var(--signal) 50%, transparent); }
.post-body img { max-width: 100%; height: auto; border: 1px solid var(--rule-strong); }
.post-body blockquote { margin: 2rem 0; padding: .25rem 0 .25rem 1.25rem; border-left: .3rem solid var(--signal); color: var(--ink-soft); font-size: 1.25rem; }
.post-body code { padding: .12em .35em; background: var(--paper-deep); font: .82em var(--mono); }
.post-body pre { overflow-x: auto; padding: 1.2rem; background: var(--ink); color: var(--paper); }
.post-body pre code { padding: 0; background: none; }
.post-body hr { margin: 3rem 0; border: 0; border-top: 1px solid var(--ink); }
.post-footer { max-width: 46rem; margin: 4rem auto 0; padding-top: 1rem; border-top: 1px solid var(--ink); color: var(--ink-soft); font-size: .9rem; }
.prose { margin-inline: 0; }

/* Footer */
.footer { padding-top: 3rem; border-top: .55rem solid var(--signal); background: var(--ink); color: var(--paper); }
.footer-inner { display: grid; gap: 3rem; padding-block: 2rem 3rem; }
.footer .brand { color: var(--paper); }
.footer-statement > p { max-width: 26rem; margin: 1rem 0 0; font: 600 clamp(1.35rem, 3vw, 2rem)/1.2 var(--display); }
.footer-meta { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.5rem; align-content: end; font-size: .875rem; }
.footer-meta p { margin: 0; }
.footer-meta span { color: color-mix(in oklch, var(--paper) 65%, transparent); }
.footer a { color: var(--paper); }
.footer-base { display: flex; justify-content: space-between; padding-block: 1rem max(1rem, env(safe-area-inset-bottom)); border-top: 1px solid color-mix(in oklch, var(--paper) 22%, transparent); color: color-mix(in oklch, var(--paper) 60%, transparent); font: 700 .75rem/1.25 var(--mono); letter-spacing: .08em; text-transform: uppercase; }
.fine { color: var(--ink-soft); font-size: .82rem; }

@media (min-width: 44rem) {
  .site-shell { width: min(100% - 4rem, var(--shell)); }
  .post-body { font-size: clamp(1.125rem, 1.8vw, 1.25rem); }
  .lead-story { grid-template-columns: minmax(0, 3.1fr) minmax(14rem, 1fr); }
  .lead-copy { padding-right: clamp(2rem, 5vw, 5rem); }
  .lead-index { display: flex; flex-direction: column; justify-content: flex-end; margin: 0; padding: 2rem 0 2rem clamp(1.5rem, 3vw, 2.5rem); border-left: 1px solid var(--ink); }
  .index-label { margin: 0 0 1rem; color: var(--signal); font: 700 .75rem/1.2 var(--mono); letter-spacing: .1em; text-transform: uppercase; }
  .lead-index ol { list-style: none; margin: 0; padding: 0; }
  .lead-index li { display: grid; grid-template-columns: 2rem 1fr; padding: .7rem 0; border-top: 1px solid var(--rule); font-size: .84rem; font-weight: 700; line-height: 1.35; }
  .lead-index li span { color: var(--signal); font: 700 .7rem/1.5 var(--mono); }
  .home-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: clamp(3rem, 7vw, 7rem); }
  .split-heading { grid-template-columns: 1.3fr .7fr; align-items: end; }
  .footer-inner { grid-template-columns: 1.2fr .8fr; }
}

@media (max-width: 59.99rem) {
  .utility-inner { justify-content: center; }
  .utility-inner > span:first-child { display: none; }
  .masthead-inner { position: relative; min-height: 4.25rem; gap: .75rem; }
  .header-actions { align-self: center; align-items: center; gap: .5rem; }
  .nav-menu { position: relative; display: block; }
  .nav-menu summary { display: inline-flex; align-items: center; gap: .5rem; min-height: 2.65rem; padding: .45rem .65rem; border: 1px solid var(--rule-strong); color: var(--ink); cursor: pointer; font: 750 .75rem/1.2 var(--mono); letter-spacing: .05em; list-style: none; text-transform: uppercase; }
  .nav-menu summary::-webkit-details-marker { display: none; }
  .nav-menu summary::marker { content: ""; }
  .nav-menu summary:hover { border-color: var(--ink); background: var(--ink); color: var(--paper); }
  .nav-menu-icon { position: relative; width: .9rem; height: .7rem; display: inline-block; }
  .nav-menu-icon i { position: absolute; left: 0; width: 100%; height: .1rem; background: currentColor; transition: transform 180ms var(--ease-out), top 180ms var(--ease-out); }
  .nav-menu-icon i:first-child { top: .14rem; }
  .nav-menu-icon i:last-child { top: .52rem; }
  .nav-menu[open] .nav-menu-icon i:first-child { top: .34rem; transform: rotate(45deg); }
  .nav-menu[open] .nav-menu-icon i:last-child { top: .34rem; transform: rotate(-45deg); }
  .nav { position: absolute; top: calc(100% + .55rem); right: 0; z-index: 30; display: grid; width: min(19rem, calc(100vw - 2rem)); padding: .45rem; border: 1px solid var(--ink); background: var(--surface); box-shadow: .45rem .45rem 0 color-mix(in oklch, var(--signal-bright) 24%, transparent); }
  .nav a { display: flex; justify-content: space-between; min-height: 2.9rem; padding: .65rem .8rem; border-bottom: 1px solid var(--rule); color: var(--ink); }
  .nav a:last-child { border-bottom: 0; }
  .nav a::before { content: "0" counter(nav-item); color: var(--signal); font: 700 .7rem/1.4 var(--mono); counter-increment: nav-item; }
  .nav-menu { counter-reset: nav-item; }
  .nav a::after { inset: auto .8rem .4rem 2.45rem; }
  .theme-toggle { flex: 0 0 auto; min-width: 2.65rem; min-height: 2.65rem; }
  .theme-toggle-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
}

@media (max-width: 43.99rem) {
  main { padding-top: 2rem; }
  .repo-table, .repo-table tbody { display: block; width: 100%; }
  .repo-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .repo-table tr { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .9rem 1rem; padding: 1.25rem 0; border-bottom: 1px solid var(--rule); }
  .repo-table td { display: grid; gap: .15rem; padding: 0; border: 0; min-width: 0 !important; white-space: normal !important; }
  .repo-table td::before { content: attr(data-label); color: var(--ink-soft); font: 700 .7rem/1.2 var(--mono); letter-spacing: .08em; text-transform: uppercase; }
  .repo-table td:first-child, .repo-table td:nth-child(2) { grid-column: 1 / -1; }
  .repo-table td:first-child { font-size: .9rem; }
  .repo-table td:first-child a { overflow-wrap: anywhere; font-size: 1rem; }
  .repo-table td:nth-child(2) { color: var(--ink-soft); line-height: 1.5; }
  .repo-table td:nth-child(2)::before { display: none; }
  .repo-teaser .repo-table tr { border-bottom-color: rgb(240 242 247 / 18%); }
  .repo-teaser .repo-table td::before { color: #aab5d0; }
  .repo-teaser .repo-table td:nth-child(2) { color: #d5dbeb; }
  .table-wrap { overflow: visible; }
  .footer-meta { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: no-preference) {
  .home .lead-copy > *, .home .lead-index { animation: rise-in 650ms var(--ease-out) both; }
  .home .lead-copy > :nth-child(2) { animation-delay: 70ms; }
  .home .lead-copy > :nth-child(3) { animation-delay: 140ms; }
  .home .lead-index { animation-delay: 180ms; }
  @keyframes rise-in { from { opacity: 0; transform: translateY(1rem); } to { opacity: 1; transform: translateY(0); } }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}

@media print {
  .utility-bar, .nav, .footer { display: none; }
  .masthead { position: static; }
  body { background: white; color: black; }
  a { color: black; }
}
