/* =============================================================================
   bc3.network -- site stylesheet
   Fonts are self-hosted via css/fonts.css (see tools/get-fonts.sh). If that
   file is empty the stacks below fall back to system serif / monospace faces.
   ============================================================================= */

:root {
  --bg: #0c0c0e;
  --bg-elev: #14141a;
  --bg-elev-2: #1c1c24;
  --bg-line: #26262f;
  --border: #2a2a34;
  --border-strong: #3d3d4a;
  --text: #ece6d6;
  --text-muted: #9b958a;
  --text-faint: #6c6760;
  --accent: #d97706;
  --accent-bright: #f59e0b;
  --accent-soft: rgba(217, 119, 6, 0.12);
  --accent-glow: rgba(217, 119, 6, 0.22);
  --success: #84cc16;
  --danger: #dc2626;

  --font-display: 'Fraunces', 'Iowan Old Style', 'Palatino Linotype', 'Book Antiqua', Georgia, 'Times New Roman', serif;
  --font-body: 'Source Serif 4', 'Iowan Old Style', Georgia, 'Times New Roman', serif;
  --font-mono: 'JetBrains Mono', ui-monospace, 'SFMono-Regular', Menlo, Consolas, 'DejaVu Sans Mono', 'Courier New', monospace;

  --measure: 64ch;
  --gutter: clamp(1.25rem, 4vw, 3rem);
  --topbar-h: 64px;
}

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

html {
  scroll-behavior: smooth;
  color-scheme: dark;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 18px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  background-image:
    radial-gradient(ellipse 1200px 600px at 80% -10%, var(--accent-soft) 0%, transparent 60%),
    radial-gradient(ellipse 800px 400px at 10% 5%, rgba(132, 204, 22, 0.04) 0%, transparent 60%);
  background-attachment: fixed;
  overflow-x: hidden;
}

/* Subtle film grain */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.025;
  z-index: 1;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

a {
  color: var(--accent-bright);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s ease, color 0.2s ease;
}
a:hover { border-bottom-color: var(--accent-bright); }

/* Keyboard focus: one consistent ring everywhere */
:focus-visible {
  outline: 2px solid var(--accent-bright);
  outline-offset: 3px;
  border-radius: 2px;
}

/* Skip link (visible only when focused) */
.skip-link {
  position: absolute;
  left: 1rem;
  top: -3rem;
  z-index: 100;
  padding: 0.5rem 0.85rem;
  background: var(--accent);
  color: #1a1100;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border: none;
  border-radius: 2px;
  transition: top 0.15s ease;
}
.skip-link:focus { top: 1rem; }

/* Typography helpers */
.mono { font-family: var(--font-mono); }
.muted { color: var(--text-muted); }
.faint { color: var(--text-faint); }
.divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 0;
}

/* ---------- Layout containers ---------- */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding-left: var(--gutter);
  padding-right: var(--gutter);
}

/* ---------- Top bar ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(12, 12, 14, 0.85);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}
.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
  min-height: var(--topbar-h);
  padding-top: 0.5rem;
  padding-bottom: 0.5rem;
}
.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 1.05rem;
  letter-spacing: 0.01em;
  color: var(--text);
  border: none;
}
.brand img {
  width: 28px;
  height: 28px;
  display: block;
  filter: drop-shadow(0 0 12px var(--accent-glow));
}
.brand .iii {
  color: var(--accent);
  font-style: italic;
  font-weight: 600;
}

.nav-links {
  display: flex;
  gap: 1.75rem;
  align-items: center;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.nav-links a {
  color: var(--text-muted);
  border-bottom: none;
}
.nav-links a:hover { color: var(--text); }
@media (max-width: 720px) {
  .nav-links { display: none; }
}

/* ---------- Live stats strip ---------- */
.stats-strip {
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(217, 119, 6, 0.04), transparent);
  position: relative;
  z-index: 5;
}
/* Cells stay transparent (so the page glow shows through) and the 1px gaps
   between them are painted by each cell's box-shadow. overflow:hidden clips the
   shadows at the outer edges, so the divider lines come out right for any
   number of cells and any number of rows. */
.stats-grid {
  display: grid;
  grid-template-columns: auto repeat(5, minmax(0, 1fr));
  gap: 1px;
  align-items: stretch;
  overflow: hidden;
}
.stats-label,
.stat {
  box-shadow: 0 0 0 1px var(--border);
}
.stats-label {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 1rem 1.5rem 1rem 0;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-muted);
  white-space: nowrap;
}
.stats-label .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 10px var(--success);
  animation: pulse 2s ease-in-out infinite;
  flex: none;
}
.stats-label.error .dot {
  background: var(--text-faint);
  box-shadow: none;
  animation: none;
}
@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%      { opacity: 0.55; transform: scale(0.85); }
}
.stat {
  padding: 1rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.18rem;
  min-width: 0;
}
.stat-key {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--text-faint);
  white-space: nowrap;
}
.stat-val {
  font-family: var(--font-mono);
  font-size: 1rem;
  font-weight: 500;
  color: var(--text);
  letter-spacing: -0.005em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-variant-numeric: tabular-nums;
}
.stat-val.accent { color: var(--accent-bright); }
.stat-val.na { color: var(--text-faint); }

/* Narrower: label on its own row, stats in 3 then 2 columns. The label is
   child 1, so stat N is child N+1; the :nth-child rules stretch a stat that
   would otherwise sit alone at the end of the last row. */
@media (max-width: 1040px) {
  .stats-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .stats-label {
    grid-column: 1 / -1;
    padding: 0.75rem 0;
    justify-content: flex-start;
  }
  .stat:last-child:nth-child(3n)   { grid-column: 2 / -1; }
  .stat:last-child:nth-child(3n+2) { grid-column: 1 / -1; }
}
@media (max-width: 560px) {
  .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat { padding: 0.85rem 1rem; }
  .stat:last-child:nth-child(3n),
  .stat:last-child:nth-child(3n+2) { grid-column: auto; }
  .stat:last-child:nth-child(even)  { grid-column: 1 / -1; }
}

/* ---------- Hero ---------- */
.hero {
  padding: clamp(4rem, 12vh, 9rem) 0 clamp(4rem, 10vh, 7rem);
  position: relative;
}

.hero-inner {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
  position: relative;
  z-index: 2;
}

.hero-logo {
  width: clamp(100px, 14vw, 156px);
  height: auto;
  margin-bottom: 1.5rem;
  filter: drop-shadow(0 0 40px var(--accent-glow));
  animation: heroLogoIn 1.4s cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes heroLogoIn {
  from { opacity: 0; transform: translateY(20px) scale(0.94); }
  to   { opacity: 1; transform: translateY(0)    scale(1); }
}

.hero h1 {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(3rem, 9vw, 7.5rem);
  line-height: 0.95;
  letter-spacing: -0.035em;
  margin: 0 0 1.5rem 0;
  color: var(--text);
  font-variation-settings: 'opsz' 144, 'SOFT' 30, 'WONK' 1;
}
.hero h1 .iii {
  font-style: italic;
  font-weight: 300;
  color: var(--accent);
  font-variation-settings: 'opsz' 144, 'SOFT' 100, 'WONK' 1;
}

.hero-tagline {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 300;
  font-size: clamp(1.3rem, 2.6vw, 1.95rem);
  line-height: 1.35;
  color: var(--text);
  max-width: 32ch;
  margin: 0 0 2.5rem 0;
  font-variation-settings: 'opsz' 36, 'SOFT' 100;
}

.hero-tagline em {
  font-style: normal;
  color: var(--accent-bright);
  background: linear-gradient(180deg, transparent 65%, var(--accent-soft) 65%);
  padding: 0 0.1em;
}

.hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem 2.5rem;
  margin: 0 0 2.5rem 0;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--text-muted);
}
.hero-meta dt {
  font-size: 0.66rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin-bottom: 0.2rem;
}
.hero-meta dd {
  margin: 0;
  color: var(--text);
  font-weight: 500;
}

.cta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem;
}
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.85rem 1.4rem;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  border-radius: 2px;
  border: 1px solid var(--border-strong);
  background: transparent;
  color: var(--text);
  transition: border-color 0.2s ease, color 0.2s ease, background-color 0.2s ease;
  cursor: pointer;
}
.btn:hover {
  border-color: var(--accent);
  color: var(--accent-bright);
  background: var(--accent-soft);
}
.btn.primary {
  background: var(--accent);
  color: #1a1100;
  border-color: var(--accent);
}
.btn.primary:hover {
  background: var(--accent-bright);
  border-color: var(--accent-bright);
  color: #1a1100;
}
.btn .arrow { transition: transform 0.2s ease; }
.btn:hover .arrow { transform: translateX(3px); }

/* ---------- Section base ---------- */
section {
  padding: clamp(4rem, 10vh, 7rem) 0;
  position: relative;
  z-index: 2;
}
/* Anchored sections stop underneath the sticky top bar without this. */
section[id] { scroll-margin-top: calc(var(--topbar-h) + 1rem); }

.section-elev {
  background: var(--bg-elev);
}
.section-framed {
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.section-num {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.18em;
  color: var(--accent);
  display: block;
  margin-bottom: 0.5rem;
}

h2 {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(2rem, 4.5vw, 3.25rem);
  line-height: 1.05;
  letter-spacing: -0.022em;
  margin: 0 0 2.5rem 0;
  color: var(--text);
  font-variation-settings: 'opsz' 96, 'SOFT' 30;
}
h2 em {
  font-style: italic;
  color: var(--accent);
  font-weight: 300;
}

h3 {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 1.45rem;
  line-height: 1.25;
  letter-spacing: -0.01em;
  margin: 0 0 0.85rem 0;
  color: var(--text);
}

p { margin: 0 0 1.25em 0; }
p:last-child { margin-bottom: 0; }
.prose { max-width: var(--measure); }
.prose p { color: var(--text); }
.prose strong { color: var(--accent-bright); font-weight: 600; }
.prose .aside {
  margin-top: 1.75rem;
  padding: 1.1rem 1.25rem;
  border-left: 2px solid var(--accent);
  background: var(--accent-soft);
  color: var(--text);
  font-size: 0.95rem;
  border-radius: 0 3px 3px 0;
}
.prose .aside p { color: var(--text); }
.prose .aside strong { color: var(--text); }

/* ---------- Thesis section ---------- */
.thesis-grid {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: clamp(2rem, 6vw, 5rem);
  align-items: start;
}
@media (max-width: 820px) {
  .thesis-grid { grid-template-columns: 1fr; }
}

.thesis-grid .label {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--accent);
}

.thesis-grid blockquote {
  margin: 0;
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 300;
  font-size: clamp(1.6rem, 3vw, 2.4rem);
  line-height: 1.25;
  color: var(--text);
  font-variation-settings: 'opsz' 72, 'SOFT' 50;
  position: relative;
}
.thesis-grid blockquote::before {
  content: '"';
  position: absolute;
  left: -0.4em;
  top: -0.1em;
  color: var(--accent);
  opacity: 0.5;
  font-size: 1.5em;
}

/* ---------- Two-column editorial ---------- */
.editorial {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: clamp(2rem, 5vw, 4rem);
  align-items: start;
}
@media (max-width: 820px) {
  .editorial { grid-template-columns: 1fr; gap: 1rem; }
}
.editorial-aside {
  position: sticky;
  top: calc(var(--topbar-h) + 1rem);
}
.editorial-aside .section-num { margin-bottom: 0.5rem; }
.editorial-aside h2 {
  font-size: clamp(1.6rem, 3.5vw, 2.4rem);
  margin-bottom: 0;
}
@media (max-width: 820px) {
  .editorial-aside { position: static; }
  .editorial-aside h2 { margin-bottom: 1rem; }
}

/* ---------- Hardware-class comparison cards ---------- */
.compare {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  margin-top: 2.5rem;
}
@media (max-width: 720px) { .compare { grid-template-columns: 1fr; } }

.compare-card {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 1.75rem 1.5rem 1.5rem;
  position: relative;
  overflow: hidden;
}
.compare-card.cross { border-color: rgba(220, 38, 38, 0.18); }
.compare-card.check { border-color: rgba(132, 204, 22, 0.18); }
.compare-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: var(--border-strong);
}
.compare-card.cross::before { background: linear-gradient(90deg, var(--danger), transparent); }
.compare-card.check::before { background: linear-gradient(90deg, var(--success), transparent); }

.compare-card .sym {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  margin-bottom: 0.75rem;
}
.compare-card.cross .sym { color: var(--danger); }
.compare-card.check .sym { color: var(--success); }
.compare-card h3 { font-size: 1.2rem; margin-bottom: 0.85rem; }
.compare-card p { font-size: 0.95rem; color: var(--text-muted); }

/* ---------- Specifications grid ---------- */
.specs-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0;
  margin: 0;
  border-top: 1px solid var(--border);
  border-left: 1px solid var(--border);
}
@media (max-width: 720px) { .specs-grid { grid-template-columns: 1fr; } }
.spec-row {
  padding: 1.2rem 1.5rem;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  display: grid;
  grid-template-columns: 1fr 1.4fr;
  gap: 1rem;
  align-items: baseline;
}
.spec-row dt {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.spec-row dd {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 0.92rem;
  color: var(--text);
  word-break: break-word;
}
.spec-row dd .em { color: var(--accent-bright); }

/* ---------- Resources ---------- */
.resources {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  margin-top: 2.5rem;
}
.resource {
  display: block;
  padding: 1.5rem 1.5rem 1.4rem;
  background: var(--bg);
  border: none;
  color: var(--text);
  transition: background 0.2s ease, color 0.2s ease;
}
.resource:hover {
  background: var(--bg-elev);
  color: var(--accent-bright);
}
.resource:focus-visible { outline-offset: -3px; }
.resource .name {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.25rem;
}
.resource .name .arrow { transition: transform 0.2s ease; font-family: var(--font-mono); }
.resource:hover .name .arrow { transform: translate(3px, -3px); color: var(--accent-bright); }
.resource .desc {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-faint);
}

/* ---------- Footer ---------- */
footer {
  border-top: 1px solid var(--border);
  padding: 3rem 0 4rem;
  font-family: var(--font-mono);
  font-size: 0.76rem;
  color: var(--text-faint);
  letter-spacing: 0.04em;
  position: relative;
  z-index: 2;
}
.footer-inner {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
}
footer strong { color: var(--text-muted); font-weight: 500; }
footer a { color: var(--text-muted); }
footer a:hover { color: var(--accent-bright); }

/* ---------- Scroll reveal ----------
   Hidden-until-scrolled is a JS effect. If scripts are unavailable the browser
   loads css/nojs.css (via <noscript>) which undoes this, so content is never
   invisible without JS. */
.reveal { opacity: 0; transform: translateY(18px); transition: opacity 0.9s ease, transform 0.9s ease; }
.reveal.in { opacity: 1; transform: translateY(0); }

::selection { background: var(--accent); color: #1a1100; }

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .hero-logo { animation: none; }
  .stats-label .dot { animation: none; }
  .reveal { opacity: 1; transform: none; transition: none; }
  .btn .arrow, .resource .name .arrow { transition: none; }
}
