:root {
  --paper: #f7f4ee;
  --surface: #fffdf9;
  --ink: #182437;
  --muted: #596579;
  --line: #d8d2c8;
  --navy: #183b63;
  --navy-dark: #102b49;
  --teal: #08786f;
  --teal-soft: #dff1ed;
  --red: #b44b42;
  --serif: Georgia, "Times New Roman", serif;
  --sans: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

button, input { font: inherit; }
a { color: inherit; }
.page-width { width: min(1120px, calc(100% - 40px)); margin-inline: auto; }

.masthead { border-bottom: 1px solid var(--line); background: rgba(247, 244, 238, .96); }
.masthead-inner { min-height: 68px; display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.masthead-title { font-family: var(--serif); font-weight: 700; text-decoration: none; letter-spacing: -.01em; }
.masthead-note { color: var(--muted); font-size: .8rem; letter-spacing: .08em; text-transform: uppercase; }

.hero { padding-top: clamp(48px, 6vw, 76px); padding-bottom: clamp(42px, 5vw, 62px); }
.eyebrow, .section-label, .footer-label, .result-kicker {
  margin: 0 0 12px;
  color: var(--teal);
  font-size: .76rem;
  font-weight: 750;
  letter-spacing: .11em;
  text-transform: uppercase;
}
.hero h1 {
  max-width: 850px;
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(3rem, 7vw, 5.6rem);
  font-weight: 500;
  letter-spacing: -.055em;
  line-height: .98;
}
.standfirst {
  max-width: 940px;
  margin: 26px 0 0;
  color: #334156;
  font-family: var(--serif);
  font-size: clamp(1.16rem, 2.1vw, 1.48rem);
  line-height: 1.48;
}
.hero-facts { display: flex; flex-wrap: wrap; gap: 10px 26px; margin: 22px 0 0; padding: 0; color: var(--muted); font-size: .9rem; list-style: none; }
.hero-facts li { display: flex; align-items: center; gap: 9px; }
.hero-facts li::before { width: 6px; height: 6px; border-radius: 50%; background: var(--teal); content: ""; }

.calculator-band { background: var(--surface); border-block: 1px solid var(--line); }
.calculator-grid { display: grid; grid-template-columns: minmax(0, 1.08fr) minmax(340px, .92fr); gap: clamp(40px, 6vw, 88px); padding-block: clamp(44px, 6vw, 76px); }
.calculator-form { min-width: 0; }
.section-heading { display: grid; grid-template-columns: 42px 1fr; gap: 14px; align-items: start; margin-bottom: 34px; }
.section-number { margin: 5px 0 0; color: var(--red); font-size: .8rem; font-weight: 800; letter-spacing: .08em; }
.section-heading h2, .prose-section h2, .clinical-note h2, .related h2 {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(1.75rem, 3vw, 2.65rem);
  font-weight: 500;
  letter-spacing: -.035em;
  line-height: 1.13;
}
.section-heading p:not(.section-number) { margin: 8px 0 0; color: var(--muted); }
.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.field label { display: block; margin-bottom: 8px; font-size: .88rem; font-weight: 750; }
.input-wrap { position: relative; }
.input-wrap input {
  width: 100%;
  height: 62px;
  padding: 0 58px 0 16px;
  border: 1px solid #9aa5b3;
  border-radius: 3px;
  outline: none;
  background: #fff;
  color: var(--ink);
  font-family: var(--serif);
  font-size: 1.42rem;
  font-weight: 700;
  transition: border-color .15s, box-shadow .15s;
}
.input-wrap input:focus { border-color: var(--navy); box-shadow: 0 0 0 3px rgba(24, 59, 99, .12); }
.input-wrap input[aria-invalid="true"] { border-color: var(--red); }
.input-wrap span { position: absolute; top: 50%; right: 16px; translate: 0 -50%; color: var(--muted); font-size: .88rem; font-weight: 700; }
.field-hint, .field-error { min-height: 1.4em; margin: 6px 0 0; color: var(--muted); font-size: .76rem; }
.field-error { color: #942f2b; font-weight: 700; }
.form-status { min-height: 1.5em; margin: 8px 0 4px; color: #942f2b; font-size: .86rem; }
.form-actions { display: flex; align-items: center; gap: 24px; }
.primary-button { min-height: 54px; padding: 0 30px; border: 0; border-radius: 3px; background: var(--navy); color: white; font-weight: 800; cursor: pointer; }
.primary-button:hover { background: var(--navy-dark); }
.primary-button:focus-visible, .text-button:focus-visible, summary:focus-visible, a:focus-visible { outline: 3px solid rgba(8, 120, 111, .35); outline-offset: 3px; }
.text-button { padding: 10px 0; border: 0; border-bottom: 1px solid var(--ink); background: transparent; color: var(--ink); font-weight: 700; cursor: pointer; }
.privacy-note { display: flex; gap: 10px; align-items: flex-start; margin: 24px 0 0; color: var(--muted); font-size: .78rem; line-height: 1.5; }
.privacy-note svg { width: 17px; flex: 0 0 auto; margin-top: 1px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.8; }

.calculator-result { min-height: 360px; border-left: 1px solid var(--line); padding-left: clamp(28px, 4vw, 58px); display: flex; align-items: center; }
.result-empty { max-width: 330px; }
.result-empty-title { margin: 0 0 4px; font-family: var(--serif); font-size: 1.55rem; font-weight: 700; }
.result-empty > p:last-child { margin: 0; color: var(--muted); }
.calculator-result:has(#result-card:not([hidden])) .result-empty { display: none; }
.result-card { width: 100%; }
.result-value { margin: 2px 0 0; color: var(--navy); font-family: var(--serif); font-size: clamp(3rem, 6vw, 4.8rem); font-weight: 600; letter-spacing: -.05em; line-height: 1; white-space: nowrap; }
.result-classification { display: inline-block; margin: 20px 0 0; padding: 7px 12px; border-radius: 999px; background: var(--teal-soft); color: #075c55; font-size: .88rem; font-weight: 800; }
.result-explanation { max-width: 430px; margin: 22px 0 0; color: var(--muted); font-size: .86rem; }
.bsa-details { margin-top: 28px; padding-top: 18px; border-top: 1px solid var(--line); }
.bsa-details summary { color: var(--navy); font-size: .88rem; font-weight: 800; cursor: pointer; }
.bsa-row { display: flex; justify-content: space-between; gap: 24px; align-items: end; margin-top: 18px; }
.bsa-row p { margin: 0; }
.bsa-row .result-kicker { margin-bottom: 4px; }
.bsa-row strong { color: var(--navy); font-family: var(--serif); font-size: 1.7rem; white-space: nowrap; }

.article-layout { display: grid; grid-template-columns: minmax(0, 760px) minmax(220px, 1fr); gap: clamp(50px, 8vw, 110px); padding-block: clamp(72px, 9vw, 124px); }
.article-main { min-width: 0; }
.prose-section { padding-bottom: clamp(54px, 7vw, 88px); }
.prose-section h2, .clinical-note h2 { margin-bottom: 24px; }
.prose-section > p:not(.section-label), .clinical-note > p:not(.section-label) { max-width: 700px; margin: 0 0 18px; color: #334156; font-family: var(--serif); font-size: 1.14rem; line-height: 1.75; }
.table-wrap { margin-top: 32px; overflow-x: auto; border-top: 2px solid var(--ink); border-bottom: 1px solid var(--ink); }
table { width: 100%; border-collapse: collapse; font-size: .94rem; }
th, td { padding: 15px 14px; border-bottom: 1px solid var(--line); text-align: left; }
thead th { color: var(--muted); font-size: .75rem; letter-spacing: .08em; text-transform: uppercase; }
tbody th { font-weight: 700; }
tbody tr:last-child th, tbody tr:last-child td { border-bottom: 0; }
tbody tr[aria-current="true"] { background: var(--teal-soft); }
.current-label { display: inline-block; margin-left: 8px; padding: 3px 8px; border-radius: 999px; background: var(--teal); color: white; font-size: .67rem; letter-spacing: .04em; text-transform: uppercase; }
.formula { display: flex; align-items: center; gap: 28px; margin: 30px 0; padding: 24px 0; border-block: 1px solid var(--line); }
.formula span { color: var(--red); font-size: .8rem; font-weight: 800; letter-spacing: .1em; }
.formula strong { font-family: var(--serif); font-size: clamp(1.45rem, 3vw, 2.15rem); font-weight: 500; }
.clinical-note { margin-bottom: clamp(60px, 8vw, 96px); padding: 34px 36px 20px; border-left: 4px solid var(--teal); background: #eaf3f0; }
.clinical-note h2 { font-size: clamp(1.7rem, 3vw, 2.35rem); }
.clinical-note > p:not(.section-label) { font-size: 1.04rem; }
.faq details { border-top: 1px solid var(--line); }
.faq details:last-child { border-bottom: 1px solid var(--line); }
.faq summary { position: relative; padding: 20px 38px 20px 0; font-weight: 750; cursor: pointer; list-style: none; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { position: absolute; right: 4px; content: "+"; color: var(--teal); font-size: 1.35rem; font-weight: 400; }
.faq details[open] summary::after { content: "−"; }
.faq details p { margin: -4px 0 22px; color: var(--muted); font-family: var(--serif); font-size: 1.02rem; }

.article-aside { position: relative; }
.aside-inner { position: sticky; top: 28px; padding-top: 18px; border-top: 3px solid var(--ink); }
.aside-title { margin: 0 0 10px; font-size: .78rem; font-weight: 800; letter-spacing: .09em; text-transform: uppercase; }
.aside-inner > p:not(.aside-title) { margin: 0 0 24px; color: var(--muted); font-family: var(--serif); }
.aside-inner dl { margin: 0 0 24px; }
.aside-inner dl div { display: flex; justify-content: space-between; gap: 16px; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: .78rem; }
.aside-inner dt { color: var(--muted); }
.aside-inner dd { margin: 0; font-weight: 700; }
.aside-inner a { color: var(--navy); font-size: .8rem; font-weight: 800; }

.related { padding-bottom: clamp(70px, 9vw, 118px); }
.related h2 { margin-bottom: 28px; }
.related ul { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0; margin: 0; padding: 0; border-block: 1px solid var(--line); list-style: none; }
.related li + li { border-left: 1px solid var(--line); }
.related a { display: block; min-height: 150px; padding: 22px 24px; font-family: var(--serif); font-size: 1.08rem; font-weight: 700; line-height: 1.4; text-decoration: none; }
.related a:hover { background: var(--surface); }
.related a span { display: block; margin-bottom: 22px; color: var(--teal); font-family: var(--sans); font-size: .69rem; font-weight: 800; letter-spacing: .09em; text-transform: uppercase; }

.editorial-footer { background: #152235; color: #ecf0f4; }
.footer-grid { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(44px, 8vw, 110px); padding-block: 60px; }
.footer-grid h2 { margin: 0 0 8px; font-family: var(--serif); font-size: 1.45rem; font-weight: 600; }
.footer-grid p { margin: 0; }
.footer-label { color: #81c9c1; }
.footer-muted { max-width: 510px; margin-top: 18px !important; color: #aeb8c5; font-size: .82rem; }
.footer-grid ol { margin: 18px 0 0; padding-left: 20px; color: #c8d0da; font-size: .82rem; }
.footer-grid li + li { margin-top: 8px; }
.footer-grid a:hover { color: white; }
.footer-credit { padding-block: 18px 26px; border-top: 1px solid #344258; color: #8f9baa; font-size: .72rem; }

@media (max-width: 820px) {
  .page-width { width: min(100% - 32px, 680px); }
  .masthead-inner { min-height: 58px; }
  .masthead-note { display: none; }
  .hero h1 { font-size: clamp(3.15rem, 16vw, 5.3rem); }
  .calculator-grid { grid-template-columns: 1fr; gap: 46px; }
  .calculator-result { min-height: 280px; border-left: 0; border-top: 1px solid var(--line); padding: 36px 0 0; }
  .article-layout { grid-template-columns: 1fr; }
  .article-aside { display: none; }
  .related ul { grid-template-columns: 1fr; }
  .related li + li { border-left: 0; border-top: 1px solid var(--line); }
  .related a { min-height: auto; }
  .footer-grid { grid-template-columns: 1fr; }
}

@media (max-width: 520px) {
  body { font-size: 15px; }
  .page-width { width: min(100% - 28px, 680px); }
  .hero { padding-top: 48px; }
  .standfirst { margin-top: 24px; font-size: 1.13rem; }
  .hero-facts { display: grid; gap: 7px; }
  .section-heading { grid-template-columns: 34px 1fr; }
  .field-grid { grid-template-columns: 1fr 1fr; gap: 12px; }
  .input-wrap input { height: 58px; padding-right: 42px; font-size: 1.18rem; }
  .input-wrap span { right: 11px; }
  .field-hint { font-size: .68rem; }
  .form-actions { gap: 18px; }
  .primary-button { flex: 1; padding-inline: 18px; }
  .clinical-note { margin-inline: -14px; padding: 28px 24px 14px; }
  th, td { padding: 13px 10px; }
  .current-label { display: block; width: fit-content; margin: 5px 0 0; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

/* Integração com os seletores preservados da calculadora publicada. */
#imc-form .input-wrap input {
  width: 100%;
  height: 62px;
  min-height: 0;
  padding: 0 58px 0 16px;
  border: 1px solid #9aa5b3;
  border-radius: 3px;
  background: #fff;
  color: var(--ink);
  font-family: var(--serif);
  font-size: 1.42rem;
  font-weight: 700;
}
#imc-form .input-wrap input:focus { border-color: var(--navy); box-shadow: 0 0 0 3px rgba(24, 59, 99, .12); }
#imc-form .input-wrap input[aria-invalid="true"] { border-color: var(--red); }
#calcular-btn.primary-button { background: var(--navy); color: #fff; }
#calcular-btn.primary-button:hover { background: var(--navy-dark); }
#result-card.result-card { width: 100%; padding: 0; border-radius: 0; background: transparent; color: var(--ink); display: block; }
#imc-value.result-value { color: var(--navy); font-family: var(--serif); font-size: clamp(3rem, 6vw, 4.8rem); font-weight: 600; line-height: 1; white-space: nowrap; }
#imc-classification.result-classification { display: inline-block; padding: 7px 12px; border-radius: 999px; background: var(--teal-soft); color: #075c55; font-size: .88rem; font-weight: 800; }
#imc-classification.result-classification::before { display: none; }
#bsa-value { color: var(--navy); font-family: var(--serif); font-size: 1.7rem; font-weight: 700; }
#faq.faq details { border-top: 1px solid var(--line); }
#faq.faq details:last-child { border-bottom: 1px solid var(--line); }
#faq.faq summary { min-height: 0; padding: 20px 38px 20px 0; color: var(--ink); font-size: 1rem; font-weight: 750; }
#faq.faq summary::after { width: auto; height: auto; background: none; -webkit-mask: none; mask: none; content: "+"; color: var(--teal); font-size: 1.35rem; font-weight: 400; }
#faq.faq details[open] summary::after { content: "−"; transform: none; }

.share-strip { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 18px 28px; padding-block: 24px; border-bottom: 1px solid var(--line); }
.share-strip[hidden] { display: none !important; }
.share-copy { margin: 0; font-family: var(--serif); font-size: 1.02rem; }
.share-strip .compartilhar-botoes { display: flex; flex-wrap: wrap; gap: 16px; }
.share-strip .compartilhar-botoes button { min-height: 0; padding: 7px 0; border: 0; border-bottom: 1px solid var(--ink); border-radius: 0; background: transparent; color: var(--ink); font-size: .78rem; font-weight: 800; cursor: pointer; }
.share-strip .compartilhar-botoes button:hover { background: transparent; color: var(--teal); border-bottom-color: var(--teal); }
.share-strip .compartilhar-botoes button:disabled { opacity: .55; cursor: wait; }
.share-strip .compartilhar-nota { grid-column: 1 / -1; margin: -8px 0 0; color: var(--muted); font-size: .72rem; }
.share-strip #compartilhar-status:not(:empty) { grid-column: 1 / -1; margin: -8px 0 0; color: var(--teal); font-size: .76rem; font-weight: 700; }
.share-strip #link-manual-imc { grid-column: 1 / -1; width: 100%; margin-top: -4px; padding: 10px; border: 1px solid var(--line); border-radius: 2px; background: #fff; color: var(--ink); font: inherit; font-size: .78rem; }

@media (max-width: 520px) {
  #imc-form .input-wrap input { height: 58px; padding-right: 42px; font-size: 1.18rem; }
  .share-strip { grid-template-columns: 1fr; align-items: flex-start; gap: 14px; }
  .share-strip .compartilhar-botoes, .share-strip .compartilhar-nota, .share-strip #compartilhar-status:not(:empty), .share-strip #link-manual-imc { grid-column: 1; }
  .share-strip .compartilhar-nota, .share-strip #compartilhar-status:not(:empty) { margin-top: 0; }
}
