/* 智慧 · Wisdom — 发现比特币
   Standalone static page. Theme tokens mirror src/app/globals.css. */

:root {
  --bg: #ffffff;
  --card: #fbf8f0;
  --ink: #14161a;
  --ink-soft: #3b3e45;
  --ink-mute: #6b6a62;
  --rule-soft: #c9bfa8;
  --orange: #F7931A;
  --accent: #b33a2e;
  --shadow: 0 1px 2px rgba(20, 22, 26, .06), 0 8px 24px rgba(20, 22, 26, .05);
}
.dark {
  --bg: #0f1115;
  --card: #1a1d24;
  --ink: #e2e4e9;
  --ink-soft: #b0b5c7;
  --ink-mute: #8b8fa3;
  --rule-soft: #2a2d36;
  --accent: #d94a3a;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 24px rgba(0, 0, 0, .3);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Noto Serif SC", "Noto Serif TC", "Times New Roman", serif;
  font-size: 17px;
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }

.wrap {
  max-width: 760px;
  margin: 0 auto;
  padding: 0 18px 64px;
}

/* ---------- header ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--rule-soft);
}

.site-header .bar {
  max-width: 760px;
  margin: 0 auto;
  padding: 12px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  min-width: 0;
}

.brand img {
  width: 30px;
  height: 30px;
  border-radius: 7px;
  display: block;
}

.brand-text { min-width: 0; }

.brand-title {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: .04em;
  line-height: 1.2;
  white-space: nowrap;
}

.brand-sub {
  font-size: 11px;
  color: var(--ink-mute);
  letter-spacing: .16em;
  text-transform: uppercase;
  line-height: 1.2;
}

.header-tools {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
}

.icon-btn {
  appearance: none;
  border: 1px solid var(--rule-soft);
  background: var(--card);
  color: var(--ink-soft);
  width: 36px;
  height: 36px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  padding: 0;
  transition: border-color .15s, color .15s;
}
.icon-btn:hover { color: var(--ink); border-color: var(--ink-mute); }

/* ---------- intro ---------- */

.hero {
  padding: 30px 0 6px;
  border-bottom: 1px solid var(--rule-soft);
  margin-bottom: 6px;
}

.hero h1 {
  margin: 0;
  font-size: 30px;
  line-height: 1.25;
  letter-spacing: .02em;
}

.hero p {
  margin: 10px 0 26px;
  color: var(--ink-mute);
  font-size: 15px;
}

/* ---------- filter chips ---------- */

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 14px 0 4px;
  margin-bottom: 4px;
}

.chip {
  appearance: none;
  font-family: inherit;
  font-size: 14px;
  line-height: 1.2;
  color: var(--ink-soft);
  background: var(--card);
  border: 1px solid var(--rule-soft);
  border-radius: 999px;
  padding: 8px 16px;
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: border-color .15s, color .15s, background .15s;
}
.chip:hover { border-color: var(--ink-mute); color: var(--ink); }
.chip.is-on {
  color: var(--ink);
  border-color: var(--orange);
  background: color-mix(in srgb, var(--orange) 14%, var(--bg));
}

.chip-n {
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  color: var(--ink-mute);
}
.chip-n:empty { display: none; }
.chip.is-on .chip-n { color: var(--ink-soft); }

/* ---------- 目录 (table of contents) ---------- */

/* Desktop: a fixed side rail in the left gutter, always open. Mobile
   (<1240px): hidden behind a hamburger in the header, sliding in as a
   left drawer with a dim backdrop. */

.toc {
  border: 1px solid color-mix(in srgb, var(--accent) 48%, transparent);
  border-radius: 14px;
  background: color-mix(in srgb, var(--accent) 6%, var(--bg));
}

/* base = mobile drawer state */
.toc {
  position: fixed;
  top: 0; bottom: 0; left: 0;
  width: min(80vw, 320px);
  margin: 0;
  padding: 14px 14px 22px;
  display: flex;
  flex-direction: column;
  z-index: 90;
  border-radius: 0 16px 16px 0;
  transform: translateX(-102%);
  transition: transform .22s ease;
  box-shadow: 0 0 40px rgba(0, 0, 0, .35);
}
.toc.open { transform: translateX(0); }

.toc-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--ink-soft);
  padding-bottom: 8px;
  border-bottom: 1px solid color-mix(in srgb, var(--accent) 30%, transparent);
  margin-bottom: 4px;
}

.toc-label {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--ink-mute);
  flex: 1;
}

.toc-close {
  appearance: none;
  font-family: inherit;
  font-size: 16px;
  line-height: 1;
  color: var(--ink-mute);
  background: transparent;
  border: 1px solid var(--rule-soft);
  border-radius: 9px;
  width: 36px; height: 36px;
  display: grid;
  place-items: center;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: color .15s, border-color .15s;
}
.toc-close:hover { color: var(--ink); border-color: var(--ink-mute); }

.toc-count {
  font-size: 12px;
  color: var(--ink-mute);
  font-variant-numeric: tabular-nums;
}

.toc-list {
  display: flex;
  flex-direction: column;
  margin-top: 6px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  min-height: 0;
}

.toc-item {
  appearance: none;
  font-family: inherit;
  font-size: 14px;
  line-height: 1.5;
  color: var(--ink-soft);
  text-align: left;
  background: transparent;
  border: 0;
  border-left: 3px solid transparent;
  border-radius: 8px;
  padding: 8px 12px;
  display: flex;
  align-items: center;
  gap: 9px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: color .15s, background .15s, border-color .15s;
}

.toc-logo {
  flex: 0 0 auto;
  width: auto;
  height: 18px;
  border-radius: 4px;
  object-fit: contain;
}
.toc-title { min-width: 0; }

.toc-item:hover { color: var(--ink); background: color-mix(in srgb, var(--accent) 9%, transparent); }
.toc-item.is-active { color: var(--orange); border-left-color: var(--accent); }

.toc-list::-webkit-scrollbar { width: 8px; }
.toc-list::-webkit-scrollbar-thumb { background: color-mix(in srgb, var(--accent) 35%, transparent); border-radius: 8px; }

.toc-backdrop {
  position: fixed;
  inset: 0;
  z-index: 85;
  background: rgba(8, 9, 12, .45);
}

.is-hidden { display: none !important; }

/* ---------- single post view (?p=w000006) ---------- */

body.single .hero p,
body.single .filters,
body.single .filter-note,
body.single .feed-foot,
body.single .toc,
body.single .toc-open { display: none; }

body.single .hero { padding-bottom: 0; }
body.single .entry { border-bottom: 0; }

.back-all {
  display: inline-block;
  margin: 16px 0 0;
  font-size: 14px;
  color: var(--ink-mute);
  text-decoration: none;
  border-bottom: 1px solid var(--rule-soft);
  padding-bottom: 1px;
}
.back-all:hover { color: var(--orange); border-color: var(--orange); }

/* share / copy this entry's link */

.entry-share {
  appearance: none;
  font-family: inherit;
  font-size: 12px;
  line-height: 1.2;
  color: var(--ink-mute);
  background: transparent;
  border: 1px solid var(--rule-soft);
  border-radius: 999px;
  padding: 6px 12px;
  min-height: 32px;
  margin-left: auto;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: color .15s, border-color .15s;
}
.entry-share:hover { color: var(--ink); border-color: var(--ink-mute); }
.entry-share.ok { color: var(--orange); border-color: var(--orange); }

.share-fallback {
  width: 100%;
  margin: 10px 0 0;
  font-family: inherit;
  font-size: 13px;
  color: var(--ink-soft);
  background: var(--card);
  border: 1px solid var(--rule-soft);
  border-radius: 8px;
  padding: 8px 10px;
}

.filter-note {
  margin: 2px 0 0;
  font-size: 13px;
  color: var(--ink-mute);
}

.feed-empty {
  margin: 24px 0 0;
  padding: 18px 0;
  font-size: 15px;
  color: var(--ink-mute);
  text-align: center;
  border-bottom: 1px solid var(--rule-soft);
}

/* ---------- month divider ---------- */

.month-divider {
  position: sticky;
  top: 61px;
  z-index: 20;
  background: var(--bg);
  padding: 14px 0 8px;
  font-size: 12px;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--ink-mute);
  display: flex;
  align-items: center;
  gap: 12px;
}
.month-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--rule-soft);
}

/* ---------- entry ---------- */

.entry {
  padding: 22px 0 26px;
  border-bottom: 1px solid var(--rule-soft);
  scroll-margin-top: 78px;
}
.entry:last-child { border-bottom: 0; }

.entry-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.entry-date {
  font-size: 12px;
  color: var(--ink-mute);
  letter-spacing: .08em;
  font-variant-numeric: tabular-nums;
}

.entry-kind {
  font-size: 11px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--orange);
  border: 1px solid color-mix(in srgb, var(--orange) 40%, transparent);
  border-radius: 999px;
  padding: 1px 9px;
}

.entry h2 {
  margin: 2px 0 12px;
  font-size: 21px;
  line-height: 1.4;
  font-weight: 700;
}

/* 工具 / 好康 entries open with the tool's own icon, left of the title */
.entry-title {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin: 2px 0 12px;
}
.entry-title h2 { margin: 0; }
.entry-logo {
  flex: 0 0 auto;
  width: auto;               /* scales by height, so a 3-tool strip stays 3 icons */
  height: 34px;
  margin-top: -2px;          /* centre the icon on the title's first line */
  border-radius: 9px;
  object-fit: contain;
  box-shadow: 0 1px 3px rgba(20, 22, 26, .18);
}

/* every linkable thing reads as a link, never a bare string */

.entry h2 a,
.entry-body a,
.entry-alt a,
.figures figcaption a {
  color: inherit;
  text-decoration: none;
  border-bottom: 1px solid color-mix(in srgb, var(--orange) 55%, transparent);
  transition: color .15s, border-color .15s;
}
.entry h2 a { border-bottom-width: 2px; }
.entry h2 a:hover,
.entry-body a:hover,
.entry-alt a:hover,
.figures figcaption a:hover { color: var(--orange); border-color: var(--orange); }

.entry-body p { margin: 0 0 14px; }
.entry-body p:last-child { margin-bottom: 0; }

.entry-body.quote {
  border-left: 3px solid var(--orange);
  padding-left: 16px;
}

.entry-body.quote .q-text {
  font-size: 20px;
  line-height: 1.7;
}

/* Folded sections (`## 标题` in text / text_zh): the TLDR stays visible, each
   detail opens in place. Long posts read short until the reader wants more. */
.entry-body details.fold {
  margin: 0 0 14px;
  padding: 0 15px;
  background: var(--card);
  border: 1px solid var(--rule-soft);
  border-radius: 10px;
}
.entry-body details.fold > summary {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 0;
  font-weight: 600;
  line-height: 1.5;
  cursor: pointer;
  list-style: none;
  -webkit-tap-highlight-color: transparent;
}
.entry-body details.fold > summary::-webkit-details-marker { display: none; }
.entry-body details.fold > summary::before {
  content: '';
  flex: 0 0 auto;
  width: 0;
  height: 0;
  border-left: 7px solid var(--orange);
  border-top: 5px solid transparent;
  border-bottom: 5px solid transparent;
  transition: transform .18s ease;
}
.entry-body details.fold[open] > summary::before { transform: rotate(90deg); }
.entry-body details.fold > summary:hover { color: var(--orange); }
.entry-body details.fold > p:last-child { margin-bottom: 15px; }
.entry-body details.fold > p:first-of-type { margin-top: 2px; }

/* The one callout that must never be missed (`!! …` in text / text_zh): it stays
   open above the folds, tinted, so a reader who never expands anything still
   reads it. Written for a family, not for engineers. */
.entry-body .warn {
  margin: 0 0 14px;
  padding: 14px 17px;
  background: color-mix(in srgb, var(--orange) 14%, transparent);
  border-left: 5px solid var(--orange);
  border-radius: 8px;
}
.entry-body .warn p { margin: 0 0 10px; }
.entry-body .warn p:last-child { margin-bottom: 0; }
.entry-body .warn p:first-child { font-weight: 700; }

.entry-alt {
  margin-top: 16px;
  padding: 14px 16px;
  background: var(--card);
  border: 1px solid var(--rule-soft);
  border-radius: 10px;
}
.entry-alt .alt-label {
  font-size: 11px;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--ink-mute);
  display: block;
  margin-bottom: 8px;
}
.entry-alt p { margin: 0 0 10px; }
.entry-alt p:last-child { margin-bottom: 0; }

/* images */

.figures {
  display: grid;
  gap: 10px;
  margin: 18px 0 6px;
}
.figures.n1 { grid-template-columns: 1fr; max-width: 560px; }
.figures.n2, .figures.n3, .figures.n4 { grid-template-columns: 1fr 1fr; }

.figures figure { margin: 0; }

.figures img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 10px;
  border: 1px solid var(--rule-soft);
  background: var(--card);
  cursor: zoom-in;
}

.figures figcaption {
  font-size: 12px;
  color: var(--ink-mute);
  margin-top: 6px;
  text-align: center;
}

/* video (vertical clips shouldn't fill a desktop column) */

.figures.video { max-width: 480px; }

.figures video {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 10px;
  border: 1px solid var(--rule-soft);
  background: #000;
}

.img-hint {
  font-size: 12px;
  color: var(--ink-mute);
  margin: 10px 0 0;
}

/* source */

.entry-source {
  margin-top: 16px;
  font-size: 13px;
  color: var(--ink-mute);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.entry-source a {
  color: var(--ink-soft);
  text-decoration: none;
  border-bottom: 1px solid var(--rule-soft);
  padding-bottom: 1px;
}
.entry-source a:hover { color: var(--orange); border-color: var(--orange); }

.tags { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.tag {
  font-size: 12px;
  color: var(--ink-mute);
  border: 1px solid var(--rule-soft);
  border-radius: 999px;
  padding: 1px 10px;
}

/* ---------- load more ---------- */

.feed-foot { padding: 28px 0 0; text-align: center; }

.load-more {
  appearance: none;
  font-family: inherit;
  font-size: 15px;
  color: var(--ink-soft);
  background: var(--card);
  border: 1px solid var(--rule-soft);
  border-radius: 999px;
  padding: 10px 26px;
  cursor: pointer;
  transition: border-color .15s, color .15s;
}
.load-more:hover { border-color: var(--ink-mute); color: var(--ink); }
.load-more[disabled] { opacity: .55; cursor: default; }

.end-note { font-size: 13px; color: var(--ink-mute); margin: 0; }

.spinner {
  width: 18px; height: 18px;
  border: 2px solid var(--rule-soft);
  border-top-color: var(--orange);
  border-radius: 50%;
  margin: 18px auto 0;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- lightbox ---------- */

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(8, 9, 12, .94);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 14px;
}
.lightbox.open { display: flex; }

.lightbox img {
  max-width: 100%;
  max-height: calc(100vh - 96px);
  max-height: calc(100dvh - 96px);
  border-radius: 8px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, .6);
}

.lb-btn {
  position: absolute;
  appearance: none;
  background: rgba(255, 255, 255, .12);
  color: #fff;
  border: 0;
  border-radius: 999px;
  width: 42px;
  height: 42px;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  display: grid;
  place-items: center;
}
.lb-btn:hover { background: rgba(255, 255, 255, .22); }
.lb-prev { left: 10px; top: 50%; transform: translateY(-50%); }
.lb-next { right: 10px; top: 50%; transform: translateY(-50%); }
.lb-close { right: 10px; top: 12px; }
.lb-count {
  position: absolute;
  bottom: 14px;
  left: 0; right: 0;
  text-align: center;
  color: rgba(255, 255, 255, .75);
  font-size: 13px;
  letter-spacing: .08em;
}
.lb-caption {
  position: absolute;
  bottom: 38px;
  left: 0; right: 0;
  text-align: center;
  color: #fff;
  font-size: 14px;
}

/* highlight target entry */
.entry.flash { animation: flash 2.4s ease-out; }
@keyframes flash {
  0%, 30% { background: color-mix(in srgb, var(--orange) 12%, transparent); }
  100% { background: transparent; }
}

.site-foot {
  margin-top: 40px;
  padding-top: 20px;
  border-top: 1px solid var(--rule-soft);
  font-size: 13px;
  color: var(--ink-mute);
  text-align: center;
}
.site-foot a { text-decoration: none; border-bottom: 1px solid var(--rule-soft); }

@media (max-width: 620px) {
  body { font-size: 16px; }
  .hero h1 { font-size: 25px; }
  .entry h2 { font-size: 19px; }
  .entry-logo { width: auto; height: 30px; border-radius: 8px; }
  .figures.n3, .figures.n4 { grid-template-columns: 1fr 1fr; }
  .month-divider { top: 59px; }
}

/* 目录 side rail on wide screens: the feed is a 760px column centred in the
   viewport, so the left gutter holds a fixed, always-open table of contents. */
@media (min-width: 1240px) {
  .toc {
    position: fixed;
    top: 92px;
    left: calc((100vw - 760px) / 2 - 234px);
    width: 220px;
    margin: 0;
    max-height: calc(100vh - 124px);
    display: flex;
    flex-direction: column;
    transform: none;
    transition: none;
    border-radius: 14px;
    z-index: 40;
    box-shadow: var(--shadow);
  }
  .toc-list { display: flex !important; overflow-y: auto; }
  .toc-open { display: none; }      /* hamburger is mobile-only */
  .toc-close { display: none; }     /* drawer close is mobile-only */
  .toc-head { padding-bottom: 2px; }
}
