/* =========================================
   1. Variables & Theme Configuration
   ========================================= */
:root {
    /* Color Palette (Dark Mode - inspired) */
    --bg-body: #14181c;
    --bg-card: #1e2328;
    --bg-header: #2c3440;

    --text-primary: #ffffff;
    --text-secondary: #99aabb;
    --text-muted: #678;

    --color-link: #40bcf4;
    --color-link-hover: #ffffff;
    --color-border: #456;

    --color-focus: #40bcf4; /* Accessibility focus ring */

    /* Typography */
    --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --font-base-size: 16px;
    --line-height: 1.6;

    /* Spacing */
    --spacing-sm: 0.5rem;
    --spacing-md: 1rem;
    --spacing-lg: 2rem;
    --container-width: 960px;
}

/* =========================================
   2. Reset & Base Styles
   ========================================= */
*, *::before, *::after {
    box-sizing: border-box;
}

body {
    background-color: var(--bg-body);
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: var(--font-base-size);
    line-height: var(--line-height);
    margin: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

h1, h2, h3, h4, h5, h6 {
    margin-top: 0;
    font-weight: 600;
    line-height: 1.2;
}

ul, ol {
    margin: 0;
    padding: 0;
    list-style: none;
}

a {
    color: var(--color-link);
    text-decoration: none;
    transition: color 0.2s ease;
}

a:hover {
    color: var(--color-link-hover);
}

a:focus-visible {
    outline: 2px solid var(--color-focus);
    outline-offset: 2px;
    border-radius: 2px;
}


/* --- 4. Alias Pills (Mini tags at bottom) --- */
.char-aliases {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: auto; /* Push to bottom */
}

.alias-pill {
    font-size: 0.75rem;
    color: var(--text-muted);
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.05);
    padding: 2px 6px;
    border-radius: 4px;
}

.alias-more {
    font-size: 0.75rem;
    color: var(--text-muted);
    padding: 2px 4px;
}

/* Mobile Adjustments */
@media (max-width: 768px) {
    .directory-layout {
        display: block; /* Stack layout on mobile */
    }

    .directory-nav {
        display: none; /* Hide sticky nav on mobile, or move to horizontal scroll top */
    }
}

/* =========================================
   3. Layout Components
   ========================================= */
.container {
    width: 100%;
    max-width: var(--container-width);
    margin: 0 auto;
    padding: 0 var(--spacing-md);

}

.directory-container {
    margin: 0 auto;
    padding: 20px;
}

/* Header */
.site-header {
    height: var(--header-height);
    display: flex;
    background-color: var(--bg-header);
    border-bottom: 1px solid #000;
    padding: var(--spacing-md) 0;
    margin-bottom: var(--spacing-lg);
    position: sticky;
    top: 0;
    z-index: 2000;
}

.site-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.nav-brand {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

.nav-links {
    display: flex;
    gap: var(--spacing-lg);
}

.nav-links a {
    font-weight: 500;
    color: var(--text-secondary);
}

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

/* Footer */
.site-footer {
    margin-top: auto; /* Pushes footer to bottom if content is short */
    padding: var(--spacing-lg) 0;
    border-top: 1px solid var(--color-border);
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.rec-card {
 align-items: center;
}

/* =========================================
   4. Reading List Specifics
   ========================================= */
.list-header {
    border-bottom: 1px solid var(--color-border);
    margin-bottom: var(--spacing-md);
    padding-bottom: var(--spacing-md);
}

.list-header h1 {
    font-size: 2rem;
    margin-bottom: var(--spacing-sm);
}

.list-description {
    color: var(--text-secondary);
    font-size: 1.1rem;
    max-width: 80ch; /* Optimal reading length */
}

.section-title {
    color: var(--text-secondary);
    border-bottom: 1px solid var(--color-border);
    font-size: 1rem;
    margin-top: calc(var(--spacing-lg) * 1.5);
    padding-bottom: var(--spacing-sm);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 700;
}

.issue-item {
    padding: var(--spacing-sm) 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    align-items: center;
}

.issue-item:last-child {
    border-bottom: none;
}

.no-link {
    color: var(--text-primary);
}

/* =========================================
   Reading List Layout Grid
   ========================================= */

.rl-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: var(--spacing-lg);
    align-items: start;
    margin-bottom: 32px;
}

.rl-main,
.rl-aside {
    background: var(--bg-card);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 12px;
}

/* Spacing inside the panels */
.rl-main {
    padding: var(--spacing-lg);
}

.rl-aside {
    padding: var(--spacing-md);
}

.aside-header {
    top: 0;
    background: var(--bg-card);
    z-index: 2500;
    padding: 16px;
    padding-bottom: var(--spacing-sm);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    margin-bottom: var(--spacing-md);
    position: static;
    flex: 0 0 auto;
}

#recommendations-list,
  .recommendations-swap {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;      /* CRITICAL for overflow children in flex */
  }

.aside-title {
    margin: 0;
    font-size: 0.95rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-secondary);
}

/* Your existing header already has a border-bottom; remove double borders inside panel */
.rl-main .list-header {
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

/* =========================================
   Recommendation Grid (inside aside)
   ========================================= */
.rec-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0rem;
    row-gap: 0rem;
}

  .rec-card {
    display: flex;              /* was block */
      flex-direction: column;
      justify-content: center;    /* vertical centering */
      align-items: flex-start;    /* keep text left-aligned */
    background: transparent;
    border: 0;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    border-radius: 0;
    padding: 1rem 1rem;/* slightly bigger than your “too small” version */
    position: relative;
    color: var(--text-primary);
  }

.rec-card::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0rem;
  bottom: 0rem;
  width: 3px;
  border-radius: 999px;
  background: rgba(255,255,255,0.10);
  transition: background 0.12s ease;
}

.rec-card:hover {
  background: rgba(255,255,255,0.03); /* subtle row highlight, not a card */
}

.rec-card:hover::before {
  background: rgba(64, 188, 244, 0.55); /* accent on hover */
}

.rec-card h4 {
    margin: 0;
    line-height: 1.25;
}

/* Pagination buttons should match your theme */
.btn-page {
    display: inline-flex;
    width: 30%;
    text-align: center;
    justify-content: center;
    background: rgba(64, 188, 244, 0.1); /* Very faint blue tint */
    color: var(--color-link);
    border: none;
    border-radius: 0; /* Square corners */
    padding: 1rem;
    font-weight: 600;
    cursor: pointer;
    line-height: 1;
    margin: 0;
    transition:
    background-color 120ms ease,
    box-shadow 120ms ease,
    transform 80ms ease;
}

.btn-page:hover {
  background: #1a252c; /* ~10–15% darker */
  box-shadow: 0 0 0 1px rgba(64, 188, 244, 0.1);;
}

.pagination {
    margin-top: 0px;
    font-size: 0.85rem;
    padding: 8px;
    color: var(--text-muted);
    background: var(--bg-card);
    z-index: 2500;
    position: sticky;
    display: flex;
    justify-content: space-between;
    align-items: center;
    bottom: 0;
}

  .pagination .step-links {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0rem;
    flex-wrap: nowrap;
    white-space: nowrap;
  }

  .step-links {
      width: 100%;
  }

  .current-page {
      width: 40%;
      text-align: center;
  }


.rec-meta {
  margin-top: 0.25rem;
  font-size: 0.8rem;
  color: var(--text-secondary);
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
}

.rec-meta .dot {
  opacity: 0.7;
}

.list-subtitle {
  color: var(--text-secondary);
  font-size: 1.5rem;
  margin-top: 0.25rem;
}

.rec-subtitle {
  color: var(--text-muted);
  font-weight: normal;
  font-size: 1rem;
}

/* =========================
   Header metadata block
   ========================= */
.list-meta {
  margin-top: var(--spacing-md);
  display: grid;
  gap: 0.6rem;
}

.meta-row {
  display: grid;
  grid-template-columns: 90px minmax(0, 1fr);
  gap: var(--spacing-md);
  align-items: start;
}

.meta-label {
  color: var(--text-muted);
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 700;
  padding-top: 0.15rem;
}

.meta-value {
  color: var(--text-secondary);
  line-height: 1.4;
}

.meta-value a {
  color: rgba(64, 188, 244, 0.85); /* same accent family as pills */
  font-weight: 600;
  text-decoration: none;
}

.meta-value a:hover {
  color: var(--text-primary);
  text-underline-offset: 2px;
}

.meta-link {
  color: var(--text-primary);
}

.meta-link--muted {
  color: var(--text-secondary);
}

.meta-sep {
  margin: 0 0.35rem;
  color: rgba(255,255,255,0.18);
}

.meta-row--subtle .meta-label {
  color: rgba(153,170,187,0.65);
}
.meta-row--subtle .meta-sep {
  color: rgba(255,255,255,0.12);
}

/* =========================
   Pills (genres/subgenres)
   ========================= */
.pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.pill {
  display: inline-flex;
  align-items: center;
  padding: 0.22rem 0.55rem;
  border-radius: 999px;
  font-size: 0.85rem;
  line-height: 1.2;

  background: rgba(0, 0, 0, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--text-secondary);

  transition: border-color 0.12s ease, transform 0.12s ease;
}

.pill:hover {
  border-color: rgba(64, 188, 244, 0.35);
  transform: translateY(-1px);
  color: var(--text-primary);
}

/* optional: slightly different treatment for subgenre */
.pill--subgenre {
  background: rgba(0, 0, 0, 0.12);
}

.more-inline {
  display: inline;
  margin-left: 0.35rem;
}

.more-inline__summary {
  display: inline;
  cursor: pointer;
  color: rgba(64, 188, 244, 0.85);
  font-weight: 600;
  list-style: none;
}

.more-inline__summary::-webkit-details-marker {
  display: none;
}

.more-inline__summary:hover {
  color: var(--text-primary);
}

.more-inline__rest {
  display: inline;
}

/* Keep the contributors inline portion tidy */
.contributors-inline {
  margin-right: 0.4rem;
}

/* Make details behave nicely inside a line */
.more-block {
  display: inline-block;
  vertical-align: baseline;
}

/* Summary styled as a subtle “link chip” */
.more-block__summary {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  cursor: pointer;
  user-select: none;
  list-style: none;

  color: rgba(64, 188, 244, 0.85); /* your accent, but softer */
  font-weight: 600;
  font-size: 0.85rem;

  padding: 0.15rem 0.45rem;
  border-radius: 8px;
  border: 1px solid rgba(64, 188, 244, 0.25);
  background: rgba(64, 188, 244, 0.06);
}

.more-block__summary:hover {
  color: var(--text-primary);
  border-color: rgba(64, 188, 244, 0.38);
  background: rgba(64, 188, 244, 0.10);
}

/* Remove default marker */
.more-block__summary::-webkit-details-marker { display: none; }

/* Context change on open/close (no JS needed) */
.summary-open { display: none; }
details[open] .summary-open { display: inline; }
details[open] .summary-closed { display: none; }

/* Expanded panel: sits underneath and wraps nicely */
.more-block__panel {
  margin-top: 0.55rem;
  padding-top: 0.55rem;
  border-top: 1px solid rgba(255,255,255,0.06);
}

/* Small label inside the panel */
.more-block__title {
  color: var(--text-secondary);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 0.4rem;
}

/* Wrap list as a compact pill-ish cloud */
.more-block__list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.6rem;
}

/* Slightly muted links in the expanded list */
.more-block__list .meta-link--muted {
  color: rgba(153, 170, 187, 0.95);
}

.more-block__list .meta-link--muted:hover {
  color: var(--text-primary);
}

.rec-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  z-index: 2500;
}

.rec-drawer {
  position: fixed;
  inset: 0;
  z-index: 2600;
  pointer-events: none;
}

.rec-drawer__panel {
  position: fixed;          /* <- KEY CHANGE */
  top: 0;
  right: 0;
  bottom: 0;                /* <- clamps height exactly */
  width: min(88vw, 360px);

  background: var(--bg-card);
  border-left: 1px solid rgba(255,255,255,0.10);
  box-shadow: -20px 0 50px rgba(0,0,0,0.55);

  transform: translateX(100%);
  transition: transform 160ms ease;

  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.rec-drawer__header {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.9rem 1rem;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.rec-drawer__title {
  margin: 0;
  font-size: 0.95rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-secondary);
}

.rec-drawer__close {
  background: transparent;
  border: 1px solid rgba(255,255,255,0.10);
  color: var(--text-primary);
  border-radius: 10px;
  padding: 0.35rem 0.55rem;
  cursor: pointer;
}

.rec-drawer__close:hover {
  border-color: rgba(64, 188, 244, 0.35);
}

body.drawer-open .rec-drawer {
  pointer-events: auto;
}

body.drawer-open .rec-drawer__panel {
  transform: translateX(0);
}

.nav-recs-btn { display: none; }

:root {
  /* ...existing vars... */
  --header-height: 72px; /* adjust once if needed */
}

.rec-title, .rec-subtitle, .rec-meta {
    font-size: 0.85rem;
}

/* Active pill state */
.pill--active {
  border-color: rgba(64, 188, 244, 0.55);
  background: rgba(64, 188, 244, 0.10);
  color: var(--text-primary);
}

/* Creator header controls layout */

.creator__section-title {
    color: var(--text-secondary);
    font-size: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 700;
    margin-bottom: 0;
}

.creator-controls {
  margin-top: var(--spacing-md);
  display: grid;
  gap: 0.9rem;
}

.creator-controls__row {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
}



.creator-header__row {
  display: flex;
  gap: 1rem;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--color-border);
  flex-wrap: wrap;
  padding-bottom: var(--spacing-sm);
  margin-bottom: 16px;
  margin-top: calc(var(--spacing-lg) * 1.5);
}

.creator-controls__stats {
  display: flex;
  gap: 0.75rem;
}

.creator-stat__label {
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 0.75rem;
  font-weight: 700;
  margin-right: 0.4rem;
}

.creator-stat__value {
  color: var(--text-primary);
  font-weight: 800;
}

.creator-controls__sort {
  display: flex;
  gap: 0.45rem;
  align-items: center;
  font-size: 0.9rem;
}

/* Popover-like subgenre picker using <details> */
.subgenre-pop {
  position: relative;
}

.subgenre-pop > summary {
  list-style: none;
}

.subgenre-pop > summary::-webkit-details-marker {
  display: none;
}

.subgenre-pop__panel {
  position: absolute;
  top: calc(100% + 0.5rem);
  left: 0;
  z-index: 4000;

  width: min(520px, 90vw);
  background: var(--bg-card);
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: 12px;
  box-shadow: 0 18px 50px rgba(0,0,0,0.55);

  padding: 0.75rem;
}

.subgenre-pop__actions {
  margin-bottom: 0.6rem;
}

.subgenre-pop__list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;

  max-height: min(52vh, 420px);
  overflow: auto;
  -webkit-overflow-scrolling: touch;

  padding-right: 0.25rem; /* scrollbar room */
}

/* Mobile: make popover feel like a dropdown sheet */
@media (max-width: 520px) {
  .subgenre-pop__panel {
    width: 92vw;
  }
}

/* Works grid (creator page) */
.work-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.6rem;
}

@media (min-width: 900px) {
.variant-compact-grid {
        grid-template-columns: 1fr 1fr;
        gap: var(--spacing-lg); /* Add gap back for 2-column layout */
        border-top: none;
    }
}

.variant-compact {
    position: relative;
    display: block;
    padding: 1.25rem;
    background: var(--bg-card); /* Ensure it stands out against body */
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 8px; /* Slight card feel */
    margin-bottom: 12px; /* Spacing between rows if using columns */
    transition: background 0.15s ease;
}

/* The Left Accent Bar (Matches your .rec-card::before) */
.variant-compact::before {
    content: "";
    position: absolute;
    left: 0;
    top: 12px;
    bottom: 12px;
    width: 3px;
    border-radius: 0 4px 4px 0;
    background: rgba(255, 255, 255, 0.1);
    transition: background 0.15s ease;
}

/* Hover State */
.variant-compact:hover {
    background: rgba(255, 255, 255, 0.08);
}

/* Dynamic Accent Colors for Tiers */
.variant-compact.accent-green:hover::before { background: #4ade80; } /* Tier 2 */
.variant-compact.accent-yellow:hover::before { background: #facc15; } /* Tier 3 */
.variant-compact.accent-blue:hover::before { background: var(--color-link); }

.compact-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: var(--spacing-md);
}

/* Empty State */
.variant-empty {
    padding: var(--spacing-lg);
    text-align: center;
    color: var(--text-muted);
    font-style: italic;
}

/* Fade In Animation for HTMX Content */
.fade-in {
    animation: fadeIn 0.3s ease-in forwards;
}

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

.compact-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 8px;
    padding-left: 12px; /* Make room for the accent bar */
}

.compact-name {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
}

.compact-badge {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 2px 6px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-secondary);
}

.compact-list {
    padding-left: 12px;
}

/* The mini-links inside the compact card */
.compact-link-row {
    display: flex;
    align-items: center;
    padding: 6px 0;
    border-bottom: 1px dashed rgba(255, 255, 255, 0.06);
    font-size: 0.9rem;
}

.compact-link-row:last-child {
    border-bottom: none;
}

.compact-link-row a {
    color: var(--text-secondary);
    transition: color 0.1s ease;
}

.compact-link-row a:hover {
    color: var(--color-link);
}

.compact-arrow {
    margin-right: 8px;
    color: var(--text-muted);
    font-size: 0.8rem;
}
  .work-grid {
    grid-template-columns: 1fr; /* keep it one column for now */
  }

/* =========================
   Works list (Creator page)
   ========================= */

/* Works list should NOT look like cards */
.works-list {
  margin: 0;
  padding: 0;
  border-top: 0px solid rgba(255,255,255,0.07);
}

.works-item {
  list-style: none;
}

.works-link {
  display: block;
  padding: 1.1rem 0.25rem 1.1rem 0.85rem;

  /* remove card look */
  background: transparent;
  border: 0;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  border-radius: 0;

  /* left rail gives hierarchy */
  position: relative;
  color: var(--text-primary);
  text-decoration: none;
}

.works-link::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0rem;
  bottom: 0rem;
  width: 3px;
  border-radius: 999px;
  background: rgba(255,255,255,0.10);
  transition: background 0.12s ease;
}

.works-link:hover {
  background: rgba(255,255,255,0.03); /* subtle row highlight, not a card */
}

.works-link:hover::before {
  background: rgba(64, 188, 244, 0.55); /* accent on hover */
}

/* Keep title row clean */
.works-title-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.works-title {
  font-size: 1.05rem;
  font-weight: 750;
}

.works-publisher {
  font-size: 1rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  color: rgba(153,170,187,0.75);
  position: relative;
}



.works-years {
  font-size: 0.92rem;
  color: rgba(153,170,187,0.9);
  white-space: nowrap;
}

/* optional subtitle line */
.works-subtitle {
  color: rgba(153,170,187,0.9);
  font-size: 0.95rem;
}

/* =========================================
   Theme / Browse Grid Layout
   ========================================= */

/* The Container for the Theme Header & Controls */
.theme-header {
    margin-bottom: var(--spacing-lg);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06); /* Matches your .rl-aside border */
    padding-bottom: var(--spacing-sm);
}

.header-top {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: var(--spacing-md);
}

.header-controls {
    font-size: 0.9rem;
    color: var(--text-secondary);
    white-space: nowrap;
}

.header-controls strong {
    color: var(--text-primary);
}

/* The Navigation Pills Row (e.g. [ Grimdark ] [ Magic ]) */
.pills-row {
    display: flex;
    gap: 0.5rem;
    margin-top: var(--spacing-sm);
    flex-direction: row;
    justify-content: space-between;
}

.pills__group {
    margin-top: auto;
}

/* Reusing your existing .pill style, but specific for nav links */
.pill--nav {
    font-family: monospace; /* Optional: adds a technical 'tag' feel */
    color: var(--color-link);
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.pill--nav:hover {
    border-color: rgba(64, 188, 244, 0.35); /* Your accent color fade */
    color: var(--text-primary);
    transform: translateY(-1px);
}

/* =========================
   The Card Grid
   ========================= */
.theme-grid {
    display: grid;
    /* Automatically fits 3 cards on desktop, 2 on tablet, 1 on mobile */
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 16px;
}

/* =========================
   The Surface Card
   ========================= */
.theme-card {
    background-color: var(--bg-card);
    border: 1px solid rgba(255, 255, 255, 0.06); /* Matches your .rl-main border */
    border-radius: 12px; /* Matches your .rl-main radius */
    padding: 20px;

    display: flex;
    flex-direction: column;
    text-decoration: none;
    min-height: 150px;

    transition: transform 0.2s ease, background-color 0.2s ease, border-color 0.2s ease;
}

.theme-card:hover {
    background-color: rgba(255, 255, 255, 0.08); /* Slightly lighter than --bg-card */
    transform: translateY(-3px); /* The "Lift" effect */
    border-color: rgba(64, 188, 244, 0.3); /* Subtle accent border on hover */
}

/* Top Row: Year (Right Aligned) */
.card-meta-top {
    font-size: 0.8rem;
    color: var(--text-muted); /* #678 */
    text-align: right;
    margin-bottom: 8px;
    font-variant-numeric: tabular-nums;
    font-weight: 500;
}

/* Middle: Title */
.card-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
    margin-bottom: auto; /* Pushes the footer to the bottom */
    padding-bottom: 16px;
    padding-top: 16px;
}

.card-subtitle {
    display: block;
    font-size: 0.95rem;
    color: var(--text-secondary);
    margin-top: 4px;
    font-weight: 400;
}

.card-title-container {
    display: flex;
    flex-direction: row;
    gap: 4px;
    justify-content: space-between;
    align-items: center;
}

/* Bottom: Footer Info */
.card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.06); /* Separator line */
    gap: 4px;
}

.card-writer {
    font-size: 0.85rem;
    color: var(--text-secondary);
    display: flex;
    text-align: center;
    align-items: center;
    gap: 6px;
    font-weight: 500;
}

.card-writer i {
    font-size: 0.75rem;
    opacity: 0.6;
}

/* Publisher Badge (Tiny Pill) */
.publisher-badge {
    font-size: 0.7rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 4px;
    background-color: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    height: 22px;
}

/* Optional: Brand Colors for the badge */
.publisher-dc { background-color: #0078f0; }
.publisher-marvel { background-color: #e23636; }
.publisher-marveldc { background-color: #9d30e6; }
.publisher-image { background-color: #333; border: 1px solid #666; }

.infinite-scroll-sentinel {
    grid-column: 1 / -1; /* Spans the full width of the grid */
    height: 1px;         /* Tiny height to ensure it exists in DOM */
    margin-top: -1px;    /* Pull it back up so it's effectively 0px visual height */
    visibility: hidden;  /* Can't be seen */
    pointer-events: none;
}

/* The Spinner Container (Centers it at the bottom) */
.htmx-indicator {
    display: flex;       /* Hidden by default */
    justify-content: center;
    padding: 0px 0;
    width: 100%;
}

/* Show spinner when HTMX is busy */
.htmx-request .htmx-indicator,
.htmx-request.htmx-indicator {
    display: flex;
}

.spinner-container {
    padding: var(--spacing-lg);
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
}

/* The Spinner Animation (Simple Circle) */
.spinner-icon {
    width: 32px;
    height: 32px;
    border: 3px solid rgba(255,255,255,0.1);
    border-radius: 50%;
    border-top-color: var(--color-link); /* Blue */
    animation: spin 0.8s linear infinite;
}

/* =========================================
   6. Character Directory (Flat / Dense)
   ========================================= */

.directory-header {
    margin-bottom: var(--spacing-lg);
    border-bottom: 1px solid var(--color-border);
    padding-bottom: var(--spacing-sm);
}

.directory-layout {
    display: flex;
    gap: 40px;
    position: relative; /* Needed for sticky context */
}

/* --- 1. Sticky Sidebar --- */
.directory-nav {
    position: sticky;
    top: 100px;
    max-height: 80vh;
    overflow-y: auto;
    padding-right: 4px;
    scrollbar-width: none; /* Hide scrollbar for cleaner look */
}

.directory-content {
    flex: 1; /* Takes up remaining width */
}

.alpha-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
    text-align: center;
}

.alpha-list a {
    display: block;
    color: var(--text-muted);
    font-weight: 700;
    padding: 2px 0;
    font-size: 0.8rem;
    transition: color 0.15s ease;
}

.alpha-list a:hover {
    color: var(--color-link);
    background: rgba(255,255,255,0.05);
    border-radius: 4px;
}

/* --- 2. Headers --- */
.alpha-section {
    margin-bottom: 32px;
    scroll-margin-top: 100px;
}

.sticky-header {
    background-color: var(--bg-body);
    position: sticky;
    top: 71px;
    z-index: 10;
    padding-top: 16px;
    border-bottom: 1px solid var(--color-border);
    margin-bottom: 20px;
}

/* --- 3. The Flat Grid --- */
.flat-index-grid {
    display: grid;
    /* repeat(auto-fill, ...): Creates as many columns as fit in the screen.
       minmax(200px, 1fr): Columns are at least 200px wide, but stretch (1fr) to fill gaps.
    */
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 15px;
}

/* The Link Item */
.flat-item {
    display: flex;
    flex-direction: column;
    padding: 6px 8px; /* Minimal padding */
    border-radius: 4px;
    text-decoration: none;
    transition: background 0.1s ease;
    border-left: 2px solid transparent; /* Invisible border for alignment */
    min-height: 51px;
}

/* Hover State - No lift, just highlight */
.flat-item:hover {
    background: rgba(255, 255, 255, 0.05);
    border-left-color: var(--color-link); /* Subtle accent on hover */
}

/* Typography */
.flat-name {
    color: var(--text-primary);
    font-size: 0.9rem; /* Smaller, dense font */
    font-weight: 600;
    line-height: 1.2;

    /* Truncate if name is absurdly long */
    overflow: hidden;
    text-overflow: ellipsis;
}

.flat-real-name {
    color: var(--text-muted);
    font-size: 0.75rem;
    margin-top: 2px;

    /* Truncate */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Mobile: Switch to 2 columns */
@media (max-width: 768px) {
    .flat-index-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    }

    .directory-layout {
        flex-direction: column; /* Stack sidebar on top or hide it */
    }

}

@keyframes spin {
    to { transform: rotate(360deg); }
}

@media (min-width: 900px) {
  .rec-drawer,
  .rec-backdrop {
    display: none !important;
  }
  .rl-layout {
        grid-template-columns: minmax(0, 1fr) 320px;
    }

  .rl-aside {
    position: sticky;
    top: calc(var(--header-height) + var(--spacing-lg));
    max-height: calc(100vh - (var(--header-height) + var(--spacing-lg) + var(--spacing-lg)));

    display: flex;
    flex-direction: column;

    padding: 0;
    overflow: hidden;   /* IMPORTANT: stop scrolling on the whole panel */
    min-height: 0;      /* allow children to shrink */
  }

.rec-grid {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;

    /* optional: scrollbar breathing room */
    padding-right: 0.25rem;
  }
}

@media (max-width: 899px) {
  .nav-recs-btn {
    display: inline-flex;
    align-items: center;
    background: rgba(0, 0, 0, 0.18);
    color: var(--text-primary);
    border: 1px solid rgba(255, 255, 255, 0.10);
    border-radius: 10px;
    padding: 0.5rem 0.75rem;
    cursor: pointer;
    font-weight: 600;
  }

  body.drawer-open {
  overflow: hidden;
}

  .rl-aside { display: none; }

    .rec-drawer__body {
    display: grid;
    grid-template-rows: 1fr auto;
    gap: 0;
    overflow: hidden;       /* no scrolling */
    min-height: 0;
    padding: 0rem;
  }

  /* List takes remaining space; pagination stays visible at bottom */
  .rec-grid {
    display: grid;
    gap: 0rem;
    min-height: 0;          /* allow rows to shrink to fit */
    overflow-y: auto;           /* scroll instead of smush */
    -webkit-overflow-scrolling: touch;
  }

  .rec-card h4 {
    margin: 0;
    line-height: 1.15;
  }

  .rec-meta {
    margin-top: 0.25rem;
    line-height: 1.1;
    font-size: 0.8rem;
    overflow: hidden;
  }

  .rec-title {
    font-size: 0.8rem;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 1;
    overflow: hidden;
  }

  .rec-subtitle {
    font-size: 0.8rem;
  }

  .pagination .current-page {
    overflow: hidden;
    text-overflow: ellipsis;
  }

}

/* =========================================
   5. Character Hub Specifics
   ========================================= */

/* The Main Page Header (Matches .list-header) */
.hub-identity-group {
    /* Increased gap between "Barbara Gordon" and the alias row */
    gap: 10px;
    /* Indent slightly to differentiate from main title hierarchy */
    padding-left: 2px;
}

.hub-header {
    border-bottom: 1px solid var(--color-border);
    margin-bottom: var(--spacing-lg);
    /* Increased padding for more overall breathing room */
    padding-bottom: var(--spacing-sm);
    display: flex;
    flex-direction: column;
}

.hub-title {
    font-size: 3.5rem;
    /* Added margin below the main title so it doesn't sit on top of the name */
    margin: 0 0 2px 0;
    color: var(--text-primary);
    line-height: 1;
    letter-spacing: -0.02em;
}

.hub-subtitle {
    font-size: 1.6rem;
    color: var(--text-secondary); /* The standard grey */
    margin: 0;
    font-weight: 500;
    line-height: 1.2;
}

.hub-alias-row {
    display: inline-flex; /* Shrink to fit content */
    align-items: baseline;
    gap: 8px;

    /* The Container Style */
    background: rgba(64, 188, 244, 0.1);
    border: 1px solid rgba(64, 188, 244, 0.2);
    padding: 4px 12px;
    border-radius: 999px; /* Pill shape */

    margin-top: 8px;
    margin-bottom: 12px;
}

/* The Label part */
.alias-label {
    font-size: 0.8rem;
    font-weight: 800;
    color: var(--color-link); /* Bright Blue */
    text-transform: uppercase;
    letter-spacing: 0.05em;
    /* No background on the label itself anymore */
    background: transparent;
    padding: 0;
}

/* The Value part */
.alias-value {
    font-size: 1rem;
    color: var(--text-secondary); /* White/Light Grey */
    font-weight: 500;
}

.hub-alias-row.popular {
    margin-bottom: 0px;
}

.alias-label.popular {
    font-size: 0.75rem;
}

.alias-value.popular {
    font-size: 0.9rem;
}

.hub-filter-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
    padding: 0 4px;
}

.filter-label {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-muted);
    white-space: nowrap;
}

.filter-pills {
    display: flex;
    flex-wrap: wrap; /* This forces items to drop to the next line */
    gap: 8px;
}

.filter-pills::-webkit-scrollbar {
    display: none;
}

.filter-pill {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-secondary);
    padding: 6px 14px;
    border-radius: 999px;
    font-size: 0.85rem;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s ease;
}

.filter-pill:hover {
    border-color: rgba(64, 188, 244, 0.4);
    color: var(--text-primary);
}

.filter-pill.active {
    background: rgba(64, 188, 244, 0.15);
    border-color: rgba(64, 188, 244, 0.6);
    color: #fff;
    font-weight: 600;
}

/* -----------------------------------------
   Tier 1: Expanded Cards (The "Main" view)
   ----------------------------------------- */
/* This container mimics your .rl-main or .theme-card styling */
.character-variant {
    background: var(--bg-card);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 12px;
    overflow: hidden; /* Keeps the inner header corners rounded */
    margin-bottom: var(--spacing-lg);
    transition: border-color 0.2s ease;
}

.character-variant:hover {
    border-color: rgba(64, 188, 244, 0.2); /* Subtle blue glow on hover */
}

.hub-section {
    margin-bottom: calc(var(--spacing-lg) * 2);
}

.hub-section-title {
    margin-top: 0;
    margin-bottom: var(--spacing-md);
    color: var(--text-secondary);
    border-bottom: 1px solid var(--color-border);
    font-size: 1.4rem;
    margin-top: calc(var(--spacing-lg) * 1.5);
    padding-bottom: var(--spacing-sm);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 500;
    line-height: 1.2;
}

/* The header inside the card (e.g. "New Earth") */
.variant-header {
    background: rgba(255, 255, 255, 0.02);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    padding: var(--spacing-md) var(--spacing-lg);
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background-color 0.2s ease;
    min-height: 72px;
}

.variant-title-group {
    align-items: center;
    gap: 16px; /* Space between chevron and name */
}

.variant-title-group h3 {
    margin: 0;
    font-size: 1.25rem; /* Larger, cleaner font for the name */
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1;
}

.variant-header.clickable {
    cursor: pointer;
    user-select: none;
}

.variant-header h3 {
    margin: 0;
    font-size: 1.5rem;
    color: var(--text-primary);
}

.variant-header.clickable {
        cursor: pointer;
        user-select: none;
    }
.variant-header.clickable:hover {
    background: rgba(255,255,255,0.05);
}

/* Variant Grid Footer */
.variant-footer {
    position: relative; /* Anchor for the absolute spinner */
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 16px 16px;
    width: 100%;
    min-height: 60px; /* Reserve space so it doesn't jump */
}

/* Button: Make it wider and more interactive */
.btn-load-more {
    background: rgba(255, 255, 255, 0.08); /* Slightly lighter than card */
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-primary);

    /* Bigger Click Target */
    padding: 10px 48px;      /* Wider horizontal padding */
    min-width: 200px;        /* Force a minimum width */

    border-radius: 999px;    /* Full pill shape */
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;

    /* Flex to center text/spinner inside button if needed */
    display: inline-flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
}

.btn-load-more:hover {
    background: rgba(64, 188, 244, 0.15); /* Blue tint on hover */
    border-color: rgba(64, 188, 244, 0.5);
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.variant-footer.htmx-request .btn-load-more {
    opacity: 0;
    pointer-events: none;
}

/* Spinner Adjustments */
.variant-spinner {
    display: none;
    position: absolute;  /* Take it out of flow */
    left: 50%;           /* Center horizontally */
    top: 50%;            /* Center vertically */
    transform: translate(-50%, -50%); /* Perfect centering */

    /* Ensure it sits on top if needed, or behind */
    z-index: 10;
    pointer-events: none; /* Let clicks pass through if it's visible but overlaying */
}

/* Ensure spinner icon is sized correctly */
.variant-spinner .spinner-icon {
    width: 20px;
    height: 20px;
    border-width: 2px;
}

.variant-footer.htmx-request .btn-load-more {
    opacity: 0;
    pointer-events: none;
}

.variant-footer.htmx-request .variant-spinner {
    display: block;
}

/* Chevron Animation */
.chevron {
    display: inline-block;
    font-size: 0.8rem;
    color: var(--text-muted);
    transition: transform 0.2s ease;
}

.character-variant.open .chevron {
    transform: rotate(90deg);
}

/* Content Wrapper logic */
.variant-content-wrapper {
    display: none; /* Hidden by default */
    min-height: 80px; /* Space for spinner */
}

/* When open, show content */
.character-variant.open .variant-content-wrapper {
    display: block;
    border-top: 1px solid rgba(255,255,255,0.06);
}

/* When closed, remove bottom radius of header so it looks flush */
.character-variant.closed .variant-header {
    border-bottom: none;
}

.variant-name-badge {
    /* 1. INCREASE SIZE: Treat it like a name, not a tag */
    font-size: 1.1rem;
    font-weight: 600;
    letter-spacing: 0.02em;

    /* 2. THE BORDER LOOK: Matches your pill aesthetic */
    background: rgba(0, 0, 0, 0.2); /* Slightly darker background for contrast */
    border: 1px solid rgba(255, 255, 255, 0.15); /* Distinct border */
    color: var(--text-primary); /* Brighter white text */

    /* 3. Spacing */
    padding: 6px 14px; /* More breathing room */
    border-radius: 6px;

    /* 4. Alignment Fix */
    align-items: center;
    white-space: nowrap;
    box-shadow: 0 1px 2px rgba(0,0,0,0.2); /* Subtle depth */
}

/* The Grid of Reading Lists inside the Variant Card */
/* =========================================
   Hub Grid & Card Refinements
   ========================================= */

/* The Grid Container */
.variant-grid {
    display: grid;
    /* Responsive: Fits as many 260px cards as possible, then stretches them */
    grid-template-columns: repeat(auto-fill, minmax(268px, 1fr));
    gap: 16px;
    padding: var(--spacing-lg);
    background: none; /* Subtle dark background for the open drawer */
}

.creator-grid {
    display: grid;
    /* CHANGE 1: Lower min-width from 268px to 170px to fit 3 columns with sidebar */
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
    gap: 16px;

    /* CHANGE 2: Remove padding.
       .rl-main already has padding, so this was doubling it and squishing the grid. */
    padding: 0;

    background: none;
}

/* The Card Itself */
.hub-rl-card {
    display: flex;
    flex-direction: column;
    padding: 0px;
    background: var(--bg-card); /* Match your theme card bg */
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 8px;
    text-decoration: none;
    transition: all 0.2s ease;
    min-height: 120px; /* Ensure visual consistency */
    position: relative;
}

/* Hover Effect: Lift & Border Glow */
.hub-rl-card:hover {
    transform: translateY(-3px);
    border-color: rgba(64, 188, 244, 0.4); /* Your --color-link with opacity */
    background: rgba(255, 255, 255, 0.08);
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.hub-card-poster {
    width: 100%;
    /* Aspect Ratio Hack: Keeps it shaped like a comic book (2:3 ratio)
       This ensures uniform height even if images vary slightly */
    aspect-ratio: 2 / 3;
    position: relative;
    border-radius: 8px 8px 0 0;
    background: #000; /* Loading placeholder color */
    border-bottom: 1px solid rgba(255,255,255,0.06);
}

.card-era-badge {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;


    background: rgba(20, 24, 28, 0.9); /* Dark background */
    color: rgba(64, 188, 244, 1); /* Blue Text */

    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;

    padding: 6px 8px;
    text-align: center;
    backdrop-filter: blur(4px);

    /* Ensure it sits above the image but below hover effects if any */
    z-index: 2;
}

.hub-card-content {
    padding: 16px;
}

/* 3. The Image Itself */
.hub-card-poster img {
    border-radius: 8px 8px 0 0;
    width: 100%;       /* Force image to fit width of card */
    height: 100%;      /* Force image to fit height of aspect ratio */
    object-fit: cover; /* "Cover" fills the box (standard look). Use "contain" if you want 0% cropping but black bars. */

}

.hub-rl-year {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-family: monospace;
    display: block;
    margin-bottom: 6px;
}



.hub-rl-footer {
    margin-top: auto; /* Pushes tags to the bottom */
}

/* Tiny Pills specifically for these small cards */
.pill--tiny {
    font-size: 0.7rem;
    padding: 2px 8px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 4px; /* Less rounded than main pills for technical look */
    color: var(--text-muted);
}

.hub-rl-tags {
    margin-top: 12px;
    display: flex;
    gap: 4px;
}

.theme-item {
    flex-direction: row !important;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.theme-item .compact-badge {
    background: rgba(255, 255, 255, 0.12);    /* Increased opacity (was 0.05) */
    color: #cbd5e1;                           /* Much brighter grey (almost white) */
    font-weight: 600;                         /* Make the numbers thicker */
    border: 1px solid rgba(255,255,255,0.08); /* Adds a crisp edge */
    min-width: 32px;                          /* Ensures small numbers (7) don't look squished */
    text-align: center;
}

.theme-item:hover .compact-badge {
    background: rgba(64, 188, 244, 0.2);
    color: var(--color-link);                 /* Bright Blue */
    border-color: rgba(64, 188, 244, 0.3);
}

/* Container adjustment */
.genre-header-row {
    border-bottom: 1px solid var(--color-border);
    padding-bottom: 8px;
    margin-bottom: 16px;
    display: flex;
    justify-content: space-between;
    align-items: flex-end; /* Aligns "View Hub" with the text baseline */
}

/* The Title Link */
.genre-header-link {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: var(--text-primary);
    text-decoration: none;
    transition: color 0.2s ease;
    line-height: 1;
}

/* Hover State: Turn Blue */
.genre-header-link:hover {
    color: var(--color-link);
}

/* The Arrow Icon */
.genre-arrow {
    font-size: 0.7em; /* Keep it smaller than the text */
    opacity: 0.5;     /* Faint by default */
    transition: transform 0.2s ease, opacity 0.2s ease;
}

/* Hover Animation: Slide arrow & brighten */
.genre-header-link:hover .genre-arrow {
    opacity: 1;
    transform: translateX(4px); /* Slide right */
}

/* The "View Hub" text on the right (Optional) */
.header-view-all {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    opacity: 0; /* Hidden by default for clean look */
    transform: translateX(-10px);
    transition: all 0.2s ease;
}

/* Show "View Hub" when hovering anywhere on the header row */
.genre-header-row:hover .header-view-all {
    opacity: 1;
    transform: translateX(0);
}

.theme-header {
    border:0;
}

.theme-section {
    margin-bottom: calc(var(--spacing-lg) * 2);
}

.theme-title {
    font-size: 1.25rem;
}

/* =========================================
   Home: Theme Carousel (Cinematic Row)
   ========================================= */

/* Container logic to handle buttons */
.carousel-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    /* Negative margin allows the scroll track to bleed slightly if needed */
    margin: 0 -8px;
}

/* The Scrollable Area */
.carousel-track {
    display: flex;
    gap: 16px;
    overflow-x: auto;
    scroll-behavior: smooth;
    padding: 4px 8px 20px 8px; /* Bottom padding accounts for hover shadow */
    scrollbar-width: none; /* Hide scrollbar Firefox */
    width: 100%;

    /* Snap effect for touch devices */
    scroll-snap-type: x mandatory;
}

.carousel-track::-webkit-scrollbar {
    display: none; /* Hide scrollbar Chrome/Safari */
}

/* The Cinematic 16:9 Card */
.carousel-card {
    flex: 0 0 280px; /* Fixed width */
    aspect-ratio: 16/9; /* Enforce Cinematic Ratio */

    position: relative;
    border-radius: 12px;
    overflow: hidden;
    text-decoration: none;
    scroll-snap-align: start;

    background: var(--bg-card);
    border: 1px solid rgba(255,255,255,0.1);

    transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

/* Hover State: Lift & Glow */
.carousel-card:hover {
    transform: translateY(-4px);
    border-color: var(--color-link);
    box-shadow: 0 12px 24px rgba(0,0,0,0.5);
    z-index: 2;
}

/* The Background Image */
.carousel-card-bg {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
    opacity: 0.85; /* Slight dim by default */
}

.carousel-card:hover .carousel-card-bg {
    transform: scale(1.05); /* Subtle Zoom */
    opacity: 1; /* Brighten on hover */
}

/* Text Overlay (Bottom Gradient) */
.carousel-card-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;

    /* Gradient ensures text pops against any image */
    background: linear-gradient(to top, rgba(0,0,0, 0.95) 10%, rgba(0,0,0, 0) 100%);

    padding: 40px 16px 12px 16px; /* High top padding for gradient fade */
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
}

.carousel-card-title {
    color: var(--text-primary);
    font-weight: 700;
    font-size: 1.1rem;
    text-shadow: 0 2px 4px rgba(0,0,0,0.8);
    letter-spacing: 0.02em;
}

.carousel-card-count {
    font-size: 0.75rem;
    color: rgba(255,255,255,0.7);
    font-weight: 600;
    background: rgba(0,0,0,0.3);
    padding: 2px 6px;
    border-radius: 4px;
    backdrop-filter: blur(2px);
}

/* Navigation Buttons */
.carousel-btn {
    position: absolute;
    z-index: 10;
    background: rgba(30, 35, 40, 0.9); /* Dark background */
    border: 1px solid rgba(255,255,255,0.15);
    color: var(--text-primary);

    width: 40px;
    height: 40px;
    border-radius: 50%;

    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    backdrop-filter: blur(4px);
    transition: all 0.2s ease;
    box-shadow: 0 4px 12px rgba(0,0,0,0.5);
}

.carousel-btn:hover {
    background: var(--color-link);
    border-color: var(--color-link);
    color: white;
    transform: scale(1.1);
}

.btn-left { left: 4px; }
.btn-right { right: 4px; }

/* -----------------------------------------
   Tier 2 & 3: Compact List (The "Works" view)
   ----------------------------------------- */
/* Styling this to match your .works-link / .rec-card style */

.variant-compact-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0; /* List style, no gaps */
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.home-poster-grid {
    display: grid;
    /* FORCE 4 Columns regardless of screen size */
    grid-template-columns: repeat(4, 1fr);
    /* Tighter gap to make room for 4 items on small screens */
    gap: 12px;
    margin-bottom: 40px;
}

.poster-only-card {
    /* calculation: (100% width - (3 gaps * 16px)) / 4 items */
    flex: 0 0 calc((100% - 48px) / 4);

    /* Ensure they don't get too small on mobile, or too big on wide screens */
    min-width: 160px;
    max-width: 240px;

    text-decoration: none;
    transition: transform 0.2s ease;
    scroll-snap-align: start;
    display: block; /* Essential for the flex item to behave */
}

.poster-only-card:hover {
    transform: translateY(-5px);
    z-index: 2; /* Ensure it pops over neighbors */
}

/* Reusing your existing poster frame logic */
.poster-frame {
    position: relative;
    width: 100%;
    aspect-ratio: 2 / 3;
    border-radius: 6px; /* Slightly tighter radius for dense grid */
    overflow: hidden;
    border: 1px solid rgba(255,255,255,0.1);
    background: var(--bg-card);
    box-shadow: 0 4px 6px rgba(0,0,0,0.2);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.poster-only-card:hover .poster-frame {
    border-color: var(--color-link);
    box-shadow: 0 8px 16px rgba(0,0,0,0.5);
}

.poster-frame img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* =========================
   Freshly Inked (Updates)
   ========================= */

.update-grid {
    display: grid;
    /* 2 Columns on Desktop */
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    margin-bottom: 40px;
}

.update-card {
    display: flex;
    align-items: center;
    background: var(--bg-card);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 8px;
    padding: 12px;
    text-decoration: none;
    transition: all 0.2s ease;
    gap: 16px;
}

.update-card:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(64, 188, 244, 0.3);
    transform: translateY(-2px);
}

/* Tiny Poster on the Left */
.update-poster-wrapper {
    flex: 0 0 48px; /* Fixed width */
    height: 72px;   /* Fixed height (2:3 ratio) */
    border-radius: 4px;
    overflow: hidden;
    position: relative;
    background: #000;
}

.update-poster-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Content Side */
.update-content {
    display: flex;
    flex-direction: column;
    justify-content: center;
    overflow: hidden; /* For truncation */
    flex: 1;
}

/* Top Row: Badges & Time */
.update-meta-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}

.status-badge {
    font-size: 0.65rem;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.status-new {
    background: rgba(74, 222, 128, 0.15);
    color: #4ade80; /* Green */
    border: 1px solid rgba(74, 222, 128, 0.2);
}

.status-new.issue-embed{
    margin-left: auto;
}

.status-updated {
    background: rgba(250, 204, 21, 0.15);
    color: #facc15; /* Yellow */
    border: 1px solid rgba(250, 204, 21, 0.2);
}

.update-time {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Title */
.update-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
    line-height: 1.2;

    /* Truncate to 1 line */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.update-subtitle {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-top: 2px;
}

/* =========================
   Square Pagination
   ========================= */

.pagination-squares {
    display: flex;
    justify-content: center;
    gap: 6px; /* Space between squares */
    margin-top: 32px;
    flex-wrap: wrap; /* Safety wrap for mobile */
}

.page-sq {
    display: flex;
    align-items: center;
    justify-content: center;

    width: 36px;
    height: 36px;

    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px; /* Soft square */

    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.15s ease;
    user-select: none;
    cursor: pointer;
    font-family: inherit; /* inherit font */
    padding: 0;
}

button.page-sq:focus {
    outline: 2px solid var(--color-focus);
    outline-offset: 2px;
}

/* Hover State */
.page-sq:hover:not(.disabled):not(.active):not(.ellipsis) {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--color-link);
    color: var(--text-primary);
    transform: translateY(-2px);
}

/* Active State (Current Page) */
.page-sq.active {
    background: var(--color-link);
    border-color: var(--color-link);
    color: #fff; /* White text on blue bg */
    pointer-events: none; /* Can't click active page */
}

/* Arrow specifics */
.page-sq.arrow {
    font-size: 0.75rem; /* Arrows slightly smaller icons */
}

/* Disabled Arrows */
.page-sq.disabled {
    opacity: 0.3;
    pointer-events: none;
    border-color: transparent;
}

/* The Ellipsis ... */
.page-sq.ellipsis {
    border: none;
    background: transparent;
    color: var(--text-muted);
    letter-spacing: 2px;
    cursor: default;
}

/* Mobile Tweak: shrinking slightly if needed */
@media (max-width: 480px) {
    .page-sq {
        width: 32px;
        height: 32px;
        font-size: 0.85rem;
    }
}

/* Mobile: Stack to 1 Column */
@media (max-width: 768px) {
    .update-grid {
        grid-template-columns: 1fr;
    }
}

/* OPTIONAL: Mobile Tweaks */
@media (max-width: 768px) {
    .home-poster-grid {
        gap: 8px; /* Even tighter gap on phones */
    }

    /* On very small phones, 4 columns might be 70px wide.
       If that's too small, remove this query to keep it 4 columns.
       If you want to allow 2 columns on VERY small screens: */
    /* @media (max-width: 350px) {
        .home-poster-grid { grid-template-columns: repeat(2, 1fr); }
    }
    */
}



@media (max-width: 520px) {
  .pills-row {
    flex-direction: column;
  }

  .pills__group.sort {
    display: flex;
    justify-content: flex-end;
  }

  .rl-main {
        padding: var(--spacing-md);
    }
    .section-title {
        margin-top: var(--spacing-lg);
    }

  .meta-row {
    grid-template-columns: 1fr;
    gap: 0.25rem;
  }
  .meta-label {
    padding-top: 0;
  }
}


@media (max-width: 899px) and (max-height: 520px) {
  .rec-drawer__body {
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }

  /* allow scrolling in the list area */
  .rec-grid {
    display: grid;
    grid-template-rows: none;   /* remove the 10 equal rows */
    overflow-y: auto;           /* scroll instead of smush */
    -webkit-overflow-scrolling: touch;
    gap: 0rem;
    min-height: 0;
    padding-right: 0.25rem;     /* optional: room for scrollbar */
  }

  /* let cards size naturally */


  /* keep pager visible at bottom */
  .pagination {
    position: static;
    flex: 0 0 auto;
    margin-top: 0;
  }
}

/* Mobile Adjustments */
@media (max-width: 768px) {
    .carousel-card {
        flex: 0 0 240px; /* Smaller card on phone */
    }
    .carousel-btn {
        display: none; /* Hide buttons on touch, natural swipe is better */
    }
}

