/* 14 · Metas — "Painel de metas" (capítulo claro)
   O capítulo amanhece (íris de papel), seis mini-pistas de atletismo viram instrumentos:
   um corredor de luz completa uma volta e o hodômetro rola até a meta. */
#metas {
  --mt-teal: #0a8a82;
  --mt-cyan: #157fb3;
  --mt-pad: clamp(14px, 1.6vw, 28px);
  --mt-line: rgba(10, 26, 56, 0.12);
  padding-block: 0;
  background: var(--paper);
}
.js:not(.reduced) #metas { background: transparent; }

/* ---------- Papel de engenharia ---------- */
#metas .mt-paper { position: absolute; inset: 0; z-index: -1; overflow: hidden; background: var(--paper); }
#metas .mt-graph {
  position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(10, 26, 56, 0.055) 1px, transparent 1px),
    linear-gradient(90deg, rgba(10, 26, 56, 0.055) 1px, transparent 1px),
    linear-gradient(rgba(10, 26, 56, 0.028) 1px, transparent 1px),
    linear-gradient(90deg, rgba(10, 26, 56, 0.028) 1px, transparent 1px);
  background-size: 96px 96px, 96px 96px, 16px 16px, 16px 16px;
  -webkit-mask-image: radial-gradient(90% 70% at 50% 45%, #000 30%, transparent 95%);
  mask-image: radial-gradient(90% 70% at 50% 45%, #000 30%, transparent 95%);
}
#metas .mt-paper::before {
  content: ''; position: absolute; inset: 0;
  background:
    radial-gradient(60% 45% at 18% 20%, rgba(18, 197, 181, 0.10), transparent 70%),
    radial-gradient(55% 45% at 85% 80%, rgba(29, 159, 208, 0.10), transparent 70%);
}
#metas .mt-watermark {
  position: absolute; right: 0; bottom: 4%;
  font-family: var(--font-display); font-style: italic; font-weight: 900; font-stretch: 125%;
  font-size: clamp(180px, 34vw, 620px); line-height: 0.8; letter-spacing: -0.04em;
  color: transparent; -webkit-text-stroke: 1.5px rgba(10, 26, 56, 0.07);
  user-select: none; white-space: nowrap;
}
#metas .mt-defs { position: absolute; width: 0; height: 0; overflow: hidden; }

/* ---------- Palco (pin) ---------- */
#metas .mt-pin {
  position: relative; min-height: 100vh; min-height: 100svh;
  display: flex; align-items: center;
  padding: calc(var(--hud-h) + clamp(8px, 2vh, 24px)) 0 clamp(14px, 2.6vh, 32px);
}
#metas .mt-wrap { width: 100%; }
#metas .mt-frame { position: absolute; inset: calc(var(--hud-h) + 4px) clamp(12px, 1.8vw, 26px) 12px; pointer-events: none; }
#metas .mt-crop { position: absolute; width: 16px; height: 16px; border: 0 solid rgba(10, 26, 56, 0.32); }
#metas .mt-crop.tl { left: 0; top: 0; border-top-width: 1px; border-left-width: 1px; }
#metas .mt-crop.tr { right: 0; top: 0; border-top-width: 1px; border-right-width: 1px; }
#metas .mt-crop.bl { left: 0; bottom: 0; border-bottom-width: 1px; border-left-width: 1px; }
#metas .mt-crop.br { right: 0; bottom: 0; border-bottom-width: 1px; border-right-width: 1px; }
#metas .mt-frame__tag { position: absolute; left: 24px; bottom: -3px; margin: 0; font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.2em; text-transform: uppercase; color: rgba(10, 26, 56, 0.45); }

/* ---------- Cabeçalho ---------- */
#metas .mt-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px 48px; }
#metas .mt-head .t-eyebrow { margin-bottom: clamp(10px, 1.6vh, 20px); }
#metas .mt-title { max-width: 27ch; font-size: clamp(28px, min(3.5vw, 5.4vh), 60px); color: var(--paper-ink); }
#metas .mt-hl { color: var(--teal-deep); }
#metas .mt-readout {
  flex: none; display: grid; justify-items: end; gap: 4px; padding: 12px 0 4px 20px;
  border-left: 1px solid var(--mt-line); text-align: right; color: var(--paper-ink);
}
#metas .mt-readout__k { font-family: var(--font-mono); font-size: 10.5px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--paper-ink-2); }
#metas .mt-readout__v { display: flex; align-items: baseline; gap: 2px; font-family: var(--font-display); font-style: italic; font-weight: 850; font-stretch: 118%; line-height: 0.9; font-variant-numeric: tabular-nums; }
#metas .mt-readout__n { font-size: clamp(40px, 4.2vw, 64px); font-weight: inherit; letter-spacing: -0.02em; color: var(--teal-deep); }
#metas .mt-readout__v i { font-style: inherit; font-size: clamp(20px, 1.8vw, 28px); color: var(--paper-ink-2); }
#metas .mt-readout__bar { display: block; width: 150px; height: 3px; margin-top: 6px; background: rgba(10, 26, 56, 0.1); border-radius: 2px; overflow: hidden; }
#metas .mt-readout__bar i { display: block; height: 100%; background: var(--grad-brand); transform-origin: 0 50%; }

/* ---------- Grade de instrumentos ---------- */
#metas .mt-grid {
  --mt-gh: clamp(96px, calc((100svh - 462px) / 2), 260px);
  list-style: none; margin: clamp(16px, 3.2vh, 40px) 0 0; padding: 0;
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); row-gap: clamp(8px, 2vh, 26px);
}
#metas .mt-cell { position: relative; display: grid; justify-items: center; align-content: start; gap: clamp(4px, 0.9vh, 10px); padding: clamp(8px, 1.4vh, 16px) var(--mt-pad); }
#metas .mt-cell::before, #metas .mt-cell::after { content: ''; position: absolute; background: var(--mt-line); transition: transform 1.2s var(--ease-out); }
#metas .mt-cell::before { left: 0; top: 8%; bottom: 8%; width: 1px; transform-origin: 50% 0; }
#metas .mt-cell::after { left: var(--mt-pad); right: var(--mt-pad); top: calc(-1 * clamp(4px, 1vh, 13px)); height: 1px; transform-origin: 0 50%; }
#metas .mt-cell:nth-child(3n + 1)::before { display: none; }
#metas .mt-cell:nth-child(-n + 3)::after { display: none; }
#metas .mt-cell--teal { --mt-c: var(--mt-teal); --mt-hot: var(--teal); }
#metas .mt-cell--cyan { --mt-c: var(--mt-cyan); --mt-hot: var(--cyan); }

#metas .mt-cell__top, #metas .mt-gauge, #metas .mt-label { width: min(100%, calc(var(--mt-gh) * 2.105)); }
#metas .mt-cell__top { display: flex; justify-content: space-between; align-items: center; font-family: var(--font-mono); font-size: 10.5px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--paper-ink-2); }
#metas .mt-status { display: inline-flex; align-items: center; gap: 7px; }
#metas .mt-status i { width: 7px; height: 7px; border-radius: 50%; background: var(--mt-hot); box-shadow: 0 0 0 3px color-mix(in srgb, var(--mt-hot) 22%, transparent); transition: background 0.4s, box-shadow 0.4s; }

#metas .mt-gauge { position: relative; aspect-ratio: 400 / 190; container-type: inline-size; }
#metas .mt-track { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
/* elementos vivos */
#metas .mt-trail, #metas .mt-comet { fill: none; stroke-width: 11; stroke-linecap: round; stroke-linejoin: round; }
#metas .mt-cell--teal .mt-trail, #metas .mt-cell--teal .mt-comet { stroke: url(#metas-grad-teal); }
#metas .mt-cell--cyan .mt-trail, #metas .mt-cell--cyan .mt-comet { stroke: url(#metas-grad-cyan); }
#metas .mt-trail { opacity: 0.85; }
#metas.mt-armed .mt-cell:not(.is-done) .mt-trail { opacity: 0.42; }
#metas .mt-comet { opacity: 0; }
#metas .mt-runner__halo { fill: var(--mt-hot); opacity: 0.2; transform-box: fill-box; transform-origin: center; animation: mt-halo 1.6s var(--ease-io) infinite; }
#metas .mt-runner__dot { fill: #fff; stroke: var(--mt-hot); stroke-width: 3.5; }
#metas .mt-flash circle { fill: none; stroke: var(--mt-hot); stroke-width: 2.5; opacity: 0; transform-box: fill-box; transform-origin: center; }
@keyframes mt-halo { 0%, 100% { transform: scale(0.7); opacity: 0.28; } 50% { transform: scale(1.15); opacity: 0.12; } }
@keyframes mt-flash { 0% { transform: scale(0.3); opacity: 0.95; } 100% { transform: scale(4.2); opacity: 0; } }

/* número / hodômetro */
#metas .mt-num {
  position: absolute; inset: 0; margin: 0; display: grid; place-items: center;
  font-family: var(--font-display); font-style: italic; font-weight: 850; font-stretch: 118%;
  font-size: 20.5cqi; line-height: 1; letter-spacing: -0.02em; font-variant-numeric: tabular-nums lining-nums;
  color: var(--mt-c); -webkit-text-stroke: 0 transparent; transition: color 0.5s var(--ease-out), -webkit-text-stroke-color 0.5s;
}
#metas .mt-num__v { padding-right: 0.06em; }
#metas .mt-odo {
  display: inline-flex; align-items: flex-start; height: 1.2em; padding: 0 0.1em 0 0.04em; overflow: hidden;
  -webkit-mask-image: linear-gradient(180deg, transparent 0, #000 12%, #000 88%, transparent 100%);
  mask-image: linear-gradient(180deg, transparent 0, #000 12%, #000 88%, transparent 100%);
}
#metas .mt-reel { display: block; width: auto; }
#metas .mt-reel > span, #metas .mt-sep { display: block; height: 1.2em; line-height: 1.2em; }
#metas .mt-sep { display: inline-block; }
#metas .mt-label { margin: 0; font-family: var(--font-display); font-weight: 700; font-stretch: 104%; font-size: clamp(16px, 1.22vw, 19px); line-height: 1.25; letter-spacing: -0.005em; text-align: center; color: var(--paper-ink); text-wrap: balance; }

/* ---------- Rodapé ---------- */
#metas .mt-foot { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 6px 32px; margin-top: clamp(10px, 2.2vh, 28px); padding-top: clamp(8px, 1.4vh, 14px); border-top: 1px solid var(--mt-line); }
#metas .mt-note { margin: 0; max-width: none; font-size: clamp(14px, 1.25vw, 16px); }
#metas .mt-legend { display: inline-flex; align-items: center; gap: 10px; margin: 0 0 0 auto; font-family: var(--font-mono); font-size: 10.5px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--paper-ink-2); }
#metas .mt-legend i { width: 26px; height: 6px; border-radius: 3px; background: var(--grad-brand); }

/* ---------- Estados animados (só com JS e sem movimento reduzido) ---------- */
#metas.mt-armed .mt-cell::before { transform: scaleY(0); }
#metas.mt-armed .mt-cell::after { transform: scaleX(0); }
#metas.mt-armed .mt-cell.is-in::before { transform: scaleY(1); }
#metas.mt-armed .mt-cell.is-in::after { transform: scaleX(1); }
/* em repouso o mostrador fica só em contorno (não se lê como dado); acende ao largar */
#metas.mt-armed .mt-cell:not(.is-live) .mt-num { color: rgba(163, 177, 199, 0); -webkit-text-stroke: 1.4px #b4c1d3; }
#metas.mt-armed .mt-cell:not(.is-done) .mt-status i { background: #b9c5d6; box-shadow: 0 0 0 3px rgba(10, 26, 56, 0.06); }
#metas.mt-armed .mt-cell:not(.is-done) .mt-status { color: rgba(60, 79, 114, 0.6); }
#metas.mt-armed .mt-comet { opacity: 1; }
#metas.mt-armed .mt-cell.is-done .mt-comet { opacity: 0; transition: opacity 0.6s; }
#metas.mt-armed .mt-cell.is-done .mt-flash circle { animation: mt-flash 1.1s var(--ease-out) 1; }
#metas.mt-armed .mt-cell.is-done .mt-trail { transition: opacity 0.5s; }
#metas.mt-armed .mt-cell:not(.is-live) .mt-runner__dot { stroke: #9aaac2; }

/* ---------- Sem pin (telas baixas) ---------- */
#metas.mt-nopin .mt-pin { min-height: 0; padding-block: clamp(96px, 14vh, 150px) clamp(60px, 10vh, 110px); }
#metas.mt-nopin .mt-grid { --mt-gh: 200px; }

@media (max-height: 820px) {
  #metas .mt-frame__tag { display: none; }
}

/* ---------- Tablet ---------- */
@media (max-width: 1080px) and (min-width: 821px) {
  #metas .mt-readout { display: none; }
}

/* ---------- Celular ---------- */
@media (max-width: 820px) {
  #metas .mt-pin { min-height: 0; padding-block: clamp(84px, 12vh, 120px) 72px; }
  #metas .mt-frame { display: none; }
  #metas .mt-head { display: block; }
  #metas .mt-title { font-size: clamp(28px, 8vw, 40px); }
  #metas .mt-readout { display: none; }
  #metas .mt-grid { --mt-gh: 200px; grid-template-columns: minmax(0, 1fr); row-gap: 22px; margin-top: 28px; }
  #metas .mt-cell { padding: 18px 0 0; gap: 8px; }
  #metas .mt-cell::before { display: none; }
  #metas .mt-cell:nth-child(n)::after { display: block; left: 0; right: 0; top: -11px; }
  #metas .mt-cell:first-child::after { display: none; }
  #metas .mt-cell__top, #metas .mt-gauge, #metas .mt-label { width: min(100%, 440px); }
  #metas .mt-label { font-size: 17px; }
  #metas .mt-watermark { font-size: 62vw; bottom: 1%; }
  #metas .mt-foot { display: grid; gap: 12px; margin-top: 28px; }
  #metas .mt-legend { font-size: 10px; }
}

/* ---------- Movimento reduzido ---------- */
.reduced #metas .mt-pin { min-height: 0; padding-block: clamp(96px, 14vh, 150px) clamp(60px, 10vh, 110px); }
.reduced #metas .mt-grid { --mt-gh: 200px; }
.reduced #metas .mt-runner__halo { animation: none; }
@media (max-width: 820px) { .reduced #metas .mt-grid { --mt-gh: 200px; } }
