/* ==== Mobile Sidebar: look & feel ==== */
.sidebar__area {
  position: fixed;
  inset: 0 0 0 auto;
  width: min(88vw, 360px);
  background: linear-gradient(180deg, #0f0f10 0%, #0b0b0c 100%);
  color: #fff;
  transform: translate3d(100%, 0, 0);
  transition: transform 0.28s ease;
  z-index: 9999 !important;
  border-left: 1px solid rgba(255, 255, 255, 0.06);
  box-shadow: -12px 0 28px rgba(0, 0, 0, 0.35);
}

.sidebar__area.is-open {
  transform: translate3d(0, 0, 0) !important;
}

/* Wrapper spacing (respects notched phones) */
.sidebar__wrapper {
  height: 100%;
  overflow-y: auto;
  padding: clamp(20px, 4vw, 28px) max(16px, env(safe-area-inset-right));
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Close button: larger target + subtle hover */
.sidebar__close {
  display: flex;
  justify-content: flex-end;
}
.sidebar__close-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 999px;
  font-size: 20px;
  color: #f5f7fa;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
  transition:
    transform 0.15s ease,
    background 0.15s ease,
    border-color 0.15s ease;
}
.sidebar__close-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.18);
  transform: scale(1.03);
}

/* Content spacing */
.sidebar__content {
  margin-top: 6px;
}

/* Body overlay: smooth fade */
.body-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  opacity: 0;
  visibility: hidden;
  transition:
    opacity 0.2s ease,
    visibility 0.2s ease;
  z-index: 9998 !important;
}
.body-overlay.is-active {
  opacity: 1;
  visibility: visible;
}

/* Mobile menu: vertical list with strong contrast */
.mobile-menu ul {
  list-style: none;
  margin: 0;
  padding: 0;
}
.mobile-menu li + li {
  margin-top: 6px;
}
.mobile-menu a {
  display: block;
  padding: 14px 14px;
  border-radius: 12px;
  text-decoration: none;
  color: #f3f4f6; /* strong contrast on dark */
  font-weight: 600;
  letter-spacing: 0.2px;
  line-height: 1.2;
  background: transparent;
  border: 1px solid transparent;
  transition:
    background 0.15s ease,
    border-color 0.15s ease,
    transform 0.06s ease;
}
.mobile-menu a:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.12);
}
.mobile-menu a:active {
  transform: translateY(1px);
}

/* Focus visibility for keyboard users */
.mobile-menu a:focus-visible,
.sidebar__close-btn:focus-visible {
  outline: 2px solid #ffffff;
  outline-offset: 2px;
}

/* Optional: indicate current page if you add .is-active on <a> */
.mobile-menu a.is-active {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.22);
}

/* Scrollbar (subtle) */
.sidebar__wrapper {
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.25) transparent;
}
.sidebar__wrapper::-webkit-scrollbar {
  width: 10px;
}
.sidebar__wrapper::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.22);
  border-radius: 999px;
}
.sidebar__wrapper::-webkit-scrollbar-track {
  background: transparent;
}

/* Prefer reduced motion */
@media (prefers-reduced-motion: reduce) {
  .sidebar__area {
    transition: none;
  }
  .body-overlay {
    transition: none;
  }
}

/* Header visibility rules (unchanged behaviour, tightened) */
@media (min-width: 1024px) {
  .main-header .main-menu {
    display: block;
  }
  .side-menu-icon {
    display: none !important;
  }
}
@media (max-width: 1023.98px) {
  .main-header .main-menu {
    display: none !important;
  }
  .side-menu-icon {
    display: block;
  }
}

/* Footer big heading remains */
.footer-top h2 {
  font-size: clamp(36px, 10vw, 120px);
  line-height: 1.05;
  word-wrap: break-word;
  padding: clamp(12px, 4vw, 20px);
  text-align: center;
}

/* Footer grid on small */
@media (max-width: 639.98px) {
  .main-footer .grid {
    row-gap: 10px;
  }
  .copy-left-text,
  .copy-right-text {
    text-align: center;
  }
}
/* --- FORCE the sidebar to show and slide in --- */
.sidebar__area {
  display: block !important; /* some themes set display:none */
  position: fixed !important;
  right: 0 !important;
  left: auto !important;
  width: min(88vw, 360px) !important;
  transform: translate3d(100%, 0, 0) !important; /* start off-canvas */
  z-index: 9999 !important;
}

.sidebar__area.is-open {
  transform: translate3d(0, 0, 0) !important; /* slide in */
  visibility: visible !important;
  pointer-events: auto !important;
}

/* overlay above page, below sidebar */
.body-overlay {
  z-index: 9998 !important;
}

/* make sure we can actually see the menu contents */
.mobile-menu {
  min-height: 1px; /* avoid collapse if empty during clone timing */
}
.mobile-menu a {
  color: #fff !important; /* strong contrast on dark bg */
  text-decoration: none;
}

/* optional: if some stylesheet still hides it via opacity */
.sidebar__area {
  opacity: 1 !important;
}
/* ===== Responsive refinements for sliding sidebar ===== */

/* 1) Flexible panel width across breakpoints */
.sidebar__area {
  /* default for very small phones */
  width: min(92vw, 340px) !important;
}

/* ≥360px (most phones) */
@media (min-width: 360px) {
  .sidebar__area {
    width: min(90vw, 360px) !important;
  }
}

/* ≥480px (large phones / small phablets) */
@media (min-width: 480px) {
  .sidebar__area {
    width: min(88vw, 380px) !important;
  }
}

/* ≥640px (small tablets / landscape phones) */
@media (min-width: 640px) {
  .sidebar__area {
    width: min(84vw, 420px) !important;
  }
}

/* ≥768px (tablets) */
@media (min-width: 768px) {
  .sidebar__area {
    width: min(80vw, 460px) !important;
  }
}

/* ≥1024px (desktop; still keep it usable if opened) */
@media (min-width: 1024px) {
  .sidebar__area {
    width: min(72vw, 520px) !important;
  }
}

/* ≥1280px (large desktop) */
@media (min-width: 1280px) {
  .sidebar__area {
    width: min(60vw, 560px) !important;
  }
}

/* 2) Safe-area & max-height so nothing gets clipped */
.sidebar__wrapper {
  padding-right: max(16px, env(safe-area-inset-right));
  padding-left: max(8px, env(safe-area-inset-left));
  padding-top: max(20px, env(safe-area-inset-top));
  padding-bottom: max(20px, env(safe-area-inset-bottom));
  max-height: calc(
    100dvh - env(safe-area-inset-top) - env(safe-area-inset-bottom)
  );
}

/* 3) Typography & touch targets scale with screen size */
.mobile-menu a {
  font-size: clamp(14px, 1.6vw, 18px);
  padding: clamp(12px, 1.8vw, 16px) clamp(12px, 2vw, 18px);
  border-radius: clamp(10px, 1.6vw, 14px);
}

/* 4) Compact layout for short viewports (landscape phones, split-screen) */
@media (max-height: 540px) {
  .sidebar__wrapper {
    gap: 10px;
  }
  .sidebar__close-btn {
    width: 38px;
    height: 38px;
  }
  .mobile-menu a {
    padding: 10px 12px;
  }
}

/* 5) Extra-compact for very short heights */
@media (max-height: 420px) {
  .sidebar__wrapper {
    gap: 8px;
  }
  .mobile-menu a {
    padding: 8px 10px;
  }
}

/* 6) Improve overlay feel on big screens without overpowering small ones */
.body-overlay.is-active {
  background: rgba(0, 0, 0, 0.48);
}
@media (min-width: 1024px) {
  .body-overlay.is-active {
    background: rgba(0, 0, 0, 0.56);
  }
}

/* 7) Prevent accidental horizontal scroll on narrow pages */
html,
body {
  overflow-x: hidden;
}

/* 8) If any 3rd-party CSS forces the panel wider, keep it within viewport */
@media (max-width: 359.98px) {
  .sidebar__area {
    width: 94vw !important;
  }
}

/* 9) High-contrast & reduced-motion users are already covered by your base rules,
   but ensure transitions never block interaction on slow devices */
@media (prefers-reduced-motion: reduce) {
  .sidebar__area {
    transition: none !important;
  }
  .body-overlay {
    transition: none !important;
  }
}
