/* ==========================================================================
   bysafira — Design Tokens & Core Component Styles
   Authoritative source: docs/04-design.md & docs/03-technical.md
   WCAG AA Compliant (Mobile-first, 360px base, container max 1100px)
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Google Fonts Loading (Poppins 600, 700 & Inter 400, 600)
   -------------------------------------------------------------------------- */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;600&family=Poppins:wght@600;700&display=swap');

/* --------------------------------------------------------------------------
   2. Design Tokens (CSS Custom Properties)
   -------------------------------------------------------------------------- */
:root {
  /* Brand Color Tokens */
  --navy: #1E2A5A;         /* Primary brand color, headings, header, video bg */
  --coral: #FF6B4A;        /* Accent color, primary CTA button */
  --teal: #2EC4B6;         /* Progress fill, correct answer background */
  --teal-text: #0F7F76;    /* Correct answer text on white/light bg (contrast >= 4.5:1) */
  --bg: #F7F8FC;           /* Page background */
  --surface: #FFFFFF;      /* Card & modal surface */
  --text: #1B1F3B;         /* Primary body text (contrast 15.15:1 on --bg) */
  --text-2: #5B6285;       /* Secondary body & caption text (contrast >= 5.6:1) */
  --wrong: #E5484D;        /* Error fill, wrong answer icon (UI component only) */
  --wrong-text: #C62F34;   /* Wrong answer text on white/light bg (contrast >= 5.1:1) */

  /* Disabled States (WCAG AA Compliant) */
  --disabled-bg: #E2E5F0;  /* Disabled button background */
  --disabled-text: #1E2A5A;/* Disabled button text (contrast 10.89:1 on --disabled-bg) */

  /* Typography Tokens */
  --font-heading: 'Poppins', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-body: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;

  /* Layout & Geometry Tokens */
  --container-max: 1100px;
  --touch-target-min: 44px;
  --radius-card: 16px;
  --radius-btn: 999px;
  --radius-input: 12px;

  /* Shadows */
  --shadow-soft: 0 4px 20px -2px rgba(30, 42, 90, 0.08);
  --shadow-card: 0 2px 12px 0 rgba(30, 42, 90, 0.06);

  /* Force light color scheme to avoid dark-mode contrast distortion */
  color-scheme: light;
}

/* --------------------------------------------------------------------------
   3. Global Base & Accessibility Resets
   -------------------------------------------------------------------------- */
html {
  font-family: var(--font-body);
  color: var(--text);
  background-color: var(--bg);
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  padding: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Headings Typography */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  color: var(--navy);
  font-weight: 700;
  line-height: 1.25;
}

/* Global visible keyboard focus outline (WCAG AA) */
:focus-visible {
  outline: 2px solid var(--navy);
  outline-offset: 2px;
}

/* On Navy backgrounds, use high-contrast Coral outline */
header :focus-visible,
footer :focus-visible,
.bg-navy :focus-visible {
  outline-color: var(--coral);
}

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

/* --------------------------------------------------------------------------
   4. Skip Link (Accessible Keyboard Skip-to-Content Mechanism)
   -------------------------------------------------------------------------- */
.skip-link {
  position: absolute;
  top: -9999px;
  left: 1rem;
  background-color: var(--navy);
  color: #FFFFFF;
  padding: 0.75rem 1.5rem;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.875rem;
  border-radius: 0 0 12px 12px;
  z-index: 10000;
  text-decoration: underline;
  box-shadow: var(--shadow-soft);
  transition: top 0.2s ease;
}

.skip-link:focus,
.skip-link:focus-visible {
  top: 0;
  left: 1rem;
  outline: 3px solid var(--coral);
  outline-offset: 2px;
}

/* --------------------------------------------------------------------------
   5. Container Max-Width & Padding
   -------------------------------------------------------------------------- */
.site-container {
  width: 100%;
  max-width: 1100px;
  margin-left: auto;
  margin-right: auto;
  padding-left: 1rem;
  padding-right: 1rem;
}

@media (min-width: 768px) {
  .site-container {
    padding-left: 1.5rem;
    padding-right: 1.5rem;
  }
}

@media (min-width: 1280px) {
  .site-container {
    padding-left: 2rem;
    padding-right: 2rem;
  }
}

/* --------------------------------------------------------------------------
   6. Touch Target Enforcer (>= 44px)
   -------------------------------------------------------------------------- */
.touch-target {
  min-height: 44px;
  min-width: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* --------------------------------------------------------------------------
   7. Buttons (WCAG AA Compliant)
   -------------------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  min-width: 44px;
  padding: 0.625rem 1.5rem;
  border-radius: var(--radius-btn);
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 0.9375rem;
  text-decoration: none;
  cursor: pointer;
  border: 0;
  transition: transform 0.15s ease, background-color 0.15s ease, box-shadow 0.15s ease;
}

.btn:active {
  transform: scale(0.98);
}

/* Primary Button: Coral background MUST have Navy text (4.86:1). White text is FORBIDDEN. */
.btn-primary {
  background-color: var(--coral);
  color: var(--navy);
  box-shadow: 0 4px 14px rgba(255, 107, 74, 0.35);
}

.btn-primary:hover {
  background-color: #FA5834;
}

/* Secondary Button: Navy background with White text (13.69:1). */
.btn-secondary {
  background-color: var(--navy);
  color: #FFFFFF;
}

.btn-secondary:hover {
  background-color: #273775;
}

/* Teal Button: Teal background MUST have Navy text (6.32:1). White text is FORBIDDEN. */
.btn-teal {
  background-color: var(--teal);
  color: var(--navy);
}

.btn-teal:hover {
  background-color: #26AB9E;
}

/* Outline Button */
.btn-outline {
  background-color: transparent;
  color: var(--navy);
  border: 2px solid var(--navy);
}

.btn-outline:hover {
  background-color: rgba(30, 42, 90, 0.05);
}

/* Disabled Button: WCAG AA Compliant (10.89:1). No pointer events. */
.btn-disabled,
.btn:disabled,
.btn[aria-disabled="true"] {
  background-color: var(--disabled-bg);
  color: var(--disabled-text);
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
  pointer-events: none;
}

/* --------------------------------------------------------------------------
   8. Video Frame Component & Phase 1 Placeholder Card
   -------------------------------------------------------------------------- */
.video-frame {
  position: relative;
  aspect-ratio: 16 / 9;
  border-radius: 16px;
  overflow: hidden;
  background-color: var(--navy);
  width: 100%;
}

.video-frame iframe,
.video-frame video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

/* Placeholder card for Phase 1 */
.video-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  text-align: center;
  color: #FFFFFF;
  background: linear-gradient(135deg, var(--navy) 0%, #293873 100%);
}

.video-placeholder-icon {
  width: 48px;
  height: 48px;
  margin-bottom: 0.75rem;
  color: var(--coral);
}

.video-placeholder-title {
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 1.125rem;
  margin-bottom: 0.5rem;
  color: #FFFFFF;
}

.video-placeholder-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.25rem 0.75rem;
  border-radius: 999px;
  background-color: rgba(255, 255, 255, 0.15);
  font-size: 0.8125rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.video-placeholder-note {
  font-size: 0.8125rem;
  color: #D1D5E8;
}

/* --------------------------------------------------------------------------
   9. Partner Logo Badge (UPGRIS & PJKR on White Surface)
   Authoritative source: docs/04-design.md, ADR-011, WCAG AA compliance
   -------------------------------------------------------------------------- */
.partner-badge,
.logo-badge {
  background-color: var(--surface);
  border-radius: 10px;
  padding: 4px 10px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.25);
  flex-shrink: 0;
  transition: opacity 0.15s ease, transform 0.15s ease;
}

/* Subtle separator line between UPGRIS and PJKR */
.partner-badge-divider {
  display: inline-block;
  width: 1px;
  height: 24px;
  background-color: #E2E5F0;
}

/* Partner Logo Images within Badge */
.partner-logo-img {
  display: block;
  height: 36px;
  width: auto;
  object-fit: contain;
  image-rendering: -webkit-optimize-contrast;
  image-rendering: crisp-edges;
}

.partner-logo-upgris {
  aspect-ratio: 205 / 200;
  max-height: 36px;
}

.partner-logo-pjkr {
  aspect-ratio: 1 / 1;
  max-height: 36px;
}

/* Responsive adjustment for tablet/desktop (>= 768px) */
@media (min-width: 768px) {
  .partner-badge,
  .logo-badge {
    padding: 6px 12px;
    gap: 10px;
  }
  .partner-badge-divider {
    height: 28px;
  }
  .partner-logo-img {
    height: 40px;
  }
  .partner-logo-upgris {
    max-height: 40px;
  }
  .partner-logo-pjkr {
    max-height: 40px;
  }
}

/* --------------------------------------------------------------------------
   10. Feedback & Quiz Status Classes (WCAG AA Compliant)
   -------------------------------------------------------------------------- */
.status-correct {
  color: var(--teal-text);
  font-weight: 600;
}

.badge-correct {
  background-color: #D6F7F3;
  color: var(--teal-text);
  border: 1px solid var(--teal);
}

.status-wrong {
  color: var(--wrong-text);
  font-weight: 600;
}

.badge-wrong {
  background-color: #FEE8E9;
  color: var(--wrong-text);
  border: 1px solid var(--wrong);
}
