/* ============================================================
   6.02214076.com — Avogadro Constant Science Site
   Dark · Tech · Rigorous
   ============================================================ */

:root {
  --bg: #05070f;
  --bg-soft: #0a0f1e;
  --panel: rgba(255, 255, 255, 0.035);
  --panel-strong: rgba(255, 255, 255, 0.06);
  --line: rgba(148, 163, 184, 0.14);
  --ink: #e8eef9;
  --muted: #93a0b8;
  --faint: #5d6b84;
  --cyan: #3ce0ff;
  --violet: #8b8cf8;
  --amber: #ffd166;
  --grad: linear-gradient(120deg, #3ce0ff 0%, #8b8cf8 60%, #c084fc 100%);
  --font-body: "Inter", "Noto Sans SC", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  --font-display: "Space Grotesk", "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  --font-mono: "JetBrains Mono", "SFMono-Regular", Consolas, "Courier New", monospace;
  --nav-h: 68px;
  --radius: 18px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

::selection { background: rgba(60, 224, 255, 0.25); }

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }

.container { width: min(1120px, 92%); margin: 0 auto; }

/* ---------- ambient background ---------- */
.bg-glow {
  position: fixed; inset: 0; z-index: -2; pointer-events: none;
  background:
    radial-gradient(900px 500px at 85% -10%, rgba(139, 140, 248, 0.16), transparent 60%),
    radial-gradient(800px 520px at 8% 12%, rgba(60, 224, 255, 0.10), transparent 60%),
    radial-gradient(700px 700px at 50% 115%, rgba(192, 132, 252, 0.10), transparent 60%),
    var(--bg);
}
.bg-grid {
  position: fixed; inset: 0; z-index: -1; pointer-events: none; opacity: 0.5;
  background-image:
    linear-gradient(rgba(148, 163, 184, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(148, 163, 184, 0.05) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: radial-gradient(ellipse 90% 70% at 50% 0%, #000 30%, transparent 75%);
  -webkit-mask-image: radial-gradient(ellipse 90% 70% at 50% 0%, #000 30%, transparent 75%);
}

/* ---------- navigation ---------- */
.nav {
  position: sticky; top: 0; z-index: 50;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  background: rgba(5, 7, 15, 0.72);
  border-bottom: 1px solid var(--line);
}
.nav-inner {
  height: var(--nav-h);
  display: flex; align-items: center; gap: 28px;
}
.logo { display: flex; align-items: center; gap: 12px; font-family: var(--font-display); }
.logo-na {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 44px; height: 44px; padding: 0 10px;
  border: 1px solid rgba(60, 224, 255, 0.45);
  border-radius: 12px;
  background: linear-gradient(160deg, rgba(60, 224, 255, 0.14), rgba(139, 140, 248, 0.14));
  font-weight: 700; font-size: 18px; letter-spacing: 0.5px;
  color: var(--cyan);
  box-shadow: 0 0 24px rgba(60, 224, 255, 0.18) inset;
}
.logo-na sub { font-size: 11px; color: var(--violet); }
.logo-text { font-size: 15px; font-weight: 600; letter-spacing: 0.4px; }
.logo-text b { color: var(--cyan); font-weight: 700; }

.nav-links { display: flex; gap: 4px; margin-left: auto; }
.nav-links a {
  padding: 8px 14px; border-radius: 10px;
  font-size: 14px; color: var(--muted);
  transition: color .2s, background .2s;
}
.nav-links a:hover { color: var(--ink); background: var(--panel-strong); }
body[data-page="home"] .nav-links a[data-nav="home"],
body[data-page="carbon12"] .nav-links a[data-nav="carbon12"],
body[data-page="silicon"] .nav-links a[data-nav="silicon"],
body[data-page="redefinition"] .nav-links a[data-nav="redefinition"],
body[data-page="scale"] .nav-links a[data-nav="scale"] {
  color: var(--cyan); background: rgba(60, 224, 255, 0.08);
}

.lang-btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 7px 16px; border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink); font-size: 13px; font-weight: 600;
  cursor: pointer; transition: border-color .2s, background .2s;
  font-family: var(--font-body);
}
.lang-btn:hover { border-color: rgba(60, 224, 255, 0.5); background: rgba(60, 224, 255, 0.08); }
.lang-btn .globe { color: var(--cyan); }

.nav-toggle {
  display: none; margin-left: auto;
  background: none; border: 1px solid var(--line); border-radius: 10px;
  color: var(--ink); width: 42px; height: 42px; cursor: pointer; font-size: 18px;
}

/* ---------- hero ---------- */
.hero {
  position: relative;
  padding: clamp(72px, 12vh, 140px) 0 clamp(64px, 10vh, 110px);
  text-align: center;
  overflow: hidden;
}
#particles {
  position: absolute; inset: 0; z-index: 0;
  pointer-events: none;
}
.hero > .container { position: relative; z-index: 1; }

.kicker {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 7px 18px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--panel);
  font-size: 13px; letter-spacing: 2px; color: var(--muted);
  text-transform: uppercase;
  margin-bottom: 28px;
}
.kicker::before {
  content: ""; width: 7px; height: 7px; border-radius: 50%;
  background: var(--cyan); box-shadow: 0 0 10px var(--cyan);
  animation: pulse 2.4s ease-in-out infinite;
}
@keyframes pulse { 50% { opacity: 0.35; } }

.hero-number {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: clamp(44px, 9vw, 104px);
  line-height: 1.08;
  letter-spacing: -1px;
  background: var(--grad);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
  filter: drop-shadow(0 0 34px rgba(60, 224, 255, 0.22));
}
.hero-number .exp { font-size: 0.52em; vertical-align: super; letter-spacing: 0; }
.hero-number .unit { font-size: 0.36em; color: var(--muted); -webkit-text-fill-color: var(--muted); margin-left: 10px; letter-spacing: 1px; }

.hero-sub {
  max-width: 720px; margin: 26px auto 0;
  font-size: clamp(16px, 2.2vw, 19px); color: var(--muted);
}
.hero-badge {
  display: inline-flex; align-items: center; gap: 10px;
  margin-top: 26px; padding: 10px 20px; border-radius: 12px;
  border: 1px dashed rgba(255, 209, 102, 0.45);
  background: rgba(255, 209, 102, 0.06);
  font-size: 14px; color: #f2ddae;
  font-family: var(--font-mono);
}
.hero-cta { margin-top: 40px; display: flex; gap: 16px; justify-content: center; flex-wrap: wrap; }

.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 13px 30px; border-radius: 12px;
  font-size: 15px; font-weight: 600;
  transition: transform .2s, box-shadow .2s, background .2s;
}
.btn-primary {
  background: var(--grad); color: #051018;
  box-shadow: 0 8px 30px rgba(60, 224, 255, 0.25);
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 12px 38px rgba(60, 224, 255, 0.38); }
.btn-ghost { border: 1px solid var(--line); color: var(--ink); background: var(--panel); }
.btn-ghost:hover { border-color: rgba(60, 224, 255, 0.5); transform: translateY(-2px); }

.scroll-hint {
  margin-top: 56px; font-size: 12px; letter-spacing: 3px;
  color: var(--faint); text-transform: uppercase;
}

/* topic page hero (compact) */
.hero-page { padding: clamp(56px, 9vh, 96px) 0 40px; text-align: left; }
.hero-page .kicker { margin-bottom: 18px; }
.hero-page h1 {
  font-family: var(--font-display);
  font-size: clamp(30px, 5vw, 52px);
  font-weight: 700; line-height: 1.2; letter-spacing: -0.5px;
}
.hero-page h1 .grad { background: var(--grad); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.hero-page .lead { max-width: 780px; margin-top: 18px; color: var(--muted); font-size: 17px; }

/* ---------- sections ---------- */
.section { padding: clamp(48px, 8vh, 84px) 0; }
.section + .section { border-top: 1px solid rgba(148, 163, 184, 0.08); }

.section-head { max-width: 760px; margin-bottom: 36px; }
.section-head .eyebrow {
  font-family: var(--font-mono); font-size: 12px; letter-spacing: 3px;
  color: var(--cyan); text-transform: uppercase; margin-bottom: 12px;
}
.section-head h2 {
  font-family: var(--font-display);
  font-size: clamp(24px, 3.6vw, 36px); font-weight: 700; letter-spacing: -0.3px;
}
.section-head p { margin-top: 12px; color: var(--muted); }

.prose { max-width: 780px; color: #c3cddd; }
.prose p + p { margin-top: 18px; }
.prose strong { color: var(--ink); }
.prose .hl { color: var(--cyan); font-weight: 600; }

/* ---------- cards / grids ---------- */
.grid { display: grid; gap: 20px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

.card {
  position: relative;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 28px;
  transition: transform .25s, border-color .25s, background .25s;
  overflow: hidden;
}
.card:hover { transform: translateY(-4px); border-color: rgba(60, 224, 255, 0.35); background: var(--panel-strong); }

.topic-card { display: flex; flex-direction: column; gap: 14px; }
.topic-card .idx {
  font-family: var(--font-mono); font-size: 13px; color: var(--faint);
}
.topic-card h3 { font-family: var(--font-display); font-size: 20px; font-weight: 700; }
.topic-card p { color: var(--muted); font-size: 14.5px; flex: 1; }
.topic-card .more {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 14px; font-weight: 600; color: var(--cyan);
}
.topic-card .more .arrow { transition: transform .2s; }
.topic-card:hover .more .arrow { transform: translateX(4px); }

.tag {
  display: inline-block; padding: 3px 12px; border-radius: 999px;
  font-size: 12px; font-weight: 600; letter-spacing: 0.5px;
  border: 1px solid rgba(60, 224, 255, 0.35); color: var(--cyan);
  background: rgba(60, 224, 255, 0.07);
}
.tag.violet { border-color: rgba(139, 140, 248, 0.4); color: var(--violet); background: rgba(139, 140, 248, 0.07); }
.tag.amber { border-color: rgba(255, 209, 102, 0.4); color: var(--amber); background: rgba(255, 209, 102, 0.06); }

/* ---------- stats ---------- */
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; margin-top: 36px; }
.stat {
  text-align: center; padding: 30px 20px;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--panel);
}
.stat .v {
  font-family: var(--font-mono); font-weight: 700;
  font-size: clamp(22px, 3.4vw, 32px);
  background: var(--grad); -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}
.stat .l { margin-top: 8px; font-size: 13.5px; color: var(--muted); }

/* ---------- formula box ---------- */
.formula {
  margin: 28px 0; padding: 26px 30px;
  border: 1px solid rgba(60, 224, 255, 0.28);
  border-radius: 14px;
  background: linear-gradient(140deg, rgba(60, 224, 255, 0.06), rgba(139, 140, 248, 0.05));
  font-family: var(--font-mono);
  font-size: clamp(16px, 2.6vw, 22px);
  text-align: center; color: var(--ink);
  overflow-x: auto; white-space: nowrap;
}
.formula .sym { color: var(--cyan); font-weight: 700; }
.formula sub { font-size: 0.65em; }
.formula sup { font-size: 0.65em; }

/* ---------- quote / definition ---------- */
.defbox {
  margin: 30px 0; padding: 26px 30px 26px 34px;
  border-left: 3px solid var(--cyan);
  border-radius: 0 14px 14px 0;
  background: var(--panel);
  color: #c9d4e4; font-size: 16.5px;
}
.defbox .src { display: block; margin-top: 12px; font-size: 13px; color: var(--faint); }

/* ---------- person / measurement cards ---------- */
.mcard { display: flex; flex-direction: column; gap: 10px; }
.mcard .who { display: flex; align-items: baseline; gap: 10px; }
.mcard .who .name { font-family: var(--font-display); font-weight: 700; font-size: 17px; }
.mcard .who .year { font-family: var(--font-mono); font-size: 13px; color: var(--cyan); }
.mcard p { color: var(--muted); font-size: 14.5px; }

/* ---------- list ---------- */
.flist { margin-top: 18px; display: grid; gap: 12px; }
.flist li {
  list-style: none; position: relative;
  padding: 14px 18px 14px 44px;
  border: 1px solid var(--line); border-radius: 12px;
  background: var(--panel); color: #c3cddd; font-size: 15px;
}
.flist li::before {
  content: "◇"; position: absolute; left: 18px; top: 14px;
  color: var(--cyan); font-size: 13px;
}

/* ---------- big fact cards (scale page) ---------- */
.fact-card { display: flex; flex-direction: column; gap: 12px; }
.fact-card .fv {
  font-family: var(--font-mono); font-weight: 700;
  font-size: clamp(24px, 4vw, 34px); line-height: 1.15;
  background: var(--grad); -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}
.fact-card h3 { font-family: var(--font-display); font-size: 17px; }
.fact-card p { color: var(--muted); font-size: 14.5px; }

/* ---------- constants table ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); }
table.constants { width: 100%; border-collapse: collapse; font-size: 14.5px; min-width: 640px; }
table.constants th {
  text-align: left; padding: 14px 18px;
  font-family: var(--font-display); font-weight: 600; font-size: 13px;
  letter-spacing: 1px; color: var(--muted); text-transform: uppercase;
  background: rgba(255, 255, 255, 0.03);
  border-bottom: 1px solid var(--line);
}
table.constants td { padding: 14px 18px; border-bottom: 1px solid rgba(148, 163, 184, 0.08); color: #c3cddd; }
table.constants tr:last-child td { border-bottom: none; }
table.constants td.val { font-family: var(--font-mono); white-space: nowrap; color: var(--ink); }
table.constants td.sym { font-family: var(--font-mono); color: var(--violet); white-space: nowrap; }
table.constants tr.focus td { background: rgba(60, 224, 255, 0.06); }
table.constants tr.focus td:first-child { box-shadow: inset 3px 0 0 var(--cyan); }

/* ---------- next page link ---------- */
.next-link {
  display: flex; align-items: center; justify-content: space-between; gap: 20px;
  margin-top: 40px; padding: 26px 32px;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--panel); transition: border-color .25s;
}
.next-link:hover { border-color: rgba(60, 224, 255, 0.4); }
.next-link .nl-label { font-size: 12px; letter-spacing: 2px; color: var(--faint); text-transform: uppercase; }
.next-link .nl-title { font-family: var(--font-display); font-size: 19px; font-weight: 700; margin-top: 4px; color: var(--cyan); }
.next-link .nl-arrow { font-size: 24px; color: var(--cyan); }

/* ---------- footer ---------- */
.footer {
  margin-top: 60px; padding: 56px 0 40px;
  border-top: 1px solid var(--line);
  background: linear-gradient(180deg, transparent, rgba(10, 15, 30, 0.6));
}
.footer-grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 36px; }
.footer h4 { font-family: var(--font-display); font-size: 14px; letter-spacing: 1px; color: var(--muted); margin-bottom: 14px; text-transform: uppercase; }
.footer p, .footer li { font-size: 14px; color: var(--faint); }
.footer ul { list-style: none; display: grid; gap: 8px; }
.footer a:hover { color: var(--cyan); }
.footer .f-brand { font-family: var(--font-mono); font-size: 15px; color: var(--ink); margin-bottom: 10px; }
.footer-bottom {
  margin-top: 44px; padding-top: 22px;
  border-top: 1px solid rgba(148, 163, 184, 0.08);
  display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  font-size: 13px; color: var(--faint);
}
.footer .domain-story { font-family: var(--font-mono); font-size: 13.5px; color: #f2ddae; }

/* ---------- reveal animation ---------- */
.reveal { opacity: 0; transform: translateY(22px); transition: opacity .7s ease, transform .7s ease; }
.reveal.visible { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
  html { scroll-behavior: auto; }
}

/* ---------- responsive ---------- */
@media (max-width: 960px) {
  .grid-3, .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .footer-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 720px) {
  .grid-2, .grid-3, .grid-4, .stats { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr; }
  .nav-links {
    display: none; position: absolute; top: var(--nav-h); left: 0; right: 0;
    flex-direction: column; padding: 12px;
    background: rgba(5, 7, 15, 0.97); border-bottom: 1px solid var(--line);
  }
  .nav-links.open { display: flex; }
  .nav-toggle { display: block; }
  .nav-inner { gap: 12px; }
  .lang-btn { margin-left: auto; }
  .nav-toggle { margin-left: 0; }
}
