/* Colors and fonts come from the shared tokens file (design system C1, Nov 10). The names below are the devlog's old
   nicknames for the same tokens; khaki, skin, donut and lavender are art colors that only the devlog uses. */
@import url("../assets/ui/ms-tokens.css?v=2");
/* VT323 (SIL OFL, self-hosted): a pixel font with serifs, used for the big first letter of each memo */
@font-face { font-family: "VT323"; src: url("fonts/vt323-latin-400.woff2") format("woff2"); font-display: swap; }
/* Midlife Survivors Devlog mockup — palette from assets/art-direction/STYLE_GUIDE.md */
:root {
  --navy: var(--ms-surface, #171C35);
  --slate: var(--ms-raised, #303750);
  --muted-blue: var(--ms-line, #526078);
  --teal: var(--ms-border, #3E7775);
  --sage: var(--ms-ok, #83A89A);
  --khaki: #D3B78D;
  --cream: var(--ms-paper, #F2D7A1);
  --warm-white: var(--ms-text, #FFF0CF);
  --russet: #874C3B;
  --tie: var(--ms-danger, #C45C4B);
  --orange: var(--ms-accent, #EF9347);
  --skin: #E5A995;
  --donut: #F1B5BF;
  --lavender: #BFA8CF;
  --fg: var(--ms-text, #FFF0CF);
  --muted: var(--ms-text-quiet, #B8C0D4);
  --line: var(--ms-raised, #303750);
  --surface: #1f2640;
  --surface-2: #262e4d;
  --display: var(--ms-font-label, "Silkscreen", "Courier New", monospace);
  --body: var(--ms-font-read, "Atkinson Hyperlegible", system-ui, sans-serif);
  --radius: 6px;
  --shadow: 0 12px 40px rgba(0,0,0,.45);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--navy);
  color: var(--fg);
  font: 17px/1.65 var(--body);
  min-height: 100vh;
}
img { max-width: 100%; height: auto; }
a { color: var(--orange); }
a:focus-visible { outline: 2px solid var(--orange); outline-offset: 2px; }

.silk { font-family: var(--display); letter-spacing: .04em; }
.pill {
  display: inline-block;
  font-family: var(--display);
  font-size: 11px;
  letter-spacing: .04em;
  padding: 4px 9px;
  border-radius: 999px;
  background: var(--orange);
  color: var(--navy);
  text-decoration: none;
  white-space: nowrap;
}
.pill.draft { background: var(--tie); color: var(--warm-white); }
.pill.ghost {
  background: transparent;
  color: var(--cream);
  border: 1px solid var(--teal);
}

/* —— Site chrome —— */
.site-header {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 18px;
  background: rgba(23,28,53,.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.site-header .brand {
  display: flex; align-items: center; gap: 10px;
  text-decoration: none; color: var(--cream);
}
.site-header .brand-mark {
  display: block; flex: 0 0 32px; width: 32px; height: 32px;
  background: url("../assets/branding/clock-mark-v1.svg") center / 32px 32px no-repeat;
  image-rendering: pixelated;
}
.site-header .brand-title { font-family: var(--display); font-size: 12px; }
.site-header .brand-sub { display: block; font-family: var(--body); font-size: 12px; color: var(--muted); font-weight: 400; }
.site-header.is-compact .brand-sub { display: none; }

.site-header .actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
@media (max-width: 560px) {
  .site-header { flex-wrap: wrap; }
  .site-header .brand { flex: 1 0 100%; }
  .site-header .brand-sub { display: none; }
  .site-header .actions { width: 100%; justify-content: flex-start; }
}

.btn {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--display); font-size: 11px; letter-spacing: .03em;
  padding: 8px 12px; border-radius: 4px; text-decoration: none;
  border: 1px solid transparent; cursor: pointer;
}
.btn-primary { background: var(--orange); color: var(--navy); }
.btn-primary:hover { filter: brightness(1.05); }
.btn-ghost { background: transparent; color: var(--cream); border-color: var(--teal); }
.btn-ghost:hover { border-color: var(--orange); color: var(--orange); }
/* Buttons feel like buttons (Nov 7, Rami): a raised bottom edge at rest, a lift on hover, a press on click.
   The Read the memo button lives inside the big memo card, so it reacts when the card is hovered or clicked too. */
.btn { position: relative; box-shadow: 0 3px 0 rgba(0,0,0,.45); transition: transform .08s ease, box-shadow .08s ease, filter .12s ease, background-color .12s ease, color .12s ease, border-color .12s ease; }
.btn:hover, .feature:hover .feature-cta, .feature:focus-visible .feature-cta { transform: translateY(-1px); box-shadow: 0 4px 0 rgba(0,0,0,.45); }
.btn-primary:hover, .feature:hover .feature-cta.btn-primary, .feature:focus-visible .feature-cta.btn-primary { filter: none; background: #F5A866; }
.btn:active, .feature:active .feature-cta { transform: translateY(3px); box-shadow: 0 0 0 rgba(0,0,0,.45), inset 0 2px 0 rgba(0,0,0,.25); filter: brightness(.94); transition-duration: .03s; }
@media (prefers-reduced-motion: reduce) { .btn, .btn:hover, .btn:active, .feature .feature-cta { transform: none !important; transition: none; } }

/* —— Hero (key art) —— */
.hero {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  border-bottom: 3px solid var(--teal);
  background: #0c1022;
  min-height: clamp(280px, 52vw, 560px);
}
.hero-frame {
  position: absolute; inset: 10px;
  border: 2px solid var(--cream);
  box-shadow: inset 0 0 0 1px var(--navy), 0 0 0 6px rgba(62,119,117,.35);
  pointer-events: none; z-index: 5;
  opacity: .55;
}
.hero-scan {
  position: absolute; inset: 0; z-index: 4; pointer-events: none;
  background: repeating-linear-gradient(
    to bottom,
    rgba(23,28,53,.0) 0 2px,
    rgba(23,28,53,.18) 2px 3px
  );
  mix-blend-mode: multiply;
  opacity: .35;
}
.hero-stage {
  position: absolute; inset: -4% -6%;
  background-image: image-set(
    url("img/office-key-art-hero.webp") type("image/webp"),
    url("img/office-key-art-hero.jpg") type("image/jpeg")
  );
  background-size: cover;
  background-position: 45% 40%;
  transform: scale(1.08);
  animation: heroPan 36s ease-in-out infinite alternate;
  will-change: transform, background-position;
}
@keyframes heroPan {
  from { transform: scale(1.08) translate3d(-1.2%, -0.6%, 0); background-position: 42% 38%; }
  to   { transform: scale(1.14) translate3d(1.4%, 0.8%, 0);  background-position: 58% 48%; }
}
@media (prefers-reduced-motion: reduce) {
  .hero-stage { animation: none; transform: scale(1.06); }
}
.hero-vignette {
  position: absolute; inset: 0; z-index: 3; pointer-events: none;
  background:
    linear-gradient(90deg, rgba(23,28,53,.72) 0%, rgba(23,28,53,.15) 38%, rgba(23,28,53,.55) 100%),
    linear-gradient(180deg, rgba(23,28,53,.2) 0%, rgba(23,28,53,.75) 100%);
}
.hero-memo {
  position: relative; z-index: 8; /* above the hotspot rings so none show through the memo text */
  pointer-events: none;
  max-width: 420px;
  margin: clamp(28px, 8vw, 72px) 0 0 clamp(16px, 5vw, 56px);
  padding: 16px 18px 14px;
  background: var(--cream);
  color: var(--navy);
  box-shadow: var(--shadow), 2px 3px 0 var(--orange);
  transform: rotate(-1.5deg);
}
.hero-memo .memo-eyebrow {
  font-family: var(--display); font-size: 10px; color: var(--navy);
  text-transform: uppercase; margin-bottom: 6px;
}
.hero-memo h1 {
  font-family: var(--body); font-weight: 700;
  font-size: clamp(22px, 4vw, 32px); line-height: 1.15;
  margin: 0 0 8px; color: var(--navy);
}
.hero-memo p { margin: 0; font-size: 15px; color: var(--slate); }
.hero-memo .memo-meta {
  margin-top: 12px; padding-top: 10px;
  border-top: 1px dashed var(--khaki);
  font-family: var(--display); font-size: 10px; color: var(--russet);
}

/* Hotspots */
.hotspot-layer { position: absolute; inset: 0; z-index: 7; }
.hotspot {
  position: absolute;
  transform: translate(-50%, -50%);
  width: 28px; height: 28px;
  border-radius: 50%;
  border: 2px solid var(--orange);
  background: rgba(239,147,71,.25);
  box-shadow: 0 0 0 0 rgba(239,147,71,.5);
  cursor: pointer; padding: 0;
  animation: pulse 2.4s ease-out infinite;
}
.hotspot:hover, .hotspot:focus-visible, .hotspot.is-open {
  background: rgba(239,147,71,.55);
  outline: none;
}
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(239,147,71,.55); }
  70% { box-shadow: 0 0 0 14px rgba(239,147,71,0); }
  100% { box-shadow: 0 0 0 0 rgba(239,147,71,0); }
}
@media (prefers-reduced-motion: reduce) {
  .hotspot { animation: none; }
}
.hotspot-tip {
  position: absolute; z-index: 60;
  min-width: 200px; max-width: 260px;
  padding: 10px 12px;
  background: var(--navy);
  border: 2px solid var(--orange);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  color: var(--cream);
  pointer-events: auto;
  display: none;
}
.hotspot-tip.is-open { display: block; }
.hotspot-tip .ht-label {
  font-family: var(--display); font-size: 11px; color: var(--orange);
  margin-bottom: 4px;
}
.hotspot-tip .ht-joke { font-size: 14px; line-height: 1.4; margin: 0 0 6px; }
.hotspot-tip .ht-tip { font-size: 13px; color: var(--muted); margin: 0 0 8px; }
.hotspot-tip a {
  font-family: var(--display); font-size: 10px; text-decoration: none;
}

/* Mobile hotspot strip */
.hotspot-strip {
  display: none;
  gap: 8px; flex-wrap: wrap;
  padding: 12px 16px 4px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.hotspot-chip {
  font-family: var(--display); font-size: 10px;
  padding: 7px 10px; border-radius: 999px;
  background: var(--surface-2); color: var(--cream);
  border: 1px solid var(--teal); cursor: pointer;
}
.hotspot-chip:hover, .hotspot-chip.is-open {
  border-color: var(--orange); color: var(--orange);
}

@media (max-width: 720px) {
  .hotspot-layer { display: none; }
  .hotspot-strip { display: flex; }
  .hero-memo { margin: 24px 16px 32px; max-width: none; transform: rotate(-0.8deg); }
  .hero { min-height: 320px; }
}

/* —— Main layout —— */
.wrap { max-width: 880px; margin: 0 auto; padding: 28px 16px 96px; }
.section-label {
  font-family: var(--display); font-size: 11px; color: var(--teal);
  text-transform: uppercase; margin: 0 0 14px;
}

/* Post cards */
.card-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 16px; }
.card {
  display: grid;
  grid-template-columns: 168px 1fr;
  gap: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  text-decoration: none; color: inherit;
  transition: border-color .15s, transform .15s;
}
.card:hover, .card:focus-visible {
  border-color: var(--orange);
  transform: translateY(-1px);
  outline: none;
}
.card-cover {
  background: var(--slate) center/cover no-repeat;
  min-height: 120px;
  image-rendering: auto;
  position: relative;
}
.card-cover::after {
  content: "";
  position: absolute; inset: 0;
  box-shadow: inset 0 0 0 1px rgba(242,215,161,.12);
}
.card-body { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 8px; }
.card-meta {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
  font-size: 13px; color: var(--muted);
}
.card-meta time { font-size: 13px; }
.card-title {
  font-family: var(--body); font-weight: 700;
  font-size: 20px; line-height: 1.25; margin: 0; color: var(--warm-white);
}
.card-teaser { margin: 0; font-size: 15px; color: var(--muted); line-height: 1.45; }
@media (max-width: 560px) {
  .card { grid-template-columns: 1fr; }
  .card-cover { min-height: 160px; }
}

/* —— Article / memo post —— */
.memo-strip {
  background: var(--cream); color: var(--navy);
  padding: 10px 14px;
  display: flex; flex-wrap: wrap; gap: 8px 18px;
  align-items: baseline;
  border-left: 4px solid var(--orange);
  margin-bottom: 18px;
  font-size: 14px;
}
.memo-strip .re {
  font-family: var(--display); font-size: 11px; color: var(--navy);
}
.memo-strip strong { font-weight: 700; }
.post-header h1 {
  font-family: var(--body); font-weight: 700;
  font-size: clamp(26px, 5vw, 36px); line-height: 1.2;
  margin: 0 0 10px; color: var(--warm-white);
}
.post-meta {
  display: flex; flex-wrap: wrap; gap: 10px; align-items: center;
  color: var(--muted); font-size: 14px; margin-bottom: 22px;
}
.post-meta time { font-size: 14px; }

article.post {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 22px 20px 28px;
}
article.post .prose h2 {
  font-family: var(--body); font-weight: 700;
  font-size: 20px; color: var(--orange); margin: 28px 0 8px;
}
article.post .prose p { margin: 0 0 1em; }
/* Gameplay clips: autoplay muted on loop, like a GIF but smaller. */
article.post .prose video {
  display: block; width: 100%; max-width: 100%; height: auto; margin: 18px auto;
  border: 3px solid var(--navy); box-shadow: 0 0 0 2px var(--teal); background: #000;
}
.site-footer a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
article.post .prose img {
  display: block; margin: 18px auto;
  border: 3px solid var(--navy);
  box-shadow: 0 0 0 2px var(--teal);
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  /* Prefer nearest-neighbor when images are intentional pixel art */
  background: var(--navy);
}
article.post .prose strong { color: var(--sage); }
.signoff {
  margin-top: 28px; padding-top: 16px;
  border-top: 1px dashed var(--line);
  font-size: 14px; color: var(--muted);
}
.signoff .silk { color: var(--teal); font-size: 11px; }

.post-cta {
  display: grid; gap: 14px;
  margin: 22px 0;
}
.changes-box {
  background: var(--surface-2);
  border: 1px solid var(--teal);
  border-radius: 6px;
  padding: 14px 16px;
}
.changes-box h3 {
  margin: 0 0 8px;
  font-family: var(--display); font-size: 11px; color: var(--orange);
  font-weight: 400;
}
.changes-box ul { margin: 0; padding-left: 18px; color: var(--cream); }
.changes-box li { margin: 4px 0; font-size: 15px; }
.next-up {
  font-size: 15px; color: var(--muted);
  padding: 10px 12px; border-left: 3px solid var(--lavender);
  background: rgba(191,168,207,.08);
}
.next-up strong { color: var(--lavender); font-family: var(--display); font-size: 11px; font-weight: 400; display: block; margin-bottom: 4px; }

.post-nav {
  display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  margin-top: 28px; padding-top: 16px; border-top: 1px solid var(--line);
}
.post-nav a {
  text-decoration: none; color: var(--cream);
  font-size: 14px; max-width: 46%;
}
.post-nav a span {
  display: block; font-family: var(--display); font-size: 10px; color: var(--teal); margin-bottom: 4px;
}
.post-nav a:hover { color: var(--orange); }

.follow {
  margin-top: 36px;
  padding: 14px;
  border: 1px dashed var(--muted-blue);
  border-radius: 6px;
  color: var(--muted); font-size: 14px;
}
.follow .silk { color: var(--sage); font-size: 10px; margin-bottom: 8px; }
.follow .todos { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.follow .todo {
  font-family: var(--display); font-size: 10px;
  padding: 6px 10px; border: 1px dashed var(--muted-blue);
  color: var(--muted); border-radius: 4px;
}

.site-footer {
  max-width: 880px; margin: 0 auto; padding: 0 16px 40px;
  color: var(--muted); font-size: 13px;
  border-top: 1px solid var(--line); padding-top: 16px;
}

.back {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--display); font-size: 14px; letter-spacing: .04em;
  text-decoration: none; color: var(--cream); margin-bottom: 18px;
  padding: 10px 16px; border: 2px solid var(--teal); border-radius: 6px; background: var(--surface);
  min-height: 44px; /* easy to tap */
}
.back:hover, .back:focus-visible { color: var(--navy); background: var(--cream); border-color: var(--cream); }

.empty { color: var(--muted); padding: 24px; border: 1px dashed var(--line); border-radius: 8px; }

/* Before/after helper class for future GIFs */
.media-compare {
  display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 18px 0;
}
.media-compare figcaption {
  font-family: var(--display); font-size: 10px; color: var(--teal); margin-top: 4px;
}

/* 8-bit cursors (img/cursor-*.png). Falls back to the normal cursor if the image can't load. */
html, body { cursor: url("img/cursor-arrow.png") 0 0, auto; }
a, button, [role="button"], summary, .hotspot, .card { cursor: url("img/cursor-hand.png") 8 0, pointer; }

/* Lead visual at the top of every memo (gameplay clip or cover art). */
.post-lead { margin: 18px 0 20px; }
.post-lead img, .post-lead video {
  display: block; width: 100%; height: auto; background: #000;
  border: 3px solid var(--navy); box-shadow: 0 0 0 2px var(--teal);
  image-rendering: pixelated;
}
/* Lead clips play like a GIF: no player controls. Tap the clip or the small button to pause. */
.lead-loop { position: relative; }
.lead-loop video { cursor: inherit; }
.lead-loop video::-webkit-media-controls { display: none !important; }
.loop-btn {
  position: absolute; right: 10px; bottom: 10px; width: 34px; height: 30px; padding: 0;
  font: 12px/1 Silkscreen, monospace; color: var(--cream, #FFF0CF); background: rgba(23,28,53,.78);
  border: 2px solid var(--teal, #3E7775); border-radius: 4px; opacity: .55; transition: opacity .2s;
}
.lead-loop:hover .loop-btn, .loop-btn:focus-visible { opacity: 1; }
.post-lead figcaption { font-size: 13px; color: var(--muted, #a3a8c7); margin-top: 8px; }

/* Play button on the hero memo: the devlog leads straight into the game. */
.hero-memo .memo-play { pointer-events: auto; display: inline-block; margin-top: 14px; }

/* Inline references, popover style (see sidenotes.js). Write ^[note text] in a post's markdown. */
article.post .prose { position: relative; }
.sn-ref {
  font: 700 12px/1 "Atkinson Hyperlegible", system-ui, sans-serif; color: var(--coffee, #EF9347);
  background: none; border: 0; padding: 0 1px 0 2px; margin: 0; vertical-align: super;
  cursor: url("img/cursor-hand.png") 8 0, pointer;
}
.sn-glue { white-space: nowrap; } /* Nov 16: the note number stays with the word before it */
.sn-ref:hover, .sn-ref[aria-expanded="true"] { color: var(--cream, #F2D7A1); text-decoration: underline; }
.sn-ref:focus-visible { outline: 2px solid var(--cream, #F2D7A1); outline-offset: 2px; border-radius: 2px; }
.sn {
  display: none; position: absolute; z-index: 30;
  background: var(--warm-white, #FFF0CF); color: var(--navy, #171C35);
  border: 2px solid var(--navy, #171C35); border-radius: 10px;
  box-shadow: 0 0 0 2px var(--teal, #3E7775), 0 14px 30px rgba(0,0,0,0.45);
  font-size: 15px; line-height: 1.55; text-align: left;
}
.sn.open { display: block; animation: snPop .16s ease-out; transform-origin: 40px -6px; }
@keyframes snPop { from { opacity: 0; transform: translateY(-4px) scale(.96); } to { opacity: 1; transform: none; } }
.sn-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 10px 8px 12px; border-bottom: 1px solid rgba(23,28,53,0.15);
}
.sn-head b {
  font: 400 12px/1 "Silkscreen", monospace; background: var(--teal, #3E7775); color: var(--warm-white, #FFF0CF);
  padding: 5px 7px; border-radius: 4px;
}
.sn-close {
  background: none; border: 0; font-size: 22px; line-height: 1; color: var(--coffee, #EF9347);
  padding: 2px 6px; cursor: url("img/cursor-hand.png") 8 0, pointer;
}
.sn-close:hover { color: var(--navy, #171C35); }
.sn-body { display: block; padding: 12px 14px 14px; }
.sn-body a { color: var(--teal, #3E7775); }
@media (prefers-reduced-motion: reduce) { .sn.open { animation: none; } }

/* Art Room banner on the home page: a sticky note pinned over the panorama art */
.art-banner {
  position: relative; display: block; overflow: hidden; margin: 6px 0 30px;
  border-radius: 10px; box-shadow: 0 0 0 2px var(--teal); text-decoration: none;
  min-height: 250px; isolation: isolate; padding: 30px 24px;
}
.art-banner-img {
  position: absolute; inset: 0; z-index: -2;
  background: url("img/art-room-banner.jpg") center / cover no-repeat; image-rendering: pixelated;
  transition: transform .4s ease;
}
.art-banner::after { content: ""; position: absolute; inset: 0; z-index: -1;
  background: radial-gradient(ellipse at 25% 50%, rgba(23,28,53,0.35), rgba(23,28,53,0.05) 70%); }
.art-banner-text {
  position: relative; display: flex; flex-direction: column; gap: 10px; align-items: flex-start;
  max-width: 340px; padding: 26px 22px 20px;
  background: var(--cream); color: var(--navy);
  transform: rotate(-2.2deg); transform-origin: 50% 0;
  box-shadow: 4px 6px 0 rgba(23,28,53,0.55), 0 14px 24px rgba(0,0,0,0.35);
  transition: transform .2s ease;
}
/* the strip of tape holding it up */
.art-banner-text::before {
  content: ""; position: absolute; top: -12px; left: 50%; width: 92px; height: 24px;
  transform: translateX(-50%) rotate(3deg);
  background: rgba(255,240,207,0.55); border: 1px solid rgba(23,28,53,0.12);
}
/* folded corner */
.art-banner-text::after {
  content: ""; position: absolute; right: 0; bottom: 0; width: 22px; height: 22px;
  background: linear-gradient(135deg, var(--cream) 50%, #d9bd86 50%);
}
.art-banner:hover .art-banner-img, .art-banner:focus-visible .art-banner-img { transform: scale(1.03); }
.art-banner:hover .art-banner-text, .art-banner:focus-visible .art-banner-text { transform: rotate(-0.8deg) translateY(-2px); }
.art-banner:focus-visible { outline: 3px solid var(--cream); outline-offset: 3px; }
.art-banner-eyebrow { font-family: var(--display); font-size: 11px; letter-spacing: .08em; color: var(--teal); }
.art-banner-title { font-weight: 700; font-size: clamp(20px, 3vw, 24px); line-height: 1.2; color: var(--navy); }
.art-banner-cta { margin-top: 4px; }
@media (max-width: 560px) {
  .art-banner { padding: 150px 16px 22px; }
  .art-banner-text { max-width: none; }
}
@media (prefers-reduced-motion: reduce) { .art-banner-img, .art-banner-text { transition: none; } }

/* Code snippets in posts: a dark "printout" with a cream file tab. Comments (the "why") are the brightest. */
.code-card { margin: 22px 0; border-radius: 8px; overflow: hidden; box-shadow: 0 0 0 2px var(--teal), 5px 5px 0 rgba(0,0,0,0.35); background: #10142a; }
.code-card figcaption {
  display: flex; align-items: center; gap: 10px; padding: 8px 12px;
  background: var(--cream); color: var(--navy); border-bottom: 3px solid var(--orange);
}
.code-file { font-family: var(--display); font-size: 12px; letter-spacing: .03em; flex: 1; overflow-wrap: anywhere; }
.code-file::before { content: "📄 "; }
.code-lang { font-family: var(--display); font-size: 10px; background: var(--teal); color: var(--warm-white, #FFF0CF); padding: 3px 6px; border-radius: 3px; }
.code-copy { font-family: var(--display); font-size: 11px; background: var(--navy); color: var(--cream); border: 0; border-radius: 4px; padding: 5px 9px; cursor: url("img/cursor-hand.png") 8 0, pointer; }
.code-copy:hover { background: var(--orange); color: var(--navy); }
.code-card pre { margin: 0; padding: 14px 0; overflow-x: auto; }
.code-card code { display: block; counter-reset: ln; font: 14px/1.6 ui-monospace, "SF Mono", Menlo, Consolas, monospace; color: #dfe3f2; white-space: pre; }
.code-card .ln { display: block; padding: 0 16px 0 0; }
/* Prompts (JSON cards) wrap instead of scrolling sideways, so they read on a phone */
.code-card.lang-json code { white-space: pre-wrap; overflow-wrap: anywhere; }
.code-card.lang-json .ln { padding-left: calc(2.6em + 14px); text-indent: calc(-2.6em - 14px); }
.code-card .ln::before { counter-increment: ln; content: counter(ln); display: inline-block; width: 2.6em; margin-right: 14px; text-align: right; color: #526078; user-select: none; }
.tk-c { color: #a9d4bf; font-style: italic; }   /* comments: the plain-English "why" */
.tk-s { color: var(--cream); }
.tk-n { color: var(--orange); }
.tk-k { color: #8fb8ff; }
@media (max-width: 560px) { .code-card code { font-size: 12.5px; } .code-card .ln::before { width: 2em; margin-right: 10px; } }

/* Ko-fi tip button: warm cream so it reads as friendly, never louder than Play */
.btn-coffee { background: var(--cream); color: var(--navy); border: 1px solid var(--cream); }
.btn-coffee:hover, .btn-coffee:focus-visible { background: var(--warm-white, #FFF0CF); color: var(--navy); }
@media (max-width: 720px) { .coffee-long { display: none; } }

/* ===== Home layout v2 (Nov 3): featured memo + sidebar (build clock, play stats, leaderboard) ===== */
.wrap.home-grid { max-width: 1180px; display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 28px; align-items: start; }
.home-main { min-width: 0; display: flex; flex-direction: column; gap: 16px; }
.home-main .section-label { margin: 0; }
.home-main .art-banner { margin: 8px 0 0; }
.earlier-label { margin-top: 12px !important; }
.home-side { display: flex; flex-direction: column; gap: 16px; position: sticky; top: 84px; }
@media (max-width: 1000px) {
  .wrap.home-grid { grid-template-columns: 1fr; }
  .home-side { position: static; }
}

/* Featured (newest) memo */
.feature {
  display: block; text-decoration: none; color: inherit;
  background: var(--surface); border: 1px solid var(--orange); border-radius: 10px; overflow: hidden;
  box-shadow: 0 0 0 3px rgba(239,147,71,.12), var(--shadow);
  transition: transform .15s, box-shadow .15s;
}
.feature:hover, .feature:focus-visible { transform: translateY(-2px); box-shadow: 0 0 0 4px rgba(239,147,71,.25), var(--shadow); outline: none; }
.feature-cover { position: relative; aspect-ratio: 1200 / 630; background: var(--slate) center/cover no-repeat; }
.feature-badge {
  position: absolute; top: 12px; left: 12px; font-family: var(--display); font-size: 11px;
  background: var(--orange); color: var(--navy); padding: 5px 9px; border-radius: 4px; letter-spacing: .04em;
}
.feature-body { padding: 18px 20px 20px; display: flex; flex-direction: column; gap: 10px; }
.feature-title { font-family: var(--body); font-weight: 700; font-size: clamp(22px, 3.2vw, 30px); line-height: 1.15; margin: 0; color: var(--warm-white); }
.feature-changes { margin: 0; padding-left: 18px; color: var(--muted); font-size: 14px; line-height: 1.5; }
.feature-changes li::marker { color: var(--orange); }
.feature-cta { align-self: flex-start; margin-top: 4px; }
time.stamp { font-family: var(--display); font-size: 12px; color: var(--cream); letter-spacing: .02em; }

/* Sidebar cards */
.side-card { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 16px; }
.side-eyebrow { font-family: var(--display); font-size: 11px; color: var(--teal); text-transform: uppercase; margin: 0 0 10px; display: flex; align-items: center; gap: 8px; }
.side-loading { margin: 0; color: var(--muted); font-size: 14px; }
.side-foot { margin: 12px 0 0; color: var(--muted); font-size: 12px; line-height: 1.4; }
.big-stat { display: flex; align-items: baseline; gap: 10px; margin-bottom: 8px; }
.big-stat strong { font-family: var(--display); font-size: 44px; line-height: 1; color: var(--orange); }
.big-stat span { color: var(--fg); font-size: 15px; line-height: 1.3; }
.side-row { display: flex; justify-content: space-between; gap: 10px; padding: 6px 0; border-top: 1px solid var(--line); font-size: 14px; }
.side-row span { color: var(--muted); }
.side-row b { color: var(--fg); text-align: right; }

.bars { display: flex; align-items: flex-end; gap: 8px; height: 92px; margin: 12px 0 4px; padding-top: 14px; }
.bar { flex: 1; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; position: relative; }
.bar span { width: 100%; background: linear-gradient(var(--orange), #c7702f); border-radius: 3px 3px 0 0; }
.bar em { position: absolute; top: -2px; font-style: normal; font-size: 11px; color: var(--cream); font-family: var(--display); }
.bar small { font-size: 10px; color: var(--muted); margin-top: 4px; white-space: nowrap; }

.timeline { list-style: none; margin: 12px 0 0; padding: 0 0 0 14px; border-left: 2px solid var(--teal); display: flex; flex-direction: column; gap: 10px; }
.timeline li { position: relative; display: grid; grid-template-columns: 64px 1fr; column-gap: 8px; font-size: 13px; }
.timeline li::before { content: ""; position: absolute; left: -20px; top: 4px; width: 10px; height: 10px; border-radius: 50%; background: var(--navy); border: 2px solid var(--orange); }
.tl-time { color: var(--muted); font-size: 11px; line-height: 1.3; grid-row: span 2; }
.tl-time b { display: block; color: var(--cream); font-family: var(--display); font-size: 11px; font-weight: 400; }
.tl-v { color: var(--orange); font-family: var(--display); font-size: 12px; }
.tl-note { color: var(--fg); line-height: 1.3; }

.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 8px; }
.stat-grid div { background: var(--surface-2); border-radius: 6px; padding: 10px; display: flex; flex-direction: column; gap: 2px; }
.stat-grid strong { font-family: var(--display); font-size: 22px; color: var(--cream); }
.stat-grid span { font-size: 12px; color: var(--muted); }
.mini-head { font-size: 12px; color: var(--muted); margin: 10px 0 4px; }
.mini-list { list-style: none; margin: 0; padding: 0; font-size: 14px; }
.mini-list li { display: flex; justify-content: space-between; padding: 3px 0; }
.mini-list b { color: var(--orange); }

.board { list-style: none; margin: 0 0 12px; padding: 0; font-size: 14px; }
.board li { display: grid; grid-template-columns: 22px 1fr auto 40px; gap: 8px; padding: 6px 0; border-top: 1px solid var(--line); align-items: center; }
.board li:first-child { border-top: 0; }
.board .rk { font-family: var(--display); font-size: 12px; color: var(--muted); }
.board li:nth-child(1) .rk { color: var(--orange); }
.board .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.board .sc { font-family: var(--display); font-size: 12px; color: var(--cream); }
.board .ag { color: var(--muted); font-size: 12px; text-align: right; }
.live-dot { font-size: 9px; color: var(--navy); background: var(--sage); padding: 2px 6px; border-radius: 3px; }
.side-play { width: 100%; justify-content: center; text-align: center; }
.home-side .follow { margin: 0; }
.sn-ref.sn-art { font-family: var(--display); font-size: 9px; padding: 0 5px; width: auto; }

/* ===== Post pages v2 (Nov 3): sidebar, memo numbers, sort toggle, before/next cards ===== */
.wrap.post-grid { max-width: 1180px; display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 28px; align-items: start; }
#post-main { min-width: 0; }
.post-side { display: flex; flex-direction: column; gap: 16px; }
.post-side .follow { margin: 0; }
@media (max-width: 1000px) { .wrap.post-grid { grid-template-columns: 1fr; } }

/* Reading bar: the shared ms-bar (../assets/ui/ms-bar.css), docked right under the sticky header (top set by app.js) */
.read-progress.ms-bar { height: calc(var(--msbar-h) * 2); position: fixed; top: var(--hdr-h, 0px); left: 0; right: 0; z-index: 39; pointer-events: none;
  border-radius: 0; border-left: 0; border-right: 0; box-shadow: 0 1px 0 rgba(62,119,117,.9), 0 4px 10px rgba(0,0,0,.35); }

.memo-num { font-family: var(--display); font-size: 12px; color: var(--orange); letter-spacing: .04em; }
.memo-num i { font-style: normal; color: var(--muted); }
.post-meta time.stamp { font-size: 13px; }
.pill.new { background: var(--sage); color: var(--navy); }
.read-mark { font-family: var(--display); font-size: 10px; color: var(--sage); }
.card-cover { position: relative; }
.card-num { position: absolute; left: 8px; bottom: 8px; font-family: var(--display); font-size: 14px; color: var(--navy); background: var(--cream); padding: 3px 7px; border-radius: 4px; box-shadow: 2px 2px 0 var(--orange); }
.card.is-read .card-title { color: var(--muted); }

/* Sort toggle */
.list-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.sort-toggle { display: inline-flex; border: 1px solid var(--teal); border-radius: 6px; overflow: hidden; }
.sort-toggle button { font-family: var(--display); font-size: 10px; letter-spacing: .03em; background: transparent; color: var(--cream); border: 0; padding: 8px 10px; cursor: pointer; min-height: 34px; }
.sort-toggle button + button { border-left: 1px solid var(--teal); }
.sort-toggle button[aria-pressed="true"] { background: var(--orange); color: var(--navy); }
.sort-toggle button:focus-visible { outline: 2px solid var(--orange); outline-offset: -2px; }
.sort-hint { margin: -4px 0 0; font-size: 14px; color: var(--muted); }
.sort-hint b { color: var(--cream); font-weight: 700; }
.read-count { color: var(--sage); }

/* Series list in the post sidebar */
#post-series .sort-toggle { width: 100%; margin-bottom: 12px; }
#post-series .sort-toggle button { flex: 1; }
.series-progress { height: 6px; background: var(--surface-2); border-radius: 3px; overflow: hidden; }
.series-progress span { display: block; height: 100%; background: var(--sage); }
.series-count { font-size: 12px; color: var(--muted); margin: 6px 0 8px; }
.series { list-style: none; margin: 0; padding: 0; }
.series li a { display: grid; grid-template-columns: 28px 1fr 16px; gap: 8px; align-items: baseline; padding: 7px 6px; border-top: 1px solid var(--line); text-decoration: none; color: var(--fg); font-size: 14px; line-height: 1.3; border-radius: 4px; }
.series li:first-child a { border-top: 0; }
.series li a:hover { background: var(--surface-2); color: var(--orange); }
.series .s-no { font-family: var(--display); font-size: 11px; color: var(--muted); }
.series .s-mark { color: var(--sage); font-size: 12px; }
.series li.read a { color: var(--muted); }
.series li.here a { background: rgba(239,147,71,.12); box-shadow: inset 3px 0 0 var(--orange); color: var(--warm-white); }
.series li.here .s-no { color: var(--orange); }
.series .s-title em { display: block; font-style: normal; font-family: var(--display); font-size: 9px; color: var(--orange); margin-top: 3px; }

/* What happened before / What's next */
.sequel { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 28px; align-items: start; }
.sequel-card { display: flex; flex-direction: column; gap: 8px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 14px; text-decoration: none; color: inherit; transition: border-color .15s, transform .15s; }
a.sequel-card:hover, a.sequel-card:focus-visible { border-color: var(--orange); transform: translateY(-2px); outline: none; }
.sequel-card.next { border-color: var(--teal); }
.sequel-eyebrow { font-family: var(--display); font-size: 10px; color: var(--teal); letter-spacing: .03em; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.sequel-card.next .sequel-eyebrow { color: var(--orange); }
.sequel-cover { display: block; aspect-ratio: 1200 / 630; background: var(--slate) center/cover no-repeat; border-radius: 6px; }
.sequel-title { font-weight: 700; font-size: 17px; line-height: 1.3; color: var(--warm-white); }
.sequel-teaser { font-size: 14px; color: var(--muted); line-height: 1.45; }
.sequel-card.is-soon { background: repeating-linear-gradient(135deg, var(--surface) 0 14px, var(--surface-2) 14px 28px); border-style: dashed; }
.sequel-card.is-start .btn { align-self: flex-start; }
.sequel-card .todos { display: flex; flex-wrap: wrap; gap: 8px; }
.sequel-card .todo { font-family: var(--display); font-size: 10px; padding: 6px 10px; border: 1px dashed var(--muted-blue); color: var(--cream); border-radius: 4px; text-decoration: none; }
.sequel-card .todo:hover { border-color: var(--orange); color: var(--orange); }
@media (max-width: 640px) { .sequel { grid-template-columns: 1fr; } }
@media (prefers-reduced-motion: reduce) { .read-progress span, a.sequel-card { transition: none; } }

/* ===== Memo list intro (Nov 3): a real header for "Start here" / "Latest memo" ===== */
.list-intro { padding: 6px 0 14px; margin-bottom: 6px; border-bottom: 1px dashed var(--muted-blue); }
.list-intro-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.list-intro-eyebrow { font-family: var(--display); font-size: 11px; color: var(--navy); background: var(--sage); padding: 4px 9px; border-radius: 4px; letter-spacing: .05em; text-transform: uppercase; }
.list-intro-title { font-family: var(--body); font-weight: 700; font-size: clamp(26px, 4vw, 38px); line-height: 1.1; margin: 0 0 8px; color: var(--warm-white); }
.list-intro-sub { margin: 0 0 12px; max-width: 62ch; font-size: 16px; line-height: 1.5; color: var(--cream); }
.list-intro-meta { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 13px; color: var(--muted); }
.list-intro-meta span + span::before { content: "·"; margin-right: 18px; margin-left: -12px; color: var(--muted-blue); }
.list-intro-meta b { color: var(--cream); }
.home-main { gap: 20px; }

/* ===== Page background (Nov 3): screened key art + pixel texture + soft color glows ===== */
body::before, body::after { content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none; }
body::before {
  background:
    linear-gradient(180deg, rgba(23,28,53,.55) 0%, rgba(23,28,53,.92) 55%, var(--navy) 100%),
    url("img/office-key-art-hero-960.jpg") center top / cover no-repeat;
  filter: saturate(.55) blur(1.5px);
  opacity: .32;
}
body::after {
  background:
    radial-gradient(60vw 50vh at 8% 0%, rgba(62,119,117,.22), transparent 70%),
    radial-gradient(55vw 45vh at 100% 100%, rgba(239,147,71,.12), transparent 70%),
    repeating-linear-gradient(0deg, rgba(255,240,207,.025) 0 1px, transparent 1px 4px),
    repeating-linear-gradient(90deg, rgba(255,240,207,.02) 0 1px, transparent 1px 4px);
}

/* Sort hint bubble (Nov 3): pops up pointing at the other reading order */
.sort-wrap { position: relative; display: inline-block; }
#post-series .sort-wrap { display: block; }
.sort-tip {
  position: absolute; top: calc(100% + 10px); z-index: 20; width: max-content; max-width: 240px;
  background: var(--warm-white); color: var(--navy); font-size: 13px; line-height: 1.35;
  padding: 8px 30px 8px 11px; border-radius: 8px; border: 2px solid var(--navy);
  box-shadow: 0 0 0 2px var(--orange), 0 10px 24px rgba(0,0,0,.45);
  opacity: 0; transform: translateY(-4px); pointer-events: none; transition: opacity .2s, transform .2s;
}
.sort-tip b { color: var(--russet); }
.sort-tip::before { content: ""; position: absolute; top: -9px; width: 14px; height: 14px; background: var(--warm-white);
  border-left: 2px solid var(--navy); border-top: 2px solid var(--navy); transform: rotate(45deg); }
.sort-tip.point-left { left: 0; } .sort-tip.point-left::before { left: 22%; }
.sort-tip.point-right { right: 0; } .sort-tip.point-right::before { right: 22%; }
.sort-tip-x { position: absolute; top: 3px; right: 5px; border: 0; background: none; font-size: 16px; line-height: 1; color: var(--slate); cursor: pointer; padding: 2px 4px; }
.sort-tip-x:hover { color: var(--tie); }
.sort-wrap.tip-show .sort-tip { opacity: 1; transform: none; pointer-events: auto; }
@media (hover: hover) { .sort-wrap:not(.tip-off):hover .sort-tip { opacity: 1; transform: none; pointer-events: auto; } }
@media (prefers-reduced-motion: reduce) { .sort-tip { transition: none; } }

/* Your employee file + memo-finished toast (Nov 3) */
.your-file { border-color: var(--teal); background: linear-gradient(160deg, rgba(62,119,117,.16), var(--surface) 55%); }
.file-name { font-weight: 700; font-size: 20px; color: var(--warm-white); margin-bottom: 10px; line-height: 1.2; }
.file-name span { display: block; font-weight: 400; font-size: 12px; color: var(--muted); margin-top: 2px; }
.series-progress.goal span { background: linear-gradient(90deg, var(--sage), var(--orange)); }
.file-goal { margin: 8px 0 0; font-size: 13px; color: var(--fg); line-height: 1.4; }
.file-goal b { color: var(--orange); }
.read-toast { position: fixed; left: 50%; bottom: 20px; z-index: 70; transform: translate(-50%, 20px); opacity: 0;
  max-width: min(440px, calc(100vw - 32px)); background: var(--warm-white); color: var(--navy); font-size: 14px; line-height: 1.4;
  padding: 10px 14px; border-radius: 8px; border: 2px solid var(--navy); box-shadow: 0 0 0 2px var(--sage), 0 12px 28px rgba(0,0,0,.5);
  transition: opacity .25s, transform .25s; }
.read-toast.show { opacity: 1; transform: translate(-50%, 0); }
.read-toast b { color: var(--teal); } .read-toast em { font-style: normal; font-weight: 700; color: var(--russet); }
@media (prefers-reduced-motion: reduce) { .read-toast { transition: none; } }

/* Reading bar at the end of the page: a shine sweeps across, it flashes cream, and a label appears (Nov 3) */
.read-progress .rp-done { position: absolute; right: 14px; top: 50%; transform: translateY(-50%) scale(.6); opacity: 0; z-index: 2;
  font-family: var(--display); font-size: clamp(10px, calc(var(--msbar-h) * .9), 14px); letter-spacing: .06em; color: var(--navy);
  transition: opacity .25s, transform .25s cubic-bezier(.3,1.6,.5,1); }
.read-progress.done .rp-done { opacity: 1; transform: translateY(-50%) scale(1); }
.read-progress.done > .ms-fill { background: linear-gradient(90deg, var(--teal), var(--orange) 70%, var(--cream)); }
.read-progress > .ms-fill::before { content: ""; position: absolute; top: 0; bottom: 0; left: -30%; width: 30%; z-index: 1;
  background: linear-gradient(90deg, transparent, rgba(255,240,207,.85), transparent); opacity: 0; }
.read-progress.celebrate > .ms-fill::before { animation: rpShine .9s ease-out 2; }
.read-progress.celebrate > .ms-fill { animation: rpPop .45s ease-out 2; }
@keyframes rpShine { 0% { left: -30%; opacity: 1; } 100% { left: 110%; opacity: 1; } }
@keyframes rpPop { 40% { filter: brightness(1.5) saturate(1.3); } }
@media (prefers-reduced-motion: reduce) { .read-progress.celebrate > .ms-fill, .read-progress.celebrate > .ms-fill::before { animation: none; } }

/* Before/after swipe slider in posts (markdown image with title "compare: before | after") */
.ba-post { margin: 22px 0; }
.ba-post .ba { position: relative; overflow: hidden; border: 3px solid var(--navy); box-shadow: 0 0 0 2px var(--teal); background: var(--navy); touch-action: pan-y; user-select: none; }
article.post .prose .ba-post img { display: block; width: 100%; height: auto; margin: 0; border: 0; box-shadow: none; image-rendering: auto; }
.ba-post .ba-b { position: absolute; inset: 0; clip-path: inset(0 0 0 var(--cut, 50%)); }
.ba-post .ba-b img { height: 100% !important; object-fit: cover; }
.ba-post .ba-handle { position: absolute; top: 0; bottom: 0; left: var(--cut, 50%); width: 3px; margin-left: -1.5px; background: var(--cream); box-shadow: 0 0 0 1px var(--navy); pointer-events: none; }
.ba-post .ba-handle::after { content: "◀ ▶"; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); font: 11px var(--display); color: var(--navy); background: var(--cream); padding: 7px 9px; border-radius: 4px; white-space: nowrap; box-shadow: 0 2px 0 var(--navy); }
.ba-post .ba-lab { position: absolute; top: 10px; font: 10px var(--display); letter-spacing: .06em; padding: 3px 7px; border-radius: 3px; z-index: 2; pointer-events: none; }
.ba-post .ba-lab.l { left: 10px; background: var(--slate); color: var(--muted); }
.ba-post .ba-lab.r { right: 10px; background: var(--orange); color: var(--navy); }
.ba-post input[type=range] { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: ew-resize; z-index: 3; }
.ba-post .ba-cap { margin: 8px 2px 0; font-size: 14px; color: var(--muted); }

/* Share a memo (Nov 4): sits next to Play this build, and again after the sign-off */
.cta-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.btn-share { background: transparent; color: var(--cream); border-color: var(--teal); }
.btn-share:hover { border-color: var(--orange); color: var(--orange); }
.btn-share.copied { border-color: var(--sage); color: var(--sage); }
.share-end { margin-top: 14px; }
@media (pointer: coarse) { .cta-row .btn, .share-end .btn { min-height: 40px; } }

/* Nov 4: lighter memo layouts. Pictures stay modest, "side" pictures sit beside the text, sliders share one tabbed box. */
article.post .prose img { max-width: 100%; max-height: 70vh; width: auto; height: auto; }
article.post .prose img.zoomable { cursor: zoom-in; }
article.post .prose h2 { clear: both; }
article.post .prose .fig { margin: 18px auto; }
article.post .prose .fig img { margin: 0 auto; }
article.post .prose .fig.small img { max-width: min(100%, 440px); }
article.post .prose .fig.side img { max-width: 100%; }
article.post .prose .fig.side { width: 62%; }
@media (min-width: 760px) {
  article.post .prose .fig.side { float: right; clear: right; width: 40%; margin: 6px 0 14px 22px; }
}
/* Book covers (Nov 6): a small cover that sits beside the paragraph about the book, on phones too */
article.post .prose .fig.book { float: right; clear: right; width: 34%; max-width: 170px; margin: 4px 0 12px 16px; }
article.post .prose .fig.book img { width: 100%; border-radius: 4px; box-shadow: 4px 4px 0 rgba(0,0,0,.4); }
@media (min-width: 760px) { article.post .prose .fig.book { width: 22%; } }
.ba-tabs { margin: 22px 0; border: 2px solid var(--teal); border-radius: 6px; background: rgba(23,28,53,.5); padding: 10px 10px 4px; }
.ba-tabs .bt-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-bottom: 10px; }
.ba-tabs .bt-title { font: 10px var(--display); letter-spacing: .08em; color: var(--navy); background: var(--cream); padding: 4px 8px; border-radius: 2px; }
.ba-tabs .bt-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.ba-tabs .bt-chip { font: 10px var(--display); letter-spacing: .05em; color: var(--muted); background: var(--slate); border: 1px solid transparent; border-radius: 3px; padding: 6px 9px; cursor: pointer; }
.ba-tabs .bt-chip[aria-selected="true"] { color: var(--navy); background: var(--orange); }
.ba-tabs .ba-post { margin: 0 0 6px; }
.ba-tabs .ba-post[hidden] { display: none; }
/* Nov 16: card decks. One card at a time in the "Then and now" box, arrows under it, swipe on phones. */
.ba-tabs.deck .dk-card { margin: 0; }
.ba-tabs.deck .dk-card[hidden] { display: none; }
article.post .prose .ba-tabs.deck .dk-card img { width: 100%; max-height: none; margin: 0; display: block; border-radius: 4px; }
.ba-tabs.deck .dk-card figcaption { font: 15px/1.45 var(--body); color: var(--cream); margin: 10px 2px 0; }
.ba-tabs.deck .dk-nav { display: flex; align-items: center; justify-content: center; gap: 12px; margin: 10px 0 6px; }
.ba-tabs.deck .dk-nav button { width: 44px; height: 44px; font: 16px/1 var(--display); color: var(--cream); background: var(--slate); border: 0; border-radius: 4px; cursor: pointer; }
.ba-tabs.deck .dk-nav button:hover, .ba-tabs.deck .dk-nav button:focus-visible { background: var(--orange); color: var(--navy); }
.ba-tabs.deck .dk-count { font: 14px var(--display); color: var(--muted); min-width: 64px; text-align: center; }
.img-zoom { position: fixed; inset: 0; z-index: 1000; background: rgba(10,12,24,.92); display: flex; align-items: center; justify-content: center; padding: 16px; cursor: zoom-out; }
.img-zoom img { max-width: 100%; max-height: 100%; image-rendering: auto; border: 3px solid var(--navy); box-shadow: 0 0 0 2px var(--teal); }
.img-zoom button { position: absolute; top: 12px; right: 14px; font: 22px/1 var(--display); color: var(--cream); background: var(--slate); border: 0; border-radius: 4px; width: 40px; height: 40px; cursor: pointer; }
details.changes-box summary { list-style: none; cursor: pointer; display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
details.changes-box summary::-webkit-details-marker { display: none; }
details.changes-box summary h3 { margin: 0; }
details.changes-box .cb-more { font: 10px var(--display); letter-spacing: .05em; color: var(--orange); }
details.changes-box[open] .cb-more { display: none; }
details.changes-box ul { margin-top: 10px; }

/* Nov 4: screenshot galleries. Same-size tiles in a tidy grid, cropped from the top, tap for the full picture. */
article.post .prose .shot-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin: 22px 0; clear: both; }
@media (min-width: 760px) { article.post .prose .shot-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
article.post .prose .shot { margin: 0; }
article.post .prose .shot-frame { aspect-ratio: 4 / 5; overflow: hidden; border: 2px solid var(--teal); border-radius: 6px; background: var(--navy); }
article.post .prose .shot-frame img { width: 100%; height: 100%; max-height: none; object-fit: cover; object-position: top center; margin: 0; display: block; }
article.post .prose .shot figcaption { font: 10px var(--display); letter-spacing: .05em; color: var(--cream); text-align: center; margin-top: 6px; }
/* LEGACY tag on the sidebar leaderboard (Nov 4): runs from before V. 2.0, when Midlife ran to 80 */
.board .legacy { font: 8px Silkscreen, monospace; color: var(--navy, #171C35); background: #D3B78D; padding: 1px 3px; border-radius: 3px; margin-left: 4px; vertical-align: middle; }

/* Audio cards (Nov 6): play a game track or sound right in the memo. Same cream-and-teal look as the code cards. */
.audio-card { display: flex; align-items: center; gap: 14px; margin: 18px 0 22px; padding: 12px 16px; background: var(--cream); color: var(--navy); border: 2px solid var(--teal); border-radius: 12px; box-shadow: 4px 4px 0 rgba(0,0,0,.35); }
.audio-card .ac-play { flex: none; width: 46px; height: 46px; border: 0; border-radius: 10px; background: var(--navy); color: var(--cream); font: 16px/1 "Silkscreen", monospace; cursor: pointer; display: grid; place-items: center; }
.audio-card .ac-play:hover, .audio-card.playing .ac-play { background: var(--orange); color: var(--navy); }
.audio-card .ac-play:focus-visible, .audio-card .ac-bar:focus-visible { outline: 2px solid var(--orange); outline-offset: 2px; }
.audio-card .ac-meta { flex: 1; min-width: 0; display: grid; gap: 6px; }
.audio-card .ac-title { font: 13px/1.3 "Silkscreen", monospace; letter-spacing: .5px; }
.audio-card .ac-bar { position: relative; height: 10px; background: rgba(23,28,53,.18); border-radius: 5px; cursor: pointer; overflow: hidden; }
.audio-card .ac-fill { position: absolute; inset: 0 auto 0 0; width: 0; background: var(--teal); }
.audio-card.playing .ac-fill { background: var(--orange); }
.audio-card .ac-time { font: 12px/1 ui-monospace, Menlo, monospace; opacity: .75; }

/* What changed + Next up (Nov 6): first card in the right column on wide screens; below the memo on phones and share pages */
.post-facts { display: flex; flex-direction: column; gap: 12px; padding: 14px; }
.post-facts[hidden] { display: none; }
.post-facts .changes-box { padding: 0; border: 0; background: none; }
.post-facts .changes-box li { font-size: 14px; }
.post-facts .next-up { font-size: 14px; }
.post-facts-end { margin: 26px 0 8px; padding: 0; }
.post-facts-end .changes-box { padding: 14px 16px; border: 1px solid var(--teal); background: var(--surface-2); }

/* Drop cap (Nov 6): every memo opens with a big pixel-font initial with a hard shadow */
article.post .prose .dropcap {
  float: left; font-family: "VT323", var(--display); font-weight: 400; font-size: 5.6em; line-height: .68;
  margin: .06em .1em 0 0; color: var(--orange); text-shadow: 4px 4px 0 rgba(255,240,207,.28);
}

/* A small pixel portrait inside a sidenote (Nov 6), e.g. Ben's mugshot */
.sn img.sn-mug { display: block; width: 96px !important; height: 96px !important; max-width: none; margin: 2px 0 8px; image-rendering: pixelated; border-radius: 6px; }
/* The Midlife Survivors playlist (Apple Music) in the side column */
/* The player runs edge to edge in its card (the card's padding would squeeze Apple's layout into a sideways scroll) */
/* Apple's player draws its own rounded dark box, and the corners outside it come through white,
   so the iframe is clipped to the same rounded shape (clip-path works on iframes, border-radius alone doesn't). */
.side-card.playlist { padding-bottom: 8px; overflow: hidden; }
.side-card.playlist iframe { display: block; width: calc(100% + 16px); margin: 0 -8px; height: 450px; border: 0; background: transparent; color-scheme: dark; border-radius: 14px; clip-path: inset(1px round 14px); }
.side-card.playlist p { margin: 0 0 10px; font-size: 14px; color: var(--muted); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
/* Desktop social buttons beside Share (Nov 6). Hidden on touch screens, which get the share sheet instead. */
.share-links { display: none; }
@media (hover: hover) and (pointer: fine) {
  .share-links { display: inline-flex; flex-wrap: wrap; gap: 6px; vertical-align: middle; margin-left: 6px; }
  .share-links .btn-social { padding: 6px 10px; font: 11px/1.2 var(--display); border: 1px solid var(--line, rgba(255,255,255,.2)); border-radius: 6px; color: var(--cream); background: transparent; text-decoration: none; }
  .share-links .btn-social:hover, .share-links .btn-social:focus-visible { border-color: var(--orange); color: var(--orange); }
}

/* Apple Music song players inside a memo (Memo 13) */
.song-embed { margin: 4px 0 26px; max-width: 660px; }
.song-embed iframe { display: block; width: 100%; height: 175px; }
.video-embed { position: relative; max-width: 660px; aspect-ratio: 16 / 9; margin: 4px 0 26px; border-radius: 10px; overflow: hidden; background: #000; }
.video-embed iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

/* Memo side column (Nov 7, Rami): every card stays, but sits dim so the memo leads.
   Mouse over a card (or tab into it) and it lights up. Touch screens skip this: no hover there. */
@media (hover: hover) and (pointer: fine) {
  .post-side .side-card { opacity: .42; filter: saturate(.6); transition: opacity .25s ease, filter .25s ease; }
  .post-side .side-card:hover, .post-side .side-card:focus-within { opacity: 1; filter: none; }
}
@media (hover: hover) and (pointer: fine) and (prefers-reduced-motion: reduce) {
  .post-side .side-card { transition: none; }
}

/* ===== Memo page redesign (Nov 7, Rami + Darvin's notes) ===== */
/* 1. The hero: key art across both columns, headline on the art. */
.memo-top { max-width: 1180px; margin: 0 auto; padding: 28px 16px 0; }
.memo-hero {
  position: relative; overflow: hidden; border-radius: 10px;
  border: 3px solid var(--navy); box-shadow: 0 0 0 2px var(--teal);
  background: var(--navy); aspect-ratio: 2 / 1; isolation: isolate;
}
.memo-hero.no-art { aspect-ratio: auto; min-height: 220px; }
.mh-art, .mh-art .lead-loop { position: absolute; inset: 0; }
.mh-art img, .mh-art video {
  width: 100%; height: 100%; object-fit: cover; object-position: var(--focus, 50% 45%);
  display: block; image-rendering: pixelated; transform-origin: var(--focus, 50% 45%);
  animation: mh-drift 28s ease-in-out infinite alternate;
}
@keyframes mh-drift { from { transform: scale(1.02); } to { transform: scale(1.09) translate(-1%, -1%); } }
/* Scrim: a navy fade from the bottom so the headline always reads, plus faint scanlines for the pixel look. */
.memo-hero::before {
  content: ""; position: absolute; inset: 0; z-index: 1; pointer-events: none;
  background:
    linear-gradient(to top, rgba(23,28,53,.96) 0%, rgba(23,28,53,.78) 22%, rgba(23,28,53,.25) 48%, rgba(23,28,53,0) 64%),
    repeating-linear-gradient(to bottom, rgba(23,28,53,.10) 0 1px, transparent 1px 4px);
}
.mh-text { position: absolute; left: 0; right: 0; bottom: 0; z-index: 2; padding: 0 40px 30px; max-width: 900px; }
.mh-stamp {
  display: inline-block; background: var(--cream); color: var(--navy);
  font: 12px/1 var(--display); padding: 7px 10px 6px; border-left: 4px solid var(--orange); margin-bottom: 14px;
  animation: mh-in .5s ease-out both;
}
.memo-hero h1 {
  font-family: var(--body); font-weight: 700; margin: 0 0 14px; color: var(--warm-white);
  font-size: clamp(32px, 4.4vw, 56px); line-height: 1.06; letter-spacing: -.01em; text-wrap: balance;
  text-shadow: 3px 3px 0 var(--navy), 0 2px 24px rgba(0,0,0,.55);
  animation: mh-in .7s .08s ease-out both;
}
.memo-hero .post-meta { margin: 0; color: var(--cream); animation: mh-in .7s .16s ease-out both; }
@keyframes mh-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.mh-under { display: flex; flex-wrap: wrap; gap: 12px 24px; align-items: flex-start; justify-content: space-between; margin: 12px 0 0; }
.mh-cap { margin: 0; flex: 1 1 420px; font-size: 13px; line-height: 1.5; color: var(--muted); max-width: 72ch; }
.mh-under .cta-row { display: flex; gap: 10px; flex-wrap: wrap; }
@media (prefers-reduced-motion: reduce) {
  .mh-art img, .mh-art video, .mh-stamp, .memo-hero h1, .memo-hero .post-meta { animation: none; }
}
/* Phones: the art keeps its own shape and the headline sits just under it, so faces stay visible. */
@media (max-width: 719px) {
  .memo-hero { aspect-ratio: auto; overflow: visible; border-radius: 8px; }
  .mh-art { position: relative; inset: auto; aspect-ratio: 3 / 2; overflow: hidden; border-radius: 6px 6px 0 0; }
  .memo-hero::before { display: none; }
  .mh-text { position: relative; padding: 0 16px 18px; }
  .mh-stamp { margin-top: -14px; position: relative; }
  .memo-hero h1 { font-size: clamp(28px, 8vw, 36px); text-shadow: none; }
}

/* 2. The two columns start at the same line, with room to breathe below the hero. */
#post-view .wrap.post-grid { padding-top: 32px; }
#post-view #post-main > article.post:first-child { margin-top: 0; }

/* 3. Reading type: shorter lines, bigger text, clear section breaks. */
article.post { padding: 40px 48px 36px; }
article.post .prose { font-size: 19px; line-height: 1.75; }
article.post .prose > p, article.post .prose > ul, article.post .prose > ol,
article.post .prose > blockquote, article.post .prose > h2, article.post .prose > h3 { max-width: 62ch; }
article.post .prose > p:first-of-type { font-size: 22px; line-height: 1.6; color: var(--warm-white); }
article.post .prose p { margin: 0 0 1.25em; }
article.post .prose h2 {
  font-size: 30px; line-height: 1.2; letter-spacing: -.01em; color: var(--warm-white);
  margin: 64px 0 18px; text-wrap: balance;
}
article.post .prose h2::before {
  content: ""; display: block; width: 56px; height: 5px; background: var(--orange); margin-bottom: 18px;
}
article.post .prose h3 { font-size: 22px; color: var(--cream); margin: 40px 0 10px; }
article.post .prose strong { color: var(--cream); }
article.post .prose li { margin: 6px 0; }
article.post .prose .sn-ref { opacity: .7; }
article.post .prose .sn-ref:hover, article.post .prose .sn-ref[aria-expanded="true"] { opacity: 1; }
@media (max-width: 719px) {
  article.post { padding: 26px 18px 24px; }
  article.post .prose { font-size: 18px; line-height: 1.7; }
  article.post .prose > p:first-of-type { font-size: 20px; }
  article.post .prose h2 { font-size: 25px; margin-top: 48px; }
}

/* 4. Media cards (Nov 7, Rami): song players and videos sit centered in a small card of their own,
   a shade darker than the memo, with a tiny label. Any .song-embed or .video-embed gets this. */
article.post .prose .song-embed, article.post .prose .video-embed {
  position: relative; box-sizing: border-box; max-width: 640px; margin: 30px auto 38px; padding: 34px 14px 14px;
  background: rgba(10, 13, 28, .55); border: 1px solid var(--line); border-radius: 12px;
  box-shadow: inset 0 0 0 1px rgba(255,240,207,.04), 0 10px 28px rgba(0,0,0,.28);
  aspect-ratio: auto; overflow: visible;
}
article.post .prose .song-embed::before, article.post .prose .video-embed::before {
  position: absolute; top: 11px; left: 14px; font: 10px/1 var(--display); letter-spacing: .06em; color: var(--sage);
}
article.post .prose .song-embed::before { content: "♪ LISTEN"; }
article.post .prose .video-embed::before { content: "▶ WATCH"; }
article.post .prose .video-embed.explore::before { content: "◆ EXPLORE"; }  /* interactive 3D viewer (Memo 14) */
article.post .prose .song-embed iframe { display: block; width: 100%; height: 175px; border-radius: 8px; }
article.post .prose .video-embed iframe { position: static; display: block; width: 100%; height: auto; aspect-ratio: 16 / 9; border: 0; border-radius: 8px; }
@media (max-width: 719px) {
  article.post .prose .song-embed, article.post .prose .video-embed { margin: 24px -6px 30px; padding: 30px 10px 10px; }
}
.mh-under + article.post { margin-top: 28px; }

/* 5. Depth (Nov 7, Rami): the memo sits raised, the side column sits recessed beneath it. Two-column screens only. */
@media (min-width: 1001px) {
  #post-view .wrap.post-grid { gap: 18px; }
  #post-view article.post {
    position: relative; z-index: 1;
    border-color: rgba(255,240,207,.10);
    box-shadow: inset 0 1px 0 rgba(255,240,207,.07), 0 1px 0 rgba(0,0,0,.18), 0 16px 36px -10px rgba(0,0,0,.42), 0 4px 10px rgba(0,0,0,.18);
  }
  #post-view .post-side .side-card {
    background: rgba(12,15,32,.72);
    border-color: rgba(0,0,0,.35);
    box-shadow: inset 0 2px 10px rgba(0,0,0,.45), inset 0 -1px 0 rgba(255,240,207,.04);
  }
}

/* Instagram reel embed (Nov 11, Memo 14): a tall card, narrower than the 16:9 video card. */
article.post .prose .video-embed.reel { max-width: 420px; }
article.post .prose .video-embed.reel iframe { aspect-ratio: 9 / 16; }

/* sideCard icon (Nov 11, Memo 14 Z9): the icon sits in an inventory slot, title and caption beside it */
.side-facts .sf-head { display: flex; align-items: center; gap: var(--ms-space-3, 12px); margin: 0 0 var(--ms-space-3, 12px); }
.side-facts .sf-head h3 { margin: 0 0 var(--ms-space-1, 4px); }
.side-facts .sf-tile { flex: none; display: grid; place-items: center; width: 80px; height: 80px;
  background: var(--ms-bg, #10142A); border: var(--ms-border-w, 2px) solid var(--ms-line, #526078);
  border-radius: var(--ms-radius-m, 4px); box-shadow: inset 0 0 0 var(--ms-border-w, 2px) var(--ms-surface, #171C35); }
.side-facts .sf-tile img { width: 64px; height: 64px; image-rendering: pixelated; }
.side-facts .sf-sub { display: block; font-size: 14px; color: var(--ms-text-quiet, #B8C0D4); }
