:root {
  color-scheme: light;
  --ink: #151827;
  --muted: #61677a;
  --line: #e3e5ec;
  --surface: #ffffff;
  --canvas: #f7f7fb;
  --purple: #7137d7;
  --purple-dark: #5123a4;
  --purple-soft: #f2ebff;
  --green: #097a55;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

.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;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--canvas);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.65;
}

a {
  color: var(--purple-dark);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

a:hover {
  color: var(--purple);
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  border-bottom: 1px solid rgba(227, 229, 236, 0.9);
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(12px);
}

.nav {
  display: flex;
  width: min(1160px, calc(100% - 40px));
  min-height: 68px;
  margin: 0 auto;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  color: var(--ink);
  font-weight: 800;
  letter-spacing: -0.02em;
  text-decoration: none;
  white-space: nowrap;
}

.brand-mark {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--purple), #4f46e5);
  color: white;
  font-size: 14px;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 18px;
  font-size: 14px;
  font-weight: 650;
}

.nav-links a {
  color: #44495a;
  text-decoration: none;
}

.nav-links .button,
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  border-radius: 9px;
  padding: 0 17px;
  background: var(--purple);
  color: white;
  font-weight: 750;
  text-decoration: none;
  transition: transform 160ms ease, background 160ms ease;
}

.nav-links .button:hover,
.button:hover {
  background: var(--purple-dark);
  color: white;
  transform: translateY(-1px);
}

.hero {
  border-bottom: 1px solid var(--line);
  background:
    radial-gradient(circle at 85% 10%, rgba(113, 55, 215, 0.18), transparent 30%),
    linear-gradient(180deg, #ffffff, #faf8ff);
}

.hero-inner {
  width: min(980px, calc(100% - 40px));
  margin: 0 auto;
  padding: 82px 0 70px;
}

.eyebrow {
  margin: 0 0 18px;
  color: var(--purple-dark);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

h1 {
  max-width: 880px;
  margin: 0;
  font-size: clamp(40px, 6.3vw, 72px);
  line-height: 1.02;
  letter-spacing: -0.055em;
}

.dek {
  max-width: 780px;
  margin: 25px 0 0;
  color: #4f5568;
  font-size: clamp(18px, 2.2vw, 23px);
  line-height: 1.5;
}

.meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  margin-top: 30px;
  color: var(--muted);
  font-size: 14px;
}

.layout {
  display: grid;
  width: min(1160px, calc(100% - 40px));
  margin: 0 auto;
  padding: 64px 0 80px;
  grid-template-columns: minmax(0, 760px) minmax(240px, 1fr);
  gap: 64px;
  align-items: start;
}

article {
  min-width: 0;
  font-size: 18px;
}

article > p:first-child {
  margin-top: 0;
  color: #33384a;
  font-size: 21px;
  line-height: 1.65;
}

h2 {
  margin: 54px 0 16px;
  font-size: clamp(27px, 3vw, 36px);
  line-height: 1.2;
  letter-spacing: -0.035em;
}

h3 {
  margin: 32px 0 10px;
  font-size: 22px;
  line-height: 1.3;
}

p,
ul,
ol,
table,
blockquote {
  margin: 0 0 22px;
}

ul,
ol {
  padding-left: 25px;
}

li + li {
  margin-top: 8px;
}

blockquote {
  border-left: 4px solid var(--purple);
  border-radius: 0 10px 10px 0;
  padding: 18px 22px;
  background: var(--purple-soft);
  color: #342557;
  font-weight: 650;
}

.table-wrap {
  max-width: 100%;
  margin: 28px 0;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: white;
}

table {
  width: 100%;
  min-width: 620px;
  margin: 0;
  border-collapse: collapse;
  font-size: 15px;
}

th,
td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

th {
  background: #f4f1fa;
  color: #342557;
  font-size: 13px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

tr:last-child td {
  border-bottom: 0;
}

.checklist {
  padding: 22px 24px 22px 46px;
  border: 1px solid #d8c9f5;
  border-radius: 14px;
  background: #fcfaff;
}

.sidebar {
  position: sticky;
  top: 96px;
  display: grid;
  gap: 18px;
}

.side-card {
  border: 1px solid var(--line);
  border-radius: 15px;
  padding: 24px;
  background: var(--surface);
  box-shadow: 0 10px 35px rgba(37, 25, 65, 0.06);
}

.side-card h2 {
  margin: 0 0 10px;
  font-size: 21px;
  letter-spacing: -0.025em;
}

.side-card p {
  color: var(--muted);
  font-size: 15px;
}

.side-card ul {
  margin: 0;
  padding-left: 18px;
  color: #4f5568;
  font-size: 14px;
}

.side-card .button {
  width: 100%;
  margin-top: 4px;
}

.source-note {
  border-top: 1px solid var(--line);
  margin-top: 52px;
  padding-top: 24px;
  color: var(--muted);
  font-size: 15px;
}

.site-footer {
  border-top: 1px solid var(--line);
  background: white;
}

.footer-inner {
  display: flex;
  width: min(1160px, calc(100% - 40px));
  min-height: 100px;
  margin: 0 auto;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  color: var(--muted);
  font-size: 14px;
}

.library-grid {
  display: grid;
  width: min(1160px, calc(100% - 40px));
  margin: 0 auto;
  padding: 64px 0 90px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 22px;
}

.resource-card {
  display: flex;
  min-height: 260px;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 28px;
  background: white;
  color: var(--ink);
  text-decoration: none;
  box-shadow: 0 12px 38px rgba(37, 25, 65, 0.06);
  transition: transform 170ms ease, border-color 170ms ease;
}

.resource-card:hover {
  border-color: #bca4e8;
  color: var(--ink);
  transform: translateY(-3px);
}

.resource-card h2 {
  margin: 12px 0 14px;
  font-size: 27px;
}

.resource-card p {
  color: var(--muted);
}

.resource-card .read {
  margin-top: auto;
  color: var(--purple-dark);
  font-weight: 750;
}

.calculator-hero .hero-inner {
  max-width: 1160px;
}

.calculator-shell {
  width: min(1160px, calc(100% - 40px));
  margin: 0 auto;
  padding: 60px 0 18px;
}

.calculator-intro {
  max-width: 760px;
  margin-bottom: 26px;
}

.calculator-intro h2 {
  margin: 0 0 12px;
}

.calculator-intro > p:last-of-type {
  color: var(--muted);
  font-size: 17px;
}

.download-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 20px;
  align-items: center;
  border: 1px solid #d8c9f5;
  border-radius: 14px;
  margin-top: 24px;
  padding: 20px;
  background: #fcfaff;
}

.download-panel p,
.download-note {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.download-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 9px 14px;
  align-items: center;
}

.download-actions .button {
  min-height: 42px;
  padding: 0 16px;
  white-space: nowrap;
}

.download-preview {
  color: var(--purple-dark);
  font-size: 13px;
  font-weight: 750;
}

.download-note {
  line-height: 1.55;
}

.calculator-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.02fr) minmax(0, 0.98fr);
  gap: 24px;
  align-items: start;
}

.calculator-card,
.results-card {
  min-height: 100%;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 30px;
  background: white;
  box-shadow: 0 18px 50px rgba(37, 25, 65, 0.08);
}

.results-card {
  border-color: #cdbbea;
  scroll-margin-top: 84px;
  background:
    radial-gradient(circle at 100% 0, rgba(113, 55, 215, 0.13), transparent 32%),
    white;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
}

.form-grid label {
  display: grid;
  gap: 7px;
  color: #34394b;
  font-size: 14px;
  font-weight: 700;
}

.form-grid input {
  width: 100%;
  min-height: 48px;
  border: 1px solid #cfd2dc;
  border-radius: 9px;
  padding: 0 13px;
  background: white;
  color: var(--ink);
  font: inherit;
  font-weight: 550;
}

.form-grid input:focus {
  border-color: var(--purple);
  outline: 3px solid rgba(113, 55, 215, 0.16);
}

.input-affix {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  border: 1px solid #cfd2dc;
  border-radius: 9px;
  padding-left: 13px;
  background: white;
  color: var(--muted);
  font-weight: 650;
}

.input-affix.suffix {
  grid-template-columns: minmax(0, 1fr) auto;
  padding: 0 13px 0 0;
}

.input-affix input {
  border: 0;
}

.input-affix:focus-within {
  border-color: var(--purple);
  outline: 3px solid rgba(113, 55, 215, 0.16);
}

.input-affix input:focus {
  outline: 0;
}

.form-note,
.form-error {
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.form-error {
  color: #9d1c2f;
  font-weight: 700;
}

.form-actions,
.results-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 20px;
  align-items: center;
}

button {
  border: 0;
  cursor: pointer;
  font: inherit;
}

.calculate-button {
  padding: 0 21px;
}

.text-button {
  min-height: 42px;
  border: 1px solid #d5d8e2;
  border-radius: 9px;
  padding: 0 14px;
  background: white;
  color: var(--purple-dark);
  font-weight: 750;
}

.text-button:hover {
  border-color: #bca4e8;
  background: var(--purple-soft);
}

.results-empty {
  display: grid;
  min-height: 360px;
  place-content: center;
}

.results-empty h2,
.results-card h2 {
  margin: 0 0 12px;
  font-size: clamp(27px, 3vw, 36px);
}

.results-empty p:last-child {
  max-width: 430px;
  color: var(--muted);
}

.result-summary {
  border-bottom: 1px solid var(--line);
  margin-bottom: 22px;
  padding-bottom: 20px;
}

.result-summary div {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 10px 20px;
  align-items: baseline;
}

.result-summary span {
  color: #4f5568;
  font-weight: 700;
}

.result-summary strong {
  color: var(--purple-dark);
  font-size: clamp(34px, 5vw, 52px);
  line-height: 1;
  letter-spacing: -0.045em;
}

.result-summary p {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.result-grid {
  display: grid;
  margin: 0;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.result-grid div {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 13px;
  background: rgba(255, 255, 255, 0.82);
}

.result-grid dt {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.result-grid dd {
  margin: 5px 0 0;
  font-size: 18px;
  font-weight: 800;
}

.conversion-panel {
  border-radius: 13px;
  margin-top: 24px;
  padding: 20px;
  background: #201438;
  color: white;
}

.conversion-panel p {
  margin: 6px 0 15px;
  color: #ded3f3;
  font-size: 14px;
}

.conversion-panel .button {
  background: #8a50ed;
}

.calculator-content-layout {
  padding-top: 54px;
}

.formula-card {
  border: 1px solid #d8c9f5;
  border-radius: 14px;
  margin: 28px 0;
  padding: 22px 24px;
  background: #fcfaff;
}

.formula-card p {
  margin: 0;
}

.formula-card p + p {
  margin-top: 10px;
}

code {
  border-radius: 4px;
  padding: 2px 5px;
  background: #f0edf5;
  color: #3d285f;
  font-size: 0.88em;
}

@media (max-width: 860px) {
  .layout {
    grid-template-columns: 1fr;
    gap: 48px;
  }

  .sidebar {
    position: static;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

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

  .download-actions {
    justify-content: flex-start;
  }
}

@media (max-width: 640px) {
  .nav {
    width: min(100% - 28px, 1160px);
    min-height: 62px;
    gap: 10px;
  }

  .brand {
    gap: 7px;
    font-size: 14px;
  }

  .brand-mark {
    width: 30px;
    height: 30px;
  }

  .nav-links .button {
    min-height: 40px;
    padding: 0 12px;
    font-size: 13px;
    white-space: nowrap;
  }

  .nav-links a:not(.button) {
    display: none;
  }

  .hero-inner,
  .layout,
  .library-grid,
  .calculator-shell,
  .footer-inner {
    width: min(100% - 32px, 1160px);
  }

  .hero-inner {
    padding: 55px 0 46px;
  }

  h1 {
    font-size: clamp(38px, 12vw, 54px);
  }

  .layout {
    padding: 42px 0 64px;
  }

  article {
    font-size: 17px;
  }

  .sidebar,
  .library-grid {
    grid-template-columns: 1fr;
  }

  .library-grid {
    padding: 42px 0 64px;
  }

  .footer-inner {
    min-height: 120px;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
  }

  .calculator-shell {
    padding-top: 42px;
  }

  .calculator-card,
  .results-card {
    border-radius: 14px;
    padding: 20px;
  }

  .form-grid,
  .result-grid {
    grid-template-columns: 1fr;
  }

  .calculate-button {
    width: 100%;
  }

  .download-actions {
    display: grid;
  }

  .download-actions .button,
  .results-actions .text-button {
    width: 100%;
    white-space: normal;
  }
}

@media (max-width: 365px) {
  .nav {
    width: calc(100% - 20px);
  }

  .brand-name {
    display: none;
  }

  .nav-links .button {
    padding: 0 10px;
  }
}
