/* 15G site shell — global overrides, mobile fixes, theme inversions */

html, body { max-width: 100vw; overflow-x: hidden; }
nav, .nav, header { max-width: 100vw; }

/* The floating "gm" pill-nav appears on every 15G page — make it bulletproof on mobile */
@media (max-width: 720px) {
  .gm { 
    top: 8px !important; 
    right: 8px !important; 
    left: auto !important;
    max-width: calc(100vw - 70px) !important; /* leave room for theme button */
    flex-wrap: wrap !important;
    justify-content: flex-end !important;
    padding: 5px 6px !important;
    font-size: 8px !important;
    letter-spacing: 0.16em !important;
    row-gap: 2px !important;
  }
  .gm a { padding: 4px 6px !important; }
}
@media (max-width: 420px) {
  .gm { 
    max-width: calc(100vw - 64px) !important;
    font-size: 7.5px !important;
    letter-spacing: 0.12em !important;
  }
  .gm a { padding: 3px 5px !important; }
}

/* Prevent ANY common section from blowing past viewport on mobile */
@media (max-width: 640px) {
  section, .section, header, footer, .hero, .grid, .row { max-width: 100vw; }
  h1, h2, h3, .display { word-break: break-word; overflow-wrap: anywhere; }
  table { display: block; overflow-x: auto; }
  pre, code { white-space: pre-wrap; word-break: break-all; }
}

/* ------- LIGHT THEME OVERRIDES ------- */
:root[data-theme="light"] {
  --bg-0: #F4ECD8 !important;
  --bg-1: #EFE5CB !important;
  --bg-2: #E5D7B7 !important;
  --cream: #3A2A18 !important;
  --cream-bright: #2A1E10 !important;
  --cream-soft: #5A4226 !important;
  --gold: #8A6428 !important;
  --gold-bright: #A07A38 !important;
  --gold-light: #C09650 !important;
  --gold-deep: #5A3F18 !important;
  --gold-grad: linear-gradient(180deg,#A07A38 0%,#8A6428 55%,#5A3F18 100%) !important;
  --rule: rgba(138,100,40,0.28) !important;
  --rule-strong: rgba(138,100,40,0.55) !important;
  --ink-dim: #6E5C40 !important;
}

[data-theme="light"] body {
  background:
    radial-gradient(ellipse 1200px 600px at 20% -10%, rgba(192,150,80,0.22), transparent 60%),
    radial-gradient(ellipse 1000px 500px at 80% 110%, rgba(220,190,140,0.32), transparent 60%),
    linear-gradient(180deg, #F4ECD8 0%, #EFE5CB 50%, #F4ECD8 100%) !important;
  color: #3A2A18 !important;
}

[data-theme="light"] .nav,
[data-theme="light"] header.nav,
[data-theme="light"] nav.nav { background: rgba(244,236,216,0.92) !important; }

[data-theme="light"] .gm {
  background: rgba(244,236,216,0.92) !important;
  border-color: rgba(138,100,40,0.40) !important;
}
[data-theme="light"] .gm a { color: #5A4226 !important; }
[data-theme="light"] .gm a:hover { background: rgba(138,100,40,0.18) !important; color: #2A1E10 !important; }
[data-theme="light"] .gm a.act { background: rgba(138,100,40,0.25) !important; color: #5A3F18 !important; }

[data-theme="light"] .nav-pill, [data-theme="light"] .pill { background: rgba(255,255,255,0.65) !important; border-color: rgba(138,100,40,0.32) !important; color: #3A2A18 !important; }
[data-theme="light"] a { color: inherit; }
[data-theme="light"] .gold-rule { opacity: 0.55; }

/* Prevent body scroll while gate is active */
html[data-gate="closed"] body { overflow: hidden !important; }
