/* ========== Global ========== */
* { 
  box-sizing: border-box; 
}

body {
  margin: 0;
  font-family: 'Raleway', sans-serif;
  background: #f4f4f4;
  color: #333;
}

/* ========== Fixed header ========== */
header {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 999;                   /* keep header above mobile drawer */
  background: transparent;
  padding: 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between; /* site-name left, menu right */
  transition: background 0.3s ease;
}

header.scrolled {
  background: #f27c22;
}

/* Left title/logo */
.site-name {
  display: flex;
  align-items: center;
  font-weight: 800;
  color: #000;
  font-size: 1.2rem;
}

.site-name img {
  height: 32px;
  margin-right: 0.5rem;
}

/* Menu toggle button (mobile only) */
.menu-toggle {
  display: none;
  font-size: 1.6rem;
  background: none;
  border: none;
  color: black;
  cursor: pointer;
  line-height: 1;
  padding: .25rem .5rem;
  z-index: 1000; /* above drawer just in case */
}

/* ========== Desktop nav ========== */
nav.menu {
  display: flex;
  gap: 1rem;
  margin-left: auto;         /* push to the right edge */
  align-items: center;       /* align links and avatar vertically */
}

nav.menu a {
  text-decoration: none;
  color: #000;
  position: relative;
  padding-bottom: 0.35rem;   /* room for underline without moving text */
}

nav.menu .dropdown-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

nav.menu .submenu {
  display: none;
  position: absolute;
  background: #fff;
  padding: 0.5rem 1rem;
  top: 100%;
  left: 0;
  border-radius: 0 0 6px 6px;
  box-shadow: 0 2px 5px rgba(0,0,0,0.15);
  min-width: 160px;
}

nav.menu .dropdown-wrapper:hover > .submenu {
  display: block;
}

nav.menu .submenu a {
  display: block;
  color: #000;
  padding: 0.25rem 0;
}

nav.menu a.active::after {
  content: "";
  display: block;
  height: 3px;
  background: #f27c22;
  margin-top: 0.25rem;
  width: 100%;
}

/* ========== Mobile drawer ========== */
.mobile-menu {
  position: fixed;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: #f27c22;
  color: black;
  display: flex;
  flex-direction: column;
  padding: 5rem 2rem 2rem; /* space for header, then content */
  gap: 0.25rem;
  transition: left 0.3s ease;
  z-index: 998; /* under the fixed header */
}

.mobile-menu.active {
  left: 0;
}

/* Mobile drawer header row (logo + close X) */
.mobile-menu-header {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .75rem 1rem;
}

.mobile-menu .site-name {
  font-weight: 800;
  font-size: 1.1rem;
  display: flex;
  align-items: center;
}

.mobile-menu .site-name img {
  height: 28px;
  margin-right: 0.5rem;
}

.menu-close {
  background: transparent;
  border: none;
  font-size: 1.6rem;
  line-height: 1;
  color: black;
  cursor: pointer;
}

/* Mobile links spacing */
.mobile-menu a,
.mobile-menu .has-submenu > a {
  display: block;
  padding: 0.75rem 0;
  color: black;
  text-decoration: none;
  font-size: 1.1rem;
}

/* Mobile submenus (accordion) */
.mobile-menu .submenu {
  display: none;
  flex-direction: column;
  gap: 0.5rem;
  margin: 0 0 0.5rem 1rem; /* indent items a bit */
}

.mobile-menu .has-submenu.open .submenu {
  display: flex;
}

/* ======= Responsive ======= */
@media (max-width: 768px) {
  nav.menu { display: none; }
  .menu-toggle { display: block; }
}

/* When header is scrolled */
header.scrolled .site-name,
header.scrolled .site-name span,
header.scrolled nav.menu a {
  color: #000;
}

header.scrolled nav.menu a.active::after {
  background: #000;
}

/* When mobile menu is open */
.mobile-menu.active a {
  color: #000;
}

.mobile-menu.active a.active::after {
  background: #000;
}

/* ===== Reader Login (header avatar) ===== */

.login-container {
  position: relative;
  margin-left: auto;
  margin-right: 0.5rem;
  display: flex;
  align-items: center;
}

@media (max-width: 700px) {
  .login-container {
    margin-right: 0.25rem;
  }
}

/* Bold if you ever show it as text link in menus */
nav.menu a.login-link,
#mobileMenu a.login-link {
  font-weight: 800;
}

/* Desktop avatar slot */
#loginStatus {
  display: flex;
  align-items: center;
  padding: 0;
  margin-left: 0.75rem; /* small gap after last link */
  cursor: pointer;
}

/* Remove underline bar from avatar item */
#loginStatus::after {
  content: none;
}

/* Wrapper for cropped circle */
.login-avatar-wrap {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
}

/* Avatar image (slight 105% zoom for cleaner edge) */
.login-avatar {
  width: 105%;
  height: 105%;
  object-fit: cover;
  display: block;
  border: none;
  box-shadow: none;
  transform: translate(-2.5%, -2.5%);
}

/* Subtle hover pop */
.login-avatar:hover {
  transform: translate(-2.5%, -2.5%) scale(1.03);
  transition: 0.15s ease;
}

/* Mobile "Signed in as X" text */
#loginStatusMobile {
  font-weight: 800;
  margin-top: 1.5rem;
  cursor: pointer;
  color: #000;
}

#loginStatusMobile .login-avatar-wrap {
  width: 48px;
  height: 48px;
}

/* Ensure underline color is orange in all cases */
nav.menu a.active::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 3px;
  background: #f27c22;
}

/* Scrolled dropdown colors (Option B-style) */
header.scrolled nav.menu .submenu {
  background: #f27c22;
}
header.scrolled nav.menu .submenu a {
  color: #fff;
}
