/* Base tokens, fonts, resets, and shell/header layout */
:root {
  --bg-page: #ffffff;
  --bg-main: #000000;
  --text-main: #ffffff;
  --text-accent: #c0fe04;
  --header-fg: #000000;
  --ui-surface: #000000;
  --ui-on-surface: #ffffff;
  --ui-hover-bg: #c0fe04;
  --ui-hover-fg: #000000;
  --accent-rail-bg: #c0fe04;
  --section-bg: #000000;
  --section-text: #ffffff;
  --trail-color: #9b83f4;
  --caterpillar-color: #ffffff;
  --logo-filter-inactive: invert(1);
  --logo-filter-active: invert(0);
  --font-display: "Marathon Shapiro Local", "Arial Black", Arial, sans-serif;
  --font-heading: "KH Interference Local", Impact, "Arial Black", sans-serif;
  --font-mono: "PP Fraktion Mono Local", "Courier New", Courier, monospace;
  --border-main: #ffffff;
  --container-max: 880px;
  --side-panel-width: 200px;
  --delimiter-width: 4.2px;
  --header-row-size: 150px;
  --space-8: 8px;
  --space-12: 12px;
  --space-16: 16px;
  --space-24: 24px;
}

@font-face {
  font-family: "KH Interference Local";
  src: local("KH Interference"), url("/fonts/KHInterference.woff2") format("woff2");
  font-display: swap;
}

@font-face {
  font-family: "Marathon Shapiro Local";
  src: local("Marathon Shapiro"), url("/fonts/MarathonShapiro-Wide65.woff2") format("woff2");
  font-display: swap;
}

@font-face {
  font-family: "PP Fraktion Mono Local";
  src: local("PP Fraktion Mono"), url("/fonts/PPFraktionMono.woff2") format("woff2");
  font-display: swap;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  margin: 0;
  padding: 0;
  overflow: hidden;
}

body {
  min-height: 100dvh;
  background: var(--bg-page);
  color: var(--text-main);
  font-family: var(--font-mono);
  line-height: 1.45;
  position: relative;
}

html.has-custom-cursor,
html.has-custom-cursor body,
html.has-custom-cursor * {
  cursor: none !important;
}

.custom-cursor {
  --cursor-x: -100px;
  --cursor-y: -100px;
  --cursor-rot: 0deg;
  --cursor-scale: 1;
  position: fixed;
  left: 0;
  top: 0;
  width: 18px;
  height: 18px;
  pointer-events: none;
  z-index: 2147483647;
  mix-blend-mode: normal;
  opacity: 0;
  transform: translate3d(
    calc(var(--cursor-x) - 50%),
    calc(var(--cursor-y) - 50%),
    0
  ) rotate(var(--cursor-rot)) scale(var(--cursor-scale));
  transition:
    opacity 120ms ease-out,
    transform 120ms cubic-bezier(0.2, 0.8, 0.2, 1);
  will-change: transform, opacity;
}

.custom-cursor.is-visible {
  opacity: 1;
}

.custom-cursor-svg {
  width: 100%;
  height: 100%;
  display: block;
  filter: drop-shadow(0 0 0.5px rgba(0, 0, 0, 0.45));
}

.custom-cursor-path {
  fill: #fff;
  stroke: #111;
  stroke-width: 2;
  stroke-linejoin: round;
  paint-order: stroke fill;
  vector-effect: non-scaling-stroke;
}

.site-shell {
  width: min(100%, var(--container-max));
  height: 100dvh;
  margin: 0 auto;
  padding: 0;
  background: var(--bg-main);
  border: 0;
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--side-panel-width);
  grid-template-rows: auto 1fr;
  gap: 0;
  overflow: hidden;
}

.site-header {
  border: 0;
  padding: 0;
  background: var(--text-accent);
  color: var(--header-fg);
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 0;
  align-items: stretch;
  grid-column: 1 / -1;
  grid-row: 1;
}

.theme-picker {
  position: relative;
  width: var(--header-row-size);
  min-width: var(--header-row-size);
  min-height: var(--header-row-size);
}

.theme-selected-button {
  position: absolute;
  inset: 0;
  border: 0;
  margin: 0;
  padding: 0;
  background: var(--ui-surface);
  color: var(--ui-on-surface);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.theme-selected-icon {
  width: 56%;
  height: 56%;
  object-fit: contain;
  filter: var(--logo-filter-inactive);
  transform-origin: center;
}

.theme-grid {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-auto-rows: 1fr;
  opacity: 0;
  pointer-events: none;
}

.theme-option {
  border: 0;
  margin: 0;
  padding: 0;
  background: var(--ui-surface);
  color: var(--ui-on-surface);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.theme-option img {
  width: 58%;
  height: 58%;
  object-fit: contain;
  filter: var(--logo-filter-inactive);
  transform-origin: center;
}

.theme-option:hover,
.theme-option:focus-visible,
.theme-option.is-active {
  background: var(--ui-hover-bg);
  color: var(--ui-hover-fg);
  outline: 0;
}

.theme-option:hover img,
.theme-option:focus-visible img,
.theme-option.is-active img {
  filter: var(--logo-filter-active);
}

.theme-option.is-picked img,
.theme-selected-button.is-picked .theme-selected-icon {
  animation: themeIconPopFast 260ms cubic-bezier(0.2, 0.85, 0.25, 1);
}

@keyframes themeIconPopFast {
  0% {
    transform: scale(1) rotate(0deg);
  }
  35% {
    transform: scale(1.32) rotate(-8deg);
  }
  60% {
    transform: scale(1.12) rotate(6deg);
  }
  100% {
    transform: scale(1) rotate(0deg);
  }
}

.theme-picker:hover .theme-grid,
.theme-picker:focus-within .theme-grid,
.theme-picker.is-open .theme-grid {
  opacity: 1;
  pointer-events: auto;
}

.theme-picker:hover .theme-selected-button,
.theme-picker:focus-within .theme-selected-button,
.theme-picker.is-open .theme-selected-button {
  opacity: 0;
  pointer-events: none;
}

.header-name-block {
  display: grid;
  align-content: center;
  gap: var(--space-8);
  min-height: var(--header-row-size);
  padding: var(--space-16);
}

.shell-content {
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 0;
  grid-column: 1;
  grid-row: 2;
}

.shell-content .box-section:last-child {
  margin-bottom: 0;
}

.site-label {
  margin: 0;
  color: var(--header-fg);
  letter-spacing: 0.06em;
  font-size: 0.82rem;
  text-transform: uppercase;
}

.site-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(2rem, 5.5vw, 3.8rem);
  letter-spacing: 0.03em;
  line-height: 1;
  color: var(--header-fg);
}

.site-nav {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
  align-content: stretch;
  min-width: var(--side-panel-width);
  width: var(--side-panel-width);
  background: var(--ui-surface);
}

.site-nav a,
.site-nav button {
  border: 0;
  padding: 12px 14px;
  color: var(--ui-on-surface);
  background: var(--ui-surface);
  font-family: var(--font-heading);
  text-transform: uppercase;
  text-decoration: none;
  display: flex;
  align-items: center;
  justify-content: center;
}

.site-nav button {
  width: 100%;
  margin: 0;
  cursor: pointer;
}
