/* ─────────────────────────────────────────────────────
   SIGNAL — ryan-chappell-inspired cinematic board
   3D scattered grid · mouse parallax · cinema cuts
───────────────────────────────────────────────────── */

:root {
  --void:  #000000;
  --smoke: rgba(255,255,255,0.45);
  --mist:  rgba(255,255,255,0.25);
  --ghost: rgba(255,255,255,0.08);

  --font-serif: 'EB Garamond', Georgia, serif;
  --font-sans:  'DM Sans', system-ui, sans-serif;

  --hud-size: 10px;
  --hud-ls:   0.1em;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { background: var(--void); }

body {
  background: var(--void);
  color: #fff;
  font-family: var(--font-sans);
  font-weight: 300;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

body.no-scroll { overflow: hidden; }

.hidden { display: none !important; }


/* ── GATE ─────────────────────────────────────────── */

.gate {
  position: fixed;
  inset: 0;
  background: var(--void);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9000;
  transition: opacity 0.8s ease, visibility 0.8s ease;
}

.gate.fade-out { opacity: 0; visibility: hidden; }

.gate-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 36px;
}

.gate-mark {
  font-family: var(--font-serif);
  font-size: 64px;
  font-weight: 400;
  font-style: italic;
  color: rgba(255,255,255,0.15);
  opacity: 0;
  transform: translateY(10px);
  animation: fadeUp 1.2s cubic-bezier(0.16,1,0.3,1) 0.2s forwards;
}

@keyframes fadeUp {
  to { opacity: 1; transform: none; }
}

.gate-form {
  opacity: 0;
  animation: fadeUp 1s cubic-bezier(0.16,1,0.3,1) 0.6s forwards;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.gate-form input {
  background: none;
  border: none;
  border-bottom: 1px solid rgba(255,255,255,0.15);
  color: #fff;
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 300;
  letter-spacing: 0.2em;
  text-align: center;
  padding: 10px 0;
  width: 180px;
  outline: none;
  transition: border-color 0.3s;
}

.gate-form input:focus { border-color: rgba(255,255,255,0.4); }
.gate-form input::placeholder { color: rgba(255,255,255,0.18); letter-spacing: 0.15em; }

.gate-error {
  font-size: 9px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.3);
  text-align: center;
  min-height: 14px;
}


/* ── BOARD ────────────────────────────────────────── */

.board {
  min-height: 100vh;
  background: var(--void);
}


/* ── HUD (persistent top chrome) ─────────────────── */

.hud {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 500;
  display: flex;
  align-items: center;
  padding: 22px 28px;
  pointer-events: none;
}

.site-mark {
  font-family: var(--font-sans);
  font-size: var(--hud-size);
  font-weight: 400;
  letter-spacing: var(--hud-ls);
  text-transform: uppercase;
  color: var(--smoke);
  pointer-events: auto;
  opacity: 0;
  transition: opacity 0.6s ease;
  flex-shrink: 0;
}

.site-mark.visible { opacity: 1; }

.tag-strip {
  flex: 1;
  display: flex;
  justify-content: center;
  gap: 22px;
  opacity: 0;
  transition: opacity 0.6s ease 0.1s;
}

.tag-strip.visible { opacity: 1; }

.tfilter {
  background: none;
  border: none;
  color: var(--mist);
  font-family: var(--font-sans);
  font-size: var(--hud-size);
  font-weight: 400;
  letter-spacing: var(--hud-ls);
  text-transform: uppercase;
  cursor: pointer;
  padding: 0;
  pointer-events: auto;
  transition: color 0.2s;
  white-space: nowrap;
}

.tfilter:hover { color: rgba(255,255,255,0.7); }
.tfilter.active { color: rgba(255,255,255,0.75); }

.btn-add {
  background: none;
  border: none;
  color: var(--smoke);
  font-family: var(--font-sans);
  font-size: 16px;
  font-weight: 300;
  cursor: pointer;
  pointer-events: auto;
  padding: 0;
  opacity: 0;
  transition: opacity 0.6s ease 0.2s, color 0.2s;
  flex-shrink: 0;
  line-height: 1;
}

.btn-add.visible { opacity: 1; }
.btn-add:hover { color: #fff; }


/* ── GRID SCENE ───────────────────────────────────── */

.grid-scene {
  padding: 88px 40px 120px;
  perspective: 1800px;
  perspective-origin: 50% 0%;
  transition: opacity 0.25s ease;
}

.grid-scene.fading {
  opacity: 0;
  pointer-events: none;
}

.grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  transform-style: preserve-3d;
  will-change: transform;
  /* rotateX/Y set by mouse JS */
}


/* ── CARD ─────────────────────────────────────────── */

.card {
  position: relative;
  cursor: pointer;
  overflow: hidden;
  animation: cardFade 0.6s ease both;
  /* rotateZ + scale set inline by JS; animation-delay set inline by JS */
  transition: filter 0.3s ease;
}

@keyframes cardFade {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.card:hover { filter: brightness(1.08); }
.card:hover .card-overlay { opacity: 1; }

.card-inner {
  width: 100%;
  height: 100%;
  position: relative;
}

.card img,
.card video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  pointer-events: none;
}

.card-placeholder {
  width: 100%;
  height: 100%;
  background: #0c0c0c;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 52px;
  color: rgba(255,255,255,0.06);
  user-select: none;
}

/* Hover text overlay */
.card-overlay {
  position: absolute;
  inset: 0;
  bottom: 0;
  padding: 40px 12px 12px;
  background: linear-gradient(to top, rgba(0,0,0,0.72) 0%, transparent 100%);
  opacity: 0;
  transition: opacity 0.3s ease;
  display: flex;
  align-items: flex-end;
}

.card-label {
  font-size: 9px;
  letter-spacing: 0.06em;
  color: rgba(255,255,255,0.7);
  line-height: 1.4;
  text-transform: uppercase;
}


/* ── DETAIL OVERLAY ───────────────────────────────── */

.detail {
  position: fixed;
  inset: 0;
  z-index: 800;
  background: var(--void);
  display: flex;
  flex-direction: column;
}

/* Hide board HUD behind detail */
body.no-scroll .hud {
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

/* Top HUD row */
.detail-hud {
  position: absolute;
  top: 0; left: 0; right: 0;
  display: flex;
  align-items: flex-start;
  padding: 22px 28px;
  z-index: 10;
}

.detail-counter {
  font-family: var(--font-sans);
  font-size: var(--hud-size);
  letter-spacing: var(--hud-ls);
  color: var(--smoke);
  flex-shrink: 0;
  min-width: 48px;
}

.detail-meta {
  flex: 1;
  text-align: center;
  font-family: var(--font-sans);
  font-size: var(--hud-size);
  letter-spacing: var(--hud-ls);
  text-transform: uppercase;
  color: var(--smoke);
  line-height: 1.7;
}

.detail-close-btn {
  background: none;
  border: none;
  font-family: var(--font-sans);
  font-size: var(--hud-size);
  letter-spacing: var(--hud-ls);
  text-transform: uppercase;
  color: var(--smoke);
  cursor: pointer;
  padding: 0;
  flex-shrink: 0;
  min-width: 48px;
  text-align: right;
  transition: color 0.2s;
}

.detail-close-btn:hover { color: #fff; }

/* Centered media stage */
.detail-stage {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 68px 12vw 64px;
}

.detail-media {
  max-width: 100%;
  max-height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.2s ease;
}

.detail-media img,
.detail-media video {
  max-width: 100%;
  max-height: 80vh;
  object-fit: contain;
  display: block;
}

/* Bottom foot row */
.detail-foot {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 28px 26px;
}

.detail-nav-btn {
  background: none;
  border: none;
  font-family: var(--font-sans);
  font-size: var(--hud-size);
  letter-spacing: var(--hud-ls);
  text-transform: uppercase;
  color: var(--mist);
  cursor: pointer;
  padding: 0;
  transition: color 0.2s;
  min-width: 64px;
}

.detail-nav-btn:hover { color: rgba(255,255,255,0.8); }
.detail-nav-btn:disabled { color: rgba(255,255,255,0.1); cursor: default; }

.detail-foot-close {
  background: none;
  border: none;
  font-family: var(--font-sans);
  font-size: var(--hud-size);
  letter-spacing: var(--hud-ls);
  text-transform: uppercase;
  color: var(--smoke);
  cursor: pointer;
  padding: 0;
  transition: color 0.2s;
}

.detail-foot-close:hover { color: #fff; }


/* ── SUBMIT PANEL ─────────────────────────────────── */

.side-panel {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: stretch;
  justify-content: flex-end;
}

.panel-bg {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.75);
}

.panel-inner {
  position: relative;
  width: 420px;
  max-width: 100vw;
  height: 100dvh;
  background: #0d0d0d;
  overflow-y: auto;
  padding: 32px 28px 48px;
  display: flex;
  flex-direction: column;
  border-left: 1px solid var(--ghost);
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 32px;
}

.panel-title {
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--smoke);
}

.panel-close {
  background: none;
  border: none;
  color: var(--mist);
  font-size: 14px;
  cursor: pointer;
  padding: 0;
  transition: color 0.2s;
}

.panel-close:hover { color: #fff; }

.field { margin-bottom: 22px; }

.type-row, .tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.typebtn input, .tagbtn input { display: none; }

.typebtn span, .tagbtn span {
  display: inline-block;
  padding: 5px 12px;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 100px;
  font-size: 11px;
  font-family: var(--font-sans);
  color: rgba(255,255,255,0.35);
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s;
}

.typebtn input:checked + span,
.tagbtn input:checked + span {
  border-color: rgba(255,255,255,0.55);
  color: rgba(255,255,255,0.9);
}

.drop-zone {
  border: 1px dashed rgba(255,255,255,0.1);
  padding: 24px 16px;
  text-align: center;
  font-size: 11px;
  color: rgba(255,255,255,0.22);
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s;
}

.drop-zone:hover {
  border-color: rgba(255,255,255,0.25);
  color: rgba(255,255,255,0.5);
}

.drop-zone.small { padding: 12px 16px; }

.line-input, .line-area {
  width: 100%;
  background: none;
  border: none;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  color: #fff;
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 300;
  padding: 9px 0;
  outline: none;
  transition: border-color 0.2s;
}

.line-input:focus, .line-area:focus { border-color: rgba(255,255,255,0.35); }
.line-input::placeholder, .line-area::placeholder { color: rgba(255,255,255,0.18); }
.line-area { resize: none; line-height: 1.6; }

.btn-submit-form {
  width: 100%;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.18);
  color: rgba(255,255,255,0.65);
  font-family: var(--font-sans);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 13px;
  cursor: pointer;
  margin-top: 8px;
  transition: background 0.2s, border-color 0.2s, color 0.2s;
}

.btn-submit-form:hover {
  background: rgba(255,255,255,0.1);
  border-color: rgba(255,255,255,0.4);
  color: #fff;
}

.submit-done {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  text-align: center;
}

.submit-done.hidden { display: none; }

.done-msg {
  font-family: var(--font-serif);
  font-size: 20px;
  font-style: italic;
  line-height: 1.6;
  color: var(--smoke);
}

.btn-done {
  background: none;
  border: 1px solid rgba(255,255,255,0.12);
  color: var(--mist);
  padding: 9px 22px;
  font-family: var(--font-sans);
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s;
}

.btn-done:hover {
  border-color: rgba(255,255,255,0.35);
  color: rgba(255,255,255,0.8);
}

/* Empty state */
.empty-screen {
  grid-column: 1 / -1;
  min-height: 60vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.empty-screen h2 {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 28px;
  font-weight: 400;
  color: rgba(255,255,255,0.15);
}

.empty-screen p {
  font-size: 11px;
  letter-spacing: 0.06em;
  color: rgba(255,255,255,0.1);
}


/* ── RESPONSIVE ───────────────────────────────────── */

@media (max-width: 1100px) {
  .grid { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 700px) {
  .grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .grid-scene { padding: 76px 16px 80px; perspective: none; }
  .tag-strip { gap: 14px; }
  .detail-stage { padding: 68px 6vw 64px; }
  .hud { padding: 18px 18px; }
}

@media (prefers-reduced-motion: reduce) {
  .grid { transform: none !important; }
  .card { transform: none !important; transition: opacity 0.3s; }
  .detail { transition: opacity 0.2s; }
  .grid-scene { transition: opacity 0.2s; }
}
