/* Orchestra Comics — Modern gallery site */

:root {
  --bg: #ebe6e0;
  --bg-card: #fff;
  --text: #1a1a1a;
  --text-muted: #5c5c5c;
  --accent: #c45c3e;
  --accent-hover: #a84a2f;
  --border: #ddd8d2;
  --serif: "Instrument Serif", Georgia, serif;
  --sans: "DM Sans", system-ui, sans-serif;
  --radius: 8px;
  --shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
  --transition: 0.2s ease;
}

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--sans);
  font-size: 1rem;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

/* Constellation background */
.constellations {
  position: fixed;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  opacity: 0.42;
}

a {
  color: inherit;
  text-decoration: none;
  transition: color var(--transition);
}

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

/* Header */
.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.5rem;
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(235, 230, 224, 0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

.logo {
  font-family: var(--serif);
  font-size: 1.35rem;
  font-weight: 400;
}

.nav {
  display: flex;
  gap: 1.75rem;
}

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

.menu-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  padding: 8px;
  background: none;
  border: none;
  cursor: pointer;
}

.menu-toggle span {
  width: 22px;
  height: 2px;
  background: var(--text);
}

@media (max-width: 640px) {
  .nav {
    position: fixed;
    top: 0;
    right: 0;
    height: 100vh;
    width: 220px;
    flex-direction: column;
    padding: 4rem 1.5rem 1.5rem;
    background: var(--bg);
    border-left: 1px solid var(--border);
    transform: translateX(100%);
    transition: transform var(--transition);
  }

  .nav.is-open {
    transform: translateX(0);
  }

  .menu-toggle {
    display: flex;
  }
}

/* Main content above canvas */
main {
  position: relative;
  z-index: 1;
}

/* Hero */
.hero {
  padding: 4rem 1.5rem 5rem;
  text-align: center;
  max-width: 42rem;
  margin: 0 auto;
}

.hero h1 {
  font-family: var(--serif);
  font-size: clamp(2.5rem, 6vw, 3.5rem);
  font-weight: 400;
  margin: 0 0 0.5rem;
  line-height: 1.15;
}

.hero-tagline {
  font-size: 1.1rem;
  color: var(--text-muted);
  margin: 0 0 2rem;
}

.cta {
  display: inline-block;
  padding: 0.65rem 1.5rem;
  background: var(--accent);
  color: #fff;
  border-radius: var(--radius);
  font-weight: 500;
  transition: background var(--transition);
}

.cta:hover {
  background: var(--accent-hover);
}

/* Gallery sections */
.gallery-section {
  padding: 3rem 1.5rem 4rem;
  max-width: 1100px;
  margin: 0 auto;
}

.gallery-section h2 {
  font-family: var(--serif);
  font-size: 1.75rem;
  font-weight: 400;
  margin: 0 0 1.5rem;
}

.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem;
}

.gallery-item {
  background: var(--bg-card);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: transform var(--transition), box-shadow var(--transition);
}

a.gallery-item {
  display: block;
  text-decoration: none;
  color: inherit;
}

a.gallery-item:visited {
  color: inherit;
}

.gallery-item:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.08);
}

.gallery-item figure {
  margin: 0;
}

.gallery-item .gallery-image-wrap {
  position: relative;
}

.gallery-item .gallery-image-wrap img {
  display: block;
}

.gallery-item img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
}

.gallery-item figcaption {
  padding: 1rem;
  font-size: 0.95rem;
  color: var(--text);
}

.gallery-item .caption-title {
  font-weight: 500;
}

.gallery-item .caption-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

/* Section intro */
.section-intro {
  max-width: 42rem;
  margin: 0 0 2rem;
  color: var(--text-muted);
  font-size: 0.95rem;
}

.section-intro code {
  font-size: 0.85em;
  padding: 0.15em 0.4em;
  background: var(--border);
  border-radius: 4px;
}

/* Characters */
.characters-section {
  padding: 3rem 1.5rem 4rem;
  max-width: 1100px;
  margin: 0 auto;
  border-top: 1px solid var(--border);
}

.characters-section h2 {
  font-family: var(--serif);
  font-size: 1.75rem;
  font-weight: 400;
  margin: 0 0 0.5rem;
}

.character-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.5rem;
}

.character-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
}

.character-image-wrap {
  position: relative;
  aspect-ratio: 3 / 4;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
}

.character-image-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.character-image-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--serif);
  font-size: 1.25rem;
  color: var(--border);
  pointer-events: none;
}

.character-image-wrap:has(img:not([style*="display: none"])) .character-image-placeholder {
  display: none;
}

.character-body {
  padding: 1.25rem;
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.character-name {
  font-family: var(--serif);
  font-size: 1.35rem;
  font-weight: 400;
  margin: 0 0 0.35rem;
}

.character-meta {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin: 0 0 0.5rem;
  line-height: 1.4;
}

.character-bio {
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.65;
  margin: 0.5rem 0 0;
  flex: 1;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  line-clamp: 4;
  -webkit-box-orient: vertical;
}


/* Collapsed: explicit so "Less" reliably restores clamp */
.character-card:not(.is-expanded) .character-bio {
  overflow: hidden;
  -webkit-line-clamp: 4;
  line-clamp: 4;
}

.character-card.is-expanded .character-bio {
  display: block;
  -webkit-line-clamp: unset;
  line-clamp: unset;
  overflow: visible;
}

.character-card .bio-toggle {
  margin-top: 0.5rem;
  font-size: 0.85rem;
  color: var(--accent);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  text-align: left;
}

.character-card .bio-toggle:hover {
  text-decoration: underline;
}

/* Compendium */
.compendium-section {
  padding: 3rem 1.5rem 4rem;
  max-width: 800px;
  margin: 0 auto;
  border-top: 1px solid var(--border);
}

.compendium-section h2 {
  font-family: var(--serif);
  font-size: 1.75rem;
  font-weight: 400;
  margin: 0 0 0.5rem;
}

.compendium-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  margin-bottom: 2.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
}

.compendium-nav a {
  font-size: 0.9rem;
  color: var(--text-muted);
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius);
  background: var(--bg);
  border: 1px solid var(--border);
  transition: color var(--transition), background var(--transition), border-color var(--transition);
}

.compendium-nav a:hover {
  color: var(--accent);
  border-color: var(--accent);
  background: transparent;
}

.compendium-content {
  display: flex;
  flex-direction: column;
  gap: 2.5rem;
}

.compendium-entry {
  scroll-margin-top: 5rem;
}

.compendium-entry h3 {
  font-family: var(--serif);
  font-size: 1.35rem;
  font-weight: 400;
  margin: 0 0 1rem;
  color: var(--text);
}

.compendium-entry p {
  margin: 0 0 1rem;
  color: var(--text-muted);
  line-height: 1.7;
}

.compendium-entry p:last-child {
  margin-bottom: 0;
}

.compendium-entry strong {
  color: var(--text);
}

.compendium-glossary {
  margin: 0;
  display: grid;
  gap: 1rem;
}

.compendium-glossary dt {
  font-weight: 600;
  color: var(--text);
  margin: 0;
}

.compendium-glossary dd {
  margin: 0 0 0 1rem;
  color: var(--text-muted);
  line-height: 1.6;
}

/* About */
.about-section {
  padding: 3rem 1.5rem 4rem;
  max-width: 42rem;
  margin: 0 auto;
  border-top: 1px solid var(--border);
}

.about-section h2 {
  font-family: var(--serif);
  font-size: 1.75rem;
  font-weight: 400;
  margin: 0 0 1rem;
}

.about-section p {
  margin: 0;
  color: var(--text-muted);
}

/* CSS-only lightbox (:target); no JavaScript */
.lightbox-css {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}

.lightbox-css:target {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.lightbox-css__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.9);
  cursor: default;
}

.lightbox-css__panel {
  position: relative;
  z-index: 1;
  max-width: 90vw;
  max-height: 90vh;
  text-align: center;
}

.lightbox-css__close {
  position: absolute;
  top: 0.35rem;
  right: 0.35rem;
  z-index: 2;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.75rem;
  line-height: 1;
  color: #fff;
  text-decoration: none;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
  transition: opacity var(--transition);
}

.lightbox-css__close:hover {
  opacity: 0.85;
}

.lightbox-css__img {
  max-height: 85vh;
  width: auto;
  margin: 0 auto;
  border-radius: var(--radius);
  display: block;
}

.lightbox-css__caption {
  margin: 1rem 0 0;
  color: #fff;
  font-size: 0.95rem;
}

/* Transparent overlay on gallery thumbs (optional right-click target) */
.image-overlay {
  position: absolute;
  inset: 0;
  z-index: 1;
  cursor: pointer;
}

/* Footer */
.site-footer {
  position: relative;
  z-index: 1;
  padding: 1.5rem;
  text-align: center;
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.9rem;
}

.site-footer p {
  margin: 0;
}

/* Empty state */
.gallery-empty {
  padding: 2rem;
  text-align: center;
  color: var(--text-muted);
  font-style: italic;
}

/* ========== Splash & tab layout ========== */
.splash-page .splash-main {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: 0 1.5rem 3rem;
}

.splash {
  min-height: 85vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 2rem 1rem;
}

.splash-text {
  font-family: var(--serif);
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  font-weight: 400;
  font-style: italic;
  color: var(--text);
  margin: 0;
  max-width: 20ch;
  line-height: 1.35;
}

.splash-featured {
  margin-top: 2rem;
  width: min(92vw, 42rem);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  background: var(--bg-card);
}

.splash-featured img {
  width: 100%;
  height: auto;
}

.splash-scroll {
  margin-top: 2rem;
  font-size: 1.5rem;
  color: var(--text-muted);
  animation: bounce 2s ease-in-out infinite;
}

@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(0.5rem); }
}

.tabs {
  width: 100%;
  max-width: 600px;
  padding: 3rem 0 4rem;
  border-top: 1px solid var(--border);
}

.tabs-heading {
  font-family: var(--serif);
  font-size: 1.25rem;
  font-weight: 400;
  margin: 0 0 1.25rem;
  text-align: center;
  color: var(--text-muted);
}

.tabs-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.75rem 1.5rem;
}

.tabs-list a {
  display: inline-block;
  padding: 0.6rem 1.25rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-weight: 500;
  transition: color var(--transition), border-color var(--transition), background var(--transition);
}

.tabs-list a:hover {
  color: var(--accent);
  border-color: var(--accent);
  background: transparent;
}

.tab-under-construction a {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
  text-align: center;
}

.tab-link-title {
  line-height: 1.2;
}

.tab-link-status {
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.tab-under-construction a:hover .tab-link-status {
  color: var(--accent);
}

.under-construction-section h1 {
  font-family: var(--serif);
  font-size: 1.75rem;
  font-weight: 400;
  margin: 0 0 0.5rem;
}

.site-footer--splash {
  margin-top: auto;
}

/* Inner pages (Gallery, Books, Compendium, About) */
.site-header--inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.5rem;
}

.site-header--inner .back-to-tabs {
  font-size: 0.9rem;
  color: var(--text-muted);
}

.site-header--inner .back-to-tabs:hover {
  color: var(--accent);
}

.page-main {
  position: relative;
  z-index: 1;
  padding: 2rem 1.5rem 4rem;
  max-width: 1100px;
  margin: 0 auto;
}

.page-main .gallery-section h1,
.page-main .books-section h1,
.page-main .compendium-hub h1,
.page-main .about-section--page h1 {
  font-family: var(--serif);
  font-size: 1.75rem;
  font-weight: 400;
  margin: 0 0 0.5rem;
}

.back-wrap {
  text-align: center;
  margin: 2.5rem 0 1rem;
}

.btn-back {
  display: inline-block;
  padding: 0.5rem 1rem;
  font-size: 0.9rem;
  color: var(--accent);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  transition: background var(--transition), color var(--transition);
}

.btn-back:hover {
  background: var(--accent);
  color: #fff;
}

.back-wrap .btn-back + .btn-back {
  margin-left: 0.75rem;
}

/* Books & Comics page */
.books-section {
  padding: 0;
}

.books-sort {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1rem;
  margin-bottom: 1.5rem;
}

.books-sort-label {
  font-size: 0.9rem;
  color: var(--text-muted);
}

.books-sort-btn {
  padding: 0.35rem 0.75rem;
  font-size: 0.85rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  color: var(--text-muted);
  transition: color var(--transition), border-color var(--transition);
}

.books-sort-btn:hover,
.books-sort-btn.is-active {
  color: var(--accent);
  border-color: var(--accent);
}

.books-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.books-item {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.5rem 1rem;
  padding: 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.books-item-title {
  font-weight: 500;
}

.books-item-date {
  font-size: 0.9rem;
  color: var(--text-muted);
}

.books-empty {
  padding: 1.5rem;
  color: var(--text-muted);
  font-style: italic;
}

/* Compendium hub */
.compendium-hub-list {
  list-style: none;
  margin: 1.5rem 0 0;
  padding: 0;
  display: grid;
  gap: 0.5rem;
}

.compendium-hub-list a {
  display: block;
  padding: 0.85rem 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color var(--transition), color var(--transition);
}

.compendium-hub-list a:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* Single compendium entry page */
.compendium-page .compendium-entry--single {
  padding: 0;
  max-width: 42rem;
}

.compendium-entry--single h1 {
  font-family: var(--serif);
  font-size: 1.75rem;
  font-weight: 400;
  margin: 0 0 1rem;
}

.compendium-page .characters-section {
  border: none;
  padding-top: 0;
}

/* Places / Groups list: each item is an article */
.compendium-list-section {
  padding: 0;
  max-width: 42rem;
}

.compendium-list-section h1 {
  font-family: var(--serif);
  font-size: 1.75rem;
  font-weight: 400;
  margin: 0 0 0.5rem;
}

.compendium-article {
  margin-top: 2.5rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
}

.compendium-article:first-of-type {
  margin-top: 1.5rem;
  padding-top: 0;
  border-top: none;
}

.compendium-article h2 {
  font-family: var(--serif);
  font-size: 1.35rem;
  font-weight: 400;
  margin: 0 0 0.5rem;
  color: var(--text);
}

.compendium-article p {
  margin: 0;
  color: var(--text-muted);
  line-height: 1.7;
}

/* Index at top of Places / Teams & Factions */
.page-index {
  margin: 1.5rem 0 2rem;
  padding: 1.25rem 1.5rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

/* Sidebar layout: index floats left, content on the right */
.compendium-list-section--with-sidebar {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  gap: 2rem;
  max-width: none;
}

.page-index--sidebar {
  position: sticky;
  top: 5rem;
  width: 11rem;
  flex-shrink: 0;
  margin: 0;
}

.page-index--sidebar .page-index-list {
  flex-direction: column;
  flex-wrap: nowrap;
  gap: 0.35rem 0;
}

.page-content {
  flex: 1;
  min-width: 0;
  max-width: 42rem;
}

@media (max-width: 720px) {
  .compendium-list-section--with-sidebar {
    flex-direction: column;
    gap: 0;
  }

  .page-index--sidebar {
    position: static;
    width: auto;
    margin: 1.5rem 0 2rem;
  }

  .page-index--sidebar .page-index-list {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 0.35rem 1.25rem;
  }
}

.page-index-title {
  font-family: var(--serif);
  font-size: 1rem;
  font-weight: 400;
  margin: 0 0 0.75rem;
  color: var(--text);
}

.page-index-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 1.25rem;
}

.page-index-list a {
  font-size: 0.95rem;
  color: var(--text-muted);
}

.page-index-list a:hover {
  color: var(--accent);
}

.compendium-article {
  scroll-margin-top: 5rem;
}
