/* ==========================================================================
   SAME SKY — Global Stylesheet
   Brand colors and type live as CSS custom properties on :root.
   Each character page overrides --accent locally (see bottom of file)
   to tint hover states / act dividers with that character's palette,
   without touching this file.
   ========================================================================== */

:root {
  --navy: #1A1A2E;
  --gold: #C9A84C;
  --offwhite: #F8F6F2;
  --charcoal: #333333;
  --accent: var(--gold); /* default; character pages override this */

  --font-display: Georgia, 'Times New Roman', serif;
  --font-body: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;

  --max-width: 1200px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--charcoal);
  background: var(--offwhite);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 400;
  margin: 0 0 0.5em;
  color: var(--navy);
}

p { margin: 0 0 1em; }

.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
}

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

.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(248, 246, 242, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(26, 26, 46, 0.08);
}

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 24px;
  max-width: var(--max-width);
  margin: 0 auto;
}

.nav-wordmark {
  font-family: var(--font-display);
  font-size: 1.15rem;
  letter-spacing: 0.18em;
  color: var(--navy);
  text-transform: uppercase;
}

.nav-links {
  display: flex;
  gap: 32px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-links a {
  font-size: 0.85rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--charcoal);
  transition: color 0.2s ease;
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--accent);
}

.nav-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
}

.nav-toggle span {
  display: block;
  width: 24px;
  height: 2px;
  background: var(--navy);
  margin: 5px 0;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

@media (max-width: 768px) {
  .nav-toggle { display: block; }

  .nav-links {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    background: var(--offwhite);
    border-bottom: 1px solid rgba(26, 26, 46, 0.08);
    padding: 16px 24px 24px;
    gap: 18px;
    display: none;
  }

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

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

.hero {
  position: relative;
  min-height: 72vh;
  display: flex;
  align-items: flex-end;
  background-color: var(--navy);
  background-size: cover;
  background-position: center 20%;
  color: #fff;
  overflow: hidden;
}

/* Mobile banner headshot fix: on narrow screens the hero container is
   nearly square, so `cover` barely crops the square source image and
   the full figure shows instead of the desktop's headshot crop.
   Oversizing the background restores the tight face crop on mobile. */
@media (max-width: 768px) {
  .hero {
    background-size: 220%;
    background-position: 50% 12%;
  }
}

.hero::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(26,26,46,0.05) 0%, rgba(26,26,46,0.75) 100%);
}

.hero-content {
  position: relative;
  z-index: 1;
  padding: 48px 24px;
  max-width: var(--max-width);
  margin: 0 auto;
  width: 100%;
}

.hero-tagline {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 1.1rem;
  opacity: 0.9;
  margin-bottom: 0.4em;
}

.hero-title {
  color: #fff;
  font-size: clamp(2.2rem, 6vw, 4rem);
  letter-spacing: 0.08em;
  margin-bottom: 0.3em;
}

.hero-sub {
  max-width: 520px;
  font-size: 1.05rem;
  opacity: 0.92;
}

.hero-cta {
  display: inline-block;
  margin-top: 24px;
  padding: 14px 32px;
  border: 1px solid #fff;
  color: #fff;
  font-size: 0.85rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  transition: background 0.2s ease, color 0.2s ease;
}

.hero-cta:hover {
  background: #fff;
  color: var(--navy);
}

/* -------------------- Banner system (config-driven) -------------------- */
/* Powers data/banner-config.json. In "single" mode this just paints one
   static image (no visual change from a plain hero). In "cycle" mode it
   crossfades between layered images with a slow Ken Burns drift. See
   assets/js/banner.js and README.md "Banner System" section. */

.hero-bg-layer {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center 20%;
  opacity: 0;
  transition: opacity 1.6s ease;
  will-change: opacity, transform;
}

.hero-bg-layer.is-active {
  opacity: 1;
  z-index: 1;
}

.hero-bg-layer.kb-in {
  animation: heroKenBurns var(--kb-duration, 9s) ease-in-out forwards;
}

@keyframes heroKenBurns {
  from { transform: scale(1); }
  to   { transform: scale(1.07); }
}

.hero-banner-label {
  position: absolute;
  bottom: var(--space-m, 32px);
  right: 24px;
  z-index: 2;
  font-family: var(--font-data, monospace);
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.75);
  opacity: 0;
  transition: opacity 0.6s ease;
  pointer-events: none;
}

.hero-banner-label.is-visible { opacity: 1; }

/* ------------------------------- Sections -------------------------------- */

.section {
  padding: 80px 24px;
}

.section-narrow {
  max-width: 720px;
  margin: 0 auto;
}

.section-eyebrow {
  font-size: 0.8rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 0.6em;
}

.section-title {
  font-size: clamp(1.6rem, 3.5vw, 2.4rem);
  margin-bottom: 0.6em;
}

/* ------------------------------ Character grid (Universe page) ---------- */

.character-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 28px;
  margin-top: 40px;
}

.character-card {
  position: relative;
  aspect-ratio: 3/4;
  overflow: hidden;
  background: var(--navy);
  color: #fff;
}

.character-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 15%;
  transform: scale(2.3);
  transform-origin: 50% 15%;
  opacity: 0.85;
  transition: transform 0.4s ease, opacity 0.4s ease;
}

.character-card:hover img {
  transform: scale(2.4);
  opacity: 1;
}

.character-card-info {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  padding: 20px;
  background: linear-gradient(0deg, rgba(0,0,0,0.75), transparent);
}

.character-card-name {
  font-family: var(--font-display);
  font-size: 1.3rem;
  color: #fff;
}

.character-card-meta {
  font-size: 0.78rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  opacity: 0.8;
}

.character-card.placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  background: repeating-linear-gradient(135deg, #e8e4dc, #e8e4dc 10px, #eeeae2 10px, #eeeae2 20px);
  color: var(--charcoal);
}

.character-card.placeholder .character-card-name {
  color: var(--charcoal);
  font-size: 1rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* ------------------------------ Character page hero ---------------------- */

.character-hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
  margin-top: 20px;
  font-size: 0.82rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  opacity: 0.85;
}

.act-divider {
  max-width: var(--max-width);
  margin: 64px auto 32px;
  padding: 0 24px;
  display: flex;
  align-items: baseline;
  gap: 16px;
}

.act-divider .act-label {
  font-size: 0.78rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  white-space: nowrap;
}

.act-divider .act-mood {
  font-size: 0.85rem;
  color: var(--charcoal);
  opacity: 0.65;
}

.act-divider hr {
  flex: 1;
  border: none;
  border-top: 1px solid rgba(26,26,46,0.12);
}

.act-divider .act-coming {
  font-family: var(--font-data, monospace);
  font-size: 0.7rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
  border: 1px solid var(--accent);
  padding: 3px 10px;
  white-space: nowrap;
}

/* -------------------------------- Gallery grid ---------------------------- */

.gallery-grid {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px 24px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 20px;
}

.gallery-item-teaser {
  position: relative;
  aspect-ratio: 1/1;
  overflow: hidden;
  background: #eee;
  cursor: default;
}

.gallery-item-teaser img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: saturate(0.85);
}

.gallery-item-teaser::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(26,26,46,0.15);
}

.gallery-item-placeholder {
  aspect-ratio: 1/1;
  border: 1px dashed rgba(26,26,46,0.25);
  background: repeating-linear-gradient(
    135deg,
    rgba(26,26,46,0.025),
    rgba(26,26,46,0.025) 10px,
    rgba(26,26,46,0.05) 10px,
    rgba(26,26,46,0.05) 20px
  );
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  color: var(--charcoal);
  opacity: 0.55;
}

.gallery-item-placeholder .piece-num {
  font-family: var(--font-data, monospace);
  font-size: 1.1rem;
  letter-spacing: 0.04em;
}

.gallery-item-placeholder .placeholder-text {
  font-size: 0.7rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.gallery-item {
  cursor: pointer;
  position: relative;
  overflow: hidden;
  background: #eee;
  aspect-ratio: 1/1;
  display: block;
  text-decoration: none;
  color: inherit;
}

.gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}

.gallery-item:hover img { transform: scale(1.05); }

.gallery-item-label {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  padding: 12px 14px;
  background: linear-gradient(0deg, rgba(0,0,0,0.7), transparent);
  color: #fff;
  font-size: 0.82rem;
  letter-spacing: 0.02em;
}

.gallery-item-label .piece-num {
  opacity: 0.7;
  margin-right: 6px;
}

.gallery-item-badge {
  position: absolute;
  left: 10px;
  bottom: 10px;
  z-index: 1;
  font-family: var(--font-data, monospace);
  font-size: 0.65rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #fff;
  background: rgba(26,26,46,0.75);
  border: 1px solid rgba(255,255,255,0.25);
  padding: 4px 9px;
}

.gallery-item.crown-jewel::before {
  content: '★';
  position: absolute;
  top: 10px; right: 10px;
  color: var(--gold);
  font-size: 1.1rem;
  z-index: 2;
  text-shadow: 0 1px 3px rgba(0,0,0,0.5);
}

/* --------------------------------- Lightbox -------------------------------- */

.lightbox {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(15, 15, 20, 0.96);
  overflow-y: auto;
}

.lightbox.open { display: block; }

.lightbox-inner {
  max-width: 1000px;
  margin: 0 auto;
  padding: 60px 24px 80px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 32px;
}

@media (min-width: 860px) {
  .lightbox-inner {
    grid-template-columns: 1.1fr 0.9fr;
    align-items: start;
    padding-top: 90px;
  }
}

.lightbox-image img {
  width: 100%;
  border: 1px solid rgba(255,255,255,0.1);
}

.lightbox-close {
  position: fixed;
  top: 20px;
  right: 24px;
  z-index: 1001;
  background: none;
  border: none;
  color: #fff;
  font-size: 1.8rem;
  cursor: pointer;
  line-height: 1;
  padding: 8px;
}

.lightbox-nav {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: #fff;
  font-size: 2.2rem;
  cursor: pointer;
  padding: 12px;
  opacity: 0.6;
  transition: opacity 0.2s ease;
  z-index: 1001;
}

.lightbox-nav:hover { opacity: 1; }
.lightbox-prev { left: 12px; }
.lightbox-next { right: 12px; }

.lightbox-content { color: #f0efe9; }

.lightbox-eyebrow {
  font-size: 0.78rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 0.5em;
}

.lightbox-title {
  color: #fff;
  font-size: 1.8rem;
  margin-bottom: 0.4em;
}

.lightbox-traits {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 16px 0 20px;
}

.lightbox-traits span {
  font-size: 0.72rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  border: 1px solid rgba(255,255,255,0.25);
  padding: 5px 10px;
  color: #ddd;
}

.lightbox-desc {
  font-size: 0.98rem;
  line-height: 1.75;
  color: #d8d6d0;
  margin-bottom: 24px;
}

.lightbox-opensea {
  display: inline-block;
  padding: 12px 26px;
  border: 1px solid var(--gold);
  color: var(--gold);
  font-size: 0.82rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  transition: background 0.2s ease, color 0.2s ease;
}

.lightbox-opensea:hover { background: var(--gold); color: var(--navy); }

.lightbox-opensea.disabled {
  opacity: 0.4;
  pointer-events: none;
  border-color: #888;
  color: #999;
}

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

.site-footer {
  border-top: 1px solid rgba(26,26,46,0.1);
  padding: 40px 24px;
  text-align: center;
  font-size: 0.8rem;
  color: var(--charcoal);
  opacity: 0.7;
}

.site-footer a { color: var(--navy); }
.site-footer a:hover { color: var(--accent); }

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

.loading-state {
  text-align: center;
  padding: 80px 24px;
  color: var(--charcoal);
  opacity: 0.6;
  font-style: italic;
}

.act-legend {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
  margin-top: 32px;
}

.act-legend-item {
  border-left: 2px solid var(--accent);
  padding-left: 16px;
}

.act-legend-item .act-num {
  font-size: 0.78rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
}

.act-legend-item .act-season {
  font-family: var(--font-display);
  font-size: 1.2rem;
  margin: 4px 0;
}

.act-legend-item .act-mood {
  font-size: 0.85rem;
  opacity: 0.65;
}

/* ── Flying Bunny Productions link ── */
.nav-links .fbp-link {
  color: #C9A84C;
  border-bottom: 1px solid #C9A84C;
  padding-bottom: 2px;
  font-size: 0.75rem;
  letter-spacing: 0.1em;
}
.nav-links .fbp-link:hover {
  color: #E8C86A;
  border-bottom-color: #E8C86A;
}
