/* ==========================================================================
   Puzzle Lab — Design Tokens & Base Styles
   Calm, intelligent, modern Arabic RTL identity
   ========================================================================== */

:root {
  /* Core Brand Palette */
  --pl-navy: #0F1E36;
  --pl-navy-soft: #1B3256;
  --pl-navy-deep: #091324;
  --pl-gold: #F2B705;
  --pl-gold-hover: #D9A204;
  --pl-gold-ink: #8A6200;
  --pl-gold-tint: #FEF7DC;

  /* Calm Cream & White Surfaces */
  --pl-bg: #FBF9F4;
  --pl-surface: #FFFFFF;
  --pl-surface-alt: #F3EFE6;
  --pl-border: #E3DEC9;
  --pl-border-strong: #CEC6AA;

  /* Typography & Grays */
  --pl-text: #162338;
  --pl-text-secondary: #475569;
  --pl-text-muted: #64748B;
  --pl-text-on-navy: #F8FAFC;

  /* Semantic Status (Always paired with icons/text) */
  --pl-success: #15803D;
  --pl-success-bg: #DCFCE7;
  --pl-success-border: #86EFAC;
  --pl-danger: #B91C1C;
  --pl-danger-bg: #FEE2E2;
  --pl-danger-border: #FCA5A5;
  --pl-info: #1D4ED8;
  --pl-info-bg: #DBEAFE;
  --pl-info-border: #93C5FD;
  --pl-warning: #A16207;
  --pl-warning-bg: #FEF3C7;
  --pl-warning-border: #FDE68A;

  /* Typography */
  --pl-font: 'Cairo', 'Segoe UI', Tahoma, Arial, sans-serif;
  --pl-font-mono: 'Consolas', 'Courier New', monospace;

  /* Radii & Elevation */
  --pl-radius-sm: 8px;
  --pl-radius-md: 14px;
  --pl-radius-lg: 20px;
  --pl-radius-pill: 999px;
  --pl-shadow-sm: 0 2px 8px rgba(15, 30, 54, 0.05);
  --pl-shadow-md: 0 8px 24px rgba(15, 30, 54, 0.08);
  --pl-shadow-lg: 0 18px 40px rgba(15, 30, 54, 0.14);

  /* Transitions */
  --pl-transition: 0.2s cubic-bezier(0.22, 1, 0.36, 1);
}

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  padding: 0;
  direction: rtl;
  text-align: right;
  font-family: var(--pl-font);
  background-color: var(--pl-bg);
  color: var(--pl-text);
  line-height: 1.7;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

main {
  flex: 1 0 auto;
}

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

button,
input,
select,
textarea {
  font-family: inherit;
  font-size: inherit;
}

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

h1, h2, h3, h4, p {
  margin-top: 0;
}

/* Accessibility & Focus */
:focus-visible {
  outline: 3px solid var(--pl-gold);
  outline-offset: 2px;
}

.pl-skip-link {
  position: absolute;
  top: -120px;
  right: 16px;
  z-index: 9999;
  background: var(--pl-navy);
  color: var(--pl-gold);
  padding: 10px 18px;
  border-radius: var(--pl-radius-sm);
  font-weight: 700;
  border: 2px solid var(--pl-gold);
  transition: top var(--pl-transition);
}

.pl-skip-link:focus {
  top: 12px;
}

.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;
}

.pl-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  display: inline-block;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
