/* Visual refresh. The original stylesheet stays byte-for-byte; this file only tightens the tool-site presentation. */

html { color-scheme: light; }
body {
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr auto;
  font: 18px/1.6 var(--font);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
::selection { background: #c5e6df; color: var(--ink); }

.skip:focus {
  border-radius: 10px;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  z-index: 30;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.site-header {
  background: rgba(255, 253, 249, 0.9);
  border-bottom-color: rgba(221, 212, 198, 0.95);
  backdrop-filter: blur(16px);
}
.site-header .wrap.header-bar {
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 60px;
  padding: 0;
}
.logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  font-size: 1.05rem;
  letter-spacing: -0.04em;
}
.logo-mark { display: block; flex: none; }
.logo-word { white-space: nowrap; }
.menu { position: relative; margin: 0; }
.menu-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  margin: 0;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--paper);
  color: var(--ink);
  cursor: pointer;
  list-style: none;
}
.menu-toggle::-webkit-details-marker,
.menu-toggle::marker { display: none; content: ""; }
.menu-toggle:hover { background: var(--accent-soft); border-color: #c9ddd8; }
.menu-icon,
.menu-icon::before,
.menu-icon::after {
  display: block;
  width: 16px;
  height: 2px;
  border-radius: 1px;
  background: currentColor;
  position: relative;
}
.menu-icon::before,
.menu-icon::after {
  content: "";
  position: absolute;
  left: 0;
}
.menu-icon::before { top: -5px; }
.menu-icon::after { top: 5px; }
.menu[open] .menu-icon { background: transparent; }
.menu[open] .menu-icon::before { top: 0; transform: rotate(45deg); }
.menu[open] .menu-icon::after { top: 0; transform: rotate(-45deg); }

.nav { align-items: center; gap: 2px; flex-wrap: nowrap; }
.nav > a,
.nav-group > summary {
  font-weight: 600;
  letter-spacing: -0.01em;
}
.nav a:focus-visible,
.nav-group > summary:focus-visible,
.menu-toggle:focus-visible,
.logo:focus-visible,
.btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.nav-group > summary::after {
  content: "";
  display: inline-block;
  width: 0.38em;
  height: 0.38em;
  margin-left: 0.45em;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: translateY(-0.15em) rotate(45deg);
  vertical-align: 0.05em;
}
.nav-group[open] > summary::after { transform: translateY(0.05em) rotate(225deg); }
.nav-dropdown {
  border-radius: 14px;
  padding: 6px;
}
.nav-dropdown a { font-weight: 400; font-size: 0.95rem; }

@media (min-width: 721px) {
  .menu { display: flex; align-items: center; }
  .menu > .nav { display: flex !important; align-items: center; }
  .menu-toggle { display: none !important; }
}

@media (max-width: 720px) {
  .site-header .wrap.header-bar {
    flex-direction: row;
    align-items: center;
    min-height: 56px;
    padding: 0;
  }
  .menu-toggle { display: inline-flex; }
  .nav { width: auto; gap: 2px; }
  .menu:not([open]) > .nav { display: none; }
  .menu[open] > .nav {
    display: flex !important;
    flex-direction: column;
    align-items: stretch;
    position: absolute;
    right: 0;
    top: calc(100% + 8px);
    width: min(19rem, calc(100vw - 32px));
    max-height: calc(100dvh - 72px);
    overflow: auto;
    padding: 6px;
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: 16px;
    box-shadow: 0 12px 40px rgba(28, 25, 21, 0.12);
    z-index: 8;
  }
  .menu[open] > .nav > a,
  .menu[open] .nav-group > summary {
    display: block;
    padding: 11px 12px;
    border-radius: 10px;
  }
  .menu[open] .nav-group { width: 100%; }
  .nav-dropdown {
    position: static;
    min-width: 0;
    margin: 0;
    padding: 0 0 4px;
    border: 0;
    box-shadow: none;
    background: transparent;
  }
  .nav-dropdown a {
    padding: 9px 12px 9px 18px;
    color: var(--muted);
    font-weight: 400;
  }
  .hero h1, .page h1 { font-size: 1.9rem; }
}

.hero { padding: 36px 0 18px; }
.hero h1, .page h1 {
  font-size: clamp(1.9rem, 1.35rem + 1.5vw, 2.6rem);
  line-height: 1.12;
  letter-spacing: -0.035em;
  text-wrap: balance;
}
.lede { line-height: 1.55; text-wrap: pretty; }
.hero-grid { gap: 18px 32px; }
.kicker, .callout .label { letter-spacing: 0.07em; }

.panel,
.card,
.example,
.penalty,
.diagram {
  border-color: #e4d9cb;
  box-shadow: 0 1px 2px rgba(28, 25, 21, 0.04), 0 14px 34px rgba(28, 25, 21, 0.05);
}
.panel { padding: 22px 22px 20px; }
.fact,
.example,
.penalty,
.card,
.faq details {
  box-shadow: 0 1px 2px rgba(28, 25, 21, 0.035);
}
.fact { padding: 13px 14px; }
a.card { transition: border-color 0.15s ease, transform 0.15s ease; }
a.card:hover { transform: translateY(-1px); }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  a.card { transition: none; }
  a.card:hover { transform: none; }
}

.panel h2, .section h2, .facts h2, .prose h2, .related h2 {
  letter-spacing: -0.02em;
  text-wrap: balance;
}
input[type="date"], input[type="number"], input[type="text"], select {
  border-color: #e3d8ca;
  border-radius: 12px;
  background: #fff;
}
.btn { letter-spacing: -0.01em; }
.result .amount, .example .sum { color: var(--accent-dark); }
.formula { border-left: 3px solid var(--accent); }

.table-wrap {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}
th, td { padding: 11px 12px; }
thead th { background: #faf7f2; }

.page { padding: 32px 0 72px; }
.section { padding: 6px 0 40px; }

.site-footer {
  margin-top: 12px;
  padding: 22px 0 28px;
  background: rgba(255, 253, 249, 0.72);
}
.site-footer .wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 24px;
}
.site-footer p,
.site-footer nav { margin: 0; }
.site-footer a:hover { text-decoration: underline; text-underline-offset: 3px; }
@media (max-width: 720px) {
  .site-footer .wrap {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
}

.diagram {
  padding: 18px 18px 14px;
  scroll-margin-top: 76px;
}
.diagram p { margin: 0 0 8px; }
.diagram-title {
  font: 600 1.35rem/1.25 var(--serif);
  letter-spacing: -0.02em;
  color: var(--ink);
  margin: 0 0 4px;
  text-wrap: balance;
}
.diagram-sub { color: var(--muted); }
.diagram-note { color: var(--muted); font-size: 0.92rem; }
.diagram-kicker {
  margin: 0 0 4px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--accent-dark);
}
.diagram-formula {
  margin: 12px 0;
  padding: 12px 14px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
}
.diagram-formula-line {
  margin: 0 0 6px;
  font-weight: 600;
  font-size: 1.02rem;
  letter-spacing: -0.02em;
  text-wrap: balance;
}
.diagram-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  margin: 0;
  padding: 0;
  list-style: none;
  color: var(--muted);
  font-size: 0.92rem;
}
.swatch {
  display: inline-block;
  width: 14px;
  height: 10px;
  margin-right: 6px;
  border-radius: 3px;
  vertical-align: -1px;
}
.swatch-free { background: #e8e2d6; box-shadow: inset 0 0 0 1px #ddd4c6; }
.swatch-paid { background: #0F766E; }
.fee-example {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}
.fee-example-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 4px 16px;
  margin-bottom: 10px;
}
.fee-example-title {
  flex: 1 1 14rem;
  margin: 0;
  font: 600 1.2rem/1.3 var(--serif);
  letter-spacing: -0.02em;
  text-wrap: balance;
}
.fee-amount {
  margin: 0;
  font: 600 2rem/1 var(--serif);
  letter-spacing: -0.03em;
  color: var(--accent-dark);
}
.meter {
  display: flex;
  height: 14px;
  overflow: hidden;
  border-radius: 999px;
  background: #e8e2d6;
  box-shadow: inset 0 0 0 1px #ddd4c6;
}
.meter-free { background: #e8e2d6; }
.meter-paid { background: #0F766E; min-width: 8px; }
.meter-caption,
.meter-ends,
.rollout-frame {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.88rem;
}
.meter-caption { justify-content: flex-start; gap: 6px 16px; color: var(--ink); font-weight: 600; }
.meter-ends, .rollout-frame { justify-content: space-between; }
.diagram figcaption { margin: 12px 2px 0; }

.rollout {
  list-style: none;
  margin: 12px 0 0;
  padding: 0;
}
.rollout-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 6px;
  padding: 10px 0;
  border-top: 1px solid var(--line);
}
.rollout-id {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 2px 12px;
  margin: 0;
}
.rollout-region { font-weight: 600; }
.rollout-dates { color: var(--muted); font-size: 0.92rem; }
.rollout-track {
  position: relative;
  height: 12px;
  margin: 0;
  border-radius: 999px;
  background: #e8e2d6;
  box-shadow: inset 0 0 0 1px #ddd4c6;
}
.rollout-bar {
  position: absolute;
  top: 0;
  bottom: 0;
  left: calc(var(--from) * 100%);
  width: calc(var(--span) * 100%);
  border-radius: 999px;
  background: #0F766E;
}
.rollout-frame { margin-top: 12px; }
@media (min-width: 721px) {
  .rollout-row {
    grid-template-columns: minmax(11rem, 17rem) minmax(0, 1fr);
    align-items: center;
    column-gap: 18px;
  }
  .rollout-id { flex-direction: column; align-items: flex-start; gap: 0; }
}
@media (max-width: 720px) {
  .diagram { padding: 14px 14px 12px; }
  .fee-amount { font-size: 1.7rem; }
}
