/* ==========================================================================
   2J Game — Obsidian Royale
   tokens.css — design tokens, reset and base element styles
   ========================================================================== */

:root {
  /* --- Core palette ------------------------------------------------------ */
  --color-bg:             #0B0B0D;   /* Charcoal Black */
  --color-bg-deep:        #060607;   /* Deepest black, used for footer wells */
  --color-surface:        #141416;   /* Obsidian panel */
  --color-surface-2:      #1C1C1F;   /* Raised obsidian */
  --color-surface-3:      #232326;   /* Highest obsidian (chips, inputs) */
  --color-surface-glass:  rgba(28, 28, 31, 0.6);

  --color-accent:         #D4AF37;   /* Royal Gold */
  --color-accent-bright:  #F4D06F;   /* Gold highlight / shimmer */
  --color-accent-dim:     #9C7F26;   /* Gold pressed/dim state */
  --color-accent-soft:    rgba(212, 175, 55, 0.10);

  --color-text-primary:   #F8F6F0;   /* Ivory White */
  --color-text-secondary: #C9C6BC;   /* Muted ivory */
  --color-text-muted:     #8B887F;   /* Lifted from spec for AA contrast */

  --color-border:         rgba(212, 175, 55, 0.18);   /* Hairline gold */
  --color-border-strong:  rgba(212, 175, 55, 0.40);
  --color-border-neutral: rgba(248, 246, 240, 0.08);

  --color-success:        #4CAF7D;
  --color-error:          #E5484D;
  --color-telegram:       #2AABEE;

  /* --- Typography -------------------------------------------------------- */
  --font-display:     'Cormorant Garamond', 'Playfair Display', Georgia, 'Times New Roman', serif;
  --font-heading-alt: 'Cinzel', 'Cormorant Garamond', Georgia, serif;
  --font-body:        'Inter', 'Noto Nastaliq Urdu', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --font-urdu:        'Noto Nastaliq Urdu', 'Jameel Noori Nastaleeq', serif;

  --fs-eyebrow:  0.75rem;
  --fs-xs:       0.8125rem;
  --fs-sm:       0.9375rem;
  --fs-base:     1rem;
  --fs-lg:       1.125rem;
  --fs-xl:       1.375rem;
  --fs-h4:       clamp(1.125rem, 0.95rem + 0.7vw, 1.375rem);
  --fs-h3:       clamp(1.375rem, 1.1rem + 1.1vw, 1.875rem);
  --fs-h2:       clamp(1.875rem, 1.35rem + 2.2vw, 3rem);
  --fs-h1:       clamp(2.375rem, 1.5rem + 3.6vw, 4.25rem);

  --lh-tight: 1.12;
  --lh-snug:  1.35;
  --lh-body:  1.75;

  /* --- Spacing scale ----------------------------------------------------- */
  --space-2:  0.125rem;
  --space-4:  0.25rem;
  --space-8:  0.5rem;
  --space-12: 0.75rem;
  --space-16: 1rem;
  --space-20: 1.25rem;
  --space-24: 1.5rem;
  --space-32: 2rem;
  --space-40: 2.5rem;
  --space-48: 3rem;
  --space-64: 4rem;
  --space-80: 5rem;
  --space-96: 6rem;

  --section-y: clamp(3.5rem, 2rem + 6vw, 6.5rem);

  /* --- Layout ------------------------------------------------------------ */
  --container-max: 1240px;
  --container-wide: 1440px;
  --container-narrow: 820px;
  --gutter: 1.25rem;         /* breathing room on the left/right edges */
  --header-h: 74px;
  --header-h-compact: 60px;

  /* --- Shadows & glow ---------------------------------------------------- */
  --shadow-card:        0 4px 20px rgba(0, 0, 0, 0.5);
  --shadow-card-lift:   0 18px 44px rgba(0, 0, 0, 0.62);
  --shadow-glow:        0 0 24px rgba(212, 175, 55, 0.22);
  --shadow-glow-strong: 0 0 48px rgba(212, 175, 55, 0.38);
  --shadow-inset-top:   inset 0 1px 0 rgba(248, 246, 240, 0.06);

  --gradient-gold: linear-gradient(135deg, #9C7F26 0%, #D4AF37 38%, #F4D06F 55%, #D4AF37 72%, #9C7F26 100%);
  --gradient-panel: linear-gradient(160deg, rgba(28, 28, 31, 0.92) 0%, rgba(15, 15, 17, 0.92) 100%);
  --gradient-foil: linear-gradient(120deg, transparent 30%, rgba(244, 208, 111, 0.35) 50%, transparent 70%);

  /* --- Radii & motion ---------------------------------------------------- */
  --radius-sm:   6px;
  --radius-md:   12px;
  --radius-lg:   20px;
  --radius-xl:   28px;
  --radius-full: 9999px;

  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
  --dur-fast: 160ms;
  --dur-base: 280ms;
  --dur-slow: 520ms;

  --z-base: 1;
  --z-sticky: 100;
  --z-header: 200;
  --z-drawer: 300;
  --z-modal: 400;
}

/* ==========================================================================
   Reset
   ========================================================================== */

*,
*::before,
*::after {
  box-sizing: border-box;
}

* {
  margin: 0;
  padding: 0;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 1rem);
}

/* Horizontal overflow is locked down at the document level so no decorative
   element, marquee or carousel can ever introduce a sideways scrollbar. */
html {
  max-width: 100%;
  /* Fallback for engines without `overflow: clip`. Applied to <html> only —
     putting it on <body> too would turn <body> into a non-scrolling scroll
     container and break the sticky header. */
  overflow-x: hidden;
}

body {
  max-width: 100%;
  overscroll-behavior-x: none;
}

/* `clip` does the same job without turning either element into a scroll
   container, so the sticky header and smooth anchor scrolling keep working. */
@supports (overflow: clip) {
  html,
  body {
    overflow-x: clip;
  }
}

body {
  min-height: 100vh;
  background-color: var(--color-bg);
  color: var(--color-text-secondary);
  font-family: var(--font-body);
  font-size: var(--fs-base);
  line-height: var(--lh-body);
  font-synthesis-weight: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

input,
button,
textarea,
select {
  font: inherit;
  color: inherit;
}

button {
  background: none;
  border: 0;
  cursor: pointer;
}

ul,
ol {
  list-style: none;
}

a {
  color: var(--color-accent-bright);
  text-decoration: none;
  transition: color var(--dur-fast) var(--ease-out);
}

a:hover {
  color: var(--color-accent);
}

table {
  border-collapse: collapse;
  width: 100%;
}

hr {
  border: 0;
  border-top: 1px solid var(--color-border);
}

::selection {
  background: rgba(212, 175, 55, 0.32);
  color: var(--color-text-primary);
}

/* ==========================================================================
   Base typography
   ========================================================================== */

h1,
h2,
h3,
h4,
h5,
h6 {
  color: var(--color-text-primary);
  font-family: var(--font-display);
  font-weight: 600;
  line-height: var(--lh-tight);
  letter-spacing: -0.01em;
  text-wrap: balance;
}

h1 { font-size: var(--fs-h1); }
h2 { font-size: var(--fs-h2); }
h3 { font-size: var(--fs-h3); }
h4 { font-size: var(--fs-h4); font-family: var(--font-body); font-weight: 600; letter-spacing: 0; }
h5 { font-size: var(--fs-lg); font-family: var(--font-body); font-weight: 600; letter-spacing: 0; }
h6 { font-size: var(--fs-base); font-family: var(--font-body); font-weight: 600; letter-spacing: 0; }

p {
  text-wrap: pretty;
}

strong,
b {
  color: var(--color-text-primary);
  font-weight: 600;
}

small {
  font-size: var(--fs-xs);
}

code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.9em;
  background: var(--color-surface-2);
  border: 1px solid var(--color-border-neutral);
  border-radius: var(--radius-sm);
  padding: 0.1em 0.4em;
  color: var(--color-accent-bright);
}

/* ==========================================================================
   Accessibility primitives
   ========================================================================== */

:focus-visible {
  outline: 2px solid var(--color-accent-bright);
  outline-offset: 3px;
  border-radius: var(--radius-sm);
}

:focus:not(:focus-visible) {
  outline: none;
}

.skip-link {
  position: absolute;
  top: -100px;
  left: var(--space-16);
  z-index: var(--z-modal);
  padding: 0.75rem 1.25rem;
  background: var(--color-accent);
  color: #0B0B0D;
  font-weight: 700;
  border-radius: 0 0 var(--radius-md) var(--radius-md);
  transition: top var(--dur-base) var(--ease-out);
}

.skip-link:focus {
  top: 0;
  color: #0B0B0D;
}

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}
