/* Marketing landing page at /welcome (#13.1, beautify #695). Standalone
   stylesheet so the page can render without pulling in the full app bundle.
   Color tokens mirror the Watch (cinematic dark) theme from assets/css/app.css
   so visual language is consistent. Mobile first at a 390pt baseline. */

* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #0A0A10;
  --surface: #161821;
  --surface-2: #1F2230;
  --surface-3: #2A2D3D;
  --border: #2E3145;
  --text: #F5F2EA;
  --text-dim: #A19B8E;
  --text-muted: #6B6354;
  --accent: #D4AF37;
  --accent-hover: #B8962E;
  --on-accent: var(--bg);
  /* Per-category tints used by .feature-section[data-tint] (mirrors the
     in-app cat-* palettes: Watch gold, Read warm paper-brown, Play violet,
     Together sky-cyan for the social section). */
  --tint-watch: 212, 175, 55;
  --tint-read: 196, 165, 122;
  --tint-play: 168, 85, 247;
  --tint-discover: 16, 185, 129;
  --tint-together: 56, 189, 248;
  --bezel: #0A0A10;
  --bezel-ring: #2E3145;
  --font-body: -apple-system, BlinkMacSystemFont, 'Segoe UI', Inter, system-ui, sans-serif;
  --maxw: 1100px;
  color-scheme: dark light;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #FAFAF7;
    --surface: #FFFFFF;
    --surface-2: #F2EFE8;
    --surface-3: #E9E5DA;
    --border: #E1DDD2;
    --text: #1A1818;
    --text-dim: #5C564B;
    --text-muted: #8A8474;
    --accent: #B8862E;
    --accent-hover: #9C7124;
    --on-accent: #FFFFFF;
    --tint-watch: 184, 134, 46;
    --tint-read: 167, 124, 81;
    --tint-play: 124, 58, 237;
    --tint-discover: 5, 150, 105;
    --tint-together: 3, 105, 161;
    --bezel: #1F2230;
    --bezel-ring: #C7C2B6;
  }
}

html, body {
  width: 100%;
  overflow-x: clip;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
}

a { color: var(--accent); text-decoration: none; }
a:hover, a:focus-visible { color: var(--accent-hover); }

.skip-link {
  position: absolute;
  left: -9999px;
  top: auto;
  width: 1px;
  height: 1px;
  overflow: hidden;
}
.skip-link:focus {
  left: 12px;
  top: 12px;
  width: auto;
  height: auto;
  padding: 8px 12px;
  background: var(--accent);
  color: var(--on-accent);
  border-radius: 8px;
  z-index: 100;
}

.wrap {
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 20px;
}

/* Top bar */
.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: saturate(140%) blur(10px);
  -webkit-backdrop-filter: saturate(140%) blur(10px);
  border-bottom: 1px solid var(--border);
}
.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 18px;
  color: var(--text);
}
.brand img { width: 24px; height: 24px; }
.brand-accent { color: var(--accent); }
.topbar-cta {
  display: inline-flex;
  align-items: center;
  height: 40px;
  min-height: 44px;
  padding: 0 14px;
  border-radius: 999px;
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
  font-size: 14px;
  font-weight: 600;
}

/* Hero */
.hero {
  position: relative;
  padding: 36px 0 28px;
  overflow: hidden;
  isolation: isolate;
}
.hero-bg {
  position: absolute;
  inset: -10% -5% 0 -5%;
  z-index: -1;
  background:
    radial-gradient(60% 50% at 20% 10%, rgba(var(--tint-watch), 0.18) 0%, transparent 70%),
    radial-gradient(50% 40% at 90% 30%, rgba(var(--tint-play), 0.14) 0%, transparent 75%),
    radial-gradient(70% 60% at 60% 100%, rgba(var(--tint-together), 0.10) 0%, transparent 80%);
  pointer-events: none;
}
.hero-wrap {
  display: flex;
  flex-direction: column;
  gap: 28px;
}
.hero-copy { max-width: 32ch; }
.hero-title {
  font-size: 34px;
  line-height: 1.08;
  letter-spacing: -0.02em;
  font-weight: 800;
  margin-bottom: 14px;
}
.hero-title .brand-accent {
  color: var(--accent);
  position: relative;
}
.hero-lead {
  font-size: 17px;
  color: var(--text-dim);
  margin-bottom: 22px;
  max-width: 38ch;
}
.cta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0 22px;
  border-radius: 999px;
  font-size: 16px;
  font-weight: 700;
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  position: relative;
  overflow: hidden;
}
.btn-primary {
  background: var(--accent);
  color: var(--on-accent);
  box-shadow: 0 8px 24px -8px rgba(var(--tint-watch), 0.65);
}
.btn-primary:hover, .btn-primary:focus-visible {
  background: var(--accent-hover);
  color: var(--on-accent);
}
.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border);
}
.btn-secondary:hover, .btn-secondary:focus-visible {
  background: var(--surface-2);
  color: var(--text);
}

/* CTA shimmer: a diagonal highlight sweeps across the primary button on a
   slow loop. Pure CSS, no images. Disabled under prefers-reduced-motion. */
.btn-shimmer::after {
  content: '';
  position: absolute;
  top: 0;
  left: -60%;
  width: 40%;
  height: 100%;
  background: linear-gradient(
    100deg,
    transparent 0%,
    rgba(255, 255, 255, 0) 25%,
    rgba(255, 255, 255, 0.35) 50%,
    rgba(255, 255, 255, 0) 75%,
    transparent 100%
  );
  transform: skewX(-18deg);
  animation: btnShimmer 3.4s ease-in-out infinite;
  pointer-events: none;
}
@keyframes btnShimmer {
  0%   { left: -60%; }
  55%  { left: 120%; }
  100% { left: 120%; }
}

/* Phone bezel. CSS-only Linear / Things style device frame around a real
   1284x2778 iOS screenshot. The screenshot itself carries the iOS status bar
   + Dynamic Island, so the frame is just a thin chrome ring + rounded mask
   over the display. No painted notch (it would double up with the real one
   inside the image). */
.phone-frame {
  position: relative;
  width: min(248px, 72vw);
  margin: 0 auto;
  padding: 7px;
  background: linear-gradient(160deg, #3A3D4D 0%, #0A0A10 100%);
  border-radius: 44px;
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.06) inset,
    0 0 0 1px rgba(255, 255, 255, 0.04) inset,
    0 40px 80px -24px rgba(0, 0, 0, 0.6),
    0 12px 32px -10px rgba(0, 0, 0, 0.55);
}
.phone-screen {
  position: relative;
  border-radius: 38px;
  overflow: hidden;
  aspect-ratio: 1284 / 2778;
  background: #000;
}
.phone-screen img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.phone-frame--hero {
  transform: rotate(-4deg);
  transform-origin: 50% 50%;
}

/* Section rhythm */
.sections {
  padding: 8px 0 0;
}
section {
  padding: 36px 0;
}
section h2 {
  font-size: 26px;
  line-height: 1.15;
  letter-spacing: -0.015em;
  font-weight: 800;
  margin-bottom: 12px;
}

.feature-section {
  position: relative;
  isolation: isolate;
}
.feature-section + .feature-section {
  border-top: 1px solid var(--border);
}
.feature-section::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  background: radial-gradient(
    60% 70% at 50% 0%,
    rgba(var(--tint), 0.10) 0%,
    rgba(var(--tint), 0.02) 55%,
    transparent 85%
  );
  pointer-events: none;
}
.feature-section[data-tint="watch"]     { --tint: var(--tint-watch); }
.feature-section[data-tint="read"]      { --tint: var(--tint-read); }
.feature-section[data-tint="play"]      { --tint: var(--tint-play); }
.feature-section[data-tint="discover"]  { --tint: var(--tint-discover); }
.feature-section[data-tint="together"]  { --tint: var(--tint-together); }

.feature-wrap {
  display: flex;
  flex-direction: column;
  gap: 24px;
  align-items: center;
}
.feature-copy {
  width: 100%;
  max-width: 52ch;
}
.feature-art {
  width: 100%;
  display: flex;
  justify-content: center;
}
.eyebrow {
  display: inline-block;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgb(var(--tint));
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(var(--tint), 0.12);
  margin-bottom: 10px;
}
.feature-body {
  color: var(--text-dim);
  font-size: 16px;
  max-width: 48ch;
}

/* Sign up section */
.signup {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 22px;
  box-shadow: 0 24px 60px -32px rgba(0, 0, 0, 0.6);
}
.signup form {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 14px;
}
.signup label {
  font-size: 13px;
  color: var(--text-dim);
  font-weight: 600;
}
.signup input[type="email"] {
  width: 100%;
  height: 48px;
  padding: 0 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-size: 16px;
  font-family: inherit;
}
.signup input[type="email"]:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}
.signup .btn { width: 100%; }
/* #790 — Apple Guideline 1.2 consent gate before sign-in. */
.welcome-consent {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  margin: 4px 0 14px;
  font-size: 13.5px;
  line-height: 1.4;
  color: var(--text-dim);
  cursor: pointer;
  text-align: start;
}
.welcome-consent-check {
  flex: none;
  width: 18px;
  height: 18px;
  margin-top: 1px;
  accent-color: var(--accent);
  cursor: pointer;
}
@media (pointer: coarse) {
  .welcome-consent-check {
    min-width: 44px;
    min-height: 44px;
  }
}
.welcome-consent-text { display: block; }
.welcome-consent-links { display: block; margin-top: 2px; }
.welcome-consent-links a {
  color: var(--accent);
  text-decoration: none;
}
.welcome-consent-links a:hover { text-decoration: underline; }
.signup-status {
  margin-top: 10px;
  font-size: 14px;
  color: var(--text-dim);
  min-height: 1.5em;
}
.signup-status.ok { color: var(--text); }
.signup-status.err { color: #F87171; }
.skip-signup {
  margin-top: 14px;
  font-size: 14px;
  color: var(--text-dim);
  text-align: center;
}

/* App store badges. Placeholders for now (#13.2): live links land when
   #132.2 (iOS) and #132.3 (Android) ship. Hand-rolled badges instead of
   the Apple / Google asset packs to avoid an extra image fetch and to
   match Todeo's dark UI tokens. */
.stores {
  padding: 48px 0 8px;
}
.stores-wrap {
  text-align: center;
}
.stores-title {
  font-size: 22px;
  margin: 0 0 8px;
}
.stores-sub {
  color: var(--text-dim);
  margin: 0 0 22px;
  font-size: 15px;
}
.stores-badges {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
}
.store-badge {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 18px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  min-height: 56px;
  text-decoration: none;
  font-family: inherit;
}
.store-badge--soon {
  opacity: 0.7;
  cursor: default;
}
.store-badge-icon {
  width: 26px;
  height: 26px;
  flex: 0 0 auto;
}
.store-badge-text {
  display: flex;
  flex-direction: column;
  text-align: left;
  line-height: 1.1;
}
.store-badge-small {
  font-size: 11px;
  color: var(--text-dim);
}
.store-badge-big {
  font-size: 18px;
  font-weight: 600;
}

/* Footer */
.footer {
  border-top: 1px solid var(--border);
  padding: 22px 0;
  text-align: center;
  color: var(--text-dim);
  font-size: 14px;
}
.footer-links {
  display: inline-flex;
  gap: 18px;
  margin-top: 6px;
}
.footer-links a { color: var(--text-dim); }

/* Scroll-driven entrance: feature sections start translated down + faded
   out, then JS toggles .is-visible when they enter the viewport. */
.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.7s ease, transform 0.7s ease;
  will-change: opacity, transform;
}
.reveal.is-visible {
  opacity: 1;
  transform: none;
}

/* Wider screens */
@media (min-width: 720px) {
  .hero { padding: 64px 0 48px; }
  .hero-wrap {
    flex-direction: row;
    align-items: center;
    gap: 40px;
  }
  .hero-copy { flex: 1 1 auto; max-width: 40ch; }
  .hero-art  { flex: 0 0 auto; }
  .hero-title { font-size: 52px; }
  .hero-lead { font-size: 19px; }

  .feature-wrap {
    flex-direction: row;
    align-items: center;
    gap: 56px;
  }
  .feature-section--flip .feature-wrap {
    flex-direction: row-reverse;
  }
  .feature-copy {
    flex: 1 1 0;
    min-width: 320px;
    max-width: 56ch;
  }
  .feature-art {
    flex: 0 0 auto;
    width: auto;
  }
  .phone-frame { width: 268px; }

  section h2 { font-size: 34px; }
  .feature-body { font-size: 17px; line-height: 1.55; max-width: 52ch; }
}

@media (min-width: 1024px) {
  .hero-title { font-size: 64px; }
  .phone-frame { width: 296px; padding: 8px; border-radius: 48px; }
  .phone-frame .phone-screen { border-radius: 42px; }
  .phone-frame--hero { width: 312px; transform: rotate(-5deg); }
  .signup {
    padding: 32px;
    max-width: 560px;
    margin: 0 auto;
  }
  section { padding: 56px 0; }
  section h2 { font-size: 38px; }
  .feature-copy { min-width: 360px; }
  .feature-body { font-size: 18px; }
}

/* Legal overlay (#831). In-page Terms/Privacy overlay that works in every
   iOS context (standalone PWA, in-app webview, Safari) -- no navigation,
   no window.open. JS populates #legalBody from the canonical i18n tables. */
.legal-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(0, 0, 0, 0.72);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0;
  opacity: 0;
  transition: opacity 0.22s ease;
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
}
.legal-overlay[hidden] { display: none; }
.legal-overlay.is-visible {
  opacity: 1;
}

.legal-overlay-panel {
  position: relative;
  width: 100%;
  max-width: 680px;
  max-height: 88vh;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px 20px 0 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: translateY(20px);
  transition: transform 0.22s ease;
  /* iOS safe-area inset at the bottom (home indicator) */
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
.legal-overlay.is-visible .legal-overlay-panel {
  transform: translateY(0);
}

.legal-overlay-body {
  flex: 1 1 auto;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 52px 24px 16px;
}
/* Title injected by JS as first child h2 */
.legal-overlay-body h2 {
  font-size: 20px;
  font-weight: 700;
  line-height: 1.2;
  margin: 0 0 4px;
  color: var(--text);
  padding-right: 40px; /* clear the X button */
}
/* last_updated muted paragraph */
.legal-overlay-body .legal-updated {
  font-size: 12px;
  color: var(--text-muted);
  margin: 0 0 18px;
}
.legal-overlay-body p {
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--text-dim);
  margin: 0 0 10px;
}
.legal-overlay-body h3 {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin: 20px 0 5px;
}
.legal-overlay-body a {
  color: var(--accent);
  text-decoration: none;
  word-break: break-all;
}
.legal-overlay-body a:hover,
.legal-overlay-body a:focus-visible {
  text-decoration: underline;
}

.legal-overlay-footer {
  flex: none;
  padding: 12px 24px 16px;
  border-top: 1px solid var(--border);
  background: var(--surface);
  display: flex;
  justify-content: flex-end;
}
.legal-close-btn {
  min-height: 44px;
  min-width: 80px;
  padding: 0 20px;
  font-size: 15px;
}

/* Floating X close button -- top-right corner of the panel */
.legal-overlay-x {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: none;
  background: var(--surface-2);
  color: var(--text-dim);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
  /* sits above the panel's own content */
  z-index: 1;
}
.legal-overlay-x:hover,
.legal-overlay-x:focus-visible {
  background: var(--surface-3);
  color: var(--text);
}
.legal-overlay-x:active {
  transform: scale(0.94);
}

/* On wider screens, center the panel with rounded corners all around */
@media (min-width: 520px) {
  .legal-overlay {
    align-items: center;
    padding: 24px 16px;
  }
  .legal-overlay-panel {
    border-radius: 20px;
    max-height: 84vh;
  }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
  .btn-shimmer::after { display: none; }
  .reveal { opacity: 1; transform: none; }
  .phone-frame--hero { transform: none; }
}
