/* Talking Postcard -- landing page
   Mobile-first. No external fonts, no CDN assets. Deep evergreen/navy ground,
   warm gold accent, elegant rather than corporate. */

:root {
  --evergreen-900: #04150f;
  --evergreen-800: #08241d;
  --evergreen-700: #0c322a;
  --navy-900: #051524;
  --navy-800: #0a2236;

  --gold-400: #f0cd88;
  --gold-500: #e3b25c;
  --gold-600: #c9903a;

  --cream: #f7f1e3;
  --cream-dim: rgba(247, 241, 227, 0.72);
  --cream-faint: rgba(247, 241, 227, 0.5);

  --line: rgba(240, 205, 136, 0.22);
  --panel: rgba(255, 255, 255, 0.045);

  --focus: #ffe6ae;
  --danger: #ffb4a2;

  --radius-lg: 22px;
  --radius-md: 14px;
  --maxw: 30rem;

  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua",
    Georgia, "Times New Roman", serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue",
    Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  padding: 0;
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.5;
  color: var(--cream);
  /* Solid colour matches the gradient's tail so short pages never show a seam. */
  background-color: var(--navy-900);
  background-image:
    radial-gradient(120% 70% at 50% -10%, rgba(227, 178, 92, 0.22) 0%, rgba(227, 178, 92, 0) 60%),
    radial-gradient(100% 60% at 85% 105%, rgba(10, 34, 54, 0.9) 0%, rgba(10, 34, 54, 0) 65%),
    linear-gradient(168deg, var(--evergreen-800) 0%, var(--evergreen-900) 45%, var(--navy-900) 100%);
  background-repeat: no-repeat;
  background-size: 100% 100%;
  background-attachment: scroll;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

@supports (min-height: 100dvh) {
  body {
    min-height: 100dvh;
  }
}

/* ---------- string of lights across the top ---------- */

.lights {
  position: relative;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 2px;
  padding: 0 6px;
  height: 26px;
  border-top: 2px solid rgba(240, 205, 136, 0.28);
  pointer-events: none;
}

.bulb {
  display: block;
  width: 7px;
  height: 11px;
  margin-top: 3px;
  border-radius: 0 0 50% 50% / 0 0 70% 70%;
  background: var(--gold-400);
  box-shadow: 0 0 10px 2px rgba(240, 205, 136, 0.55);
  opacity: 0.9;
  animation: twinkle 3.6s ease-in-out infinite;
}

.bulb:nth-child(odd) {
  background: #ffdca4;
  animation-delay: 1.2s;
}

.bulb:nth-child(3n) {
  animation-delay: 2.1s;
  height: 9px;
}

@keyframes twinkle {
  0%, 100% { opacity: 0.95; }
  50% { opacity: 0.4; }
}

/* ---------- layout ---------- */

.wrap {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 22px 20px calc(38px + env(safe-area-inset-bottom, 0px));
  display: flex;
  flex-direction: column;
  gap: 26px;
}

.masthead {
  text-align: center;
}

.eyebrow {
  margin: 0 0 6px;
  font-size: 0.68rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--gold-500);
}

.brand {
  margin: 0;
  font-family: var(--serif);
  font-size: 1.55rem;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: 0.01em;
  color: var(--cream);
}

/* ---------- hero ---------- */

.hero {
  margin: 0;
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: 0 18px 40px -22px rgba(0, 0, 0, 0.85);
}

.hero-img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 3 / 2;
  object-fit: cover;
  background: var(--evergreen-700);
}

.hero-caption {
  padding: 10px 14px 12px;
  font-size: 0.82rem;
  letter-spacing: 0.04em;
  color: var(--cream-dim);
  text-align: center;
}

/* ---------- greeting ---------- */

.greeting {
  text-align: center;
}

.hello {
  margin: 0 0 8px;
  font-family: var(--serif);
  font-size: 1.9rem;
  font-weight: 600;
  line-height: 1.15;
  color: var(--gold-400);
}

.offer {
  margin: 0;
  font-size: 1.02rem;
  color: var(--cream-dim);
  text-wrap: pretty;
}

/* ---------- talk / mic ---------- */

.talk {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

.mic {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 15rem;
  height: 15rem;
  max-width: 78vw;
  max-height: 78vw;
  padding: 0;
  border: 0;
  border-radius: 50%;
  cursor: pointer;
  color: var(--evergreen-900);
  font-family: inherit;
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  background: radial-gradient(circle at 32% 26%, #ffe3ae 0%, var(--gold-500) 52%, var(--gold-600) 100%);
  box-shadow:
    0 0 0 1px rgba(255, 236, 200, 0.5) inset,
    0 22px 46px -18px rgba(227, 178, 92, 0.6),
    0 0 60px -12px rgba(227, 178, 92, 0.45);
  -webkit-tap-highlight-color: transparent;
  transition: transform 140ms ease, box-shadow 200ms ease, background 250ms ease;
  touch-action: manipulation;
}

.mic:active {
  transform: scale(0.975);
}

.mic:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 5px;
}

.mic-face {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 4.6rem;
  height: 4.6rem;
}

.mic-icon,
.stop-icon {
  width: 100%;
  height: 100%;
  fill: currentColor;
}

.stop-icon {
  display: none;
}

.mic-label {
  padding: 0 1rem;
  font-size: 1.02rem;
  text-align: center;
  text-wrap: balance;
}

/* pulse rings */
.mic-ring {
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  border: 2px solid rgba(240, 205, 136, 0.55);
  opacity: 0;
  pointer-events: none;
}

/* --- states --- */

.mic[data-state="connecting"] {
  background: radial-gradient(circle at 32% 26%, #ffeccb 0%, var(--gold-500) 55%, var(--gold-600) 100%);
  cursor: progress;
}

.mic[data-state="connecting"] .mic-ring {
  animation: ripple 1.6s ease-out infinite;
  opacity: 1;
}

.mic[data-state="connecting"] .mic-ring-2 {
  animation-delay: 0.8s;
}

.mic[data-state="listening"] .mic-ring,
.mic[data-state="speaking"] .mic-ring {
  animation: ripple 2.4s ease-out infinite;
  opacity: 1;
}

.mic[data-state="listening"] .mic-ring-2,
.mic[data-state="speaking"] .mic-ring-2 {
  animation-delay: 1.2s;
}

.mic[data-state="listening"] {
  background: radial-gradient(circle at 32% 26%, #fff3d8 0%, #f2d69a 50%, var(--gold-500) 100%);
}

.mic[data-state="speaking"] {
  color: var(--evergreen-900);
  background: radial-gradient(circle at 32% 26%, #ffffff 0%, #ffe9bd 45%, var(--gold-500) 100%);
  animation: breathe 1.9s ease-in-out infinite;
}

.mic[data-state="listening"] .mic-icon,
.mic[data-state="speaking"] .mic-icon,
.mic[data-state="connecting"] .mic-icon {
  display: none;
}

.mic[data-state="listening"] .stop-icon,
.mic[data-state="speaking"] .stop-icon,
.mic[data-state="connecting"] .stop-icon {
  display: block;
}

/* Error state is still tappable ("Tap to try again"); only a hard-disabled
   button (voice module never loaded) is truly inert. */
.mic[data-state="error"],
.mic[disabled] {
  background: rgba(255, 255, 255, 0.08);
  color: var(--cream-faint);
  box-shadow: 0 0 0 1px rgba(247, 241, 227, 0.14) inset;
}

.mic[disabled] {
  cursor: not-allowed;
}

.mic[data-state="error"] .stop-icon,
.mic[disabled] .stop-icon {
  display: none;
}

.mic[data-state="error"] .mic-icon,
.mic[disabled] .mic-icon {
  display: block;
}

@keyframes ripple {
  0% { transform: scale(1); opacity: 0.75; }
  100% { transform: scale(1.28); opacity: 0; }
}

@keyframes breathe {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.035); }
}

.status {
  margin: 0;
  min-height: 1.4em;
  font-size: 0.98rem;
  color: var(--cream-dim);
  text-align: center;
}

.alert {
  margin: 0;
  max-width: 24rem;
  padding: 12px 14px;
  border: 1px solid rgba(255, 180, 162, 0.4);
  border-radius: var(--radius-md);
  background: rgba(255, 180, 162, 0.1);
  color: var(--danger);
  font-size: 0.94rem;
  text-align: center;
}

/* ---------- fallback ---------- */

.fallback {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding-top: 4px;
  transition: transform 200ms ease;
}

.call-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 54px;
  width: 100%;
  max-width: 22rem;
  padding: 14px 20px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
  color: var(--cream);
  font-size: 1rem;
  font-weight: 600;
  text-decoration: none;
  transition: background 160ms ease, border-color 160ms ease, transform 120ms ease;
}

.call-btn:active {
  transform: scale(0.985);
}

.call-btn:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}

.call-icon {
  width: 20px;
  height: 20px;
  fill: var(--gold-400);
  flex: none;
}

.fallback[data-prominent="1"] .call-btn {
  border-color: var(--gold-500);
  background: linear-gradient(180deg, var(--gold-400) 0%, var(--gold-500) 100%);
  color: var(--evergreen-900);
  box-shadow: 0 16px 34px -18px rgba(227, 178, 92, 0.8);
}

.fallback[data-prominent="1"] .call-icon {
  fill: var(--evergreen-900);
}

.book {
  margin: 0;
}

.book-link {
  color: var(--cream-faint);
  font-size: 0.88rem;
  text-decoration: none;
  border-bottom: 1px solid rgba(247, 241, 227, 0.22);
  padding-bottom: 1px;
}

.book-link:hover,
.book-link:focus {
  color: var(--gold-400);
  border-bottom-color: var(--gold-400);
}

.book-link:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 3px;
  border-radius: 3px;
}

/* ---------- footer ---------- */

.foot {
  margin-top: 4px;
  padding-top: 18px;
  border-top: 1px solid rgba(247, 241, 227, 0.1);
  text-align: center;
}

.notice {
  margin: 0 0 10px;
  font-size: 0.78rem;
  line-height: 1.45;
  color: var(--cream-faint);
}

.notyou {
  margin: 0 0 12px;
  font-size: 0.86rem;
  color: var(--cream-faint);
}

.linkish {
  padding: 4px 2px;
  border: 0;
  border-bottom: 1px solid rgba(240, 205, 136, 0.55);
  background: none;
  color: var(--gold-400);
  font: inherit;
  font-size: inherit;
  cursor: pointer;
}

.linkish:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 3px;
  border-radius: 3px;
}

.mark {
  margin: 0;
  font-size: 0.7rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(247, 241, 227, 0.28);
}

/* ---------- personalized / generic switching ---------- */

body.is-generic .personal-only {
  display: none !important;
}

body.is-personalized .generic-only {
  display: none !important;
}

/* ---------- a11y helpers ---------- */

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

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

/* ---------- larger phones / small tablets ---------- */

@media (min-width: 480px) {
  body {
    font-size: 18px;
  }

  .brand {
    font-size: 1.75rem;
  }

  .hello {
    font-size: 2.1rem;
  }
}

/* ---------- motion preferences ---------- */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }

  .mic[data-state="speaking"] {
    box-shadow:
      0 0 0 4px rgba(255, 255, 255, 0.55) inset,
      0 22px 46px -18px rgba(227, 178, 92, 0.6);
  }

  .mic[data-state="listening"] .mic-ring,
  .mic[data-state="speaking"] .mic-ring,
  .mic[data-state="connecting"] .mic-ring {
    opacity: 0.55;
    animation: none;
  }
}
