/* ==========================================================================
   WEI STUDIO — arcade-cabinet effects (fx.js companion).
   No frameworks, no external requests. Remove this file + fx.js to disable.
   ========================================================================== */

/* ---------------------------------------------------------------- boot screen */

.boot {
  position: fixed;
  inset: 0;
  z-index: 999;
  background: var(--ink);
  color: var(--paper);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  cursor: pointer;
}

.boot__inner {
  width: min(560px, 86vw);
}

.boot__line {
  margin: 0 0 10px;
  font-size: clamp(12px, 1.6vw, 16px);
  letter-spacing: 0.08em;
  white-space: pre;
  min-height: 1.3em;
}

.boot__bar {
  display: flex;
  gap: 4px;
  margin-top: 22px;
}

.boot__seg {
  flex: 1;
  height: 10px;
  background: var(--line-strong);
}

.boot__seg.is-on {
  background: var(--accent);
}

.boot.is-leaving {
  animation: boot-wipe 220ms steps(6, end) forwards;
}

@keyframes boot-wipe {
  0% {
    clip-path: inset(0 0 0 0);
  }
  100% {
    clip-path: inset(0 0 100% 0);
  }
}

/* ---------------------------------------------------------------- pixel field */

.hero {
  position: relative;
}

.hero canvas.pixel-field {
  position: absolute;
  inset: 0;
  z-index: 0;
  opacity: 0.55;
  pointer-events: none;
}

.hero .shell {
  position: relative;
  z-index: 1;
}

/* ---------------------------------------------------------------- hero decode + cursor */

.hero__line {
  position: relative;
}

.hero__line .fx-scr {
  display: inline-block;
}

.hero__title .fx-cursor {
  display: inline-block;
  width: 0.5em;
  height: 0.78em;
  margin-left: 0.08em;
  background: var(--accent);
  vertical-align: -0.1em;
  animation: fx-blink 1s steps(1, end) infinite;
}

@keyframes fx-blink {
  0%, 49% { opacity: 1; }
  50%, 100% { opacity: 0; }
}

/* ---------------------------------------------------------------- ticker */

.ticker {
  position: relative;
  z-index: 1;
  overflow: hidden;
  border-bottom: 1px solid var(--line-strong);
  background: var(--ink-raise);
  white-space: nowrap;
}

.ticker__track {
  display: inline-flex;
  align-items: center;
  width: max-content;
  animation: ticker-scroll 28s steps(60, end) infinite linear;
}

.ticker:hover .ticker__track {
  animation-play-state: paused;
}

.ticker__item {
  display: inline-flex;
  align-items: center;
  padding: 10px clamp(14px, 1.6vw, 24px);
  font-size: var(--step-1);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  white-space: nowrap;
}

.ticker__sep {
  display: inline-block;
  width: 7px;
  height: 7px;
  flex: none;
  background: var(--accent);
}

@keyframes ticker-scroll {
  0% { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}

/* ---------------------------------------------------------------- card tilt + shine + glitch */

.card {
  transform-style: preserve-3d;
  will-change: transform;
}

.card__media {
  position: relative;
}

.card__media::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background: linear-gradient(
    115deg,
    transparent 0%,
    rgba(244, 241, 233, 0.22) 48%,
    transparent 58%
  );
  transform: translateX(-120%);
  opacity: 0;
}

.card.fx-shine .card__media::after {
  opacity: 1;
  transition: transform 520ms linear;
  transform: translateX(120%);
}

.card__media--empty span.is-glitching {
  animation: fx-digit-glitch 180ms steps(3, end);
}

@keyframes fx-digit-glitch {
  0% { transform: translate(0, 0); }
  33% { transform: translate(-2px, 1px); }
  66% { transform: translate(2px, -1px); }
  100% { transform: translate(0, 0); }
}

/* ---------------------------------------------------------------- section title glitch */

.section__title {
  position: relative;
  display: inline-block;
}

.section__title.fx-glitching {
  animation: fx-title-glitch 260ms steps(4, end);
}

.section__title.fx-glitching::before,
.section__title.fx-glitching::after {
  content: attr(data-fx-text);
  position: absolute;
  inset: 0;
  overflow: hidden;
}

.section__title.fx-glitching::before {
  color: var(--accent);
  clip-path: inset(0 0 55% 0);
  transform: translate(-3px, 0);
}

.section__title.fx-glitching::after {
  color: var(--paper);
  clip-path: inset(55% 0 0 0);
  transform: translate(3px, 0);
}

@keyframes fx-title-glitch {
  0% { transform: translate(0, 0); }
  25% { transform: translate(-2px, 1px); }
  50% { transform: translate(2px, -1px); }
  75% { transform: translate(-1px, 0); }
  100% { transform: translate(0, 0); }
}

/* ---------------------------------------------------------------- tactile buttons */

.btn {
  transition: background 140ms linear, color 140ms linear, transform 90ms steps(2, end),
    box-shadow 90ms steps(2, end);
}

.btn:not(.btn--ghost):not([aria-disabled="true"]) {
  box-shadow: inset 0 -4px 0 rgba(11, 11, 12, 0.22), inset 0 2px 0 rgba(255, 255, 255, 0.35);
}

.btn:not(.btn--ghost):not([aria-disabled="true"]):active {
  transform: translateY(2px);
  box-shadow: inset 0 -2px 0 rgba(11, 11, 12, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.25);
}

/* ---------------------------------------------------------------- download feedback */

.dl-progress {
  display: inline-flex;
  gap: 3px;
  margin-left: 10px;
  vertical-align: middle;
}

.dl-progress__seg {
  width: 6px;
  height: 12px;
  background: var(--ink);
  opacity: 0.25;
}

.dl-progress__seg.is-on {
  opacity: 1;
}

.btn--ghost .dl-progress__seg {
  background: var(--paper);
}

/* ---------------------------------------------------------------- easter egg toast */

.fx-toast {
  position: fixed;
  left: 50%;
  bottom: 36px;
  z-index: 998;
  transform: translateX(-50%);
  padding: 12px 20px;
  background: var(--accent);
  color: var(--ink);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--step-1);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  box-shadow: 5px 5px 0 0 var(--paper);
  pointer-events: none;
}

.fx-cards-canvas {
  position: fixed;
  inset: 0;
  z-index: 997;
  pointer-events: none;
}

/* ---------------------------------------------------------------- CRT scanlines */

.fx-scanlines {
  position: fixed;
  inset: 0;
  z-index: 996;
  pointer-events: none;
  background: repeating-linear-gradient(
    to bottom,
    rgba(0, 0, 0, 0.35) 0,
    rgba(0, 0, 0, 0.35) 1px,
    transparent 1px,
    transparent 3px
  );
  opacity: 0.04;
  mix-blend-mode: multiply;
}

/* ---------------------------------------------------------------- cursors */

@media (pointer: fine) {
  body {
    cursor: url("/assets/common/cursor.png") 4 2, auto;
  }
  a,
  button,
  [data-set-lang],
  .card,
  input,
  select,
  summary {
    cursor: url("/assets/common/cursor-hand.png") 8 2, pointer;
  }
  input[type="text"],
  input[type="email"],
  input[type="search"],
  textarea {
    cursor: text;
  }
}

/* ---------------------------------------------------------------- reduced motion + touch */

@media (prefers-reduced-motion: reduce) {
  .boot,
  .hero canvas.pixel-field,
  .fx-cards-canvas {
    display: none !important;
  }
  .ticker__track {
    animation: none;
  }
  .card.fx-shine .card__media::after {
    display: none;
  }
  .section__title.fx-glitching,
  .section__title.fx-glitching::before,
  .section__title.fx-glitching::after {
    animation: none;
    content: none;
  }
  .card__media--empty span.is-glitching {
    animation: none;
  }
  .hero__title .fx-cursor {
    animation: none;
    opacity: 1;
  }
}

@media (pointer: coarse) {
  .card {
    transform: none !important;
  }
  .card.fx-shine .card__media::after {
    display: none;
  }
}
