/* =============================================================
   1. Tokens
   ============================================================= */
:root {
  --bg: #faf9fc;
  --surface: #ffffff;
  --surface-2: #f3f2f9;
  --text: #16161f;
  --text-muted: #5c5c6b;
  --border: #e6e4ef;
  --accent: #5b4cf5;
  --accent-dark: #4033d6;
  --accent-soft: #edebff;
  --success: #16a34a;
  --success-soft: #e8f7ee;
  --warning: #b45309;
  --warning-soft: #fef3e0;
  --danger: #dc2626;
  --cream: #ffffff;

  --radius-lg: 20px;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow-sm: 0 2px 10px -4px rgba(20, 18, 45, 0.12);
  --shadow: 0 16px 40px -16px rgba(20, 18, 45, 0.22);

  --display: "Plus Jakarta Sans", "Inter", sans-serif;
  --sans: "Inter", sans-serif;
  --mono: "JetBrains Mono", monospace;

  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-soft: cubic-bezier(0.25, 0.46, 0.45, 0.94);

  --header-h: 72px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f0f16;
    --surface: #17171f;
    --surface-2: #1e1e29;
    --text: #f1f0f7;
    --text-muted: #a3a1b5;
    --border: #2a2a37;
    --accent: #8a7dff;
    --accent-dark: #a79dff;
    --accent-soft: #241f4a;
    --success-soft: #123423;
    --warning-soft: #3a2a10;
    --shadow: 0 16px 40px -16px rgba(0, 0, 0, 0.55);
    color-scheme: dark;
  }
}

/* =============================================================
   2. Reset & base
   ============================================================= */
*, *::before, *::after { box-sizing: border-box; margin: 0; }
html { -webkit-text-size-adjust: 100%; tab-size: 2; scroll-behavior: smooth; overflow-x: clip; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: clip;
  overscroll-behavior-y: none;
}
img, svg, video { display: block; max-width: 100%; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
a { color: inherit; text-decoration: none; }
p { text-wrap: pretty; }
ul, ol { list-style: none; padding: 0; }
h1, h2, h3, h4 {
  font-family: var(--display);
  text-wrap: balance;
  line-height: 1.12;
  letter-spacing: -0.02em;
  font-weight: 700;
}
table { border-collapse: collapse; width: 100%; }
::selection { background: var(--accent); color: #fff; }

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

/* Several components below set an explicit `display` on their own class
   (flex/inline-flex for layout). Without this, that class rule would beat
   the UA `[hidden]{display:none}` default whenever JS toggles the `hidden`
   attribute, leaving the element visible. This wins on specificity always. */
[hidden] { display: none !important; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

/* =============================================================
   3. Utilities
   ============================================================= */
.container { width: 100%; max-width: 1180px; margin-inline: auto; padding-inline: 1.25rem; }
.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: fixed; top: -100px; left: 1rem;
  padding: .6rem 1rem; background: var(--text); color: var(--bg);
  z-index: 9999; border-radius: 8px; font-weight: 600;
  transition: top .2s var(--ease-out);
}
.skip-link:focus { top: 1rem; }
.center { text-align: center; }
.eyebrow {
  display: inline-block; font-family: var(--display); font-weight: 700; font-size: .8rem;
  letter-spacing: .06em; text-transform: uppercase; color: var(--accent); margin-bottom: .5rem;
}
.eyebrow.center { display: block; }
.section { padding-block: clamp(3rem, 7vw, 5.5rem); }
.section-title { font-size: clamp(1.6rem, 3.4vw, 2.4rem); max-width: 46ch; margin-inline: auto .5em; margin-bottom: 2.5rem; }
.section-title.center { margin-bottom: 3rem; }

/* =============================================================
   4. Buttons & form components
   ============================================================= */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  padding: .7rem 1.3rem; border-radius: 999px; font-weight: 600; font-size: .95rem;
  transition: transform .2s var(--ease-out), background .2s var(--ease-out), box-shadow .2s var(--ease-out), color .2s var(--ease-out);
  white-space: nowrap;
}
.btn-primary { background: var(--accent); color: #fff; box-shadow: 0 8px 20px -8px rgba(91, 76, 245, .55); }
.btn-primary:hover { background: var(--accent-dark); transform: translateY(-1px); }
.btn-secondary { background: var(--surface); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { border-color: var(--accent); color: var(--accent); }
.btn-ghost { background: transparent; color: var(--text-muted); }
.btn-ghost:hover { color: var(--text); }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none; }

input[type="text"], input[type="email"], textarea, select {
  font: inherit;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: .65rem .8rem;
  width: 100%;
  transition: border-color .2s var(--ease-out), box-shadow .2s var(--ease-out);
}
input:focus, textarea:focus, select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
  outline: none;
}
textarea { resize: vertical; font-family: var(--mono); font-size: .88rem; line-height: 1.55; }

.chip {
  display: inline-flex; align-items: center; gap: .3rem;
  padding: .25rem .65rem; border-radius: 999px; font-size: .78rem; font-weight: 700;
  background: var(--accent-soft); color: var(--accent-dark);
}
.chip-urgent { background: var(--warning-soft); color: var(--warning); }

/* =============================================================
   5. Header / nav
   ============================================================= */
.site-header {
  position: sticky; top: 0; z-index: 40;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
@supports not (backdrop-filter: blur(1px)) {
  .site-header { background: var(--bg); }
}
.header-row { display: flex; align-items: center; gap: 1.5rem; height: var(--header-h); }
.brand { display: inline-flex; align-items: center; gap: .55rem; font-family: var(--display); font-weight: 800; font-size: 1.05rem; }
.main-nav { display: none; align-items: center; gap: 1.75rem; margin-inline: auto; font-weight: 600; font-size: .92rem; color: var(--text-muted); }
.main-nav a:hover { color: var(--accent); }
.header-actions { display: none; align-items: center; gap: .6rem; }
.nav-toggle {
  margin-left: auto; width: 40px; height: 40px; display: grid; place-items: center;
  gap: 4px; border-radius: 8px;
}
.nav-toggle span { display: block; width: 20px; height: 2px; background: var(--text); border-radius: 2px; }
.mobile-nav { display: flex; flex-direction: column; gap: .25rem; padding: .5rem 1.25rem 1.25rem; border-top: 1px solid var(--border); }
.mobile-nav a { padding: .7rem 0; font-weight: 600; border-bottom: 1px solid var(--border); }
.mobile-nav .btn { margin-top: .75rem; }

@media (min-width: 960px) {
  .main-nav { display: flex; }
  .header-actions { display: flex; }
  .nav-toggle { display: none; }
  .mobile-nav { display: none !important; }
}

/* =============================================================
   6. Hero
   ============================================================= */
.hero { padding-top: clamp(2.5rem, 6vw, 4rem); padding-bottom: clamp(2rem, 5vw, 3rem); }
.hero-inner { text-align: center; max-width: 780px; margin-inline: auto; }
.hero-copy h1 { font-size: clamp(2.1rem, 5.2vw, 3.4rem); margin-bottom: .9rem; }
.hero-sub { color: var(--text-muted); font-size: clamp(1rem, 1.6vw, 1.15rem); max-width: 62ch; margin-inline: auto 1.25rem; }
.hero-bullets { display: flex; flex-wrap: wrap; justify-content: center; gap: .5rem 1.5rem; margin-top: 1.25rem; font-weight: 600; font-size: .9rem; color: var(--text-muted); }
.hero-bullets li { display: flex; align-items: center; gap: .4rem; }
.hero-bullets li::before { content: "✓"; color: var(--success); font-weight: 800; }

/* =============================================================
   7. Tool card (demo)
   ============================================================= */
.tool-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: clamp(1.25rem, 3vw, 2.25rem);
  margin-top: clamp(1.75rem, 4vw, 2.5rem);
  scroll-margin-top: calc(var(--header-h) + 12px);
}
.tool-card-head { text-align: center; margin-bottom: 1.25rem; }
.tool-card-head h2 { font-size: clamp(1.25rem, 2.6vw, 1.6rem); margin-bottom: .35rem; }
.tool-card-head p { color: var(--text-muted); }

.demo-examples { display: flex; flex-wrap: wrap; gap: .5rem; justify-content: center; margin-bottom: 1.5rem; }
.demo-example-chip {
  border: 1px solid var(--border); background: var(--surface-2); color: var(--text);
  padding: .45rem .85rem; border-radius: 999px; font-size: .85rem; font-weight: 600;
  transition: border-color .2s var(--ease-out), color .2s var(--ease-out);
}
.demo-example-chip:hover { border-color: var(--accent); color: var(--accent); }

.demo-grid { display: grid; gap: 1.5rem; grid-template-columns: 1fr; }
@media (min-width: 960px) { .demo-grid { grid-template-columns: 1fr 1fr; align-items: start; } }

.demo-label { display: block; font-weight: 700; font-size: .88rem; margin-bottom: .4rem; }
.demo-textarea { min-height: 170px; }

.kb-editor { margin-top: .9rem; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2); }
.kb-editor summary { cursor: pointer; padding: .7rem .9rem; font-weight: 600; font-size: .85rem; }
.kb-fields { display: grid; gap: .7rem; padding: 0 .9rem .9rem; grid-template-columns: 1fr; }
@media (min-width: 560px) { .kb-fields { grid-template-columns: 1fr 1fr; } }
.kb-fields label { font-size: .78rem; font-weight: 600; color: var(--text-muted); display: flex; flex-direction: column; gap: .3rem; }

.demo-controls { display: flex; gap: .8rem; margin-top: .9rem; flex-wrap: wrap; }
.demo-select-label { flex: 1 1 160px; font-size: .78rem; font-weight: 600; color: var(--text-muted); display: flex; flex-direction: column; gap: .3rem; }

.btn-generate { width: 100%; margin-top: 1rem; padding-block: .85rem; font-size: 1rem; position: relative; }
.btn-generate-spinner {
  display: none; width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid rgba(255,255,255,.4); border-top-color: #fff;
  animation: spin .7s linear infinite;
}
[data-state="loading"] .btn-generate-spinner { display: inline-block; }
[data-state="loading"] .btn-generate-label::after { content: "…"; }
@keyframes spin { to { transform: rotate(360deg); } }
.demo-noscript-note { font-size: .8rem; color: var(--text-muted); margin-top: .5rem; }

.demo-output-head { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; margin-bottom: .5rem; }
.demo-output-label { font-weight: 700; font-size: .88rem; }
.demo-output {
  min-height: 220px; background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 1rem; font-family: var(--mono); font-size: .87rem;
  white-space: pre-wrap; line-height: 1.6;
}
.demo-output[contenteditable="true"] { outline: 2px solid var(--accent); background: var(--surface); }
.demo-placeholder { color: var(--text-muted); font-family: var(--sans); }
.demo-result-actions { display: flex; gap: .5rem; flex-wrap: wrap; margin-top: .8rem; }
.demo-approved-msg { margin-top: .6rem; font-size: .85rem; color: var(--success); font-weight: 600; }

.demo-footer { display: flex; flex-wrap: wrap; gap: .75rem 1.5rem; align-items: center; justify-content: space-between; margin-top: 1.5rem; padding-top: 1.25rem; border-top: 1px solid var(--border); }
.privacy-badge { font-size: .82rem; color: var(--text-muted); max-width: 52ch; }
.demo-stats { font-size: .85rem; color: var(--text-muted); }
.demo-stats strong { color: var(--accent); font-size: 1.05rem; }

.demo-history { margin-top: 1.5rem; padding-top: 1.25rem; border-top: 1px solid var(--border); }
.demo-history h3 { font-size: .9rem; margin-bottom: .6rem; }
.demo-history ul { display: flex; flex-direction: column; gap: .4rem; }
.demo-history li { font-size: .82rem; color: var(--text-muted); display: flex; gap: .5rem; align-items: baseline; }
.demo-history li .chip { flex-shrink: 0; }

/* =============================================================
   8. Ad slots
   ============================================================= */
.ad-slot {
  display: flex; align-items: center; justify-content: center;
  border: 1.5px dashed var(--border); border-radius: var(--radius-sm);
  color: var(--text-muted); font-weight: 700; letter-spacing: .08em; font-size: .8rem;
  background: var(--surface-2);
}
.ad-slot-leaderboard { min-height: 90px; margin-block: 1.5rem; }
.ad-slot-incontent { min-height: 250px; margin-block: 1rem; max-width: 728px; margin-inline: auto; }
.ad-slot-popup { min-height: 240px; width: min(90vw, 380px); }
.ad-slot-corner { min-height: 90px; width: 260px; }

/* =============================================================
   9. Steps
   ============================================================= */
.steps-grid { display: grid; gap: 1.25rem; grid-template-columns: 1fr; counter-reset: step; }
@media (min-width: 760px) { .steps-grid { grid-template-columns: repeat(3, 1fr); } }
.step-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.5rem; }
.step-num {
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; border-radius: 50%; background: var(--accent-soft); color: var(--accent-dark);
  font-family: var(--display); font-weight: 800; margin-bottom: .9rem;
}
.step-card h3 { font-size: 1.1rem; margin-bottom: .5rem; }
.step-card p { color: var(--text-muted); font-size: .93rem; }

/* =============================================================
   10. Features grid + stats mock
   ============================================================= */
.features-grid { display: grid; gap: 1rem; grid-template-columns: 1fr; }
@media (min-width: 620px) { .features-grid { grid-template-columns: 1fr 1fr; } }
@media (min-width: 960px) { .features-grid { grid-template-columns: repeat(3, 1fr); } }
.feature-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.4rem; transition: transform .2s var(--ease-out), box-shadow .2s var(--ease-out); }
.feature-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-sm); }
.feature-card svg { color: var(--accent); margin-bottom: .8rem; }
.feature-card h3 { font-size: 1.02rem; margin-bottom: .4rem; }
.feature-card p { color: var(--text-muted); font-size: .9rem; }

.stats-mock { margin-top: 3rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: clamp(1.25rem, 3vw, 2rem); }
.stats-mock-label { font-weight: 700; font-size: .85rem; color: var(--text-muted); margin-bottom: 1rem; text-align: center; }
.stats-mock-grid { display: grid; gap: 1rem; grid-template-columns: 1fr; text-align: center; }
@media (min-width: 720px) { .stats-mock-grid { grid-template-columns: repeat(3, 1fr); } }
.stats-mock-card { background: var(--surface-2); border-radius: var(--radius-sm); padding: 1.25rem; display: flex; flex-direction: column; gap: .3rem; }
.stats-mock-num { font-family: var(--display); font-size: 1.8rem; font-weight: 800; color: var(--accent); }
.stats-mock-card span:last-child { color: var(--text-muted); font-size: .85rem; }

/* =============================================================
   11. Use cases
   ============================================================= */
.usecases-grid { display: grid; gap: 1rem; grid-template-columns: 1fr; }
@media (min-width: 620px) { .usecases-grid { grid-template-columns: 1fr 1fr; } }
@media (min-width: 960px) { .usecases-grid { grid-template-columns: repeat(4, 1fr); } }
.usecase-card { background: var(--surface-2); border-radius: var(--radius); padding: 1.3rem; border: 1px solid var(--border); }
.usecase-card h3 { font-size: 1rem; margin-bottom: .4rem; color: var(--accent-dark); }
.usecase-card p { font-size: .88rem; color: var(--text-muted); }

/* =============================================================
   12. Comparison table
   ============================================================= */
.comparison-table-wrap { overflow-x: auto; border-radius: var(--radius); border: 1px solid var(--border); }
.comparison-table { min-width: 620px; background: var(--surface); }
.comparison-table th, .comparison-table td { padding: .9rem 1.1rem; text-align: left; font-size: .92rem; border-bottom: 1px solid var(--border); }
.comparison-table thead th { font-family: var(--display); font-size: .82rem; text-transform: uppercase; letter-spacing: .04em; color: var(--text-muted); background: var(--surface-2); }
.comparison-table thead th:nth-child(3) { color: var(--accent-dark); }
.comparison-table tbody th { font-weight: 700; }
.comparison-table tbody td:nth-child(2) { color: var(--text-muted); }
.comparison-table tbody td:nth-child(3) { color: var(--success); font-weight: 600; }
.comparison-table tbody tr:last-child th, .comparison-table tbody tr:last-child td { border-bottom: none; }

/* =============================================================
   13. Testimonials
   ============================================================= */
.testimonials-grid { display: grid; gap: 1.1rem; grid-template-columns: 1fr; }
@media (min-width: 640px) { .testimonials-grid { grid-template-columns: 1fr 1fr; } }
.testimonial-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.4rem; display: flex; flex-direction: column; gap: 1rem; }
.testimonial-card blockquote { font-size: .95rem; color: var(--text); }
.testimonial-card figcaption { display: flex; align-items: center; gap: .7rem; font-size: .85rem; color: var(--text-muted); }
.avatar { width: 38px; height: 38px; border-radius: 50%; background: var(--accent-soft); color: var(--accent-dark); display: grid; place-items: center; font-weight: 800; font-size: .8rem; flex-shrink: 0; }
.testimonials-disclaimer { text-align: center; margin-top: 1.5rem; font-size: .78rem; color: var(--text-muted); }

/* =============================================================
   14. CTA section
   ============================================================= */
.cta-section { background: linear-gradient(135deg, var(--accent), var(--accent-dark)); border-radius: var(--radius-lg); margin-inline: 1.25rem; max-width: 1180px; margin-inline: auto; padding-block: clamp(2.5rem, 6vw, 4rem); }
.cta-inner { text-align: center; color: #fff; max-width: 640px; }
.cta-inner h2 { color: #fff; font-size: clamp(1.5rem, 3vw, 2.1rem); margin-bottom: .6rem; }
.cta-inner p { color: rgba(255,255,255,.85); margin-bottom: 1.5rem; }
.cta-buttons { display: flex; gap: .75rem; justify-content: center; flex-wrap: wrap; }
.cta-section .btn-secondary { background: rgba(255,255,255,.12); color: #fff; border-color: rgba(255,255,255,.35); }
.cta-section .btn-secondary:hover { background: rgba(255,255,255,.2); border-color: #fff; }
.cta-section .btn-primary { background: #fff; color: var(--accent-dark); box-shadow: none; }
.cta-section .btn-primary:hover { background: #fff; opacity: .92; transform: translateY(-1px); }

/* =============================================================
   15. FAQ
   ============================================================= */
.faq-list { display: flex; flex-direction: column; gap: .6rem; max-width: 760px; margin-inline: auto; }
.faq-item { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 1rem 1.2rem; }
.faq-item summary { cursor: pointer; font-weight: 700; font-size: .98rem; list-style: none; display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after { content: "+"; font-size: 1.3rem; color: var(--accent); flex-shrink: 0; transition: transform .2s var(--ease-out); }
.faq-item[open] summary::after { transform: rotate(45deg); }
.faq-item p { margin-top: .7rem; color: var(--text-muted); font-size: .92rem; }

/* =============================================================
   16. Footer
   ============================================================= */
.site-footer { border-top: 1px solid var(--border); padding-block: 2.5rem 1.5rem; margin-top: 2rem; }
.footer-inner { display: flex; flex-wrap: wrap; gap: 2rem; justify-content: space-between; }
.footer-brand { max-width: 420px; }
.footer-brand .brand { margin-bottom: .6rem; }
.footer-brand p { color: var(--text-muted); font-size: .88rem; }
.footer-links { display: flex; gap: 1.25rem; font-size: .88rem; color: var(--text-muted); flex-wrap: wrap; }
.footer-links a:hover { color: var(--accent); }
.footer-copy { text-align: center; color: var(--text-muted); font-size: .78rem; margin-top: 2rem; }

/* =============================================================
   17. Dialogs: ad popup, corner ad, signup modal
   ============================================================= */
dialog { border: none; padding: 0; background: transparent; max-width: none; max-height: none; }
dialog::backdrop { background: rgba(10, 8, 30, .55); backdrop-filter: blur(2px); }

.ad-popup-inner, .signup-modal-inner {
  position: relative; background: var(--surface); border-radius: var(--radius-lg);
  padding: 1.5rem; box-shadow: var(--shadow); margin: auto;
}
.ad-popup { margin: auto; }
.ad-popup-close, .corner-ad-close, .signup-modal-close {
  position: absolute; top: .6rem; right: .6rem; width: 30px; height: 30px; border-radius: 50%;
  background: var(--surface-2); display: grid; place-items: center; font-size: .85rem; color: var(--text-muted);
}
.ad-popup-close:hover, .corner-ad-close:hover, .signup-modal-close:hover { color: var(--text); background: var(--border); }

.signup-modal { width: min(92vw, 420px); }
.signup-modal-inner { display: flex; flex-direction: column; gap: .9rem; }
.signup-modal-inner h2 { font-size: 1.3rem; }
.signup-modal-inner p { color: var(--text-muted); font-size: .9rem; }
.signup-field { display: flex; flex-direction: column; gap: .35rem; font-size: .85rem; font-weight: 600; }
.signup-thanks { color: var(--success); font-weight: 600; }

.corner-ad {
  position: fixed; bottom: 1rem; right: 1rem; z-index: 45;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: .6rem; box-shadow: var(--shadow); animation: cornerIn .35s var(--ease-out);
}
@keyframes cornerIn { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@media (max-width: 480px) { .ad-slot-corner { width: 76vw; } }

/* =============================================================
   18. Reduced motion — only intrusive effects
   ============================================================= */
@media (prefers-reduced-motion: reduce) {
  .corner-ad { animation: none; }
  .btn-generate-spinner { animation-duration: 1.4s; }
}

/* =============================================================
   19. Responsive tweaks
   ============================================================= */
@media (max-width: 539px) {
  .demo-controls { flex-direction: column; }
  .cta-buttons { flex-direction: column; align-items: stretch; }
}
