/* ===========================================================
   Imposter Game — Theme (colors, typography, RTL/LTR, base)
   =========================================================== */

:root {
  /* Base palette */
  --bg-base: #F4F1EA;
  --bg-base-dots: #DAD4C6;
  --surface: #FFFFFF;
  --ink: #16161A;
  --ink-soft: #4A4A52;

  /* Brand (sampled from logo-rect-ar.png — see README + assets/brand/palette-from-logo-rect-ar.json) */
  --brand-orange: #F37108;
  --brand-orange-bright: #F68E0A;
  --brand-yellow: #FAC803;
  --brand-cyan: #08CFF4;
  --brand-cyan-muted: #19A5DD;
  --brand-navy: #030F49;
  --brand-imposter-red: #DC062C;

  /* Accents (mapped to brand where it helps UI cohesion) */
  --accent-amber: var(--brand-yellow);
  --accent-coral: var(--brand-imposter-red);
  --accent-teal: #16C79A;
  --accent-blue: #4D96FF;
  --accent-violet: #A26BFA;
  --accent-pink: #FF7AC6;
  --on-accent: var(--ink);

  /* Structure */
  --border-w: 3px;
  --border-w-lg: 4px;
  --radius-sm: 12px;
  --radius-md: 18px;
  --radius-lg: 26px;
  --radius-pill: 999px;
  --radius-badge: var(--radius-pill);

  --shadow-sm: 2px 2px 0 0 var(--ink);
  --shadow-md: 3px 3px 0 0 var(--ink);
  --shadow-lg: 5px 5px 0 0 var(--ink);
  --shadow-sticker-sm: 2px 2px 0 0 var(--ink), 3px 3px 0 0 var(--brand-orange);
  --shadow-sticker-md: 3px 3px 0 0 var(--ink), 5px 5px 0 0 var(--brand-orange);
  --shadow-soft: 0 6px 16px rgba(22,22,26,0.08);

  /* Marketing washes (brand-tinted gradients on light bg) */
  --wash-brand-yellow: rgba(250, 200, 3, 0.22);
  --wash-brand-cyan: rgba(8, 207, 244, 0.12);
  --wash-brand-orange: rgba(243, 113, 8, 0.1);
  --border-soft: rgba(22, 22, 26, 0.12);
  --ink-muted: #6b6b73;
  --gradient-marketing-cta: linear-gradient(135deg, var(--wash-brand-yellow), var(--wash-brand-cyan));
  --gradient-page-cta: linear-gradient(135deg, rgba(250, 200, 3, 0.18), var(--wash-brand-orange));
  /* Extra inset space so hard shadows are not clipped by overflow:auto parents */
  --shadow-clearance: 6px;

  --ease-pop: cubic-bezier(.2,.9,.3,1.3);
  --ease-smooth: cubic-bezier(.4,0,.2,1);

  --font-ar: 'Cairo', 'Tajawal', sans-serif;
  --font-en: 'Poppins', 'Rubik', sans-serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

html[lang="ar"] body, [data-lang="ar"] body { font-family: var(--font-ar); }
html[lang="en"] body, [data-lang="en"] body { font-family: var(--font-en); }

body {
  margin: 0;
  min-height: 100vh;
  background-color: var(--bg-base);
  color: var(--ink);
  background-image:
    radial-gradient(ellipse 120% 80% at 90% 0%, rgba(243, 113, 8, 0.04), transparent 55%),
    radial-gradient(ellipse 100% 70% at 0% 100%, rgba(8, 207, 244, 0.04), transparent 50%),
    radial-gradient(var(--bg-base-dots) 1.6px, transparent 1.6px);
  background-size: 100% 100%, 100% 100%, 26px 26px;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* Logical direction helpers so one stylesheet serves RTL + LTR */
[dir="rtl"] .flip-x { transform: scaleX(-1); }
[dir="ltr"] .flip-x { transform: none; }

.container {
  width: 100%;
  max-width: 1180px;
  margin-inline: auto;
  padding-inline: 20px;
}

h1, h2, h3, h4 { margin: 0; font-weight: 900; }
p { margin: 0; }

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

::selection { background: var(--brand-yellow); color: var(--ink); }

/* Focus visibility (a11y) */
:focus-visible {
  outline: 3px solid var(--brand-cyan-muted);
  outline-offset: 2px;
}

/* Scrollbar hide util */
.scrollbar-hide::-webkit-scrollbar { display: none; }
.scrollbar-hide { -ms-overflow-style: none; scrollbar-width: none; }

/* Skip to content */
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

/* Responsive type scale */
.h-display { font-size: clamp(2.1rem, 5vw, 4rem); line-height: 1.1; }
.h-xl { font-size: clamp(1.6rem, 3.2vw, 2.4rem); line-height: 1.2; }
.h-lg { font-size: clamp(1.3rem, 2.2vw, 1.8rem); line-height: 1.25; }
.text-lead { font-size: clamp(1rem, 1.6vw, 1.25rem); color: var(--ink-soft); line-height: 1.65; }

@media (max-width: 640px) {
  .container { padding-inline: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .anim-pop,
  .anim-float,
  .fade-screen,
  .answer-card.anim-pop-once {
    animation: none !important;
  }
  .btn,
  .field {
    transition: none;
  }
}

/* Panels must not clip neo-brutalist offsets */
:is(
  .panel,
  .setup-panel,
  .host-sidebar,
  .host-stage,
  .status-panel,
  .question-panel,
  .results-card,
  .step-card,
  .feature-card,
  .preview-card,
  .hero-visual
) {
  overflow: visible;
}

/**
 * Scroll regions: padding inside the scrollport so 4–9px shadows stay visible.
 * (overflow-y:auto forces clipping; padding is the reliable fix.)
 */
.scroll-shadow-safe {
  overflow-y: auto;
  overflow-x: hidden;
  padding: var(--shadow-clearance);
  /* Hard shadows offset +x/+y (physical right & bottom) */
  padding-bottom: calc(var(--shadow-clearance) + 3px);
  padding-right: calc(var(--shadow-clearance) + 3px);
  scrollbar-gutter: stable;
}

/* Flex/grid rows: reserve space for shadow on the +x/+y side */
.brutal-row-gap {
  padding-bottom: 3px;
  padding-inline-end: 3px;
}

/* Dark theme (admin toggle; reusable for game/marketing later) */
[data-theme="dark"] {
  --bg-base: #121218;
  --bg-base-dots: #2a2a32;
  --surface: #1e1e26;
  --ink: #f4f1ea;
  --ink-soft: #b8b4ac;

  --shadow-sm: 2px 2px 0 0 #000;
  --shadow-md: 3px 3px 0 0 #000;
  --shadow-lg: 5px 5px 0 0 #000;
  --shadow-sticker-sm: 2px 2px 0 0 #000, 3px 3px 0 0 var(--brand-orange);
  --shadow-sticker-md: 3px 3px 0 0 #000, 5px 5px 0 0 var(--brand-orange);
  --shadow-soft: 0 6px 16px rgba(0, 0, 0, 0.35);

  --wash-brand-yellow: rgba(250, 200, 3, 0.12);
  --wash-brand-cyan: rgba(8, 207, 244, 0.08);
  --wash-brand-orange: rgba(243, 113, 8, 0.12);
  --border-soft: rgba(244, 241, 234, 0.12);
  --ink-muted: #9a968f;
}

[data-theme="dark"] body {
  background-image:
    radial-gradient(ellipse 120% 80% at 90% 0%, rgba(243, 113, 8, 0.06), transparent 55%),
    radial-gradient(ellipse 100% 70% at 0% 100%, rgba(8, 207, 244, 0.05), transparent 50%),
    radial-gradient(var(--bg-base-dots) 1.6px, transparent 1.6px);
}

[data-theme="dark"] .btn-ghost:hover {
  background: rgba(255, 255, 255, 0.06);
}

[data-theme="dark"] .admin-nav-link:hover {
  background: rgba(255, 255, 255, 0.06);
}

[data-theme="dark"] .panel {
  background: var(--surface);
}

[data-theme="dark"] .field {
  background: #252530;
  border-color: var(--ink-soft);
  color: var(--ink);
}

[data-theme="dark"] .field:focus {
  border-color: var(--brand-cyan);
}

[data-theme="dark"] .admin-table th {
  color: var(--ink-muted);
}

[data-theme="dark"] .admin-table tr.is-stale td {
  background: rgba(243, 113, 8, 0.12);
}

[data-theme="dark"] .admin-topbar {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
}
