/* Media Manager - 03-components.css */

/* ===========================
   STEP 4 — SCOPED SCROLLBARS
   =========================== */

/* Scope to filter areas (sidebar + header tools) and modal details */
.sidebar,
#headerTools,
.modal__details {
  scrollbar-width: thin;
  /* Firefox */
  scrollbar-color: rgba(125, 211, 252, .26) transparent;
}

.modal__actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 12px;
  /* space from identifiers text */
}

/* WebKit thin scrollbar */
.sidebar::-webkit-scrollbar,
#headerTools::-webkit-scrollbar,
.modal__details::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

.sidebar::-webkit-scrollbar-track,
#headerTools::-webkit-scrollbar-track,
.modal__details::-webkit-scrollbar-track {
  background: transparent;
}

/* Glassy thumb with subtle aurora tint */
.sidebar::-webkit-scrollbar-thumb,
#headerTools::-webkit-scrollbar-thumb,
.modal__details::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background:
    linear-gradient(180deg,
      var(--scroll-thumb-1),
      var(--scroll-thumb-2));
  border: 2px solid transparent;
  /* makes it appear slimmer */
  background-clip: padding-box;
  box-shadow: inset 0 0 0 1px var(--border);
}

.sidebar::-webkit-scrollbar-thumb:hover,
#headerTools::-webkit-scrollbar-thumb:hover,
.modal__details::-webkit-scrollbar-thumb:hover {
  background:
    linear-gradient(180deg,
      var(--scroll-thumb-1-hover),
      var(--scroll-thumb-2-hover));
}

.sidebar::-webkit-scrollbar-thumb:active,
#headerTools::-webkit-scrollbar-thumb:active,
.modal__details::-webkit-scrollbar-thumb:active {
  background:
    linear-gradient(180deg,
      var(--scroll-thumb-1-active),
      var(--scroll-thumb-2-active));
}

.sidebar::-webkit-scrollbar-corner,
#headerTools::-webkit-scrollbar-corner,
.modal__details::-webkit-scrollbar-corner {
  background: transparent;
}

/* Step 8: identifiers rows with per-field copy buttons */
.idsRow {
  display: grid;
  grid-template-columns: 140px 1fr auto;
  align-items: center;
  gap: 10px;
}

.btn--mini {
  padding: 6px 10px;
  border-radius: 10px;
  font-size: 12px;
  line-height: 1;
}

/* ---------- Grid ---------- */
/* Responsive, fluid grid with a "no giant cards" safeguard.

   Your targets:
     - >=1600px: ~8 cards across
     - >=1200px: ~6 cards across
     - >=900px:  ~4 cards across (tablet / small laptop)
     - >=560px:  ~3 cards across (large phones / small tablets)
     - <560px:   2 cards across (small phones)

   Notes:
     - We keep auto-fit + min/max sizing so the grid stays fluid.
     - We cap the grid container width per breakpoint so cards don't
       stretch comically when there are only a few items.
*/
:root {
  --card-min: 160px;
  --card-max: 190px;
  --card-gap: 16px;
  --grid-max-cols: 2;
}

@media (min-width: 560px) {
  :root {
    --card-min: 170px;
    --card-max: 200px;
    --card-gap: 16px;
    --grid-max-cols: 3;
  }
}

@media (min-width: 900px) {
  :root {
    --card-min: 180px;
    --card-max: 210px;
    --card-gap: 18px;
    --grid-max-cols: 4;
  }
}

@media (min-width: 1200px) {
  :root {
    /* Medium desktop: slightly smaller cards to avoid the "too big" feel */
    --card-min: 180px;
    --card-max: 200px;
    --card-gap: 18px;
    --grid-max-cols: 6;
  }
}

@media (min-width: 1600px) {
  :root {
    --card-min: 180px;
    --card-max: 210px;
    --card-gap: 18px;
    --grid-max-cols: 8;
  }
}

.grid,
#cardGrid {
  display: grid;
  gap: var(--card-gap);

  /* Fluid but capped cards */
  grid-template-columns: repeat(auto-fit, minmax(var(--card-min), var(--card-max)));

  /* Prevent stretch when sparse */
  justify-content: center;

  /* Make the container "fluid" up to the current breakpoint's
     max-columns target (8/6/4/3/2). This keeps cards from inflating
     when there are only a few on screen. */
  width: 100%;
  max-width: min(100%,
      calc((var(--card-max) * var(--grid-max-cols)) + (var(--card-gap) * (var(--grid-max-cols) - 1))));

  margin: 0 auto;
}

/* ---------- Home layout ---------- */
#libraryGrid {
  display: flex;
  flex-direction: column;
  gap: 28px;
  align-items: stretch;
}

/* ---------- Home v1 (Entry screen) ---------- */
#homeView.home--v1 {
  /* Center the welcome block as a single, calm entry point */
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  /* Avoid scroll-y feel on large screens; allow graceful shrink on short viewports */
  min-height: calc(100dvh - 140px);
  padding: 24px 16px 60px;
  gap: 18px;
}

#homeView.home--v1 .homeWelcome {
  max-width: 720px;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
}

#homeView.home--v1 .homeWelcome__lede {
  margin: 12px 0 0;
  font-size: 1.05rem;
}

#homeView.home--v1 .homeWelcome__types {
  margin: 10px 0 0;
  color: var(--muted);
}

#homeView.home--v1 .homeWelcome__actions {
  margin-top: 18px;
}

/* Hide legacy home modules (tiles, health, quick launch, footer) for v1 */
#homeView.home--v1 #libraryGrid,
#homeView.home--v1 .homeSection,
#homeView.home--v1 #homeQuickLaunch,
#homeView.home--v1 .homeFooter {
  display: none;
}

/* Explicitly re-enable Home v1 sections we actually use */
#homeView.home--v1 .homeSection--cinemaFact {
  display: block !important;
}

#homeView.home--v1 .homeSection--randomMovies {
  display: block !important;
}



.homeSection {
  max-width: 1200px;
  margin: 0 auto;
}

.homeSection__title {
  margin: 0 2px 10px;
  color: var(--muted);
  text-align: center;
}


/* Home v1 polish: section framing + title-card headers + subtle motion */
#homeView.home--v1 .homeSection {
  padding: 18px 14px 10px;
  margin-top: 10px;
  border: 1px solid rgba(255, 255, 255, 0.04);
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.035), rgba(255, 255, 255, 0.0));
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.22);
}

#homeView.home--v1 .homeSection__header {
  margin-bottom: 12px;
}

#homeView.home--v1 .homeSection__title {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;

  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-size: 12px;
  color: var(--muted);
}

#homeView.home--v1 .homeSection__title::before,
#homeView.home--v1 .homeSection__title::after {
  content: "";
  height: 1px;
  flex: 1 1 auto;
  max-width: 180px;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.0), rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0.0));
}

/* Cinema Fact: treat as intertitle card */
#homeView.home--v1 .cinemaFact {
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.02));
}

/* Motion (respect reduced motion) */
@media (prefers-reduced-motion: no-preference) {
  @keyframes mmHomeFadeUp {
    from {
      opacity: 0;
      transform: translateY(8px);
    }

    to {
      opacity: 1;
      transform: translateY(0);
    }
  }

  #homeView.home--v1 .cinemaFact {
    animation: mmHomeFadeUp 220ms ease-out both;
  }

  #homeView.home--v1 .randomMovies__item {
    animation: mmHomeFadeUp 220ms ease-out both;
  }

  #homeView.home--v1 .randomMovies__item:nth-child(1) {
    animation-delay: 40ms;
  }

  #homeView.home--v1 .randomMovies__item:nth-child(2) {
    animation-delay: 80ms;
  }

  #homeView.home--v1 .randomMovies__item:nth-child(3) {
    animation-delay: 120ms;
  }

  #homeView.home--v1 .randomMovies__item:nth-child(4) {
    animation-delay: 160ms;
  }

  #homeView.home--v1 .randomMovies__item:nth-child(5) {
    animation-delay: 200ms;
  }
}


/* Horizontal rails */
.homeRail {
  display: flex;
  gap: 18px;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 6px 2px 12px;

  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;

  justify-content: center;
}

/* Home rail horizontal scrollbar (keep) */
.homeRail::-webkit-scrollbar {
  height: 10px;
}

.homeRail::-webkit-scrollbar-track {
  background: var(--surface-card);
  border-radius: 999px;
}

.homeRail::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: 999px;
}

.homeRail::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, .24);
}

.homeRail .card {
  flex: 0 0 200px;
  scroll-snap-align: start;
}

/* ---------- Cards ---------- */
.card {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .055), rgba(255, 255, 255, .020));
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  overflow: hidden;

  box-shadow:
    0 2px 14px rgba(0, 0, 0, .25),
    inset 0 0 0 1px var(--border-soft);

  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);

  cursor: pointer;
  transform: translateY(0);
  transition:
    transform .18s var(--ease),
    border-color .18s var(--ease),
    box-shadow .18s var(--ease),
    filter .18s var(--ease),
    background .18s var(--ease),
    backdrop-filter .18s var(--ease);

  position: relative;
  /* required for absolute badge */
  will-change: transform;
}

.card::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(180deg, var(--border), transparent 42%),
    radial-gradient(400px 160px at 50% 0%, var(--border-soft), transparent 60%),
    radial-gradient(520px 220px at 18% 0%, rgba(125, 211, 252, .07), transparent 62%),
    radial-gradient(520px 220px at 92% 0%, rgba(129, 140, 248, .065), transparent 62%);
  opacity: .70;
  transition: opacity .18s var(--ease);
}

.card::after {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: var(--radius);
  pointer-events: none;
  opacity: 0;
  transition: opacity .18s var(--ease);
  background:
    radial-gradient(600px 220px at 20% 0%, rgba(125, 211, 252, .14), transparent 55%),
    radial-gradient(500px 220px at 90% 0%, rgba(129, 140, 248, .13), transparent 55%);
}

.card:hover {
  transform: translateY(-4px);
  border-color: var(--border-strong);
  box-shadow:
    0 18px 44px rgba(0, 0, 0, .42),
    inset 0 0 0 1px var(--border-subtle);

  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .065), rgba(255, 255, 255, .028));
}

.card:hover::after {
  opacity: 1;
}

.card:hover::before {
  opacity: .85;
}

.card:active {
  transform: translateY(-2px);
}

/* Default image ratio: poster 2:3 */
.card__img,
.card img {
  width: 100%;
  aspect-ratio: 2 / 3;
  height: auto;
  display: block;
  object-fit: cover;
  background: #0f0f0f;
  transform: scale(1);
  transition: transform .22s var(--ease), filter .22s var(--ease);
  filter: saturate(1.02) contrast(1.02);
}

/* HOME tiles square images */
.card--home .card__img,
.card--home img {
  aspect-ratio: 1 / 1;
  object-fit: contain;
  background: #0f0f0f;
}

.card:hover .card__img,
.card:hover img {
  transform: scale(1.04);
  filter: saturate(1.06) contrast(1.04);
}

/* Music artwork square */
.card--music .card__img,
.card--music img,
.card--music_cd .card__img,
.card--music_cd img,
.card--music_vinyl .card__img,
.card--music_vinyl img {
  aspect-ratio: 1 / 1;
}

/* Info blocks */
.card__info,
.card-info {
  padding: 12px;
  text-align: center;
}

/* Title/sub kept, but title now uses body font via typography system */
.card__title,
.card-info h3 {
  margin: 0 0 6px;
}

.card__sub,
.card-info p {
  margin: 0 0 8px;
  font-size: 12px;
  color: rgba(255, 255, 255, .70);
}

/* Chips */
.chips {
  display: flex;
  gap: 6px;
  justify-content: center;
  flex-wrap: wrap;
}

.chip,
.format-tag {
  font-size: 11px;
  padding: 4px 8px;
  border-radius: 999px;
  background: var(--surface-card);
  border: 1px solid var(--border);
  color: rgba(255, 255, 255, .82);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

/* Empty state */
.empty {
  margin-top: 18px;
  padding: 14px;
  border: 1px dashed rgba(255, 255, 255, .14);
  border-radius: var(--radius);
  color: var(--muted);
}

/* ---------- Floating Quick Bar ---------- */
.fab-home {
  position: fixed;
  left: calc(var(--sidebar-w) + (100vw - var(--sidebar-w)) / 2);
  bottom: calc(14px + env(safe-area-inset-bottom));

  transform: translateX(-50%) translateY(140%);
  opacity: 0;
  pointer-events: none;

  z-index: 40;
  padding: 10px 14px;
  border-radius: 999px;

  /* Tint the quick bar darker so it stands out against lighter tiles */
  border: 1px solid rgba(255, 255, 255, .12);
  background: rgba(20, 26, 43, .92);
  color: var(--text);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);

  display: inline-flex;
  gap: 8px;
  align-items: center;

  transition: transform .28s var(--ease), opacity .22s var(--ease);
  will-change: transform, opacity;
}

/* Ensure quick bar controls blend with surrounding UI */
.fab-home .btn {
  border-radius: 999px;
}

.fab-home .input {
  min-width: 180px;
  height: 36px;
}

@media (max-width: 900px) {

  /* 02-layout sets left:50% on mobile; keep it from being overridden by this file */
  .fab-home {
    left: 50%;
  }
}

body.is-library .fab-home {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
  pointer-events: auto;
}

body.is-modal-open .fab-home {
  transform: translateX(-50%) translateY(140%);
  opacity: 0;
  pointer-events: none;
}

/* ---------- Step 6: Modal Expandables + Collector Checklist ---------- */

/* Make disclosure summaries feel like tappable controls */
.modal__block>summary {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;

  padding: 10px 12px;
  border-radius: 12px;

  border: 1px solid var(--border);
  background: var(--surface-card);
  box-shadow: 0 10px 30px rgba(0, 0, 0, .22);

  transition: transform .18s var(--ease), background .18s var(--ease), border-color .18s var(--ease);
}

.modal__block>summary:hover {
  background: var(--border-soft);
  border-color: var(--border-strong);
  transform: translateY(-1px);
}

.modal__block[open]>summary {
  background:
    linear-gradient(90deg,
      rgba(110, 231, 255, .10),
      rgba(167, 139, 250, .10)),
    var(--surface-card);
  border-color: rgba(110, 231, 255, .22);
}

/* Keep arrow aligned & readable */
.modal__block>summary::after {
  opacity: .9;
}

/* Add a little spacing for content inside details */
.modal__block>dl,
.modal__block>pre,
.modal__block>ul {
  margin-top: 10px;
}

/* Checklist list (new) */
.list {
  margin: 0;
  padding-left: 0;
  list-style: none;

  display: grid;
  gap: 8px;
}

.list li {
  padding: 10px 12px;
  border-radius: 12px;

  border: 1px solid var(--border-subtle);
  background: rgba(0, 0, 0, .22);

  color: rgba(255, 255, 255, .88);
}

/* Optional: subtle aurora bullet marker */
.list li::before {
  content: "•";
  display: inline-block;
  margin-right: 10px;
  opacity: .75;
}

/* Identifiers <pre> gets a bit more “console” feel */
#modalIdentifiers {
  max-height: 220px;
  overflow: auto;

  background: rgba(0, 0, 0, .28);
  border-color: var(--border);
}

/* ---------- Step 9: Small-screen polish for Identifiers rows ---------- */

/* Keep long identifiers from overflowing */
#modalIdentifiers dd {
  overflow-wrap: anywhere;
  word-break: break-word;
}

/* Slightly tighter label column so values have room */
.idsRow {
  grid-template-columns: 120px 1fr auto;
}

/* On small screens: stack label/value/button cleanly */
@media (max-width: 520px) {
  .idsRow {
    grid-template-columns: 1fr;
    gap: 6px;
    padding: 10px 0;
  }

  .idsRow dt {
    font-size: 12px;
    letter-spacing: .06em;
    text-transform: uppercase;
  }

  .idsRow dd {
    margin: 0;
    line-height: 1.35;
  }

  .idsRow .btn--mini {
    justify-self: start;
    margin-top: 4px;
  }
}

/* If you ever get *super* long numbers, this helps readability */
@media (max-width: 520px) {
  #modalIdentifiers dd {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    font-size: 12px;
  }
}

/* ---------- Step 9b: Icon-only copy buttons on small screens ---------- */

/* Give the per-field copy buttons a simple icon */
.idsRow .btn--mini::before {
  content: "⧉";
  display: inline-block;
  margin-right: 8px;
  transform: translateY(-.5px);
  opacity: .9;
}

/* Mobile: turn per-field Copy buttons into icon-only */
@media (max-width: 520px) {
  .idsRow .btn--mini {
    padding: 8px 10px;
    min-width: 40px;
    justify-content: center;
  }

  /* Remove the right margin since there's no label */
  .idsRow .btn--mini::before {
    margin-right: 0;
  }

  /* Hide the label text but keep it accessible to screen readers */
  .idsRow .btn--mini {
    font-size: 0;
  }

  .idsRow .btn--mini::before {
    font-size: 14px;
  }
}

/* ---------- Card Completeness Indicator (single canonical block) ---------- */
.card__completeness {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 10px;
  height: 10px;
  border-radius: 999px;
  z-index: 5;

  background: rgba(255, 255, 255, .18);
  border: 1px solid rgba(255, 255, 255, .18);
  box-shadow:
    0 0 0 4px var(--border-soft),
    0 10px 20px rgba(0, 0, 0, .25);

  backdrop-filter: blur(8px);
  pointer-events: none;

  transition:
    transform .18s var(--ease),
    box-shadow .18s var(--ease),
    background .18s var(--ease),
    border-color .18s var(--ease);
}

.card:hover .card__completeness {
  transform: translateY(-1px) scale(1.06);
  box-shadow:
    0 0 0 5px rgba(255, 255, 255, .07),
    0 14px 24px rgba(0, 0, 0, .32);
}

/* Tier styling (Aurora-friendly) */
.card[data-complete="complete"] .card__completeness {
  background: rgba(110, 231, 255, .95);
  border-color: rgba(110, 231, 255, .45);
  box-shadow:
    0 0 0 4px rgba(110, 231, 255, .14),
    0 0 18px rgba(110, 231, 255, .22),
    0 12px 22px rgba(0, 0, 0, .30);
}

.card[data-complete="good"] .card__completeness {
  background: rgba(167, 139, 250, .95);
  border-color: rgba(167, 139, 250, .45);
  box-shadow:
    0 0 0 4px rgba(167, 139, 250, .12),
    0 0 18px rgba(167, 139, 250, .20),
    0 12px 22px rgba(0, 0, 0, .30);
}

.card[data-complete="partial"] .card__completeness {
  background: rgba(255, 255, 255, .42);
  border-color: rgba(255, 255, 255, .24);
}

.card[data-complete="low"] .card__completeness {
  background: var(--border-strong);
  border-color: rgba(255, 255, 255, .14);
}

/* ---- Manage Views panel (Sidebar) ---- */
.sideItem--manage {
  opacity: .9;
  border-style: dashed;
}

.viewsPanel {
  margin: 10px 0 6px;
  padding: 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface-card);
  backdrop-filter: blur(18px);
}

.viewsPanel__head {
  margin-bottom: 10px;
}

.viewsPanel__title {
  font-weight: 700;
  font-size: 14px;
}

.viewsPanel__sub {
  color: var(--muted);
  font-size: 12px;
  margin-top: 2px;
}

.viewsPanel__section {
  margin-top: 12px;
}

.viewsPanel__label {
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 8px;
}

.viewsPanel__row {
  margin: 8px 0;
  display: flex;
  gap: 8px;
}

.viewsPanel__input {
  width: 100%;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, .20);
  color: var(--text);
}

.viewsPanel__btn {
  width: 100%;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--border-soft);
  color: var(--text);
  cursor: pointer;
}

.viewsPanel__check {
  display: flex;
  gap: 8px;
  align-items: center;
  color: var(--muted);
  font-size: 12px;
  user-select: none;
}

.viewsPanel__list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.viewsPanel__item {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, .18);
}

.viewsPanel__itemMain {
  flex: 1;
  min-width: 0;
}

.viewsPanel__itemTitle {
  font-size: 13px;
  font-weight: 600;
}

.viewsPanel__itemMeta {
  font-size: 11px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.viewsPanel__miniCheck {
  display: flex;
  gap: 6px;
  align-items: center;
  color: var(--muted);
  font-size: 11px;
  user-select: none;
}

.viewsPanel__miniBtn {
  padding: 6px 8px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--border-soft);
  color: var(--text);
  cursor: pointer;
}

/* =========================================================
   PHASE 1 UI POLISH — Drawer + Home Readability (CSS-only)
   - No JS changes
   - No card layout changes (visual-only)
   ========================================================= */

/* ---------- Drawer: clearer group hierarchy ---------- */

/* Add breathing room + a subtle separator between groups */
.sidebarGroup {
  padding-top: 10px;
  margin: 14px 0 18px;
  border-top: 1px solid var(--border-soft);
}

.sidebarGroup:first-child {
  border-top: none;
  padding-top: 0;
}

/* Make group titles easier to scan */
.sidebarGroup__title,
.sidebar__sectionTitle {
  color: rgba(185, 185, 185, .92);
  text-shadow: 0 1px 10px rgba(0, 0, 0, .35);
}

/* Give section titles a subtle “label chip” feel without adding UI noise */
.sidebarGroup__title {
  display: inline-flex;
  align-items: center;
  padding: 4px 8px;
  border-radius: 999px;
  background: var(--surface-card-2);
  border: 1px solid var(--border-soft);
}

/* Improve focus visibility for keyboard navigation */
.sideItem:focus-visible {
  outline: 2px solid var(--focus-outline);
  outline-offset: 2px;
  box-shadow: 0 0 0 4px var(--focus-ring);
}

/* Active state: slightly clearer without becoming “neon” */
.sideItem[aria-current="page"] {
  background: var(--active-bg);
  border-color: var(--active-border);
}

/* Child items: keep hierarchy readable even at a glance */
.sideItem--child {
  opacity: .95;
}

.sideItem--child::before {
  opacity: .7;
}

/* ---------- Home: better scanning + subtle rail affordance ---------- */

/* Home section title: slightly stronger and more structured */
.homeSection__title {
  color: rgba(185, 185, 185, .96);
  letter-spacing: .12em;
  margin: 2px 2px 12px;
}

/* Rails: add gentle “edge fade” to imply horizontal scroll (no layout change) */
.homeRail {
  position: relative;
  padding-bottom: 14px;
  /* a touch more room for scrollbar */
  mask-image: linear-gradient(90deg, transparent 0, #000 36px, #000 calc(100% - 36px), transparent 100%);
  -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 36px, #000 calc(100% - 36px), transparent 100%);
}

/* Optional: subtle end-cap shadows (helps on large screens where rails are centered) */
.homeRail::before,
.homeRail::after {
  content: "";
  position: sticky;
  top: 0;
  width: 24px;
  height: 100%;
  pointer-events: none;
  z-index: 1;
}

.homeRail::before {
  left: 0;
  background: linear-gradient(90deg, rgba(18, 18, 18, .85), transparent);
}

.homeRail::after {
  right: 0;
  background: linear-gradient(270deg, rgba(18, 18, 18, .85), transparent);
}

/* Empty state: friendlier and more readable */
.empty {
  background: rgba(0, 0, 0, .18);
}

/* Slightly improve Home intro text readability */
#homeView .muted {
  color: rgba(185, 185, 185, .90);
}

/* =========================================================
   MOBILE QUICK LAUNCH — VISIBILITY ONLY
   - No styling
   - No layout
   - No behavior
   ========================================================= */

/* Hidden by default (desktop & tablet) */
.homeQuickLaunch {
  display: none;
}

/* Visible on mobile only */
@media (max-width: 900px) {
  .homeQuickLaunch {
    display: block;
  }
}


/* =========================================================
   MOBILE QUICK LAUNCH — LIGHTWEIGHT BUTTON STYLES
   - Thumb-friendly
   - Icon-forward
   - No glass (solid panels, minimal effects)
   ========================================================= */

@media (max-width: 900px) {
  .homeQuickLaunch {
    margin-top: 18px;
    padding: 12px 0 2px;
    border-top: 1px solid var(--line);
  }

  .homeQuickLaunch__title {
    margin: 0 0 10px;
    font-family: var(--font-head);
    font-size: 14px;
    letter-spacing: .02em;
    color: var(--muted);
    text-transform: uppercase;
  }

  .homeQuickLaunch__grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  /* Buttons are intentionally NOT "cardy" */
  .homeQuickLaunch__btn {
    appearance: none;
    border: 1px solid var(--line);
    background: var(--panel2);
    color: var(--text);
    border-radius: 12px;
    padding: 12px 12px;
    min-height: 48px;
    /* comfortable thumb target */
    display: flex;
    align-items: center;
    gap: 10px;
    text-align: left;
    box-shadow: none;
    cursor: pointer;
  }

  .homeQuickLaunch__btn:active {
    transform: translateY(1px);
  }

  .homeQuickLaunch__btn:hover {
    background: #222;
    /* subtle, solid */
  }

  .homeQuickLaunch__btn:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
  }

  /* Icon placeholder: replace with your inline SVG later */
  .homeQuickLaunch__icon {
    width: 22px;
    height: 22px;
    flex: 0 0 22px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    border: 1px solid var(--line);
    background: transparent;
  }

  .homeQuickLaunch__label {
    font-family: var(--font-head);
    font-size: 15px;
    line-height: 1.1;
  }
}

/* Extra-small screens: single column for easier tapping */
@media (max-width: 420px) {
  .homeQuickLaunch__grid {
    grid-template-columns: 1fr;
  }
}

.sideItem--parent .sideItem--child .sideItem__bullet {
  width: 0.9rem;
  height: 0.9rem;
}

/* Mobile: show 2 columns in the item grid for faster scanning */
@media (max-width: 520px) {

  .grid,
  #cardGrid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }
}

/* Fluid layout on large screens */
@media (min-width: 1400px) {
  .main {
    max-width: none;
  }
}

@media (min-width: 1400px) {
  :root {
    --card-max: 190px;
  }
}


/* ===========================
   Phase 1 Loaders (app + nav)
   =========================== */

.mmLoader {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;

  background: rgba(0, 0, 0, .55);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.mmLoader[hidden] {
  display: none !important;
}

.mmLoader__panel {
  width: min(440px, calc(100vw - 32px));
  display: flex;
  align-items: center;
  gap: 12px;

  padding: 14px 16px;
  border-radius: 18px;

  background: rgba(20, 26, 43, .86);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.mmLoader__spinner {
  width: 22px;
  height: 22px;
  border-radius: 999px;
  border: 2px solid rgba(255, 255, 255, .18);
  border-top-color: rgba(111, 212, 255, .85);
  animation: mmSpin 900ms linear infinite;
  flex: 0 0 22px;
}

.mmLoader__text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.mmLoader__label {
  font-family: var(--font-head);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .10em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, .92);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mmLoader__sub {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

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

@media (prefers-reduced-motion: reduce) {
  .mmLoader {
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }

  .mmLoader__spinner {
    animation: none;
  }
}


/* ===========================
   Video Games section accent
   Targets current drawer markup:
   - anchors have data-view="<viewId>"
   - bullet element class is .sideItem__dot (iconless) OR .sideItem__bullet (icon bullets, if present)
   =========================== */

.sideItem[data-view="games_all"],
.sideItem[data-view^="games_"] {
  --section-accent: var(--games-accent);
}

.sideItem[data-view="games_all"] .sideItem__dot,
.sideItem[data-view^="games_"] .sideItem__dot,
.sideItem[data-view="games_all"] .sideItem__bullet,
.sideItem[data-view^="games_"] .sideItem__bullet {
  background-color: var(--games-accent);
}

.sideItem[data-view="games_all"].is-active,
.sideItem[data-view^="games_"].is-active {
  box-shadow: inset 2px 0 0 var(--games-accent);
}



/* ---- Card edition badges (Vol/Season/Disc/Part) ---- */
.card__titleRow {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.card__badges {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.badge--mini {
  font-size: 11px;
  padding: 3px 8px;
}


/* --------------------------------------------------
 * Home: Random Movie Picks (ambient interest)
 * -------------------------------------------------- */
.homeSection--randomMovies .homeSection__header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 12px;
}

.homeSection--randomMovies .homeSection__title {
  width: 100%;
  text-align: center;
}

/* Home: Random Movie Picks (single row; responsive max count) */
.randomMovies {
  display: grid;
  gap: 10px;
  /* Fixed-size "strip" feel (smaller posters) */
  grid-template-columns: repeat(5, minmax(0, 140px));
  justify-content: center;
  overflow: hidden;
  max-width: calc(5 * 140px + 4 * 10px);
  margin: 0 auto;
}

@media (max-width: 600px) {
  .randomMovies {
    grid-template-columns: repeat(2, minmax(0, 140px));
    max-width: calc(2 * 140px + 1 * 10px);
  }
}

@media (max-width: 420px) {
  .randomMovies {
    grid-template-columns: repeat(1, minmax(0, 160px));
    max-width: 160px;
  }
}


/* NOTE: Avoid auto-fit/auto-fill and wrapping. Breakpoints above define explicit counts. */

.randomMovies__item {
  display: block;
  width: 100%;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(0, 0, 0, 0.25);
  cursor: pointer;
  transition: transform 120ms ease, border-color 120ms ease;
}

.randomMovies__item:hover,
.randomMovies__item:focus-visible {
  transform: translateY(-2px);
  border-color: rgba(255, 255, 255, 0.18);
  outline: none;
}

.randomMovies__img {
  width: 100%;
  aspect-ratio: 2 / 3;
  object-fit: cover;
  display: block;
}

.randomMovies__meta {
  padding: 6px 6px 7px;
  font-size: 0.72rem;
  color: var(--muted);
  line-height: 1.2;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}


/* Home: Cinema Fact */
.cinemaFact {
  padding: 12px 12px 14px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 14px;
  background: rgba(0, 0, 0, 0.18);
}

.cinemaFact__h {
  margin: 0 0 6px;
  font-size: 0.98rem;
  color: var(--text);
  text-align: left;
}

.cinemaFact__p {
  margin: 0;
  color: var(--muted);
  line-height: 1.35;
}

#homeView.home--v1 .homeSection--cinemaFact {
  display: block;
}

#homeView.home--v1 .homeSection--randomMovies {
  display: block;
}

/* Match Cinema Fact card width to Random Favorites strip width */
#homeView.home--v1 .cinemaFact {
  max-width: calc(5 * 140px + 4 * 10px);
  margin: 0 auto;
  width: 100%;
}

@media (max-width: 600px){
  #homeView.home--v1 .cinemaFact {
    max-width: calc(2 * 140px + 1 * 10px);
  }
}

@media (max-width: 420px){
  #homeView.home--v1 .cinemaFact {
    max-width: 160px;
  }
}