:root {
  color-scheme: light;
  --ink: #151515;
  --muted: #66645f;
  --paper: #f6f0e5;
  --panel: #fffaf0;
  --line: rgba(21, 21, 21, 0.16);
  --accent: #e7462d;
  --blue: #1f5d9f;
  --green: #197c55;
}

* {
  box-sizing: border-box;
  min-width: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  font-family:
    "Avenir Next", "Trebuchet MS", ui-sans-serif, system-ui, sans-serif;
  background:
    linear-gradient(90deg, rgba(21, 21, 21, 0.05) 1px, transparent 1px),
    linear-gradient(rgba(21, 21, 21, 0.05) 1px, transparent 1px),
    var(--paper);
  background-size: 42px 42px;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input {
  font: inherit;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 16px clamp(18px, 4vw, 54px);
  border-bottom: 1px solid var(--line);
  background: rgba(246, 240, 229, 0.88);
  backdrop-filter: blur(16px);
}

.topbar > a,
.topbar nav a,
.eyebrow,
.control-panel label span,
.metric-grid span,
.metric-grid small,
.progress-card span,
.legend {
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

.topbar > a {
  font-size: 18px;
}

.topbar nav {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  color: var(--muted);
}

main {
  display: grid;
  gap: 22px;
  padding: 22px clamp(18px, 4vw, 54px) 54px;
}

.hero,
.result-panel,
.timeline {
  border: 1px solid var(--line);
  background: rgba(255, 250, 240, 0.82);
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 420px);
  gap: clamp(28px, 6vw, 72px);
  align-items: end;
  min-height: min(720px, calc(100svh - 110px));
  padding: clamp(28px, 5vw, 62px);
}

.eyebrow {
  margin: 0 0 14px;
  color: var(--accent);
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  max-width: 920px;
  margin-bottom: 24px;
  font-size: clamp(54px, 8vw, 112px);
  line-height: 0.9;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 0;
  font-size: clamp(38px, 6vw, 78px);
  line-height: 0.92;
}

.hero-copy p:last-child {
  max-width: 680px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: clamp(18px, 2vw, 23px);
  line-height: 1.62;
}

.control-panel {
  display: grid;
  gap: 20px;
  padding: 22px;
  border: 2px solid var(--ink);
  background: var(--panel);
  box-shadow: 10px 10px 0 rgba(21, 21, 21, 0.12);
}

.control-panel label {
  display: grid;
  gap: 9px;
}

.control-panel label span {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
}

.control-panel input[type="date"] {
  min-height: 52px;
  border: 2px solid var(--ink);
  padding: 0 14px;
  background: #ffffff;
  color: var(--ink);
}

.control-panel input[type="range"] {
  accent-color: var(--accent);
}

.field-help {
  margin: -12px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.control-panel button {
  min-height: 52px;
  border: 2px solid var(--ink);
  background: var(--ink);
  color: var(--panel);
  cursor: pointer;
  font-weight: 950;
  transition:
    transform 160ms ease,
    box-shadow 160ms ease;
}

.control-panel button:hover {
  transform: translate(-2px, -2px);
  box-shadow: 6px 6px 0 var(--accent);
}

.result-panel {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(280px, 0.85fr);
  gap: 0;
}

.result-panel[hidden] {
  display: none;
}

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

.metric-grid article {
  min-height: 180px;
  padding: clamp(18px, 3vw, 30px);
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.metric-grid strong {
  display: block;
  margin: 18px 0 6px;
  color: var(--accent);
  font-size: clamp(38px, 6vw, 76px);
  line-height: 0.9;
}

.metric-grid span,
.metric-grid small,
.progress-card span,
.progress-card p,
.legend {
  color: var(--muted);
}

.progress-card {
  display: grid;
  align-content: center;
  gap: 20px;
  padding: clamp(20px, 4vw, 34px);
}

.progress-card strong {
  display: block;
  margin-top: 8px;
  font-size: clamp(24px, 4vw, 42px);
  line-height: 1;
}

.progress-track {
  height: 20px;
  overflow: hidden;
  border: 2px solid var(--ink);
  background: #ffffff;
}

.progress-track span {
  display: block;
  width: 0%;
  height: 100%;
  background:
    repeating-linear-gradient(
      90deg,
      var(--green) 0 12px,
      var(--blue) 12px 24px
    );
  transition: width 260ms ease;
}

.progress-card p {
  margin-bottom: 0;
  line-height: 1.6;
}

.summary-box {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.52);
}

.summary-box p {
  min-height: 48px;
}

.summary-box button {
  min-height: 42px;
  border: 2px solid var(--ink);
  background: #ffffff;
  color: var(--ink);
  cursor: pointer;
  font-weight: 950;
}

.summary-box button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

.timeline {
  display: grid;
  gap: 28px;
  padding: clamp(24px, 5vw, 52px);
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
}

.legend span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.legend i {
  width: 13px;
  height: 13px;
  border: 1px solid var(--ink);
}

.legend .lived {
  background: var(--accent);
}

.legend .current {
  background: var(--blue);
}

.legend .future {
  background: #ffffff;
}

.year-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(18px, 1fr));
  gap: 7px;
}

.year-cell {
  aspect-ratio: 1;
  border: 1px solid var(--line);
  background: #ffffff;
}

.year-cell.lived {
  border-color: var(--accent);
  background: var(--accent);
}

.year-cell.current {
  border-color: var(--blue);
  background: var(--blue);
}

.year-cell.future {
  background: rgba(255, 255, 255, 0.58);
}

@media (max-width: 880px) {
  .hero,
  .result-panel {
    grid-template-columns: 1fr;
  }

  .hero {
    min-height: auto;
  }
}

@media (max-width: 560px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  main {
    padding: 12px 10px 42px;
  }

  .hero,
  .timeline {
    padding: 20px;
  }

  h1 {
    font-size: clamp(46px, 16vw, 66px);
  }

  .metric-grid {
    grid-template-columns: 1fr;
  }
}
