/*
 * site-chrome.css — Shared global header/footer for Stables static pages.
 * Depends on stables.css (design tokens, Inter, buttons) loaded first.
 */
@import url("site-rail.css");

:root {
  --site-header-h: 64px;
  --site-footer-minimal-h: 96px;
}

/* --- Global shell -------------------------------------------------------- */

.site-chrome-body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background-color: var(--bg);
  color: var(--text-primary);
}

/* Hub / deck pages using centered header math (links.html pattern) */
body.site-chrome-body.links-page-body {
  align-items: stretch;
  justify-content: flex-start;
  padding: 0;
}

body.links-page-body .lang-menu {
  max-height: min(78vh, calc(100dvh - var(--site-header-h, 52px) - 100px));
  overflow-y: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

body.links-page-body .lang-menu::-webkit-scrollbar {
  width: 0;
  height: 0;
}

.site-chrome-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--site-header-h);
  z-index: 800;
  display: flex;
  align-items: center;
  justify-content: space-between;
  /* Longhand overrides — align brand + pill with the 680px .links-page-stack column.
     .links-page-stack is 680px max-width, margin:auto inside .site-chrome-main--links.
     main--links has: pad-left=28px, pad-right=84px (28px + 56px side-rail, ≥768px).
     Centering: margin:auto on margin = 0 auto gives column at 50vw, NOT offset by main padding.
     So left edge of column = (vw − 680)/2 = 50vw − 340px from left.
     But the main left-padding of 28px effectively adds 28px to where the column truly sits.
     Empirically confirmed at 1536px: brand target = 400px → 50vw − 368px.
     Pill right-edge target = 1080px from left = right at 456px → 50vw − 312px.
     Clamp mins prevent negative values on narrow screens. */
  padding-top: 0;
  padding-bottom: 0;
  padding-left:  clamp(40px, calc(50vw - 368px), 50vw);
  padding-right: clamp(112px, calc(50vw - 312px), 50vw);
  background: rgba(16, 24, 38, 0.82);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid rgba(103, 232, 249, 0.22);
  box-shadow: 0 4px 28px rgba(0, 0, 0, 0.35);
  transition: transform 0.28s ease;
  will-change: transform;
}

.site-chrome-header--hidden {
  transform: translateY(-100%);
}

/* Mobile: taller header, bigger brand */
@media (max-width: 767px) {
  :root {
    --site-header-h: 72px;
  }

  .site-chrome-header__mark {
    width: 52px;
    height: 52px;
    border-radius: 12px;
  }

  .site-chrome-header__name {
    font-size: 1.375rem;
    letter-spacing: 0.15em;
  }

  .site-chrome-header__slogan {
    font-size: 0.75rem;
    letter-spacing: 0.2em;
    margin-top: 4px;
  }

  .site-chrome-header__brand {
    gap: 16px;
  }
}

.site-chrome-header__brand {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
  text-decoration: none;
  color: inherit;
}

.site-chrome-header__mark {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  flex-shrink: 0;
  object-fit: contain;
  filter: drop-shadow(0 0 14px rgba(103, 232, 249, 0.35));
}

.site-chrome-header__titles {
  display: flex;
  flex-direction: column;
  justify-content: center;
  line-height: 1.05;
  min-width: 0;
}

.site-chrome-header__name {
  font-size: 1.125rem;
  font-weight: 900;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-primary);
}

.site-chrome-header__slogan {
  font-size: 0.6875rem;
  font-weight: 700;
  color: var(--accent-cyan);
  text-transform: uppercase;
  letter-spacing: 0.18em;
  margin-top: 3px;
}

.site-chrome-header__pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 5px 14px;
  border-radius: 999px;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--accent-cyan);
  border: 1px solid rgba(103, 232, 249, 0.5);
  background: rgba(15, 23, 42, 0.65);
  box-shadow:
    0 0 0 1px rgba(103, 232, 249, 0.06),
    0 0 16px rgba(103, 232, 249, 0.18);
  flex-shrink: 0;
  white-space: nowrap;
}

.site-chrome-header__pill:hover {
  border-color: rgba(103, 232, 249, 0.85);
  color: var(--text-primary);
  box-shadow:
    0 0 0 1px rgba(103, 232, 249, 0.1),
    0 0 22px rgba(103, 232, 249, 0.28);
}


/* Brand left-aligned, pill right — natural flex; no centering overrides */
body.links-page-body .site-chrome-header__brand {
  position: static;
  transform: none;
}

body.links-page-body .site-chrome-header__pill {
  position: static;
  transform: none;
  margin-left: auto;
}

.site-chrome-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

/*
 * Document deck pages: first title stack (reference: circulareconomy/).
 * Same offset below the fixed header, same Inter scale for h1 + .subtitle.
 */
body.links-page-body.deck-chrome-page .site-chrome-main--document {
  padding-top: var(--site-header-h);
  padding-left: clamp(12px, 4vw, 28px);
  /* Mobile: full width — fixed rail floats on top as overlay */
  padding-right: clamp(12px, 4vw, 28px);
  padding-bottom: 2.5rem;
  width: 100%;
  max-width: 960px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: stretch;
}

/* Desktop only: push content clear of the 44px fixed rail */
@media (min-width: 768px) {
  body.links-page-body.deck-chrome-page .site-chrome-main--document {
    padding-right: calc(clamp(12px, 4vw, 28px) + 56px);
  }
}

body.links-page-body.deck-chrome-page .site-chrome-main--document > .title-block:first-child,
body.links-page-body.deck-chrome-page .playing-field-inner > .title-block:first-child,
body.links-page-body.deck-chrome-page .bankingsystem-main > .title-block:first-child {
  text-align: center;
  margin-bottom: 28px;
  max-width: 800px;
  width: 100%;
  align-self: center;
  padding-top: clamp(1.5rem, 4.5vw, 3rem);
  box-sizing: border-box;
}

body.links-page-body.deck-chrome-page .site-chrome-main--document > .container > .title-block:first-child {
  text-align: center;
  margin: 0 auto 28px;
  max-width: 800px;
  width: 100%;
  padding-top: clamp(1.5rem, 4.5vw, 3rem);
  box-sizing: border-box;
}

body.links-page-body.ambassadors-doc-page .site-chrome-main--document > .container > .title-block:first-child {
  margin-bottom: clamp(2.5rem, 5vw, 4rem);
}

body.links-page-body.bankingsystem-page .bankingsystem-main > .title-block:first-child {
  margin-bottom: clamp(28px, 4vw, 48px);
}

body.links-page-body.deck-chrome-page .title-block > h1:first-of-type {
  font-size: clamp(2rem, 5.5vw, 2.625rem);
  font-weight: 900;
  letter-spacing: -0.03em;
  line-height: 1.15;
  margin: 0 0 12px;
  text-align: center;
  text-wrap: balance;
  background: linear-gradient(135deg, #ffffff 0%, var(--accent-cyan) 50%, var(--accent-purple) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

body.links-page-body.deck-chrome-page .title-block > .subtitle {
  font-family: "Inter", system-ui, -apple-system, sans-serif;
  font-size: 17px;
  font-weight: 400;
  line-height: 1.5;
  margin: 0;
  color: var(--text-secondary);
  text-align: center;
}

body.links-page-body.deck-chrome-page .title-block > .subtitle + .subtitle {
  margin-top: 0.65rem;
}

body.links-page-body.deck-chrome-page .title-block > .subtitle.philosophy-text {
  max-width: 52rem;
  margin-left: auto;
  margin-right: auto;
}

@media (max-width: 720px) {
  body.links-page-body.deck-chrome-page .title-block > h1:first-of-type {
    font-size: clamp(1.75rem, 6vw, 2.25rem);
  }
}

/* Links (and similar) template: scrollable column */
.site-chrome-main--links {
  padding-top: var(--site-header-h);
  align-items: stretch;
  justify-content: flex-start;
  padding-left: clamp(12px, 4vw, 28px);
  /* Mobile: full width — fixed rail floats on top as overlay */
  padding-right: clamp(12px, 4vw, 28px);
  /* Match document pages: fixed minimal footer + meta sits above scroll; body.links-page-body uses padding:0 so main must reserve the gap */
  padding-bottom: calc(var(--site-footer-minimal-h) + env(safe-area-inset-bottom, 0px) + 2.5rem);
  position: relative;
}

/* Desktop only: push content clear of the fixed 44px rail */
@media (min-width: 768px) {
  .site-chrome-main--links {
    padding-right: calc(clamp(12px, 4vw, 28px) + 56px);
  }

  body.has-site-rail {
    padding-right: calc(clamp(12px, 4vw, 28px) + 56px);
  }

  body:not(.has-site-rail):has(> aside.site-chrome-side-rail) > .container {
    padding-right: calc(var(--container-pad, 1rem) + 52px);
  }
}

@media (min-width: 768px) {
  /*
   * Rail column is 44px (.site-chrome-side-rail width). Inset FAB so its right edge
   * meets the rail’s left edge (same vertical strip as globe / share), not +52px past.
   */
  body.has-site-rail .agent-fab,
  body.links-page-body .agent-fab {
    right: calc(clamp(0.75rem, 2.5vw, 1.5rem) + 44px);
  }
}

/* Share control below header when it lives in main (not links rail) */
.site-chrome-body:not(.links-page-body) .share-btn {
  top: calc(var(--site-header-h) + 12px);
}

.site-chrome-body:not(.links-page-body) .share-menu {
  top: calc(var(--site-header-h) + 56px);
}

.site-chrome-footer.site-chrome-footer--minimal .site-chrome-footerGrid {
  display: none;
}

/* Compact footer bar fixed at bottom — slides DOWN to hide (anti-sync with header) */
.site-chrome-footer.site-chrome-footer--minimal {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 700;
  height: var(--site-footer-minimal-h);
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 10px clamp(14px, 4vw, 32px) 14px;
  border-top: 1px solid rgba(103, 232, 249, 0.22);
  background: rgba(16, 24, 38, 0.82);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 -4px 28px rgba(0, 0, 0, 0.35);
  transition: transform 0.28s ease;
  will-change: transform;
}

.site-chrome-footer.site-chrome-footer--minimal.site-chrome-footer--hidden {
  transform: translateY(100%);
}

/* Push page content above the fixed footer with a comfortable gap */
body:has(.site-chrome-footer--minimal) {
  padding-bottom: calc(var(--site-footer-minimal-h) + 32px);
}

.site-chrome-footer.site-chrome-footer--minimal .site-chrome-footerSocial {
  margin-bottom: 0.25rem;
  gap: 1rem;
}

.site-chrome-footer.site-chrome-footer--minimal .site-chrome-footerSocial__link:not(.site-chrome-footerSocial__link--icon) {
  font-size: 13px;
  font-weight: 600;
}

.site-chrome-footer.site-chrome-footer--minimal .site-chrome-footerSocial__link--icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  border: 1px solid rgba(103, 232, 249, 0.28);
  background: rgba(15, 23, 42, 0.55);
  color: var(--accent-cyan);
  text-decoration: none;
  transition: border-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}

.site-chrome-footer.site-chrome-footer--minimal .site-chrome-footerSocial__link--icon:hover {
  border-color: rgba(103, 232, 249, 0.55);
  color: var(--text-primary);
  text-decoration: none;
  box-shadow: 0 0 18px rgba(103, 232, 249, 0.14);
}

.site-chrome-footer.site-chrome-footer--minimal .site-chrome-footerSocial__link--icon svg {
  display: block;
  flex-shrink: 0;
}

.site-chrome-footer.site-chrome-footer--minimal .site-chrome-footerSocial__link--all-links {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 16px;
  border-radius: 12px;
  border: 1px solid rgba(103, 232, 249, 0.28);
  background: rgba(15, 23, 42, 0.55);
  color: var(--accent-cyan);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-decoration: none;
  transition: border-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}

.site-chrome-footer.site-chrome-footer--minimal .site-chrome-footerSocial__link--all-links:hover {
  border-color: rgba(103, 232, 249, 0.55);
  color: var(--text-primary);
  text-decoration: none;
  box-shadow: 0 0 18px rgba(103, 232, 249, 0.14);
}

.site-chrome-footer.site-chrome-footer--minimal .site-chrome-footerMeta {
  font-size: 0.65rem;
  letter-spacing: 0.04em;
  margin-top: 0.15rem;
}

.site-chrome-footerSocial {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 1.25rem;
  margin-bottom: 0.75rem;
}

.site-chrome-footerSocial__link {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 14px;
  font-weight: 600;
  color: var(--accent-cyan);
  text-decoration: none;
}

.site-chrome-footerSocial__link:hover {
  color: var(--text-primary);
  text-decoration: underline;
}

/* --- Footer grid (four destinations) ------------------------------------ */

.site-chrome-footer {
  margin-top: auto;
  padding: 2.75rem clamp(16px, 5vw, 40px) 2.25rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  background: linear-gradient(to bottom, transparent, rgba(16, 24, 38, 0.55));
}

.site-chrome-footerGrid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
  max-width: 960px;
  margin: 0 auto 1.5rem;
}

.site-chrome-footerCard {
  display: block;
  padding: 1.25rem 1.35rem;
  border-radius: 16px;
  text-decoration: none;
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(103, 232, 249, 0.22);
  transition: border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
}

.site-chrome-footerCard:hover {
  border-color: rgba(103, 232, 249, 0.5);
  transform: translateY(-2px);
  box-shadow: 0 8px 28px rgba(103, 232, 249, 0.12);
}

.site-chrome-footerCard__title {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 0.35rem;
}

.site-chrome-footerCard__desc {
  font-size: 0.8rem;
  color: var(--text-secondary);
  line-height: 1.45;
}

.site-chrome-footerMeta {
  text-align: center;
  font-size: 0.75rem;
  color: var(--text-secondary);
  max-width: 720px;
  margin: 0 auto;
}

@media (max-width: 700px) {
  .site-chrome-header__pill {
    font-size: 7px;
    padding: 4px 10px;
    letter-spacing: 0.1em;
  }

  .site-chrome-header__name {
    font-size: 0.8125rem;
    letter-spacing: 0.08em;
  }

  .site-chrome-header__mark {
    width: 30px;
    height: 30px;
  }
}

/*
 * Deck pages (Playing Field, Links hub, QR helper, …): same header scale as playing_field.html.
 * Add body class `deck-chrome-page` alongside `site-chrome-body`.
 */
body.deck-chrome-page {
  --site-header-h: 76px;
}

body.deck-chrome-page .site-chrome-header__brand {
  gap: 16px;
}

body.deck-chrome-page .site-chrome-header__mark {
  width: 48px;
  height: 48px;
  border-radius: 10px;
}

body.deck-chrome-page .site-chrome-header__name {
  font-size: 28px;
  font-weight: 900;
  letter-spacing: 0.04em;
  line-height: 1;
}

body.deck-chrome-page .site-chrome-header__slogan {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.1em;
  margin-top: 4px;
}

body.deck-chrome-page .site-chrome-header__pill {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.05em;
  padding: 8px 18px;
}

@media (max-width: 700px) {
  body.deck-chrome-page .site-chrome-header__mark {
    width: 44px;
    height: 44px;
  }

  body.deck-chrome-page .site-chrome-header__name {
    font-size: 1.125rem;
    letter-spacing: 0.06em;
  }

  body.deck-chrome-page .site-chrome-header__slogan {
    font-size: 11px;
    margin-top: 3px;
  }

  body.deck-chrome-page .site-chrome-header__pill {
    font-size: 9px;
    padding: 6px 12px;
  }
}

@media (max-width: 520px) {
  body.deck-chrome-page {
    --site-header-h: 64px;
  }

  body.deck-chrome-page .site-chrome-header__mark {
    width: 40px;
    height: 40px;
  }

  body.deck-chrome-page .site-chrome-header__name {
    font-size: 1.125rem;
    letter-spacing: 0.06em;
  }

  body.deck-chrome-page .site-chrome-header__slogan {
    font-size: 10px;
    margin-top: 2px;
  }

  body.deck-chrome-page .site-chrome-header__pill {
    font-size: 9px;
    padding: 6px 12px;
  }
}
