/* ==========================================================================
   nsF5 Steganography · Interactive Learning Lab
   Design system — a "signal / forensic lab" look: deep navy ink, a phosphor
   teal accent, crisp instrument panels, and monospaced readouts.
   ========================================================================== */

:root {
  /* color */
  --ink: #0b1f33;
  --ink-2: #41556c;
  /* 2026-09-14: #6b7d90 对白底只有 4.2:1, 低于 WCAG AA 的 4.5:1 ——
     axe 在 #bitplane-note / #thr-note / #pay-value 上判了 serious。
     加深到 #607086 (约 5.0:1), 视觉上几乎看不出差别但过了标准。 */
  --ink-3: #607086;
  --brand: #1a60b0;
  --brand-strong: #123f7a;
  --brand-soft: #e8f2fc;
  --teal: #0f9d94;
  --teal-strong: #0b6b66;
  --teal-soft: #e2f5f3;
  --amber: #e8930c;
  --green: #159a3c;
  --green-soft: #e7f6ec;
  --red: #ce3535;
  --red-soft: #fdeded;
  --bg: #ffffff;
  --bg-soft: #f5f8fb;
  --line: #dde6f0;
  --line-strong: #c5d3e2;
  /* dark instrument panel */
  --panel: #0d2034;
  --panel-line: #1d3a59;
  --phosphor: #3fd0c0;
  --phosphor-dim: #7fe0d5;

  /* elevation */
  --shadow-sm: 0 1px 2px rgba(11, 31, 51, .06), 0 3px 10px rgba(11, 31, 51, .05);
  --shadow-md: 0 8px 24px rgba(11, 31, 51, .10);
  --shadow-lg: 0 18px 44px rgba(11, 31, 51, .16);

  /* shape & rhythm */
  --radius: 16px;
  --radius-sm: 10px;
  --radius-pill: 999px;

  /* type */
  --font-sans: "Space Grotesk", "Segoe UI", "PingFang SC", "Microsoft YaHei",
               system-ui, -apple-system, sans-serif;
  --font-mono: "JetBrains Mono", "SFMono-Regular", Consolas, "Liberation Mono",
               monospace;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font-sans);
  color: var(--ink);
  background: var(--bg);
  line-height: 1.65;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img { max-width: 100%; display: block; }
a { color: var(--brand); }
::selection { background: var(--teal); color: #fff; }

:focus-visible {
  outline: 3px solid var(--teal);
  outline-offset: 2px;
  border-radius: 4px;
}

/* ---------- skip link (a11y) ---------- */
.skip-link {
  position: absolute; left: -9999px; top: 0;
  background: var(--ink); color: #fff;
  padding: 10px 18px; border-radius: 0 0 10px 0; z-index: 100;
  text-decoration: none; font-weight: 700;
}
.skip-link:focus { left: 0; }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; gap: 18px;
  padding: 10px 26px;
  background: rgba(255, 255, 255, .82);
  backdrop-filter: saturate(180%) blur(10px);
  -webkit-backdrop-filter: saturate(180%) blur(10px);
  border-bottom: 1px solid var(--line);
}
.brand {
  display: inline-flex; align-items: center; gap: 8px;
  font-weight: 800; color: var(--ink); text-decoration: none; letter-spacing: .1px;
  white-space: nowrap;
}
.brand::before {
  content: ""; width: 9px; height: 9px; border-radius: 50%;
  background: var(--teal); box-shadow: 0 0 0 4px var(--teal-soft);
}
.nav { display: flex; gap: 4px; margin-left: auto; flex-wrap: wrap; }
.nav a {
  color: var(--ink-2); text-decoration: none; font-size: .95rem; font-weight: 600;
  padding: 6px 11px; border-radius: var(--radius-pill); transition: color .15s, background .15s;
}
.nav a:hover { color: var(--brand); background: var(--brand-soft); }
.nav a.active { color: var(--brand-strong); font-weight: 700; background: var(--brand-soft); }
.lang-btn {
  border: 1px solid var(--brand); color: var(--brand); background: #fff;
  border-radius: var(--radius-pill); padding: 5px 14px; font-weight: 700; cursor: pointer;
  font-family: var(--font-sans); font-size: .9rem;
  transition: background .15s, color .15s, transform .12s;
}
.lang-btn:hover { background: var(--brand); color: #fff; transform: translateY(-1px); }
.menu-btn {
  display: none; border: 1px solid var(--line-strong); background: #fff;
  border-radius: var(--radius-sm); padding: 6px 12px; font-size: 1.1rem; cursor: pointer;
}

/* ---------- sections ---------- */
section { scroll-margin-top: 72px; }
.hero {
  position: relative; overflow: hidden;
  display: grid; grid-template-columns: 1.05fr 1fr; gap: 44px; align-items: center;
  padding: 76px 7vw 64px;
  background:
    radial-gradient(900px 460px at 8% -12%, #eaf4ff 0%, transparent 60%),
    radial-gradient(720px 420px at 98% -4%, #e2f6f3 0%, transparent 55%),
    #ffffff;
  border-bottom: 1px solid var(--line);
}
.hero::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background-image:
    linear-gradient(rgba(26, 96, 176, .05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(26, 96, 176, .05) 1px, transparent 1px);
  background-size: 46px 46px;
  -webkit-mask-image: radial-gradient(120% 90% at 28% 12%, #000 0%, transparent 62%);
  mask-image: radial-gradient(120% 90% at 28% 12%, #000 0%, transparent 62%);
}
.hero-copy, .hero-visual { position: relative; }
.eyebrow {
  color: var(--brand); font-weight: 800; letter-spacing: 1.6px;
  text-transform: uppercase; font-size: .82rem;
}
h1 {
  font-size: clamp(2rem, 4.4vw, 3.3rem); line-height: 1.16;
  margin: 12px 0 18px; letter-spacing: -.01em; color: var(--ink);
}
.lead { color: var(--ink-2); font-size: 1.1rem; max-width: 42rem; }
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; margin: 24px 0 20px; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 11px 24px; border-radius: var(--radius-pill);
  text-decoration: none; font-weight: 700; border: 1px solid transparent; cursor: pointer;
  font-family: var(--font-sans); font-size: .98rem;
  transition: transform .15s, box-shadow .15s, background .15s, color .15s, border-color .15s;
}
.btn.primary {
  background: linear-gradient(180deg, #1f6cc0, var(--brand-strong));
  color: #fff; box-shadow: 0 6px 16px rgba(26, 96, 176, .30);
}
.btn.primary:hover { transform: translateY(-2px); box-shadow: 0 10px 22px rgba(26, 96, 176, .36); }
.btn.ghost { background: #fff; color: var(--brand); border-color: var(--brand); }
.btn.ghost:hover { background: var(--brand-soft); transform: translateY(-2px); }
.btn:active { transform: translateY(0); }
.btn.small { padding: 8px 16px; font-size: .88rem; border-radius: var(--radius-sm); }

.hero-tags { display: flex; gap: 10px; flex-wrap: wrap; list-style: none; padding: 0; margin: 0; }
.hero-tags li {
  background: #fff; border: 1px solid var(--line-strong); padding: 5px 13px;
  border-radius: var(--radius-pill); font-size: .88rem; color: var(--ink-2); font-weight: 600;
}
.hero-visual img { border-radius: var(--radius); box-shadow: var(--shadow-lg); }
.hero-caption { margin-top: 12px; color: var(--ink-3); font-size: .92rem; text-align: center; }

/* ---------- section shell ---------- */
.section { padding: 68px 7vw; }
.section.alt { background: var(--bg-soft); }
.section-head { max-width: 880px; margin-bottom: 32px; }
.section-head h2 {
  font-size: clamp(1.5rem, 2.7vw, 2.25rem); margin: 8px 0 12px;
  letter-spacing: -.01em; color: var(--ink);
}
.section-head p { color: var(--ink-2); }

/* ---------- part tag ---------- */
.part-tag {
  display: inline-flex; align-items: center;
  background: linear-gradient(180deg, #12aca1, var(--teal-strong)); color: #fff;
  font-weight: 700; font-size: .78rem; letter-spacing: .6px;
  padding: 5px 13px; border-radius: var(--radius-pill); margin-bottom: 14px;
}

/* ---------- lab grid ---------- */
.lab-grid { display: grid; grid-template-columns: minmax(300px, 470px) 1fr; gap: 30px; align-items: start; }
.canvas-card {
  margin: 0; background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; box-shadow: var(--shadow-md); position: relative; overflow: hidden;
}
.canvas-card::before {
  content: ""; position: absolute; top: 0; left: 16px; right: 16px; height: 3px;
  background: linear-gradient(90deg, var(--brand), var(--teal)); border-radius: 0 0 4px 4px;
}
.canvas-card canvas {
  width: 100%; height: auto; background: #fafcff; border-radius: var(--radius-sm);
  border: 1px solid var(--line); touch-action: none;
}
.canvas-card canvas:focus { outline: 3px solid var(--teal); outline-offset: 3px; }
.stat-line { margin-top: 10px; color: var(--brand-strong); font-weight: 700; font-size: .95rem; }
.decode-note { margin: 10px 0 0; color: var(--brand-strong); }
.decode-note.err { color: var(--red); }
.lab-controls label { display: block; font-weight: 700; margin: 15px 0 6px; color: var(--ink); }
.lab-controls input[type=text], .lab-controls select {
  width: 100%; max-width: 340px; padding: 10px 13px; border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm); font-size: 1rem; font-family: var(--font-sans); color: var(--ink);
  background: #fff; transition: border-color .15s, box-shadow .15s;
}
.lab-controls input[type=text]:focus, .lab-controls select:focus {
  border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); outline: none;
}
.lab-controls input[type=range] { width: 100%; max-width: 400px; accent-color: var(--brand); cursor: pointer; }
.range-note { color: var(--ink-2); font-size: .88rem; margin-top: 4px; }
.btn-row { display: flex; gap: 10px; margin: 16px 0 10px; flex-wrap: wrap; }

/* ---------- monospace readout ---------- */
.mono {
  font-family: var(--font-mono);
  background: var(--panel); color: var(--phosphor);
  border: 1px solid var(--panel-line);
  border-radius: var(--radius-sm); padding: 12px 15px; margin: 12px 0; font-size: .95rem;
  line-height: 1.5; box-shadow: inset 0 0 0 1px rgba(63, 208, 192, .06);
}
.mono.sm { font-size: .85rem; }
.mono:empty { display: none; }
.hint { color: var(--ink-2); font-size: .92rem; margin: 8px 0; }
.wide-lab { margin-top: 28px; }
.learn-list { padding-left: 20px; color: var(--ink-2); }
.learn-list li { margin: 7px 0; }
.field-row { display: flex; gap: 14px; align-items: center; }
.field-row label { margin: 0; }

/* ---------- images & cards ---------- */
.thumb-row, .wide-figure { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-top: 28px; }
.thumb-row img, .wide-figure img { width: 100%; height: auto; border-radius: var(--radius); box-shadow: var(--shadow-md); }
.wide-img { margin: 0 auto 24px; border-radius: var(--radius); box-shadow: var(--shadow-md); }
.card-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; margin-top: 28px; }
.card {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 22px; box-shadow: var(--shadow-sm);
}
.card h3 { margin-top: 0; color: var(--brand-strong); font-size: 1.08rem; }
.card p { color: var(--ink-2); margin-bottom: 0; }
.card.link { text-decoration: none; transition: transform .18s ease, box-shadow .18s ease, border-color .18s; }
.card.link:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); border-color: var(--line-strong); }
.card.small h3 { font-size: 1.02rem; }

/* ---------- roadmap ---------- */
.road-note { color: var(--ink-2); max-width: 720px; }
.roadmap {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px;
  list-style: none; padding: 0; margin-top: 8px;
}
.roadmap li {
  background: #fff; border: 1px solid var(--line); border-left: 5px solid var(--teal);
  border-radius: 14px; padding: 15px 17px; box-shadow: var(--shadow-sm);
  transition: transform .15s ease, box-shadow .15s ease;
}
.roadmap li:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.roadmap b { display: block; color: var(--brand-strong); }
.roadmap span { color: var(--ink-2); display: block; font-size: .92rem; }

/* ---------- contents map (on this page) ---------- */
.contents {
  padding: 22px 7vw 10px;
  background: #fff;
  border-bottom: 1px solid var(--line);
  scroll-margin-top: 72px;
}
.contents-title {
  font-weight: 800; color: var(--brand-strong); letter-spacing: .8px;
  font-size: .8rem; margin: 0 0 14px; text-transform: uppercase;
}
.contents-parts { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.contents-part {
  background: var(--bg-soft); border: 1px solid var(--line);
  border-radius: 14px; padding: 14px 16px; transition: border-color .15s;
}
.contents-part:hover { border-color: var(--line-strong); }
.contents-part-head {
  font-weight: 800; color: var(--ink); margin: 0 0 10px; font-size: .98rem;
}
.contents-part a {
  display: block; color: var(--brand); text-decoration: none;
  padding: 5px 0; font-size: .9rem; border-bottom: 1px dashed var(--line);
  transition: color .12s, padding-left .12s;
}
.contents-part a:last-child { border-bottom: none; }
.contents-part a:hover { color: var(--brand-strong); padding-left: 4px; }

/* ---------- FAQ accordion ---------- */
.faq-list { display: grid; gap: 12px; max-width: 880px; }
.faq-item {
  background: #fff; border: 1px solid var(--line); border-radius: 14px;
  overflow: hidden; box-shadow: var(--shadow-sm);
}
.faq-item summary {
  cursor: pointer; padding: 16px 48px 16px 20px; font-weight: 700; color: var(--ink);
  list-style: none; position: relative; transition: background .15s ease;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after {
  content: "+"; position: absolute; right: 20px; top: 50%;
  transform: translateY(-50%); font-size: 1.4rem; color: var(--brand);
  transition: transform .2s ease;
}
.faq-item[open] summary::after { content: "–"; transform: translateY(-50%) rotate(180deg); }
.faq-item summary:hover { background: var(--bg-soft); }
.faq-item p { padding: 0 20px 18px; margin: 0; color: var(--ink-2); }

/* ---------- self-test quiz ---------- */
.quiz-box { display: grid; gap: 16px; max-width: 880px; }
.quiz-item {
  background: #fff; border: 1px solid var(--line); border-radius: 14px;
  padding: 20px 22px; box-shadow: var(--shadow-sm);
}
.quiz-q { margin: 0 0 14px; font-size: 1.04rem; color: var(--ink); }
.quiz-opts { display: grid; gap: 8px; }
.quiz-opt {
  text-align: left; font: 600 .96rem/1.5 var(--font-sans); color: var(--ink);
  background: var(--bg-soft); border: 1.5px solid var(--line);
  border-radius: var(--radius-sm); padding: 11px 15px; cursor: pointer;
  transition: border-color .12s, background .12s, color .12s, transform .12s;
}
.quiz-opt:hover { border-color: var(--brand); color: var(--brand); }
.quiz-opt.sel { border-color: var(--brand); background: var(--brand-soft); color: var(--brand-strong); font-weight: 700; }
.quiz-opt.right { border-color: var(--green); background: var(--green-soft); color: var(--green); font-weight: 700; }
.quiz-opt.wrong { border-color: var(--red); background: var(--red-soft); color: var(--red); font-weight: 700; }
.quiz-opt:disabled { cursor: default; opacity: .92; }
.quiz-check { margin-top: 14px; }
.quiz-fb { margin: 14px 0 0; padding: 11px 14px; border-radius: var(--radius-sm); font-size: .92rem; }
.quiz-fb.fb-right { background: var(--green-soft); color: var(--green); }
.quiz-fb.fb-wrong { background: var(--red-soft); color: var(--red); }
.quiz-score {
  display: flex; align-items: center; gap: 12px; margin-top: 24px;
  font-weight: 700; color: var(--brand-strong);
}
.quiz-score strong { font-size: 1.2rem; }

footer {
  text-align: center; padding: 30px; color: var(--ink-2);
  border-top: 1px solid var(--line); background: var(--bg-soft);
}
footer p { margin: 4px 0; }
footer a { color: var(--brand); text-decoration: none; }
footer a:hover { text-decoration: underline; }

/* ---------- bit-plane layering explorer ---------- */
.plane-chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0 6px; }
.plane-chip {
  font: 700 .82rem var(--font-mono);
  color: var(--ink-2);
  background: #fff; border: 1px solid var(--line-strong);
  border-radius: var(--radius-pill); padding: 6px 13px; cursor: pointer;
  transition: border-color .12s, color .12s, background .12s, transform .12s;
}
.plane-chip:hover { border-color: var(--brand); color: var(--brand); transform: translateY(-1px); }
.plane-chip.on {
  background: var(--brand); color: #fff; border-color: var(--brand);
  box-shadow: 0 6px 14px rgba(26, 96, 176, .28);
}
.layering-figure { margin: 32px 0 0; }
.layering-figure img { border-radius: var(--radius); box-shadow: var(--shadow-md); width: 100%; height: auto; }
.layering-figure figcaption {
  margin-top: 12px; color: var(--ink-2); font-size: .9rem; text-align: center;
}

/* ---------- entrance motion ---------- */
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
.hero-copy { animation: rise .5s ease both; }
.hero-visual { animation: rise .6s .08s ease both; }

/* ---------- responsive ---------- */
@media (max-width: 980px) {
  .hero, .lab-grid { grid-template-columns: 1fr; }
  .hero { gap: 28px; }
  .nav {
    display: none; position: absolute; top: 100%; left: 0; right: 0;
    background: #fff; border-bottom: 1px solid var(--line);
    flex-direction: column; gap: 0; padding: 8px 20px 14px;
    box-shadow: 0 18px 30px rgba(11, 31, 51, .12);
  }
  .nav.open { display: flex; }
  .nav a { padding: 9px 11px; border-bottom: 1px dashed var(--line); border-radius: 0; }
  .menu-btn { display: block; margin-left: auto; }
  .topbar .lang-btn { margin-left: 10px; }
  .thumb-row, .wide-figure, .card-row, .roadmap { grid-template-columns: 1fr; }
  .contents-parts { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 560px) {
  .contents-parts { grid-template-columns: 1fr; }
  .hero { padding: 56px 6vw 44px; }
  .section { padding: 52px 6vw; }
  .hero-actions, .btn-row { flex-direction: column; align-items: stretch; }
  .hero-actions .btn, .btn-row .btn { text-align: center; }
}

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