/* === NAVIGATION === */
/* The wrapper carries both `.menu` (component) and `.main-nav` (theme slot)
   classes when rendered via render_menu('primary', css_class='main-nav'). */
.main-nav {
  display: none;
  gap: 8px;
}

/* Generic menu component (mobile-first; horizontal on desktop via .main-nav) */
.menu__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.menu__item {
  position: relative;
}

.menu__link {
  display: block;
  color: var(--text-dim);
  text-decoration: none;
  font-size: 0.875rem;
  padding: 6px 8px;
  border-radius: var(--radius);
  transition: color 0.2s, background 0.2s;
}

.menu__link:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.04);
}

.menu__submenu {
  list-style: none;
  margin: 4px 0 0;
  padding: 0 0 0 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  border-left: 1px solid var(--border);
}

/* Legacy class kept for any non-menu links that might still use it */
.nav-link {
  color: var(--text-dim);
  text-decoration: none;
  font-size: 0.875rem;
  padding: 4px 8px;
  border-radius: var(--radius);
  transition: color 0.2s;
}

.nav-link:hover {
  color: var(--text);
}

.nav-divider {
  width: 1px;
  background: var(--border);
  margin: 0 4px;
}

.search-form {
  margin-left: auto;
}

.search-input {
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 6px 12px;
  border-radius: var(--radius);
  font-size: 0.875rem;
  width: 180px;
  transition: border-color 0.2s;
}

.search-input:focus {
  outline: none;
  border-color: var(--accent);
}

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

.menu-toggle span {
  display: block;
  width: 20px;
  height: 2px;
  background: var(--text);
  transition: transform 0.2s;
}

/* === ITEM GRID === */
.item-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
  margin: 20px 0;
}

.item-card {
  display: flex;
  flex-direction: column;
}

.card-thumb-link {
  text-decoration: none;
}

.card-thumb {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  aspect-ratio: 16 / 9;
  background: var(--surface);
}

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

.card-thumb-placeholder {
  width: 100%;
  height: 100%;
  background: var(--surface);
}

.card-duration {
  position: absolute;
  bottom: 6px;
  right: 6px;
  background: rgba(0, 0, 0, 0.8);
  color: var(--text);
  font-size: 0.75rem;
  padding: 2px 6px;
  border-radius: 3px;
}

.card-info {
  padding: 8px 0;
}

.card-title {
  color: var(--text);
  text-decoration: none;
  font-size: 0.9375rem;
  font-weight: 500;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-title:hover {
  color: #fff;
}

.card-meta {
  display: flex;
  gap: 6px;
  color: var(--text-muted);
  font-size: 0.8125rem;
  margin-top: 2px;
}

/* === FEATURED === */
.featured-section {
  margin-bottom: 32px;
}

.featured-row {
  display: flex;
  gap: 16px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 8px;
}

.featured-row .item-card {
  min-width: 280px;
  scroll-snap-align: start;
  flex-shrink: 0;
}

/* === SORT TABS === */
.sort-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 16px;
}

.sort-tab {
  color: var(--text-dim);
  text-decoration: none;
  font-size: 0.875rem;
  padding: 6px 14px;
  border-radius: var(--radius);
  background: var(--surface);
  transition: color 0.2s, background 0.2s;
}

.sort-tab:hover,
.sort-tab.active {
  color: var(--text);
  background: var(--border);
}

/* === PAGINATION === */
.pagination {
  display: flex;
  gap: 4px;
  justify-content: center;
  margin: 32px 0;
  flex-wrap: wrap;
}

.page-link {
  color: var(--text-dim);
  text-decoration: none;
  padding: 6px 12px;
  border-radius: var(--radius);
  background: var(--surface);
  font-size: 0.875rem;
  transition: color 0.2s, background 0.2s;
}

.page-link:hover,
.page-link.active {
  color: var(--text);
  background: var(--border);
}

.page-ellipsis {
  color: var(--text-muted);
  padding: 6px 4px;
  font-size: 0.875rem;
}

/* === TYPE FILTER === */
.type-filter {
  display: flex;
  gap: 4px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.type-tab {
  color: var(--text-dim);
  text-decoration: none;
  font-size: 0.875rem;
  padding: 6px 14px;
  border-radius: var(--radius);
  background: var(--surface);
}

.type-tab:hover,
.type-tab.active {
  color: var(--text);
  background: var(--border);
}

/* === BREADCRUMBS === */
.breadcrumbs {
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin-bottom: 16px;
}

.breadcrumbs a {
  color: var(--text-dim);
  text-decoration: none;
}

.breadcrumbs a:hover {
  color: var(--text);
}

.breadcrumb-sep {
  margin: 0 6px;
}

/* === DETAIL PAGE === */
.item-detail {
  margin-bottom: 32px;
}

.item-detail h1 {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 8px;
}

.item-meta {
  display: flex;
  gap: 8px;
  align-items: center;
  color: var(--text-dim);
  font-size: 0.875rem;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.item-votes {
  margin-left: auto;
  display: flex;
  gap: 12px;
}

.vote-up {
  color: var(--text);
}

.vote-down {
  color: var(--text-muted);
}

.item-description {
  color: var(--text-dim);
  font-size: 0.9375rem;
  line-height: 1.6;
  padding: 16px;
  background: var(--surface);
  border-radius: var(--radius);
  margin: 16px 0;
}

.item-description.collapsible {
  max-height: 120px;
  overflow: hidden;
  position: relative;
  cursor: pointer;
}

.item-description.collapsible.expanded {
  max-height: none;
}

.item-description.collapsible::after {
  content: "Show more";
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 24px 16px 8px;
  background: linear-gradient(transparent, var(--surface));
  text-align: center;
  color: var(--accent);
  font-size: 0.8125rem;
}

.item-description.collapsible.expanded::after {
  display: none;
}

/* === VIDEO === */
.video-player {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #000;
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 16px;
}

.video-player iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

/* === GALLERY === */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin: 16px 0;
}

.gallery-item img {
  width: 100%;
  border-radius: var(--radius);
  display: block;
}

/* === ARCHIVE === */
.download-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px;
  background: var(--surface);
  border-radius: var(--radius);
  margin: 16px 0;
}

.download-info {
  display: flex;
  gap: 16px;
  font-size: 0.875rem;
}

.file-format {
  color: var(--accent);
  font-weight: 600;
}

.file-size {
  color: var(--text-dim);
}

.download-button {
  display: inline-block;
  padding: 10px 24px;
  background: var(--accent);
  color: #fff;
  text-decoration: none;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 0.9375rem;
}

.external-embed-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--text-dim);
  background: linear-gradient(180deg, rgba(255,255,255,0.04), rgba(255,255,255,0.02));
  text-align: center;
  padding: 16px;
}

/* === ARTICLE === */
.article-body {
  font-size: 1rem;
  line-height: 1.7;
  color: var(--text);
  margin: 24px 0;
}

.article-body h2,
.article-body h3 {
  margin: 24px 0 8px;
}

.article-body p {
  margin-bottom: 16px;
}

.article-body img {
  max-width: 100%;
  border-radius: var(--radius);
}

/* === TAGS, ACTORS, CATEGORIES === */
.tag-list,
.actor-list,
.category-list {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin: 12px 0;
}

.tag-badge,
.actor-badge,
.category-badge {
  background: var(--surface);
  color: var(--text-dim);
  text-decoration: none;
  padding: 4px 10px;
  border-radius: var(--radius);
  font-size: 0.8125rem;
}

.tag-badge:hover,
.actor-badge:hover,
.category-badge:hover {
  color: var(--text);
  background: var(--border);
}

/* === CATEGORY & ACTOR GRIDS === */
.category-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin: 20px 0;
}

.category-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: var(--surface);
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--text);
  transition: background 0.2s;
}

.category-card:hover {
  background: var(--border);
}

.category-card img {
  width: 80px;
  height: 60px;
  object-fit: cover;
  border-radius: var(--radius);
}

.category-card h3 {
  font-size: 1rem;
  font-weight: 500;
}

.count {
  color: var(--text-muted);
  font-size: 0.8125rem;
}

.actor-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  margin: 20px 0;
}

.actor-card {
  text-align: center;
  text-decoration: none;
  color: var(--text);
}

.actor-card-photo {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 50%;
  display: block;
  margin-bottom: 8px;
}

.actor-card-photo.placeholder {
  background: var(--surface);
}

.actor-card h3 {
  font-size: 0.9375rem;
  font-weight: 500;
}

.actor-profile {
  display: flex;
  gap: 20px;
  align-items: flex-start;
  margin-bottom: 24px;
}

.actor-photo {
  width: 120px;
  height: 120px;
  object-fit: cover;
  border-radius: 50%;
  flex-shrink: 0;
}

.actor-bio {
  color: var(--text-dim);
  font-size: 0.9375rem;
  line-height: 1.6;
  margin: 8px 0;
}

/* === STATIC PAGE === */
.static-page {
  max-width: 800px;
}

.page-content {
  font-size: 1rem;
  line-height: 1.7;
  margin: 24px 0;
}

/* === ERROR PAGE === */
.error-page {
  text-align: center;
  padding: 80px 0;
}

.error-page h1 {
  font-size: 4rem;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.error-page p {
  color: var(--text-dim);
  font-size: 1.125rem;
  margin-bottom: 24px;
}

.back-link {
  color: var(--accent);
  text-decoration: none;
}

/* === MISC === */
.section-title {
  font-size: 1.125rem;
  font-weight: 600;
  margin-bottom: 16px;
}

.page-title {
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: 16px;
}

.page-description {
  color: var(--text-dim);
  margin-bottom: 16px;
}

.empty-message {
  color: var(--text-muted);
  text-align: center;
  padding: 40px 0;
}

.result-count {
  color: var(--text-muted);
  font-size: 0.875rem;
  margin-bottom: 12px;
}

/* === FOOTER === */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 24px 0;
  margin-top: 40px;
  color: var(--text-muted);
  font-size: 0.8125rem;
  text-align: center;
}

/* === DESKTOP (min-width: 768px) === */
@media (min-width: 768px) {
  .main-nav {
    display: flex;
  }

  /* Horizontal top-level inside .main-nav */
  .main-nav .menu__list--depth1 {
    flex-direction: row;
    align-items: center;
    gap: 4px;
  }

  /* Hover dropdown for second-level on desktop */
  .main-nav .menu__item--has-children > .menu__link::after {
    content: " ▾";
    font-size: 0.7em;
    color: var(--text-muted);
  }
  .main-nav .menu__submenu {
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 180px;
    margin: 0;
    padding: 6px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
    display: none;
    z-index: 110;
  }
  .main-nav .menu__item:hover > .menu__submenu,
  .main-nav .menu__item:focus-within > .menu__submenu {
    display: flex;
  }
  .main-nav .menu__submenu .menu__link {
    white-space: nowrap;
  }

  .menu-toggle {
    display: none;
  }

  .item-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .gallery-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .category-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .actor-grid {
    grid-template-columns: repeat(4, 1fr);
  }

  .item-detail h1 {
    font-size: 1.5rem;
  }
}

/* === WIDE DESKTOP (min-width: 1024px) === */
@media (min-width: 1024px) {
  .video-player {
    max-width: 960px;
  }

  .gallery-grid {
    grid-template-columns: repeat(4, 1fr);
  }

  .category-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* Mobile nav open */
body.nav-open .main-nav {
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 56px;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--bg);
  padding: 16px;
  z-index: 99;
  overflow-y: auto;
}
body.nav-open .main-nav .menu__list--depth1 {
  gap: 8px;
}
body.nav-open .main-nav .menu__link {
  font-size: 1rem;
  padding: 10px 12px;
}
body.nav-open .main-nav .menu__submenu {
  margin-left: 12px;
}

/* === AUTH FORMS === */
.auth-form-wrap {
  max-width: 400px;
  margin: 40px auto;
}

.auth-form-wrap h1 {
  margin-bottom: 20px;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.form-group label {
  font-size: 0.875rem;
  color: var(--text-dim);
}

.form-group input {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 10px 12px;
  border-radius: var(--radius);
  font-size: 1rem;
}

.form-group input:focus {
  outline: none;
  border-color: var(--accent);
}

.form-error {
  background: #7f1d1d;
  color: #fecaca;
  padding: 8px 12px;
  border-radius: var(--radius);
  font-size: 0.875rem;
  margin-bottom: 8px;
}

.btn {
  padding: 10px 20px;
  border: none;
  border-radius: var(--radius);
  font-size: 1rem;
  cursor: pointer;
  transition: opacity 0.2s;
}

.btn:hover {
  opacity: 0.85;
}

.btn-primary {
  background: var(--accent);
  color: var(--text);
}

.auth-link {
  margin-top: 16px;
  font-size: 0.875rem;
  color: var(--text-dim);
}

.auth-link a {
  color: var(--accent);
}

/* === PROFILE === */
.profile-info {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.profile-row {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}

.profile-label {
  color: var(--text-dim);
  font-size: 0.875rem;
}

/* === LANGUAGE SWITCHER === */
.lang-switcher { position: relative; }
.lang-current { background: transparent; border: 1px solid #333; padding: 0.4rem 0.75rem;
    color: #eee; cursor: pointer; font-size: 0.8125rem; border-radius: var(--radius); }
.lang-dropdown { position: absolute; right: 0; top: 100%; background: #111; list-style: none;
    padding: 0.25rem 0; margin: 0; border: 1px solid #333; min-width: 120px; z-index: 10; }
.lang-dropdown li a { display: block; padding: 0.4rem 0.75rem; color: #eee; text-decoration: none;
    font-size: 0.8125rem; }
.lang-dropdown li a:hover { background: #222; }
.lang-partial { color: #fbbf24; margin-left: 0.25rem; }

/* === AUTH NAV === */
.auth-nav {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: 12px;
}

.logout-form {
  display: inline;
}

.logout-btn {
  background: none;
  border: none;
  cursor: pointer;
  font: inherit;
}

/* === FLASH MESSAGES === */
.flash {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  margin: 0;
  font-size: 0.875rem;
}

.flash-success {
  background: #14532d;
  color: #bbf7d0;
}

.flash-error {
  background: #7f1d1d;
  color: #fecaca;
}

.flash-close {
  background: none;
  border: none;
  color: inherit;
  font-size: 1.25rem;
  cursor: pointer;
  padding: 0 4px;
}

/* === COMMENTS === */
.comments-section {
  margin-top: 40px;
}

.comment-form {
  margin-bottom: 24px;
}

.comment-form textarea {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 10px 12px;
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 0.9375rem;
  resize: vertical;
}

.comment-form textarea:focus {
  outline: none;
  border-color: var(--accent);
}

.comment-form .btn {
  margin-top: 8px;
}

.comment-login-prompt {
  color: var(--text-dim);
  margin-bottom: 24px;
}

.comment-login-prompt a {
  color: var(--accent);
}

.comment {
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}

.comment-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
  font-size: 0.875rem;
}

.comment-date {
  color: var(--text-muted);
}

.comment-delete-form {
  margin-left: auto;
}

.comment-delete-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1rem;
}

.comment-delete-btn:hover {
  color: #ef4444;
}

.comment-body {
  color: var(--text);
  line-height: 1.5;
}

.comment-reply {
  margin-left: 24px;
  border-bottom: none;
  border-left: 2px solid var(--border);
  padding-left: 12px;
}

/* === REACTIONS === */
.reaction-buttons {
  display: inline-flex;
  gap: 4px;
}

.reaction-btn {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-dim);
  padding: 4px 10px;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 0.875rem;
  transition: border-color 0.2s, color 0.2s;
}

.reaction-btn:hover {
  border-color: var(--accent);
  color: var(--text);
}

.reaction-btn.active {
  border-color: var(--accent);
  color: var(--text);
  background: var(--border);
}

/* Phase 9: admin-only license status banner */
.lic-banner { padding: .5rem 1rem; font: 14px/1.4 sans-serif; text-align: center; }
.lic-banner--info    { background: #1e3a5f; color: #bfdbfe; }
.lic-banner--warning { background: #78350f; color: #fde68a; }
.lic-banner--alert   { background: #7f1d1d; color: #fecaca; }

/* External-file player (video items with external_file). */
.external-player {
  position: relative;
  width: 100%;
  padding-bottom: 56.25%;
  background: #000;
  cursor: pointer;
  overflow: hidden;
  line-height: 0;
}
.external-player-poster {
  position: absolute;
  inset: 0;
}
.external-player-poster img,
.external-player-poster-empty {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.external-player-poster-empty {
  background: linear-gradient(135deg, #1e1e1e 0%, #2a2a2a 100%);
}
.external-player-play {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: transparent;
  border: 0;
  padding: 0;
  cursor: pointer;
  filter: drop-shadow(0 0 6px rgba(0, 0, 0, 0.4));
  transition: opacity 0.15s;
}
.external-player-play:hover,
.external-player:hover .external-player-play { opacity: 0.85; }
.external-player-play svg { width: 68px; height: 48px; display: block; }
.external-player-duration {
  position: absolute;
  bottom: 8px;
  right: 8px;
  background: rgba(0, 0, 0, 0.8);
  color: #fff;
  padding: 2px 6px;
  border-radius: 3px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.3px;
  pointer-events: none;
}
.external-player-iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}
