:root {
  --indigo: #4b0082;
  --lavender: #e6e6fa;
  --teal: #008080;
  --gold: #daa520;
  --charcoal: #36454f;
  --purple: #800080;
  --blackberry: #14051f;
  --night: #0f0715;
  --panel: rgba(255, 255, 255, 0.075);
  --panel-strong: rgba(255, 255, 255, 0.12);
  --text: #f8f3ff;
  --muted: #cdbfe0;
  --border: rgba(230, 230, 250, 0.25);
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.35);
  --radius: 22px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: "Chivo Mono", monospace;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(128, 0, 128, 0.55), transparent 35%),
    radial-gradient(circle at bottom right, rgba(0, 128, 128, 0.35), transparent 30%),
    linear-gradient(135deg, var(--night), var(--blackberry) 55%, #050208);
  min-height: 100vh;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255,255,255,0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.025) 1px, transparent 1px);
  background-size: 38px 38px;
  mask-image: linear-gradient(to bottom, rgba(0,0,0,0.75), transparent 85%);
}

.skip-link {
  position: absolute;
  left: -999px;
  top: 1rem;
  background: var(--gold);
  color: #1b0e00;
  padding: 0.75rem 1rem;
  border-radius: 999px;
  z-index: 20;
}

.skip-link:focus {
  left: 1rem;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 1rem;
  align-items: center;
  padding: 1.2rem clamp(1rem, 4vw, 3rem);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(18px);
  background: rgba(15, 7, 21, 0.85);
}

.brand-block h1 {
  margin: 0;
  font-family: "Cinzel Decorative", serif;
  font-size: clamp(2rem, 4vw, 4rem);
  letter-spacing: 0.08em;
  color: var(--lavender);
  text-shadow: 0 0 30px rgba(230, 230, 250, 0.35);
}

.eyebrow {
  margin: 0 0 0.35rem;
  color: var(--gold);
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 0.78rem;
  font-weight: 600;
}

.tagline {
  margin: 0.3rem 0 0;
  color: var(--muted);
  max-width: 55rem;
}

.nav-toggle {
  display: none;
  border: 1px solid var(--border);
  color: var(--text);
  background: var(--panel);
  border-radius: 12px;
  padding: 0.6rem 0.8rem;
  font-size: 1.3rem;
  cursor: pointer;
}

.primary-nav {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}

.nav-link {
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
  padding: 0.7rem 1rem;
  font-family: inherit;
  cursor: pointer;
  transition: transform 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

.nav-link:hover,
.nav-link:focus-visible {
  transform: translateY(-2px);
  border-color: var(--gold);
  background: rgba(218, 165, 32, 0.15);
}

.nav-link.active {
  color: #160016;
  background: linear-gradient(135deg, var(--gold), #ffe7a6);
  border-color: transparent;
}

main {
  width: min(1180px, calc(100% - 2rem));
  margin: 0 auto;
  padding: clamp(1.25rem, 4vw, 3rem) 0 5rem;
}

.content-section {
  display: none;
  animation: fadeIn 0.3s ease both;
}

.active-section {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

h2,
h3,
h4 {
  font-family: "Cinzel", serif;
  line-height: 1.15;
}

h2 {
  font-size: clamp(2rem, 4vw, 3.5rem);
  margin: 0 0 1rem;
}

h3 {
  font-size: 1.45rem;
  color: var(--lavender);
  margin: 0 0 0.75rem;
}

h4 {
  color: #fff5cf;
  margin: 0 0 0.5rem;
}

p,
li {
  line-height: 1.75;
  color: var(--muted);
}

.hero-panel,
.feature-card,
.info-card,
.story-panel,
.admin-box,
.holiday-block,
.hierarchy article,
.accordion-list details,
.timeline article,
.race-card {
  border: 1px solid var(--border);
  background: var(--panel);
  box-shadow: var(--shadow);
  border-radius: var(--radius);
}

.hero-panel {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(260px, 0.75fr);
  gap: 2rem;
  padding: clamp(1.4rem, 4vw, 3rem);
  min-height: 420px;
  align-items: stretch;
}

.image-slot {
  min-height: 150px;
  display: grid;
  place-items: center;
  border-radius: calc(var(--radius) - 6px);
  border: 1px dashed rgba(230, 230, 250, 0.35);
  background:
    linear-gradient(135deg, rgba(75,0,130,0.4), rgba(0,128,128,0.15)),
    rgba(255,255,255,0.05);
  color: rgba(248, 243, 255, 0.7);
  text-align: center;
  font-family: "Cinzel", serif;
}

.image-slot.large {
  min-height: 100%;
}


.image-frame {
  margin: 0;
  min-height: 150px;
  overflow: hidden;
  border-radius: calc(var(--radius) - 6px);
  background: rgba(0, 0, 0, 0.28);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.04);
}

.image-frame.large {
  min-height: 100%;
}

.image-frame img,
.section-banner {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: none;
}

.section-banner {
  max-height: 220px;
  margin: 0 0 1rem;
  border-radius: calc(var(--radius) - 8px);
  border: 1px solid rgba(230, 230, 250, 0.25);
  object-position: center;
}

.cosmos-image {
  display: grid;
  place-items: center;
  margin: 0 auto 1.5rem;
  max-width: 350px;
  padding: 1.2rem;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255,255,255,0.16), rgba(0,128,128,0.08), transparent 68%);
}

.cosmos-image img {
  width: min(350px, 70vw);
  height: auto;
  display: block;
}


.section-heading {
  margin-bottom: 1.5rem;
  max-width: 850px;
}

.info-grid,
.card-grid,
.race-grid,
.location-list,
.hierarchy,
.timeline {
  display: grid;
  gap: 1rem;
}

.two-column {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 1rem;
}

.card-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.card-grid.compact {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.info-card,
.race-card,
.holiday-block,
.story-panel,
.admin-box,
.hierarchy article,
.timeline article {
  padding: 1.2rem;
}

.info-card:hover,
.race-card:hover,
.feature-card:hover {
  background: var(--panel-strong);
}

.needed-you {
  font-size: clamp(2rem, 4vw, 3.6rem);
  line-height: 1;
  margin: 0.4rem 0;
  color: var(--gold);
  font-family: "Cinzel Decorative", serif;
}

.location-list {
  grid-template-columns: 1fr;
}

.feature-card {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 1.2rem;
  padding: 1rem;
}

.meta {
  color: #fff0b3;
  margin-top: -0.3rem;
}

.accordion-list {
  display: grid;
  gap: 0.85rem;
}

.accordion-list details {
  padding: 0.9rem 1.2rem;
}

.accordion-list summary {
  cursor: pointer;
  font-family: "Cinzel", serif;
  color: var(--lavender);
  font-size: 1.25rem;
  padding: 0.4rem 0;
}

.race-toolbar {
  margin-bottom: 1rem;
  display: grid;
  gap: 0.45rem;
  max-width: 520px;
}

.race-toolbar label {
  color: var(--gold);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.8rem;
}

.race-toolbar input {
  width: 100%;
  padding: 0.9rem 1rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.07);
  color: var(--text);
  font-family: inherit;
}

.race-toolbar input::placeholder {
  color: rgba(248, 243, 255, 0.45);
}

.race-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.subheading {
  margin: 2rem 0 1rem;
}

.timeline {
  grid-template-columns: repeat(7, minmax(0, 1fr));
}

.holiday-block {
  margin-bottom: 1rem;
}

.holiday-block ul,
.info-card ul {
  padding-left: 1.2rem;
}

.hierarchy {
  grid-template-columns: 1fr;
}

.hierarchy article {
  position: relative;
  overflow: hidden;
}

.hierarchy article::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 5px;
  background: linear-gradient(var(--gold), var(--teal), var(--purple));
}

.story-panel {
  margin-bottom: 1rem;
  padding: 1.5rem;
}

.rules-list {
  display: grid;
  gap: 0.7rem;
  padding-left: 1.3rem;
}

.site-footer {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.5rem clamp(1rem, 4vw, 3rem);
  border-top: 1px solid var(--border);
  color: var(--muted);
  background: rgba(0,0,0,0.24);
}

.signature {
  font-family: "Pinyon Script", cursive;
  font-size: 1.6rem;
  color: var(--gold);
  margin: 0;
}

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

.hidden {
  display: none;
}

@media (max-width: 960px) {
  .hero-panel,
  .feature-card,
  .two-column {
    grid-template-columns: 1fr;
  }

  .card-grid,
  .race-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .card-grid.compact,
  .timeline {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .site-header {
    grid-template-columns: 1fr auto;
  }

  .nav-toggle {
    display: inline-grid;
  }

  .primary-nav {
    display: none;
    flex-direction: column;
  }

  .primary-nav.open {
    display: flex;
  }

  .nav-link {
    width: 100%;
    text-align: left;
  }

  .card-grid,
  .race-grid,
  .card-grid.compact,
  .timeline {
    grid-template-columns: 1fr;
  }

  .site-footer {
    flex-direction: column;
  }
}


.sub-heading {
  margin-top: 2.5rem;
}

.map-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.25rem;
  margin-top: 1rem;
}

.map-card {
  margin: 0;
  border: 1px solid var(--border);
  background: var(--panel);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.map-card img {
  width: 100%;
  display: block;
  aspect-ratio: 1 / 0.78;
  object-fit: cover;
  object-position: center;
}

.map-card figcaption {
  padding: 1rem;
  color: var(--muted);
  line-height: 1.6;
}

.mini-banner {
  width: 100%;
  display: block;
  margin: 0 auto 1rem;
  height: auto;
  object-fit: contain;
  object-position: center center;
  border-radius: calc(var(--radius) - 8px);
}

.mini-symbol {
  width: min(150px, 45%);
  float: right;
  margin: 0 0 1rem 1rem;
  border-radius: 18px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.08);
}

@media (max-width: 800px) {
  .map-grid {
    grid-template-columns: 1fr;
  }

  .mini-symbol {
    float: none;
    width: 150px;
    margin: 0 0 1rem;
  }
}


/* Overview hero banner fix: keep the Wisteria header horizontal and fully visible. */
.overview-hero {
  grid-template-columns: 1fr;
  min-height: auto;
  align-items: start;
}

.overview-banner {
  width: 100%;
  min-height: 0;
  background: rgba(0, 0, 0, 0.28);
}

.overview-banner img {
  width: 100%;
  height: auto;
  max-height: none;
  object-fit: contain;
  object-position: center;
}

.current-focus-card {
  text-align: center;
}

.square-symbol {
  display: block;
  width: 250px;
  height: 250px;
  object-fit: cover;
  margin: 0 auto 1rem;
  border-radius: 18px;
  border: 1px solid rgba(230, 230, 250, 0.28);
  box-shadow: 0 14px 38px rgba(0, 0, 0, 0.35);
}

/* Needed Characters poster */
.needed-card {
  text-align: center;
}

.needed-poster {
  display: block;
  width: min(100%, 340px);
  height: auto;
  margin: 0 auto 1.2rem;
  border-radius: 18px;
  border: 1px solid rgba(230, 230, 250, 0.28);
  box-shadow: 0 14px 38px rgba(0, 0, 0, 0.38);
  background: rgba(0, 0, 0, 0.28);
}


/* Locations: horizontal full-image presentation */
.location-list .feature-card {
  grid-template-columns: 1fr;
  gap: 1rem;
}

/* Location banners */
.location-list .image-frame {
  width: 100%;
  height: auto !important;
  min-height: unset !important;
  aspect-ratio: unset !important;
  overflow: visible !important;
  display: block;
  background: transparent;
}

.location-list .image-frame img {
  width: 100%;
  height: auto !important;
  max-height: none !important;
  display: block;
  object-fit: unset !important;
  object-position: center bottom !important;
}

/* Center the player reference / city map headings */
.section-heading.sub-heading {
  text-align: center;
  margin-left: auto;
  margin-right: auto;
}

.section-heading.sub-heading .eyebrow,
.section-heading.sub-heading h3,
.section-heading.sub-heading p {
  text-align: center;
  margin-left: auto;
  margin-right: auto;
}

/* City maps: show the entire map image without cropping */
.map-card img {
  width: 100%;
  height: auto;
  aspect-ratio: auto;
  object-fit: contain;
  object-position: center;
  background: rgba(0, 0, 0, 0.35);
}


/* TRUE horizontal location and map image treatment: generated images are landscape canvases that show the full original art. */
.location-list .feature-card {
  grid-template-columns: 1fr !important;
  gap: 1.25rem;
}

.location-list .image-frame {
  width: 100%;
  min-height: 0 !important;
  aspect-ratio: 16 / 7;
  display: block;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.35);
}

.location-list .image-frame img {
  width: 100%;
  height: 100% !important;
  object-fit: cover !important;
  object-position: center !important;
  display: block;
}

.section-heading.sub-heading {
  width: 100%;
  max-width: 900px;
  text-align: center !important;
  margin: 2.75rem auto 1.25rem !important;
}

.section-heading.sub-heading .eyebrow,
.section-heading.sub-heading h3,
.section-heading.sub-heading p {
  text-align: center !important;
  margin-left: auto !important;
  margin-right: auto !important;
}

.map-grid {
  align-items: start;
}

.map-card img {
  width: 100%;
  height: auto !important;
  aspect-ratio: 16 / 9;
  object-fit: cover !important;
  object-position: center !important;
  display: block;
  background: rgba(0, 0, 0, 0.35);
}


/* Reverted city maps: use original map artwork and show the complete image without horizontal cropping. */
.map-card img {
  width: 100%;
  height: auto !important;
  aspect-ratio: auto !important;
  object-fit: contain !important;
  object-position: center !important;
  display: block;
  background: rgba(0, 0, 0, 0.35);
}

/* Magic section: elemental branches as square cards for better readability */
#magic .timeline {
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  align-items: stretch;
}

#magic .timeline article {
  aspect-ratio: 1 / 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  text-align: center;
  padding: 1.2rem;
}

#magic .timeline article h4 {
  margin-bottom: 0.65rem;
}

#magic .timeline article p {
  margin: 0;
  font-size: 0.92rem;
  line-height: 1.55;
}

@media (max-width: 720px) {
  #magic .timeline article {
    aspect-ratio: auto;
    min-height: 180px;
  }
}

/* Holidays: show full banner artwork instead of cropping. */
.holiday-block .section-banner {
  width: 100%;
  height: auto !important;
  max-height: none !important;
  aspect-ratio: auto !important;
  object-fit: contain !important;
  object-position: center !important;
  display: block;
  background: rgba(0, 0, 0, 0.35);
}


/* Important Individuals: horizontal character images inside tabs */
.character-image-frame {
  margin: 0.85rem 0 1rem;
  width: 100%;
  border-radius: calc(var(--radius) - 8px);
  overflow: hidden;
  background: transparent;
}

.character-image-frame img {
  display: block;
  width: 100%;
  height: auto;
  max-height: 360px;
  object-fit: contain;
  object-position: center;
}

/* Header layout update: move navigation to the right and center the tagline. */
.site-header {
  grid-template-columns: minmax(280px, 520px) minmax(0, 1fr);
  align-items: center;
}

.brand-block {
  text-align: center;
  justify-self: start;
  width: 100%;
  max-width: 520px;
}

.brand-block .tagline {
  max-width: 100%;
  margin: 0.35rem auto 0;
  text-align: center;
}

.primary-nav {
  grid-column: 2 / 3;
  grid-row: 1 / 2;
  justify-content: flex-end;
  align-items: center;
  align-self: center;
}

@media (max-width: 960px) {
  .site-header {
    grid-template-columns: 1fr;
  }

  .brand-block {
    justify-self: center;
    max-width: 100%;
  }

  .primary-nav {
    grid-column: 1 / -1;
    grid-row: auto;
    justify-content: center;
  }
}

@media (max-width: 720px) {
  .site-header {
    grid-template-columns: 1fr auto;
  }

  .brand-block {
    justify-self: stretch;
  }

  .primary-nav {
    grid-column: 1 / -1;
    grid-row: auto;
    justify-content: flex-start;
  }
}

/* Faction banner repair: keeps transparent bordered faction art from overflowing or breaking cards. */
.faction-banner {
  width: 100%;
  height: auto;
  display: block;
  object-fit: contain;
  object-position: center bottom;
}

#factions .info-card {
  overflow: hidden;
}

#factions .info-card:has(.faction-banner) {
  padding-top: 0.75rem;
}
