/* Sitewide chrome — frozen copy of index resting header @ u=1 (journey-layout-lock)
   Tokens mirror complexity-start + clarity-layout-lock + clarity-transition. */

body.site-shell {
  --width-site: 980px;
  --cx-urgency-height: calc(20px + 0.7rem * 1.25);
  --cx-layout-header-h-compact: 56px;
  --cx-shell-header-h: calc(var(--cx-layout-header-h-compact) + var(--cx-urgency-height));
  --cx-shell-header-pad-top: calc(var(--cx-urgency-height) + 1rem);
  --cx-shell-header-pad-bottom: 1rem;
  --case-gutter: max(2rem, calc((100vw - min(var(--width-site), 100%)) / 2 + 2rem));
  padding-top: calc(var(--play-ribbon-h, 0px) + var(--cx-shell-header-h));
}

/* ——— Header ——— */
body.site-shell .cx-header.site-header {
  position: fixed;
  left: 0;
  right: 0;
  top: var(--play-ribbon-h, 0px);
  z-index: 100;
  margin: 0;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: center;
  height: var(--cx-shell-header-h);
  min-height: var(--cx-shell-header-h);
  padding-top: var(--cx-shell-header-pad-top);
  padding-bottom: var(--cx-shell-header-pad-bottom);
  border-bottom: 1px solid var(--color-rule);
  background: var(--color-paper);
  box-shadow: none;
}

body.site-shell .cx-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  position: relative;
  min-height: 0;
}

body.site-shell .cx-logo {
  display: inline-flex;
  align-items: baseline;
  text-decoration: none;
  color: var(--color-ink);
  flex-shrink: 0;
}

body.site-shell .cx-logo__name {
  font-family: var(--font-sans);
  font-size: 1.111rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  line-height: 1;
}

body.site-shell .cx-logo__tm {
  display: none;
}

body.site-shell .cx-nav {
  display: flex;
  flex: 1 1 auto;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  min-width: 0;
  --cx-nav-link-gap: 0.875rem;
  gap: 0.5rem var(--cx-nav-link-gap);
}

body.site-shell .cx-nav a {
  font-family: var(--font-sans);
  font-size: 0.722rem;
  color: var(--color-ink-muted);
  text-decoration: none;
  white-space: nowrap;
}

body.site-shell .cx-nav a:hover,
body.site-shell .cx-nav a[aria-current="page"] {
  color: var(--color-ink);
}

/* ——— Footer ——— */
body.site-shell .cx-footer.site-footer {
  border-top: 1px solid var(--color-rule);
  padding-block: 4rem 2.222rem;
  margin-top: 0;
}

body.site-shell .cx-footer__inner {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 1rem;
  font-family: var(--font-sans);
  font-size: 0.722rem;
}

body.site-shell .cx-footer__inner p {
  margin: 0;
}

body.site-shell .cx-footer__inner p:first-child {
  color: var(--color-ink-faint);
}

body.site-shell .cx-footer__inner p:last-child {
  color: var(--color-ink-muted);
}

body.site-shell .cx-footer__inner a {
  color: inherit;
  text-decoration: none;
}

body.site-shell .cx-footer__inner a:hover {
  color: var(--color-ink);
  text-decoration: underline;
}

@media (max-width: 768px) {
  body.site-shell .cx-footer__inner {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
  }
}

.case-back-top {
  display: flex;
  justify-content: flex-end;
  max-width: 42rem;
  margin: 1.75rem 0 0;
  padding: 0 var(--case-gutter, 1.5rem);
  box-sizing: content-box;
}

.case-interior-retro .case-back-top {
  margin-top: 2rem;
  padding: 0;
}

.case-back-top a {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-family: var(--font-sans);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-ink-faint);
  text-decoration: none;
  transition: color 0.2s ease;
}

.case-back-top a::before {
  content: "↑";
  font-size: 0.85em;
  line-height: 1;
}

.case-back-top a:hover {
  color: var(--color-ink);
}

/* --- Mobile nav (shared with journey homepage) --- */
body.site-shell .cx-nav-toggle,
body.site-shell .cx-mobile-nav,
body.site-shell .cx-mobile-nav-backdrop {
  display: none;
}

@media (max-width: 768px) {
  body.site-shell {
    overflow-x: clip;
  }

  html:has(body.site-shell.story) {
    overflow-x: clip;
  }

  body.site-shell.story #main {
    overflow-x: clip;
    max-width: 100%;
  }

  body.site-shell .cx-header.site-header {
    width: 100%;
    overflow: visible;
  }

  body.site-shell .cx-header .container.cx-header__inner {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    column-gap: 1rem;
  }

  body.site-shell .cx-header .cx-nav--clarity {
    display: none !important;
  }

  body.site-shell .cx-logo {
    grid-column: 1;
    grid-row: 1;
    min-width: 0;
  }

  body.site-shell .cx-nav-toggle {
    display: inline-flex;
    grid-column: 2;
    grid-row: 1;
    margin-left: 0;
    flex-direction: column;
    justify-content: center;
    gap: 6px;
    flex-shrink: 0;
    position: relative;
    z-index: 101;
    width: 2.5rem;
    height: 2.5rem;
    margin: 0;
    padding: 0;
    border: none;
    background: transparent;
    cursor: pointer;
    color: var(--color-ink);
  }

  body.site-shell .cx-nav-toggle__bar {
    display: block;
    width: 1.35rem;
    height: 2px;
    margin-inline: auto;
    background: currentColor;
    transition: transform 0.2s ease, opacity 0.2s ease;
  }

  body.site-shell.is-mobile-nav-open .cx-nav-toggle__bar:nth-child(1) {
    transform: translateY(8px) rotate(45deg);
  }

  body.site-shell.is-mobile-nav-open .cx-nav-toggle__bar:nth-child(2) {
    opacity: 0;
  }

  body.site-shell.is-mobile-nav-open .cx-nav-toggle__bar:nth-child(3) {
    transform: translateY(-8px) rotate(-45deg);
  }

  body.site-shell .cx-mobile-nav {
    position: fixed;
    left: 0;
    right: 0;
    top: calc(var(--play-ribbon-h, 0px) + var(--cx-shell-header-h));
    z-index: 99;
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
    margin: 0;
    padding: 1rem 2rem 1.25rem;
    background: var(--color-paper);
    border-bottom: 1px solid var(--color-rule);
    box-shadow: 0 10px 24px rgba(28, 28, 28, 0.08);
    grid-column: 1 / -1;
  }

  body.site-shell .cx-mobile-nav[hidden] {
    display: none !important;
  }

  body.site-shell .cx-mobile-nav-backdrop {
    position: fixed;
    inset: 0;
    z-index: 98;
    margin: 0;
    padding: 0;
    border: none;
    background: rgba(28, 28, 28, 0.16);
    cursor: pointer;
  }

  body.site-shell .cx-mobile-nav-backdrop[hidden] {
    display: none !important;
  }

  body.site-shell .cx-mobile-nav a {
    font-family: var(--font-sans);
    font-size: 0.9rem;
    font-weight: 500;
    letter-spacing: 0.02em;
    text-decoration: none;
    color: var(--color-ink-muted);
  }

  body.site-shell .cx-mobile-nav a:hover,
  body.site-shell .cx-mobile-nav a[aria-current="page"] {
    color: var(--color-ink);
  }

  body.site-shell.is-mobile-nav-open {
    overflow: hidden;
  }
}
