/* ==========================================================================
   IPR — Explicação · base.css
   Tokens, reset, tipografia, layout, cabeçalho, rodapé.
   ========================================================================== */

:root {
  color-scheme: light;

  --bg: #f7f8fc;
  --bg-alt: #eef1f8;
  --surface: #ffffff;
  --surface-2: #f0f3fa;
  --surface-3: #e5eaf5;
  --text: #131a2b;
  --text-soft: #4d5877;
  --text-faint: #727d99;
  --line: #dde3f0;
  --line-strong: #c3cce0;

  --brand: #3b5bdb;
  --brand-soft: #e6ebff;
  --brand-ink: #24357f;
  --accent: #0d9488;
  --accent-soft: #d7f5f1;
  --warn: #b45309;
  --warn-soft: #fdf0dc;
  --danger: #be2338;
  --danger-soft: #fde8ec;
  --ok: #15803d;
  --ok-soft: #dcf5e6;

  --radius-s: 10px;
  --radius: 16px;
  --radius-l: 24px;

  --shadow-s: 0 1px 2px rgba(19, 26, 43, 0.05), 0 2px 8px rgba(19, 26, 43, 0.05);
  --shadow: 0 1px 2px rgba(19, 26, 43, 0.06), 0 10px 34px rgba(19, 26, 43, 0.08);
  --shadow-l: 0 2px 4px rgba(19, 26, 43, 0.06), 0 24px 60px rgba(19, 26, 43, 0.12);

  --max: 1120px;
  --max-read: 72ch;

  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue",
    Arial, "Noto Sans", sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;

  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
}

:root[data-theme="dark"] {
  color-scheme: dark;

  --bg: #0a0f1c;
  --bg-alt: #0e1526;
  --surface: #121a2e;
  --surface-2: #18223a;
  --surface-3: #1f2b47;
  --text: #e9eefb;
  --text-soft: #a8b3cd;
  --text-faint: #7d89a6;
  --line: #23304d;
  --line-strong: #35456a;

  --brand: #7c8cff;
  --brand-soft: #1b2450;
  --brand-ink: #c3cbff;
  --accent: #2dd4bf;
  --accent-soft: #0d2f2c;
  --warn: #f0b46a;
  --warn-soft: #2e2314;
  --danger: #ff8494;
  --danger-soft: #33131b;
  --ok: #4ade80;
  --ok-soft: #10291b;

  --shadow-s: 0 1px 2px rgba(0, 0, 0, 0.4), 0 2px 10px rgba(0, 0, 0, 0.3);
  --shadow: 0 2px 6px rgba(0, 0, 0, 0.45), 0 14px 40px rgba(0, 0, 0, 0.4);
  --shadow-l: 0 4px 10px rgba(0, 0, 0, 0.5), 0 30px 70px rgba(0, 0, 0, 0.5);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 96px;
}

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 17.5px;
  line-height: 1.72;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(60rem 40rem at 8% -10%, color-mix(in srgb, var(--brand) 12%, transparent), transparent 60%),
    radial-gradient(50rem 34rem at 95% 0%, color-mix(in srgb, var(--accent) 10%, transparent), transparent 55%);
}

/* ---------- Tipografia ---------- */

h1,
h2,
h3,
h4 {
  line-height: 1.2;
  letter-spacing: -0.018em;
  margin: 0 0 0.5em;
  font-weight: 700;
  text-wrap: balance;
}

h1 {
  font-size: clamp(2rem, 4.4vw, 3.15rem);
  letter-spacing: -0.03em;
}

h2 {
  font-size: clamp(1.5rem, 2.6vw, 2.05rem);
  margin-top: 2.4em;
}

h3 {
  font-size: clamp(1.16rem, 1.8vw, 1.36rem);
  margin-top: 1.8em;
}

h4 {
  font-size: 1.02rem;
  margin-top: 1.4em;
  letter-spacing: 0;
}

p {
  margin: 0 0 1.05em;
}

a {
  color: var(--brand);
  text-decoration-thickness: 1.5px;
  text-underline-offset: 2px;
}

a:hover {
  color: var(--brand-ink);
}

strong {
  font-weight: 650;
}

em {
  font-style: italic;
}

small {
  font-size: 0.86rem;
  color: var(--text-soft);
}

ul,
ol {
  padding-left: 1.35em;
  margin: 0 0 1.1em;
}

li {
  margin: 0.35em 0;
}

li::marker {
  color: var(--text-faint);
}

hr {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 3rem 0;
}

code {
  font-family: var(--font-mono);
  font-size: 0.88em;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0.08em 0.36em;
  white-space: nowrap;
}

blockquote {
  margin: 1.6em 0;
  padding: 0.2em 0 0.2em 1.15em;
  border-left: 3px solid var(--brand);
  color: var(--text-soft);
  font-style: italic;
}

/* ---------- Layout ---------- */

.wrap {
  width: 100%;
  max-width: var(--max);
  margin-inline: auto;
  padding-inline: clamp(18px, 4vw, 34px);
}

.prose {
  max-width: var(--max-read);
}

.prose > p {
  font-size: 1.045rem;
}

main {
  display: block;
  padding-bottom: 5rem;
}

.section {
  padding-block: clamp(2.6rem, 6vw, 4.4rem);
}

.section--tight {
  padding-block: clamp(1.6rem, 3vw, 2.4rem);
}

.section--alt {
  background: var(--bg-alt);
  border-block: 1px solid var(--line);
}

.stack > * + * {
  margin-top: 1rem;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 200;
  background: var(--brand);
  color: #fff;
  padding: 0.7rem 1.1rem;
  border-radius: 0 0 var(--radius-s) 0;
  font-weight: 600;
}

.skip-link:focus {
  left: 0;
}

/* ---------- Cabeçalho ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 90;
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  border-bottom: 1px solid var(--line);
}

.site-header__inner {
  display: flex;
  align-items: center;
  gap: 1rem;
  min-height: 66px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
  text-decoration: none;
  flex: 0 0 auto;
}

.brand__mark {
  width: 30px;
  height: 30px;
  flex: 0 0 auto;
}

.brand__sub {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--text-faint);
  display: block;
  line-height: 1;
  margin-top: 3px;
}

.nav {
  display: flex;
  align-items: center;
  gap: 0.2rem;
  margin-left: auto;
  flex-wrap: wrap;
}

.nav a {
  color: var(--text-soft);
  text-decoration: none;
  font-size: 0.93rem;
  font-weight: 550;
  padding: 0.42rem 0.7rem;
  border-radius: 999px;
  white-space: nowrap;
  transition: background 0.18s var(--ease), color 0.18s var(--ease);
}

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

.nav a[aria-current="page"] {
  background: var(--brand-soft);
  color: var(--brand-ink);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex: 0 0 auto;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text-soft);
  cursor: pointer;
  transition: background 0.18s var(--ease), color 0.18s var(--ease), border-color 0.18s var(--ease);
}

.icon-btn:hover {
  background: var(--surface-2);
  color: var(--text);
  border-color: var(--line-strong);
}

.nav-toggle {
  display: none;
}

@media (max-width: 900px) {
  .nav {
    position: fixed;
    inset: 66px 0 auto 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0.15rem;
    background: var(--surface);
    border-bottom: 1px solid var(--line);
    padding: 0.8rem clamp(18px, 4vw, 34px) 1.1rem;
    box-shadow: var(--shadow);
    display: none;
  }

  .nav[data-open="true"] {
    display: flex;
  }

  .nav a {
    padding: 0.72rem 0.8rem;
    border-radius: var(--radius-s);
    font-size: 1rem;
  }

  .nav-toggle {
    display: inline-flex;
  }
}

/* ---------- Rodapé ---------- */

.site-footer {
  border-top: 1px solid var(--line);
  background: var(--bg-alt);
  padding-block: 3rem 2.4rem;
  font-size: 0.94rem;
  color: var(--text-soft);
}

.site-footer h2 {
  font-size: 0.78rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin: 0 0 0.9rem;
}

.footer-grid {
  display: grid;
  grid-template-columns: 1.4fr repeat(2, 1fr);
  gap: 2rem;
}

@media (max-width: 720px) {
  .footer-grid {
    grid-template-columns: 1fr;
    gap: 1.6rem;
  }
}

.site-footer ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.site-footer li {
  margin: 0.4em 0;
}

.site-footer a {
  color: var(--text-soft);
  text-decoration: none;
}

.site-footer a:hover {
  color: var(--text);
  text-decoration: underline;
}

.footer-base {
  margin-top: 2.4rem;
  padding-top: 1.4rem;
  border-top: 1px solid var(--line);
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem 1.4rem;
  justify-content: space-between;
  font-size: 0.86rem;
  color: var(--text-faint);
}

/* ---------- Utilidades ---------- */

.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;
}

.center {
  text-align: center;
}

.mt-0 { margin-top: 0 !important; }
.mt-1 { margin-top: 0.6rem !important; }
.mt-2 { margin-top: 1.2rem !important; }
.mt-3 { margin-top: 2rem !important; }
.mb-0 { margin-bottom: 0 !important; }

.muted {
  color: var(--text-soft);
}

.faint {
  color: var(--text-faint);
}

.lead {
  font-size: clamp(1.1rem, 1.9vw, 1.28rem);
  line-height: 1.62;
  color: var(--text-soft);
  max-width: 62ch;
}

:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--brand) 60%, transparent);
  outline-offset: 3px;
  border-radius: 4px;
}

@media print {
  .site-header,
  .site-footer,
  .scene-ctl {
    display: none !important;
  }
  body {
    font-size: 11pt;
  }
  .scene {
    break-inside: avoid;
  }
}
