/* ═══════════════════════════════════════════════════════════════════
   MENU STYLES — Fourmula.ai Fullscreen Overlay (Premium Version)
   ═══════════════════════════════════════════════════════════════════ */

/* ── CSS VARIABLES ── */
:root {
  --gold: #b8822e;
  --gold-light: #d4a55a;
  --gold-dim: rgba(184,130,46,0.12);
  --bg: #0f0d0a;
  --surface: #1a1611;
  --surface2: #221d15;
  --surface3: #2d2720;
  --border: rgba(184,130,46,0.15);
  --text: #f0ebe2;
  --text-muted: #8a7d6e;
  --header-h: 56px;
  --tab-h: 62px;
  --radius: 14px;
  /* Animation easing - premium curves */
  --ease-premium: cubic-bezier(.76,0,.24,1);
  --ease-out-expo: cubic-bezier(.22,1,.36,1);
  /* Menu animation timing */
  --menu-speed-open: 0.6s;
  --menu-speed-close: 0.5s;
  --menu-speed-backdrop: 0.45s;
}

[data-theme="light"] {
  --bg: #faf8f5;
  --surface: #ffffff;
  --surface2: #f3f0ea;
  --surface3: #e8e4da;
  --border: rgba(184,130,46,0.12);
  --text: #1a1611;
  --text-muted: #7a6f62;
}

/* ── HEADER ── */
#header {
  position: sticky;
  top: 0;
  z-index: 200;
  background: transparent;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  padding: 0 1rem;
  height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.header__left {
  flex: 1;
  display: flex;
  align-items: center;
  min-width: 0;
}

.logo {
  display: none;
}

/* Logo image - desktop only */
.logo-link { display: flex !important; align-items: center; text-decoration: none; visibility: visible !important; opacity: 1 !important; }
.logo-img { width: 96px; height: auto; object-fit: contain; }
.header__cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  padding: 0.35rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text-muted);
  font-family: 'Inter', sans-serif;
  font-size: 0.78rem;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  background: color-mix(in srgb, var(--surface2) 72%, transparent);
  transition: color 0.2s var(--ease-premium), border-color 0.2s var(--ease-premium), background 0.2s var(--ease-premium), transform 0.2s var(--ease-premium);
}
.header__cta:hover {
  color: var(--gold-light);
  border-color: var(--gold);
  background: var(--gold-dim);
  transform: translateY(-1px);
}
@media (max-width: 680px) {
  .logo-img { width: 60px; }
  .header__cta { display: none; }
}

/* Center pill */
.header__main {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.35rem 0.4rem 0.35rem 0.7rem;
  gap: 0.65rem;
}

.header__right {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.5rem;
  min-width: 0;
}

/* ── MENU TOGGLE ── */
.header__menu {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  cursor: pointer;
  padding: 0.25rem 0.5rem 0.25rem 0;
  border-radius: 999px;
  transition: opacity 0.3s var(--ease-premium);
  user-select: none;
  background: none;
  border: none;
}
.header__menu:hover { opacity: 0.72; }

.header__menu-icon {
  width: 24px;
  height: 16px;
  position: relative;
  flex-shrink: 0;
}
.header__menu-line {
  position: absolute;
  width: 100%;
  height: 1.5px;
  background: var(--text-muted);
  border-radius: 999px;
  transition: all 0.5s var(--ease-premium);
}
.header__menu-line.is-top  { top: 0; }
.header__menu-line.is-bottom { bottom: 0; }
.header__menu.open .header__menu-line.is-top {
  top: 50%;
  transform: translateY(-50%) rotate(45deg);
  background: var(--text);
}
.header__menu.open .header__menu-line.is-bottom {
  bottom: 50%;
  transform: translateY(50%) rotate(-45deg);
  background: var(--text);
}

.header__menu-txt {
  font-family: 'Inter', sans-serif;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-muted);
  transition: color 0.15s;
}
.header__menu:hover .header__menu-txt { color: var(--text); }

/* ── THEME TOGGLE ── */
.header__theme {
  display: flex; align-items: center; justify-content: center;
  width: 30px; height: 30px;
  border-radius: 50%;
  border: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  flex-shrink: 0;
  background: none;
}
.header__theme:hover { background: var(--surface3); border-color: var(--gold); }
.header__theme svg { width: 14px; height: 14px; color: var(--text-muted); }
.header__theme:hover svg { color: var(--gold-light); }
.header__theme-night { display: flex; }
.header__theme-day   { display: none; }
[data-theme="light"] .header__theme-night { display: none; }
[data-theme="light"] .header__theme-day   { display: flex; }

/* ── SCROLL PROGRESS ── */
.header__prc {
  display: flex; align-items: center; justify-content: center;
  background: var(--surface3);
  border-radius: 999px;
  min-width: 44px; height: 28px;
  padding: 0 0.5rem;
}
.header__prc-txt {
  font-family: 'Inter', sans-serif;
  font-size: 0.72rem; font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.02em;
}

/* ═══════════════════════════════════════════════════════════════════
   FULLSCREEN MENU OVERLAY
   ═══════════════════════════════════════════════════════════════════ */

.menu-overlay {
  position: fixed;
  inset: 0;
  z-index: 500;
  background: rgba(0,0,0,0.55);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  /* No top padding — panel starts at y:0, covering the header row exactly */
  padding: 0 1rem 0.6rem;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}
.menu-overlay.open {
  opacity: 1;
  visibility: visible;
}

.menu-panel {
  width: 100%;
  max-width: 280px;
  background: var(--surface);
  /* Only round bottom corners — top edge is flush with the viewport/header row */
  border-radius: 0 0 20px 20px;
  border: 1px solid var(--border);
  border-top: none;
  display: flex;
  flex-direction: column;
  max-height: 100dvh;
  overflow: hidden;
  clip-path: inset(0 0 100% 0 round 0 0 20px 20px);
  transition: clip-path 0.6s var(--ease-out-expo);
  box-shadow: 0 24px 80px rgba(0,0,0,.6);
}

.menu-overlay.open .menu-panel {
  clip-path: inset(0 0 0% 0 round 0 0 20px 20px);
}

/* Panel header — matches page header height exactly so pill sits at the same row */
.menu-header {
  display: flex;
  align-items: center;
  height: var(--header-h);   /* 56px — identical to #header height */
  padding: 0 0.55rem;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  gap: 0;
}

/* Inner pill */
.menu-header-pill {
  display: inline-flex;
  align-items: center;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.35rem 0.4rem 0.35rem 0.7rem;
  gap: 0.65rem;
  margin: 0 auto;
}

.menu-close-btn {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  cursor: pointer;
  padding: 0.25rem 0.5rem 0.25rem 0;
  border-radius: 999px;
  transition: opacity 0.3s var(--ease-premium);
  user-select: none;
  background: none;
  border: none;
}
.menu-close-btn:hover { opacity: 0.72; }

.menu-close-icon {
  width: 24px;
  height: 16px;
  left: -10px;
  position: relative;
  flex-shrink: 0;
}
.menu-close-line {
  position: absolute;
  width: 100%;
  height: 1.5px;
  background: var(--text-muted);
  border-radius: 999px;
  transition: all 0.5s var(--ease-premium);
}
.menu-close-line.is-top  { top: 0; }
.menu-close-line.is-bottom { bottom: 0; }
.menu-close-btn.open .menu-close-line.is-top {
  top: 50%;
  transform: translateY(-50%) rotate(45deg);
  background: var(--text);
}
.menu-close-btn.open .menu-close-line.is-bottom {
  bottom: 50%;
  transform: translateY(50%) rotate(-45deg);
  background: var(--text);
}

.menu-close-txt {
  font-family: 'Inter', sans-serif;
  font-size: 0.82rem; font-weight: 500;
  color: var(--text-muted);
}

.menu-header-spacer { display: none; }

/* Theme + progress sit directly in the header pill — no extra wrapper */
.menu-theme-btn {
  display: flex; align-items: center; justify-content: center;
  width: 30px; height: 30px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: none;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.menu-theme-btn:hover { background: var(--surface3); border-color: var(--gold); }
.menu-theme-btn svg { width: 14px; height: 14px; color: var(--text-muted); }
.menu-theme-btn:hover svg { color: var(--gold-light); }

.menu-progress-pill {
  display: flex; align-items: center; justify-content: center;
  background: var(--surface3);
  border-radius: 999px;
  min-width: 44px; height: 28px;
  padding: 0 0.5rem;
  font-family: 'Inter', sans-serif;
  font-size: 0.72rem; font-weight: 600;
  color: var(--text-muted);
}

/* ── MENU CONTENT ── */
.menu-content {
  flex: 1;
  overflow-y: auto;
  padding: 1rem 1.5rem 0.25rem;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  scrollbar-width: none;
}
.menu-content::-webkit-scrollbar {
  display: none;
}

.menu-section { margin-bottom: 0.25rem; }

.menu-section-title {
  font-family: 'Inter', sans-serif;
  font-size: 0.625rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.125em;
  color: var(--text-muted);
  margin-bottom: 0.25rem;
}

/* Primary — large items with staggered animation */
.menu-section.primary .menu-link {
  font-family: 'Inter', sans-serif;
  font-size: clamp(1.5rem, 5vw, 2rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
  color: var(--text);
  display: block;
  padding: 0.125rem 0;
  text-decoration: none;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  cursor: pointer;
  opacity: 0;
  transform: translateY(16px);
  transition:
    color 0.3s var(--ease-premium),
    opacity 0.5s var(--ease-out-expo),
    transform 0.5s var(--ease-out-expo);
}
.menu-section.primary .menu-link.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.menu-section.primary .menu-link:hover {
  color: var(--gold-light);
  opacity: 0.88;
}
.menu-section.primary .menu-link.active { color: var(--gold-light); }

.menu-divider {
  height: 1px;
  background: var(--border);
  margin: 0.5rem 0;
}

/* Secondary — small items with staggered animation */
.menu-section.secondary .menu-link {
  font-family: 'Inter', sans-serif;
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text-muted);
  opacity: 0;
  transform: translateY(10px);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.25rem 0;
  text-decoration: none;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  cursor: pointer;
  transition:
    color 0.25s var(--ease-premium),
    opacity 0.4s var(--ease-out-expo),
    transform 0.4s var(--ease-out-expo);
}
.menu-section.secondary .menu-link.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.menu-section.secondary .menu-link:hover {
  color: var(--text);
  transform: translateX(4px);
}
.menu-section.secondary .menu-link.active { color: var(--gold-light); }
.menu-section.secondary .menu-link .menu-icon {
  width: 20px;
  height: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.menu-section.secondary .menu-link .menu-icon svg { width: 18px; height: 18px; stroke-width: 1.75; }

/* ── SOCIAL + FOOTER ── */
.menu-social {
  padding: 0.75rem 1.5rem;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

.menu-social-title {
  font-family: 'Inter', sans-serif;
  font-size: 0.625rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.125em;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.menu-social-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.menu-social-links { display: flex; gap: 0.5rem; flex-wrap: wrap; }

.menu-social-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-muted);
  font-family: 'Inter', sans-serif;
  font-size: 0.75rem;
  font-weight: 500;
  text-decoration: none;
  padding: 0.25rem 0.75rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  transition: all 0.3s var(--ease-premium);
}
.menu-social-link svg { width: 16px; height: 16px; stroke-width: 1.75; }
.menu-social-link:hover {
  border-color: var(--gold);
  color: var(--gold-light);
  background: var(--gold-dim);
}

.menu-footer-text {
  font-family: 'Inter', sans-serif;
  font-size: 0.72rem;
  color: var(--text-muted);
  letter-spacing: 0.04em;
  white-space: nowrap;
}

/* ── RESPONSIVE ── */
@media (max-width: 640px) {
  .menu-overlay {
    padding: 0 1rem 0.6rem;
  }
  .menu-panel {
    max-height: 100dvh;
    border-radius: 0 0 20px 20px;
  }
  .menu-header { padding: 0 0.55rem; }
  .menu-content { padding: 1rem 1rem 0.25rem; }
  .menu-social { padding: 0.75rem 1rem 1rem; }
  .menu-section.primary .menu-link { font-size: clamp(1.25rem, 8vw, 1.75rem); }
  .header__menu-txt,
  .menu-close-txt,
  .menu-footer-text { display: none; }
}

@media (max-width: 480px) {
  .menu-overlay { padding: 0 0.75rem 0.5rem; }
  .menu-panel { border-radius: 0 0 16px 16px; }
}

/* When menu is open */
body.menu-open {
  overflow: hidden;
}

@media (prefers-reduced-motion: reduce) {
  .menu-overlay,
  .menu-panel,
  .header__menu-line,
  .menu-close-line,
  .menu-link,
  .menu-social-link,
  .header__menu,
  .header__theme,
  .menu-theme-btn {
    animation: none !important;
    transition-duration: 0.01ms !important;
    transition-delay: 0ms !important;
  }
}
