/* ============================================================
   WAXCAVATION — "The Specimen Cabinet"
   Tropical naturalist's field journal: herbarium-white paper,
   watercolour pastels, rounded + hand-lettered type.
   ============================================================ */

:root {
  color-scheme: light;

  --paper:      #FEFDFA;   /* the ground — nearly white */
  --paper-deep: #F8F5EE;   /* player, deeper panels */
  --card:       #FCFAF4;   /* specimen cards, event rows */
  --ink:        #3B3A30;   /* text */
  --ink-soft:   #857F66;   /* secondary text */
  --lagoon:     #A9D8CE;   /* primary wash */
  --palm:       #C7DAAB;   /* fronds, rules */
  --papaya:     #F8DCB6;   /* tags, data warmth */
  --clay:       #E5A48E;   /* the one pop — pins, W, active */
  --line:       #A6A08A;   /* pencil-grey line */
  --teal-text:  #5D847B;   /* readable teal for small labels */
  --lagoon-soft: color-mix(in srgb, var(--lagoon) 16%, transparent);
  --shadow:     60 54 36;

  --maxw: 1120px;
  --player-h: 92px;

  --wordmark: "Caveat Brush", "Caveat", cursive;
  --sans: "Baloo 2", ui-rounded, "Segoe UI", system-ui, sans-serif;
  --body: "Nunito", ui-sans-serif, system-ui, sans-serif;
  --hand: "Caveat", "Segoe Script", cursive;

  /* faint cold-press watercolour-paper grain */
  --paper-tex: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='p'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.62' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3CfeComponentTransfer%3E%3CfeFuncR type='linear' slope='0.22' intercept='0.78'/%3E%3CfeFuncG type='linear' slope='0.22' intercept='0.78'/%3E%3CfeFuncB type='linear' slope='0.22' intercept='0.78'/%3E%3CfeFuncA type='linear' slope='0' intercept='1'/%3E%3C/feComponentTransfer%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23p)'/%3E%3C/svg%3E");
  /* brush-stroke underline (used as a mask, colour comes from a token) */
  --brush-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='14' preserveAspectRatio='none'%3E%3Cpath d='M4 9 Q 34 3 66 8 T 132 7 T 216 6' fill='none' stroke='%23000' stroke-width='8' stroke-linecap='round'/%3E%3C/svg%3E");
  /* pressed-frond rule beside the year tabs */
  --frond-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='20' preserveAspectRatio='none'%3E%3Cpath d='M4 10 q 140 -5 292 0' fill='none' stroke='%23000' stroke-width='2.4' stroke-linecap='round'/%3E%3Cg fill='%23000'%3E%3Cpath d='M46 10 q 7 -12 20 -14 q -4 12 -12 17 z'/%3E%3Cpath d='M92 10 q 7 11 20 14 q -4 -12 -12 -17 z'/%3E%3Cpath d='M140 10 q 7 -12 20 -14 q -4 12 -12 17 z'/%3E%3Cpath d='M188 10 q 7 11 20 14 q -4 -12 -12 -17 z'/%3E%3Cpath d='M236 10 q 7 -12 20 -14 q -4 12 -12 17 z'/%3E%3C/g%3E%3C/svg%3E");
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --paper:      #2E332A;
    --paper-deep: #272C24;
    --card:       #363C31;
    --ink:        #F3EEDB;
    --ink-soft:   #B4AF93;
    --lagoon:     #9BD0C4;
    --palm:       #BFD09B;
    --papaya:     #F2CD9E;
    --clay:       #E9AA90;
    --line:       #8E8F72;
    --teal-text:  #A6DACF;
    --shadow:     0 0 0;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --paper:      #2E332A;
  --paper-deep: #272C24;
  --card:       #363C31;
  --ink:        #F3EEDB;
  --ink-soft:   #B4AF93;
  --lagoon:     #9BD0C4;
  --palm:       #BFD09B;
  --papaya:     #F2CD9E;
  --clay:       #E9AA90;
  --line:       #8E8F72;
  --teal-text:  #A6DACF;
  --shadow:     0 0 0;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--body);
  font-size: 17px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  padding-bottom: calc(var(--player-h) + 2rem);
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image: var(--paper-tex);
  background-size: 180px 180px;
  opacity: .26;
  mix-blend-mode: multiply;
  pointer-events: none;
  z-index: 40;
}
:root[data-theme="dark"] body::before,
:root:not([data-theme="light"]) body::before { mix-blend-mode: overlay; opacity: .3; }

img { display: block; max-width: 100%; }

a { color: var(--clay); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }

code {
  font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: .85em;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 0 .3em;
}

h1, h2, h3 {
  font-family: var(--sans);
  font-weight: 700;
  line-height: 1.05;
  margin: 0;
  text-wrap: balance;
  letter-spacing: -0.01em;
}

.muted { color: var(--ink-soft); }
.mono { font-variant-numeric: tabular-nums; }

/* ---------- Header / nav ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .4rem 1.3rem;
  justify-content: space-between;
  padding: .7rem clamp(1rem, 4vw, 2rem);
  background: color-mix(in srgb, var(--paper) 86%, transparent);
  backdrop-filter: blur(7px);
  -webkit-backdrop-filter: blur(7px);
  border-bottom: 1.5px solid color-mix(in srgb, var(--line) 55%, transparent);
}

.wordmark {
  display: flex;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 0 .04em;
  font-family: var(--wordmark);
  font-weight: 400;
  font-size: 2rem;
  line-height: .82;
  color: var(--ink);
}
.wordmark:hover { text-decoration: none; }
.wm-w {
  font-size: 1.5em;
  line-height: .62;
  color: var(--clay);
  display: inline-block;
  transform: rotate(-6deg);
  margin-right: .01em;
  text-shadow: 2px 4px 0 color-mix(in srgb, var(--lagoon) 40%, transparent);
}
.wm-sub {
  flex-basis: 100%;
  margin-top: .1rem;
  font-family: var(--hand);
  font-weight: 600;
  font-size: .95rem;
  line-height: 1;
  color: var(--ink-soft);
}

.site-header nav { display: flex; gap: .35rem; flex-wrap: wrap; }
.site-header nav a {
  font-family: var(--sans);
  font-weight: 600;
  font-size: .9rem;
  color: var(--ink);
  border-radius: 999px;
  padding: .3rem .85rem;
}
.site-header nav a:hover { text-decoration: none; background: var(--lagoon-soft); }
.site-header nav a[aria-current="page"] { background: var(--clay); color: var(--ink); }

.theme-toggle {
  flex: none;
  width: 34px; height: 34px;
  border-radius: 999px;
  border: 1.5px solid var(--line);
  background: var(--card);
  color: var(--ink);
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
}
.theme-toggle:hover { background: var(--lagoon-soft); }

/* focus visibility */
a:focus-visible, button:focus-visible, input:focus-visible {
  outline: 2.5px solid var(--clay);
  outline-offset: 2px;
  border-radius: 4px;
}

/* ---------- Main / views ---------- */

main {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: clamp(1.75rem, 5vw, 3.25rem) clamp(1rem, 4vw, 2rem);
}

.view-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 1rem 1.5rem;
  flex-wrap: wrap;
  margin-bottom: 1.6rem;
}
.view h1 {
  font-size: clamp(2.1rem, 6.5vw, 3.4rem);
  font-weight: 800;
}
.view h1::after {
  content: "";
  display: block;
  width: min(300px, 70%);
  height: 12px;
  margin-top: .3rem;
  background: var(--clay);
  -webkit-mask: var(--brush-mask) no-repeat left center / 100% 100%;
  mask: var(--brush-mask) no-repeat left center / 100% 100%;
  opacity: .5;
  filter: blur(.4px);
}
h2 {
  font-size: 1.3rem;
  font-weight: 700;
  margin: 2.4rem 0 1rem;
  color: var(--ink);
}
h2::after {
  content: "";
  display: block;
  width: 120px;
  height: 9px;
  margin-top: .25rem;
  background: var(--lagoon);
  -webkit-mask: var(--brush-mask) no-repeat left center / 100% 100%;
  mask: var(--brush-mask) no-repeat left center / 100% 100%;
  opacity: .55;
}

.crate-label {
  margin: .5rem 0 0;
  font-family: var(--hand);
  font-weight: 600;
  font-size: 1.15rem;
  color: var(--ink-soft);
}
#music-status { color: var(--ink-soft); font-style: italic; }

.btn {
  font-family: var(--sans);
  font-weight: 600;
  font-size: .9rem;
  background: var(--card);
  color: var(--ink);
  border: 1.5px solid var(--line);
  border-radius: 999px;
  padding: .5rem 1.15rem;
  cursor: pointer;
}
.btn:hover:not(:disabled) { background: var(--clay); color: var(--ink); }
.btn:disabled { opacity: .4; cursor: not-allowed; }

/* ---------- Music: the pinboard ---------- */
/* Timeless catalogue — video + photo cards thrown on a table / pinned to
   a board. Each card gets a loose tilt + vertical drop from app.js;
   hover straightens and lifts it. */

.flipfile-stage { position: relative; }

.flipfile {
  list-style: none;
  margin: 0;
  padding: .5rem 0 2rem;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: flex-start;
  gap: clamp(.7rem, 2.6vw, 1.7rem);
}
.flipfile:empty { display: none; }

/* shared card frame (video + photo) */
.rec,
.rec-photo {
  position: relative;
  width: clamp(178px, 44vw, 232px);
  background: var(--paper);
  border-radius: 3px;
  padding: 9px 9px 8px;
  box-shadow: 0 12px 24px -18px rgb(var(--shadow) / .45);
  transition: transform .16s ease, box-shadow .16s ease;
}
.rec:hover, .rec:focus-within,
.rec-photo:hover, .rec-photo:focus-within {
  rotate: 0deg !important;
  transform: translateY(-7px) scale(1.04);
  box-shadow: 0 22px 38px -18px rgb(var(--shadow) / .5);
  z-index: 30 !important;
}
.rec.is-playing { background: color-mix(in srgb, var(--lagoon) 26%, var(--paper)); }

/* the pushpin */
.pin {
  position: absolute;
  top: -8px; left: 50%;
  width: 15px; height: 15px;
  border-radius: 50%;
  transform: translateX(-50%);
  background: radial-gradient(circle at 34% 32%, #ffffffcc, transparent 46%), var(--clay);
  box-shadow: 0 5px 7px -3px rgb(var(--shadow) / .55);
  z-index: 4;
}
.rec:nth-child(3n) .pin,
.rec-photo:nth-child(3n) .pin {
  background: radial-gradient(circle at 34% 32%, #ffffffcc, transparent 46%), var(--lagoon);
}
.rec:nth-child(3n+1) .pin {
  background: radial-gradient(circle at 34% 32%, #ffffffcc, transparent 46%), var(--papaya);
}

/* video card */
.rec-face {
  display: flex;
  flex-direction: column;
  width: 100%;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.rec .thumb {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 2px;
  background-size: cover;
  background-position: center;
  background-color: var(--lagoon);
}
.rec-play {
  position: absolute;
  right: 6px; bottom: 6px;
  width: 30px; height: 30px;
  display: grid;
  place-items: center;
  border: 2px solid var(--paper);
  border-radius: 50%;
  background: color-mix(in srgb, var(--ink) 52%, transparent);
  color: var(--paper);
  font-size: .66rem;
  transition: background .14s ease, transform .14s ease;
}
.rec:hover .rec-play,
.rec:focus-within .rec-play,
.rec.is-playing .rec-play { background: var(--clay); color: var(--ink); transform: scale(1.12); }

.rec-body { padding: .55rem .3rem .15rem; display: flex; flex-direction: column; gap: .22rem; }
.rec .title {
  font-family: var(--sans);
  font-weight: 600;
  font-size: .88rem;
  line-height: 1.18;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.rec-cat {
  font-family: var(--body);
  font-weight: 700;
  font-size: .68rem;
  letter-spacing: .05em;
  font-variant-numeric: tabular-nums;
  color: var(--ink-soft);
}
.rec-yt {
  display: block;
  margin: .35rem .3rem 0;
  font-family: var(--body);
  font-weight: 700;
  font-size: .66rem;
  letter-spacing: .04em;
  color: var(--ink-soft);
}
.rec-yt:hover { color: var(--clay); }

/* photo card — the whole thing opens a lightbox on click */
.rec-photo-btn {
  display: block;
  width: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  color: inherit;
  text-align: center;
  cursor: zoom-in;
  border-radius: 2px;
  overflow: hidden;
}
.rec-photo img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 2px;
}
.rec-photo .rec-cap {
  display: block;
  padding: .45rem .3rem .1rem;
  text-align: center;
  color: var(--ink-soft);
}
.rec-photo .cap-date {
  display: block;
  font-family: var(--hand);
  font-weight: 600;
  font-size: 1.02rem;
  line-height: 1.15;
}
.rec-photo .cap-note {
  display: block;
  margin-top: .12rem;
  font-family: var(--body);
  font-weight: 700;
  font-size: .62rem;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--ink-soft);
  opacity: .85;
}

.polaroid { display: none; }

@media (max-width: 460px) {
  .rec, .rec-photo { width: clamp(148px, 46vw, 190px); }
}

/* ---------- Shows ---------- */

.shows-note {
  max-width: 60ch;
  margin: 0 0 1.4rem;
  font-family: var(--hand);
  font-weight: 600;
  font-size: 1.22rem;
  line-height: 1.4;
  color: var(--ink-soft);
}
.shows-note a { font-family: var(--body); font-weight: 700; font-size: .9rem; }

.events { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .55rem; }
.events li {
  display: grid;
  grid-template-columns: 6.5rem 1fr auto;
  gap: 1rem;
  align-items: baseline;
  padding: .9rem 1.1rem;
  background: var(--card);
  border: 1.5px solid var(--line);
  border-radius: 12px;
}
.events li.empty {
  display: block;
  background: none;
  border: 0;
  padding: .4rem 0;
  font-family: var(--hand);
  font-size: 1.15rem;
  color: var(--ink-soft);
}
.events .date { font-family: var(--sans); font-weight: 700; font-variant-numeric: tabular-nums; }
.events .loc { font-family: var(--sans); font-weight: 600; }
.events .country { color: var(--ink-soft); font-family: var(--body); font-weight: 700; font-size: .78em; }
.events .act a { font-family: var(--body); font-weight: 700; font-size: .78rem; }
#shows-past { opacity: .62; }

/* ---------- About ---------- */

.prose { max-width: 62ch; font-size: 1.06rem; }
.prose p { margin: 0 0 1rem; }
.prose em { font-family: var(--hand); font-weight: 600; font-size: 1.15em; font-style: normal; }

.contact a {
  font-family: var(--wordmark);
  font-weight: 400;
  font-size: clamp(1.5rem, 5.5vw, 2.6rem);
  color: var(--ink);
  word-break: break-word;
}
.contact a:hover { color: var(--clay); text-decoration: none; }

.links { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: .7rem; }
.links a {
  font-family: var(--sans);
  font-weight: 600;
  font-size: .88rem;
  color: var(--ink);
  border: 1.5px solid var(--line);
  border-radius: 999px;
  padding: .35rem .95rem;
}
.links a:hover { text-decoration: none; background: var(--lagoon-soft); }

/* ---------- Footer ---------- */

.site-footer {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 1.8rem clamp(1rem, 4vw, 2rem);
  border-top: 1.5px dashed color-mix(in srgb, var(--line) 50%, transparent);
  font-size: .8rem;
  color: var(--ink-soft);
}

/* ---------- Persistent player — the field radio ---------- */

.player {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  height: var(--player-h);
  z-index: 30;
  background: var(--paper-deep);
  color: var(--ink);
  border-top: 1.5px solid var(--line);
  box-shadow: 0 -12px 34px -22px rgb(var(--shadow) / .5);
}

/* tropical sound system parked on the left of the bar (behind the rickshaw) */
.sound-system {
  position: absolute;
  left: -10px;
  bottom: calc(100% - 14px);
  width: clamp(88px, 14vw, 134px);
  z-index: 0;
  pointer-events: none;
  filter: drop-shadow(0 8px 8px rgb(var(--shadow) / .28));
}
.sound-system img { display: block; width: 100%; height: auto; }

/* rickshaw riding the top edge (positioned by app.js) — passes in front */
.road-rider {
  position: absolute;
  left: 0;
  bottom: calc(100% - 4px);
  width: 60px;
  height: 60px;
  z-index: 2;
  pointer-events: none;
  will-change: transform;
  filter: drop-shadow(0 6px 6px rgb(var(--shadow) / .3));
}
.road-rider img {
  display: block;
  width: 100%; height: 100%;
  object-fit: contain;
  transform-origin: center;
  transition: transform .24s ease;   /* the direction flip, animated */
}
.road-rider--wide { width: 108px; height: 80px; bottom: calc(100% + 2px); }
@media (max-width: 640px) {
  .road-rider { width: 46px; height: 46px; }
  .road-rider--wide { width: 82px; height: 60px; }
}
@media (max-width: 560px) { .sound-system { display: none; } }

/* ---------- daylight: noon at the top, sunset at the bottom ---------- */
.sky-tint {
  position: fixed;
  inset: 0;
  z-index: 34;
  pointer-events: none;
  mix-blend-mode: multiply;
  opacity: 0;
}
/* the sun sits behind the content & the player (so it can set behind
   the sound system) but in front of the leaf backdrop */
.sun {
  position: fixed;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  mix-blend-mode: multiply;   /* warm pool on the pale ground */
}
:root[data-theme="dark"] .sun,
:root:not([data-theme="light"]) .sun { mix-blend-mode: screen; }
:root[data-theme="dark"] .sky-tint,
:root:not([data-theme="light"]) .sky-tint { mix-blend-mode: soft-light; }
@media (prefers-reduced-motion: reduce) {
  .sky-tint, .sun { transition: none; }
}

/* ---------- parallax leaf backdrop ---------- */
.leaf-bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
}
:root[data-theme="dark"] .leaf-bg,
:root:not([data-theme="light"]) .leaf-bg { opacity: .6; }
.leaf-bg-inner {
  position: absolute;
  top: 0; left: 0; right: 0;
  will-change: transform;
}
.leaf-bg img {
  position: absolute;
  filter: saturate(.55) brightness(1.03);
  transform-origin: center;
}
@media (prefers-reduced-motion: reduce) {
  .leaf-bg-inner { transform: none !important; }
}

/* macaw crossing mid-screen on scroll — left to right (positioned by app.js) */
.sky-bird {
  position: fixed;
  left: 0;
  top: 26%;
  width: clamp(54px, 7.5vw, 96px);
  z-index: 20;
  pointer-events: none;
  will-change: transform;
  filter: drop-shadow(0 10px 12px rgb(var(--shadow) / .22));
}
.sky-bird img {
  display: block;
  width: 100%; height: auto;
  transform-origin: center;
  transition: transform .24s ease;   /* direction flip */
}
@media (max-width: 640px) { .sky-bird { width: clamp(42px, 13vw, 66px); } }

.player-inner {
  position: relative;
  z-index: 1;
  max-width: var(--maxw);
  margin: 0 auto;
  height: 100%;
  display: flex;
  align-items: center;
  gap: .55rem;
  padding: 0 clamp(.75rem, 3vw, 1.5rem);
}
.player button {
  flex: none;
  width: 38px; height: 38px;
  display: grid;
  place-items: center;
  background: var(--card);
  color: var(--ink);
  border: 1.5px solid var(--line);
  border-radius: 11px;
  font-size: .85rem;
  line-height: 1;
  cursor: pointer;
}
.player button:hover:not(:disabled) { background: var(--lagoon-soft); }
.player button:disabled { opacity: .4; cursor: not-allowed; }
#p-play { border-radius: 50%; background: var(--clay); color: var(--ink); }
#p-play:hover:not(:disabled) { background: color-mix(in srgb, var(--clay) 82%, var(--ink)); }

.p-track { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: .3rem; }
#p-title {
  font-family: var(--sans);
  font-weight: 600;
  font-size: .85rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.p-seek { display: flex; align-items: center; gap: .6rem; }
#p-time { flex: none; font-size: .68rem; font-variant-numeric: tabular-nums; color: var(--ink-soft); }

.p-vol {
  flex: none;
  display: flex;
  align-items: center;
  gap: .4rem;
  font-family: var(--body);
  font-weight: 700;
  font-size: .62rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--ink-soft);
}
.p-vol input { width: 74px; }

.player input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  height: 6px;
  flex: 1;
  background: color-mix(in srgb, var(--line) 30%, transparent);
  border-radius: 6px;
  cursor: pointer;
}
.player input[type="range"]:disabled { opacity: .45; cursor: not-allowed; }
.player input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 15px; height: 15px;
  border-radius: 50%;
  background: var(--clay);
  border: 2px solid var(--line);
}
.player input[type="range"]::-moz-range-thumb {
  width: 13px; height: 13px;
  border-radius: 50%;
  background: var(--clay);
  border: 2px solid var(--line);
}

/* YouTube iframe kept off-screen (audio only) */
#yt-mount {
  position: fixed;
  left: -9999px;
  top: 0;
  width: 200px;
  height: 120px;
  overflow: hidden;
  pointer-events: none;
  opacity: 0;
}

/* ---------- Skip link ---------- */

.skip { position: absolute; left: -9999px; }
.skip:focus {
  left: 1rem;
  top: 1rem;
  z-index: 100;
  background: var(--clay); color: var(--ink);
  padding: .5rem .8rem;
  border-radius: 8px;
}

/* ---------- Responsive / motion ---------- */

@media (max-width: 640px) {
  .site-header { gap: .3rem .9rem; }
  .wordmark { font-size: 1.75rem; }
  .events li { grid-template-columns: 1fr; gap: .15rem; }
  .events .act { margin-top: .3rem; }
  .p-vol, #p-time, #p-stop { display: none; }
  .player button { width: 34px; height: 34px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
  .rec:hover, .rec:focus-within,
  .rec-photo:hover, .rec-photo:focus-within,
  .polaroid:hover, .polaroid:focus-within { transform: none; }
}

/* ============================================================
   Hand-drawn (pencil) lines — borders wobbled by an SVG
   displacement filter. Filter defs live in index.html.
   ============================================================ */

.sketch-defs { position: absolute; width: 0; height: 0; overflow: hidden; }

/* container outlines: real border moved to a wobbled overlay */
.rec,
.rec-photo,
.events li:not(.empty) { border: 0; position: relative; }

.rec::before,
.rec-photo::before,
.events li:not(.empty)::before,
.polaroid::before {
  content: "";
  position: absolute;
  inset: 0;
  border: 1.7px solid var(--line);
  border-radius: inherit;
  pointer-events: none;
  z-index: 2;
  filter: url(#sketch);
}
.rec:hover::before,
.rec:focus-within::before,
.rec.is-playing::before { border-color: var(--clay); border-width: 2px; }

/* photo sliver: clip on the figure so the wobbly frame can breathe */
.rec-photo { overflow: visible; }
.rec-photo .rec-photo-btn { border-radius: 2px; overflow: hidden; }

@media (min-width: 1080px) { .polaroid { border: 0; } }

/* kraft year tag: border to overlay, keep the frond ::after */
.rec-divider::before {
  content: "";
  position: absolute;
  inset: 0;
  border: 1.5px solid var(--line);
  border-radius: inherit;
  pointer-events: none;
  filter: url(#sketch2);
}
.rec-divider::after { filter: url(#sketch2); }

/* small controls: wobble the element itself */
.btn,
.links a,
.theme-toggle,
.player button,
.rec-no,
.rec-play,
code { filter: url(#sketch2); }

/* header + player edge lines */
.site-header { border-bottom: 0; }
.site-header::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: 0;
  border-bottom: 1.6px solid color-mix(in srgb, var(--line) 85%, transparent);
  pointer-events: none;
  filter: url(#sketch);
}
.player { border-top: 0; }
.player::after {
  content: "";
  position: absolute;
  left: 0; right: 0; top: 0;
  border-top: 2px solid var(--line);
  pointer-events: none;
  z-index: 2;
  filter: url(#sketch);
}

/* underlines get a touch of graphite grain */
.view h1::after,
h2::after { filter: url(#sketch2); }

@media (prefers-reduced-motion: reduce) {
  /* the wobble is static, but drop it for the calmest setting */
  .rec::before, .rec-photo::before, .events li:not(.empty)::before,
  .polaroid::before, .rec-divider::before, .rec-divider::after,
  .site-header::after, .player::after,
  .btn, .links a, .theme-toggle, .player button,
  .rec-no, .rec-play, code,
  .view h1::after, h2::after { filter: none; }
}

/* ---------- Photo lightbox ---------- */

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: grid;
  place-items: center;
  padding: clamp(1rem, 5vw, 3rem);
}
.lightbox[hidden] { display: none; }
.lightbox-scrim {
  position: absolute;
  inset: 0;
  background: rgb(var(--shadow) / .62);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}
:root:not([data-theme="light"]) .lightbox-scrim,
:root[data-theme="dark"] .lightbox-scrim { background: rgba(10, 12, 8, .72); }

.lightbox-body {
  position: relative;
  max-width: min(1000px, 92vw);
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .6rem;
  background: var(--paper);
  border: 1.5px solid var(--line);
  border-radius: 6px;
  padding: 12px 12px 10px;
  box-shadow: 0 40px 80px -30px rgb(var(--shadow) / .7);
  transform: rotate(-.6deg);
}
.lightbox-body img {
  display: block;
  max-width: 100%;
  max-height: calc(88vh - 5rem);
  width: auto;
  object-fit: contain;
  border-radius: 3px;
}
.lightbox-cap {
  margin: 0;
  text-align: center;
  color: var(--ink-soft);
}
.lightbox-cap .lb-date {
  display: block;
  font-family: var(--hand);
  font-weight: 700;
  font-size: 1.3rem;
  line-height: 1.1;
}
.lightbox-cap .lb-note {
  display: block;
  margin-top: .15rem;
  font-family: var(--body);
  font-weight: 700;
  font-size: .68rem;
  letter-spacing: .06em;
  text-transform: uppercase;
  opacity: .85;
}
.lightbox-close {
  position: absolute;
  top: -14px;
  right: -14px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1.5px solid var(--line);
  background: var(--clay);
  color: var(--ink);
  font-size: 1.3rem;
  line-height: 1;
  cursor: pointer;
}
.lightbox-close:hover { background: color-mix(in srgb, var(--clay) 82%, var(--ink)); }

@media (prefers-reduced-motion: reduce) {
  .lightbox-body { transform: none; }
  .lightbox-scrim { backdrop-filter: none; -webkit-backdrop-filter: none; }
}
