/* ==========================================================================
   AppHeader — LOTR Fantasy Modern Theme
   Palette: forest greens (#0F2409 → #2D5016), gold (#DAA520 / #FFD700),
   parchment (#E8D5B7 / #F4E4BC), earth brown (#8B4513)
   ========================================================================== */

/* ── HEADER CONTAINER ── */
.lotr-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: linear-gradient(
    180deg,
    #1A3209 0%,
    #1B3A0D 30%,
    #2D5016 50%,
    #1F3A0E 80%,
    #162608 100%
  );
  box-shadow:
    inset 0 1px 0 rgba(255, 215, 0, 0.08),
    inset 0 -1px 0 rgba(0, 0, 0, 0.3),
    0 6px 20px rgba(0, 0, 0, 0.5);
  position: relative;
}

/* Atmospheric shimmer overlay — elegant fantasy texture */
.lotr-header::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(circle at 10% 50%, rgba(218, 165, 32, 0.06) 0%, transparent 50%),
    radial-gradient(circle at 90% 50%, rgba(218, 165, 32, 0.06) 0%, transparent 50%),
    radial-gradient(circle at 50% 0%, rgba(255, 215, 0, 0.02) 0%, transparent 60%);
  pointer-events: none;
  z-index: 0;
  animation: shimmerFlow 8s ease-in-out infinite;
}

@keyframes shimmerFlow {
  0%, 100% { opacity: 0.6; }
  50% { opacity: 1; }
}

/* ── top GOLD SHIMMER ACCENT LINE ── */
.lotr-header__top-accent {
  height: 1px;
  background: linear-gradient(
    to right,
    transparent 0%,
    #A67C52 20%,
    #FFD700 50%,
    #A67C52 80%,
    transparent 100%
  );
  opacity: 0.85;
  box-shadow: 0 0 8px rgba(255, 215, 0, 0.3);
}

/* ── INNER LAYOUT ── */
.lotr-header__inner {
  position: relative;
  z-index: 1;
  max-width: 90rem;
  margin: 0 auto;
  padding: 0.75rem 1.75rem;
  display: flex;
  align-items: center;
  gap: 1.5rem;
  min-width: 0;
}

/* ── BRAND ── */
.lotr-header__brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-shrink: 0;
  text-decoration: none;
  min-width: 0;
  max-width: 380px;
}

.lotr-header__ring-wrap {
  display: flex;
  align-items: center;
  filter: drop-shadow(0 0 8px rgba(218, 165, 32, 0.6));
  transition: filter 0.4s ease;
  cursor: default;
}

.lotr-header__ring-wrap:hover {
  filter: drop-shadow(0 0 16px rgba(255, 215, 0, 0.9));
}

/* Slow pulse glow on the ring SVG */
.lotr-header__ring-svg {
  animation: ringPulse 5s ease-in-out infinite;
}

@keyframes ringPulse {
  0%, 100% {
    opacity: 1;
    filter: drop-shadow(0 0 4px rgba(218, 165, 32, 0.5));
  }
  50% {
    opacity: 0.95;
    filter: drop-shadow(0 0 12px rgba(255, 215, 0, 0.85));
  }
}


/* Brand text: more prominent, fantasy style */
.lotr-header__brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.05;
  gap: 0.05em;
  min-width: 0;
  flex: 0 1 auto;
}


.lotr-header__subtitle {
  font-family: 'Cinzel', serif;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.35em;
  text-transform: uppercase;
  color: #FFD700;
  opacity: 0.9;
  user-select: none;
  text-shadow:
    0 1px 2px rgba(0, 0, 0, 0.7),
    0 0 8px rgba(218, 165, 32, 0.3);
}


.lotr-header__page-title {
  font-family: 'Uncial Antiqua', 'Cinzel', serif;
  font-size: 1.65rem;
  font-weight: 800;
  color: #FFF8DC;
  letter-spacing: 0.08em;
  margin: 0;
  line-height: 1.1;
  text-shadow:
    0 2px 4px rgba(0, 0, 0, 0.6),
    0 0 12px rgba(218, 165, 32, 0.25),
    0 0 24px rgba(218, 165, 32, 0.1);
  filter: drop-shadow(0 1px 3px #1A320966);
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── DIVIDER between brand and nav ── */
.lotr-header__brand::after {
  content: '';
  display: block;
  width: 1px;
  height: 2.2rem;
  background: linear-gradient(
    to bottom,
    transparent 0%,
    rgba(255, 215, 0, 0.3) 20%,
    rgba(255, 215, 0, 0.5) 50%,
    rgba(255, 215, 0, 0.3) 80%,
    transparent 100%
  );
  margin-left: 1.25rem;
  margin-right: 0.25rem;
  flex-shrink: 0;
  box-shadow: 0 0 8px rgba(218, 165, 32, 0.2);
}

/* ── NAVIGATION ── */
.lotr-header__nav {
  display: flex;
  align-items: center;
  gap: 0.1rem;
  flex: 1;
  justify-content: center;
}

/* ── NAV LINK ── */
.lotr-nav-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 1rem;
  border-radius: 0.5rem;
  font-family: 'Lora', serif;
  font-size: 0.95rem;
  font-weight: 500;
  color: #E8D5B7;
  text-decoration: none;
  white-space: nowrap;
  position: relative;
  transition:
    color 0.25s cubic-bezier(0.34, 1.56, 0.64, 1),
    background-color 0.25s ease,
    transform 0.2s ease;
  border-bottom: 2px solid transparent;
}

/* Animated gold underline */
.lotr-nav-link::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 2px;
  border-radius: 9999px;
  background: linear-gradient(to right, transparent, #FFD700, transparent);
  transition: width 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: 0 0 8px rgba(255, 215, 0, 0.3);
}

.lotr-nav-link:hover {
  color: #FFD700;
  background-color: rgba(218, 165, 32, 0.12);
  transform: translateY(-2px);
}

.lotr-nav-link:hover::after {
  width: 60%;
}

/* Active state */
.lotr-nav-link--active {
  color: #FFD700 !important;
  background-color: rgba(218, 165, 32, 0.16) !important;
  border-bottom: 2px solid #FFD700;
}

.lotr-nav-link--active::after {
  width: 60%;
  opacity: 0;
}

.lotr-nav-link:focus-visible {
  outline: 2px solid #FFD700;
  outline-offset: 3px;
}

.lotr-nav-link__icon {
  font-size: 1rem;
  flex-shrink: 0;
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.lotr-nav-link:hover .lotr-nav-link__icon {
  transform: scale(1.15) rotate(-5deg);
}


/* ── CONTROLS (scoring card + logout) ── */
.lotr-header__controls {
  display: flex;
  align-items: center;
  gap: 1.2rem;
  flex-shrink: 0;
  min-width: auto;
}


/* Subtle fantasy logout button override */
.lotr-logout-btn {
  border: 1.5px solid rgba(255, 215, 0, 0.55) !important;
  background: linear-gradient(135deg, #2D5016 0%, #1F3A0E 100%);
  color: #FFD700 !important;
  font-family: 'Cinzel', serif;
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  box-shadow:
    0 2px 8px rgba(218, 165, 32, 0.15),
    inset 0 1px 0 rgba(255, 215, 0, 0.1);
  transition:
    all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.lotr-logout-btn:hover {
  border-color: #FFF8DC !important;
  background: linear-gradient(135deg, #243A12 0%, #2D5016 100%);
  color: #FFF8DC !important;
  box-shadow:
    0 4px 16px rgba(255, 215, 0, 0.35),
    inset 0 1px 0 rgba(255, 215, 0, 0.2);
  transform: translateY(-2px);
}

/* ── HAMBURGER (mobile only) ── */
.lotr-hamburger {
  display: none; /* shown via media query below */
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  width: 2.5rem;
  height: 2.5rem;
  padding: 0.5rem;
  border-radius: 0.5rem;
  border: 1.5px solid rgba(218, 165, 32, 0.45);
  background: rgba(26, 50, 9, 0.6);
  cursor: pointer;
  flex-shrink: 0;
  transition:
    all 0.25s ease;
}

.lotr-hamburger:hover {
  background: rgba(26, 50, 9, 0.9);
  border-color: rgba(255, 215, 0, 0.65);
  box-shadow: 0 0 12px rgba(218, 165, 32, 0.2);
}

.lotr-hamburger:focus-visible {
  outline: 2px solid #FFD700;
  outline-offset: 2px;
}

.lotr-hamburger__bar {
  display: block;
  width: 18px;
  height: 2px;
  background-color: #E8D5B7;
  border-radius: 9999px;
  transition:
    transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1),
    opacity 0.2s ease,
    background-color 0.25s ease;
}

.lotr-hamburger--open .lotr-hamburger__bar:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
  background-color: #FFD700;
}

.lotr-hamburger--open .lotr-hamburger__bar:nth-child(2) {
  opacity: 0;
  transform: scaleX(0);
}

.lotr-hamburger--open .lotr-hamburger__bar:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
  background-color: #FFD700;
}

/* ── ELVISH WAVY BORDER BOTTOM ── */
.lotr-header__elvish-border {
  position: relative;
  height: 16px;
  overflow: visible;
  pointer-events: none;
}

.lotr-header__border-svg {
  width: 100%;
  height: 16px;
  display: block;
  filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.25));
}

/* Decorative gem cluster centred on the border */
.lotr-header__gems {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 0.5rem;
  color: #FFD700;
  letter-spacing: 0.8rem;
  opacity: 0.75;
  user-select: none;
  white-space: nowrap;
  text-shadow: 0 0 6px rgba(255, 215, 0, 0.5);
}


/* ── RESPONSIVE — MOBILE (< 768 px) ── */
@media (max-width: 767px) {
  .lotr-header__inner {
    padding: 0.6rem 0.75rem;
    flex-wrap: wrap;
    row-gap: 0.3rem;
  }

  /* Brand takes remaining space on first row */
  .lotr-header__brand {
    flex: 1;
  }

  /* Nav hidden by default on mobile */
  .lotr-header__nav {
    display: none;
    order: 10; /* below hamburger row */
    width: 100%;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.1rem;
    padding-top: 0.45rem;
    border-top: 1px solid rgba(218, 165, 32, 0.15);
    margin-top: 0.3rem;
    animation: mobileNavIn 220ms cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
  }

  /* Controls hidden by default on mobile */
  .lotr-header__controls {
    display: none;
    order: 11;
    width: 100%;
    flex-direction: column;
    align-items: stretch;
    gap: 0.55rem;
    padding-top: 0.45rem;
    padding-bottom: 0.2rem;
    border-top: 1px solid rgba(218, 165, 32, 0.12);
    margin-top: 0.2rem;
    animation: mobileNavIn 240ms cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
  }

  /* When menu is open: reveal nav and controls */
  .lotr-header--menu-open .lotr-header__nav,
  .lotr-header--menu-open .lotr-header__controls {
    display: flex;
  }

  /* Show hamburger on mobile */
  .lotr-hamburger {
    display: flex;
  }

  /* Full-width nav links on mobile */
  .lotr-nav-link {
    width: 100%;
    padding: 0.55rem 0.8rem;
    font-size: 1.05rem;
    border-radius: 0.5rem;
  }

  /* Logout fills width on mobile */
  .lotr-logout-btn {
    width: 100% !important;
    justify-content: center;
    text-align: center;
    padding: 0.7rem 1rem !important;
  }

  /* Hide brand divider on mobile */
  .lotr-header__brand::after {
    display: none;
  }
}

/* ── SLIDE-IN ANIMATION FOR MOBILE MENU ── */
@keyframes mobileNavIn {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ── DESKTOP ADJUSTMENTS ── */
@media (min-width: 768px) {
  /* Ensure hamburger stays hidden on desktop */
  .lotr-hamburger {
    display: none !important;
  }

  /* Ensure controls are always visible on desktop */
  .lotr-header__controls {
    display: flex !important;
  }

  /* Ensure nav is always visible on desktop */
  .lotr-header__nav {
    display: flex !important;
  }
}
