/* ==========================================================================
   TRUE CRIME INVESTIGATION / NEO-NOIR PORTFOLIO STYLESHEET
   Inspired by 80s/90s retro-thriller cinema credits & analog darkroom film.
   ========================================================================== */

:root {
  --bg-blood: #1A0306;
  --bg-wine: #2B0509;
  --surface-burgundy: #4A0810;
  --surface-paper: #E8DEC8;
  --accent-amber: #F2A900;
  --accent-gold: #E5B84B;
  --text-offwhite: #F5EFE6;
  --text-charcoal: #1C1917;
  --stamp-crimson: #DC2626;
  --mouse-x: 50vw;
  --mouse-y: 35vh;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  background-color: var(--bg-blood);
  color: var(--text-offwhite);
}

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background-color: var(--bg-blood);
  color: var(--text-offwhite);
  overflow-x: hidden;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

/* Typography Helpers */
.font-cinema {
  font-family: 'Playfair Display', Georgia, serif;
  letter-spacing: 0.04em;
}

.font-mono-case {
  font-family: 'Space Mono', 'Courier New', monospace;
}

/* Global Analog Film Grain Overlay (opacity: 0.04, pointer-events: none) */
.film-grain {
  position: fixed;
  inset: 0;
  z-index: 60;
  pointer-events: none;
  opacity: 0.04;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='grain'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23grain)'/%3E%3C/svg%3E");
}

/* Interactive Spotlight Cursor Layer */
#spotlight-overlay {
  position: fixed;
  inset: 0;
  z-index: 5;
  pointer-events: none;
  background: radial-gradient(
    520px circle at var(--mouse-x) var(--mouse-y),
    rgba(242, 169, 0, 0.09),
    rgba(153, 27, 27, 0.14) 38%,
    transparent 72%
  );
  transition: opacity 0.3s ease;
}

/* Darkroom Radial Vignette for Hero */
.darkroom-vignette {
  background:
    radial-gradient(ellipse 75% 60% at 50% 42%, rgba(74, 8, 16, 0.55) 0%, rgba(26, 3, 6, 0.92) 72%, #1A0306 100%);
}

/* Classified Folder Tab CTA */
.folder-tab-btn {
  position: relative;
  border-top-left-radius: 0.35rem;
  border-top-right-radius: 0.75rem;
  border-bottom-left-radius: 0.25rem;
  border-bottom-right-radius: 0.25rem;
  box-shadow: 0 10px 28px -8px rgba(242, 169, 0, 0.35);
}

.folder-tab-btn::before {
  content: 'TỐI MẬT // HỒ SƠ #2026-MA';
  position: absolute;
  top: -19px;
  left: 0;
  padding: 2px 10px;
  font-family: 'Space Mono', monospace;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: #1A0306;
  background-color: var(--accent-gold);
  border-top-left-radius: 0.35rem;
  border-top-right-radius: 0.45rem;
}

/* Duotone Red & Amber Portrait Filter */
.duotone-portrait {
  position: relative;
  background: linear-gradient(145deg, #4A0810 0%, #1A0306 100%);
}

.duotone-portrait::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(160deg, rgba(242, 169, 0, 0.22) 0%, rgba(220, 38, 38, 0.32) 55%, rgba(26, 3, 6, 0.6) 100%);
  mix-blend-mode: screen;
}

.duotone-media {
  filter: grayscale(100%) contrast(125%) sepia(55%) hue-rotate(-28deg) saturate(210%);
}

/* Redacted Text Reveal */
.redacted {
  display: inline-block;
  position: relative;
  padding: 0 6px;
  margin: 0 1px;
  border-radius: 2px;
  background-color: #000000;
  color: transparent;
  cursor: pointer;
  user-select: none;
  transition: background-color 0.28s ease, color 0.28s ease, box-shadow 0.28s ease;
}

.redacted::after {
  content: ' [TỐI MẬT]';
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Space Mono', monospace;
  font-size: 0.68em;
  letter-spacing: 0.08em;
  color: rgba(229, 184, 75, 0.55);
  transition: opacity 0.22s ease;
  pointer-events: none;
}

.redacted:hover,
.redacted:focus-visible,
.redacted.is-revealed {
  background-color: rgba(0, 0, 0, 0.82);
  color: var(--accent-amber);
  box-shadow: 0 0 0 1px rgba(242, 169, 0, 0.45);
  outline: none;
}

.redacted:hover::after,
.redacted:focus-visible::after,
.redacted.is-revealed::after {
  opacity: 0;
}

/* Evidence Corkboard Surface */
.corkboard-surface {
  background-color: #210408;
  background-image:
    radial-gradient(rgba(229, 184, 75, 0.09) 1px, transparent 1px),
    radial-gradient(rgba(220, 38, 38, 0.07) 1px, transparent 1px);
  background-size: 28px 28px;
  background-position: 0 0, 14px 14px;
}

/* Pinned Polaroid / Case Document Cards */
.exhibit-card {
  transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1),
              box-shadow 0.35s ease;
  will-change: transform;
}

.exhibit-tilt-left {
  transform: rotate(-1.35deg);
}

.exhibit-tilt-right {
  transform: rotate(1.15deg);
}

.exhibit-tilt-slight {
  transform: rotate(-0.85deg);
}

.exhibit-card:hover,
.exhibit-card:focus-within {
  transform: rotate(0deg) translateY(-6px);
  box-shadow:
    0 20px 38px -12px rgba(0, 0, 0, 0.75),
    0 0 26px rgba(242, 169, 0, 0.28);
}

/* Rubber Stamp Styling & CASE CLOSED Slam Animation */
.rubber-stamp {
  border: 3px solid var(--stamp-crimson);
  color: var(--stamp-crimson);
  font-family: 'Space Mono', monospace;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  box-shadow: inset 0 0 0 1px rgba(220, 38, 38, 0.35);
}

@keyframes stampSlam {
  0% {
    opacity: 0;
    transform: scale(2.4) rotate(-18deg);
  }
  65% {
    opacity: 1;
    transform: scale(0.94) rotate(-6deg);
  }
  100% {
    opacity: 0.95;
    transform: scale(1) rotate(-7deg);
  }
}

.stamp-slam {
  animation: stampSlam 0.48s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

/* Nav active underline */
.noir-nav-link {
  position: relative;
}

.noir-nav-link::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: -4px;
  width: 100%;
  height: 1.5px;
  background-color: var(--accent-amber);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.25s ease;
}

.noir-nav-link.is-active,
.noir-nav-link:hover {
  color: var(--accent-amber);
}

.noir-nav-link.is-active::after,
.noir-nav-link:hover::after {
  transform: scaleX(1);
}

/* Scroll Reveal */
.reveal {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.65s ease, transform 0.65s cubic-bezier(0.22, 1, 0.36, 1);
}

.reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  .reveal {
    opacity: 1;
    transform: none;
    transition: none;
  }
  .stamp-slam {
    animation: none;
    transform: rotate(-7deg);
  }
  .exhibit-card,
  .exhibit-card:hover {
    transform: none;
  }
}
