/* ============================================================
   PickMyWine — website stylesheet
   Brand tokens map 1:1 to .claude/design-brief.md in the iOS app.
   Source of truth: PickMyWine/Resources/Font+Design.swift
   ============================================================ */

:root {
  /* ---- Brand palette ---- */
  --brand-burgundy: #52172A;
  --brand-deep: #1C0812;
  --brand-cream: #F2EAE0;
  --brand-gold: #C9A870;
  --brand-ink: #0C0408;

  /* ---- Text on surfaces ---- */
  --text-on-dark: #EDE5D8;
  --text-subdued: rgba(237, 229, 216, 0.55);
  --text-dim: rgba(237, 229, 216, 0.72);

  /* ---- Surfaces ---- */
  --card-border: rgba(201, 168, 112, 0.14);
  --card-border-strong: rgba(201, 168, 112, 0.45);
  --hairline-ink: rgba(12, 4, 8, 0.10);
  --hairline-gold: rgba(201, 168, 112, 0.25);
  --shadow-wine: 0 4px 20px rgba(12, 4, 8, 0.13);
  --shadow-wine-lg: 0 12px 48px rgba(12, 4, 8, 0.22);
  --glow: rgba(82, 23, 42, 0.55);

  /* ---- Cream-screen secondary tokens (mirrors gutCheck* in Font+Design.swift) ---- */
  --cream-card-bg: #F4EEE7;
  --cream-card-bg-warm: #F6F0E8;
  --cream-border: #D5CCBE;
  --cream-divider: #DDD4C5;
  --cream-muted: #9A8C7C;
  --cream-deep-burgundy: #5E1223;

  /* ---- Spacing scale ---- */
  --s-8: 0.5rem;
  --s-12: 0.75rem;
  --s-16: 1rem;
  --s-20: 1.25rem;
  --s-24: 1.5rem;
  --s-32: 2rem;
  --s-48: 3rem;
  --s-56: 3.5rem;
  --s-80: 5rem;
  --s-120: 7.5rem;

  /* ---- Spring (mirrors app: damping 0.88, stiffness 180 ≈ 0.35s ease-out) ---- */
  --spring: cubic-bezier(0.22, 0.61, 0.36, 1);
  --spring-fast: cubic-bezier(0.4, 0, 0.2, 1);

  /* ---- Type ---- */
  --font-serif: "Cormorant Garamond", "Cormorant", "Times New Roman", Georgia, serif;
  --font-sans: "DM Sans", -apple-system, BlinkMacSystemFont, "Helvetica Neue", system-ui, sans-serif;
}

/* ============================================================
   Reset & base
   ============================================================ */

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

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

body {
  margin: 0;
  font-family: var(--font-sans);
  font-weight: 300;
  font-size: 15px;
  line-height: 1.55;
  color: var(--brand-ink);
  background: var(--brand-cream);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

img, svg { display: block; max-width: 100%; }

a {
  color: inherit;
  text-decoration: none;
  transition: opacity 0.2s var(--spring-fast);
}
a:hover { opacity: 0.72; }

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
}

/* ============================================================
   Typography utilities
   ============================================================ */

.h-display {
  font-family: var(--font-serif);
  font-weight: 400;
  font-size: clamp(2.6rem, 6vw + 1rem, 4.6rem);
  line-height: 1.04;
  letter-spacing: 0.005em;
  margin: 0;
}

.h-section {
  font-family: var(--font-serif);
  font-weight: 400;
  font-size: clamp(1.85rem, 2.4vw + 1rem, 2.6rem);
  line-height: 1.12;
  letter-spacing: 0.005em;
  margin: 0;
}

.h-card {
  font-family: var(--font-serif);
  font-weight: 400;
  font-size: 1.4rem;
  line-height: 1.2;
  letter-spacing: 0.005em;
  margin: 0;
}

.wine-name {
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 400;
  font-size: 1.3rem;
  letter-spacing: 0.005em;
  margin: 0;
}

.eyebrow {
  font-family: var(--font-sans);
  font-weight: 300;
  font-size: 0.72rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--brand-gold);
  margin: 0 0 var(--s-16) 0;
}

.eyebrow--dark { color: rgba(201, 168, 112, 0.85); }

.lede {
  font-family: var(--font-sans);
  font-weight: 300;
  font-size: clamp(1.05rem, 0.5vw + 0.95rem, 1.2rem);
  line-height: 1.55;
  color: rgba(12, 4, 8, 0.72);
  max-width: 36rem;
  margin: var(--s-20) 0 0 0;
}

.lede--dark { color: var(--text-dim); }

/* ============================================================
   Layout helpers
   ============================================================ */

.container {
  width: 100%;
  max-width: 1140px;
  margin: 0 auto;
  padding: 0 var(--s-24);
}

.section {
  padding: var(--s-120) 0;
  position: relative;
}

.section--tight { padding: var(--s-80) 0; }

@media (max-width: 720px) {
  .section { padding: var(--s-80) 0; }
  .section--tight { padding: var(--s-48) 0; }
}

.section--dark {
  background: linear-gradient(180deg, var(--brand-burgundy) 0%, var(--brand-deep) 100%);
  color: var(--text-on-dark);
  overflow: hidden;
}

.section--dark::before {
  /* Soft radial glow behind hero content — mirrors --glow on iOS dark screens */
  content: "";
  position: absolute;
  inset: -10% 20%;
  background: radial-gradient(closest-side, var(--glow), transparent 70%);
  pointer-events: none;
  z-index: 0;
}

.section--dark .container { position: relative; z-index: 1; }

.section--cream { background: var(--brand-cream); }

.fine-rule {
  height: 0.5px;
  background: var(--hairline-gold);
  border: 0;
  margin: var(--s-32) 0;
}

.fine-rule--ink { background: var(--hairline-ink); }

/* ============================================================
   Nav
   ============================================================ */

.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  background: rgba(28, 8, 18, 0.55);
  border-bottom: 0.5px solid rgba(201, 168, 112, 0.18);
}

.nav__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}

.wordmark {
  font-family: var(--font-serif);
  font-weight: 400;
  font-size: 1.4rem;
  letter-spacing: 0.04em;
  color: var(--text-on-dark);
}

.wordmark em {
  font-style: italic;
  color: var(--brand-gold);
}

.nav__links {
  display: flex;
  gap: var(--s-32);
  align-items: center;
}

.nav__link {
  font-family: var(--font-sans);
  font-weight: 300;
  font-size: 0.92rem;
  color: var(--text-dim);
}

.nav__link:hover { color: var(--text-on-dark); opacity: 1; }

@media (max-width: 720px) {
  /* Tighten gaps and shrink section links — keep them visible. The
     "Join waitlist" button alone reads as a nag; the page is short
     enough that anchor links earn their space. */
  .nav__links { gap: var(--s-16); }
  .nav__link { font-size: 0.82rem; }
}

@media (max-width: 480px) {
  /* Below iPhone SE width, fall back to button-only — but the button
     stays as the primary action. */
  .nav__links .nav__link { display: none; }
}

/* ============================================================
   Buttons (capsule, never rounded-rectangle)
   ============================================================ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s-8);
  font-family: var(--font-sans);
  font-weight: 400;
  font-size: 0.95rem;
  line-height: 1;
  padding: 0 var(--s-32);
  height: 52px;
  border-radius: 999px;
  white-space: nowrap;
  transition: transform 0.25s var(--spring), background 0.25s var(--spring-fast), opacity 0.25s;
  border: 0.5px solid transparent;
}

.btn:hover { transform: translateY(-1px); opacity: 1; }
.btn:active { transform: translateY(0); }

.btn--primary {
  background: var(--brand-burgundy);
  color: var(--text-on-dark);
  box-shadow: var(--shadow-wine);
}
.btn--primary:hover { background: #5E1A2F; }

.btn--cream {
  background: #EFE2C4;
  color: #1C0A10;
}
.btn--cream:hover { background: #F5E9D0; }

.btn--ghost {
  background: transparent;
  color: var(--text-on-dark);
  border-color: rgba(201, 168, 112, 0.5);
}
.btn--ghost:hover { background: rgba(201, 168, 112, 0.08); }

.btn--sm { height: 40px; padding: 0 var(--s-20); font-size: 0.85rem; }

/* ============================================================
   Hero — two-column at desktop (text + phone), stacked on mobile
   ============================================================ */

.hero { padding: var(--s-120) 0 var(--s-80); min-height: 92vh; display: flex; align-items: center; }

.hero__grid {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: var(--s-56);
  align-items: center;
  width: 100%;
}

.hero__copy { max-width: 32rem; }

.hero__headline em {
  font-style: italic;
  color: var(--brand-gold);
}

.hero__sub {
  margin: var(--s-24) 0 0 0;
  font-size: clamp(1.05rem, 0.4vw + 1rem, 1.15rem);
  color: var(--text-dim);
}

.hero__form {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-12);
  margin: var(--s-48) 0 0 0;
  max-width: 32rem;
  align-items: stretch;
}

.hero__form .field { flex: 1 1 auto; }

/* Inline validation / submit-error — placed below the input + button row.
   The JS adds .form-error to the form on validation failure. Width:100%
   forces it onto its own flex line (the form has flex-wrap: wrap). */
.hero__form .form-error {
  flex-basis: 100%;
  width: 100%;
  margin: 0;
  padding-left: var(--s-20, 20px);
  font-family: "DM Sans", sans-serif;
  font-size: 0.82rem;
  line-height: 1.4;
  color: #E0928C;
  text-align: left;
}

.hero__caption {
  margin-top: var(--s-16);
  font-size: 0.85rem;
  letter-spacing: 0.005em;
  color: var(--text-subdued);
}

.hero__phone {
  display: flex;
  justify-content: center;
}

@media (max-width: 860px) {
  .hero__grid {
    grid-template-columns: 1fr;
    gap: var(--s-32);
    text-align: center;
  }
  .hero__copy { max-width: 36rem; margin: 0 auto; }
  .hero__sub { margin-left: auto; margin-right: auto; }
  .hero__form { margin-left: auto; margin-right: auto; }
  .hero__phone { order: 2; }
  /* Drop the eyebrow on mobile so the phone screenshot peeks above
     the fold and immediately signals "this is an app". */
  .hero__eyebrow { display: none; }
}

@media (max-width: 560px) {
  .hero__form { flex-direction: column; }
  .hero__form .btn { width: 100%; }
}

/* ============================================================
   Phone frame — used in hero and features section
   ============================================================ */

.phone-frame {
  width: 100%;
  max-width: 300px;
  padding: 10px;
  background: linear-gradient(160deg, #2a1119 0%, #110509 100%);
  border-radius: 48px;
  position: relative;
  box-shadow:
    0 30px 80px -16px rgba(12, 4, 8, 0.55),
    0 8px 28px -8px rgba(12, 4, 8, 0.35),
    inset 0 0 0 0.5px rgba(201, 168, 112, 0.20);
  transform: translateZ(0);
}

.phone-frame::before {
  /* Subtle gold edge highlight along the top — fine-china detail */
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 48px;
  background: linear-gradient(180deg, rgba(201, 168, 112, 0.18), transparent 18%);
  pointer-events: none;
  mix-blend-mode: screen;
}

.phone-frame__screen {
  position: relative;
  display: block;
  width: 100%;
  border-radius: 38px;
  background: var(--brand-cream);
  overflow: hidden;
  isolation: isolate;
}

.phone-frame__screen img {
  display: block;
  width: 100%;
  height: auto;
}

.phone-frame--features { max-width: 320px; }
.phone-frame--video    { max-width: 360px; }

.phone-frame__screen video {
  display: block;
  width: 100%;
  height: auto;
}

@media (max-width: 560px) {
  .phone-frame { max-width: 260px; padding: 8px; border-radius: 42px; }
  .phone-frame::before { border-radius: 42px; }
  .phone-frame__screen { border-radius: 34px; }
  .phone-frame--video { max-width: 280px; }
}

/* ============================================================
   Video section — "Watch it choose"
   Sits between Three Steps and What-you-get-back.
   Both neighbours are dark/cream — we keep this one dark so the
   in-store viewfinder content reads strongest, and shift the glow
   placement so the section reads as visually distinct from the
   Three Steps section above.
   ============================================================ */

.section--video {
  padding: var(--s-80) 0 var(--s-120);
}

.section--video::before {
  /* Reposition the radial glow so it sits behind the phone, not above the heading. */
  inset: 25% -10% -15% -10%;
  background: radial-gradient(closest-side, var(--glow), transparent 65%);
}

.video-section__phone {
  display: flex;
  justify-content: center;
  margin-top: var(--s-56);
}

.video-section__caption {
  text-align: center;
  margin-top: var(--s-32);
  font-family: var(--font-sans);
  font-weight: 300;
  font-size: 0.78rem;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  color: var(--text-subdued);
}

/* ============================================================
   Form field (cream input on dark surface)
   ============================================================ */

.field {
  position: relative;
}

.field input {
  width: 100%;
  height: 52px;
  padding: 0 var(--s-20);
  background: rgba(237, 229, 216, 0.06);
  border: 0.5px solid rgba(237, 229, 216, 0.22);
  border-radius: 999px;
  color: var(--text-on-dark);
  font-family: var(--font-sans);
  font-weight: 300;
  font-size: 0.95rem;
  letter-spacing: 0.005em;
  transition: border-color 0.2s var(--spring-fast), background 0.2s;
  outline: none;
}

.field input::placeholder { color: var(--text-subdued); }
.field input:focus {
  border-color: var(--brand-gold);
  background: rgba(237, 229, 216, 0.10);
}

.field--cream input {
  background: var(--brand-cream);
  border-color: rgba(12, 4, 8, 0.15);
  color: var(--brand-ink);
}
.field--cream input::placeholder { color: rgba(12, 4, 8, 0.45); }
.field--cream input:focus { border-color: var(--brand-gold); background: #FFFFFF; }

/* ============================================================
   "Two moments" — restaurant vs shop
   ============================================================ */

.moments {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--s-32);
  margin-top: var(--s-56);
}

@media (max-width: 720px) {
  .moments { grid-template-columns: 1fr; gap: var(--s-20); }
}

.moment-card {
  padding: var(--s-32);
  border-radius: 20px;
  background: var(--cream-card-bg);
  border: 0.5px solid var(--cream-border);
  box-shadow: var(--shadow-wine);
  transition: transform 0.35s var(--spring), box-shadow 0.35s var(--spring);
}

.moment-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-wine-lg); }

.moment-card__icon {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: 0.5px solid var(--brand-gold);
  color: var(--brand-burgundy);
  margin-bottom: var(--s-20);
}

.moment-card__icon svg { width: 22px; height: 22px; }

.moment-card h3 { margin-bottom: var(--s-12); }
.moment-card p { color: rgba(12, 4, 8, 0.72); margin: 0; }

/* ============================================================
   How it works — 3 steps
   ============================================================ */

.steps {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--s-32);
  margin-top: var(--s-56);
}

@media (max-width: 720px) { .steps { grid-template-columns: 1fr; gap: var(--s-24); } }

.step {
  text-align: left;
  padding: var(--s-32) var(--s-24);
  border-top: 0.5px solid var(--hairline-gold);
}

.step__num {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 2.6rem;
  line-height: 1;
  color: var(--brand-gold);
  margin-bottom: var(--s-16);
}

.step h3 {
  color: var(--text-on-dark);
  margin: 0 0 var(--s-12) 0;
}

.step p {
  color: var(--text-dim);
  margin: 0;
}

/* ============================================================
   Features grid
   ============================================================ */

.features-layout {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: var(--s-56);
  align-items: center;
  margin-top: var(--s-56);
}

@media (max-width: 900px) {
  .features-layout { grid-template-columns: 1fr; gap: var(--s-32); }
}

.feature-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.feature-list li {
  padding: var(--s-24) 0;
  border-top: 0.5px solid var(--hairline-ink);
}

.feature-list li:last-child { border-bottom: 0.5px solid var(--hairline-ink); }

.feature-list h4 {
  font-family: var(--font-serif);
  font-weight: 400;
  font-size: 1.3rem;
  margin: 0 0 var(--s-8) 0;
  letter-spacing: 0.005em;
}

.feature-list p {
  margin: 0;
  color: rgba(12, 4, 8, 0.72);
  font-size: 0.95rem;
  line-height: 1.55;
}

/* ============================================================
   FAQ accordion
   ============================================================ */

.faq { max-width: 720px; margin: var(--s-56) auto 0; }

.faq__item {
  border-top: 0.5px solid var(--hairline-ink);
}

.faq__item:last-child { border-bottom: 0.5px solid var(--hairline-ink); }

.faq__q {
  width: 100%;
  text-align: left;
  padding: var(--s-24) 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--s-24);
  font-family: var(--font-serif);
  font-weight: 400;
  font-size: 1.25rem;
  color: var(--brand-ink);
  letter-spacing: 0.005em;
}

.faq__q::after {
  content: "+";
  font-family: var(--font-sans);
  font-weight: 300;
  font-size: 1.4rem;
  color: var(--brand-gold);
  transition: transform 0.35s var(--spring);
  flex-shrink: 0;
}

.faq__item[open] .faq__q::after { transform: rotate(45deg); }

.faq__a {
  padding: 0 0 var(--s-24) 0;
  color: rgba(12, 4, 8, 0.72);
  max-width: 56ch;
  margin: 0;
  font-size: 0.98rem;
  line-height: 1.6;
}

.faq__item summary { list-style: none; cursor: pointer; }
.faq__item summary::-webkit-details-marker { display: none; }

/* ============================================================
   Founder note — single paragraph, signed
   Sits between Features and FAQ. Uses .section--tight padding
   so it doesn't compete with the larger sections around it.
   ============================================================ */

.section--founder { padding: var(--s-80) 0 var(--s-48); }

.founder {
  max-width: 36rem;
  margin: 0 auto;
  text-align: center;
}

.founder .eyebrow { margin-bottom: var(--s-24); }

.founder__body {
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 400;
  font-size: clamp(1.15rem, 0.5vw + 1.05rem, 1.4rem);
  line-height: 1.55;
  color: rgba(12, 4, 8, 0.82);
  letter-spacing: 0.005em;
  margin: 0;
}

.founder__sign {
  font-family: var(--font-sans);
  font-weight: 400;
  font-size: 0.9rem;
  color: rgba(12, 4, 8, 0.62);
  margin: var(--s-20) 0 0 0;
  letter-spacing: 0.02em;
}

/* ============================================================
   Footer
   ============================================================ */

.footer {
  background: var(--brand-deep);
  color: var(--text-dim);
  padding: var(--s-56) 0 var(--s-32);
  font-size: 0.88rem;
}

.footer__inner {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--s-24);
  align-items: flex-end;
}

.footer__brand {
  font-family: var(--font-serif);
  font-size: 1.6rem;
  color: var(--text-on-dark);
  letter-spacing: 0.04em;
  margin-bottom: var(--s-8);
}

.footer__brand em { color: var(--brand-gold); font-style: italic; }

.footer__tag {
  color: var(--text-subdued);
  font-size: 0.82rem;
  letter-spacing: 0.06em;
}

.footer__links {
  display: flex;
  gap: var(--s-24);
}

.footer__links a {
  color: var(--text-dim);
}

.footer__copy {
  text-align: center;
  margin-top: var(--s-32);
  padding-top: var(--s-24);
  border-top: 0.5px solid rgba(237, 229, 216, 0.08);
  color: var(--text-subdued);
  font-size: 0.78rem;
  letter-spacing: 0.06em;
}

.footer__age {
  display: block;
  margin-top: var(--s-8);
  font-size: 0.72rem;
  color: rgba(237, 229, 216, 0.42);
  letter-spacing: 0.08em;
}

/* ============================================================
   Reveal-on-scroll
   ============================================================ */

.reveal {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.6s var(--spring), transform 0.6s var(--spring);
}

.reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* Stagger children */
.reveal.is-visible > * { animation: rise 0.6s var(--spring) backwards; }
.reveal.is-visible > *:nth-child(1) { animation-delay: 0.00s; }
.reveal.is-visible > *:nth-child(2) { animation-delay: 0.06s; }
.reveal.is-visible > *:nth-child(3) { animation-delay: 0.12s; }
.reveal.is-visible > *:nth-child(4) { animation-delay: 0.18s; }

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

@media (prefers-reduced-motion: reduce) {
  .reveal, .reveal.is-visible > * { opacity: 1; transform: none; animation: none; transition: none; }
}

/* ============================================================
   Legal pages
   ============================================================ */

.legal {
  max-width: 720px;
  margin: 0 auto;
  padding: var(--s-80) var(--s-24);
}

.legal h1 {
  font-family: var(--font-serif);
  font-weight: 400;
  font-size: clamp(2.2rem, 3vw + 1rem, 3.2rem);
  line-height: 1.1;
  margin: 0 0 var(--s-12) 0;
  letter-spacing: 0.005em;
}

.legal .legal__updated {
  font-family: var(--font-sans);
  font-weight: 300;
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--cream-muted);
  margin: 0 0 var(--s-48) 0;
}

.legal h2 {
  font-family: var(--font-serif);
  font-weight: 400;
  font-size: 1.5rem;
  margin: var(--s-48) 0 var(--s-16) 0;
  letter-spacing: 0.005em;
}

.legal h3 {
  font-family: var(--font-sans);
  font-weight: 500;
  font-size: 1rem;
  margin: var(--s-24) 0 var(--s-8) 0;
  letter-spacing: 0.01em;
}

.legal p, .legal li {
  color: rgba(12, 4, 8, 0.78);
  line-height: 1.65;
  font-size: 1rem;
}

.legal ul { padding-left: var(--s-20); }
.legal li { padding: 4px 0; }

.legal a { color: var(--brand-burgundy); text-decoration: underline; text-underline-offset: 3px; }

.legal__note {
  background: var(--cream-card-bg);
  border-left: 2px solid var(--brand-gold);
  padding: var(--s-20) var(--s-24);
  border-radius: 4px;
  font-size: 0.92rem;
  color: rgba(12, 4, 8, 0.72);
  margin: var(--s-32) 0;
}

.legal__back {
  font-family: var(--font-sans);
  font-weight: 300;
  font-size: 0.88rem;
  color: var(--brand-burgundy);
  letter-spacing: 0.01em;
}
