/* ═══════════════════════════════════════════════
   global.css — Consolidated styles for cEDH Data
   ═══════════════════════════════════════════════ */

/* ── Fonts ── */
@font-face {
  font-family: 'Asimovian';
  src: url('/branding/fonts/Asimovian-Regular.ttf') format('truetype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

/* ── Base & Dark Mode ── */
html {
  color-scheme: dark !important;
}
body {
  background-color: #070810 !important;
  color: #D1D3D8 !important;
  font-family: 'Montserrat', sans-serif;
}

/* ── Design Tokens (CSS Custom Properties) ── */
:root {
  --color-primary-obsidian: #050608;
  --color-primary-charcoal: #0F1118;
  --color-primary-slate: #1A1D28;
  --color-accent-gold: #C4A66B;
  --color-accent-amber: #B89660;
  --color-accent-copper: #8B6F47;
  --color-ui-background: #070810;
  --color-ui-surface: #0F1118;
  --color-ui-surface-elevated: #181B26;
  --color-ui-border: #252935;
  --color-ui-text-primary: #D1D3D8;
  --color-ui-text-secondary: #8A8F9A;
  --color-ui-text-muted: #5A6069;
  --color-status-success: #4A6B5A;
  --color-status-success-text: #a7f3d0;
  --color-status-warning: #8B6F3A;
  --color-status-warning-text: #fef08a;
  --color-status-error: #6B3A3A;
  --color-status-error-text: #fca5a5;
  --color-status-info: #3A4A6B;
  --color-magic-w: #E8E4D9;
  --color-magic-u: #2A4A6B;
  --color-magic-b: #1C1C1C;
  --color-magic-r: #6B3A3E;
  --color-magic-g: #3A5A44;
}

/* ── Font Families ── */
.font-heading { font-family: 'Exo 2', sans-serif; }
.font-brand { font-family: 'Asimovian', 'Exo 2', sans-serif; }
.font-mono { font-family: 'JetBrains Mono', monospace; }
.font-magic { font-family: 'Exo 2', serif; }

/* ── Theme Utility Classes ── */
.bg-ui-surface { background-color: var(--color-ui-surface); }
.bg-ui-surface-elevated { background-color: var(--color-ui-surface-elevated); }
.bg-brand-charcoal { background-color: var(--color-primary-charcoal); }
.bg-brand-gold { background-color: var(--color-accent-gold); }
.bg-brand-amber { background-color: var(--color-accent-amber); }
.text-ui-text-primary { color: var(--color-ui-text-primary); }
.text-ui-text-secondary { color: var(--color-ui-text-secondary); }
.text-ui-text-muted { color: var(--color-ui-text-muted); }
.text-brand-gold { color: var(--color-accent-gold); }
.text-brand-amber { color: var(--color-accent-amber); }
.text-brand-obsidian { color: var(--color-primary-obsidian); }
.border-ui-border { border-color: var(--color-ui-border); }
.border-brand-gold { border-color: var(--color-accent-gold); }

/* Opacity variants */
.\!bg-ui-surface-elevated\/50, .bg-ui-surface-elevated\/50 { background-color: rgba(24, 27, 38, 0.5); }
.\!bg-ui-surface\/50, .bg-ui-surface\/50 { background-color: rgba(15, 17, 24, 0.5); }
.\!bg-ui-surface\/80, .bg-ui-surface\/80 { background-color: rgba(15, 17, 24, 0.8); }

/* Status Colors */
.bg-ui-text-muted\/20 { background-color: rgba(90, 96, 105, 0.2); }
.\!bg-status-success\/10, .bg-status-success\/10 { background-color: rgba(74, 107, 90, 0.1); }
.\!bg-status-success\/30, .bg-status-success\/30 { background-color: rgba(74, 107, 90, 0.3); }
.border-status-success\/30 { border-color: rgba(74, 107, 90, 0.3); }
.bg-status-warning\/20 { background-color: rgba(139, 111, 58, 0.2); }
.\!bg-status-warning\/30, .bg-status-warning\/30 { background-color: rgba(139, 111, 58, 0.3); }
.border-status-warning\/50 { border-color: rgba(139, 111, 58, 0.5); }
.\!bg-status-error\/10, .bg-status-error\/10 { background-color: rgba(107, 58, 58, 0.1); }
.bg-status-error\/20 { background-color: rgba(107, 58, 58, 0.2); }
.\!bg-status-error\/30, .bg-status-error\/30 { background-color: rgba(107, 58, 58, 0.3); }
.border-status-error\/30 { border-color: rgba(107, 58, 58, 0.3); }
.border-status-error\/50 { border-color: rgba(107, 58, 58, 0.5); }

/* ── Hover States ── */
.hover\:bg-brand-amber:hover { background-color: var(--color-accent-amber); }
.hover\:bg-brand-gold:hover { background-color: var(--color-accent-gold); }
.hover\:text-brand-obsidian:hover { color: var(--color-primary-obsidian); }
.hover\:bg-brand-charcoal:hover { background-color: var(--color-primary-charcoal); }
.hover\:text-ui-text-primary:hover { color: var(--color-ui-text-primary); }
.hover\:text-brand-gold:hover { color: var(--color-accent-gold); }

/* ── Focus States ── */
.focus\:ring-brand-gold:focus {
  outline: 2px solid var(--color-accent-gold);
  outline-offset: 2px;
}
.focus\:border-brand-gold:focus { border-color: var(--color-accent-gold); }

/* ── Other States ── */
.accent-brand-gold { accent-color: var(--color-accent-gold); }
input::placeholder { color: var(--color-ui-text-muted); }

/* ── Component: Select Dropdown ── */
select.bg-ui-surface {
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%238A8F9A' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
  background-position: right 0.5rem center;
  background-repeat: no-repeat;
  background-size: 1.5em 1.5em;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
}

/* ── Aurora Background ── */
.aurora-background {
  position: relative;
  overflow: hidden;
}
.aurora-background::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 150%;
  height: 150%;
  background-image:
    radial-gradient(at 20% 20%, hsla(43, 45%, 59%, 0.15) 0px, transparent 50%),
    radial-gradient(at 80% 20%, hsla(40, 50%, 55%, 0.15) 0px, transparent 50%),
    radial-gradient(at 50% 80%, hsla(38, 56%, 44%, 0.15) 0px, transparent 50%);
  transform: translate(-50%, -50%);
  animation: aurora-spin 25s linear infinite;
  will-change: transform;
  z-index: 0;
}
@keyframes aurora-spin {
  from { transform: translate(-50%, -50%) rotate(0deg); }
  to { transform: translate(-50%, -50%) rotate(360deg); }
}

/* ── Modal & Page Transition Animations ── */
.animate-in {
  animation-duration: 200ms;
  animation-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
  animation-fill-mode: forwards;
}
.fade-in { animation-name: fade-in; }
.zoom-in-95 { animation-name: zoom-in-95; }
.slide-in-from-bottom-4 { animation-name: slide-in-from-bottom-4; }
.slide-in-from-bottom-8 { animation-name: slide-in-from-bottom-8; }
.duration-500 { animation-duration: 500ms; }
.duration-700 { animation-duration: 700ms; }

@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes zoom-in-95 {
  from { transform: scale(0.95); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}
@keyframes slide-in-from-bottom-4 {
  from { transform: translateY(1rem); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}
@keyframes slide-in-from-bottom-8 {
  from { transform: translateY(2rem); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* ── No-Scrollbar Utility ── */
.no-scrollbar::-webkit-scrollbar { display: none; }
.no-scrollbar { -ms-overflow-style: none; scrollbar-width: none; }

/* ── TopBar: Support Button — Iridescent Effect ── */
.support-btn {
  background: #b89660;
  transition: transform 0.15s ease, box-shadow 0.3s ease;
}
.support-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 24px rgba(184, 150, 96, 0.35), 0 0 0 1px rgba(255, 255, 255, 0.08);
}
.support-btn:active {
  transform: translateY(0px);
}

.support-btn__iris {
  background: linear-gradient(
    115deg,
    #c06060 0%, #c07020 12%, #b8a030 24%, #50c080 36%,
    #40a0c8 48%, #7060d0 60%, #c050a0 72%, #c06060 84%, #c4a66b 100%
  );
  background-size: 300% 300%;
  opacity: 0;
  transition: opacity 0.35s ease;
  animation: none;
}
.support-btn:hover .support-btn__iris {
  opacity: 1;
  animation: iris-shift 3s linear infinite;
}
@keyframes iris-shift {
  0%   { background-position: 0% 50%; }
  25%  { background-position: 50% 0%; }
  50%  { background-position: 100% 50%; }
  75%  { background-position: 50% 100%; }
  100% { background-position: 0% 50%; }
}

.support-btn__shine {
  background: linear-gradient(105deg, transparent 30%, rgba(255, 255, 255, 0.30) 50%, transparent 70%);
  background-size: 200% 100%;
  background-position: -100% 0;
  transition: background-position 0s;
}
.support-btn:hover .support-btn__shine {
  background-position: 200% 0;
  transition: background-position 0.55s ease;
}

/* ── Loader: Card Stack Animation ── */
@keyframes card-stack {
  0%, 100% { transform: translateY(0) rotate(0deg) scale(1); opacity: 1; }
  25% { transform: translateY(-20px) rotate(-5deg) scale(1.05); }
  50% { transform: translateY(10px) rotate(5deg) scale(0.95); opacity: 0.5; }
  75% { transform: translateY(0) rotate(0deg) scale(1); opacity: 1; }
}

/* ── MetaDashboard: Gem Animations ── */
@keyframes gem-ring-spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}
@keyframes gem-sparkle {
  0%, 72%, 100% { opacity: 0; transform: rotate(45deg) scale(0.45); }
  82% { opacity: 0.65; transform: rotate(45deg) scale(1); }
  90% { opacity: 0.18; transform: rotate(45deg) scale(0.78); }
}
@keyframes gem-glow {
  0%, 100% { filter: saturate(1.15) brightness(0.92); }
  50% { filter: saturate(1.55) brightness(1.06); }
}
@keyframes artifact-gem-shift {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}
@keyframes gem-card-highlight {
  0% { border-color: rgba(196, 166, 107, 0.2); box-shadow: 0 0 0 rgba(196, 166, 107, 0); transform: scale(1); }
  22% { border-color: rgba(196, 166, 107, 0.95); box-shadow: 0 0 0 4px rgba(196, 166, 107, 0.16), 0 0 32px rgba(196, 166, 107, 0.36); transform: scale(1.015); }
  52% { border-color: rgba(255, 255, 255, 0.22); box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.08), 0 0 18px rgba(196, 166, 107, 0.2); transform: scale(1); }
  76% { border-color: rgba(196, 166, 107, 0.75); box-shadow: 0 0 0 3px rgba(196, 166, 107, 0.12), 0 0 24px rgba(196, 166, 107, 0.28); }
  100% { border-color: rgba(255, 255, 255, 0.05); box-shadow: none; transform: scale(1); }
}

.gem-card-highlight {
  animation: gem-card-highlight 1.9s ease-out;
}

/* ── MetaDashboard: MTG Card Image Rounding ── */
.mtg-card-image {
  border-radius: 4.75% / 3.5%;
  clip-path: inset(0.4% round 4.75% 4.75% 4.75% 4.75% / 3.5% 3.5% 3.5% 3.5%);
  background: transparent;
}

/* ── Accessibility: Reduced Motion ── */
@media (prefers-reduced-motion: reduce) {
  .gem-ring-effect,
  .gem-sparkle-effect,
  .gem-card-highlight,
  .support-btn__iris,
  .support-btn__shine,
  .aurora-background::before {
    animation: none !important;
  }
}
