/* Benny Graves · the connected site · the shell.
   The page (html/body), the view layers and their crossfade, the site nav (the Living Poster's top bar), and the one
   persistent official player with its dock. Views style only their own <section class="view view-NAME">.
   Tokens any view may read:
     --bg-nav-h   the fixed nav's height, safe area included (lay your view out under it)
     --bg-vh      the visible viewport height (use it, never 100vh)
     --bg-dock-h  the space the player dock takes at the bottom of the screen (0px while there's no dock) */

:root {
  --sn-paper: #efeae0;
  --sn-ink: #181512;
  --sn-ink-soft: rgba(24, 21, 18, .62);
  --sn-spot: #ff4a1f;
  --sn-spot-text: #c7300d;
  --sn-font: 'Anybody', 'Arial Narrow', 'Helvetica Neue', Arial, sans-serif;
  --sn-m: 48px;
  --sn-h: 64px;
  --bg-nav-h: calc(var(--sn-h) + env(safe-area-inset-top, 0px));
  --bg-vh: 100svh;
  --bg-dock-h: 0px;
  /* the dock: a small red ticket stub, in the Listen ticket's own paper and ink */
  --bgp-tk: #b2311e; --bgp-tk-2: #8f2413; --bgp-ink: #fbf3ea; --bgp-ink-2: rgba(251, 243, 234, .76);
  --bgp-h: 68px; --bgp-b: 20px; --bgp-x: 20px; --bgp-w: 384px;
  --bgp-shadow: 0 2px 3px rgba(60, 38, 20, .22), 0 12px 28px rgba(60, 38, 20, .30);
  color-scheme: light;
}
html[data-theme="night"] {
  --sn-paper: #0e0d0c;
  --sn-ink: #f0e8d8;
  --sn-ink-soft: rgba(240, 232, 216, .66);
  --sn-spot: #ff5a2a;
  --sn-spot-text: #ff6a3d;
  --bgp-tk: #a42a19; --bgp-tk-2: #771c10; --bgp-ink: #f6eadb; --bgp-ink-2: rgba(246, 234, 219, .74);
  --bgp-shadow: 0 2px 3px rgba(0, 0, 0, .5), 0 12px 30px rgba(0, 0, 0, .62);
  color-scheme: dark;
}
html.bg-docked { --bg-dock-h: calc(var(--bgp-h) + var(--bgp-b) + 10px); }

/* ---------- the page ---------- */
html, body { margin: 0; padding: 0; }
html { background: var(--sn-paper); color: var(--sn-ink); -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-behavior: auto; }
body {
  min-height: var(--bg-vh); background: var(--sn-paper); color: var(--sn-ink); overflow-x: clip;
  font: 16px/1.45 'Hanken Grotesk', ui-sans-serif, system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent;
}
/* full-screen views (gallery, music) and the open phone menu: the page itself never scrolls or bounces */
html[data-scroll="fixed"], html[data-scroll="fixed"] body, html.sn-menu-open, html.sn-menu-open body { overflow: hidden; overscroll-behavior: none; }

.skip { position: fixed; left: 12px; top: -80px; z-index: 100; padding: 12px 16px; background: var(--sn-ink); color: var(--sn-paper); font: 700 14px/1.2 var(--sn-font); text-decoration: none; }
.skip:focus { top: calc(env(safe-area-inset-top, 0px) + 10px); }

/* ---------- views: one live layer each, kept alive ----------
   is-on:      the view on screen. A 'page' view is in the normal flow (the window scrolls it); a 'fixed' view fills the screen.
   is-off:     still laid out (its state, size and scroll kept), never painted, never hit. A page view waits exactly where it
               was scrolled to (top = minus its scroll position), so it comes back as it was left.
   is-leaving: the view that's going, held still on top and fading out over the next one, which is already in place below. */
#views { position: relative; z-index: 0; display: block; }
.view { display: block; box-sizing: border-box; }
.view:focus { outline: none; }
:where(.view) { background: var(--sn-paper); }
.view[data-scroll="page"] { position: relative; min-height: var(--bg-vh); }
:where(html.bg-docked) :where(.view[data-scroll="page"]) { padding-bottom: var(--bg-dock-h); }
.view[data-scroll="fixed"] { position: fixed; inset: 0; overflow: hidden; }
.view.is-on { z-index: 1; }
.view.is-off, .view.is-leaving { position: fixed; left: 0; right: 0; }
.view[data-scroll="fixed"].is-off, .view[data-scroll="fixed"].is-leaving { top: 0; bottom: 0; }
.view.is-off { z-index: 0; visibility: hidden; pointer-events: none; }
.view.is-off * { visibility: hidden !important; }
.view.is-leaving { z-index: 3; pointer-events: none; }
.view.is-leaving * { pointer-events: none !important; }

/* ============ the site nav: the Living Poster's top bar, fixed, the same on every view ============ */
.site-nav {
  position: fixed; inset: 0 0 auto 0; z-index: 50; box-sizing: border-box;
  height: var(--bg-nav-h); padding-top: env(safe-area-inset-top, 0px);
  padding-left: max(var(--sn-m), env(safe-area-inset-left, 0px)); padding-right: max(var(--sn-m), env(safe-area-inset-right, 0px));
  display: flex; align-items: center; gap: 28px;
  background: var(--sn-paper); color: var(--sn-ink); border-bottom: 2px solid var(--sn-ink);
  font-family: var(--sn-font); font-variation-settings: 'wdth' 78; text-transform: uppercase; letter-spacing: .07em; font-size: 13px; font-weight: 750; line-height: 1;
  -webkit-user-select: none; user-select: none;
}
/* a view that is dark in the day too can declare navTone: 'dark' and get the night bar */
html[data-nav="dark"] .site-nav, html[data-nav="dark"] .sn-menu {
  --sn-paper: #0e0d0c; --sn-ink: #f0e8d8; --sn-ink-soft: rgba(240, 232, 216, .66); --sn-spot: #ff5a2a; --sn-spot-text: #ff6a3d; color-scheme: dark;
}
.site-nav a { color: inherit; }
.site-nav button { font: inherit; color: inherit; letter-spacing: inherit; text-transform: inherit; -webkit-tap-highlight-color: transparent; }
.site-nav :focus-visible { outline: 3px solid var(--sn-spot); outline-offset: 3px; }

.sn-mark { flex: none; display: grid; place-items: center; width: 44px; height: 44px; box-sizing: border-box; border: 2px solid var(--sn-ink); border-radius: 50%; text-decoration: none; font-weight: 900; font-size: 14px; letter-spacing: 0; font-variation-settings: 'wdth' 60; }
.sn-mark i { font-style: normal; color: var(--sn-spot); }

.sn-links { display: flex; gap: 4px; margin-right: auto; }
.sn-links a { position: relative; display: grid; place-items: center; min-height: 44px; padding: 0 12px; text-decoration: none; }
.sn-links a::after { content: ''; position: absolute; left: 12px; right: 12px; bottom: 9px; height: 3px; background: var(--sn-spot); transform: scaleX(0); transform-origin: left; transition: transform .2s ease; }
.sn-links a:hover::after, .sn-links a[aria-current]::after { transform: scaleX(1); }

/* day / night / auto: the pressed one is the visitor's choice; under Auto the one in effect carries the orange rule */
.sn-theme { display: flex; align-items: center; height: 40px; border: 2px solid var(--sn-ink); box-sizing: border-box; }
.sn-th { position: relative; display: flex; align-items: center; gap: 6px; height: 100%; padding: 0 11px; border: 0; background: none; cursor: pointer; font-size: 12px; font-weight: 750; }
.sn-th + .sn-th { border-left: 2px solid var(--sn-ink); }
.sn-th::before { content: ''; position: absolute; inset: -4px 0; } /* a 44 px tall hit area */
.sn-th svg, .sn-flip svg { width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.sn-th .i-moon, .sn-flip .i-moon { fill: currentColor; stroke: none; }
.sn-th[aria-pressed="true"] { background: var(--sn-ink); color: var(--sn-paper); }
.sn-th.is-current:not([aria-pressed="true"]) { box-shadow: inset 0 -4px 0 var(--sn-spot); }

/* phone: one pill shows the theme in effect and whether it's Auto (orange) or their own choice; a tap flips day/night */
.sn-flip { display: none; align-items: center; gap: 7px; height: 44px; padding: 0 13px 0 12px; box-sizing: border-box; border: 2px solid var(--sn-ink); border-radius: 22px; background: none; cursor: pointer; font-size: 12px; font-weight: 800; }
.sn-flip svg { width: 18px; height: 18px; }
.sn-flip .i-moon, html[data-theme="night"] .sn-flip .i-sun { display: none; }
html[data-theme="night"] .sn-flip .i-moon { display: block; }
.sn-flip-l { min-width: 3.2em; text-align: left; }
html[data-theme-mode="auto"] .sn-flip-l { color: var(--sn-spot-text); }

.sn-listen { flex: none; display: flex; align-items: center; gap: 8px; height: 44px; padding: 0 18px; box-sizing: border-box; background: var(--sn-ink); color: var(--sn-paper) !important; text-decoration: none; font-weight: 800; }
.sn-listen svg { width: 15px; height: 15px; fill: var(--sn-spot); }
.sn-listen[aria-current] { background: var(--sn-spot); color: #181512 !important; }
.sn-listen[aria-current] svg { fill: #181512; }

.sn-menu-btn { display: none; position: relative; flex: none; width: 44px; height: 44px; margin-right: -6px; padding: 0; border: 0; background: none; cursor: pointer; }
.sn-menu-btn i { position: absolute; left: 11px; right: 11px; height: 3px; background: var(--sn-ink); transition: transform .16s ease; }
.sn-menu-btn i:first-child { top: 16px; }
.sn-menu-btn i:last-child { top: 25px; }
.sn-menu-btn[aria-expanded="true"] i:first-child { transform: translateY(4.5px) rotate(45deg); }
.sn-menu-btn[aria-expanded="true"] i:last-child { transform: translateY(-4.5px) rotate(-45deg); }

/* the phone menu: a sheet of poster paper under the bar, there the moment it's tapped */
.sn-menu {
  position: fixed; left: 0; right: 0; top: var(--bg-nav-h); bottom: 0; z-index: 49; box-sizing: border-box;
  padding: 18px max(16px, env(safe-area-inset-right, 0px)) calc(24px + env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px));
  display: flex; flex-direction: column; justify-content: space-between; gap: 24px; overflow-y: auto; overscroll-behavior: contain;
  background: var(--sn-paper); color: var(--sn-ink); font-family: var(--sn-font); text-transform: uppercase; letter-spacing: normal;
}
.sn-menu[hidden] { display: none; }
.sn-menu nav { display: flex; flex-direction: column; }
.sn-menu nav a { display: flex; align-items: center; justify-content: space-between; min-height: 56px; padding: 6px 0; border-bottom: 2px solid var(--sn-ink); color: inherit; text-decoration: none;
  font-size: clamp(40px, 13.5vw, 72px); line-height: .98; font-weight: 900; font-variation-settings: 'wdth' 58; letter-spacing: .01em; }
.sn-menu nav a[aria-current] { color: var(--sn-spot); }
.sn-menu nav a svg { width: .42em; height: .42em; fill: var(--sn-spot); flex: none; }
.sn-menu-theme { display: flex; flex-direction: column; gap: 10px; }
.sn-menu-theme p { margin: 0; font-size: 11px; line-height: 1.4; font-weight: 650; font-variation-settings: 'wdth' 78; letter-spacing: .12em; color: var(--sn-ink-soft); }
.sn-menu-theme .sn-theme { height: 52px; }
.sn-menu-theme .sn-th { flex: 1; justify-content: center; font-size: 14px; }
.sn-menu button { font-family: inherit; color: inherit; text-transform: inherit; letter-spacing: .07em; font-variation-settings: 'wdth' 78; font-weight: 750; }
.sn-menu :focus-visible { outline: 3px solid var(--sn-spot); outline-offset: 3px; }
@media (prefers-reduced-motion: no-preference) {
  .sn-menu.is-opening nav a { animation: sn-rise .16s cubic-bezier(.2, .7, .2, 1) both; }
  .sn-menu.is-opening nav a:nth-child(2) { animation-delay: 15ms; }
  .sn-menu.is-opening nav a:nth-child(3) { animation-delay: 30ms; }
  .sn-menu.is-opening nav a:nth-child(4) { animation-delay: 45ms; }
  .sn-menu.is-opening nav a:nth-child(5) { animation-delay: 60ms; }
}
@keyframes sn-rise { from { transform: translateY(10px); } }

@media (max-width: 899px) {
  .sn-links, .site-nav > .sn-theme { display: none; }
  .sn-flip { display: flex; margin-left: auto; }
  .sn-menu-btn { display: block; }
  .site-nav { gap: 10px; }
  .sn-listen { padding: 0 14px; }
}
@media (max-width: 759px) {
  :root { --sn-m: 16px; --sn-h: 56px; }
}
@media (max-width: 359px) {
  .sn-flip { width: 44px; padding: 0; justify-content: center; }
  .sn-flip-l { display: none; }
  .sn-listen { padding: 0 12px; }
}
@media (prefers-reduced-motion: reduce) {
  .sn-links a::after, .sn-menu-btn i { transition: none; }
}

/* ============ the one persistent official player ============
   #player-layer holds the host of the site's ONE Spotify / Apple Music player. The host never moves in the DOM (moving
   an iframe reloads it); only its frame's position changes. On the Listen view the frame lies exactly over the ticket's
   player slot and tilts with the ticket; on every other view it waits beside the dock, alive and out of sight, until
   "Player" brings it up. */
.player-layer { position: absolute; left: 0; top: 0; width: 0; height: 0; z-index: 45; }
.bgp-frame { position: fixed; left: 0; top: 0; width: 0; visibility: hidden; pointer-events: none; }
.bgp-host iframe { display: block; border: 0; }
.bgp-frame.is-ticket {
  position: absolute; visibility: visible; pointer-events: auto; border-radius: 12px; overflow: hidden;
  box-shadow: 0 0 0 1.5px color-mix(in srgb, var(--bgp-ink) 34%, transparent), 0 6px 16px rgba(40, 6, 0, .28);
}
.bgp-frame.is-ticket .bgp-host iframe { border-radius: 12px; }
.bgp-frame.is-ticket.is-empty { visibility: hidden; pointer-events: none; }
.bgp-frame.is-dock {
  position: fixed; top: auto; left: var(--bgp-x); width: var(--bgp-w); bottom: calc(var(--bgp-b) + var(--bgp-h) + 10px);
  visibility: visible; opacity: 0; transform: translateY(12px); pointer-events: none;
  border-radius: 12px; overflow: hidden; box-shadow: var(--bgp-shadow);
  transition: opacity .18s ease, transform .2s cubic-bezier(.2, .7, .2, 1);
}
.bgp-frame.is-dock.is-open { opacity: 1; transform: none; pointer-events: auto; }
.bgp-frame.is-dock .bgp-host iframe { border-radius: 12px; }
.bgp-frame.is-dock.is-gone { visibility: hidden; }

/* the dock: a small red ticket stub with the song, an honest state line, and the way back to the ticket */
.bgp-dock {
  position: fixed; left: var(--bgp-x); bottom: var(--bgp-b); width: var(--bgp-w); height: var(--bgp-h); box-sizing: border-box; z-index: 1;
  display: flex; align-items: center; gap: 8px; padding: 0 8px 0 9px;
  color: var(--bgp-ink); border-radius: 8px; box-shadow: var(--bgp-shadow);
  background: linear-gradient(176deg, color-mix(in srgb, var(--bgp-tk) 88%, #fff) 0, var(--bgp-tk) 26%, var(--bgp-tk) 76%, var(--bgp-tk-2) 100%);
  font: 16px/1.2 'Bricolage Grotesque', ui-sans-serif, system-ui, -apple-system, sans-serif;
  transition: opacity .18s ease, transform .22s cubic-bezier(.2, .7, .2, 1);
  -webkit-user-select: none; user-select: none;
}
.bgp-dock[hidden] { display: flex; visibility: hidden; opacity: 0; transform: translateY(14px); pointer-events: none; transition: opacity .14s ease, transform .18s ease, visibility 0s .18s; }
.bgp-dock::after { /* the tear line after the cover, punched like the ticket's perforation */
  content: ''; position: absolute; left: calc(var(--bgp-h) - 1px); top: 10px; bottom: 10px; width: 3px; pointer-events: none;
  background: radial-gradient(circle at 1.5px 2px, rgba(40, 6, 0, .55) 1.2px, transparent 1.7px) 0 0 / 3px 7px repeat-y; }
.bgp-to { flex: 1; min-width: 0; display: flex; align-items: center; gap: 17px; height: 100%; color: inherit; text-decoration: none; border-radius: 6px; }
.bgp-art { flex: none; width: calc(var(--bgp-h) - 18px); height: calc(var(--bgp-h) - 18px); border-radius: 3px; background: #000; object-fit: cover; box-shadow: 0 0 0 1.5px color-mix(in srgb, var(--bgp-ink) 50%, transparent); }
.bgp-meta { min-width: 0; display: flex; flex-direction: column; gap: 5px; }
.bgp-title { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-weight: 800; font-size: 15px; font-stretch: 90%; }
.bgp-state { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font: 500 10.5px/1.25 'IBM Plex Mono', ui-monospace, Menlo, monospace; letter-spacing: .04em; color: var(--bgp-ink-2); }
.bgp-state::before { content: ''; display: inline-block; width: 6px; height: 6px; margin: 0 6px 1px 0; border-radius: 50%; background: currentColor; opacity: .5; vertical-align: middle; }
.bgp-dock.is-live .bgp-state { color: var(--bgp-ink); }
.bgp-dock.is-live .bgp-state::before { opacity: 1; background: #ffd9a8; box-shadow: 0 0 0 2px rgba(255, 217, 168, .25); }
.bgp-btn { flex: none; display: grid; place-items: center; width: 44px; height: 44px; padding: 0; box-sizing: border-box; border: 1.6px solid color-mix(in srgb, var(--bgp-ink) 70%, transparent); border-radius: 50%; background: transparent; color: inherit; cursor: pointer; font: inherit; -webkit-tap-highlight-color: transparent; }
.bgp-btn:hover { background: rgba(255, 240, 225, .1); }
.bgp-btn:active { transform: translateY(1px); }
.bgp-btn[hidden] { display: none; }
.bgp-btn svg { width: 18px; height: 18px; fill: currentColor; }
.bgp-pp { background: var(--bgp-ink); color: var(--bgp-tk); border-color: var(--bgp-ink); }
.bgp-pp:hover { background: var(--bgp-ink); filter: brightness(1.04); }
.bgp-pp .i-pause, .bgp-pp.on .i-play { display: none; }
.bgp-pp.on .i-pause { display: block; }
.bgp-show { width: auto; min-width: 44px; padding: 0 13px 0 11px; border-radius: 22px; grid-auto-flow: column; gap: 6px; font: 600 10.5px/1 'IBM Plex Mono', ui-monospace, Menlo, monospace; letter-spacing: .08em; text-transform: uppercase; }
.bgp-show svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; transition: transform .18s ease; }
.bgp-show[aria-expanded="true"] svg { transform: rotate(180deg); }
.bgp-dock :focus-visible { outline: 2px solid var(--bgp-ink); outline-offset: 2px; }

@media (max-width: 759px) {
  :root { --bgp-h: 62px; --bgp-b: max(10px, env(safe-area-inset-bottom, 0px)); --bgp-x: max(12px, env(safe-area-inset-left, 0px)); --bgp-w: calc(100% - 2 * max(12px, env(safe-area-inset-left, 0px))); }
  .bgp-title { font-size: 14.5px; }
}
@media (max-width: 340px) {
  .bgp-show { width: 44px; padding: 0; }
  .bgp-show span { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .bgp-frame.is-dock, .bgp-dock, .bgp-dock[hidden], .bgp-show svg { transition: none; }
}
