.container {
  width: 100%;
  max-width: var(--container-max);
  margin-inline: auto;
  /* Fluid side padding: fixed 20px floor on small screens, scales with
     viewport width, capped at 64px so wide desktop screens still get a
     generous but bounded content column. */
  padding-inline: clamp(20px, 4vw, 64px);
}

.prose {
  max-width: var(--prose-max);
}

.prose--wide {
  max-width: var(--prose-wide-max);
}

.site-header {
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  z-index: 100;
}

.site-header__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  /* Tighter on mobile/tablet, where Logo + Login + Register + the menu
     toggle all share one row down to 320px; desktop restores the wider
     gap below. */
  gap: var(--space-1);
  padding-block: var(--space-3);
}

.site-header__brand {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  font-weight: 700;
  font-size: var(--font-size-md);
  color: var(--color-text);
  text-decoration: none;
}

.site-header__logo {
  display: block;
  height: 24px;
  width: auto;
}

.primary-nav {
  display: none;
}

.primary-nav__list {
  display: flex;
  align-items: center;
  gap: var(--space-5);
  list-style: none;
  margin: 0;
  padding: 0;
}

.primary-nav__list a {
  color: var(--color-text);
  text-decoration: none;
  font-size: var(--font-size-sm);
  font-weight: 600;
}

.primary-nav__list a:hover {
  color: var(--color-primary-deep);
}

.header-actions {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  gap: var(--space-1);
}

/* Compact Login/Register sizing for the mobile/tablet header row, where
   Logo + Login + Register + the menu toggle all need to fit on one line
   down to 320px. `min-height` (not just padding) keeps a consistent,
   comfortable tap target regardless of exact font-metrics rounding.
   Desktop restores full `.btn` sizing at the nav breakpoint below. */
.btn--compact {
  padding: 6px 8px;
  font-size: 0.75rem;
  min-height: 34px;
}

.nav-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 34px;
  height: 34px;
  padding: 0;
  background: none;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  cursor: pointer;
}

/* Plain CSS hamburger — three bars (the middle one is the span's own
   background, the other two are pseudo-elements) — no icon font or
   image asset. Text label moved to aria-label since there's no room
   for a visible "Menu" word next to Login/Register on narrow screens. */
.nav-toggle__icon {
  position: relative;
  display: block;
  width: 16px;
  height: 2px;
  background: var(--color-text);
  border-radius: 1px;
}

.nav-toggle__icon::before,
.nav-toggle__icon::after {
  content: "";
  position: absolute;
  left: 0;
  width: 16px;
  height: 2px;
  background: var(--color-text);
  border-radius: 1px;
}

.nav-toggle__icon::before {
  top: -5px;
}

.nav-toggle__icon::after {
  top: 5px;
}

.mobile-nav {
  border-top: 1px solid var(--color-border);
  background: var(--color-surface);
}

.mobile-nav[hidden] {
  display: none;
}

.mobile-nav__list {
  list-style: none;
  margin: 0;
  padding: var(--space-3) var(--space-4) var(--space-5);
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.mobile-nav__list a {
  display: block;
  padding: var(--space-3) 0;
  color: var(--color-text);
  text-decoration: none;
  font-weight: 600;
  border-bottom: 1px solid var(--color-border);
}

.mobile-nav__sublist {
  list-style: none;
  margin: 0;
  padding-left: var(--space-4);
}

.mobile-nav__sublist a {
  font-weight: 500;
  font-size: var(--font-size-sm);
}

/* 1120px: adding the "Download" nav item (8 top-level items now) raised
   the measured no-wrap minimum from ~970px to ~1069px — re-measured after
   that change rather than assumed. 1120px sits with a comfortable margin
   above that new minimum, same reasoning as the original 1024px value. */
@media (min-width: 1120px) {
  .site-header__bar {
    gap: var(--space-4);
  }

  .site-header__logo {
    height: 36px;
  }

  .primary-nav {
    display: block;
  }

  .header-actions {
    gap: var(--space-3);
  }

  /* Restore full `.btn` sizing — same padding/font-size as the base
     class — so desktop is visually identical to before this change. */
  .btn--compact {
    padding: var(--space-3) var(--space-5);
    font-size: var(--font-size-sm);
    min-height: 0;
  }

  .nav-toggle {
    display: none;
  }

  .mobile-nav {
    display: none;
  }
}

main {
  display: block;
}

.section {
  padding-block: var(--space-section-y);
}

.section--tight {
  padding-block: var(--space-section-y-sm);
}

.breadcrumbs {
  padding-block: var(--space-3);
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
}

.breadcrumbs__list {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin: 0;
  padding: 0;
}

.breadcrumbs__list li:not(:last-child)::after {
  content: "/";
  margin-left: var(--space-2);
  color: var(--color-border);
}

.breadcrumbs a {
  color: var(--color-text-muted);
  text-decoration: none;
}

.breadcrumbs a:hover {
  color: var(--color-primary-deep);
}

.site-footer {
  background: var(--color-dark);
  color: #d9d9de;
  margin-top: var(--space-8);
}

.site-footer a {
  color: #d9d9de;
  text-decoration: none;
}

.site-footer a:hover {
  color: var(--color-primary-light);
}

.footer-brand-row {
  padding-top: var(--space-7);
  padding-bottom: var(--space-5);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.footer-brand {
  display: inline-flex;
}

.footer-brand__logo {
  display: block;
  height: 40px;
  width: auto;
}

.footer-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-6);
  padding-block: var(--space-7);
}

@media (min-width: 768px) {
  .footer-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (min-width: 1100px) {
  .footer-grid {
    grid-template-columns: repeat(5, 1fr);
  }
}

.footer-group h2 {
  font-size: var(--font-size-sm);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #9b9ba3;
  margin-bottom: var(--space-3);
}

.footer-group ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.footer-bottom {
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  padding-block: var(--space-4);
  font-size: var(--font-size-sm);
  color: #9b9ba3;
}

/* ---------------------------------------------------------------------
   Mobile/tablet bottom navigation bar
   Additive to the existing responsive header — never replaces it. Shown
   below the same 1120px breakpoint the header uses for its own
   mobile/tablet mode, so both switch together. Fixed, so `body` gets
   matching bottom padding in the same query to keep the last section of
   every page from sitting underneath it.
   ------------------------------------------------------------------ */

.bottom-nav {
  display: none;
  position: fixed;
  left: 50%;
  bottom: 12px;
  transform: translateX(-50%);
  width: calc(100% - 24px);
  max-width: 560px;
  align-items: flex-end;
  justify-content: space-between;
  gap: 2px;
  background: rgba(20, 19, 25, 0.94);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(254, 119, 53, 0.5);
  border-radius: 22px;
  padding: 8px 8px calc(8px + env(safe-area-inset-bottom));
  box-shadow:
    0 12px 32px rgba(0, 0, 0, 0.35),
    0 0 0 1px rgba(254, 119, 53, 0.15),
    0 0 24px rgba(254, 119, 53, 0.35);
  z-index: 60;
}

@media (max-width: 1119px) {
  .bottom-nav {
    display: flex;
  }

  body {
    padding-bottom: calc(78px + env(safe-area-inset-bottom));
  }
}

.bottom-nav__item {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 8px 2px;
  border-radius: 14px;
  color: rgba(255, 255, 255, 0.65);
  text-decoration: none;
  font-size: 10.5px;
  font-weight: 600;
  line-height: 1.1;
  text-align: center;
  transition: color var(--transition-fast);
}

.bottom-nav__icon {
  display: flex;
  align-items: center;
  justify-content: center;
}

.bottom-nav__icon svg {
  width: 21px;
  height: 21px;
  display: block;
}

.bottom-nav__item:hover,
.bottom-nav__item:focus-visible {
  color: #fff;
}

.bottom-nav__item.is-active {
  color: var(--color-primary-light);
}

.bottom-nav__item.is-active .bottom-nav__icon {
  filter: drop-shadow(0 0 6px rgba(254, 119, 53, 0.7));
}

.bottom-nav__item--home {
  color: rgba(255, 255, 255, 0.85);
}

.bottom-nav__home-badge {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--gradient-brand);
  color: #1a1204;
  transform: translateY(-14px);
  margin-bottom: -8px;
  box-shadow:
    0 0 0 4px var(--color-dark),
    0 6px 16px rgba(254, 119, 53, 0.55),
    0 0 22px rgba(254, 119, 53, 0.45);
}

.bottom-nav__item--home.is-active .bottom-nav__home-badge {
  box-shadow:
    0 0 0 4px var(--color-dark),
    0 0 0 6px rgba(254, 119, 53, 0.35),
    0 8px 20px rgba(254, 119, 53, 0.7),
    0 0 28px rgba(254, 119, 53, 0.6);
}
