/* ── niffler website — dark, terminal-first, amber-accented ───────────── */

:root {
  --bg: #0a0e14;
  --bg-2: #0d1220;
  --panel: #111726;
  --panel-2: #0f1522;
  --border: #1e2a3f;
  --border-2: #2c3b58;
  --fg: #cdd6e4;
  --dim: #7a8699;
  --dim-2: #566174;
  --amber: #f5b942;
  --amber-dim: #8a6d2b;
  --green: #7ee787;
  --red: #ff6b6b;
  --cyan: #79c0ff;
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

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

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  background-image:
    radial-gradient(1200px 500px at 50% -100px, rgba(245, 185, 66, 0.05), transparent 60%),
    repeating-linear-gradient(0deg, transparent 0 31px, rgba(255, 255, 255, 0.012) 31px 32px);
  color: var(--fg);
  font-family: var(--mono);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* CJK fallbacks so zh/zh-TW copy renders consistently across platforms */
:lang(zh-CN), :lang(zh-TW) {
  font-family: var(--mono), "PingFang SC", "PingFang TC", "Hiragino Sans GB",
    "Noto Sans CJK SC", "Noto Sans TC", "Microsoft YaHei", "Microsoft JhengHei", sans-serif;
}

a { color: var(--amber); text-decoration: none; border-bottom: 1px dashed var(--amber-dim); }
a:hover { color: #ffd47e; border-bottom-style: solid; }

code {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 6px;
  font-family: var(--mono);
  font-size: 0.9em;
  color: var(--cyan);
}

pre { font-family: var(--mono); }

::selection { background: rgba(245, 185, 66, 0.25); }

/* ── nav ──────────────────────────────────────────────────────────────── */

.nav {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 28px;
  background: rgba(10, 14, 20, 0.85);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}

.nav-brand {
  font-weight: 700;
  color: var(--fg);
  border: none;
  letter-spacing: 0.02em;
}
.nav-brand .caret { color: var(--amber); }
.nav-brand:hover { color: var(--amber); }

.nav-links {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
}
.nav-links a {
  color: var(--dim);
  border: none;
  font-size: 13px;
}
.nav-links a:hover { color: var(--amber); }
.nav-links .btn { color: var(--amber); border: 1px solid var(--border-2); border-radius: 6px; padding: 6px 12px; }
.nav-links .btn:hover { border-color: var(--amber); }

/* locale switcher (EN / 中文 / 繁中) */
.locales {
  display: inline-flex;
  gap: 4px;
  border: 1px solid var(--border-2);
  border-radius: 6px;
  padding: 2px;
}
.locales button {
  background: none;
  border: none;
  color: var(--dim);
  font-size: 12px;
  font-family: inherit;
  padding: 4px 8px;
  border-radius: 4px;
  cursor: pointer;
}
.locales button:hover { color: var(--amber); }
.locales button.active {
  color: var(--amber);
  background: var(--bg-2, rgba(255, 255, 255, 0.06));
}

/* ── buttons ──────────────────────────────────────────────────────────── */

.btn {
  display: inline-block;
  border: 1px solid var(--border-2);
  border-radius: 6px;
  padding: 9px 18px;
  color: var(--fg);
  background: var(--panel);
  font-family: var(--mono);
  font-size: 14px;
}
.btn:hover { border-color: var(--amber); color: var(--amber); }

.btn-primary {
  background: var(--amber);
  border-color: var(--amber);
  color: #1a1205;
  font-weight: 700;
}
.btn-primary:hover { background: #ffd47e; border-color: #ffd47e; color: #1a1205; }

/* ── hero ─────────────────────────────────────────────────────────────── */

.hero {
  max-width: 900px;
  margin: 0 auto;
  padding: 72px 24px 24px;
  text-align: center;
}

.hero-ascii {
  display: inline-block;
  margin-bottom: 24px;
  color: var(--amber);
  text-shadow: 0 0 24px rgba(245, 185, 66, 0.25);
}
.hero-ascii pre {
  font-size: clamp(7px, 1.6vw, 14px);
  line-height: 1.15;
  text-align: left;
}

.hero h1 {
  font-size: clamp(26px, 4.5vw, 46px);
  line-height: 1.15;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.hero h1 .accent { color: var(--amber); }

.hero-sub {
  max-width: 620px;
  margin: 20px auto 0;
  color: var(--dim);
  font-size: 15px;
}
.hero-sub strong { color: var(--fg); font-weight: 500; }

.hero-cta { margin-top: 28px; display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

.release-line { margin-top: 16px; font-size: 0.92rem; color: var(--dim); }
.release-line a { color: var(--amber); font-weight: 600; }
.badges { margin-top: 28px; display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.badge {
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 3px 12px;
  font-size: 12px;
  color: var(--dim);
  background: var(--panel-2);
}
.badge:nth-child(1) { color: var(--amber); border-color: var(--amber-dim); }

/* ── terminal widget ──────────────────────────────────────────────────── */

.term-wrap {
  max-width: 720px;
  margin: 40px auto 0;
  padding: 0 24px;
}

.term {
  background: var(--panel);
  border: 1px solid var(--border-2);
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(0, 0, 0, 0.4);
}

.term-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: var(--panel-2);
  border-bottom: 1px solid var(--border);
}
.term-title {
  margin-left: 8px;
  font-size: 12px;
  color: var(--dim-2);
}

.dot { width: 11px; height: 11px; border-radius: 50%; }
.dot-r { background: #ff5f57; }
.dot-y { background: #febc2e; }
.dot-g { background: #28c840; }

.term-body { padding: 18px 20px; font-size: 13.5px; overflow-x: auto; }
.term-body p { white-space: nowrap; }
.term-body .p { color: var(--green); font-weight: 700; }
.term-body .dim { color: var(--dim); }

.term-sm .term-body { font-size: 13px; padding: 14px 16px; }

/* typing cursor */
.cursor {
  display: inline-block;
  width: 8px;
  height: 15px;
  background: var(--amber);
  vertical-align: text-bottom;
  animation: blink 1.1s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

/* ── sections ─────────────────────────────────────────────────────────── */

.section {
  max-width: 960px;
  margin: 0 auto;
  padding: 84px 24px 0;
}

.sec-title {
  font-size: 15px;
  font-weight: 500;
  color: var(--fg);
  text-transform: lowercase;
  letter-spacing: 0.04em;
  margin-bottom: 28px;
}
.sec-title .comment { color: var(--dim-2); }
.sec-title::after {
  content: "";
  display: block;
  width: 42px;
  height: 2px;
  background: var(--amber);
  margin-top: 10px;
}

/* cards */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 16px;
}

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 22px 20px;
  transition: border-color 0.15s ease, transform 0.15s ease;
}
.card:hover { border-color: var(--border-2); transform: translateY(-2px); }

.card h3 { font-size: 14px; margin-bottom: 10px; color: var(--fg); }
.card h3 .num { color: var(--amber); margin-right: 8px; }
.card p { font-size: 13px; color: var(--dim); }

/* ── architecture ─────────────────────────────────────────────────────── */

.arch {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 32px 24px;
  text-align: center;
}

.box {
  display: inline-block;
  background: var(--panel);
  border: 1px solid var(--border-2);
  border-radius: 8px;
  padding: 14px 22px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--fg);
}
.box-lang { color: var(--dim-2); font-size: 11px; }
.box-tag { color: var(--amber); font-weight: 700; }

.arch-core { margin-bottom: 4px; font-size: 13px; }

.arch-bus { display: flex; align-items: center; gap: 12px; margin: 0 auto; max-width: 420px; }
.bus-label { font-size: 10.5px; color: var(--dim-2); white-space: nowrap; }
.bus-line { flex: 1; border-top: 1px dashed var(--amber-dim); position: relative; }
.bus-line::before, .bus-line::after {
  content: "";
  position: absolute;
  top: -4px;
  width: 7px;
  height: 7px;
  border: 1px solid var(--amber-dim);
  background: var(--bg);
}
.bus-line::before { left: 0; }
.bus-line::after { right: 0; }

.arch-cols {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 10px;
  max-width: 760px;
  margin: 10px auto 0;
}
.arch-cols .box { text-align: center; }
.box-your { border-color: var(--amber-dim); border-style: dashed; }
.box-your .box-lang { color: var(--amber); }

.arch-note { margin-top: 22px; font-size: 12.5px; color: var(--dim-2); }

/* ── loop ─────────────────────────────────────────────────────────────── */

.loop {
  display: flex;
  align-items: stretch;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: center;
}

.step {
  flex: 1 1 170px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px 14px;
}
.step-cmd { color: var(--amber); font-size: 13px; font-weight: 700; }
.step pre {
  margin-top: 10px;
  font-size: 11.5px;
  line-height: 1.55;
  color: var(--dim);
  white-space: pre-wrap;
  overflow-wrap: break-word;
}

.step-arrow {
  align-self: center;
  color: var(--amber-dim);
  font-size: 20px;
  padding-bottom: 26px;
}

/* ── quickstart ───────────────────────────────────────────────────────── */

.qs {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 24px;
  align-items: start;
}

.qs-side h3 { font-size: 13px; margin-bottom: 14px; color: var(--fg); }

.reqs { list-style: none; margin-bottom: 18px; }
.reqs li { font-size: 13px; color: var(--dim); padding: 4px 0; }
.check { color: var(--green); margin-right: 8px; }
.small { font-size: 12px; }

/* ── table ────────────────────────────────────────────────────────────── */

.table-wrap {
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  overflow-x: auto;
}

table { width: 100%; border-collapse: collapse; font-size: 13px; }

thead th {
  text-align: left;
  font-weight: 500;
  color: var(--dim-2);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  background: var(--panel-2);
  padding: 12px 18px;
  border-bottom: 1px solid var(--border);
}

tbody td {
  padding: 12px 18px;
  border-bottom: 1px solid var(--border);
  color: var(--fg);
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:nth-child(2n) { background: rgba(255, 255, 255, 0.012); }
tbody td:first-child { color: var(--amber); font-weight: 500; }
tbody td:nth-child(2) { color: var(--dim); white-space: nowrap; }

.row-your td { border-top: 1px dashed var(--amber-dim); background: rgba(245, 185, 66, 0.04); }

/* ── screens ──────────────────────────────────────────────────────────── */

.screens {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  align-items: start;
}

/* top-of-page variant: larger, standing out right under the hero.
   Breaks out of .section's 960px cap so each 1200px screenshot renders
   close to full width; stacked (not side by side) so the two very
   different aspect ratios don't shrink each other. */
.screens-top { padding-top: 56px; max-width: 920px; }
.screens-show {
  max-width: none;
  gap: 32px;
  grid-template-columns: 1fr;
}
.screens-show .shot-frame {
  border: 1px solid var(--amber-dim);
  box-shadow: 0 0 0 1px rgba(245, 185, 66, 0.06), 0 18px 48px rgba(0, 0, 0, 0.45);
}
.screens-show .shot-frame:hover {
  border-color: var(--amber);
  box-shadow: 0 0 0 1px rgba(245, 185, 66, 0.14), 0 22px 56px rgba(0, 0, 0, 0.55);
  transform: translateY(-2px);
}
.screens-show .shot-frame {
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}
.screens-show .shot figcaption { font-size: 13px; }
.screens-show .shot-name { font-weight: 700; }

.shot { margin: 0; }

.shot-frame {
  display: block;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  background: var(--panel-2);
  line-height: 0;
  transition: border-color 0.15s ease;
}
.shot-frame:hover { border-color: var(--border-2); }
.shot-frame img { width: 100%; height: auto; display: block; }

.shot figcaption { margin-top: 10px; font-size: 12.5px; color: var(--dim); line-height: 1.6; }
.shot-name { color: var(--amber); font-weight: 500; }

.screens-note { margin-top: 26px; font-size: 12.5px; color: var(--dim-2); line-height: 1.7; }

/* ── wire ─────────────────────────────────────────────────────────────── */

.wire {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  align-items: center;
}
.wire .term pre { font-size: 12px; line-height: 1.5; color: var(--fg); }
.wire-notes { font-size: 13px; color: var(--dim); }
.wire-notes p { margin-bottom: 12px; }

/* ── status ───────────────────────────────────────────────────────────── */

.status {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

.status ul { list-style: none; font-size: 13px; color: var(--dim); }
.status li { padding: 6px 0; }
.done li .check { margin-right: 8px; }
.todo li { color: var(--dim-2); }
.todo-x { margin-right: 8px; color: var(--red); }

/* ── footer ───────────────────────────────────────────────────────────── */

.footer {
  margin-top: 96px;
  padding: 40px 24px;
  border-top: 1px solid var(--border);
  text-align: center;
}

.footer-ascii { font-size: 11px; color: var(--dim-2); margin-bottom: 14px; }
.footer .dim { font-size: 12.5px; }

/* ── responsive ───────────────────────────────────────────────────────── */

@media (max-width: 760px) {
  .qs, .wire, .status, .screens { grid-template-columns: 1fr; }
  .screens-top { padding-top: 40px; }
  .nav-links { gap: 10px; }
  .nav-links a:not(.btn) { display: none; }
  .step-arrow { transform: rotate(90deg); padding: 4px 0; }
  .hero { padding-top: 48px; }
  .section { padding-top: 64px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .cursor { animation: none; }
}

/* ── lightbox: click a screenshot to view it enlarged ─────────────────── */

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(8, 10, 14, 0.86);
  backdrop-filter: blur(4px);
  cursor: zoom-out;
  opacity: 0;
  animation: lb-in 0.18s ease forwards;
}
.lightbox.closing { animation: lb-out 0.15s ease forwards; }
@keyframes lb-in { to { opacity: 1; } }
@keyframes lb-out { to { opacity: 0; } }

.lightbox img {
  max-width: 94vw;
  max-height: 88vh;
  width: auto;
  height: auto;
  border-radius: 10px;
  border: 1px solid var(--amber-dim);
  box-shadow: 0 0 0 1px rgba(245, 185, 66, 0.1), 0 32px 90px rgba(0, 0, 0, 0.65);
  cursor: default;
}

.lightbox figcaption {
  position: absolute;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%);
  font-size: 13px;
  color: var(--dim);
  background: rgba(8, 10, 14, 0.7);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 14px;
  max-width: 80vw;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lightbox-close {
  position: absolute;
  top: 18px;
  right: 22px;
  width: 38px;
  height: 38px;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: rgba(8, 10, 14, 0.7);
  color: var(--dim);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s ease, border-color 0.15s ease;
}
.lightbox-close:hover { color: var(--amber); border-color: var(--amber-dim); }

@media (prefers-reduced-motion: reduce) {
  .lightbox, .lightbox.closing { animation: none; opacity: 1; }
}
