html {
  scroll-behavior: smooth;
}
body {
  background-color: #0a0a0a;
}

/* Scroll-reveal */
[data-reveal] {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.7s ease, transform 0.7s ease;
}
[data-reveal].is-in {
  opacity: 1;
  transform: none;
}

/* Green glow on the wordmark */
.grow-glow {
  filter: drop-shadow(0 0 3px rgba(22, 196, 127, 0.7)) drop-shadow(0 0 8px rgba(22, 196, 127, 0.35));
  transition: filter 0.3s ease;
}
.grow-glow:hover {
  filter: drop-shadow(0 0 5px #16c47f) drop-shadow(0 0 14px rgba(22, 196, 127, 0.6));
}

/* Card hover edge */
.svc-card {
  transition: border-color 0.3s ease, transform 0.3s ease, background-color 0.3s ease;
}
.svc-card:hover {
  border-color: rgba(22, 196, 127, 0.55);
  transform: translateY(-4px);
  background-color: #1a1a1a;
}

/* Visible keyboard focus */
a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible {
  outline: 2px solid #22e58f;
  outline-offset: 2px;
}

/* Top scroll-progress bar */
#scroll-bar {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  width: 0;
  background: #22e58f;
  z-index: 60;
  transition: width 0.1s linear;
  box-shadow: 0 0 8px rgba(34, 229, 143, 0.6);
}

/* Staggered cards */
[data-reveal].reveal-card {
  transform: translateY(30px) scale(0.96);
}
#svc-grid .svc-card:nth-child(1) {
  transition-delay: 0.05s;
}
#svc-grid .svc-card:nth-child(2) {
  transition-delay: 0.18s;
}
#svc-grid .svc-card:nth-child(3) {
  transition-delay: 0.31s;
}
#svc-grid .svc-card:nth-child(4) {
  transition-delay: 0.44s;
}

/* Drawing underline on accent words */
.uline {
  position: relative;
}
.uline::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: -0.06em;
  height: 0.08em;
  width: 0;
  background: #16c47f;
  transition: width 0.7s ease 0.25s;
}
.is-in .uline::after,
.is-in.uline::after {
  width: 100%;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  [data-reveal] {
    opacity: 1;
    transform: none;
    transition: none;
  }
  [data-reveal].reveal-card {
    transform: none;
  }
  .uline::after,
  #scroll-bar {
    transition: none;
  }
  .crt-scanlines,
  .crt-led {
    animation: none;
  }
}

/* Slowly rotating wireframe polyhedron, behind all content */
#glyph-bg {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}

/* ---------- CRT loading overlay (once per session) ---------- */
#crt-loader {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: #050505;
  transition: opacity 0.5s ease;
}
html.loaded #crt-loader {
  display: none;
}
#crt-loader.is-off {
  opacity: 0;
  pointer-events: none;
}

.crt {
  width: min(440px, 86vw);
  border-radius: 22px;
  padding: 22px 22px 0;
  background: linear-gradient(#2a2a2a, #161616);
  box-shadow: 0 30px 70px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.06);
}
.crt-screen {
  position: relative;
  aspect-ratio: 4 / 3;
  border-radius: 14px / 18px;
  overflow: hidden;
  background: radial-gradient(120% 120% at 50% 50%, #07271a 0%, #03130c 70%, #020a07 100%);
  box-shadow: inset 0 0 40px rgba(0, 0, 0, 0.9), inset 0 0 8px rgba(34, 229, 143, 0.15);
}
#crt-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.crt-scanlines {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(
    to bottom,
    rgba(0, 0, 0, 0) 0,
    rgba(0, 0, 0, 0) 2px,
    rgba(0, 0, 0, 0.25) 3px
  );
  mix-blend-mode: multiply;
  animation: crt-flicker 0.12s steps(2) infinite;
}
.crt-vignette {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(120% 120% at 50% 50%, transparent 55%, rgba(0, 0, 0, 0.55) 100%);
}
.crt-readout {
  position: absolute;
  right: 12px;
  bottom: 10px;
  font-family: 'Oswald', sans-serif;
  font-weight: 700;
  font-size: 1.4rem;
  letter-spacing: 0.06em;
  color: #22e58f;
  text-shadow: 0 0 8px rgba(34, 229, 143, 0.8);
}
.crt-label {
  position: absolute;
  left: 12px;
  bottom: 12px;
  font-family: 'Oswald', sans-serif;
  font-weight: 600;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.3em;
  color: rgba(34, 229, 143, 0.85);
  text-shadow: 0 0 6px rgba(34, 229, 143, 0.6);
}
.crt-base {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 6px 16px;
}
.crt-led {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #22e58f;
  box-shadow: 0 0 8px #22e58f;
  animation: crt-pulse 1.4s ease-in-out infinite;
}
.crt-brand {
  font-family: 'Oswald', sans-serif;
  font-size: 0.7rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: #6a6a6a;
}
.crt-knob {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #3a3a3a, #1a1a1a);
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.1);
}
.crt-knob:first-of-type {
  margin-left: auto;
}

@keyframes crt-flicker {
  0% {
    opacity: 0.85;
  }
  100% {
    opacity: 1;
  }
}
@keyframes crt-pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.35;
  }
}

/* CRT power-off collapse when loading completes */
.crt-screen.power-off #crt-canvas,
.crt-screen.power-off .crt-readout,
.crt-screen.power-off .crt-label,
.crt-screen.power-off .crt-scanlines,
.crt-screen.power-off .crt-vignette {
  opacity: 0;
  transition: opacity 0.15s ease;
}
.crt-screen.power-off::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  height: 3px;
  background: #eafff5;
  box-shadow: 0 0 18px #22e58f;
  transform: translateY(-50%);
  animation: crt-collapse 0.45s ease forwards;
}
@keyframes crt-collapse {
  0% {
    transform: translateY(-50%) scaleX(1);
    opacity: 1;
  }
  60% {
    transform: translateY(-50%) scaleX(0.04);
    opacity: 1;
  }
  100% {
    transform: translateY(-50%) scale(0.02);
    opacity: 0;
  }
}
