/* Tokyo Night Theme Override for re-terminal
   Replaces orange accent with deep purple and applies
   Tokyo Night color palette throughout.

   Tokyo Night palette reference:
   - Background:  #1a1b26
   - Foreground:  #a9b1d6
   - Comment:     #565f89
   - Purple:      #bb9af7
   - Blue:        #7aa2f7
   - Green:       #9ece6a
   - Red:         #f7768e
   - Orange:      #ff9e64
   - Yellow:      #e0af68
   - Cyan:        #73daca
*/

html:root {
  /* Core theme colors — html:root matches theme's specificity */
  --accent: #bb9af7;
  --accent-contrast-color: #1a1b26;
  --background: #1a1b26;
  --color: #a9b1d6;
  --menu-color: #a9b1d6;
  --border-color: rgba(169, 177, 214, 0.15);

  /* Syntax highlighting — Tokyo Night palette */
  --syntax-func-color: #7aa2f7;
  --syntax-var-color: #bb9af7;
  --syntax-value-color: #9ece6a;
  --syntax-punctuation-color: #a9b1d6;
  --syntax-comment-color: #565f89;
  --syntax-line-highlight-mix: rgba(41, 46, 73, 0.6);
  --syntax-line-highlight-background-color: rgba(41, 46, 73, 0.4);
  --syntax-line-highlight-color: #a9b1d6;
  --syntax-line-highlight-box-shadow: rgba(122, 162, 247, 0.3);
  --syntax-code-border-color: rgba(169, 177, 214, 0.1);
  --syntax-code-copy-button-background: rgba(169, 177, 214, 0.15);
  --syntax-code-copy-button-color: #565f89;
  --syntax-code-copy-button-box-shadow-color: rgba(0, 0, 0, 0.3);
}

/* Inline code blocks — subtle purple tint on Tokyo Night background */
code:not([class*="language-"]) {
  background: rgba(187, 154, 247, 0.1);
  color: #bb9af7;
}

/* Scrollbar styling to match Tokyo Night */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: #1a1b26;
}

::-webkit-scrollbar-thumb {
  background: #292e49;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: #565f89;
}

/* Logo — two-line layout with increased size */
.logo {
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
}

.logo__title {
  font-size: 1.3rem;
  font-weight: bold;
  line-height: 1.2;
}

.logo__subtitle {
  font-size: 0.8rem;
  line-height: 1.2;
  opacity: 0.85;
}

/* Selection color */
::selection {
  background: rgba(187, 154, 247, 0.3);
  color: #c0caf5;
}

/* Hide theme's default navigation menu (sidebar handles all nav; mobile-menu partial removed via header.html override) */
.navigation-menu {
  display: none !important;
}

/* ── Persistent Left Sidebar ── */
.site-layout {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: 240px;
  height: 100vh;
  padding: 3rem 0 2.5rem 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  border-right: 1px solid rgba(169, 177, 214, 0.25);
  background: #16161e;
  z-index: 10;
}

.sidebar__label {
  font-family: 'Fira Code', monospace;
  font-size: 0.7rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: #565f89;
  padding: 0 1.5rem;
  margin-bottom: 1.5rem;
}

.sidebar__nav {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.sidebar__link {
  display: block;
  font-family: 'Fira Code', monospace;
  font-size: 1rem;
  color: #a9b1d6;
  text-decoration: none;
  padding: 0.6rem 1.5rem;
  transition: background 0.2s, color 0.2s;
  border-radius: 0;
}

.sidebar__link:hover {
  color: #bb9af7;
  background: rgba(187, 154, 247, 0.08);
}

.sidebar__link--active {
  color: #fff;
  background: rgba(187, 154, 247, 0.2);
  border-left: 3px solid #bb9af7;
  padding-left: calc(1.5rem - 3px);
}

.site-main {
  margin-left: 240px;
  flex: 1;
  min-width: 0;
}

/* Neutralize theme's .container assumptions inside sidebar layout */
.site-main .container {
  max-width: 100%;
  min-height: auto;
  margin: 0;
  border-right: none;
}

/* Mobile: sidebar collapses to top bar */
@media (max-width: 768px) {
  /* Prevent page-level horizontal scroll on mobile.
     body only (not html) so child elements can still have their own
     horizontal scroll containers (e.g., overflow-x: auto tables). */
  body {
    overflow-x: hidden;
  }

  .site-layout {
    flex-direction: column;
  }

  .sidebar {
    position: sticky;
    top: 0;
    z-index: 100;
    width: 100%;
    height: auto;
    flex-direction: row;
    align-items: center;
    padding: 1rem 1.5rem;
    border-right: none;
    border-bottom: 1px solid rgba(169, 177, 214, 0.1);
  }

  .sidebar__label {
    margin-bottom: 0;
    margin-right: 1.5rem;
  }

  .sidebar__nav {
    flex-direction: row;
    gap: 0;
  }

  .sidebar__link {
    padding: 0.4rem 1rem;
    border-radius: 4px;
  }

  .sidebar__link--active {
    border-left: none;
    padding-left: 1rem;
  }

  .site-main {
    margin-left: 0;
  }

  /* Tighten container padding on mobile */
  .site-main .container {
    padding: 20px 16px;
  }

  /* Tables: enable horizontal scroll rather than breaking layout */
  table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    max-width: 100%;
  }

  /* Code blocks: wrap text in the gap zone between 684px and 768px
     (theme only applies pre-wrap at its $phone: 684px breakpoint) */
  pre {
    white-space: pre-wrap;
    word-wrap: break-word;
  }
}

/* Very small screens (phones ≤ 480px) */
@media (max-width: 480px) {
  /* Hide DIRECTORY label to save horizontal space */
  .sidebar__label {
    display: none;
  }

  /* Allow nav links to wrap if they don't fit one line */
  .sidebar__nav {
    flex-wrap: wrap;
  }

  .site-main .container {
    padding: 16px 12px;
  }
}
