/* =========================
   Header
   ========================= */
header {
  height: var(--header-height);
  background: var(--color-accent);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1em;
  position: relative;
  z-index: 1;
}

header button {
  background: none;
  border: none;
  font-size: 1.5em;
  cursor: pointer;
  padding: 0.25em 0.5em;
  color: var(--color-text);
}

header #toggle-left img.panel-logo {
  height: calc(var(--header-height) / 2) !important;
  width: auto !important;
  object-fit: contain;
}

/* =========================
   Left Panel (Navigation)
   ========================= */

.left-panel {
  position: fixed;
  top: var(--header-height);
  bottom: 0;
  left: 0;
  transform: translateX(0);
  width: var(--panel-width);
  background: var(--color-bg-alt);
  display: flex;
  flex-direction: column;
  z-index: 1;
  overflow: visible;
}

.left-panel.closed { transform: translateX(-100%); }
.transitions .left-panel { transition: transform 0.3s ease; }

.left-panel-header {
  position: absolute;
  top: calc(-1 * var(--header-height));
  left: 0;
  width: 100%;
  height: var(--header-height);
  background: transparent;
  color: var(--color-text);
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  font-weight: bold;
  z-index: 3;
}

.left-panel .left-scroll {
  flex: 1 1 auto;
  overflow-y: auto;
  overscroll-behavior: contain;
  /* no inner padding so links can go edge-to-edge */
}

.left-panel .nav-list {
  list-style: none;
  padding: 0;
  margin: 0;                /* ensure no default margin */
}

/* Single source for link spacing & behavior */
.left-panel .nav-list a {
  display: block;           /* full-width hit area */
  padding: 0.5em 1em;       /* controls both vertical & horizontal spacing */
  color: inherit;
  text-decoration: none;
}

.left-panel .nav-list a:hover,
.left-panel .nav-list a:focus {
  background: var(--color-accent);
  color: var(--color-text);
  border-radius: 0;         /* flush block highlight */
}

/* Remove inter-item gaps completely */
.left-panel .nav-list li + li { margin-top: 0; }

.left-panel footer {
  flex-shrink: 0;
  padding: 0.5em 1em;
  border-top: 1px solid var(--color-text);
  font-size: 0.9em;
  text-align: center;
}


/* =========================
   Right Panel (TOC + Settings)
   ========================= */
.right-panel {
  position: fixed;
  top: var(--header-height);
  bottom: 0;
  right: 0;
  transform: translateX(0);
  width: var(--panel-width);
  background: var(--color-bg-alt);
  display: flex;
  flex-direction: column;
  z-index: 1;
  overflow: visible;
}

.right-panel.closed {
  transform: translateX(100%);
}

.transitions .right-panel {
  transition: transform 0.3s ease;
}

.panel-header {
  position: sticky;
  top: 0;
  left: 0;
  width: 100%;
  height: var(--header-height);
  background: var(--color-bg-alt);
  color: var(--color-text);
  display: flex;
  align-items: center;
  padding: 0 0.5em;
  gap: 0.5em;
  pointer-events: none;
  font-weight: bold;
  z-index: 2;
}

.panel-header .theme-toggle {
  pointer-events: auto;
  background: none;
  border: none;
  font-size: 1.2em;
  cursor: pointer;
  color: var(--color-text);
}

.panel-header .panel-title {
  flex: 1;
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
}

.right-scroll {
  flex: 1 1 auto;
  overflow-y: auto;
  padding-top: 0;
}

.doc-meta {
  flex-shrink: 0;
  padding: 0.5em 1em;
  border-top: 1px solid var(--color-text);
  text-align: left;
  font-size: 0.9em;
  color: var(--color-text-alt);
}

/* Right panel header overlap */
.right-panel .panel-header {
  position: absolute !important;
  top: calc(-1 * var(--header-height)) !important;
  left: 0;
  width: 100%;
  height: var(--header-height);
  background: transparent;
  pointer-events: none;
  z-index: 3;
}

/* =========================
   Main Content Area
   ========================= */
.content-inner {
  max-width: var(--content-max);
  margin: 0 auto;
  width: 100%;
  padding: 0 1em;
}

main {
  position: absolute;
  top: var(--header-height);
  bottom: 0;
  left: var(--panel-width);
  right: var(--panel-width);
  overflow-y: auto;
  background: var(--color-bg);
  padding: 1em;
}

.transitions main {
  transition: left 0.3s ease, right 0.3s ease;
}

body.hide-left main {
  left: 0;
}

body.hide-right main {
  right: 0;
}

/* =========================
   TOC (right panel)
   ========================= */
.right-panel .toc { font-size: 0.9em; }

.right-panel .toc ul {
  list-style: none;
  padding-left: 0;
  margin: 0;
}

.right-panel .toc li { margin: 0; }            /* spacing comes from link padding */
.right-panel .toc li + li { margin-top: 0; }

/* Full-width link rows */
.right-panel .toc a {
  display: block;
  padding: 0.5em 1em;                          /* base spacing */
  color: inherit;                               /* keep normal text color */
  text-decoration: none;
  transition: background 0.15s ease, color 0.15s ease;
}

/* Hover/focus: accent background + text inversion */
.right-panel .toc a:hover,
.right-panel .toc a:focus {
  background: var(--color-accent);
  color: var(--color-text);
  outline: none;
}
.right-panel .toc a:focus {
  box-shadow: 0 0 0 2px var(--color-text) inset; /* visible keyboard focus */
}

/* Level differentiation: indent only; H3 italic */
.right-panel .toc li.h2 a { padding-left: 1.5em; }
.right-panel .toc li.h3 a { padding-left: 2.5em; font-style: italic; }

/* H1 divider */
.right-panel .toc li.h1 {
  font-size: 1.2em;
  font-weight: 700;
  border-bottom: 1px solid var(--color-accent);
  padding-bottom: 0.25em;
}



/* =========================
   Social Links in Footer
   ========================= */
.social-links {
  list-style: none;
  display: flex;
  gap: 0.5em;
  padding-left: 0;
justify-content: center;
}

/* Slightly larger hit area + smoother transitions */
.social-links a {
  font-size: 1.2em;
  color: var(--color-accent);
  border-radius: 999px;             /* perfect pill */
  padding: 0.25em;                  /* comfy tap target */
  line-height: 1;                   /* center icons nicely */
  transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

/* Keep hover style; switch to focus-visible for keyboards; avoid layout shift */
.social-links a:hover,
.social-links a:focus-visible {
  background: var(--color-accent);
  color: var(--color-text);
  box-shadow: 0 0 0 4px var(--color-accent);   /* replaces outline to prevent reflow */
}



.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* =========================
   Nested List Styling
   ========================= */
nav ol, nav ul,
aside ol, aside ul {
  list-style: none;
  padding-left: 1em;
}

nav li, aside li {
  /*! padding: 0.25em 0; */
}

nav li > ol, nav li > ul,
aside li > ol, aside li > ul {
  margin-left: 1em;
}

/* =========================
   Mobile-Specific Overrides
   ========================= */
@media (max-width: 768px) {
  :root {
    --panel-width: 100vw;
  }

  .left-panel,
  .right-panel {
    width: 100vw;
  }

  main {
    left: 0 !important;
    right: 0 !important;
  }

  body:not(.hide-left) header h1,
  body:not(.hide-right) header h1 {
    display: none;
  }

  body:not(.hide-left) #toggle-right {
    display: none;
  }

  body:not(.hide-right) #toggle-left {
    display: none;
  }

  body:not(.hide-right) header {
    justify-content: flex-end;
  }

  body:not(.hide-left) header {
    justify-content: flex-start;
  }
}


