/* =========================================================
   tribute.gusti25.id — Lab Rack Tribute Terminal
   Weathered 1980s/90s industrial laboratory aesthetic.
   Functional hooks are unchanged from the original build —
   only presentation has been overhauled. See script.js for
   the DOM contract this file must not break.
   ========================================================= */

:root {
  --bg: #05080c;
  --panel: #12161c;
  --panel-2: #171c24;
  --panel-border: rgba(255, 255, 255, 0.08);
  --metal-highlight: rgba(255, 255, 255, 0.06);
  --ink: #c9d4de;
  --ink-muted: #6d7a89;
  --shadow: rgba(0, 0, 0, 0.7);

  --lcd-bg: #041209;
  --lcd-glow: #77ff00;
  --lcd-glow-soft: rgba(119, 255, 0, 0.55);
  --lcd-glow-dim: rgba(119, 255, 0, 0.12);

  --cyan: #00e5ff;
  --cyan-soft: rgba(0, 229, 255, 0.35);
  --hazard: #f5c518;

  /* ---- weathered-hardware additions ---- */
  --metal-base: #33363b;
  --metal-base-2: #232629;
  --metal-dark: #17191c;
  --metal-warm: #3a3630;      /* cast-iron/oxidized-equipment tone for the bezel */
  --metal-warm-dark: #221f1a;
  --rust: #8a4a2a;
  --rust-soft: rgba(138, 74, 42, 0.35);
  --label-tape: #d9c88f;
  --label-tape-ink: #362c17;
  --cable-body: #201d1a;
  --cable-body-2: #2b2621;
  --cable-highlight: rgba(255, 255, 255, 0.1);
  --port-metal: #4a4d52;
  --wall: #1b1d21;
  --wall-seam: rgba(0, 0, 0, 0.35);
  --spotlight: rgba(255, 248, 235, 0.5);

  --font-lcd: "VT323", "Share Tech Mono", monospace;
  --font-mono: "Share Tech Mono", "JetBrains Mono", ui-monospace, monospace;

  --ease: cubic-bezier(0.2, 0.7, 0.3, 1);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: var(--font-mono);
  padding: clamp(1.25rem, 4vw, 3rem) 1rem 3rem;
  position: relative;
  overflow-x: hidden;

  /* Dusty painted-panel lab wall: seam grid + faint grime blotches over
     a dark base, sitting under everything else. */
  background-color: var(--bg);
  background-image:
    repeating-linear-gradient(0deg, var(--wall-seam) 0 1px, transparent 1px 260px),
    repeating-linear-gradient(90deg, var(--wall-seam) 0 1px, transparent 1px 260px),
    radial-gradient(circle at 15% 20%, rgba(80, 70, 55, 0.10), transparent 32%),
    radial-gradient(circle at 82% 65%, rgba(60, 55, 45, 0.08), transparent 36%),
    radial-gradient(circle at 40% 85%, rgba(50, 45, 38, 0.07), transparent 30%),
    linear-gradient(180deg, var(--wall) 0%, #101216 100%);
}

/* Overhead spotlight cone + strong corner vignette — the room reads as
   dim, with the rack sitting in a pool of light. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse 1000px 780px at 50% -6%, var(--spotlight) 0%, rgba(255, 248, 235, 0.12) 30%, transparent 62%),
    radial-gradient(ellipse 140% 130% at 50% 45%, transparent 45%, rgba(0, 0, 0, 0.62) 100%);
}

/* film-grain noise via SVG feTurbulence filter (see index.html) */
.noise-overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  pointer-events: none;
  opacity: 0.05;
  filter: url(#noiseFilter);
  mix-blend-mode: overlay;
}

/* ---------------- Floating dust motes ---------------- */
.dust-field {
  position: fixed;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  overflow: hidden;
}
.dust-mote {
  position: absolute;
  top: 100%;
  left: var(--x, 50%);
  width: var(--size, 2px);
  height: var(--size, 2px);
  border-radius: 50%;
  background: rgba(255, 248, 235, 0.55);
  box-shadow: 0 0 3px rgba(255, 248, 235, 0.4);
  opacity: 0;
  animation: dust-drift var(--duration, 14s) linear var(--delay, 0s) infinite;
}
@keyframes dust-drift {
  0% { transform: translate(0, 0); opacity: 0; }
  8% { opacity: 0.7; }
  50% { transform: translate(var(--drift, 20px), -55vh); opacity: 0.55; }
  92% { opacity: 0.3; }
  100% { transform: translate(calc(var(--drift, 20px) * 1.6), -100vh); opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .dust-mote { display: none; }
}

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ---------------- Page chrome ---------------- */
.page-title {
  position: relative;
  z-index: 1;
  text-align: center;
  max-width: 640px;
  margin: 0 auto clamp(2rem, 5vw, 3.5rem);
}
.page-title .eyebrow {
  font-size: 0.72rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--cyan);
  margin: 0 0 0.6rem;
}
.page-title h1 {
  font-family: var(--font-lcd);
  font-weight: 400;
  font-size: clamp(1.8rem, 5vw, 2.6rem);
  letter-spacing: 0.03em;
  margin: 0;
  color: var(--ink);
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.6);
}
.page-title p {
  margin: 0.75rem auto 0;
  color: var(--ink-muted);
  font-size: 0.88rem;
  max-width: 46ch;
  line-height: 1.6;
}

/* ---------------- Rack stage layout ---------------- */
.rack-stage {
  position: relative;
  z-index: 1;
  max-width: 1180px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(128px, 190px) minmax(46px, 84px) minmax(0, 1fr) minmax(46px, 84px) minmax(128px, 190px);
  column-gap: clamp(0.4rem, 1.5vw, 0.9rem);
  align-items: stretch;
}
@media (max-width: 860px) {
  .rack-stage { grid-template-columns: 1fr; row-gap: 1.5rem; }
  .rack-column { flex-direction: row !important; flex-wrap: wrap; justify-content: center; }
  .wire-gap { display: none; }
}

.rack-column {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 0.9rem;
}

/* ---------------- Server rack units ---------------- */
.server-box {
  position: relative;
  padding: 0.7rem 1rem 0.75rem 1.05rem;
  border-radius: 3px;
  border: 1px solid #0a0b0c;

  /* brushed-metal base + fine directional streaks + panel vents, all as
     layered backgrounds so no extra markup is needed for the texture */
  background-image:
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.055) 0 1px, transparent 1px 6px),
    repeating-linear-gradient(101deg, rgba(255, 255, 255, 0.02) 0 1px, transparent 1px 3px),
    linear-gradient(175deg, var(--metal-base) 0%, var(--metal-base-2) 55%, var(--metal-dark) 100%);
  background-position: right 0.6rem top 0.4rem, 0 0, 0 0;
  background-size: 22px calc(100% - 0.8rem), auto, auto;
  background-repeat: no-repeat, repeat, no-repeat;

  box-shadow:
    inset 0 1px 0 var(--metal-highlight),
    inset 0 -10px 16px -12px rgba(0, 0, 0, 0.6),
    0 10px 22px -14px var(--shadow);
}

/* 4 corner bolts — CSS-only, layered on top of the box's own background
   so no extra elements are needed */
.server-box::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image:
    radial-gradient(circle at 35% 32%, #cfd3d8 0%, #7d8288 35%, #35383c 70%),
    radial-gradient(circle at 35% 32%, #cfd3d8 0%, #7d8288 35%, #35383c 70%),
    radial-gradient(circle at 35% 32%, #cfd3d8 0%, #7d8288 35%, #35383c 70%),
    radial-gradient(circle at 35% 32%, #cfd3d8 0%, #7d8288 35%, #35383c 70%);
  background-size: 7px 7px;
  background-repeat: no-repeat;
  background-position:
    7px 7px,
    calc(100% - 7px) 7px,
    7px calc(100% - 7px),
    calc(100% - 7px) calc(100% - 7px);
}

/* subtle corner rust + a couple of thin paint scratches, aged appearance */
.server-box.is-worn::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  background-image:
    radial-gradient(ellipse 20px 14px at 96% 4%, var(--rust-soft), transparent 70%),
    radial-gradient(ellipse 14px 20px at 3% 97%, rgba(138, 74, 42, 0.22), transparent 70%),
    linear-gradient(78deg, transparent 42%, rgba(255, 255, 255, 0.06) 43%, transparent 44%),
    linear-gradient(112deg, transparent 63%, rgba(255, 255, 255, 0.045) 64%, transparent 65%);
}

.rack-ear {
  position: absolute;
  top: 8%;
  bottom: 8%;
  width: 9px;
  background: linear-gradient(90deg, var(--metal-dark), var(--metal-base-2));
  border: 1px solid #0a0b0c;
  border-radius: 2px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.03);
}
.rack-ear::before {
  content: "";
  position: absolute;
  top: 50%; left: 50%;
  width: 4px; height: 4px;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: radial-gradient(circle at 35% 32%, #b9bdc2, #2c2f33 70%);
}
.rack-ear.left { left: -9px; }
.rack-ear.right { right: -9px; }

.box-label {
  font-size: 0.62rem;
  letter-spacing: 0.08em;
  margin: 0 0 0.55rem;
  position: relative;
  z-index: 2;
}
/* Dymo-style embossed label tape */
.label-tape {
  display: inline-block;
  padding: 0.2rem 0.5rem;
  background: linear-gradient(180deg, #e4d5a0, var(--label-tape));
  color: var(--label-tape-ink);
  text-transform: uppercase;
  border-radius: 2px;
  transform: rotate(-0.6deg);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.4) inset, 0 1px 2px rgba(0, 0, 0, 0.4);
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.35);
}

.led-row { display: flex; gap: 0.4rem; position: relative; z-index: 2; }
.led {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: #1a2620;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.4);
  transition: background 0.4s var(--ease), box-shadow 0.4s var(--ease);
}
.is-powered .led.led-cyan { background: var(--cyan); box-shadow: 0 0 6px 1px var(--cyan-soft); animation: led-blink 2.6s ease-in-out infinite; }
.is-powered .led.led-green { background: var(--lcd-glow); box-shadow: 0 0 6px 1px var(--lcd-glow-soft); animation: led-blink 3.4s ease-in-out infinite; }
.is-powered .led.led-amber { background: var(--hazard); box-shadow: 0 0 6px 1px rgba(245, 197, 24, 0.5); animation: led-blink 1.9s ease-in-out infinite; }

.is-powered .led.is-react { transition: background 0.08s linear, box-shadow 0.08s linear; }

@keyframes led-blink {
  0%, 84%, 100% { opacity: 1; }
  88%, 92% { opacity: 0.25; }
}

/* port jack on the side of each server box, facing the LCD */
.port-jack {
  position: absolute;
  top: 50%;
  width: 14px;
  height: 14px;
  transform: translateY(-50%);
  border-radius: 50%;
  background: radial-gradient(circle at 38% 34%, var(--port-metal), var(--metal-dark) 70%);
  border: 1px solid #0a0b0c;
  box-shadow: inset 0 0 0 2px #05070a, inset 0 0 3px 1px rgba(0, 0, 0, 0.8);
  z-index: 2;
}
.port-jack::after {
  content: "";
  position: absolute;
  inset: 4px;
  border-radius: 50%;
  background: #030405;
}
.rack-column.side-left .port-jack { right: -7px; }
.rack-column.side-right .port-jack { left: -7px; }

/* ---------------- Wiring / cable gap ---------------- */
.wire-gap {
  position: relative;
  height: 100%;
}
.wire-gap svg {
  width: 100%;
  height: 100%;
  display: block;
  overflow: visible;
}
.cable-body {
  fill: none;
  stroke: var(--cable-body);
  stroke-width: 7;
  stroke-linecap: round;
}
.cable-sheen {
  fill: none;
  stroke: var(--cable-highlight);
  stroke-width: 1.4;
  stroke-linecap: round;
  opacity: 0.5;
}
.cable-ribbon {
  fill: none;
  stroke: var(--cable-body-2);
  stroke-width: 9;
  stroke-linecap: butt;
  stroke-dasharray: 1.3 1.1;
}
.is-powered .cable-pulse {
  fill: none;
  stroke: var(--lcd-glow);
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-dasharray: 5 220;
  opacity: 0.85;
  animation: wire-pulse 2.6s linear infinite;
}
.cable-pulse { opacity: 0; }
@keyframes wire-pulse {
  from { stroke-dashoffset: 226; }
  to { stroke-dashoffset: 0; }
}
.cable-cap {
  fill: var(--metal-dark);
  stroke: #0a0b0c;
  stroke-width: 1;
}

/* ---------------- LCD unit ---------------- */
.lcd-unit {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 1.1rem;
  height: 100%;
}

.lcd-bezel {
  position: relative;
  width: 100%;
  padding: 1.2rem;
  border-radius: 6px;
  border: 1px solid #0a0806;

  /* heavy oxidized cast-iron test-equipment housing rather than a slick
     glass panel frame */
  background-image:
    repeating-linear-gradient(93deg, rgba(255, 255, 255, 0.025) 0 1px, transparent 1px 4px),
    radial-gradient(ellipse 40px 26px at 6% 96%, var(--rust-soft), transparent 70%),
    linear-gradient(165deg, var(--metal-warm) 0%, #2c2822 55%, var(--metal-warm-dark) 100%);
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.06),
    inset 0 -14px 22px -16px rgba(0, 0, 0, 0.75),
    0 36px 60px -28px var(--shadow);
}
.lcd-bezel::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image:
    radial-gradient(circle at 35% 32%, #cfd3d8 0%, #7d8288 35%, #35383c 70%),
    radial-gradient(circle at 35% 32%, #cfd3d8 0%, #7d8288 35%, #35383c 70%),
    radial-gradient(circle at 35% 32%, #cfd3d8 0%, #7d8288 35%, #35383c 70%),
    radial-gradient(circle at 35% 32%, #cfd3d8 0%, #7d8288 35%, #35383c 70%);
  background-size: 8px 8px;
  background-repeat: no-repeat;
  background-position:
    10px 10px,
    calc(100% - 10px) 10px,
    10px calc(100% - 10px),
    calc(100% - 10px) calc(100% - 10px);
}

.lcd-port-left, .lcd-port-right {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 0;
  z-index: 3;
}
.lcd-port-left { left: -7px; }
.lcd-port-right { right: -7px; }
.lcd-port-left .port-jack, .lcd-port-right .port-jack { left: 0; }
.lcd-port-left .port-jack:first-child, .lcd-port-right .port-jack:first-child { top: 27%; }
.lcd-port-left .port-jack:last-child, .lcd-port-right .port-jack:last-child { top: 73%; }

.model-plate {
  position: absolute;
  top: 0.6rem;
  right: 0.9rem;
  font-family: var(--font-mono);
  font-size: 0.56rem;
  letter-spacing: 0.1em;
  color: rgba(230, 224, 210, 0.4);
  text-transform: uppercase;
  z-index: 2;
}

.lcd-screen {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: flex-start;
  text-align: left;
  background:
    repeating-linear-gradient(90deg, rgba(0, 0, 0, 0.4) 0, rgba(0, 0, 0, 0.4) 1px, transparent 1px, transparent calc(100% / 40)),
    repeating-linear-gradient(0deg, rgba(0, 0, 0, 0.3) 0, rgba(0, 0, 0, 0.3) 1px, transparent 1px, transparent 50%),
    var(--lcd-bg);
  border: 3px solid #010402;
  border-radius: 3px;
  padding: 0.85rem 0.9rem;
  overflow: hidden;
  width: 100%;
  box-shadow: inset 0 3px 10px rgba(0, 0, 0, 0.7);
}

.lcd-row {
  width: 100%;
  display: flex;
  justify-content: flex-start;
  align-items: left;
  text-align: left;
  font-family: var(--font-lcd);
  font-size: clamp(1.15rem, 2.6vw, 1.55rem);
  line-height: 1.4;
  letter-spacing: 0.14em;
  color: var(--lcd-glow-dim);
  text-shadow: none;
  white-space: pre;
  min-height: 1.4em;
  transition: color 0.3s var(--ease), text-shadow 0.3s var(--ease);
}
.lcd-text { display: inline; }
.is-powered .lcd-row {
  color: var(--lcd-glow);
  text-shadow: 0 0 2px var(--lcd-glow), 0 0 10px var(--lcd-glow-soft), 0 0 20px var(--lcd-glow-dim);
}

.lcd-cursor {
  animation: cursor-blink 1s steps(1, end) infinite;
}
@keyframes cursor-blink { 50%, 100% { opacity: 0; } }

.lcd-scanlines {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(0deg, rgba(0, 0, 0, 0.18) 0px, rgba(0, 0, 0, 0.18) 1px, transparent 1px, transparent 3px);
  mix-blend-mode: multiply;
}

/* glass grime: finger smudges, thin scratches, dust speckle, plus the
   original soft glare */
.lcd-glass-glare {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image:
    radial-gradient(ellipse 90px 60px at 78% 82%, rgba(180, 175, 160, 0.10), transparent 70%),
    radial-gradient(ellipse 46px 30px at 22% 18%, rgba(180, 175, 160, 0.07), transparent 70%),
    linear-gradient(64deg, transparent 34%, rgba(255, 255, 255, 0.05) 35%, transparent 36%),
    linear-gradient(20deg, transparent 58%, rgba(255, 255, 255, 0.04) 59%, transparent 60%),
    radial-gradient(1px 1px at 14% 40%, rgba(255, 255, 255, 0.5), transparent),
    radial-gradient(1px 1px at 63% 22%, rgba(255, 255, 255, 0.4), transparent),
    radial-gradient(1px 1px at 84% 58%, rgba(255, 255, 255, 0.45), transparent),
    radial-gradient(1px 1px at 37% 71%, rgba(255, 255, 255, 0.35), transparent),
    linear-gradient(115deg, rgba(255, 255, 255, 0.05) 0%, transparent 30%);
}

.lcd-label-plate {
  margin-top: 0.7rem;
  text-align: center;
  font-size: 0.64rem;
  letter-spacing: 0.14em;
  color: var(--ink-muted);
  text-transform: uppercase;
}

/* ---------------- Power console ---------------- */
.power-console {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.7rem;
}

.power-switch {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.65rem;
}

.switch-housing {
  position: relative;
  width: 64px;
  height: 96px;
  border-radius: 8px;
  overflow: hidden;
  border: 2px solid #05080c;
  background-image:
    repeating-linear-gradient(93deg, rgba(255, 255, 255, 0.03) 0 1px, transparent 1px 4px),
    linear-gradient(160deg, #363a41, #16181c);
  box-shadow: inset 0 2px 4px rgba(255, 255, 255, 0.06), 0 12px 26px -14px var(--shadow);
}
.switch-housing::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 8px;
  background: repeating-linear-gradient(45deg, var(--hazard) 0 6px, #14171c 6px 12px);
}
.switch-slot {
  position: absolute;
  left: 50%;
  top: 22px;
  bottom: 10px;
  width: 30px;
  transform: translateX(-50%);
  background: #05070a;
  border-radius: 15px;
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.8);
}
.switch-lever {
  position: absolute;
  left: 50%;
  bottom: 12px;
  width: 22px;
  height: 46px;
  background: linear-gradient(180deg, #545c6b, #22262e);
  border-radius: 6px;
  transform-origin: bottom center;
  transform: translateX(-50%) rotate(28deg);
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.6);
}
.switch-lever::after {
  content: "";
  position: absolute;
  top: -7px; left: 50%;
  transform: translateX(-50%);
  width: 16px; height: 16px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #7a828f, #23262c);
}
.power-switch.is-on .switch-lever { transform: translateX(-50%) rotate(-6deg); }

.switch-status-led {
  position: absolute;
  right: 8px; bottom: 10px;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: #3a0f0f;
  box-shadow: 0 0 4px rgba(220, 60, 60, 0.4);
}
.power-switch.is-on .switch-status-led {
  background: var(--lcd-glow);
  box-shadow: 0 0 8px 2px var(--lcd-glow-soft);
}

.switch-label {
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  color: var(--ink-muted);
  text-transform: uppercase;
}
.switch-sublabel {
  font-size: 0.64rem;
  letter-spacing: 0.08em;
  color: var(--ink-muted);
  opacity: 0.7;
}

/* ---------------- Footer ---------------- */
footer {
  position: relative;
  z-index: 1;
  text-align: center;
  margin-top: 3rem;
  font-size: 0.72rem;
  color: var(--ink-muted);
}

/* ---------------- Focus & motion ---------------- */
button:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 4px;
  border-radius: 8px;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
  .led { opacity: 1 !important; }
  .lcd-cursor { opacity: 1; animation: none; }
  .switch-lever { transition: none; }
}

@media (max-width: 420px) {
  .rack-ear { display: none; }
}
