:root{
  --bg: #0a0a0a;
  --ink: #f4f4f0;
}

*{ box-sizing: border-box; }

html, body{
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  background: var(--bg);
  overflow: hidden;
  color: var(--ink);
  touch-action: none; /* the finger drives the cursor (js/main.js), no panning/zoom */
}

#bg{
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

body.no-webgl #bg{ display: none; }

.stage{
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

/* every label is a framed box in a ~2005 web style, kept monochrome and
   crisp: Verdana/Tahoma at a small size with a touch of tracking, a 1px
   frame with an inner hairline rule (double-rule look), a hard 2px offset
   shadow, and a glossy "Web 2.0" highlight on the top half of the box */
.label{
  position: absolute;
  pointer-events: none;
  color: var(--ink);
  text-decoration: none;
  line-height: 1.2;
  user-select: none;
  transition: opacity 0.2s ease;
  background-color: var(--bg);
  border: 1px solid var(--ink);
  box-shadow:
    inset 0 0 0 1px var(--bg),
    inset 0 0 0 2px rgba(244, 244, 240, 0.28),
    2px 2px 0 rgba(244, 244, 240, 0.22);
  padding: 4px 26px 5px 8px;
  font-family: Verdana, Geneva, Tahoma, sans-serif;
  font-weight: 400;
  font-size: clamp(11px, 0.85vw, 13px);
  letter-spacing: 0.04em;
  white-space: nowrap;
  -webkit-touch-callout: none;          /* no iOS link preview on long press */
  -webkit-tap-highlight-color: transparent;
}
/* the classic "»" link bullet */
a.label::before{
  content: "\00BB\00A0";
  opacity: 0.55;
}
.label--name{
  font-weight: 700;
  letter-spacing: 0.08em;
}

a.label{
  pointer-events: auto;
}

/* glossy "Web 2.0" highlight on the top half of the box */
.label{
  background-image: linear-gradient(to bottom, rgba(255, 255, 255, 0.13), rgba(255, 255, 255, 0.05) 50%, transparent 50%);
  background-repeat: no-repeat;
  isolation: isolate; /* own stacking context, so the smear ghost (::after,
                         z-index -1) sits on the box but under the text */
}

/* 2005 "selected" state on hover: the box flips to a light fill with dark
   text (snappy, not a slow fade), a dotted rule appears inside the frame,
   and the » bullet nudges right. Hovering a label also starts its second
   stage animation (SSA) in js/main.js. */
.label{
  transition: opacity 0.2s ease, background-color 0.08s linear, color 0.08s linear;
  outline: 1px dotted transparent;
  outline-offset: -5px;
}
.label:hover,
.label.is-hover{
  background-color: var(--ink);
  color: var(--bg);
  outline-color: var(--bg);
}
a.label::before{
  display: inline-block;
  transition: transform 0.12s steps(3, end);
}
a.label:hover::before,
a.label.is-hover::before{
  transform: translateX(3px);
}
/* the name isn't a link but gets the same hover (selection + its SSA);
   clicking it toggles an inversion of the whole page (see js/main.js) */
.label--name{
  pointer-events: auto;
  cursor: pointer;
}
html{
  transition: filter 0.18s ease;
}
html.invert{
  filter: invert(1);
}

.label--name{
  left: 5px;
  top: 50%;
  transform: translateY(-50%);
}

.label--works{
  top: 5px;
  left: 50%;
  transform: translateX(-50%);
}

.label--contacts{
  right: 5px;
  top: 50%;
  transform: translateY(-50%);
}

.label--about{
  bottom: 5px;
  left: 50%;
  transform: translateX(-50%);
}

/* name SSA: smear of the other labels streaming away from the name,
   matching the WebGL feedback smear on the lines. --smear (0..1) is set on
   <body> and each label's direction away from the name (--sx, --sy, a unit
   vector) on the label itself, both from js/main.js; a stack of fading,
   slightly blurred copies trails along it and collapses under the text
   when --smear is 0. */
.label--works,
.label--contacts,
.label--about{
  --k: calc(var(--smear, 0) * 1px);
  text-shadow:
    calc(var(--k) * var(--sx, 1) * 4)  calc(var(--k) * var(--sy, 0) * 4)  calc(var(--k) * 1) rgba(244, 244, 240, 0.55),
    calc(var(--k) * var(--sx, 1) * 9)  calc(var(--k) * var(--sy, 0) * 9)  calc(var(--k) * 2) rgba(244, 244, 240, 0.38),
    calc(var(--k) * var(--sx, 1) * 16) calc(var(--k) * var(--sy, 0) * 16) calc(var(--k) * 3) rgba(244, 244, 240, 0.24),
    calc(var(--k) * var(--sx, 1) * 25) calc(var(--k) * var(--sy, 0) * 25) calc(var(--k) * 4) rgba(244, 244, 240, 0.14),
    calc(var(--k) * var(--sx, 1) * 37) calc(var(--k) * var(--sy, 0) * 37) calc(var(--k) * 5) rgba(244, 244, 240, 0.07),
    calc(var(--k) * var(--sx, 1) * 52) calc(var(--k) * var(--sy, 0) * 52) calc(var(--k) * 6) rgba(244, 244, 240, 0.03);
}

/* name SSA on the frames too: a ghost copy of each label's frame (just the
   1px border, transparent inside) multiplied by a chain of drop-shadows
   along the same direction as the text smear. Each drop-shadow copies
   everything before it, so 3 of them give 8 fading frames trailing away
   from the name, like the feedback trail on the lines. Invisible and
   collapsed onto the real frame when --smear is 0. */
.label--works::after,
.label--contacts::after,
.label--about::after{
  content: "";
  position: absolute;
  inset: -1px;
  border: 1px solid var(--ink);
  pointer-events: none;
  z-index: -1;
  opacity: var(--smear, 0);
  filter:
    drop-shadow(calc(var(--k) * var(--sx, 1) * 9)  calc(var(--k) * var(--sy, 0) * 9)  0 rgba(244, 244, 240, 0.6))
    drop-shadow(calc(var(--k) * var(--sx, 1) * 19) calc(var(--k) * var(--sy, 0) * 19) calc(var(--k) * 1) rgba(244, 244, 240, 0.45))
    drop-shadow(calc(var(--k) * var(--sx, 1) * 41) calc(var(--k) * var(--sy, 0) * 41) calc(var(--k) * 2) rgba(244, 244, 240, 0.3));
}

/* first-visit tip on touch screens (js/main.js adds .is-shown): a quieter
   cousin of the label boxes — thin frame, dim small text, no » bullet —
   centred low in the free space above "about". A fingertip dot steps left
   and right in front of the text like an old LED. Fades out once the
   finger starts dragging. */
.hint{
  position: absolute;
  left: 50%;
  top: 72%;
  transform: translate(-50%, -50%);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 9px 5px;
  font-family: Verdana, Geneva, Tahoma, sans-serif;
  font-size: 10px;
  letter-spacing: 0.06em;
  white-space: nowrap;
  color: rgba(244, 244, 240, 0.6);
  background-color: var(--bg);
  border: 1px solid rgba(244, 244, 240, 0.35);
  box-shadow: inset 0 0 0 1px var(--bg), inset 0 0 0 2px rgba(244, 244, 240, 0.1);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.6s ease;
}
.hint.is-shown{ opacity: 1; }
.hint.is-gone{ opacity: 0; transition-duration: 0.3s; }
.hint-dot{
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: rgba(244, 244, 240, 0.8);
  box-shadow: 0 0 0 1px var(--bg), 0 0 0 2px rgba(244, 244, 240, 0.3);
  animation: hint-drag 1.6s steps(1, end) infinite;
}
@keyframes hint-drag{
  0%{ transform: translateX(-3px); }
  25%{ transform: translateX(0); }
  50%{ transform: translateX(3px); }
  75%{ transform: translateX(0); }
}
