* {
  box-sizing: border-box;
}

html {
  overscroll-behavior: none;
  scrollbar-width: thin;
  scrollbar-color: rgba(180, 180, 180, 0.5) transparent;
}

html:hover {
  scrollbar-color: rgba(200, 200, 200, 0.7) transparent;
}

/* Webkit scrollbar styling (Chrome, Safari, Edge) */
::-webkit-scrollbar {
  width: 10px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(180, 180, 180, 0.4);
  border-radius: 6px;
  border: 2px solid transparent;
  background-clip: padding-box;
  transition: background 0.3s ease;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(200, 200, 200, 0.6);
  background-clip: padding-box;
}

/* Auto-hide scrollbar when not needed */
body::-webkit-scrollbar-thumb {
  background: rgba(180, 180, 180, 0.3);
}

body:hover::-webkit-scrollbar-thumb {
  background: rgba(180, 180, 180, 0.5);
}

:root {
  color-scheme: light dark;
  /* 1950s/60s Guitar Amp Color Palette */
  --tolex-dark: #1a1a1a;
  --tolex-mid: #2d2d2d;
  --chrome: #9a9590;
  --chrome-light: #b8b0a8;
  --chrome-dark: #6b6560;
  --cream-panel: #f5f0e6;
  --ivory: #fffef5;
  --gold-accent: #c9a227;
  --copper: #b87333;
  --warm-white: #fff8f0;
  --charcoal: #333333;
  --grille-brown: #4a3728;
}

body {
  margin: 0;
  width: 100%;
  font-family: 'Outfit', sans-serif;
  /* Tolex texture background */
  background: var(--tolex-dark);
  background-image:
    radial-gradient(ellipse at 50% 0%, rgba(60, 60, 60, 0.3) 0%, transparent 50%),
    repeating-linear-gradient(
      0deg,
      transparent 0px,
      transparent 2px,
      rgba(0, 0, 0, 0.1) 2px,
      rgba(0, 0, 0, 0.1) 4px
    );
  color: var(--charcoal);
  padding-top: 140px;
  overscroll-behavior: none;
  overflow-y: auto;
  overflow-x: hidden;
}

#main-wrapper {
  width: 100%;
  min-height: calc(100vh - 140px);
  display: flex;
}

main {
  padding: 40px;
  width: calc(100% - 280px);
  flex: 1;
  min-width: 0;
}

main .content {
  /* Cream control panel */
  background: var(--cream-panel);
  border: 3px solid var(--chrome-dark);
  border-radius: 8px;
  box-shadow:
    0 4px 20px rgba(0, 0, 0, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.5);
  font-size: 18px;
  line-height: 1.7em;
  color: var(--charcoal);
  padding: 40px 50px;
  position: relative;
  overflow-x: auto;
  overflow-y: hidden;
  word-wrap: break-word;
}

main .content::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--chrome-dark), var(--chrome-light), var(--chrome-dark));
}

header {
  width: 100%;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  height: 140px;
  margin: 0;
  /* Dark tolex background with subtle texture */
  background: var(--tolex-dark);
  background-image:
    repeating-linear-gradient(
      0deg,
      transparent 0px,
      transparent 3px,
      rgba(255, 255, 255, 0.02) 3px,
      rgba(255, 255, 255, 0.02) 6px
    ),
    repeating-linear-gradient(
      90deg,
      transparent 0px,
      transparent 3px,
      rgba(255, 255, 255, 0.02) 3px,
      rgba(255, 255, 255, 0.02) 6px
    );
  color: var(--chrome-light);
  /* Chrome bottom border */
  border-bottom: 4px solid;
  border-image: linear-gradient(90deg, var(--chrome-dark), var(--chrome-light), var(--chrome-dark)) 1;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  overflow: hidden;
}

header::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: radial-gradient(ellipse at 50% 100%, rgba(100, 100, 100, 0.1) 0%, transparent 60%);
  pointer-events: none;
}

header > .logo-container {
  display: flex;
  align-items: center;
  padding: 0 30px;
  z-index: 1;
}

header > .logo-container img {
  height: 105px;
}

header > .logo-container.github {
  margin-left: auto;
  padding: 0 30px;
}

header > .logo-container.github a {
  display: flex;
  align-items: center;
}

header > .logo-container.github img {
  width: 40px;
  height: 40px;
  filter: brightness(0) invert(0.7);
  opacity: 0.8;
  transition: opacity 0.2s;
}

header > .logo-container.github img:hover {
  opacity: 1;
}

header > .title {
  display: none;
}

footer {
  width: 100%;
  min-height: 80px;
  background: var(--tolex-mid);
  color: var(--chrome);
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 20px;
  margin-top: 64px;
  border-top: 3px solid var(--chrome-dark);
}

h1, h2, h3, h4, h5, h6 {
  font-family: 'Outfit', sans-serif;
  font-weight: 600;
  letter-spacing: 0.5px;
}

h1 {
  font-weight: 600;
  font-size: 2.2em;
  color: var(--charcoal);
  margin-top: 40px;
  margin-bottom: 20px;
}

main .content h1:first-child {
  margin-top: 0;
}

h2 {
  font-weight: 600;
  padding-top: 30px;
  font-size: 1.8em;
  color: var(--charcoal);
  border-bottom: 2px solid var(--chrome);
  padding-bottom: 10px;
  margin-bottom: 20px;
}

h3 {
  font-weight: 600;
  font-size: 1.4em;
  color: var(--charcoal);
  margin-top: 30px;
}

h4 {
  font-weight: 600;
  color: var(--charcoal);
}

p > code,
a > code {
  background-color: var(--tolex-mid);
  color: var(--chrome-light);
  border-radius: 4px;
  font-weight: 500;
  padding: 3px 8px;
  margin: 0 4px;
  border: 1px solid var(--chrome-dark);
}

header h1,
header h2,
header h3 {
  width: auto;
  margin: 0;
}

nav {
  display: block;
  min-width: 280px;
  width: 280px;
  font-size: 16px;
  /* Grille cloth texture */
  background: var(--grille-brown);
  background-image:
    repeating-linear-gradient(
      0deg,
      transparent 0px,
      transparent 2px,
      rgba(0, 0, 0, 0.2) 2px,
      rgba(0, 0, 0, 0.2) 4px
    ),
    repeating-linear-gradient(
      90deg,
      transparent 0px,
      transparent 2px,
      rgba(0, 0, 0, 0.2) 2px,
      rgba(0, 0, 0, 0.2) 4px
    );
  padding: 25px;
  border-right: 3px solid var(--chrome-dark);
  font-family: 'Outfit', sans-serif;
  position: relative;
}

nav > h4 {
  color: #d4a89a;
  margin: 0;
  margin-top: 25px;
  margin-bottom: 10px;
  padding-top: 20px;
  text-transform: uppercase;
  font-family: 'Outfit', sans-serif;
  font-weight: 600;
  letter-spacing: 1px;
  font-size: 0.85em;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

nav > h4:first-of-type {
  border-top: none;
  padding-top: 0;
  margin-top: 0;
}

nav > a {
  color: #c49080;
  display: block;
  text-decoration: none;
  padding: 8px 0;
  padding-left: 12px;
  border-left: 2px solid transparent;
  transition: all 0.2s;
  position: relative;
  z-index: 1;
}

nav > a:hover {
  border-left-color: var(--gold-accent);
  background: rgba(255, 255, 255, 0.05);
  color: #e0c0b0;
  padding-left: 16px;
}

nav.collection {
  border: none;
}

nav.collection > ul {
  padding: 0;
  list-style: none;
}

nav.collection > ul > li {
  padding: 4px 0;
}

nav.collection > ul > li.selected {
  font-weight: 600;
}

nav.collection a {
  text-decoration: none;
}

nav.collection a:hover {
  text-decoration: underline;
}

section.demo {
  width: calc(100% - 50px);
  margin: 20px 0;
  padding: 25px;
  background: rgba(0, 0, 0, 0.03);
  border: 2px solid var(--chrome);
  border-radius: 8px;
}

section.demo h2 {
  padding-top: 0;
  margin-top: 0;
  margin-bottom: 30px;
  border-bottom: none;
}

.table-wrapper {
  overflow-x: auto;
  border: 2px solid var(--chrome-dark);
  border-radius: 6px;
  background: white;
}

table {
  border-collapse: collapse;
  width: 100%;
}

table th {
  background: var(--tolex-mid);
  color: var(--chrome-light);
  padding: 12px 15px;
  text-align: left;
  font-family: 'Outfit', sans-serif;
  font-weight: 600;
  letter-spacing: 0.5px;
}

table td {
  padding: 12px 15px;
  border-bottom: 1px solid var(--chrome);
}

table tr:last-child td {
  border-bottom: none;
}

.mobile-header {
  display: none;
}

.mobile-menu-button {
  display: none;
  background: transparent;
  border: 2px solid var(--chrome);
  cursor: pointer;
  padding: 10px;
  border-radius: 6px;
  transition: all 0.2s;
}

.mobile-menu-button:hover {
  background-color: rgba(255, 255, 255, 0.1);
}

.mobile-menu-button:active {
  background-color: rgba(255, 255, 255, 0.2);
}

.mobile-menu-button svg {
  filter: brightness(0) invert(0.7);
}

#page-title {
  margin-top: 0;
  margin-bottom: 30px;
  padding: 0;
  padding-bottom: 15px;
  font-family: 'Outfit', sans-serif;
  font-style: italic;
  font-weight: 400;
  color: var(--chrome-dark);
  font-size: 1.1em;
  border-bottom: 1px solid var(--chrome);
}

#version {
  background-color: var(--tolex-mid);
  padding: 8px 15px;
  color: var(--chrome-light);
  border-radius: 4px;
  margin-top: 15px;
  display: inline-block;
  border: 1px solid var(--chrome-dark);
  font-family: 'Outfit', sans-serif;
  font-weight: 600;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

#open-issues {
  border-radius: 4px;
  border: 2px solid var(--gold-accent);
  font-size: 16px;
  background-color: var(--gold-accent);
  color: var(--tolex-dark);
  padding: 10px 18px;
  font-weight: 600;
  margin-top: 15px;
}

pre[class*="language-"] {
  border: 2px solid var(--chrome-dark) !important;
  border-radius: 6px !important;
  background: var(--tolex-dark) !important;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3) !important;
}

a {
  color: var(--copper);
  font-weight: 500;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

a:hover {
  color: var(--gold-accent);
}

strong {
  color: var(--charcoal);
  font-weight: 600;
}

/* Image styling - constrain to content width */
main .content img {
  max-width: 100%;
  height: auto;
  display: block;
  margin: 20px 0;
  border: 2px solid var(--chrome-dark);
  border-radius: 6px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

/* Code blocks - allow horizontal scroll on small screens */
pre[class*="language-"] {
  max-width: 100%;
  overflow-x: auto;
}

/* Tablet/small laptop breakpoint */
@media only screen and (max-width: 1024px) {
  nav {
    min-width: 220px;
    width: 220px;
    padding: 20px;
    font-size: 14px;
  }

  main {
    padding: 20px;
    width: calc(100% - 220px);
  }

  main .content {
    padding: 30px 35px;
    font-size: 16px;
  }

  header {
    height: 100px;
  }

  header > .logo-container img {
    height: 75px;
  }

  body {
    padding-top: 100px;
  }

  #main-wrapper {
    min-height: calc(100vh - 100px);
  }
}

@media only screen and (max-device-width: 490px) {
  body {
    padding-top: 70px;
  }

  header {
    height: 70px;
    display: flex;
    align-items: center;
    gap: 20px;
  }

  header .mobile-menu-button {
    margin-left: 20px;
    margin-top: 0;
    flex-shrink: 0;
  }

  header .logo-container {
    display: flex;
    margin-top: 0;
  }

  header .logo-container img {
    height: 50px;
  }

  header .title {
    display: none;
  }

  header > .title h1 {
    font-size: 1.5em;
    color: var(--chrome-light);
  }

  header .title h4 {
    display: none;
  }

  .mobile-header {
    display: none;
  }

  .mobile-header a > img {
    width: 33%;
  }

  .mobile-header h1 {
    color: var(--chrome-light);
  }

  nav {
    display: none;
  }

  .menu-open nav {
    position: fixed;
    background: var(--grille-brown);
    top: 70px;
    width: 80%;
    height: calc(100vh - 70px);
    display: block;
    z-index: 1000;
    overflow-y: auto;
  }

  .menu-open nav::-webkit-scrollbar {
    width: 8px;
  }

  .menu-open nav::-webkit-scrollbar-thumb {
    background: rgba(200, 200, 200, 0.4);
  }

  .menu-open nav::-webkit-scrollbar-thumb:hover {
    background: rgba(200, 200, 200, 0.6);
  }

  #main-wrapper {
    min-height: calc(100vh - 70px);
  }

  .mobile-menu-button {
    margin-top: 15px;
    display: inline-block;
  }

  main {
    margin: 0;
    padding: 15px;
    width: 100%;
  }

  main .content {
    padding: 20px;
    border-width: 2px;
  }
}
