/* ============================================
   Google Fonts Import
   ============================================ */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

/* ============================================
   CSS Variables
   ============================================ */
:root {
  --background-color: #f9f6f0;
  --sidebar-bg: #f9f6f0;
  --wine-dark: #3d2645;
  --accent-purple: #b893c7;
  --link-color: var(--accent-purple);
  --quote-color: #888;
  --text-color: #333;
  --sidebar-width: 260px;
  --topbar-height: 40px;
  --arrow-bg: var(--sidebar-bg);
  --arrow-color: var(--wine-dark);
  --border-color: var(--wine-dark);
}

/* ============================================
   Base Styles
   ============================================ */
body {
  background-color: var(--background-color);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 16px;
  line-height: 1.6;
  padding: 0;
  margin: 0;
  overflow-x: hidden;
}

.content {
  margin: 2rem 0 0 2rem;
  margin-left: var(--sidebar-width);
  margin-top: var(--topbar-height);
  min-height: calc(100vh - var(--topbar-height) - 14rem);
  transition: margin-left 0.3s ease;
}

[role="doc-endnotes"] {
  margin-left: var(--sidebar-width);
  padding: 0 3rem;
  max-width: 1400px;
}

h3 {
  margin-bottom: 0;
}

ul, ol {
  padding: 0;
  margin: 0 1em;
}

a {
  color: var(--link-color);
  text-decoration: underline;
  text-decoration-color: transparent;
  text-decoration-thickness: 1px;
  transition: text-decoration-color 0.3s ease;
}

a:hover {
  text-decoration-color: var(--link-color);
}

video {
  max-width: 100%;
}

blockquote {
  position: relative;
  width: 100%;
  padding: 1rem 1rem 1rem 2rem;
  margin: 1.5rem 0;
  font-size: 1.1rem;
  background: #fff;
  color: var(--text-color);
  border-left: 2px solid var(--quote-color);
}

blockquote::before {
  content: "\201C";
  position: absolute;
  top: .2rem;
  left: .3rem;
  font-size: 2rem;
  color: var(--quote-color);
  line-height: 1;
}

section[role="doc-endnotes"] ol li a[role="doc-backlink"] {
  padding-right: 0.2em;
}

/* ============================================
   Code Blocks
   ============================================ */
pre {
  max-width: 100%;
  overflow-x: auto;
  margin: 1em 0;
}

code {
  word-wrap: break-word;
  overflow-wrap: break-word;
}

pre code {
  display: block;
  white-space: pre-wrap;
  background-color: #fff;
  border: 1px solid var(--wine-dark);
  padding: 1rem;
  border-radius: 4px;
  word-break: break-word;
}

@media (max-width: 768px) {
  pre {
    overflow-x: visible;
  }

  pre code {
    white-space: pre-wrap;
    word-break: break-all;
  }
}

/* ============================================
   Sidebar Backdrop
   ============================================ */
.sidebar-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.sidebar-backdrop.visible {
  opacity: 1;
  pointer-events: auto;
}

/* ============================================
   Topbar
   ============================================ */
.topbar {
  position: fixed;
  top: 0;
  left: calc(var(--sidebar-width));
  right: 0;
  height: var(--topbar-height);
  background-color: var(--sidebar-bg);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 98;
  transition: left 0.3s ease;
}

.sidebar-toggle {
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  position: absolute;
  left: 15px;
  display: none;
  transition: left 0.3s ease;
}

.hamburger {
  display: block;
  width: 20px;
  height: 2px;
  background-color: var(--text-color);
  position: relative;
  transition: background-color 0.3s ease;
}

.hamburger::before,
.hamburger::after {
  content: '';
  position: absolute;
  width: 20px;
  height: 2px;
  background-color: var(--text-color);
  left: 0;
  transition: transform 0.3s ease, top 0.3s ease;
}

.hamburger::before {
  top: -6px;
}

.hamburger::after {
  top: 6px;
}

.topbar-title {
  font-weight: 500;
  font-size: 16px;
  color: var(--text-color);
  display: flex;
  align-items: center;
  justify-content: center;
}

.topbar-title img {
  height: 24px;
  width: auto;
  display: block;
  object-fit: contain;
}

/* ============================================
   Sidebar Navigation
   ============================================ */
nav.sidebar {
  width: var(--sidebar-width);
  background-color: var(--sidebar-bg);
  border-right: 1px solid var(--border-color);
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  overflow-y: auto;
  /* padding: 20px; */
  z-index: 99;
  transition: transform 0.3s ease;
}

.banner {
  height: 40px;
  /* border-bottom: 1px solid var(--border-color); */
  /* overflow: hidden; */
}

.banner a {
  display: flex;
  flex-direction: row;
  margin: 0 1em;
  height: 100%;
}

.banner img {
  padding-top: 8px;
  height: 50%;
  width: auto;
  display: block;
  object-fit: contain;
  object-position: left center;
  border-radius: 0;
}

.sidebar-nav {
  list-style: none;
  padding: 0;
  margin: 0;
}

.sidebar-nav li {
  margin-bottom: 8px;
}

.sidebar-nav a {
  display: block;
  padding: 8px 12px;
  color: #555;
  text-decoration: none;
  /* border-radius: 4px; */
  transition: background-color 0.2s;
}

.sidebar-nav a:hover {
  background-color: #e8e8e8;
  color: #000;
}

.sidebar-nav li.active a {
  background-color: var(--accent-purple);
  color: #000;
  font-weight: 500;
}

/* ============================================
   Responsive Design
   ============================================ */

/* Desktop: Show hamburger and enable sidebar toggle */
@media (min-width: 769px) {
  .sidebar-toggle {
    display: block;
  }

  nav.sidebar.hidden {
    transform: translateX(-100%);
  }

  /* When sidebar is closed, move topbar and content to left edge */
  .topbar.sidebar-closed {
    left: 0;
  }

  .sidebar-closed ~ .content, .sidebar-closed ~ [role="doc-endnotes"] {
    margin-left: 0;
  }

}

/* Tablet and up */
@media (min-width: 768px) {
  .content {
    font-size: 14pt;
    line-height: 1.4;
    padding: 2rem 4rem 0 4rem;
  }

  blockquote {
    max-width: 24rem;
    padding: 1rem 1.5rem 1rem 2.5rem;
    margin: 2rem auto;
    font-size: 16pt;
  }

  blockquote::before {
    top: .4rem;
    left: .5rem;
    font-size: 2.5rem;
  }
}

/* Desktop and up */
@media (min-width: 1024px) {
  .content {
    padding: 2rem 10vw 0 4rem;
    max-width: 1400px;
  }
}

/* Mobile */
@media (max-width: 768px) {
  .topbar {
    left: 0;
    z-index: 100;
  }

  /* When sidebar is open, topbar needs to be above it for the button to be visible */
  .topbar.sidebar-open {
    z-index: 102;
    background-color: transparent;
    border-bottom: none;
  }

  /* Hide topbar title when sidebar is open on mobile */
  .topbar.sidebar-open .topbar-title {
    opacity: 0;
  }

  .sidebar-toggle {
    display: block;
    position: fixed;
    top: 11px;
    left: 15px;
    z-index: 1;
  }

  /* Hamburger stays in top left when sidebar opens */
  .topbar.sidebar-open .sidebar-toggle {
    position: fixed;
    left: 15px;
  }

  /* Cross animation - hide middle line, rotate top/bottom */
  .sidebar-open .hamburger {
    background-color: transparent;
  }

  .sidebar-open .hamburger::before {
    top: 0;
    transform: rotate(45deg);
  }

  .sidebar-open .hamburger::after {
    top: 0;
    transform: rotate(-45deg);
  }

  .content {
    margin-left: 0;
    padding: 2rem 1rem 0 1rem;
  }

  nav.sidebar {
    transform: translateX(-100%);
    z-index: 101;
  }

  nav.sidebar:not(.hidden) {
    transform: translateX(0);
  }

  [role="doc-endnotes"] {
    margin-left: 0;
    padding-left: 1rem;
  }
}

/* ============================================
   Navigation Arrows
   ============================================ */

/* Navigation arrows container - always at bottom of content */
.nav-arrows {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-top: 3rem;
  margin-left: var(--sidebar-width);
  padding: 0 2rem 2rem 2rem;
  transition: margin-left 0.3s ease;
}

/* Individual navigation arrow links */
.nav-arrow {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  background-color: var(--arrow-bg);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  color: var(--accent-purple);
  text-decoration: none;
  transition: all 0.2s ease;
  min-width: 120px;
}

.nav-arrow:hover {
  background-color: var(--accent-purple);
  border-color: var(--accent-purple);
  /* transform: translateY(-2px); */
  box-shadow: 0 2px 4px rgba(184, 147, 199, 0.3);
}

/* Arrow icons */
.nav-arrow .arrow-icon {
  font-size: 1.2em;
  font-weight: bold;
  color: var(--arrow-color);
}

/* Arrow text */
.nav-arrow .arrow-text {
  font-size: 0.9rem;
  color: var(--arrow-color);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Previous arrow - align left with margin from sidebar */
.prev-arrow {
  justify-content: flex-start;
  margin-right: auto;
  margin-left: 2rem;
}

/* Next arrow - align right */
.next-arrow {
  justify-content: flex-end;
  margin-left: auto;
  flex-direction: row-reverse;
}

/* Desktop navigation - show full titles */
.desktop-nav {
  display: flex;
}

/* Mobile navigation - hide by default */
.mobile-nav {
  display: none;
}

/* Mobile: Show simplified navigation */
@media (max-width: 768px) {
  .desktop-nav {
    display: none;
  }

  .mobile-nav {
    display: flex;
  }

  .nav-arrows {
    margin-left: 0;
    padding: 0 1rem 2rem 1rem;
  }

  .mobile-nav .nav-arrow {
    flex: 1;
    min-width: auto;
  }

  .mobile-nav .arrow-text {
    font-size: 0.85rem;
  }
  .prev-arrow {
    margin-left: 0;
  }
}

/* Desktop: When sidebar is closed, adjust arrow positions */
@media (min-width: 769px) {
  .sidebar-closed ~ .nav-arrows {
    margin-left: 0;
  }
}

/* Tablet and larger screens - limit title width */
@media (min-width: 768px) {
  .desktop-nav .arrow-text {
    max-width: 250px;
  }
}

/* Large screens - more space for arrow text */
@media (min-width: 1024px) {
  .desktop-nav .arrow-text {
    max-width: 350px;
  }
}
