/* =========================================================
   BellyDay — Pregnancy weight gain calculator
   Page-scoped additions only. Shared components live in assets/site.css.
   Loads after /assets/site.css.
   ========================================================= */

body.pwg {
  --ink-55: rgba(44, 27, 42, 0.68);
  background:
    radial-gradient(circle at 6% -8%, rgba(224, 138, 95, 0.13), transparent 42%),
    radial-gradient(circle at 100% 3%, rgba(184, 69, 95, 0.09), transparent 34%),
    var(--bone);
}

/* ---------- Breadcrumbs ---------- */

.crumbs {
  padding-top: 14px;
  font-size: 11.5px;
  color: var(--ink-55);
}

.crumbs ol { display: flex; flex-wrap: wrap; gap: 4px 8px; margin: 0; padding: 0; list-style: none; }
.crumbs li + li::before { content: "›"; margin-right: 8px; color: var(--ink-55); }
.crumbs a { color: inherit; }
.crumbs a:hover { color: var(--ink); }
.crumbs [aria-current="page"] { color: var(--ink-70); }

/* ---------- Hero ---------- */

.pwg .hero {
  padding-top: clamp(18px, 2.6vw, 34px);
  padding-bottom: clamp(14px, 2vw, 24px);
}

.pwg .hero h1 {
  max-width: none;
  font-size: clamp(34px, 4.6vw, 52px);
}

.pwg .hero__lede { max-width: 68ch; font-size: clamp(14px, 1.5vw, 17px); }

.pwg .hero__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 7px 20px;
  margin-top: 14px;
  font-size: 12.5px;
  color: var(--ink-55);
}

.pwg .hero__meta span { display: inline-flex; align-items: center; gap: 7px; }
.pwg .hero__meta span::before {
  content: "";
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--apricot);
}
.pwg .hero__meta span:first-child::before { display: none; }
.pwg .hero__meta time { font-variant-numeric: tabular-nums; }

/* ---------- Tool card ---------- */

.pwg-tool { padding-bottom: 8px; grid-template-columns: minmax(0, 1fr); }

.pwg-panel {
  max-width: 900px;
  margin-inline: auto;
  padding: clamp(18px, 2.6vw, 34px);
  border: 1px solid var(--line-strong);
  background: var(--paper);
  box-shadow: 6px 6px 0 var(--rose-tint);
}

.pwg-head__title {
  font-family: var(--font-display);
  font-size: clamp(21px, 2.6vw, 29px);
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.pwg-head__sub {
  margin-top: 6px;
  max-width: 62ch;
  font-size: 13px;
  color: var(--ink-70);
}

/* Unit toggle: real radios, so it is keyboard operable and labelled. */
.pwg-units { margin: 18px 0 0; padding: 0; border: 0; }
.pwg-units legend { padding: 0; font-size: 12px; font-weight: 600; color: var(--ink-70); }
.pwg-units__opts { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.pwg-units__opts label { position: relative; }
.pwg-units__opts input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}
.pwg-units__opts span {
  display: inline-block;
  padding: 8px 14px;
  border: 1px solid var(--line-strong);
  background: #fffdf8;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
}
.pwg-units__opts input:checked + span {
  border-color: var(--rose);
  background: var(--rose-tint);
  color: var(--rose-deep);
  font-weight: 600;
}
.pwg-units__opts input:focus-visible + span { outline: 3px solid var(--rose); outline-offset: 2px; }

.pwg-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px 18px;
  margin-top: 18px;
}

/* :not([hidden]) matters: a bare `.pwg-fields > div` has higher specificity
   than [hidden] and would otherwise render the inactive unit group. */
.pwg-fields > div:not([hidden]) { display: grid; gap: 16px; align-content: start; }
.pwg-fields > .field { grid-column: 1 / -1; }

.pwg-fields .field__hint { font-size: 11.5px; }
.pwg-fields .field__hint a { color: var(--rose-deep); text-decoration: underline; text-underline-offset: 2px; }
.pwg-fields .field--optional > label span { color: var(--ink-55); font-weight: 400; }

.pwg-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.pwg-pair .field__control { height: 46px; }
.pwg-pair .field__control input { padding: 0 10px; }
.pwg-pair .field__suffix { padding-right: 10px; }

.pwg-twins {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  margin-top: 16px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  background: rgba(255, 253, 248, 0.7);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
}
.pwg-twins input { margin-top: 3px; accent-color: var(--rose); }
.pwg-twins__note { color: var(--ink-55); font-weight: 400; }

.pwg-actions { margin-top: 16px; }
.pwg-actions .btn { min-height: 46px; }

/* ---------- Result ---------- */

.pwg-empty {
  margin-top: 18px;
  padding: 12px 14px;
  border-left: 3px solid var(--apricot);
  background: var(--apricot-soft);
  font-size: 13px;
  color: var(--ink-70);
}

.pwg-result { margin-top: 18px; }
.pwg-summary { display: grid; gap: 4px; }
.pwg-line { font-size: 14px; line-height: 1.5; }
.pwg-line--lead {
  padding: 12px 14px;
  border: 1px solid var(--line-strong);
  background: var(--rose-tint);
  font-family: var(--font-display);
  font-size: clamp(18px, 2.2vw, 23px);
  font-weight: 600;
  letter-spacing: -0.015em;
}
.pwg-line--bmi {
  white-space: nowrap;
}
.pwg-line--bmi-underweight,
.pwg-line--bmi-overweight {
  border-color: #d8ba45;
  background: #fff3c9;
  color: #5c4500;
}
.pwg-line--bmi-healthy {
  border-color: #8fc6a2;
  background: #e4f4e9;
  color: #17512d;
}
.pwg-line--bmi-obesity {
  border-color: #df9292;
  background: #fde5e5;
  color: #762020;
}
.pwg-line--gain { font-weight: 600; color: var(--rose-deep); }
.pwg-line--note { font-size: 12.5px; color: var(--ink-70); }

.pwg-twin-note,
.pwg-context {
  margin-top: 10px;
  padding: 10px 12px;
  border-left: 3px solid var(--rose);
  background: var(--rose-tint);
  font-size: 13px;
  color: var(--ink-70);
}

/* ---------- Chart ---------- */

.pwg-chart { margin-top: 24px; }
.pwg-chart__scroll { overflow-x: auto; border: 1px solid var(--line); background: #fffdf8; }
.pwg-chart__scroll svg { display: block; width: 100%; min-width: 520px; height: auto; }
.pwg-chart figcaption { margin-top: 8px; font-size: 12px; line-height: 1.5; color: var(--ink-55); }
.pwg-chart__grid { stroke: var(--line); stroke-width: 1; }
.pwg-chart__tick { fill: var(--ink-70); font-family: var(--font-ui); font-size: 12px; }
.pwg-chart__axis { fill: var(--ink-70); font-family: var(--font-ui); font-size: 12px; font-weight: 600; }
.pwg-chart__band { fill: rgba(184, 69, 95, 0.16); stroke: rgba(184, 69, 95, 0.4); stroke-width: 1; }
.pwg-chart__point { fill: var(--apricot); stroke: var(--ink); stroke-width: 2; }

.pwg-chart__details { margin-top: 10px; font-size: 13px; }
.pwg-chart__details summary { cursor: pointer; color: var(--rose-deep); font-weight: 600; }
.pwg-chart__details table { width: 100%; margin-top: 10px; border-collapse: collapse; font-size: 13px; }
.pwg-chart__details caption { text-align: left; padding-bottom: 6px; color: var(--ink-55); }
.pwg-chart__details th,
.pwg-chart__details td { padding: 6px 8px; border-bottom: 1px solid var(--line); text-align: left; }

/* ---------- Caveat, noscript, privacy ---------- */

.pwg-does-not {
  margin-top: 22px;
  padding: 14px 16px;
  border: 1px solid var(--line-strong);
  background: var(--bone-deep);
}
.pwg-does-not h3 { font-family: var(--font-display); font-size: 17px; font-weight: 600; }
.pwg-does-not p { margin-top: 6px; font-size: 13px; line-height: 1.6; color: var(--ink-70); }

.pwg-noscript {
  margin-top: 14px;
  padding: 10px 12px;
  border-left: 3px solid var(--rose);
  background: var(--rose-tint);
  font-size: 13px;
}

.pwg-privacy { margin-top: 16px; font-size: 12px; line-height: 1.5; color: var(--ink-55); }
.pwg-privacy strong { color: var(--ink); }

/* ---------- Print-only summary ---------- */

.pwg-print { display: none; }

/* ---------- Pillar table and diagram ---------- */

.pwg .section__head { max-width: none; }
.pwg .section h2 { font-size: clamp(24px, 2.6vw, 34px); }
.pwg .section__lede { max-width: 74ch; }

.pwg-table-scroll { overflow-x: auto; margin: 18px 0; border: 1px solid var(--line); }
.pwg-table { width: 100%; border-collapse: collapse; font-size: 13px; font-variant-numeric: tabular-nums; }
.pwg-table caption { padding: 10px 12px; text-align: left; font-weight: 600; background: var(--bone-deep); }
.pwg-table th,
.pwg-table td { padding: 9px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.pwg-table thead th { font-size: 12px; color: var(--ink-70); background: rgba(255, 253, 248, 0.6); }
.pwg-table tbody tr:last-child td { border-bottom: 0; }

.pwg-figure { margin-top: 20px; }
.pwg-figure__scroll { overflow-x: auto; border: 1px solid var(--line); background: #fffdf8; }
.pwg-figure__scroll svg { display: block; width: 100%; min-width: 520px; height: auto; }
.pwg-figure figcaption { margin-top: 8px; font-size: 12px; line-height: 1.5; color: var(--ink-55); }
.pwg-fig__axis { stroke: var(--line-strong); stroke-width: 1; }
.pwg-fig__band { fill: rgba(184, 69, 95, 0.16); stroke: rgba(184, 69, 95, 0.4); stroke-width: 1; }
.pwg-fig__point { fill: var(--apricot); stroke: var(--ink); stroke-width: 1.5; }
.pwg-fig__tick { fill: var(--ink-70); font-family: var(--font-ui); font-size: 13px; }
.pwg-fig__label { fill: var(--ink-70); font-family: var(--font-ui); font-size: 12px; font-weight: 600; }

/* ---------- Mobile ---------- */

@media (max-width: 760px) {
  .pwg-fields { grid-template-columns: 1fr; gap: 14px; }
  .pwg-fields > .field { grid-column: auto; }
  .pwg-fields > div:not([hidden]) { gap: 14px; }
}

/* The brief requires the first input AND the first result line above the fold
   at 390×844. On a phone that means: short lede, one-line meta, no repeated
   tool subtitle, two columns of fields, and help text kept for screen readers
   but out of the visual rush. Error text always stays visible. */
@media (max-width: 560px) {
  .pwg .crumbs { padding-top: 10px; }
  .pwg .hero { padding-top: 10px; padding-bottom: 6px; }
  .pwg .hero h1 { font-size: 32px; line-height: 1.1; }
  .pwg .hero__lede { margin-top: 10px; font-size: 13px; line-height: 1.45; }
  .pwg .hero__meta {
    margin-top: 8px;
    gap: 4px 10px;
    font-size: 11px;
  }
  .pwg .hero__meta span::before { display: none; }

  .pwg-panel { padding: 12px; box-shadow: 4px 4px 0 var(--rose-tint); }
  .pwg-head__title { font-size: 20px; }
  .pwg-head__sub { display: none; }
  .pwg .section h2 { font-size: 22px; }

  .pwg-units { margin-top: 10px; }
  .pwg-units legend { font-size: 11px; }
  .pwg-units__opts { margin-top: 6px; }
  .pwg-units__opts span { padding: 6px 12px; }

  /* Let the inner field containers participate in the outer two-column grid,
     while the inactive unit group stays properly hidden. */
  .pwg-fields { grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 10px; }
  .pwg-fields > div:not([hidden]) { display: contents; }
  .pwg-fields .field,
  .pwg-fields > .field { grid-column: auto; min-width: 0; }
  .pwg-fields label { font-size: 12px; }
  .pwg-fields .field__control { height: 44px; }
  .pwg-pair { gap: 5px; }
  .pwg-pair .field__control { height: 44px; }

  /* Keep hints in the accessibility tree (aria-describedby still points at
     them) but stop them consuming the fold. Errors are never hidden. */
  .pwg-fields .field__hint {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
  }
  .pwg-fields .field__error { font-size: 11px; }

  .pwg-twins {
    margin-top: 10px;
    padding: 8px 10px;
    font-size: 12px;
  }
  .pwg-twins__note {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
  }
  .pwg-actions { margin-top: 10px; }
  .pwg-actions .btn { min-height: 44px; }

  .pwg-empty { margin-top: 12px; padding: 9px 11px; }
  .pwg-result { margin-top: 10px; }
  .pwg-line--lead { font-size: 16px; padding: 8px 11px; }
  .pwg-chart figcaption { font-size: 11.5px; }
}

/* ---------- Print: summary, band table and caveats only ---------- */

@media print {
  body.pwg { background: #fff; }
  .masthead, .crumbs, .skip, .reviewstrip, .pwg-tool, .faq,
  .footer, .dock, .pwg-print-ad, .section--hide-print { display: none !important; }
  #main { padding-top: 0; }
  .pwg-print {
    display: block;
    color: #000;
    font-size: 12pt;
    line-height: 1.45;
  }
  .pwg-print h2 { font-family: Georgia, serif; font-size: 18pt; margin-bottom: 10pt; }
  .pwg-print p { margin: 0 0 6pt; }
  .pwg-print table { width: 100%; border-collapse: collapse; margin-top: 10pt; font-size: 10pt; }
  .pwg-print caption { text-align: left; font-weight: bold; margin-bottom: 4pt; }
  .pwg-print th, .pwg-print td { border: 1px solid #000; padding: 4pt 6pt; text-align: left; }
}
