@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("fonts/inter-latin-400-normal.woff2") format("woff2");
}

@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("fonts/inter-latin-600-normal.woff2") format("woff2");
}

@font-face {
  font-family: "Source Serif 4";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("fonts/source-serif-4-latin-500-normal.woff2") format("woff2");
}

:root {
  --text: #4d5656;
  --brand: #0047d4;
  --secondary: #003333;
  --bg: #eef2f1;
  --surface: #ffffff;
  --line: #d5dfdc;
  --line-strong: #c5d0cc;
  --error: #8c2f2f;
  --focus: #0047d4;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  color-scheme: light;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, "Segoe UI", sans-serif;
  font-size: 1.0625rem;
  line-height: 1.6;
}

.page {
  max-width: 42rem;
  margin: 0 auto;
  padding: 2.5rem 1.25rem 4rem;
}

.masthead {
  margin-bottom: 1.5rem;
}

.org {
  margin: 0;
  color: var(--secondary);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.partner {
  margin: 0.15rem 0 0;
  color: var(--secondary);
  font-family: "Source Serif 4", Georgia, serif;
  font-size: 1.15rem;
  font-weight: 500;
}

.sheet {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 1.75rem 1.25rem 2rem;
}

h1,
h2,
h3 {
  font-family: "Source Serif 4", Georgia, serif;
  font-weight: 500;
  line-height: 1.2;
}

h1 {
  margin: 0;
  color: var(--brand);
  font-size: clamp(2rem, 5vw, 2.75rem);
}

h1::after {
  content: "";
  display: block;
  width: 3rem;
  height: 2px;
  margin-top: 1rem;
  background: var(--brand);
}

.lede {
  margin: 1.25rem 0 0;
  max-width: 38rem;
}

.block {
  margin-top: 2.25rem;
}

.block h2,
.results h2,
.disclaimer h2 {
  margin: 0 0 0.4rem;
  color: var(--secondary);
  font-size: 1.5rem;
}

.hint,
.day-count,
.detail,
.disclaimer p {
  margin: 0.35rem 0 0;
}

.field {
  margin-top: 1rem;
}

.field-label,
.field > label {
  display: block;
}

.field > label,
.field-label {
  margin-bottom: 0.4rem;
  font-weight: 600;
}

.segmented {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.segment {
  position: relative;
  display: flex;
  flex: 1 1 8.5rem;
}

.segment input {
  position: absolute;
  inset: 0;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.segment span,
.segmented > button {
  display: flex;
  flex: 1;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0.65rem 0.85rem;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  text-align: center;
  cursor: pointer;
}

.segmented > button {
  flex: 1 1 8.5rem;
}

.segment input:checked + span,
.segmented > button[aria-pressed="true"] {
  border-color: var(--brand);
  background: var(--brand);
  color: #ffffff;
  font-weight: 600;
}

.segment:has(input:focus-visible) span,
.segmented > button:focus-visible,
.calculate:focus-visible,
select:focus-visible,
input[type="date"]:focus-visible,
.amount-row:focus-within {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.amount-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 48px;
  padding: 0 0.9rem;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--surface);
}

.amount-row input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: none;
  padding: 0.75rem 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 1.0625rem;
}

.affix {
  color: var(--secondary);
  font-weight: 600;
}

select:disabled {
  color: var(--text);
  opacity: 1;
}

select,
input[type="date"] {
  width: 100%;
  min-height: 48px;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 1.0625rem;
}

.dates {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.25rem 1rem;
  margin-top: 1rem;
}

.day-count {
  margin-top: 0.9rem;
  font-weight: 600;
}

.error {
  margin: 0.45rem 0 0;
  color: var(--error);
}

.actions {
  margin-top: 1.75rem;
}

.calculate {
  width: 100%;
  min-height: 48px;
  padding: 0.75rem 1.5rem;
  border: 0;
  border-radius: 8px;
  background: var(--brand);
  color: #ffffff;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.calculate:hover {
  background: #003bb4;
}

#results-page > .revise {
  margin-top: 1.35rem;
}

.revise {
  min-height: 48px;
  margin: 0 0 1.25rem;
  padding: 0.65rem 1.1rem;
  border: 1px solid var(--brand);
  border-radius: 8px;
  background: var(--surface);
  color: var(--brand);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.revise:hover {
  background: #f3f6ff;
}

.revise:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

#results-page > .actions {
  margin-top: 2rem;
}

#results-page > .actions .revise {
  margin-bottom: 0;
}

.results-kicker {
  margin: 0.85rem 0 0;
}

.compare {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
  margin-top: 1.5rem;
}

.bill-card {
  padding: 1.1rem 1.15rem 1.2rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
}

.bill-card.new {
  border-color: var(--brand);
  background: #f4f7ff;
}

.bill-card h2 {
  margin: 0;
  color: var(--secondary);
  font-family: Inter, "Segoe UI", sans-serif;
  font-size: 1rem;
  font-weight: 600;
}

.bill-figure {
  margin: 0.2rem 0 0;
  color: var(--secondary);
  font-family: "Source Serif 4", Georgia, serif;
  font-size: clamp(2rem, 5vw, 2.6rem);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}

.bill-card p:last-child {
  margin: 0.55rem 0 0;
}

.impact {
  margin: 0.75rem 0 0;
  padding: 1.25rem 1.3rem 1.35rem;
  border: 0;
  border-radius: 12px;
  background: var(--secondary);
  color: #ffffff;
}

.impact-kind {
  margin: 0;
  color: #ffffff;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.impact-figure {
  margin: 0.15rem 0 0;
  color: #ffffff;
  font-family: "Source Serif 4", Georgia, serif;
  font-size: clamp(2.75rem, 8vw, 3.75rem);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  line-height: 1.05;
}

.impact p {
  margin: 0.35rem 0 0;
  color: #ffffff;
}

.details {
  margin-top: 2rem;
}

.details h2,
.neighbours h2 {
  margin-bottom: 0.75rem;
}

.lines {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin: 0;
}

.pair {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.15rem;
}

.pair dt {
  font-weight: 600;
  color: var(--secondary);
}

.pair dd {
  margin: 0;
}

.money {
  font-variant-numeric: tabular-nums;
}

.pair .money {
  font-weight: 600;
}

.neighbours {
  margin-top: 2rem;
}

.neighbour-row {
  display: grid;
  gap: 0.75rem;
}

.neighbours h2 {
  margin-bottom: 0.35rem;
}

.neighbour {
  margin-top: 0.9rem;
  padding: 1rem 1rem 1.05rem;
  border: 1px solid var(--line);
  border-radius: 10px;
}

.neighbour h3 {
  margin: 0;
  color: var(--secondary);
  font-size: 1.25rem;
}

.neighbour .name {
  margin: 0.35rem 0 0;
  font-weight: 600;
}

.neighbour-bill {
  margin: 0.7rem 0 0;
  color: var(--secondary);
  font-family: "Source Serif 4", Georgia, serif;
  font-size: 1.85rem;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}

.neighbour-bill span {
  display: block;
  margin-bottom: 0.15rem;
  font-family: Inter, "Segoe UI", sans-serif;
  font-size: 0.95rem;
  font-weight: 600;
}

.neighbour-delta {
  margin: 0.45rem 0 0;
  font-weight: 600;
}

.omit {
  margin: 0.9rem 0 0;
}

.disclaimer {
  margin-top: 1.5rem;
  padding: 0 0.25rem;
}

.disclaimer h2 {
  font-size: 1.35rem;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.noscript {
  max-width: 42rem;
  margin: 1rem auto;
  padding: 0 1.25rem;
  color: var(--text);
}

@media (min-width: 640px) {
  .page {
    padding-top: 4rem;
  }

  .sheet {
    padding: 2.75rem 2.5rem 2.5rem;
  }

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

  .pair {
    grid-template-columns: 11.5rem 1fr;
    gap: 0.15rem 1.25rem;
    align-items: baseline;
  }

  .calculate,
  .revise {
    width: auto;
    min-width: 11rem;
  }

  .compare,
  .neighbour-row.two {
    grid-template-columns: 1fr 1fr;
  }
}
