:root {
  --bg: #f3efe7;
  --card: #fffdf8;
  --ink: #1c1916;
  --muted: #4e4943;
  --line: #e3dacd;
  --accent: #9c341f;
  --green: #1a4333;
  --warn-bg: #fbf3e4;
  --warn: #7a4e0d;
  --shadow: 0 18px 40px rgba(48, 32, 16, 0.06);
  color-scheme: light;
}

* { box-sizing: border-box; }

html { scrollbar-gutter: stable; }

[hidden] { display: none !important; }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(1200px 400px at 10% -10%, rgba(156, 52, 31, 0.08), transparent 50%),
    var(--bg);
  color: var(--ink);
  font-family: "Segoe UI", Candara, sans-serif;
  line-height: 1.5;
}

main {
  flex: 1;
  width: min(1100px, calc(100% - 2rem));
  margin-inline: auto;
}

.site-header {
  width: 100%;
  border-bottom: 1px solid var(--line);
  background: #fffdf8;
  position: sticky;
  top: 0;
  z-index: 2;
}

.head-inner {
  width: min(1100px, calc(100% - 2rem));
  margin-inline: auto;
  padding: 0.75rem 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.65rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  color: inherit;
  text-decoration: none;
  font-weight: 700;
}

.brand em {
  font-style: normal;
  color: var(--accent);
}

.mark,
.logo {
  display: block;
  width: 3.5rem;
  height: 3.5rem;
  border-radius: 8px;
}

nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.9rem 1.1rem;
}

nav a {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.92rem;
}

nav a:hover,
.brand:hover em { color: var(--ink); }

.site-header nav {
  width: 100%;
  align-items: center;
  gap: 0.15rem;
}

.site-header nav a {
  display: inline-flex;
  align-items: center;
  line-height: 1;
  min-height: 2rem;
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
}

.site-header nav a[aria-current="page"] {
  background: var(--ink);
  color: #fffdf8;
}

.site-header nav a[aria-current="page"]:hover { color: #fffdf8; }

.crumbs {
  margin: 0.2rem 0 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.crumbs a { color: inherit; }

.page-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem 1.1rem;
  margin: 0.9rem 0 0;
}

.page-links a { color: var(--muted); }

.score-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.8rem;
  margin-top: 0.4rem;
}

.score-grid article {
  padding: 0.7rem 0.2rem 0.2rem;
}

.score-grid .median {
  font-size: clamp(2rem, 4vw, 3.1rem);
}

.plate-list {
  margin: 0.4rem 0 0;
  padding: 0;
  list-style: none;
}

.plate-list li {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.45rem 0;
  border-bottom: 1px solid var(--line);
  font-variant-numeric: tabular-nums;
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.hero { padding: 1.4rem 0 1.1rem; }

.eyebrow {
  margin: 0;
  color: var(--accent);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

h1, h2, h3 { line-height: 1.15; }

h1 {
  margin: 0.35rem 0 0.6rem;
  font-family: Georgia, "Iowan Old Style", Palatino, serif;
  font-size: clamp(2.5rem, 5vw, 4.3rem);
  font-weight: 600;
  letter-spacing: -0.035em;
}

.lede {
  max-width: 40rem;
  margin: 0;
  color: var(--muted);
  font-size: 1.12rem;
}

.tool {
  display: grid;
  grid-template-columns: minmax(270px, 360px) minmax(0, 1fr);
  gap: 1.1rem;
  align-items: start;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
}

.form-card,
.result-card { padding: 1.15rem 1.15rem 1.3rem; }

.form-card h2,
.prose h2 {
  margin: 0 0 0.8rem;
  font-family: Georgia, "Iowan Old Style", Palatino, serif;
  font-size: 1.55rem;
  font-weight: 600;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-bottom: 0.85rem;
}

.field span,
fieldset legend {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

fieldset {
  border: 0;
  margin: 0 0 0.9rem;
  padding: 0;
}

input,
select,
button {
  font: inherit;
  color: inherit;
}

input[type="number"],
select {
  width: 100%;
  padding: 0.72rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: white;
}

.segment {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  padding: 4px;
  background: var(--bg);
  border-radius: 999px;
}

.segment.three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border-radius: 12px;
}

.segment label {
  position: relative;
  text-align: center;
  padding: 0.55rem 0.25rem;
  border-radius: 999px;
  cursor: pointer;
  font-size: 0.92rem;
  font-weight: 700;
}

.segment.three label {
  border-radius: 8px;
  font-size: 0.78rem;
}

.segment input {
  position: absolute;
  opacity: 0;
  inset: 0;
  margin: 0;
}

.segment label:has(input:checked) {
  background: var(--ink);
  color: white;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.ghost {
  border: 1px solid var(--line);
  background: transparent;
  border-radius: 999px;
  padding: 0.55rem 0.8rem;
  cursor: pointer;
}

.ghost:hover { background: var(--bg); }

.result-kicker {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.median {
  margin: 0.15rem 0 0.2rem;
  color: var(--green);
  font-family: Georgia, "Iowan Old Style", Palatino, serif;
  font-size: clamp(3.2rem, 7vw, 5rem);
  letter-spacing: -0.045em;
  line-height: 0.95;
}

.precise,
.spread,
.load-note,
.table-note,
.empty {
  margin: 0.25rem 0 0.7rem;
  color: var(--muted);
}

.load-note:empty { display: none; }

.warn {
  margin: 0 0 0.9rem;
  padding: 0.7rem 0.8rem;
  border-radius: 10px;
  background: var(--warn-bg);
  color: var(--warn);
}

.result-card h3 {
  margin: 1.1rem 0 0.45rem;
  font-size: 1rem;
}

.table-wrap { overflow-x: auto; }

table {
  width: 100%;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
}

th,
td {
  padding: 0.48rem 0.35rem;
  border-bottom: 1px solid var(--line);
  text-align: left;
}

th {
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

td:last-child,
th:last-child { text-align: right; }

.prose { padding: 2.2rem 0 0.2rem; }

.prose p,
.prose li { font-size: 1.05rem; }

.prose a { color: var(--accent); }

.prose h3 {
  margin: 1.3rem 0 0.3rem;
  font-size: 1.15rem;
}

.card.flat {
  box-shadow: none;
  padding: 0.3rem 0.8rem;
  margin: 1rem 0;
}

.disclaimer {
  padding: 0.8rem 0.9rem;
  border-left: 3px solid var(--accent);
  color: var(--muted);
}

.site-footer {
  width: 100%;
  margin-top: 2.5rem;
  padding: 0;
  border-top: 1px solid var(--line);
  background: var(--card);
  color: var(--muted);
  font-size: 0.9rem;
}

.foot-inner {
  width: min(1100px, calc(100% - 2rem));
  margin-inline: auto;
  padding: 1.45rem 0 1.7rem;
}

.foot-nav {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1.2rem 1.5rem;
}

.foot-nav div { display: flex; flex-direction: column; }

.foot-nav p {
  margin: 0 0 0.3rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.foot-nav a {
  display: block;
  padding: 0.16rem 0;
}

.fine {
  margin: 1.15rem 0 0;
  padding-top: 0.9rem;
  border-top: 1px solid var(--line);
  font-size: 0.88rem;
}

@media (max-width: 860px) {
  .tool { grid-template-columns: 1fr; }
  .segment.three label { font-size: 0.72rem; }
  .score-grid { grid-template-columns: 1fr; }
  .foot-nav { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 560px) {
  .foot-nav { grid-template-columns: 1fr; }
}
