* {
  box-sizing: border-box;
}

html {
  color-scheme: dark;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  scrollbar-gutter: stable;
}

body {
  min-height: 100svh;
  margin: 0;
  background:
    radial-gradient(circle at top, rgb(255 255 255 / 0.08), transparent 34rem),
    linear-gradient(135deg, #101010, #1a1a1a);
  color: white;
  text-align: center;
}

a {
  color: inherit;
}

img {
  height: auto;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.75rem;
  padding: 0.75rem 1rem;
  border-radius: 999px;
  color: inherit;
  text-decoration: none;
  font-weight: 800;
  background:
    linear-gradient(#171717, #171717) padding-box,
    linear-gradient(135deg, #ff4ecd, #7c5cff, #00d4ff) border-box;
  border: 2px solid transparent;
  box-shadow:
    0 0.75rem 1.5rem rgb(124 92 255 / 0.2),
    0 0 2rem rgb(0 212 255 / 0.12);
  transition:
    transform 160ms ease,
    box-shadow 160ms ease,
    opacity 160ms ease;
}

.button:hover,
.button:focus-visible {
  transform: translateY(-1px);
  box-shadow:
    0 1rem 2rem rgb(124 92 255 / 0.3),
    0 0 2.75rem rgb(0 212 255 / 0.2);
}

.button.secondary {
  background: rgb(255 255 255 / 0.1);
  border-color: rgb(255 255 255 / 0.12);
  box-shadow: none;
}

.button.secondary:hover,
.button.secondary:focus-visible {
  background: rgb(255 255 255 / 0.16);
  box-shadow: none;
}

/* Home gallery */
body.page-home {
  padding: clamp(1rem, 3vw, 2rem);
}

.page-home main {
  width: min(100%, 76rem);
  margin-inline: auto;
}

.gallery {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  justify-items: center;
}

.gallery img {
  display: block;
  max-width: min(100%, 760px);
  border-radius: 0.75rem;
  background: rgb(255 255 255 / 0.06);
  box-shadow:
    0 1rem 2.5rem rgb(0 0 0 / 0.35),
    0 0 0 1px rgb(255 255 255 / 0.08);
}

.gallery a {
  display: inline-block;
  color: inherit;
}

.gallery a img {
  transition:
    transform 160ms ease,
    box-shadow 160ms ease;
}

.gallery a:hover img,
.gallery a:focus-visible img {
  transform: translateY(-2px);
  box-shadow:
    0 1.25rem 3rem rgb(0 0 0 / 0.45),
    0 0 0 2px rgb(255 255 255 / 0.28);
}

.small-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 1rem;
  max-width: 760px;
}

.small-row img {
  max-width: min(100%, 220px);
}

footer {
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid rgb(255 255 255 / 0.14);
  color: rgb(255 255 255 / 0.55);
}

.counter {
  display: inline-block;
  margin-top: 1rem;
  padding: 0.5rem;
  border-radius: 0.5rem;
  background: rgb(0 0 0 / 0.35);
}

.counter-label {
  margin: 0 0 0.5rem;
  color: rgb(255 255 255 / 0.55);
  font-family: "Courier New", monospace;
  font-size: 0.9rem;
}

.fake-counter {
  display: inline-block;
  padding: 0.35rem 0.6rem;
  border: 2px inset #999;
  background: #000;
  color: #39ff14;
  font-family: "Courier New", monospace;
  font-size: 1.25rem;
  letter-spacing: 0.12em;
  line-height: 1;
  box-shadow:
    inset 0 0 0.5rem rgb(57 255 20 / 0.22),
    0 0.75rem 1.5rem rgb(0 0 0 / 0.35);
}

/* Meaning page */
body.page-meaning {
  padding: clamp(1rem, 3vw, 2rem);
}

.page-meaning main {
  width: min(100%, 58rem);
  margin-inline: auto;
}

.title-link {
  display: inline-block;
  margin-bottom: 2rem;
  color: inherit;
  text-decoration: none;
}

.title-image {
  display: block;
  max-width: min(100%, 760px);
  margin-inline: auto;
  border-radius: 0.75rem;
  background: rgb(255 255 255 / 0.06);
  box-shadow:
    0 1rem 2.5rem rgb(0 0 0 / 0.35),
    0 0 0 1px rgb(255 255 255 / 0.08);
  transition:
    transform 160ms ease,
    box-shadow 160ms ease;
}

.title-link:hover .title-image,
.title-link:focus-visible .title-image {
  transform: translateY(-2px);
  box-shadow:
    0 1.25rem 3rem rgb(0 0 0 / 0.45),
    0 0 0 2px rgb(255 255 255 / 0.28);
}

.content,
.error-card {
  border: 1px solid rgb(255 255 255 / 0.12);
  background: rgb(0 0 0 / 0.35);
  box-shadow: 0 2rem 5rem rgb(0 0 0 / 0.35);
  backdrop-filter: blur(10px);
}

.content {
  margin-inline: auto;
  padding: clamp(1.25rem, 3vw, 2rem);
  border-radius: 1.25rem;
  text-align: left;
}

.page-meaning h1 {
  margin: 0 0 1rem;
  font-size: clamp(2rem, 6vw, 4rem);
  line-height: 1;
  letter-spacing: -0.05em;
  text-align: center;
}

.page-meaning p {
  margin: 1rem 0;
  color: rgb(255 255 255 / 0.78);
  font-size: clamp(1rem, 2vw, 1.2rem);
  line-height: 1.65;
}

.definition {
  margin: 1.5rem 0;
  padding: 1rem;
  border-left: 4px solid rgb(255 255 255 / 0.28);
  border-radius: 0.5rem;
  background: rgb(255 255 255 / 0.06);
  color: white;
  font-family: "Courier New", Courier, monospace;
  font-size: clamp(1.1rem, 2.5vw, 1.4rem);
  line-height: 1.4;
}

.note {
  color: rgb(255 255 255 / 0.55);
  font-size: 0.95rem;
  font-style: italic;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.75rem;
  margin-top: 1.5rem;
}

.page-meaning .actions {
  margin-top: 2rem;
  text-align: center;
}

/* Error pages */
body.page-error {
  display: grid;
  place-items: center;
  padding: 2rem;
  background:
    radial-gradient(circle at top, rgb(255 255 255 / 0.08), transparent 32rem),
    linear-gradient(135deg, #101010, #1a1a1a);
}

.error-card {
  width: min(100%, 54rem);
  padding: clamp(1.5rem, 4vw, 3rem);
  border-radius: 1.5rem;
  box-shadow: 0 2rem 5rem rgb(0 0 0 / 0.45);
}

.eyebrow {
  margin: 0 0 0.5rem;
  color: rgb(255 255 255 / 0.65);
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.page-error h1 {
  margin: 0;
  font-size: clamp(5rem, 22vw, 12rem);
  line-height: 0.85;
  letter-spacing: -0.08em;
}

.message {
  margin: 1rem auto 0;
  max-width: 42rem;
  color: rgb(255 255 255 / 0.78);
  font-size: clamp(1.05rem, 2.5vw, 1.35rem);
  line-height: 1.5;
}

.image-wrap {
  margin: 2rem auto;
  display: grid;
  place-items: center;
}

#random-stfu-image {
  display: block;
  max-width: min(100%, 520px);
  max-height: 48svh;
  width: auto;
  border-radius: 1rem;
  background: rgb(255 255 255 / 0.06);
  box-shadow:
    0 1.5rem 3rem rgb(0 0 0 / 0.45),
    0 0 0 1px rgb(255 255 255 / 0.1);
}

.tiny {
  margin: 1.5rem 0 0;
  color: rgb(255 255 255 / 0.45);
  font-size: 0.9rem;
}

/* Three.js cube/sphere page */
html.cube-page,
html.cube-page body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #20242a;
}

html.cube-page body {
  min-height: 100%;
  text-align: initial;
}

html.cube-page canvas {
  display: block;
}

#error {
  display: none;
  box-sizing: border-box;
  margin: 20px;
  padding: 20px;
  font-family: monospace;
  white-space: pre-wrap;
  color: #b00020;
  background: #fff3f3;
  border: 1px solid #ffcccc;
}

@media (max-width: 700px) {
  body.page-home {
    padding: 1rem;
  }

  .gallery {
    gap: 0.85rem;
  }

  .gallery img {
    border-radius: 0.5rem;
  }

  .small-row {
    gap: 0.75rem;
  }

  .small-row img {
    max-width: 30%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .gallery a img,
  .title-image,
  .button {
    transition: none;
  }

  .gallery a:hover img,
  .gallery a:focus-visible img,
  .title-link:hover .title-image,
  .title-link:focus-visible .title-image,
  .button:hover,
  .button:focus-visible {
    transform: none;
  }
}

