:root {
  --teal: #14b8a6;
  --teal-deep: #0f766e;
  --ink: #0a0e14;
  --ink-soft: #1f2933;
  --muted: #6b7d8f;
  --bg: #f8fafc;
  --card: #ffffff;
  --feature-bg: #f1f5f9;
  --border: #d9e2ec;
  --accent: #0f766e;        /* headings, links, emphasis on light surfaces */
  --btn-bg: #0f766e;
  --btn-fg: #ffffff;
  --hero-from: #14b8a6;
  --hero-to: #0f766e;
  --shadow-1: rgba(0, 0, 0, 0.06);
  --shadow-2: rgba(0, 0, 0, 0.04);
  --max: 760px;
}

/* Dark palette — explicit override set by the pre-paint script / toggle. */
:root[data-theme="dark"] {
  --ink: #f1f5f9;
  --ink-soft: #dbe4ee;
  --muted: #9fb1c2;
  --bg: #0a0e14;
  --card: #141c27;
  --feature-bg: #1b2531;
  --border: #2a3744;
  --accent: #5eead4;        /* lighter teal keeps AA contrast on dark */
  --btn-bg: #14b8a6;
  --btn-fg: #06231f;
  --hero-from: #0f766e;
  --hero-to: #0a0e14;
  --shadow-1: rgba(0, 0, 0, 0.45);
  --shadow-2: rgba(0, 0, 0, 0.35);
}

/* No-JS fallback: follow the OS preference when no explicit choice is set. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ink: #f1f5f9;
    --ink-soft: #dbe4ee;
    --muted: #9fb1c2;
    --bg: #0a0e14;
    --card: #141c27;
    --feature-bg: #1b2531;
    --border: #2a3744;
    --accent: #5eead4;
    --btn-bg: #14b8a6;
    --btn-fg: #06231f;
    --hero-from: #0f766e;
    --hero-to: #0a0e14;
    --shadow-1: rgba(0, 0, 0, 0.45);
    --shadow-2: rgba(0, 0, 0, 0.35);
  }
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--ink-soft);
  background: var(--bg);
  line-height: 1.6;
  transition: background-color 0.25s ease, color 0.25s ease;
}

a { color: var(--accent); }

.wrap {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 20px;
}

/* Header / hero */
header.hero {
  position: relative;
  overflow: hidden;
  background: linear-gradient(160deg, var(--hero-from) 0%, var(--hero-to) 100%);
  color: #fff;
  text-align: center;
  padding: 56px 20px 64px;
  /* Pointer-reactive custom properties (updated by app.js). */
  --mx: 0;
  --my: 0;
  --tilt-x: 0deg;
  --tilt-y: 0deg;
}

.hero-content {
  position: relative;
  z-index: 1;
}

/* Decorative animated layer behind the logo. */
.hero-fx {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

.hero-fx span {
  position: absolute;
  top: 50%;
  left: 50%;
  border-radius: 50%;
  will-change: transform, opacity;
  /* NOTE: no base `transform` here. Each fx element bakes its own -50% centering
     into its translate3d (with --mx/--my defaulting to 0 on header.hero), so a
     base transform would only win specificity (0,1,1 > 0,1,0) and freeze the
     pointer-reactive transforms. The reduced-motion reset below re-asserts a
     static transform when motion must be disabled. */
}

/* Central spotlight: brightest point sits centered behind the logo and falls
   off smoothly. Drifts gently with the cursor. */
.fx-glow {
  width: 440px;
  height: 440px;
  max-width: 90vw;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.5) 0%, rgba(94, 234, 212, 0.16) 42%, rgba(255, 255, 255, 0) 72%);
  transform: translate3d(calc(-50% + var(--mx) * 50px), calc(-50% + var(--my) * 50px), 0);
  transition: transform 0.4s ease-out;
}

/* Large, faint ambient halo that frames the whole hero (~3x diameter of the
   old ring, far more transparent). Reacts only subtly to the pointer. */
.fx-ring {
  width: 760px;
  height: 760px;
  max-width: 150vw;
  max-height: 150vw;
  border: 1.5px solid rgba(255, 255, 255, 0.15);
  background: transparent;
  transform: translate3d(calc(-50% + var(--mx) * 18px), calc(-50% + var(--my) * 18px), 0);
  transition: transform 0.5s ease-out;
}

.logo {
  width: 96px;
  height: 96px;
  margin: 0 auto 20px;
  display: block;
  will-change: transform;
  transform: perspective(600px) rotateX(var(--tilt-x)) rotateY(var(--tilt-y));
  transition: transform 0.3s ease-out;
}

header.hero h1 {
  margin: 0;
  font-size: 2.4rem;
  font-weight: 800;
  letter-spacing: 0.5px;
}

header.hero p.tagline {
  margin: 10px 0 0;
  font-size: 1.1rem;
  opacity: 0.92;
}

/* Idle / no-JS autonomous motion (subtle breathing of the spotlight). */
[data-motion="idle"] .fx-glow,
header.hero:not([data-motion]) .fx-glow {
  animation: fx-float 9s ease-in-out infinite;
}

@keyframes fx-float {
  0%, 100% { transform: translate3d(-50%, -50%, 0) scale(1); opacity: 0.85; }
  50%      { transform: translate3d(-50%, -52%, 0) scale(1.04); opacity: 1; }
}

/* Interactive mode disables idle keyframes so pointer transforms win. */
header.hero[data-motion="interactive"] .fx-glow,
header.hero[data-motion="interactive"] .fx-ring {
  animation: none;
}

/* Dark mode: keep the hero clean and uncluttered — a calmer, cooler spotlight
   and an even fainter halo so only the logo draws the eye. */
:root[data-theme="dark"] header.hero {
  background: radial-gradient(120% 140% at 50% 22%, #134e48 0%, var(--bg) 70%);
}
:root[data-theme="dark"] .fx-glow {
  background: radial-gradient(circle, rgba(94, 234, 212, 0.34) 0%, rgba(20, 184, 166, 0.12) 44%, rgba(10, 14, 20, 0) 72%);
}
:root[data-theme="dark"] .fx-ring {
  border-color: rgba(94, 234, 212, 0.12);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) header.hero {
    background: radial-gradient(120% 140% at 50% 22%, #134e48 0%, var(--bg) 70%);
  }
  :root:not([data-theme="light"]) .fx-glow {
    background: radial-gradient(circle, rgba(94, 234, 212, 0.34) 0%, rgba(20, 184, 166, 0.12) 44%, rgba(10, 14, 20, 0) 72%);
  }
  :root:not([data-theme="light"]) .fx-ring {
    border-color: rgba(94, 234, 212, 0.12);
  }
}

/* Content */
main {
  padding: 40px 0 64px;
}

section.card {
  background: var(--card);
  border-radius: 16px;
  padding: 28px 28px;
  margin: 0 0 24px;
  box-shadow: 0 1px 3px var(--shadow-1), 0 8px 24px var(--shadow-2);
  transition: background-color 0.25s ease;
}

/* Page title moved into the policy content (per language). */
.page-title {
  color: var(--ink);
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: 0.3px;
  margin: 0 0 4px;
}

h2 {
  color: var(--accent);
  font-size: 1.4rem;
  margin-top: 0;
}

section.card .page-title + .updated { margin-top: 0; }

h3 {
  font-size: 1.05rem;
  margin: 22px 0 6px;
}

ul { padding-left: 20px; }
li { margin: 4px 0; }

.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-top: 18px;
}

.feature {
  background: var(--feature-bg);
  border-radius: 12px;
  padding: 16px;
}

.feature strong { color: var(--accent); }

/* Buttons */
.btn-row {
  text-align: center;
  margin-top: 28px;
}

.btn {
  display: inline-block;
  background: var(--btn-bg);
  color: var(--btn-fg);
  text-decoration: none;
  padding: 12px 22px;
  border-radius: 999px;
  font-weight: 700;
  margin: 6px;
}

.btn.secondary {
  background: transparent;
  color: var(--accent);
  border: 2px solid var(--accent);
}

/* Inline lang spans (e.g. inside the "Back" button) stay inline. */
.btn [data-lang-block].show { display: inline; }

/* Controls row: language toggle + theme toggle */
.controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
  margin: 0 0 24px;
}

/* Language toggle */
.lang-toggle {
  display: inline-flex;
}

.lang-toggle button {
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--muted);
  padding: 8px 18px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
}

.lang-toggle button:not(:first-child) { border-left: none; }
.lang-toggle button:first-child { border-radius: 999px 0 0 999px; }
.lang-toggle button:last-child  { border-radius: 0 999px 999px 0; }

.lang-toggle button.active {
  background: var(--btn-bg);
  color: var(--btn-fg);
  border-color: var(--btn-bg);
}

.lang-toggle button:focus-visible,
.theme-toggle:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

/* Theme toggle */
.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--accent);
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
}

.theme-icon { display: none; }
:root[data-theme="light"] .theme-icon-moon { display: inline; }
:root[data-theme="dark"] .theme-icon-sun { display: inline; }
/* No-JS fallback icon (no data-theme attribute present). */
:root:not([data-theme]) .theme-icon-moon { display: inline; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) .theme-icon-moon { display: none; }
  :root:not([data-theme]) .theme-icon-sun { display: inline; }
}

[data-lang-block] { display: none; }
[data-lang-block].show { display: block; }

/* No-JS graceful degradation: hide inert toggles, show the default language. */
html:not(.js) .controls { display: none; }
html:not(.js) [data-lang-block][data-lang="pt"] { display: block; }
html:not(.js) .btn [data-lang-block][data-lang="pt"] { display: inline; }

.updated {
  color: var(--muted);
  font-size: 0.9rem;
  font-style: italic;
}

/* Footer */
footer {
  text-align: center;
  padding: 32px 20px 48px;
  color: var(--muted);
  font-size: 0.9rem;
}

footer a { margin: 0 8px; color: var(--accent); }

@media (max-width: 480px) {
  header.hero h1 { font-size: 1.9rem; }
  section.card { padding: 22px 18px; }
  .page-title { font-size: 1.7rem; }
  .fx-glow { width: 320px; height: 320px; }
  .fx-ring { width: 460px; height: 460px; }
}

/* Accessibility: fully disable motion when requested. */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .hero-fx span,
  .logo {
    animation: none !important;
    transition: none !important;
    transform: translate3d(-50%, -50%, 0);
  }
  .logo { transform: none; }
}

header.hero[data-motion="off"] .hero-fx span,
header.hero[data-motion="off"] .logo {
  animation: none !important;
  transition: none !important;
}
header.hero[data-motion="off"] .logo { transform: none; }
