:root {
  --bg: #f7f2ef;          /* nabazabih.com backdrop */
  --ink: #2a2520;
  --ink-soft: #7a7268;
  --line: #e2d9d1;
  --chip-on: #9a8f83;        /* soft warm taupe, not black */
  --tile: rgba(214, 206, 196, 0.22);  /* loading placeholder, close to the page */
  --olive: #a3a985;          /* muted sage so the vine sits back */
  --year: #b3aaa0;           /* years ahead of you */
  --year-on: #857b70;        /* years reached */
  --lb-bg: #141210;
  --display: "Bellefair", "Cormorant Garamond", Georgia, serif;
  --text: "Lato", system-ui, sans-serif;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; overflow-x: clip; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--text);
  font-weight: 300;
  /* images fly in from beyond the viewport edges */
  overflow-x: clip;
}

/* ---------- Pinned bar: year jump + person filters ---------- */
.bar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--bg) 97%, transparent);
}
/* toolbar laid out like the polaroid view's: title, names, favorites, count;
   the view toggle sits in the space kept free on the right */
.toolbar {
  display: flex;
  align-items: center;
  gap: 10px 22px;
  flex-wrap: wrap;
  padding: max(14px, env(safe-area-inset-top)) 104px 6px 28px;
}
.brand {
  margin: 0;
  font-family: "Monsieur La Doulaise", var(--display);
  font-weight: 400;
  font-size: 40px;
  line-height: 1;
  color: var(--chip-on); /* same warm taupe as the selected names */
  white-space: nowrap;
  padding: 4px 0.2em 0 0; /* room for the swashes */
}
.toolbar .filters { padding: 0; align-items: flex-start; min-width: 0; }
.toolbar .chips { justify-content: flex-start; }

.albums {
  display: flex;
  justify-content: center;
  padding: 0 16px;
}
.album-list {
  display: flex;
  gap: 4px 22px;
  overflow-x: auto;
  scrollbar-width: none;
  padding: 4px 2px 10px;
  max-width: 100%;
}
.album-list::-webkit-scrollbar { display: none; }
.album {
  appearance: none;
  flex: none;
  border: 0;
  background: none;
  padding: 4px 0 6px;
  color: var(--ink-soft);
  font: 400 clamp(19px, 2vw, 24px)/1.1 var(--display);
  white-space: nowrap;
  cursor: pointer;
  border-bottom: 1px solid transparent;
  transition: color 0.2s, border-color 0.2s;
}
.album:hover { color: var(--ink); }
.album[aria-current="true"] { color: var(--ink); border-bottom-color: var(--ink); }
@media (max-width: 767px) {
  .albums { justify-content: flex-start; padding: 0 0 6px; }
  .album-list { padding-left: 16px; padding-right: 16px; }
}

/* ---------- Olive vine year bar (public/vine.js) ---------- */
/* same width as the photo grid below it */
.vine-wrap { max-width: 1440px; margin: 0 auto; padding: 0 32px; }
svg.vine { display: block; width: 100%; height: 84px; overflow: visible; margin-bottom: 4px; }
@media (max-width: 599px) {
  svg.vine { height: 56px; margin-bottom: 2px; }
}
.vine path, .vine circle { vector-effect: non-scaling-stroke; }
.v-stem { fill: none; stroke: var(--olive); stroke-width: 1.3; stroke-linecap: round; stroke-linejoin: round; }
.v-rail { fill: none; stroke: var(--olive); stroke-width: 1; opacity: 0.35; }
.v-leaf { fill: var(--olive); }
.v-vein { fill: none; stroke: var(--bg); stroke-width: 0.6; opacity: 0.8; }
/* shoots and leaves grow with scroll position (set from vine.js), no timed animation */
.v-pop > * { transform-box: fill-box; transform-origin: 0 50%; transform: scale(0); }
/* years: a faint dot on the rail ahead of you, gone once the vine reaches it */
.v-year { cursor: pointer; outline: none; }
.v-hit { fill: transparent; }
.v-year text { font-family: var(--display); font-size: 20px; fill: var(--year); transition: fill 0.3s; }
.v-year.past text { fill: var(--year-on); }
.v-year.now text, .v-year:hover text, .v-year:focus-visible text { fill: var(--ink-soft); }
.v-year:focus-visible text { text-decoration: underline; }
.v-dot {
  fill: var(--olive);
  opacity: 0.35;
  transform-box: fill-box;
  transform-origin: center;
  transition: opacity 0.3s, transform 0.35s cubic-bezier(0.3, 1.4, 0.5, 1);
}
/* once the vine has grown past a year its dot goes away; only years ahead show one */
.v-year.grown .v-dot { opacity: 0; }
@media (max-width: 1023px) { .vine-wrap { padding: 0 24px; } }
@media (max-width: 767px) {
  .vine-wrap { padding: 0 12px; }
  .v-year text { font-size: 14px; }
}
@media (prefers-reduced-motion: reduce) {
  .v-dot { transition: none; }
}

/* ---------- Filters ---------- */
.filters {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 4px 16px 0;
}
.chips {
  display: flex;
  flex-wrap: nowrap; /* always one line; scrolls sideways on the narrowest phones */
  justify-content: safe center;
  gap: 8px;
  max-width: 100%;
  overflow-x: auto;
  scrollbar-width: none;
  padding: 2px;
}
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; }
.chip.reset .short { display: none; }
/* favorites */
:root { --heart: #c4857c; }
.chip.fav { display: inline-flex; align-items: center; gap: 6px; }
.chip.fav svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linejoin: round; }
.chip.fav[aria-pressed="true"] { background: var(--heart); border-color: var(--heart); color: #fbf8f5; }
.chip.fav[aria-pressed="true"] svg { fill: currentColor; }
.fav-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 22px;
  height: 22px;
  color: #fff;
  filter: drop-shadow(0 1px 4px rgb(0 0 0 / 0.35));
  pointer-events: none;
}
.fav-badge svg { width: 100%; height: 100%; fill: currentColor; }
.fav-btn {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  flex: none;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: transparent;
  color: var(--ink-soft);
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s, transform 0.2s;
}
.fav-btn:hover { color: var(--heart); border-color: var(--heart); }
.fav-btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linejoin: round; }
.fav-btn[aria-pressed="true"] { color: var(--heart); border-color: var(--heart); }
.fav-btn[aria-pressed="true"] svg { fill: currentColor; animation: fav-pop 0.35s cubic-bezier(0.3, 1.6, 0.5, 1); }
@keyframes fav-pop { from { transform: scale(0.6); } to { transform: scale(1); } }
@media (max-width: 900px) {
  .chips { gap: 6px; }
  .chips .chip { font-size: 12px; letter-spacing: 0.1em; padding: 8px 11px 7px; }
  .chips .chip.reset { padding-left: 10px; padding-right: 10px; }
  .chip.reset .full { display: none; }
  .chip.reset .short { display: inline; letter-spacing: 0; }
}
@media (max-width: 480px) {
  /* scale with the screen so all five names and the ✕ fit on one line */
  .chips { gap: 4px; }
  .chips .chip { font-size: clamp(9px, 2.7vw, 11px); letter-spacing: 0.04em; padding: 6px 1.6vw 5px; }
  .chips .chip.reset, .chips .chip.fav { padding-left: 6px; padding-right: 6px; }
}
@media (max-width: 360px) {
  .chips { gap: 3px; }
  .chips .chip { letter-spacing: 0.02em; padding: 6px 1.15vw 5px; }
  .chips .chip.reset, .chips .chip.fav { padding-left: 5px; padding-right: 5px; }
}
/* phones and small tablets: title on its own line, then the row of names */
@media (max-width: 900px) {
  .toolbar { display: block; padding: max(12px, env(safe-area-inset-top)) 0 4px; }
  .brand { font-size: 32px; padding: 2px 86px 8px 14px; }
  .toolbar .filters { padding: 0 12px; }
  }
.chip {
  appearance: none;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink-soft);
  font: 400 13px/1 var(--display);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 8px 13px 7px;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.25s, color 0.25s, border-color 0.25s;
}
.chip:hover { border-color: var(--ink-soft); }
.chip[aria-pressed="true"] {
  background: var(--chip-on);
  border-color: var(--chip-on);
  color: #fbf8f5;
}

/* ---------- Timeline: one section per album, newest first ---------- */
.gallery {
  /* tiles carry big z-indexes for in-flight overlap; keep them under the bar */
  isolation: isolate;
  max-width: 1440px;
  margin: 0 auto;
  padding: 0 32px;
}
/* virtualized mosaic: tiles are absolutely placed from a precomputed layout */
.gallery { --gap: 32px; }
.mosaic { position: relative; margin-top: 32px; margin-bottom: 80px; }
.year-head {
  display: flex;
  align-items: baseline;
  gap: 18px;
  margin: 0 0 24px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}
.year-head h2 {
  margin: 0;
  font: 400 clamp(44px, 6vw, 80px)/0.9 var(--display);
}
.year-head p {
  margin: 0;
  font-size: 12px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

/* mirrors mfrports' 3/2/1 column masonry */
.year-grid {
  display: grid;
  grid-template-columns: repeat(var(--cols, 3), minmax(0, 1fr));
  gap: 32px;
  align-items: start;
}
.sentinel { height: 1px; }
.col {
  display: flex;
  flex-direction: column;
  gap: 32px;
  min-width: 0;
}
.tile {
  position: absolute;
  display: block;
  padding: 0;
  border: 0;
  border-radius: 16px;
  background: transparent; /* no placeholder box: the photo simply arrives */
  cursor: zoom-in;
}
.tile .shot {
  position: absolute;
  inset: 0;
  will-change: transform;
}
/* the year, written on the first photo of each year like the date on a print */
.stamp {
  position: absolute;
  left: 18px;
  bottom: 12px;
  color: #fff;
  font: 400 clamp(30px, 3.4vw, 46px)/1 var(--display);
  letter-spacing: 0.01em;
  text-shadow: 0 1px 14px rgb(0 0 0 / 0.45), 0 0 2px rgb(0 0 0 / 0.25);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s;
}
.tile img.loaded + .stamp { opacity: 1; }
.tile img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 16px;
  opacity: 0;
  transition: opacity 0.2s;
  -webkit-user-drag: none;
}
.tile img.loaded { opacity: 1; }
.tile:focus-visible { outline: 2px solid var(--ink); outline-offset: 4px; }

@media (max-width: 1023px) {
  .gallery { padding: 0 24px; --gap: 24px; }
}
@media (max-width: 767px) {
  .gallery { padding: 0 12px; --gap: 10px; }
  .tile, .tile img { border-radius: 10px; }
  .year { padding-top: 28px; }
  .year-head { gap: 12px; margin-bottom: 16px; }
}

.gallery.empty { display: block; }
.empty-msg {
  margin: 48px 0;
  text-align: center;
  font: 400 24px/1.3 var(--display);
  color: var(--ink-soft);
}


/* ---------- Focus view: the photo enlarged in the middle, a sideways carousel ---------- */
.focus {
  position: fixed;
  inset: 0;
  z-index: 100;
  overscroll-behavior: contain;
}
.focus[hidden] { display: none; }
.fx-veil {
  position: absolute;
  inset: 0;
  background: var(--bg); /* solid, so nothing behind the photo view shows through */
}
.fx-track {
  position: absolute;
  inset: 0;
  z-index: 1; /* keeps the slides' own stacking inside, under the buttons */
  touch-action: none; /* the carousel handles horizontal drags itself */
  cursor: grab;
}
.fx-track:active { cursor: grabbing; }
.fx-slide {
  position: absolute;
  left: 50%;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 18px 50px rgb(60 48 36 / 0.18);
  background: var(--bg); /* never a white box while a photo loads */
  will-change: transform;
  user-select: none;
}
.fx-slide img { display: block; width: 100%; height: 100%; object-fit: cover; -webkit-user-drag: none; pointer-events: none; }

.fx-btn {
  position: absolute;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  color: var(--ink-soft);
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s;
}
.fx-btn:hover { color: var(--ink); border-color: var(--ink-soft); }
.fx-btn svg, .lb-download svg {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.fx-btn svg { width: 20px; height: 20px; }
.fx-close { top: max(14px, env(safe-area-inset-top)); right: 16px; }
.fx-prev, .fx-next { top: calc(50% - 60px); }
.fx-prev { left: 18px; }
.fx-next { right: 18px; }

.fx-info {
  position: absolute;
  z-index: 2;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 0 24px max(18px, env(safe-area-inset-bottom));
}
/* versions sit in the bar between the names and the download button */
.lb-versions { display: flex; justify-content: center; gap: 10px; flex: 1 1 auto; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.lb-versions[hidden] { display: none; }
.version {
  appearance: none;
  flex: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--ink-soft);
  font: 300 10px/1 var(--text);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  cursor: pointer;
}
.version img { height: 34px; width: auto; border-radius: 4px; outline: 1px solid transparent; outline-offset: 2px; opacity: 0.55; transition: opacity 0.2s, outline-color 0.2s; }
.version:hover img { opacity: 0.85; }
.version[aria-pressed="true"] { color: var(--ink); }
.version[aria-pressed="true"] img { opacity: 1; outline-color: var(--chip-on); }

.lb-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 24px; max-width: 1440px; margin: 0 auto; min-height: 56px; }
.lb-meta { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.lb-album { margin: 0; font-size: 11px; letter-spacing: 0.22em; text-transform: uppercase; color: var(--ink-soft); }
.lb-people { display: flex; flex-wrap: wrap; gap: 4px 14px; font: 400 17px/1.2 var(--display); letter-spacing: 0.12em; text-transform: uppercase; color: var(--chip-on); }
.lb-people .tag { appearance: none; background: none; border: 0; padding: 0; font: inherit; letter-spacing: inherit; color: inherit; }
.lb-people.editing .tag { cursor: pointer; border: 1px solid var(--line); border-radius: 999px; padding: 6px 12px 5px; opacity: 0.45; }
.lb-people.editing .tag.on { opacity: 1; background: color-mix(in srgb, var(--chip-on) 15%, transparent); }
.lb-actions { display: flex; align-items: center; gap: 18px; }
.lb-index { font-size: 12px; letter-spacing: 0.2em; color: var(--ink-soft); }
.lb-download {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 11px 18px;
  border-radius: 999px;
  background: var(--chip-on);
  color: #fbf8f5;
  text-decoration: none;
  font-size: 14px;
  font-weight: 400;
  letter-spacing: 0.06em;
  transition: transform 0.2s;
}
.lb-download:hover { transform: translateY(-1px); }
.lb-download svg { width: 18px; height: 18px; }

@media (max-width: 767px) {
  .fx-prev, .fx-next { display: none; }
  .fx-info { padding: 0 14px max(14px, env(safe-area-inset-bottom)); }
  .lb-actions { width: 100%; }
  .lb-download { flex: 1; justify-content: center; }
  .lb-people { font-size: 15px; }
  /* fixed two-row bar so the photo never shifts or collides when versions appear:
     year + names | version previews, then heart + Download */
  .lb-bar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas: "meta versions" "actions actions";
    gap: 10px 12px;
    align-items: center;
  }
  .lb-meta { grid-area: meta; min-height: 38px; justify-content: center; }
  .lb-versions { grid-area: versions; height: 38px; align-items: center; gap: 6px; }
  .lb-versions[hidden] { display: flex; visibility: hidden; }
  .version { font-size: 0; gap: 0; }
  .version img { height: 34px; }
  .lb-actions { grid-area: actions; }
  .lb-index { display: none; }
}

/* phone turned sideways: controls float as small pills over the photo's bottom edge */
.focus.short .fx-prev, .focus.short .fx-next, .focus.short .lb-index, .focus.short .lb-album { display: none; }
.focus.short .fx-close { top: 10px; right: 10px; width: 40px; height: 40px; }
.focus.short .fx-info { padding: 0 12px 10px; pointer-events: none; }
.focus.short .lb-bar { min-height: 0; flex-wrap: nowrap; align-items: flex-end; }
.focus.short .lb-meta,
.focus.short .lb-versions,
.focus.short .lb-actions { pointer-events: auto; }
.focus.short .lb-meta {
  flex: 0 1 auto;
  padding: 6px 12px 5px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--bg) 86%, transparent);
}
.focus.short .lb-people { font-size: 12px; gap: 2px 10px; }
.focus.short .lb-versions { flex: 0 1 auto; padding: 4px 8px; border-radius: 12px; background: color-mix(in srgb, var(--bg) 86%, transparent); }
.focus.short .version img { height: 26px; }
.focus.short .version { font-size: 8px; gap: 3px; }
.focus.short .lb-actions { width: auto; gap: 8px; }
.focus.short .fav-btn { width: 38px; height: 38px; background: color-mix(in srgb, var(--bg) 86%, transparent); }
.focus.short .lb-download { flex: none; padding: 9px 14px; font-size: 13px; }

@media (prefers-reduced-motion: reduce) {
  .tile img { transition: none; }
}


/* ---------- View toggle (top right): mosaic ⇄ polaroids ---------- */
.view-toggle {
  position: fixed; z-index: 8000; top: max(16px, env(safe-area-inset-top)); right: 16px;
  width: 66px; height: 34px; padding: 0; border-radius: 999px; cursor: pointer;
  display: flex; align-items: center; justify-content: space-between; padding: 0 9px;
  background: #ffffffb0; border: 1px solid #d9d0c6; color: var(--chip-on);
  transition: background .3s, border-color .3s, color .3s;
}
.view-toggle svg { position: relative; z-index: 1; width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.6; transition: color .3s; }
.view-toggle .vt-grid { color: #fff; }
.view-toggle .vt-knob {
  position: absolute; top: 3px; left: 3px; width: 28px; height: 26px; border-radius: 999px;
  background: var(--chip-on); transition: transform .35s cubic-bezier(.3, 1.3, .5, 1), background .3s;
}
.view-toggle[aria-pressed="true"] { background: #ffffff14; border-color: #ffffff2e; color: #9b9184; }
.view-toggle[aria-pressed="true"] .vt-knob { transform: translateX(32px); background: #f1ebe1; }
.view-toggle[aria-pressed="true"] .vt-grid { color: #9b9184; }
.view-toggle[aria-pressed="true"] .vt-pol { color: #1a1612; }
.view-toggle:focus-visible { outline: 2px solid var(--chip-on); outline-offset: 3px; }

/* while polaroids are up, the mosaic page steps aside */
html.pd-on body > :not(#pd):not(.view-toggle) { display: none !important; }
html.pd-on, html.pd-on body { background: #14110f; }

/* ---------- Polaroid view (polaroid.js) ---------- */
#pd {
  --ink: #f1ebe1; --muted: #9b9184; --paper: #f6f2ea; --accent: #ff5a4e; --rail-w: 64px;
  color: var(--ink); font-family: "Instrument Sans", system-ui, sans-serif;
  overscroll-behavior: none; -webkit-tap-highlight-color: transparent;
}
#pd[hidden] { display: none; }
#pd-track { width: 1px; pointer-events: none; }
#pd-stage {
  position: fixed; inset: 0; overflow: hidden;
  perspective: 1100px; perspective-origin: calc((100% - var(--rail-w)) / 2) 45%;
  background: radial-gradient(120% 80% at 50% 40%, #2a221c 0%, #17130f 55%, #0c0a08 100%);
}
#pd-stage::after { /* film grain */
  content: ""; position: absolute; inset: -50%; pointer-events: none; z-index: 5000;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/></filter><rect width='100%' height='100%' filter='url(%23n)' opacity='.09'/></svg>");
  animation: pd-grain 1s steps(4) infinite;
}
@keyframes pd-grain { 0%{transform:translate(0,0)} 25%{transform:translate(-3%,2%)} 50%{transform:translate(2%,-3%)} 75%{transform:translate(-2%,-1%)} 100%{transform:translate(0,0)} }
#pd-world { position: absolute; left: calc((100% - var(--rail-w)) / 2); top: 50%; transform-style: preserve-3d; }

.pd-pol {
  position: absolute; left: 0; top: 0;
  width: var(--w); margin-left: calc(var(--w) / -2); margin-top: calc(var(--w) * -0.6);
  will-change: transform, opacity; cursor: pointer;
}
.pd-pol .pd-inner {
  position: relative; background: var(--paper); padding: 7% 7% 0 7%; border-radius: 2px;
  box-shadow: 0 1px 0 rgba(255,255,255,.6) inset, 0 18px 40px rgba(0,0,0,.55), 0 4px 10px rgba(0,0,0,.35);
  transform: translateY(80px) rotate(var(--in-rot)) scale(.7); opacity: 0;
  transition: transform 1.1s cubic-bezier(.2,.9,.25,1.15), opacity .5s ease, box-shadow .3s;
}
.pd-pol.in .pd-inner { transform: none; opacity: 1; }
.pd-pol:hover .pd-inner { box-shadow: 0 1px 0 rgba(255,255,255,.6) inset, 0 28px 60px rgba(0,0,0,.6), 0 0 0 2px rgba(255,255,255,.25); }
.pd-pol .pd-photo { position: relative; aspect-ratio: 1 / 1; overflow: hidden; background: #2b2723; }
.pd-pol img {
  /* square crop kept near the top of tall photos, where the faces are */
  width: 100%; height: 100%; object-fit: cover; object-position: 50% 15%; display: block;
  filter: brightness(1.9) contrast(.45) sepia(.7) blur(3px); /* "developing" */
  transition: filter 2.4s ease .25s;
}
.pd-pol.in img { filter: none; }
.pd-pol.instant .pd-inner, .pd-pol.instant img { transition: none; }
.pd-pol .pd-cap {
  display: flex; align-items: center; justify-content: space-between; gap: 6px;
  height: calc(var(--w) * 0.24);
  font-family: "Caveat", cursive; color: #2d2823; font-size: calc(var(--w) * 0.105); line-height: 1;
}
.pd-pol .pd-cap span { white-space: nowrap; overflow: hidden; min-width: 0; flex: 1; padding-right: 2px; }
#pd .pd-heart {
  flex: none; border: 0; background: none; padding: 4px; cursor: pointer; line-height: 0;
  color: #b9b0a4; transition: transform .2s, color .2s;
}
#pd .pd-heart svg { width: calc(var(--w) * 0.09); height: calc(var(--w) * 0.09); min-width: 14px; min-height: 14px; }
#pd .pd-heart:hover { transform: scale(1.15); }
#pd .pd-heart.on { color: var(--accent); }
#pd .pd-heart.pop { animation: pd-pop .45s cubic-bezier(.3,1.6,.5,1); }
@keyframes pd-pop { 0%{transform:scale(1)} 40%{transform:scale(1.6)} 100%{transform:scale(1)} }
.pd-pol.fav .pd-inner::after { /* tape strip on favorites */
  content: ""; position: absolute; left: 50%; top: -10px; width: 34%; height: 18px; margin-left: -17%;
  background: rgba(255, 220, 160, .55); transform: rotate(-3deg); box-shadow: 0 1px 2px rgba(0,0,0,.15);
}
.pd-pol.hide { pointer-events: none; }

#pd-head {
  position: fixed; z-index: 6000; top: 0; left: 0; right: calc(var(--rail-w) + 36px);
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  padding: max(14px, env(safe-area-inset-top)) 18px 14px 20px;
  background: linear-gradient(#0c0a08e6, #0c0a0800);
}
.pd-brand { font-family: "Caveat", cursive; font-size: 30px; line-height: 1; margin-right: 6px; }
.pd-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.pd-chip {
  font: 500 13px/1 "Instrument Sans", system-ui, sans-serif; color: var(--ink); background: #ffffff10; border: 1px solid #ffffff22;
  padding: 8px 12px; border-radius: 999px; cursor: pointer; transition: background .2s, border-color .2s, color .2s;
}
.pd-chip:hover { background: #ffffff1c; }
.pd-chip.on { background: var(--ink); color: #1a1612; border-color: var(--ink); }
.pd-chip.fav.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.pd-chip-row { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.pd-sep { width: 1px; height: 22px; background: #ffffff22; }

#pd-rail {
  position: fixed; z-index: 6000; top: 0; right: 0; bottom: 0; width: var(--rail-w);
  padding: 90px 0 40px; user-select: none; touch-action: none; cursor: ns-resize;
}
#pd-rail .pd-line { position: absolute; top: 90px; bottom: 40px; right: 18px; width: 1px; background: #ffffff1f; }
.pd-yr {
  position: absolute; right: 26px; transform: translateY(-50%);
  font: 600 11px/1 "Instrument Sans", system-ui, sans-serif; letter-spacing: .04em; color: var(--muted); transition: color .2s, transform .2s;
}
.pd-yr::after { content: ""; position: absolute; right: -10px; top: 50%; width: 5px; height: 1px; background: #ffffff40; }
.pd-yr.now { color: var(--ink); transform: translateY(-50%) scale(1.15); }
#pd-thumb {
  position: absolute; right: 12px; width: 13px; height: 13px; margin-top: -6px; border-radius: 50%;
  background: var(--ink); box-shadow: 0 0 0 4px #f1ebe126;
}
#pd-bubble {
  position: absolute; right: 36px; margin-top: -16px; padding: 7px 12px; border-radius: 16px 16px 4px 16px;
  background: var(--ink); color: #1a1612; font: 600 14px/1.1 "Instrument Sans", system-ui, sans-serif;
  opacity: 0; transition: opacity .25s; pointer-events: none; white-space: nowrap;
}
#pd-rail.active #pd-bubble, #pd-rail:hover #pd-bubble { opacity: 1; }

#pd-hint {
  position: fixed; z-index: 6000; left: 50%; bottom: max(22px, env(safe-area-inset-bottom)); transform: translateX(-50%);
  font-size: 12px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted);
  transition: opacity .6s; pointer-events: none; text-align: center;
}
#pd-empty { position: fixed; inset: 0; display: none; place-items: center; z-index: 5500; font-family: "Caveat", cursive; font-size: 34px; color: var(--muted); pointer-events: none; }
#pd.none #pd-empty { display: grid; }

#pd-lb { position: fixed; inset: 0; z-index: 9000; display: none; }
#pd-lb.open { display: block; }
#pd-lb .pd-scrim { position: absolute; inset: 0; background: #0b0907cc; backdrop-filter: blur(6px); opacity: 0; transition: opacity .35s; }
#pd-lb.show .pd-scrim { opacity: 1; }
#pd-lb .pd-card {
  position: absolute; left: 0; top: 0; transform-origin: 0 0;
  background: var(--paper); padding: 22px 22px 0; border-radius: 3px; box-shadow: 0 40px 90px rgba(0,0,0,.6);
  transition: transform .55s cubic-bezier(.2,.85,.25,1);
}
#pd-lb .pd-card img { display: block; width: min(76vw, 64vh, 620px); aspect-ratio: 1/1; object-fit: cover; object-position: 50% 15%; background: #2b2723; }
#pd-lb .pd-meta { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 2px 18px; color: #2d2823; }
#pd-lb .pd-t { font-family: "Caveat", cursive; font-size: 34px; line-height: 1; }
#pd-lb .pd-p { font-size: 12px; color: #7d7468; letter-spacing: .06em; text-transform: uppercase; margin-top: 6px; }
#pd-lb .pd-acts { display: flex; align-items: center; gap: 10px; }
#pd-lb .pd-dl {
  font: 500 12px/1 "Instrument Sans", system-ui, sans-serif; letter-spacing: .06em; text-transform: uppercase;
  color: #2d2823; text-decoration: none; border: 1px solid #2d282333; border-radius: 999px; padding: 8px 12px;
}
#pd-lb .pd-dl:hover { background: #2d28230d; }
#pd-lb .pd-heart svg { width: 28px; height: 28px; }
#pd-lb .pd-x {
  position: absolute; top: 16px; left: 18px; z-index: 2; background: #ffffff14; border: 1px solid #ffffff2a; color: var(--ink);
  border-radius: 999px; padding: 8px 14px; font: 500 13px "Instrument Sans", system-ui, sans-serif; cursor: pointer;
}

@media (max-width: 640px) {
  #pd { --rail-w: 46px; }
  /* title on its own line, then one row of chips swiped sideways */
  #pd-head { display: block; right: 0; padding-left: 0; padding-right: 0; }
  .pd-brand { font-size: 24px; padding: 0 86px 10px 12px; }
  .pd-chip-row { overflow-x: auto; scrollbar-width: none; padding: 0 12px; gap: 6px; }
  .pd-chip-row::-webkit-scrollbar { display: none; }
  .pd-chip-row, .pd-chips { flex-wrap: nowrap; }
  .pd-chip { flex: none; }
  .pd-chip { padding: 7px 10px; font-size: 12px; }
  .pd-sep,   .pd-yr { right: 20px; font-size: 10px; }
  #pd-rail .pd-line { right: 12px; }
  #pd-thumb { right: 6px; }
  #pd-lb .pd-card { padding: 14px 14px 0; }
  .view-toggle { right: 10px; top: max(12px, env(safe-area-inset-top)); }
}
@media (prefers-reduced-motion: reduce) {
  .pd-pol .pd-inner, .pd-pol img { transition: none; }
  #pd-stage::after { animation: none; }
}
