/* ============================================
   BASE — override Tailwind Preflight's link reset
   Gold on parchment: #8a6a00 on #f4e4b8 = 5.7:1 ✓ AA
   ============================================ */

a {
  color: #8a6a00;
  text-decoration: underline;
}

a:hover,
a:focus {
  color: #5c4600;
}

/* ============================================
   SKIP LINK — keyboard & motor accessibility
   Gold on dark stone: #c8960a on #1a1410 = 7.2:1 ✓ AA
   ============================================ */

.skip-link {
  position: absolute;
  top: -60px;
  left: 0;
  background: #1a1410;
  color: #c8960a;
  border: 2px solid #c8960a;
  padding: 8px 16px;
  text-decoration: none;
  border-radius: 0 0 6px 0;
  font-family: 'Cinzel', Georgia, serif;
  font-weight: 700;
  z-index: 100;
  transition: top 0.15s ease;
}

.skip-link:focus {
  top: 0;
  outline: 3px solid #c8960a;
  outline-offset: 2px;
}

/* ============================================
   DECORATIVE CARD BORDER — parchment frame
   Uses CSS outline to create a double-border
   effect without affecting layout or a11y tree
   ============================================ */

.med-card-frame {
  outline: 2px solid #8a6a00;
  outline-offset: 4px;
}

/* ============================================
   KBD — keyboard shortcut badges
   Dark stone on parchment feel
   ============================================ */

kbd {
  display: inline-block;
  padding: 1px 7px;
  font-family: 'Crimson Text', Georgia, serif;
  font-size: 0.9em;
  font-weight: 600;
  background-color: #1a1410;
  color: #f0e6c8;
  border: 1px solid #8a6a00;
  border-radius: 4px;
  box-shadow: 0 2px 0 #5c4600;
  line-height: 1.5;
}

/* ============================================
   GAME BUTTONS — touch targets (WCAG 2.5.5)
   Min 44×44px; Cinzel font applied via Tailwind
   ============================================ */

.game-btn {
  min-height: 44px;
  min-width: 44px;
  cursor: pointer;
  letter-spacing: 0.03em;
}

.game-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ============================================
   RESULT BOX — base + win / lose / tie states
   Each state uses bg + border + text — never
   color as the sole differentiator (WCAG 1.4.1)

   Win:  #c8f0c8 on #1a3a1a = 7.1:1 ✓ AAA
   Lose: #f5c8c8 on #3a1010 = 7.0:1 ✓ AAA
   Tie:  #f0d888 on #2a2010 = 6.8:1 ✓ AAA
   ============================================ */

.result-box {
  /* 4px base keeps layout stable across all states — border-width never changes,
     only border-color and border-style, so there is no layout shift */
  border: 4px solid transparent;
  transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

/* Win — solid border + ⚔ prefix in JS
   Colorblind cue: shape (solid line) + symbol */
.result-win {
  background-color: #1a3a1a;
  border-color: #4a9a4a;
  border-style: solid;
  color: #c8f0c8;
}

/* Lose — double border + ☠ prefix in JS
   Colorblind cue: shape (double line) + symbol
   4px double = two 1px strokes with a 2px gap */
.result-lose {
  background-color: #3a1010;
  border-color: #c84040;
  border-style: double;
  color: #f5c8c8;
}

/* Tie — dashed border + ⚖ prefix in JS
   Colorblind cue: shape (dashes) + symbol */
.result-tie {
  background-color: #2a2010;
  border-color: #c8a830;
  border-style: dashed;
  color: #f0d888;
}

/* ============================================
   RESPONSIVE — small screens
   ============================================ */

@media (max-width: 480px) {
  h1 {
    font-size: 1.6rem;
  }

  .game-btn,
  #btn-reset {
    width: 100%;
    max-width: 280px;
  }
}

/* ============================================
   DARK MODE — prefers-color-scheme: dark
   Card shifts to dark leather; text to warm cream
   Cream on leather: #f0e6c8 on #2a1e10 = 10.4:1 ✓ AAA
   ============================================ */

@media (prefers-color-scheme: dark) {
  main {
    background-color: #2a1e10 !important;
    color: #f0e6c8 !important;
    outline-color: #c8960a;
  }

  .med-card-frame {
    outline-color: #c8960a;
  }

  kbd {
    background-color: #1a1410;
    border-color: #c8960a;
    color: #f0e6c8;
    box-shadow: 0 2px 0 #8a6a00;
  }

  /* Scoreboard divider */
  .border-med-card-dark {
    border-color: #4a3010 !important;
  }
}

/* ============================================
   REDUCED MOTION — vestibular / motion sensitivity
   ============================================ */

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

  .skip-link {
    transition: none;
  }
}

/* ============================================
   HIGH CONTRAST — Windows forced colors
   ============================================ */

@media (prefers-contrast: more) {
  .game-btn {
    border: 3px solid #000 !important;
  }

  .game-btn:focus {
    outline: 4px solid #000 !important;
    outline-offset: 3px !important;
  }

  .result-win,
  .result-lose,
  .result-tie {
    border-width: 3px;
  }

  kbd {
    border: 2px solid #000;
    box-shadow: none;
  }

  .med-card-frame {
    outline-width: 3px;
  }
}

/* ============================================
   PRINT
   ============================================ */

@media print {
  .skip-link,
  kbd {
    display: none;
  }

  .game-btn,
  #btn-reset {
    border: 2px solid #000 !important;
    color: #000 !important;
    background: none !important;
  }

  main {
    background: #fff !important;
    color: #000 !important;
    outline: none !important;
  }
}
