/* One viewport: the countdown leads, with cattle and indicators below. */
:root {
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  color: #111;
  background: #fff;
  font-synthesis: none;
  --ink: #111;
  --line: #303030;
}
* { box-sizing: border-box; }
html { overflow-x: clip; }
body { margin: 0; height: 100dvh; display: grid; grid-template-rows: 64px minmax(0, 1fr); }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; background: none; border: 0; }
button, a { touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
button:focus-visible, a:focus-visible, [tabindex]:focus-visible { outline: 2px solid currentColor; outline-offset: 4px; }
[hidden] { display: none !important; }
.skip { position: fixed; top: -100px; left: 20px; padding: 14px; background: #fff; color: #111; z-index: 20; }
.skip:focus { top: 12px; }
.site-header { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 0 4vw; }
.wordmark { font-size: 31px; font-weight: 650; letter-spacing: -2px; line-height: .85; }
.wordmark span { display: block; margin-top: 7px; font-size: 9px; font-weight: 400; letter-spacing: 0; line-height: 1; }
.site-header h1 { max-width: 58vw; margin: 0; font-size: clamp(11px, 1.1vw, 15px); font-weight: 400; line-height: 1.3; text-align: right; }
main, .hero, .progress-section { min-height: 0; }
.hero { height: 100%; padding: 0 3vw 16px; }
.progress-section { height: 100%; }
.tracker {
  height: 100%;
  display: grid;
  grid-template-columns: minmax(0, .85fr) minmax(0, 1.15fr);
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  gap: clamp(10px, 2dvh, 22px) clamp(24px, 4vw, 72px);
  padding: clamp(16px, 3dvh, 32px) clamp(20px, 3vw, 48px) 12px;
  border-radius: 24px;
  background: #111;
  color: #f8f8f8;
}
.tracker-header { grid-column: 1 / -1; grid-row: 1; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.tracker-country { display: block; margin-bottom: 6px; font-size: 10px; color: #aaa; }
h2 { margin: 0; font-size: clamp(22px, 2.3vw, 32px); font-weight: 400; letter-spacing: -.055em; line-height: 1.1; }
.horizon-switch { display: flex; gap: 3px; padding: 3px; border: 1px solid #454545; border-radius: 24px; }
.horizon-switch button { min-height: 38px; padding: 8px 18px; border-radius: 20px; font-size: 12px; color: #aaa; }
.horizon-switch [aria-pressed=true] { background: #fff; color: #111; }
.countdown { grid-column: 1 / -1; grid-row: 2; display: grid; grid-template-columns: 2fr 8px 1fr 8px 1fr 8px 1fr; align-items: end; gap: clamp(6px, 1vw, 14px); }
.countdown-group { min-width: 0; }
.countdown-group > span { display: block; margin-bottom: 8px; font-size: 10px; color: #aaa; }
.countdown-digits { display: flex; align-items: end; gap: clamp(3px, .5vw, 8px); height: clamp(38px, 13dvh, 150px); }
.countdown-digits svg { display: block; width: 0; min-width: 0; flex: 1; max-height: 100%; aspect-ratio: 4 / 5; overflow: visible; }
.countdown-colon { padding-bottom: 4px; font-size: clamp(22px, 4dvh, 48px); line-height: 1; text-align: center; }
.exhibit { grid-column: 1; grid-row: 3; position: relative; min-height: 0; min-width: 0; }
.stage { position: absolute; inset: 0; }
.poster, .stage canvas { position: absolute; inset: 0; display: block; width: 100%; height: 100%; object-fit: contain; object-position: center bottom; }
.poster { filter: grayscale(1) brightness(.85); mask-image: linear-gradient(to bottom, #000 0%, #000 80%, transparent 100%); }
.stage canvas { filter: grayscale(1); touch-action: none; cursor: grab; }
.stage canvas:active { cursor: grabbing; }
.stage .chewing-canvas { filter: grayscale(1) brightness(.85); mask-image: linear-gradient(to bottom, #000 0%, #000 80%, transparent 100%); pointer-events: none; cursor: default; }
.viewer-status { position: absolute; bottom: 20px; left: 50%; transform: translateX(-50%); padding: 7px 12px; background: #fff; color: #111; font-size: 12px; border-radius: 20px; }
.model-controls { position: absolute; bottom: 4px; left: 0; right: 0; display: flex; justify-content: center; gap: 4px; }
.model-controls button { min-height: 36px; padding: 7px 12px; border: 1px solid #555; border-radius: 20px; background: #222; color: #fff; font-size: 11px; }
.model-controls [aria-pressed=true] { background: #fff; color: #111; }
.metrics { grid-column: 2; grid-row: 3; min-width: 0; min-height: 0; display: grid; grid-template-rows: auto auto minmax(0, 1fr); gap: 12px; }
.calendar { padding: 0 2px; }
.calendar-years { display: flex; justify-content: space-between; gap: 8px; font-size: 10px; color: #999; }
.calendar-field { position: relative; height: clamp(42px, 7dvh, 72px); margin-top: 12px; }
.calendar-lines { display: flex; justify-content: space-between; height: 100%; }
.calendar-lines i { width: 1px; height: 50%; background: #ffffff18; }
.now-marker { position: absolute; top: 0; height: 55%; border-left: 1px solid #fff; }
.now-dot { position: absolute; left: -4px; top: -4px; width: 7px; height: 7px; background: #fff; border-radius: 50%; }
.now-label { position: absolute; top: calc(100% + 6px); left: 0; transform: translateX(-50%); font-size: 9px; color: #bbb; }
.row-headings, .indicator-row { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(72px, .8fr) minmax(64px, .8fr) minmax(56px, .6fr); gap: 14px; align-items: center; }
.row-headings { font-size: 9px; color: #999; }
.row-headings > span:last-child { text-align: right; }
.indicator-rows { min-height: 0; list-style: none; padding: 0; margin: 0; display: grid; grid-template-rows: repeat(3, minmax(0, 1fr)); }
.indicator-row { min-width: 0; min-height: 0; border-top: 1px solid var(--line); padding: clamp(8px, 1.6dvh, 20px) 0; }
.indicator-name { min-width: 0; }
.indicator-name > button { display: flex; align-items: center; gap: 10px; min-height: 36px; padding: 0; font-size: clamp(15px, 1.5vw, 21px); font-weight: 400; letter-spacing: -.025em; }
.indicator-name > button span { font-size: 12px; color: #888; }
.indicator-name > button[aria-pressed=false] { color: #bcbcbc; }
.indicator-name > span { display: block; margin-top: 3px; font-size: 9px; line-height: 1.4; color: #999; }
.latest strong, .target strong { display: block; font-size: clamp(20px, 2vw, 28px); font-weight: 400; letter-spacing: -.045em; line-height: 1.15; }
.latest > span, .target > span { display: block; margin-top: 5px; font-size: 10px; color: #999; }
.latest:hover strong { text-decoration: underline; text-underline-offset: 4px; text-decoration-thickness: 1px; }
.target { text-align: right; }
.trend { min-width: 0; }
.trend svg { display: block; width: 100%; height: 28px; overflow: visible; }
.trend polyline { fill: none; stroke: #bbb; stroke-width: 1.5; vector-effect: non-scaling-stroke; stroke-linecap: round; stroke-linejoin: round; }
.trend > span { display: block; margin-top: 4px; font-size: 9px; color: #999; }
.tracker-footer { grid-column: 1 / -1; grid-row: 4; display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 28px; padding-top: 4px; border-top: 1px solid var(--line); font-size: 10px; color: #999; }
.tracker-footer a { padding: 8px 0; }
.tracker-footer a:hover { color: #fff; }
.chewing-control { min-height: 28px; padding: 5px 0; color: #bbb; font-size: 10px; text-decoration: underline; text-underline-offset: 3px; }
/* Historical records stay available without adding a second page section. */
.pillar-details { position: fixed; inset: 0 0 0 auto; margin: 0; width: min(560px, 100%); max-width: 100%; height: 100dvh; max-height: 100dvh; overflow: auto; border: 0; border-radius: 20px 0 0 20px; padding: 0; background: #f3f2ee; color: #161616; overscroll-behavior: contain; }
.pillar-details::backdrop { background: #0009; backdrop-filter: blur(5px); }
.detail-sheet { min-height: 100%; padding: 24px 30px; }
.detail-header { display: flex; align-items: center; justify-content: space-between; gap: 16px; font-size: 10px; color: #666; }
.detail-header button { width: 40px; height: 40px; border: 1px solid #ccc; border-radius: 50%; font-size: 28px; line-height: 1; }
.detail-sheet h2 { margin: 24px 0 12px; font-family: Georgia, 'Times New Roman', serif; font-size: clamp(30px, 5vw, 52px); letter-spacing: -.055em; overflow-wrap: anywhere; }
.detail-unit { font-size: 11px; color: #666; }
.detail-lead { display: flex; align-items: baseline; gap: 16px; margin: 24px 0; }
.detail-lead strong { font-size: 64px; font-weight: 450; letter-spacing: -.07em; line-height: 1.1; }
.detail-lead > span { font-size: 12px; color: #777; }
.detail-metrics { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; padding: 20px 0; border-block: 1px solid #ccc; }
.detail-metrics span { display: block; margin-bottom: 10px; font-size: 10px; color: #777; }
.detail-metrics strong { font-size: 23px; font-weight: 400; letter-spacing: -.04em; }
.detail-chart { width: 100%; height: 90px; margin: 24px 0 16px; overflow: visible; }
.detail-chart polyline { fill: none; stroke: #161616; stroke-width: 1.5; vector-effect: non-scaling-stroke; }
.detail-table { width: 100%; border-collapse: collapse; font-size: 13px; font-variant-numeric: tabular-nums; }
.detail-table caption { padding-bottom: 12px; text-align: left; font-size: 11px; color: #666; }
.detail-table th { font-weight: 400; text-align: left; }
.detail-table td, .detail-table th { padding: 10px 0; border-bottom: 1px solid #d8d7d3; }
.detail-table td, .detail-table th:last-child { text-align: right; }
.detail-table thead { font-size: 10px; color: #777; }
.detail-source { display: block; margin-top: 24px; font-size: 10px; color: #666; }
@media (max-width: 1000px) {
  .tracker { grid-template-columns: minmax(0, .7fr) minmax(0, 1.3fr); column-gap: 20px; }
  .row-headings, .indicator-row { grid-template-columns: minmax(0, 1.3fr) minmax(64px, .8fr) minmax(48px, .6fr); gap: 10px; }
  .trend, .row-headings > span:nth-child(3) { display: none; }
}
@media (max-width: 700px) {
  body { grid-template-rows: 58px minmax(0, 1fr); }
  .site-header { padding: 0 5vw; gap: 12px; }
  .wordmark { font-size: 28px; }
  .wordmark span { font-size: 8px; margin-top: 6px; }
  .hero { padding: 0 12px 12px; }
  .tracker { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto auto minmax(80px, .8fr) minmax(0, 1.2fr) auto; gap: 12px; padding: 18px 16px 10px; border-radius: 20px; }
  .tracker-country { font-size: 9px; }
  h2 { font-size: 23px; }
  .horizon-switch button { min-height: 36px; padding: 8px 12px; font-size: 11px; }
  .countdown { grid-template-columns: 2fr 5px 1fr 5px 1fr 5px 1fr; gap: 5px; }
  .countdown-group > span { font-size: 9px; margin-bottom: 6px; }
  .countdown-digits { height: clamp(36px, 8dvh, 80px); gap: 3px; }
  .countdown-colon { font-size: 22px; padding-bottom: 2px; }
  .exhibit { grid-column: 1; grid-row: 3; }
  .metrics { grid-column: 1; grid-row: 4; grid-template-rows: minmax(0, 1fr); gap: 0; }
  .calendar, .row-headings { display: none; }
  .indicator-row { grid-template-columns: minmax(0, 1.4fr) minmax(64px, .8fr) minmax(46px, .55fr); gap: 10px; padding: 6px 0; }
  .indicator-name > button { font-size: clamp(14px, 3.6vw, 18px); min-height: 34px; gap: 6px; }
  .indicator-name > span { font-size: 8px; }
  .latest strong, .target strong { font-size: clamp(17px, 4.5vw, 25px); }
  .latest > span, .target > span { font-size: 9px; margin-top: 4px; }
  .tracker-footer { grid-row: 5; gap: 8px; font-size: 8px; }
  .chewing-control { font-size: 9px; }
  .pillar-details { border-radius: 0; }
  .detail-sheet { padding: 20px 24px; }
  .poster, .stage .chewing-canvas { object-position: center; mask-image: linear-gradient(to bottom, #000 0%, #000 75%, transparent 100%); }
}
@media (max-height: 700px) and (min-width: 701px) {
  .metrics { grid-template-rows: auto minmax(0, 1fr); }
  .calendar { display: none; }
  .tracker { row-gap: 12px; padding-block: 16px 8px; }
  .indicator-row { padding-block: 6px; }
}
@media (max-height: 500px) {
  body { grid-template-rows: 46px minmax(0, 1fr); }
  .wordmark { font-size: 25px; }
  .wordmark span { margin-top: 5px; font-size: 8px; }
  .hero { padding-bottom: 8px; }
  .tracker { row-gap: 8px; padding-block: 10px 6px; }
  .tracker-country, .calendar, .row-headings, .trend { display: none; }
  .metrics { grid-template-rows: minmax(0, 1fr); }
  h2 { font-size: 20px; }
  .countdown-digits { height: 38px; }
  .countdown-group > span { margin-bottom: 3px; font-size: 9px; }
  .indicator-row { padding-block: 4px; }
  .indicator-name > button { min-height: 28px; font-size: 14px; }
  .indicator-name > span { font-size: 8px; margin-top: 0; }
  .latest strong, .target strong { font-size: 18px; }
  .latest > span, .target > span { margin-top: 2px; font-size: 8px; }
  .tracker-footer { min-height: 24px; padding-top: 2px; }
  .chewing-control { min-height: 24px; }
}
/* Preserve readable content when zoom or a virtual keyboard leaves very little height. */
@media (max-height: 300px) {
  body { min-height: 400px; height: auto; grid-template-rows: 46px minmax(340px, 1fr); }
}
@media (prefers-reduced-motion: reduce) {
  .chewing-canvas, .chewing-control { display: none !important; }
}
