/* ==========================================================================
   Tobey's Philosophical Ponderings — site.css
   1. tokens & themes   2. base   3. header/footer   4. subscribe
   5. home (hero → descent → bowl)   6. category + bookshelf   7. post
   8. theme decorations   9. responsive / reduced motion
   ========================================================================== */

/* 1. TOKENS ----------------------------------------------------------------- */
:root {
  --serif: "Newsreader", Georgia, "Times New Roman", serif;
  --hand: "Gaegu", "Comic Sans MS", cursive;
  --pixel: "VT323", "Courier New", monospace;
  --mono: "IBM Plex Mono", ui-monospace, Menlo, monospace;
  --manga: "Dela Gothic One", Impact, sans-serif;

  --logo-red: #d9311c;
  --pink: #fdeceb;
  --star-yellow: #fff38a;
  --star-blue: #bfe6fb;

  /* default theme values (overridden per theme below) */
  --bg: var(--pink);
  --ink: #3b1d19;
  --muted: #8a5d57;
  --accent: var(--logo-red);
  --accent-ink: #fff;
  --rule: rgba(59, 29, 25, .14);
  --header-bg: transparent;
  --display: var(--serif);

  /* bookshelf */
  --case-back: #3a2416;
  --case-frame: #24150c;
  --board: #7a4c2b;
  --board-edge: #5a361d;
  --peek-bg: #fffaf3;
  --peek-ink: #2a1c16;
  --ghost: rgba(255, 255, 255, .25);
}

.theme-philosophy {
  --bg: #f1e8d8;
  --ink: #2b211b;
  --muted: #7b6a5c;
  --accent: #9b2f22;
  --rule: rgba(43, 33, 27, .16);
  --header-bg: rgba(241, 232, 216, .82);
  --display: var(--serif);
}

.theme-scifi {
  --bg: #05070a;
  --ink: #e6d9dd;
  --muted: #9a8a90;
  --accent: #ffd9e7;
  --accent-ink: #2a0d17;
  --amber: #f1d2ac;
  --alien: #b9f5a6;
  --moon-red: #ff4d4d;
  --rule: rgba(255, 217, 231, .18);
  --header-bg: rgba(5, 7, 10, .78);
  --display: var(--pixel);
  --case-back: #120d10;
  --case-frame: #3a3036;
  --board: #4a3e44;
  --board-edge: #241c20;
  --peek-bg: #150e12;
  --peek-ink: #f3e4e9;
  --ghost: rgba(255, 217, 231, .28);
}

.theme-manga {
  --bg: #f7f5ef;
  --ink: #111;
  --muted: #555;
  --accent: #e2231a;
  --rule: rgba(0, 0, 0, .9);
  --header-bg: rgba(247, 245, 239, .9);
  --display: var(--manga);
  --case-back: #f7f5ef;
  --case-frame: #111;
  --board: #111;
  --board-edge: #111;
  --peek-bg: #fff;
  --peek-ink: #111;
  --ghost: rgba(0, 0, 0, .35);
}

.theme-void {
  --bg: #000;
  --ink: #fff;
  --muted: #aaa;
  --accent: #ff2a2a;
  --header-bg: #000;
}

/* 2. BASE ------------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; background: var(--bg); overflow-x: clip; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 1.0625rem;
  line-height: 1.6;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; height: auto; display: block; }
a { color: inherit; }
button { font: inherit; color: inherit; }
main { position: relative; }
.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}
.skip { position: absolute; left: -999px; top: 8px; z-index: 100; background: var(--ink); color: var(--bg); padding: 6px 12px; }
.skip:focus { left: 8px; }
:focus-visible { outline: 2px dashed var(--accent); outline-offset: 3px; }

/* 3. HEADER / FOOTER --------------------------------------------------------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 10px clamp(16px, 4vw, 40px);
  background: var(--header-bg);
  color: var(--header-ink, var(--ink));
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  transition: background-color .4s, color .4s, border-color .4s;
  border-bottom: 1px solid transparent;
}
.theme-philosophy .site-header, .theme-scifi .site-header { border-bottom-color: var(--rule); }
.theme-manga .site-header { border-bottom: 3px solid #111; }

.brand { display: flex; align-items: center; gap: 12px; flex-shrink: 0; text-decoration: none; }
.brand-logo { display: block; width: 104px; transition: transform .3s; }
.brand img { width: 100%; }
.brand-name {
  font-family: var(--hand); font-weight: 700; font-size: 1.6rem; line-height: 1;
  color: var(--accent); white-space: nowrap;
  transition: transform .3s;
}
/* hover: the logo hops and the name wriggles like a worm, letter by letter */
.brand-name .l { display: inline-block; }
.brand:hover .brand-logo, .brand:focus-visible .brand-logo { animation: brand-jelly .8s ease-in-out; }
.brand:hover .brand-name .l, .brand:focus-visible .brand-name .l { animation: worm-wiggle .6s ease-in-out calc(var(--i) * 32ms) both; }
@keyframes brand-jelly { /* squash and stretch, settling down like jelly */
  0%, 100% { transform: scale(1, 1); }
  20% { transform: scale(1.12, .88); }
  35% { transform: scale(.9, 1.1); }
  50% { transform: scale(1.06, .94); }
  65% { transform: scale(.97, 1.03); }
  80% { transform: scale(1.02, .98); }
}
@keyframes worm-wiggle {
  0%, 100% { transform: translateY(0); }
  35% { transform: translateY(-6px) rotate(-4deg); }
  70% { transform: translateY(2px) rotate(3deg); }
}
.theme-home .brand-name { color: var(--logo-red); }
.theme-home.is-deep .brand-name { color: #ffe14d; }

.site-nav { display: flex; align-items: center; gap: 6px; }
.nav-link {
  position: relative;
  text-decoration: none;
  font-family: var(--serif);
  font-size: 1.05rem;
  padding: 6px 14px;
  border-radius: 999px;
  transition: background-color .2s, color .2s;
}
.nav-link:hover { background: color-mix(in srgb, var(--accent) 12%, transparent); }
.nav-link.is-active { background: var(--accent); color: var(--accent-ink); }
.nav-toggle { display: none; }

/* per-theme nav flavour */
.theme-scifi .nav-link { font-family: var(--pixel); font-size: 1.55rem; letter-spacing: .04em; border-radius: 0; }
.theme-scifi .nav-link::before { content: "> "; opacity: 0; transition: opacity .2s; }
.theme-scifi .nav-link:hover::before, .theme-scifi .nav-link.is-active::before { opacity: 1; }
.theme-manga .nav-link { font-family: var(--manga); font-size: .95rem; border-radius: 0; }
.theme-manga .nav-link.is-active { box-shadow: 3px 3px 0 #111; }
.theme-void .nav-link { font-family: var(--pixel); font-size: 1.3rem; border-radius: 0; }

/* home page: header floats over the hero, then turns dark below the fold */
.theme-home .site-header { position: fixed; left: 0; right: 0; }
.theme-home.is-deep .site-header {
  --header-bg: rgba(8, 8, 10, .7);
  --header-ink: #e8e4da;
  --accent: #ffe14d;
  --accent-ink: #111;
  border-bottom-color: rgba(255, 255, 255, .08);
}
.theme-home.is-deep .nav-link { font-family: var(--pixel); font-size: 1.55rem; border-radius: 0; }

.site-footer {
  position: relative;
  text-align: center;
  padding: 56px 20px 40px;
  color: var(--muted);
  font-size: .95rem;
}
.foot-socials { display: flex; gap: 22px; justify-content: center; flex-wrap: wrap; margin-bottom: 10px; }
.foot-socials a { text-decoration: none; color: var(--ink); border-bottom: 1px solid var(--rule); }
.foot-socials a:hover { color: var(--accent); }
.foot-note { margin: 0; }
.theme-home .site-footer { color: #8d8a93; font-family: var(--pixel); font-size: 1.4rem; }
.theme-home .site-footer .foot-socials a { color: #e8e4da; border-color: rgba(255, 255, 255, .2); }
.theme-scifi .site-footer, .theme-void .site-footer { font-family: var(--pixel); font-size: 1.4rem; }

/* 4. SUBSCRIBE --------------------------------------------------------------- */
.subscribe { width: min(460px, 100%); margin: 0 auto; }
.sub-row {
  display: flex;
  padding: 5px;
  background: rgba(255, 255, 255, .78);
  border: 2px solid #efc3bc;
  border-radius: 999px;
  box-shadow: 0 6px 24px -10px rgba(217, 49, 28, .35);
  transition: border-color .2s, box-shadow .2s;
}
.sub-row:focus-within { border-color: var(--logo-red); box-shadow: 0 8px 30px -10px rgba(217, 49, 28, .5); }
.sub-row input {
  flex: 1; min-width: 0;
  border: 0; background: transparent; outline: none;
  padding: 10px 16px;
  font: inherit; font-size: 1.02rem; color: #3b1d19;
}
.sub-row input::placeholder { color: #b8918b; }
.sub-row button {
  border: 0; cursor: pointer;
  padding: 10px 22px;
  border-radius: 999px;
  background: var(--logo-red);
  color: #fff;
  font-weight: 600;
  letter-spacing: .01em;
  transition: transform .15s, background-color .2s;
}
.sub-row button:hover { background: #bd2511; }
.sub-row button:active { transform: scale(.96); }
.sub-row button[disabled] { opacity: .6; cursor: wait; }
.sub-note { margin: 10px 0 0; font-family: var(--hand); font-size: 1.15rem; color: var(--muted); min-height: 1.6em; }
.sub-note.ok { color: #2f7a4b; }
.sub-note.err { color: #b3261e; }
.consent {
  display: flex; align-items: center; justify-content: center; gap: 9px;
  margin: 12px auto 0; max-width: 100%;
  font-family: var(--hand); font-size: 1.18rem; line-height: 1.2; color: #7d4a43;
  cursor: pointer; text-align: left;
}
.consent input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.consent .box {
  position: relative; flex: 0 0 20px; width: 20px; height: 20px;
  border: 2px solid #e7a99f; border-radius: 6px; background: rgba(255, 255, 255, .7);
  transition: background-color .15s, border-color .15s, transform .15s;
}
.consent:hover .box { border-color: var(--logo-red); }
.consent input:checked + .box { background: var(--logo-red); border-color: var(--logo-red); transform: rotate(-4deg); }
.consent input:checked + .box::after { /* hand-drawn-ish tick */
  content: ""; position: absolute; left: 5px; top: 1px; width: 6px; height: 11px;
  border: solid #fff; border-width: 0 2.5px 2.5px 0; transform: rotate(40deg);
}
.consent input:focus-visible + .box { outline: 2px dashed var(--logo-red); outline-offset: 3px; }
.consent.nudge .box { animation: nudge .4s; border-color: var(--logo-red); }
@keyframes nudge { 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }
.theme-scifi .consent { color: var(--muted); }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }

/* 5. HOME -------------------------------------------------------------------- */
.theme-home { background: #0b0a0d; }
html.theme-home { background: #0b0a0d; }

.bg-layers { position: fixed; inset: 0; z-index: 0; pointer-events: none; background: #0b0a0d; }
.bg-layers > * { position: absolute; inset: 0; width: 100%; height: 100%; }
.bg-soft {
  background:
    radial-gradient(60% 45% at 50% 38%, #fff6f4 0%, transparent 70%),
    radial-gradient(40% 35% at 15% 85%, #fde2df 0%, transparent 70%),
    radial-gradient(35% 30% at 88% 15%, #fbe3e8 0%, transparent 70%),
    var(--pink);
  opacity: calc(1 - var(--p, 0));
}
.bg-dusk {
  background:
    radial-gradient(70% 50% at 50% 100%, rgba(255, 140, 110, .25), transparent 70%),
    linear-gradient(180deg, #3a1f33 0%, #6b3346 55%, #a3505a 100%);
  opacity: var(--dusk, 0);
}
.bg-grunge { opacity: var(--p, 0); }
.bg-noise {
  opacity: calc(.05 + var(--p, 0) * .16);
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
.bg-scan {
  opacity: calc(var(--p, 0) * .5);
  background: repeating-linear-gradient(to bottom, rgba(0, 0, 0, .35) 0 1px, transparent 1px 3px);
}
.soft-stars { opacity: calc(1 - var(--p, 0) * 1.4); }
.soft-star {
  position: absolute;
  width: var(--s, 14px); height: var(--s, 14px);
  color: var(--c, var(--star-yellow));
  animation: twinkle var(--d, 3s) ease-in-out infinite;
  animation-delay: var(--delay, 0s);
}
.soft-star svg { width: 100%; height: 100%; fill: currentColor; }
@keyframes twinkle { 0%, 100% { opacity: .35; transform: scale(.8) rotate(0); } 50% { opacity: 1; transform: scale(1.1) rotate(15deg); } }

.hero, .descent, .bowl-zone { position: relative; z-index: 1; }

.hero {
  min-height: 100svh;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center;
  padding: 110px 20px 70px;
  color: #3b1d19;
}
.hero-logo { width: min(600px, 92vw); margin-bottom: 30px; }
.hero-logo img { width: 100%; filter: drop-shadow(0 18px 30px rgba(217, 49, 28, .12)); animation: float 7s ease-in-out infinite; }
@keyframes float { 0%, 100% { transform: translateY(0) rotate(-.4deg); } 50% { transform: translateY(-8px) rotate(.4deg); } }
.hero-tag {
  font-style: italic;
  font-size: clamp(1.05rem, 2.4vw, 1.3rem);
  color: #7d4a43;
  max-width: 34ch;
  margin: 0 0 26px;
}
.find-me {
  display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 10px;
  margin-top: 26px;
  font-family: var(--hand); font-size: 1.25rem; color: #8a5d57;
}
.pill {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 6px 14px 6px 11px;
  border: 1.5px solid #efc3bc;
  border-radius: 999px;
  background: rgba(255, 255, 255, .55);
  text-decoration: none;
  font-family: var(--serif); font-size: .98rem; color: #3b1d19;
  transition: transform .2s, border-color .2s, background-color .2s;
}
.pill svg { width: 16px; height: 16px; fill: var(--logo-red); color: var(--logo-red); }
.pill:hover { transform: translateY(-2px) rotate(-1deg); border-color: var(--logo-red); background: #fff; }
.scroll-cue {
  margin-top: 48px;
  font-family: var(--hand); font-size: 1.3rem; color: #b06a60;
  text-decoration: none;
  animation: bob 2.4s ease-in-out infinite;
}
@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(6px); } }

.descent { height: 150vh; }
.descent-line {
  position: absolute; left: 0; right: 0;
  top: calc(var(--at) * 100%);
  margin: 0; text-align: center;
  font-size: clamp(1.2rem, 3vw, 1.7rem);
  opacity: 0; transform: translateY(16px);
  transition: opacity 1.2s ease, transform 1.2s ease;
}
.descent-line:nth-child(1) { color: #9a5d55; }
.descent-line:nth-child(2) { color: #8e8790; }
.descent-line.glitchy { color: #d8d4c8; font-family: var(--pixel); font-style: normal; font-size: clamp(1.5rem, 3.6vw, 2.1rem); letter-spacing: .06em; }
.descent-line.seen { opacity: 1; transform: none; }
.glitchy.seen { animation: glitch 4s steps(1) infinite 1.2s; }
@keyframes glitch {
  0%, 92%, 100% { text-shadow: none; transform: none; }
  93% { text-shadow: -2px 0 #ff2a6d, 2px 0 #3df2ff; transform: translateX(2px); }
  95% { text-shadow: 2px 0 #ff2a6d, -2px 0 #3df2ff; transform: translateX(-3px) skewX(6deg); }
  97% { text-shadow: none; transform: translateX(1px); }
}

.bowl-zone {
  min-height: 100svh;
  display: flex; flex-direction: column; align-items: center;
  padding: 90px 20px 40px;
  color: #f2efe6;
  font-family: var(--pixel);
}
.bowl-zone::before { /* spotlight behind the bowl */
  content: ""; position: absolute; left: 50%; top: 40px;
  width: min(760px, 120vw); height: 620px; transform: translateX(-50%);
  background: radial-gradient(closest-side, rgba(255, 232, 160, .22), rgba(255, 232, 160, .07) 55%, transparent);
  pointer-events: none;
}
.bowl-art { position: relative; width: min(400px, 76vw); }
.bowl-art img {
  width: 100%;
  filter: drop-shadow(0 0 1px rgba(255, 240, 200, .5)) drop-shadow(0 24px 40px rgba(0, 0, 0, .7)) drop-shadow(0 0 60px rgba(255, 225, 120, .12));
}
.save-star {
  position: absolute; z-index: 2;
  top: 340px; left: calc(50% - min(330px, 44vw));
  width: 38px; height: 38px; padding: 0;
  border: 0; background: none; cursor: pointer;
  color: #ffe14d;
  filter: drop-shadow(0 0 8px rgba(255, 225, 77, .8));
  animation: save-bob 1.6s steps(4) infinite;
}
.save-star svg { width: 100%; height: 100%; fill: currentColor; }
.save-star:hover { color: #fff6a8; }
@keyframes save-bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-4px); } }

.ut-box {
  position: relative;
  width: min(640px, 100%);
  margin-top: 30px;
  padding: 18px 26px;
  background: #000;
  border: 4px solid #fff;
  min-height: 5.6em;
  text-align: left;
  font-family: var(--pixel);
  font-size: clamp(1.6rem, 3.6vw, 2.05rem);
  line-height: 1.2;
  letter-spacing: .02em;
  color: #fff;
}
.ut-text { margin: 0; white-space: pre-line; }
.ut-text .caret { display: inline-block; width: .5em; animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }

.ut-menu { width: min(640px, 100%); margin-top: 28px; text-align: left; font-size: 1.75rem; }
.ut-menu-title { margin: 0 0 6px; color: #ffe14d; }
.ut-sections { margin-top: 22px; }
.ut-menu ul { list-style: none; margin: 0; padding: 0; }
.ut-menu a {
  position: relative; display: block;
  padding: 3px 0 3px 34px;
  text-decoration: none; color: #f2efe6;
}
.ut-menu a::before {
  content: ""; position: absolute; left: 6px; top: 50%;
  width: 16px; height: 14px; margin-top: -7px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 7' shape-rendering='crispEdges'%3E%3Cpath fill='%23ff0000' d='M1 0h2v1h2V0h2v1h1v3H7v1H6v1H5v1H3V6H2V5H1V4H0V1h1z'/%3E%3C/svg%3E") center/contain no-repeat;
  opacity: 0;
}
.ut-menu a:hover, .ut-menu a:focus-visible { color: #ffe14d; outline: none; }
.ut-menu a:hover::before, .ut-menu a:focus-visible::before { opacity: 1; }
.ut-menu .meta { color: #8d8a93; margin-left: 8px; }

/* 6. CATEGORY + BOOKSHELF ---------------------------------------------------- */
.theme-bg { position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }
.cat-hero, .shelf-wrap, .index-list, .post { position: relative; z-index: 1; }

.cat-hero {
  max-width: 1100px; margin: 0 auto;
  padding: clamp(48px, 9vw, 110px) clamp(20px, 5vw, 48px) 36px;
  min-height: 300px;
}
.cat-kicker { margin: 0 0 6px; color: var(--muted); font-family: var(--hand); font-size: 1.3rem; }
.cat-title {
  margin: 0;
  font-family: var(--display);
  font-size: clamp(3rem, 10vw, 6.4rem);
  line-height: .95;
  letter-spacing: -.02em;
}
.cat-tagline { margin: 16px 0 0; max-width: 40ch; font-size: 1.2rem; font-style: italic; color: var(--muted); }
.cat-deco { position: absolute; inset: 0; pointer-events: none; }

.shelf-wrap {
  max-width: 1100px;
  margin: 0 auto;
  padding: 70px clamp(16px, 4vw, 40px) 10px;
}
.bookcase {
  position: relative;
  padding: 10px 18px 0;
  overflow: visible;
  background:
    linear-gradient(90deg, rgba(0, 0, 0, .35), transparent 6%, transparent 94%, rgba(0, 0, 0, .35)),
    var(--case-back);
  border: 12px solid var(--case-frame);
  border-bottom-width: 18px;
  border-radius: 6px;
  box-shadow: 0 30px 60px -30px rgba(0, 0, 0, .6), inset 0 0 40px rgba(0, 0, 0, .4);
}
.shelves { --board-h: 16px; --row: 244px; }
.shelf-row {
  position: relative;
  height: var(--row);
  display: flex; align-items: flex-end; gap: 4px;
  padding: 0 12px var(--board-h);
}
.shelf-row::after { /* the plank */
  content: ""; position: absolute; left: -18px; right: -18px; bottom: 0; height: var(--board-h);
  background: linear-gradient(180deg, color-mix(in srgb, var(--board) 80%, #fff) 0 2px, var(--board) 2px calc(100% - 4px), var(--board-edge) calc(100% - 4px));
  box-shadow: 0 8px 14px -6px rgba(0, 0, 0, .55);
}
.decor-row { --row: 180px; justify-content: flex-start; gap: 22px; padding-left: 28px; }
.slot { display: flex; align-items: flex-end; flex-shrink: 0; }
.slot.spacer { flex: 1; }
.slot.decor { position: relative; z-index: 1; }

/* decor bits */
.flat-stack { display: flex; flex-direction: column-reverse; align-items: flex-start; }
.flat-stack i {
  display: block; height: 20px; margin-left: calc(var(--n, 0) * 1px);
  background: linear-gradient(180deg, rgba(255,255,255,.18), rgba(0,0,0,.25)), var(--c);
  border-radius: 2px; box-shadow: inset 0 0 0 1px rgba(0,0,0,.25);
}
.flat-stack i:nth-child(2) { margin-left: 10px; }
.flat-stack i:nth-child(3) { margin-left: -4px; }
.fig { display: block; height: auto; filter: drop-shadow(0 4px 4px rgba(0, 0, 0, .3)); }
.fig-bow { width: 70px; margin: 0 0 -2px 26px; }
.fig-lounge { width: 110px; margin-right: 6px; margin-bottom: -7px; }
.fig-flex { width: 96px; margin-right: 10px; margin-bottom: -4px; }
.stack-with-fig { flex-direction: column; align-items: flex-start; }
.bonsai { display: block; width: 120px; height: auto; filter: drop-shadow(0 6px 6px rgba(0, 0, 0, .3)); }


.book {
  --w: 44px; --h: 190px; --tilt: 0deg;
  position: relative;
  display: block;
  width: var(--w); height: var(--h);
  border-radius: 3px 3px 1px 1px;
  background:
    linear-gradient(90deg, rgba(0, 0, 0, .35) 0, rgba(255, 255, 255, .14) 18%, rgba(255, 255, 255, .02) 40%, rgba(0, 0, 0, .1) 75%, rgba(0, 0, 0, .4) 100%),
    var(--spine, #8c2f25);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .25), 2px 0 3px rgba(0, 0, 0, .25);
  color: var(--spine-ink, #f6ecd9);
  text-decoration: none;
  transform: rotate(var(--tilt));
  transform-origin: bottom left;
  transition: transform .28s cubic-bezier(.3, 1.4, .5, 1), filter .2s;
  cursor: pointer;
}
.book::before, .book::after { /* little foil bands */
  content: ""; position: absolute; left: 4px; right: 4px; height: 3px;
  border-top: 1px solid var(--band, rgba(240, 210, 140, .8));
  border-bottom: 1px solid var(--band, rgba(240, 210, 140, .8));
}
.book::before { top: 14px; }
.book::after { bottom: 14px; }
.book:hover, .book:focus-visible, .book.open { transform: translateY(-12px) rotate(var(--tilt)); filter: brightness(1.08); z-index: 5; outline: none; }
.spine-title {
  position: absolute; inset: 24px 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
  writing-mode: vertical-rl;
  font-family: var(--serif); font-weight: 600; font-size: .86rem; line-height: 1.1; letter-spacing: .03em;
  overflow: hidden; text-align: center;
}
.spine-name { max-block-size: 72%; }
.spine-author { font-weight: 400; font-style: italic; opacity: .8; font-size: .72rem; white-space: nowrap; }

.book.ghost {
  background: transparent;
  border: 2px dashed var(--ghost);
  box-shadow: none; cursor: default;
  color: var(--ghost);
}
.book.ghost::before, .book.ghost::after { display: none; }
.book.ghost:hover { transform: rotate(var(--tilt)); filter: none; }
.book.ghost .spine-title { font-family: var(--hand); font-weight: 400; font-size: 1rem; }

.bookend {
  width: 22px; height: 120px;
  background: linear-gradient(180deg, #c9a45c, #8d6a2b);
  clip-path: polygon(0 0, 100% 18%, 100% 100%, 0 100%);
  border-radius: 2px;
}

/* the hover popup ("peek") */
.peek {
  position: absolute;
  bottom: calc(100% + 16px);
  left: 50%;
  width: 290px;
  display: flex; gap: 14px; align-items: stretch;
  padding: 12px;
  background: var(--peek-bg);
  color: var(--peek-ink);
  border-radius: 10px;
  box-shadow: 0 18px 40px -12px rgba(0, 0, 0, .55), 0 0 0 1px rgba(0, 0, 0, .08);
  transform: translate(calc(-50% + var(--shift, 0px)), 8px) scale(.96);
  transform-origin: bottom center;
  opacity: 0; visibility: hidden;
  transition: opacity .18s, transform .22s, visibility 0s .22s;
  writing-mode: horizontal-tb;
  text-align: left;
  z-index: 30;
  pointer-events: none;
}
.peek::after { /* hover bridge so the popup doesn't vanish on the way up */
  content: ""; position: absolute; left: 0; right: 0; top: 100%; height: 18px;
}
.peek.below { bottom: auto; top: calc(100% + 16px); transform-origin: top center; }
.peek.below::after { top: auto; bottom: 100%; }
.book:hover .peek, .book:focus-visible .peek, .book.open .peek {
  opacity: 1; visibility: visible; pointer-events: auto;
  transform: translate(calc(-50% + var(--shift, 0px)), 0) scale(1);
  transition: opacity .18s, transform .22s, visibility 0s;
}
.peek-thumb {
  flex: 0 0 96px; height: 140px;
  border-radius: 3px 5px 5px 3px;
  overflow: hidden;
  background: var(--spine);
  box-shadow: 4px 6px 14px -6px rgba(0, 0, 0, .5);
}
.peek-text { display: flex; flex-direction: column; min-width: 0; padding-top: 2px; }
.peek-title, .peek-meta, .peek-cta { display: block; }
.peek-cta { margin-top: auto !important; white-space: nowrap; }
.peek-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.gen-cover { /* generated cover when no image is set */
  position: relative; height: 100%;
  display: flex; flex-direction: column; justify-content: space-between;
  padding: 18px 14px;
  background:
    radial-gradient(circle at 70% 30%, rgba(255, 255, 255, .22), transparent 45%),
    linear-gradient(160deg, rgba(255, 255, 255, .12), rgba(0, 0, 0, .35)),
    var(--spine);
  color: #f8efe0;
  box-shadow: inset 6px 0 0 rgba(0, 0, 0, .25);
}
.gen-cover { padding: 12px 10px; }
.gen-cover .gc-title { font-family: var(--serif); font-weight: 600; font-size: 1.05rem; line-height: 1.05; }
.gen-cover .gc-author { font-family: var(--serif); font-style: italic; font-size: .72rem; opacity: .85; }
.gen-cover .gc-sun { position: absolute; right: 10px; bottom: 34px; width: 30px; height: 30px; border-radius: 50%; border: 2px solid rgba(255, 240, 210, .7); }
.peek-title { margin: 0; font-family: var(--serif); font-weight: 600; font-size: 1.2rem; line-height: 1.15; }
.peek-meta { margin: 6px 0 0; font-size: .85rem; line-height: 1.35; opacity: .72; }
.peek-cta { margin: 8px 0 0; font-family: var(--hand); font-size: 1.1rem; color: var(--accent); }

.shelf-hint { text-align: center; color: var(--muted); font-family: var(--hand); font-size: 1.2rem; margin: 14px 0 0; }

.index-list { max-width: 760px; margin: 0 auto; padding: 50px 20px 20px; }
.index-list h2 { font-family: var(--display); font-weight: 500; font-size: 1.6rem; margin: 0 0 12px; }
.index-list ol { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--rule); }
.index-list li a {
  display: grid; grid-template-columns: 1fr auto; gap: 4px 16px;
  padding: 14px 4px; border-bottom: 1px solid var(--rule);
  text-decoration: none;
  transition: background-color .2s, padding .2s;
}
.index-list li a:hover { background: color-mix(in srgb, var(--accent) 8%, transparent); padding-left: 12px; }
.index-list .t { font-weight: 600; font-size: 1.1rem; }
.index-list .d { color: var(--muted); font-size: .9rem; }
.index-list .x { grid-column: 1 / -1; color: var(--muted); font-size: .95rem; }
.index-list .empty { padding: 18px 4px; color: var(--muted); font-style: italic; }

/* 7. POST -------------------------------------------------------------------- */
.post { max-width: 720px; margin: 0 auto; padding: 40px 22px 30px; }
.back-link { display: inline-block; margin-bottom: 30px; color: var(--muted); text-decoration: none; font-family: var(--hand); font-size: 1.2rem; }
.back-link:hover { color: var(--accent); }
.post-head { display: grid; grid-template-columns: auto 1fr; gap: 28px; align-items: end; margin-bottom: 40px; }
.post-cover {
  width: 120px; aspect-ratio: 2 / 3;
  display: flex; flex-direction: column; justify-content: space-between;
  padding: 14px 12px;
  border-radius: 2px 6px 6px 2px;
  background:
    radial-gradient(circle at 70% 30%, rgba(255, 255, 255, .22), transparent 45%),
    linear-gradient(160deg, rgba(255, 255, 255, .12), rgba(0, 0, 0, .35)),
    var(--spine);
  color: #f8efe0;
  box-shadow: inset 6px 0 0 rgba(0, 0, 0, .25), 8px 12px 24px -10px rgba(0, 0, 0, .5);
}
.post-cover.has-image { padding: 0; background: none; overflow: hidden; }
.post-cover.has-image img { width: 100%; height: 100%; object-fit: cover; }
.pc-title { font-weight: 600; font-size: 1.05rem; line-height: 1.1; }
.pc-author { font-style: italic; font-size: .75rem; opacity: .85; }
.post-title { margin: 0; font-family: var(--display); font-size: clamp(2.4rem, 7vw, 3.8rem); line-height: 1; letter-spacing: -.01em; }
.post-author { margin: 8px 0 0; font-style: italic; font-size: 1.25rem; color: var(--accent); }
.post-meta { margin: 6px 0 0; color: var(--muted); font-size: .92rem; }
.post-body { font-size: 1.2rem; line-height: 1.8; }
.post-body p { margin: 0 0 1.25em; }
.post-body > p:first-child::first-letter {
  float: left; font-size: 3.6em; line-height: .85; padding: 6px 10px 0 0;
  font-weight: 600; color: var(--accent);
}
.poem {
  margin: 2.2em 0;
  padding: 1.4em 1.6em;
  border-left: 3px solid var(--accent);
  background: color-mix(in srgb, var(--accent) 6%, transparent);
  font-style: italic;
  font-size: 1.3rem;
}
.poem p { margin: 0; }
.poem p + p { margin-top: .7em; }
.poem .poem-title { display: block; font-family: var(--hand); font-weight: 700; font-size: 2.1rem; line-height: 1; color: var(--accent); }
.poem .poem-sub { display: block; margin-top: .25em; }
.poem .poem-label {
  font-style: normal; font-family: var(--hand); font-size: 1.15rem;
  color: var(--accent); margin-bottom: .4em;
}
.post-body .truth {
  margin: 1.6em 0; padding: 1.1em 0;
  border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule);
  font-size: 1.45rem; line-height: 1.45; font-weight: 500;
  text-align: center; text-wrap: balance; color: var(--accent);
}
.signature { display: flex; justify-content: flex-end; align-items: center; gap: 2px; margin: 2.2em 0 0; }
.theme-scifi .post-sub > p { margin: 0 0 14px; font-style: italic; }
.more-shelf { margin-top: 40px; }
.more-shelf h2 { font-family: var(--hand); font-weight: 400; font-size: 1.4rem; color: var(--muted); margin: 0 0 8px; }
.more-shelf a { display: block; padding: 6px 0; }

/* 404 */
.lost { min-height: 70vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 40px 20px; font-family: var(--pixel); }
.lost-home { margin-top: 22px; color: #ffe14d; font-size: 1.5rem; text-decoration: none; }

/* 8. THEME DECORATIONS ------------------------------------------------------- */

/* --- philosophy: old paper, ink, a low sun --- */
.theme-philosophy .theme-bg {
  background:
    radial-gradient(circle at 82% 16%, rgba(214, 92, 52, .30) 0 90px, rgba(232, 150, 90, .18) 91px 160px, transparent 300px),
    radial-gradient(120% 80% at 50% 120%, rgba(120, 80, 40, .18), transparent 60%),
    var(--bg);
}
.theme-philosophy .theme-bg::after {
  content: ""; position: absolute; inset: 0; opacity: .35; mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Cfilter id='p'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.04 .6' numOctaves='3'/%3E%3CfeColorMatrix values='0 0 0 0 .55 0 0 0 0 .45 0 0 0 0 .32 0 0 0 .35 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23p)'/%3E%3C/svg%3E");
}
.theme-philosophy .cat-title { font-family: var(--hand); font-weight: 700; font-size: clamp(3.4rem, 11vw, 7.2rem); line-height: .9; letter-spacing: 0; }
.theme-philosophy .cat-tagline { font-style: normal; }
.theme-philosophy .cat-title::after { content: "."; color: var(--accent); }
.theme-philosophy .post-body > p:first-child::first-letter { font-family: var(--serif); font-style: italic; }

/* --- sci-fi: ASCII cosmos over a megastructure --- */
.theme-scifi { font-family: var(--mono); font-size: 1rem; }
.theme-scifi .theme-bg { background: radial-gradient(90% 60% at 70% 0%, #1d1018, transparent 70%), var(--bg); }
.theme-scifi .theme-bg canvas { position: absolute; inset: 0; width: 100%; height: 100%; opacity: .32; }
.ascii-stars {
  position: absolute; inset: 0;
  margin: 0; overflow: hidden;
  font-family: var(--mono); font-size: 13px; line-height: 15px;
  color: #8e7880; white-space: pre;
}
.ascii-stars b { font-weight: 400; color: #fff3f7; text-shadow: 0 0 6px #ffd9e7; }
.ascii-stars i { font-style: normal; color: var(--amber); }
.theme-scifi .theme-bg::after { /* scanlines + vignette */
  content: ""; position: absolute; inset: 0;
  background:
    repeating-linear-gradient(to bottom, rgba(0, 0, 0, .28) 0 1px, transparent 1px 3px),
    radial-gradient(120% 90% at 50% 50%, transparent 60%, rgba(0, 0, 0, .7));
}
.theme-scifi .cat-kicker { font-family: var(--pixel); font-size: 1.35rem; color: var(--amber); letter-spacing: .08em; }
.theme-scifi .cat-title { font-weight: 400; color: var(--accent); text-shadow: 0 0 18px rgba(255, 217, 231, .45); letter-spacing: .02em; }
.theme-scifi .cat-title::before { content: "> "; color: var(--muted); }
.theme-scifi .cat-title::after { content: "_"; animation: blink 1s steps(1) infinite; }
.theme-scifi .cat-tagline { font-family: var(--mono); font-style: normal; font-size: 1rem; }
.ascii-planet, .ascii-moon, .ascii-dog {
  position: absolute; margin: 0;
  font-family: var(--mono); white-space: pre; line-height: 1;
}
.ascii-planet { right: clamp(-60px, 2vw, 40px); top: 24px; font-size: clamp(7px, 1.05vw, 12px); color: var(--accent); text-shadow: 0 0 8px rgba(255, 217, 231, .35); }
.ascii-moon { right: clamp(260px, 36vw, 470px); top: 30px; font-size: 10px; color: #b8c4c1; opacity: .8; }
.ascii-cat, .ascii-dog { font-size: 12px; color: var(--amber); text-shadow: 0 0 6px rgba(241, 210, 172, .4); }
.ascii-cat { color: var(--alien); text-shadow: 0 0 7px rgba(185, 245, 166, .5); }
.ascii-red-moon { position: absolute; margin: 0; font-family: var(--mono); white-space: pre; line-height: 1; font-size: 9px; color: var(--moon-red); text-shadow: 0 0 10px rgba(255, 77, 77, .55); right: -40px; top: 250px; transform: rotate(-18deg); }
.ascii-full-moon { right: auto; left: 36%; top: 40px; color: #e4d8dc; text-shadow: 0 0 8px rgba(255, 240, 245, .35); }

/* clickable critters + Pokémon-style speech box */
.critter {
  position: absolute; padding: 0; border: 0; background: none; cursor: pointer;
  font: inherit; color: inherit; line-height: 0;
  transition: transform .15s;
}
.critter:hover { transform: translateY(-2px); }
.critter:active { transform: translateY(1px) scale(.97); }
.critter pre { margin: 0; position: static; }
.critter-cat { right: 70px; bottom: calc(100% + 12px); z-index: 3; }
.critter-dog { position: relative; }
.critter-fig { position: relative; display: block; }
.critter-fig .poke-box { left: auto; right: -8px; transform: scale(.6); transform-origin: bottom right; min-width: 120px; }
.critter-fig .poke-box.show { transform: scale(1); }
.poke-box {
  position: absolute; left: 50%; bottom: calc(100% + 12px); z-index: 40;
  min-width: 170px; padding: 12px 34px 12px 16px;
  background: #f8f8f8; color: #282828;
  border: 4px solid #6b6b78; border-radius: 10px;
  box-shadow: inset 0 0 0 3px #f8f8f8, inset 0 0 0 5px #d8a0b0, 0 6px 0 rgba(0, 0, 0, .35);
  font-family: var(--pixel); font-size: 1.6rem; line-height: 1.1; text-align: left; white-space: nowrap;
  transform: translateX(-50%) scale(.6); transform-origin: bottom center;
  opacity: 0; visibility: hidden; pointer-events: none;
  transition: transform .14s steps(3), opacity .1s, visibility 0s .14s;
}
.poke-box.show { opacity: 1; visibility: visible; transform: translateX(-50%) scale(1); transition: transform .14s steps(3), opacity .1s; }
.poke-box .who { display: block; font-size: 1.05rem; color: #a2486a; margin-bottom: 2px; }
.poke-box::after { /* the blinking "next" arrow */
  content: ""; position: absolute; right: 12px; bottom: 10px;
  border: 6px solid transparent; border-top: 8px solid #e04a4a; border-bottom: 0;
  animation: blink .8s steps(1) infinite;
}
.critter-cat .poke-box { left: auto; right: -20px; transform: scale(.6); transform-origin: bottom right; }
.critter-cat .poke-box.show { transform: scale(1); }
.ascii-cat { position: absolute; right: 70px; bottom: calc(100% + 12px); margin: 0; white-space: pre; line-height: 1.05; font-family: var(--mono); z-index: 2; }
.ascii-dog { position: static; line-height: 1.05; }
.ascii-bubble { position: absolute; right: 150px; bottom: calc(100% + 92px); font-family: var(--pixel); font-size: 1.15rem; color: var(--ink); white-space: nowrap; opacity: 0; transition: opacity .3s; }
.shelf-wrap:hover .ascii-bubble { opacity: 1; }
.shelf-wrap.critter-talking .ascii-bubble { opacity: 0; }
.theme-scifi .book { --band: rgba(255, 217, 231, .7); border-radius: 1px; }
.theme-scifi .spine-title { font-family: var(--pixel); font-weight: 400; font-size: 1.15rem; letter-spacing: .06em; }
.theme-scifi .bookcase { border-radius: 0; box-shadow: 0 0 0 1px rgba(255, 217, 231, .25), 0 0 40px -10px rgba(255, 217, 231, .25), inset 0 0 50px rgba(0, 0, 0, .8); }
.theme-scifi .bookcase::before { content: "ARCHIVE//SHELF.01"; position: absolute; top: -32px; left: -12px; font-family: var(--pixel); font-size: 1.1rem; color: var(--muted); letter-spacing: .1em; }
.theme-scifi .peek { border-radius: 0; border: 1px solid var(--accent); font-family: var(--mono); box-shadow: 0 0 30px -6px rgba(255, 217, 231, .4); }
.theme-scifi .peek-title { font-family: var(--pixel); font-size: 1.4rem; font-weight: 400; color: var(--accent); }
.theme-scifi .peek-cta { font-family: var(--pixel); }
.theme-scifi .bookend { background: linear-gradient(180deg, #73626a, #33292e); }
.theme-scifi .shelf-row::after { box-shadow: 0 1px 0 rgba(255, 217, 231, .35), 0 8px 14px -6px rgba(0, 0, 0, .8); }
.theme-scifi .index-list h2, .theme-scifi .post-title { font-weight: 400; color: var(--accent); }
.theme-scifi .post-body { font-family: var(--serif); }
.theme-scifi .sub-row { background: #150e12; border-color: var(--rule); box-shadow: none; }
.theme-scifi .sub-row input { color: var(--ink); }
.theme-scifi .post-sub { background: rgba(21, 14, 18, .8); }

/* --- manga: screentone, speed lines, ink --- */
.theme-manga .theme-bg {
  background:
    radial-gradient(circle, rgba(0, 0, 0, .16) 1.2px, transparent 1.6px) 0 0 / 9px 9px,
    var(--bg);
  -webkit-mask-image: linear-gradient(180deg, #000 0, rgba(0, 0, 0, .35) 60%, rgba(0, 0, 0, .15));
          mask-image: linear-gradient(180deg, #000 0, rgba(0, 0, 0, .35) 60%, rgba(0, 0, 0, .15));
}
.theme-manga .cat-hero::before { /* speed lines burst */
  content: ""; position: absolute; inset: 0; z-index: -1;
  background: repeating-conic-gradient(from 0deg at 30% 60%, rgba(0, 0, 0, .85) 0 .6deg, transparent .6deg 7deg);
  -webkit-mask-image: radial-gradient(ellipse at 30% 60%, transparent 22%, #000 70%);
          mask-image: radial-gradient(ellipse at 30% 60%, transparent 22%, #000 70%);
  opacity: .22;
}
.theme-manga .cat-title { color: #111; text-shadow: 5px 5px 0 var(--accent); letter-spacing: 0; }
.theme-manga .cat-kicker { font-family: var(--manga); font-size: 1rem; color: var(--accent); }
.theme-manga .cat-hero { overflow: hidden; }
.theme-manga .bookcase { border-width: 6px; border-radius: 0; box-shadow: 10px 10px 0 #111; background: var(--case-back); }
.theme-manga .shelves { --board-h: 10px; }
.theme-manga .shelf-row::after { left: -6px; right: -6px; box-shadow: none; }
.theme-manga .book { border: 2px solid #111; border-radius: 0; box-shadow: none; --band: rgba(255, 255, 255, .8); }
.theme-manga .spine-title { font-family: var(--manga); font-weight: 400; font-size: .8rem; }
.theme-manga .peek { border-radius: 0; border: 3px solid #111; box-shadow: 6px 6px 0 #111; }
.theme-manga .peek-title { font-family: var(--manga); font-weight: 400; }
.theme-manga .bookend { background: #111; }
.theme-manga .index-list h2 { font-weight: 400; }

/* --- void (404) --- */
.theme-void { font-family: var(--pixel); }

/* 9. RESPONSIVE / MOTION ----------------------------------------------------- */
@media (max-width: 720px) {
  .brand { gap: 8px; }
  .brand-logo { width: 72px; }
  .brand-name { font-size: 1.25rem; }
  .nav-toggle {
    display: grid; gap: 6px; place-content: center;
    width: 42px; height: 42px; padding: 0;
    border: 0; background: none; cursor: pointer;
  }
  .nav-toggle span { display: block; width: 22px; height: 2px; background: currentColor; transition: transform .25s; }
  .nav-toggle[aria-expanded="true"] span:first-child { transform: translateY(4px) rotate(45deg); }
  .nav-toggle[aria-expanded="true"] span:last-child { transform: translateY(-4px) rotate(-45deg); }
  .site-nav {
    position: absolute; top: 100%; left: 12px; right: 12px;
    flex-direction: column; align-items: stretch; gap: 2px;
    padding: 10px;
    background: var(--bg);
    border: 1px solid var(--rule);
    border-radius: 14px;
    box-shadow: 0 20px 40px -20px rgba(0, 0, 0, .5);
    opacity: 0; transform: translateY(-8px); visibility: hidden;
    transition: opacity .2s, transform .2s, visibility 0s .2s;
  }
  .theme-home .site-nav { background: #fff8f6; }
  .theme-home.is-deep .site-nav { background: #0d0c10; }
  .site-nav.open { opacity: 1; transform: none; visibility: visible; transition: opacity .2s, transform .2s; }
  .nav-link { padding: 10px 14px; }

  .shelves { --row: 206px; }
  .decor-row { --row: 150px; }
  .peek { width: 260px; }
  .peek-thumb { flex-basis: 80px; height: 118px; }
  .post-head { grid-template-columns: 1fr; gap: 20px; }
  .post-cover { width: 96px; }
  .ascii-planet { opacity: .45; top: 70px; }
  .ascii-moon, .ascii-full-moon { display: none; }
  .ascii-red-moon { top: 200px; right: 12px; font-size: 7px; }
  .critter-cat { right: 20px; }
  .ascii-bubble { right: 90px; }
  .save-star { top: 300px; left: 14px; }
  .ut-menu .meta { display: block; margin-left: 0; font-size: .8em; }
  .decor-row { gap: 10px; padding-left: 6px; }
  .flat-stack { zoom: .75; }
    .bonsai { width: 92px; }
  .fig-bow { width: 54px; margin-left: 18px; }
  .fig-lounge { width: 88px; }
  .fig-flex { width: 72px; }
  }
@media (hover: none) { .shelf-wrap:hover .ascii-bubble { opacity: 0; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}
