/* self-hosted so the brand face has no render-blocking third-party request */
@font-face {
  font-family: "Slabo 27px";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("assets/fonts/slabo-27px-latin.woff2") format("woff2");
}

:root {
  /* brand — Klein blue sampled from Doogle's own background, so page + dog blend */
  --klein: #003399;
  --klein-deep: #00257a;        /* pressed / hover on blue surfaces */
  --paper: #ffffff;             /* stark white on the blue field — the identity */
  --accent: #ffd400;            /* DJ-yellow: "playing" state + focus ring */

  /* modal surface + a blue-tinted neutral ramp (neutrals lean toward --klein) */
  --surface: #ffffff;
  --text-strong: #15233a;       /* input values, dialog text */
  --text: #44506a;              /* labels, secondary copy */
  --muted: #7a8499;             /* de-emphasised UI (close icon) — ≥3:1 on surface */
  --placeholder: #aab2c0;       /* input placeholders */
  --field-border: #d4dae6;
  --field-ring: color-mix(in srgb, var(--klein) 15%, transparent);

  /* status — both ≥4.5:1 on the white surface */
  --ok:  #157a41;
  --err: #c43a32;

  /* scrims & shadows */
  --backdrop: color-mix(in srgb, #000c28 55%, transparent);
  --card-shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
  --hairline: rgba(255, 255, 255, 0.55);   /* ghost-control borders on blue */

  --pad-gap: clamp(8px, 1.4vw, 14px);
  font-family: "Helvetica Neue", Helvetica, "Inter", system-ui, Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  min-height: 100svh;
  background: var(--klein);
  color: var(--paper);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  gap: clamp(8px, 2vh, 24px);
  padding: clamp(16px, 3vh, 32px) 16px calc(env(safe-area-inset-bottom) + clamp(16px, 3vh, 32px));
  overflow-x: hidden;
  cursor: default;
  -webkit-tap-highlight-color: transparent;
}

/* ---------- wordmark ---------- */
.wordmark { text-align: center; user-select: none; }
.wordmark h1 {
  margin: 0;
  font-family: "Slabo 27px", Georgia, serif;
  font-size: clamp(54px, 17vw, 196px);
  font-weight: 700;
  line-height: 1;
  /* Slabo 27px only ships at 400, so add weight by stroking the glyphs
     in the same colour as the fill — cleaner than synthetic bold */
  -webkit-text-stroke: 2px var(--paper);
}

/* ---------- the dog ---------- */
.stage {
  flex: 1 1 auto;
  display: grid;
  place-items: center;
  width: 100%;
  min-height: 0;
}
.doogle-wrap {
  position: relative;
  display: inline-block;
  line-height: 0;
}
.doogle-wrap picture { display: block; }
.doogle-img {
  display: block;
  height: min(57vh, 70vmin);
  width: auto;
  aspect-ratio: 1128 / 1236;   /* reserve space before load — no layout shift */
  user-select: none;
  -webkit-user-drag: none;
}

/* the moving pupils — pure black, no glare */
.pupil {
  position: absolute;
  left: 0;
  top: 0;
  border-radius: 50%;
  background: #000;
  z-index: 2;
  transform: translate(-999px, -999px);   /* parked until JS sizes it */
  will-change: transform;
}

/* ---------- controls ---------- */
.controls {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(12px, 2.4vh, 22px);
  width: 100%;
}

.player {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--pad-gap);
  width: 100%;              /* so pads wrap instead of overflowing on narrow screens */
}

.pad {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font: inherit;
  font-size: clamp(11px, 1.5vw, 13px);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
  color: var(--paper);
  background: transparent;
  border: 1.5px solid var(--hairline);
  border-radius: 999px;
  padding: 0.62em 1.1em;
  cursor: pointer;
  transition: background-color 0.18s, color 0.18s, border-color 0.18s, transform 0.08s;
}
.pad:hover { border-color: var(--paper); }
.pad:active { transform: translateY(1px); }
.pad.is-active {
  background: var(--paper);
  color: var(--klein);
  border-color: var(--paper);
}
.pad-off.is-active {
  background: transparent;
  color: var(--paper);
  border-style: dashed;
  border-color: var(--hairline);
}

/* tiny equaliser — animates only while a track is playing */
.eq {
  display: inline-flex;
  align-items: flex-end;
  gap: 3px;
  height: 18px;
  margin-left: 4px;
  opacity: 0;
  transition: opacity 0.25s;
}
.eq i {
  width: 3px;
  height: 100%;               /* full bar; scaleY animates it (GPU, no layout) */
  transform-origin: bottom;
  transform: scaleY(0.22);
  background: var(--accent);
  border-radius: 2px;
}
.player.is-playing .eq { opacity: 1; }
/* fallback animation (when Web Audio is unavailable): incommensurate
   durations so the bars drift permanently out of phase — never in sync */
.player.is-playing .eq i { animation: eqbar 0.6s ease-in-out infinite; }
/* per-bar selectors must out-specify the rule above, or its shorthand resets
   duration/delay back to default and every bar moves in lockstep */
.player.is-playing .eq i:nth-child(1) { animation-duration: 0.62s; animation-delay: -0.05s; }
.player.is-playing .eq i:nth-child(2) { animation-duration: 0.47s; animation-delay: -0.31s; }
.player.is-playing .eq i:nth-child(3) { animation-duration: 0.73s; animation-delay: -0.17s; }
.player.is-playing .eq i:nth-child(4) { animation-duration: 0.53s; animation-delay: -0.44s; }
.player.is-playing .eq i:nth-child(5) { animation-duration: 0.41s; animation-delay: -0.23s; }
@keyframes eqbar { 0%,100% { transform: scaleY(0.2); } 50% { transform: scaleY(1); } }
/* when the real analyser is live, JS owns the bars — drop the CSS loop */
.player.eq-live.is-playing .eq i { animation: none; }

.book {
  appearance: none;
  font: inherit;
  font-weight: 700;
  font-size: clamp(28px, 4vw, 34px);   /* 2× */
  letter-spacing: 0.02em;
  color: var(--klein);
  background: var(--paper);
  border: 2px solid var(--paper);
  border-radius: 999px;
  padding: 0.85em 1.8em;
  cursor: pointer;
  transition: background-color 0.18s, color 0.18s, transform 0.08s;
}
.book:hover { background: transparent; color: var(--paper); }
.book:active { transform: translateY(1px); }

/* hero BOOK button uses the same display face as the wordmark.
   Text scaled up ~1.3× and stroked for weight; padding trimmed in the same
   proportion so the pill keeps its dimensions. */
#book {
  font-family: "Slabo 27px", Georgia, serif;
  font-size: clamp(36px, 5.2vw, 44px);
  line-height: 1;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 0.618em 1.089em;
  -webkit-text-stroke: 0.9px currentColor;
}

/* ---------- booking modal ---------- */
.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.modal[hidden] { display: none; }
.modal__backdrop {
  position: absolute;
  inset: 0;
  background: var(--backdrop);
  backdrop-filter: blur(3px);
}
.modal__card {
  position: relative;
  z-index: 1;
  width: min(440px, 100%);
  max-height: 90svh;
  overflow-y: auto;
  background: var(--surface);
  color: var(--text-strong);
  border-radius: 18px;
  padding: clamp(22px, 4vw, 32px);
  box-shadow: var(--card-shadow);
  animation: pop 0.18s ease-out;
}
@keyframes pop { from { transform: scale(0.96); opacity: 0; } to { transform: scale(1); opacity: 1; } }

.modal__card h2 {
  margin: 0 0 2px;
  font-family: "Slabo 27px", Georgia, serif;
  font-size: clamp(22px, 5vw, 28px);
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--klein);
}
.modal__card .rate {
  margin: 0 0 18px;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--text);
}
.modal__close {
  position: absolute;
  top: 10px;
  right: 14px;
  border: none;
  background: none;
  font-size: 30px;
  line-height: 1;
  color: var(--muted);
  cursor: pointer;
  padding: 4px 8px;
}
.modal__close:hover { color: var(--text-strong); }

#bookForm { display: flex; flex-direction: column; gap: 9px; }
#bookForm label {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--text);
}
#bookForm label.about { align-items: flex-start; }
/* field name + status, sitting on the same line as the field */
#bookForm .fname {
  flex: 0 0 120px;
  text-align: right;
  line-height: 1.3;
}
#bookForm label.about .fname { padding-top: 11px; }
#bookForm input,
#bookForm textarea {
  flex: 1 1 auto;
  min-width: 0;
  font: inherit;
  font-size: 14px;           /* close to the 13px labels (bumped to 16 on touch below) */
  font-weight: 400;
  color: var(--text-strong);
  padding: 9px 13px;
  border: 1.5px solid var(--field-border);
  border-radius: 10px;
  background: var(--surface);
}
#bookForm textarea { min-height: 64px; line-height: 1.4; resize: none; }
#bookForm input::placeholder,
#bookForm textarea::placeholder { color: var(--placeholder); }
/* iOS Safari centres date/time values by default — left-align to match text fields */
#bookForm input::-webkit-date-and-time-value { text-align: left; }
#bookForm input:focus,
#bookForm textarea:focus {
  outline: none;
  border-color: var(--klein);
  box-shadow: 0 0 0 3px var(--field-ring);
}
#bookForm input:user-invalid { border-color: var(--err); }
/* touch devices: 16px to dodge iOS focus-zoom + 44px comfortable tap targets */
@media (pointer: coarse) {
  #bookForm input, #bookForm textarea { font-size: 16px; }
  #bookForm input { min-height: 44px; }
}
em.req { color: var(--err); font-style: normal; }

/* stack label above field on very narrow screens */
@media (max-width: 460px) {
  #bookForm label { flex-direction: column; align-items: stretch; gap: 5px; }
  /* .about sets align-items:flex-start for the desktop row layout; when stacked
     that collapses the textarea, so stretch it back to full width */
  #bookForm label.about { align-items: stretch; }
  #bookForm .fname { flex: none; text-align: left; }
  #bookForm label.about .fname { padding-top: 0; }
  #bookForm textarea { min-height: 88px; }   /* roomier free-text box on phones */
}

/* phones: full-screen sheet so the form scrolls as one natural surface
   (no floating card with awkward internal scroll), with notch-safe padding */
@media (max-width: 560px) {
  .modal { padding: 0; }
  .modal__card {
    width: 100%;
    max-width: none;
    height: 100%;
    max-height: 100%;
    border-radius: 0;
    padding-top: calc(env(safe-area-inset-top, 0px) + 24px);
    padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 28px);
    animation: none;          /* skip the scale-pop at full screen */
  }
  .modal__close { top: calc(env(safe-area-inset-top, 0px) + 10px); }
}

/* honeypot — hidden from real users */
.hp {
  position: absolute !important;
  left: -9999px !important;
  width: 1px; height: 1px;
  opacity: 0;
}

.modal__submit {
  font-family: "Slabo 27px", Georgia, serif;
  font-size: 18px;
  width: 100%;
  margin-top: 26px;
  background: var(--klein);
  color: var(--paper);
  border-color: var(--klein);
  padding: 0.9em 1.4em;
}
.modal__submit:hover { background: var(--klein-deep); color: var(--paper); border-color: var(--klein-deep); }
.modal__submit[disabled] { opacity: 0.6; cursor: progress; }

.modal__status {
  margin: 0;
  min-height: 0;            /* don't reserve dead space while empty */
  font-size: 14px;
  font-weight: 600;
  text-align: center;
}
.modal__status.ok  { color: var(--ok); }
.modal__status.err { color: var(--err); }

/* ---------- a11y ---------- */
.skip {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--paper);
  color: var(--klein);
  padding: 8px 14px;
  border-radius: 0 0 8px 0;
  z-index: 10;
}
.skip:focus { left: 0; }

:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }

/* tighter pads on phones so the row wraps neatly instead of overflowing */
@media (max-width: 560px) {
  :root { --pad-gap: 7px; }
  .pad { font-size: 11px; padding: 0.55em 0.9em; letter-spacing: 0.04em; }
  .eq { flex-basis: 100%; justify-content: center; height: 14px; }
}

/* comfortable touch targets (≥44px) on touch-primary devices */
@media (pointer: coarse) {
  .pad { min-height: 44px; }
  .modal__close { min-width: 44px; min-height: 44px; display: flex; align-items: center; justify-content: center; }
}

@media (prefers-reduced-motion: reduce) {
  .player.is-playing .eq i { animation: none; transform: scaleY(0.66); }
  .modal__card { animation: none; }       /* no scale-pop entrance */
}
