/* ============================================================
   Think Puzzle — marketing + dashboard design system
   Brand palette pulled from the app (DesignTokens.swift):
     navy #1A1F36 · gold #F5C518 · purple #6B3FA0 · teal #00897B
   ============================================================ */

:root {
  --navy: #1a1f36;
  --navy-700: #262c4a;
  --gold: #f5c518;
  --gold-deep: #e0ac00;
  --purple: #6b3fa0;
  --teal: #00897b;
  --amber: #f5a623;

  --ink: #1a1f36;
  --ink-soft: #4a4f68;
  --ink-faint: #767b90;
  --paper: #fbf9f4;
  --paper-2: #f3efe6;
  --card: #ffffff;
  --line: #e7e1d4;
  --shadow: 24px 24px 60px rgba(26, 31, 54, 0.10);
  --shadow-sm: 0 6px 20px rgba(26, 31, 54, 0.08);
  --radius: 20px;
  --radius-lg: 28px;
  --maxw: 1080px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica,
    Arial, "Apple Color Emoji", sans-serif;

  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --ink: #f4f2ec;
    --ink-soft: #c3c1d4;
    --ink-faint: #918ea6;
    --paper: #101426;
    --paper-2: #161b31;
    --card: #1a2039;
    --line: #2a3050;
    --shadow: 24px 24px 60px rgba(0, 0, 0, 0.35);
    --shadow-sm: 0 6px 20px rgba(0, 0, 0, 0.3);
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background: var(--paper);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}
img { max-width: 100%; height: auto; display: block; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, h4 { line-height: 1.08; letter-spacing: -0.02em; margin: 0 0 0.4em; font-weight: 800; }
h1 { font-size: clamp(2.4rem, 6vw, 4.2rem); }
h2 { font-size: clamp(1.8rem, 4vw, 2.8rem); }
h3 { font-size: 1.3rem; }
p { margin: 0 0 1rem; }
.lede { font-size: clamp(1.1rem, 2.2vw, 1.4rem); color: var(--ink-soft); }
small { color: var(--ink-faint); }

/* ---------- layout ---------- */
.wrap { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 22px; }
.section { padding: clamp(56px, 9vw, 120px) 0; }
.section-tight { padding: clamp(36px, 6vw, 72px) 0; }
.center { text-align: center; }
.grid { display: grid; gap: 24px; }
.eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 0.78rem; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--purple); margin-bottom: 14px;
}
.eyebrow::before { content: ""; width: 22px; height: 2px; background: var(--gold); border-radius: 2px; }

/* ---------- nav ---------- */
.nav {
  position: sticky; top: 0; z-index: 50;
  backdrop-filter: saturate(160%) blur(14px);
  background: color-mix(in srgb, var(--paper) 82%, transparent);
  border-bottom: 1px solid var(--line);
}
.nav__row { display: flex; align-items: center; justify-content: space-between; height: 66px; }
.brand { display: flex; align-items: center; gap: 11px; font-weight: 800; letter-spacing: -0.02em; }
.brand img { width: 34px; height: 34px; border-radius: 9px; box-shadow: var(--shadow-sm); }
.nav__links { display: flex; align-items: center; gap: 26px; }
.nav__links a { color: var(--ink-soft); font-weight: 600; font-size: 0.96rem; }
.nav__links a:hover { color: var(--ink); }
.nav__toggle { display: none; background: none; border: 0; font-size: 1.5rem; color: var(--ink); cursor: pointer; }

@media (max-width: 720px) {
  .nav__links {
    position: absolute; top: 66px; left: 0; right: 0;
    flex-direction: column; align-items: stretch; gap: 0;
    background: var(--paper); border-bottom: 1px solid var(--line);
    max-height: 0; overflow: hidden; transition: max-height 0.28s ease;
  }
  .nav__links.open { max-height: 380px; }
  .nav__links a { padding: 15px 22px; border-top: 1px solid var(--line); }
  .nav__links .btn { margin: 12px 22px; text-align: center; }
  .nav__toggle { display: block; }
}

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  font-weight: 700; font-size: 1rem; padding: 13px 22px; border-radius: 14px;
  border: 1px solid transparent; cursor: pointer; transition: transform 0.14s ease, box-shadow 0.14s ease, background 0.14s;
}
.btn:active { transform: translateY(1px) scale(0.99); }
.btn--primary { background: var(--navy); color: #fff; box-shadow: var(--shadow-sm); }
.btn--primary:hover { background: var(--navy-700); }
.btn--gold { background: var(--gold); color: var(--navy); box-shadow: 0 8px 22px rgba(245, 197, 24, 0.35); }
.btn--gold:hover { background: var(--gold-deep); }
.btn--ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn--ghost:hover { border-color: var(--ink-faint); }
.btn--lg { padding: 16px 26px; font-size: 1.06rem; }

/* App Store badge (self-contained, no external image) */
.appstore {
  display: inline-flex; align-items: center; gap: 12px;
  background: var(--navy); color: #fff; padding: 11px 20px 11px 18px; border-radius: 14px;
  box-shadow: var(--shadow-sm); transition: transform 0.14s ease, background 0.14s;
}
.appstore:hover { transform: translateY(-2px); background: var(--navy-700); }
.appstore svg { width: 26px; height: 26px; flex: none; }
.appstore span { display: block; line-height: 1.12; }
.appstore .small { font-size: 0.66rem; opacity: 0.82; letter-spacing: 0.02em; }
.appstore .big { font-size: 1.16rem; font-weight: 700; letter-spacing: -0.01em; }
.cta-row { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; }

/* ---------- hero ---------- */
.hero { position: relative; padding: clamp(40px, 7vw, 96px) 0 clamp(30px, 6vw, 72px); overflow: hidden; }
.hero__grid { display: grid; grid-template-columns: 1.05fr 0.95fr; gap: 40px; align-items: center; }
.hero__badges { display: flex; gap: 10px; flex-wrap: wrap; margin: 22px 0 26px; }
.chip {
  display: inline-flex; align-items: center; gap: 7px; font-size: 0.85rem; font-weight: 600;
  color: var(--ink-soft); background: var(--card); border: 1px solid var(--line);
  padding: 7px 13px; border-radius: 999px;
}
.dot { width: 9px; height: 9px; border-radius: 50%; }
.dot--gold { background: var(--gold); } .dot--purple { background: var(--purple); }
.dot--teal { background: var(--teal); } .dot--navy { background: var(--navy); }

/* soft decorative puzzle grid behind hero */
.hero::before {
  content: ""; position: absolute; inset: 0; z-index: 0; pointer-events: none;
  background-image: radial-gradient(circle at 1px 1px, color-mix(in srgb, var(--ink) 8%, transparent) 1px, transparent 0);
  background-size: 26px 26px;
  -webkit-mask-image: radial-gradient(120% 80% at 70% 20%, #000 30%, transparent 72%);
          mask-image: radial-gradient(120% 80% at 70% 20%, #000 30%, transparent 72%);
  opacity: 0.7;
}
.hero .wrap { position: relative; z-index: 1; }

@media (max-width: 860px) {
  .hero__grid { grid-template-columns: 1fr; text-align: center; }
  .hero__badges, .cta-row { justify-content: center; }
}

/* ---------- phone mockup ---------- */
.phone {
  position: relative; width: min(300px, 78vw); margin: 0 auto;
  border-radius: 44px; padding: 12px; background: #0c1024;
  box-shadow: var(--shadow); border: 1px solid rgba(255,255,255,0.06);
}
.phone::after { /* notch */
  content: ""; position: absolute; top: 20px; left: 50%; transform: translateX(-50%);
  width: 108px; height: 26px; background: #0c1024; border-radius: 0 0 16px 16px; z-index: 2;
}
.phone img { border-radius: 33px; width: 100%; }
.phone--tilt { transform: rotate(3deg); }

.phone-stack { position: relative; height: 100%; min-height: 660px; display: grid; place-items: center; }
.phone-stack .phone { position: absolute; }
.phone-stack .p1 { transform: rotate(-6deg) translateX(-46px) scale(0.9); z-index: 1; filter: saturate(0.98); }
.phone-stack .p2 { transform: rotate(4deg) translateX(60px) translateY(30px) scale(0.9); z-index: 1; }
.phone-stack .p0 { z-index: 3; }
@media (max-width: 860px) {
  .phone-stack { min-height: 560px; }
  .phone-stack .p1 { transform: rotate(-7deg) translateX(-96px) translateY(10px) scale(0.82); }
  .phone-stack .p2 { transform: rotate(6deg) translateX(96px) translateY(40px) scale(0.82); }
}

/* ---------- cards / modes ---------- */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 20px; }
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 26px; box-shadow: var(--shadow-sm); transition: transform 0.18s ease, box-shadow 0.18s ease;
}
.card:hover { transform: translateY(-4px); box-shadow: var(--shadow); }
.card .mode-badge {
  width: 46px; height: 46px; border-radius: 13px; display: grid; place-items: center;
  font-size: 1.35rem; margin-bottom: 16px; color: #fff;
}
.card h3 { margin-bottom: 6px; }
.card p { color: var(--ink-soft); margin: 0; font-size: 0.98rem; }

.split { display: grid; grid-template-columns: 1fr 1fr; gap: 48px; align-items: center; }
.split--reverse .split__media { order: 2; }
@media (max-width: 820px) { .split, .split--reverse .split__media { grid-template-columns: 1fr; order: 0; } }

.feature-list { list-style: none; padding: 0; margin: 18px 0 0; display: grid; gap: 14px; }
.feature-list li { display: flex; gap: 12px; align-items: flex-start; }
.feature-list .tick {
  flex: none; width: 24px; height: 24px; border-radius: 8px; background: color-mix(in srgb, var(--teal) 16%, transparent);
  color: var(--teal); display: grid; place-items: center; font-weight: 800; font-size: 0.85rem; margin-top: 2px;
}

/* pull / banner */
.band { background: var(--navy); color: #fff; border-radius: var(--radius-lg); padding: clamp(34px, 6vw, 64px); position: relative; overflow: hidden; }
.band h2 { color: #fff; } .band p { color: rgba(255,255,255,0.78); }
.band::before {
  content: ""; position: absolute; right: -60px; top: -60px; width: 280px; height: 280px; border-radius: 50%;
  background: radial-gradient(circle, rgba(245,197,24,0.28), transparent 65%);
}

/* quote / promise */
.promise { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 18px; }
.promise .item { padding: 22px; border: 1px dashed var(--line); border-radius: var(--radius); background: var(--paper-2); }
.promise .item strong { display: block; font-size: 1.05rem; margin-bottom: 4px; }
.promise .item span { color: var(--ink-soft); font-size: 0.94rem; }

/* prose pages (privacy/terms) */
.prose { max-width: 760px; }
.prose h2 { margin-top: 2em; font-size: 1.5rem; }
.prose h3 { margin-top: 1.6em; }
.prose p, .prose li { color: var(--ink-soft); }
.prose ul { padding-left: 1.2em; }
.prose a { color: var(--purple); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }
.prose .updated { color: var(--ink-faint); font-size: 0.9rem; }

/* forms */
.form { display: grid; gap: 14px; max-width: 560px; }
.field label { display: block; font-weight: 600; font-size: 0.9rem; margin-bottom: 6px; }
.field input, .field textarea {
  width: 100%; font: inherit; color: var(--ink); background: var(--card);
  border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px;
}
.field input:focus, .field textarea:focus { outline: 2px solid color-mix(in srgb, var(--purple) 50%, transparent); border-color: var(--purple); }
.form-note { font-size: 0.86rem; color: var(--ink-faint); }
.form-status { padding: 12px 14px; border-radius: 12px; font-weight: 600; font-size: 0.94rem; display: none; }
.form-status.ok { display: block; background: color-mix(in srgb, var(--teal) 14%, transparent); color: var(--teal); }
.form-status.err { display: block; background: color-mix(in srgb, #d33 14%, transparent); color: #c0392b; }

/* footer */
.footer { border-top: 1px solid var(--line); background: var(--paper-2); padding: 54px 0 40px; margin-top: 40px; }
.footer__grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 30px; }
.footer h4 { font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.1em; color: var(--ink-faint); margin-bottom: 14px; }
.footer a { color: var(--ink-soft); display: block; padding: 5px 0; font-size: 0.95rem; }
.footer a:hover { color: var(--ink); }
.footer__bottom { display: flex; flex-wrap: wrap; gap: 10px; justify-content: space-between; align-items: center;
  margin-top: 40px; padding-top: 22px; border-top: 1px solid var(--line); color: var(--ink-faint); font-size: 0.88rem; }
@media (max-width: 720px) { .footer__grid { grid-template-columns: 1fr 1fr; } }

/* misc */
.pill { display:inline-block; background: color-mix(in srgb, var(--gold) 22%, transparent); color: var(--gold-deep); font-weight:700; font-size:0.78rem; padding: 5px 11px; border-radius: 999px; }
.hr { height: 1px; background: var(--line); border: 0; margin: 0; }
.stat-inline { display:flex; gap: 30px; flex-wrap: wrap; margin-top: 26px; }
.stat-inline .n { font-size: 1.7rem; font-weight: 800; }
.stat-inline .l { color: var(--ink-faint); font-size: 0.85rem; }

/* ============ dashboard ============ */
.dash { min-height: 100vh; background: var(--paper); }
.dash__top { display:flex; align-items:center; justify-content:space-between; gap:16px; padding: 18px 0; border-bottom: 1px solid var(--line); }
.dash__who { font-size: 0.9rem; color: var(--ink-faint); }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px,1fr)); gap: 16px; margin: 26px 0; }
.kpi { background: var(--card); border:1px solid var(--line); border-radius: 16px; padding: 20px; box-shadow: var(--shadow-sm); }
.kpi .k-l { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--ink-faint); }
.kpi .k-n { font-size: 2rem; font-weight: 800; margin: 6px 0 2px; }
.kpi .k-s { font-size: 0.82rem; color: var(--ink-faint); }
.kpi .k-n.muted { color: var(--ink-faint); font-weight: 700; font-size: 1.1rem; }
.panel { background: var(--card); border:1px solid var(--line); border-radius: 16px; padding: 22px; box-shadow: var(--shadow-sm); margin-bottom: 20px; }
.panel h3 { margin: 0 0 4px; }
.panel .sub { color: var(--ink-faint); font-size: 0.88rem; margin-bottom: 16px; }
.empty { text-align:center; padding: 34px 20px; color: var(--ink-faint); border: 1px dashed var(--line); border-radius: 14px; background: var(--paper-2); }
.empty .big { font-size: 1.6rem; margin-bottom: 8px; }
table.data { width: 100%; border-collapse: collapse; font-size: 0.94rem; }
table.data th { text-align: left; color: var(--ink-faint); font-weight: 600; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.05em; padding: 8px 10px; border-bottom: 1px solid var(--line); }
table.data td { padding: 11px 10px; border-bottom: 1px solid var(--line); }
table.data tr:last-child td { border-bottom: 0; }
.badge { display:inline-block; padding: 3px 9px; border-radius: 999px; font-size: 0.76rem; font-weight: 700; }
.badge.green { background: color-mix(in srgb, var(--teal) 16%, transparent); color: var(--teal); }
.badge.amber { background: color-mix(in srgb, var(--amber) 18%, transparent); color: #b8770a; }
.badge.gray { background: color-mix(in srgb, var(--ink) 10%, transparent); color: var(--ink-soft); }
.funnel { display:grid; gap: 10px; }
.funnel .step { display:flex; align-items:center; gap: 14px; }
.funnel .bar { height: 34px; border-radius: 9px; background: linear-gradient(90deg, var(--purple), var(--navy)); min-width: 6px; }
.funnel .lab { width: 160px; flex:none; font-size: 0.9rem; color: var(--ink-soft); }
.funnel .val { font-weight: 800; }
.setup { font-size: 0.9rem; color: var(--ink-soft); }
.setup code { background: var(--paper-2); border:1px solid var(--line); padding: 2px 6px; border-radius: 6px; font-size: 0.85em; }
.two-col { display:grid; grid-template-columns: 1fr 1fr; gap: 20px; }
@media (max-width: 820px){ .two-col { grid-template-columns: 1fr; } }
