:root {
  --bg: #f7f1e6; --panel: #fffaf2; --fg: #2a2118; --muted: #6f6252; --faint: #8f816d;
  --line: #e6dccb; --accent: #b45309; --accent-soft: #f3e3c7;
  --serif: "Literata", Georgia, serif; --sans: "Geist", system-ui, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #15120e; --panel: #1f1a14; --fg: #f1e8da; --muted: #a89a86; --faint: #857864;
    --line: #332b21; --accent: #f0a35e; --accent-soft: #3a2a17; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #15120e; --panel: #1f1a14; --fg: #f1e8da; --muted: #a89a86; --faint: #857864;
  --line: #332b21; --accent: #f0a35e; --accent-soft: #3a2a17; color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--fg); font: 16px/1.55 var(--sans); }
a { color: inherit; }
p a, dd a, .foot a { color: var(--accent); text-underline-offset: 2px; }

.bar { display: flex; align-items: center; gap: 12px; max-width: 1080px; margin: 0 auto; padding: 14px 16px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; font-weight: 600; letter-spacing: -.01em; }
.brand svg { width: 26px; height: 24px; color: var(--accent); }
.bar nav { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.bar nav a { text-decoration: none; color: var(--muted); padding: 6px 10px; border-radius: 8px; font-size: .95rem; }
.bar nav a:hover { color: var(--fg); background: var(--accent-soft); }
.theme { display: grid; place-items: center; width: 36px; height: 36px; border: 1px solid var(--line); border-radius: 999px; background: none; color: var(--muted); cursor: pointer; }
.theme svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.theme .i-moon { fill: currentColor; stroke: none; }
.theme .i-sun { display: none; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .theme .i-sun { display: block; } :root:not([data-theme="light"]) .theme .i-moon { display: none; } }
:root[data-theme="dark"] .theme .i-sun { display: block; }
:root[data-theme="dark"] .theme .i-moon { display: none; }

.home { max-width: 1080px; margin: 0 auto; padding: 8px 16px 40px; }
.intro { padding: 28px 0 22px; max-width: 40em; }
.intro h1 { font: 600 clamp(2rem, 6.5vw, 3.2rem)/1.1 var(--serif); letter-spacing: -.02em; margin: 0 0 14px; }
.intro p { font: 1.12rem/1.6 var(--serif); color: var(--muted); margin: 0; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 6px 0 20px; }
.chips button { font: 500 .92rem var(--sans); color: var(--muted); background: none; border: 1px solid var(--line); border-radius: 999px; padding: 6px 14px; cursor: pointer; }
.chips button i { font-style: normal; color: var(--faint); margin-left: 2px; }
.chips button.on { background: var(--fg); border-color: var(--fg); color: var(--bg); }
.chips button.on i { color: inherit; opacity: .7; }

.cards { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.cards li[hidden] { display: none; }
.cards a { display: flex; flex-direction: column; height: 100%; padding: 16px 18px 18px; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; text-decoration: none; transition: border-color .15s, transform .15s; }
.cards a:hover { border-color: var(--accent); transform: translateY(-2px); }
.cards .k { font-size: .85rem; font-weight: 500; color: var(--accent); }
.cards .yr { font-size: .8rem; color: var(--faint); float: right; margin-top: -1.3em; align-self: flex-end; }
.cards b { font: 600 1.3rem/1.25 var(--serif); margin: 8px 0 2px; }
.cards small { color: var(--muted); font-size: .9rem; }
.cards p { font: .98rem/1.55 var(--serif); color: var(--muted); margin: 10px 0 0; }

.story { max-width: 700px; margin: 0 auto; padding: 8px 16px 40px; }
.kicker { font-size: .85rem; color: var(--faint); margin: 18px 0 6px; }
.kicker a { color: var(--accent); text-decoration: none; }
.story h1 { font: 600 clamp(2.1rem, 7vw, 3.1rem)/1.1 var(--serif); letter-spacing: -.02em; margin: 0 0 18px; overflow-wrap: anywhere; }
.facts { display: flex; flex-wrap: wrap; gap: 8px 22px; margin: 0 0 22px; padding: 12px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.facts dt { font-size: .8rem; color: var(--faint); }
.facts dd { margin: 0; font-weight: 500; }
.story p { font: 1.12rem/1.78 var(--serif); margin: 0 0 1.1em; }
.story p.lead { font-size: 1.22rem; color: var(--muted); }
.story h2 { font: 600 1.4rem/1.3 var(--serif); letter-spacing: -.01em; margin: 1.8em 0 .6em; }
.story .muted { color: var(--faint); font-size: .95rem; }
.listen { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 28px 0 !important; font-family: var(--sans) !important; font-size: .95rem !important; }
.listen span { color: var(--faint); margin-right: 4px; }
.listen a { text-decoration: none; color: var(--fg); border: 1px solid var(--line); border-radius: 999px; padding: 5px 14px; }
.listen a:hover { border-color: var(--accent); }
.source { background: var(--panel); border: 1px solid var(--line); border-left: 3px solid var(--accent); border-radius: 10px; padding: 14px 16px; margin: 10px 0 0; }
.source b { font-size: .9rem; color: var(--fg); }
.source p { font: .95rem/1.6 var(--sans); color: var(--muted); margin: 6px 0 0; }

.cards .cv { float: right; width: 56px; height: 56px; border-radius: 8px; margin: 0 0 6px 12px; object-fit: cover; background: var(--accent-soft); }
.cards .cv ~ .yr { float: none; margin: 0 0 0 8px; }

.top { display: flex; gap: 18px; align-items: flex-start; }
.top > div { flex: 1; min-width: 0; }
.cover { flex: none; width: 132px; height: 132px; border-radius: 12px; object-fit: cover; box-shadow: 0 10px 30px rgba(0, 0, 0, .18); }
@media (max-width: 480px) { .cover { width: 92px; height: 92px; } .top { gap: 14px; } }

/* 30-second Apple preview */
.pv { display: flex; align-items: center; gap: 14px; max-width: 460px; margin: 0 0 26px; padding: 10px 16px 10px 10px; background: var(--panel); border: 1px solid var(--line); border-radius: 999px; }
.pv-btn { flex: none; width: 46px; height: 46px; border-radius: 50%; border: 0; display: grid; place-items: center; background: var(--accent); color: var(--bg); cursor: pointer; transition: transform .15s; }
.pv-btn:hover { transform: scale(1.05); }
.pv-btn:focus-visible, .pv-bar:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.pv-btn svg { width: 20px; height: 20px; fill: currentColor; grid-area: 1/1; }
.pv-btn .i-pause, .pv[data-state=playing] .pv-btn .i-play { display: none; }
.pv[data-state=playing] .pv-btn .i-pause { display: block; }
.pv[data-state=loading] .pv-btn svg { opacity: 0; }
.pv[data-state=loading] .pv-btn::after { content: ""; grid-area: 1/1; width: 18px; height: 18px; border-radius: 50%; border: 2px solid transparent; border-top-color: currentColor; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.pv[data-state=error] { opacity: .6; }
.pv-body { flex: 1; min-width: 0; }
.pv-top { display: flex; justify-content: space-between; gap: 10px; margin-bottom: 8px; font-size: .8rem; }
.pv-label { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pv-time { font-variant-numeric: tabular-nums; flex: none; }
.pv-bar { position: relative; height: 16px; cursor: pointer; touch-action: none; }
.pv-bar::before, .pv-bar i { content: ""; position: absolute; left: 0; right: 0; top: 6px; height: 4px; border-radius: 2px; }
.pv-bar::before { background: var(--line); }
.pv-bar i { background: var(--accent); transform: scaleX(0); transform-origin: left; }

/* YouTube: a still until pressed, then the youtube-nocookie player in its place */
.yt { margin: 0 0 28px; }
.yt-play, .yt iframe { display: block; width: 100%; aspect-ratio: 16 / 9; border: 0; border-radius: 14px; background: #000; }
.yt-play { position: relative; padding: 0; overflow: hidden; cursor: pointer; }
.yt-play img { width: 100%; height: 100%; object-fit: cover; opacity: .85; transition: opacity .2s; }
.yt-play:hover img { opacity: 1; }
.yt-btn { position: absolute; inset: 0; margin: auto; width: 68px; height: 68px; border-radius: 50%; display: grid; place-items: center; background: var(--accent); color: var(--bg); box-shadow: 0 6px 24px rgba(0, 0, 0, .35); transition: transform .15s; }
.yt-play:hover .yt-btn { transform: scale(1.06); }
.yt-play:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
.yt-btn svg { width: 28px; height: 28px; fill: currentColor; margin-left: 3px; }
.yt figcaption { font-size: .82rem; color: var(--faint); margin-top: 8px; }

.share { font: 500 .95rem var(--sans); color: var(--fg); background: none; border: 1px solid var(--line); border-radius: 999px; padding: 5px 14px; cursor: pointer; }
.share:hover { border-color: var(--accent); }

/* visitors' own stories */
.talk { margin-top: 44px; }
.talk .hint { font: 1rem/1.6 var(--serif) !important; color: var(--muted); }
.cmts { list-style: none; padding: 0; margin: 0 0 22px; display: grid; gap: 12px; }
.cmts li { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 12px 16px; }
.cmts p { font: 1.02rem/1.65 var(--serif) !important; margin: 0 0 6px !important; white-space: pre-line; overflow-wrap: anywhere; }
.cmts small { color: var(--faint); font-size: .82rem; }
.cform, .sform { display: grid; gap: 12px; }
.cform label, .sform label { display: grid; gap: 6px; font-weight: 500; font-size: .92rem; }
.cform label small, .sform label small { color: var(--faint); font-weight: 400; }
.cform input, .cform textarea, .sform input, .sform textarea { font: 1rem/1.5 var(--sans); color: var(--fg); background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; width: 100%; }
.cform textarea { font-family: var(--serif); resize: vertical; min-height: 120px; }
.cform input:focus, .cform textarea:focus, .sform input:focus, .sform textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: transparent; }
.cform .hp, .sform .hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
.crow { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.crow button { font: 600 .95rem var(--sans); color: var(--bg); background: var(--accent); border: 0; border-radius: 999px; padding: 9px 22px; cursor: pointer; }
.crow button:disabled { opacity: .5; cursor: default; }
.cnt { color: var(--faint); font-size: .82rem; font-variant-numeric: tabular-nums; }
.cmsg { font: .95rem/1.5 var(--sans) !important; margin: 0 !important; min-height: 1.4em; }
.cmsg.ok { color: var(--accent); }
.cmsg.bad { color: #c0392b; }
.fine { font: .85rem/1.5 var(--sans) !important; color: var(--faint); margin: 0 !important; }

@media (max-width: 640px) { .bar nav a.hub { display: none; } }
.intro .hubs { font: 500 .98rem var(--sans); margin-top: 14px; color: var(--faint); }
.intro .hubs a { color: var(--accent); text-decoration: none; }
.intro .kicker { margin: 0 0 10px; }
.h1sub { display: block; font: 400 clamp(1.05rem, 3.4vw, 1.3rem)/1.4 var(--serif); color: var(--muted); letter-spacing: 0; margin-top: 6px; }
.gist { margin: 0 0 26px; padding: 16px 18px; background: var(--accent-soft); border-radius: 14px; }
.story .gist h2 { font: 600 .95rem var(--sans); color: var(--accent); margin: 0 0 6px; }
.story .gist p { font: 1.12rem/1.7 var(--serif); margin: 0; }
.story h2.wiki-h { font: 600 .95rem var(--sans); color: var(--faint); margin: 8px 0 14px; }

/* story page: the story on the left, more stories and the suggestion box on the right */
.story.wide { max-width: 1080px; }
@media (min-width: 980px) {
  .story.wide { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 56px; align-items: start; }
  .side { padding-top: 58px; }
}
.main { max-width: 700px; min-width: 0; }
.side { display: grid; gap: 18px; min-width: 0; margin-top: 36px; }
@media (min-width: 980px) { .side { margin-top: 0; } }
.box { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 16px 18px; }
.box h2, .story .box h2 { font: 600 1.15rem/1.3 var(--serif); margin: 0 0 6px; }
.box .hint, .story .box .hint { font: .95rem/1.5 var(--serif) !important; color: var(--muted); margin: 0 0 12px !important; }
.minis { list-style: none; padding: 0; margin: 10px 0 8px; display: grid; gap: 2px; }
.minis a { display: flex; align-items: center; gap: 12px; padding: 7px 6px; margin: 0 -6px; border-radius: 10px; text-decoration: none; }
.minis a:hover { background: var(--accent-soft); }
.minis img, .minis .ph { flex: none; width: 48px; height: 48px; border-radius: 8px; object-fit: cover; }
.minis .ph { display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); font-size: 1.2rem; }
.minis span { min-width: 0; display: grid; }
.minis b { font: 600 1rem/1.3 var(--serif); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.minis small { color: var(--faint); font-size: .82rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.all { font-size: .9rem; color: var(--accent); text-decoration: none; }
.sform textarea { min-height: 80px; resize: vertical; font-family: var(--serif); }
.sform input, .sform textarea { background: var(--bg) !important; }

/* home: readers' latest memories next to the suggestion box */
.duo { display: grid; gap: 18px; margin-top: 36px; }
@media (min-width: 860px) { .duo { grid-template-columns: 1fr 1fr; align-items: start; } }
.duo .box h2 { font: 600 1.25rem/1.3 var(--serif); margin: 0 0 6px; }
.duo .hint { font: .98rem/1.5 var(--serif); color: var(--muted); margin: 0 0 12px; }
.readers .cmts li { background: var(--bg); }
.readers .cmts p { font: 1rem/1.6 var(--serif); margin: 0 0 6px; white-space: pre-line; }
.readers .cmts a { color: var(--accent); }

.foot { max-width: 1080px; margin: 0 auto; padding: 26px 16px 40px; border-top: 1px solid var(--line); color: var(--faint); font-size: .88rem; }
.foot p { margin: 0 0 6px; }
