:root {
  --bg: #15110f;
  --bg-2: #201915;
  --panel: rgba(30, 24, 21, 0.72);
  --ink: #f4ebe2;
  --ink-soft: #c9b9ab;
  --ink-mute: #8f7f72;
  --lamp: #f3c77b;
  --lamp-deep: #d9a24f;
  --line: rgba(243, 199, 123, 0.18);
  --danger: #e38b7a;
  --radius: 18px;
  --shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

*,
*::before,
*::after { box-sizing: border-box; }

html { color-scheme: dark; }

[hidden] { display: none !important; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--bg);
  display: flex;
  flex-direction: column;
}

/* Full-viewport farm scene (1950s GMC on the left, lit farmhouse porch on the right).
   A fixed pseudo-element instead of background-attachment: fixed, so it also stays put on iOS.
   The gradient darkens the sky for the header and the foreground for contrast. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  background-color: var(--bg);
  background-image:
    linear-gradient(180deg, rgba(8, 10, 18, 0.62) 0%, rgba(8, 10, 18, 0.28) 32%, rgba(14, 11, 9, 0.38) 70%, rgba(14, 11, 9, 0.78) 100%),
    url("img/background-gmc-farmhouse.jpg?v=20261025");
  background-image:
    linear-gradient(180deg, rgba(8, 10, 18, 0.62) 0%, rgba(8, 10, 18, 0.28) 32%, rgba(14, 11, 9, 0.38) 70%, rgba(14, 11, 9, 0.78) 100%),
    image-set(url("img/background-gmc-farmhouse.webp?v=20261025") type("image/webp"), url("img/background-gmc-farmhouse.jpg?v=20261025") type("image/jpeg"));
  background-size: cover, cover;
  background-position: center bottom;
  background-repeat: no-repeat;
  pointer-events: none;
}

.glow {
  position: fixed;
  inset: auto auto -40vh 50%;
  transform: translateX(-50%);
  width: 90vw;
  height: 70vh;
  background: radial-gradient(closest-side, rgba(243, 199, 123, 0.1), transparent 70%);
  pointer-events: none;
  z-index: 0;
}

a { color: var(--lamp); }
a:hover { color: #fff; }

.site-header,
main,
.site-footer { position: relative; z-index: 1; }

.site-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 22px clamp(18px, 5vw, 56px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: var(--ink);
  font-weight: 600;
  letter-spacing: 0.01em;
}

.lamp {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--lamp);
  box-shadow: 0 0 0 4px rgba(243, 199, 123, 0.18), 0 0 24px 6px rgba(243, 199, 123, 0.55);
  animation: breathe 4s ease-in-out infinite;
}

@keyframes breathe {
  0%, 100% { box-shadow: 0 0 0 4px rgba(243, 199, 123, 0.18), 0 0 24px 6px rgba(243, 199, 123, 0.5); }
  50% { box-shadow: 0 0 0 5px rgba(243, 199, 123, 0.22), 0 0 34px 10px rgba(243, 199, 123, 0.7); }
}

.account { display: flex; gap: 18px; flex-wrap: wrap; }

.link-button {
  background: none;
  border: 0;
  padding: 0;
  color: var(--ink-soft);
  font: inherit;
  font-size: 15px;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.link-button:hover { color: var(--ink); }

main {
  flex: 1;
  display: grid;
  place-items: start center;
  padding: clamp(12px, 4vh, 48px) clamp(16px, 5vw, 56px) 48px;
}

/* Narrower than the viewport on desktop so the truck and the porch stay visible either side;
   translucent + blurred so the scene reads through without hurting legibility. */
.panel {
  width: min(1200px, 100%);
  background: var(--panel);
  border: 0;
  border-radius: calc(var(--radius) + 6px);
  box-shadow: var(--shadow);
  padding: clamp(24px, 5vw, 48px);
  -webkit-backdrop-filter: blur(14px) saturate(1.1);
  backdrop-filter: blur(14px) saturate(1.1);
  animation: rise 0.5s ease-out both;
}
@supports not (backdrop-filter: blur(1px)) {
  .panel { background: rgba(30, 24, 21, 0.92); }
}

@keyframes rise {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}

h1 {
  margin: 0 0 10px;
  font-size: clamp(28px, 4.2vw, 40px);
  line-height: 1.15;
  font-weight: 600;
  letter-spacing: -0.01em;
}

h2 { margin: 0 0 8px; font-size: 22px; font-weight: 600; }

.lede { margin: 0 0 26px; color: var(--ink-soft); font-size: 18px; max-width: 78ch; }

/* Landing hero: generous, wraps freely on narrow screens, legible over the dusk photo. */
.hero-title {
  font-size: clamp(30px, 3.6vw + 8px, 50px);
  line-height: 1.12;
  max-width: 22ch;
  overflow-wrap: anywhere;
  text-shadow: 0 2px 18px rgba(0, 0, 0, 0.6);
  margin-bottom: 14px;
}
.hero-question {
  margin: 0 0 12px;
  font-size: clamp(19px, 1.2vw + 11px, 24px);
  line-height: 1.35;
  font-weight: 500;
  color: var(--lamp);
  max-width: 44ch;
  text-shadow: 0 1px 12px rgba(0, 0, 0, 0.55);
}
.hero-lede {
  font-size: clamp(16px, 1vw + 9px, 19px);
  line-height: 1.5;
  color: var(--ink);
  max-width: 64ch;
  margin-bottom: 30px;
  text-shadow: 0 1px 10px rgba(0, 0, 0, 0.5);
}
.offer { margin: 0 0 14px; color: var(--ink-soft); font-size: 16px; max-width: 70ch; }
.fine { color: var(--ink-mute); font-size: 14px; margin: 12px 0 0; }
.notice { color: var(--ink-soft); font-size: 15px; margin: 12px 0 0; }

.actions { display: flex; gap: 12px; flex-wrap: wrap; }

.btn {
  appearance: none;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  color: var(--ink);
  font: inherit;
  font-weight: 600;
  padding: 12px 20px;
  border-radius: 999px;
  cursor: pointer;
  transition: transform 0.12s ease, background 0.2s ease, box-shadow 0.2s ease;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 10px;
}
.btn:hover { background: rgba(255, 255, 255, 0.08); }
.btn:active { transform: translateY(1px); }
.btn:focus-visible,
.link-button:focus-visible,
.tile:focus-visible,
input:focus-visible { outline: 3px solid var(--lamp); outline-offset: 3px; }
/* Programmatic focus targets (state sections, dialogs, headings) never show a ring; only real
   controls above do. */
[tabindex="-1"]:focus,
[tabindex="-1"]:focus-visible,
.panel:focus,
.panel:focus-visible,
dialog:focus,
dialog:focus-visible,
h1:focus,
h2:focus { outline: none; box-shadow: none; }

.btn.primary {
  background: linear-gradient(180deg, var(--lamp), var(--lamp-deep));
  color: #2b1d0e;
  border-color: transparent;
  box-shadow: 0 10px 30px rgba(243, 199, 123, 0.25);
}
.btn.primary:hover { filter: brightness(1.05); }
.btn.primary:disabled { opacity: 0.45; cursor: not-allowed; box-shadow: none; filter: none; }

.btn.ghost { background: transparent; }

.tiles.preview { margin-bottom: 8px; }

.preview-hint { margin: 0 0 22px; min-height: 1.4em; }

.checkout-shell { margin-top: 8px; scroll-margin-top: 16px; }
.checkout:empty { display: none; }
.checkout {
  background: #fff;
  border-radius: var(--radius);
  padding: 8px;
  min-height: 120px;
}

.restore { margin-top: 26px; border-top: 1px solid var(--line); padding-top: 18px; }
.restore summary { cursor: pointer; color: var(--ink-soft); }
.restore-form { margin-top: 14px; }
.restore-form label { display: block; font-size: 15px; color: var(--ink-soft); margin-bottom: 8px; }
.inline { display: flex; gap: 10px; flex-wrap: wrap; }

input[type="text"] {
  flex: 1 1 260px;
  font: inherit;
  padding: 11px 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.25);
  color: var(--ink);
}

.tiles {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: clamp(12px, 1.6vw, 22px);
  margin: 6px 0 26px;
}
@media (max-width: 1100px) { .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) { .tiles { grid-template-columns: 1fr; } }

/* Hero tile: the portrait IS the tile; name and tagline sit on a gradient at the bottom. */
.tile {
  --accent: var(--lamp);
  position: relative;
  display: block;
  width: 100%;
  padding: 0;
  margin: 0;
  text-align: left;
  border: 0;
  border-radius: calc(var(--radius) + 2px);
  overflow: hidden;
  background: rgba(255, 255, 255, 0.03);
  color: var(--ink);
  font: inherit;
  cursor: pointer;
  isolation: isolate;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.35);
  transition: transform 0.18s ease, box-shadow 0.25s ease;
}
.tile:hover { transform: translateY(-3px); box-shadow: 0 18px 40px rgba(0, 0, 0, 0.45); }
.tile[aria-checked="true"],
.tile.is-playing {
  box-shadow: 0 0 0 3px var(--accent), 0 0 46px 6px color-mix(in srgb, var(--accent) 45%, transparent);
}
.tile.is-playing { animation: ring 1.6s ease-in-out infinite; }
@keyframes ring {
  0%, 100% { box-shadow: 0 0 0 3px var(--accent), 0 0 30px 2px color-mix(in srgb, var(--accent) 35%, transparent); }
  50% { box-shadow: 0 0 0 5px var(--accent), 0 0 60px 10px color-mix(in srgb, var(--accent) 60%, transparent); }
}

.avatar {
  position: relative;
  display: grid;
  place-items: center;
  width: 100%;
  aspect-ratio: 4 / 5;
  overflow: hidden;
  font-weight: 700;
  font-size: clamp(40px, 5vw, 64px);
  color: #1e1510;
  background: radial-gradient(circle at 30% 30%, #fff8 0, transparent 40%), var(--accent);
}
.avatar .portrait {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 25%;
  opacity: 0;
  transform: scale(1.02);
  transition: opacity 0.4s ease, transform 0.6s ease;
}
.avatar.has-portrait .portrait { opacity: 1; }
.tile:hover .avatar.has-portrait .portrait,
.tile.is-playing .avatar.has-portrait .portrait { transform: scale(1.06); }
.avatar::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(21, 17, 15, 0) 40%, rgba(21, 17, 15, 0.55) 72%, rgba(21, 17, 15, 0.94) 100%);
  pointer-events: none;
}

/* Fixed-height caption: one name row + exactly three bio lines, so every name sits on the same
   baseline across the four tiles regardless of bio length. */
.caption {
  position: absolute;
  inset: auto 0 0 0;
  display: grid;
  grid-template-rows: 1.3em auto;
  gap: 4px;
  padding: clamp(12px, 1.6vw, 20px);
  z-index: 1;
  pointer-events: none;
}
.tile .name {
  font-weight: 600;
  font-size: clamp(18px, 1.6vw, 22px);
  line-height: 1.3;
  white-space: nowrap;
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.6);
}
.tile .blurb {
  --lines: 3;
  color: var(--ink-soft);
  font-size: clamp(13px, 1.05vw, 14.5px);
  line-height: 1.4;
  height: calc(var(--lines) * 1.4em);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.6);
}

/* "Hear her" badge on preview tiles; mirrors the tile state. */
.hear-badge {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 104px;
  height: 32px;
  padding: 0 12px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  color: #2b1d0e;
  background: linear-gradient(180deg, var(--lamp), var(--lamp-deep));
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
  transition: transform 0.15s ease;
}
.tile:hover .hear-badge { transform: scale(1.04); }
.hear-badge .play-icon { border-left-width: 10px; border-top-width: 6px; border-bottom-width: 6px; }
.tile.is-playing .hear-badge .play-icon {
  width: 10px;
  height: 12px;
  border: 0;
  border-left: 4px solid currentColor;
  border-right: 4px solid currentColor;
  margin-left: 0;
}
.tile.is-loading .hear-badge .play-icon {
  width: 12px;
  height: 12px;
  border: 3px solid rgba(43, 29, 14, 0.3);
  border-top-color: #2b1d0e;
  border-radius: 50%;
  margin: 0;
  animation: spin 0.8s linear infinite;
}

.player-bar {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
}

.btn.play { padding: 14px 26px; font-size: 18px; }
.play-icon {
  width: 0;
  height: 0;
  border-left: 14px solid currentColor;
  border-top: 9px solid transparent;
  border-bottom: 9px solid transparent;
  margin-left: 3px;
}
.btn.play.is-playing .play-icon {
  width: 14px;
  height: 18px;
  border: 0;
  border-left: 5px solid currentColor;
  border-right: 5px solid currentColor;
  margin-left: 0;
}
.btn.play.is-loading .play-icon {
  width: 16px;
  height: 16px;
  border: 3px solid rgba(43, 29, 14, 0.3);
  border-top-color: #2b1d0e;
  border-radius: 50%;
  margin: 0;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.status { margin: 0; color: var(--ink-soft); }
.status.error { color: var(--danger); }

dialog {
  border: 0;
  border-radius: var(--radius);
  background: var(--bg-2);
  color: var(--ink);
  padding: 28px;
  max-width: min(520px, 92vw);
  box-shadow: var(--shadow);
}
dialog::backdrop { background: rgba(0, 0, 0, 0.6); }
.code-box {
  display: block;
  word-break: break-all;
  padding: 12px 14px;
  background: rgba(0, 0, 0, 0.35);
  border-radius: 12px;
  margin: 14px 0 18px;
  font-size: 14px;
  user-select: all;
}

.site-footer {
  padding: 18px clamp(18px, 5vw, 56px) 30px;
  color: var(--ink-soft);
  font-size: 13.5px;
  text-align: center;
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.8);
}
.site-header { text-shadow: 0 1px 10px rgba(0, 0, 0, 0.7); }
.site-footer p { margin: 4px 0; }

.legal { width: min(760px, 100%); }
.legal h2 { margin-top: 28px; }
.legal p, .legal li { color: var(--ink-soft); }
.draft-banner {
  border: 1px dashed var(--lamp);
  border-radius: 12px;
  padding: 10px 14px;
  color: var(--lamp);
  font-size: 14px;
  margin-bottom: 20px;
}

@media (prefers-reduced-motion: reduce) {
  .lamp, .panel, .play-icon { animation: none; }
  .tile, .btn { transition: none; }
}
