/* ============================================================================
   WaifuCash Modern Shell
   ============================================================================
   The shared chrome: sticky glass header, primary nav, mobile drawer, footer,
   app banner. Extracted from index.php so every page renders identical chrome.
   Import AFTER modern-tokens.css (and modern-components.css). Markup lives in
   includes/header.php and includes/footer.php; behavior in modern-shell.js.
   ============================================================================ */

/* === HEADER === */
.site-header {
  position: sticky; top: 0; z-index: var(--z-header);
  padding: 0.875rem clamp(1rem, 4vw, 2.5rem);
  display: flex; align-items: center; justify-content: space-between;
  background: var(--c-header-bg);
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  border-bottom: 1px solid transparent;
  transition: background var(--t-normal) var(--ease-out-expo),
              border-color var(--t-normal) var(--ease-out-expo),
              transform var(--t-normal) var(--ease-out-expo);
}
.site-header.is-scrolled {
  background: var(--c-header-bg-scrolled);
  border-bottom-color: var(--c-border);
}
.site-header.is-hidden { transform: translateY(-100%); }

.brand {
  display: inline-flex; align-items: center; gap: 0.625rem;
  font-family: var(--font-display); font-weight: 700; font-size: 1.05rem;
  letter-spacing: var(--tracking-snug); color: var(--c-text);
}
.brand img { width: 32px; height: 32px; border-radius: 8px; transition: transform var(--t-normal) var(--ease-spring); }
.brand:hover img { transform: rotate(-8deg) scale(1.08); }
.brand-mark { display: inline-flex; align-items: center; }
.brand-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--c-accent);
  margin-left: 4px; box-shadow: 0 0 12px var(--c-accent); }

.nav-primary { display: flex; align-items: center; gap: 0.25rem; }
.nav-link {
  padding: 0.5rem 0.875rem; font-size: var(--text-sm); font-weight: 500;
  color: var(--c-text-soft); border-radius: var(--r-pill);
  transition: color var(--t-fast) var(--ease-out-expo), background var(--t-fast) var(--ease-out-expo);
}
.nav-link:hover { color: var(--c-text); background: oklch(100% 0 0 / 0.06); }
.nav-link.is-active, .nav-link[aria-current="page"] {
  color: var(--c-text); background: oklch(72% 0.22 330 / 0.12);
}

.nav-actions { display: flex; align-items: center; gap: 0.5rem; }

/* Theme toggle */
.theme-toggle {
  width: 40px; height: 40px; flex: none; display: inline-flex; align-items: center; justify-content: center;
  background: oklch(100% 0 0 / 0.05); border: 1px solid var(--c-border); border-radius: var(--r-pill);
  color: var(--c-text-soft); cursor: pointer; transition: color var(--t-fast), border-color var(--t-fast), background var(--t-fast);
}
.theme-toggle:hover { color: var(--c-text); border-color: var(--c-accent); }
.theme-toggle svg { width: 18px; height: 18px; }
.theme-toggle .icon-sun { display: none; }
.theme-toggle .icon-moon { display: block; }
:root[data-theme="light"] .theme-toggle .icon-sun { display: block; }
:root[data-theme="light"] .theme-toggle .icon-moon { display: none; }

/* Hamburger (mobile) */
.menu-toggle {
  display: none; width: 40px; height: 40px;
  background: oklch(100% 0 0 / 0.05); border: 1px solid var(--c-border); border-radius: var(--r-pill);
  align-items: center; justify-content: center; position: relative;
}
.menu-toggle span {
  position: absolute; left: 11px; right: 11px; height: 1.5px; background: var(--c-text); border-radius: 2px;
  transition: transform var(--t-normal) var(--ease-out-expo), opacity var(--t-fast) var(--ease-out-expo);
}
.menu-toggle span:nth-child(1) { top: 14px; }
.menu-toggle span:nth-child(2) { top: 19px; }
.menu-toggle span:nth-child(3) { top: 24px; }
.menu-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(5px) rotate(45deg); }
.menu-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.menu-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-5px) rotate(-45deg); }

/* Spinner (compat for connect button) */
.spinner { display: inline-block; width: 14px; height: 14px; border: 2px solid oklch(100% 0 0 / 0.2);
  border-top-color: white; border-radius: 50%; animation: spin 0.8s linear infinite; vertical-align: middle; margin-right: 6px; }
@keyframes spin { to { transform: rotate(360deg); } }
.fade-in { animation: reveal-in 0.3s var(--ease-out-expo); }

/* === MOBILE NAV === */
@media (max-width: 980px) {
  .nav-primary { display: none; }
  .nav-actions .btn-buy-cta, .nav-actions .btn-phantom { display: none; }
  .menu-toggle { display: inline-flex; }

  .nav-drawer {
    position: fixed; top: 0; right: -100%; width: min(320px, 86vw); height: 100dvh;
    background: var(--c-drawer-bg); backdrop-filter: blur(24px); -webkit-backdrop-filter: blur(24px);
    border-left: 1px solid var(--c-border); padding: 5rem 1.5rem 2rem;
    display: flex; flex-direction: column; gap: 0.75rem; overflow-y: auto;
    transition: right var(--t-normal) var(--ease-out-expo); z-index: var(--z-drawer);
  }
  .nav-drawer.open { right: 0; }
  .nav-drawer > a, .nav-drawer > button {
    width: 100%; text-align: left; padding: 0.875rem 1rem; font-size: 1rem; border-radius: var(--r-md);
    font-family: var(--font-display); font-weight: 500; color: var(--c-text);
    background: oklch(100% 0 0 / 0.03); border: 1px solid var(--c-border); text-decoration: none; display: block;
  }
  .nav-drawer > a.btn-primary, .nav-drawer > button.btn-primary { background: var(--g-accent); border-color: transparent; text-align: center; }
  .nav-drawer form.js-logout { display: block; width: 100%; }
  .nav-drawer form.js-logout button {
    width: 100%; text-align: center; padding: 0.875rem 1rem; font-size: 1rem; border-radius: var(--r-md);
    font-family: var(--font-display); font-weight: 500; color: var(--c-text);
    background: oklch(100% 0 0 / 0.03); border: 1px solid var(--c-border);
  }

  .nav-overlay {
    position: fixed; inset: 0; background: oklch(0% 0 0 / 0.55); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
    opacity: 0; pointer-events: none; transition: opacity var(--t-normal) var(--ease-out-expo); z-index: var(--z-overlay);
  }
  .nav-overlay.show { opacity: 1; pointer-events: auto; }
}
@media (min-width: 981px) { .nav-drawer { display: none; } }

/* === FOOTER === */
.site-footer {
  margin-top: clamp(4rem, 8vw, 7rem);
  padding: clamp(3rem, 6vw, 5rem) var(--container-pad-x) 2rem;
  background: linear-gradient(180deg, transparent, var(--c-footer-bg) 30%);
  border-top: 1px solid var(--c-border);
}
.footer-grid {
  width: 100%; max-width: var(--container-max); margin-inline: auto;
  display: grid; grid-template-columns: 1.5fr repeat(3, 1fr) 1.5fr; gap: clamp(2rem, 4vw, 3rem);
}
@media (max-width: 860px) {
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .footer-brand { grid-column: span 2; }
  .footer-newsletter { grid-column: span 2; }
}
.footer-brand p { color: var(--c-text-muted); font-size: var(--text-sm); line-height: var(--leading-relaxed); margin: 0.875rem 0 1.25rem; max-width: 18rem; }
.footer-socials { display: flex; gap: 0.5rem; }
.footer-social {
  width: 36px; height: 36px; display: flex; align-items: center; justify-content: center; border-radius: 50%;
  border: 1px solid var(--c-border); background: oklch(100% 0 0 / 0.03); color: var(--c-text-muted);
  transition: transform var(--t-fast) var(--ease-spring), border-color var(--t-fast) var(--ease-out-expo),
              color var(--t-fast) var(--ease-out-expo), background var(--t-fast) var(--ease-out-expo);
}
.footer-social:hover { transform: translateY(-3px) scale(1.08); border-color: var(--c-accent); color: var(--c-text); background: oklch(72% 0.22 330 / 0.18); }
.footer-social svg { width: 16px; height: 16px; }
.footer-col h4 { font-family: var(--font-mono); font-size: var(--text-xs); text-transform: uppercase;
  letter-spacing: var(--tracking-wider); color: var(--c-text-faded); margin: 0 0 1rem; font-weight: 500; }
.footer-col ul { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 0.65rem; }
.footer-col a { font-size: var(--text-sm); color: var(--c-text-soft); transition: color var(--t-fast) var(--ease-out-expo); }
.footer-col a:hover { color: var(--c-text); }
.footer-newsletter form { display: flex; gap: 0.5rem; margin-top: 0.875rem; }
.footer-newsletter input {
  flex: 1; padding: 0.6rem 0.875rem; background: oklch(100% 0 0 / 0.04); border: 1px solid var(--c-border);
  border-radius: var(--r-pill); color: var(--c-text); font-family: var(--font-body); font-size: var(--text-sm);
  transition: border-color var(--t-fast) var(--ease-out-expo); min-width: 0;
}
.footer-newsletter input:focus { outline: none; border-color: var(--c-accent); }
.footer-newsletter button { padding: 0.6rem 1rem; background: var(--g-accent); color: white; border: none;
  border-radius: var(--r-pill); font-family: var(--font-display); font-size: var(--text-sm); font-weight: 600; cursor: pointer; }
.footer-meta {
  width: 100%; max-width: var(--container-max); margin: 2.5rem auto 0; padding-top: 1.5rem;
  border-top: 1px solid var(--c-border); display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 1rem;
}
.footer-contract { font-family: var(--font-mono); font-size: var(--text-xs); color: var(--c-text-muted); word-break: break-all; }
.footer-contract code { color: var(--c-cyan); padding: 0.25rem 0.5rem; background: oklch(100% 0 0 / 0.04); border-radius: var(--r-sm); border: 1px solid var(--c-border); }
.footer-copy { font-family: var(--font-mono); font-size: var(--text-xs); color: var(--c-text-faded); }
@media (max-width: 680px) { .footer-meta { flex-direction: column; align-items: flex-start; } }

/* === MOBILE APP BANNER === */
.app-banner {
  display: none; position: fixed; bottom: 0; left: 0; right: 0; z-index: var(--z-app-banner);
  padding: 0.875rem 1rem calc(0.875rem + env(safe-area-inset-bottom, 0));
  background: var(--c-app-banner-bg); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
  border-top: 1px solid var(--c-border-accent); align-items: center; gap: 0.75rem;
}
.app-banner .ab-text { flex: 1; min-width: 0; }
.app-banner .ab-title { font-family: var(--font-display); font-weight: 600; font-size: 0.95rem; color: var(--c-text); }
.app-banner .ab-sub { font-size: 0.8rem; color: var(--c-text-muted); }
.app-banner .ab-btn { padding: 0.5rem 1.125rem; background: var(--g-accent); color: white; border-radius: var(--r-pill);
  font-family: var(--font-display); font-weight: 600; font-size: 0.875rem; text-decoration: none; white-space: nowrap; }
.app-banner .ab-close { background: none; border: none; color: var(--c-text-muted); font-size: 1.4rem; cursor: pointer; padding: 0 0.25rem; line-height: 1; }
