:root {
  --night: #050404;
  --night-lighter: #110c0b;
  --ember: #ff7a2f;
  --ember-glow: rgba(255, 122, 47, 0.4);
  --crimson: #8a1c1c;
  --rune-blue: #5fa8ff;
  --ash: #b9b0a6;
  --ash-dim: #8f857b;
  --font-title: 'Cinzel', serif;
  --font-body: 'EB Garamond', Georgia, serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  background-color: var(--night);
  color: var(--ash);
  font-family: var(--font-body);
  line-height: 1.6;
  overflow-x: hidden;
  font-size: 18px;
}

canvas#ember-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: -1;
  pointer-events: none;
}

/* Typography */
h1, h2, h3, h4, .tag, .btn {
  font-family: var(--font-title);
  text-transform: uppercase;
}

h2 {
  font-size: clamp(2rem, 5vw, 3rem);
  color: #e9ddd0;
  text-align: center;
  margin-bottom: 2rem;
  letter-spacing: 0.1em;
  text-shadow: 0 0 10px rgba(255, 122, 47, 0.2);
}

h3 {
  font-size: 1.5rem;
  color: var(--ember);
  margin-bottom: 1rem;
}

h4 {
  font-size: 1.2rem;
  color: #e9ddd0;
  margin-bottom: 0.5rem;
}

a {
  color: var(--ember);
  text-decoration: none;
  transition: color 0.3s ease, text-shadow 0.3s ease;
}

a:hover {
  color: #ff9b5f;
  text-shadow: 0 0 8px var(--ember-glow);
}

/* Accessibility: Focus rings */
a:focus-visible, button:focus-visible {
  outline: 2px solid var(--rune-blue);
  outline-offset: 4px;
}
a:focus:not(:focus-visible), button:focus:not(:focus-visible) {
  outline: none;
}

/* Layout */
.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 16px;
}

.section {
  padding: 80px 0;
}

/* Navigation */
nav {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  padding: 20px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 100;
  background: linear-gradient(to bottom, rgba(5,4,4,0.9) 0%, rgba(5,4,4,0) 100%);
}

.nav-links {
  display: flex;
  gap: 24px;
}

.nav-links a {
  color: var(--ash);
  font-family: var(--font-title);
  font-size: 0.9rem;
  letter-spacing: 0.1em;
}

.nav-links a:hover {
  color: var(--ember);
}

.lang-switch {
  background: none;
  border: 1px solid var(--ash-dim);
  color: var(--ash);
  cursor: pointer;
  padding: 4px 10px;
  font-family: var(--font-title);
  font-size: 0.8rem;
  transition: all 0.3s;
}

.lang-switch:hover {
  border-color: var(--ember);
  color: var(--ember);
}

/* Hero Section */
.hero {
  height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 0 16px;
  position: relative;
}

.hero-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  z-index: 10;
}

.emblem {
  width: min(78vw, 460px);
  aspect-ratio: 1;
  /* The emblem art sits on black: screen it into the page and fade its square edges away. */
  mix-blend-mode: screen;
  -webkit-mask-image: radial-gradient(circle at 50% 50%, #000 58%, transparent 71%);
  mask-image: radial-gradient(circle at 50% 50%, #000 58%, transparent 71%);
  animation: breathe 6s ease-in-out infinite;
}

@keyframes breathe {
  0%, 100% { filter: brightness(1); }
  50% { filter: brightness(1.18) saturate(1.1); }
}

.title {
  font-size: clamp(2.6rem, 11vw, 5.2rem);
  color: #e9ddd0;
  font-weight: 700;
  letter-spacing: 0.32em;
  margin: 16px 0 0 0.32em;
  text-shadow: 0 0 18px rgba(255, 110, 30, 0.45), 0 2px 0 #000;
}

.tag {
  letter-spacing: 0.25em;
  font-size: clamp(0.8rem, 2.8vw, 1rem);
  color: var(--ember);
  margin-top: 10px;
}

.line {
  margin-top: 28px;
  font-size: clamp(1.05rem, 3.6vw, 1.3rem);
  font-style: italic;
}

.hero-ctas {
  margin-top: 40px;
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  justify-content: center;
}

.btn {
  display: inline-block;
  padding: 12px 24px;
  font-size: 0.9rem;
  letter-spacing: 0.15em;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.3s ease;
}

.btn-primary {
  background-color: var(--crimson);
  color: #e9ddd0;
  border-color: var(--crimson);
}
.btn-primary:hover {
  background-color: #a82424;
  color: #fff;
  box-shadow: 0 0 15px rgba(255, 122, 47, 0.4);
}

.btn-outline {
  background-color: transparent;
  color: var(--ash);
  border-color: var(--ash-dim);
}
.btn-outline:hover {
  border-color: var(--ember);
  color: var(--ember);
}

/* Thin Gold/Ember Separator */
.separator {
  width: 150px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--ember), transparent);
  margin: 0 auto;
  opacity: 0.6;
}

/* Intersection Observer Reveal */
.reveal {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 1s ease-out, transform 1s ease-out;
}
.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

/* Lore */
.lore-text {
  max-width: 800px;
  margin: 0 auto;
  font-size: 1.1rem;
  text-align: center;
}
.lore-text p {
  margin-bottom: 1.5rem;
}

/* World Grid */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 32px;
}

.card {
  background: var(--night-lighter);
  border: 1px solid #221815;
  padding: 20px;
  transition: transform 0.3s ease, border-color 0.3s ease;
}
.card:hover {
  transform: translateY(-5px);
  border-color: #3d241c;
}

.card-img {
  width: 100%;
  aspect-ratio: 16/9;
  background-color: #111;
  background-size: cover;
  background-position: center;
  margin-bottom: 20px;
  border: 1px solid #000;
  background-image: linear-gradient(45deg, #1a0f0c, #0d1218);
}

/* A region not in the game yet: no picture, only a sealed, ember-dark panel. */
.card-img.sealed {
  background-image: radial-gradient(ellipse at 50% 70%, rgba(255, 98, 20, 0.28), transparent 60%), linear-gradient(180deg, #0b0705, #050404);
}

/* Combat */
.combat .intro {
  text-align: center;
  max-width: 800px;
  margin: 0 auto 40px auto;
  font-size: 1.1rem;
}
.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 32px;
  margin-bottom: 40px;
}
.feature {
  text-align: center;
  padding: 20px;
  background: rgba(17, 12, 11, 0.5);
  border-top: 1px solid var(--ember);
}
.platforms-note {
  text-align: center;
  font-style: italic;
  color: var(--ash-dim);
}

/* Journey */
.journey .intro {
  text-align: center;
  margin-bottom: 30px;
}
.journey-list {
  max-width: 600px;
  margin: 0 auto;
  list-style: none;
}
.journey-list li {
  margin-bottom: 16px;
  padding-left: 30px;
  position: relative;
  font-size: 1.1rem;
}
.journey-list li::before {
  content: '♦';
  color: var(--ember);
  position: absolute;
  left: 0;
  font-size: 1.2rem;
}

/* Media (YouTube & Gallery) */
.video-container {
  width: 100%;
  max-width: 800px;
  aspect-ratio: 16/9;
  margin: 0 auto 40px auto;
  background: #0a0a0a;
  border: 1px solid #222;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  border-radius: 4px;
}
.trailer-soon {
  font-family: var(--font-title);
  color: var(--ash-dim);
  letter-spacing: 0.1em;
  font-size: 1.2rem;
}
.video-container iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: none;
}
.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 16px;
}
.gallery-img {
  width: 100%;
  aspect-ratio: 16/9;
  object-fit: cover;
  cursor: pointer;
  background: #111;
  opacity: 0; /* JS handles fade in to hide broken link icon before load */
  transition: opacity 0.5s ease;
}
.gallery-img.loaded {
  opacity: 1;
}
.gallery-img:hover {
  opacity: 0.8;
}

/* Follow */
.follow {
  text-align: center;
}
.follow .social-links {
  margin: 30px 0;
  display: flex;
  gap: 16px;
  justify-content: center;
}
.contact-link {
  font-size: 1.1rem;
  letter-spacing: 0.05em;
}

/* Footer */
footer {
  text-align: center;
  padding: 40px 16px;
  font-size: 0.9rem;
  color: var(--ash-dim);
  background: #030202;
  border-top: 1px solid #1a1a1a;
}
.made-by {
  margin-top: 8px;
  font-style: italic;
}

/* Lightbox Modal */
.lightbox {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.9);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}
.lightbox.active {
  opacity: 1;
  pointer-events: auto;
}
.lightbox img {
  max-width: 90%;
  max-height: 90vh;
  box-shadow: 0 0 30px rgba(0,0,0,0.8);
}
.lightbox-close {
  position: absolute;
  top: 20px;
  right: 30px;
  background: none;
  border: none;
  color: #fff;
  font-size: 3rem;
  cursor: pointer;
  line-height: 1;
}

/* Mobile & Media Queries */
@media (max-width: 768px) {
  .nav-links {
    flex-wrap: wrap;
    justify-content: center;
    gap: 12px;
    font-size: 0.8rem;
  }
  nav {
    flex-direction: column;
    gap: 12px;
    background: rgba(5,4,4,0.95);
  }
  .hero-ctas {
    flex-direction: column;
    width: 100%;
    padding: 0 32px;
  }
  .btn {
    width: 100%;
  }
}

/* Accessibility / Reduced Motion */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  .emblem {
    animation: none;
  }
  .reveal {
    transition: none;
    opacity: 1;
    transform: none;
  }
  canvas#ember-canvas {
    display: none;
  }
}
