:root {
  --text-color: #000;
  --primary-color: #2f2f2f;
  --background-color: #2f2f2f;

  --mid-color: color-mix(in srgb, #f5f5dc, #2f2f2f 50%);
}

/* Hide content until styles are loaded, but keep menu bar visible */
body:not(.styles-loaded) main,
body:not(.styles-loaded) main *,
body:not(.styles-loaded) main h1,
body:not(.styles-loaded) main h2,
body:not(.styles-loaded) main h3,
body:not(.styles-loaded) main h4,
body:not(.styles-loaded) main h5,
body:not(.styles-loaded) main h6,
body:not(.styles-loaded) main p,
body:not(.styles-loaded) main span,
body:not(.styles-loaded) main label,
body:not(.styles-loaded) main li,
body:not(.styles-loaded) main a,
body:not(.styles-loaded) main button,
body:not(.styles-loaded) main input,
body:not(.styles-loaded) main textarea {
  color: transparent !important;
  opacity: 0 !important;
}

.light-mode-switch {
  border-radius: 2em;
  border: 2px solid --var(--text-color);
  font-family: "Courier New", Courier, monospace;
}

@media (prefers-color-scheme: light) {
  :root {
    --text-color: #2f2f2f;
    --primary-color: #f5f5dc;
    --background-color: #f5f5dc;
  }
  .light-mode-switch {
    display: none;
  }
}

body,
#root {
  background-color: var(--mid-color);
  margin: 0;
}

.title-bar-controls button[aria-label="Maximize"] {
  margin-left: 2px;
}

:root {
  font-family: "Courier New", Courier, monospace;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  --background-color: #000;
  --border-size: 0.25em;
  --gap-size: 0.5em;
  --menu-bar-height: calc(2em + 4px);
  --trailer-tail: 8px;
  --clippy-border-flash-color: transparent;
  font-size: 16px;
}
/* Force title bar text to dark gray for readability */
.title-bar-text,
.title-bar-text a {
  color: #eee !important;
  font-size: 0.85rem;
}

:root.theme-border-flash .window,
:root.theme-border-flash .window *,
:root.theme-border-flash .window *::before,
:root.theme-border-flash .window *::after {
  border-color: var(--clippy-border-flash-color, #feef69) !important;
}

:root.theme-border-flash .window .title-bar,
:root.theme-border-flash .title-bar {
  background: var(--clippy-border-flash-color, #feef69) !important;
  background-image: none !important;
}

:root.theme-border-flash .window .title-bar-text,
:root.theme-border-flash .window .title-bar a,
:root.theme-border-flash .title-bar-text {
  color: #000 !important;
}

:root.theme-box-shadow-flash .window .title-bar {
  border-color: var(--clippy-border-flash-color, #feef69) !important;
  box-shadow: 0 0 15px 4px #feef69 !important;
}

/* --- Experimental theme: raise-and-wobble effect ----------------------------
 * Sections marked with the "experimental" theme bob up and down gently on
 * hover/focus, and gain a thick double border (2px solid) layered with the
 * 98.css raised-window bevel. The 3D perspective is provided by .page.
 * Driven by the `raiseWobble` flag on the theme definition.
 */
@keyframes theme-experimental-wobble {
  0% {
    transform: translateY(0);
  }
  20% {
    transform: translateY(-6px);
  }
  40% {
    transform: translateY(-3px);
  }
  60% {
    transform: translateY(-6px);
  }
  80% {
    transform: translateY(-2px);
  }
  100% {
    transform: translateY(0);
  }
}

.window[data-theme="experimental"] {
  /* The 3D perspective is provided by the .page ancestor so the raise/wobble
     isn't clipped by this element's own box; here we just preserve the 3D
     context and animate the transform. */
  transform-style: preserve-3d;
  transition:
    transform 120ms ease-out,
    box-shadow 86 ease-out;
  will-change: transform;
}

@media (hover: hover) {
  .window[data-theme="experimental"]:hover {
    /* Bob up and down (translateY) in the page's 3D space. */
    animation: theme-experimental-wobble 0.6s ease-in-out;
  }
}

.window[data-theme="experimental"]:focus-within {
  /* Keyboard focus also triggers the wobble (a11y). */
  animation: theme-experimental-wobble 0.6s ease-in-out;
}

/* Respect reduced-motion: skip the wobble animation, keep the raise. */
@media (prefers-reduced-motion: reduce) {
  .window[data-theme="experimental"]:hover,
  .window[data-theme="experimental"]:focus-within {
    animation: none;
  }
}

/* Touch devices (Android Firefox, etc.) don't expose a real hover pointer.
   Strip the raise/wobble transitions there so the sticky-hover state can't
   leave a window stuck mid-hover when the user scrolls past it. */
@media (hover: none) {
  .window[data-theme="experimental"] {
    transition: none;
    will-change: auto;
  }
}

/** The "centered" theme centers child windows with space-around distribution. */
.window[data-theme~="centered"] .window-body ul li {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
}

@font-face {
  font-family: "bahnscrift";
  src: url("/BAHNSCHRIFT.TTF");
  font-weight: normal;
  font-style: normal;
}

/* Reset XP.css window styling overrides */
.window {
  min-width: min(480px, 100%);
  max-height: 100%;
  height: max-content;
  box-sizing: border-box;
  /* Leave room for the fixed menu bar when scrolling to a window. */
  scroll-margin-top: var(--menu-bar-height);
}

.window:last-child {
  margin-bottom: 0;
}

/* Add extra spacing for nested windows */
.window-body .window {
  margin-bottom: var(--trailer-tail);
}

.window-body .window:last-child {
  margin-bottom: 0;
}

/* Spacing for windows inside lists (addon pages) */
.window-body ul li .window,
.window-body ul .window,
.window-body .addon-wrapper {
  margin-bottom: 0.5em;
}

.window-body ul li:last-child .window,
.window-body ul .window:last-child,
.window-body .addon-wrapper:last-child {
  margin-bottom: 0;
}

/* Hide border on first-level windows to avoid double border */
.page > .window,
main > .page {
  border: none;
}

/* Pin all root-level windows to the same width so a window with wider
   inner content (e.g. a Spotify iframe) can't push itself past the rest
   of the page. Defaults to 768px to match the website's compact reading
   width; only grows when the viewport is narrower than that. */
.page > .window {
  width: min(768px, 100% - (var(--gap-size) * 2));
  max-width: min(768px, 100% - (var(--gap-size) * 2));
}
/* Add more vertical padding to title bars */
.title-bar {
  padding-top: 0.25em !important;
  padding-bottom: 0.25em !important;
}

body {
  margin-top: 0;
  min-height: 100vh;
  min-height: 100dvh;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
}

#root {
  display: flex;
  flex: 1;
  flex-direction: column;
  place-items: stretch;
  min-height: 0;
}

body,
h1,
h2,
h3,
h4,
h5,
h6,
p,
span,
label,
input,
textarea,
button,
form,
div,
a,
li {
  color: var(--text-color) !important;
  opacity: 1 !important;
}

.page > ul,
li {
  padding: 0;
  margin: 0;
  list-style: none;
  margin-bottom: var(--gap-size);
}

.page {
  margin: 0 auto;
  display: flex;
  border: 0;
  z-index: 100;
  width: calc(100% - (var(--gap-size) * 2));
  height: 100%;
  box-sizing: border-box;
  flex-direction: column;
  place-items: center;
  min-height: 100%;
  /* Establish the 3D viewing space for themed windows so their raise/wobble
     transforms (translateZ, scale) render relative to the page rather than
     being clipped by the page's own box. */
  perspective: 800px;
  /* Let a raised window overflow the page bounds without clipping. */
  transform-style: preserve-3d;
}

.window.maximized {
  min-height: 100%;
  min-width: 100%;
  margin: 2em;
  box-sizing: content-box;
}

.menu-item {
  margin: 0;
  padding: calc(var(--gap-size) / 2) var(--gap-size);
  background-color: beige;
}

ul > section > h1,
ul > section > h4,
form#form > label {
  margin: 0 calc(var(--gap-size) * 1.75);
  font-family: bahnscrift, system-ui, Helvetica, Arial, sans-serif;
  line-height: 1.5;
  font-weight: 400;
  font-size: 0.9rem;
}

.window-body ul {
  margin: 0;
  padding-left: 0;
}

.window-body ul li {
  padding-left: 1.5em;
}

.window-body {
  min-width: 0;
  min-height: 100%;
  max-width: 100%;
  word-break: break-word;
}

.maximized-window-body {
  display: flex;
  flex-direction: column;
}

.maximized-window-body > *:last-child {
  flex: 1;
  min-height: 0;
}

/* The permalink row should never grow; it stays at its natural size while the
   content siblings take the remaining height in the maximized window. */
.maximized-window-body > .permalink-button-container {
  flex: 0 0 auto;
  min-height: 0;
}

/* When a window is maximized, let embedded iframes (SoundCloud/Spotify/blogs)
   grow to fill the available window-body height instead of staying at their
   fixed pixel height. Stretches the ancestor chain (ul > li > wrapper) so the
   flex height propagates down to the iframe. Only applies inside `.maximized`
   so inline (non-fullscreen) windows keep their natural sizes. */
.maximized .maximized-window-body:has(iframe) {
  /* allow the body itself to hand height down to its children */
  align-items: stretch;
}

/* The content wrapper (the last child that isn't the permalink row) should
   grow to fill the window body, and hand its height down to the iframe chain. */
.maximized
  .maximized-window-body:has(iframe)
  > *:not(.permalink-button-container),
.maximized .maximized-window-body:has(iframe) ul,
.maximized .maximized-window-body:has(iframe) ul > li {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
}

.maximized .maximized-window-body iframe {
  /* Fill the available height via flex (NOT height:100%, which resolves to 0
     against an indefinite flex parent). flex-basis auto + grow stretches the
     iframe to its share of the parent's resolved height. */
  flex: 1 1 auto;
  min-height: 200px;
  max-height: 100%;
  box-sizing: border-box;
}

.debug-printout-scroll {
  width: 100%;
  max-width: 100%;
  height: 100%;
}

.debug-printout-scroll pre,
.debug-printout-scroll code {
  max-width: 100%;
  box-sizing: border-box;
}

.debug-printout-scroll pre {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.window-body pre {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
}

/* xp.css sets very large heading sizes; keep markdown headings readable in content windows. */
.window-body h1 {
  font-size: 1.2rem !important;
  line-height: 1.25;
  margin: 0.25em 0;
}

.window-body h2 {
  text-align: right;
  color: var(--button-shadow) !important;
}

.window-body > ul:first-child {
  margin-top: 0;
}

.music-track-title {
  font-size: 1.08em;
  font-weight: 600;
  margin: 0 0 0.35em 0;
}

.music-track-window .window-body {
  padding: 0.5em;
}

.music-track-window ul {
  min-width: 100%;
}
/* .music-track-window li, */
.music-track-window p {
  width: max-content;
}
.music-track-window iframe {
  border-radius: 4px;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1);
}

/* Favourite-link windows mirror the per-track styling so their Spotify
   iframe doesn't push the window wider than the rest of the page. */
.music-favourite-link-window .window-body {
  padding: 0.5em;
}

.music-favourite-link-window ul {
  min-width: 100%;
}

.music-favourite-link-window p {
  width: max-content;
}

.music-favourite-link-window iframe {
  display: block;
  border-radius: 4px;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1);
  max-width: 100%;
}

/* Artist Profile Picture - 1:1 aspect ratio background image */
.artist-profile-picture {
  width: 80px;
  height: 80px;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  border-radius: 4px;
  margin-right: 0.5em;
  vertical-align: middle;
}

/* Artist Profile Background - stretched background under text */
.artist-profile-background {
  width: 100%;
  min-height: 36em;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  border-radius: 4px;
  margin-bottom: 0.5em;
}

/* Menu Bar - Windows XP style */
.menu-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  background: linear-gradient(to bottom, #f0f0f0 0%, #e0e0e0 100%);
  border-bottom: 1px solid #808080;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
  padding: 0;
  margin: 0;
}

.menu-bar menu {
  display: flex;
  list-style: none;
  margin: 0;
  padding: 0;
  gap: 0;
}

.menu-bar menu li {
  margin: 0;
  padding: 0;
}

.menu-bar menu a {
  display: block;
  padding: 4px 8px;
  text-decoration: none;
  color: #000 !important;
  font-size: 16px;
  font-family: "Tahoma", "MS Sans Serif", sans-serif;
  white-space: nowrap;
  transition: background-color 0.1s ease;
}

@media (hover: hover) {
  .menu-bar menu a:hover {
    background-color: rgba(51, 153, 255, 0.2);
  }
}

.menu-bar menu a:active {
  background-color: rgba(51, 153, 255, 0.4);
}

.menu-bar .menu-underline {
  text-decoration: underline;
}

/* Minimized Sections Menu */
.minimized-sections-item {
  margin-left: auto;
  position: relative;
}

/* Unhide button in the menu bar (top-left) */
.unhide-button-container {
  top: calc(var(--menu-bar-height) + 1px);
  left: 0;
  right: 0;
  height: var(--menu-bar-height);
  max-width: 100%;
  display: flex;
  align-items: center;
  flex-direction: column;
  place-self: stretch;
  position: absolute;
  z-index: 999;
}

/* Unhide button styling in the menu bar */
.unhide-button-container .menu-button {
  padding: 4px 8px !important;
  font-size: 13px !important;
  background: transparent;
  border: none;
  cursor: pointer;
  width: 100%;
  max-width: 100%;
}

/* Dropdown menu positioned below the button in the top-left corner */
.unhide-button-container .dropdown-menu {
  position: absolute;
  top: calc(100% + 8px);
  left: var(--gap-size);
  right: var(--gap-size);
  min-width: unset;
  width: calc(100% - (var(--gap-size) * 2));
  background: #fff;
  border: 2px outset #dfdfdf;
  box-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
  max-height: 400px;
  padding: 2px;
  display: flex;
  box-sizing: border-box;
  flex-direction: column;
}

.unhide-button-container .dropdown-item {
  display: block;
  width: 100%;
  padding: 6px 12px;
  text-align: left;
  background: transparent;
  border: none;
  color: #000 !important;
  font-size: 14px;
  font-family: "Tahoma", "MS Sans Serif", sans-serif;
  cursor: pointer;
  white-space: nowrap;
  text-overflow: ellipsis;
}

@media (hover: hover) {
  .unhide-button-container .dropdown-item:hover {
    background-color: #0a246a;
    color: #fff !important;
  }
}

.minimized-menu {
  position: relative;
  display: inline-block;
}

.minimized-menu .menu-button {
  display: block;
  padding: 4px 8px;
  text-decoration: none;
  color: #000 !important;
  font-size: 14px;
  font-family: "Tahoma", "MS Sans Serif", sans-serif;
  white-space: nowrap;
  background: transparent;
  border: none;
  cursor: pointer;
  transition: background-color 0.1s ease;
  bottom: 0;
}

@media (hover: hover) {
  .minimized-menu .menu-button:hover {
    background-color: rgba(51, 153, 255, 0.2);
  }
}

.minimized-menu .menu-button:active {
  background-color: rgba(51, 153, 255, 0.4);
}

.minimized-menu-container .dropdown-menu {
  position: absolute;
  bottom: 100%;
  left: 0;
  background: #fff;
  border: 2px outset #dfdfdf;
  box-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
  min-width: 250px;
  max-height: 400px;
  padding: 2px;
  display: flex;
  flex-direction: column;
  z-index: 90;
}

.minimized-menu-container .dropdown-item {
  display: block;
  width: 100%;
  padding: 6px 12px;
  text-align: left;
  background: transparent;
  border: none;
  color: #000 !important;
  font-size: 14px;
  font-family: "Tahoma", "MS Sans Serif", sans-serif;
  cursor: pointer;
  white-space: nowrap;
  z-index: 92;
  text-overflow: ellipsis;
}

@media (hover: hover) {
  .minimized-menu-container .dropdown-item:hover {
    background-color: #0a246a;
    color: #fff !important;
  }
}

body main {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 0;
  height: 100%;
  min-height: 100%;
}

/* Fixed bars (menu bar, debug bar, unhide chinbar) overlay the viewport.
   Reserve space on the body itself via padding so every flow descendant —
   not just main — starts below them. */
body {
  padding-top: calc(var(--menu-bar-height) + var(--trailer-tail));
  padding-bottom: var(--trailer-tail);
}

/* Account for the fixed debug bar on the music page (sits below menu bar) */
body:has([data-debug-bar]) .page {
  padding-bottom: calc(var(--menu-bar-height)+5em);
}

/* Leave room for the fixed unhide chinbar on desktop */
body:has(.unhide-button-container) {
  padding-top: var(--menu-bar-height);
}
/* Leave room for the fixed unhide chinbar on desktop */
body:has(.unhide-button-container) .page {
  padding-top: var(--menu-bar-height);
}

.unhide-button-container {
  height: 2em;
}

@media (prefers-color-scheme: light) {
  :root {
    --background-color: #fefefe;
  }
}

@media screen and (max-width: 768px) {
  :root {
    --gap-size: 1.26em;
  }
  body:has([data-debug-bar]) .page {
    padding-bottom: calc(var(--menu-bar-height) + 2em);
  }
  .page {
    width: 100%;
  }

  body {
    max-width: 100vw;
  }

  main {
    width: 100%;
    max-width: 100vw;
    box-sizing: border-box;
    padding: 0;
    margin: 0;
  }

  .page {
    margin: 0 auto;
    padding: 0;
    box-sizing: border-box;
    justify-items: center;
  }

  /* Constrain window width on mobile */
  .window {
    max-width: 100%;
    box-sizing: border-box;
  }

  .window-body {
    max-width: 100%;
  }

  /* Mobile-friendly menu bar */
  .menu-bar {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: #888 #f0f0f0;
  }

  /* Hide scrollbar for cleaner look but keep functionality */
  .menu-bar::-webkit-scrollbar {
    height: 3px;
  }

  .menu-bar::-webkit-scrollbar-track {
    background: #f0f0f0;
  }

  .menu-bar::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 2px;
  }

  .menu-bar menu {
    flex-wrap: nowrap;
    justify-content: flex-start;
    min-width: min-content;
  }

  .menu-bar menu a {
    padding: 6px 12px;
    font-size: 14px;
    white-space: nowrap;
  }

  /* Increase touch target size for better mobile usability */
  .menu-bar menu li {
    display: flex;
    align-items: center;
  }

  /* Give the unhide button a visible chinbar on mobile so it isn't
     clobbered by on-screen content. */
  .minimized-menu-container {
    left: 0;
    bottom: 0;
    right: 0;
    padding: 2px 20px;
    align-items: stretch;
  }

  .minimized-menu-button {
    top: var(--menu-bar-height);
    font-size: 14px !important;
    text-align: center;
    z-index: 98;
  }

  .minimized-menu-container .dropdown-menu {
    bottom: 100%;
    left: 0;
    right: 0;
    min-width: unset;
    width: 100%;
  }
}

@media screen and (max-width: 480px) {
  :root {
    --menu-bar-height: 24px;
  }
  .page > .window {
    box-sizing: border-box;
    margin: 0 auto;
    /* width: fit-content; */
    width: 100%;
  }

  /* Extra small screens - even more compact */
  .menu-bar menu a {
    padding: 5px 10px;
  }
}

.Toastify__toast-container {
  z-index: 9999 !important;
}

.Toastify__toast {
  max-width: 100%;
  width: 100%;
}
.Toastify__close-button {
  place-self: center;
  bottom: 6px;
  right: 6px;
}
