/* Self-contained styling for crawlable content/landing pages (index.html,
   <slug>.html, /tools, legal pages). These pages do NOT boot the Flutter app,
   so they cannot inherit app theme/CSS — everything they need is here.

   THEME SYSTEM: the EXACT 7 app themes, source of truth =
   apps/mobile/lib/core/theme/app_theme_colors.dart (matches the brand spec).
   Each theme defines a complete semantic token set (not a shallow skin); the
   shared component rules below consume those tokens identically per theme.
   Only exact spec hex + #fff/#000 + alpha/color-mix derivations are used.
   No external fonts or network calls. */

/* ── Per-theme raw color roles ──────────────────────────────────────────── */
:root,
[data-theme="dark"] {
  --bg: #04070B; --fg: #E6F1FF; --card: #070B12; --card-fg: #F4F7FB;
  --primary: #00F0FF; --primary-fg: #04070B; --secondary: #141B26; --secondary-fg: #D8E2F3;
  --muted-s: #101722; --muted-fg: #7A8699; --accent: #00DCFF; --accent-fg: #04070B;
  --destructive: #FF4040; --border: #1B2432; --input: #1B2432; --ring: #00E4FF;
  --glow-primary: rgba(0,240,255,.45); --glow-accent: rgba(0,170,255,.40); --glow-subtle: rgba(0,150,220,.25);
}
[data-theme="light"] {
  --bg: #051A1D; --fg: #FFFFFF; --card: #051B1E; --card-fg: #FFFFFF;
  --primary: #00E6E6; --primary-fg: #051A1D; --secondary: #222226; --secondary-fg: #FFFFFF;
  --muted-s: #051C1F; --muted-fg: #CCCCCC; --accent: #00CCCC; --accent-fg: #051A1D;
  --destructive: #DC2626; --border: #051A1E; --input: #05181B; --ring: #00E6E6;
  --glow-primary: rgba(0,230,230,.45); --glow-accent: rgba(0,200,200,.35); --glow-subtle: rgba(0,180,180,.20);
}
[data-theme="matrix"] {
  --bg: #010A06; --fg: #7BFFB9; --card: #04130B; --card-fg: #B9FFD8;
  --primary: #00FF88; --primary-fg: #011006; --secondary: #052013; --secondary-fg: #66FFAC;
  --muted-s: #042512; --muted-fg: #4CD087; --accent: #00E87A; --accent-fg: #011006;
  --destructive: #FF4040; --border: #09361D; --input: #09361D; --ring: #00FF88;
  --glow-primary: rgba(0,255,136,.45); --glow-accent: rgba(0,200,110,.40); --glow-subtle: rgba(0,170,96,.25);
}
[data-theme="neon"] {
  --bg: #0B0612; --fg: #F5F0FF; --card: #120D2A; --card-fg: #FEF7FF;
  --primary: #FF3DFF; --primary-fg: #0B0612; --secondary: #1A1038; --secondary-fg: #F0E8FF;
  --muted-s: #140F2C; --muted-fg: #A89ADB; --accent: #26D8FF; --accent-fg: #0B0612;
  --destructive: #FF4040; --border: #241A48; --input: #241A48; --ring: #FF3DFF;
  --glow-primary: rgba(255,0,255,.45); --glow-accent: rgba(0,230,255,.40); --glow-subtle: rgba(140,100,255,.30);
}
[data-theme="ocean"] {
  --bg: #082F49; --fg: #F8FAFC; --card: #0C4A6E; --card-fg: #F8FAFC;
  --primary: #38BDF8; --primary-fg: #082F49; --secondary: #334155; --secondary-fg: #E2E8F0;
  --muted-s: #075985; --muted-fg: #94A3B8; --accent: #2DD4BF; --accent-fg: #042F2E;
  --destructive: #EF4444; --border: #1F3F64; --input: #1F3F64; --ring: #38BDF8;
  --glow-primary: rgba(56,189,248,.45); --glow-accent: rgba(45,212,191,.40); --glow-subtle: rgba(15,118,110,.28);
}
[data-theme="sunset"] {
  --bg: #140616; --fg: #FDF6FF; --card: #1F0A29; --card-fg: #FFF8FB;
  --primary: #FF8A00; --primary-fg: #20070B; --secondary: #2A113C; --secondary-fg: #FFE5F2;
  --muted-s: #24102F; --muted-fg: #D9A9C8; --accent: #FF00A5; --accent-fg: #200310;
  --destructive: #EF4444; --border: #3A1A4E; --input: #3A1A4E; --ring: #FF8A00;
  --glow-primary: rgba(255,138,0,.45); --glow-accent: rgba(255,0,165,.40); --glow-subtle: rgba(200,0,120,.25);
}
[data-theme="pearl"] {
  --bg: #FFFFFF; --fg: #04070B; --card: #FFFFFF; --card-fg: #04070B;
  --primary: #00E6E6; --primary-fg: #051A1D; --secondary: #F4F7FB; --secondary-fg: #04070B;
  --muted-s: #E6F1FF; --muted-fg: #7A8699; --accent: #00CCCC; --accent-fg: #051A1D;
  --destructive: #DC2626; --border: #D8E2F3; --input: #F4F7FB; --ring: #00E6E6;
  --glow-primary: rgba(0,230,230,.22); --glow-accent: rgba(0,200,200,.18); --glow-subtle: rgba(0,170,255,.12);
}

/* ── Shared derived component tokens (formulas on listed colors only) ────── */
:root {
  --radius: 12px;
  --maxw: 880px;
  --text: var(--fg);
  --text-muted: var(--muted-fg);
  --accent-ink: var(--primary-fg);
  /* elevated card surface (surfaceHigh = mix(card, secondary, .35)) */
  --surface: color-mix(in srgb, var(--card) 62%, var(--secondary));
  --surface-2: var(--muted-s);
  --surface-hover: color-mix(in srgb, var(--card), var(--primary) 8%);
  /* primary works as a link colour on every dark theme; Pearl darkens it */
  --link: var(--primary);
  --card-shadow: 0 18px 44px rgba(0, 0, 0, .34);
}
[data-theme="pearl"] {
  --link: color-mix(in srgb, var(--primary), #000000 46%); /* legible cyan on white */
  --card-shadow: 0 16px 40px rgba(4, 7, 11, .10);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  /* premium ambient glow per theme, restrained */
  background:
    radial-gradient(130% 70% at 50% -12%, var(--glow-subtle), transparent 58%),
    var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue",
    Arial, "Noto Sans", "Noto Naskh Arabic", sans-serif;
  line-height: 1.65;
  font-size: 17px;
}

:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; border-radius: 4px; }

/* ── Brand header + language/theme controls ─────────────────────────────── */
/* Fixed dark gradient so the logo's light wordmark stays legible in every
   theme (incl. Pearl/light); a thin primary edge ties it to the active theme. */
.cyvo-topbar {
  /* THEME-AWARE frame: each theme colors its own header from its tokens. */
  border-bottom: 1px solid color-mix(in srgb, var(--border), var(--primary) 35%);
  background: linear-gradient(180deg, var(--surface) 0%, var(--bg) 100%);
  box-shadow: 0 1px 0 var(--glow-subtle);
}
.cyvo-bar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; max-width: var(--maxw); margin: 0 auto; padding: 10px 20px;
}
/* emblem.png = brand-cyan (#00DDFF) filled logo on transparent background.
   Always readable on dark backgrounds (>8:1 contrast).
   CSS hue-rotate shifts cyan to each theme's accent colour.
   Pearl (white bg): brightness(0) produces dark ink + brand-cyan glow. */
.cyvo-brand { display: inline-flex; align-items: center; gap: 10px; }
.cyvo-emblem {
  display: block; height: 38px; width: auto;
  filter: drop-shadow(0 0 8px rgba(0,221,255,0.55));
}
[data-theme="matrix"] .cyvo-emblem {
  filter: hue-rotate(-40deg) saturate(1.1) drop-shadow(0 0 8px rgba(0,255,136,0.60));
}
[data-theme="neon"] .cyvo-emblem {
  filter: hue-rotate(107deg) saturate(2) drop-shadow(0 0 10px rgba(255,0,255,0.65));
}
[data-theme="ocean"] .cyvo-emblem {
  filter: saturate(1.15) drop-shadow(0 0 9px rgba(45,212,191,0.62));
}
[data-theme="sunset"] .cyvo-emblem {
  filter: hue-rotate(-160deg) saturate(1.3) drop-shadow(0 0 8px rgba(255,138,0,0.60));
}
[data-theme="pearl"] .cyvo-emblem {
  filter: brightness(0) drop-shadow(0 0 6px rgba(0,221,255,0.40));
}
.cyvo-word { font-weight: 800; font-size: 20px; letter-spacing: -0.01em; color: var(--fg); }
.cyvo-brand:hover { text-decoration: none; }
.cyvo-brand:hover .cyvo-word { color: var(--primary); }

.cyvo-controls { display: flex; align-items: center; gap: 8px; }
.cyvo-menu { position: relative; }
.cyvo-menu > summary {
  list-style: none; cursor: pointer; display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 12px; border: 1px solid var(--border); border-radius: 999px;
  background: var(--surface); color: var(--text); font-size: 14px; white-space: nowrap;
}
.cyvo-menu > summary::-webkit-details-marker { display: none; }
.cyvo-menu[open] > summary { border-color: var(--primary); }
.cyvo-caret { font-size: 11px; opacity: .75; }
.cyvo-menu-list {
  position: absolute; inset-inline-end: 0; top: calc(100% + 6px); margin: 0; padding: 6px;
  list-style: none; min-width: 200px; max-height: 64vh; overflow: auto;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  box-shadow: var(--card-shadow); z-index: 40;
}
.cyvo-menu-list li { margin: 0; }
.cyvo-menu-list a,
.cyvo-menu-list button {
  display: flex; align-items: center; gap: 8px; width: 100%; text-align: start;
  padding: 8px 12px; border: 0; border-radius: 8px; background: transparent;
  color: var(--text); font: inherit; font-size: 14px; cursor: pointer;
}
.cyvo-menu-list a:hover,
.cyvo-menu-list button:hover { background: var(--surface-hover); text-decoration: none; }
.cyvo-menu-list a.is-current,
.cyvo-menu-list button.is-current { background: var(--primary); color: var(--primary-fg); font-weight: 650; }
.cyvo-theme-list {
  max-height: min(72vh, calc(100dvh - 140px));
  overflow-y: auto;
  overscroll-behavior: contain;
}
.cyvo-ic { font-size: 15px; line-height: 1; }

/* ── Content ────────────────────────────────────────────────────────────── */
#cyvo-landing { max-width: var(--maxw); margin: 0 auto; padding: 32px 20px 72px; }

a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }

.cyvo-crumbs { font-size: 14px; color: var(--text-muted); margin-bottom: 20px; }
.cyvo-crumbs a { color: var(--text-muted); }

h1 { font-size: clamp(28px, 5vw, 42px); line-height: 1.18; letter-spacing: -0.02em; margin: 8px 0 16px; }
h2 { font-size: clamp(21px, 3.4vw, 26px); letter-spacing: -0.01em; margin: 40px 0 12px; }
h3 { font-size: 18px; margin: 22px 0 6px; }
p { margin: 0 0 14px; }

.cyvo-intro { font-size: clamp(18px, 2.4vw, 21px); color: var(--text); max-width: 64ch; margin-bottom: 24px; }

.cyvo-privacy {
  color: var(--text-muted); font-size: 15px;
  border-inline-start: 3px solid var(--primary); padding-inline-start: 14px;
}
.cyvo-inputs { color: var(--text-muted); font-size: 15px; }

.cyvo-cta {
  display: inline-block; background: var(--primary); color: var(--primary-fg) !important;
  font-weight: 650; padding: 13px 28px; border-radius: 999px; margin: 8px 0;
  box-shadow: 0 0 22px var(--glow-primary);
  transition: filter .15s ease, box-shadow .15s ease, transform .15s ease;
}
.cyvo-cta:hover { text-decoration: none; filter: brightness(1.06); transform: translateY(-1px); }

/* Official Apple/Google badge images are already fully styled buttons —
   only layout and a subtle hover lift belong here. */
.cyvo-store-badges { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; margin: 8px 0 20px; }
.cyvo-store-badge { display: inline-block; line-height: 0; transition: transform .15s ease, filter .15s ease; }
.cyvo-store-badge:hover { transform: translateY(-1px); filter: brightness(1.06); }
.cyvo-store-badge img { display: block; height: 48px; width: auto; }

.cyvo-section {
  margin-top: 16px; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px 20px;
}
.cyvo-section p { color: var(--text); }

/* Tool grid */
.cyvo-grid { margin-top: 36px; }
.cyvo-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; margin-top: 12px; }
.cyvo-card {
  display: block; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px 18px; color: var(--text) !important;
  transition: border-color .15s ease, transform .15s ease, box-shadow .15s ease, background .15s ease;
}
.cyvo-card:hover {
  text-decoration: none; border-color: var(--primary); background: var(--surface-hover);
  transform: translateY(-2px); box-shadow: 0 0 18px var(--glow-subtle);
}
.cyvo-card h3 { margin: 0 0 6px; font-size: 17px; }
.cyvo-card p { margin: 0; color: var(--text-muted); font-size: 14px; }

/* Actions / related / FAQ */
.cyvo-actions ul { padding-inline-start: 20px; }
.cyvo-actions li { margin-bottom: 6px; }
.cyvo-faq h3 { color: var(--text); }
.cyvo-faq p { color: var(--text); margin-bottom: 18px; }
.cyvo-related { margin-top: 40px; }
.cyvo-related-links { display: flex; flex-wrap: wrap; gap: 10px 18px; }

.cyvo-tagline { margin-top: 40px; color: var(--text-muted); font-style: italic; }

.cyvo-foot {
  margin-top: 28px; padding-top: 18px; border-top: 1px solid var(--border);
  color: var(--text-muted); font-size: 15px;
}

/* RTL (ar, ur) */
[dir="rtl"] .cyvo-privacy { border-inline-start: 3px solid var(--primary); }

@media (max-width: 520px) {
  body { font-size: 16px; }
  #cyvo-landing { padding: 24px 16px 56px; }
  .cyvo-bar { padding: 8px 14px; gap: 8px; }
  .cyvo-menu > summary { padding: 6px 10px; }
}
