:root {
  color-scheme: dark;
  --bg: #080a0d;
  --panel: #10151b;
  --text: #f4f0e8;
  --muted: #a7b0ba;
  --quiet: #6f7a86;
  --gold: #c8a96a;
  --gold-soft: rgba(200, 169, 106, 0.16);
  --blue: #31a8ff;
  --blue-soft: rgba(49, 168, 255, 0.16);
  --line: rgba(244, 240, 232, 0.1);
  --danger: #ff786d;
  --success: #74dfb4;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.36);
  font-family: "Avenir Next", "Helvetica Neue", "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 78% 12%, rgba(49, 168, 255, 0.16), transparent 28rem),
    linear-gradient(135deg, rgba(200, 169, 106, 0.08), transparent 28%),
    var(--bg);
  color: var(--text);
}

body::before {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  content: "";
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: linear-gradient(to bottom, black, transparent 82%);
}

a { color: inherit; }
a:visited { color: #b49a5f; }

a:focus-visible,
button:focus-visible,
input:focus-visible {
  outline: 3px solid rgba(49, 168, 255, 0.72);
  outline-offset: 3px;
}

h1, h2, h3, p { margin: 0; }

.page { overflow: hidden; }

.shell {
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
}

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

/* ── Nav ─────────────────────────────────────────────────────────────── */

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 28px 0;
}

.brand {
  display: flex;
  align-items: center;
  text-decoration: none;
}

.brand:visited { color: var(--text); }

.brand-logo {
  display: block;
  width: clamp(150px, 16vw, 210px);
  height: auto;
}

.nav-links {
  display: flex;
  gap: 18px;
  align-items: center;
  color: var(--muted);
  font-size: 0.92rem;
}

.nav-links a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  text-decoration: none;
}

.nav-links a:hover { color: var(--gold); }
.nav-links a[aria-current="page"] { color: var(--gold); font-weight: 800; }
.nav-links a:visited { color: var(--muted); }
.nav-links a[aria-current="page"]:visited { color: var(--gold); }

/* ── Eyebrow ─────────────────────────────────────────────────────────── */

.eyebrow {
  display: inline-flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 22px;
  color: var(--gold);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.eyebrow::before {
  width: 34px;
  height: 1px;
  content: "";
  background: var(--gold);
}

.subhead {
  max-width: 700px;
  margin-top: 22px;
  color: var(--muted);
  font-size: clamp(1.04rem, 1.5vw, 1.2rem);
  line-height: 1.62;
}

/* ── Blog hub ────────────────────────────────────────────────────────── */

.blog-header {
  padding: 52px 0 60px;
  border-bottom: 1px solid var(--line);
}

.blog-header h1 {
  max-width: 820px;
  font-family: "Iowan Old Style", Georgia, "Times New Roman", serif;
  font-size: clamp(2.4rem, 5vw, 4.4rem);
  line-height: 0.98;
  text-wrap: balance;
}

.blog-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px;
  padding: 60px 0;
}

.blog-card {
  display: grid;
  gap: 14px;
  align-content: start;
  padding: 24px;
  border: 1px solid rgba(244, 240, 232, 0.13);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.04), transparent 34%),
    rgba(15, 20, 26, 0.92);
  text-decoration: none;
  color: inherit;
  transition: border-color 200ms, box-shadow 200ms, transform 200ms;
}

.blog-card:hover {
  border-color: rgba(200, 169, 106, 0.36);
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.32);
  transform: translateY(-2px);
}

.blog-card:visited { color: inherit; }

.blog-tag {
  display: inline-flex;
  min-height: 24px;
  align-items: center;
  padding: 0 10px;
  border: 1px solid rgba(200, 169, 106, 0.3);
  border-radius: 999px;
  background: rgba(200, 169, 106, 0.1);
  color: var(--gold);
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.blog-card h2 {
  font-family: "Iowan Old Style", Georgia, "Times New Roman", serif;
  font-size: clamp(1.2rem, 2vw, 1.44rem);
  line-height: 1.2;
  text-wrap: balance;
}

.blog-card p {
  color: var(--muted);
  font-size: 0.94rem;
  line-height: 1.65;
}

.blog-card-meta {
  display: flex;
  gap: 14px;
  align-items: center;
  color: var(--quiet);
  font-size: 0.8rem;
}

/* ── Article header ──────────────────────────────────────────────────── */

.article-header {
  padding: 52px 0 48px;
  border-bottom: 1px solid var(--line);
}

.article-header h1 {
  max-width: 860px;
  font-family: "Iowan Old Style", Georgia, "Times New Roman", serif;
  font-size: clamp(2.4rem, 5vw, 4.6rem);
  line-height: 0.98;
  text-wrap: balance;
}

.article-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  align-items: center;
  margin-top: 24px;
  color: var(--quiet);
  font-size: 0.85rem;
}

.article-meta time { color: var(--muted); }

/* ── Article body ────────────────────────────────────────────────────── */

.article-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 2.5fr);
  gap: clamp(30px, 5vw, 70px);
  align-items: start;
  padding: 56px 0 72px;
}

/* TOC */
.toc {
  position: sticky;
  top: 28px;
  padding: 18px 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.03);
}

.toc-title {
  margin-bottom: 14px;
  color: var(--gold);
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.toc ol {
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: toc;
}

.toc li {
  counter-increment: toc;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
  line-height: 1.4;
}

.toc li:last-child { border-bottom: 0; }

.toc a {
  display: flex;
  gap: 10px;
  align-items: baseline;
  color: var(--muted);
  font-size: 0.86rem;
  text-decoration: none;
}

.toc a::before {
  flex-shrink: 0;
  min-width: 18px;
  content: counter(toc);
  color: var(--quiet);
  font-size: 0.75rem;
}

.toc a:hover { color: var(--gold); }
.toc a:visited { color: var(--muted); }

/* ── Prose ───────────────────────────────────────────────────────────── */

.prose {
  min-width: 0;
  color: var(--muted);
  font-size: 1.08rem;
  line-height: 1.82;
}

.prose h2 {
  margin-top: 52px;
  font-family: "Iowan Old Style", Georgia, "Times New Roman", serif;
  font-size: clamp(1.7rem, 3vw, 2.6rem);
  line-height: 1.08;
  color: var(--text);
  text-wrap: balance;
}

.prose h2:first-child { margin-top: 0; }

.prose h3 {
  margin-top: 32px;
  font-size: 1.08rem;
  font-weight: 800;
  line-height: 1.35;
  color: var(--text);
}

.prose p { margin-top: 18px; }
.prose p:first-child { margin-top: 0; }

.prose strong { color: var(--text); font-weight: 800; }

.prose a {
  color: var(--gold);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.prose a:hover { color: var(--text); }
.prose a:visited { color: #b49a5f; }

.prose ul,
.prose ol {
  margin: 18px 0 0;
  padding-left: 22px;
  display: grid;
  gap: 8px;
}

.prose li { line-height: 1.7; }

.prose table {
  width: 100%;
  margin-top: 28px;
  border-collapse: collapse;
  font-size: 0.94rem;
}

.prose th {
  padding: 10px 14px;
  border-bottom: 1px solid rgba(200, 169, 106, 0.28);
  color: var(--text);
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.07em;
  text-align: left;
  text-transform: uppercase;
}

.prose td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

/* Callout */
.callout {
  margin-top: 32px;
  padding: 20px 22px;
  border-left: 3px solid var(--gold);
  border-radius: 0 8px 8px 0;
  background: var(--gold-soft);
}

.callout p {
  margin: 0;
  color: var(--text);
  line-height: 1.65;
}

.callout strong { color: var(--gold); }

.callout.blue {
  border-left-color: var(--blue);
  background: var(--blue-soft);
}

/* Formula box */
.formula-box {
  margin-top: 28px;
  padding: 22px 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.03);
}

.formula-eq {
  font-size: 1.12rem;
  font-weight: 800;
  color: var(--text);
  line-height: 1.5;
}

.formula-eq .eq-num { color: var(--text); }
.formula-eq .eq-den { color: var(--muted); font-size: 0.92rem; font-weight: 400; }
.formula-eq .eq-div { color: var(--gold); }

.formula-label {
  display: block;
  margin-top: 10px;
  color: var(--quiet);
  font-size: 0.84rem;
}

/* Benchmark rows */
.bench-table {
  margin-top: 28px;
  display: grid;
  gap: 10px;
}

.bench-row {
  display: grid;
  grid-template-columns: 110px 1fr auto;
  gap: 14px;
  align-items: center;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.bench-row.good  { border-color: rgba(116, 223, 180, 0.28); background: rgba(116, 223, 180, 0.06); }
.bench-row.watch { border-color: rgba(200, 169, 106, 0.28); background: rgba(200, 169, 106, 0.06); }
.bench-row.risk  { border-color: rgba(255, 120, 109, 0.28); background: rgba(255, 120, 109, 0.06); }

.bench-val { font-size: 1.15rem; font-weight: 800; color: var(--text); }
.bench-row.good  .bench-val { color: var(--success); }
.bench-row.watch .bench-val { color: var(--gold); }
.bench-row.risk  .bench-val { color: var(--danger); }

.bench-label { color: var(--muted); font-size: 0.92rem; }
.bench-note  { color: var(--quiet); font-size: 0.82rem; text-align: right; }

/* ── CTA box ─────────────────────────────────────────────────────────── */

.article-cta {
  padding: 60px 0;
  border-top: 1px solid var(--line);
}

.cta-box {
  display: grid;
  gap: 18px;
  padding: 36px;
  border: 1px solid rgba(49, 168, 255, 0.24);
  border-radius: 8px;
  background: linear-gradient(110deg, rgba(49, 168, 255, 0.12), rgba(200, 169, 106, 0.08));
}

.cta-box h2 {
  font-family: "Iowan Old Style", Georgia, "Times New Roman", serif;
  font-size: clamp(1.5rem, 3vw, 2.4rem);
  line-height: 1.1;
}

.cta-box p {
  max-width: 680px;
  color: var(--muted);
  line-height: 1.65;
}

.cta-form {
  display: grid;
  grid-template-columns: minmax(190px, 1fr) auto;
  gap: 10px;
}

.cta-form input {
  width: 100%;
  min-height: 54px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 6px;
  outline: 0;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  font: inherit;
}

.cta-form button,
.tool-link {
  min-height: 54px;
  padding: 0 18px;
  border: 0;
  border-radius: 6px;
  background: linear-gradient(135deg, #d4b878, #a98748);
  color: #090a0c;
  cursor: pointer;
  font: inherit;
  font-weight: 850;
  text-align: center;
  text-decoration: none;
  white-space: nowrap;
  box-shadow: 0 14px 34px rgba(200, 169, 106, 0.2);
  transition: transform 180ms ease-out, box-shadow 180ms ease-out, filter 180ms ease-out;
}

.tool-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.cta-form button:hover,
.tool-link:hover {
  filter: brightness(1.04);
  box-shadow: 0 18px 42px rgba(200, 169, 106, 0.28);
  transform: translateY(-1px);
}

.tool-link:visited { color: #090a0c; }

.bot-field {
  position: absolute;
  left: -10000px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.form-message {
  min-height: 22px;
  color: var(--quiet);
  font-size: 0.92rem;
}

/* ── Related posts ───────────────────────────────────────────────────── */

.related-posts {
  padding: 60px 0;
  border-top: 1px solid var(--line);
}

.related-posts h2 {
  margin-bottom: 28px;
  font-family: "Iowan Old Style", Georgia, "Times New Roman", serif;
  font-size: clamp(1.5rem, 3vw, 2.2rem);
  line-height: 1;
}

.related-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

/* ── Sections ────────────────────────────────────────────────────────── */

section { padding: 80px 0; }

.gap {
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.018);
}

/* ── Info card ───────────────────────────────────────────────────────── */

.info-card {
  padding: 24px;
  border: 1px solid rgba(244, 240, 232, 0.13);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.05), transparent 34%),
    rgba(15, 20, 26, 0.92);
  box-shadow: var(--shadow);
}

.info-card h3 {
  margin-bottom: 12px;
  font-family: "Iowan Old Style", Georgia, "Times New Roman", serif;
  font-size: 1.12rem;
  line-height: 1.2;
  text-wrap: balance;
}

.info-card p, .info-card li { color: var(--muted); line-height: 1.7; }

/* ── Glossário ───────────────────────────────────────────────────────── */

.gloss-header {
  padding: 52px 0 48px;
  border-bottom: 1px solid var(--line);
}

.gloss-header h1 {
  max-width: 820px;
  font-family: "Iowan Old Style", Georgia, "Times New Roman", serif;
  font-size: clamp(2.4rem, 5vw, 4.2rem);
  line-height: 0.98;
  text-wrap: balance;
}

.alpha-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 28px 0;
  border-bottom: 1px solid var(--line);
}

.alpha-nav a {
  display: inline-flex;
  min-width: 36px;
  min-height: 36px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 800;
  text-decoration: none;
  transition: border-color 160ms, color 160ms;
}

.alpha-nav a:hover { border-color: var(--gold); color: var(--gold); }
.alpha-nav a:visited { color: var(--muted); }

.gloss-body { padding: 52px 0 80px; }

.gloss-section { margin-bottom: 56px; }

.gloss-letter {
  display: flex;
  gap: 14px;
  align-items: center;
  margin-bottom: 22px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(200, 169, 106, 0.28);
}

.gloss-letter span {
  font-family: "Iowan Old Style", Georgia, "Times New Roman", serif;
  font-size: 2.2rem;
  color: var(--gold);
  line-height: 1;
}

.term-grid { display: grid; gap: 10px; }

.term-card {
  display: grid;
  grid-template-columns: minmax(170px, 0.3fr) minmax(0, 1fr);
  gap: 20px;
  align-items: start;
  padding: 18px 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.025);
}

.term-name {
  font-family: "Iowan Old Style", Georgia, "Times New Roman", serif;
  font-size: 1.05rem;
  color: var(--text);
  line-height: 1.3;
}

.term-abbr {
  display: block;
  margin-top: 5px;
  color: var(--gold);
  font-size: 0.73rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.term-def {
  color: var(--muted);
  line-height: 1.72;
  font-size: 0.96rem;
}

.term-def strong { color: var(--text); font-weight: 800; }

.term-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-top: 10px;
  color: var(--gold);
  font-size: 0.84rem;
  font-weight: 700;
  text-decoration: none;
}

.term-link:hover { color: var(--text); }
.term-link:visited { color: #b49a5f; }

/* ── Footer ──────────────────────────────────────────────────────────── */

footer {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: center;
  padding: 26px 0 40px;
  border-top: 1px solid var(--line);
  color: var(--quiet);
  font-size: 0.88rem;
}

footer a { color: var(--gold); font-weight: 750; text-decoration: none; }

/* ── Animations ──────────────────────────────────────────────────────── */

.article-header,
.blog-header,
.gloss-header,
.article-body,
.article-cta,
.related-posts,
section {
  animation: rise-in 520ms ease-out both;
}

@keyframes rise-in {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Responsive ──────────────────────────────────────────────────────── */

@media (max-width: 980px) {
  .blog-grid,
  .related-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .article-body { grid-template-columns: 1fr; }
  .toc { position: static; }
  .term-card { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .shell { width: min(100% - 28px, 1180px); }

  .nav { align-items: flex-start; gap: 14px; }
  .nav-links { display: grid; gap: 8px; text-align: right; }

  .blog-grid,
  .related-grid { grid-template-columns: 1fr; }

  .cta-form { grid-template-columns: 1fr; }
  .cta-form button, .tool-link { width: 100%; white-space: normal; }

  .bench-row { grid-template-columns: 90px 1fr; }
  .bench-note { display: none; }

  section { padding: 64px 0; }
  footer { display: grid; }
}

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