html {
  font-size: 14px;
}

@media (min-width: 768px) {
  html {
    font-size: 16px;
  }
}

html {
  position: relative;
  min-height: 100%;
  scroll-behavior: smooth;
}

body {
  background-color: var(--bg-dark);
  color: var(--text);
  font-family: "Roboto Mono", monospace;
  font-optical-sizing: auto;
  font-weight: 400;
  font-style: normal;
  margin: 0;
}

main {
  min-height: calc(100dvh - 85px - 53px);
}

a {
  color: var(--text-emphasis);
  text-decoration: none;
}

/* ── Home ── */
#home-bh-canvas {
  position: fixed;
  inset: 0;
  z-index: 0;
  display: block;
}

.home-hero {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: calc(100dvh - 85px - 53px - 60vh);
  gap: 1rem;
  transition: transform 0.08s linear;
  will-change: transform;
}

.home-hero h1 {
  font-size: clamp(2rem, 6vw, 4rem);
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--text);
  margin: 0;
}

.home-hero p {
  font-size: 0.8rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin: 0;
}

/* ── Burn In ── */
.burn-in-screen, .dead-pixel-screen {
  position: fixed;
  inset: 0;
  z-index: 1;
}

.dead-pixel-screen {
  transition: background-color 0.3s ease;
}

.burn-in-controls {
  position: fixed;
  padding: 4rem;
  inset-block-end: 2rem;
  inset-inline: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  opacity: 1;
  transition: opacity 0.3s ease;
  z-index: 10;
}

.burn-in-controls.hidden {
  opacity: 0;
  pointer-events: none;
}

.grey-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 16rem;
  height: 1rem;
  border-radius: 9999px;
  background: linear-gradient(to right, #000, #fff);
  outline: none;
  cursor: pointer;
}

.grey-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 1rem;
  height: 1rem;
  border-radius: 50%;
  background: oklch(0.5 0 0);
  border: 2px solid oklch(0.8 0 0 / 0.5);
  mix-blend-mode: difference;
}

.grey-slider::-moz-range-thumb {
  width: 1rem;
  height: 1rem;
  border-radius: 50%;
  background: oklch(0.5 0 0);
  border: 2px solid oklch(0.8 0 0 / 0.5);
  mix-blend-mode: difference;
  cursor: pointer;
}

.burn-in-label {
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.burn-in-swatches {
  display: flex;
  gap: 0.5rem;
}

.swatch {
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 50%;
  background-color: var(--color);
  border: 2px solid oklch(0.5 0 0 / 0.3);
  cursor: pointer;
  transition: transform 0.1s, border-color 0.1s;
}

.swatch:hover {
  transform: scale(1.2);
  border-color: oklch(0.5 0 0 / 0.6);
}

/* ── Screensaver ── */
#bh-canvas {
  position: fixed;
  inset: 0;
  display: block;
  z-index: 0;
}

/* ── Interface hint ── */
.interface-hint-desktop {
  font-size: 0.75rem;
}

.interface-hint {
  position: fixed;
  inset-block-end: 1.5rem;
  inset-inline: 0;
  text-align: center;
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  z-index: 10;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.interface-hint.hidden {
  opacity: 0;
}

/* Desktop: show inline hint, hide bottom hint */
@media (min-width: 641px) {
  .interface-hint-mobile {
    display: none;
  }
}

/* Mobile: hide desktop hint, show bottom hint */
@media (max-width: 640px) {
  .interface-hint-desktop {
    display: none;
  }
}

/* ── Floating nav ── */
header, footer {
  z-index: 10;
  position: relative;
  transition: opacity 0.3s ease;
}

header.hidden, footer.hidden {
  opacity: 0;
  pointer-events: none;
}

header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 2rem;
  max-width: 1200px;
  margin: 0 auto;
}

.nav-brand {
  corner-shape: round;
  color: var(--text-muted);
  background-color: var(--bg);
  border: 1px solid var(--border);
  border-radius: 2rem;
  padding: 0.5rem 1rem;
  transition: background-color 0.1s ease;
}

.nav-tools {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  text-wrap: nowrap;
}

.nav-tools > li:first-child > a {
  z-index: 1;
  padding-left: 1rem;
  margin: 0;

  @supports (corner-shape: bevel) {
    border-radius: 1rem 0 1rem 1rem;
    corner-shape: round bevel bevel round;
  }
}

.nav-tools > li:last-child > a {
  z-index: 1;
  padding-right: 1rem;
  margin: 0;

  @supports (corner-shape: bevel) {
    border-radius: 1rem 1rem 1rem 0;
    corner-shape: bevel round round bevel;
  }
}

.nav-tools > li > a {
  border-radius: 1rem;
  position: relative;
  padding: 0.5rem 1rem;
  color: var(--text-muted);
  background-color: var(--bg);
  border: 1px solid var(--border);
  margin: 0 0.5rem;
  z-index: 3;
  transition: background-color 0.1s ease;

  @supports (corner-shape: bevel) {
    corner-shape: bevel round;
    border-radius: 1rem 0 / 3rem 0;
    padding: 0.5rem 1.5rem;
    margin: 0 -1rem;
  }
}

.nav-tools > li > a:hover, .nav-tools > li > a:focus, .nav-brand:hover, .nav-brand:focus {
  background-color: var(--bg-light);
}

@media (max-width: 640px) {
  header {
    padding: 0.75rem 1rem;
  }

  header > div {
    display: none;
  }

  .floating-nav {
    width: 100%;
  }

  .nav-tools {
    width: 100%;
  }

  .nav-tools > li {
    flex: 1;
  }

  .nav-tools > li > a {
    display: block;
    text-align: center;
    padding: 0.5rem 0;
    margin: 0;
    border-radius: 0;
  }

  .nav-tools > li:first-child > a {
    border-radius: 1rem 0 0 1rem;
    padding-left: 0;
  }

  .nav-tools > li:last-child > a {
    border-radius: 0 1rem 1rem 0;
    padding-right: 0;
  }
}
