/* ═══════════════════════════════════════════════════════════
   Living Mirrors — Shared Theme v1.0
   Source of truth: THEME.md + modes/index.html (canonical)
   ═══════════════════════════════════════════════════════════ */

/* ═══════ DESIGN TOKENS ═══════ */
:root {
  /* Gold system */
  --gold: #c9a162;
  --gold-rich: #a8844a;
  --gold-mid: rgba(201,161,98,.55);
  --gold-dim: rgba(201,161,98,.3);
  --gold-faint: rgba(201,161,98,.1);

  /* Text — light background */
  --text: rgba(20,18,16,.88);
  --text-mid: rgba(40,35,28,.58);
  --text-dim: rgba(70,62,50,.36);
  --text-faint: rgba(100,90,75,.14);

  /* Text — dark background */
  --text-light: rgba(250,245,235,.88);
  --text-light-mid: rgba(250,245,235,.5);
  --text-light-dim: rgba(250,245,235,.28);

  /* Surfaces */
  --bg: #faf9f6;
  --bg-warm: #f4f2ed;
  --dark: #0a2540;
  --dark-surface: rgba(10,30,56,.97);
  --dark-deep: #061a30;

  /* Mode colours */
  --savant: #4A6FA5;
  --savant-bright: #6B92C4;
  --play: #D4845A;
  --play-bright: #E6A07A;
  --spark: #d4a020;
  --spark-bright: #e8c44a;
  --imagineer: #8B6AAE;
  --imagineer-bright: #A88BC8;
  --learn: #4a9e6e;
  --learn-bright: #6bbe8e;

  /* Fonts */
  --serif: "Cormorant Garamond", Georgia, serif;
  --sans: "Helvetica Neue", Arial, -apple-system, sans-serif;
}

/* ═══════ RESET ═══════ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; -webkit-font-smoothing: antialiased; scroll-behavior: smooth; overflow-x: hidden; }
body { font-family: var(--serif); overflow-x: hidden; }
::selection { background: rgba(201,161,98,.2); }

/* ═══════ GRAIN OVERLAY — desktop only, kills mobile scroll ═══════ */
@media (min-width: 769px) {
  body::after {
    content: '';
    position: fixed;
    inset: 0;
    z-index: 9999;
    pointer-events: none;
    opacity: 0.022;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
    background-repeat: repeat;
    background-size: 256px;
  }
}

/* ═══════ NAV ═══════ */
.lm-nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  padding: 26px 48px;
  transition: background .5s, box-shadow .5s;
}

/* Dark mode nav (dark hero sections) */
.lm-nav.on-dark {
  background: linear-gradient(to bottom, rgba(6,26,48,.92) 0%, rgba(6,26,48,.35) 60%, transparent 100%);
}

/* Light mode nav (light bg sections) */
.lm-nav.on-light {
  background: linear-gradient(to bottom, #faf9f6 0%, rgba(250,249,246,.97) 70%, rgba(250,249,246,.85) 100%);
}

/* Wordmark */
.lm-nav-wordmark {
  text-decoration: none;
  margin-right: auto;
  display: flex;
  align-items: center;
  gap: 10px;
}
.lm-nav-spark {
  width: 28px; height: 28px;
  transition: opacity .3s, filter .3s;
}
/* Logo always gold-tinted */
.lm-nav.on-dark .lm-nav-spark {
  filter: sepia(1) saturate(2) hue-rotate(-5deg) brightness(1.1);
  opacity: .8;
}
.lm-nav.on-light .lm-nav-spark {
  filter: sepia(1) saturate(1.8) hue-rotate(-5deg) brightness(.65);
  opacity: .85;
}
.lm-nav-wordmark:hover .lm-nav-spark { opacity: 1; }

.lm-nav-text {
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 300;
  letter-spacing: .35em;
  text-transform: uppercase;
  transition: color .3s;
}

/* Wordmark text */
.lm-nav.on-dark .lm-nav-text { color: rgba(201,161,98,.75); }
.lm-nav.on-light .lm-nav-text { color: var(--gold-rich); }
.lm-nav.on-dark .lm-nav-wordmark:hover .lm-nav-text { color: rgba(201,161,98,.95); }
.lm-nav.on-light .lm-nav-wordmark:hover .lm-nav-text { color: rgba(160,130,70,1); }

/* Links */
.lm-nav-links {
  display: flex;
  gap: 36px;
  align-items: center;
}
.lm-nav-link {
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 300;
  letter-spacing: .35em;
  text-transform: uppercase;
  text-decoration: none;
  transition: color .4s;
}
.lm-nav.on-dark .lm-nav-link { color: rgba(250,245,235,.5); }
.lm-nav.on-dark .lm-nav-link:hover,
.lm-nav.on-dark .lm-nav-link.active { color: var(--gold); }
.lm-nav.on-light .lm-nav-link { color: rgba(70,62,50,.55); }
.lm-nav.on-light .lm-nav-link:hover,
.lm-nav.on-light .lm-nav-link.active { color: var(--gold-rich); }
.lm-nav-link.active {
  text-decoration: underline;
  text-underline-offset: 6px;
  text-decoration-thickness: 1px;
}

/* Home link — mobile only */
.lm-nav-mobile-only { display: none; }

/* Hamburger */
.lm-nav-hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  z-index: 101;
}
.lm-nav-hamburger span {
  display: block;
  width: 22px;
  height: 1.5px;
  transition: all .3s;
}
.lm-nav.on-dark .lm-nav-hamburger span { background: rgba(250,245,235,.5); }
.lm-nav.on-light .lm-nav-hamburger span { background: rgba(70,62,50,.65); }

/* Hamburger open state */
.lm-nav-hamburger.open span:nth-child(1) { transform: rotate(45deg) translate(4px, 4px); }
.lm-nav-hamburger.open span:nth-child(2) { opacity: 0; }
.lm-nav-hamburger.open span:nth-child(3) { transform: rotate(-45deg) translate(4px, -4px); }
.lm-nav-hamburger.open span { background: rgba(250,245,235,.6) !important; }

/* Mobile nav */
@media (max-width: 768px) {
  .lm-nav-hamburger { display: flex; }
  .lm-nav-links {
    display: none;
    position: fixed;
    inset: 0;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 0;
    padding: 0;
    background: rgba(6,20,38,.98);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    z-index: 99;
  }
  .lm-nav-links.open {
    display: flex;
    animation: lm-menu-in .4s cubic-bezier(.22,1,.36,1) forwards;
  }
  @keyframes lm-menu-in {
    from { opacity: 0; }
    to { opacity: 1; }
  }
  .lm-nav-links .lm-nav-link {
    padding: 20px 0;
    color: rgba(250,245,235,.85);
    font-size: 16px;
    font-weight: 300;
    letter-spacing: .35em;
    border-bottom: none;
    transition: color .3s, transform .3s;
  }
  .lm-nav-links .lm-nav-link:hover,
  .lm-nav-links .lm-nav-link:active { color: var(--gold); transform: translateX(4px); }
  .lm-nav-links .lm-nav-link.active {
    color: var(--gold);
    text-decoration: none;
    text-underline-offset: 0;
  }
  .lm-nav-mobile-only { display: block; }
  .lm-nav { padding: 20px 24px; }
  .lm-nav-spark { width: 24px; height: 24px; }
  .lm-nav-text { font-size: 10px; }
}

/* ═══════ FOOTER ═══════ */
.lm-footer {
  padding: 60px 48px 48px;
  background: var(--dark-deep);
  text-align: center;
  position: relative;
}
.lm-footer::before {
  content: '';
  position: absolute;
  top: 0; left: 50%;
  transform: translateX(-50%);
  width: 1px; height: 48px;
  background: linear-gradient(to bottom, rgba(201,161,98,.1), transparent);
}
.lm-footer-logo {
  display: inline-block;
  margin-bottom: 28px;
}
.lm-footer-logo img {
  height: 54px;
  width: auto;
  opacity: .4;
  transition: opacity .3s;
  filter: sepia(1) saturate(2) hue-rotate(-5deg) brightness(1.1);
}
.lm-footer-logo:hover img { opacity: .7; }

.lm-footer-links {
  display: flex;
  justify-content: center;
  gap: 32px;
  margin-bottom: 32px;
}
.lm-footer-links a {
  font-family: var(--sans);
  font-size: .83rem;
  font-weight: 300;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: rgba(250,245,235,.18);
  text-decoration: none;
  transition: color .3s;
}
.lm-footer-links a:hover { color: rgba(201,161,98,.45); }

.lm-footer-copy {
  font-family: var(--sans);
  font-size: .72rem;
  font-weight: 300;
  letter-spacing: .12em;
  color: rgba(250,245,235,.1);
}

@media (max-width: 768px) {
  .lm-footer { padding: 40px 24px 36px; }
  .lm-footer-links { gap: 16px; flex-wrap: wrap; }
}

/* ═══════ SHARED ANIMATIONS ═══════ */
@keyframes rise {
  from { opacity: 0; transform: translateY(18px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ═══════ SHARED BUTTON STYLES ═══════ */
.lm-btn {
  display: inline-block;
  font-family: var(--sans);
  font-size: .83rem;
  font-weight: 300;
  letter-spacing: .24em;
  text-transform: uppercase;
  text-decoration: none;
  padding: 18px 52px;
  border-radius: 40px;
  position: relative;
  overflow: hidden;
  transition: all .5s;
}
.lm-btn-dark {
  color: rgba(201,161,98,.5);
  border: 1px solid rgba(201,161,98,.2);
}
.lm-btn-dark:hover {
  border-color: rgba(201,161,98,.5);
  color: rgba(212,184,120,.9);
  background: rgba(201,161,98,.06);
}
.lm-btn-light {
  color: var(--gold-rich);
  border: 1px solid var(--gold-dim);
}
.lm-btn-light:hover {
  border-color: var(--gold);
  background: rgba(201,161,98,.05);
}
