/* =========================================================
   Variables
   ========================================================= */

:root {
  /* Color Palette - Dragonheir: Silent Gods */
  --color-background: #050509; /* obsidian black */
  --color-surface: #101018;
  --color-surface-elevated: #171725;

  --color-text: #f5f5f7;
  --color-text-muted: #a2a2b5;
  --color-border-subtle: #26263a;

  --color-primary: #c3222b; /* deep blood red */
  --color-primary-soft: rgba(195, 34, 43, 0.15);

  --color-accent-gold: #e6c26b; /* royal gold */
  --color-accent-gold-soft: rgba(230, 194, 107, 0.16);

  --color-accent-turquoise: #19c8d9; /* electric turquoise */
  --color-accent-turquoise-soft: rgba(25, 200, 217, 0.16);

  --color-success: #3bbf72;
  --color-warning: #f3b13c;
  --color-danger: #ff4b55;

  /* Neutral Grays (stormy) */
  --gray-50: #f7f7fb;
  --gray-100: #e2e2f0;
  --gray-200: #c4c4da;
  --gray-300: #a3a3c0;
  --gray-400: #8282a4;
  --gray-500: #636388;
  --gray-600: #4b4b6b;
  --gray-700: #353551;
  --gray-800: #25253a;
  --gray-900: #171724;

  /* Typography */
  --font-sans: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-display: "Cinzel", "Trajan Pro", "Times New Roman", serif; /* epic, cinematic */
  --font-mono: "JetBrains Mono", "SF Mono", Menlo, Monaco, Consolas, "Liberation Mono", monospace;

  --font-size-xs: 0.75rem;   /* 12px */
  --font-size-sm: 0.875rem;  /* 14px */
  --font-size-base: 1rem;    /* 16px */
  --font-size-lg: 1.125rem;  /* 18px */
  --font-size-xl: 1.25rem;   /* 20px */
  --font-size-2xl: 1.5rem;   /* 24px */
  --font-size-3xl: 1.875rem; /* 30px */
  --font-size-4xl: 2.25rem;  /* 36px */
  --font-size-5xl: 3rem;     /* 48px */

  --line-height-tight: 1.1;
  --line-height-snug: 1.3;
  --line-height-normal: 1.5;
  --line-height-relaxed: 1.7;

  /* Spacing Scale (0 – 96px) */
  --space-0: 0;
  --space-1: 0.25rem;  /* 4px */
  --space-2: 0.5rem;   /* 8px */
  --space-3: 0.75rem;  /* 12px */
  --space-4: 1rem;     /* 16px */
  --space-5: 1.25rem;  /* 20px */
  --space-6: 1.5rem;   /* 24px */
  --space-8: 2rem;     /* 32px */
  --space-10: 2.5rem;  /* 40px */
  --space-12: 3rem;    /* 48px */
  --space-16: 4rem;    /* 64px */
  --space-20: 5rem;    /* 80px */
  --space-24: 6rem;    /* 96px */

  /* Radius */
  --radius-none: 0;
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 20px;
  --radius-pill: 999px;

  /* Shadows (cinematic, soft) */
  --shadow-soft: 0 18px 40px rgba(0, 0, 0, 0.4);
  --shadow-soft-sm: 0 8px 24px rgba(0, 0, 0, 0.45);
  --shadow-inner-glow: 0 0 0 1px rgba(230, 194, 107, 0.1), 0 0 40px rgba(25, 200, 217, 0.15);

  /* Transitions */
  --transition-fast: 120ms ease-out;
  --transition-normal: 200ms ease-out;
  --transition-slow: 320ms ease-out;
}

/* =========================================================
   Reset / Normalize
   ========================================================= */

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

html,
body {
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  text-size-adjust: 100%;
}

body {
  min-height: 100vh;
}

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

button,
input,
textarea,
select {
  font: inherit;
  color: inherit;
}

ul,
ol {
  margin: 0;
  padding: 0;
}

h1,
h2,
h3,
h4,
h5,
h6,
p,
figure {
  margin: 0;
}

button {
  border: none;
  background: none;
  padding: 0;
  cursor: pointer;
}

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

/* =========================================================
   Base Styles
   ========================================================= */

body {
  font-family: var(--font-sans);
  font-size: var(--font-size-base);
  line-height: var(--line-height-normal);
  color: var(--color-text);
  background: radial-gradient(circle at top, #1b0a12 0, #050509 55%, #000000 100%);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

main {
  min-height: 100vh;
}

/* Headings: epic display style */

h1,
h2,
h3,
h4,
h5,
h6 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: var(--line-height-tight);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--color-text);
}

h1 {
  font-size: clamp(2.5rem, 3.5vw, var(--font-size-5xl));
  margin-bottom: var(--space-4);
}

h2 {
  font-size: clamp(2rem, 2.8vw, var(--font-size-4xl));
  margin-bottom: var(--space-3);
}

h3 {
  font-size: clamp(1.5rem, 2.1vw, var(--font-size-3xl));
  margin-bottom: var(--space-2);
}

h4 {
  font-size: var(--font-size-2xl);
}

h5 {
  font-size: var(--font-size-xl);
}

h6 {
  font-size: var(--font-size-lg);
}

p {
  margin-bottom: var(--space-4);
  color: var(--color-text-muted);
}

strong,
b {
  font-weight: 600;
  color: var(--gray-50);
}

code,
pre {
  font-family: var(--font-mono);
}

/* Links */

a {
  position: relative;
  color: var(--color-accent-turquoise);
  text-decoration: none;
  transition: color var(--transition-normal), text-shadow var(--transition-normal);
}

a::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -0.15em;
  width: 100%;
  height: 1px;
  background: linear-gradient(90deg, var(--color-primary), var(--color-accent-turquoise));
  transform-origin: left;
  transform: scaleX(0);
  transition: transform var(--transition-normal);
  opacity: 0.9;
}

a:hover::after {
  transform: scaleX(1);
}

a:hover {
  color: var(--color-accent-gold);
  text-shadow: 0 0 12px rgba(230, 194, 107, 0.45);
}

/* Lists */

ul[class],
ol[class] {
  list-style: none;
}

/* =========================================================
   Accessibility & Motion
   ========================================================= */

:focus-visible {
  outline: 2px solid var(--color-accent-turquoise);
  outline-offset: 3px;
}

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

/* =========================================================
   Utilities
   ========================================================= */

/* Layout containers */

.container {
  width: 100%;
  margin-inline: auto;
  padding-inline: var(--space-4);
  max-width: 1200px;
}

@media (min-width: 1440px) {
  .container {
    max-width: 1320px;
  }
}

.section {
  padding-block: var(--space-12);
}

.section--dense {
  padding-block: var(--space-8);
}

/* Flex helpers */

.flex {
  display: flex;
}

.inline-flex {
  display: inline-flex;
}

.flex-center {
  display: flex;
  align-items: center;
  justify-content: center;
}

.flex-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.flex-column {
  display: flex;
  flex-direction: column;
}

.gap-sm {
  gap: var(--space-3);
}

.gap-md {
  gap: var(--space-4);
}

.gap-lg {
  gap: var(--space-6);
}

/* Grid helpers */

.grid {
  display: grid;
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-6);
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-6);
}

@media (max-width: 768px) {
  .grid-2,
  .grid-3 {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* Screen-reader only */

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

/* Utility text colors */

.text-muted {
  color: var(--color-text-muted);
}

.text-gold {
  color: var(--color-accent-gold);
}

.text-primary {
  color: var(--color-primary);
}

/* Utility backgrounds */

.bg-surface {
  background-color: var(--color-surface);
}

.bg-surface-elevated {
  background-color: var(--color-surface-elevated);
}

/* =========================================================
   Components
   ========================================================= */

/* Buttons */

.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding-inline: var(--space-5);
  padding-block: calc(var(--space-2) + 2px);
  border-radius: var(--radius-pill);
  border: 1px solid rgba(230, 194, 107, 0.4);
  font-family: var(--font-display);
  font-size: var(--font-size-sm);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  text-align: center;
  color: var(--gray-50);
  background: radial-gradient(circle at 10% 0, rgba(230, 194, 107, 0.26), rgba(195, 34, 43, 0.98));
  box-shadow: var(--shadow-soft-sm);
  transition: transform var(--transition-fast), box-shadow var(--transition-fast), filter var(--transition-fast), background var(--transition-fast), border-color var(--transition-fast);
}

.btn::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  border: 1px solid rgba(25, 200, 217, 0.4);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-fast);
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-soft);
  filter: brightness(1.05);
}

.btn:hover::before {
  opacity: 1;
}

.btn:active {
  transform: translateY(0);
  box-shadow: var(--shadow-soft-sm);
}

.btn:disabled,
.btn[aria-disabled="true"] {
  cursor: not-allowed;
  opacity: 0.6;
  box-shadow: none;
}

.btn--ghost {
  background: rgba(10, 10, 18, 0.8);
  border-color: rgba(195, 34, 43, 0.9);
}

.btn--outline {
  background: transparent;
  border-color: rgba(230, 194, 107, 0.8);
}

.btn--danger {
  background: radial-gradient(circle at 0 0, rgba(255, 75, 85, 0.4), rgba(110, 7, 13, 0.98));
  border-color: rgba(255, 75, 85, 0.8);
}

/* Inputs */

.input,
select,
textarea {
  width: 100%;
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border-subtle);
  background-color: rgba(8, 8, 16, 0.96);
  color: var(--color-text);
  font-size: var(--font-size-sm);
  line-height: var(--line-height-normal);
  transition: border-color var(--transition-normal), box-shadow var(--transition-normal), background-color var(--transition-normal);
}

.input::placeholder,
textarea::placeholder {
  color: var(--gray-500);
}

.input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: none;
  border-color: var(--color-accent-turquoise);
  box-shadow: 0 0 0 1px rgba(25, 200, 217, 0.6), 0 0 24px rgba(25, 200, 217, 0.25);
}

.input[disabled],
select[disabled],
textarea[disabled] {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Cards: for lore, characters, scenes */

.card {
  position: relative;
  padding: var(--space-5);
  border-radius: var(--radius-xl);
  background: radial-gradient(circle at top, rgba(195, 34, 43, 0.18), rgba(10, 10, 20, 0.98));
  border: 1px solid rgba(230, 194, 107, 0.24);
  box-shadow: var(--shadow-soft);
  overflow: hidden;
}

.card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 0 0, rgba(25, 200, 217, 0.18), transparent 60%);
  mix-blend-mode: screen;
  opacity: 0.35;
  pointer-events: none;
}

.card__header {
  margin-bottom: var(--space-4);
}

.card__title {
  font-family: var(--font-display);
  font-size: var(--font-size-2xl);
  letter-spacing: 0.08em;
}

.card__subtitle {
  font-size: var(--font-size-sm);
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--color-accent-gold);
}

.card__body {
  position: relative;
  z-index: 1;
}

/* Media wrapper for cinematic images */

.card__media {
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-soft);
}

.card__media img {
  width: 100%;
  height: auto;
  display: block;
}

/* Tag / pill (e.g., role, faction) */

.pill {
  display: inline-flex;
  align-items: center;
  padding-inline: var(--space-3);
  padding-block: calc(var(--space-1) + 2px);
  border-radius: var(--radius-pill);
  border: 1px solid rgba(230, 194, 107, 0.7);
  font-size: var(--font-size-xs);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--color-accent-gold);
  background: linear-gradient(90deg, rgba(195, 34, 43, 0.75), rgba(23, 23, 36, 0.95));
}

/* Cinematic section divider */

.divider {
  width: 100%;
  height: 1px;
  margin-block: var(--space-6);
  background: linear-gradient(
    90deg,
    transparent,
    rgba(230, 194, 107, 0.75),
    rgba(25, 200, 217, 0.55),
    transparent
  );
  opacity: 0.8;
}

/* Hero overlay utilities (for large key-art sections) */

.hero-overlay-dark {
  position: relative;
}

.hero-overlay-dark::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, rgba(5, 5, 9, 0.1), rgba(5, 5, 9, 0.96) 80%);
  pointer-events: none;
}

