/* Basic reset */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* Header Styles */
.site-header {
  position: sticky;
  top: 0;
  width: 100%;
  background-color: var(--chrome-bg);
  color: var(--chrome-fg);
  padding: 10px 20px;
  z-index: 1000;
  box-shadow: 0 2px 5px var(--shadow-md);
  overflow-x: clip;
}

.navbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.navbar-brand .logo {
  color: var(--chrome-fg);
  font-size: 1.5em;
  text-decoration: none;
  font-weight: bold;
}

.navbar-nav {
  list-style: none;
  display: flex;
}

.navbar-nav li {
  margin-left: 20px;
}

.navbar-nav .icon {
  margin-right: 8px;
  font-size: 1.2em;
  vertical-align: middle;
}

.navbar-nav li a {
  color: var(--chrome-fg);
  text-decoration: none;
  font-size: 1em;
  padding: 8px 16px;
  transition: background-color 0.3s ease;
}

.navbar-nav li a:hover {
  background-color: var(--chrome-hover);
  border-radius: 5px;
}

/* "New" badge pill (nav + hamburger) */
.nav-badge {
  display: inline-block;
  background: var(--badge-bg);
  color: var(--surface);  /* light text: on hot-pink (default) or cranberry (warm) */
  font-size: 0.65em;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 8px;
  vertical-align: middle;
  margin-left: 4px;
  line-height: 1.4;
}

/* Premium nav link accent */
.nav-premium {
  color: #ffe0b2 !important;
}

/* Warm: pale gold vanishes on the paper header — point Premium at the plum
   premium mark (legible + on-brand). Default keeps its gold-on-green pop. */
:root[data-theme="warm"] .nav-premium {
  color: var(--premium) !important;
}

/* Hamburger button — hidden by default, shown on mobile when in editor */
.hamburger-btn {
  display: none;
  background: none;
  border: none;
  color: var(--chrome-fg);
  font-size: 1.4em;
  cursor: pointer;
  padding: 6px 8px;
  border-radius: 4px;
  transition: background-color 0.2s;
}

.hamburger-btn:hover {
  background-color: var(--chrome-hover);
}

/* Hamburger slide-down menu panel — overlays the canvas */
.hamburger-menu {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background-color: var(--chrome-menu-bg);
  padding: 12px 20px;
  z-index: 1001;
  box-shadow: 0 4px 8px var(--shadow-md);
}

.hamburger-menu.open {
  display: flex;
  gap: 24px;
}

.hamburger-menu-section h4 {
  color: var(--chrome-fg);
  opacity: 0.7;  /* default: == rgba(255,255,255,.7) on green; warm: muted ink on paper */
  font-size: 0.75em;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 6px;
}

.hamburger-menu-section a {
  display: block;
  color: var(--chrome-fg);
  text-decoration: none;
  padding: 6px 8px;
  margin: 0 -8px;
  border-radius: 5px;
  font-size: 0.95em;
  transition: background-color 0.2s;
}

/* Proper highlight hover (was an opacity fade that read as "nothing" on paper). */
.hamburger-menu-section a:hover {
  background-color: var(--chrome-hover);
}

.hamburger-menu-section a i {
  width: 20px;
  margin-right: 8px;
  text-align: center;
}

/* Editor action buttons in the header */
.header-buttons {
  display: flex;
  gap: 10px;
  align-items: center;
}

.header-button {
  background-color: var(--surface);
  color: var(--chrome-icon);
  border: none;
  padding: 8px 10px;
  border-radius: 5px;
  font-size: 1.1rem;
  cursor: pointer;
  transition: background-color 0.3s ease;
}

.header-button:hover {
  background-color: var(--line-2);
}

.header-button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.header-button i {
  font-size: 1.2rem;
}

.header-button--pending {
  animation: pending-pulse 1.5s ease-in-out infinite;
}

@keyframes pending-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.header-avatar {
  width: 38px;
  height: 38px;
  border-radius: 8px;
  cursor: pointer;
}

/* Editor mode: hide non-pinned nav links, show hamburger for the rest.
   Action buttons are the priority in editor mode. */
.site-header.editor .navbar-nav li:not(.nav-item--pinned) {
  display: none;
}

.site-header.editor .hamburger-btn {
  display: block;
}

/* Mobile Responsive Styles */
@media (max-width: 768px) {
  .navbar-brand .logo {
    font-size: 1.15em;
  }

  /* On mobile, only show pinned nav items; the rest live in the hamburger */
  .navbar-nav li:not(.nav-item--pinned) {
    display: none;
  }

  /* In the editor on mobile, hide all nav — action buttons need the space */
  .site-header.editor .navbar-nav {
    display: none;
  }

  /* Show hamburger button */
  .hamburger-btn {
    display: block;
  }

  /* Hide secondary editor buttons on mobile (they're in the hamburger) */
  .header-button--secondary,
  .print-button {
    display: none;
  }

  .header-buttons {
    gap: 8px;
  }

  .header-button {
    padding: 7px 8px;
    font-size: 1rem;
  }

  .header-button i {
    font-size: 1.1rem;
  }

  .header-avatar {
    width: 34px;
    height: 34px;
  }

  .hamburger-menu.open {
    flex-direction: column;
    gap: 12px;
  }
}

/* Desktop: hide hamburger, show nav (content pages only) */
@media (min-width: 769px) {
  .hamburger-btn {
    display: none;
  }

  .site-header:not(.editor) .hamburger-menu {
    display: none !important;
  }
}

/* Theme toggle — segmented control in the hamburger "Appearance" section.
   Track + inactive labels use chrome-fg (white on the green panel / ink on the
   warm paper panel); the ACTIVE segment is a raised surface pill with brand
   text (green = the affirmative/selected choice) so it reads on either panel. */
.theme-toggle {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--chrome-fg) 16%, transparent);
}
.theme-toggle__btn {
  border: none;
  background: transparent;
  color: var(--chrome-fg);
  font: inherit;
  font-size: 0.9em;
  line-height: 1.2;
  padding: 4px 14px;
  border-radius: 999px;
  cursor: pointer;
  opacity: 0.72;
  transition: background-color 0.15s ease, color 0.15s ease, opacity 0.15s ease;
}
.theme-toggle__btn:hover { opacity: 1; }
.theme-toggle__btn.is-active {
  background: var(--surface);
  color: var(--brand);
  font-weight: 600;
  opacity: 1;
}
