/* PHEVCalc V2.0 — CSS próprio (substitui o Tailwind via CDN). Tema escuro, mobile-first. */

:root {
  color-scheme: dark;
  --bg: #020617;
  --card: #0f172a;
  --card-2: #0b1220;
  --line: #1e293b;
  --line-2: #334155;
  --text: #f1f5f9;
  --muted: #a3b1c6;
  --faint: #7c8ba1;
  --emerald: #34d399;
  --emerald-strong: #059669;
  --emerald-hover: #10b981;
  --amber: #fbbf24;
  --rose: #fb7185;
  --radius: 16px;
  --font: Inter, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; } /* garante que "hidden" vença regras como display:grid */
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.55;
}
main { flex: 1 0 auto; }
a { color: var(--emerald); text-underline-offset: 3px; }
a:hover { color: #6ee7b7; }
img, svg { max-width: 100%; }
h1, h2, h3 { line-height: 1.2; margin: 0; }
p { margin: 0 0 1em; }

:focus-visible { outline: 2px solid var(--emerald); outline-offset: 2px; border-radius: 6px; }
.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;
}
.skip-link {
  position: absolute; left: 8px; top: -48px; z-index: 100;
  background: var(--emerald-strong); color: #fff; padding: 8px 14px; border-radius: 8px; text-decoration: none;
}
.skip-link:focus { top: 8px; }

.container { width: 100%; max-width: 64rem; margin: 0 auto; padding: 0 16px; }

/* ---------- Topo ---------- */
.topbar { border-bottom: 1px solid var(--line); }
.topbar .container { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-top: 14px; padding-bottom: 14px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 8px; text-decoration: none; }
.brand-name { color: var(--emerald); font-size: 1.5rem; font-weight: 900; letter-spacing: -0.02em; }
.brand-tag {
  font-size: 0.6875rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em;
  background: var(--line); color: var(--muted); border: 1px solid var(--line-2);
  padding: 2px 8px; border-radius: 999px;
}
.nav { display: flex; gap: 4px 18px; flex-wrap: wrap; font-size: 0.9375rem; }
.nav a { color: var(--muted); text-decoration: none; padding: 4px 0; }
.nav a:hover, .nav a[aria-current="page"] { color: var(--emerald); }

/* ---------- Linha de navegação das calculadoras ---------- */
.crumbs { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin: 20px 0 18px; font-size: 0.875rem; font-weight: 600; }
.crumbs a { text-decoration: none; }
.crumbs .back { color: var(--muted); }
.crumbs .back:hover { color: var(--emerald); }
.crumbs .cross:hover { text-decoration: underline; }

/* ---------- Cabeçalho da página ---------- */
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; padding-bottom: 20px; margin-bottom: 24px; border-bottom: 1px solid var(--line); }
.page-head h1 { font-size: clamp(1.5rem, 4.5vw, 2rem); font-weight: 800; letter-spacing: -0.01em; }
.page-head .lead { color: var(--muted); margin: 6px 0 0; max-width: 40rem; font-size: 0.9375rem; }
.badge {
  display: inline-block; margin-bottom: 8px;
  background: rgba(16,185,129,.1); color: var(--emerald); border: 1px solid rgba(16,185,129,.25);
  padding: 2px 10px; border-radius: 999px; font-size: 0.8125rem; font-weight: 600;
}
.actions { display: flex; gap: 8px; flex-wrap: wrap; }

.btn {
  font: inherit; font-size: 0.9375rem; font-weight: 600; cursor: pointer;
  background: var(--emerald-strong); color: #fff; border: 1px solid transparent;
  padding: 10px 16px; border-radius: 12px; transition: background .15s;
}
.btn:hover { background: var(--emerald-hover); }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--line-2); }
.btn-ghost:hover { background: var(--line); }

/* ---------- Grade da calculadora ---------- */
.calc-grid { display: grid; gap: 24px; grid-template-columns: 1fr; padding-bottom: 8px; }
@media (min-width: 1024px) {
  .calc-grid { grid-template-columns: 7fr 5fr; gap: 32px; align-items: start; }
  .calc-results { position: sticky; top: 16px; }
}
.stack { display: grid; gap: 20px; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: 0 10px 30px rgba(0,0,0,.25); }
.card > h2, .card-title { font-size: 1rem; font-weight: 700; color: #e2e8f0; margin-bottom: 16px; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.card-title.green { color: var(--emerald); }
.card-title.amber { color: var(--amber); }

.fields { display: grid; gap: 16px; grid-template-columns: 1fr; }
@media (min-width: 640px) {
  .fields.two { grid-template-columns: 1fr 1fr; }
  .fields.three { grid-template-columns: 1fr 1fr 1fr; }
}
.field-box { background: var(--bg); border: 1px solid var(--line); border-radius: 12px; padding: 14px; }

label, .label { display: block; font-size: 0.8125rem; font-weight: 600; color: var(--muted); margin-bottom: 6px; }
.label.green { color: var(--emerald); }
.label.amber { color: var(--amber); }

.input-row { display: flex; gap: 8px; }
input[type="text"], select {
  font: inherit; font-size: 1rem; /* 16px evita zoom automático no iOS */
  color: var(--text); background: var(--card-2); border: 1px solid var(--line-2);
  border-radius: 10px; padding: 10px 12px; width: 100%; min-width: 0;
}
input[type="text"] { font-weight: 700; }
select { width: auto; flex: 0 0 auto; font-size: 0.875rem; background: var(--line); padding: 10px 8px; }
input[aria-invalid="true"] { border-color: var(--rose); }
.field-hint { font-size: 0.8125rem; color: var(--faint); margin: 6px 0 0; }
.field-error { font-size: 0.8125rem; color: var(--rose); margin: 6px 0 0; }
.form-error, .notice {
  border-radius: 12px; padding: 12px 14px; font-size: 0.875rem; margin: 0 0 16px;
}
.form-error { background: rgba(251,113,133,.1); border: 1px solid rgba(251,113,133,.35); color: #fecdd3; }
.notice { background: rgba(251,191,36,.08); border: 1px solid rgba(251,191,36,.3); color: #fde68a; }
.notice ul { margin: 0; padding-left: 18px; }

/* Seletor de método (rádios) */
.segmented { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; background: var(--bg); border: 1px solid var(--line); border-radius: 12px; padding: 4px; }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented label {
  margin: 0; text-align: center; padding: 9px 8px; border-radius: 9px; cursor: pointer;
  color: var(--muted); font-size: 0.875rem; font-weight: 600;
}
.segmented input:checked + label { background: var(--emerald-strong); color: #fff; }
.segmented input:focus-visible + label { outline: 2px solid var(--emerald); outline-offset: 2px; }
.method-note { font-size: 0.8125rem; color: var(--muted); margin: 10px 0 0; }

/* ---------- Resultados ---------- */
.result-card {
  background: linear-gradient(135deg, rgba(2,44,34,.75), var(--card) 55%);
  border: 1px solid rgba(16,185,129,.4);
  border-radius: var(--radius); padding: 24px; box-shadow: 0 18px 45px rgba(0,0,0,.4);
}
.result-title { font-size: 0.75rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; color: var(--emerald); display: block; }
.result-method { font-size: 0.8125rem; color: var(--muted); margin-top: 2px; display: block; }
.hero { margin: 14px 0 6px; display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.hero-num { font-size: clamp(2.5rem, 9vw, 3.25rem); font-weight: 900; line-height: 1; }
.hero-unit { font-size: 1.125rem; font-weight: 700; color: var(--emerald); }
.hero-alt { color: var(--muted); font-size: 0.875rem; margin: 0; }
.hero-alt strong { color: #e2e8f0; }
.hero-other { color: var(--faint); font-size: 0.8125rem; margin: 6px 0 0; }
.unit-select { margin: 0 0 4px auto; }
.result-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }

.breakdown { background: rgba(2,6,23,.8); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; font-size: 0.875rem; margin: 16px 0; display: grid; gap: 6px; }
.breakdown .row { display: flex; justify-content: space-between; gap: 12px; color: #cbd5e1; }
.breakdown .row.green { color: var(--emerald); }
.breakdown .row.total { border-top: 1px solid var(--line); padding-top: 8px; font-weight: 800; color: #fff; }
.breakdown .val { font-weight: 600; text-align: right; }

.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; padding-top: 16px; border-top: 1px solid var(--line); }
.stat { background: rgba(2,6,23,.6); border: 1px solid var(--line); border-radius: 12px; padding: 12px; }
.stat .k { display: block; color: var(--muted); font-size: 0.8125rem; }
.stat .v { display: block; font-size: 1.125rem; font-weight: 800; }

.compare { font-size: 0.875rem; display: grid; gap: 10px; }
.compare h3 { font-size: 0.8125rem; font-weight: 800; text-transform: uppercase; color: #cbd5e1; letter-spacing: .04em; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.compare .row { display: flex; justify-content: space-between; gap: 12px; color: var(--muted); }
.compare .row b { color: var(--text); }
.compare .rose { color: var(--rose) !important; }
.compare .green { color: var(--emerald) !important; }
.saving { background: rgba(2,44,34,.45); border: 1px solid rgba(16,185,129,.25); border-radius: 12px; padding: 12px; margin-top: 4px; }
.saving.negative { background: rgba(76,5,25,.35); border-color: rgba(251,113,133,.3); }
.saving .big { display: flex; justify-content: space-between; gap: 12px; font-weight: 800; color: #6ee7b7; font-size: 1rem; }
.saving.negative .big { color: #fda4af; }
.saving .small { display: block; text-align: right; color: #34d399; opacity: .85; font-size: 0.8125rem; margin-top: 4px; }
.saving.negative .small { color: #fb7185; }

.single { background: var(--bg); border: 1px solid var(--line); border-radius: 12px; padding: 12px; }
.single .top { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 4px; }
.single .top .t { font-size: 0.875rem; font-weight: 700; }
.single .top .t.green { color: var(--emerald); }
.single .top .t.amber { color: var(--amber); }
.single select { font-size: 0.8125rem; padding: 6px 8px; }
.single .num { font-size: 1.375rem; font-weight: 800; }
.single .num span { font-size: 0.8125rem; font-weight: 400; color: var(--muted); }
.single .sub { font-size: 0.8125rem; color: var(--faint); }

.empty { color: var(--muted); font-size: 0.9375rem; }

/* ---------- Conteúdo explicativo ---------- */
.content { padding: 40px 0 24px; }
.content .prose { max-width: 46rem; }
.content h2 { font-size: 1.375rem; font-weight: 800; margin: 36px 0 12px; letter-spacing: -0.01em; }
.content h2:first-child { margin-top: 0; }
.content h3 { font-size: 1.0625rem; font-weight: 700; margin: 22px 0 8px; }
.content p, .content li { color: #cbd5e1; }
.content ul, .content ol { padding-left: 22px; margin: 0 0 1em; }
.content li { margin-bottom: 6px; }
.formula {
  background: var(--card); border: 1px solid var(--line); border-left: 3px solid var(--emerald);
  border-radius: 10px; padding: 12px 16px; margin: 12px 0 16px; font-size: 0.9375rem; color: #e2e8f0; overflow-x: auto;
}
.example { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; margin: 12px 0 16px; font-size: 0.9375rem; }
.example p:last-child { margin-bottom: 0; }
.table-wrap { overflow-x: auto; margin: 12px 0 18px; }
table { border-collapse: collapse; width: 100%; font-size: 0.9375rem; }
th, td { text-align: left; padding: 8px 12px; border-bottom: 1px solid var(--line); color: #cbd5e1; }
th { color: var(--text); font-weight: 700; background: var(--card); }
details { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 0 16px; margin-bottom: 10px; }
summary { cursor: pointer; font-weight: 700; padding: 14px 0; list-style-position: outside; }
details[open] summary { border-bottom: 1px solid var(--line); margin-bottom: 12px; }
details p { color: #cbd5e1; }
.disclaimer { font-size: 0.875rem; color: var(--faint); }

/* Espaço reservado para anúncios: oculto até a rede de anúncios ser aprovada */
.ad-slot { display: none; margin: 28px auto; text-align: center; min-height: 100px; }
.ad-slot[data-active="true"] { display: block; }

/* ---------- Home ---------- */
.hero-home { text-align: center; padding: 56px 0 32px; }
.hero-home h1 { font-size: clamp(2rem, 6vw, 3.25rem); font-weight: 900; letter-spacing: -0.02em; margin-top: 14px; }
.hero-home p { color: var(--muted); max-width: 36rem; margin: 14px auto 0; font-size: 1.0625rem; }
.tool-grid { display: grid; gap: 20px; margin-top: 32px; text-align: left; }
@media (min-width: 768px) { .tool-grid { grid-template-columns: 1fr 1fr; gap: 24px; } }
.tool-card { display: block; text-decoration: none; color: inherit; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; transition: border-color .15s, transform .15s; }
.tool-card:hover { border-color: rgba(16,185,129,.5); transform: translateY(-2px); }
.tool-icon { width: 48px; height: 48px; display: flex; align-items: center; justify-content: center; font-size: 1.5rem; background: rgba(16,185,129,.1); border: 1px solid rgba(16,185,129,.25); border-radius: 12px; margin-bottom: 16px; }
.tool-card h2 { font-size: 1.25rem; font-weight: 700; color: #fff; }
.tool-card:hover h2 { color: var(--emerald); }
.tool-card p { color: var(--muted); font-size: 0.9375rem; margin: 8px 0 0; }
.tool-card .go { display: inline-block; margin-top: 16px; font-weight: 600; font-size: 0.9375rem; color: var(--emerald); }

/* ---------- Rodapé ---------- */
.footer { border-top: 1px solid var(--line); margin-top: 48px; padding: 24px 0; font-size: 0.875rem; color: var(--faint); }
.footer .container { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px 24px; }
.footer nav { display: flex; flex-wrap: wrap; gap: 6px 18px; }
.footer a, .footer button.linklike { color: var(--muted); text-decoration: none; background: none; border: 0; padding: 0; font: inherit; cursor: pointer; }
.footer a:hover, .footer button.linklike:hover { color: var(--emerald); text-decoration: underline; }

/* ---------- Banner de consentimento ---------- */
.consent {
  position: fixed; left: 12px; right: 12px; bottom: 12px; z-index: 50; max-width: 40rem; margin: 0 auto;
  background: var(--card); border: 1px solid var(--line-2); border-radius: 14px; padding: 16px;
  box-shadow: 0 20px 50px rgba(0,0,0,.6); font-size: 0.875rem;
}
.consent p { margin: 0 0 12px; color: #cbd5e1; }
.consent .btns { display: flex; gap: 8px; flex-wrap: wrap; }
.consent[hidden] { display: none; }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; scroll-behavior: auto !important; }
}

/* ---------- V2.1: idiomas, região e unidades ---------- */
.nav-wrap { display: flex; align-items: center; gap: 8px 20px; flex-wrap: wrap; }
.lang-switch { display: flex; gap: 2px; font-size: 0.8125rem; }
.lang-switch a { color: var(--muted); text-decoration: none; padding: 3px 8px; border: 1px solid var(--line); border-radius: 6px; }
.lang-switch a + a { margin-left: 4px; }
.lang-switch a:hover { color: var(--emerald); border-color: var(--emerald); }
.lang-switch a[aria-current="true"] { color: var(--emerald); border-color: var(--emerald); font-weight: 600; }

.lang-suggest { background: #0b1220; border-bottom: 1px solid var(--line); font-size: 0.875rem; color: #cbd5e1; padding: 8px 0; }
.lang-suggest[hidden] { display: none; }
.lang-suggest .container { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; }
.lang-suggest a { color: var(--emerald); font-weight: 600; }
.lang-suggest button.linklike { background: none; border: 0; padding: 0; font: inherit; color: var(--muted); cursor: pointer; text-decoration: underline; }

.settings { margin-bottom: 16px; }
.settings h2 { margin-bottom: 12px; }
.settings-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px 16px; }
.settings-row select { width: 100%; }
@media (max-width: 720px) { .settings-row { grid-template-columns: 1fr; } }
