/* =============================================================================
   CULTURAL GAMES — global.css
   Design tokens, reset, base typography, and layout utilities.
   All other stylesheets build on top of this one.
============================================================================= */

/* =============================================================================
   DESIGN TOKENS (CSS Custom Properties)
============================================================================= */
:root {
  /* ── Color Palette ── */

  /* Backgrounds */
  --color-bg:          #FBF5E6;   /* warm parchment — page background */
  --color-surface:     #FFFFFF;   /* card / panel surfaces */
  --color-surface-alt: #F3EAD3;   /* slightly deeper warm — hover states, dividers */

  /* Primary (dark game-board tone) */
  --color-primary:     #1A0E06;   /* near-black walnut — headers, nav, footer */

  /* Accent palette — culturally inspired, no single culture */
  --color-accent-red:  #B83232;   /* deep festival red — primary CTA */
  --color-accent-gold: #C89B3C;   /* rich antique gold — logo, highlights */
  --color-accent-teal: #2C7873;   /* jade/earthy teal — tags, secondary accent */
  --color-accent-warm: #D4663A;   /* terracotta orange — hover glows, badges */

  /* Text */
  --color-text:        #1A0E06;   /* body text */
  --color-text-muted:  #6B5744;   /* secondary / caption text */
  --color-text-inverse: #FFFFFF;  /* text on dark backgrounds */

  /* Borders & Shadows */
  --color-border:      #DDD0B5;
  --color-shadow:      rgba(26, 14, 6, 0.14);

  /* ── Typography ── */
  --font-display: 'Playfair Display', Georgia, 'Times New Roman', serif;
  --font-body:    'Outfit', system-ui, -apple-system, sans-serif;

  /* Type scale (1.25 Major Third) */
  --text-xs:   0.75rem;    /*  12px */
  --text-sm:   0.875rem;   /*  14px */
  --text-base: 1rem;       /*  16px */
  --text-lg:   1.125rem;   /*  18px */
  --text-xl:   1.25rem;    /*  20px */
  --text-2xl:  1.5rem;     /*  24px */
  --text-3xl:  1.875rem;   /*  30px */
  --text-4xl:  2.25rem;    /*  36px */
  --text-5xl:  3rem;       /*  48px */

  --leading-tight:  1.25;
  --leading-snug:   1.4;
  --leading-normal: 1.65;

  --weight-normal:   400;
  --weight-medium:   500;
  --weight-semibold: 600;
  --weight-bold:     700;

  /* ── Spacing (8px base unit) ── */
  --space-1:  0.5rem;    /*  8px */
  --space-2:  1rem;      /* 16px */
  --space-3:  1.5rem;    /* 24px */
  --space-4:  2rem;      /* 32px */
  --space-5:  2.5rem;    /* 40px */
  --space-6:  3rem;      /* 48px */
  --space-8:  4rem;      /* 64px */
  --space-10: 5rem;      /* 80px */
  --space-12: 6rem;      /* 96px */

  /* ── Border Radius ── */
  --radius-sm:   4px;
  --radius-md:   8px;
  --radius-lg:   16px;
  --radius-xl:   24px;
  --radius-full: 9999px;

  /* ── Shadows ── */
  --shadow-sm: 0 1px 3px var(--color-shadow);
  --shadow-md: 0 4px 12px var(--color-shadow);
  --shadow-lg: 0 8px 28px var(--color-shadow);
  --shadow-xl: 0 16px 48px var(--color-shadow);

  /* ── Transitions ── */
  --transition-fast: 140ms ease;
  --transition-base: 240ms ease;
  --transition-slow: 380ms ease;

  /* ── Layout ── */
  --container-max:     1200px;
  --container-padding: var(--space-2);

  /* ── Nav ── */
  --nav-height: 64px;
}

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

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  tab-size: 2;
}

body {
  font-family: var(--font-body);
  font-size: var(--text-base);
  font-weight: var(--weight-normal);
  line-height: var(--leading-normal);
  color: var(--color-text);
  background-color: var(--color-bg);
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img, video, canvas, svg {
  display: block;
  max-width: 100%;
}

a {
  color: inherit;
  text-decoration: none;
}

ul, ol {
  list-style: none;
}

button {
  font-family: var(--font-body);
  cursor: pointer;
  border: none;
  background: none;
  -webkit-appearance: none;
}

input, select, textarea {
  font-family: var(--font-body);
}

table {
  border-collapse: collapse;
}

/* =============================================================================
   TYPOGRAPHY — Base
============================================================================= */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: var(--weight-bold);
  line-height: var(--leading-tight);
  color: var(--color-text);
}

h1 { font-size: var(--text-4xl); }
h2 { font-size: var(--text-3xl); }
h3 { font-size: var(--text-2xl); }
h4 { font-size: var(--text-xl); }
h5 { font-size: var(--text-lg); }
h6 { font-size: var(--text-base); }

p {
  line-height: var(--leading-normal);
}

/* Apply readable measure only in prose contexts */
.prose p {
  max-width: 68ch;
}

strong { font-weight: var(--weight-semibold); }
em     { font-style: italic; }

small {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}

/* =============================================================================
   LAYOUT UTILITIES
============================================================================= */

/* Centered content wrapper */
.container {
  width: 100%;
  max-width: var(--container-max);
  margin-inline: auto;
  padding-inline: var(--container-padding);
}

/* Main stretches to fill page, pushing footer down */
main {
  flex: 1;
}

/* Section spacing */
.section {
  padding-block: var(--space-10);
}

.section--sm {
  padding-block: var(--space-6);
}

/* Visually hide but keep accessible */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

/* =============================================================================
   FOCUS STYLES — Accessibility
============================================================================= */
:focus-visible {
  outline: 3px solid var(--color-accent-gold);
  outline-offset: 3px;
  border-radius: var(--radius-sm);
}

/* =============================================================================
   SCROLLBAR — subtle warm style
============================================================================= */
::-webkit-scrollbar        { width: 8px; }
::-webkit-scrollbar-track  { background: var(--color-surface-alt); }
::-webkit-scrollbar-thumb  { background: var(--color-border); border-radius: var(--radius-full); }
::-webkit-scrollbar-thumb:hover { background: var(--color-text-muted); }

/* =============================================================================
   SELECTION COLOR
============================================================================= */
::selection {
  background-color: var(--color-accent-gold);
  color: var(--color-primary);
}

/* =============================================================================
   ROOM MODE — strip site chrome when a game runs inside a room iframe
   game-bridge.js adds .room-mode to <html> when ?roomId= is present.
============================================================================= */
.room-mode .site-nav,
.room-mode .game-nav-bar,
.room-mode .site-footer,
.room-mode #mp-panel,
.room-mode .mp-panel,
.room-mode .pt-mode-row,
.room-mode #pt-new-game-btn,
.room-mode .game-header,
.room-mode .game-disclaimer,
.room-mode .accordion {
  display: none !important;
}
.room-mode body {
  background: var(--color-bg);
}
.room-mode .game-page {
  padding: var(--space-3) 0 0;
}
.room-mode .game-page .container {
  padding-inline: var(--space-3);
}
