/* =========================================================================
   AI Math Solver — marketing site design system.
   Palette is taken 1:1 from the app (lib/core/theme/app_colors.dart).
   Only these tokens drive buttons, links, gradients, badges and surfaces.
   ========================================================================= */
:root {
  /* Light theme — mirrors AppColors.light* */
  --brand: #2B57D6;          /* focus blue (primary) */
  --brand-strong: #12245C;   /* deep blue ink */
  --on-brand: #F4F8FF;       /* cool white on blue */
  --accent: #14B8A6;         /* teal */
  --accent-deep: #0F766E;    /* teal text/gradient end */
  --success: #18794E;
  --warning: #B45309;
  --error: #DC2626;

  --bg: #F4F6FB;             /* cool paper */
  --surface: #FFFFFF;
  --surface-2: #EDF1F8;
  --surface-3: #E6ECF5;
  --ink: #141821;           /* cool near-black */
  --muted: #5A6275;         /* cool muted text */
  --outline: #D9E0EC;
  --outline-soft: #EAEEF6;

  --grad-start: #2B57D6;
  --grad-end: #0F766E;
  --credit: #C77D12;

  --shadow-sm: 0 1px 2px rgba(18, 36, 92, .06), 0 2px 8px rgba(18, 36, 92, .05);
  --shadow-md: 0 8px 24px rgba(18, 36, 92, .10), 0 2px 8px rgba(18, 36, 92, .06);
  --shadow-lg: 0 24px 60px rgba(18, 36, 92, .16);

  --radius-sm: 10px;
  --radius: 16px;
  --radius-lg: 24px;
  --radius-xl: 32px;

  --maxw: 1120px;
  --gutter: clamp(16px, 5vw, 40px);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial,
          "Apple Color Emoji", "Segoe UI Emoji", sans-serif;
}

:root[data-theme="dark"] {
  /* Dark theme — mirrors AppColors.dark* */
  --brand: #6E9BFF;
  --brand-strong: #DCE6FF;
  --on-brand: #08142E;       /* dark text on bright blue */
  --accent: #2DD4BF;
  --accent-deep: #5EEAD4;
  --success: #5FCC8A;
  --warning: #FBBF24;
  --error: #F87171;

  --bg: #0F1218;
  --surface: #171A21;
  --surface-2: #1E222B;
  --surface-3: #262B36;
  --ink: #ECEEF3;
  --muted: #9AA5B8;
  --outline: #2A3040;
  --outline-soft: #222835;

  --grad-start: #6E9BFF;
  --grad-end: #2DD4BF;
  --credit: #FBBF24;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow-md: 0 10px 30px rgba(0, 0, 0, .45);
  --shadow-lg: 0 28px 70px rgba(0, 0, 0, .55);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { animation: none !important; transition: none !important; }
}

body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

h1, h2, h3 { line-height: 1.15; letter-spacing: -0.02em; margin: 0 0 .5em; }
h1 { font-size: clamp(2.1rem, 6vw, 3.6rem); font-weight: 800; }
h2 { font-size: clamp(1.6rem, 4vw, 2.5rem); font-weight: 800; }
h3 { font-size: 1.2rem; font-weight: 700; }
p { margin: 0 0 1rem; color: var(--muted); }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }

.wrap { max-width: var(--maxw); margin: 0 auto; padding-inline: var(--gutter); }
.eyebrow {
  text-transform: uppercase; letter-spacing: .14em; font-size: .78rem;
  font-weight: 700; color: var(--accent-deep);
}
.lead { font-size: 1.15rem; color: var(--muted); max-width: 60ch; }
.center { text-align: center; margin-inline: auto; }

/* Focus visibility (accessibility) */
a:focus-visible, button:focus-visible, .btn:focus-visible, .shot:focus-visible {
  outline: 3px solid var(--accent); outline-offset: 3px; border-radius: 8px;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: .5rem; cursor: pointer;
  font: inherit; font-weight: 700; border: 0; border-radius: 999px;
  padding: .85rem 1.5rem; transition: transform .15s ease, box-shadow .2s ease, background .2s ease;
}
.btn:hover { text-decoration: none; transform: translateY(-2px); }
.btn-primary { background: var(--brand); color: var(--on-brand); box-shadow: var(--shadow-md); }
.btn-primary:hover { box-shadow: var(--shadow-lg); }
.btn-ghost { background: transparent; color: var(--ink); border: 1.5px solid var(--outline); }
.btn-ghost:hover { border-color: var(--brand); color: var(--brand); }

/* Google Play badge (token-styled, inline) */
.play-badge {
  display: inline-flex; align-items: center; gap: .75rem;
  background: var(--ink); color: var(--bg);
  border-radius: 14px; padding: .6rem 1.15rem; transition: transform .15s ease, box-shadow .2s ease;
  box-shadow: var(--shadow-md);
}
:root[data-theme="dark"] .play-badge { background: var(--surface-3); color: var(--ink); border: 1px solid var(--outline); }
.play-badge:hover { transform: translateY(-2px); text-decoration: none; box-shadow: var(--shadow-lg); }
.play-badge svg { width: 26px; height: 26px; flex: none; }
.play-badge .pb-small { font-size: .66rem; opacity: .85; line-height: 1; letter-spacing: .04em; text-transform: uppercase; }
.play-badge .pb-big { font-size: 1.15rem; font-weight: 700; line-height: 1.1; }

/* ---------- Nav ---------- */
.nav {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(140%) blur(14px);
  border-bottom: 1px solid var(--outline-soft);
}
.nav-inner { display: flex; align-items: center; gap: 1rem; height: 66px; }
.brand { display: flex; align-items: center; gap: .6rem; font-weight: 800; color: var(--ink); }
.brand:hover { text-decoration: none; }
.brand img { width: 34px; height: 34px; border-radius: 9px; box-shadow: var(--shadow-sm); }
.nav-links { display: flex; align-items: center; gap: .3rem; margin-left: auto; }
.nav-links a {
  color: var(--muted); font-weight: 600; padding: .5rem .8rem; border-radius: 10px;
}
.nav-links a:hover { color: var(--ink); background: var(--surface-2); text-decoration: none; }
.nav-cta { margin-left: .4rem; }
.icon-btn {
  display: inline-grid; place-items: center; width: 42px; height: 42px; cursor: pointer;
  background: var(--surface-2); color: var(--ink); border: 1px solid var(--outline);
  border-radius: 12px; transition: background .2s ease, transform .15s ease;
}
.icon-btn:hover { background: var(--surface-3); }
.icon-btn svg { width: 20px; height: 20px; }
.theme-toggle .moon { display: none; }
:root[data-theme="dark"] .theme-toggle .sun { display: none; }
:root[data-theme="dark"] .theme-toggle .moon { display: block; }
.hamburger { display: none; }

@media (max-width: 820px) {
  .nav-links {
    position: fixed; inset: 66px 0 auto 0; flex-direction: column; align-items: stretch;
    gap: .2rem; padding: 1rem var(--gutter) 1.4rem; background: var(--bg);
    border-bottom: 1px solid var(--outline); box-shadow: var(--shadow-md);
    transform: translateY(-120%); transition: transform .28s ease; margin-left: 0;
  }
  .nav-links.open { transform: translateY(0); }
  .nav-links a { padding: .8rem 1rem; }
  .nav-cta { margin: .4rem 0 0; }
  .nav-right { margin-left: auto; display: flex; gap: .5rem; }
  .hamburger { display: inline-grid; }
}

/* ---------- Hero ---------- */
.hero { position: relative; padding: clamp(3rem, 8vw, 6rem) 0 clamp(2rem, 6vw, 4rem); overflow: hidden; }
.hero::before {
  content: ""; position: absolute; inset: -30% -10% auto; height: 620px; z-index: -1;
  background:
    radial-gradient(60% 60% at 15% 10%, color-mix(in srgb, var(--brand) 22%, transparent), transparent 70%),
    radial-gradient(50% 50% at 90% 0%, color-mix(in srgb, var(--accent) 20%, transparent), transparent 70%);
  filter: blur(6px);
}
.hero-grid { display: grid; grid-template-columns: 1.05fr .95fr; gap: clamp(2rem, 5vw, 4rem); align-items: center; }
.hero h1 .grad { background: linear-gradient(100deg, var(--grad-start), var(--grad-end)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero .cta-row { display: flex; flex-wrap: wrap; gap: .8rem; margin-top: 1.6rem; align-items: center; }
.trust { display: flex; flex-wrap: wrap; gap: 1.1rem; margin-top: 1.6rem; color: var(--muted); font-size: .92rem; }
.trust span { display: inline-flex; align-items: center; gap: .4rem; }
.trust svg { width: 18px; height: 18px; color: var(--success); }

/* Phone mockup */
.phone {
  position: relative; width: min(300px, 78vw); margin-inline: auto;
  border-radius: 44px; padding: 12px; background: linear-gradient(160deg, #20242e, #0b0d12);
  box-shadow: var(--shadow-lg); border: 1px solid rgba(255,255,255,.06);
}
.phone::after { content: ""; position: absolute; top: 18px; left: 50%; transform: translateX(-50%); width: 42%; height: 22px; background: #0b0d12; border-radius: 0 0 16px 16px; z-index: 2; }
.phone img { border-radius: 33px; width: 100%; display: block; }
.phone-float { animation: floaty 6s ease-in-out infinite; }
@keyframes floaty { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-12px); } }

@media (max-width: 860px) {
  .hero-grid { grid-template-columns: 1fr; text-align: center; }
  .hero .cta-row, .trust { justify-content: center; }
  .lead { margin-inline: auto; }
  .hero-media { order: -1; }
}

/* ---------- Sections ---------- */
section { padding: clamp(3rem, 7vw, 5.5rem) 0; }
.section-head { max-width: 62ch; margin: 0 auto clamp(2rem, 4vw, 3rem); text-align: center; }

.features { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 1.1rem; }
.card {
  background: var(--surface); border: 1px solid var(--outline); border-radius: var(--radius-lg);
  padding: 1.6rem; box-shadow: var(--shadow-sm); transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}
.card:hover { transform: translateY(-4px); box-shadow: var(--shadow-md); border-color: color-mix(in srgb, var(--brand) 40%, var(--outline)); }
.card .ico {
  width: 50px; height: 50px; border-radius: 14px; display: grid; place-items: center; margin-bottom: 1rem;
  background: linear-gradient(150deg, color-mix(in srgb, var(--brand) 18%, var(--surface)), color-mix(in srgb, var(--accent) 16%, var(--surface)));
  color: var(--brand); border: 1px solid var(--outline-soft);
}
.card .ico svg { width: 26px; height: 26px; }
.card h3 { color: var(--ink); }
.card p { margin: 0; font-size: .96rem; }

/* How it works */
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.2rem; counter-reset: step; }
.step { position: relative; background: var(--surface); border: 1px solid var(--outline); border-radius: var(--radius-lg); padding: 2rem 1.5rem 1.6rem; text-align: center; }
.step .num {
  width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; margin: 0 auto 1rem;
  font-weight: 800; color: var(--on-brand); background: linear-gradient(150deg, var(--grad-start), var(--grad-end));
  box-shadow: var(--shadow-sm);
}
@media (max-width: 760px) { .steps { grid-template-columns: 1fr; } }

/* Gallery */
.gallery { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 1rem; }
.shot {
  border: 0; padding: 0; cursor: zoom-in; background: transparent; border-radius: 26px;
  box-shadow: var(--shadow-md); transition: transform .2s ease; overflow: hidden;
}
.shot:hover { transform: translateY(-5px) scale(1.01); }
.shot img { border-radius: 26px; width: 100%; }

/* Privacy band */
.band {
  background: linear-gradient(135deg, var(--grad-start), var(--grad-end)); color: var(--on-brand);
  border-radius: var(--radius-xl); padding: clamp(2rem, 5vw, 3.2rem); box-shadow: var(--shadow-lg);
}
.band h2, .band p { color: var(--on-brand); }
.band p { opacity: .92; max-width: 70ch; }
.band .btn-primary { background: var(--on-brand); color: var(--brand); }

/* ---------- Lightbox ---------- */
.lightbox {
  position: fixed; inset: 0; z-index: 100; display: none; place-items: center;
  background: rgba(5, 8, 16, .82); backdrop-filter: blur(6px); padding: 4vh 4vw;
}
.lightbox.open { display: grid; }
.lightbox img { max-height: 92vh; width: auto; border-radius: 22px; box-shadow: var(--shadow-lg); }
.lightbox-close {
  position: absolute; top: 18px; right: 20px; width: 46px; height: 46px; border-radius: 50%;
  background: rgba(255,255,255,.14); color: #fff; border: 0; cursor: pointer; font-size: 1.4rem;
}

/* ---------- Footer ---------- */
.footer { border-top: 1px solid var(--outline); background: var(--surface); padding: 3rem 0 2rem; margin-top: 2rem; }
.footer-grid { display: flex; flex-wrap: wrap; gap: 2rem; justify-content: space-between; align-items: flex-start; }
.footer .brand { margin-bottom: .6rem; }
.footer-cols { display: flex; flex-wrap: wrap; gap: 2.5rem; }
.footer-cols h4 { font-size: .8rem; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); margin: 0 0 .7rem; }
.footer-cols a { display: block; color: var(--ink); padding: .25rem 0; font-weight: 500; }
.footer-cols a:hover { color: var(--brand); }
.footer-note { margin-top: 2rem; padding-top: 1.4rem; border-top: 1px solid var(--outline-soft); color: var(--muted); font-size: .88rem; display: flex; flex-wrap: wrap; gap: .5rem 1.2rem; justify-content: space-between; }

/* ---------- Legal pages ---------- */
.legal { padding: clamp(2.5rem, 6vw, 4rem) 0 4rem; }
.legal .doc { max-width: 820px; margin: 0 auto; background: var(--surface); border: 1px solid var(--outline); border-radius: var(--radius-lg); padding: clamp(1.5rem, 5vw, 3rem); box-shadow: var(--shadow-sm); }
.legal h1 { font-size: clamp(1.8rem, 5vw, 2.6rem); }
.legal h2 { font-size: 1.3rem; margin-top: 2.2rem; color: var(--ink); }
.legal h3 { font-size: 1.05rem; margin-top: 1.4rem; }
.legal p, .legal li { color: var(--muted); }
.legal li { margin-bottom: .4rem; }
.legal .updated { display: inline-block; font-size: .85rem; color: var(--accent-deep); font-weight: 700; background: color-mix(in srgb, var(--accent) 14%, var(--surface)); padding: .35rem .8rem; border-radius: 999px; border: 1px solid var(--outline-soft); }
.legal .callout { background: color-mix(in srgb, var(--brand) 8%, var(--surface)); border: 1px solid color-mix(in srgb, var(--brand) 25%, var(--outline)); border-left: 4px solid var(--brand); border-radius: var(--radius); padding: 1.1rem 1.3rem; margin: 1.4rem 0; }
.legal .callout p:last-child { margin-bottom: 0; }
.legal a { font-weight: 600; }
.toc { font-size: .95rem; }

/* Contact */
.contact-card { max-width: 620px; margin: 0 auto; text-align: center; background: var(--surface); border: 1px solid var(--outline); border-radius: var(--radius-lg); padding: clamp(2rem, 5vw, 3rem); box-shadow: var(--shadow-sm); }
.contact-card .ico { width: 64px; height: 64px; margin: 0 auto 1.2rem; border-radius: 20px; display: grid; place-items: center; background: linear-gradient(150deg, var(--grad-start), var(--grad-end)); color: var(--on-brand); }
.contact-card .ico svg { width: 32px; height: 32px; }

/* Scroll reveal */
.reveal { opacity: 0; transform: translateY(24px); transition: opacity .7s ease, transform .7s ease; }
.reveal.in { opacity: 1; transform: none; }
