:root {
  color-scheme: dark;
  --bg: #15110f;
  --surface: #201916;
  --surface-soft: #2b211c;
  --ink: #f3eadf;
  --muted: #c2ad9b;
  --line: #503d32;
  --accent: #f04a16;
  --accent-dark: #ff9a5d;
  --accent-ink: #241008;
  --warning: #f4b34f;
  --warning-bg: #3b260f;
  --shadow: 0 18px 50px rgba(0, 0, 0, .24);
  --radius: 18px;
}

[data-theme="light"] {
  color-scheme: light;
  --bg: #f4eee8;
  --surface: #fffaf5;
  --surface-soft: #eee1d6;
  --ink: #2c1c15;
  --muted: #705b4e;
  --line: #d7c2b3;
  --accent: #c9360b;
  --accent-dark: #8e2609;
  --accent-ink: #fffaf5;
  --warning: #8f5700;
  --warning-bg: #fff0cf;
  --shadow: 0 18px 50px rgba(73, 39, 22, .10);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 17px/1.72 Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
a { color: var(--accent-dark); text-decoration-thickness: .08em; text-underline-offset: .16em; }
a:hover { color: var(--accent); }
.unavailable-reference { color: var(--muted); }
.skip-link { position: fixed; left: 1rem; top: -5rem; z-index: 20; padding: .7rem 1rem; background: var(--surface); }
.skip-link:focus { top: 1rem; }

.hero {
  position: relative;
  overflow: hidden;
  color: #fff8f0;
  background:
    radial-gradient(circle at 85% 15%, rgba(255, 112, 42, .34), transparent 28rem),
    linear-gradient(135deg, #2b120b, #8f2c0b);
}
.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  opacity: .13;
  background-image: linear-gradient(rgba(255,255,255,.35) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.35) 1px, transparent 1px);
  background-size: 28px 28px;
  mask-image: linear-gradient(to bottom, black, transparent);
}
.hero__inner { position: relative; z-index: 1; width: min(1120px, calc(100% - 2rem)); margin: auto; padding: 5rem 11rem 4.4rem 0; }
.hero-logo {
  position: absolute;
  top: 3.25rem;
  right: 0;
  width: 144px;
  height: 144px;
  object-fit: contain;
  filter: drop-shadow(0 12px 18px rgba(0, 0, 0, .28));
}
.eyebrow { margin: 0 0 .8rem; color: #ffc08f; font-size: .78rem; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; }
h1 { max-width: 900px; margin: 0; font-size: clamp(2.2rem, 6vw, 4.8rem); line-height: .98; letter-spacing: -.055em; }
.lede { max-width: 780px; margin: 1.5rem 0 0; color: #f6dfcf; font-size: clamp(1rem, 2vw, 1.22rem); }
.hero__badges { display: flex; flex-wrap: wrap; gap: .55rem; margin-top: 1.7rem; }
.hero__badges span { padding: .34rem .68rem; border: 1px solid rgba(255,255,255,.3); border-radius: 999px; background: rgba(255,255,255,.1); font-size: .82rem; }
.hero--article .hero__inner { padding-bottom: 3.4rem; }
.hero--article h1 { font-size: clamp(2.2rem, 5vw, 4rem); line-height: 1.04; }
.collection-nav { display: flex; flex-wrap: wrap; gap: .55rem; margin-top: 1.8rem; }
.collection-nav a {
  padding: .48rem .78rem;
  border: 1px solid rgba(255,255,255,.34);
  border-radius: 999px;
  background: rgba(255,255,255,.1);
  color: #fff;
  font-size: .82rem;
  font-weight: 750;
  text-decoration: none;
}
.collection-nav a:hover { background: rgba(255,255,255,.2); color: #fff; }

.utility { position: sticky; top: 0; z-index: 10; border-bottom: 1px solid var(--line); background: color-mix(in srgb, var(--surface) 90%, transparent); backdrop-filter: blur(14px); }
.utility__inner { display: flex; align-items: center; gap: 1rem; width: min(1120px, calc(100% - 2rem)); min-height: 64px; margin: auto; }
.brand { margin-right: auto; color: var(--ink); font-weight: 850; text-decoration: none; }
.search { display: flex; width: min(430px, 48vw); }
.search input { min-width: 0; flex: 1; border: 1px solid var(--line); border-right: 0; border-radius: 10px 0 0 10px; background: var(--bg); color: var(--ink); padding: .62rem .78rem; font: inherit; }
.search button, .theme-toggle { border: 0; background: var(--accent); color: var(--accent-ink); cursor: pointer; font-weight: 750; }
.search button { border-radius: 0 10px 10px 0; padding: 0 .9rem; }
.theme-toggle { width: 40px; height: 40px; border-radius: 50%; font-size: 1.15rem; }

.article {
  width: min(1000px, calc(100% - 2rem));
  margin: 2rem auto 5rem;
  padding: clamp(1.25rem, 4vw, 3.6rem);
  overflow-wrap: anywhere;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}
.intro { margin: 0 0 2rem; padding-bottom: 2rem; border-bottom: 1px solid var(--line); color: var(--muted); font-size: 1.1rem; }
.notice { margin-bottom: 1.4rem; padding: 1rem 1.1rem; border-left: 4px solid var(--warning); border-radius: 0 12px 12px 0; background: var(--warning-bg); color: var(--ink); }
.article h2, .article h3, .article h4 { color: var(--ink); line-height: 1.2; letter-spacing: -.02em; }
.article h3 { margin-top: 2.6rem; font-size: 1.7rem; }
.article h4 { margin: 2rem 0 .65rem; color: var(--accent-dark); font-size: 1.12rem; }
.article hr { height: 1px; margin: 2.5rem 0; border: 0; background: var(--line); }
.article br + br { line-height: 2.4; }
.article b, .article strong { color: var(--ink); }
.anchor { display: block; scroll-margin-top: 84px; }

.compat-explorer {
  margin: 1.5rem 0 1rem;
  padding: clamp(1rem, 3vw, 1.6rem);
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface-soft);
}
.compat-explorer__heading { display: grid; grid-template-columns: 1fr minmax(260px, 340px); gap: 1.5rem; align-items: end; }
.compat-explorer__heading h3 { margin: .15rem 0 .35rem; }
.compat-explorer__heading p { margin: 0; color: var(--muted); }
.section-kicker { color: var(--accent-dark) !important; font-size: .75rem; font-weight: 850; letter-spacing: .12em; text-transform: uppercase; }
.board-picker { display: grid; gap: .4rem; color: var(--ink); font-size: .82rem; font-weight: 800; }
.board-picker select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink);
  padding: .72rem 2.2rem .72rem .8rem;
  font: inherit;
}
.compat-legend { display: flex; flex-wrap: wrap; gap: .45rem; margin: 1.2rem 0; }
.legend-chip { padding: .28rem .58rem; border: 1px solid currentColor; border-radius: 999px; font-size: .72rem; font-weight: 800; }
.compat-results { display: grid; grid-template-columns: repeat(auto-fit, minmax(185px, 1fr)); gap: .75rem; }
.compat-card {
  min-width: 0;
  padding: 1rem;
  border: 1px solid var(--line);
  border-top-width: 4px;
  border-radius: 12px;
  background: var(--surface);
}
.article .compat-card h4 { min-height: 2.8em; margin: 0 0 .7rem; color: var(--ink); font-size: .88rem; }
.compat-code {
  min-width: 3.2rem;
  border: 0;
  border-radius: 999px;
  padding: .35rem .65rem;
  background: var(--ink);
  color: var(--surface);
  cursor: pointer;
  font: 850 .83rem/1.2 ui-monospace, SFMono-Regular, Consolas, monospace;
}
.status-official .compat-code { background: #8e7130; color: #fff; }
.status-conditional .compat-code { background: #3e6fa8; color: #fff; }
.status-overclock .compat-code { background: #bd4c0b; color: #fff; }
.status-limited .compat-code { background: #aa4141; color: #fff; }
.compat-description { margin: .7rem 0 0; color: var(--muted); font-size: .78rem; line-height: 1.45; }
.status-official { color: #8e7130; border-top-color: #8e7130; }
.status-conditional { color: #3e6fa8; border-top-color: #3e6fa8; }
.status-overclock { color: #bd4c0b; border-top-color: #bd4c0b; }
.status-limited { color: #aa4141; border-top-color: #aa4141; }
.matrix-details { margin: .8rem 0 2rem; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.matrix-details summary { padding: .85rem 1rem; color: var(--accent-dark); cursor: pointer; font-weight: 800; }
.matrix-details[open] summary { border-bottom: 1px solid var(--line); }
.matrix-scroller { max-height: 72vh; overflow: auto; overscroll-behavior: contain; }
.compat-matrix {
  width: max-content;
  min-width: 100%;
  margin: 0;
  border-collapse: separate;
  border-spacing: 0;
  background: var(--surface);
  font-size: .82rem;
  white-space: nowrap;
}
.compat-matrix th, .compat-matrix td { padding: .68rem .78rem; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); text-align: center; }
.compat-matrix th { position: sticky; top: 0; z-index: 3; background: var(--surface-soft); color: var(--ink); }
.compat-matrix th:first-child { left: 0; z-index: 4; min-width: 250px; }
.compat-matrix tr:not(:first-child) th:first-child { background: var(--surface); box-shadow: 1px 0 0 var(--line); }
.compat-matrix tr:last-child td, .compat-matrix tr:last-child th { border-bottom: 0; }
.compat-matrix td:last-child, .compat-matrix th:last-child { border-right: 0; }
.compat-matrix tr:hover td, .compat-matrix tr:hover th:first-child { background: color-mix(in srgb, var(--accent) 8%, var(--surface)); }

.credits { margin-top: 3rem; padding: 1.4rem 1.5rem; border: 1px solid var(--line); border-radius: 14px; background: var(--surface-soft); }
.credits h2 { margin: 0 0 .7rem; font-size: 1.35rem; }
.credits p { margin: .35rem 0; }
.archive-note { color: var(--muted); font-size: .84rem; text-align: right; }
.article img { max-width: 100%; height: auto; }
.archived-article { max-width: 1000px; }
.processor-article { width: min(920px, calc(100% - 2rem)); }
.legacy-content { font: inherit; }
.legacy-content > :first-child { margin-top: 0; }
.legacy-content p, .legacy-content li, .legacy-content td { color: var(--ink); }
.legacy-content h1, .legacy-content h2, .legacy-content h3, .legacy-content h4 {
  margin-top: 2rem;
  font-family: Inter, ui-sans-serif, system-ui, sans-serif;
}
.legacy-content > p,
.legacy-content > ul,
.legacy-content > ol,
.legacy-content > blockquote,
.legacy-content > h1,
.legacy-content > h2,
.legacy-content > h3,
.legacy-content > h4 {
  max-width: 76ch;
  margin-right: auto;
  margin-left: auto;
}
.legacy-content p { margin-top: 0; margin-bottom: 1.15rem; }
.legacy-content p + p { margin-top: .15rem; }
.legacy-content ul, .legacy-content ol { margin-top: .65rem; margin-bottom: 1.25rem; }
.legacy-content hr { margin: 2rem 0; }
.legacy-content br { display: block; content: ""; margin-top: .45rem; }
.legacy-content li + li { margin-top: .35rem; }
.legacy-content img {
  display: block;
  max-height: 720px;
  margin: 1.25rem auto;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 8px 24px rgba(73, 39, 22, .10);
}
.article-byline { color: var(--muted) !important; font-size: .88rem; font-weight: 750; }
.article-disclaimer {
  max-width: 76ch;
  margin: 1rem auto 1.6rem;
  padding: 1rem 1.1rem;
  border-left: 4px solid var(--warning);
  border-radius: 0 10px 10px 0;
  background: var(--warning-bg);
}
.image-pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; margin: 1.5rem 0; }
.legacy-content figure { margin: 1.5rem auto; text-align: center; }
.legacy-content figcaption { margin-top: .5rem; color: var(--muted); font-size: .82rem; }
.manual-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: .85rem; }
.manual-card { border: 1px solid var(--line); border-radius: 12px; background: var(--surface-soft); overflow: hidden; }
.manual-card a { display: grid; height: 100%; grid-template-columns: 92px 1fr; gap: .8rem; align-items: center; padding: .8rem; text-decoration: none; }
.manual-card img { width: 92px; max-height: 90px; margin: 0; object-fit: contain; box-shadow: none; }
.manual-card__body { display: grid; gap: .25rem; }
.manual-card__body small { color: var(--muted); }
.legacy-content table { width: 100% !important; max-width: 100% !important; table-layout: auto; }
.legacy-content td, .legacy-content th { max-width: 100%; overflow-wrap: anywhere; }
.legacy-content blockquote {
  margin: 1.25rem 0;
  padding: .8rem 1.1rem;
  border-left: 4px solid var(--accent);
  background: var(--surface-soft);
}
.legacy-content pre {
  max-width: 100%;
  overflow: auto;
  padding: 1rem;
  border-radius: 10px;
  background: #15110f;
  color: #f3eadf;
}
.archived-center { text-align: center; }
.legacy-table-wrap { width: 100%; margin: 1.4rem 0; overflow-x: auto; border: 1px solid var(--line); border-radius: 10px; }
.legacy-table-wrap table { width: 100%; min-width: 560px; border-collapse: collapse; background: var(--surface); }
.legacy-table-wrap th, .legacy-table-wrap td { padding: .58rem .7rem; border: 1px solid var(--line); vertical-align: top; }
.legacy-table-wrap img { max-width: min(100%, 680px); }
.forum-thread { display: grid; gap: 1rem; }
.forum-post { overflow: hidden; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.forum-post > header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: .4rem 1rem;
  padding: .7rem 1rem;
  background: var(--surface-soft);
  font-family: Inter, ui-sans-serif, system-ui, sans-serif;
}
.forum-post > header span { color: var(--muted); font-size: .75rem; }
.forum-message { padding: 1rem; }
.forum-message > :first-child { margin-top: 0; }
.forum-message > :last-child { margin-bottom: 0; }
.forum-message p { margin: 0 0 1rem; white-space: pre-line; }
.forum-message p:last-child { margin-bottom: 0; }
.reply-context {
  margin-bottom: .7rem !important;
  color: var(--accent-dark);
  font-size: .82rem;
  font-weight: 800;
}

.library-page { width: min(1120px, calc(100% - 2rem)); max-width: 1120px; }
.library-section + .library-section { margin-top: 3rem; }
.library-section > h2 { margin: 0 0 1rem; font-size: 1.6rem; }
.library-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 1rem; }
.library-card {
  display: flex;
  min-height: 195px;
  flex-direction: column;
  padding: 1.25rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface-soft);
}
.library-card--featured { border-top: 4px solid var(--accent); }
.library-card h2 { margin: .3rem 0 .7rem; font-size: 1.15rem; line-height: 1.3; }
.library-card p { margin: 0 0 1rem; color: var(--muted); }
.back-to-top { position: fixed; right: 1rem; bottom: 1rem; width: 46px; height: 46px; border: 0; border-radius: 50%; opacity: 0; transform: translateY(12px); background: var(--accent); color: white; box-shadow: var(--shadow); cursor: pointer; pointer-events: none; transition: .2s; }
.back-to-top.is-visible { opacity: 1; transform: none; pointer-events: auto; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

@media (max-width: 680px) {
  .hero__inner { padding-right: 0; }
  .hero-logo {
    position: static;
    display: block;
    width: 128px;
    height: 128px;
    margin: -1.6rem 0 1.35rem;
  }
  .hero__inner { padding: 3.6rem 0 3rem; }
  .utility__inner { gap: .55rem; }
  .brand { display: none; }
  .search { width: auto; flex: 1; }
  .article { width: 100%; margin-top: 0; border-right: 0; border-left: 0; border-radius: 0; }
  .collection-nav { gap: .4rem; }
  .collection-nav a { padding: .4rem .6rem; font-size: .75rem; }
  .compat-explorer__heading { grid-template-columns: 1fr; }
  .compat-results { grid-template-columns: 1fr 1fr; }
  .article .compat-card h4 { min-height: 3.7em; }
}

@media (max-width: 430px) {
  .compat-results { grid-template-columns: 1fr; }
  .article .compat-card h4 { min-height: 0; }
  .image-pair { grid-template-columns: 1fr; }
  .manual-card a { grid-template-columns: 76px 1fr; }
  .manual-card img { width: 76px; }
}

@media print {
  .utility, .back-to-top, .skip-link { display: none; }
  .hero { color: #000; background: none; }
  .hero__inner { padding: 1rem 0; }
  .hero .lede, .hero .eyebrow { color: #333; }
  .hero__badges { display: none; }
  .article { width: 100%; margin: 0; padding: 0; border: 0; box-shadow: none; }
  table { display: table; white-space: normal; font-size: 7pt; }
}
