/* Saint Croix Valley Light Show guest page. Spec: design/SaintCroixValleyLightShow_Claude_Package (approved reference). */
:root {
  --navy: #01122b;
  --navy-2: #031a3d;
  --green: #47ff82;
  --blue: #1caaff;
  --magenta: #e943ff;
  --amber: #ffbd51;
  --text: #ffffff;
  --muted: rgba(255, 255, 255, .82);
  --radius: clamp(18px, 5vw, 26px);
  --gap: clamp(10px, 3vw, 16px);
  --pad: max(16px, env(safe-area-inset-left));
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--navy); color: var(--text); }
body {
  font-family: Nunito, ui-rounded, "SF Pro Rounded", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  min-height: 100dvh;
}
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.page {
  max-width: 560px; margin: 0 auto; position: relative;
  padding-bottom: calc(28px + env(safe-area-inset-bottom));
  background:
    radial-gradient(120% 40% at 50% 100%, rgba(70, 90, 170, .35), transparent 70%),
    linear-gradient(180deg, #2a3d84 0, var(--navy-2) 12%, var(--navy) 30%, var(--navy) 100%);
}
@media (min-width: 561px) { body { background: radial-gradient(80% 60% at 50% 0, #0a2350, var(--navy)); } }

/* hero: exact crop of the approved artwork, fades into the navy below */
.hero { position: relative; margin: 0; }
.hero img { display: block; width: 100%; height: auto; aspect-ratio: 1086 / 711; object-fit: cover; }
.hero::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 22%;
  background: linear-gradient(180deg, rgba(42, 61, 132, 0) 0, #2a3d84 100%); pointer-events: none;
}

/* 2x2 control grid */
.controls {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--gap);
  padding: clamp(4px, 2vw, 14px) var(--pad) 0; margin-top: clamp(-34px, -6vw, -12px); position: relative; z-index: 1;
}
.card {
  --c: var(--green);
  position: relative; display: flex; align-items: center; gap: clamp(8px, 2.4vw, 14px);
  min-height: clamp(84px, 22vw, 112px); padding: clamp(10px, 3vw, 16px);
  border-radius: var(--radius); border: 2.5px solid var(--c);
  background: linear-gradient(180deg, color-mix(in srgb, var(--c) 26%, #02102a), color-mix(in srgb, var(--c) 12%, #01091c));
  box-shadow: 0 0 14px color-mix(in srgb, var(--c) 70%, transparent), inset 0 0 18px color-mix(in srgb, var(--c) 30%, transparent);
  color: var(--text); font: inherit; text-align: left; cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
button.card:focus-visible, .card button:focus-visible, .sheet button:focus-visible, .tabs a:focus-visible {
  outline: 3px solid #fff; outline-offset: 3px;
}
button.card:active, .card-main:active { transform: scale(.98); }
.card-listen { --c: var(--green); padding: 0; min-width: 0; container-type: inline-size; }
.card-request { --c: var(--blue); }
.card-donate { --c: var(--magenta); }
.card-info { --c: var(--amber); }
/* approved layout (owner 2026-11-22, alternate_reference.png): Listen full row / Request + Donate / Show Info full row */
.card-listen, .card-info { grid-column: 1 / -1; }

/* request / donate / info: icon + title on one row, caption centered underneath (as in the approved reference) */
.card:not(.card-listen) {
  display: grid; grid-template-columns: auto minmax(0, 1fr); grid-template-areas: "icon title" "sub sub";
  align-items: center; column-gap: clamp(8px, 2.4vw, 12px); row-gap: 6px; min-width: 0;
}
.card:not(.card-listen) .card-text { display: contents; }
.card:not(.card-listen) .card-icon { grid-area: icon; }
.card:not(.card-listen) .card-title { grid-area: title; }
.card:not(.card-listen) .card-sub { grid-area: sub; justify-self: stretch; text-align: center; margin-top: 2px; }
.card-info .card-sub { letter-spacing: .8px; font-size: clamp(9px, 2.45vw, 12px); }
.card.card-info { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; column-gap: clamp(10px, 3vw, 16px); }
.card-info .card-sub { flex-basis: 100%; }
.card-text { display: flex; flex-direction: column; min-width: 0; }
.card-title { font-weight: 900; font-size: clamp(19px, 5.6vw, 28px); line-height: 1.05; letter-spacing: .2px; }
.card-sub { font-weight: 700; font-size: clamp(10px, 2.7vw, 13px); color: var(--muted); margin-top: 6px; line-height: 1.35; }
.caps { text-transform: uppercase; letter-spacing: 1.4px; }
.card-icon { width: clamp(30px, 9vw, 46px); height: clamp(30px, 9vw, 46px); flex: none; fill: currentColor;
  filter: drop-shadow(0 0 6px var(--c)); color: #fff; }
.card-info .card-icon { color: var(--amber); }
.card-donate .card-icon { color: #fff; }
.pin { width: 1.2em; height: 1.2em; fill: currentColor; vertical-align: -0.25em; margin-right: 4px; }
.card-request .card-sub { color: #cfeaff; }

/* Listen: main play button + separately clickable gear */
.card-main {
  flex: 1; min-width: 0; display: flex; align-items: center; gap: clamp(8px, 2.4vw, 14px);
  min-height: 100%; padding: clamp(8px, 2.4vw, 16px); border: 0; background: none; color: inherit; font: inherit;
  text-align: left; cursor: pointer; border-radius: var(--radius) 0 0 var(--radius);
}
.icon-ring {
  flex: none; width: clamp(34px, 13cqi, 60px); height: clamp(34px, 13cqi, 60px); border-radius: 50%;
  border: 3px solid var(--green); display: grid; place-items: center;
  box-shadow: 0 0 10px var(--green), inset 0 0 8px rgba(71, 255, 130, .5);
}
.icon-ring svg { width: 52%; height: 52%; fill: #fff; }
.ic-pause { display: none; }
.card-listen.playing .ic-play { display: none; }
.card-listen.playing .ic-pause { display: block; }
.card-listen .card-title { font-size: clamp(18px, 7.5cqi, 40px); }
.card-listen.playing { box-shadow: 0 0 22px var(--green), inset 0 0 22px rgba(71, 255, 130, .4); }
.divider { flex: none; width: 1.5px; align-self: stretch; margin: 16px 0; background: rgba(255, 255, 255, .5); }
.gear {
  flex: none; min-height: 100%; min-width: 44px; border: 0; background: none; color: #fff; cursor: pointer; font: inherit;
  display: flex; align-items: center; justify-content: center; gap: 10px; padding: 8px clamp(12px, 4cqi, 22px) 8px clamp(10px, 3cqi, 18px);
  border-radius: 0 var(--radius) var(--radius) 0;
}
.gear svg { width: 28px; height: 28px; fill: #fff; filter: drop-shadow(0 0 4px var(--green)); }
.card-listen .card-title { white-space: nowrap; }
.card-listen .card-main { justify-content: center; }
.gear-text { font-weight: 700; font-size: clamp(11px, 3.6cqi, 16px); line-height: 1.2; text-align: left; max-width: 8.5em; }
/* The label must never clip. Space is given up in this order, never by cutting "Listen"/"Listening":
   1. phones (card < 440 px): "Adjust Bluetooth Delay" moves under the gear icon (still visible);
   2. very narrow (iOS text 200%: card < 230 px): ring stacks over the label, gear becomes an icon-only 44 px corner button
      (its accessible name stays "Adjust Bluetooth Delay"). Checked by scripts/dev/fit_test.mjs. */
@container (max-width: 439px) {
  .card-listen .gear { flex-direction: column; gap: 4px; padding: 8px clamp(8px, 3cqi, 14px); }
  .card-listen .gear svg { width: 26px; height: 26px; }
  .card-listen .gear-text { text-align: center; font-size: clamp(10px, 3.3cqi, 13px); max-width: 6.2em; }
}
@container (max-width: 229px) {
  .card-listen .card-main { flex-direction: column; gap: clamp(4px, 4cqi, 8px); padding: clamp(8px, 7cqi, 14px) clamp(6px, 5cqi, 12px);
    border-radius: var(--radius); }
  .card-listen .card-text { align-items: center; max-width: 100%; }
  .card-listen .card-title { font-size: min(clamp(16px, 5.1vw, 30px), 15cqi); text-align: center; }
  .card-listen .icon-ring { width: clamp(30px, 24cqi, 52px); height: clamp(30px, 24cqi, 52px); }
  .card-listen .divider { display: none; }
  .card-listen .gear { position: absolute; top: 0; right: 0; width: 44px; height: 44px; min-height: 0; padding: 0; z-index: 1;
    border-radius: 0 var(--radius) 0 12px; }
  .card-listen .gear svg { width: 22px; height: 22px; }
  .card-listen .gear-text { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
}
.nowplaying { margin: 12px var(--pad) 0; min-height: 1.3em; text-align: center; font-weight: 800; font-size: 15px; color: var(--green);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nowplaying:empty { display: none; }

.card[aria-disabled="true"] { opacity: .78; }

/* skater strip */
.skater {
  margin: calc(var(--gap) + 6px) var(--pad) 0; padding: 12px clamp(12px, 3vw, 20px);
  display: flex; align-items: center; gap: 12px;
  border: 2.5px solid var(--blue); border-radius: calc(var(--radius) + 6px);
  background: linear-gradient(180deg, rgba(28, 170, 255, .14), rgba(1, 9, 28, .6));
  box-shadow: 0 0 14px rgba(28, 170, 255, .7), inset 0 0 16px rgba(28, 170, 255, .25);
}
.skater-fig { width: clamp(64px, 18vw, 96px); flex: none; }
/* filled figure-skater silhouette (arabesque), owner 2026-11-22: "an actual figure skater instead of a stick person" */
.skater-fig .fig { fill: #fff; filter: drop-shadow(0 0 4px rgba(255, 255, 255, .6)); }
.skater-fig .blade { stroke: #dfe9ff; stroke-width: 1.8; stroke-linecap: round; }
.skater-fig .trail { stroke: rgba(200, 220, 255, .55); stroke-width: 1.6; }
.skater-text { min-width: 0; }
.skater-title { margin: 0; font-weight: 800; font-style: italic; font-size: clamp(14px, 4.1vw, 20px); line-height: 1.2; }
.skater-note { margin: 6px 0 0; font-style: italic; font-weight: 700; font-size: clamp(11px, 3.2vw, 14px); color: var(--muted);
  padding-top: 6px; border-top: 2px solid; border-image: linear-gradient(90deg, transparent, var(--green), var(--blue), transparent) 1; }

.status { margin: 14px var(--pad) 0; min-height: 1.2em; font-size: 14px; color: var(--muted); text-align: center; }
.diag { margin: 10px var(--pad); padding: 10px; border-radius: 10px; background: rgba(255, 255, 255, .06);
  font: 12px/1.5 ui-monospace, Menlo, monospace; white-space: pre-wrap; }

/* stacked layout when two columns would clip text (narrow phones, large text) */
@media (max-width: 359px) { .controls { grid-template-columns: 1fr; } }

/* sheets (dialogs) */
.sheet {
  width: min(560px, 100vw); max-height: 88dvh; margin: auto auto 0; padding: 0; border: 0;
  border-radius: 22px 22px 0 0; background: #071c3f; color: var(--text);
  box-shadow: 0 -8px 40px rgba(0, 0, 0, .6);
}
.sheet::backdrop { background: rgba(0, 4, 14, .65); }
.sheet form { padding: 20px var(--pad) calc(18px + env(safe-area-inset-bottom)); }
.sheet h2 { margin: 0 0 10px; font-size: 22px; font-weight: 900; }
.sheet h3 { margin: 22px 0 6px; font-size: 17px; font-weight: 800; color: var(--amber); }
.sheet p, .sheet li { font-size: 16px; line-height: 1.45; }
.sheet-tall { height: 88dvh; }
.sheet-tall form { height: 100%; overflow-y: auto; }
.hint { color: var(--muted); font-size: 14px !important; }
.sheet-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px; }
.sheet button { min-height: 44px; min-width: 88px; padding: 0 18px; border-radius: 12px; border: 1.5px solid rgba(255, 255, 255, .5);
  background: transparent; color: #fff; font: inherit; font-weight: 800; font-size: 16px; cursor: pointer; }
.sheet button.primary { background: var(--green); border-color: var(--green); color: #022; }
.slider { display: block; margin: 16px 0 6px; font-weight: 800; }
.slider input { width: 100%; height: 44px; accent-color: var(--green); }
.tabs { display: flex; flex-wrap: wrap; gap: 8px; position: sticky; top: -20px; padding: 8px 0; background: #071c3f; z-index: 1; }
.tabs a { color: #fff; text-decoration: none; font-weight: 800; font-size: 14px; padding: 8px 12px; min-height: 36px;
  border-radius: 999px; border: 1.5px solid var(--amber); }
.songs { padding-left: 1.4em; }
.songs li { margin: 4px 0; }
.songs .artist { color: var(--muted); }
.songs li.now { color: var(--green); font-weight: 800; }
.steps { padding-left: 1.3em; }
#treeMap svg { width: 100%; height: auto; display: block; }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
