/* =========================
   Global Styles
========================= */
body {
  font-family: "Poppins", Arial, sans-serif; /* standard arial font */
  background-color: #1E1E1E;
  color: #efdecd;
  margin: 10px auto 220px;
  padding-top: 60px;
  box-sizing: border-box;
  max-width: 1000px;
  transition: margin-left 0.3s ease;
}

/* Prevent text selection while dragging the scrollbar thumb */
.no-select {
  user-select: none !important;
  -webkit-user-select: none !important;
  -ms-user-select: none !important;
}

h1, h2, h3 {
  font-family: "Poppins", Arial, sans-serif;
  color: #FFF000;
  margin-top: 1.5em;
  margin-bottom: 0.5em;
  line-height: 1.2;
}

p, li, figcaption {
  font-size: clamp(1rem, 1.2vw, 1.3rem);
  line-height: 1.6;
}

h1 { font-size: 2rem; }
h2 { font-size: 1.6rem; }
h3 { font-size: 1.3rem; }

/* =========================
   Global Text Visibility
========================= */
p, h1, h2, h3, li {
  text-shadow: 1px 1px 2px rgba(0,0,0,0.7);
}

/* =========================
   Navigation Bar
========================= */
.nav {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw; /* always stretch across window */
  z-index: 9999; 
  background: rgba(34, 34, 34, 0); /*transparent bg*/ /*transparent bg*/
  padding: 10px 20px;
  display: flex;
  justify-content: center;
  backdrop-filter: blur(6px);
  transition: top 0.3s ease, background-color 0.3s ease;
}

.nav.scrolled {
   background-color: rgba(34, 34, 34, 0.95);
}

.nav ul {
  display: flex;
  flex-wrap: nowrap;
  justify-content: center;
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav li {
  margin: 0 6px;
}

.nav a {
  text-decoration: none;
  color: #efdecd;
  font-weight: bold;
  padding: 6px 10px;
  border-radius: 5px;
  font-size: clamp(0.7rem, 1.5vw, 1rem);
  transition: background-color 0.3s, color 0.3s; 
}

.nav.scrolled a {
  color: #fff;
}

.nav a:hover {
  color: #FFF000;
}

/* =========================
   Nav Links
========================= */
#nav-links {
  display: none;
}

#nav-links.show {
  display: flex;
}

/* =========================
   Images and Figures
========================= */
img {
  max-width: 80%;
  height: auto;
  display: block;
  margin: 10px auto;
  border-radius: 5px;
}

figure {
  margin: 20px 0;
  text-align: center;
}

figcaption {
  font-style: italic;
  font-size: 0.9rem;
  color: #ffbf00;
  margin-top: 5px;
}

/* =========================
   Responsive Typography
========================= */
@media (max-width: 768px) {
  h1 { font-size: 1.8rem; }
  h2 { font-size: 1.5rem; }
  h3 { font-size: 1.2rem; }
  p, li, figcaption { font-size: 0.95rem; }
}

/* =========================
Optional: small screens nav stacking
========================= */
@media (max-width: 500px) {
  body {
   padding-top: 60px;
  }
  .nav ul li a {
    padding: 6px 8px; /* smaller padding for tiny screens */
  }
}
@media (min-width: 768px) {
  #nav-links {
    display: flex;
  }
}

/* =========================
   Custom overlay scrollbar (draggable)
========================= */
.custom-scrollbar {
  position: fixed;
  right: 8px;
  top: 0;
  height: 100vh;
  width: 12px;
  z-index: 99999;
  opacity: 0;
  transition: opacity 0.45s ease;
  pointer-events: none;
}

.custom-scrollbar.visible {
  opacity: 1;
  pointer-events: auto;
}

.custom-scrollbar-thumb {
  position: absolute;
  right: 0;
  width: 8px;
  border-radius: 6px;
  background: linear-gradient(to bottom,
    #ff0000 0%, 
    #ff8800 5%,
    #ffff00 15%,
    #00ff00 30%
  );
  border: 1px solid #222;
  box-shadow: inset 0 0 6px rgba(255,0,0,0.5);
  transition: transform 0.06s linear, height 0.06s linear;
  pointer-events: auto;
  touch-action: none;
}

.custom-scrollbar-thumb:hover {
  filter: brightness(1.08);
}

/* SCROLLBAR FALLBACKS */
body::-webkit-scrollbar {
  width: 0;
  background: transparent;
}

html {
  scrollbar-width: none;
  -ms-overflow-style: none;
}

/* =========================
   Sidebar Base
   NOTE: z-index increased so sidebar (and hamburger) sit above the navbar
========================= */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: 220px;
  height: 100vh;
  background: rgba(34,34,34,0.0);
  padding: 10px 10px;
  box-sizing: border-box;
  overflow-y: auto;
  transition: width 0.3s ease;
  z-index: 10001; /* raised above .nav (9999) so toggle is clickable */
}
/* =========================
   Collapse Button
   Ensure the toggle element itself has a stacking context above the nav
========================= */
.sidebar-toggle {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background: rgba(255, 240, 0, 0.1);
  border: 2px solid #FFF000;
  padding: 10px 12px;
  cursor: pointer;
  font-size: 1.5rem;
  color: #FFF000;
  border-radius: 6px;
  transition: background-color 0.3s, transform 0.2s;
  position: relative;
  z-index: 10002;
}

.sidebar-toggle:hover {
  background: rgba(255, 240, 0, 0.2);
  transform: scale(1.05);
}

/* Keep keyboard focus visible */
.sidebar-toggle:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(0,123,255,0.25);
  border-radius: 4px;
}
/* =========================
   Accordion Sections
========================= */
.accordion {
  list-style: none;
  padding: 0;
  margin-top: 20px;
}

.accordion-header {
  width: 100%;
  background: none;
  color: #FFF000;
  border: none;
  text-align: left;
  padding: 10px 5px;
  font-size: 1rem;
  font-weight: bold;
  cursor: pointer;
  transition: color 0.3s;
}

.accordion-header:hover {
  color: #ffd700;
}

.accordion-content {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease; 
}

.accordion-content.open {
  max-height: 500px;
}

.accordion-content li a {
  display: block;
  color: #efdecd;
  padding: 8px 5px;
  border-radius: 4px;
  text-decoration: none;
}

.accordion-content li a:hover {
  background: rgba(255,255,0,0.2);
  color: #FFF000;
}

/* =========================
   Sidebar Collapsed
========================= */
.sidebar.collapsed {
  width: 60px;
}

.sidebar.collapsed .accordion-header {
  display: none;
}

.sidebar.collapsed .accordion-content {
  display: none !important;
}

body.sidebar-collapsed main {
  margin-left: 60px;
}

main {
  /* default: do not force a left margin so content can be centered */
  transition: margin-left 0.3s ease;
}

/* =========================
   Main Container Centering
========================= */
main.container {
  max-width: 1000px; /* limits width for readability */
  margin: 0 auto;    /* centers horizontally */
  padding: 20px;     /* optional spacing */
  transition: margin-left 0.3s ease; /* adjusts with sidebar collapse */
}

body.sidebar-collapsed main.container {
  margin-left: auto; /* remove extra margin when sidebar is collapsed */
}
