/* =============================================
   DOOMSQUAD.LOL — MAIN STYLES v4
   ============================================= */

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

:root {
  --black:        #050507;
  --card-bg:      #0c0c10;
  --card-border:  rgba(255,255,255,0.06);
  --white:        #f5f5f5;
  --white-faint:  rgba(245,245,245,0.07);
  --font-mono:    'DM Mono', monospace;
  --shield-r:     45px;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--black);
  color: var(--white);
  font-family: var(--font-mono);
  cursor: none;
  user-select: none;
}

/* ══════════════════════════════════════════════
   CURSOR  (top-level, always visible)
   ══════════════════════════════════════════════ */
#cursor-dot {
  position: fixed;
  width: 4px;
  height: 4px;
  background: var(--white);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
  z-index: 99999;
  transition: transform 0.1s ease, opacity 0.1s ease;
}

#cursor-shield {
  position: fixed;
  width: calc(var(--shield-r) * 2);
  height: calc(var(--shield-r) * 2);
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.08);
  background: radial-gradient(circle, rgba(5,5,7,0.5) 50%, transparent 100%);
  transform: translate(-50%, -50%);
  pointer-events: none;
  z-index: 99998;
}

/* ══════════════════════════════════════════════
   ENTRANCE GATE
   ══════════════════════════════════════════════ */
#entrance-gate {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: #050507;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.9s cubic-bezier(0.16, 1, 0.3, 1),
              visibility 0.9s;
}

#entrance-gate.fade-out {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

#enter-btn {
  background: none;
  border: 1px solid rgba(245,245,245,0.18);
  color: rgba(245,245,245,0.55);
  font-family: var(--font-mono);
  font-size: clamp(0.9rem, 2vw, 1.1rem);
  letter-spacing: 0.28em;
  text-transform: lowercase;
  padding: 22px 52px;
  border-radius: 4px;
  cursor: none;
  outline: none;
  transition: border-color 0.3s, color 0.3s, box-shadow 0.3s;
  animation: gatePulse 3.5s ease-in-out infinite;
}

@keyframes gatePulse {
  0%, 100% { box-shadow: 0 0 0   rgba(245,245,245,0); }
  50%       { box-shadow: 0 0 28px rgba(245,245,245,0.06); }
}

#enter-btn:hover {
  border-color: rgba(245,245,245,0.45);
  color: rgba(245,245,245,0.9);
  box-shadow: 0 0 32px rgba(245,245,245,0.07);
  animation: none;
}

/* ══════════════════════════════════════════════
   SITE WRAP
   ══════════════════════════════════════════════ */
#site-wrap {
  position: fixed;
  inset: 0;
  transition: opacity 1.1s cubic-bezier(0.16, 1, 0.3, 1);
}

#site-wrap.site-hidden {
  opacity: 0;
  pointer-events: none;
}

#site-wrap.site-visible {
  opacity: 1;
  pointer-events: all;
}

/* ══════════════════════════════════════════════
   RAIN CANVAS
   ══════════════════════════════════════════════ */
#rain-canvas {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

/* ══════════════════════════════════════════════
   HEADER
   ══════════════════════════════════════════════ */
#site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  padding: 30px 44px;
  pointer-events: none;
}

.logo {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 400;
  letter-spacing: 0.18em;
  color: rgba(245,245,245,0.3);
  text-transform: lowercase;
}

.logo .tld {
  color: rgba(245,245,245,0.5);
}

/* ══════════════════════════════════════════════
   MAIN STAGE
   ══════════════════════════════════════════════ */
#main-stage {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

/* ══════════════════════════════════════════════
   CARD TRACK
   ══════════════════════════════════════════════ */
#card-track {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 28px;
  padding: 24px;
  pointer-events: all;
  perspective: 1400px;
}

/* ══════════════════════════════════════════════
   PLAYING CARD
   ══════════════════════════════════════════════ */
.playing-card {
  position: relative;
  width: clamp(148px, 14vw, 196px);
  height: clamp(240px, 26vw, 320px);
  border-radius: 12px;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  cursor: none;
  transition:
    transform 0.5s cubic-bezier(0.22, 1, 0.36, 1),
    box-shadow 0.5s cubic-bezier(0.22, 1, 0.36, 1),
    border-color 0.4s ease;
  transform-style: preserve-3d;
  box-shadow:
    0 0 0 1px var(--card-border),
    0 24px 64px rgba(0,0,0,0.75),
    inset 0 1px 0 rgba(255,255,255,0.03);
  flex-shrink: 0;
  overflow: hidden;
}

.playing-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.04'/%3E%3C/svg%3E");
  background-size: 160px;
  border-radius: inherit;
  pointer-events: none;
  z-index: 0;
  opacity: 0.6;
}

.playing-card:hover {
  transform: translateY(-12px) scale(1.035);
  box-shadow:
    0 0 0 1px rgba(255,255,255,0.12),
    0 48px 88px rgba(0,0,0,0.88),
    0 0 32px rgba(255,255,255,0.03),
    inset 0 1px 0 rgba(255,255,255,0.06);
  border-color: rgba(255,255,255,0.14);
}

.playing-card:active {
  transform: translateY(-6px) scale(1.01);
  transition-duration: 0.15s;
}

.card-inner {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: 18px 14px 16px;
}

.card-pip {
  font-family: var(--font-mono);
  font-size: 0.58rem;
  letter-spacing: 0.06em;
  color: rgba(245,245,245,0.25);
  line-height: 1.3;
  align-self: flex-start;
}

.card-pip.bottom {
  align-self: flex-end;
  transform: rotate(180deg);
}

.card-headshot {
  width: 84%;
  aspect-ratio: 1 / 1;
  border-radius: 6px;
  overflow: hidden;
  background: var(--white-faint);
  border: 1px solid rgba(255,255,255,0.05);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.card-headshot img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  filter: grayscale(30%) contrast(1.05) brightness(0.92);
  transition: filter 0.4s ease;
}

.card-headshot .placeholder-icon {
  font-size: 2.5rem;
  opacity: 0.1;
}

.playing-card:hover .card-headshot img {
  filter: grayscale(0%) contrast(1.08) brightness(1.0);
}

.card-placeholder-label {
  font-family: var(--font-mono);
  font-size: 0.58rem;
  letter-spacing: 0.14em;
  color: rgba(245,245,245,0.18);
  text-transform: lowercase;
}

.card-alias {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.24em;
  text-transform: lowercase;
  color: rgba(245,245,245,0.6);
  text-align: center;
}

.card-rule {
  width: 24px;
  height: 1px;
  background: rgba(245,245,245,0.15);
  margin: 5px auto 0;
}

@keyframes cardReveal {
  from { opacity: 0; transform: translateY(32px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.playing-card { animation: cardReveal 0.65s cubic-bezier(0.16, 1, 0.3, 1) both; }
.playing-card:nth-child(1) { animation-delay: 0.08s; }
.playing-card:nth-child(2) { animation-delay: 0.18s; }
.playing-card:nth-child(3) { animation-delay: 0.28s; }
.playing-card:nth-child(4) { animation-delay: 0.38s; }

/* ══════════════════════════════════════════════
   OVERLAY
   ══════════════════════════════════════════════ */
#card-overlay {
  position: fixed;
  inset: 0;
  z-index: 500;
  transition: opacity 0.5s ease, backdrop-filter 0.5s ease;
}

#card-overlay.hidden {
  opacity: 0;
  pointer-events: none;
  backdrop-filter: blur(0px);
}

#card-overlay:not(.hidden) {
  opacity: 1;
  backdrop-filter: blur(20px) saturate(0.8);
  background: rgba(5,5,7,0.78);
}

#close-btn {
  position: fixed;
  top: 28px;
  right: 36px;
  background: none;
  border: 1px solid rgba(255,255,255,0.1);
  color: rgba(245,245,245,0.5);
  font-size: 0.85rem;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: none;
  z-index: 600;
  transition: border-color 0.2s, color 0.2s, transform 0.3s;
  font-family: var(--font-mono);
}

#close-btn:hover {
  border-color: rgba(255,255,255,0.3);
  color: var(--white);
  transform: rotate(90deg);
}

#overlay-inner {
  width: 100%;
  height: 100%;
  position: relative;
  overflow: hidden;
}

/* ══════════════════════════════════════════════
   UTILITY
   ══════════════════════════════════════════════ */
.hidden { opacity: 0; pointer-events: none; }

@media (max-width: 580px) {
  #card-track { gap: 16px; }
  .playing-card { width: 120px; height: 195px; }
}
