.calorie-page {
  --calc-coral: #cc7770;
  --calc-cream: #f6f1e7;
  --calc-paper: #fffdf8;
  --calc-ink: #171714;
  --calc-wine: #471014;
}

.calorie-hero {
  padding-block: clamp(4.5rem, 9vw, 8rem) clamp(3.5rem, 7vw, 6rem);
}

.calorie-hero .back-link { margin-bottom: clamp(3rem, 6vw, 5rem); }

.calorie-hero__grid {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(19rem, .58fr);
  align-items: end;
  gap: clamp(3rem, 8vw, 8rem);
}

.calorie-hero h1 {
  max-width: 11.5ch;
  margin-bottom: 0;
  font-size: clamp(3.35rem, 6.9vw, 6.7rem);
}

.calorie-hero__lead {
  padding-top: 1.25rem;
  border-top: .24rem solid var(--red);
  color: var(--body-ink);
}

.calorie-hero__lead > p:first-child { font-size: clamp(1rem, 1.3vw, 1.12rem); }

.calorie-hero__proof {
  margin: 1.8rem 0 0;
  color: var(--muted);
  font-size: .78rem;
  line-height: 1.55;
}

.calorie-hero__proof strong {
  display: block;
  color: var(--ink);
}

.calculator-responsibility {
  margin: 1.1rem 0 0;
  color: var(--muted);
  font-size: .76rem;
}
.calculator-responsibility a { color: var(--red-dark); font-weight: 700; }

.scope-strip {
  border-block: 1px solid rgba(255, 253, 248, .16);
  background: var(--calc-wine);
  color: var(--white);
}

.scope-strip__grid {
  display: grid;
  grid-template-columns: minmax(10rem, .3fr) minmax(0, 1fr);
  gap: clamp(2rem, 6vw, 6rem);
  padding-block: clamp(2rem, 4vw, 3.25rem);
}

.scope-strip__label {
  margin: 0;
  color: #e7c7b8;
  font-family: var(--ui);
  font-size: .72rem;
  font-weight: 750;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.scope-strip__grid div { max-width: 60rem; }
.scope-strip__grid p { margin-bottom: .65rem; color: #f2e6df; }
.scope-strip__grid p:last-child { margin-bottom: 0; color: #d9c7c0; font-size: .83rem; }

.calculator-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(25rem, .72fr);
  align-items: start;
  margin-block: clamp(3rem, 7vw, 6.5rem);
  border: 1px solid var(--border-strong);
  background: var(--calc-paper);
}

.calorie-form {
  min-width: 0;
  padding: clamp(1.4rem, 4vw, 3.75rem);
  border-right: 1px solid var(--border-strong);
}

.calorie-form__header {
  max-width: 43rem;
  margin-bottom: clamp(3.5rem, 7vw, 6rem);
}

.calorie-form__header h2 {
  max-width: 12ch;
  font-size: clamp(2.6rem, 4.5vw, 4.35rem);
}

.calorie-form__header > p:last-child { max-width: 39rem; color: var(--muted); }

.form-error-summary {
  margin: 0 0 2.5rem;
  padding: 1rem 1.15rem;
  border-left: .25rem solid var(--red);
  background: #f1dedb;
  color: var(--red-dark);
}

.form-error-summary p { margin: .2rem 0 0; }

.calorie-step {
  padding: 0 0 clamp(3.5rem, 7vw, 5.5rem);
  margin: 0 0 clamp(3.5rem, 7vw, 5.5rem);
  border: 0;
  border-bottom: 1px solid var(--border);
}

.calorie-step > legend {
  width: 100%;
  padding: 0;
  margin-bottom: 2rem;
  color: var(--ink);
  font-family: var(--display);
  font-size: clamp(1.75rem, 3vw, 2.45rem);
  font-stretch: 88%;
  font-weight: 580;
  letter-spacing: -.035em;
  line-height: 1;
}

.calorie-step > legend span {
  display: inline-block;
  min-width: 3rem;
  margin-right: .6rem;
  color: var(--red);
  font-family: var(--ui);
  font-size: .72rem;
  font-stretch: 100%;
  font-weight: 760;
  letter-spacing: .08em;
  vertical-align: .3em;
}

.step-intro {
  max-width: 40rem;
  margin: -1rem 0 2rem;
  color: var(--muted);
  font-size: .9rem;
}

.field-grid { display: grid; gap: 1.4rem; }
.field-grid--two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.field-grid--three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.field--wide { grid-column: 1 / -1; }

.field label,
.nested-fieldset > legend,
.activity-proposal > legend {
  display: block;
  padding: 0;
  margin-bottom: .5rem;
  color: var(--ink);
  font-family: var(--ui);
  font-size: .78rem;
  font-weight: 720;
  line-height: 1.4;
}

.field label span,
.activity-proposal > legend span {
  color: var(--muted);
  font-weight: 520;
}

.field input,
.field select {
  width: 100%;
  min-height: 3.3rem;
  padding: .82rem .9rem;
  border: 1px solid var(--border-strong);
  border-radius: 0;
  background: transparent;
  color: var(--ink);
  font-family: var(--ui);
}

.field select { appearance: auto; }

.field input:hover,
.field select:hover { border-color: var(--ink); }

.field input:focus,
.field select:focus { border-color: var(--red); }

.field input:disabled,
.field select:disabled {
  border-color: var(--border);
  background: var(--paper-deep);
  color: var(--muted);
  cursor: not-allowed;
}

.field-input { position: relative; }
.field-input input { padding-right: 4.5rem; }
.field-input > span {
  position: absolute;
  top: 50%;
  right: .85rem;
  color: var(--muted);
  font-family: var(--ui);
  font-size: .68rem;
  font-weight: 650;
  pointer-events: none;
  transform: translateY(-50%);
}

.field small,
.field-help {
  display: block;
  margin-top: .45rem;
  color: var(--muted);
  font-size: .69rem;
  line-height: 1.48;
}

.field .field-check {
  display: flex;
  align-items: flex-start;
  gap: .55rem;
  margin: .75rem 0 0;
  color: var(--body-ink);
  cursor: pointer;
  font-size: .7rem;
  font-weight: 520;
}
.field .field-check input {
  width: 1rem;
  height: 1rem;
  min-height: 0;
  flex: 0 0 auto;
  padding: 0;
  margin: .12rem 0 0;
  accent-color: var(--red);
}

.training-dependency-help {
  margin: .8rem 0 0;
  color: var(--muted);
  font-size: .72rem;
}

.nested-fieldset {
  padding: 0;
  margin: 2.4rem 0 0;
  border: 0;
}

.field-help { max-width: 43rem; margin: 0 0 1rem; }

.choice-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: .65rem;
}

.choice-tile {
  position: relative;
  display: flex;
  min-height: 4rem;
  align-items: stretch;
  border: 1px solid var(--border-strong);
  cursor: pointer;
}

.choice-tile input {
  width: 1rem;
  height: 1rem;
  flex: 0 0 auto;
  margin: 1rem 0 0 1rem;
  accent-color: var(--red);
}

.choice-tile > span {
  display: flex;
  flex: 1;
  flex-direction: column;
  justify-content: center;
  padding: .85rem 1rem;
  font-family: var(--ui);
  font-size: .78rem;
  font-weight: 680;
  line-height: 1.3;
}

.choice-tile small {
  display: block;
  margin-top: .35rem;
  color: var(--muted);
  font-size: .67rem;
  font-weight: 450;
  line-height: 1.4;
}

.choice-tile:hover,
.choice-tile:has(input:checked) { border-color: var(--red); }
.choice-tile:has(input:checked) { background: #f4e7e1; }
.choice-tile:has(input:focus-visible) { outline: .18rem solid var(--red); outline-offset: .2rem; }
.choice-tile input:focus-visible { outline: none; }

.training-rule {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin: 2.5rem 0 1.5rem;
  color: var(--muted);
  font-family: var(--ui);
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.training-rule::after { flex: 1; height: 1px; background: var(--border); content: ""; }

.plain-check,
.scope-confirmation {
  display: flex;
  align-items: flex-start;
  gap: .75rem;
  cursor: pointer;
}

.plain-check { margin-top: 1.6rem; color: var(--muted); font-size: .78rem; }
.plain-check input,
.scope-confirmation input {
  width: 1.05rem;
  height: 1.05rem;
  flex: 0 0 auto;
  margin-top: .18rem;
  accent-color: var(--red);
}

.activity-proposal {
  padding: 1.4rem;
  margin: 2.5rem 0 0;
  border: 0;
  border-top: .22rem solid var(--red);
  background: var(--paper-deep);
}

.activity-proposal__status {
  margin: .2rem 0 1.15rem;
  color: var(--body-ink);
  font-size: .79rem;
}

.activity-proposal__status strong { color: var(--red-dark); }

.activity-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }

.activity-options label {
  display: flex;
  gap: .7rem;
  padding: .9rem;
  border-top: 1px solid var(--border);
  cursor: pointer;
}

.activity-options label:nth-child(odd) { border-right: 1px solid var(--border); }
.activity-options label:hover { background: rgba(255, 253, 248, .6); }
.activity-options input { flex: 0 0 auto; margin-top: .2rem; accent-color: var(--red); }
.activity-options strong,
.activity-options small { display: block; }
.activity-options strong { font-family: var(--ui); font-size: .77rem; }
.activity-options small { margin-top: .2rem; color: var(--muted); font-size: .65rem; line-height: 1.4; }
.activity-options label:has(input:checked) { background: var(--paper); color: var(--red-dark); }
.activity-options label:has(input:focus-visible) { outline: .18rem solid var(--red); outline-offset: -.18rem; }
.activity-options input:focus-visible { outline: none; }

.activity-method {
  margin-top: 1.25rem;
  border-block: 1px solid var(--border);
}
.activity-method summary {
  padding: .9rem 0;
  color: var(--red-dark);
  cursor: pointer;
  font-family: var(--ui);
  font-size: .76rem;
  font-weight: 720;
}
.activity-method summary::marker { color: var(--red); }
.activity-method > div { padding: 0 0 .55rem 1.35rem; border-left: .14rem solid var(--red); }
.activity-method p { margin: 0 0 .8rem; color: var(--muted); font-size: .75rem; line-height: 1.58; }

.choice-row--goals .choice-tile { min-height: 7rem; }

.scope-confirmation {
  padding: 1.15rem;
  margin-top: -2.25rem;
  border-left: .22rem solid var(--red);
  background: var(--paper-deep);
  color: var(--body-ink);
  font-size: .76rem;
  line-height: 1.5;
}

.form-actions {
  display: grid;
  grid-template-columns: minmax(13rem, auto) minmax(0, 1fr);
  align-items: center;
  gap: 1.5rem;
  margin-top: 2rem;
}

.form-actions p { margin: 0; color: var(--muted); font-size: .68rem; line-height: 1.5; }

.field-error {
  margin: .55rem 0 0;
  color: var(--red-dark);
  font-size: .74rem;
  font-weight: 700;
  line-height: 1.45;
}
.field-error::before { margin-right: .35rem; content: "↳"; }

.calorie-form.was-validated :is(input, select):invalid { border-color: var(--red); }
.calorie-form.was-validated .choice-tile:has(input:invalid),
.calorie-form.was-validated .activity-options label:has(input:invalid) { border-color: var(--red); }

.energy-result {
  position: sticky;
  top: calc(var(--header-height) + 1rem);
  min-width: 0;
  min-height: min(54rem, calc(100vh - var(--header-height) - 2rem));
  align-self: start;
  overflow: hidden;
  background: var(--calc-wine);
  color: var(--white);
}

.energy-result__empty,
.energy-result__content { padding: clamp(1.5rem, 4vw, 3rem); }

.energy-result__empty {
  display: flex;
  min-height: inherit;
  flex-direction: column;
  justify-content: center;
}

.energy-result .eyebrow { color: #e5b5a4; }
.energy-result h2,
.energy-result h3 { color: var(--white); }
.energy-result__empty h2 { max-width: 9ch; font-size: clamp(2.8rem, 4.8vw, 4.6rem); }
.energy-result__empty > p:not(.eyebrow) { max-width: 32rem; color: #d9c7c0; }

.empty-stitch {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 3rem;
}

.empty-stitch::before {
  width: 100%;
  border-top: .14rem dashed var(--calc-coral);
  content: "";
}

.empty-stitch span { display: none; }

.energy-result__content { min-height: inherit; }

.result-heading {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 1rem;
  align-items: end;
  padding-bottom: 2rem;
  border-bottom: 1px solid rgba(255, 253, 248, .2);
}

.result-heading h2 {
  margin: 0;
  font-size: clamp(3.1rem, 6vw, 5.4rem);
  font-variant-numeric: tabular-nums;
  letter-spacing: -.06em;
}

.energy-result.is-out-of-scope .result-heading h2 {
  max-width: 8ch;
  font-size: clamp(2.2rem, 4vw, 3.3rem);
  letter-spacing: -.035em;
}

.result-unit { margin: .15rem 0 0; color: #d9c7c0; font-size: .82rem; }

.activity-stamp {
  max-width: 8.5rem;
  margin: 0;
  padding-left: .8rem;
  border-left: .14rem solid var(--calc-coral);
  font-family: var(--ui);
  line-height: 1.25;
}

.activity-stamp span { display: block; color: #d9c7c0; font-size: .7rem; text-transform: uppercase; }
.activity-stamp strong { display: block; margin-top: .3rem; font-size: .82rem; }

.energy-map { padding-block: 1.2rem .8rem; border-bottom: 1px solid rgba(255, 253, 248, .2); }
.energy-map svg { width: 100%; overflow: visible; }
.energy-map__thread { fill: none; stroke-linecap: round; }
.energy-map__thread--back { stroke: rgba(255, 253, 248, .18); stroke-width: 2; }
.energy-map__thread--stitch {
  stroke: var(--calc-coral);
  stroke-width: 3;
  stroke-dasharray: 2 9;
  stroke-dashoffset: 100;
}

.energy-result.is-drawn .energy-map__thread--stitch { animation: stitch-line 1.25s var(--ease-out) forwards; }

@keyframes stitch-line {
  from { stroke-dashoffset: 100; }
  to { stroke-dashoffset: 0; }
}

.energy-map__point circle { fill: var(--calc-wine); stroke: var(--calc-coral); stroke-width: 2; }
.energy-map__point text { fill: #d9c7c0; font-family: var(--ui); font-size: 17px; font-weight: 620; }
.energy-map__point .energy-map__value { fill: var(--white); font-size: 20px; font-weight: 720; }
.energy-map figcaption { color: #cdb9b0; font-size: .75rem; line-height: 1.5; }

.goal-result {
  padding: 1.5rem 0;
  border-bottom: 1px solid rgba(255, 253, 248, .2);
}

.goal-result h3 {
  margin-bottom: .35rem;
  font-size: clamp(1.9rem, 4vw, 3rem);
  font-variant-numeric: tabular-nums;
}

.goal-result > p:last-child { margin: 0; color: #d9c7c0; font-size: .82rem; line-height: 1.55; }
.goal-result.is-blocked { border-left: .2rem solid var(--calc-coral); padding-left: 1rem; }

.result-ledger { margin: 0; }
.result-ledger > div {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 1rem;
  padding: .75rem 0;
  border-bottom: 1px solid rgba(255, 253, 248, .13);
}
.result-ledger dt { color: #cdb9b0; font-size: .76rem; }
.result-ledger dd { margin: 0; font-family: var(--ui); font-size: .8rem; font-weight: 700; text-align: right; }

.result-detail,
.model-error,
.calibration { padding: 2rem 0; border-bottom: 1px solid rgba(255, 253, 248, .2); }
.result-detail h3,
.model-error h3,
.calibration h3 { font-size: clamp(1.55rem, 3vw, 2.2rem); }
.result-detail > p,
.model-error p,
.calibration li { color: #d9c7c0; font-size: .82rem; line-height: 1.58; }

.table-scroll { max-width: 100%; overflow-x: auto; }
.table-scroll:focus-visible { outline-color: var(--calc-coral); outline-offset: .2rem; }
.table-scroll-hint { display: none; color: #d9c7c0; font-size: .76rem; }
.energy-result table { width: 100%; border-collapse: collapse; font-size: .78rem; }
.energy-result th,
.energy-result td { padding: .65rem .35rem; border-bottom: 1px solid rgba(255, 253, 248, .13); text-align: left; white-space: nowrap; }
.energy-result th { color: #e2bcae; font-family: var(--ui); font-size: .7rem; letter-spacing: .045em; text-transform: uppercase; }
.energy-result td:last-child { color: var(--white); font-family: var(--ui); font-weight: 700; text-align: right; }
.energy-result tr.is-selected td { color: var(--white); }
.energy-result tr.is-selected td:first-child::before { margin-right: .3rem; color: var(--calc-coral); content: "●"; }

.calibration ol { padding-left: 1.15rem; margin-bottom: 0; }
.calibration li { padding: .35rem 0 .5rem .25rem; }

.result-notices { padding: 1.25rem 0 0 1.2rem; margin: 0; color: #f2d4c9; font-size: .8rem; line-height: 1.55; }
.result-notices li { margin-bottom: .5rem; }

.energy-result .button--paper { margin-top: 1.5rem; border-color: var(--white); background: transparent; color: var(--white); }
.energy-result .button--paper:hover { background: var(--white); color: var(--red-dark); }

.noscript-message {
  padding: 1rem 1.2rem;
  border-left: .22rem solid var(--red);
  background: var(--paper);
}

.method-section {
  padding-block: var(--section);
  border-block: 1px solid var(--border);
  background: var(--paper-deep);
}

.method-grid {
  display: grid;
  grid-template-columns: minmax(18rem, .72fr) minmax(0, 1fr);
  gap: clamp(3rem, 9vw, 9rem);
}

.method-heading { position: sticky; top: calc(var(--header-height) + 2rem); align-self: start; }
.method-heading h2 { max-width: 9ch; }
.method-copy { max-width: 48rem; }
.method-copy h3 { margin: 2.4rem 0 .6rem; }
.method-copy h3:first-child { margin-top: 0; }
.method-copy > p { color: var(--body-ink); font-family: var(--reading-face); font-size: 1.12rem; line-height: 1.72; }

.method-limit {
  margin-top: 3rem;
  padding: 1.5rem 0 0 1.5rem;
  border-top: .22rem solid var(--red);
  border-left: 1px solid var(--border-strong);
}
.method-limit p { margin: .4rem 0 0; color: var(--muted); }

.method-copy > .calculator-origin {
  margin: 2.5rem 0 0;
  color: var(--muted);
  font-family: var(--body);
  font-size: .78rem;
  line-height: 1.55;
}
.method-copy > .calculator-origin a { color: var(--red-dark); font-weight: 700; }

.calculator-sources { padding-block: var(--section); }
.calculator-sources h2 { max-width: 10ch; }
.calculator-sources ol { padding: 0; margin: 3rem 0; list-style: none; counter-reset: source; }
.calculator-sources li {
  display: grid;
  grid-template-columns: 2rem minmax(0, 1fr);
  padding: 1rem 0;
  border-top: 1px solid var(--border);
  counter-increment: source;
}
.calculator-sources li::before { color: var(--red); content: counter(source, decimal-leading-zero); font-family: var(--ui); font-size: .66rem; font-weight: 720; }
.calculator-sources li span { grid-column: 2; color: var(--muted); font-size: .69rem; }
.calculator-sources a { color: var(--red-dark); font-weight: 700; }
.sources-meta { color: var(--muted); font-size: .75rem; }

.calculator-visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

@media (max-width: 1060px) {
  .calculator-workspace { grid-template-columns: minmax(0, 1fr) minmax(22rem, .68fr); }
  .field-grid--three { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .physiology-fieldset { grid-column: 1 / -1; }
}

@media (max-width: 880px) {
  .calorie-hero__grid,
  .scope-strip__grid,
  .method-grid { grid-template-columns: 1fr; }
  .calorie-hero__grid { align-items: start; gap: 2.5rem; }
  .calorie-hero__lead { max-width: 43rem; }
  .calculator-workspace { display: block; border-inline: 0; }
  .calorie-form { border-right: 0; }
  .energy-result { position: static; min-height: 0; }
  .energy-result__empty { min-height: 26rem; }
  .method-heading { position: static; }
}

@media (max-width: 620px) {
  .calorie-hero { padding-top: 3.5rem; }
  .calorie-hero h1 { font-size: clamp(3rem, 14vw, 4.4rem); }
  .field-grid--two,
  .field-grid--three,
  .choice-row,
  .activity-options { grid-template-columns: 1fr; }
  .activity-options label:nth-child(odd) { border-right: 0; }
  .calorie-form__header h2 { font-size: clamp(2.5rem, 12vw, 3.5rem); }
  .form-actions { grid-template-columns: 1fr; }
  .form-actions .button { width: 100%; }
  .result-heading { grid-template-columns: 1fr; }
  .activity-stamp { max-width: none; }
  .energy-map { margin-inline: -.5rem; }
  .energy-map__point text { font-size: 24px; }
  .energy-map__point .energy-map__value { font-size: 27px; }
  .table-scroll-hint { display: block; }
}

@media (prefers-reduced-motion: reduce) {
  .energy-result.is-drawn .energy-map__thread--stitch { animation: none; stroke-dashoffset: 0; }
}

@media print {
  .calorie-hero,
  .calorie-form,
  .scope-strip,
  .method-section,
  .calculator-sources { display: none !important; }
  .calculator-workspace { display: block; margin: 0; border: 0; }
  .energy-result { position: static; min-height: 0; background: #fff; color: #000; }
  .energy-result h2,
  .energy-result h3,
  .energy-result td,
  .energy-result .eyebrow { color: #000; }
  .energy-result p,
  .energy-result li,
  .energy-result dt { color: #333; }
  .energy-map { display: none; }
}
