/**
 * Main Menu Styling - Exact reference match
 * Based on IFB_WitnessProtection_MainMenu.html
 */

/* Menu section specific styling */
#menuSection {
  background: #3A3238;
  padding: 2rem;
  font-family: 'Courier New', Courier, monospace;
  color: #5F5449;
  min-height: var(--vh100, 100vh);
  margin: 0;
  perspective: 1000px;
  display: flex;
  justify-content: center;
  align-items: center;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
}

.menu-container {
  /* Widened from 1000 → 1240 to give the right-side 2x2
     classification grid its 460px without stealing room from
     the menu-file (flex:1). Restores the original ~748px
     menu-file width — title, items, and version sit at the
     same scale they did before the grid landed. */
  max-width: 1240px;
  width: 100%;
  position: relative;
  display: flex;
  gap: 2rem;
  align-items: flex-start;
}

/* Main Menu File */
.menu-file {
  flex: 1;
  background: #EBE6D8;
  padding: 3rem 2rem;
  border: 1px solid #8E7F7F;
  box-shadow: 0 8px 24px rgba(0,0,0,0.2);
  position: relative;
  animation: openFile 1s ease-out forwards;
  transform-origin: top center;
  overflow: hidden;
}

@keyframes openFile {
  from { transform: rotateX(30deg) translateY(-100px); opacity: 0; }
  to { transform: rotateX(0) translateY(0); opacity: 1; }
}

/* Paper Texture */
.paper-texture {
  position: absolute;
  inset: 0;
  background: url('data:image/svg+xml,<svg viewBox="0 0 100 100" xmlns="http://www.w3.org/2000/svg"><filter id="noise"><feTurbulence type="fractalNoise" baseFrequency="0.8"/></filter><rect width="100" height="100" filter="url(%23noise)" opacity="0.1"/></svg>');
  pointer-events: none;
  opacity: 0.3;
}

/* Title */
.game-title {
  text-align: center;
  margin-bottom: 3rem;
  position: relative;
  opacity: 0;
  animation: fadeIn 0.5s ease-out 0.8s forwards;
}

.title-text {
  font-size: 42px;
  font-weight: bold;
  color: #3A3238;
  letter-spacing: 4px;
  text-transform: uppercase;
  margin-bottom: 1rem;
  text-shadow: 3px 3px 0 rgba(142,127,127,0.2);
}

.subtitle {
  font-size: 14px;
  color: #8E7F7F;
}

.title-text .subtitle-blood {
  font-size: 32px;
  color: #8B0000 !important;
  display: block;
  letter-spacing: 5px;
  margin-top: 0.5rem;
}

.typewriter-container {
  color: #8B0000 !important;
  position: relative;
}

.typewriter-container.typing::after {
  content: "|";
  position: absolute;
  right: -0.1em;
  color: #8B0000;
  animation: typewriterCursor 1s infinite;
}

@keyframes typewriterCursor {
  0%, 50% {
    opacity: 1;
  }
  51%, 100% {
    opacity: 0;
  }
}

@keyframes protectionPulse {
  0%, 100% { color: #8E7F7F; }
  50% { color: #555a88; text-shadow: 0 0 10px rgba(85,90,136,0.3); }
}

/* Classification Section */
.classification-section {
  width: 220px;
  position: sticky;
  top: 2rem;
  perspective: 1000px;
}

.classification-card {
  background: #EBE6D8;
  border: 1px solid #8E7F7F;
  padding: 1.5rem;
  position: relative;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  opacity: 0;
  transform: rotateY(30deg);
  animation: revealClassification 0.8s ease forwards 1.5s;
}

@keyframes revealClassification {
  to {
    opacity: 1;
    transform: rotateY(0);
  }
}

.classification-label {
  position: absolute;
  top: -10px;
  left: -10px;
  background: darkred;
  color: #EBE6D8;
  padding: 4px 12px;
  font-size: 12px;
  transform: rotate(-15deg);
  z-index: 2;
  transition: all 0.3s ease;
  box-shadow: 2px 2px 4px rgba(0,0,0,0.1);
}

.classification-card:hover .classification-label {
  transform: rotate(-5deg) scale(1.1);
}

.classification-title {
  font-weight: bold;
  color: #3A3238;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px dashed #8E7F7F;
  text-align: center;
}

.classification-text {
  font-size: 14px;
  color: #5F5449;
  margin-bottom: 1rem;
  line-height: 1.4;
  text-align: center;
}

/* ENTER PROTECTION call-to-action button — the primary "start the
   game" path. Gets a quiet attention pull so a first-time player's
   eye finds it without the page feeling busy:
     • soft gold halo pulse (3.4s) — barely perceptible at idle,
       reads as the page breathing rather than a flashing button
     • a thin highlight sweep every 4.8s that slides left → right
       across the face — the kind of brief sheen polished brass
       gets in passing light
   Both animations pause on hover so the player can read the label
   without competing motion, and a `prefers-reduced-motion` media
   query disables the lot for users who'd rather not. */
.enter-protection-cta {
  position: relative;
  overflow: hidden;
  animation: cta-halo 3.4s ease-in-out infinite;
}
.enter-protection-cta::after {
  content: '';
  position: absolute;
  top: 0; bottom: 0;
  left: -40%;
  width: 35%;
  background: linear-gradient(110deg,
    rgba(235, 230, 216, 0.0)  0%,
    rgba(235, 230, 216, 0.22) 50%,
    rgba(235, 230, 216, 0.0)  100%);
  pointer-events: none;
  animation: cta-sheen 4.8s ease-in-out infinite;
}
.enter-protection-cta:hover {
  animation: none;
  box-shadow:
    0 2px 4px rgba(0,0,0,0.3),
    0 0 0 1px rgba(196, 168, 122, 0.45),
    0 0 16px rgba(196, 168, 122, 0.4);
}
.enter-protection-cta:hover::after {
  animation: none;
  opacity: 0;
}
@keyframes cta-halo {
  0%, 100% {
    box-shadow: 0 2px 4px rgba(0,0,0,0.3),
                0 0 0 0 rgba(196, 168, 122, 0);
  }
  50% {
    box-shadow: 0 2px 4px rgba(0,0,0,0.3),
                0 0 0 1px rgba(196, 168, 122, 0.35),
                0 0 14px rgba(196, 168, 122, 0.35);
  }
}
@keyframes cta-sheen {
  /* Long quiet stretch, then a quick pass — gives the eye time to
     rest before the next sweep so it never reads as nagging. */
  0%, 72%   { left: -40%; }
  85%, 100% { left: 110%; }
}
@media (prefers-reduced-motion: reduce) {
  .enter-protection-cta,
  .enter-protection-cta::after { animation: none; }
}

/* Right classification-section restructured into a 2x2 grid:
     Row 1: ENTER PROTECTION  · BACK CHANNEL
     Row 2: WITNESS LIST      · CASE LEADS
   Cards keep their existing .classification-card chrome; only
   the section becomes a grid and widens to fit two columns. */
.classification-section.classification-grid {
  width: 460px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  align-items: start;
}
.classification-section.classification-grid .classification-card {
  margin-top: 0 !important;  /* override the inline margin the
                                 second card used in single-column
                                 mode; the grid `gap` handles
                                 spacing now */
}
/* Tighten the card padding + text size a notch in the grid so
   two cards fit cleanly on a 1000px-wide menu container. */
.classification-section.classification-grid .classification-card {
  padding: 1.1rem 1rem;
}
.classification-section.classification-grid .classification-title {
  font-size: 0.95rem;
}
.classification-section.classification-grid .classification-text {
  font-size: 12px;
}
/* Stagger the reveal of the four cards instead of all four
   firing at the same 1.5s offset — keeps the grid from feeling
   like it slams in as one block. */
.classification-section.classification-grid .classification-card:nth-child(1) {
  animation-delay: 1.45s;
}
.classification-section.classification-grid .classification-card:nth-child(2) {
  animation-delay: 1.55s;
}
.classification-section.classification-grid .classification-card:nth-child(3) {
  animation-delay: 1.65s;
}
.classification-section.classification-grid .classification-card:nth-child(4) {
  animation-delay: 1.75s;
}

/* Narrow viewports — collapse the 2x2 grid back to a single
   column stack so cards stay readable on small screens. */
@media (max-width: 900px) {
  .classification-section.classification-grid {
    width: 220px;
    grid-template-columns: 1fr;
  }
}

/* BACK CHANNEL CTA — same idle attention-pull idiom as the
   ENTER PROTECTION button on the right, but in cobalt so the
   two CTAs read as separate channels rather than competing for
   the same attention. Halo pulse runs on a slower cadence
   (4.2s vs 3.4s) so they never breathe in sync. */
.back-channel-cta {
  position: relative;
  overflow: hidden;
  animation: cta-halo-blue 4.2s ease-in-out infinite;
}
.back-channel-cta::after {
  content: '';
  position: absolute;
  top: 0; bottom: 0;
  left: -40%;
  width: 35%;
  background: linear-gradient(110deg,
    rgba(235, 230, 216, 0.0)  0%,
    rgba(235, 230, 216, 0.22) 50%,
    rgba(235, 230, 216, 0.0)  100%);
  pointer-events: none;
  animation: cta-sheen 5.8s ease-in-out infinite;
}
.back-channel-cta:hover {
  animation: none;
  box-shadow:
    0 2px 4px rgba(0,0,0,0.3),
    0 0 0 1px rgba(122, 145, 196, 0.45),
    0 0 16px rgba(122, 145, 196, 0.4);
}
.back-channel-cta:hover::after {
  animation: none;
  opacity: 0;
}
@keyframes cta-halo-blue {
  0%, 100% {
    box-shadow: 0 2px 4px rgba(0,0,0,0.3),
                0 0 0 0 rgba(122, 145, 196, 0);
  }
  50% {
    box-shadow: 0 2px 4px rgba(0,0,0,0.3),
                0 0 0 1px rgba(122, 145, 196, 0.35),
                0 0 14px rgba(122, 145, 196, 0.35);
  }
}
@media (prefers-reduced-motion: reduce) {
  .classification-card-left { animation: none; transform: rotateY(0); opacity: 1; }
  .back-channel-cta,
  .back-channel-cta::after { animation: none; }
}

.classification-status {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-family: monospace;
  font-size: 12px;
  color: #8E7F7F;
}

.status-dot {
  width: 8px;
  height: 8px;
  background: darkred;
  border-radius: 50%;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.5); opacity: 0.5; }
}

/* Menu Items */
.menu-items {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  position: relative;
  z-index: 1;
}

.menu-item {
  background: transparent;
  border: none;
  padding: 1rem 2rem;
  font-family: 'Courier New', Courier, monospace;
  font-size: 18px;
  color: #3A3238;
  cursor: pointer;
  position: relative;
  transition: all 0.3s ease;
  opacity: 0;
  transform: translateX(-20px);
  text-align: left;
}

.menu-item:nth-child(1) { animation: slideIn 0.5s ease forwards 0.9s; }
.menu-item:nth-child(2) { animation: slideIn 0.5s ease forwards 1.0s; }
.menu-item:nth-child(3) { animation: slideIn 0.5s ease forwards 1.1s; }
.menu-item:nth-child(4) { animation: slideIn 0.5s ease forwards 1.2s; }
.menu-item:nth-child(5) { animation: slideIn 0.5s ease forwards 1.3s; }
.menu-item:nth-child(6) { animation: slideIn 0.5s ease forwards 1.4s; }
.menu-item:nth-child(7) { animation: slideIn 0.5s ease forwards 1.5s; }

@keyframes slideIn {
  to { opacity: 1; transform: translateX(0); }
}

.menu-item::before {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 1px;
  background: #8E7F7F;
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.3s ease;
}

.menu-item:hover::before {
  transform: scaleX(1);
}

.menu-item::after {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  width: 8px;
  height: 8px;
  background: #8E7F7F;
  border-radius: 50%;
  transform: translate(-20px, -50%);
  opacity: 0;
  transition: all 0.3s ease;
}

.menu-item:hover::after {
  opacity: 1;
  transform: translate(-30px, -50%);
}

.menu-item:hover {
  padding-left: 3rem;
  color: #000;
}

/* Status Labels */
.status-label {
  position: absolute;
  right: 2rem;
  font-size: 12px;
  color: #8E7F7F;
  opacity: 0;
  transform: translateX(20px);
  transition: all 0.3s ease;
}

.menu-item:hover .status-label {
  opacity: 1;
  transform: translateX(0);
}

/* Coffee Stains */
.coffee-stain {
  position: absolute;
  border-radius: 50%;
  background: #8E7F7F;
  opacity: 0;
  pointer-events: none;
}

.stain-1 {
  width: 120px;
  height: 120px;
  bottom: -40px;
  right: -20px;
  transform: rotate(-15deg);
  animation: revealStain 1s ease forwards 1.4s;
}

.stain-2 {
  width: 80px;
  height: 80px;
  top: -20px;
  left: -20px;
  transform: rotate(25deg);
  animation: revealStain 1s ease forwards 1.6s;
}

@keyframes revealStain {
  to { opacity: 0.1; }
}

/* Version Number — clickable handle that flies out a WitSec
   Archive menu (Docket + Record). Caret rotates 180° while
   open so the affordance is obvious. */
.version {
  position: absolute;
  bottom: 1rem;
  right: 1rem;
  font-size: 12px;
  color: #8E7F7F;
  font-family: monospace;
  opacity: 0;
  animation: fadeIn 0.5s ease forwards 1.8s;
  cursor: pointer;
  user-select: none;
  padding: 4px 8px;
  border: 1px dashed transparent;
  transition: border-color 0.2s ease, color 0.2s ease, background 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.version:hover {
  color: #5F5449;
  border-color: rgba(142, 127, 127, 0.55);
  background: rgba(235, 230, 216, 0.45);
}
.version .version-caret {
  font-size: 8px;
  color: rgba(95, 84, 73, 0.6);
  transition: transform 0.22s ease, color 0.22s ease;
}
.version.version-open {
  border-color: #8E7F7F;
  color: #3A3238;
  background: rgba(235, 230, 216, 0.7);
}
.version.version-open .version-caret {
  transform: rotate(180deg);
  color: #8B0000;
}

@keyframes fadeIn {
  to { opacity: 1; }
}