/* Phase 2 — homepage styles.
 *
 * Layout: flex column, min-height 100vh.
 *   nav (auto)
 *   hero (1fr — pushes everything else down, content centered)
 *   marquee (auto, full-bleed)
 *   footer (auto, tiny)
 *
 * Typography: Candidate A — system sans only, no webfont for hero.
 * Glitch: G3 multi-layer slice on the wordmark hover.
 */

html {
  scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

.shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── Nav ─────────────────────────────────────── */

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--sp-4) var(--sp-5);
}

.nav__link {
  font-family: var(--font-system);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text);
  text-decoration: none;
  padding: var(--sp-2) 0;
  transition: color 120ms ease;
}

.nav__link:hover { color: var(--magenta); }

/* Wordmark + G3 glitch live in shared/wordmark.css. */

/* ── Hero ───────────────────────────────────── */

.hero {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--sp-7) var(--sp-5);
  gap: clamp(48px, 8vh, 96px);
  text-align: center;
}

/* Title block keeps the question and the subhead grouped tightly so
 * the hero gap-clamp only applies between this block and the auth box. */
.hero__title-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-6);
  width: 100%;
}

/* White at 88% opacity reads as clearly secondary to the heavy hero
 * question while still standing out from muted body greys. */
.hero__subhead {
  margin: 0;
  font-family: var(--font-system);
  font-size: clamp(20px, 2.4vw, 26px);
  font-weight: 400;
  line-height: 1.45;
  letter-spacing: -0.01em;
  color: rgba(245, 245, 245, 0.88);
}

.hero__question {
  font-family: var(--font-system);
  /* 28px floor for mobile so 45-char strings fit on 2 lines down to ~375px.
   * 96px ceiling preserves the existing desktop hierarchy. 7.5vw scales
   * smoothly between. */
  font-size: clamp(1.75rem, 7.5vw, 6rem);
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1.15;
  margin: 0;
  /* 24ch allows ~24 chars/line so the longest 45-char strings split
   * cleanly into 2 lines. Was 18ch which forced 3+ lines for anything
   * over ~36 chars. */
  max-width: 24ch;
  text-wrap: balance;
  /* Container is the viewport for the chase: slots wider than 100% slide
   * in/out via translateX, overflow hidden clips the off-screen ones.
   * Height is locked to exactly two lines so the auth block beneath
   * never shifts between questions of different lengths. */
  height: calc(2 * 1.15em);
  overflow: hidden;
  position: relative;
  width: 100%;
}

/* The track is the horizontal ribbon that holds one or more slots and
 * slides as a unit during a transition. Fills the full container so
 * each slot inherits the locked 2-line height. */
.hero__track {
  display: flex;
  width: 100%;
  height: 100%;
  will-change: transform;
}

/* Each slot is one full question. flex:0 0 100% locks its width to a
 * single track column. Slot is a flex container that vertically centres
 * its inner .hero__slot-text wrapper.
 *
 * Why the inner span wrapper: anonymous text content in a flex/grid
 * centred parent gets sized to its natural width and ignores
 * white-space:normal — so a 45-char string overflows the slot and gets
 * clipped horizontally by the parent overflow:hidden. The inner span
 * takes width:100% explicitly so it fills the slot and wraps text
 * inside it normally. */
.hero__slot {
  flex: 0 0 100%;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  min-width: 0;
}

.hero__slot-text {
  display: block;
  width: 100%;
  text-align: center;
  white-space: normal;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

/* ── Hero glitch on hover ─────────────────────────
 * Movement-only — no colour ghost layer. The text shakes, skews, and
 * toggles italic across stepped keyframes for a visceral "this is
 * unstable" feel. Single 450ms burst on hover-enter. */

.hero__question:hover .hero__slot {
  animation: hero-glitch 450ms steps(7, end) 1;
}

@keyframes hero-glitch {
  0%, 100% {
    transform: translate3d(0, 0, 0) skewX(0);
    font-style: normal;
  }
  14% {
    transform: translate3d(-7px, 2px, 0) skewX(-6deg);
    font-style: italic;
  }
  28% {
    transform: translate3d(8px, -2px, 0) skewX(5deg);
    font-style: italic;
  }
  42% {
    transform: translate3d(-4px, 1px, 0) skewX(-4deg);
    font-style: normal;
  }
  57% {
    transform: translate3d(9px, -1px, 0) skewX(6deg);
    font-style: italic;
  }
  71% {
    transform: translate3d(-6px, 2px, 0) skewX(-5deg);
    font-style: italic;
  }
  85% {
    transform: translate3d(3px, 0, 0) skewX(3deg);
    font-style: normal;
  }
}

@media (prefers-reduced-motion: reduce) {
  .hero__track {
    transition: none !important;
    transform: none !important;
  }
  .hero__question:hover .hero__slot {
    animation: none !important;
  }
}

/* ── Auth (login block) ─────────────────────── */

.auth {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: var(--sp-3);
  width: 100%;
  max-width: 360px;
}

.auth__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-3);
  height: 48px;
  padding: 0 var(--sp-5);
  border-radius: 6px;
  font-family: var(--font-system);
  font-size: 15px;
  font-weight: 500;
  letter-spacing: 0;
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: background-color 120ms ease, border-color 120ms ease, transform 80ms ease;
}

.auth__btn--secondary {
  background: transparent;
  color: var(--text);
  border-color: var(--border-default);
}
.auth__btn--secondary:hover {
  background: var(--surface-raised);
  border-color: rgba(245, 245, 245, 0.36);
}
.auth__btn--secondary:active { transform: translateY(1px); }

.auth__btn--primary {
  background: var(--text);
  color: var(--bg);
  border-color: var(--text);
  width: 100%;
}
.auth__btn--primary:hover { background: #ffffff; border-color: #ffffff; }
.auth__btn--primary:active { transform: translateY(1px); background: #e8e8e8; border-color: #e8e8e8; }

.auth__icon { width: 18px; height: 18px; flex-shrink: 0; }

/* OR divider */
.auth__divider {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  margin: var(--sp-3) 0;
  font-family: var(--font-system);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}
.auth__divider::before,
.auth__divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border-subtle);
}

/* Email form */
.auth__form {
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
  margin: 0;
}

.auth__input {
  height: 48px;
  padding: 0 var(--sp-4);
  background: transparent;
  border: 1px solid var(--border-default);
  border-radius: 6px;
  color: var(--text);
  font-family: var(--font-system);
  font-size: 15px;
  outline: none;
  transition: border-color 120ms ease;
}
.auth__input::placeholder { color: var(--muted); }
.auth__input:focus { border-color: var(--magenta); }

/* Tiny grey legal line */
.auth__terms {
  margin: var(--sp-3) 0 0 0;
  font-family: var(--font-system);
  font-size: 11px;
  line-height: 1.6;
  color: var(--muted);
  text-align: center;
}
.auth__terms a { color: var(--muted); text-decoration: underline; text-decoration-color: var(--border-default); text-underline-offset: 2px; }
.auth__terms a:hover { color: var(--text); text-decoration-color: var(--text); }

/* ── Marquee section on homepage ────────────── */

.shell .marquee {
  /* Marquee already styled in shared/marquee.css. The homepage variant
   * is full-bleed (no horizontal padding) because the .marquee element
   * is a direct child of .shell, not the padded hero. */
}

/* ── Pricing module (boxed plan card) ──────── */

.pricing {
  padding: var(--sp-9) var(--sp-5);
  display: flex;
  justify-content: center;
}

.pricing__card {
  width: 100%;
  max-width: 420px;
  padding: var(--sp-7) var(--sp-6) var(--sp-6);
  background: var(--surface-raised);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  text-align: center;
}

.pricing__head {
  padding-bottom: var(--sp-5);
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: var(--sp-5);
}

.pricing__label {
  margin: 0 0 var(--sp-4) 0;
  font-family: var(--font-system);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--magenta);
}

.pricing__price {
  display: inline-flex;
  align-items: flex-start;
  gap: 4px;
  line-height: 1;
}

.pricing__currency {
  font-family: var(--font-system);
  font-size: 32px;
  font-weight: 600;
  color: var(--text);
  margin-top: 8px;
  letter-spacing: -0.02em;
}

.pricing__amount {
  font-family: var(--font-system);
  font-size: 88px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.04em;
  line-height: 1;
}

.pricing__period {
  margin: var(--sp-2) 0 0 0;
  font-family: var(--font-system);
  font-size: 14px;
  font-weight: 400;
  color: var(--muted);
  letter-spacing: 0;
}

.pricing__features {
  list-style: none;
  margin: 0 0 var(--sp-6) 0;
  padding: 0;
  text-align: left;
}

.pricing__features li {
  position: relative;
  padding: var(--sp-2) 0 var(--sp-2) 28px;
  font-family: var(--font-system);
  font-size: 15px;
  font-weight: 400;
  line-height: 1.5;
  color: rgba(245, 245, 245, 0.88);
}

/* Magenta check-tick (CSS-only, no SVG): a rotated rectangle with two
 * borders forms the L-shape of a checkmark. */
.pricing__features li::before {
  content: '';
  position: absolute;
  left: 4px;
  top: 12px;
  width: 6px;
  height: 11px;
  border-right: 2px solid var(--magenta);
  border-bottom: 2px solid var(--magenta);
  transform: rotate(45deg);
}

.pricing__cta {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 48px;
  padding: 0 var(--sp-5);
  background: var(--text);
  color: var(--bg);
  border: 1px solid var(--text);
  border-radius: 6px;
  font-family: var(--font-system);
  font-size: 15px;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 120ms ease, border-color 120ms ease, transform 80ms ease;
}

.pricing__cta:hover {
  background: #ffffff;
  border-color: #ffffff;
}

.pricing__cta:active {
  transform: translateY(1px);
  background: #e8e8e8;
  border-color: #e8e8e8;
}

.pricing__note {
  margin: var(--sp-4) 0 0 0;
  font-family: var(--font-system);
  font-size: 13px;
  font-weight: 400;
  line-height: 1.5;
  color: var(--muted);
}
.pricing__note a {
  color: var(--magenta);
  text-decoration: none;
}
.pricing__note a:hover { text-decoration: underline; }

/* ── FAQs ───────────────────────────────────── */

.faqs {
  padding: var(--sp-7) var(--sp-5) var(--sp-9);
}

.faqs__inner {
  max-width: 720px;
  margin: 0 auto;
}

.faqs__heading {
  margin: 0 0 var(--sp-6) 0;
  font-family: var(--font-system);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  text-align: center;
}

.faqs__list {
  list-style: none;
  margin: 0;
  padding: 0;
  border-top: 1px solid var(--border-subtle);
}

.faq {
  border-bottom: 1px solid var(--border-subtle);
}

.faq details {
  width: 100%;
}

.faq__q {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-4);
  padding: var(--sp-5) var(--sp-2);
  font-family: var(--font-system);
  font-size: 17px;
  font-weight: 500;
  letter-spacing: -0.01em;
  color: var(--text);
  cursor: pointer;
  list-style: none;
  transition: color 120ms ease;
}

.faq__q::-webkit-details-marker { display: none; }
.faq__q:hover { color: var(--magenta); }

.faq__chevron {
  width: 12px;
  height: 12px;
  border-right: 1.5px solid var(--muted);
  border-bottom: 1.5px solid var(--muted);
  transform: rotate(45deg);
  transition: transform 180ms ease, border-color 120ms ease;
  flex-shrink: 0;
  margin-right: var(--sp-2);
}

.faq__q:hover .faq__chevron {
  border-color: var(--magenta);
}

.faq details[open] .faq__chevron {
  transform: rotate(-135deg);
}

.faq__a {
  padding: 0 var(--sp-2) var(--sp-5) var(--sp-2);
}

.faq__a p {
  margin: 0;
  font-family: var(--font-system);
  font-size: 16px;
  font-weight: 400;
  line-height: 1.6;
  color: rgba(245, 245, 245, 0.78);
  max-width: 60ch;
}

.faq__a a {
  color: var(--text);
  text-decoration: underline;
  text-decoration-color: var(--border-default);
  text-underline-offset: 2px;
}

.faq__a a:hover {
  text-decoration-color: var(--magenta);
}

/* ── Footer ─────────────────────────────────── */

.foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--sp-4) var(--sp-5);
  font-family: var(--font-system);
  font-size: 12px;
  color: var(--muted);
  letter-spacing: 0.02em;
}

.foot__links {
  display: flex;
  gap: var(--sp-4);
}

.foot a { color: var(--muted); text-decoration: none; }
.foot a:hover { color: var(--text); }

/* ── "Signed out" toast ─────────────────────── */
/* Shown when user lands here from the app's signOut redirect (?signedout=1).
 * Bottom-centered, auto-dismisses via JS after a few seconds. */

.signedout-toast {
  position: fixed;
  left: 50%;
  bottom: var(--sp-5);
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-3) var(--sp-3) var(--sp-5);
  background: var(--surface-raised);
  border: 1px solid var(--border-default);
  border-radius: 999px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  font-family: var(--font-system);
  font-size: 13px;
  color: var(--text);
  z-index: 8000;
  animation: signedout-in 220ms ease-out;
}

.signedout-toast[hidden] { display: none; }

.signedout-toast__close {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 0;
  border-radius: 50%;
  font-size: 18px;
  line-height: 1;
  color: var(--muted);
  cursor: pointer;
  transition: color 120ms ease, background-color 120ms ease;
}
.signedout-toast__close:hover {
  color: var(--text);
  background: rgba(245, 245, 245, 0.06);
}

@keyframes signedout-in {
  from { opacity: 0; transform: translate(-50%, 8px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

@media (prefers-reduced-motion: reduce) {
  .signedout-toast { animation: none; }
}

/* ── Reduced motion ─────────────────────────── */

/* ── Responsive: mobile tweaks ──────────────── */

@media (max-width: 700px) {
  .nav { padding: var(--sp-3) var(--sp-4); }
  .hero { padding: var(--sp-5) var(--sp-4); gap: var(--sp-7); }
  .hero__title-block { gap: var(--sp-5); }
  .hero__subhead { font-size: 18px; }
  .pricing { padding: var(--sp-7) var(--sp-4); }
  .pricing__card { padding: var(--sp-6) var(--sp-5) var(--sp-5); }
  .pricing__amount { font-size: 72px; }
  .pricing__currency { font-size: 28px; margin-top: 6px; }
  .faqs { padding: var(--sp-5) var(--sp-4) var(--sp-7); }
  .faq__q { font-size: 16px; padding: var(--sp-4) var(--sp-2); }
  .faq__a p { font-size: 15px; }
  .foot { flex-direction: column; gap: var(--sp-2); padding: var(--sp-4); text-align: center; }
}
