/* ============================================================
   ArborPrep — styles
   Tailwind handles layout/colour; this file covers the pieces
   Tailwind utilities can't express (study-guide tables, print,
   outdoor contrast mode, motion preferences).
   ============================================================ */

:root {
  --emerald-400: #34d399;
  --emerald-500: #10b981;
  --emerald-600: #059669;
}

/* ---------------- base ---------------- */

html {
  -webkit-text-size-adjust: 100%;
}

body {
  font-feature-settings: 'cv02', 'cv03', 'cv04', 'cv11';
}

code, kbd, .font-mono {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
}

kbd {
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid rgba(148, 163, 184, 0.4);
  border-radius: 4px;
  padding: 0 0.3rem;
  font-size: 0.7rem;
}

/* ---------------- form controls ---------------- */

.input {
  width: 100%;
  background-color: #0f172a;
  border: 1px solid #334155;
  border-radius: 0.75rem;
  padding: 0.625rem 0.75rem;
  font-size: 0.875rem;
  color: #f1f5f9;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.input::placeholder {
  color: #64748b;
}

.input:focus {
  border-color: var(--emerald-500);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.2);
}

/* Native date inputs render dark on dark in some browsers. */
.input[type='date']::-webkit-calendar-picker-indicator {
  filter: invert(0.8);
  cursor: pointer;
}

select.input {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath fill='%2394a3b8' d='M2 4l4 4 4-4z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.6rem center;
  background-size: 0.7rem;
  padding-right: 1.75rem;
}

.btn-primary,
.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  border-radius: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.btn-primary {
  background-color: var(--emerald-600);
  color: #ffffff;
}

.btn-primary:hover {
  background-color: var(--emerald-500);
}

.btn-secondary {
  background-color: #334155;
  color: #e2e8f0;
}

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

.btn-play {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 9999px;
  background-color: #14b8a6;
  color: #0f172a;
  font-weight: 700;
  cursor: pointer;
  transition: background-color 0.15s ease;
}

.btn-play:hover {
  background-color: #2dd4bf;
}

/* Range inputs need explicit accent + height on some platforms. */
.slider {
  width: 100%;
  height: 1.25rem;
  accent-color: #f59e0b;
  cursor: pointer;
  background: transparent;
}

.slider::-webkit-slider-runnable-track {
  height: 0.375rem;
  border-radius: 9999px;
  background: #334155;
}

.slider::-webkit-slider-thumb {
  margin-top: -0.3125rem;
  height: 1rem;
  width: 1rem;
  border-radius: 9999px;
  background: #f59e0b;
  border: 2px solid #0f172a;
  -webkit-appearance: none;
  appearance: none;
}

.slider::-moz-range-track {
  height: 0.375rem;
  border-radius: 9999px;
  background: #334155;
}

.slider::-moz-range-thumb {
  height: 1rem;
  width: 1rem;
  border: 2px solid #0f172a;
  border-radius: 9999px;
  background: #f59e0b;
}

/* ---------------- focus visibility ---------------- */

:focus-visible {
  outline: 2px solid var(--emerald-400);
  outline-offset: 2px;
  border-radius: 4px;
}

.skip-link,
.sr-only-focusable {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.sr-only-focusable:focus {
  position: fixed;
  top: 0.5rem;
  left: 0.5rem;
  z-index: 100;
  width: auto;
  height: auto;
  margin: 0;
  padding: 0.5rem 0.875rem;
  overflow: visible;
  clip: auto;
  white-space: normal;
  background-color: var(--emerald-600);
  color: #ffffff;
  border-radius: 0.5rem;
  font-size: 0.875rem;
  font-weight: 600;
}

/* ---------------- scrollbars ---------------- */

.scrollbar-none {
  -ms-overflow-style: none;
  scrollbar-width: none;
}

.scrollbar-none::-webkit-scrollbar {
  display: none;
}

/* ---------------- study guide typography ---------------- */

.sg-body p {
  margin-bottom: 0.65rem;
}

.sg-body p:last-child {
  margin-bottom: 0;
}

.sg-body strong {
  color: #6ee7b7;
  font-weight: 700;
}

.sg-body code {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.8em;
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid rgba(148, 163, 184, 0.35);
  padding: 0.05rem 0.35rem;
  border-radius: 4px;
  color: #fbbf24;
}

.sg-highlight {
  background-color: rgba(251, 191, 36, 0.3);
  border-radius: 2px;
  padding: 0 2px;
  color: inherit;
}

mark.sg-highlight {
  background-color: rgba(251, 191, 36, 0.3);
  color: #fde68a;
}

.sg-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.75rem;
}

.sg-table th,
.sg-table td {
  padding: 0.55rem 0.7rem;
  text-align: left;
  border-bottom: 1px solid rgba(148, 163, 184, 0.2);
  vertical-align: top;
}

.sg-table th {
  background: rgba(15, 23, 42, 0.7);
  color: #fbbf24;
  font-weight: 700;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.sg-table tbody tr:last-child td {
  border-bottom: none;
}

.sg-table tbody tr:hover td {
  background: rgba(15, 23, 42, 0.35);
}

/* ---------------- motion ---------------- */

@keyframes pulseGlow {
  0%, 100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.45); }
  50%      { box-shadow: 0 0 0 10px rgba(16, 185, 129, 0); }
}

.pulse-glow {
  animation: pulseGlow 2.6s ease-in-out infinite;
}

@media (prefers-reduced-motion: reduce) {
  .pulse-glow {
    animation: none !important;
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0) !important;
  }

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

/* ---------------- outdoor high-contrast mode ---------------- */

body.outdoor-contrast {
  background-color: #000 !important;
  color: #ffffff !important;
}

body.outdoor-contrast .card-bg {
  background-color: #121212 !important;
  border: 2px solid #ffff00 !important;
  color: #ffffff !important;
}

body.outdoor-contrast button,
body.outdoor-contrast input,
body.outdoor-contrast select {
  border: 2px solid #ffffff !important;
  font-weight: 700 !important;
}

body.outdoor-contrast .text-slate-400,
body.outdoor-contrast .text-slate-500,
body.outdoor-contrast .text-slate-300 {
  color: #f1f5f9 !important;
}

body.outdoor-contrast .text-emerald-400,
body.outdoor-contrast .text-amber-400,
body.outdoor-contrast .text-teal-400,
body.outdoor-contrast .text-blue-400 {
  color: #fde047 !important;
}

body.outdoor-contrast .bg-slate-900\/60,
body.outdoor-contrast .bg-slate-900\/70,
body.outdoor-contrast .bg-slate-950\/70 {
  background-color: #0a0a0a !important;
}

/* ---------------- print ---------------- */

@media print {
  body.outdoor-contrast {
    background: #ffffff !important;
    color: #000000 !important;
  }

  body > *:not(#printable-certificate):not(#printable-studyguide) {
    visibility: hidden !important;
  }

  #printable-certificate,
  #printable-certificate * {
    visibility: visible !important;
  }

  #printable-certificate {
    position: absolute !important;
    left: 0;
    top: 0;
    width: 100%;
    box-shadow: none !important;
    border: 4px solid #065f46 !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  #printable-studyguide,
  #printable-studyguide * {
    visibility: visible !important;
  }

  #printable-studyguide {
    position: absolute !important;
    left: 0;
    top: 0;
    width: 100%;
    padding: 1rem;
    background: #ffffff !important;
    color: #000000 !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  #printable-studyguide .sg-body strong { color: #065f46 !important; }
  #printable-studyguide .sg-body code {
    background: #f1f5f9 !important;
    color: #0f172a !important;
    border-color: #94a3b8 !important;
  }
  #printable-studyguide .sg-table th {
    background: #ecfdf5 !important;
    color: #065f46 !important;
  }

  .sg-print-break {
    page-break-inside: avoid;
    break-inside: avoid;
  }

  @page {
    margin: 12mm;
  }
}

/* ---------------- high contrast (OS level) ---------------- */

@media (prefers-contrast: more) {
  .card-bg,
  .opt-btn {
    border-color: #ffffff !important;
  }
}