:root {
  --ink: #151616;
  --surface: #1f2121;
  --surface-2: #282b2b;
  --paper: #f0eee7;
  --muted: #a6a79f;
  --line: #3a3d3d;
  --accent: #83abc7;
  --accent-soft: #b7d0e0;
  --sans: "Manrope", system-ui, sans-serif;
  --serif: "Newsreader", Georgia, serif;
  --page: 1360px;
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: 80px;
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
}

button,
input {
  font: inherit;
}

a,
button {
  color: inherit;
}

a {
  text-decoration: none;
}

button {
  border: 0;
}

h1,
h2,
h3,
p {
  margin: 0;
}

:focus-visible {
  outline: 3px solid rgba(131, 171, 199, 0.58);
  outline-offset: 4px;
}

.skip-link {
  position: fixed;
  top: 10px;
  left: 10px;
  z-index: 1000;
  padding: 10px 14px;
  background: var(--accent);
  color: var(--ink);
  transform: translateY(-150%);
}

.skip-link:focus {
  transform: translateY(0);
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  min-height: 72px;
  padding: 0 max(24px, calc((100vw - var(--page)) / 2));
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 24px;
  border-bottom: 1px solid var(--line);
  background: var(--ink);
}

.brand {
  width: fit-content;
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.brand span {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border: 1px solid var(--accent);
  color: var(--accent-soft);
  font-size: 10px;
  font-weight: 700;
}

.brand strong {
  font-size: 13px;
  letter-spacing: -0.02em;
}

.site-header nav {
  display: flex;
  gap: 8px;
}

.site-header nav a,
.header-action {
  min-height: 44px;
  padding: 0 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
}

.site-header nav a:hover {
  color: var(--paper);
}

.header-action {
  justify-self: end;
  padding: 0 16px;
  border: 1px solid var(--line);
  color: var(--paper);
}

.header-action:hover {
  border-color: var(--accent);
}

.hero {
  width: min(100%, var(--page));
  min-height: calc(100svh - 72px);
  margin: 0 auto;
  padding: 72px 24px 104px;
  display: grid;
  grid-template-columns: minmax(0, 7fr) minmax(380px, 5fr);
  align-items: center;
  gap: clamp(56px, 8vw, 112px);
}

.eyebrow {
  color: var(--accent-soft);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.hero h1 {
  max-width: 12ch;
  margin-top: 20px;
  font-family: var(--serif);
  font-size: clamp(64px, 7vw, 96px);
  font-weight: 400;
  letter-spacing: -0.05em;
  line-height: 0.95;
}

.hero__copy > p:not(.eyebrow) {
  max-width: 56ch;
  margin-top: 28px;
  color: var(--muted);
  font-size: 17px;
}

.primary-button {
  min-height: 50px;
  width: fit-content;
  margin-top: 32px;
  padding: 0 18px;
  display: inline-flex;
  align-items: center;
  gap: 14px;
  background: var(--accent);
  color: var(--ink);
  font-size: 12px;
  font-weight: 700;
}

.hero__model {
  min-height: 520px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  background: var(--surface);
}

.model-header {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px 20px;
}

.model-header > span,
.model-header > small {
  color: var(--muted);
  font-size: 9px;
  font-weight: 600;
  text-transform: uppercase;
}

.model-header strong {
  grid-row: 2;
  font-size: 13px;
}

.model-header small {
  grid-row: 1 / 3;
  align-self: center;
  padding: 5px 8px;
  border: 1px solid var(--line);
}

.model-value {
  margin-top: 64px;
  display: grid;
}

.model-value span,
.model-value small {
  color: var(--muted);
  font-size: 10px;
}

.model-value strong {
  margin: 6px 0;
  color: var(--accent-soft);
  font-family: var(--serif);
  font-size: clamp(56px, 6vw, 80px);
  font-weight: 400;
  letter-spacing: -0.04em;
  line-height: 1;
}

.model-bars {
  margin-top: auto;
  display: grid;
  gap: 18px;
}

.model-bars div {
  height: 7px;
  position: relative;
  background: var(--surface-2);
}

.model-bars span {
  height: 100%;
  display: block;
  background: var(--accent);
}

.model-bars .bar-current {
  width: 30%;
}

.model-bars .bar-target {
  width: 62%;
}

.model-bars .bar-value {
  width: 46%;
}

.model-bars small {
  position: absolute;
  top: -18px;
  left: 0;
  color: var(--muted);
  font-size: 8px;
  text-transform: uppercase;
}

.hero__model > p {
  margin-top: 24px;
  color: var(--muted);
  font-size: 9px;
}

.section {
  width: min(100%, var(--page));
  margin: 0 auto;
  padding: 120px 24px;
  border-top: 1px solid var(--line);
}

.section-heading {
  margin-bottom: 56px;
  display: grid;
  grid-template-columns: minmax(0, 7fr) minmax(300px, 5fr);
  align-items: end;
  gap: 72px;
}

.section-heading h2,
.method h2,
.about h2 {
  max-width: 13ch;
  margin-top: 14px;
  font-family: var(--serif);
  font-size: clamp(52px, 6vw, 80px);
  font-weight: 400;
  letter-spacing: -0.045em;
  line-height: 0.96;
}

.section-heading > p {
  color: var(--muted);
  font-size: 14px;
}

.calculator-shell {
  border: 1px solid var(--line);
}

.calculator-tabs {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  border-bottom: 1px solid var(--line);
}

.calculator-tabs button {
  min-height: 64px;
  padding: 0 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  text-align: left;
}

.calculator-tabs button + button {
  border-left: 1px solid var(--line);
}

.calculator-tabs button.is-active {
  background: var(--accent);
  color: var(--ink);
}

.calculator-tabs span {
  font-size: 9px;
}

.calculator-panel {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.calculator-panel[hidden] {
  display: none;
}

.inputs,
.results {
  padding: clamp(24px, 4vw, 48px);
}

.inputs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 22px 16px;
  border-right: 1px solid var(--line);
}

.inputs__heading {
  grid-column: 1 / -1;
  margin-bottom: 16px;
}

.inputs__heading h3 {
  max-width: 18ch;
  margin-top: 12px;
  font-family: var(--serif);
  font-size: 34px;
  font-weight: 400;
  line-height: 1.05;
}

.inputs label {
  min-width: 0;
  position: relative;
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.inputs input {
  min-height: 54px;
  width: 100%;
  padding: 0 32px 0 12px;
  border: 1px solid var(--line);
  border-radius: 0;
  background: var(--ink);
  color: var(--paper);
  font-size: 17px;
  font-variant-numeric: tabular-nums;
}

.inputs label > span {
  position: absolute;
  right: 12px;
  top: 40px;
  color: var(--accent-soft);
  font-size: 12px;
}

.inputs small {
  color: #777a75;
  font-size: 8px;
  font-weight: 500;
  letter-spacing: 0;
  line-height: 1.4;
  text-transform: none;
}

.calculate-button {
  min-height: 48px;
  grid-column: 1 / -1;
  border: 1px solid var(--accent);
  background: transparent;
  color: var(--accent-soft);
  cursor: pointer;
  font-size: 11px;
  font-weight: 700;
}

.calculate-button:hover {
  background: var(--accent);
  color: var(--ink);
}

.results {
  background: var(--surface);
}

.results__heading {
  display: flex;
  justify-content: space-between;
  gap: 20px;
}

.results__heading > span {
  color: var(--muted);
  font-size: 9px;
  text-transform: uppercase;
}

.result-primary {
  margin-top: 40px;
  padding-bottom: 32px;
  display: grid;
  border-bottom: 1px solid var(--line);
}

.result-primary > span,
.result-primary small,
.result-grid span {
  color: var(--muted);
  font-size: 9px;
  text-transform: uppercase;
}

.result-primary strong {
  margin: 8px 0;
  color: var(--accent-soft);
  font-family: var(--serif);
  font-size: clamp(52px, 5vw, 72px);
  font-weight: 400;
  letter-spacing: -0.04em;
  line-height: 1;
}

.result-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
}

.result-grid > div {
  min-height: 105px;
  padding: 20px 0;
  display: grid;
  align-content: space-between;
  border-bottom: 1px solid var(--line);
}

.result-grid > div:nth-child(odd) {
  padding-right: 16px;
  border-right: 1px solid var(--line);
}

.result-grid > div:nth-child(even) {
  padding-left: 16px;
}

.result-grid strong {
  font-size: 22px;
  font-variant-numeric: tabular-nums;
  font-weight: 500;
}

.result-visual {
  height: 8px;
  margin-top: 28px;
  background: var(--surface-2);
}

.result-visual span {
  width: 0;
  height: 100%;
  display: block;
  background: var(--accent);
  transition: width 180ms ease;
}

.copy-button {
  min-height: 48px;
  width: 100%;
  margin-top: 24px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--paper);
  cursor: pointer;
  font-size: 11px;
  font-weight: 700;
}

.copy-button:hover {
  border-color: var(--accent);
}

.result-note {
  margin-top: 12px;
  color: var(--muted);
  font-size: 9px;
}

.method {
  display: grid;
  grid-template-columns: 5fr 7fr;
  gap: 80px;
}

.formula-list {
  border-top: 1px solid var(--line);
}

.formula-list article {
  min-height: 130px;
  padding: 20px 0;
  display: grid;
  grid-template-columns: 80px 1fr;
  align-items: center;
  gap: 20px;
  border-bottom: 1px solid var(--line);
}

.formula-list span {
  color: var(--accent-soft);
  font-size: 9px;
}

.formula-list h3 {
  font-size: 16px;
}

.formula-list code {
  grid-column: 2;
  margin-top: -32px;
  color: var(--muted);
  font-family: var(--sans);
  font-size: 11px;
}

.about {
  background: var(--paper);
  color: var(--ink);
}

.about .eyebrow {
  color: #486d88;
}

.about > p:not(.eyebrow) {
  max-width: 54ch;
  margin-top: 28px;
  color: #60625d;
}

.about__actions {
  margin-top: 32px;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.about__actions a {
  min-height: 48px;
  padding: 0 18px;
  display: inline-flex;
  align-items: center;
  border: 1px solid #c6c3b8;
  font-size: 11px;
  font-weight: 700;
}

.about__actions a:first-child {
  border-color: var(--ink);
  background: var(--ink);
  color: var(--paper);
}

footer {
  min-height: 120px;
  padding: 32px max(24px, calc((100vw - var(--page)) / 2));
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 24px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 10px;
}

footer a {
  justify-self: end;
  color: var(--paper);
}

.toast {
  position: fixed;
  z-index: 100;
  right: 20px;
  bottom: 20px;
  padding: 12px 16px;
  background: var(--accent);
  color: var(--ink);
  font-size: 11px;
  font-weight: 700;
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px);
  transition:
    opacity 160ms ease,
    transform 160ms ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 940px) {
  .hero,
  .section-heading,
  .method {
    grid-template-columns: 1fr;
  }

  .calculator-panel {
    grid-template-columns: 1fr;
  }

  .inputs {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
}

@media (max-width: 650px) {
  .site-header {
    min-height: 64px;
    padding: 0 16px;
    grid-template-columns: 1fr auto;
  }

  .site-header nav {
    display: none;
  }

  .header-action {
    min-height: 40px;
    padding: 0 11px;
  }

  .hero,
  .section {
    padding: 72px 16px;
  }

  .hero h1 {
    font-size: 58px;
  }

  .hero__model {
    min-height: 480px;
  }

  .calculator-tabs {
    grid-template-columns: 1fr;
  }

  .calculator-tabs button + button {
    border-top: 1px solid var(--line);
    border-left: 0;
  }

  .inputs,
  .results {
    padding: 24px 16px;
  }

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

  .result-primary strong {
    font-size: 48px;
  }

  .formula-list article {
    grid-template-columns: 64px 1fr;
  }

  footer {
    padding: 32px 16px;
    grid-template-columns: 1fr;
    gap: 14px;
  }

  footer a {
    justify-self: start;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
  }
}

.brand,
.header-action,
footer a {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
}
