:root {
  color-scheme: dark;
  --ink: #f5f2e9;
  --muted: #a9aaa4;
  --panel: #171918;
  --panel-2: #202321;
  --line: #3a3e39;
  --lime: #c9ff3d;
  --orange: #ff7a38;
  --danger: #ff6b69;
  --page: #0b0d0c;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-width: 320px;
  background:
    linear-gradient(rgba(255,255,255,.022) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.022) 1px, transparent 1px),
    var(--page);
  background-size: 32px 32px;
  color: var(--ink);
}

a { color: inherit; }

.site-header, main, footer {
  width: min(1120px, calc(100% - 40px));
  margin-inline: auto;
}

.site-header {
  height: 82px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--lime);
  text-decoration: none;
  font-size: 1.08rem;
  font-weight: 800;
  letter-spacing: .02em;
}

.brand-mark { width: 36px; height: 36px; }

.repo-link, .text-button {
  color: var(--muted);
  font: inherit;
  font-size: .9rem;
  text-decoration: none;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
}

.repo-link:hover, .repo-link:focus-visible, .text-button:hover, .text-button:focus-visible { color: var(--lime); }

.hero {
  min-height: 420px;
  display: grid;
  grid-template-columns: 1.25fr .75fr;
  gap: 64px;
  align-items: center;
  padding: 76px 0 68px;
}

.eyebrow, .step-label {
  color: var(--lime);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: .72rem;
  font-weight: 800;
  letter-spacing: .14em;
  text-transform: uppercase;
}

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

h1 {
  max-width: 760px;
  margin-bottom: 24px;
  font-size: clamp(3rem, 7vw, 5.75rem);
  line-height: .93;
  letter-spacing: -.065em;
}

h2 {
  margin-bottom: 0;
  font-size: clamp(1.6rem, 4vw, 2.5rem);
  letter-spacing: -.035em;
}

.lede {
  max-width: 690px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 1.1rem;
  line-height: 1.7;
}

.tire-visual {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
}

.tire {
  display: grid;
  place-items: center;
  width: 130px;
  aspect-ratio: 1;
  border: 20px dashed #363a37;
  border-radius: 50%;
  box-shadow: inset 0 0 0 4px var(--line), 0 20px 45px rgba(0,0,0,.35);
  color: var(--muted);
  font: 800 .65rem ui-monospace, monospace;
  letter-spacing: .12em;
}

.tire-new { width: 146px; border-color: #465426; color: var(--lime); }
.shift-arrow { color: var(--orange); font-size: 2rem; }

.calculator, .results, .boundary {
  background: color-mix(in srgb, var(--panel) 96%, transparent);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: clamp(24px, 4vw, 46px);
  box-shadow: 0 25px 80px rgba(0,0,0,.22);
}

.results, .boundary { margin-top: 24px; }

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 34px;
}

.step-label { margin-bottom: 10px; }

.input-grid {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 18px;
  align-items: end;
}

label > span, .suffix-input + span {
  display: block;
  margin-bottom: 9px;
  color: var(--muted);
  font-size: .8rem;
  font-weight: 700;
  letter-spacing: .04em;
}

input, select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #0f1110;
  color: var(--ink);
  font: 700 1rem ui-monospace, SFMono-Regular, Menlo, monospace;
  padding: 14px 15px;
  outline: none;
}

.input-grid input {
  font-size: clamp(1.1rem, 3vw, 1.55rem);
  text-transform: uppercase;
}

input:focus, select:focus { border-color: var(--lime); box-shadow: 0 0 0 3px rgba(201,255,61,.12); }

.arrow-cell { color: var(--orange); font-size: 1.6rem; padding-bottom: 12px; }

.field-note {
  margin: 12px 0 28px;
  color: var(--muted);
  font-size: .82rem;
  line-height: 1.6;
}

code { color: var(--ink); }

.option-row {
  display: grid;
  grid-template-columns: 1fr .8fr 1fr 1.25fr;
  gap: 14px;
  align-items: end;
}

.suffix-input { position: relative; }
.suffix-input input { padding-right: 40px; }
.suffix-input span { position: absolute; right: 14px; top: 14px; color: var(--muted); }

.primary-button {
  min-height: 50px;
  border: 0;
  border-radius: 10px;
  background: var(--lime);
  color: #10130a;
  font: 900 .9rem inherit;
  letter-spacing: .03em;
  cursor: pointer;
}
.primary-button:hover, .primary-button:focus-visible { background: #dcff82; transform: translateY(-1px); }

.error {
  margin-top: 20px;
  border-left: 3px solid var(--danger);
  background: rgba(255,107,105,.1);
  color: #ffd1d0;
  padding: 14px 16px;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

.metric-card {
  min-height: 150px;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel-2);
  padding: 20px;
}

.metric-card.accent { border-color: #5d7228; background: linear-gradient(145deg, #252c1b, #1a1d18); }
.metric-card p { margin-bottom: auto; color: var(--muted); font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; }
.metric-card strong { margin: 16px 0 6px; font: 800 clamp(1.55rem, 3vw, 2.1rem) ui-monospace, monospace; }
.metric-card.accent strong { color: var(--lime); }
.metric-card span { color: var(--muted); font-size: .75rem; }

.advisory {
  margin: 18px 0;
  border: 1px solid #4b5434;
  border-radius: 10px;
  background: #1d2117;
  padding: 15px 17px;
  color: #dbe8bb;
  line-height: 1.5;
}
.advisory.warning { border-color: #775234; background: #251b14; color: #ffd2b7; }

.comparison-table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th, td { padding: 15px 12px; border-bottom: 1px solid var(--line); text-align: right; white-space: nowrap; }
th:first-child, td:first-child { text-align: left; }
th { color: var(--muted); font-size: .72rem; text-transform: uppercase; letter-spacing: .07em; }
td:not(:first-child) { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }

.boundary { margin-bottom: 54px; }
.boundary-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 36px; margin-top: 24px; }
.boundary-grid p { margin-bottom: 0; color: var(--muted); line-height: 1.7; }

footer {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  border-top: 1px solid var(--line);
  padding: 28px 0 42px;
  color: var(--muted);
  font-size: .82rem;
}
footer p { margin: 0; }

@media (max-width: 820px) {
  .hero { grid-template-columns: 1fr; padding-top: 54px; }
  .tire-visual { display: none; }
  .option-row, .metric-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 560px) {
  .site-header, main, footer { width: min(100% - 24px, 1120px); }
  .repo-link { font-size: 0; }
  .repo-link span { font-size: 1rem; }
  .hero { min-height: auto; padding: 44px 0; }
  h1 { font-size: 3.25rem; }
  .calculator, .results, .boundary { padding: 22px 18px; border-radius: 12px; }
  .section-heading { align-items: flex-start; }
  .input-grid { grid-template-columns: 1fr; }
  .arrow-cell { display: none; }
  .option-row, .metric-grid, .boundary-grid { grid-template-columns: 1fr; }
  footer { flex-direction: column; }
}

@media (prefers-reduced-motion: no-preference) {
  .primary-button { transition: transform .15s ease, background .15s ease; }
}
