/* Compact responsive header for mobile — hamburger menu, centered logo, search icon */

:root {
  --compact-header-height: 5rem;
}

.compact-page-header {
  border-bottom: 1px solid #d8d0be;
  box-sizing: border-box;
  height: var(--compact-header-height);
  padding: 0 !important;
}

.compact-header-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
  color: #1c1b18;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.15s ease;
  width: 2.5rem;
  height: 2.5rem;
}

.compact-header-btn:hover {
  opacity: 0.6;
}

.compact-header-btn svg {
  display: block;
}

.compact-header-btn svg.hidden {
  display: none;
}

/* Sidebar overlay — dims background, slides in from left */
.sidebar-overlay {
  position: fixed;
  inset: 0;
  background: rgba(28, 27, 24, 0.5);
  z-index: 40;
  display: flex;
  align-items: flex-start;
}

.sidebar-overlay.hidden {
  display: none;
}

.sidebar-content {
  width: 70vw;
  max-width: 280px;
  height: 100vh;
  height: 100dvh;
  background: #f2ede1;
  overflow-y: auto;
  padding: 0;
  position: relative;
  animation: slideIn 0.3s ease;
  display: flex;
  flex-direction: column;
}

@keyframes slideIn {
  from {
    transform: translateX(-100%);
  }
  to {
    transform: translateX(0);
  }
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  box-sizing: border-box;
  height: var(--compact-header-height);
  min-height: 0;
  padding-top: 0;
  padding-bottom: 0;
  padding-left: 1rem;
  padding-right: 1rem;
  border-bottom: 1px solid #d8d0be;
}

.sidebar-header h2 {
  font-size: 1.25rem;
  line-height: 1.2;
  margin: 0;
  flex: 1;
}

.sidebar-header a {
  color: inherit;
  text-decoration: none;
}

.sidebar-header a:hover {
  color: #c1272d;
}

.sidebar-close-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: #1c1b18;
  padding: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.15s ease;
  flex-shrink: 0;
}

.sidebar-close-btn:hover {
  opacity: 0.6;
}

.sidebar-close-btn svg {
  display: block;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  padding: 1rem;
  flex: 1;
}

.sidebar-footer {
  padding: 1rem;
  border-top: 1px solid #d8d0be;
  /* text-align: center; */
}

.sidebar-nav-item {
  display: block;
  font-family: "Inter", sans-serif;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #1c1b18;
  text-decoration: none;
  padding: 0.75rem 0;
  transition: color 0.15s ease;
}

.sidebar-nav-item:hover {
  color: #c1272d;
}

.sidebar-nav-item.is-active {
  color: #c1272d;
  /* font-weight: 600; */
}

/* Search overlay — drops down from directly below the compact header,
   anchored to it (the header is `relative`, this is `absolute`), over content */
.search-overlay {
  position: absolute;
  top: 101%;
  left: 0;
  right: 0;
  background: #f2ede1;
  border-bottom: 1px solid #d8d0be;
  padding: 1rem;
  z-index: 30;
  /* animation: slideDown 0.2s ease; */
}

.search-overlay.hidden {
  display: none;
}

@keyframes slideDown {
  from {
    transform: translateY(-100%);
  }
  to {
    transform: translateY(0);
  }
}

.search-overlay-form {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.search-overlay-form input {
  flex: 1;
  border: 1px solid #d8d0be;
  background: #f8f3e8;
  color: #1c1b18;
  padding: 0 0.65rem;
  min-height: 2.2rem;
  font-family: "Inter", sans-serif;
  font-size: 0.8rem;
  letter-spacing: 0.03em;
  outline: none;
}

.search-overlay-form input:focus-visible {
  border-color: #1c1b18;
}

.search-overlay-btn {
  background: none;
  border: 1px solid #d8d0be;
  cursor: pointer;
  color: #1c1b18;
  padding: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 2.2rem;
  min-width: 2.2rem;
  transition: all 0.15s ease;
}

.search-overlay-btn:hover {
  border-color: #1c1b18;
  background: #f8f3e8;
}

.search-overlay-btn svg {
  display: block;
}

/* Scroll lock when overlays are open */
body.compact-overlay-open {
  overflow: hidden;
}

/* Keep the same 2rem breathing room below the header on every page type. */
@media (max-width: 639px) {
  main > article,
  main > section,
  main > div {
    padding-top: 2rem !important;
  }

  main > article[id="article-view"] {
    padding-top: 2rem !important;
  }

  #search-grid {
    padding-top: 0 !important;
  }
}
