/* ==========================================================================
   Prime Communication Media — HEADER (shared by every page)
   --------------------------------------------------------------------------
   Covers: <header id="mainHeader">, logo, desktop nav links, theme toggle,
           hamburger button and the mobile navigation drawer.
   Needs  : js/header.js   (scroll class, theme toggle, mobile drawer)
   Master : index.html (all other pages now follow it).

   Variables used (every page already defines them in its own :root / theme):
     --gold  --gold-light  --gold-dim  --transition-speed

   Page-specific tweaks do NOT belong here — put them in the page's own CSS
   (loaded AFTER this file). Two are in use today:
     • index.html          header:not(.scrolled) { background: transparent }
                           (header floats over the hero until you scroll)
     • gallery / legal     header { position: static }
   ========================================================================== */

/* ---------- 1. Header bar ---------- */
header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 500;
  background: rgb(201 168 77);
  transition: background var(--transition-speed), padding var(--transition-speed), box-shadow var(--transition-speed);
}

header.scrolled {
  background: rgb(201 168 77);
  box-shadow: 0 1px 0 rgba(201, 168, 76, 0.2);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 60px;
  transition: padding var(--transition-speed);
}

header.scrolled nav {
  padding: 14px 60px;
}

/* ---------- 2. Logo ---------- */
.nav-logo {
  display: flex;
  align-items: center;
  text-decoration: none;
  flex-shrink: 0;
}

.nav-logo img {
  height: 100px;
  width: auto;
  object-fit: contain;
  transition: height var(--transition-speed), filter var(--transition-speed);
  filter: drop-shadow(0 0 0 rgba(200, 190, 100, 1));
}

header.scrolled .nav-logo img {
  height: 100px;
}

/* Text shown if images/logo.png fails to load */
.nav-logo-fallback {
  font-family: 'Playfair Display', serif;
  font-size: 1.15rem;
  font-weight: 900;
  color: var(--gold);
  letter-spacing: 0.15em;
}

/* Optional emblem-style logo fallback */
.logo-svg-fallback {
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo-emblem {
  width: 44px;
  height: 44px;
  background: linear-gradient(135deg, var(--gold), var(--gold-dim));
  clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: width var(--transition-speed), height var(--transition-speed);
}

header.scrolled .logo-emblem {
  width: 36px;
  height: 36px;
}

.logo-emblem-inner {
  width: 20px;
  height: 20px;
  background: #0a0a0f;
  clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
  transition: background var(--transition-speed);
}

.logo-text-group {
  display: flex;
  flex-direction: column;
  line-height: 1;
}

.logo-text-prime {
  font-family: 'Playfair Display', serif;
  font-size: 1.15rem;
  font-weight: 900;
  color: var(--gold);
  letter-spacing: 0.15em;
}

.logo-text-comm {
  font-family: 'Montserrat', sans-serif;
  font-size: 0.52rem;
  font-weight: 300;
  color: #d4c9b0;
  letter-spacing: 0.4em;
  text-transform: uppercase;
  margin-top: 2px;
}

/* ---------- 3. Desktop nav links ---------- */
.nav-center {
  display: flex;
  align-items: center;
}

.nav-links {
  display: flex;
  gap: 36px;
  list-style: none;
}

.nav-links a {
  font-family: "Montserrat", sans-serif;
  font-size: 0.7rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #fff;
  text-decoration: none;
  position: relative;
  transition: color 0.3s;
}

.nav-links a.active {
  color: #000;
}

.nav-links a::after {
  content: "";
  position: absolute;
  bottom: -4px;
  left: 0;
  right: 100%;
  height: 1px;
  background: #000;
  transition: right 0.35s;
}

.nav-links a:hover::after,
.nav-links a.active::after {
  right: 0;
}

.nav-links a:hover {
  color: #000;
}

/* ---------- 4. Right side: theme toggle + hamburger ---------- */
.nav-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.theme-toggle {
  background: none;
  border: 1px solid #000;
  width: 44px;
  height: 24px;
  border-radius: 12px;
  cursor: pointer;
  position: relative;
  transition: border-color 0.3s, background 0.3s;
  flex-shrink: 0;
}

.theme-toggle:hover {
  border-color: #000;
}

.theme-toggle-knob {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #000;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
}

[data-theme="light"] .theme-toggle-knob {
  transform: translateX(20px);
}

.theme-icon {
  line-height: 1;
}

.nav-toggle {
  display: none;
  background: none;
  border: none;
  color: #000;
  font-size: 1.4rem;
  cursor: pointer;
  padding: 4px;
  line-height: 1;
}

/* ---------- 5. Mobile navigation drawer ---------- */
.mobile-nav-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  z-index: 700;
  opacity: 0;
  transition: opacity 0.3s;
}

.mobile-nav-overlay.open {
  opacity: 1;
}

.mobile-nav-drawer {
  position: fixed;
  top: 0;
  right: -100%;
  width: min(320px, 85vw);
  height: 100%;
  background: #13131c;
  border-left: 1px solid rgba(201, 168, 76, 0.2);
  z-index: 710;
  transition: right 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  padding: 80px 36px 40px;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.mobile-nav-drawer.open {
  right: 0;
}

.mobile-nav-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: absolute;
  top: 20px;
  left: 20px;
  right: 20px;
}

.mobile-theme-toggle-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}

.mobile-theme-label {
  font-family: 'Montserrat', sans-serif;
  font-size: 0.65rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: #d4c9b0;
}

.mobile-nav-close {
  background: none;
  border: none;
  color: #d4c9b0;
  font-size: 1.5rem;
  cursor: pointer;
  padding: 4px;
  transition: color 0.3s;
}

.mobile-nav-close:hover {
  color: var(--gold);
}

.mobile-nav-links {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 20px;
}

.mobile-nav-links a {
  font-family: 'Montserrat', sans-serif;
  font-size: 0.75rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: #d4c9b0;
  text-decoration: none;
  padding: 14px 0;
  border-bottom: 1px solid rgba(201, 168, 76, 0.2);
  display: block;
  transition: color 0.3s, padding-left 0.3s;
}

.mobile-nav-links a:hover,
.mobile-nav-links a.active {
  color: var(--gold);
  padding-left: 8px;
}

/* ---------- 6. Responsive ---------- */
@media (max-width: 1024px) {
  /* !important: some pages carry an inline style="display:flex" on .nav-center */
  .nav-center {
    display: none !important;
  }

  .nav-toggle {
    display: block !important;
  }

  nav {
    padding: 18px 40px;
  }

  header.scrolled nav {
    padding: 12px 40px;
  }

  .nav-links {
    gap: 24px;
  }
}

@media (max-width: 768px) {
  nav {
    padding: 14px 20px;
  }

  header.scrolled nav {
    padding: 10px 20px;
  }

  /* on phones the theme switch lives inside the drawer */
  .nav-right .theme-toggle {
    display: none !important;
    visibility: hidden !important;
  }
}

@media (max-width: 480px) {
  .nav-logo img {
    height: 80px;
  }
}
