/* ==========================================================================
   PromptCost — Stylesheet
   Table of contents:
   1.  Reset & base
   2.  CSS variables (theme tokens)
   3.  Typography
   4.  Layout utilities
   5.  Background decor (blobs, particles)
   6.  Navbar
   7.  Buttons
   8.  Hero
   9.  Calculator
   10. Token estimator
   11. Pricing cards
   12. Comparison chart
   13. FAQ
   14. Testimonials
   15. CTA strip / Footer / Modal
   16. Ad slots
   17. Toasts / back-to-top / loading screen
   18. Animations
   19. Responsive
   ========================================================================== */

/* ---------- 1. Reset & base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  transition: background .4s ease, color .4s ease;
  overflow-x: hidden;
}
img, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
ul { list-style: none; margin: 0; padding: 0; }
h1, h2, h3, p { margin: 0; }
input, select, textarea { font-family: inherit; }

.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}
.skip-link {
  position: absolute; left: 1rem; top: -3rem;
  background: var(--primary); color: #fff; padding: .6rem 1rem;
  border-radius: 8px; z-index: 999; transition: top .2s ease;
}
.skip-link:focus { top: 1rem; }

:focus-visible { outline: 2px solid var(--primary-light); outline-offset: 2px; }

/* Custom scrollbar */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--scrollbar-thumb); border-radius: 10px; border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: var(--primary); }
* { scrollbar-width: thin; scrollbar-color: var(--scrollbar-thumb) var(--bg); }

/* ---------- 2. Theme tokens ---------- */
:root {
  /* Brand gradient */
  --primary: #6366F1;
  --primary-light: #818CF8;
  --secondary: #A855F7;
  --accent: #22D3B6;

  /* Dark theme (default) */
  --bg: #090b16;
  --bg-alt: #0d1024;
  --surface: rgba(255,255,255,0.055);
  --surface-strong: rgba(255,255,255,0.09);
  --border: rgba(255,255,255,0.12);
  --track: rgba(255,255,255,0.08);
  --text: #f3f4f9;
  --text-muted: #9aa3c0;
  --text-dim: #6b7395;
  --shadow: 0 20px 60px -20px rgba(0,0,0,0.6);
  --scrollbar-thumb: #383e63;
  --danger: #f87171;

  /* Type */
  --font-display: 'Space Grotesk', sans-serif;
  --font-body: 'Inter', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  /* Radius / spacing */
  --radius-lg: 26px;
  --radius-md: 16px;
  --radius-sm: 10px;
  --container: 1200px;
}

[data-theme="light"] {
  --bg: #f3f5fc;
  --bg-alt: #ffffff;
  --surface: rgba(255,255,255,0.65);
  --surface-strong: rgba(255,255,255,0.85);
  --border: rgba(20,20,50,0.09);
  --track: rgba(20,20,50,0.07);
  --text: #12142b;
  --text-muted: #565d7e;
  --text-dim: #8790b3;
  --shadow: 0 20px 50px -20px rgba(60,60,120,0.25);
  --scrollbar-thumb: #c7cbe6;
}

/* ---------- 3. Typography ---------- */
.eyebrow {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--primary-light);
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 0.35rem 0.8rem;
  border-radius: 100px;
  margin-bottom: 1rem;
}
h1, h2, h3 { font-family: var(--font-display); font-weight: 600; letter-spacing: -0.02em; }
.grad-text {
  background: linear-gradient(100deg, var(--primary), var(--secondary));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* ---------- 4. Layout utilities ---------- */
.section { padding: 6.5rem 0; position: relative; }
.section-alt { background: var(--bg-alt); }
.section-inner, .nav-inner, .footer-inner { max-width: var(--container); margin: 0 auto; padding: 0 1.5rem; }
.section-head { max-width: 620px; margin-bottom: 3rem; }
.section-head h2 { font-size: clamp(1.7rem, 3.4vw, 2.4rem); margin-bottom: 0.75rem; }
.section-head p { color: var(--text-muted); font-size: 1.02rem; line-height: 1.6; }

.glass {
  background: var(--surface);
  border: 1px solid var(--border);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

/* ---------- 5. Background decor ---------- */
.bg-decor { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; }
.blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.55;
  animation: blobFloat 18s ease-in-out infinite;
}
[data-theme="light"] .blob { opacity: 0.35; }
.blob-a { width: 480px; height: 480px; top: -120px; left: -100px; background: radial-gradient(circle, var(--primary), transparent 70%); }
.blob-b { width: 520px; height: 520px; top: 30%; right: -180px; background: radial-gradient(circle, var(--secondary), transparent 70%); animation-delay: -6s; }
.blob-c { width: 400px; height: 400px; bottom: -140px; left: 30%; background: radial-gradient(circle, var(--accent), transparent 70%); animation-delay: -12s; }

@keyframes blobFloat {
  0%, 100% { transform: translate(0,0) scale(1); }
  33% { transform: translate(40px,-30px) scale(1.08); }
  66% { transform: translate(-30px,40px) scale(0.95); }
}

.particles { position: absolute; inset: 0; }
.particles span {
  position: absolute;
  width: 3px; height: 3px;
  background: var(--primary-light);
  border-radius: 50%;
  opacity: 0.5;
  animation: particleDrift linear infinite;
}
@keyframes particleDrift {
  0% { transform: translateY(0) translateX(0); opacity: 0; }
  10% { opacity: 0.6; }
  90% { opacity: 0.6; }
  100% { transform: translateY(-100vh) translateX(20px); opacity: 0; }
}

/* ---------- 6. Navbar ---------- */
.navbar {
  position: sticky; top: 0; z-index: 100;
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  background: color-mix(in srgb, var(--bg) 70%, transparent);
  border-bottom: 1px solid var(--border);
  transition: box-shadow .3s ease;
}
.navbar.scrolled { box-shadow: 0 8px 30px -12px rgba(0,0,0,0.35); }
.nav-inner { display: flex; align-items: center; justify-content: space-between; height: 72px; gap: 1.5rem; }
.brand { display: flex; align-items: center; gap: 0.6rem; }
.brand-mark { display: inline-flex; border-radius: 8px; }
.brand-name { font-family: var(--font-display); font-weight: 600; font-size: 1.2rem; }
.brand-name em { font-style: normal; background: linear-gradient(100deg, var(--primary), var(--secondary)); -webkit-background-clip: text; background-clip: text; color: transparent; }

.nav-menu { display: flex; gap: 2rem; }
.nav-menu a { color: var(--text-muted); font-size: 0.94rem; font-weight: 500; transition: color .2s ease; position: relative; }
.nav-menu a:hover { color: var(--text); }
.nav-menu a::after {
  content: ''; position: absolute; left: 0; bottom: -6px; height: 2px; width: 0;
  background: linear-gradient(90deg, var(--primary), var(--secondary)); transition: width .25s ease;
}
.nav-menu a:hover::after { width: 100%; }

.nav-actions { display: flex; align-items: center; gap: 0.8rem; }
.icon-btn {
  width: 40px; height: 40px; border-radius: 50%;
  border: 1px solid var(--border); background: var(--surface);
  color: var(--text); display: grid; place-items: center;
  transition: transform .2s ease, background .2s ease;
}
.icon-btn:hover { transform: translateY(-2px); background: var(--surface-strong); }
.icon-sun, .icon-moon { grid-area: 1/1; transition: opacity .25s ease, transform .25s ease; }
[data-theme="dark"] .icon-moon, :root:not([data-theme]) .icon-moon { opacity: 1; }
[data-theme="dark"] .icon-sun, :root:not([data-theme]) .icon-sun { opacity: 0; position: absolute; }
[data-theme="light"] .icon-sun { opacity: 1; }
[data-theme="light"] .icon-moon { opacity: 0; position: absolute; }

.nav-toggle { display: none; flex-direction: column; gap: 5px; background: none; border: none; padding: 8px; }
.nav-toggle span { width: 22px; height: 2px; background: var(--text); border-radius: 2px; transition: transform .25s ease, opacity .25s ease; }
.nav-toggle.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle.open span:nth-child(2) { opacity: 0; }
.nav-toggle.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ---------- 7. Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 0.5rem;
  font-weight: 600; font-size: 0.95rem;
  border-radius: 100px; border: 1px solid transparent;
  padding: 0.85rem 1.6rem; transition: all .22s ease;
  white-space: nowrap;
}
.btn-sm { padding: 0.55rem 1rem; font-size: 0.85rem; border-radius: 12px; }
.btn-lg { padding: 1rem 2rem; font-size: 1rem; }
.btn-primary {
  background: linear-gradient(100deg, var(--primary), var(--secondary));
  color: #fff; box-shadow: 0 12px 30px -10px rgba(99,102,241,0.55);
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 16px 36px -8px rgba(99,102,241,0.65); }
.btn-ghost { background: var(--surface); color: var(--text); border-color: var(--border); }
.btn-ghost:hover { background: var(--surface-strong); transform: translateY(-2px); }

/* ---------- 8. Hero ---------- */
.hero { position: relative; padding: 3.5rem 0 0; overflow: hidden; }
.hero-inner {
  max-width: var(--container); margin: 0 auto; padding: 3rem 1.5rem 7rem;
  display: grid; grid-template-columns: 1.05fr 0.95fr; gap: 3rem; align-items: center;
}
.hero-title { font-size: clamp(2.4rem, 5.4vw, 3.6rem); line-height: 1.08; margin-bottom: 1.25rem; }
.hero-desc { font-size: 1.08rem; line-height: 1.65; color: var(--text-muted); max-width: 520px; margin-bottom: 2rem; }
.hero-cta-row { display: flex; gap: 1rem; flex-wrap: wrap; margin-bottom: 2.5rem; }
.hero-trust { display: flex; align-items: center; gap: 1.2rem; }
.hero-trust-item { display: flex; flex-direction: column; }
.hero-trust-item strong { font-family: var(--font-display); font-size: 1.3rem; }
.hero-trust-item span { font-size: 0.78rem; color: var(--text-dim); }
.hero-trust-divider { width: 1px; height: 30px; background: var(--border); }
.hero-wave { display: block; width: 100%; height: 60px; position: relative; margin-top: -2px; }

.hero-art { position: relative; display: flex; justify-content: center; align-items: center; min-height: 380px; }
.meter-card {
  width: 100%; max-width: 340px; padding: 2rem 1.8rem 1.6rem;
  display: flex; flex-direction: column; align-items: center; text-align: center;
  position: relative; z-index: 2;
}
.meter-dial { position: relative; width: 200px; height: 120px; }
.meter-svg { width: 100%; height: 100%; }
#meterArc { animation: meterFill 3.2s ease-in-out infinite alternate; transform-origin: 100px 110px; }
@keyframes meterFill { from { stroke-dashoffset: 220; } to { stroke-dashoffset: 60; } }
.meter-needle {
  position: absolute; left: 50%; bottom: 10px; width: 3px; height: 78px;
  background: linear-gradient(var(--text), transparent);
  transform-origin: bottom center; transform: translateX(-50%) rotate(-35deg);
  animation: needleSwing 3.2s ease-in-out infinite alternate; border-radius: 4px;
}
@keyframes needleSwing { from { transform: translateX(-50%) rotate(-70deg); } to { transform: translateX(-50%) rotate(35deg); } }
.meter-center { position: absolute; left: 50%; bottom: 6px; width: 14px; height: 14px; background: var(--text); border-radius: 50%; transform: translateX(-50%); }
.meter-label { color: var(--text-dim); font-size: 0.8rem; margin-top: 0.6rem; }
.meter-value { font-family: var(--font-mono); font-size: 1.9rem; font-weight: 700; margin-top: 0.15rem; }
.meter-value span { font-size: 0.85rem; color: var(--text-dim); font-weight: 500; }
.meter-ticks { display: flex; gap: 6px; margin-top: 1rem; }
.meter-ticks span { width: 22px; height: 4px; border-radius: 4px; background: var(--track); }
.meter-ticks span:nth-child(-n+3) { background: linear-gradient(90deg, var(--primary), var(--secondary)); }

.float-chip {
  position: absolute; font-family: var(--font-mono); font-size: 0.75rem;
  background: var(--surface-strong); border: 1px solid var(--border);
  padding: 0.5rem 0.85rem; border-radius: 100px; backdrop-filter: blur(12px);
  box-shadow: var(--shadow); animation: chipFloat 6s ease-in-out infinite;
}
.float-chip em { font-style: normal; color: var(--primary-light); margin-left: 0.35rem; }
.chip-1 { top: 5%; left: -4%; animation-delay: 0s; }
.chip-2 { bottom: 20%; right: -8%; animation-delay: -2s; }
.chip-3 { bottom: -4%; left: 10%; animation-delay: -4s; }
@keyframes chipFloat { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-12px); } }

/* ---------- 9. Calculator ---------- */
.calc-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.75rem; align-items: start; }
.calc-card { padding: 2rem; }
.field { display: flex; flex-direction: column; gap: 0.45rem; margin-bottom: 1.25rem; }
.field label { font-size: 0.85rem; font-weight: 600; color: var(--text-muted); }
.field label .hint { font-weight: 400; color: var(--text-dim); }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
input[type="number"], select, textarea {
  background: var(--track); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 0.8rem 1rem; color: var(--text); font-size: 0.98rem; font-family: var(--font-mono);
  transition: border-color .2s ease, box-shadow .2s ease; width: 100%;
}
input[type="number"]:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--primary-light); box-shadow: 0 0 0 3px rgba(99,102,241,0.18);
}
.select-wrap select { appearance: none; cursor: pointer; background-image: linear-gradient(45deg, transparent 50%, var(--text-muted) 50%), linear-gradient(135deg, var(--text-muted) 50%, transparent 50%); background-position: calc(100% - 20px) center, calc(100% - 15px) center; background-size: 5px 5px, 5px 5px; background-repeat: no-repeat; padding-right: 2.5rem; }
.field-actions { display: flex; align-items: center; justify-content: space-between; margin-top: 0.5rem; }
.autosave-note { font-size: 0.75rem; color: var(--text-dim); }

.results-card { padding: 2rem; display: flex; flex-direction: column; gap: 1.25rem; }
.result-tile {
  background: var(--track); border: 1px solid var(--border); border-radius: var(--radius-md);
  padding: 1.1rem 1.3rem; display: flex; flex-direction: column; gap: 0.35rem;
}
.result-tile-main { background: linear-gradient(120deg, rgba(99,102,241,0.18), rgba(168,85,247,0.14)); border-color: rgba(129,140,248,0.35); }
.result-label { font-size: 0.78rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; }
.result-value { font-family: var(--font-mono); font-size: 1.7rem; font-weight: 700; }
.result-tile-main .result-value { font-size: 2.1rem; background: linear-gradient(100deg, var(--primary-light), var(--secondary)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.result-tile-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.9rem; }
.result-tile-grid .result-value { font-size: 1.3rem; }
.result-actions { display: flex; flex-wrap: wrap; gap: 0.6rem; margin-top: 0.25rem; }

/* ---------- 10. Token estimator ---------- */
.estimator-card { padding: 2rem; max-width: 900px; margin: 0 auto; }
.estimator-card textarea { resize: vertical; min-height: 160px; line-height: 1.6; }
.estimator-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; margin-top: 1.25rem; }
.stat { background: var(--track); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 1rem; text-align: center; }
.stat-value { display: block; font-family: var(--font-mono); font-size: 1.6rem; font-weight: 700; }
.stat-label { font-size: 0.78rem; color: var(--text-muted); }
.stat-primary { background: linear-gradient(120deg, rgba(99,102,241,0.18), rgba(168,85,247,0.14)); border-color: rgba(129,140,248,0.35); }
.stat-primary .stat-value { background: linear-gradient(100deg, var(--primary-light), var(--secondary)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.estimator-footer { margin-top: 1.25rem; display: flex; justify-content: flex-end; }

/* ---------- 11. Pricing cards ---------- */
.pricing-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 1.25rem; }
.price-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md);
  padding: 1.5rem; transition: transform .25s ease, box-shadow .25s ease, border-color .25s ease;
  position: relative; overflow: hidden;
}
.price-card::before {
  content: ''; position: absolute; inset: 0; opacity: 0; transition: opacity .25s ease;
  background: linear-gradient(135deg, rgba(99,102,241,0.12), rgba(168,85,247,0.10));
}
.price-card:hover { transform: translateY(-6px); box-shadow: var(--shadow); border-color: rgba(129,140,248,0.4); }
.price-card:hover::before { opacity: 1; }
.price-card > * { position: relative; z-index: 1; }
.price-card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1rem; }
.price-card-head h3 { font-size: 1.1rem; }
.price-tag { font-size: 0.68rem; font-weight: 700; text-transform: uppercase; padding: 0.25rem 0.55rem; border-radius: 100px; letter-spacing: 0.04em; }
.tag-flagship { background: rgba(168,85,247,0.18); color: #d3a9ff; }
.tag-value { background: rgba(34,211,182,0.18); color: #6be3cd; }
.tag-fast { background: rgba(99,102,241,0.18); color: #b0b4ff; }
.price-rows { display: flex; flex-direction: column; gap: 0.6rem; margin-bottom: 1rem; }
.price-row { display: flex; justify-content: space-between; font-size: 0.9rem; color: var(--text-muted); }
.price-row strong { font-family: var(--font-mono); color: var(--text); }
.price-card-foot { font-size: 0.78rem; color: var(--text-dim); border-top: 1px solid var(--border); padding-top: 0.8rem; }

/* ---------- 12. Comparison chart ---------- */
.compare-card { padding: 2rem; }
.compare-chart { display: flex; flex-direction: column; gap: 0.9rem; }
.compare-row { display: grid; grid-template-columns: 130px 1fr 90px; align-items: center; gap: 0.9rem; }
.compare-row .name { font-size: 0.88rem; font-weight: 600; }
.compare-row .bar-track { height: 14px; background: var(--track); border-radius: 100px; overflow: hidden; }
.compare-row .bar-fill { height: 100%; border-radius: 100px; background: linear-gradient(90deg, var(--primary), var(--secondary)); width: 0%; transition: width 1s cubic-bezier(.2,.8,.2,1); }
.compare-row.is-current .bar-fill { background: linear-gradient(90deg, var(--accent), #5eead4); }
.compare-row.is-current .name { color: var(--accent); }
.compare-row .val { font-family: var(--font-mono); font-size: 0.85rem; text-align: right; color: var(--text-muted); }

/* ---------- 13. FAQ ---------- */
.faq-list { display: flex; flex-direction: column; gap: 0.85rem; max-width: 820px; }
.faq-item { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md); overflow: hidden; }
.faq-question {
  width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  background: none; border: none; color: var(--text); text-align: left;
  padding: 1.1rem 1.4rem; font-size: 1rem; font-weight: 600;
}
.faq-question .plus { flex-shrink: 0; width: 24px; height: 24px; border-radius: 50%; background: var(--track); display: grid; place-items: center; transition: transform .3s ease, background .3s ease; }
.faq-item.open .faq-question .plus { transform: rotate(135deg); background: linear-gradient(120deg, var(--primary), var(--secondary)); }
.faq-answer { max-height: 0; overflow: hidden; transition: max-height .35s ease; }
.faq-answer p { padding: 0 1.4rem 1.2rem; color: var(--text-muted); line-height: 1.65; font-size: 0.95rem; }

/* ---------- 14. Testimonials ---------- */
.testimonial-track-wrap { overflow: hidden; }
.testimonial-track { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.25rem; }
.testimonial-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 1.6rem; display: flex; flex-direction: column; gap: 1rem; }
.testimonial-stars { color: #fbbf24; font-size: 0.9rem; letter-spacing: 2px; }
.testimonial-quote { font-size: 0.95rem; line-height: 1.65; color: var(--text-muted); }
.testimonial-person { display: flex; align-items: center; gap: 0.7rem; margin-top: auto; }
.avatar { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; font-family: var(--font-display); font-weight: 700; color: #fff; font-size: 0.85rem; }
.testimonial-person strong { display: block; font-size: 0.88rem; }
.testimonial-person span { font-size: 0.76rem; color: var(--text-dim); }

/* ---------- 15. CTA / Footer / Modal ---------- */
.cta-strip { padding: 0 1.5rem 6rem; max-width: var(--container); margin: 0 auto; }
.cta-strip-inner { padding: 3.2rem 2rem; text-align: center; background: linear-gradient(120deg, rgba(99,102,241,0.16), rgba(168,85,247,0.14)); }
.cta-strip-inner h2 { font-size: clamp(1.5rem, 3vw, 2.1rem); margin-bottom: 0.6rem; }
.cta-strip-inner p { color: var(--text-muted); margin-bottom: 1.6rem; }

.footer { border-top: 1px solid var(--border); padding-top: 3.5rem; background: var(--bg-alt); }
.footer-inner { display: grid; grid-template-columns: 1.3fr 1fr; gap: 3rem; padding-bottom: 2.5rem; }
.footer-brand p { color: var(--text-muted); margin-top: 0.75rem; max-width: 340px; line-height: 1.6; font-size: 0.92rem; }
.footer-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 2rem; }
.footer-col h3 { font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-dim); margin-bottom: 1rem; }
.footer-col ul { display: flex; flex-direction: column; gap: 0.7rem; }
.footer-col a { color: var(--text-muted); font-size: 0.92rem; transition: color .2s ease; }
.footer-col a:hover { color: var(--primary-light); }
.footer-bottom { border-top: 1px solid var(--border); text-align: center; padding: 1.5rem; }
.footer-bottom p { color: var(--text-dim); font-size: 0.82rem; }

.modal-overlay {
  position: fixed; inset: 0; background: rgba(4,6,16,0.6); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center; z-index: 200;
  opacity: 0; pointer-events: none; transition: opacity .25s ease; padding: 1.5rem;
}
.modal-overlay.active { opacity: 1; pointer-events: auto; }
.modal { max-width: 520px; width: 100%; padding: 2rem; position: relative; max-height: 80vh; overflow-y: auto; }
.modal h3 { margin-bottom: 1rem; }
.modal p { color: var(--text-muted); line-height: 1.7; margin-bottom: 0.9rem; font-size: 0.95rem; }
.modal-close { position: absolute; top: 1rem; right: 1rem; background: var(--track); border: none; width: 32px; height: 32px; border-radius: 50%; color: var(--text); }

/* ---------- 16. Ad slots ---------- */
.ad-slot { max-width: var(--container); margin: 2.5rem auto; padding: 0 1.5rem; display: flex; flex-direction: column; align-items: center; gap: 0.4rem; }
.ad-label { font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-dim); }
.ad-placeholder {
  width: 100%; display: flex; align-items: center; justify-content: center;
  background: var(--track); border: 1px dashed var(--border); border-radius: var(--radius-sm);
  color: var(--text-dim); font-size: 0.85rem; min-height: 90px;
}
.ad-top .ad-placeholder, .ad-footer .ad-placeholder { max-width: 728px; }
.ad-middle .ad-placeholder { max-width: 336px; min-height: 200px; margin: 0 auto; }
.ad-sidebar { max-width: 300px; }
.ad-sidebar .ad-placeholder { min-height: 400px; }

/* ---------- 17. Toasts / back-to-top / loading ---------- */
.toast-container { position: fixed; bottom: 1.5rem; right: 1.5rem; display: flex; flex-direction: column; gap: 0.6rem; z-index: 300; }
.toast {
  background: var(--surface-strong); border: 1px solid var(--border); backdrop-filter: blur(14px);
  padding: 0.85rem 1.2rem; border-radius: var(--radius-sm); box-shadow: var(--shadow);
  font-size: 0.88rem; display: flex; align-items: center; gap: 0.6rem;
  animation: toastIn .3s ease forwards;
  color: var(--text);
}
.toast.hide { animation: toastOut .3s ease forwards; }
@keyframes toastIn { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: translateY(0); } }
@keyframes toastOut { to { opacity: 0; transform: translateY(16px); } }
.toast-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); flex-shrink: 0; }

.back-to-top {
  position: fixed; bottom: 1.5rem; left: 1.5rem; width: 46px; height: 46px; border-radius: 50%;
  background: var(--surface-strong); border: 1px solid var(--border); color: var(--text);
  display: grid; place-items: center; box-shadow: var(--shadow); z-index: 300;
  opacity: 0; pointer-events: none; transform: translateY(10px); transition: all .3s ease;
}
.back-to-top.visible { opacity: 1; pointer-events: auto; transform: translateY(0); }
.back-to-top:hover { background: var(--primary); border-color: var(--primary); }

.kbd-hint {
  position: fixed; bottom: 1.5rem; left: 50%; transform: translateX(-50%);
  font-size: 0.75rem; color: var(--text-dim); background: var(--surface);
  border: 1px solid var(--border); padding: 0.4rem 0.8rem; border-radius: 100px;
  display: flex; align-items: center; gap: 0.4rem; z-index: 250; backdrop-filter: blur(10px);
}
.kbd-hint kbd { background: var(--track); border: 1px solid var(--border); border-radius: 4px; padding: 0.1rem 0.4rem; font-family: var(--font-mono); }

#loading-screen {
  position: fixed; inset: 0; background: var(--bg); z-index: 999;
  display: flex; align-items: center; justify-content: center;
  transition: opacity .5s ease, visibility .5s ease;
}
#loading-screen.loaded { opacity: 0; visibility: hidden; }
.loader-mark { position: relative; width: 64px; height: 64px; display: grid; place-items: center; }
.loader-ring { position: absolute; inset: 0; border: 3px solid var(--track); border-top-color: var(--primary); border-radius: 50%; animation: spin 0.9s linear infinite; }
.loader-dollar { font-family: var(--font-display); font-weight: 700; font-size: 1.4rem; background: linear-gradient(100deg, var(--primary), var(--secondary)); -webkit-background-clip: text; background-clip: text; color: transparent; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- 18. Scroll animations ---------- */
[data-animate] { opacity: 0; transition: opacity .7s ease, transform .7s ease; }
[data-animate="fade-up"] { transform: translateY(28px); }
[data-animate="fade-in"] { transform: scale(0.96); }
[data-animate].in-view { opacity: 1; transform: translateY(0) scale(1); }
[data-animate="stagger"].in-view > * { animation: staggerIn .6s ease forwards; }
[data-animate="stagger"].in-view > *:nth-child(1) { animation-delay: 0s; }
[data-animate="stagger"].in-view > *:nth-child(2) { animation-delay: .07s; }
[data-animate="stagger"].in-view > *:nth-child(3) { animation-delay: .14s; }
[data-animate="stagger"].in-view > *:nth-child(4) { animation-delay: .21s; }
[data-animate="stagger"].in-view > *:nth-child(5) { animation-delay: .28s; }
[data-animate="stagger"].in-view > *:nth-child(6) { animation-delay: .35s; }
[data-animate="stagger"].in-view > *:nth-child(7) { animation-delay: .42s; }
[data-animate="stagger"].in-view > *:nth-child(8) { animation-delay: .49s; }
[data-animate="stagger"].in-view > *:nth-child(9) { animation-delay: .56s; }
[data-animate="stagger"].in-view > *:nth-child(10) { animation-delay: .63s; }
[data-animate="stagger"] > * { opacity: 0; transform: translateY(20px); }
@keyframes staggerIn { to { opacity: 1; transform: translateY(0); } }

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

/* ---------- 19. Responsive ---------- */
@media (max-width: 1080px) {
  .hero-inner { grid-template-columns: 1fr; }
  .hero-art { order: -1; min-height: 320px; }
  .ad-sidebar { max-width: var(--container); }
  .ad-sidebar .ad-placeholder { min-height: 120px; }
}

@media (max-width: 860px) {
  .nav-menu { position: fixed; top: 72px; left: 0; right: 0; flex-direction: column; background: var(--bg); border-bottom: 1px solid var(--border); padding: 1.2rem 1.5rem; gap: 1rem; transform: translateY(-130%); transition: transform .3s ease; }
  .nav-menu.open { transform: translateY(0); }
  .nav-toggle { display: flex; }
  .calc-grid { grid-template-columns: 1fr; }
  .testimonial-track { grid-template-columns: 1fr; }
  .footer-inner { grid-template-columns: 1fr; }
  .footer-cols { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 560px) {
  .section { padding: 4rem 0; }
  .field-row { grid-template-columns: 1fr; }
  .result-tile-grid { grid-template-columns: 1fr; }
  .estimator-stats { grid-template-columns: 1fr; }
  .hero-trust { flex-wrap: wrap; row-gap: 0.6rem; }
  .compare-row { grid-template-columns: 90px 1fr 70px; gap: 0.5rem; }
  .footer-cols { grid-template-columns: 1fr; }
}

/* Print styles for result card */
@media print {
  .navbar, .bg-decor, .ad-slot, .back-to-top, .kbd-hint, .toast-container, footer, .hero, .section:not(#calculator), .cta-strip { display: none !important; }
  body { background: #fff; color: #000; }
}
