/* chiisanahibi — shared stylesheet
   Lifted from mockups/02-stardew/blog-v2.html + editor.html, kept 1:1 so
   the design guideline still applies. Edit here, not in the HTML. */

:root {
  --cream: #f4ead4;
  --cream-deep: #e8dcb8;
  --paper: #fbf5e3;
  --paper-warm: #f7eccd;
  --sage: #7d9263;
  --sage-deep: #4f6440;
  --copper: #c46a3a;
  --copper-deep: #8a4823;
  --wood: #8b5a30;
  --wood-deep: #5a3717;
  --wood-light: #c8a578;
  --ink: #2a2218;
  --ink-soft: #6b5a45;
  --gold: #d9a648;
  --line: rgba(90, 55, 23, 0.18);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: "Lora", Georgia, serif;
  color: var(--ink);
  background: var(--cream);
  background-image:
    radial-gradient(800px 500px at 100% 0%, rgba(217, 166, 72, 0.18) 0%, transparent 60%),
    radial-gradient(700px 500px at 0% 100%, rgba(125, 146, 99, 0.18) 0%, transparent 60%);
  background-attachment: fixed;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
body::before {
  content: ""; position: fixed; inset: 0;
  background-image: radial-gradient(rgba(90, 55, 23, 0.10) 1px, transparent 1.5px);
  background-size: 18px 18px;
  pointer-events: none; opacity: 0.6;
  z-index: 0;
}

/* ───── Skip link (visible on keyboard focus) ───── */
.skip-link {
  position: fixed; top: 8px; left: 8px; z-index: 1000;
  background: var(--gold); color: var(--wood-deep);
  border: 2px solid var(--wood-deep);
  box-shadow: 2px 2px 0 var(--wood-deep);
  font-family: "Press Start 2P", monospace; font-size: 10px;
  padding: 9px 12px; letter-spacing: 0.12em; text-transform: uppercase;
  text-decoration: none;
  transform: translateY(-200%);
  transition: transform .12s ease;
}
.skip-link:focus { transform: translateY(0); }

/* ───── Global focus-visible — gold ring, matches the active state ───── */
:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
  border-radius: 1px;
}
/* Buttons that already share a wooden-frame look get a tighter gold halo
   so the ring stays within their bevel. */
.pill:focus-visible,
.pixbtn:focus-visible,
.chip:focus-visible,
.po-cell:focus-visible,
.topbar nav .search-btn:focus-visible,
.topbar nav .audio-btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px var(--gold), 2px 2px 0 var(--wood-deep);
}
.topbar nav a:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 3px;
}

/* ───── WOODEN TOP BAR ───── */
.topbar {
  position: sticky; top: 0; z-index: 30;
  background:
    repeating-linear-gradient(90deg, rgba(0, 0, 0, 0.04) 0 2px, transparent 2px 6px),
    linear-gradient(180deg, #9b6a3e 0%, #7a4d27 50%, #6a3f1d 100%);
  color: #fff3d9;
  padding: 14px 28px 16px;
  box-shadow: 0 4px 0 #4d2c15, 0 8px 22px rgba(0, 0, 0, 0.18);
  display: flex; justify-content: space-between; align-items: center;
}
.topbar::after {
  content: ""; position: absolute; left: 14px; right: 14px; top: 8px; height: 6px;
  background: radial-gradient(circle at 6px 3px, #4d2c15 2px, transparent 3px) 0 0/40px 6px;
}
.topbar::before {
  content: ""; position: absolute; left: 14px; right: 14px; bottom: 6px; height: 6px;
  background: radial-gradient(circle at 6px 3px, #4d2c15 2px, transparent 3px) 0 0/40px 6px;
}
.crest { display: flex; align-items: center; gap: 14px; }
.crest .badge {
  width: 42px; height: 42px;
  background: var(--gold);
  box-shadow:
    inset -3px -3px 0 #a87b1d,
    inset 3px 3px 0 #f3cd6e,
    0 0 0 3px #4d2c15;
  display: inline-flex; align-items: center; justify-content: center;
  color: #5a3717;
}
/* Glyph drawn as SVG so size + centering are fully under our control —
   Press Start 2P is Latin-only, so a unicode 日 was falling back to the
   system monospace font and looked inconsistent across OSes. */
.crest .badge .badge-glyph {
  width: 13px; height: 15px;
  display: block;
}
.crest h1 { font-family: "Klee One", serif; font-size: 22px; letter-spacing: 0.03em; }
.crest h1 small {
  display: block; font-family: "Press Start 2P", monospace;
  font-size: 9px; color: #f5d999; letter-spacing: 0.1em; margin-top: 4px;
}
.topbar nav { display: flex; gap: 22px; align-items: center; font-family: "Klee One", serif; font-size: 15px; }
.topbar nav a { color: #f5e7b7; text-decoration: none; padding: 4px 8px; border-bottom: 2px dashed transparent; }
.topbar nav a.active { color: #fff; border-color: var(--gold); }
.topbar nav a:hover { color: #fff; }

/* ───── MOBILE MENU BUTTON + DRAWER ─────
   Hidden by default; surfaced at ≤600px (see media-query block far below).
   The drawer reuses the wooden-frame motif so it feels like the rest of
   the journal rather than a generic hamburger sheet. */
.menu-btn {
  display: none;
  width: 38px; height: 38px;
  background: rgba(255,243,217,0.10);
  border: 2px solid rgba(255,243,217,0.30);
  cursor: pointer; padding: 0;
  align-items: center; justify-content: center;
  flex-direction: column; gap: 4px;
  transition: background .15s, border-color .15s;
}
.menu-btn:hover { background: rgba(217,166,72,0.35); border-color: var(--gold); }
.menu-btn .bar {
  width: 18px; height: 3px; background: #f5e7b7;
  transition: transform .2s ease, opacity .2s ease;
}
.menu-btn[aria-expanded="true"] .bar:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.menu-btn[aria-expanded="true"] .bar:nth-child(2) { opacity: 0; }
.menu-btn[aria-expanded="true"] .bar:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

.menu-drawer {
  position: fixed;
  top: 56px; left: 0; right: 0;
  z-index: 40;
  background: var(--paper);
  border-top: 3px solid var(--wood-deep);
  border-bottom: 3px solid var(--wood-deep);
  box-shadow:
    inset 0 3px 0 var(--cream),
    inset 0 -3px 0 var(--cream),
    0 12px 22px rgba(0,0,0,0.18);
  padding: 14px 14px 18px;
  transform: translateY(-110%);
  transition: transform .26s ease;
  pointer-events: none;
}
.menu-drawer.open { transform: translateY(0); pointer-events: auto; }
.menu-drawer .menu-head {
  text-align: center;
  font-family: "Press Start 2P", monospace; font-size: 8px;
  color: var(--copper-deep); letter-spacing: 0.18em;
  padding-bottom: 10px; border-bottom: 2px dotted var(--line);
  margin-bottom: 12px;
}
.menu-drawer .menu-list { display: flex; flex-direction: column; gap: 8px; }
.menu-drawer .menu-item {
  display: flex; align-items: center; gap: 14px;
  padding: 12px 14px;
  background: var(--cream);
  border: 2px solid var(--wood-deep);
  box-shadow: 3px 3px 0 var(--wood-deep);
  color: var(--ink);
  text-decoration: none;
  font-family: "Klee One", serif; font-size: 16px;
  min-height: 44px;
  text-align: left;
  cursor: pointer;
  transition: transform .08s, box-shadow .08s, background .15s;
}
.menu-drawer .menu-item:hover { background: var(--paper-warm); }
.menu-drawer .menu-item:active {
  transform: translate(1px,1px);
  box-shadow: 2px 2px 0 var(--wood-deep);
}
.menu-drawer .menu-item.active {
  background: var(--gold); color: var(--wood-deep);
}
.menu-drawer .menu-item .ic {
  flex: 0 0 28px;
  width: 28px; height: 28px;
  background: var(--paper);
  border: 2px solid var(--wood-deep);
  display: inline-flex; align-items: center; justify-content: center;
  font-family: "Press Start 2P", monospace; font-size: 11px;
  color: var(--copper-deep);
}
.menu-drawer .menu-item.active .ic { background: var(--cream); color: var(--wood-deep); }
.menu-drawer .menu-item .lbl {
  flex: 1; min-width: 0;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.menu-drawer .menu-item .chev {
  flex: 0 0 auto;
  font-family: "Press Start 2P", monospace; font-size: 9px;
  color: var(--ink-soft); letter-spacing: 0.12em;
}
.menu-drawer .menu-item.active .chev { color: var(--wood-deep); }
.menu-drawer .menu-sep {
  height: 0; border-top: 2px dotted var(--line); margin: 4px 4px;
}
.menu-drawer .menu-item.auth {
  background: var(--paper-warm);
  font-family: "Press Start 2P", monospace; font-size: 10px;
  letter-spacing: 0.14em; color: var(--copper-deep);
  justify-content: center; gap: 8px;
  text-transform: uppercase;
}
/* Sign-out is the less-flashy action (you only need it after you signed in) */
.menu-drawer .menu-item.auth[data-signed-in-only] {
  background: transparent;
  border-color: var(--line);
  color: var(--ink-soft);
  box-shadow: none;
}
.menu-drawer .menu-item.auth[data-signed-in-only]:hover {
  background: var(--cream);
  border-color: var(--copper-deep);
  color: var(--copper-deep);
}
.menu-backdrop {
  position: fixed; inset: 0;
  background: rgba(42,34,24,0.36);
  z-index: 35;
  opacity: 0; pointer-events: none;
  transition: opacity .2s ease;
}
.menu-backdrop.open { opacity: 1; pointer-events: auto; }

@media (min-width: 601px) {
  /* Drawer is a mobile-only affordance — belt + braces in case the JS
     forgets to hide it after a resize. */
  .menu-drawer, .menu-backdrop { display: none !important; }
}

/* ───── LAYOUT ───── */
.layout {
  display: grid;
  grid-template-columns: 1fr 120px;
  max-width: 1100px;
  margin: 0 auto;
  padding: 48px 28px 96px;
  gap: 36px;
  position: relative; z-index: 1;
}
/* Timeline is HIDDEN by default — blog.js adds `body.has-timeline` after the
   first page of posts loads, but only if there are enough entries to make
   the rail useful (>5). This means an empty/sparse feed never gets a flash
   of the rail showing then disappearing. */
.layout { grid-template-columns: 1fr; }
aside.timeline { display: none; }

body.has-timeline .layout { grid-template-columns: 1fr 120px; }
body.has-timeline aside.timeline { display: block; }

/* On narrow screens, the rail stays hidden no matter what. */
@media (max-width: 880px) {
  body.has-timeline .layout { grid-template-columns: 1fr; }
  body.has-timeline aside.timeline { display: none; }
}

/* ───── Empty state (no posts) ───── */
.empty-state[hidden] { display: none; }
.empty-state {
  text-align: center;
  padding: clamp(60px, 12vh, 120px) 24px;
  font-family: "Klee One", serif;
  color: var(--ink-soft);
}
.empty-state .es-stars {
  font-family: "Press Start 2P", monospace;
  font-size: 11px; letter-spacing: 0.5em;
  color: var(--copper-deep); opacity: 0.55;
  margin-bottom: 22px;
}
.empty-state .es-msg {
  font-family: "DM Serif Display", serif;
  font-size: clamp(24px, 5vw, 36px);
  color: var(--copper-deep);
  margin: 0 0 10px;
}
.empty-state .es-sub {
  font-style: italic; font-size: 15px;
  margin: 0 0 18px;
}
.empty-state .es-cta[hidden] { display: none; }
.empty-state .es-cta {
  display: inline-block;
  font-family: "Press Start 2P", monospace; font-size: 9px;
  letter-spacing: 0.14em; text-decoration: none;
  padding: 11px 16px;
  background: var(--gold); color: var(--wood-deep);
  border: 2px solid #4d2c15;
  box-shadow: 3px 3px 0 #4d2c15;
  text-transform: uppercase;
  transition: transform .08s ease;
}
.empty-state .es-cta:hover { transform: translate(-1px, -1px); box-shadow: 4px 4px 0 #4d2c15; }

/* ───── FEED ───── */
.feed { display: flex; flex-direction: column; gap: 64px; min-width: 0; }

article.post {
  background: var(--paper);
  border: 3px solid var(--wood-deep);
  box-shadow: inset 0 0 0 3px var(--cream), 5px 5px 0 var(--wood-deep);
  padding: 30px clamp(20px, 4vw, 44px) 40px;
  scroll-margin-top: 110px;
}
article.post header { margin-bottom: 18px; padding-bottom: 16px; border-bottom: 2px dotted var(--line); position: relative; }
article.post .day-stamp {
  font-family: "Press Start 2P", monospace; font-size: 9px;
  color: var(--copper-deep); letter-spacing: 0.16em;
  display: inline-block; margin-bottom: 10px;
}
article.post h2 {
  font-family: "DM Serif Display", serif; font-weight: 400;
  font-size: clamp(28px, 3.6vw, 42px); line-height: 1.15;
  letter-spacing: -0.005em;
}
article.post .byline {
  display: flex; align-items: center; gap: 10px;
  margin-top: 14px; font-family: "Klee One", serif;
  font-size: 13px; color: var(--ink-soft);
}
article.post .byline .avi {
  width: 24px; height: 24px; background: var(--gold);
  color: var(--wood-deep);
  font-family: "Press Start 2P", monospace; font-size: 10px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 2px solid var(--wood-deep);
}
article.post > header .edit-link {
  position: absolute; top: 0; right: 0;
  font-family: "Press Start 2P", monospace; font-size: 9px;
  letter-spacing: 0.12em; color: var(--ink-soft);
  text-decoration: none; padding: 6px 10px;
  background: transparent;
  border: 1.5px solid var(--line);
  transition: color .15s, border-color .15s, background .15s;
}
article.post > header .edit-link:hover {
  color: var(--copper-deep); border-color: var(--copper-deep); background: var(--cream);
}

/* cover image — wooden frame */
.cover-frame {
  margin: 22px 0 24px;
  border: 3px solid var(--wood-deep);
  box-shadow: inset 0 0 0 3px var(--cream);
  background: var(--cream-deep);
  position: relative;
  overflow: hidden;
}
.cover-frame .img {
  aspect-ratio: 16/10;
  background-size: cover; background-position: center;
  background-color: var(--cream-deep);
  transition: opacity .5s ease;
}
.cover-frame .img.lazy {
  background-image: none !important;
  opacity: 0.6;
  background:
    repeating-linear-gradient(45deg, rgba(90, 55, 23, 0.06) 0 10px, transparent 10px 20px),
    var(--cream-deep);
}
.cover-frame .img.lazy::after {
  content: "loading…";
  display: flex; align-items: center; justify-content: center; height: 100%;
  font-family: "Press Start 2P", monospace; font-size: 9px;
  color: var(--ink-soft); letter-spacing: 0.18em;
}

/* prose */
.prose { font-size: 16.5px; line-height: 1.95; color: #2d271d; }
.prose p { margin-bottom: 20px; }
.prose p .first {
  font-family: "DM Serif Display", serif; float: left;
  font-size: 50px; line-height: 0.85;
  margin: 4px 12px 0 0; color: var(--copper-deep);
}
.prose .pull {
  font-family: "Klee One", serif; font-size: 20px;
  color: var(--sage-deep); border-left: 4px solid var(--gold);
  padding: 4px 0 4px 16px; margin: 26px 0;
}

/* Inline links inside the body — copper-deep with a hand-drawn dotted
   underline, gold tint on hover. Applies to both the reading view's
   `.prose` and the contenteditable editor body. */
article.post .prose a,
.body-editor a {
  color: var(--copper-deep);
  text-decoration: none;
  border-bottom: 1.5px dotted var(--copper);
  padding-bottom: 1px;
  transition: color .15s, border-color .15s, background .15s;
}
article.post .prose a:hover,
.body-editor a:hover {
  color: var(--wood-deep);
  border-color: var(--gold);
  background: rgba(217, 166, 72, 0.10);
}

/* Google Maps embed — responsive 16:9 with the same wooden-frame chrome
   the rest of the body media uses. */
.map-embed {
  position: relative;
  margin: 24px 0;
  aspect-ratio: 16 / 9;
  border: 3px solid var(--wood-deep);
  box-shadow: inset 0 0 0 3px var(--cream);
  background: var(--cream-deep);
}
.map-embed iframe {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  border: 0;
  display: block;
}

/* inline image group */
.image-group { margin: 24px 0; position: relative; }
.image-group .strip {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px;
}
/* Photo cells get the wooden frame; the .bt-thumbs wrapper does NOT
   (otherwise we'd render a big square box around the whole thumb area). */
.image-group .strip > [data-src] {
  aspect-ratio: 1/1;
  background-size: cover; background-position: center;
  background-color: var(--cream-deep);
  border: 3px solid var(--wood-deep);
  box-shadow: inset 0 0 0 2px var(--cream);
  position: relative;
}
/* Play badge on any cell that wraps a video (poster + data-video). */
.image-group [data-video]::after {
  content: "▶";
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: clamp(14px, 30%, 28px);
  color: #fff; text-shadow: 0 1px 4px rgba(0,0,0,0.6);
  pointer-events: none;
}
.image-group [data-video] { position: relative; }
/* When a cell hosts an inline <video> (single/stacked layouts), the native
   controls take over — hide the play badge so it doesn't sit on top, drop
   the cell's own background color, and let the video fill the frame. */
.image-group [data-video].has-inline-video::after { display: none; }
.image-group [data-video].has-inline-video {
  background-image: none;
  background-color: #000;
  /* Inline video doesn't constrain to 1:1 — let it choose its own height
     based on the surrounding strip's aspect rules. */
}
.image-group [data-video].has-inline-video > video {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: contain;
  background: #000;
  display: block;
}
/* The BIG+THUMB hero mirror inherits the play badge too when it's showing a video. */
.image-group[data-layout="big-thumb"] .strip > .bt-big.is-video::after {
  content: "▶";
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 64px;
  color: #fff; text-shadow: 0 2px 6px rgba(0,0,0,0.5);
  pointer-events: none;
}
.image-group[data-layout="big-thumb"] .strip > .bt-big { position: relative; }
/* default (no data-layout) collapses to fewer columns when there are 1 or 2 */
.image-group:not([data-layout]) .strip:has(> div:nth-child(2):last-child) { grid-template-columns: repeat(2, 1fr); }
.image-group:not([data-layout]) .strip:has(> div:only-child) { grid-template-columns: 1fr; }
.image-group:not([data-layout]) .strip:has(> div:only-child) > div { aspect-ratio: 4 / 5; }

/* SINGLE — first photo full width, rest stacked tall */
.image-group[data-layout="single"] .strip { display: block; }
.image-group[data-layout="single"] .strip > div {
  width: 100%; aspect-ratio: 4 / 5; margin-bottom: 6px;
}
.image-group[data-layout="single"] .strip > div:last-child { margin-bottom: 0; }

/* STACKED — every photo full width, 3:2 letterbox */
.image-group[data-layout="stacked"] .strip {
  display: flex; flex-direction: column; gap: 8px;
}
.image-group[data-layout="stacked"] .strip > div {
  width: 100%; aspect-ratio: 3 / 2;
}

/* GALLERY — 3-up grid; click-to-open via modal (in blog.js) */
.image-group[data-layout="gallery"] .strip {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px;
}
.image-group[data-layout="gallery"] .strip > div {
  aspect-ratio: 1 / 1; cursor: zoom-in;
}

/* BIG + THUMB
   Render-time structure (editor + blog inject this; saved HTML stays flat):
       .strip
         .bt-big        ← mirror of currently selected thumb (visual only)
         .bt-thumbs     ← every cell, including the selected one
           [data-src]
           [data-src].selected
           …
   Outer grid is `1fr auto` so the thumbnail rail takes only as much width
   as it needs (cols * 30px + gaps); the big photo absorbs the rest. With
   fewer photos the rail is narrow and the big is wider — exactly what we
   want.
   Thumbs use flex column-wrap with explicit height (matches big's height),
   so they fill column-first: top-to-bottom, then start a new column on the
   right when the current one is full. */
.image-group[data-layout="big-thumb"] .strip {
  display: grid;
  /* `auto auto` + `justify-content: start` so the big and the thumb rail
     each take their own intrinsic width and sit left-aligned. (`1fr auto`
     made column 1 absorb all leftover space, pushing thumbs to the far
     right whenever the big was capped by max-height.) */
  grid-template-columns: auto auto;
  justify-content: start;
  gap: 10px;
  align-items: stretch;
}
.image-group[data-layout="big-thumb"] .strip > .bt-big {
  /* Intrinsic width 64vh (aspect 4:5 → 80vh tall = the requested cap).
     max-width: 100% prevents overflow on narrow articles. */
  width: 64vh;
  max-width: 100%;
  aspect-ratio: 4 / 5;
  background-size: cover; background-position: center;
  background-color: var(--cream-deep);
  border: 3px solid var(--wood-deep);
  box-shadow: inset 0 0 0 2px var(--cream);
  cursor: zoom-in;
}
.image-group[data-layout="big-thumb"] .strip > .bt-thumbs {
  display: flex;
  flex-direction: column;
  flex-wrap: wrap;
  align-content: flex-start;
  gap: 4px;
  /* Stretch to the row height (set by the big photo's 4:5 aspect) so flex
     wrap knows when to break to a new column. */
  align-self: stretch;
}
.image-group[data-layout="big-thumb"] .strip > .bt-thumbs > [data-src] {
  flex: 0 0 auto;
  width: 30px; height: 30px;
  background-size: cover; background-position: center;
  background-color: var(--cream-deep);
  border: 2px solid var(--wood-deep);
  box-shadow: inset 0 0 0 1px var(--cream);
  cursor: pointer;
  /* Override the global .strip > [data-src] aspect-ratio so width/height win. */
  aspect-ratio: auto;
}
.image-group[data-layout="big-thumb"] .strip > .bt-thumbs > [data-src].selected {
  box-shadow: inset 0 0 0 1px var(--cream), 0 0 0 2px var(--gold);
}
/* Single-photo group → no thumb rail, just the big. */
.image-group[data-layout="big-thumb"] .strip:not(:has(> .bt-thumbs)) {
  grid-template-columns: 1fr;
}

/* Cursor reflects what each layout's click does (see blog.js click handler). */
.image-group .strip [data-src] { cursor: default; }
.image-group[data-layout="gallery"]   .strip [data-src] { cursor: zoom-in; }
.image-group[data-layout="big-thumb"] .strip .bt-thumbs > [data-src] { cursor: pointer; }
/* legacy (no data-layout) keeps zoom-in for backward compat with old posts */
.image-group:not([data-layout]) .strip [data-src] { cursor: zoom-in; }

/* ───── Editor-only chip header on each image-group (hidden in blog) ─── */
/* No frame around the block — chips alone are enough to mark it as a group. */
body.is-editor .ig-head {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 10px; flex-wrap: wrap; gap: 8px;
  font-family: "Press Start 2P", monospace; font-size: 9px;
  letter-spacing: 0.14em; color: var(--copper-deep);
  user-select: none;
}
body.is-editor .ig-tools { display: flex; gap: 4px; flex-wrap: wrap; }
body.is-editor .chip {
  font-family: "Press Start 2P", monospace; font-size: 8px;
  padding: 6px 8px; border: 2px solid var(--wood-deep);
  background: var(--cream); color: var(--wood-deep);
  box-shadow: 2px 2px 0 var(--wood-deep);
  cursor: pointer;
  text-transform: uppercase; letter-spacing: 0.08em;
  transition: transform .08s ease;
}
body.is-editor .chip:hover { transform: translate(-1px, -1px); box-shadow: 3px 3px 0 var(--wood-deep); }
body.is-editor .chip.on { background: var(--copper); color: #fff; }
/* "+ PHOTO" chip — visually flagged as an action, not a layout toggle. */
body.is-editor .chip.ig-add {
  background: var(--gold); color: var(--wood-deep);
  margin-left: 6px;
}
body.is-editor .chip.ig-add:hover { background: var(--copper); color: #fff; }
body:not(.is-editor) .ig-head { display: none; }

/* ───── Modal gallery viewer (blog only) ───── */
.lightbox[hidden] { display: none; }
.lightbox {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(20, 14, 8, 0.92);
  display: flex; align-items: center; justify-content: center;
  user-select: none;
}
.lightbox-img {
  max-width: 92vw; max-height: 80vh;
  border: 3px solid var(--wood-deep);
  box-shadow: inset 0 0 0 3px var(--cream), 6px 6px 0 var(--wood-deep);
  background: var(--cream-deep) center/contain no-repeat;
  width: 92vw; height: 80vh;
}
.lightbox-video {
  max-width: 92vw; max-height: 80vh;
  border: 3px solid var(--wood-deep);
  box-shadow: inset 0 0 0 3px var(--cream), 6px 6px 0 var(--wood-deep);
  background: #000;
  width: auto; height: 80vh;
  display: block;
}
.lightbox-img[hidden], .lightbox-video[hidden] { display: none; }
.lightbox-nav {
  position: absolute; top: 50%; transform: translateY(-50%);
  background: var(--cream); border: 2px solid var(--wood-deep);
  box-shadow: 2px 2px 0 var(--wood-deep);
  color: var(--wood-deep);
  font-family: "Press Start 2P", monospace; font-size: 14px;
  width: 38px; height: 38px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
}
.lightbox-nav:hover { background: var(--gold); }
.lightbox-prev { left: 20px; }
.lightbox-next { right: 20px; }
.lightbox-close {
  position: absolute; top: 20px; right: 20px;
  background: var(--cream); border: 2px solid var(--wood-deep);
  box-shadow: 2px 2px 0 var(--wood-deep);
  color: var(--wood-deep);
  font-family: "Press Start 2P", monospace; font-size: 11px;
  padding: 8px 12px; cursor: pointer;
}
.lightbox-close:hover { background: var(--gold); }
.lightbox-count {
  position: absolute; bottom: 96px; left: 50%;
  transform: translateX(-50%);
  font-family: "Press Start 2P", monospace; font-size: 9px;
  color: var(--cream); letter-spacing: 0.16em;
}
/* horizontal thumbnail rail at the bottom of the lightbox */
.lightbox-thumbs {
  position: absolute; bottom: 20px; left: 50%;
  transform: translateX(-50%);
  display: flex; gap: 4px;
  max-width: 88vw; padding: 4px 6px;
  overflow-x: auto;
  scrollbar-width: thin;
}
.lightbox-thumbs:empty { display: none; }
.lightbox-thumb {
  flex: 0 0 auto;
  width: 50px; height: 50px;
  background-size: cover; background-position: center;
  background-color: var(--cream-deep);
  border: 2px solid var(--cream);
  cursor: pointer;
  opacity: 0.6;
  transition: opacity .12s, border-color .12s, box-shadow .12s;
}
.lightbox-thumb:hover { opacity: 1; }
.lightbox-thumb.selected {
  opacity: 1;
  border-color: var(--gold);
  box-shadow: 0 0 0 2px var(--gold);
}

/* ───── RIGHT TIMELINE ───── */
aside.timeline {
  position: sticky;
  top: 88px;
  height: calc(100vh - 110px);
  align-self: start;
}
.timeline-frame {
  height: 100%;
  background: var(--paper);
  border: 3px solid var(--wood-deep);
  box-shadow: inset 0 0 0 3px var(--cream), 4px 4px 0 var(--wood-deep);
  padding: 14px 8px;
  display: flex; flex-direction: column;
}
.timeline-head {
  text-align: center;
  font-family: "Press Start 2P", monospace; font-size: 8px;
  color: var(--copper-deep); letter-spacing: 0.18em;
  padding-bottom: 10px; border-bottom: 2px dotted var(--line);
  margin-bottom: 10px;
}
.timeline-foot {
  text-align: center;
  font-family: "Press Start 2P", monospace; font-size: 8px;
  color: var(--ink-soft); letter-spacing: 0.18em;
  padding-top: 10px; border-top: 2px dotted var(--line); margin-top: 6px;
}
.timeline-foot .count { color: var(--copper-deep); }

.track {
  position: relative;
  flex: 1; min-height: 0;
  overflow-y: auto;
  scrollbar-width: none;
  padding: 8px 0 8px 30px;
}
.track::-webkit-scrollbar { display: none; }
.track::before {
  content: "";
  position: absolute; top: 8px; bottom: 8px;
  left: 41px; width: 2px;
  background: repeating-linear-gradient(180deg, var(--wood-deep) 0 3px, transparent 3px 7px);
}
.thumb {
  display: flex; align-items: center; gap: 0;
  position: relative;
  margin-bottom: 12px;
  cursor: pointer; text-decoration: none;
  transition: transform .25s ease;
}
.thumb .dot {
  flex: 0 0 auto;
  width: 28px; height: 28px;
  border: 2px solid var(--wood-deep);
  box-shadow: inset 0 0 0 2px var(--cream);
  background-color: var(--cream-deep);
  background-size: cover; background-position: center;
  position: relative; z-index: 1;
  transition: width .25s ease, height .25s ease, box-shadow .25s ease, transform .25s ease;
}
.thumb .plaque { display: none; }
.thumb.active .dot,
.thumb:hover .dot {
  width: 52px; height: 52px;
  box-shadow:
    inset 0 0 0 2px var(--cream),
    0 0 0 3px var(--gold),
    4px 4px 0 var(--wood-deep);
  transform: translateX(-6px);
}
.thumb:not(.active):not(:hover) .dot { filter: saturate(0.78) brightness(0.96); }

.rail-wrap {
  position: relative;
  flex: 1; min-height: 0;
  display: flex; flex-direction: column;
}
.floating-plaque {
  position: absolute;
  right: calc(100% - 16px);
  top: 0;
  transform: translateY(-50%);
  background: var(--gold);
  color: var(--wood-deep);
  font-family: "Press Start 2P", monospace; font-size: 9px;
  letter-spacing: 0.12em;
  padding: 9px 12px 10px;
  border: 2px solid var(--wood-deep);
  box-shadow: 3px 3px 0 var(--wood-deep);
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease;
  z-index: 5;
}
.floating-plaque.show { opacity: 1; }
.floating-plaque::after {
  content: "";
  position: absolute; right: -8px; top: 50%; transform: translateY(-50%);
  border: 4px solid transparent;
  border-left-color: var(--wood-deep);
}

/* ───── FOOTER ───── */
.feed-end {
  text-align: center; padding: 40px 0 0;
  font-family: "Press Start 2P", monospace; font-size: 9px;
  letter-spacing: 0.18em; color: var(--ink-soft);
}
.feed-end .star { color: var(--copper-deep); }

/* ───── PROGRESS ───── */
.progress {
  position: fixed; left: 0; right: 0; top: 60px; height: 3px;
  background: rgba(90, 55, 23, 0.12); z-index: 20;
}
.progress .fill {
  height: 100%; width: 0%; background: var(--gold);
  box-shadow: inset 0 -2px 0 var(--copper-deep);
  transition: width .12s linear;
}

/* ───── SEARCH ───── */
.topbar nav .search-btn,
.topbar nav .audio-btn {
  background: rgba(255, 243, 217, 0.10);
  border: 2px solid rgba(255, 243, 217, 0.30);
  color: #f5e7b7;
  font-size: 14px;
  width: 32px; height: 32px;
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer;
  line-height: 1;
  transition: background .15s, border-color .15s, color .15s;
}
.topbar nav .search-btn:hover,
.topbar nav .audio-btn:hover {
  background: rgba(217, 166, 72, 0.35);
  border-color: var(--gold);
  color: #fff;
}
/* gold reserved for active state — audio playing */
.topbar nav .audio-btn[aria-pressed="true"] {
  background: rgba(217, 166, 72, 0.35);
  border-color: var(--gold);
  color: #fff;
}
.topbar nav .audio-btn { font-size: 16px; }
.topbar nav .audio-btn[aria-busy="true"] { opacity: .55; cursor: progress; }

/* hidden YouTube audio host — kept in flow but invisible */
#yt-audio-host {
  position: absolute; left: -9999px; top: -9999px;
  width: 1px; height: 1px; pointer-events: none;
  visibility: hidden;
}
.search-panel {
  position: sticky; top: 76px; z-index: 25;
  background: var(--paper);
  border-bottom: 2px solid var(--wood-deep);
  box-shadow: 0 2px 0 var(--wood-deep), 0 8px 18px -10px rgba(0, 0, 0, 0.18);
  padding: 14px clamp(16px, 4vw, 36px);
}
.search-panel[hidden] { display: none; }
.search-inner {
  max-width: 760px; margin: 0 auto;
  display: flex; align-items: center; gap: 12px;
}
.search-inner input {
  flex: 1;
  font-family: "Lora", serif; font-size: 17px;
  background: var(--cream);
  border: 2px solid var(--wood-deep);
  box-shadow: inset 2px 2px 0 rgba(90, 55, 23, 0.08);
  padding: 11px 14px;
  outline: none;
  color: var(--ink);
}
.search-inner input::placeholder { color: rgba(42, 34, 24, 0.32); font-style: italic; }
.search-inner .hint {
  font-family: "Press Start 2P", monospace; font-size: 8px;
  letter-spacing: 0.14em; color: var(--ink-soft); text-transform: uppercase;
}
.search-inner .search-close {
  font-family: "Press Start 2P", monospace; font-size: 9px;
  padding: 9px 11px; background: var(--cream); color: var(--wood-deep);
  border: 2px solid var(--wood-deep);
  box-shadow: 2px 2px 0 var(--wood-deep);
  cursor: pointer; letter-spacing: 0.12em; text-transform: uppercase;
}
.search-inner .search-close:hover { background: var(--gold); }

/* search results — list of cards under the input. */
.search-results[hidden] { display: none; }
.search-results {
  max-width: 760px; margin: 14px auto 0;
  display: flex; flex-direction: column; gap: 8px;
  max-height: 50vh; overflow-y: auto;
}
.search-result {
  display: flex; align-items: stretch; gap: 12px;
  text-decoration: none; color: var(--ink);
  background: var(--cream);
  border: 2px solid var(--line);
  padding: 10px 14px;
  transition: border-color .12s, transform .08s;
}
.search-result:hover {
  border-color: var(--wood-deep);
  transform: translate(-1px, -1px);
  box-shadow: 2px 2px 0 var(--wood-deep);
}
.search-result .sr-thumb {
  flex: 0 0 auto;
  width: 56px; height: 56px;
  border: 2px solid var(--wood-deep);
  box-shadow: inset 0 0 0 2px var(--cream);
  background: var(--cream-deep) center/cover no-repeat;
  align-self: center;
}
.search-result .sr-thumb.glyph {
  display: flex; align-items: center; justify-content: center;
  font-family: "DM Serif Display", serif; font-size: 26px; line-height: 1;
  color: var(--copper-deep); background-color: var(--cream);
}
.search-result .sr-thumb.glyph.alpha {
  font-family: "Press Start 2P", monospace; font-size: 14px;
}
.search-result .sr-body { flex: 1 1 auto; min-width: 0; }
.search-result .sr-meta {
  font-family: "Press Start 2P", monospace; font-size: 8px;
  letter-spacing: 0.14em; color: var(--ink-soft);
  text-transform: uppercase; margin-bottom: 4px;
}
.search-result h3 {
  font-family: "DM Serif Display", serif;
  font-size: 18px; line-height: 1.2; color: var(--copper-deep);
  margin: 0 0 4px;
}
.search-result .sr-snippet {
  font-family: "Lora", serif; font-size: 14px; line-height: 1.55;
  color: var(--ink-soft);
}
.search-result mark {
  background: var(--gold); color: var(--wood-deep);
  padding: 0 2px; border-radius: 1px;
}
.search-results .sr-empty {
  font-family: "Klee One", serif; color: var(--ink-soft);
  font-style: italic; padding: 14px; text-align: center;
}

/* ───── DRAFTS COLLAPSIBLE ───── */
.drafts-fold {
  background: var(--paper-warm);
  border: 3px solid var(--wood-deep);
  box-shadow: inset 0 0 0 3px var(--cream), 4px 4px 0 var(--wood-deep);
  margin-bottom: 32px;
}
.drafts-fold > summary {
  list-style: none;
  cursor: pointer;
  padding: 14px 22px;
  display: flex; align-items: center; gap: 14px;
  font-family: "Press Start 2P", monospace; font-size: 9px;
  letter-spacing: 0.16em; color: var(--copper-deep);
  user-select: none;
}
.drafts-fold > summary::-webkit-details-marker { display: none; }
.drafts-fold > summary .d-label { font-size: 10px; }
.drafts-fold > summary .d-hint { flex: 1; font-size: 8px; color: var(--ink-soft); }
.drafts-fold > summary .d-chev {
  font-family: "Lora", serif; font-size: 14px;
  color: var(--copper-deep); transition: transform .2s ease;
}
.drafts-fold[open] > summary .d-chev { transform: rotate(180deg); }
.drafts-fold[open] > summary { border-bottom: 2px dotted var(--line); }
.drafts-fold[open] > summary .d-hint { visibility: hidden; }
.draft-list { padding: 14px 18px 18px; display: flex; flex-direction: column; gap: 10px; }
.draft-card {
  background: var(--paper);
  border: 2px solid var(--wood-deep);
  box-shadow: 2px 2px 0 var(--wood-deep);
  padding: 14px 16px;
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
}
.draft-card .d-meta {
  font-family: "Press Start 2P", monospace; font-size: 8px;
  color: var(--ink-soft); letter-spacing: 0.14em;
  min-width: 230px;
}
.draft-card h3 {
  font-family: "DM Serif Display", serif; font-weight: 400;
  font-size: 19px; line-height: 1.2;
  flex: 1; min-width: 200px;
}
.draft-card .d-actions { display: flex; gap: 8px; }
.draft-card .d-btn {
  font-family: "Press Start 2P", monospace; font-size: 9px;
  letter-spacing: 0.1em; text-transform: uppercase;
  padding: 8px 11px; background: var(--cream); color: var(--wood-deep);
  border: 2px solid var(--wood-deep); box-shadow: 2px 2px 0 var(--wood-deep);
  cursor: pointer; text-decoration: none;
  display: inline-flex; align-items: center;
  transition: transform .08s, box-shadow .08s, background .15s;
}
.draft-card .d-btn:hover {
  background: var(--gold);
  transform: translate(-1px, -1px);
  box-shadow: 3px 3px 0 var(--wood-deep);
}
.draft-card .d-btn.discard {
  color: var(--ink-soft); background: transparent;
  box-shadow: none; border-color: var(--line);
}
.draft-card .d-btn.discard:hover {
  color: var(--copper-deep); border-color: var(--copper-deep);
  background: transparent; transform: none; box-shadow: none;
}

/* hide things meant only for admins (toggled by JS) */
[data-admin-only] { display: none; }
body.is-admin [data-admin-only] { display: revert; }
body.is-admin [data-admin-only].draft-list-actions { display: flex; }

/* sign-in / sign-out visibility (toggled by JS once /api/me resolves) */
[data-signed-in-only], [data-signed-out-only] { display: none; }
body.is-signed-in [data-signed-in-only] { display: revert; }
body.is-signed-out [data-signed-out-only] { display: revert; }

/* Drawer-scoped overrides — `display: revert` falls back to <a>'s UA default
   (inline), which kills the .menu-item flex layout. Use display: flex
   explicitly here. Specificity also has to beat .menu-drawer .menu-item. */
.menu-drawer .menu-item[data-admin-only],
.menu-drawer .menu-item[data-signed-in-only],
.menu-drawer .menu-item[data-signed-out-only] { display: none; }
body.is-admin      .menu-drawer .menu-item[data-admin-only],
body.is-signed-in  .menu-drawer .menu-item[data-signed-in-only],
body.is-signed-out .menu-drawer .menu-item[data-signed-out-only] { display: flex; }

/* ───── EDITOR ───── */
.actionbar {
  position: sticky; top: 76px; z-index: 25;
  background: var(--paper);
  border-bottom: 2px solid var(--wood-deep);
  box-shadow: 0 2px 0 var(--wood-deep), 0 8px 18px -10px rgba(0, 0, 0, 0.18);
  padding: 12px clamp(16px, 3vw, 36px);
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  flex-wrap: wrap;
}
.actionbar .left {
  display: flex; align-items: center; gap: 14px;
  font-family: "Press Start 2P", monospace; font-size: 9px;
  letter-spacing: 0.14em; color: var(--ink-soft); text-transform: uppercase;
}
.actionbar .left .saved {
  display: inline-flex; align-items: center; gap: 8px;
  color: var(--sage-deep);
}
.actionbar .left .saved .dot {
  width: 8px; height: 8px; background: #9adb6e;
  box-shadow: 0 0 0 2px var(--sage-deep);
}
.actionbar .left .saved[data-tone="idle"]    { color: var(--ink-soft); }
.actionbar .left .saved[data-tone="idle"] .dot { background: var(--paper); box-shadow: 0 0 0 2px var(--ink-soft); }
.actionbar .left .saved[data-tone="saving"]  { color: var(--copper-deep); }
.actionbar .left .saved[data-tone="saving"] .dot { background: var(--gold); box-shadow: 0 0 0 2px var(--copper-deep); }
.actionbar .left .saved[data-tone="error"]   { color: var(--copper-deep); }
.actionbar .left .saved[data-tone="error"] .dot { background: var(--copper-deep); box-shadow: 0 0 0 2px var(--copper-deep); }
.actionbar .right { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

.pill {
  font-family: "Press Start 2P", monospace; font-size: 9px;
  letter-spacing: 0.12em; text-transform: uppercase;
  padding: 9px 13px;
  background: var(--cream);
  border: 2px solid var(--wood-deep);
  box-shadow: 2px 2px 0 var(--wood-deep);
  color: var(--wood-deep);
  cursor: pointer;
  display: inline-flex; align-items: center; gap: 8px;
  user-select: none;
  transition: transform .08s ease, background .15s ease, color .15s ease;
}
.pill:hover { transform: translate(-1px, -1px); box-shadow: 3px 3px 0 var(--wood-deep); }
.pill:active { transform: translate(1px, 1px); box-shadow: 1px 1px 0 var(--wood-deep); }
.pill .ind {
  width: 9px; height: 9px; border-radius: 50%;
  border: 1.5px solid var(--wood-deep);
  background: var(--cream-deep);
}
.pill.status[data-status="live"] { background: var(--copper); color: #fff; }
.pill.status[data-status="live"] .ind { background: #9adb6e; border-color: #fff; }
.pill.status[data-status="draft"] .ind { background: var(--gold); }
.pill.visibility[data-vis="private"] .ind { background: var(--wood); }
.pill.visibility[data-vis="group"] .ind { background: var(--gold); }
.pill.visibility[data-vis="public"] .ind { background: var(--sage); }
/* Cog is a square icon-button — same total height as LIVE/DRAFT/PRIVATE
   (content 27 + borders 4 = 31px). Uses an SVG gear so the centering is
   pixel-perfect (the unicode ⚙ glyph has unpredictable vertical metrics). */
.pill.cog {
  width: 31px; height: 31px;
  padding: 0;
  justify-content: center;
  gap: 0;
}
.pill.cog .cog-icon {
  width: 17px; height: 17px;
  display: block;
  color: var(--wood-deep);
}
.pill.cog[aria-expanded="true"] { background: var(--gold); }

.pixbtn {
  /* Same height as the .pill row: 9px font + 9px+9px padding + 2px+2px border = 31px. */
  font-family: "Press Start 2P", monospace; font-size: 9px;
  padding: 9px 16px; border: 2px solid #4d2c15;
  background: var(--gold); color: var(--wood-deep);
  box-shadow: 3px 3px 0 #4d2c15;
  letter-spacing: 0.06em; cursor: pointer; text-transform: uppercase;
  transition: transform .08s ease;
  display: inline-flex; align-items: center; gap: 10px;
}
/* Stars use a system font (Press Start 2P draws ★ low in its em-box) and
   are themselves flex containers so the glyph centers within a fixed-height
   slot equal to the SAVE label's cap-height. */
.pixbtn .star {
  font-family: system-ui, -apple-system, sans-serif;
  font-size: 13px; line-height: 1;
  height: 9px;            /* matches the SAVE label height */
  display: inline-flex;
  align-items: center; justify-content: center;
}
.pixbtn:hover { transform: translate(-1px, -1px); box-shadow: 4px 4px 0 #4d2c15; }
.pixbtn:active { transform: translate(1px, 1px); box-shadow: 1px 1px 0 #4d2c15; }
.pixbtn[disabled] { opacity: .5; cursor: not-allowed; transform: none; box-shadow: 3px 3px 0 #4d2c15; }

main.canvas {
  max-width: 740px; margin: 0 auto;
  padding: 48px clamp(20px, 4vw, 36px) 120px;
  position: relative; z-index: 1;
}
.date-row {
  font-family: "Press Start 2P", monospace; font-size: 9px;
  color: var(--copper-deep); letter-spacing: 0.16em;
  margin-bottom: 16px;
  display: flex; gap: 10px; align-items: center;
}
.date-row .when { color: var(--copper-deep); }
.date-row .by { color: var(--ink-soft); }
.title-input {
  width: 100%;
  font-family: "DM Serif Display", serif; font-weight: 400;
  font-size: clamp(36px, 5.5vw, 56px); line-height: 1.1;
  letter-spacing: -0.005em;
  border: 0; background: transparent; color: var(--ink);
  outline: none; padding: 4px 0 10px;
  border-bottom: 2px dotted var(--line);
  margin-bottom: 18px;
}
.title-input::placeholder { color: rgba(42, 34, 24, 0.30); font-style: italic; }

.toolbar {
  display: inline-flex; gap: 4px; padding: 6px;
  background: var(--cream);
  border: 2px solid var(--wood-deep);
  box-shadow: 3px 3px 0 var(--wood-deep);
  margin-bottom: 22px;
  flex-wrap: wrap;
}
.toolbar button {
  background: transparent; border: 0; cursor: pointer;
  width: 30px; height: 30px;
  font-family: "Press Start 2P", monospace; font-size: 11px;
  color: var(--wood-deep);
  display: inline-flex; align-items: center; justify-content: center;
}
.toolbar button.on,
.toolbar button:hover {
  background: var(--gold);
  box-shadow: inset 2px 2px 0 rgba(255, 255, 255, 0.4), inset -2px -2px 0 rgba(90, 55, 23, 0.25);
}
.toolbar .sep { width: 2px; background: var(--line); margin: 4px 4px; }

.body-editor {
  font-family: "Lora", serif; font-size: 17px; line-height: 1.95;
  color: #2d271d;
  min-height: 240px;
  outline: none;
}
.body-editor[contenteditable]:empty::before {
  content: "start writing here. paste a photo or video any time…";
  color: rgba(42, 34, 24, 0.32); font-style: italic;
}
.body-editor p { margin-bottom: 20px; }
.body-editor p .first {
  font-family: "DM Serif Display", serif; float: left;
  font-size: 50px; line-height: 0.85;
  margin: 4px 12px 0 0; color: var(--copper-deep);
}

.drop-zone {
  margin-top: 30px;
  border: 3px dashed var(--sage);
  background: rgba(125, 146, 99, 0.08);
  padding: 30px 22px; text-align: center;
  font-family: "Klee One", serif; color: var(--ink-soft);
  transition: background .15s, border-color .15s;
}
.drop-zone.over {
  background: rgba(125, 146, 99, 0.18);
  border-color: var(--sage-deep);
}
.drop-zone .px {
  font-family: "Press Start 2P", monospace; font-size: 10px;
  color: var(--sage-deep); letter-spacing: 0.15em;
  display: block; margin-bottom: 10px;
}
.drop-zone .ways { font-size: 13.5px; margin-top: 6px; }
.kbd {
  font-family: "Press Start 2P", monospace; font-size: 9px;
  padding: 4px 6px; background: var(--cream);
  border: 2px solid var(--wood-deep); box-shadow: 1px 1px 0 var(--wood-deep);
  margin: 0 2px;
}
.hints {
  max-width: 740px; margin: 60px auto 0;
  padding: 0 clamp(20px, 4vw, 36px);
  font-family: "Press Start 2P", monospace; font-size: 8px;
  letter-spacing: 0.16em; color: var(--ink-soft);
  text-align: center; line-height: 2;
}
.hints .kbd { font-size: 8px; vertical-align: 1px; }

/* ───── MOBILE pass — component-by-component audit at ≤ 600px ─────────── */
@media (max-width: 600px) {

  /* ── TOPBAR ────────────────────────────────────────────────────────────
     The original screenshot had the "· C H I I S A N A   H I B I ·"
     subtitle wrapping under the title, and "sign out" splitting onto two
     lines. Fixed by hiding the decorative subtitle, shrinking the badge
     a touch, no-wrapping nav links, and using a compact font size. */
  .topbar { padding: 8px 12px 10px; }
  .topbar::before, .topbar::after { display: none; }  /* drop the rivet rail rows for breathing room */
  .crest { gap: 10px; }
  .crest .badge { width: 36px; height: 36px; box-shadow:
    inset -2px -2px 0 #a87b1d,
    inset 2px 2px 0 #f3cd6e,
    0 0 0 2px #4d2c15;
  }
  .crest .badge .badge-glyph { width: 11px; height: 13px; }
  .crest h1 { font-size: 17px; line-height: 1.1; }
  .crest h1 small { display: none; }  /* decorative subtitle — hide on mobile */

  .topbar nav { gap: 8px; font-size: 13px; flex-wrap: nowrap; }
  /* The inline "desktop" nav links collapse into the hamburger drawer. The
     two icon buttons (🔍 search, ♪ audio) stay inline because they're the
     two most-tapped actions and they already fit comfortably. */
  .topbar nav a.desk { display: none; }
  .topbar nav .menu-btn { display: inline-flex; }
  .topbar nav .search-btn,
  .topbar nav .audio-btn {
    width: 32px; height: 32px; font-size: 14px;
  }
  .menu-drawer { top: 52px; }

  /* ── ACTIONBAR (editor) ────────────────────────────────────────────────
     Saved hint takes its own row; pill row right-aligns. */
  .actionbar { padding: 8px 12px; top: 56px; gap: 8px; }
  .actionbar .left { width: 100%; }
  .actionbar .right { justify-content: flex-end; gap: 8px; }
  .pill, .pixbtn { padding: 9px 11px; font-size: 9px; }
  .pill.cog { width: 34px; height: 34px; padding: 0; }
  .pill.cog .cog-icon { width: 18px; height: 18px; }

  /* ── DATE ROW (editor) ─────────────────────────────────────────────────
     Keep author + date on one row but reduce font + padding. */
  .date-row { font-size: 11px; gap: 8px; flex-wrap: wrap; }

  /* ── EDITOR BODY ───────────────────────────────────────────────────── */
  main.canvas { padding: 22px 14px 80px; }
  .title-input { font-size: 26px; padding: 4px 0 6px; }
  .body-editor { font-size: 17px; }
  .toolbar { gap: 5px; margin-bottom: 12px; }
  .toolbar button { padding: 8px 10px; font-size: 10px; min-height: 32px; }
  .drop-zone { padding: 20px 14px; margin-top: 22px; }
  .hints { display: none; }   /* keyboard shortcuts not relevant on touch */

  /* ── SEARCH PANEL ──────────────────────────────────────────────────── */
  .search-panel { top: 56px; padding: 10px 12px; }
  .search-inner { flex-wrap: wrap; gap: 8px; }
  .search-inner input { font-size: 16px; padding: 10px 12px; }  /* 16px keeps iOS from zooming in */
  .search-inner .hint { display: none; }
  .search-results { max-height: 64vh; margin-top: 10px; }
  .search-result { gap: 10px; padding: 10px; }
  .search-result .sr-thumb { width: 48px; height: 48px; }
  .search-result h3 { font-size: 16px; }
  .search-result .sr-snippet { font-size: 13px; }

  /* ── ARTICLE POST ──────────────────────────────────────────────────────
     On mobile we drop the wooden frame entirely so each entry uses the full
     width — the page reads like a continuous journal rather than a stack of
     boxed cards. Posts are separated by a small ★ ★ ★ ornament instead. */
  .layout { padding: 18px 0 60px; }
  .feed { gap: 0; }
  article.post {
    background: transparent;
    border: none;
    box-shadow: none;
    padding: 26px 16px 30px;
    scroll-margin-top: 80px;
    position: relative;
  }
  article.post + article.post {
    padding-top: 56px;          /* room above for the separator */
  }
  article.post + article.post::before {
    content: "★  ★  ★";
    position: absolute;
    top: 14px; left: 50%;
    transform: translateX(-50%);
    font-family: "Press Start 2P", monospace;
    font-size: 9px;
    letter-spacing: 0.5em;
    color: var(--copper-deep);
    opacity: 0.55;
    pointer-events: none;
  }
  article.post header { margin-bottom: 14px; padding-bottom: 14px; }
  article.post h2 { font-size: 26px; }
  article.post .day-stamp { font-size: 8px; }
  article.post .byline { font-size: 12px; gap: 8px; flex-wrap: wrap; }
  /* Edit pencil — inline under the byline so it doesn't fight the title. */
  article.post > header .edit-link {
    position: static; display: inline-flex; align-items: center;
    margin-top: 8px; font-size: 8px; padding: 5px 8px;
  }

  /* ── DRAFTS FOLD ───────────────────────────────────────────────────── */
  .drafts-fold {
    /* layout padding is 0 on mobile — breathe a bit so the card doesn't
       slam the screen edges. */
    margin: 0 14px;
  }
  .drafts-fold > summary { padding: 12px 14px; gap: 8px; }
  .drafts-fold > summary .d-hint { display: none; }
  .draft-card { padding: 12px; }
  .feed-end { padding: 0 16px; }

  /* ── IMAGE GROUPS ──────────────────────────────────────────────────── */
  .image-group { margin: 18px 0; }
  /* GALLERY: 3-up is too tight on narrow — drop to 2-up. */
  .image-group[data-layout="gallery"] .strip { grid-template-columns: repeat(2, 1fr); }
  /* BIG+THUMB: stack on mobile (big up top, thumb rail underneath as a flex row). */
  .image-group[data-layout="big-thumb"] .strip {
    grid-template-columns: 1fr;
    justify-content: stretch;
  }
  .image-group[data-layout="big-thumb"] .strip > .bt-big { width: 100%; }
  .image-group[data-layout="big-thumb"] .strip > .bt-thumbs {
    flex-direction: row; flex-wrap: wrap;
    align-self: auto; height: auto;
    gap: 5px;
  }
  /* Editor chips below image groups — wrap nicely. */
  body.is-editor .ig-head { font-size: 8px; gap: 6px; }
  body.is-editor .chip { padding: 6px 7px; font-size: 7px; }

  /* ── COG MODAL ─────────────────────────────────────────────────────── */
  .po-modal { padding: 12px; }
  .po-panel { padding: 16px; max-height: 92vh; }
  .po-head h2 { font-size: 10px; }
  .po-tab { padding: 6px 7px; font-size: 7px; }
  .po-grid { grid-template-columns: repeat(auto-fill, minmax(48px, 1fr)); gap: 6px; }
  .po-cell.glyph { font-size: 22px; }
  .po-cell.glyph.alpha { font-size: 12px; }

  /* ── LIGHTBOX ──────────────────────────────────────────────────────── */
  .lightbox-close {
    top: 12px; right: 12px;
    font-size: 10px; padding: 8px 10px;
  }
  .lightbox-nav { width: 34px; height: 34px; font-size: 12px; }
  .lightbox-prev { left: 8px; }
  .lightbox-next { right: 8px; }
  .lightbox-count { bottom: 86px; font-size: 8px; }
  .lightbox-thumbs { bottom: 14px; max-width: 96vw; }
  .lightbox-thumb { width: 40px; height: 40px; }
  .lightbox-img, .lightbox-video {
    max-width: 96vw; max-height: 70vh;
    width: 96vw; height: 70vh;
  }
}

/* Reduced-motion users — kill our small transform/hover animations. */
@media (prefers-reduced-motion: reduce) {
  .pill, .pixbtn, .chip, .po-cell, .lightbox-thumb,
  .topbar nav .search-btn, .topbar nav .audio-btn,
  .search-result, .thumb .dot {
    transition: none;
  }
  .lightbox-thumbs { scroll-behavior: auto; }
  .track { scroll-behavior: auto; }
}

/* Date picker overlaid invisibly on the date label — clicking the formatted
   "MAY 13, 2026" opens the browser's native date picker. */
.when-wrap {
  position: relative; display: inline-block;
  cursor: pointer;
}
.when-input {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  opacity: 0; cursor: pointer;
  font: inherit; padding: 0; border: 0;
  background: transparent;
  /* Webkit shows a blinking caret unless we hide it. */
  color: transparent;
}
.when-input::-webkit-calendar-picker-indicator {
  position: absolute; inset: 0;
  width: 100%; height: 100%; opacity: 0; cursor: pointer;
}

/* ───── POST OPTIONS modal (cog button) ───── */
.po-modal[hidden] { display: none; }
.po-modal {
  position: fixed; inset: 0; z-index: 100;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
}
.po-backdrop {
  position: absolute; inset: 0;
  background: rgba(42, 28, 16, 0.55);
  backdrop-filter: blur(2px);
}
.po-panel {
  position: relative; z-index: 1;
  width: min(560px, 100%);
  max-height: 86vh; overflow: auto;
  background: var(--paper);
  border: 3px solid var(--wood-deep);
  box-shadow: inset 0 0 0 3px var(--cream), 6px 6px 0 var(--wood-deep);
  padding: 22px 24px 24px;
}
.po-head {
  display: flex; justify-content: space-between; align-items: center;
  border-bottom: 2px dashed var(--line);
  padding-bottom: 14px; margin-bottom: 18px;
}
.po-head h2 {
  font-family: "Press Start 2P", monospace; font-size: 11px;
  letter-spacing: 0.16em; color: var(--copper-deep);
  margin: 0;
}
.po-x {
  background: transparent; border: none; cursor: pointer;
  font-size: 22px; line-height: 1; color: var(--ink-soft);
  padding: 4px 8px;
}
.po-x:hover { color: var(--copper-deep); }

.po-section { margin-bottom: 22px; }
.po-section:last-child { margin-bottom: 0; }
.po-section-head {
  font-family: "Press Start 2P", monospace; font-size: 9px;
  letter-spacing: 0.14em; color: var(--ink-soft); text-transform: uppercase;
  margin-bottom: 10px;
}
.po-section.danger .po-section-head { color: var(--copper-deep); }

.po-tabs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.po-tab {
  font-family: "Press Start 2P", monospace; font-size: 8px;
  padding: 7px 9px; border: 2px solid var(--wood-deep);
  background: var(--cream); color: var(--wood-deep);
  box-shadow: 2px 2px 0 var(--wood-deep);
  cursor: pointer; letter-spacing: 0.10em;
}
.po-tab:hover { transform: translate(-1px, -1px); box-shadow: 3px 3px 0 var(--wood-deep); }
.po-tab.on { background: var(--copper); color: #fff; }

.po-grid {
  display: grid; gap: 8px;
  grid-template-columns: repeat(auto-fill, minmax(56px, 1fr));
}
.po-cell {
  aspect-ratio: 1/1;
  background: var(--cream); color: var(--wood-deep);
  border: 2px solid var(--wood-deep);
  box-shadow: inset 0 0 0 2px var(--cream-deep);
  display: flex; align-items: center; justify-content: center;
  font-family: "Press Start 2P", monospace; font-size: 14px;
  cursor: pointer;
  background-size: cover; background-position: center;
  transition: transform .08s ease, box-shadow .08s ease;
}
.po-cell.glyph { font-family: "DM Serif Display", serif; font-size: 28px; line-height: 1; }
.po-cell.glyph.alpha { font-family: "Press Start 2P", monospace; font-size: 14px; }
.po-cell:hover { transform: translate(-1px, -1px); }
.po-cell.selected {
  box-shadow: inset 0 0 0 2px var(--cream), 0 0 0 3px var(--gold), 3px 3px 0 var(--wood-deep);
}
.po-cell.none {
  font-family: "Press Start 2P", monospace; font-size: 8px;
  letter-spacing: 0.10em; color: var(--ink-soft);
}
.po-empty {
  font-family: "Klee One", serif; color: var(--ink-soft);
  text-align: center; padding: 28px 8px; font-style: italic;
  grid-column: 1 / -1;
}

/* Per-photo × button — editor-only, shown in the top-right of each cell in
   an image-group. CSS-hidden outside the editor; JS strips it from saved
   HTML in getCleanBodyHtml. */
.cell-remove { display: none; }
body.is-editor .image-group .strip [data-src] { position: relative; }
body.is-editor .cell-remove {
  display: flex; align-items: center; justify-content: center;
  position: absolute; top: 4px; right: 4px;
  width: 22px; height: 22px;
  background: rgba(255, 243, 217, 0.92);
  border: 2px solid var(--wood-deep);
  box-shadow: 1px 1px 0 var(--wood-deep);
  color: var(--wood-deep);
  font-family: "Press Start 2P", monospace;
  font-size: 12px; line-height: 1;
  cursor: pointer; padding: 0;
  z-index: 2;
  transition: background .12s, color .12s;
}
body.is-editor .cell-remove:hover {
  background: var(--copper-deep); color: #fff;
}
/* BIG+THUMB rail thumbs are 30 px — shrink the × so it doesn't dwarf them. */
body.is-editor .image-group[data-layout="big-thumb"] .bt-thumbs > [data-src] > .cell-remove {
  width: 14px; height: 14px;
  top: 2px; right: 2px;
  font-size: 8px;
  border-width: 1.5px;
  box-shadow: 1px 1px 0 var(--wood-deep);
}

/* Floating link tooltip — shown when hovering an <a> in the editor body. */
.link-tooltip[hidden] { display: none; }
.link-tooltip {
  position: absolute;
  z-index: 50;
  background: var(--cream);
  border: 2px solid var(--wood-deep);
  box-shadow: 2px 2px 0 var(--wood-deep);
  padding: 6px 8px;
  display: flex; align-items: center; gap: 8px;
  font-family: "Klee One", serif; font-size: 12px;
  max-width: 380px;
}
.link-tooltip .lt-url {
  color: var(--copper-deep);
  text-decoration: none;
  border-bottom: 1px dotted var(--copper);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  max-width: 240px;
}
.link-tooltip .lt-url:hover { color: var(--wood-deep); border-color: var(--gold); }
.link-tooltip .lt-btn {
  font-family: "Press Start 2P", monospace; font-size: 8px;
  letter-spacing: 0.1em;
  padding: 5px 7px;
  background: var(--cream-deep);
  border: 1.5px solid var(--wood-deep);
  color: var(--wood-deep);
  cursor: pointer;
}
.link-tooltip .lt-btn:hover { background: var(--gold); }
.link-tooltip .lt-remove { color: var(--copper-deep); border-color: var(--copper-deep); }
.link-tooltip .lt-remove:hover { background: var(--copper-deep); color: #fff; border-color: var(--copper-deep); }

/* LOCATION section in the cog modal */
.po-loc { display: flex; flex-direction: column; gap: 8px; }
.po-loc-input {
  width: 100%;
  font-family: "Lora", serif; font-size: 15px;
  background: var(--cream);
  border: 2px solid var(--wood-deep);
  box-shadow: inset 2px 2px 0 rgba(90, 55, 23, 0.08);
  padding: 9px 11px;
  outline: none;
  color: var(--ink);
}
.po-loc-input::placeholder { color: rgba(42, 34, 24, 0.32); font-style: italic; }
.po-loc-row {
  display: flex; align-items: center; gap: 10px;
  font-family: "Klee One", serif; font-size: 13px;
}
.po-loc-current { color: var(--copper-deep); flex: 1; }
.po-loc-current[data-needs-coords="true"] {
  color: var(--copper);
  background: rgba(196, 106, 58, 0.10);
  padding: 2px 6px;
  border-left: 2px solid var(--copper);
}
.po-loc-hint code {
  font-family: "Press Start 2P", monospace; font-size: 9px;
  background: var(--cream); padding: 1px 4px; color: var(--wood-deep);
  border: 1px solid var(--line);
}
.po-loc-clear {
  font-family: "Press Start 2P", monospace; font-size: 8px;
  padding: 5px 8px; background: transparent;
  border: 1.5px solid var(--line); color: var(--ink-soft);
  cursor: pointer; letter-spacing: 0.1em;
}
.po-loc-clear:hover { color: var(--copper-deep); border-color: var(--copper-deep); }
.po-loc-clear[hidden] { display: none; }
.po-loc-hint {
  font-family: "Klee One", serif; font-size: 12px; font-style: italic;
  color: var(--ink-soft); margin: 0;
}

/* Byline location chip — small 📍 link/text after the byline metadata. */
article.post .byline .byline-loc {
  color: var(--copper-deep);
  text-decoration: none;
  border-bottom: 1.5px dotted var(--copper);
  padding-bottom: 1px;
  transition: color .15s, border-color .15s;
}
article.post .byline a.byline-loc:hover {
  color: var(--wood-deep);
  border-color: var(--gold);
}
article.post .byline span.byline-loc { border-bottom: none; cursor: default; }

.po-delete {
  font-family: "Press Start 2P", monospace; font-size: 9px;
  padding: 11px 14px; border: 2px solid var(--copper-deep);
  background: var(--paper); color: var(--copper-deep);
  box-shadow: 2px 2px 0 var(--copper-deep);
  cursor: pointer; letter-spacing: 0.12em;
}
.po-delete:hover  { background: var(--copper-deep); color: #fff; transform: translate(-1px, -1px); box-shadow: 3px 3px 0 var(--copper-deep); }
.po-delete.confirm { background: var(--copper-deep); color: #fff; }
.po-delete-hint {
  font-family: "Klee One", serif; color: var(--ink-soft);
  font-size: 12px; margin-top: 6px; font-style: italic;
}

/* ───── Glyph covers (cover_url = "glyph:<char>") ───── */
.cover-frame.glyph .img-glyph,
.thumb .dot.glyph {
  display: flex; align-items: center; justify-content: center;
  font-family: "DM Serif Display", serif;
  color: var(--copper-deep); background: var(--cream);
  text-align: center; line-height: 1;
}
.cover-frame.glyph .img-glyph {
  width: 100%; height: 100%;
  font-size: clamp(48px, 18vw, 120px);
}
.cover-frame.glyph .img-glyph.alpha,
.thumb .dot.glyph.alpha {
  font-family: "Press Start 2P", monospace;
}
.cover-frame.glyph .img-glyph.alpha { font-size: clamp(36px, 12vw, 80px); }
.thumb .dot.glyph { font-size: 14px; }
.thumb .dot.glyph.alpha { font-size: 9px; }

/* ───── PLACES PAGE — map frame, pins, popover, right-rail ───── */

.places-head-row {
  max-width: 1200px;
  margin: 36px auto 18px;
  padding: 0 28px;
  position: relative; z-index: 1;
  display: flex; align-items: baseline; justify-content: space-between;
  flex-wrap: wrap; gap: 12px;
}
.places-head-row h2 {
  font-family: "DM Serif Display", serif; font-weight: 400;
  font-size: clamp(28px, 3.6vw, 38px);
  letter-spacing: -0.005em;
}
.places-head-row h2 .ja {
  display: inline-block; margin-left: 12px;
  font-family: "Klee One", serif;
  font-size: 18px; color: var(--ink-soft);
}
.places-head-row .meta {
  font-family: "Press Start 2P", monospace; font-size: 9px;
  letter-spacing: 0.16em; color: var(--copper-deep);
}
.places-head-row .meta .count { color: var(--wood-deep); }

.places-layout {
  display: grid;
  grid-template-columns: 1fr 320px;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 28px 96px;
  gap: 28px;
  position: relative; z-index: 1;
}
@media (max-width: 960px) {
  .places-layout { grid-template-columns: 1fr; }
}

.map-frame {
  position: relative;
  background: var(--paper);
  border: 3px solid var(--wood-deep);
  box-shadow: inset 0 0 0 3px var(--cream), 5px 5px 0 var(--wood-deep);
  padding: 0;
  overflow: hidden;
  min-height: 640px;
}
.map-canvas {
  position: relative;
  width: 100%;
  height: 640px;
  background:
    radial-gradient(800px 500px at 30% 30%, rgba(125,146,99,0.14) 0%, transparent 60%),
    radial-gradient(700px 500px at 80% 70%, rgba(185,205,183,0.20) 0%, transparent 60%),
    var(--paper-warm);
}
/* Leaflet chrome — restyle to fit the wood palette + hide the default popup. */
.leaflet-control-attribution {
  font-family: "Klee One", serif !important;
  font-size: 11px !important;
  background: rgba(244, 234, 212, 0.92) !important;
  color: var(--ink-soft) !important;
  border: 1.5px solid var(--wood-deep);
  padding: 2px 8px !important;
}
.leaflet-control-attribution a { color: var(--copper-deep) !important; }
.leaflet-container { background: transparent !important; font-family: "Lora", serif; }
.leaflet-popup-content-wrapper, .leaflet-popup-tip { display: none !important; }
.leaflet-marker-icon.pin-wrap { background: transparent !important; border: 0 !important; }

.map-empty {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  flex-direction: column; gap: 10px;
  font-family: "Klee One", serif; font-size: 17px; color: var(--ink-soft);
  text-align: center;
  pointer-events: none;
  z-index: 10;
}
.map-empty .star {
  font-family: "Press Start 2P", monospace; font-size: 10px;
  letter-spacing: 0.18em; color: var(--copper-deep);
}

/* Pins — rendered into L.divIcon so their CSS lives here, not in JS. */
.pin {
  cursor: pointer;
  background: transparent; border: 0; padding: 0;
  text-align: center;
  font-family: "Press Start 2P", monospace;
  display: inline-block;
  transition: transform .15s ease;
}
.pin .pin-head {
  width: 32px; height: 32px;
  background: var(--copper);
  color: var(--cream);
  border: 2px solid var(--wood-deep);
  box-shadow:
    inset -2px -2px 0 var(--copper-deep),
    inset 2px 2px 0 #e89366,
    3px 3px 0 var(--wood-deep);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 11px;
  position: relative;
}
.pin .pin-tail {
  width: 0; height: 0;
  margin: 0 auto;
  border: 8px solid transparent;
  border-top-color: var(--wood-deep);
  margin-top: -2px;
}
.pin .pin-count {
  position: absolute; top: -8px; right: -8px;
  min-width: 18px; height: 18px; padding: 0 4px;
  background: var(--cream);
  color: var(--wood-deep);
  border: 1.5px solid var(--wood-deep);
  box-shadow: 1px 1px 0 var(--wood-deep);
  font-family: "Press Start 2P", monospace; font-size: 8px;
  display: inline-flex; align-items: center; justify-content: center;
}
.pin:hover .pin-head { background: var(--copper-deep); }
.pin.active .pin-head {
  background: var(--gold);
  color: var(--wood-deep);
  box-shadow:
    inset -2px -2px 0 #a87b1d,
    inset 2px 2px 0 #f3cd6e,
    0 0 0 3px var(--wood-deep),
    4px 4px 0 var(--wood-deep);
  transform: scale(1.1);
}

/* Floating wooden popover. JS positions it via fixed left/top relative to viewport. */
.places-popover {
  position: fixed;
  width: 320px; max-width: calc(100vw - 28px);
  background: var(--paper);
  border: 3px solid var(--wood-deep);
  box-shadow: inset 0 0 0 3px var(--cream), 5px 5px 0 var(--wood-deep);
  padding: 14px 14px 12px;
  z-index: 600;
}
.places-popover[hidden] { display: none; }
.places-popover .pop-head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 8px; padding-bottom: 8px; border-bottom: 2px dotted var(--line);
  margin-bottom: 10px;
}
.places-popover .pop-head .place {
  font-family: "Klee One", serif; font-size: 16px;
  color: var(--ink); letter-spacing: 0.02em; line-height: 1.2;
  flex: 1; min-width: 0;
}
.places-popover .pop-head .place .coords {
  display: block;
  font-family: "Press Start 2P", monospace; font-size: 8px;
  color: var(--ink-soft); letter-spacing: 0.14em; margin-top: 4px;
}
.places-popover .pop-close {
  background: transparent; border: 0; cursor: pointer;
  font-family: "Press Start 2P", monospace; font-size: 9px;
  color: var(--ink-soft); padding: 4px 6px;
}
.places-popover .pop-close:hover { color: var(--copper-deep); }
.places-popover .pop-meta {
  font-family: "Press Start 2P", monospace; font-size: 8px;
  color: var(--copper-deep); letter-spacing: 0.16em;
  margin-bottom: 12px;
}
.places-popover .pop-posts {
  display: flex; flex-direction: column; gap: 10px;
  max-height: 380px; overflow-y: auto; padding-right: 2px;
}
.places-popover .pop-post {
  display: flex; gap: 10px; align-items: stretch;
  background: var(--cream);
  border: 2px solid var(--wood-deep);
  box-shadow: 2px 2px 0 var(--wood-deep);
  padding: 8px;
  text-decoration: none; color: inherit;
  transition: transform .08s, box-shadow .08s, background .15s;
}
.places-popover .pop-post:hover {
  background: var(--paper-warm);
  transform: translate(-1px,-1px);
  box-shadow: 3px 3px 0 var(--wood-deep);
}
.places-popover .pop-post .thumb {
  flex: 0 0 64px; width: 64px; height: 64px;
  background-size: cover; background-position: center;
  background-color: var(--cream-deep);
  border: 2px solid var(--wood-deep);
  box-shadow: inset 0 0 0 2px var(--cream);
  display: flex; align-items: center; justify-content: center;
}
.places-popover .pop-post .thumb.glyph {
  background-color: var(--cream);
  font-family: "DM Serif Display", serif;
  font-size: 32px; line-height: 1;
  color: var(--copper-deep);
}
.places-popover .pop-post .thumb.glyph.alpha {
  font-family: "Press Start 2P", monospace;
  font-size: 20px;
}
.places-popover .pop-post .pp-body {
  flex: 1; min-width: 0;
  display: flex; flex-direction: column; justify-content: center; gap: 4px;
}
.places-popover .pop-post .pp-date {
  font-family: "Press Start 2P", monospace; font-size: 8px;
  letter-spacing: 0.14em; color: var(--copper-deep);
}
.places-popover .pop-post .pp-title {
  font-family: "DM Serif Display", serif; font-weight: 400;
  font-size: 15px; line-height: 1.2; color: var(--ink);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
}
.places-popover .pop-post .pp-byline {
  font-family: "Klee One", serif; font-size: 11px;
  color: var(--ink-soft);
  display: flex; align-items: center; gap: 6px;
}
.places-popover .pop-post .pp-byline .avi {
  width: 14px; height: 14px;
  background: var(--gold); color: var(--wood-deep);
  font-family: "Press Start 2P", monospace; font-size: 7px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1.5px solid var(--wood-deep);
}

aside.places-rail {
  align-self: start;
  position: sticky; top: 96px;
}
.places-rail-frame {
  background: var(--paper);
  border: 3px solid var(--wood-deep);
  box-shadow: inset 0 0 0 3px var(--cream), 4px 4px 0 var(--wood-deep);
  padding: 14px 10px 10px;
  display: flex; flex-direction: column;
  max-height: calc(100vh - 130px);
}
.places-rail-head {
  text-align: center;
  font-family: "Press Start 2P", monospace; font-size: 8px;
  color: var(--copper-deep); letter-spacing: 0.18em;
  padding-bottom: 10px; border-bottom: 2px dotted var(--line);
  margin-bottom: 8px;
}
.places-list {
  overflow-y: auto; min-height: 0; flex: 1;
  display: flex; flex-direction: column;
  padding: 6px 4px 6px 4px;
  scrollbar-width: thin; scrollbar-color: var(--wood-light) transparent;
}
.place-row {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px;
  background: transparent;
  border: 2px solid transparent;
  cursor: pointer;
  text-align: left; width: 100%;
  font-family: inherit; color: inherit;
  transition: background .12s, border-color .12s;
  margin-bottom: 4px;
}
.place-row:hover {
  background: var(--cream);
  border-color: var(--line);
}
.place-row.active {
  background: var(--paper-warm);
  border-color: var(--wood-deep);
  box-shadow: 2px 2px 0 var(--wood-deep);
}
.place-row .num {
  flex: 0 0 26px;
  width: 26px; height: 26px;
  background: var(--copper);
  color: var(--cream);
  border: 2px solid var(--wood-deep);
  font-family: "Press Start 2P", monospace; font-size: 9px;
  display: inline-flex; align-items: center; justify-content: center;
}
.place-row.active .num { background: var(--gold); color: var(--wood-deep); }
.place-row .pr-body { flex: 1; min-width: 0; }
.place-row .pr-name {
  font-family: "Klee One", serif; font-size: 14px;
  color: var(--ink); line-height: 1.2;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.place-row .pr-sub {
  font-family: "Press Start 2P", monospace; font-size: 7px;
  color: var(--ink-soft); letter-spacing: 0.16em;
  margin-top: 4px;
}
.place-row .pr-sub .dot { color: var(--copper-deep); margin: 0 4px; }
.places-rail-foot {
  text-align: center;
  font-family: "Press Start 2P", monospace; font-size: 8px;
  color: var(--ink-soft); letter-spacing: 0.18em;
  padding-top: 10px; border-top: 2px dotted var(--line); margin-top: 6px;
}
.places-rail-foot .count { color: var(--copper-deep); }

.places-hint {
  margin-top: 14px;
  background: var(--paper-warm);
  border: 2px dashed var(--wood-deep);
  padding: 10px 14px;
  font-family: "Klee One", serif; font-size: 13px;
  color: var(--ink-soft);
  display: flex; align-items: center; gap: 10px;
}
.places-hint .ic {
  font-family: "Press Start 2P", monospace; font-size: 11px;
  color: var(--copper-deep);
}

@media (max-width: 600px) {
  .map-frame { min-height: 460px; }
  .map-canvas { height: 460px; }
  .places-popover { width: min(86vw, 320px); }
  aside.places-rail { position: static; }
  .places-rail-frame { max-height: 360px; }
  .places-head-row { margin-top: 22px; padding: 0 16px; }
  .places-layout { padding: 0 16px 80px; gap: 18px; }
}
