/* =====================
   HEADER
===================== */
#header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  transition: background-color 0.4s ease,
    box-shadow 0.4s ease;
}

#header .header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 40px;
  height: 72px;
  max-width: 100%;
}

/* Solid state at top */
#header.at-top {
  background-color: var(--rm-bg);
  box-shadow: 0 1px 0 rgba(61, 90, 71, 0.1);
}

/* Blurred transparent on scroll */
#header.scrolled {
  background-color: rgba(247, 244, 238, 0.72);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 1px 0 rgba(61, 90, 71, 0.08);
}

/* Logo */
.header-logo img {
  height: 44px;
  width: auto;
  display: block;
}

/* Nav */
.header-nav {
  display: flex;
  align-items: center;
  gap: 32px;
  list-style: none;
}

.header-nav a,
.header-nav button {
  font-family: Arial, sans-serif;
  font-size: 13px;
  letter-spacing: 0.04em;
  text-decoration: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  transition: color 0.2s ease;
}

/* Solid nav links at top */
#header.at-top .header-nav a,
#header.at-top .header-nav button {
  color: var(--rm-text);
}

#header.at-top .header-nav a:hover,
#header.at-top .header-nav button:hover {
  color: var(--rm-green);
}

/* Blurred nav links on scroll */
#header.scrolled .header-nav a,
#header.scrolled .header-nav button {
  color: var(--rm-text);
}

#header.scrolled .header-nav a:hover,
#header.scrolled .header-nav button:hover {
  color: var(--rm-green);
}

/* Active link */
.header-nav a.active {
  border-bottom: 1px solid var(--rm-accent);
  padding-bottom: 2px;
}

/* Dropdown */
.header-nav-folder {
  position: relative;
}

.rm-custom-dropdown {
  position: absolute;
  top: calc(100% + 20px);
  left: 50%;
  transform: translateX(-50%) translateY(-8px);
  background: #1E1E1E;
  border-radius: 14px;
  padding: 10px;
  min-width: 300px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.3);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease,
    visibility 0.25s ease,
    transform 0.25s ease;
  z-index: 9999;
  pointer-events: none;
}

.rm-custom-dropdown::after {
  content: '';
  position: absolute;
  top: -20px;
  left: 0;
  right: 0;
  height: 20px;
  background: transparent;
}

.rm-custom-dropdown::before {
  content: '';
  position: absolute;
  top: -5px;
  left: 50%;
  width: 10px;
  height: 10px;
  background: #1E1E1E;
  transform: translateX(-50%) rotate(45deg);
  border-radius: 2px;
}

.rm-custom-dropdown.is-open {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
  pointer-events: all;
}

.rm-dropdown-item {
  display: block;
  padding: 14px 18px;
  border-radius: 8px;
  text-decoration: none;
  transition: background 0.2s ease;
  cursor: pointer;
}

.rm-dropdown-item:hover {
  background: rgba(255, 255, 255, 0.07);
}

.rm-dropdown-item-label {
  display: block;
  font-family: Arial, sans-serif;
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--rm-accent);
  margin-bottom: 4px;
}

.rm-dropdown-item-title {
  display: block;
  font-family: Georgia, serif;
  font-size: 16px;
  color: #F7F4EE;
  line-height: 1.3;
  margin-bottom: 4px;
}

.rm-dropdown-item-desc {
  display: block;
  font-family: Arial, sans-serif;
  font-size: 12px;
  color: rgba(247, 244, 238, 0.45);
  line-height: 1.5;
}

.rm-dropdown-divider {
  display: block;
  height: 1px;
  background: rgba(255, 255, 255, 0.07);
  margin: 2px 10px;
}

.rm-dropdown-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 18px 8px;
  margin-top: 4px;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
}

.rm-dropdown-footer-text {
  font-family: Arial, sans-serif;
  font-size: 10px;
  color: rgba(247, 244, 238, 0.25);
  letter-spacing: 0.06em;
}

.rm-dropdown-footer-link {
  font-family: Arial, sans-serif;
  font-size: 11px;
  color: var(--rm-accent);
  text-decoration: none;
  transition: color 0.2s ease;
}

.rm-dropdown-footer-link:hover {
  color: #F7F4EE;
}

/* Burger menu */
.header-burger {
  display: none;
  flex-direction: column;
  gap: 5px;
  cursor: pointer;
  background: none;
  border: none;
  padding: 4px;
}

.burger-bar {
  width: 24px;
  height: 1px;
  transition: background-color 0.3s ease;
}

#header.at-top .burger-bar {
  background-color: var(--rm-text);
}

#header.scrolled .burger-bar {
  background-color: var(--rm-text);
}

/* Mobile menu overlay */
.mobile-menu {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--rm-bg);
  z-index: 999;
  display: flex;
  flex-direction: column;
  padding: 100px 40px 40px;
  gap: 0;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.mobile-menu.is-open {
  opacity: 1;
  visibility: visible;
}

.mobile-menu-close {
  position: absolute;
  top: 24px;
  right: 40px;
  background: none;
  border: none;
  font-size: 28px;
  cursor: pointer;
  color: var(--rm-text);
  line-height: 1;
}

.mobile-nav-item {
  border-bottom: 1px solid var(--rm-bg-card);
}

.mobile-nav-item a,
.mobile-nav-item button {
  display: block;
  width: 100%;
  text-align: left;
  font-family: Georgia, serif;
  font-size: 24px;
  font-weight: 400;
  color: var(--rm-green);
  padding: 20px 0;
  background: none;
  border: none;
  cursor: pointer;
  text-decoration: none;
}

.mobile-nav-sub {
  padding: 0 0 16px 16px;
  display: none;
}

.mobile-nav-sub.is-open {
  display: block;
}

.mobile-nav-sub a {
  display: block;
  font-family: Arial, sans-serif;
  font-size: 15px;
  color: var(--rm-text-muted);
  padding: 8px 0;
  text-decoration: none;
}

@media (max-width: 900px) {
  .header-nav {
    display: none;
  }

  .header-burger {
    display: flex;
  }
}

@media (max-width: 768px) {
  #header .header-inner {
    padding: 0 24px;
    height: 64px;
  }
}