/* ===========================================================
   #clima — Clima + Vestimenta (Lane F) · §8.7
   Opaque cream section: split day/night panel with a scrubbed
   divider sweep, band chart, ruled vestimenta checklist, outro.
   Mobile-first. Tokens only.
   =========================================================== */

.clima {
  position: relative;
  background: var(--c-cream);
  color: var(--c-navy);
  padding-block: 0 var(--section-pad);
  overflow: hidden;
}

/* ---- header on cream ---- */
.clima__head {
  max-width: var(--container);
  margin-inline: auto;
  padding: var(--section-pad) var(--gutter) var(--sp-7);
  display: grid;
  gap: var(--sp-4);
}
.clima__title {
  margin: 0;
  font: 700 var(--fs-h1) / var(--lh-tight) var(--ff-display);
  font-optical-sizing: auto;
  letter-spacing: -.02em;
  color: var(--c-navy);
}
.clima__lead {
  margin: 0;
  max-width: var(--measure);
  font: 400 var(--fs-lead) / var(--lh-body) var(--ff-body);
  color: var(--c-ink-soft);
}

/* ---- split panel ---- */
.clima__panel {
  position: relative;
  height: clamp(560px, 80svh, 900px);
  overflow: hidden;
  background: var(--c-navy);
  contain: layout paint;
}
.split-wrap {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 120%;                 /* mobile: divider sweeps 60% → 40% of the panel */
  display: flex;
  flex-direction: column;
}
.half {
  position: relative;
  flex: 0 0 50%;
  overflow: hidden;
  display: flex;
  padding: var(--gutter);
  isolation: isolate;
}
.half--day  { background: var(--g-golden); color: var(--c-cream); }
.half--night{ background: var(--g-night);  color: var(--c-cream); }

/* photos at 25 % under the gradient */
.half__photo {
  position: absolute;
  inset: 0;
  margin: 0;
  aspect-ratio: auto;
  opacity: .25;
  z-index: 0;
}
.half__photo img { width: 100%; height: 100%; }
.half__scrim {
  position: absolute;
  inset: 0;
  z-index: 1;
  background: var(--g-scrim);
}

/* mobile: day content sits at the bottom of its half, night at the top
   → both temperature blocks flank the moving divider */
.half--day   { align-items: flex-end; }
.half--night { align-items: flex-start; }

.half__body {
  position: relative;
  z-index: 3;
  width: 100%;
  display: grid;
  gap: var(--sp-2);
}
.half__name {
  margin: 0;
  font: 600 var(--fs-eyebrow) / 1 var(--ff-body);
  letter-spacing: var(--track-eyebrow);
  text-transform: uppercase;
  color: var(--c-gold-light);
}
.half--night .half__name { color: var(--c-gold); }
.half__label {
  margin: 0;
  max-width: 28ch;
  font: 500 var(--fs-small) / 1.45 var(--ff-body);
  color: var(--c-paper-soft);
}
.half__temp {
  margin: 0;
  display: flex;
  align-items: baseline;
  font: 900 min(var(--fs-display), 19vw) / var(--lh-tight) var(--ff-display);
  font-optical-sizing: auto;
  font-variant-numeric: tabular-nums;
  letter-spacing: -.02em;
  color: var(--c-cream);
}
.half__temp .num { font-weight: inherit; font-variant-numeric: tabular-nums; }
.half__dash {
  display: inline-block;
  transform-origin: 0 50%;
  margin-inline: .02em;
  color: var(--c-gold);
}
.half__unit {
  font: 500 var(--fs-h3) / 1 var(--ff-display);
  color: var(--c-gold);
  margin-left: .1em;
}

/* icons: sun rays / moon */
.half__ico {
  position: absolute;
  z-index: 2;
  width: 88px;
  height: 88px;
  top: var(--gutter);
  right: var(--gutter);
  color: var(--c-gold-light);
  opacity: .92;
  transform-origin: 50% 50%;
}
.half__ico--luna { color: var(--c-cream); opacity: .85; width: 64px; height: 64px; }
/* mobile: the day half's top scrolls out of the panel, so the sun sits above the numbers */
.half--day .half__ico { top: auto; bottom: 46%; }
/* mobile: the moon lives on the top edge so it never sits on the «Noche» copy at 320px */
@media (max-width: 1023px) {
  .half--night .half__ico { top: var(--sp-4); right: var(--sp-4); }
  .half--night .half__body { padding-top: 72px; }
}

/* twelve CSS-twinkling stars */
.half__stars { position: absolute; inset: 0; z-index: 2; pointer-events: none; }
.half__stars i {
  position: absolute;
  left: var(--x);
  top: var(--y);
  width: var(--s, 3px);
  height: var(--s, 3px);
  border-radius: 50%;
  background: var(--c-cream);
  opacity: .5;
  animation: clima-twinkle var(--d, 3s) ease-in-out var(--dl, 0s) infinite alternate;
}
@keyframes clima-twinkle {
  from { opacity: .15; transform: scale(.7); }
  to   { opacity: .95; transform: scale(1); }
}
@media (prefers-reduced-motion: reduce) {
  .half__stars i { animation: none; opacity: .7; }
}
html.reduce .half__stars i { animation: none; opacity: .7; }

/* ---- chart + vestimenta grid ---- */
.clima__grid {
  max-width: var(--container);
  margin-inline: auto;
  padding: var(--sp-8) var(--gutter) 0;
  display: grid;
  gap: var(--sp-6);
}

/* band chart sheet */
.chart--band {
  margin: 0;
  display: grid;
  gap: var(--sp-4);
  contain: layout paint;
}
.band__cap {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3) var(--sp-5);
}
.band__cap .kicker { margin: 0; }
.band__legend {
  display: inline-flex;
  align-items: center;
  gap: .5em;
  font: 500 var(--fs-small) / 1 var(--ff-body);
  color: var(--c-ink-soft);
}
.band__swatch {
  display: inline-block;
  width: 18px;
  height: 3px;
  border-radius: 2px;
  margin-left: .6em;
}
.band__swatch:first-child { margin-left: 0; }
.band__swatch--max { background: var(--c-gold); }
.band__swatch--min { background: var(--c-teal); }

.band__stage { position: relative; }
.band {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 4 / 3;
  overflow: visible;
  font-family: var(--ff-body);
}
.band__grid line { stroke: var(--chart-grid); stroke-width: 1; }
.band__yaxis text,
.band__xaxis text {
  font-size: 13px;
  font-weight: 500;
  fill: var(--c-ink-soft);
  font-variant-numeric: tabular-nums;
}
.band__yaxis text { text-anchor: end; dominant-baseline: middle; }
.band__xaxis text { text-anchor: middle; }
.band__city { font-size: 12px; fill: var(--c-gold-ink); }
.band__area {
  fill: var(--c-gold);
  fill-opacity: .22;
  transform-box: fill-box;
  transform-origin: 50% 100%;
}
.band__line { fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.band__line--max { stroke: var(--c-gold); }
.band__line--min { stroke: var(--c-teal); }
.band__pt { stroke: var(--c-cream); stroke-width: 1.5; transform-box: fill-box; transform-origin: 50% 50%; }
.band__pt--max { fill: var(--c-gold); }
.band__pt--min { fill: var(--c-teal); }
.band__cross { stroke: var(--c-navy); stroke-width: 1; stroke-dasharray: 3 4; opacity: 0; }
.band__hit { fill: transparent; pointer-events: all; cursor: crosshair; }
.band.is-hover .band__pt { opacity: .45; }
.band.is-hover .band__pt.is-on { opacity: 1; }
.band.is-hover .band__cross { opacity: .6; }

.band__tip {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 2;
  padding: .55em .85em;
  background: var(--c-navy);
  color: var(--c-cream);
  font: 500 var(--fs-small) / 1.2 var(--ff-body);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  border-radius: var(--r-sm);
  box-shadow: var(--sh-2);
  pointer-events: none;
  transform: translate(-50%, calc(-100% - 12px));
}
.band__tip::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -5px;
  width: 10px;
  height: 10px;
  background: var(--c-navy);
  transform: translateX(-50%) rotate(45deg);
}
.band__tip b { color: var(--c-gold-light); font-weight: 600; }

/* mobile: only D1/D5/D9 axis labels + key cities */
.band__x:not(.is-key), .band__city:not(.is-key) { display: none; }

/* vestimenta ruled sheet */
.vest {
  padding: 32px var(--sp-5) 32px;
  contain: layout paint;
}
.vest__title {
  margin: 0 0 32px;
  font: 500 var(--fs-h3) / 32px var(--ff-display);
  font-optical-sizing: auto;
  color: var(--c-navy);
}
.vest__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
}
.vest__item label {
  position: relative;
  display: grid;
  grid-template-columns: 28px 1fr;
  gap: var(--sp-3);
  align-items: start;
  min-height: 32px;
  cursor: pointer;
  color: var(--c-navy);
  font: 400 var(--fs-body) / 32px var(--ff-body);
}
/* §10: 44 px hit area on the 32 px ruled rhythm — the label's pseudo extends the tappable box, not the row */
.vest__item label::before { content: ""; position: absolute; inset: -6px 0; }
.vest__item input {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: 0;
  opacity: 0;
  pointer-events: none;
}
.check {
  position: relative;
  display: block;
  width: 26px;
  height: 26px;
  margin-top: 3px;
  border: 1.5px solid var(--c-navy);
  border-radius: var(--r-sm);
  background: var(--c-cream-light);
  transition: background-color var(--t-ui) var(--ease-out), border-color var(--t-ui) var(--ease-out), transform var(--t-micro) var(--ease-out);
}
.check svg { position: absolute; inset: 2px; width: auto; height: auto; overflow: visible; }
.check__path {
  fill: none;
  stroke: var(--c-teal-ink);
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.vest__item input:checked + .check { border-color: var(--c-teal-ink); }
.vest__item input:focus-visible + .check { outline: 2px solid var(--c-terracotta-deep); outline-offset: 3px; }
.vest__item label:active .check { transform: scale(.92); }
.vest__text { transition: opacity var(--t-ui) var(--ease-out); }
.vest__item.is-checked .vest__text { opacity: .55; }
/* no-JS: a checked box simply shows its check */
html:not(.js) .vest__item input:checked + .check .check__path { stroke-dashoffset: 0; }

/* outro line */
.clima__outro {
  max-width: var(--container);
  margin: var(--sp-9) auto 0;
  padding-inline: var(--gutter);
  font: italic 400 var(--fs-h3) / var(--lh-heading) var(--ff-display);
  font-optical-sizing: auto;
  color: var(--c-navy);
  text-wrap: balance;
}

/* ---------- ≥ 640 ---------- */
@media (min-width: 640px) {
  .band__x:not(.is-key), .band__city:not(.is-key) { display: initial; }
  .band { aspect-ratio: 900 / 440; }
  .half__ico { width: 120px; height: 120px; }
  .half__ico--luna { width: 84px; height: 84px; }
  .vest { padding-inline: var(--sp-6); }
}

/* ---------- ≥ 1024: halves side by side, horizontal sweep ---------- */
@media (min-width: 1024px) {
  .split-wrap {
    width: 135%;                /* desktop: divider sweeps 67.5% → 32.4% */
    height: 100%;
    flex-direction: row;
  }
  .half--day .half__ico { top: clamp(2rem, 4vw, 4rem); bottom: auto; }
  .half {
    padding: clamp(2rem, 4vw, 4rem);
    align-items: flex-end;
  }
  .half--day .half__body { justify-items: end; text-align: right; margin-left: auto; }
  .half--day .half__label { margin-left: auto; }
  .half--night .half__body { justify-items: start; text-align: left; }
  .half--day .half__temp { justify-content: flex-end; }
  .half__temp { font-size: min(var(--fs-display), 8.5vw); }
  .half--night .half__ico { right: auto; left: clamp(2rem, 4vw, 4rem); }
  .half__stars { inset: 0 0 auto 0; height: 55%; }
  .clima__outro { margin-top: var(--sp-10); max-width: 40ch; margin-inline: auto; text-align: center; padding-inline: 0; }
  .clima__grid {
    grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
    gap: var(--sp-7);
    align-items: start;
  }
}
