:root {
  color-scheme: light;
  --paper: #f7f3e8;
  --paper-deep: #ede6d5;
  --ink: #173f35;
  --muted: #61716a;
  --accent: #e5744f;
  --accent-dark: #bd4f30;
  --white: #fffdf8;
  --line: #d8d4c7;
  --error: #a52f25;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--paper);
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 8% 2%, rgba(229, 116, 79, 0.12), transparent 24rem),
    var(--paper);
  display: flex;
  flex-direction: column;
}

button,
input {
  font: inherit;
}

button,
a,
input {
  -webkit-tap-highlight-color: transparent;
}

a {
  color: inherit;
}

button:focus-visible,
a:focus-visible,
input:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 4px;
}

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

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

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  text-decoration: none;
  font-size: 1.05rem;
  font-weight: 750;
  letter-spacing: -0.02em;
}

.brand-mark {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 11px;
  color: var(--paper);
  background: var(--ink);
  font-size: 0.75rem;
  letter-spacing: 0.04em;
}

nav {
  display: flex;
  gap: 28px;
}

nav a,
.site-footer a {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.92rem;
}

nav a:hover,
.site-footer a:hover,
nav a[aria-current="page"] {
  color: var(--accent-dark);
}

main {
  flex: 1;
}

.hero {
  max-width: 700px;
  padding: 76px 0 38px;
}

.eyebrow {
  margin: 0 0 18px;
  color: var(--accent-dark);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 20px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(3rem, 8vw, 5.8rem);
  font-weight: 500;
  line-height: 0.98;
  letter-spacing: -0.055em;
}

.intro,
.lead {
  max-width: 590px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 1.12rem;
  line-height: 1.7;
}

.calculator {
  position: relative;
  padding: clamp(24px, 5vw, 48px);
  border: 1px solid rgba(23, 63, 53, 0.08);
  border-radius: 24px;
  background: var(--white);
  box-shadow: 0 22px 70px rgba(23, 63, 53, 0.08);
}

.date-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 22px;
}

.field label {
  display: block;
  margin-bottom: 10px;
  font-size: 0.86rem;
  font-weight: 750;
}

.label-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

input[type="date"] {
  width: 100%;
  min-height: 58px;
  padding: 12px 15px;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--ink);
  background: var(--paper);
  font-size: 1rem;
}

input[type="date"]:hover {
  border-color: var(--muted);
}

.text-button {
  padding: 0;
  border: 0;
  color: var(--accent-dark);
  background: transparent;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
}

.text-button:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.options-row {
  margin: 24px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.checkbox-label {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 0.9rem;
  cursor: pointer;
}

input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--ink);
}

.calculate-button {
  min-height: 54px;
  padding: 14px 26px;
  border: 0;
  border-radius: 12px;
  color: var(--white);
  background: var(--ink);
  font-weight: 750;
  text-decoration: none;
  cursor: pointer;
  transition: background 150ms ease, transform 150ms ease;
}

.calculate-button:hover {
  background: #245c4e;
  transform: translateY(-1px);
}

.calculate-button:active {
  transform: translateY(0);
}

.form-error,
.noscript-message {
  margin: 0 0 18px;
  color: var(--error);
  font-size: 0.9rem;
  line-height: 1.5;
}

.result {
  margin-top: 34px;
  padding-top: 30px;
  border-top: 1px solid var(--line);
}

.result-label {
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 750;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.result-number {
  margin-bottom: 8px;
  color: var(--accent-dark);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2.5rem, 7vw, 4.4rem);
  line-height: 1.1;
  letter-spacing: -0.04em;
}

.result-summary {
  margin-bottom: 6px;
  font-weight: 650;
  line-height: 1.5;
}

.result-note {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.5;
}

.explanation {
  padding: 66px 0 82px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 42px;
}

.item-number {
  display: block;
  margin-bottom: 18px;
  color: var(--accent-dark);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 0.9rem;
}

.explanation h2 {
  margin-bottom: 10px;
  font-size: 1rem;
}

.explanation p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.65;
}

.site-footer {
  min-height: 90px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.85rem;
}

.site-footer p {
  margin: 0;
}

.text-page {
  max-width: 760px;
  padding: 76px 0 90px;
}

.text-page h1 {
  margin-bottom: 28px;
  font-size: clamp(2.8rem, 7vw, 4.8rem);
  line-height: 1.05;
}

.text-page h2 {
  margin: 42px 0 12px;
  font-size: 1.25rem;
}

.text-page p:not(.eyebrow):not(.lead):not(.error-code) {
  color: var(--muted);
  line-height: 1.8;
}

.text-page .lead {
  margin-bottom: 42px;
}

.inline-link {
  display: inline-block;
  margin-top: 26px;
  color: var(--accent-dark);
  font-weight: 750;
  text-underline-offset: 5px;
}

.not-found {
  text-align: center;
}

.not-found .lead {
  margin-inline: auto;
}

.error-code {
  margin-bottom: 20px;
  color: var(--accent-dark);
  font-size: 0.85rem;
  font-weight: 800;
  letter-spacing: 0.18em;
}

.standalone-button {
  display: inline-block;
  margin-top: 20px;
}

[hidden] {
  display: none !important;
}

@media (max-width: 680px) {
  .site-header,
  .site-footer,
  main {
    width: min(100% - 32px, 1080px);
  }

  .site-header {
    min-height: 80px;
  }

  nav {
    gap: 17px;
  }

  .hero {
    padding: 52px 0 30px;
  }

  .date-grid,
  .explanation {
    grid-template-columns: 1fr;
  }

  .explanation {
    padding: 50px 0;
    gap: 32px;
  }

  .calculate-button:not(.standalone-button) {
    width: 100%;
  }

  .text-page {
    padding: 54px 0 64px;
  }
}

@media (max-width: 420px) {
  .brand > span:last-child {
    display: none;
  }

  .options-row {
    align-items: flex-start;
  }

  .checkbox-label {
    max-width: 180px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .calculate-button {
    transition: none;
  }
}
