*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:where(a, button, input, select, textarea):focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

html {
  scrollbar-width: thin;
  scrollbar-color: var(--border) var(--bg);
  scroll-behavior: smooth;
}

@view-transition {
  navigation: auto;
}

/* Page transition: clean crossfade — nothing moves */
::view-transition-old(root) {
  animation: 0.35s ease-in both fade-out;
}

::view-transition-new(root) {
  animation: 0.35s ease-out 0.12s both fade-in;
}

@keyframes fade-out {
  to { opacity: 0; }
}

@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-hover); }

:root {
  --bg: #0a0a0c;
  --surface: #111115;
  --border: #1e1e24;
  --border-hover: #3a3a4a;
  --text: #e8e8f0;
  --muted: #5a5a6e;
  --accent: #7b6cff;
  --accent-soft: rgba(123, 108, 255, 0.12);
  --accent-glow: rgba(123, 108, 255, 0.3);
  --red: #ff4f4f;
  --red-soft: rgba(255, 79, 79, 0.1);
  --green: #4fff8a;
  --green-soft: rgba(79, 255, 138, 0.08);
}

html, body {
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: "DM Mono", monospace;
  overflow-x: hidden;
}

/* Loading screen */
#loading-screen {
  position: fixed;
  inset: 0;
  background: transparent;
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 999;
  transition: opacity 0.8s ease, visibility 0.8s;
}

#loading-text {
  position: relative;
  z-index: 1;
  font-family: "Unbounded", sans-serif;
  font-weight: 800;
  font-size: clamp(48px, 12vw, 72px);
  color: #fff;
  opacity: 0;
  animation: glitchReveal 2.5s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

#loading-text::before,
#loading-text::after {
  content: "dekub";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

#loading-text::before {
  animation: glitch1 2.5s infinite;
  clip-path: polygon(0 0, 100% 0, 100% 45%, 0 45%);
  transform: translate(-2px);
  color: #ff4f4f;
  z-index: -1;
}

#loading-text::after {
  animation: glitch2 2.5s infinite;
  clip-path: polygon(0 55%, 100% 55%, 100% 100%, 0 100%);
  transform: translate(2px);
  color: #7b6cff;
  z-index: -2;
}

@keyframes glitchReveal {
  0% { opacity: 0; filter: blur(10px) contrast(2); transform: scale(1.1); }
  30% { opacity: 1; filter: blur(0) contrast(1); transform: scale(1); }
  70% { opacity: 1; transform: scale(1); }
  100% { opacity: 0; transform: scale(0.95); }
}

@keyframes glitch1 {
  0%, 20%, 100% { transform: translate(0); }
  22% { transform: translate(-3px, 1px); }
  24% { transform: translate(3px, -1px); }
  26% { transform: translate(-2px, 2px); }
  28% { transform: translate(0); }
}

@keyframes glitch2 {
  0%, 20%, 100% { transform: translate(0); }
  21% { transform: translate(2px, -1px); }
  23% { transform: translate(-2px, 1px); }
  25% { transform: translate(1px, -2px); }
  27% { transform: translate(0); }
}

/* Noise texture overlay */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.04'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 1000;
  opacity: 0.5;
}

/* Ambient glow */
body::after {
  content: "";
  position: fixed;
  top: -20%;
  left: 50%;
  transform: translateX(-50%);
  width: 600px;
  height: 400px;
  background: radial-gradient(ellipse, rgba(123, 108, 255, 0.07) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}

.d1 { animation-delay: 0.05s; }
.d2 { animation-delay: 0.1s; }
.d3 { animation-delay: 0.15s; }
.d4 { animation-delay: 0.2s; }
.d5 { animation-delay: 0.25s; }
.d6 { animation-delay: 0.3s; }
.d7 { animation-delay: 0.35s; }
