/* DOOK. PS2-era OS window on a rainbow road. */

@font-face {
  font-family: "Press Start 2P";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("assets/fonts/pressstart2p-latin.woff2") format("woff2");
}
@font-face {
  font-family: "VT323";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("assets/fonts/vt323-latin.woff2") format("woff2");
}

:root {
  color-scheme: light;
  --background: #eaedff;
  --foreground: #2f2667;
  --card: #fff8fb;
  --hot: #f164af;
  --cyan: #15c2e1;
  --lime: #75e07c;
  --sun: #fac547;
  --grape: #a170eb;
  --font-display: "Press Start 2P", "Courier New", monospace;
  --font-body: "VT323", monospace;
}
@supports (color: lab(0% 0 0)) {
  :root {
    --background: lab(93.962% 2.12416 -11.08);
    --foreground: lab(19.4589% 19.6619 -37.7595);
    --card: lab(98.1004% 3.99837 -0.753844);
    --hot: lab(62.639% 60.6604 -11.7526);
    --cyan: lab(71.8144% -32.8564 -27.4484);
    --lime: lab(81.1947% -47.6587 39.2222);
    --sun: lab(82.8172% 10.8991 67.3469);
    --grape: lab(56.69% 38.9598 -55.7984);
  }
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  border: 0 solid;
}
html {
  -webkit-text-size-adjust: 100%;
  tab-size: 4;
  line-height: 1.5;
  -webkit-tap-highlight-color: transparent;
  background: var(--background);
}
body {
  background-color: var(--background);
  font-family: var(--font-body);
  color: var(--foreground);
  font-size: 1.25rem;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
img,
video {
  display: block;
  max-width: 100%;
}
button,
input,
a {
  font: inherit;
  color: inherit;
}
button {
  background: none;
  cursor: pointer;
}
a {
  text-decoration: none;
}
[hidden] {
  display: none !important;
}

/* ---------- primitives ---------- */

.pixelated {
  image-rendering: pixelated;
}
.disp {
  font-family: var(--font-display);
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

@keyframes rainbow-shift {
  0% {
    background-position: 0%;
  }
  100% {
    background-position: 200%;
  }
}
.rainbow-text {
  background: linear-gradient(90deg, var(--hot), var(--sun), var(--lime), var(--cyan), var(--grape), var(--hot));
  background-size: 200% 100%;
  color: transparent;
  -webkit-background-clip: text;
  background-clip: text;
  animation: rainbow-shift 6s linear infinite;
}
.rainbow-btn {
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, var(--hot), var(--sun), var(--lime), var(--cyan), var(--grape), var(--hot));
  background-size: 200% 100%;
  animation: rainbow-shift 4s linear infinite;
}

@keyframes marquee {
  0% {
    transform: translateX(0);
  }
  100% {
    transform: translateX(-50%);
  }
}
.marquee-track {
  display: inline-flex;
  white-space: nowrap;
  animation: marquee 22s linear infinite;
}

@keyframes pulse {
  50% {
    opacity: 0.5;
  }
}
.pulse {
  animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes pop-in {
  0% {
    opacity: 0;
    transform: scale(0.94);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}
.pop-in {
  animation: pop-in 0.22s forwards;
}

.ps1-box {
  border: 4px solid var(--foreground);
  box-shadow: 6px 6px 0 0 var(--grape);
}
.os-window {
  border: 3px solid var(--foreground);
  box-shadow: 10px 10px 0 0 var(--grape);
  background: var(--card);
}
.compartment {
  border: 2px solid var(--foreground);
  background: var(--card);
}
.crt {
  position: relative;
}
.crt::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  mix-blend-mode: multiply;
  background: repeating-linear-gradient(rgba(0, 0, 0, 0.18) 0 1px, transparent 2px 4px);
}
@keyframes scanroll {
  0% {
    transform: translateY(-100%);
  }
  100% {
    transform: translateY(100%);
  }
}
.crt-roll::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  height: 30%;
  z-index: 2;
  pointer-events: none;
  background: linear-gradient(transparent, rgba(255, 255, 255, 0.12), transparent);
  animation: scanroll 5s linear infinite;
}

/* ---------- stage ---------- */

.stage {
  position: relative;
  display: flex;
  height: 100dvh;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: 1rem;
}
.bgvid {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.veil {
  position: absolute;
  inset: 0;
  background: color-mix(in srgb, var(--background) 35%, transparent);
}

/* gate */
.gate {
  position: absolute;
  inset: 0;
  z-index: 70;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000;
}
.gate-box {
  position: relative;
  overflow: hidden;
  padding: 1rem 2rem;
  transition: transform 0.3s;
}
.gate:hover .gate-box {
  transform: translateY(-0.25rem);
}
.gate-label {
  position: relative;
  font-family: var(--font-display);
  font-size: 1.125rem;
  color: var(--card);
  text-shadow: 2px 2px 0 #000;
}

/* intro */
.intro {
  position: absolute;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: #000;
}
.introvid {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scale(0.8);
  transition: transform 4500ms ease-in-out;
}
.introvid.zoomed {
  transform: scale(1);
}
.skip {
  position: absolute;
  right: 1.5rem;
  bottom: 1.5rem;
  z-index: 61;
  border: 2px solid var(--card);
  background: var(--hot);
  padding: 0.5rem 1rem;
  font-family: var(--font-display);
  font-size: 10px;
  color: var(--card);
}

/* ---------- window ---------- */

.shell {
  position: relative;
  z-index: 10;
  display: flex;
  max-height: 100%;
  width: 100%;
  max-width: 64rem;
  flex-direction: column;
}
.titlebar {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: space-between;
  border-bottom: 2px solid var(--foreground);
  background: var(--grape);
  padding: 0.5rem 0.75rem;
}
.tb-left {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.tb-icon {
  width: 1.25rem;
  height: 1.25rem;
  object-fit: contain;
}
.tb-name {
  font-family: var(--font-display);
  font-size: 10px;
  color: var(--card);
}
.tb-dots {
  display: flex;
  align-items: center;
  gap: 0.375rem;
}
.tb-dots span {
  width: 0.75rem;
  height: 0.75rem;
  border: 2px solid var(--card);
}
.tb-dots span:last-child {
  background: var(--hot);
}

.pane {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  /* min-height:0 on the columns makes an auto row measure 0, so the stacked mobile
     rows split the pane in half and the first column paints over the second */
  grid-auto-rows: max-content;
  min-height: 0;
  flex: 1;
  gap: 1rem;
  overflow-y: auto;
  padding: 1rem;
}
/* minmax(0,...) or the 34 thumb marquee sets a 3000px min-content on its column */
.col {
  display: flex;
  min-width: 0;
  min-height: 0;
  flex-direction: column;
  gap: 1rem;
}

/* tv */
.tv {
  position: relative;
  aspect-ratio: 1 / 1;
  width: 100%;
  flex-shrink: 0;
  overflow: hidden;
  background: var(--foreground);
}
.tvvid {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.tv-bars {
  position: absolute;
  right: 0.5rem;
  top: 0.5rem;
  z-index: 3;
  display: flex;
  width: 6rem;
  height: 0.75rem;
  border: 1px solid #000;
}
.tv-bars span {
  flex: 1;
}
.tv-rec {
  position: absolute;
  left: 0.5rem;
  top: 0.5rem;
  z-index: 3;
  display: flex;
  align-items: center;
  gap: 0.375rem;
}
.tv-dot {
  width: 0.5rem;
  height: 0.5rem;
  background: var(--hot);
}
.tv-rec-label {
  font-family: var(--font-display);
  font-size: 8px;
  color: var(--card);
  text-shadow: 1px 1px 0 #000;
}
.tv-lines {
  pointer-events: none;
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 2rem 0;
}
.tv-lines span {
  width: 100%;
  height: 1px;
  background: color-mix(in srgb, var(--card) 25%, transparent);
}
.tv-lines span:nth-child(even) {
  background: color-mix(in srgb, var(--card) 15%, transparent);
}
.tv-corner {
  pointer-events: none;
  position: absolute;
  z-index: 3;
  width: 0.75rem;
  height: 0.75rem;
  border-color: color-mix(in srgb, var(--card) 70%, transparent);
}
.tv-corner.tl {
  left: 0.25rem;
  top: 0.25rem;
  border-left: 2px solid;
  border-top: 2px solid;
}
.tv-corner.tr {
  right: 0.25rem;
  top: 0.25rem;
  border-right: 2px solid;
  border-top: 2px solid;
}
.tv-corner.bl {
  left: 0.25rem;
  bottom: 1.5rem;
  border-left: 2px solid;
  border-bottom: 2px solid;
}
.tv-corner.br {
  right: 0.25rem;
  bottom: 1.5rem;
  border-right: 2px solid;
  border-bottom: 2px solid;
}
.tv-ch {
  position: absolute;
  left: 0.5rem;
  top: 1.75rem;
  z-index: 3;
  font-family: var(--font-display);
  font-size: 7px;
  color: color-mix(in srgb, var(--card) 90%, transparent);
  text-shadow: 1px 1px 0 #000;
}
.tv-now {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 2px solid var(--foreground);
  background: var(--lime);
  padding: 0.25rem 0.75rem;
  font-family: var(--font-display);
  font-size: 9px;
  color: var(--foreground);
}
.tv-now .meter {
  letter-spacing: 0.1em;
}

/* memes button */
.memes-btn {
  position: relative;
  width: 100%;
  flex-shrink: 0;
  overflow: hidden;
  padding: 1.25rem 0;
  transition: transform 0.15s;
}
.memes-btn:hover {
  transform: translateY(-0.25rem);
}
.memes-btn span.label {
  position: relative;
  font-family: var(--font-display);
  font-size: 1.5rem;
  color: var(--card);
  text-shadow: 2px 2px 0 #000;
}

/* sneak peek */
.peek {
  position: relative;
  flex-shrink: 0;
  overflow: hidden;
  padding: 0.5rem;
}
.peek-label {
  margin-bottom: 0.5rem;
  font-family: var(--font-display);
  font-size: 8px;
  color: var(--grape);
}
.peek-clip {
  overflow: hidden;
}
.peek-track {
  gap: 0.5rem;
}
.peek-thumb {
  position: relative;
  width: 5rem;
  height: 5rem;
  flex-shrink: 0;
  overflow: hidden;
  border: 2px solid var(--foreground);
  transition: transform 0.15s;
}
.peek-thumb:hover {
  transform: translateY(-0.125rem);
}
.peek-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* hero */
.hero {
  flex-shrink: 0;
}
.hero-path {
  font-family: var(--font-display);
  font-size: 9px;
  color: var(--grape);
}
.hero h1 {
  font-family: var(--font-display);
  font-size: 3rem;
  line-height: 1;
  font-weight: 400;
}
.hero-line {
  margin-top: 0.75rem;
  font-family: var(--font-display);
  font-size: 0.875rem;
  color: var(--hot);
  text-shadow: 1px 1px 0 #000;
}

.lore {
  min-height: 0;
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
}
.lore-label {
  font-family: var(--font-display);
  font-size: 9px;
  color: var(--grape);
}
.lore p + p {
  margin-top: 0.75rem;
}
.lore p.body {
  margin-top: 0.5rem;
  font-size: 1rem;
  line-height: 1.375;
  color: var(--foreground);
}

.ca {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 1rem;
}
.ca-label {
  font-family: var(--font-display);
  font-size: 8px;
  color: var(--grape);
}
.ca-wrap {
  min-width: 0;
}
.ca-value {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 1.25rem;
  color: var(--foreground);
}
.ca-copy {
  flex-shrink: 0;
  border: 2px solid var(--foreground);
  background: var(--lime);
  padding: 0.375rem 0.75rem;
  font-family: var(--font-display);
  font-size: 8px;
  color: var(--foreground);
}

.links {
  margin-top: auto;
  display: flex;
  flex-shrink: 0;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.links a {
  display: flex;
  flex: 1;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  border: 2px solid var(--foreground);
  background: var(--card);
  padding: 0.75rem;
  font-family: var(--font-display);
  font-size: 9px;
  color: var(--foreground);
  transition: transform 0.15s;
}
.links a:hover {
  transform: translateY(-0.125rem);
}
.links .glyph {
  font-size: 1rem;
  line-height: 1;
}
.links svg,
.links img {
  width: 1rem;
  height: 1rem;
  object-fit: contain;
}

/* ticker */
.ticker {
  flex-shrink: 0;
  overflow: hidden;
  border-top: 2px solid var(--foreground);
  background: var(--foreground);
  padding: 0.375rem 0;
}
.ticker .marquee-track {
  font-family: var(--font-display);
  font-size: 9px;
  color: var(--card);
}
.ticker .run {
  display: flex;
}
.ticker .run span {
  padding: 0 1rem;
}
.ticker .slash {
  color: var(--hot);
  padding: 0 !important;
}

/* audio bar */
.audiobar {
  position: fixed;
  bottom: 1rem;
  left: 1rem;
  z-index: 70;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  border: 2px solid var(--foreground);
  background: var(--card);
  padding: 0.5rem 0.75rem;
  box-shadow: 4px 4px 0 0 var(--grape);
}
.audiobar button {
  border: 2px solid var(--foreground);
  background: var(--lime);
  padding: 0.25rem 0.5rem;
  font-family: var(--font-display);
  font-size: 8px;
  color: var(--foreground);
  transition: transform 0.15s;
}
.audiobar button:hover {
  transform: translateY(-0.125rem);
}
.audiobar .vol {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.audiobar .vol span {
  font-family: var(--font-display);
  font-size: 8px;
  color: var(--grape);
}
.audiobar input[type="range"] {
  width: 6rem;
  height: 0.375rem;
  accent-color: var(--hot);
}

/* modal */
.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  background: color-mix(in srgb, var(--foreground) 70%, transparent);
  padding: 1rem;
}
.modal-window {
  display: flex;
  max-height: 85dvh;
  width: 100%;
  max-width: 48rem;
  flex-direction: column;
}
.modal-close {
  border: 2px solid var(--card);
  background: var(--hot);
  padding: 0 0.5rem;
  font-family: var(--font-display);
  font-size: 10px;
  color: var(--card);
}
.modal-body {
  min-height: 0;
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
}
.modal-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0.75rem;
}
.modal-grid figure {
  position: relative;
  overflow: hidden;
}
.modal-grid img {
  display: block;
  width: 100%;
  height: auto;
  object-fit: contain;
}
.modal-grid figcaption {
  border-top: 2px solid var(--foreground);
  background: var(--card);
  padding: 0.25rem 0.5rem;
  font-family: var(--font-display);
  font-size: 7px;
  color: var(--foreground);
}

/* error catcher */
#boom {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 999;
  display: none;
  background: #b3003b;
  color: #fff;
  font-family: monospace;
  font-size: 12px;
  padding: 8px 12px;
  white-space: pre-wrap;
}

@media (min-width: 40rem) {
  .modal-grid {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }
}

@media (min-width: 48rem) {
  .pane {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    grid-auto-rows: minmax(0, 1fr);
  }
  .gate-label {
    font-size: 1.5rem;
  }
  .memes-btn span.label {
    font-size: 1.875rem;
  }
  .hero h1 {
    font-size: 3.75rem;
  }
  .hero-line {
    font-size: 1rem;
  }
  .lore p.body {
    font-size: 1.125rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .marquee-track,
  .rainbow-text,
  .rainbow-btn,
  .crt-roll::before,
  .pulse {
    animation: none;
  }
  .introvid {
    transition: none;
  }
}
