:root {
  --bg-obsidian: #0b0c0e;
  --bg-chamber: #111318;
  --bg-surface: #15171c;
  --bg-elevated: #1d2028;
  --gold: #ffd56b;
  --gold-bright: #ffe49c;
  --gold-tint: rgba(255, 213, 107, 0.13);
  --gold-line: rgba(255, 213, 107, 0.38);
  --tally: #fd535a;
  --ink-primary: #f5f5f7;
  --ink-secondary: #c6cad6;
  --ink-muted: #939ab0;
  --ink-dark: #121316;
  --hairline: rgba(245, 245, 247, 0.12);
  --hairline-strong: rgba(245, 245, 247, 0.22);
  --shadow-deep: 0 22px 54px rgba(0, 0, 0, 0.52);
  --font-sans: "Segoe UI Variable Text", "Segoe UI", -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --font-display: "Segoe UI Variable Display", "Segoe UI", -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  --font-mono: "Cascadia Mono", "SF Mono", Consolas, "Liberation Mono", monospace;
  --max-page: 1160px;
  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --radius-pill: 999px;
  color-scheme: dark;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  background-color: var(--bg-obsidian);
  color: var(--ink-primary);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.62;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  scrollbar-color: #2b303c var(--bg-obsidian);
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}

body {
  margin: 0;
  min-height: 100vh;
  background-color: var(--bg-obsidian);
  background-image: radial-gradient(960px 520px at 74% 8%, rgba(255, 213, 107, 0.065), transparent 68%);
  color: var(--ink-primary);
  overflow-x: hidden;
}

::selection {
  background: rgba(255, 213, 107, 0.26);
  color: #fff8e6;
}

::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: var(--bg-obsidian);
}

::-webkit-scrollbar-thumb {
  background: #282c37;
  border: 2px solid var(--bg-obsidian);
  border-radius: var(--radius-pill);
}

::-webkit-scrollbar-thumb:hover {
  background: #383e4d;
}

a {
  color: var(--gold);
  text-decoration: underline;
  text-decoration-color: rgba(255, 213, 107, 0.42);
  text-underline-offset: 0.22em;
  transition: color 140ms ease, text-decoration-color 140ms ease;
}

a:hover {
  color: var(--gold-bright);
  text-decoration-color: var(--gold-bright);
}

:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 3px;
}

img,
svg {
  display: block;
  max-width: 100%;
  height: auto;
}

code {
  font-family: var(--font-mono);
  font-size: 0.86em;
  background: rgba(255, 255, 255, 0.06);
  color: #ebeff8;
  padding: 0.08em 0.32em;
  border-radius: 5px;
}

/* Pure-CSS accessible language toggle */
.lang-radio {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  border: 0;
  clip: rect(0 0 0 0);
  overflow: hidden;
}

/* Homepage language visibility (default EN) */
.page-shell [data-lang="zh"] {
  display: none;
}

#lang-zh:checked ~ .page-shell [data-lang="en"] {
  display: none;
}

#lang-zh:checked ~ .page-shell [data-lang="zh"] {
  display: revert;
}

/* Privacy policy language filter (default Bilingual shows both EN & ZH) */
#priv-en:checked ~ .page-shell .policy-zh,
#priv-en:checked ~ .page-shell .lang-divider {
  display: none;
}

#priv-zh:checked ~ .page-shell .policy-en,
#priv-zh:checked ~ .page-shell .lang-divider {
  display: none;
}

/* Active state styling on language switch labels */
#lang-en:checked ~ .page-shell label[for="lang-en"],
#lang-zh:checked ~ .page-shell label[for="lang-zh"],
#priv-all:checked ~ .page-shell label[for="priv-all"],
#priv-en:checked ~ .page-shell label[for="priv-en"],
#priv-zh:checked ~ .page-shell label[for="priv-zh"] {
  background: var(--gold-tint);
  color: var(--gold);
  border-color: var(--gold-line);
  font-weight: 600;
}

#lang-en:focus-visible ~ .page-shell label[for="lang-en"],
#lang-zh:focus-visible ~ .page-shell label[for="lang-zh"],
#priv-all:focus-visible ~ .page-shell label[for="priv-all"],
#priv-en:focus-visible ~ .page-shell label[for="priv-en"],
#priv-zh:focus-visible ~ .page-shell label[for="priv-zh"] {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 12px;
  z-index: 100;
  padding: 0.55rem 1rem;
  background: var(--gold);
  color: var(--ink-dark);
  border-radius: var(--radius-pill);
  font-weight: 600;
  text-decoration: none;
}

.skip-link:focus {
  left: 16px;
}

.container {
  width: min(var(--max-page), calc(100% - 2.5rem));
  margin-inline: auto;
}

/* Masthead */
.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(11, 12, 14, 0.86);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--hairline);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 4.25rem;
  padding-block: 0.5rem;
}

.brand-link {
  display: inline-flex;
  align-items: center;
  gap: 0.72rem;
  color: var(--ink-primary);
  text-decoration: none;
  font-family: var(--font-display);
  font-weight: 650;
  font-size: 1.08rem;
  letter-spacing: -0.02em;
}

.brand-link:hover {
  color: var(--ink-primary);
}

.brand-mark {
  width: 34px;
  height: 34px;
  flex-shrink: 0;
}

.header-nav {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 1.25rem;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 1.35rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-links a {
  color: var(--ink-secondary);
  text-decoration: none;
  font-size: 0.92rem;
  font-weight: 500;
}

.nav-links a:hover,
.nav-links a[aria-current="page"] {
  color: var(--ink-primary);
}

.lang-switch {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 3px;
  background: var(--bg-surface);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-pill);
}

.lang-pill {
  cursor: pointer;
  user-select: none;
  padding: 0.24rem 0.68rem;
  border-radius: var(--radius-pill);
  border: 1px solid transparent;
  color: var(--ink-secondary);
  font-size: 0.82rem;
  line-height: 1.35;
  transition: background-color 140ms ease, color 140ms ease;
}

.lang-pill:hover {
  color: var(--ink-primary);
}

/* Hero */
.hero {
  padding-block: 4rem 3.5rem;
  border-bottom: 1px solid var(--hairline);
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.02fr) minmax(0, 1.18fr);
  gap: 3rem;
  align-items: center;
}

.hero-title {
  margin: 0 0 1.15rem;
  font-family: var(--font-display);
  font-size: clamp(2.15rem, 4vw, 3.35rem);
  font-weight: 680;
  line-height: 1.1;
  letter-spacing: -0.03em;
  text-wrap: balance;
  color: var(--ink-primary);
}

.hero-lead {
  margin: 0 0 1.85rem;
  max-width: 58ch;
  color: var(--ink-secondary);
  font-size: 1.08rem;
  line-height: 1.65;
  text-wrap: pretty;
}

.cta-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.85rem;
  margin-bottom: 2.2rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.85rem;
  padding: 0.68rem 1.35rem;
  border-radius: var(--radius-pill);
  font-size: 0.95rem;
  font-weight: 600;
  text-decoration: none;
  transition: background-color 150ms ease, border-color 150ms ease, transform 150ms cubic-bezier(0.22, 1, 0.36, 1);
}

.btn:active {
  transform: scale(0.985);
}

.btn-primary {
  background: var(--gold);
  color: var(--ink-dark);
  border: 1px solid var(--gold);
}

.btn-primary:hover {
  background: var(--gold-bright);
  border-color: var(--gold-bright);
  color: var(--ink-dark);
}

.btn-secondary {
  background: var(--bg-surface);
  color: var(--ink-primary);
  border: 1px solid var(--hairline-strong);
}

.btn-secondary:hover {
  background: var(--bg-elevated);
  border-color: var(--gold-line);
  color: var(--ink-primary);
}

/* Engraved optical constants ruler */
.spec-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem;
  margin: 0;
  padding-top: 1.35rem;
  border-top: 1px solid var(--hairline);
  font-variant-numeric: tabular-nums;
}

.spec-strip div {
  min-width: 0;
}

.spec-strip dt {
  font-size: 0.78rem;
  color: var(--ink-muted);
  margin-bottom: 0.2rem;
}

.hero-grid > *,
.optics-layout > *,
.spec-columns > *,
.compat-split > *,
.doc-shell > * {
  min-width: 0;
}

.spec-strip dd {
  margin: 0;
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 650;
  color: var(--ink-primary);
  letter-spacing: -0.01em;
  white-space: nowrap;
}

.hero-stage {
  background: var(--bg-chamber);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-lg);
  padding: 1rem;
  box-shadow: var(--shadow-deep);
}

/* Content bands */
.band {
  padding-block: 4.5rem;
  border-bottom: 1px solid var(--hairline);
}

.band-header {
  max-width: 66ch;
  margin-bottom: 2.5rem;
}

.band-title {
  margin: 0 0 0.75rem;
  font-family: var(--font-display);
  font-size: clamp(1.65rem, 2.7vw, 2.25rem);
  font-weight: 660;
  line-height: 1.18;
  letter-spacing: -0.024em;
  text-wrap: balance;
}

.band-intro {
  margin: 0;
  color: var(--ink-secondary);
  font-size: 1.03rem;
  max-width: 65ch;
  text-wrap: pretty;
}

/* Optical bench layout */
.optics-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 0.95fr);
  gap: 2.5rem;
  align-items: start;
}

.diagram-frame {
  background: var(--bg-surface);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-lg);
  padding: 0.85rem;
}

.ledger-list {
  list-style: none;
  margin: 0;
  padding: 0;
  border-top: 1px solid var(--hairline);
}

.ledger-list li {
  padding-block: 1.25rem;
  border-bottom: 1px solid var(--hairline);
}

.ledger-list h3 {
  margin: 0 0 0.38rem;
  font-size: 1.06rem;
  font-weight: 640;
  color: var(--ink-primary);
}

.ledger-list p {
  margin: 0;
  color: var(--ink-secondary);
  font-size: 0.95rem;
  max-width: 62ch;
}

/* Two-column technical specification sheet */
.spec-columns {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 2.5rem;
  margin-bottom: 2.75rem;
}

.spec-sheet {
  background: var(--bg-surface);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-lg);
  padding: 1.85rem 2rem;
}

.spec-sheet h3 {
  margin: 0 0 1rem;
  font-family: var(--font-display);
  font-size: 1.22rem;
  font-weight: 650;
  letter-spacing: -0.015em;
}

.feature-rows {
  margin: 0;
}

.feature-row {
  display: grid;
  grid-template-columns: 9.5rem minmax(0, 1fr);
  gap: 1rem;
  padding-block: 0.82rem;
  border-top: 1px solid var(--hairline);
  font-size: 0.94rem;
}

.feature-row dt {
  font-weight: 600;
  color: var(--ink-primary);
}

.feature-row dd {
  margin: 0;
  color: var(--ink-secondary);
}

/* Output table */
.table-wrap {
  overflow-x: auto;
  background: var(--bg-surface);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-md);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.93rem;
  font-variant-numeric: tabular-nums;
}

.data-table caption {
  text-align: left;
  padding: 1.1rem 1.35rem 0.85rem;
  font-weight: 640;
  font-size: 1rem;
  color: var(--ink-primary);
  border-bottom: 1px solid var(--hairline);
}

.data-table th,
.data-table td {
  text-align: left;
  padding: 0.85rem 1.35rem;
  border-bottom: 1px solid var(--hairline);
  vertical-align: top;
}

.data-table th {
  color: var(--ink-muted);
  font-weight: 600;
  font-size: 0.84rem;
  background: rgba(255, 255, 255, 0.018);
}

.data-table tbody tr:last-child td {
  border-bottom: 0;
}

.data-table td strong {
  color: var(--ink-primary);
}

/* Compatibility & startup split */
.compat-split {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 2.25rem;
}

.panel-surface {
  background: var(--bg-surface);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-lg);
  padding: 1.75rem 1.9rem;
}

.panel-surface h3 {
  margin: 0 0 0.65rem;
  font-size: 1.16rem;
  font-weight: 650;
}

.panel-surface p {
  margin: 0 0 1rem;
  color: var(--ink-secondary);
  max-width: 62ch;
}

.panel-surface p:last-child {
  margin-bottom: 0;
}

.route-list {
  margin: 1rem 0 0;
  padding: 0;
  list-style: none;
}

.route-list li {
  padding-block: 0.8rem;
  border-top: 1px solid var(--hairline);
  color: var(--ink-secondary);
  font-size: 0.94rem;
}

.route-list strong {
  color: var(--ink-primary);
}

/* Accordion FAQ */
.faq-list {
  max-width: 76ch;
  border-top: 1px solid var(--hairline);
}

.faq-item {
  border-bottom: 1px solid var(--hairline);
}

.faq-item summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.25rem;
  padding-block: 1.2rem;
  font-size: 1.04rem;
  font-weight: 620;
  color: var(--ink-primary);
}

.faq-item summary::-webkit-details-marker {
  display: none;
}

.faq-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  color: var(--gold);
  transition: transform 180ms cubic-bezier(0.22, 1, 0.36, 1);
}

.faq-item[open] .faq-icon {
  transform: rotate(45deg);
}

.faq-body {
  padding-bottom: 1.25rem;
  color: var(--ink-secondary);
  max-width: 68ch;
  font-size: 0.96rem;
}

.faq-body p {
  margin: 0;
}

/* Privacy Policy Read-mode Layout */
.doc-masthead {
  padding-block: 3rem 2.25rem;
  border-bottom: 1px solid var(--hairline);
}

.doc-title {
  margin: 0 0 0.65rem;
  font-family: var(--font-display);
  font-size: clamp(1.9rem, 3.2vw, 2.65rem);
  font-weight: 680;
  letter-spacing: -0.026em;
  line-height: 1.15;
}

.doc-meta {
  margin: 0 0 1.75rem;
  color: var(--ink-secondary);
  font-size: 0.95rem;
  font-variant-numeric: tabular-nums;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  background: var(--hairline);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.summary-cell {
  background: var(--bg-surface);
  padding: 1.05rem 1.2rem;
}

.summary-cell dt {
  font-size: 0.8rem;
  color: var(--ink-muted);
  margin-bottom: 0.25rem;
}

.summary-cell dd {
  margin: 0;
  font-weight: 650;
  font-size: 0.96rem;
  color: var(--ink-primary);
}

.doc-shell {
  display: grid;
  grid-template-columns: 230px minmax(0, 68ch);
  gap: 3.5rem;
  padding-block: 3rem 4.5rem;
  align-items: start;
}

.doc-toc {
  position: sticky;
  top: 5.5rem;
  padding-right: 1rem;
  border-right: 1px solid var(--hairline);
}

.doc-toc h2 {
  margin: 0 0 0.75rem;
  font-size: 0.88rem;
  font-weight: 650;
  color: var(--ink-primary);
}

.doc-toc ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.doc-toc li {
  margin-bottom: 0.5rem;
}

.doc-toc a {
  color: var(--ink-secondary);
  text-decoration: none;
  font-size: 0.88rem;
  line-height: 1.4;
  display: block;
}

.doc-toc a:hover {
  color: var(--gold);
}

.doc-article section {
  margin-bottom: 2.6rem;
  scroll-margin-top: 5.5rem;
}

.doc-article h2 {
  margin: 2.4rem 0 0.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--hairline);
  font-family: var(--font-display);
  font-size: 1.42rem;
  font-weight: 660;
  letter-spacing: -0.02em;
  color: var(--ink-primary);
}

.doc-article section:first-child h2 {
  margin-top: 0;
}

.doc-article h3 {
  margin: 1.65rem 0 0.45rem;
  font-size: 1.08rem;
  font-weight: 640;
  color: var(--ink-primary);
}

.doc-article p,
.doc-article li {
  color: var(--ink-secondary);
  font-size: 1rem;
  line-height: 1.68;
}

.doc-article p {
  margin: 0 0 1rem;
}

.doc-article ul {
  margin: 0 0 1.1rem;
  padding-left: 1.25rem;
}

.doc-article li {
  margin-bottom: 0.45rem;
}

.doc-article strong {
  color: var(--ink-primary);
}

.lang-divider {
  margin: 3.25rem 0;
  border: 0;
  border-top: 1px solid var(--hairline-strong);
}

/* Footer */
.site-footer {
  padding-block: 2.5rem 3rem;
  background: #08090b;
  border-top: 1px solid var(--hairline);
  color: var(--ink-muted);
  font-size: 0.9rem;
}

.footer-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1.25rem;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 1.35rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

/* Responsive breakpoints */
@media (max-width: 980px) {
  .hero-grid,
  .optics-layout,
  .spec-columns,
  .compat-split {
    grid-template-columns: 1fr;
  }

  .summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .doc-shell {
    grid-template-columns: 1fr;
    gap: 2rem;
  }

  .doc-toc {
    position: static;
    border-right: 0;
    border-bottom: 1px solid var(--hairline);
    padding: 0 0 1.25rem;
  }
}

@media (max-width: 640px) {
  .container {
    width: calc(100% - 1.75rem);
  }

  .header-inner {
    flex-wrap: wrap;
  }

  .nav-links {
    gap: 0.9rem;
  }

  .hero {
    padding-block: 2.5rem 2.75rem;
  }

  .spec-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .feature-row {
    grid-template-columns: 1fr;
    gap: 0.2rem;
  }

  .spec-sheet,
  .panel-surface {
    padding: 1.35rem 1.25rem;
  }

  .summary-grid {
    grid-template-columns: 1fr;
  }
}
