/*
 * theme.css — Rythmos brand tokens, font-faces, base reset, dark cosmic
 *             default, light-mode opt-in, reduced-motion, print stylesheet.
 *
 * Mirrors the iOS app's Theme tokens 1:1 (see Theme+Colors.swift,
 * Theme+Gradients.swift, Theme+Typography.swift in the iOS repo).
 *
 * IMPORTANT: the web is **dark cosmic by default** — same brand voice
 * as the iOS app's first-launch theme. Light mode is available behind
 * an explicit `html[data-theme="light"]` opt-in (no UI for it yet,
 * lives as a hatch for future use). System `prefers-color-scheme` is
 * intentionally ignored so the cosmic tone always lands on first paint.
 */

/* -------------------------------------------------------------------------- */
/* Self-hosted Noto Sans Georgian — variable font, two unicode subsets        */
/* -------------------------------------------------------------------------- */

@font-face {
  font-family: 'Noto Sans Georgian';
  font-style: normal;
  font-weight: 100 900;            /* variable */
  font-display: swap;
  src: url('/assets/fonts/NotoSansGeorgian-Geo.woff2') format('woff2');
  unicode-range: U+0589, U+10A0-10FF, U+1C90-1CBA, U+1CBD-1CBF, U+205A, U+2D00-2D2F, U+2E31;
}
@font-face {
  font-family: 'Noto Sans Georgian';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('/assets/fonts/NotoSansGeorgian-Latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* -------------------------------------------------------------------------- */
/* Brand tokens — DARK COSMIC (default for everyone)                          */
/*                                                                            */
/* Cosmic-redesign palette locked 2026-04-26. Every brand token below has a   */
/* counterpart in iOS Theme+Colors.swift; do not drift them in isolation.     */
/* -------------------------------------------------------------------------- */

:root {
  /* ── Brand identity ── */
  --brand-teal:           #14B8A6;
  --brand-teal-light:     #2DD4BF;
  --brand-teal-deep:      #0F766E;
  --brand-violet:         #8B5CF6;
  --brand-violet-light:   #A78BFA;
  --brand-violet-deep:    #5B21B6;
  --brand-blue-glow:      #60A5FA;

  /* ── Semantic legacy aliases (existing call sites) ── */
  --primary:    var(--brand-teal);
  --secondary:  var(--brand-violet);
  --accent:     var(--brand-teal-light);

  /* ── Surfaces / backgrounds (DARK cosmic) ── */
  --bg:         #0F172A;     /* default app background */
  --bg-deep:    #060B14;     /* forced-dark surfaces (hero, splash) */
  --bg-tint:    #111C31;     /* soft brand-tinted wash */
  --surface:    #1E293B;     /* card surface */
  --surface-2:  #233148;     /* surface elevated / card-on-card */
  --text:       #F8FAFC;
  --text-mut:   #94A3B8;
  --text-faint: #64748B;
  --border:     #334155;

  --danger:     #F87171;
  --success:    #2DD4BF;

  /* ── Radii ── */
  --radius-card:   16px;
  --radius-button: 12px;
  --radius-hero:   28px;
  --radius-pill:   999px;

  /* ── Shadows — dark cosmic versions (deeper, brand-tinted glows) ── */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.30);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.40);
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.50);
  --shadow-brand-glow: 0 12px 32px rgba(20, 184, 166, 0.18),
                       0 24px 56px rgba(139, 92, 246, 0.18);

  /* ── Gradients — match iOS Theme+Gradients exactly ── */
  --gradient-brand:     linear-gradient(135deg, #14B8A6 0%, #8B5CF6 100%);
  --gradient-glow:      linear-gradient(135deg, #2DD4BF 0%, #60A5FA 50%, #A78BFA 100%);
  --gradient-dark-hero: linear-gradient(135deg, #0F766E 0%, #1E3A8A 45%, #5B21B6 100%);
  --gradient-light-hero:linear-gradient(135deg, #14B8A6 0%, #2563EB 48%, #8B5CF6 100%);

  /* Backwards-compat aliases — old tokens still referenced by some pages */
  --gradient-deep:    var(--gradient-dark-hero);
  --gradient-primary: var(--gradient-brand);

  /* ── Motion tokens — extended for the cinematic redesign ── */
  /* Spring family — match iOS Theme+Animation.swift response/damping */
  --ease-spring:        cubic-bezier(0.34, 1.56, 0.64, 1);   /* response 0.4 / damping 0.80  */
  --ease-spring-page:   cubic-bezier(0.32, 1.40, 0.62, 1);   /* response 0.45 / damping 0.82 — pager */
  --ease-spring-reveal: cubic-bezier(0.30, 1.66, 0.62, 1);   /* response 0.65 / damping 0.78 — hero reveal */
  /* Soft family */
  --ease-soft:   cubic-bezier(0.4, 0, 0.2, 1);
  --ease-out:    cubic-bezier(0.16, 1, 0.3, 1);              /* expo-ish out — scroll reveal */
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
  /* Durations */
  --dur-fast:    280ms;
  --dur-base:    360ms;
  --dur-reveal:  680ms;
  --dur-hero:    1200ms;
  --dur-marquee: 40s;

  --tap-target:  48px;        /* Material floor; iOS HIG floor is 44 — go higher */

  --container:   1120px;
  --gutter:      20px;

  --font-system: -apple-system, BlinkMacSystemFont, 'SF Pro', 'Segoe UI', system-ui, 'Noto Sans Georgian', sans-serif;

  color-scheme: dark;
}

/* -------------------------------------------------------------------------- */
/* Light theme — opt-in via `html[data-theme="light"]` only.                  */
/* Future-proof hatch; the page never auto-switches to light.                 */
/* -------------------------------------------------------------------------- */

html[data-theme='light'] {
  --bg:         #F8FAFC;
  --bg-deep:    #EEF6F8;
  --bg-tint:    #ECFEFF;
  --surface:    #FFFFFF;
  --surface-2:  #F1F5F9;
  --text:       #0F172A;
  --text-mut:   #475569;
  --text-faint: #94A3B8;
  --border:     #E2E8F0;

  --danger:     #EF4444;
  --success:    #14B8A6;

  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 4px 16px rgba(20, 184, 166, 0.10);
  --shadow-lg: 0 12px 32px rgba(20, 184, 166, 0.18);

  color-scheme: light;
}

/* -------------------------------------------------------------------------- */
/* Modern reset + base                                                         */
/* -------------------------------------------------------------------------- */

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  /* Hard guard: any horizontal overflow below gets clipped at the root.
   * Long Georgian words, accidentally-unwrappable anchors, or future
   * extra-wide media never break the viewport on mobile. */
  overflow-x: hidden;
}

body {
  margin: 0;
  font-family: var(--font-system);
  font-size: 17px;
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  /* Aggressive word-breaking catches any unwrappable long Georgian
   * compound or URL from escaping its container. */
  overflow-wrap: break-word;
  word-wrap: break-word;
}

main { flex: 1 0 auto; }

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

a {
  color: var(--brand-teal-light);
  text-decoration: none;
  transition: color var(--dur-fast) var(--ease-soft);
}
a:hover { color: var(--brand-violet-light); }
a:focus-visible {
  outline: 2px solid var(--brand-teal-light);
  outline-offset: 3px;
  border-radius: 4px;
}

button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
}
button:focus-visible {
  outline: 2px solid var(--brand-teal-light);
  outline-offset: 3px;
}

h1, h2, h3, h4 {
  margin: 0 0 0.5em;
  line-height: 1.2;
  letter-spacing: -0.01em;
  font-weight: 800;
}
h1 { font-size: clamp(2rem, 6vw, 3.4rem); }
h2 { font-size: clamp(1.5rem, 4vw, 2.2rem); }
h3 { font-size: clamp(1.15rem, 2.5vw, 1.4rem); }
p  { margin: 0 0 1em; color: var(--text-mut); }

/* -------------------------------------------------------------------------- */
/* Brand-gradient text helper — used on hero + brand wordmark for the         */
/* iOS auth-style "teal → white → violet" headline treatment.                  */
/* -------------------------------------------------------------------------- */

.text-gradient-brand {
  background: linear-gradient(90deg, var(--brand-teal-light) 0%, #FFFFFF 50%, var(--brand-violet-light) 100%);
  -webkit-background-clip: text;
          background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
}

/* -------------------------------------------------------------------------- */
/* Reduced motion — respect user preference                                    */
/* -------------------------------------------------------------------------- */

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

/* -------------------------------------------------------------------------- */
/* Skip-to-content (accessibility)                                             */
/* -------------------------------------------------------------------------- */

.skip-to-content {
  position: absolute;
  top: -100px;
  left: 16px;
  z-index: 100;
  padding: 12px 20px;
  background: var(--brand-teal);
  color: #FFFFFF;
  border-radius: var(--radius-button);
  font-weight: 700;
  transition: top var(--dur-fast) var(--ease-soft);
}
.skip-to-content:focus { top: 16px; color: #FFFFFF; }

/* -------------------------------------------------------------------------- */
/* Print stylesheet — legal docs print clean (force light for paper)           */
/* -------------------------------------------------------------------------- */

@media print {
  :root {
    --bg: #FFFFFF;
    --surface: #FFFFFF;
    --text: #000000;
    --text-mut: #333333;
    --text-faint: #555555;
    --border: #CCCCCC;
  }
  body { font-size: 11pt; line-height: 1.4; color: #000; background: #fff; }
  .site-header, .site-footer, .lang-pill, .nav-toggle, .skip-to-content,
  .legal-version, .toc, .send-row, .copy-fallback, .feature-grid,
  .coming-soon-strip, .audience-block, .hero { display: none !important; }
  main, .container { padding: 0; max-width: none; }
  h1, h2, h3 { color: #000; page-break-after: avoid; }
  .legal-section { page-break-inside: avoid; }
  .legal-section + .legal-section { page-break-before: always; }
  a { color: #000; text-decoration: underline; }
  a[href^='http']::after,
  a[href^='mailto']::after {
    content: ' (' attr(href) ')';
    font-size: 0.85em;
    color: #555;
  }
}
