/* Sistema de design, Projeto ENEM Matematica. Fundo claro sempre. */

:root {
  --paper: #f5f4f0;
  --surface: #ffffff;
  --surface-2: #fbfaf8;
  --ink: #14161a;
  --ink-2: #4b515a;
  --ink-3: #838a94;
  --line: #e4e2dc;
  --line-strong: #cfccc4;

  --accent: #1b3bd1;
  --accent-ink: #12299a;
  --accent-soft: #ecefff;

  --stop: #b3261e;
  --stop-soft: #fceceb;
  --warn: #a25b06;
  --warn-soft: #fdf3e4;
  --ok: #176b3f;
  --ok-soft: #e8f4ed;

  --radius: 14px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(20,22,26,.05), 0 8px 24px -12px rgba(20,22,26,.14);
  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  --font-display: "Fraunces", Georgia, "Times New Roman", serif;
  --font-mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.62;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent-ink); text-decoration: none; }
a:hover { text-decoration: underline; }

.wrap { max-width: 1120px; margin: 0 auto; padding: 0 24px; }

/* ---------- Topbar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 40;
  background: rgba(245,244,240,.86);
  backdrop-filter: saturate(1.6) blur(10px);
  border-bottom: 1px solid var(--line);
}
.topbar-inner {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; height: 58px;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 640; letter-spacing: -.01em; }
.brand .mark {
  width: 26px; height: 26px; border-radius: 7px; flex: none;
  background: var(--ink); color: #fff;
  display: grid; place-items: center;
  font-family: var(--font-mono); font-size: 13px; font-weight: 600;
}
.brand small { display: block; font-weight: 450; color: var(--ink-3); font-size: 12px; line-height: 1; margin-top: 2px; }
.topbar nav { display: flex; gap: 18px; font-size: 14px; }
.topbar nav a { color: var(--ink-2); }
.topbar nav a[aria-current="page"] { color: var(--ink); font-weight: 560; }

/* ---------- Hero ---------- */
.hero { padding: 64px 0 40px; border-bottom: 1px solid var(--line); }
.eyebrow {
  font-family: var(--font-mono); font-size: 12px; letter-spacing: .1em;
  text-transform: uppercase; color: var(--ink-3);
}
h1 {
  font-family: var(--font-display);
  font-weight: 600; letter-spacing: -.02em;
  font-size: clamp(34px, 5.2vw, 58px); line-height: 1.04;
  margin: 14px 0 0;
}
.lede { font-size: clamp(17px, 2vw, 20px); color: var(--ink-2); max-width: 62ch; margin: 18px 0 0; }

/* ---------- Countdown ---------- */
.counters { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; margin-top: 32px; }
.counter {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow);
}
.counter .n { font-family: var(--font-display); font-size: 38px; font-weight: 600; line-height: 1; letter-spacing: -.02em; }
.counter .n span { font-family: var(--font-sans); font-size: 14px; font-weight: 500; color: var(--ink-3); letter-spacing: 0; }
.counter .k { font-size: 13px; color: var(--ink-2); margin-top: 8px; }
.counter.is-hot { border-color: #e7c8c5; background: linear-gradient(180deg, #fff, var(--stop-soft)); }
.counter.is-hot .n { color: var(--stop); }

/* ---------- Layout de documento ---------- */
.doc { display: grid; grid-template-columns: 1fr; gap: 40px; padding: 44px 0 80px; }
@media (min-width: 1000px) {
  .doc { grid-template-columns: 216px 1fr; gap: 56px; }
}
.toc { display: none; }
@media (min-width: 1000px) {
  .toc { display: block; position: sticky; top: 82px; align-self: start; font-size: 13.5px; }
}
.toc p { font-family: var(--font-mono); font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3); margin: 0 0 10px; }
.toc a { display: block; padding: 5px 0 5px 12px; color: var(--ink-2); border-left: 2px solid var(--line); line-height: 1.35; }
.toc a:hover { color: var(--ink); border-left-color: var(--line-strong); text-decoration: none; }

.content { min-width: 0; }
.content > section { scroll-margin-top: 78px; }
.content h2 {
  font-family: var(--font-display); font-weight: 600; letter-spacing: -.02em;
  font-size: clamp(24px, 3vw, 32px); line-height: 1.15; margin: 56px 0 6px;
}
.content > section:first-child h2 { margin-top: 0; }
.content h3 { font-size: 17px; font-weight: 620; letter-spacing: -.01em; margin: 30px 0 8px; }
.content p { margin: 12px 0; max-width: 72ch; }
.section-kicker { font-family: var(--font-mono); font-size: 11.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--accent); }

/* ---------- Blocos ---------- */
.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 22px 24px; box-shadow: var(--shadow);
  margin: 18px 0;
}
.card > :first-child { margin-top: 0; }
.card > :last-child { margin-bottom: 0; }

.note {
  border-left: 3px solid var(--accent); background: var(--accent-soft);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: 14px 18px; margin: 18px 0;
}
.note.q { border-left-color: var(--warn); background: var(--warn-soft); }
.note.stop { border-left-color: var(--stop); background: var(--stop-soft); }
.note.ok { border-left-color: var(--ok); background: var(--ok-soft); }
.note strong { display: block; font-size: 13px; letter-spacing: .02em; text-transform: uppercase; font-family: var(--font-mono); font-weight: 600; margin-bottom: 4px; }
.note.q strong { color: var(--warn); }
.note.stop strong { color: var(--stop); }
.note.ok strong { color: var(--ok); }
.note strong:not(.note.q strong):not(.note.stop strong):not(.note.ok strong) { color: var(--accent-ink); }
.note p { margin: 6px 0; max-width: 70ch; }
.note :last-child { margin-bottom: 0; }

/* ---------- Checklist ---------- */
.check { list-style: none; padding: 0; margin: 14px 0; }
.check li {
  display: grid; grid-template-columns: 18px 1fr; gap: 12px;
  padding: 11px 0; border-top: 1px solid var(--line);
  align-items: start;
}
.check li:first-child { border-top: 0; }
.check li::before {
  content: ""; width: 16px; height: 16px; margin-top: 5px;
  border: 1.5px solid var(--line-strong); border-radius: 4px; background: var(--surface-2);
}
.check li b { font-weight: 600; }
.check li .meta { display: block; color: var(--ink-2); font-size: 14.5px; }

.tag {
  display: inline-block; vertical-align: 1px; margin-left: 8px;
  font-family: var(--font-mono); font-size: 10.5px; letter-spacing: .06em; text-transform: uppercase;
  padding: 2px 7px; border-radius: 999px; border: 1px solid transparent; white-space: nowrap;
}
.tag.stop { background: var(--stop-soft); color: var(--stop); border-color: #eccfcc; }
.tag.cliente { background: var(--warn-soft); color: var(--warn); border-color: #eddcc0; }
.tag.vc { background: var(--accent-soft); color: var(--accent-ink); border-color: #cfd8ff; }
.tag.depois { background: #f0efec; color: var(--ink-3); border-color: var(--line); }

/* ---------- Tabela ---------- */
.table-wrap { overflow-x: auto; margin: 18px 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
table { border-collapse: collapse; width: 100%; font-size: 14.5px; min-width: 560px; }
th, td { text-align: left; padding: 12px 16px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 11.5px; font-family: var(--font-mono); letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); font-weight: 600; background: var(--surface-2); }
tr:last-child td { border-bottom: 0; }
td b { font-weight: 620; }
.row-hot td { background: var(--ok-soft); }
.row-off td { color: var(--ink-3); }

/* ---------- Cards do hub ---------- */
.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); margin: 28px 0 0; }
.tile {
  display: block; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow);
  color: inherit; transition: transform .12s ease, box-shadow .12s ease, border-color .12s ease;
}
.tile:hover { text-decoration: none; transform: translateY(-2px); border-color: var(--line-strong); box-shadow: 0 2px 4px rgba(20,22,26,.06), 0 16px 32px -16px rgba(20,22,26,.22); }
.tile h3 { margin: 10px 0 6px; font-family: var(--font-display); font-size: 21px; font-weight: 600; letter-spacing: -.015em; }
.tile p { margin: 0; color: var(--ink-2); font-size: 14.5px; }
.tile .status { font-family: var(--font-mono); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); }
.tile.soon { background: var(--surface-2); box-shadow: none; border-style: dashed; }
.tile.soon:hover { transform: none; }

/* ---------- Rodape ---------- */
footer { border-top: 1px solid var(--line); padding: 28px 0 56px; color: var(--ink-3); font-size: 13.5px; }
footer p { margin: 4px 0; }

hr.rule { border: 0; border-top: 1px solid var(--line); margin: 44px 0; }

/* ---------- Checklist interativo (documento 02) ---------- */
.progress-bar {
  position: sticky; top: 58px; z-index: 30;
  background: rgba(245,244,240,.94);
  backdrop-filter: saturate(1.6) blur(10px);
  border-bottom: 1px solid var(--line);
  padding: 10px 0;
}
.progress-inner { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.progress-track { flex: 1 1 200px; height: 8px; border-radius: 999px; background: var(--line); overflow: hidden; min-width: 140px; }
.progress-fill { height: 100%; width: 0%; background: var(--ok); border-radius: 999px; transition: width .25s ease; }
.progress-num { font-family: var(--font-mono); font-size: 13px; font-weight: 600; color: var(--ink-2); white-space: nowrap; }
.progress-num b { color: var(--ink); }
.progress-num .locks { color: var(--stop); }
.btn {
  font: inherit; font-size: 13px; font-weight: 560;
  padding: 6px 13px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink-2);
  white-space: nowrap;
}
.btn:hover { border-color: var(--ink-3); color: var(--ink); }
.btn[aria-pressed="true"] { background: var(--ink); color: #fff; border-color: var(--ink); }
.btn.ghost { border-color: transparent; color: var(--ink-3); }
.btn.ghost:hover { color: var(--stop); }

.task-list { list-style: none; padding: 0; margin: 16px 0 0; }
.task {
  display: grid; grid-template-columns: 22px 1fr; gap: 13px;
  padding: 13px 0; border-top: 1px solid var(--line); align-items: start;
}
.task:first-child { border-top: 0; }
.task input[type="checkbox"] {
  appearance: none; -webkit-appearance: none; margin: 4px 0 0; flex: none;
  width: 19px; height: 19px; border-radius: 5px; cursor: pointer;
  border: 1.5px solid var(--line-strong); background: var(--surface-2);
  display: grid; place-content: center; transition: background .12s, border-color .12s;
}
.task input[type="checkbox"]:hover { border-color: var(--ink-3); }
.task input[type="checkbox"]:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.task input[type="checkbox"]::after {
  content: ""; width: 10px; height: 6px; margin-top: -2px;
  border-left: 2px solid #fff; border-bottom: 2px solid #fff;
  transform: rotate(-45deg) scale(0); transition: transform .12s ease;
}
.task input[type="checkbox"]:checked { background: var(--ok); border-color: var(--ok); }
.task input[type="checkbox"]:checked::after { transform: rotate(-45deg) scale(1); }
.task label { cursor: pointer; display: block; }
.task .t { font-weight: 600; letter-spacing: -.005em; }
.task .d { display: block; color: var(--ink-2); font-size: 14.5px; margin-top: 2px; max-width: 68ch; }
.task.done .t, .task.done .d { color: var(--ink-3); text-decoration: line-through; text-decoration-thickness: 1px; }
.task.done .tag { opacity: .45; }
.task.hidden { display: none; }

.block-head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 14px; flex-wrap: wrap; margin: 46px 0 0;
}
.block-head h3 { margin: 0; font-family: var(--font-display); font-size: 23px; font-weight: 600; letter-spacing: -.018em; }
.block-count { font-family: var(--font-mono); font-size: 12px; color: var(--ink-3); white-space: nowrap; }
.block-note { color: var(--ink-2); font-size: 14.5px; margin: 6px 0 0; max-width: 72ch; }

/* ---------- Calculadora ---------- */
.calc { display: grid; gap: 20px; grid-template-columns: 1fr; }
@media (min-width: 860px) { .calc { grid-template-columns: 320px 1fr; align-items: start; } }
.field { margin: 0 0 15px; }
.field:last-child { margin-bottom: 0; }
.field label { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; font-size: 13.5px; color: var(--ink-2); margin-bottom: 5px; }
.field label b { font-family: var(--font-mono); font-size: 13px; color: var(--ink); font-weight: 600; }
.field input[type="range"] { width: 100%; accent-color: var(--accent); cursor: pointer; margin: 0; }
.field input[type="number"] {
  width: 100%; font: inherit; font-family: var(--font-mono); font-size: 14px;
  padding: 7px 10px; border-radius: var(--radius-sm);
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink);
}
.field input[type="number"]:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: var(--accent); }
.field .hint { font-size: 12.5px; color: var(--ink-3); margin-top: 3px; }

.out-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.out {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 15px 17px;
}
.out.hero-out { border-color: #bfcaf5; background: linear-gradient(180deg, #fff, var(--accent-soft)); }
.out .lab { font-family: var(--font-mono); font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); }
.out .val { font-family: var(--font-display); font-size: 30px; font-weight: 600; letter-spacing: -.02em; line-height: 1.1; margin-top: 5px; }
.out.hero-out .val { color: var(--accent-ink); }
.out .sub { font-size: 12.5px; color: var(--ink-2); margin-top: 5px; line-height: 1.4; }

.stack { display: flex; height: 34px; border-radius: var(--radius-sm); overflow: hidden; border: 1px solid var(--line); margin-top: 6px; }
.stack div { display: grid; place-items: center; font-family: var(--font-mono); font-size: 11px; font-weight: 600; color: #fff; transition: flex-basis .25s ease; overflow: hidden; white-space: nowrap; }
.stack .s1 { background: var(--accent); }
.stack .s2 { background: #4f6ad9; }
.stack .s4 { background: #8494e8; }
.stack .s3 { background: var(--ok); }
.legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 12.5px; color: var(--ink-2); margin-top: 9px; }
.legend span { display: flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: block; }

/* Offsets quando existe a barra de progresso alem da topbar */
body.has-progress .content > section,
body.has-progress .block-head { scroll-margin-top: 122px; }
@media (min-width: 1000px) {
  body.has-progress .toc { top: 128px; max-height: calc(100vh - 150px); overflow-y: auto; }
}

.print-only { display: none; }
@media print {
  .topbar, .progress-bar, .toc, .btn { display: none !important; }
  .task.hidden { display: grid !important; }
  body { background: #fff; }
}
