:root {
  --header-height: 76px;
  --hero-offset: 96px;
}
@media (max-width: 767px) {
  :root { --hero-offset: 88px; }
}
html { scroll-padding-top: var(--hero-offset); }
#email-input { scroll-margin-top: var(--hero-offset); }

/* Skip link (keyboard / screen reader) */
.skip-link {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0);
  white-space: nowrap; border: 0;
  z-index: 100;
}
.skip-link:focus {
  position: fixed;
  width: auto; height: auto;
  margin: 0;
  overflow: visible; clip: auto;
  left: 1rem; top: 1rem;
  padding: 0.65rem 1.1rem;
  background: #E8836A;
  color: #fff;
  font-weight: 600;
  font-size: 0.875rem;
  border-radius: 0.65rem;
  box-shadow: 0 4px 20px rgba(45,31,26,0.2);
}

:focus-visible {
  outline: 2px solid #E8836A;
  outline-offset: 2px;
}
.email-input:focus-visible {
  outline: none;
  border-color: #E8836A;
  box-shadow: 0 0 0 4px rgba(232,131,106,0.14);
}

@media (prefers-reduced-motion: reduce) {
  .hero-animate { animation: none !important; opacity: 1 !important; }
  .dot-live { animation: none !important; opacity: 1 !important; }
  .btn-primary:hover:not(:disabled),
  .btn-primary:active:not(:disabled) { transform: none !important; }
  .feature-card:hover { transform: none !important; }
  .card-reveal { transform: none !important; transition: opacity 0.25s ease !important; }
  .success-animate { animation: none !important; }
  .form-fade-out { animation: none !important; opacity: 0 !important; }
  .site-header { transition: none !important; }
  .preview-card { animation: none !important; }
}

/* Preview thread: subtle lift-in (reduced motion: see block above .preview-card) */
@keyframes preview-card-enter {
  from { opacity: 0.92; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}
.preview-demo.is-ready .preview-card {
  animation: preview-card-enter 700ms cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

/* ─────────────────────────────────────
   BASE — mobile-first, never modified
─────────────────────────────────────── */
body {
  background-color: #FAF7F4;
  color: #2D1F1A;
  font-family: 'DM Sans', sans-serif;
  -webkit-font-smoothing: antialiased;
}
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.025'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 0;
}
* { position: relative; z-index: 1; }

/* Hero fills viewport on desktop (see .hero-stage) */
.hero-stage { position: relative; z-index: 1; }

/* Gradient blob — scoped to hero stage only */
.hero-blob { position: absolute; inset: 0; pointer-events: none; z-index: 0; overflow: hidden; }
.hero-blob::before {
  content: '';
  position: absolute; top: 50%; left: 50%;
  transform: translate(-50%, -55%);
  width: 560px; height: 360px; border-radius: 50%;
  background: radial-gradient(ellipse at 50% 50%, rgba(232,131,106,0.055) 0%, rgba(252,238,233,0.07) 45%, transparent 72%);
  filter: blur(48px);
}
.hero-blob::after {
  content: '';
  position: absolute; top: 50%; left: 55%;
  transform: translate(-30%, -40%);
  width: 280px; height: 220px; border-radius: 50%;
  background: radial-gradient(ellipse at 50% 50%, rgba(232,131,106,0.035) 0%, transparent 65%);
  filter: blur(36px);
}

/* Navbar lockup */
.nav-wordmark {
  font-family: 'Playfair Display', Georgia, serif;
  font-weight: 700;
  color: #E8836A;
  font-size: 1.3125rem;
  line-height: 1;
  letter-spacing: 0.03em;
}
@media (min-width: 768px) {
  .nav-wordmark { font-size: 1.5rem; }
}

/* Preview example toggle (hero + mobile) */
.preview-example-toggle .preview-tab {
  border-radius: 0.65rem;
  padding: 0.4rem 0.85rem;
  font-size: 0.72rem;
  font-weight: 600;
  color: #9C8880;
  background: transparent;
  border: none;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
  white-space: nowrap;
}
@media (min-width: 768px) {
  .preview-example-toggle .preview-tab { font-size: 0.78rem; padding: 0.45rem 1rem; }
}
.preview-example-toggle .preview-tab:hover { color: #2D1F1A; }
.preview-example-toggle .preview-tab[aria-selected="true"] {
  background: #FFFFFF;
  color: #E8836A;
  box-shadow: 0 1px 4px rgba(45,31,26,0.08);
}
.site-header {
  background-color: #FFFBF9;
  border-bottom: 1px solid transparent;
  box-shadow: none;
  transition: box-shadow 0.22s ease, border-color 0.22s ease;
}
.site-header.is-scrolled {
  border-bottom-color: rgba(237, 232, 229, 0.85);
  box-shadow: 0 2px 12px 0 rgba(45, 31, 26, 0.06);
}

/* Buttons */
.btn-primary { transition: background-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease; }
.btn-primary:hover:not(:disabled) { background-color: #C85D42; transform: scale(1.03); box-shadow: 0 6px 20px rgba(232,131,106,0.38); }
.btn-primary:active:not(:disabled) { transform: scale(1); }
.btn-primary:disabled { opacity: 0.7; cursor: not-allowed; }

/* Input */
.email-input { transition: border-color 0.2s ease, box-shadow 0.2s ease; }
.email-input:focus { outline: none; border-color: #E8836A; box-shadow: 0 0 0 4px rgba(232,131,106,0.14); }

/* Connected form row */
.form-row {
  display: flex; align-items: stretch; width: 100%;
  border-radius: 1rem; overflow: hidden;
  box-shadow: 0 2px 12px 0 rgba(45,31,26,0.08);
}
.form-row .email-input { flex: 1; border-radius: 0; border: 1.5px solid #EDE8E5; border-right: none; box-shadow: none; padding: 1rem 1.25rem; }
.form-row .email-input:focus { border-color: #E8836A; box-shadow: none; z-index: 1; }
.form-row .btn-primary { border-radius: 0; box-shadow: none; padding: 1rem 1.5rem; white-space: nowrap; flex-shrink: 0; }
.form-row .btn-primary:hover:not(:disabled) { transform: none; box-shadow: none; background-color: #C85D42; }
@media (max-width: 639px) {
  .form-row { flex-direction: column; }
  .form-row .email-input { border-right: 1.5px solid #EDE8E5; border-bottom: none; border-radius: 0; }
  .form-row .btn-primary { border-radius: 0; width: 100%; }
}

/* Feature cards */
.cards-grid { display: grid; grid-template-columns: 1fr; gap: 1.25rem; align-items: stretch; }
@media (min-width: 640px) { .cards-grid { grid-template-columns: repeat(3, 1fr); gap: 1.5rem; } }
.feature-card { height: 100%; transition: transform 0.18s ease, box-shadow 0.18s ease; }
.feature-card:hover { transform: translateY(-2px); box-shadow: 0 6px 28px 0 rgba(45,31,26,0.10); }

/* Dot pulse */
@keyframes dot-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.4; } }
.dot-live { animation: dot-pulse 2s ease-in-out infinite; }

/* Fade-up on load */
@keyframes fade-up { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
.hero-animate { opacity: 0; animation: fade-up 600ms ease-out forwards; }
.delay-0   { animation-delay: 0ms;   }
.delay-150 { animation-delay: 150ms; }
.delay-300 { animation-delay: 300ms; }
.delay-450 { animation-delay: 450ms; }
.delay-600 { animation-delay: 600ms; }

/* Scroll reveal */
.card-reveal { opacity: 0; transform: translateY(20px); transition: opacity 600ms ease-out, transform 600ms ease-out; }
.card-reveal.is-visible { opacity: 1; transform: translateY(0); }

/* Success animation */
@keyframes success-in { from { opacity: 0; transform: scale(0.95); } to { opacity: 1; transform: scale(1); } }
.success-animate { animation: success-in 400ms ease-out forwards; }
@keyframes fade-out { from { opacity: 1; } to { opacity: 0; pointer-events: none; } }
.form-fade-out { animation: fade-out 250ms ease-out forwards; }

/* How it works steps */
.steps-row {
  --step-bubble-size: 3.5rem;
  display: flex;
  flex-direction: column;
  gap: 2rem;
  align-items: center;
}
.step-connector {
  display: none;
}
.step {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  text-align: left;
  padding: 0 1rem;
  max-width: 220px;
}
.step-bubble {
  width: var(--step-bubble-size);
  height: var(--step-bubble-size);
  border-radius: 50%;
  background-color: #FCEEE9;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 12px 0 rgba(232,131,106,0.12);
  flex-shrink: 0;
  position: relative;
  z-index: 1;
}
@media (min-width: 768px) {
  .steps-row {
    flex-direction: row;
    align-items: flex-start;
    justify-content: center;
    gap: 0;
    max-width: 72rem;
    margin-left: auto;
    margin-right: auto;
  }
  /* Fixed-width columns so connectors sit in the real gap between bubbles, not full third of viewport */
  .how-it-works-section .step {
    flex: 0 1 14rem;
    min-width: 0;
    max-width: 14rem;
    padding-left: 0.5rem;
    padding-right: 0.5rem;
    align-items: center;
    text-align: center;
  }
  /* Dashed segments: only flex-grow *between* step clusters */
  .step-connector {
    display: block;
    flex: 1 1 2rem;
    align-self: flex-start;
    min-width: 0.5rem;
    height: 0;
    margin-top: calc(var(--step-bubble-size) / 2);
    border: none;
    border-top: 2px dashed #D9C9C3;
    pointer-events: none;
  }
}

/* ── Preview card (shared) ── */
.preview-card {
  background: #FFFFFF; border-radius: 1.25rem;
  box-shadow: 0 4px 32px 0 rgba(45,31,26,0.10);
  overflow: hidden; display: flex; flex-direction: column;
}
@media (min-width: 640px) { .preview-card { flex-direction: row; } }

.convo-pane {
  flex: 1; background: #F5F5F7;
  padding: 1.25rem 1.25rem 1.25rem;
  display: flex; flex-direction: column; gap: 0.6rem;
  border-bottom: 1px solid #EDE8E5;
}
@media (min-width: 640px) {
  .convo-pane { border-bottom: none; border-right: 1px solid #EDE8E5; }
}

.convo-header {
  display: flex; align-items: center; gap: 0.5rem;
  padding-bottom: 0.75rem; border-bottom: 1px solid #E0DCDA;
  margin-bottom: 0.15rem; flex-shrink: 0;
}
.convo-avatar-img {
  width: 36px; height: 36px; border-radius: 50%;
  object-fit: cover; flex-shrink: 0;
  background-color: #E8836A; /* fallback if image fails */
}

/* Scrollable messages area */
.convo-messages {
  display: flex; flex-direction: column; gap: 0.45rem;
  overflow-y: auto; max-height: 230px;
  padding-right: 2px;
}
.convo-messages::-webkit-scrollbar { width: 3px; }
.convo-messages::-webkit-scrollbar-thumb { background: #D9C9C3; border-radius: 2px; }
.convo-messages::-webkit-scrollbar-track { background: transparent; }

/* Jake's bubble (grey, left) */
.msg-bubble {
  display: inline-block; background: #E5E5EA; color: #1C1C1E;
  border-radius: 1.1rem 1.1rem 1.1rem 0.3rem;
  padding: 0.6rem 0.9rem; font-size: 0.82rem; line-height: 1.45;
  max-width: 82%; align-self: flex-start;
}
/* User's bubble (blue, right) */
.msg-bubble-user {
  display: inline-block; background: #007AFF; color: #FFFFFF;
  border-radius: 1.1rem 1.1rem 0.3rem 1.1rem;
  padding: 0.6rem 0.9rem; font-size: 0.82rem; line-height: 1.45;
  max-width: 82%; align-self: flex-end;
}
.msg-timestamp {
  font-size: 0.62rem; color: #9C8880; text-align: center;
  padding: 0.2rem 0; letter-spacing: 0.02em;
}

.analysis-pane {
  flex: 1; background: #FFFFFF;
  padding: 1.25rem 1.25rem 1.25rem;
  display: flex; flex-direction: column; gap: 0.65rem;
}
.confidence-bar-track { background: #EDE8E5; border-radius: 99px; height: 10px; overflow: hidden; }
.confidence-bar-fill { height: 100%; border-radius: 99px; background: linear-gradient(90deg, #E8836A 0%, #D9694E 100%); transition: width 1s ease-out; }

/* Desktop-only right column: hidden on mobile */
.hero-right { display: none; }

/* ─────────────────────────────────────
   DESKTOP (768px+) — purely additive
─────────────────────────────────────── */
@media (min-width: 768px) {

  /* Page-wide container — wider on desktop */
  .page-container {
    max-width: 1280px;
    margin-left: auto; margin-right: auto;
    padding-left: 3rem; padding-right: 3rem;
  }

  /* Hero section — top padding via Tailwind (mobile offset / desktop flush); hero-stage owns viewport height */
  main.hero-main {
    padding-bottom: 0;
    padding-left: 0; padding-right: 0;
    align-items: stretch;
    justify-content: flex-start;
  }

  .hero-stage {
    display: flex;
    align-items: flex-start;
    min-height: calc(100svh - var(--header-height));
    padding-top: 1.75rem;
    padding-bottom: 2.5rem;
  }

  /* Two-column hero — align tops so pair reads as one band (avoids floaty vertical centering) */
  .hero-inner { display: flex; align-items: flex-start; gap: 5rem; width: 100%; }

  /* Left column: fixed width, left-aligned */
  .hero-left {
    flex: 0 0 580px;
    max-width: 580px;
    text-align: left;
  }
  .hero-left h1,
  .hero-left .subheadline { max-width: none; margin-left: 0; margin-right: 0; }
  .hero-left #form-wrapper,
  .hero-left #success-message { max-width: none; margin-left: 0; margin-right: 0; text-align: left; }

  /* Right column */
  .hero-right {
    display: flex; flex: 1; min-width: 0;
    align-items: center; justify-content: stretch;
    max-height: min(700px, 78vh);
  }
  .hero-right .preview-card {
    flex-direction: column; flex: 1;
    box-shadow: 0 6px 36px 0 rgba(45,31,26,0.13);
    max-height: min(700px, 78vh);
    overflow: hidden;
  }
  .hero-right .convo-pane {
    border-right: none; border-bottom: 1px solid #EDE8E5;
    padding: 1.1rem 1.25rem 1.1rem;
  }
  .hero-right .convo-messages { max-height: min(220px, 28vh); }
  .hero-right .msg-bubble,
  .hero-right .msg-bubble-user { font-size: 0.78rem; padding: 0.5rem 0.8rem; }
  .hero-right .analysis-pane { padding: 1.1rem 1.25rem 1.25rem; gap: 0.55rem; }

  /* Feature cards */
  .hero-cards-container { width: 100%; margin-top: 0; }

  /* Hide mobile preview section */
  .preview-section-mobile { display: none; }

  /* How it works */
  .how-it-works-inner {
    max-width: 1280px; margin-left: auto; margin-right: auto;
    padding-left: 3rem; padding-right: 3rem;
  }
  /* Step spacing lives in main .how-it-works-section rules (avoid wide columns + dashed gaps) */

  /* Bottom CTA */
  .bottom-cta-inner {
    max-width: 1280px; margin-left: auto; margin-right: auto;
    padding-left: 3rem; padding-right: 3rem;
  }

  /* Footer */
  .footer-inner {
    max-width: 1280px; margin-left: auto; margin-right: auto;
    padding-left: 3rem; padding-right: 3rem;
  }
}

/* Trust badge pills */
.trust-badges {
  display: flex; flex-wrap: wrap; justify-content: center; gap: 0.6rem;
  margin-top: 1.75rem;
  min-width: min(100%, 720px);
  margin-left: auto; margin-right: auto;
}
@media (min-width: 768px) {
  .trust-badges { flex-wrap: nowrap; gap: 0.55rem; }
}
.trust-badge {
  display: inline-flex; align-items: center; gap: 0.4rem;
  background: #FCEEE9; color: #6B5E58;
  border: 1px solid #EDE8E5; border-radius: 99px;
  padding: 0.45rem 1rem; font-size: 0.8rem; font-weight: 500;
  white-space: nowrap;
}
@media (min-width: 768px) {
  .trust-badge { padding: 0.5rem 1.15rem; font-size: 0.8125rem; }
}
