:root {
  --u: calc(100vw / 1920);
  --paper: #E6F5F5;
  --surface: #F4F8F7;
  --text: #101717;
  --muted: #62706F;
  --cyan: #00D8D8;
  --coral: #FF6A4D;
  --track: #DBE9E9;
  --cream-line: linear-gradient(90deg, #00D8D8 0%, #00D8D8 55%, #FF6A4D 100%);
  --font-display: "Roboto", sans-serif;
  --font-body: "Rubik", sans-serif;
  --font-figure: "Spline Sans Mono", monospace;
  --font-label: "Rubik", sans-serif;
  --radius-card: calc(23 * var(--u));
  --radius-control: calc(14 * var(--u));
  --shadow-lifted: 0 calc(23 * var(--u)) calc(52 * var(--u)) calc(-11 * var(--u)) rgba(0, 25, 25, 0.05);
}

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

html {
  min-width: 320px;
  min-height: 100%;
  overflow-x: hidden;
  background-color: var(--paper);
  background-image: radial-gradient(ellipse at 54% 28%, #F4FBFB 0%, #ECF8F8 48%, var(--paper) 100%);
  background-attachment: fixed;
  color: var(--text);
  font-family: var(--font-body);
  text-rendering: optimizeLegibility;
}

body {
  min-height: 100vh;
  margin: 0;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  background: var(--paper);
}

button,
a {
  color: inherit;
  font: inherit;
}

button {
  border: 0;
}

a {
  text-decoration: none;
}

a:focus-visible,
button:focus-visible {
  outline: 2px solid var(--coral);
  outline-offset: 3px;
}

.nav {
  position: relative;
  z-index: 20;
  width: 100%;
  height: calc(76 * var(--u));
  min-height: calc(76 * var(--u));
  padding: 0 calc(56 * var(--u));
  display: grid;
  grid-template-columns: calc(360 * var(--u)) 1fr auto;
  align-items: center;
  background: var(--surface);
  font: 500 max(12px, calc(15 * var(--u))) var(--font-body);
}

.nav > .brand {
  display: flex;
  align-items: center;
  gap: calc(12 * var(--u));
  width: max-content;
  font-size: max(12px, calc(27 * var(--u)));
  letter-spacing: 0.06em;
}

.nav > .brand img {
  width: calc(42 * var(--u));
  height: calc(42 * var(--u));
  object-fit: contain;
}

.routes,
.actions {
  display: flex;
  align-items: center;
  gap: calc(34 * var(--u));
}

.routes {
  justify-content: center;
}

.routes a,
.actions span,
.actions a,
.actions button {
  color: #465757;
  text-decoration: none;
  white-space: nowrap;
}

.routes a {
  padding: calc(12 * var(--u)) calc(15 * var(--u));
  border-radius: calc(12 * var(--u));
}

.routes a.is-active,
.routes a[aria-current="page"] {
  background: #D4F7F5;
  color: var(--text);
}

.actions .buy,
.mobile-actions .buy {
  padding: calc(13 * var(--u)) calc(22 * var(--u));
  border-radius: calc(12 * var(--u));
  background: #BFF4F5;
  color: var(--text);
}

.ca {
  padding: 0;
  background: transparent;
  cursor: pointer;
  font: 500 max(12px, calc(13 * var(--u))) var(--font-figure);
}

.menu-button,
.nav-mobile {
  display: none;
}

main {
  width: 100%;
  flex: 1 0 auto;
  opacity: 1;
  transform: translateY(0);
  transition: opacity 200ms ease, transform 200ms ease;
}

main.is-leaving {
  opacity: 0;
  transform: translateY(4px);
}

.footer {
  width: 100%;
  height: calc(68 * var(--u));
  min-height: calc(68 * var(--u));
  margin-top: auto;
  padding: 0 calc(56 * var(--u));
  display: grid;
  grid-template-columns: calc(260 * var(--u)) 1fr 1.15fr;
  align-items: center;
  gap: calc(36 * var(--u));
  background: var(--surface);
  font: 400 max(12px, calc(12 * var(--u))) var(--font-body);
}

.footer .brand {
  display: flex;
  align-items: center;
  gap: calc(10 * var(--u));
  font-size: max(12px, calc(20 * var(--u)));
  letter-spacing: 0.05em;
}

.footer .brand img {
  width: calc(34 * var(--u));
  height: calc(34 * var(--u));
  object-fit: contain;
}

.sources {
  color: var(--muted);
  font: 500 max(12px, calc(12 * var(--u))) var(--font-figure);
}

.boundary {
  color: var(--muted);
  text-align: right;
}

@media (hover: hover) {
  .routes a:hover {
    background: rgba(212, 247, 245, 0.58);
  }

  .ca:hover {
    color: var(--text);
  }

  main :is(article, section, .panel, .card, .source-card, .result-card, .formula-card) {
    transition: transform 220ms ease, box-shadow 220ms ease, opacity 450ms ease;
  }

  main :is(.source-card, .result-card, .formula-card):hover {
    transform: translateY(-3px);
    box-shadow: 0 18px 36px -22px rgba(0, 104, 112, .34);
  }
}

.motion-reveal {
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 450ms ease, transform 450ms cubic-bezier(.22,.75,.25,1);
  transition-delay: var(--reveal-delay, 0ms);
}

.motion-reveal.is-in {
  opacity: 1;
  transform: translateY(0);
}

.number-tick {
  animation: number-tick 420ms cubic-bezier(.2,.8,.2,1);
}

@keyframes number-tick {
  0% { opacity: .5; transform: translateY(5px); }
  55% { opacity: 1; transform: translateY(-2px); }
  100% { transform: translateY(0); }
}

@media (max-width: 1023px) {
  :root {
    --u: 1px;
    --radius-card: 20px;
    --radius-control: 12px;
  }

  .nav {
    height: 68px;
    min-height: 68px;
    padding: 0 18px;
    grid-template-columns: 1fr auto;
    gap: 16px;
  }

  .nav > .brand {
    gap: 9px;
    font-size: 21px;
  }

  .nav > .brand img {
    width: 34px;
    height: 34px;
  }

  .routes,
  .actions {
    display: none;
  }

  .menu-button {
    display: inline-grid;
    min-width: 70px;
    min-height: 40px;
    padding: 0 16px;
    place-items: center;
    border-radius: 12px;
    background: #D4F7F5;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
  }

  .nav-mobile {
    position: relative;
    z-index: 19;
    width: 100%;
    padding: 18px;
    background: var(--surface);
    box-shadow: var(--shadow-lifted);
  }

  .nav-mobile.is-open {
    display: block;
  }

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

  .mobile-routes a {
    min-height: 46px;
    padding: 0 14px;
    display: flex;
    align-items: center;
    border-radius: 12px;
    background: var(--paper);
    font-size: 15px;
  }

  .mobile-routes a.is-active,
  .mobile-routes a[aria-current="page"] {
    background: #D4F7F5;
  }

  .mobile-actions {
    margin-top: 14px;
    padding-top: 14px;
    display: grid;
    grid-template-columns: auto auto 1fr;
    align-items: center;
    gap: 16px;
    color: #465757;
    font-size: 13px;
  }

  .mobile-actions .ca {
    justify-self: end;
    font-size: 12px;
  }

  .mobile-actions .buy {
    grid-column: 1 / -1;
    padding: 13px 18px;
    text-align: center;
  }

  .footer {
    height: auto;
    min-height: 150px;
    padding: 22px 18px;
    grid-template-columns: 1fr;
    gap: 13px;
  }

  .footer .brand {
    font-size: 18px;
  }

  .footer .brand img {
    width: 30px;
    height: 30px;
  }

  .sources,
  .boundary {
    font-size: 12px;
    line-height: 1.45;
    text-align: left;
  }
}

@media (max-width: 420px) {
  .mobile-actions {
    grid-template-columns: auto auto;
  }

  .mobile-actions .ca {
    grid-column: 1 / -1;
    justify-self: stretch;
    min-height: 42px;
    border-radius: 12px;
    background: var(--paper);
  }
}

@media (prefers-reduced-motion: reduce) {
  main, .motion-reveal, .number-tick, main :is(article, section, .panel, .card, .source-card, .result-card, .formula-card) {
    transition: none;
    animation: none;
    transform: none;
    opacity: 1;
  }
}
