/* closeallgates.com is the game's main menu: the wordmark, a list of entries, the selected entry's panel,
   all behind the tape footage and scanlines. No build step. */
@font-face {
  font-family: "Droid Sans Mono";
  src: url("assets/fonts/DroidSansMono.ttf") format("truetype");
  font-display: swap;
}

:root {
  color-scheme: dark;
  --black: #030303;
  --ink: #f4f4f0;
  --dim: #a9a9a3;
  --rec: #ff2a1a;
  --fringe: 1.5px;
  --gutter: clamp(28px, 7vw, 96px);
}

* { box-sizing: border-box; }

html { background: var(--black); }

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100svh;
  background: var(--black);
  color: var(--ink);
  font: 15px/1.6 "Droid Sans Mono", ui-monospace, Menlo, Consolas, monospace;
  text-transform: uppercase;
  letter-spacing: .06em;
  /* The ghost the game draws beside its lettering. */
  text-shadow: calc(var(--fringe) * -1) 0 rgba(255, 40, 60, .5), var(--fringe) 0 rgba(40, 200, 255, .5);
  -webkit-font-smoothing: antialiased;
}

/* Everything on the page sits behind the recording effects, as in the game. */
#tape, .scanlines { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; }
#tape { z-index: 20; mix-blend-mode: screen; image-rendering: auto; opacity: .9; }
.scanlines {
  z-index: 21;
  background:
    radial-gradient(ellipse at center, transparent 50%, rgba(0, 0, 0, .7) 100%),
    repeating-linear-gradient(to bottom, rgba(0, 0, 0, .28) 0 1px, transparent 1px 3px);
}

/* The tube: a window-sized picture that the page scrolls inside, so the bend belongs to the screen, not the page. */
.defs { position: absolute; }
.crt { position: fixed; inset: 0; background: var(--black); }
.scroll { position: absolute; inset: 0; overflow-y: auto; overscroll-behavior: contain; }
.warped .crt { filter: url(#crt-warp); }
.warped body { background: #000; }

/* The viewfinder frames the window and stays put while the page scrolls. */
.hud { position: absolute; inset: clamp(10px, 2.2vmin, 30px); z-index: 5; pointer-events: none; }
.corner {
  position: absolute;
  width: clamp(26px, 6vmin, 64px);
  height: clamp(26px, 6vmin, 64px);
  border: 0 solid var(--ink);
  filter: drop-shadow(calc(var(--fringe) * -1) 0 rgba(255, 40, 60, .6)) drop-shadow(var(--fringe) 0 rgba(40, 200, 255, .6));
}
.corner.top { top: 0; border-top-width: 5px; }
.corner.bottom { bottom: 0; border-bottom-width: 5px; }
.corner.left { left: 0; border-left-width: 5px; }
.corner.right { right: 0; border-right-width: 5px; }
.rec, .counter { position: absolute; top: clamp(12px, 2.6vmin, 26px); margin: 0; max-width: none; font-size: clamp(.9rem, 2.4vmin, 1.35rem); letter-spacing: .1em; }
.rec { left: clamp(16px, 3.6vmin, 40px); display: flex; align-items: center; gap: .55em; }
.counter { right: clamp(16px, 3.6vmin, 40px); color: var(--dim); }
.dot {
  width: .8em;
  height: .8em;
  border-radius: 50%;
  background: var(--rec);
  box-shadow: 0 0 12px rgba(255, 42, 26, .7);
  animation: blink 1.4s steps(1) infinite;
}
@keyframes blink { 0%, 60% { opacity: 1; } 61%, 100% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .dot { animation: none; } }

.screen {
  min-height: 100vh;
  min-height: 100svh;
  width: min(100%, 1280px);
  margin: 0 auto;
  padding: clamp(84px, 13vh, 128px) var(--gutter) clamp(48px, 8vh, 84px);
  display: grid;
  grid-template-columns: minmax(260px, 5fr) 7fr;
  grid-template-rows: auto 1fr auto;
  grid-template-areas: "wordmark panel" "menu panel" "keys keys";
  column-gap: clamp(24px, 6vw, 96px);
  row-gap: clamp(20px, 4vh, 44px);
}

.wordmark { grid-area: wordmark; }
h1 {
  margin: 0;
  font-size: clamp(2.4rem, 6vw, 4.6rem);
  font-weight: 400;
  line-height: 1.06;
  letter-spacing: .04em;
}
h1 span { display: block; white-space: nowrap; }
.subtitle {
  margin: 1.4rem 0 0;
  color: var(--dim);
  font-size: clamp(.62rem, 1.25vw, .95rem);
  letter-spacing: .5em;
  white-space: nowrap;
}

.menu { grid-area: menu; align-self: start; }
.menu ul { margin: 0 0 1.4rem; padding: 0; list-style: none; }
.heading { margin: 0 0 .35rem; color: var(--dim); font-size: .78rem; letter-spacing: .2em; }
.menu a {
  display: block;
  padding: .42rem 0 .42rem 1.6em;
  position: relative;
  color: var(--ink);
  font-size: clamp(.95rem, 1.7vw, 1.2rem);
  text-decoration: none;
  outline: none;
}
.menu a::before { content: ">"; position: absolute; left: 0; opacity: 0; }
.menu a[aria-current="true"]::before { opacity: 1; }
.menu a[aria-current="true"] { background: rgba(255, 255, 255, .08); }
.menu a:hover, .menu a:focus-visible { background: rgba(255, 255, 255, .14); }

.panel { grid-area: panel; align-self: center; min-width: 0; text-transform: none; letter-spacing: .02em; }
.panel section { padding-block: 1.5rem; }
/* With the menu script running, one entry shows at a time, like the game's panel. */
.js .panel section[hidden] { display: none; }
h2 {
  margin: 0 0 .3rem;
  font-size: clamp(1.15rem, 2.4vw, 1.7rem);
  font-weight: 400;
  letter-spacing: .1em;
  text-transform: uppercase;
}
.hint { margin: 0 0 1.4rem; color: var(--dim); font-size: .8rem; letter-spacing: .16em; text-transform: uppercase; }
p { margin: 0 0 .9rem; max-width: 56ch; }

.action {
  display: inline-block;
  margin-top: .6rem;
  padding: .5em .2em;
  color: var(--ink);
  font-size: clamp(1rem, 2vw, 1.25rem);
  letter-spacing: .14em;
  text-decoration: none;
  text-transform: uppercase;
}
.action:hover, .action:focus-visible { background: var(--ink); color: var(--black); text-shadow: none; outline: none; }

/* A trailer has no frame: its 4:3 picture fades into the page on every side, so the screen sits inside the
   background instead of on a panel. The fade starts where the trailer's own black bars end. */
video {
  display: block;
  width: 100%;
  max-width: 820px;
  aspect-ratio: 16 / 9;
  border: 0;
  background: transparent;
  -webkit-mask-image: linear-gradient(to right, transparent 12%, #000 22%, #000 78%, transparent 88%),
                      linear-gradient(to bottom, transparent 0, #000 10%, #000 93%, transparent 100%);
  -webkit-mask-composite: source-in;
  mask-image: linear-gradient(to right, transparent 12%, #000 22%, #000 78%, transparent 88%),
              linear-gradient(to bottom, transparent 0, #000 10%, #000 93%, transparent 100%);
  mask-composite: intersect;
}

button.action { border: 0; background: none; font-family: inherit; text-shadow: inherit; cursor: pointer; }
.deck { display: flex; flex-wrap: wrap; justify-content: center; gap: .2rem 1.6rem; max-width: 820px; margin: 0; }
.js video { cursor: pointer; }

.struck { margin: 0 0 1.2rem; padding: 0; list-style: none; }
.struck li { padding: .3rem 0; color: var(--dim); text-decoration: line-through; text-decoration-color: var(--rec); text-decoration-thickness: 2px; }

.keys {
  grid-area: keys;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: .4rem 2rem;
  color: var(--dim);
  font-size: .74rem;
  letter-spacing: .14em;
}
.keys p { margin: 0; max-width: none; }

.toggle {
  display: none;
  grid-area: toggle;
  justify-self: start;
  margin: 0;
  padding: .7em 1em .7em 0;
  border: 0;
  background: none;
  color: var(--ink);
  font: inherit;
  font-size: 1rem;
  letter-spacing: .14em;
  text-shadow: inherit;
  cursor: pointer;
}

/* A narrow screen stacks the menu over its panel, and has no keys to hint at. */
@media (max-width: 820px) {
  .screen { grid-template-columns: 1fr; grid-template-rows: auto; grid-template-areas: "wordmark" "menu" "panel" "keys"; }
  .panel { align-self: start; border-top: 1px solid #2c2c2c; }
  .with-keys { display: none; }
  /* With the script running, a narrow screen starts on the chosen entry with the menu put away behind the
     camcorder's MENU button; the button opens the menu in the entry's place, and choosing an entry puts it away. */
  .js .screen { grid-template-areas: "wordmark" "toggle" "menu" "panel" "keys"; row-gap: 14px; align-content: start; }
  .js .toggle { margin-top: 1.2rem; }
  .js .keys { margin-top: 2.5rem; }
  .js .toggle { display: block; }
  .js .menu { display: none; }
  .js .panel { border-top: 0; }
  .js.menu-open .menu { display: block; }
  .js.menu-open .panel { display: none; }
}
}
