/* =================================================================
   GLOBAL LAYOUT — Header, Nav, Footer
   ================================================================= */

/* ---- Site header ---- */
.sw-siteheader {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(250, 249, 252, 0.85);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--sw-border);
}

.sw-siteheader__inner {
  height: var(--sw-header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

/* ---- Brand / logo (the wheel-ring signature mark) ---- */
.sw-brand {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.15rem;
  letter-spacing: -0.02em;
  color: var(--sw-ink);
}

.sw-brand__mark {
  width: 34px;
  height: 34px;
  flex-shrink: 0;
}

.sw-brand__mark svg {
  width: 100%;
  height: 100%;
  animation: sw-mark-spin 14s linear infinite;
}

@keyframes sw-mark-spin {
  to {
    transform: rotate(360deg);
  }
}

.sw-brand__accent {
  background: linear-gradient(135deg, var(--sw-primary) 0%, var(--sw-focus) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* ---- Nav ---- */
.sw-nav {
  display: flex;
  align-items: center;
  gap: 2rem;
}

.sw-nav__list {
  display: flex;
  align-items: center;
  gap: 1.75rem;
}

.sw-nav__link {
  position: relative;
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--sw-text);
  padding: 0.4rem 0;
  transition: color 0.15s ease;
}

.sw-nav__link::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -2px;
  width: 0;
  height: 2px;
  background: var(--sw-focus);
  border-radius: 2px;
  transition: width 0.2s ease;
}

.sw-nav__link:hover {
  color: var(--sw-primary);
}

.sw-nav__link:hover::after,
.sw-nav__link[aria-current="page"]::after {
  width: 100%;
}

.sw-nav__link[aria-current="page"] {
  color: var(--sw-primary);
}

.sw-header__actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

/* Two CTA buttons exist (one for desktop header, one inside the
   mobile slide-out nav) so exactly one is ever visible at a time —
   never both, at any viewport width. Compound selector (element +
   class) intentionally used so this reliably beats .sw-btn's own
   display:inline-flex regardless of CSS file load order. */
a.sw-nav__cta {
  display: none;
}

/* ---- Mobile nav toggle ---- */
.sw-navtoggle {
  display: none;
  width: 42px;
  height: 42px;
  border-radius: var(--sw-radius-sm);
  align-items: center;
  justify-content: center;
  border: 1.5px solid var(--sw-border);
}

.sw-navtoggle__bars {
  position: relative;
  width: 18px;
  height: 14px;
}

.sw-navtoggle__bars span {
  position: absolute;
  left: 0;
  width: 100%;
  height: 2px;
  background: var(--sw-ink);
  border-radius: 2px;
  transition: transform 0.2s ease, opacity 0.2s ease, top 0.2s ease;
}

.sw-navtoggle__bars span:nth-child(1) {
  top: 0;
}

.sw-navtoggle__bars span:nth-child(2) {
  top: 6px;
}

.sw-navtoggle__bars span:nth-child(3) {
  top: 12px;
}

.sw-siteheader.is-open .sw-navtoggle__bars span:nth-child(1) {
  top: 6px;
  transform: rotate(45deg);
}

.sw-siteheader.is-open .sw-navtoggle__bars span:nth-child(2) {
  opacity: 0;
}

.sw-siteheader.is-open .sw-navtoggle__bars span:nth-child(3) {
  top: 6px;
  transform: rotate(-45deg);
}

@media (max-width: 1024px) {
  a.sw-header__cta {
    display: none;
  }

  .sw-navtoggle {
    display: flex;
  }

  .sw-nav {
    position: fixed;
    top: var(--sw-header-h);
    left: 0;
    right: 0;
    /* Explicit height rather than `bottom: 0` — .sw-siteheader's own
       backdrop-filter makes it a containing block for fixed descendants,
       so `inset`/`bottom` would resolve against the 72px header box
       instead of the viewport, collapsing this menu to a sliver. */
    height: calc(100vh - var(--sw-header-h));
    height: calc(100dvh - var(--sw-header-h));
    background: var(--sw-canvas);
    flex-direction: column;
    align-items: stretch;
    padding: 1.5rem;
    transform: translateY(-8px);
    opacity: 0;
    pointer-events: none;
    transition: transform 0.2s ease, opacity 0.2s ease;
    overflow-y: auto;
    z-index: 40;
  }

  .sw-siteheader.is-open .sw-nav {
    transform: translateY(0);
    opacity: 1;
    pointer-events: all;
  }

  .sw-nav__list {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0.25rem;
  }

  .sw-nav__link {
    padding: 0.85rem 0.25rem;
    border-bottom: 1px solid var(--sw-border);
    font-size: 1rem;
  }

  a.sw-nav__cta {
    display: block;
    text-align: center;
    margin-top: 1rem;
    width: 100%;
  }
}

@media (max-width: 400px) {
  .sw-siteheader__inner {
    gap: 0.5rem;
  }

  .sw-brand {
    font-size: 1rem;
    gap: 0.45rem;
  }

  .sw-brand__mark {
    width: 28px;
    height: 28px;
  }

  .sw-navtoggle {
    width: 38px;
    height: 38px;
  }
}

/* ---- Footer ---- */
.sw-footer {
  background: var(--sw-ink);
  color: rgba(255, 255, 255, 0.75);
  margin-top: var(--sw-space-2xl);
}

.sw-footer__top {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr 1fr;
  gap: 2.5rem;
  padding: var(--sw-space-xl) 0 var(--sw-space-lg);
}

.sw-footer__brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.1rem;
  color: #fff;
  margin-bottom: 0.85rem;
}

.sw-footer__brand .sw-brand__mark svg {
  animation: none;
}

.sw-footer__desc {
  font-size: 0.88rem;
  line-height: 1.7;
  max-width: 32ch;
  color: rgba(255, 255, 255, 0.55);
}

.sw-footer__heading {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.85rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.9);
  margin-bottom: 1rem;
}

.sw-footer__list {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.sw-footer__list a {
  font-size: 0.9rem;
  color: rgba(255, 255, 255, 0.6);
  transition: color 0.15s ease;
}

.sw-footer__list a:hover {
  color: #fff;
}

.sw-footer__bottom {
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  padding: 1.5rem 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.45);
}

.sw-footer__socials {
  display: flex;
  gap: 0.75rem;
}

.sw-footer__socials a {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.15);
  display: grid;
  place-items: center;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.sw-footer__socials a:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.3);
}

@media (max-width: 860px) {
  .sw-footer__top {
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
  }
}

@media (max-width: 560px) {
  .sw-footer__top {
    grid-template-columns: 1fr;
  }

  .sw-footer__bottom {
    flex-direction: column;
    align-items: flex-start;
  }
}
