/* ============================================
   NAV
   ============================================ */
.nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  padding: 0.75rem max(var(--space-md), env(safe-area-inset-right)) 0 max(var(--space-md), env(safe-area-inset-left));
  padding-top: max(0.75rem, env(safe-area-inset-top));
  pointer-events: none;
}

.nav .container {
  max-width: 760px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(250, 248, 244, 0.72);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border);
  border-radius: 100px;
  padding: 0.45rem 0.5rem 0.45rem 1.4rem;
  box-shadow: var(--shadow-sm);
  pointer-events: auto;
}

/* Dark theme: nav pill becomes dark glass */
:root[data-theme="dark"] .nav .container { background: rgba(15, 15, 42, 0.72); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .nav .container { background: rgba(15, 15, 42, 0.72); }
}

.nav-wordmark {
  font-family: 'EB Garamond', Georgia, serif;
  font-size: 1.5rem;
  font-weight: 700;
  text-decoration: none;
  /* FINDING-009: extend tap area while keeping visible size identical */
  padding: 0.45rem 0.25rem;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  order: 2;
}

.nav-links a {
  font-size: var(--text-sm);
  font-weight: 500;
  text-decoration: none;
  color: var(--text);
  opacity: 0.55;
  transition: opacity 0.2s;
}
/* FINDING-009: 44px tap area on text links — does NOT touch the .nav-cta pill,
   which keeps its own padding so it doesn't clip its label. */
.nav-links a:not(.nav-cta) { padding: 0.5rem 0; }
.nav-links a:hover { opacity: 1; }

.nav-cta {
  display: inline-flex;
  background: var(--text);
  color: var(--bg) !important;
  opacity: 1 !important;
  padding: 0.45rem 1.1rem;
  border-radius: 100px;
  font-weight: 600 !important;
  font-size: var(--text-sm) !important;
  transition: transform 0.2s, box-shadow 0.2s;
}
.nav-cta:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.nav-cta--mobile { display: none; }

.nav-toggle {
  display: none;
  position: relative;
  background: none;
  border: none;
  color: var(--text);
  opacity: 1;
  /* FINDING-009: 44x44 tap area; visual icon stays 28px via SVG */
  padding: 8px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  width: 44px;
  height: 44px;
  border-radius: 100px;
}

.nav-icon {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.nav-icon--close {
  opacity: 0;
  transform: translate(-50%, -50%) rotate(-90deg);
}

.nav--open .nav-icon--dots {
  opacity: 0;
  transform: translate(-50%, -50%) rotate(90deg);
}

.nav--open .nav-icon--close {
  opacity: 1;
  transform: translate(-50%, -50%) rotate(0deg);
}

.nav-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 99;
}

/* ============================================
   DEVICE FRAME
   ============================================ */
.device-frame {
  position: relative;
  padding: 8px;
  background: var(--indigo-900);
  border-radius: 40px;
  border: 1px solid rgba(255,255,255,0.10);
  box-shadow: var(--shadow-card-deep);
}

.device-frame img,
.device-frame video {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 30px;
}

.device-frame::after {
  content: '';
  position: absolute;
  inset: 8px;
  border-radius: 30px;
  background: linear-gradient(165deg, rgba(255,255,255,0.06) 0%, transparent 35%);
  pointer-events: none;
  z-index: 2;
}

.device-frame--hero { width: 320px; }
.device-frame--feature { width: 240px; }

/* ============================================
   FOOTER
   ============================================ */
.footer {
  background: var(--indigo-900);
  color: var(--text-on-dark-secondary);
  padding: var(--space-xl) 0 max(var(--space-lg), env(safe-area-inset-bottom));
}

/* In dark mode the footer becomes an elevated surface, not a contrast slab */
:root[data-theme="dark"] .footer { background: var(--bg-elevated); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .footer { background: var(--bg-elevated); }
}

.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  align-items: first baseline;
  gap: var(--column-gap);
  margin-bottom: var(--space-lg);
}

.footer-brand-lockup {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  margin-bottom: var(--space-sm);
}

.footer-brand-name {
  font-family: 'EB Garamond', Georgia, serif;
  font-size: var(--text-xl);
  font-weight: 600;
  color: var(--text-on-dark);
  white-space: nowrap;
}

.footer-brand-tagline {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-on-dark-secondary);
  white-space: nowrap;
}

.footer-badge {
  display: inline-block;
  transition: opacity 0.2s;
}
.footer-badge:hover { opacity: 0.85; }
.footer-badge img { height: 35px; width: auto; }

/* Theme-aware App Store badge swap. Apple ships two locale-specific
 * variants — black for light backgrounds, white for dark — and the
 * usage guidelines require picking the right one for the surface.
 * Templates render BOTH <img> elements; CSS hides one based on the
 * effective theme (matches the precedence used in tokens.css:
 * explicit data-theme wins, prefers-color-scheme is the auto-follow
 * when no explicit choice exists).
 *
 * Used by .appstore-badge (hero) and .pricing-badge (pricing card).
 * The footer is always dark by design (var(--indigo-900) base, dark-
 * mode bg-elevated override) and renders only the white badge — no
 * swap markup needed there.
 *
 * Belt-and-suspenders specificity:
 *   - Selectors duplicated (.X.X) → specificity 0,2,0 (beats the
 *     parent `.pricing-badge img` rule at 0,1,1 and the global
 *     `img { display: block }` at 0,0,1).
 *   - `!important` on display, because this utility's single job is
 *     to hide/show the right badge — any future CSS rule that
 *     accidentally sets `display` on a swap-class img should not be
 *     able to break the swap. The `!important` is scoped narrowly to
 *     the display property of these two classes; no other property
 *     uses it. */
.badge-on-dark.badge-on-dark { display: none !important; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .badge-on-light.badge-on-light { display: none !important; }
  :root:not([data-theme="light"]) .badge-on-dark.badge-on-dark  { display: block !important; }
}
:root[data-theme="dark"] .badge-on-light.badge-on-light { display: none !important; }
:root[data-theme="dark"] .badge-on-dark.badge-on-dark  { display: block !important; }

.footer-col-title {
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-on-dark);
  margin-bottom: var(--space-sm);
}

.footer-col a {
  display: block;
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-on-dark-secondary);
  text-decoration: none;
  /* FINDING-009: 44px tap target on stacked footer links */
  padding: 0.6rem 0;
  transition: color 0.2s;
}
.footer-col a:hover { color: var(--text-on-dark); }

.footer-bottom {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding-top: var(--space-md);
}

.footer-legal {
  font-size: var(--text-xs);
  font-weight: 400;
  color: var(--text-on-dark-muted);
}
.footer-legal a {
  color: var(--text-on-dark-muted);
  text-decoration: none;
  transition: color 0.2s;
}
.footer-legal a:hover { color: var(--text-on-dark); }

/* ============================================
   SCROLL REVEAL — guarded against reduced-motion in tokens.css
   ============================================ */
.reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.65s ease, transform 0.65s ease;
}
.reveal.visible { opacity: 1; transform: none; }
.reveal-stagger > .reveal:nth-child(2) { transition-delay: 0.1s; }
.reveal-stagger > .reveal:nth-child(3) { transition-delay: 0.2s; }

/* Reduced-motion: never let .reveal hold the page invisible */
@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1 !important; transform: none !important; }
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 768px) {
  .split--5-7, .split--7-5 {
    grid-template-columns: 1fr;
    gap: var(--space-lg);
  }
  .split--7-5 .feature-visual { order: 2; }
  .split--7-5 .feature-content { order: 1; }

  .device-frame--hero { width: 240px; }
  .device-frame--feature { width: 200px; }

  .footer-grid { grid-template-columns: 1fr 1fr; }
  .footer-brand { grid-column: 1 / -1; margin-bottom: var(--space-sm); }

  .nav .container {
    max-width: none;
    padding: 0.45rem 0.5rem 0.45rem 1.2rem;
    flex-wrap: wrap;
  }

  .nav-wordmark { flex: 1; }

  .nav-cta--desktop { display: none !important; }
  .nav-cta--mobile {
    display: inline-flex;
    text-decoration: none;
    margin-right: 0.4rem;
  }
  .nav-toggle { display: block; flex-shrink: 0; }

  .nav-links {
    display: none;
    flex-basis: 100%;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding-top: 0.5rem;
    border-top: 1px solid var(--border);
    margin-top: 0.5rem;
  }

  .nav-links a {
    /* Mobile menu links stay clearly tappable */
    padding: 0.85rem 0.2rem;
    opacity: 0.7;
    font-size: var(--text-base);
    text-decoration: none;
    min-height: 44px;
    display: flex;
    align-items: center;
  }

  .nav--open .container { border-radius: 24px; }
  .nav--open .nav-links { display: flex; }
  .nav--open + .nav-backdrop { display: block; }
}

/* ============================================
   EMBED MODE  (?embed=1)
   ============================================ */
.embed .nav,
.embed .footer { display: none; }

/* ============================================
   CONTACT CTA (used on Help, Privacy, Terms)
   ============================================ */
.contact-cta {
  text-align: center;
  padding: var(--space-xl) 0;
  margin-top: var(--space-lg);
  border-top: 1px solid var(--border);
}

.contact-cta-title {
  font-size: var(--text-2xl);
  margin-bottom: var(--space-xs);
}

.contact-cta-body {
  color: var(--text-secondary);
  font-size: var(--text-lg);
  font-weight: 420;
  margin-bottom: var(--space-md);
}

.contact-cta-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.65rem 1.6rem;
  background: var(--text);
  color: var(--bg) !important;
  font-family: 'Merriweather Sans', sans-serif;
  font-size: var(--text-base);
  font-weight: 600;
  text-decoration: none;
  border-radius: 100px;
  transition: transform 0.2s, box-shadow 0.2s;
}

.contact-cta-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(17, 17, 17, 0.15);
}

.contact-cta-note {
  color: var(--text-muted);
  font-size: var(--text-sm);
  margin-top: var(--space-md);
  margin-bottom: 0;
}

@media (max-width: 768px) {
  .contact-cta-title { font-size: 2rem; }
}

/* ============================================================
   Region × Language switcher (PR2 — anchored, on-scale; supersedes
   variant D's centered modal + oversized type). Theme-aware via tokens.
   ============================================================ */

/* entry points */
.rl-trigger {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: none;
  border: none;
  color: var(--text-secondary);
  font: inherit;
  font-size: var(--text-sm);
  cursor: pointer;
  padding: 0.4rem 0.55rem;
  border-radius: 8px;
}
.rl-trigger:hover { color: var(--text); }
.rl-trigger:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
}
.rl-trigger svg { width: 20px; height: 20px; flex: none; }
.rl-trigger--header { color: var(--text-secondary); }
.rl-trigger--header svg { width: 20px; height: 20px; }
/* footer sits on the dark indigo surface — dark-on-light tokens would be
   invisible here (the bug behind "footer selector did not render"). */
.rl-trigger--footer {
  color: var(--text-on-dark-secondary);
  font-size: var(--text-xs);
  font-weight: 500;
}
.rl-trigger--footer:hover { color: var(--text-on-dark); }
.rl-trigger--footer .globe-icon { width: 16px; height: 16px; }
.rl-trigger--footer:focus-visible { outline-color: var(--focus-ring-on-dark, var(--focus-ring)); }
.rl-summary { white-space: nowrap; }

/* Header globe (.rl-trigger--hd, in .nav-links before the desktop CTA) is
   desktop-only — on mobile the nav pill has no room (it wrapped the menu
   toggle), so the footer control is the sole mobile entry. */
@media (max-width: 768px) { .rl-trigger--hd { display: none; } }

/* overlay + caret + dialog (anchored to its opener; JS sets coordinates).
   Popover, not a modal: the overlay is a transparent click-catcher so the
   trigger (globe) stays visible behind the panel — a dim layer made it
   "disappear". */
.rl-overlay {
  position: fixed; inset: 0;
  background: transparent;
  z-index: 200;
}
.rl-caret {
  position: fixed;
  z-index: 205;
  width: 14px; height: 14px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  transform: rotate(45deg);
}
.rl-modal {
  position: fixed;
  z-index: 210;
  /* neutral in-dialog focus ring — the site's red --focus-ring read as an
     error/alert on the pre-selected row. */
  --focus-ring: var(--text);
  width: min(560px, calc(100vw - 3rem));
  max-height: min(70vh, 640px);
  display: flex;
  flex-direction: column;
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  border-radius: 14px;
  box-shadow: var(--shadow-card-deep);
  overflow: hidden;
}
.rl-modal[hidden], .rl-overlay[hidden], .rl-caret[hidden] { display: none; }

/* compact head: tabs + state + close share one row */
.rl-tabs {
  display: flex;
  align-items: center;
  gap: 1.4rem;
  padding: 1rem 1.2rem 0;
  border-bottom: 1px solid var(--border);
}
.rl-tab {
  font-family: 'EB Garamond', Georgia, serif;
  font-size: var(--text-base);
  font-weight: 600;
  background: none; border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0 0 0.85rem;
  position: relative;
}
.rl-tab.is-on { color: var(--text); }
.rl-tab.is-on::after {
  content: ""; position: absolute;
  left: 0; right: 0; bottom: -1px; height: 2px;
  background: var(--text);
}
.rl-tab:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 3px; }
/* current state lives ONLY on the footer summary now — an in-dialog copy was
   redundant, misaligned, and truncated in a tethered panel. */
.rl-x {
  margin-left: auto;
  align-self: center;
  padding-bottom: 0.85rem;
  background: none; border: none;
  color: var(--text-muted);
  font-size: var(--text-base);
  cursor: pointer;
}
.rl-x:hover { color: var(--text); }
.rl-x:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; }

.rl-body { padding: 1rem 1.1rem 1.2rem; overflow: auto; }
.rl-panel[hidden] { display: none; }

/* two columns on desktop (less scroll for 175 countries), one on mobile */
.rl-grid { display: grid; grid-template-columns: repeat(2, 1fr); column-gap: 1rem; }
.rl-opt {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  padding: 0.65rem 0.7rem;
  border-radius: 9px;
  background: none; border: none;
  font: inherit;
  font-size: var(--text-sm);
  color: var(--text);
  text-align: left;
  cursor: pointer;
  width: 100%;
}
.rl-opt:hover { background: color-mix(in srgb, var(--text) 4%, transparent); }
.rl-opt.is-on { background: color-mix(in srgb, var(--text) 6%, transparent); }
.rl-opt.is-on .rl-nm { font-weight: 600; }
.rl-opt:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: -1px; }
.rl-opt[hidden] { display: none; }
.rl-fl { font-size: 1.1rem; width: 1.4rem; text-align: center; flex: none; }
.rl-nm { flex: 1; }
.rl-mk {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--text); flex: none;
}

/* country search (Country tab only) */
.rl-search {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.05rem 0.85rem;
  margin-bottom: 0.9rem;
  background: var(--bg);
  position: sticky;
  top: 0;
}
.rl-search svg { width: 17px; height: 17px; color: var(--text-muted); flex: none; }
.rl-search input {
  flex: 1;
  border: none; background: none;
  font: inherit; font-size: var(--text-sm);
  color: var(--text);
  padding: 0.7rem 0;
}
.rl-search input:focus { outline: none; }
.rl-empty { color: var(--text-muted); font-size: var(--text-xs); padding: 0.5rem 0.2rem; }

/* soft cross-hint — neutral/subdued, NOT an error (no accent red) */
.rl-hint {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  font-size: var(--text-sm);
  color: var(--text-secondary);
  background: color-mix(in srgb, var(--text) 4%, transparent);
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 0.6rem 0.85rem;
  margin-bottom: 0.9rem;
}
.rl-hint[hidden] { display: none; }
/* the whole message is the action (one-click apply); a quiet ✕ dismisses */
.rl-hint-apply {
  flex: 1;
  text-align: left;
  background: none; border: none;
  font: inherit; color: var(--text-secondary);
  cursor: pointer;
  padding: 0;
}
.rl-hint-apply:hover { color: var(--text); text-decoration: underline; }
.rl-hint-apply:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; }
.rl-hint-x {
  flex: none;
  background: none; border: none;
  color: var(--text-muted);
  font-size: var(--text-xs);
  cursor: pointer;
  padding: 0.1rem 0.2rem;
}
.rl-hint-x:hover { color: var(--text); }
.rl-hint-x:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; }

/* mobile: same anchored sheet (NOT full-screen), single column */
@media (max-width: 640px) {
  .rl-modal { width: min(440px, calc(100vw - 1rem)); max-height: min(72vh, 640px); }
  .rl-grid { grid-template-columns: 1fr; }
  .rl-tab { font-size: var(--text-base); }
}

@media (prefers-reduced-motion: no-preference) {
  .rl-modal { animation: rl-in 0.15s ease-out; }
  @keyframes rl-in { from { opacity: 0; } }
}
