:root {
  --bg: #0b0d16;
  --panel: #141829;
  --panel-2: #1b2035;
  --border: #2a2f4a;
  --text: #f1f3fb;
  --text-dim: #9aa0c3;
  --purple: #7c6cff;
  --purple-2: #9b8cff;
  --cyan: #38bdf8;
  --cyan-2: #7dd3fc;
  --radius: 16px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background:
    radial-gradient(900px 420px at 10% -10%, rgba(124, 108, 255, 0.12), transparent 60%),
    radial-gradient(800px 400px at 100% 0%, rgba(56, 189, 248, 0.1), transparent 55%),
    linear-gradient(180deg, #0b0d16 0%, #0e1120 60%, #0b0d16 100%);
  color: var(--text);
  min-height: 100vh;
}

.page {
  max-width: 860px;
  margin: 0 auto;
  padding: 32px 20px 64px;
  display: flex;
  flex-direction: column;
  gap: 32px;
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.site-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
  text-decoration: none;
  font-weight: 800;
  font-size: 1.05rem;
  letter-spacing: -0.01em;
}

.brand-logo {
  height: 34px;
  width: auto;
  display: block;
  background: #fff;
  border-radius: 8px;
  padding: 4px 8px;
}

.site-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.site-nav a {
  color: var(--text-dim);
  text-decoration: none;
  font-size: 0.82rem;
  font-weight: 600;
  padding: 7px 12px;
  border-radius: 999px;
  white-space: nowrap;
}

.site-nav a:hover { color: var(--text); background: var(--panel-2); }

.site-nav a.active {
  color: white;
  background: linear-gradient(135deg, var(--purple), var(--purple-2));
}

.doc {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 36px clamp(20px, 4vw, 48px);
}

.doc h1 {
  margin: 0 0 6px;
  font-size: clamp(1.6rem, 3.2vw, 2.1rem);
  font-weight: 800;
  letter-spacing: -0.01em;
  background: linear-gradient(135deg, #ffffff 20%, var(--purple-2) 65%, var(--cyan-2) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.doc .lede {
  margin: 0 0 28px;
  color: var(--text-dim);
  font-size: 1rem;
  line-height: 1.6;
  max-width: 640px;
}

.doc h2 {
  font-size: 1.1rem;
  font-weight: 700;
  margin: 32px 0 10px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

.doc h2:first-of-type { border-top: none; padding-top: 0; margin-top: 8px; }

.doc p, .doc li {
  color: #d7dbee;
  font-size: 0.94rem;
  line-height: 1.7;
}

.doc ul { margin: 10px 0; padding-left: 22px; }
.doc li { margin-bottom: 6px; }
.doc a { color: var(--cyan-2); }
.doc strong { color: var(--text); }

.offer-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin: 16px 0 8px;
}

@media (max-width: 640px) {
  .offer-grid { grid-template-columns: 1fr; }
}

.offer-card {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px 20px;
}

.offer-card h3 {
  margin: 0 0 6px;
  font-size: 0.98rem;
  font-weight: 700;
  color: var(--text);
}

.offer-card p {
  margin: 0;
  font-size: 0.86rem;
  color: var(--text-dim);
  line-height: 1.6;
}

.offer-card a { color: var(--cyan-2); text-decoration: none; font-weight: 600; }
.offer-card a:hover { text-decoration: underline; }

.page-footer {
  text-align: center;
  color: var(--text-dim);
  font-size: 0.78rem;
}

.legal-links {
  margin-top: 12px;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px 14px;
}

.legal-links a {
  color: var(--text-dim);
  text-decoration: none;
  font-size: 0.76rem;
}

.legal-links a:hover {
  color: var(--text);
  text-decoration: underline;
}

/* --- Theme toggle button --- */
.site-header { flex-wrap: wrap; }
.site-nav { flex: 1 1 auto; justify-content: flex-end; }

.theme-toggle {
  background: var(--panel-2);
  border: 1px solid var(--border);
  color: var(--text);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
  padding: 0;
  margin-left: 8px;
}
.theme-toggle:hover { border-color: var(--purple); }

/* --- Light mode --- */
:root[data-theme="light"] {
  --bg: #f6f7fb;
  --panel: #ffffff;
  --panel-2: #eef0f8;
  --border: #dbdfee;
  --text: #181b2c;
  --text-dim: #5a5f78;
}

:root[data-theme="light"] body {
  background:
    radial-gradient(1100px 520px at 15% -10%, rgba(124, 108, 255, 0.08), transparent 60%),
    radial-gradient(900px 460px at 100% 0%, rgba(56, 189, 248, 0.07), transparent 55%),
    linear-gradient(180deg, #f6f7fb 0%, #eef0f8 60%, #f6f7fb 100%);
}

:root[data-theme="light"] .hero h1,
:root[data-theme="light"] .doc h1 {
  background: linear-gradient(135deg, #181b2c 20%, var(--purple) 65%, var(--cyan) 100%);
  -webkit-background-clip: text;
  background-clip: text;
}

:root[data-theme="light"] .content-block p,
:root[data-theme="light"] .doc p,
:root[data-theme="light"] .doc li,
:root[data-theme="light"] .article-card p,
:root[data-theme="light"] .faq-item p,
:root[data-theme="light"] .offer-card p,
:root[data-theme="light"] .contact-card p {
  color: #3a3f57;
}

:root[data-theme="light"] .checkerboard,
:root[data-theme="light"] .ba-frame {
  background-image:
    linear-gradient(45deg, #dfe2ee 25%, transparent 25%),
    linear-gradient(-45deg, #dfe2ee 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #dfe2ee 75%),
    linear-gradient(-45deg, transparent 75%, #dfe2ee 75%);
  background-color: #eef0f8;
}

:root[data-theme="light"] .placeholder {
  color: #a5760a;
}

/* --- Keep the theme toggle next to the brand on narrow screens, instead
   of stranding it alone below a wrapped nav --- */
@media (max-width: 640px) {
  .site-brand { order: 1; }
  .theme-toggle { order: 2; margin-left: auto; }
  .site-nav {
    order: 3;
    flex-basis: 100%;
    justify-content: flex-start;
  }
}

/* --- Animations & micro-interactions --- */
@media (prefers-reduced-motion: no-preference) {
  .site-brand img.brand-logo {
    transition: transform 0.35s cubic-bezier(.34,1.56,.64,1);
  }
  .site-brand:hover img.brand-logo {
    transform: scale(1.08) rotate(-4deg);
  }

  .site-nav a {
    transition: background 0.2s ease, color 0.2s ease, transform 0.15s ease;
  }
  .site-nav a:hover {
    transform: translateY(-1px);
  }

  .theme-toggle {
    transition: transform 0.2s ease, background 0.2s ease, border-color 0.2s ease;
  }
  .theme-toggle:hover { transform: scale(1.08); }
  .theme-toggle:active { transform: scale(0.92); }
  .theme-toggle.spin { animation: themeSpin 0.5s cubic-bezier(.34,1.56,.64,1); }

  .btn, .tool-cta {
    transition: transform 0.15s ease, box-shadow 0.2s ease, opacity 0.15s ease;
  }
  .btn-primary, .btn-success, .tool-cta {
    position: relative;
    overflow: hidden;
  }
  .btn-primary::after, .btn-success::after, .tool-cta::after {
    content: "";
    position: absolute;
    top: 0;
    left: -75%;
    width: 40%;
    height: 100%;
    background: linear-gradient(120deg, transparent, rgba(255,255,255,0.35), transparent);
    transform: skewX(-20deg);
    transition: left 0.6s ease;
    pointer-events: none;
  }
  .btn-primary:hover::after, .btn-success:hover::after, .tool-cta:hover::after {
    left: 125%;
  }
  .btn:hover:not(:disabled) { transform: translateY(-1px); }

  .drop-zone { transition: border-color 0.25s ease, background 0.25s ease, transform 0.2s ease; }
  .drop-zone.dragover { animation: dropPulse 1.1s ease-in-out infinite; }

  .tool-card-mini, .article-card {
    transition: transform 0.25s ease, border-color 0.2s ease, box-shadow 0.25s ease;
  }
  .tool-card-mini:hover, .article-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 14px 28px -14px rgba(0,0,0,0.4);
  }

  .reveal {
    opacity: 0;
    transform: translateY(18px);
    transition: opacity 0.6s ease, transform 0.6s ease;
  }
  .reveal.is-visible {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes themeSpin {
  0% { transform: rotate(0deg) scale(1); }
  50% { transform: rotate(180deg) scale(1.2); }
  100% { transform: rotate(360deg) scale(1); }
}

@keyframes dropPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.012); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
  .reveal { opacity: 1; transform: none; }
}

/* About: facts strip, sub-headings, FAQ */
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin: 24px 0 8px; }
.fact { padding: 16px; border-radius: 14px; border: 1px solid rgba(127, 127, 127, .25); background: rgba(127, 127, 127, .06); display: grid; gap: 4px; }
.fact strong { font-size: 1.8rem; line-height: 1.1; }
.fact span { font-size: .92rem; opacity: .8; }
.doc h3 { margin: 22px 0 8px; font-size: 1.12rem; }
.offer-grid .offer-card h3 { margin-top: 0; }
.doc .updated { opacity: .7; font-size: .9rem; }
