.wrap {
  width: min(1120px, calc(100% - 40px));
  margin-inline: auto;
}

.wrap-narrow {
  width: min(980px, calc(100% - 40px));
  margin-inline: auto;
}

.nav {
  position: sticky;
  top: 0;
  z-index: 40;
  height: calc(var(--nav-h) + env(safe-area-inset-top));
  padding-top: env(safe-area-inset-top);
  background: var(--nav-glass);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid transparent;
  color: var(--text);
}

.nav.is-scrolled {
  border-bottom-color: var(--line);
}

.nav.is-dark {
  background: rgba(20, 23, 30, 0.72);
  color: var(--paper);
}

.nav.is-dark.is-scrolled {
  border-bottom-color: rgba(255, 255, 255, 0.14);
}

.nav.is-open {
  background: var(--nav-solid);
  color: var(--text);
}

.nav-bar {
  height: var(--nav-h);
  width: min(1120px, calc(100% - 32px));
  margin-inline: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: relative;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-height: 44px;
  text-decoration: none;
  font-weight: 600;
  font-size: 17px;
  letter-spacing: -0.022em;
  flex-shrink: 0;
  white-space: nowrap;
}

.brand img {
  width: 26px;
  height: 26px;
  border-radius: 7px;
}

.nav-links {
  display: none;
}

.nav-links a {
  position: relative;
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 12px;
  text-decoration: none;
  font-size: 14px;
  font-weight: 450;
  letter-spacing: -0.016em;
  opacity: 0.74;
  transition: opacity 0.2s ease;
}

.nav-links a:hover,
.nav-links a.is-current,
.nav-links a[aria-current="page"] {
  opacity: 1;
}

.nav-links a::after {
  content: "";
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 9px;
  height: 1.5px;
  border-radius: 1px;
  background: currentColor;
  transform: scaleX(0);
  transition: transform 0.25s ease;
}

.nav-links a.is-current::after,
.nav-links a[aria-current="page"]::after {
  transform: scaleX(1);
}

.nav-tools {
  display: flex;
  align-items: center;
  gap: 6px;
}

.nav-toggle {
  width: 44px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.nav-toggle-icon,
.nav-toggle-icon::before,
.nav-toggle-icon::after {
  display: block;
  width: 16px;
  height: 1.5px;
  background: currentColor;
  border-radius: 1px;
  position: relative;
}

.nav-toggle-icon::before,
.nav-toggle-icon::after {
  content: "";
  position: absolute;
  left: 0;
}

.nav-toggle-icon::before {
  top: -5px;
}

.nav-toggle-icon::after {
  top: 5px;
}

.nav.is-open .nav-toggle-icon {
  background: transparent;
}

.nav.is-open .nav-toggle-icon::before {
  top: 0;
  transform: rotate(45deg);
}

.nav.is-open .nav-toggle-icon::after {
  top: 0;
  transform: rotate(-45deg);
}

.nav-panel {
  position: fixed;
  z-index: 39;
  top: calc(var(--nav-h) + env(safe-area-inset-top));
  right: 0;
  bottom: 0;
  left: 0;
  display: flex;
  flex-direction: column;
  gap: 28px;
  padding: 20px 24px calc(28px + env(safe-area-inset-bottom));
  overflow-y: auto;
  background: var(--nav-solid);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  color: var(--text);
}

.nav-panel[hidden] {
  display: none !important;
}

.nav-panel-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.nav-panel-list li {
  border-bottom: 1px solid var(--line);
}

.nav-panel-list a {
  display: flex;
  align-items: center;
  min-height: 60px;
  text-decoration: none;
  font-size: 26px;
  font-weight: 600;
  letter-spacing: -0.03em;
}

.nav-panel-list a[aria-current="page"] {
  color: var(--muted);
}

.nav-panel-cta {
  align-self: stretch;
  min-height: 52px;
  font-size: 17px;
}

@media (prefers-reduced-motion: no-preference) {
  .nav-panel:not([hidden]) .nav-panel-list li,
  .nav-panel:not([hidden]) .nav-panel-cta {
    animation: menu-in 0.42s cubic-bezier(0.2, 0.7, 0.2, 1) both;
  }

  .nav-panel-list li:nth-child(2) { animation-delay: 0.03s; }
  .nav-panel-list li:nth-child(3) { animation-delay: 0.06s; }
  .nav-panel-list li:nth-child(4) { animation-delay: 0.09s; }
  .nav-panel-list li:nth-child(5) { animation-delay: 0.12s; }
  .nav-panel:not([hidden]) .nav-panel-cta { animation-delay: 0.16s; }
}

@keyframes menu-in {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
}

/* Lock the root only: hidden overflow on body makes it a scroll container, and the sticky nav would
   then stick to body's (unscrolled) top instead of the viewport. */
html.menu-open {
  overflow: hidden;
}

.nav-panel {
  overscroll-behavior: contain;
}

.footer {
  background: var(--surface-2);
  color: var(--muted);
  border-top: 1px solid var(--line);
  padding: 56px 0 calc(32px + env(safe-area-inset-bottom));
  font-size: 14px;
  line-height: 1.45;
  letter-spacing: -0.012em;
}

.footer-top {
  display: grid;
  gap: 40px;
}

.footer-top > * {
  min-width: 0;
}

.footer-brand .brand {
  min-height: 0;
  color: var(--text);
  font-size: 19px;
}

.footer-brand .brand img {
  width: 28px;
  height: 28px;
  border-radius: 8px;
}

.footer-brand p {
  margin: 6px 0 0;
  max-width: 20rem;
}

.footer-links {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 32px 24px;
}

.footer-col h2 {
  margin: 0 0 10px;
  color: var(--text);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.footer-col ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.footer-col a {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  color: var(--muted);
  text-decoration: none;
  transition: color 0.2s ease;
}

.footer-col a:hover,
.footer-col a[aria-current="page"] {
  color: var(--text);
}

.footer-base {
  display: grid;
  gap: 6px;
  margin-top: 48px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
  font-size: 12px;
  line-height: 1.5;
}

.footer-base p {
  margin: 0;
}

.footer-maker {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--text);
  font-weight: 500;
  text-decoration: none;
  vertical-align: bottom;
}

.footer-maker:hover {
  text-decoration: underline;
  text-underline-offset: 0.18em;
}

.footer-maker-logo {
  width: 14px;
  height: 14px;
}

.footer-maker-logo--on-dark {
  display: none;
}

:root[data-theme="dark"] .footer-maker-logo { display: none; }
:root[data-theme="dark"] .footer-maker-logo--on-dark { display: block; }

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .footer-maker-logo { display: none; }
  :root:not([data-theme="light"]) .footer-maker-logo--on-dark { display: block; }
}

@media (min-width: 734px) {
  .wrap {
    width: min(1120px, calc(100% - 80px));
  }

  .wrap-narrow {
    width: min(980px, calc(100% - 80px));
  }

  .nav-bar {
    width: min(1120px, calc(100% - 80px));
  }

  .nav-links {
    display: flex;
    align-items: center;
    margin-right: 10px;
  }

  .nav-toggle {
    display: none;
  }

  .nav-panel {
    display: none !important;
  }

  .footer-top {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: start;
    gap: 48px;
  }

  .footer-links {
    grid-template-columns: repeat(3, minmax(120px, auto));
    gap: 0 56px;
  }

  .footer-col a {
    min-height: 32px;
  }

  .footer-base {
    grid-template-columns: auto minmax(0, 1fr);
    align-items: baseline;
    gap: 24px;
  }

  .footer-note {
    text-align: right;
  }
}

@media (min-width: 1068px) {
  .wrap,
  .nav-bar {
    width: min(1120px, calc(100% - 48px));
  }
}

.nav.is-dark :focus-visible {
  outline-color: var(--paper);
}

/* The footer has the same theme control, and the hero has the store badges. */
@media (max-width: 439px) {
  .nav-bar .theme-toggle {
    display: none;
  }
}

@media (max-width: 374px) {
  .nav-bar .nav-download {
    display: none;
  }
}
