:root {
  --bg: #fbfaf8;
  --surface: #ffffff;
  --text: #1c1a1f;
  --muted: #6b6672;
  --border: #e7e3ea;
  --accent: #8e30eb;
  --accent-soft: #f2e8fd;
  --code-bg: #f4f1f6;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #131116;
    --surface: #1c1a21;
    --text: #ece9f0;
    --muted: #9d97a6;
    --border: #2d2a34;
    --accent: #b77cf5;
    --accent-soft: #2a2036;
    --code-bg: #24212b;
  }
}
:root[data-theme="dark"] {
  --bg: #131116;
  --surface: #1c1a21;
  --text: #ece9f0;
  --muted: #9d97a6;
  --border: #2d2a34;
  --accent: #b77cf5;
  --accent-soft: #2a2036;
  --code-bg: #24212b;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.6 Inter, system-ui, -apple-system, sans-serif;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
.muted { color: var(--muted); }

.top {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 10px 16px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}
.brand { flex: none; display: flex; gap: 8px; align-items: center; font-weight: 700; color: var(--text); }

/* search in the top bar */
.nav-search {
  position: relative; flex: 1 1 auto; max-width: 560px; margin: 0 auto;
  display: flex; align-items: center;
}
.nav-search svg {
  position: absolute; left: 12px; width: 18px; height: 18px; pointer-events: none;
  fill: none; stroke: var(--muted); stroke-width: 2.2; stroke-linecap: round;
}
#search {
  width: 100%; min-width: 0; padding: 9px 40px 9px 38px; font: inherit; font-size: 15px;
  border: 1px solid var(--border); border-radius: 999px;
  background: var(--surface); color: var(--text);
  transition: border-color .15s, box-shadow .15s;
}
#search::placeholder { color: var(--muted); }
#search:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 25%, transparent);
}
.nav-search kbd {
  position: absolute; right: 12px; pointer-events: none;
  font: 12px/1 "JetBrains Mono", monospace; color: var(--muted);
  border: 1px solid var(--border); border-radius: 5px; padding: 3px 6px;
}
#search:focus ~ kbd, #search:not(:placeholder-shown) ~ kbd { display: none; }
.brand:hover { text-decoration: none; }
.logo { width: 32px; height: 32px; border-radius: 50%; display: block; }
.hero-banner {
  display: block; height: auto; aspect-ratio: 1640 / 615;
  width: 100%; margin: 0 0 24px;
  border-radius: 18px;
  box-shadow: 0 10px 40px color-mix(in srgb, var(--accent) 30%, transparent);
}
.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.icon-btn {
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  border-radius: 8px; width: 36px; height: 36px; cursor: pointer; font-size: 16px;
}

main { max-width: 1132px; margin: 0 auto; padding: 0 16px 48px; }
#detail-view { max-width: 780px; margin: 0 auto; }

.hero { padding: 24px 0 8px; }

/* "Latest recap" feature under the banner */
.latest {
  display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
  border: 1px solid var(--border); border-radius: 18px; overflow: hidden;
  background:
    radial-gradient(120% 140% at 100% 0%, color-mix(in srgb, var(--accent) 16%, transparent), transparent 60%),
    var(--surface);
}
.latest-cover { position: relative; display: block; aspect-ratio: 3 / 2; overflow: hidden; background: #1d1133; }
.latest-cover > img, .latest-cover .cover-fallback { position: absolute; inset: 0; width: 100%; height: 100%; }
.latest-cover > img { object-fit: cover; transition: transform .3s; }
.latest-cover:hover > img { transform: scale(1.03); }
.latest-body { display: flex; flex-direction: column; justify-content: center; gap: 10px; padding: 24px 28px; min-width: 0; }
.eyebrow {
  display: inline-flex; align-items: center; gap: 8px; align-self: flex-start;
  font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  color: var(--accent); background: var(--accent-soft); padding: 5px 10px; border-radius: 999px;
}
.pulse { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); animation: pulse 1.8s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 60%, transparent); } 70%, 100% { box-shadow: 0 0 0 8px transparent; } }
@media (prefers-reduced-motion: reduce) { .pulse { animation: none; } }
.latest h2 { margin: 0; font-size: clamp(22px, 3vw, 30px); line-height: 1.2; letter-spacing: -0.02em; }
.latest h2 a { color: var(--text); }
.latest-meta { margin: 0; color: var(--muted); font-size: 14px; }
.latest-excerpt {
  margin: 0; font-size: 15px; line-height: 1.55;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.latest-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 6px; }
.btn {
  display: inline-flex; align-items: center; padding: 10px 18px; border-radius: 999px;
  font-weight: 600; font-size: 15px; border: 1px solid transparent; transition: transform .15s, background .15s;
}
.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn.primary { background: var(--accent); color: #fff; }
.btn.primary:hover { background: color-mix(in srgb, var(--accent) 85%, #000); }
.btn.ghost { border-color: var(--border); color: var(--text); background: var(--surface); }
.btn.ghost:hover { border-color: var(--accent); }

.list-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 28px 0 14px; }
.list-head h2 { margin: 0; font-size: 22px; letter-spacing: -0.01em; overflow-wrap: anywhere; }
.list-head .muted { flex: none; font-size: 14px; }
.no-results { text-align: center; color: var(--muted); padding: 40px 0; }

@media (max-width: 760px) {
  .latest { grid-template-columns: minmax(0, 1fr); }
  .latest-body { padding: 18px 18px 20px; }
}
@media (max-width: 600px) {
  #site-title { display: none; }
  .nav-search kbd { display: none; }
  #search { font-size: 16px; } /* stops iPhone zooming in on focus */
  .top { gap: 10px; padding: 8px 12px; }
}

.status { padding: 12px 0; color: var(--muted); font-size: 14px; }
.status.error { color: #c0392b; }

/* Recap grid: square cards, 3 / 2 / 1 per row */
.list {
  list-style: none; margin: 0; padding: 0;
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px;
}
.card {
  aspect-ratio: 1 / 1; height: 100%;
  display: grid; grid-template-rows: 2fr 1fr; /* 3:2 cover on top fills exactly two thirds */
  overflow: hidden; border: 1px solid var(--border); border-radius: 16px;
  background: var(--surface); color: var(--text);
  transition: border-color .15s, transform .15s, box-shadow .15s;
}
.card:hover {
  border-color: var(--accent); text-decoration: none; transform: translateY(-3px);
  box-shadow: 0 10px 30px color-mix(in srgb, var(--accent) 25%, transparent);
}
.card:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.cover { position: relative; min-height: 0; overflow: hidden; background: #1d1133; }
.cover > img, .cover-fallback { position: absolute; inset: 0; width: 100%; height: 100%; }
.cover > img { object-fit: cover; transition: transform .3s; }
.card:hover .cover > img { transform: scale(1.04); }
.cover-fallback {
  display: flex; align-items: center; justify-content: center; gap: 14px;
  background: radial-gradient(circle at 30% 30%, #6d28d9, #2a1050 70%);
  color: #fff; font-weight: 800; font-size: clamp(28px, 4vw, 40px);
}
.cover-fallback img { width: 34%; max-width: 110px; border-radius: 50%; }
.info {
  min-height: 0; display: flex; align-items: center; gap: 14px; padding: 12px 16px;
  border-top: 1px solid var(--border);
}
.issue-no {
  flex: none; display: grid; place-items: center; min-width: 58px; height: 48px; padding: 0 8px;
  border-radius: 10px; background: var(--accent-soft); color: var(--accent); font-weight: 700; font-size: 18px;
}
.info-text { min-width: 0; }
.card .when { font-weight: 600; font-size: 16px; line-height: 1.3; }
.card .kind { font-size: 13px; color: var(--muted); }
.card .snippet {
  font-size: 12.5px; line-height: 1.4; color: var(--muted); margin-top: 2px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.card mark { background: var(--accent-soft); color: var(--text); border-radius: 3px; }

@media (max-width: 900px) {
  .list { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
}

.back { display: inline-block; margin: 24px 0 8px; font-size: 14px; }
.article-head h1 { font-size: clamp(26px, 5vw, 36px); line-height: 1.2; margin: 4px 0 16px; letter-spacing: -0.02em; }
.article-head .meta { margin: 0; color: var(--muted); font-size: 14px; }
#detail-image { width: 100%; border-radius: 12px; margin-bottom: 16px; }
.pager {
  display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap;
  padding: 10px 0; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border);
  font-size: 14px;
}
.pager a.disabled { visibility: hidden; }

.toc {
  margin: 20px 0; padding: 14px 16px; border: 1px solid var(--border);
  border-radius: 12px; background: var(--surface); font-size: 14px;
}
.toc strong { display: block; margin-bottom: 6px; }
.toc ul { margin: 0; padding-left: 18px; columns: 2 220px; }

.prose { overflow-wrap: anywhere; }
.prose h1, .prose h2, .prose h3 { line-height: 1.3; margin-top: 2em; scroll-margin-top: 70px; }
.prose img, .prose video { max-width: 100%; height: auto; border-radius: 10px; }
.prose pre {
  white-space: pre-wrap; background: var(--code-bg); padding: 14px; border-radius: 10px;
  font: 13.5px/1.55 "JetBrains Mono", ui-monospace, monospace; overflow-x: auto;
}
.prose code { background: var(--code-bg); padding: 1px 5px; border-radius: 4px; font-size: .9em; }
.prose pre code { background: none; padding: 0; }
.prose blockquote { margin: 1em 0; padding: 4px 16px; border-left: 3px solid var(--accent); color: var(--muted); }
.prose hr { border: 0; border-top: 1px dashed var(--border); margin: 1.6em 0; }
.prose table { border-collapse: collapse; display: block; overflow-x: auto; }
.prose td, .prose th { border: 1px solid var(--border); padding: 6px 10px; }
.embed {
  margin: 12px 0 20px; padding: 14px 16px; border: 1px solid var(--border);
  border-left: 3px solid var(--accent); border-radius: 12px; background: var(--surface); font-size: 15px;
}
.embed-head { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; margin-bottom: 6px; font-size: 14px; }
.embed-text { white-space: pre-line; }
.embed img { display: block; margin-top: 10px; max-height: 360px; width: auto; max-width: 100%; }
.embed-open { display: inline-block; margin-top: 8px; font-size: 13px; }
.mention {
  background: var(--accent-soft); padding: 0 6px; border-radius: 999px; font-size: .92em; white-space: nowrap;
}

/* footer */
.site-foot {
  margin-top: 56px; border-top: 1px solid var(--border);
  background:
    radial-gradient(80% 120% at 0% 0%, color-mix(in srgb, var(--accent) 12%, transparent), transparent 60%),
    var(--surface);
}
.foot-inner {
  max-width: 1132px; margin: 0 auto; padding: 44px 16px 32px;
  display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) minmax(0, 1fr); gap: 40px;
}
.foot-brand { display: inline-flex; align-items: center; gap: 12px; color: var(--text); font-weight: 800; font-size: 20px; }
.foot-brand:hover { text-decoration: none; }
.foot-brand img { border-radius: 50%; }
.foot-blurb { margin: 14px 0 18px; color: var(--muted); max-width: 440px; }
.foot-author { display: inline-flex; align-items: center; gap: 10px; color: var(--text); }
.foot-author:hover { text-decoration: none; }
.foot-author img { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; border: 2px solid var(--accent-soft); }
.foot-author span { display: flex; flex-direction: column; line-height: 1.25; }
.foot-author small { color: var(--muted); font-size: 12px; }
.foot-author strong { font-size: 15px; }
.foot-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
.foot-col h3 {
  margin: 4px 0 14px; font-size: 13px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted);
}
.foot-col a, .foot-col #foot-links { display: flex; flex-direction: column; gap: 10px; }
.foot-col a { color: var(--text); font-weight: 500; flex-direction: row; gap: 4px; }
.foot-col a + a, #foot-links a + a { margin-top: 10px; }
.foot-col a:hover { color: var(--accent); text-decoration: none; }
.foot-col a span { color: var(--muted); font-size: 12px; }
#foot-links { gap: 0; }
.foot-bottom {
  max-width: 1132px; margin: 0 auto; padding: 18px 16px 28px;
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 20px;
  border-top: 1px solid var(--border); color: var(--muted); font-size: 13px;
}
@media (max-width: 760px) {
  .foot-inner { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 32px 24px; padding-top: 36px; }
  .foot-about { grid-column: 1 / -1; }
}
@media (max-width: 420px) {
  .foot-bottom { flex-direction: column; }
}

@media (max-width: 520px) {
  .hero-banner { border-radius: 12px; margin-bottom: 18px; }
  .list { grid-template-columns: minmax(0, 1fr); gap: 14px; }
}

/* zap window */
.zap-dialog {
  width: min(440px, calc(100vw - 32px)); max-height: calc(100vh - 32px); overflow: auto;
  padding: 26px 24px 24px; border: 1px solid var(--border); border-radius: 20px;
  background: var(--surface); color: var(--text);
  box-shadow: 0 24px 80px rgba(0, 0, 0, .45);
}
.zap-dialog::backdrop { background: rgba(10, 5, 20, .6); backdrop-filter: blur(3px); }
.zap-close {
  position: absolute; top: 12px; right: 12px; width: 34px; height: 34px; border-radius: 50%;
  border: 1px solid var(--border); background: var(--bg); color: var(--text); cursor: pointer; font-size: 14px;
}
.zap-dialog h2 { margin: 0 36px 6px 0; font-size: 22px; line-height: 1.25; }
.zap-sub { margin: 0 0 18px; font-size: 14px; }
.zap-amounts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 14px; }
.chip {
  padding: 10px 6px; border-radius: 12px; border: 1px solid var(--border); background: var(--bg);
  color: var(--text); font: inherit; font-weight: 600; cursor: pointer; transition: border-color .15s, background .15s;
}
.chip:hover { border-color: var(--accent); }
.chip.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.zap-field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; font-size: 14px; font-weight: 600; }
.zap-field input, .zap-field textarea {
  font: inherit; font-weight: 400; padding: 10px 12px; border-radius: 10px; resize: vertical;
  border: 1px solid var(--border); background: var(--bg); color: var(--text);
}
.zap-field input:focus, .zap-field textarea:focus { outline: none; border-color: var(--accent); }
.zap-check { display: flex; gap: 8px; align-items: center; font-size: 14px; margin: 4px 0 12px; }
.zap-note { font-size: 13px; margin: 2px 0 12px; }
.zap-error { color: #e5484d; font-size: 14px; margin: 0 0 12px; }
.zap-go { width: 100%; justify-content: center; font-size: 16px; padding: 12px; border: 0; cursor: pointer; }
.zap-go:disabled { opacity: .6; cursor: default; transform: none; }
.zap-qr { display: block; width: min(260px, 100%); margin: 4px auto 16px; background: #fff; border-radius: 14px; padding: 8px; }
.zap-qr svg { display: block; width: 100%; height: auto; }
.zap-pay { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.zap-pay .btn { cursor: pointer; font: inherit; font-weight: 600; }
.zap-wait { display: flex; align-items: center; justify-content: center; gap: 8px; margin: 16px 0 0; color: var(--muted); font-size: 14px; }
.zap-done { text-align: center; padding: 8px 0; }
.zap-done h2 { margin: 6px 0; }
.zap-bolt { font-size: 56px; animation: zap-pop .5s ease-out; }
@keyframes zap-pop { from { transform: scale(.3); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .zap-bolt { animation: none; } }
button.btn { font: inherit; font-weight: 600; cursor: pointer; }
