:root {
  --page-bg: #ffffff;
  --surface: #ffffff;
  --surface-soft: #f6f8fb;
  --ink: #172033;
  --muted: #5f6b7a;
  --line: #d8e0e8;
  --blue: #6699cc;
  --accent: #3f76ad;
  --accent-soft: #edf4fa;
  --danger: #be3d4a;
  --radius: 8px;
  --max-width: 1420px;
  --content-width: 1380px;
  --readable-width: 980px;
  --shadow: 0 12px 32px rgba(24, 45, 70, 0.08);

  /* Aliases used by the standalone calculator. */
  --canvas: var(--page-bg);
  --surface-blue: var(--surface-soft);
  --primary: var(--accent);
  --primary-dark: var(--accent);
  --navy: var(--ink);
  --text: var(--ink);
  --border: var(--line);
  --error: var(--danger);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--page-bg);
  color-scheme: light;
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  margin: 0;
  background: var(--page-bg);
  color: var(--ink);
  font-family: "Helvetica Neue", Arial, ui-sans-serif, system-ui, -apple-system,
    BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.6;
  letter-spacing: 0;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

button,
input,
textarea,
select {
  font: inherit;
  letter-spacing: 0;
}

a {
  color: inherit;
  text-decoration: none;
}

.skip-link {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 100;
  padding: 10px 14px;
  transform: translateY(-160%);
  border-radius: var(--radius);
  background: var(--ink);
  color: #ffffff;
  font-weight: 700;
}

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

.site-header {
  position: relative;
  z-index: 50;
  background: #ffffff;
}

.site-header__inner {
  display: flex;
  width: min(calc(100% - 48px), var(--max-width));
  min-height: 70px;
  align-items: center;
  justify-content: space-between;
  gap: 26px;
  margin: 0 auto;
}

.brand {
  display: inline-flex;
  flex: none;
  min-width: 0;
  align-items: center;
  gap: 10px;
}

.brand__logo {
  display: block;
  width: auto;
  height: 48px;
  max-width: 255px;
  object-fit: contain;
}

.brand__text {
  color: var(--accent);
  font-size: 1.45rem;
  font-weight: 500;
  line-height: 1;
  white-space: nowrap;
}

.site-nav {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 2px;
  color: var(--muted);
  font-size: 1rem;
  font-weight: 500;
}

.site-nav a {
  padding: 24px 10px 22px;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
  transition:
    border-color 160ms ease,
    color 160ms ease;
}

.site-nav a:hover,
.site-nav a.is-active {
  border-bottom-color: var(--blue);
  color: var(--accent);
}

.site-nav a:focus-visible,
.brand:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.page-shell,
.viewer-shell {
  width: min(calc(100% - 48px), var(--content-width));
  margin: 0 auto;
}

.page-title {
  padding: 10px 0 6px;
  /* border-top: 1px solid var(--line); */
  border-bottom: 1px solid var(--line);
}

.page-title__eyebrow {
  margin: 0 0 10px;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  line-height: 1.2;
  text-transform: uppercase;
}

.page-title h1 {
  max-width: 920px;
  margin: 0;
  color: var(--blue);
  font-size: 2.5rem;
  font-weight: 700;
  letter-spacing: 0;
  line-height: 1.2;
}

.page-title > p:last-child {
  max-width: var(--readable-width);
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 1.08rem;
  line-height: 1.65;
}

.noscript-message {
  width: min(calc(100% - 48px), var(--content-width));
  margin: 20px auto 0;
  padding: 12px 16px;
  border: 1px solid #efc7cb;
  border-radius: var(--radius);
  background: #fff6f7;
  color: var(--danger);
  font-size: 0.9rem;
  text-align: center;
}

@media (max-width: 760px) {
  .site-header__inner,
  .page-shell,
  .viewer-shell {
    width: min(calc(100% - 32px), var(--max-width));
  }

  .page-title {
    padding: 30px 0 20px;
  }

  .page-title h1 {
    font-size: clamp(1.78rem, 8vw, 2.1rem);
    line-height: 1.18;
  }

  .page-title > p:last-child {
    font-size: 1rem;
  }
}

@media (max-width: 620px) {
  .site-header__inner {
    min-height: auto;
    align-items: flex-start;
    flex-direction: column;
    gap: 2px;
    padding-top: 10px;
  }

  .brand {
    gap: 8px;
  }

  .brand__logo {
    height: 36px;
    max-width: min(52vw, 178px);
  }

  .brand__text {
    font-size: 1.1rem;
  }

  .site-nav {
    width: 100%;
    justify-content: flex-start;
    border-top: 1px solid var(--line);
  }

  .site-nav a {
    flex: 1 1 50%;
    min-width: 0;
    padding: 11px 8px 10px;
    line-height: 1.25;
    text-align: center;
    white-space: normal;
  }
}

@media (max-width: 420px) {
  .site-header__inner,
  .page-shell,
  .viewer-shell {
    width: min(calc(100% - 20px), var(--max-width));
  }

  .brand__logo {
    height: 32px;
    max-width: min(48vw, 150px);
  }

  .brand__text {
    font-size: 1rem;
  }
}

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

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