/* ==========================================================================
   mrstevensilva.com
   Deliberately built like it is 1999. Everything is hand written, there is no
   build step, and every asset is local.
   ========================================================================== */

:root {
  --green:  #39ff14;
  --pink:   #ff3cf0;
  --cyan:   #00f0ff;
  --yellow: #ffe600;
  --purple: #9d6bff;
  --panel:  rgba(8, 10, 38, 0.88);
  --bevel:  #6a6aff;
}

* { box-sizing: border-box; }

/* Steven's own dinosaur, imported from source-art/dino.gif by
   tools/import-cursor.js. Static fallback here; when JS is available the
   animated sprite in #dino takes over. */
html {
  cursor: url('../img/cursor-custom.png') 0 0, auto;
}

body {
  margin: 0;
  padding: 0 10px 40px;
  background: #05050f url('../img/bg-stars.png') repeat fixed;
  color: #e8e8ff;
  font-family: 'Comic Sans MS', 'Chalkboard SE', 'Trebuchet MS', cursive, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  overflow-x: hidden;
}

a, button, summary, .btn88, #buddy .x {
  cursor: url('../img/cursor-hand.png') 5 0, pointer;
}

a { color: var(--cyan); text-decoration: underline; }
a:visited { color: var(--purple); }
a:hover { color: var(--yellow); background: #221; }

/* ------------------------------------------------------------- shared bits */
.wrap { max-width: 860px; margin: 0 auto; }

.panel {
  background: var(--panel);
  border: 3px outset var(--bevel);
  padding: 14px 18px;
  margin: 14px 0;
}

.panel h2 {
  margin: 0 0 10px;
  font-size: 22px;
  color: var(--yellow);
  text-shadow: 2px 2px 0 #a00060, 0 0 12px rgba(255, 230, 0, .5);
  border-bottom: 2px dashed var(--pink);
  padding-bottom: 6px;
}

.panel h3 {
  color: var(--green);
  margin: 18px 0 4px;
  font-size: 17px;
}

hr.fancy {
  height: 6px;
  border: 0;
  margin: 18px 0;
  background: linear-gradient(90deg, var(--pink), var(--yellow), var(--green), var(--cyan), var(--pink));
  background-size: 300% 100%;
  animation: slide 4s linear infinite;
}

@keyframes slide { to { background-position: 300% 0; } }

.blink { animation: blinker 1.1s step-end infinite; }
@keyframes blinker { 50% { opacity: 0; } }

.rainbow {
  background: linear-gradient(90deg, #ff0040, #ff8c00, #ffe600, #39ff14, #00f0ff, #9d6bff, #ff0040);
  background-size: 250% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: slide 5s linear infinite;
  font-weight: bold;
}

/* Warp lanes replace the old hazard stripes. A ship crosses each one with a
   trail behind it; drawn on a canvas by site.js. */
.warp {
  display: block;
  width: 100%;
  height: 60px;
  margin: 6px 0;
  border-top: 2px solid #1b1b46;
  border-bottom: 2px solid #1b1b46;
  background: linear-gradient(180deg,
    rgba(4, 6, 24, .75) 0%, rgba(10, 14, 48, .55) 50%, rgba(4, 6, 24, .75) 100%);
}
@media (max-width: 700px) { .warp { height: 46px; } }

marquee { font-weight: bold; color: var(--green); }

/* The site stays hidden until the visitor clicks ENTER. That click is also the
   user gesture browsers require before Web Audio is allowed to make a sound.
   The corner furniture sits outside #site, so it needs the same gate. */
#site { display: none; }
body[data-entered="1"] #site { display: block; }
body[data-entered="1"] #splash { display: none; }
body:not([data-entered="1"]) #buddy,
body:not([data-entered="1"]) #geo { display: none; }

/* ------------------------------------------------------------ big screens
   A 5K display at 100% OS scaling renders all of this at postage-stamp size.
   Scale the content up rather than making people reach for browser zoom.
   Only #site and the corner widgets are scaled. The trail canvas and the cursor
   sprite are deliberately left alone: they are positioned from pointer
   coordinates, and scaling their coordinate space would put them out of
   register with the mouse. They get sized up separately instead. */
:root { --dino-scale: 1; }

@media (min-width: 1500px) {
  #site { zoom: 1.15; }
  #buddy, #geo { zoom: 1.15; }
  :root { --dino-scale: 1.15; }
}

@media (min-width: 2400px) {
  #site { zoom: 1.25; }
  #buddy, #geo { zoom: 1.25; }
  :root { --dino-scale: 1.25; }
}

/* --------------------------------------------------- cover page logotype
   Chunky orange block letters with a deep extrude and a baseline bar, in the
   spirit of an early-80s kids TV title card. Arial Black is the closest heavy
   face that is actually installed everywhere, so no web font is needed. */
.rr {
  position: relative;
  z-index: 0;                       /* own stacking context for the extrude */
  display: inline-block;
  font-family: 'Arial Black', 'Arial Bold', Gadget, Impact, sans-serif;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: -0.015em;
  line-height: 1.02;
  padding: 0 .06em .12em;
  color: #F79A2E;                   /* readable even if clipping is unsupported */
}

/* the 3D extrude, stacked one pixel at a time behind the face */
.rr::before {
  content: attr(data-text);
  position: absolute;
  left: .06em;
  top: 0;
  z-index: -1;
  color: #C2511300;
  text-shadow:
    1px 1px 0 #C25214, 2px 2px 0 #BC4D11, 3px 3px 0 #B5480F,
    4px 4px 0 #AE430D, 5px 5px 0 #A73E0B, 6px 6px 0 #A03909,
    7px 7px 0 #993407, 8px 8px 0 #922F06,
    10px 12px 14px rgba(0, 0, 0, .45);
}

/* the bar the letters sit on */
.rr::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: .1em;
  z-index: -1;
  background: linear-gradient(180deg, #FBA43A, #E9701A);
  box-shadow: 4px 5px 0 #A73E0B, 8px 9px 12px rgba(0, 0, 0, .4);
}

@supports ((-webkit-background-clip: text) or (background-clip: text)) {
  .rr {
    background: linear-gradient(180deg, #FFD489 0%, #FBA83E 36%, #F4881F 66%, #E86E19 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
  }
}

/* ------------------------------------------------------ rainbow trail
   A painted ribbon that follows the pointer, drawn on a canvas. Sits under the
   CRT so the scanlines fall across it, and under the cursor sprite. */
#trail {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 9990;
}

/* ---------------------------------------------------------------- splash */
.splash {
  /* body carries 40px of bottom padding, so a flat 100vh here pushes the cover
     page just past the viewport and adds a scrollbar with nothing below it */
  min-height: calc(100vh - 40px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 6px;
}

.splash h1 {
  font-size: clamp(30px, 7vw, 60px);
  margin: 0;
  letter-spacing: 2px;
  text-shadow: 3px 3px 0 #b0008a, 6px 6px 14px rgba(0, 0, 0, .8);
}

/* `.splash h1` outranks `.rr` on specificity, so its magenta shadow and letter
   spacing would stomp the logotype. Put them back. */
.splash h1.rr {
  font-size: clamp(34px, 8.5vw, 74px);
  letter-spacing: -0.015em;
  text-shadow: none;
}

.splash .sub { color: var(--cyan); font-size: 17px; margin: 4px 0 26px; }

.enter {
  display: inline-block;
  padding: 16px 46px;
  font-size: 27px;
  font-weight: bold;
  color: #000 !important;
  background: linear-gradient(180deg, var(--yellow), #ff9d00);
  border: 4px outset var(--yellow);
  text-decoration: none;
  text-shadow: 1px 1px 0 rgba(255, 255, 255, .6);
  animation: throb 1s ease-in-out infinite alternate;
}
.enter:hover { background: linear-gradient(180deg, #fff, var(--yellow)); }
.enter:active { border-style: inset; }
@keyframes throb { to { transform: scale(1.07); } }

.splash .warn {
  margin-top: 22px;
  font-size: 13px;
  color: #ffb3f5;
  max-width: 420px;
}

/* ------------------------------------------------------------------ header */
.masthead {
  text-align: center;
  padding: 18px 10px 10px;
}

.masthead h1 {
  margin: 0;
  font-size: clamp(26px, 6vw, 46px);
  letter-spacing: 1px;
  text-shadow: 3px 3px 0 #b0008a, 0 0 20px rgba(157, 107, 255, .7);
}

.masthead .tag { color: var(--green); font-size: 15px; margin-top: 2px; }

/* --------------------------------------------------------------- layout */
.cols { display: flex; gap: 14px; align-items: flex-start; }
.side { width: 190px; flex: 0 0 190px; }
.main { flex: 1 1 auto; min-width: 0; }

@media (max-width: 700px) {
  .cols { flex-direction: column; }
  .side { width: 100%; flex: 1 1 auto; }
}

/* ------------------------------------------------------------------- nav */
.nav { list-style: none; margin: 0; padding: 0; }
.nav li { margin: 0 0 7px; }

.nav a {
  display: block;
  padding: 8px 10px;
  background: linear-gradient(180deg, #3a2a6e, #1d1440);
  border: 2px outset var(--bevel);
  color: var(--yellow);
  text-decoration: none;
  font-weight: bold;
  font-size: 15px;
}
.nav a:hover { background: linear-gradient(180deg, #6a4ab8, #3a2a6e); color: #fff; }
.nav a.here { border-style: inset; background: #120c2c; color: var(--green); }
.nav a.here::before { content: '> '; }

/* a parent whose sub-page is the one being shown */
.nav a.open { border-style: inset; color: #d8c4ff; }

/* ---- sub-menu, drawn as a little tree branch ---- */
.nav .subnav { list-style: none; margin: 5px 0 0; padding: 0 0 0 12px; }
.nav .subnav li { margin: 0; }
.nav .subnav a {
  font-size: 13px;
  padding: 5px 8px;
  border-width: 1px;
  background: linear-gradient(180deg, #2a1e52, #150e30);
}
/* the branch stays put whether or not it is the active page, so the tree
   does not jump sideways when you click it */
.nav .subnav a::before { content: '\2514\2500\00a0'; opacity: .6; }
.nav .subnav a.here::before { opacity: 1; }

/* --------------------------------------------------------------- jukebox */
.jukebox {
  background: #0a0a18;
  border: 3px outset #555;
  padding: 8px;
  margin: 0 0 14px;
  font-family: 'Courier New', monospace;
  font-size: 12px;
}

.jukebox .lcd {
  background: #04140a;
  border: 2px inset #2a2a2a;
  color: var(--green);
  padding: 4px 6px;
  margin-bottom: 6px;
  min-height: 20px;
  overflow: hidden;
  white-space: nowrap;
  text-shadow: 0 0 6px rgba(57, 255, 20, .7);
}

.jukebox canvas {
  display: block;
  width: 100%;
  height: 34px;
  background: #04140a;
  border: 2px inset #2a2a2a;
  margin-bottom: 6px;
  image-rendering: pixelated;
}

.jukebox .row { display: flex; gap: 4px; align-items: center; }

.jukebox button {
  flex: 1 1 auto;
  font-family: inherit;
  font-size: 12px;
  font-weight: bold;
  padding: 5px 0;
  background: linear-gradient(180deg, #d8d8d8, #9a9a9a);
  border: 2px outset #e8e8e8;
  color: #000;
}
.jukebox button:hover { background: linear-gradient(180deg, #fff, #bbb); }
.jukebox button:active { border-style: inset; }

.jukebox input[type=range] { width: 100%; margin-top: 6px; }

/* ------------------------------------------------------------ hit counter */
.counter {
  display: inline-flex;
  gap: 2px;
  padding: 4px;
  background: #000;
  border: 2px inset #444;
}

.counter span {
  font-family: 'Courier New', monospace;
  font-size: 20px;
  font-weight: bold;
  color: var(--green);
  background: #061a0c;
  padding: 1px 4px;
  border: 1px solid #1c4a26;
  text-shadow: 0 0 7px rgba(57, 255, 20, .8);
}

/* --------------------------------------------------------------- content */
.main p { margin: 8px 0; }

ul.spaced li { margin-bottom: 7px; }

.card {
  border: 2px ridge var(--purple);
  background: rgba(30, 12, 60, .6);
  padding: 10px 14px;
  margin: 10px 0;
}
.card .when { color: var(--cyan); font-size: 13px; }

table.retro {
  width: 100%;
  border-collapse: collapse;
  margin: 10px 0;
  font-size: 15px;
}
table.retro th, table.retro td {
  border: 2px groove var(--bevel);
  padding: 6px 9px;
  text-align: left;
}
table.retro th { background: #2a1a5e; color: var(--yellow); }
table.retro td { background: rgba(0, 0, 0, .35); }

/* content that Steven still needs to replace */
.todo {
  background: #3a2a00;
  border: 2px dashed var(--yellow);
  color: var(--yellow);
  padding: 8px 12px;
  margin: 10px 0;
  font-size: 14px;
}
.todo::before { content: '\270E  EDIT ME: '; font-weight: bold; }

/* ------------------------------------------------------------ gaming eras */
.era {
  position: relative;
  border-left: 3px solid var(--purple);
  background: rgba(30, 12, 60, .42);
  padding: 10px 14px 10px 46px;
  margin: 14px 0;
}
.era-tag {
  position: absolute;
  left: -17px;
  top: 12px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: linear-gradient(180deg, #6a4ab8, #34206e);
  border: 2px solid var(--bevel);
  color: #fff;
  font-weight: bold;
  font-size: 15px;
  line-height: 27px;
  text-align: center;
}
.era h3 { margin-top: 2px; }
.era-games {
  color: var(--cyan);
  font-weight: bold;
  font-size: 14px;
  margin: 2px 0 8px !important;
}

/* ---------------------------------------------------------- 88x31 buttons */
.buttons { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin: 10px 0; }

.btn88 {
  width: 88px;
  height: 31px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-family: Verdana, Geneva, sans-serif;
  font-size: 9px;
  font-weight: bold;
  line-height: 1.1;
  border: 1px outset #999;
  text-decoration: none;
  padding: 2px;
  color: #fff;
}
.btn88:hover { border-style: inset; color: #fff; }

/* ------------------------------------------------------------------ footer */
.footer {
  text-align: center;
  font-size: 13px;
  color: #b9b9e8;
  margin-top: 18px;
}
.footer a { color: var(--pink); }

/* ---------------------------------------------------------- glitter text
   The specks jump to a new position four times a second, which is how the
   old glitter GIFs read as twinkling. */
/* Plain readable gold first. Clipping the text out of a background is only
   applied where the browser actually supports it, otherwise `color:transparent`
   would make the title disappear completely. */
.glitter {
  font-weight: bold;
  color: #ffd83a;
  text-shadow: 2px 2px 0 rgba(120, 0, 90, .85);
}

@supports ((-webkit-background-clip: text) or (background-clip: text)) {
  .glitter {
    background-image:
      url('../img/glitter.png'),
      linear-gradient(180deg, #fffdf0 0%, #ffe24a 42%, #ffa100 78%, #ff5ecb 100%);
    background-size: 128px 128px, 100% 100%;
    background-repeat: repeat, no-repeat;
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    text-shadow: none;
    filter: drop-shadow(2px 2px 0 rgba(120, 0, 90, .85));
    animation: glint .34s steps(4) infinite;
  }
}
@keyframes glint { to { background-position: 128px 0, 0 0; } }

/* little animated stars you can drop beside any text */
.twinkle {
  display: inline-block;
  width: 1.05em;
  height: 1.05em;
  vertical-align: -0.15em;
  background: url('../img/sparkle.png') no-repeat center/contain;
  animation: twk 1.15s ease-in-out infinite;
}
.twinkle.b { animation-delay: .38s; background-image: url('../img/sparkle6.png'); }
.twinkle.c { animation-delay: .76s; }
@keyframes twk {
  0%, 100% { transform: scale(.5) rotate(0deg);    opacity: .5; }
  50%      { transform: scale(1.15) rotate(100deg); opacity: 1; }
}

/* ------------------------------------------------------ desktop assistant */
#buddy {
  position: fixed;
  right: 12px;
  bottom: 12px;
  z-index: 9998;
  display: flex;
  align-items: flex-end;
  gap: 6px;
  font-family: 'MS Sans Serif', Tahoma, Verdana, sans-serif;
}

#buddy .ape {
  width: 72px;
  height: 86px;
  flex: 0 0 72px;
  background: url('../img/buddy.png') 0 0 / auto 100% no-repeat;
  animation: apeIdle .78s steps(6) infinite;
  filter: drop-shadow(2px 3px 4px rgba(0, 0, 0, .6));
}
@keyframes apeIdle { to { background-position: -432px 0; } }

#buddy .bubble {
  position: relative;
  max-width: 220px;
  background: #fffbe6;
  color: #111;
  border: 2px solid #000;
  border-radius: 12px;
  padding: 9px 24px 9px 11px;
  font-size: 12px;
  line-height: 1.45;
  box-shadow: 3px 3px 0 rgba(0, 0, 0, .5);
  margin-bottom: 14px;
}
/* tail pointing at the ape */
#buddy .bubble::after {
  content: '';
  position: absolute;
  right: -9px;
  bottom: 12px;
  border: 8px solid transparent;
  border-left-color: #000;
}
#buddy .bubble::before {
  content: '';
  position: absolute;
  right: -5px;
  bottom: 14px;
  border: 6px solid transparent;
  border-left-color: #fffbe6;
  z-index: 1;
}

#buddy .x {
  position: absolute;
  top: 3px;
  right: 4px;
  width: 16px;
  height: 16px;
  line-height: 13px;
  text-align: center;
  font-size: 11px;
  font-weight: bold;
  background: linear-gradient(180deg, #e8e8e8, #a8a8a8);
  border: 1px outset #eee;
  color: #000;
}
#buddy .x:active { border-style: inset; }

@media (max-width: 560px) {
  #buddy .bubble { max-width: 150px; font-size: 11px; }
  #buddy .ape { width: 54px; height: 64px; flex-basis: 54px; }
  @keyframes apeIdle { to { background-position: -324px 0; } }
}

/* ------------------------------------------------------- corner watermark */
#geo {
  position: fixed;
  left: 12px;
  bottom: 12px;
  z-index: 9997;
  background: rgba(0, 0, 20, .82);
  border: 2px outset #5b5bd6;
  padding: 5px 9px;
  font-family: Verdana, Geneva, sans-serif;
  font-size: 9px;
  letter-spacing: .5px;
  color: #cfe3ff;
  text-align: center;
  line-height: 1.35;
  text-shadow: 1px 1px 0 #000;
  pointer-events: none;
}
#geo b {
  display: block;
  font-size: 15px;
  letter-spacing: 0;
  color: #7cf7ff;
}
@supports ((-webkit-background-clip: text) or (background-clip: text)) {
  #geo b {
    background: linear-gradient(180deg, #7cf7ff, #2f6bff);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
  }
}
#geo .blink { color: #ffe600; }

@media (max-width: 620px) { #geo { display: none; } }

/* ------------------------------------------------------------ CRT overlay
   Sits above everything and ignores the mouse. Off by default until site.js
   restores the saved preference, so it can never trap the page. */
#crt {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 10000;
  display: none;
}
body.crt #crt { display: block; animation: crtflick 3.4s steps(14) infinite; }

#crt .lines {
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    0deg,
    rgba(0, 0, 0, .17) 0px, rgba(0, 0, 0, .17) 1px,
    rgba(0, 0, 0, 0)   1px, rgba(0, 0, 0, 0)   3px
  );
}
#crt .glow {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at 50% 45%,
      rgba(150, 210, 255, .05) 0%,
      rgba(0, 0, 0, 0) 48%,
      rgba(0, 0, 0, .14) 80%,
      rgba(0, 0, 0, .32) 100%);
}
@keyframes crtflick { 0%, 100% { opacity: 1; } 45% { opacity: .93; } 70% { opacity: .97; } }

.crt-toggle {
  width: 100%;
  margin-top: 8px;
  font-family: 'Courier New', monospace;
  font-size: 11px;
  font-weight: bold;
  padding: 4px 0;
  background: linear-gradient(180deg, #d8d8d8, #9a9a9a);
  border: 2px outset #e8e8e8;
  color: #000;
}
.crt-toggle:active { border-style: inset; }

/* --------------------------------------------------------- animated cursor
   CSS cursors cannot animate, so the real pointer is hidden and this sprite
   follows it instead. Only ever active when site.js says so. */
html.dino-cursor, html.dino-cursor * { cursor: none !important; }

#dino {
  position: fixed;
  top: 0;
  left: 0;
  width: calc(32px * var(--dino-scale));
  height: calc(31px * var(--dino-scale));
  display: none;
  pointer-events: none;
  z-index: 10001;
  background: url('../img/dino-custom.png') 0 0 / auto 100% no-repeat;
  image-rendering: pixelated;
  filter: drop-shadow(1px 2px 2px rgba(0, 0, 0, .55));
  animation: dinoStep .6s steps(6) infinite;
  /* keep this on its own compositor layer so following the pointer is a
     composite rather than a layout and paint on every move */
  will-change: transform;
}
html.dino-cursor #dino { display: block; }
/* 6 frames straight from the GIF. The sheet is sized by height, so one frame is
   always exactly the element's width and the end offset tracks the scale. */
@keyframes dinoStep { to { background-position: calc(-192px * var(--dino-scale)) 0; } }

/* perks up over anything clickable, since we lose the pointing hand */
#dino.hot {
  animation-duration: .2s;
  transform-origin: 20% 20%;
  filter: drop-shadow(0 0 5px #fff) drop-shadow(1px 2px 2px rgba(0, 0, 0, .55));
}

/* ----------------------------------------------------------------- snow
   Sits behind the ribbon and ignores the mouse like the other overlays. */
#snow {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 9985;
  display: none;
}
body.snow-on #snow { display: block; }

/* Respect the OS setting. The site is a joke, motion sickness is not.
   Everything still renders, it just holds still: the ape sits on frame one and
   the glitter text keeps its gradient without the twinkle. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
  /* Hidden by default when the OS asks for reduced motion, but the sidebar
     toggle is an explicit opt-in and wins over the hint. */
  body:not(.trail-on) #trail { display: none; }
  #buddy .ape { animation: none; background-position: 0 0; }
  .twinkle { animation: none; opacity: 1; transform: none; }
  /* scanlines stay, the flicker does not */
  body.crt #crt { animation: none; opacity: 1; }
}
