/* ============================================================
   ARCADE CHROME — Shared Horizon Design System Wrapper
   Served from /arcade-chrome.css (Vercel static + cached)
   ============================================================ */

/* ---- Horizon Design Tokens ---- */
:root {
  /* Light Mode (Sunrise) */
  --bg-page: #FAF9F6;
  --bg-panel: #FDFBFA;
  --bg-elevated: #F5F2ED;
  --text-primary: #3C3836;
  --text-secondary: #6B6560;
  --text-muted: #A8A29E;
  --accent-primary: #D4A373;   /* Sun-Kissed Gold */
  --accent-secondary: #DCAE96; /* Dusty Rose */
  --accent-pop: #E9C46A;
  --border: rgba(60,56,54,0.1);
  --shadow-sm: rgba(60,56,54,0.05) 0px 2px 8px;
  --shadow-md: rgba(60,56,54,0.08) 0px 8px 24px;
  --shadow-lg: rgba(60,56,54,0.12) 0px 20px 40px;
  --focus-ring: hsla(212, 100%, 48%, 1);
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg-page: #1A1614;
    --bg-panel: #2D2826;
    --bg-elevated: #3C3836;
    --text-primary: #F5F2ED;
    --text-secondary: #BDB7B2;
    --text-muted: #8C8580;
    --accent-primary: #FDBA74;   /* Golden Hour */
    --accent-secondary: #E9967A; /* Hazy Coral */
    --accent-pop: #FAD0C4;
    --border: rgba(245,242,237,0.1);
    --shadow-sm: rgba(0,0,0,0.2) 0px 2px 8px;
    --shadow-md: rgba(0,0,0,0.3) 0px 8px 24px;
    --shadow-lg: rgba(0,0,0,0.4) 0px 20px 40px;
  }
}

/* ---- Typography (Geist) ---- */
@import url('https://fonts.googleapis.com/css2?family=Geist:wght@300;400;500;600&family=Geist+Mono:wght@400;500&display=swap');

:root {
  --font-sans: 'Geist', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'Geist Mono', ui-monospace, monospace;
}

/* ---- Reset & Base ---- */
*, *::before, *::after { box-sizing: border-box; }
html { font-size: 16px; -webkit-font-smoothing: antialiased; }
body { margin: 0; font: 400 1rem/1.6 var(--font-sans); color: var(--text-primary); background: var(--bg-page); min-height: 100vh; }

/* ---- Layout Primitives ---- */
.container { max-width: 1200px; margin: 0 auto; padding: 0 1.5rem; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

/* ---- Focus Styles ---- */
:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; }

/* ============================================================
   ARCADE HEADER
   ============================================================ */
.arcade-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg-panel);
  border-bottom: 1px solid var(--border);
  padding: 1rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.arcade-logo {
  font: 600 1.25rem/1.2 var(--font-sans);
  color: var(--text-primary);
  text-decoration: none;
  letter-spacing: -0.02em;
  transition: color 0.2s;
}
.arcade-logo:hover { color: var(--accent-primary); }

.arcade-badge {
  font: 500 0.75rem/1.2 var(--font-sans);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent-primary);
  background: color-mix(in srgb, var(--accent-primary) 15%, transparent);
  padding: 0.25rem 0.75rem;
  border-radius: 9999px;
  white-space: nowrap;
}

/* ============================================================
   ARCADE MAIN — Game + Sidebar
   ============================================================ */
.arcade-main {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
  padding: 2rem 1.5rem;
  max-width: 1200px;
  margin: 0 auto;
}

@media (min-width: 900px) {
  .arcade-main {
    grid-template-columns: 1fr 280px;
    align-items: start;
  }
}

/* ---- Game Wrapper ---- */
.arcade-game-wrapper {
  position: relative;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  overflow: hidden;
  aspect-ratio: 4 / 3;
  max-width: 100%;
}

.arcade-game-wrapper canvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none; /* Prevent scrolling on game canvas */
}

/* ---- Pause / Save Overlay ---- */
.arcade-overlay {
  position: absolute;
  inset: 0;
  background: rgba(26, 22, 20, 0.92);
  backdrop-filter: blur(8px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  padding: 2rem;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s, visibility 0.2s;
  z-index: 50;
}

.arcade-overlay:not([hidden]) {
  opacity: 1;
  visibility: visible;
}

.arcade-overlay h2 {
  margin: 0;
  font: 600 1.5rem/1.2 var(--font-sans);
  color: var(--text-primary);
}

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  font: 500 0.875rem/1.4 var(--font-sans);
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s, background 0.15s;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  white-space: nowrap;
}
.btn:active { transform: scale(0.98); }
.btn:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; }

.btn-primary {
  background: var(--accent-primary);
  color: var(--text-primary);
  box-shadow: var(--shadow-sm);
}
.btn-primary:hover { background: var(--accent-pop); transform: translateY(-1px); box-shadow: var(--shadow-md); }

.btn-secondary {
  background: var(--bg-elevated);
  color: var(--text-primary);
  border: 1px solid var(--border);
}
.btn-secondary:hover { background: var(--bg-panel); border-color: var(--accent-primary); }

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  padding: 0.5rem 1rem;
}
.btn-ghost:hover { color: var(--accent-primary); }

/* ============================================================
   ARCADE SIDEBAR — Game Info & Controls
   ============================================================ */
.arcade-sidebar {
  position: sticky;
  top: 100px;
  max-height: calc(100vh - 120px);
  overflow-y: auto;
  padding: 1.5rem;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.arcade-sidebar h2 {
  margin: 0 0 0.5rem;
  font: 600 clamp(1.25rem, 2.5vw, 1.5rem)/1.2 var(--font-sans);
  color: var(--text-primary);
}

.arcade-sidebar .game-description {
  margin: 0 0 1.5rem;
  color: var(--text-secondary);
  font-size: 0.95rem;
  line-height: 1.6;
}

.arcade-controls {
  border-top: 1px solid var(--border);
  padding-top: 1rem;
}

.arcade-controls h3 {
  margin: 0 0 1rem;
  font: 500 0.75rem/1.2 var(--font-sans);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

.control-list {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.5rem 1rem;
  margin: 0;
  font-size: 0.875rem;
}

.control-list dt {
  color: var(--text-muted);
  font: 400 0.875rem/1.4 var(--font-mono);
  text-align: right;
  padding-right: 0.5rem;
}

.control-list dd {
  margin: 0;
  color: var(--text-primary);
  font: 400 0.875rem/1.4 var(--font-sans);
}

/* ============================================================
   ARCADE FOOTER
   ============================================================ */
.arcade-footer {
  border-top: 1px solid var(--border);
  padding: 1.5rem;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.875rem;
}

.arcade-footer a {
  color: var(--accent-primary);
  text-decoration: none;
  font-weight: 500;
}
.arcade-footer a:hover { text-decoration: underline; }

/* ============================================================
   MOBILE TOUCH SHIM CONTAINER
   ============================================================ */
.touch-shim-container {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 200;
  pointer-events: none;
  display: none; /* Activated by JS on touch devices */
}

@media (hover: none) and (pointer: coarse) {
  .touch-shim-container.active { display: block; }
}

/* ============================================================
   REDUCED MOTION
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ============================================================
   PRINT STYLES
   ============================================================ */
@media print {
  .arcade-header, .arcade-sidebar, .arcade-footer, .arcade-overlay, .touch-shim-container {
    display: none !important;
  }
  .arcade-main { grid-template-columns: 1fr; padding: 0; }
  .arcade-game-wrapper { box-shadow: none; border: 1px solid #000; }
}