/* =========================================================
   CB8eats — shared site styles
   ========================================================= */

:root {
  --bg: #0c0c11;
  --bg-alt: #131319;
  --card: #1a1a23;
  --card-hover: #21212c;
  --border: #2a2a37;
  --text: #ece9f5;
  --text-dim: #a6a2b8;
  --text-faint: #706c82;
  --accent: #00d95f;
  --accent-bright: #00ff88;
  --accent-2: #7b3ff2;
  --glow: rgba(0, 217, 95, 0.35);
  --radius: 10px;
  --max-width: 1100px;
  --font-display: "Cinzel", Georgia, "Times New Roman", serif;
  --font-body: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background:
    radial-gradient(ellipse 900px 500px at 15% -10%, rgba(123, 63, 242, 0.16), transparent 60%),
    radial-gradient(ellipse 900px 500px at 85% 0%, rgba(0, 217, 95, 0.14), transparent 55%),
    var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  line-height: 1.6;
  min-height: 100vh;
}

img {
  max-width: 100%;
  display: block;
}

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

/* ---------- Header / Nav ---------- */

header {
  position: sticky;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  flex-wrap: wrap;
  padding: 1rem 2rem;
  background: rgba(12, 12, 17, 0.97);
  border-bottom: 1px solid var(--border);
  z-index: 999;
  transform: translateY(0);
  transition: transform 0.25s ease;
}

/* Toggled by js/nav-scroll.js: hidden while scrolling down, removed the
   instant you scroll up (even slightly) or reach the top of the page. */
header.nav-hidden {
  transform: translateY(-100%);
}

.brand {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  background: linear-gradient(120deg, var(--accent-bright), var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.brand a {
  color: inherit;
}

nav .nav-tabs {
  list-style: none;
  display: flex;
  gap: 0.5rem;
  margin: 0;
  padding: 0;
  flex-wrap: wrap;
}

.nav-tabs li a {
  display: inline-block;
  padding: 0.5rem 0.9rem;
  border-radius: 999px;
  font-size: 0.92rem;
  font-weight: 500;
  color: var(--text-dim);
  transition: color 0.2s ease, background 0.2s ease;
}

.nav-tabs li a:hover {
  color: var(--text);
  background: var(--card);
}

.nav-tabs li a.active {
  color: #fff;
  background: linear-gradient(120deg, var(--accent), var(--accent-2));
  box-shadow: 0 0 18px var(--glow);
}

/* Groups .brand with .header-back so `header`'s own space-between still
   only has two real columns (this group, and nav) instead of three. */
.header-left {
  display: flex;
  align-items: center;
  gap: 1rem;
}

/* A compact "back to X" pill living in the header itself (subpages only).
   Hidden at the very top - the full-size .back-link in the page body
   already covers that - and revealed once you've scrolled away from it,
   so getting back to the hub page never needs a scroll back to the top
   first. Toggled via the `scrolled` class js/nav-scroll.js adds to
   <header> based on scroll position (independent of nav-hidden, which is
   based on scroll direction). */
.header-back {
  display: inline-flex;
  align-items: center;
  padding: 0.5rem 0.9rem;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-dim);
  border: 1px solid var(--border);
  opacity: 0;
  transform: translateX(-6px);
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease, color 0.2s ease, background 0.2s ease;
}

.header-back:hover {
  color: var(--text);
  background: var(--card);
}

header.scrolled .header-back {
  opacity: 1;
  transform: translateX(0);
  pointer-events: auto;
}

/* ---------- Layout ---------- */

main {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 3rem 2rem 5rem;
}

section {
  margin-bottom: 3.5rem;
}

section:last-child {
  margin-bottom: 0;
}

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

h1 {
  font-family: var(--font-display);
  font-size: clamp(2.1rem, 4vw, 3rem);
  line-height: 1.15;
  margin: 0 0 1rem;
}

h2 {
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 2.6vw, 2rem);
  margin: 0 0 1rem;
}

h3 {
  font-family: var(--font-display);
  font-size: 1.2rem;
  margin: 0 0 0.6rem;
  color: #fff;
}

p {
  color: var(--text-dim);
  margin: 0 0 1rem;
}

.lede {
  font-size: 1.1rem;
  color: var(--text-dim);
  max-width: 65ch;
}

/* ---------- Hero ---------- */

.hero {
  padding: 4rem 0 2rem;
  border-bottom: 1px solid var(--border);
}

.hero .tags {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-top: 1.5rem;
}

.tag {
  font-size: 0.8rem;
  color: var(--text-dim);
  border: 1px solid var(--border);
  padding: 0.3rem 0.75rem;
  border-radius: 999px;
  background: var(--card);
}

/* ---------- Embeds ---------- */

.spotify-embed {
  display: flex;
  align-items: center;
  border-radius: var(--radius);
  overflow: hidden;
}

.spotify-embed iframe {
  display: block;
  border-radius: var(--radius);
}

/* ---------- Cards / Grid ---------- */

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.25rem;
}

/* Fixed 3-column layout for grids that need to land as clean rows (e.g. an
   even number of cards meant to read as 2 rows of 3) rather than however
   many 240px columns happen to fit — auto-fit would give 4 on a full-width
   desktop viewport, not 3. */
.grid-3 {
  grid-template-columns: repeat(3, 1fr);
}

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

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

/* Fixed 5-column layout, same reasoning as .grid-3 above. */
.grid-5 {
  grid-template-columns: repeat(5, 1fr);
}

@media (max-width: 860px) {
  .grid-5 { grid-template-columns: repeat(3, 1fr); }
}

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

.card {
  display: block;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  transition: transform 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

.card:hover {
  transform: translateY(-3px);
  border-color: var(--accent);
  background: var(--card-hover);
}

.card .icon {
  font-size: 1.6rem;
  margin-bottom: 0.75rem;
  display: inline-block;
}

.card.placeholder {
  border-style: dashed;
  color: var(--text-faint);
}

/* Same red already used for "crit" status in the resource tracker component
   — reused here rather than introducing a second red into the palette. */
.card.locked {
  border-color: rgba(226, 87, 79, 0.4);
  background: rgba(226, 87, 79, 0.06);
}

.card .locked-badge {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #e2574f;
  border: 1px solid rgba(226, 87, 79, 0.4);
  border-radius: 999px;
  padding: 0.2rem 0.6rem;
  margin-bottom: 0.6rem;
}

.card.placeholder p {
  color: var(--text-faint);
  font-size: 0.92rem;
  margin: 0;
}

.card .card-cta {
  display: inline-block;
  margin-top: 0.75rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--accent-bright);
}

/* Music track cards (music.html) — cover art thumbnail beside the title/
   audio player. Source art varies in aspect ratio (portrait poster-style
   covers vs. a square Spotify-sourced one), so the thumbnail box is a
   fixed square with object-fit: cover rather than sized to the image, to
   keep every card the same shape regardless of source proportions. */
.music-card {
  display: flex;
  align-items: flex-start;
  gap: 1.1rem;
}

.music-cover {
  flex: 0 0 96px;
  width: 96px;
  height: 96px;
  border-radius: 8px;
  overflow: hidden;
  background: var(--bg-alt, #10141c);
  border: 1px solid var(--border);
}

.music-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.music-info {
  flex: 1;
  min-width: 0;
}

@media (max-width: 560px) {
  .music-cover { flex-basis: 64px; width: 64px; height: 64px; }
  .music-card { gap: 0.85rem; }
}

/* ---------- Subpages (COA lore pages) ---------- */

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.88rem;
  color: var(--text-faint);
  margin-bottom: 2rem;
  transition: color 0.2s ease;
}

.back-link:hover {
  color: var(--accent-bright);
}

/* The capital sits between the two regions, so its banner carries both
   accent colors at once rather than picking a side — the one place on the
   page the full brand gradient appears as a hairline, not just on buttons. */
.capital-banner {
  text-align: center;
  padding: 2.25rem 1.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
  position: relative;
  overflow: hidden;
  margin-bottom: 3rem;
}

.capital-banner::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(120deg, var(--accent), var(--accent-2));
}

.capital-banner .eyebrow {
  display: block;
}

.capital-banner h2 {
  margin-bottom: 0.5rem;
}

.capital-banner p {
  max-width: 50ch;
  margin: 0 auto;
}

/* Two regions, split down the middle — literal, not decorative: Asanha
   really is one world divided into two named halves around a shared
   capital. Each side takes one half of the site's own brand gradient. */
.region-split {
  display: grid;
  grid-template-columns: 1fr 1px 1fr;
  gap: 2rem;
}

.region-panel {
  padding: 0.5rem 0 0.5rem;
  border-top: 2px solid var(--region-color, var(--accent));
  padding-top: 1.5rem;
}

.region-panel.region-a { --region-color: var(--accent); }
.region-panel.region-b { --region-color: var(--accent-2); }

.region-panel .region-label {
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.75rem;
  color: var(--region-color, var(--text-faint));
  font-weight: 600;
  margin-bottom: 0.4rem;
}

.region-panel .region-name {
  font-family: var(--font-display);
  font-size: 1.3rem;
  color: var(--region-color, var(--text));
  margin: 0 0 0.75rem;
}

/* A region with no confirmed name yet keeps the old faint/italic "TBD" look —
   toggle this class off once a real name replaces the placeholder text. */
.region-panel .region-name.unnamed {
  color: var(--text-faint);
  font-style: italic;
}

.region-divider {
  background: linear-gradient(180deg, transparent, var(--border) 12%, var(--border) 88%, transparent);
}

/* A working zone map, not official concept art - framed like the other
   COA lore cards (border/radius/--card) rather than floated bare. */
.map-figure {
  margin: 0 0 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--card);
}

.map-figure img {
  width: 100%;
}

.map-figure figcaption {
  padding: 0.9rem 1.25rem;
  font-size: 0.85rem;
  color: var(--text-faint);
  border-top: 1px solid var(--border);
}

@media (max-width: 720px) {
  .region-split {
    grid-template-columns: 1fr;
    gap: 2.5rem;
  }
  .region-divider {
    display: none;
  }
}

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.7rem 1.3rem;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.95rem;
  border: 1px solid var(--border);
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn-primary {
  background: linear-gradient(120deg, var(--accent), var(--accent-2));
  border-color: transparent;
  color: #fff;
  box-shadow: 0 4px 18px var(--glow);
}

.btn-ghost {
  color: var(--text);
  background: transparent;
}

.btn-ghost:hover {
  border-color: var(--accent);
  color: #fff;
}

.btn-row {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-top: 1.5rem;
}

/* ---------- Misc ---------- */

.divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 3rem 0;
}

.note {
  font-size: 0.88rem;
  color: var(--text-faint);
  border-left: 2px solid var(--accent);
  padding-left: 0.9rem;
}

ul.feature-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

ul.feature-list li {
  padding: 0.55rem 0;
  border-bottom: 1px solid var(--border);
  color: var(--text-dim);
}

ul.feature-list li:last-child {
  border-bottom: none;
}

ul.feature-list strong {
  color: var(--text);
}

/* ---------- Footer ---------- */

footer {
  border-top: 1px solid var(--border);
  padding: 2rem;
  text-align: center;
  color: var(--text-faint);
  font-size: 0.85rem;
}

footer a {
  color: var(--text-dim);
}

footer a:hover {
  color: var(--accent-bright);
}

/* ---------- Footer signature: always-on, centered, animated blood pulse + drip ---------- */
.joker-egg {
  display: block;
  text-align: center;
  margin-bottom: 0.6rem;
}

.joker-egg-text {
  position: relative;
  display: inline-block;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.15rem;
  letter-spacing: 0.1em;
  color: #b00707;
  animation: joker-egg-pulse 2.4s ease-in-out infinite;
}

.joker-egg-text::before,
.joker-egg-text::after {
  content: "";
  position: absolute;
  top: 70%;
  width: 12px;
  height: 0;
  background: #7a0505;
  border-radius: 0 0 50% 50%;
  animation: joker-egg-drip 6.5s ease-in-out infinite;
}

.joker-egg-text::before {
  left: 12%;
  animation-delay: 0.5s;
}

.joker-egg-text::after {
  right: 12%;
  animation-delay: 1.9s;
}

.joker-egg-drip {
  position: absolute;
  top: 70%;
  width: 12px;
  height: 0;
  background: #7a0505;
  border-radius: 0 0 50% 50%;
  animation: joker-egg-drip 6.5s ease-in-out infinite;
  pointer-events: none;
}

.joker-egg-drip-1 { left: 8%; animation-delay: 0s; }
.joker-egg-drip-2 { left: 22%; animation-delay: 0.8s; }
.joker-egg-drip-3 { left: 38%; animation-delay: 1.6s; }
.joker-egg-drip-4 { left: 54%; animation-delay: 2.4s; }
.joker-egg-drip-5 { left: 70%; animation-delay: 3.2s; }
.joker-egg-drip-6 { right: 8%; animation-delay: 4s; }

@keyframes joker-egg-pulse {
  0%, 100% { text-shadow: 0 0 8px rgba(200, 0, 0, 0.5), 0 2px 0 #4a0000; }
  50% { text-shadow: 0 0 18px rgba(255, 20, 20, 0.9), 0 2px 0 #4a0000; }
}

@keyframes joker-egg-drip {
  0% { height: 0; opacity: 0.95; }
  50% { height: 22px; opacity: 0.95; }
  85% { height: 32px; opacity: 0.8; }
  100% { height: 40px; opacity: 0; }
}

/* ---------- Character-name reveal: tap/click to toggle, works the same on
   touch and mouse (a checkbox-driven CSS toggle, not :hover — hover is what
   got stuck open on mobile for the Joker signature above; this avoids that
   entire bug class by using a real persistent toggle state instead). No
   quotes yet, just names — swap in real quotes later by editing the text
   inside .char-egg-names on each page. ---------- */
.char-egg {
  margin-top: 0.5rem;
  font-size: 0.85rem;
}

.char-egg-input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.char-egg-trigger {
  display: inline-block;
  cursor: pointer;
  color: var(--text-faint);
  transition: color 0.2s ease;
  user-select: none;
}

.char-egg-trigger:hover,
.char-egg-input:focus-visible ~ .char-egg-trigger {
  color: var(--accent-2);
}

.char-egg-names {
  display: none;
  margin-left: 0.5em;
  color: var(--text-dim);
  letter-spacing: 0.03em;
}

.char-egg-input:checked ~ .char-egg-names {
  display: inline;
}

@media (max-width: 640px) {
  header {
    flex-direction: column;
    align-items: flex-start;
  }

  main {
    padding: 2rem 1.25rem 3.5rem;
  }
}
