/* JoyKino site styles */
*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  overflow-x: hidden;
}

body {
  background: #0a0a0f;
  color: #fafafa;
  min-height: 100vh;
  overflow-x: hidden;
  max-width: 100vw;
}

img, video, svg {
  max-width: 100%;
  height: auto;
}

a { color: inherit; text-decoration: none; }

main {
  min-width: 0;
  overflow-x: hidden;
}

.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1rem;
}

.page-shell {
  padding: 1.25rem 0 2rem;
}

/* Header */
.site-header {
  border-bottom: 1px solid rgba(255, 255, 255, .08);
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(10, 10, 15, .92);
}

.site-header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 56px;
  position: relative;
}

.logo {
  font-weight: 700;
  font-size: 1.125rem;
  letter-spacing: -.02em;
  flex-shrink: 0;
}

.nav-toggle {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 0;
  border-radius: .5rem;
  background: rgba(255, 255, 255, .06);
  cursor: pointer;
  flex-shrink: 0;
}

.nav-toggle span {
  display: block;
  width: 18px;
  height: 2px;
  margin: 0 auto;
  background: #fafafa;
  border-radius: 1px;
  transition: transform .2s, opacity .2s;
}

.nav-toggle[aria-expanded="true"] span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.nav-toggle[aria-expanded="true"] span:nth-child(2) {
  opacity: 0;
}

.nav-toggle[aria-expanded="true"] span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

.nav {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  flex-direction: column;
  gap: .25rem;
  padding: .75rem 1rem 1rem;
  background: rgba(10, 10, 15, .98);
  border-bottom: 1px solid rgba(255, 255, 255, .08);
}

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

.nav a {
  padding: .75rem 1rem;
  border-radius: .5rem;
  font-size: .9375rem;
  color: #a1a1aa;
}

.nav a:hover,
.nav a.active {
  color: #fff;
  background: rgba(255, 255, 255, .06);
}

@media (min-width: 768px) {
  .site-header-inner {
    min-height: 64px;
    position: relative;
  }

  .logo { font-size: 1.25rem; }

  .nav-toggle { display: none; }

  .nav {
    display: flex;
    position: static;
    flex-direction: row;
    flex-wrap: wrap;
    gap: .5rem;
    padding: 0;
    background: transparent;
    border: 0;
  }

  .nav a {
    padding: .5rem 1rem;
    font-size: .875rem;
  }
}

/* Typography */
.page-title {
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1.25;
  margin: 0;
}

.section-title {
  font-size: 1.25rem;
  font-weight: 700;
  margin: 0;
}

.film-title {
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1.25;
  margin: 0;
  word-break: break-word;
}

@media (min-width: 640px) {
  .page-title { font-size: 1.75rem; }
  .film-title { font-size: 1.75rem; }
}

@media (min-width: 1024px) {
  .page-title { font-size: 2rem; }
  .film-title { font-size: 2rem; }
}

/* Grids & cards */
.film-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .75rem;
}

@media (min-width: 640px) {
  .film-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
  }
}

@media (min-width: 1024px) {
  .film-grid {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }
}

.film-card {
  border: 1px solid rgba(255, 255, 255, .08);
  border-radius: .75rem;
  overflow: hidden;
  background: rgba(255, 255, 255, .03);
  transition: .2s;
  min-width: 0;
}

.film-card:hover {
  border-color: rgba(99, 102, 241, .4);
  transform: translateY(-2px);
}

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

.film-card-body { padding: .65rem .75rem; }

.film-card-title {
  font-size: .8125rem;
  font-weight: 600;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.film-card-meta {
  font-size: .75rem;
  color: #a1a1aa;
  margin-top: .25rem;
}

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

@media (min-width: 480px) {
  .genre-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (min-width: 768px) {
  .genre-grid { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
}

.genre-card {
  padding: 1rem;
  text-align: center;
}

/* Sections */
.section { margin: 1.75rem 0; }

.section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.section-head h2 {
  font-size: 1.25rem;
  font-weight: 700;
  margin: 0;
}

@media (min-width: 640px) {
  .section { margin: 2.5rem 0; }
  .section-head h2 { font-size: 1.5rem; }
}

.btn-link { color: #818cf8; font-size: .875rem; white-space: nowrap; }

.badge {
  display: inline-flex;
  align-items: center;
  border-radius: 9999px;
  padding: .125rem .5rem;
  font-size: .75rem;
  background: rgba(234, 179, 8, .15);
  color: #facc15;
}

.meta-line { color: #a1a1aa; font-size: .875rem; }

.meta-row {
  display: flex;
  gap: .5rem .75rem;
  align-items: center;
  margin: 1rem 0;
  flex-wrap: wrap;
}

/* Film page */
.film-page-grid {
  display: grid;
  gap: 1.25rem;
  grid-template-columns: 1fr;
}

.film-page-grid > div { min-width: 0; }

.film-page-content {
  min-width: 0;
  max-width: 100%;
}

.film-page-poster {
  max-width: 200px;
  margin: 0 auto;
}

.poster-box {
  border-radius: .75rem;
  overflow: hidden;
  box-shadow: 0 20px 50px rgba(0, 0, 0, .45);
}

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

.ratings-block {
  display: flex;
  gap: .75rem;
  margin-top: 1rem;
  flex-wrap: wrap;
  justify-content: center;
}

.rating-item {
  display: flex;
  flex-direction: column;
  gap: .15rem;
  padding: .65rem .85rem;
  border-radius: .75rem;
  background: rgba(255, 255, 255, .04);
  border: 1px solid rgba(255, 255, 255, .08);
  min-width: 6.5rem;
}

.rating-item:hover { border-color: rgba(99, 102, 241, .35); }

.rating-label { font-size: .75rem; color: #a1a1aa; }
.rating-value { font-size: 1.125rem; font-weight: 700; }
.rating-kp { color: #facc15; }
.rating-imdb { color: #f5c518; }
.rating-votes { font-size: .75rem; color: #71717a; }

.genre-links {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  margin-top: .25rem;
}

.genre-chip {
  display: inline-flex;
  padding: .35rem .75rem;
  border-radius: 9999px;
  background: rgba(255, 255, 255, .06);
  border: 1px solid rgba(255, 255, 255, .08);
  font-size: .8125rem;
  color: #e4e4e7;
}

.genre-chip:hover {
  background: rgba(99, 102, 241, .15);
  border-color: rgba(99, 102, 241, .35);
  color: #fff;
}

.genre-chip-static { cursor: default; }

.meta-badge {
  display: inline-flex;
  align-items: center;
  padding: .2rem .65rem;
  border-radius: 9999px;
  background: rgba(255, 255, 255, .06);
  color: #e4e4e7;
  font-size: .8125rem;
  font-weight: 600;
}

.film-description {
  margin-top: 1rem;
  line-height: 1.7;
  color: #d4d4d8;
  font-size: .9375rem;
}

@media (min-width: 1024px) {
  .film-page-grid {
    gap: 2rem;
    grid-template-columns: 300px minmax(0, 1fr);
  }

  .film-page-poster {
    max-width: none;
    margin: 0;
  }

  .ratings-block { justify-content: flex-start; }

  .rating-item { padding: .75rem 1rem; min-width: 7rem; }
  .rating-value { font-size: 1.25rem; }
}

/* Actors strip */
.actors-strip-wrap {
  width: 100%;
  max-width: 100%;
  overflow: hidden;
  margin-top: 1rem;
  margin-bottom: .25rem;
}

.actors-strip {
  display: flex;
  gap: .75rem;
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  overscroll-behavior-x: contain;
  padding-bottom: .5rem;
  cursor: grab;
  user-select: none;
  scroll-snap-type: x proximity;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, .25) transparent;
}

.actors-strip::-webkit-scrollbar { height: 6px; }
.actors-strip::-webkit-scrollbar-track { background: transparent; }
.actors-strip::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, .22);
  border-radius: 999px;
}

.actors-strip.is-dragging { cursor: grabbing; }

.actors-strip-item {
  flex: 0 0 72px;
  width: 72px;
  min-width: 72px;
  text-align: center;
  color: inherit;
  scroll-snap-align: start;
}

@media (min-width: 480px) {
  .actors-strip-item {
    flex-basis: 88px;
    width: 88px;
    min-width: 88px;
  }
}

.actors-strip-photo {
  aspect-ratio: 2/3;
  border-radius: .5rem;
  overflow: hidden;
  background: rgba(255, 255, 255, .04);
  border: 1px solid rgba(255, 255, 255, .08);
  transition: border-color .2s;
}

.actors-strip-item:hover .actors-strip-photo { border-color: rgba(99, 102, 241, .45); }

.actors-strip-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.actors-strip-name {
  margin-top: .5rem;
  font-size: .6875rem;
  font-weight: 500;
  line-height: 1.25;
  color: #e4e4e7;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

@media (min-width: 480px) {
  .actors-strip-name { font-size: .75rem; }
}

.actors-strip-item:hover .actors-strip-name { color: #a5b4fc; }

/* Torrent section */
.torrent-section-title {
  font-size: 1.125rem;
  font-weight: 700;
  margin: 1.5rem 0 1rem;
}

@media (min-width: 640px) {
  .torrent-section-title {
    font-size: 1.25rem;
    margin: 2rem 0 1rem;
  }
}

.tabs-scroll {
  display: flex;
  gap: .5rem;
  margin-bottom: 1rem;
  overflow-x: auto;
  overflow-y: hidden;
  flex-wrap: nowrap;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
  padding-bottom: .25rem;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, .2) transparent;
}

.tabs-scroll::-webkit-scrollbar { height: 4px; }
.tabs-scroll::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, .2);
  border-radius: 999px;
}

.quality-tab,
.studio-tab {
  flex-shrink: 0;
  padding: .4rem .8rem;
  border-radius: .5rem;
  border: 0;
  background: rgba(255, 255, 255, .06);
  color: #a1a1aa;
  font-size: .8125rem;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
}

.quality-tab:hover,
.studio-tab:hover {
  color: #fff;
  background: rgba(255, 255, 255, .1);
}

.quality-tab.is-active {
  background: #6366f1;
  color: #fff;
}

.studio-tab.is-active {
  background: rgba(99, 102, 241, .2);
  color: #fff;
  border: 1px solid rgba(99, 102, 241, .35);
}

.torrent-groups {
  display: flex;
  flex-direction: column;
  gap: .75rem;
}

.torrent-group {
  border: 1px solid rgba(255, 255, 255, .08);
  border-radius: .75rem;
  overflow: hidden;
  background: rgba(255, 255, 255, .02);
}

.torrent-group-summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: .75rem;
  padding: .85rem 1rem;
  cursor: pointer;
  list-style: none;
}

.torrent-group-summary::-webkit-details-marker { display: none; }

.torrent-group-title {
  font-size: .875rem;
  font-weight: 600;
}

.torrent-group-count {
  font-size: .75rem;
  color: #71717a;
  white-space: nowrap;
}

.torrent-group-body { border-top: 1px solid rgba(255, 255, 255, .06); }

.torrent-row {
  display: flex;
  flex-direction: column;
  gap: .75rem;
  padding: .85rem 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, .05);
}

.torrent-row:last-child { border-bottom: 0; }

.torrent-row-main { min-width: 0; }

.torrent-row-quality {
  font-weight: 600;
  font-size: .875rem;
  word-break: break-word;
}

.torrent-row-episodes {
  font-size: .8125rem;
  color: #a1a1aa;
  margin-bottom: .35rem;
}

.torrent-row-meta {
  display: flex;
  flex-direction: column;
  gap: .25rem;
  font-size: .8125rem;
  color: #71717a;
}

.torrent-row-side {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  flex-shrink: 0;
}

.torrent-row-sl {
  font-size: .8125rem;
  color: #a1a1aa;
  white-space: nowrap;
}

.torrent-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .35rem;
  background: #6366f1;
  color: #fff;
  padding: .5rem .85rem;
  border-radius: .5rem;
  font-weight: 600;
  font-size: .8125rem;
  white-space: nowrap;
  min-height: 36px;
}

@media (min-width: 640px) {
  .torrent-row {
    flex-direction: row;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
  }

  .torrent-row-meta {
    flex-direction: row;
    flex-wrap: wrap;
    gap: .5rem 1rem;
  }

  .torrent-row-side {
    flex-direction: column;
    align-items: flex-end;
  }

  .torrent-group-title { font-size: .9375rem; }
}

/* Torrent table → cards on mobile */
.torrent-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.torrent-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .875rem;
  min-width: 520px;
}

.torrent-table th,
.torrent-table td {
  padding: .75rem;
  border-bottom: 1px solid rgba(255, 255, 255, .08);
  text-align: left;
  vertical-align: top;
}

.torrent-cards {
  display: none;
  flex-direction: column;
  gap: .75rem;
}

.torrent-card {
  border: 1px solid rgba(255, 255, 255, .08);
  border-radius: .75rem;
  padding: .85rem 1rem;
  background: rgba(255, 255, 255, .02);
}

.torrent-card-row {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: .35rem 0;
  font-size: .8125rem;
}

.torrent-card-label {
  color: #71717a;
  flex-shrink: 0;
}

.torrent-card-value {
  text-align: right;
  word-break: break-word;
}

.torrent-card-actions {
  margin-top: .75rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
}

@media (max-width: 639px) {
  .torrent-table-wrap { display: none; }

  .torrent-cards { display: flex; }
}

/* Person page */
.person-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.person-photo {
  width: 140px;
  flex-shrink: 0;
}

.person-photo img {
  width: 100%;
  aspect-ratio: 2/3;
  object-fit: cover;
  border-radius: .75rem;
  border: 1px solid rgba(255, 255, 255, .08);
}

.person-name {
  font-size: 1.5rem;
  font-weight: 700;
  margin: 0;
}

.person-alt {
  margin: .35rem 0 0;
  font-size: 1rem;
  color: #a1a1aa;
}

.person-role,
.person-stats {
  margin: .5rem 0 0;
  color: #a1a1aa;
  font-size: .875rem;
}

.person-kp-link {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  margin-top: .75rem;
  font-size: .875rem;
  color: #a1a1aa;
}

.person-kp-link:hover { color: #fff; }

.person-filmography-title {
  font-size: 1.125rem;
  font-weight: 700;
  margin: 0 0 1rem;
}

@media (min-width: 640px) {
  .person-header {
    flex-direction: row;
    align-items: flex-start;
    text-align: left;
    gap: 1.5rem;
    margin-bottom: 2rem;
  }

  .person-photo { width: 160px; }
  .person-name { font-size: 1.75rem; }
  .person-alt { font-size: 1.125rem; }
  .person-filmography-title { font-size: 1.25rem; }
}

@media (min-width: 768px) {
  .person-photo { width: 180px; }
  .person-name { font-size: 2rem; }
}

/* Pagination */
.pagination {
  display: flex;
  gap: .5rem;
  justify-content: center;
  margin: 2rem 0;
  flex-wrap: wrap;
}

.pagination a {
  min-width: 36px;
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: .35rem .75rem;
  border-radius: .5rem;
  background: rgba(255, 255, 255, .06);
  font-size: .875rem;
}

.pagination a.is-active {
  background: #6366f1;
  color: #fff;
}

/* Footer */
.site-footer {
  border-top: 1px solid rgba(255, 255, 255, .08);
  margin-top: 3rem;
  padding: 1.5rem 0 2rem;
  color: #a1a1aa;
  font-size: .875rem;
}

.footer-grid {
  display: grid;
  gap: 1.25rem;
  grid-template-columns: 1fr;
}

.footer-grid h4 {
  color: #fff;
  margin-bottom: .5rem;
  font-size: .875rem;
}

.footer-grid a {
  display: block;
  margin: .35rem 0;
  padding: .15rem 0;
}

@media (min-width: 480px) {
  .footer-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (min-width: 768px) {
  .site-footer { margin-top: 4rem; padding: 2rem 0; }
  .footer-grid { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 1.5rem; }
  .footer-grid h4 { margin-bottom: .75rem; }
}

/* Static prose */
.prose {
  line-height: 1.7;
  color: #d4d4d8;
  font-size: .9375rem;
  word-break: break-word;
}

.prose h1, .prose h2, .prose h3 {
  color: #fff;
  margin: 1.5rem 0 .75rem;
  line-height: 1.3;
}

.prose p { margin: .75rem 0; }

.prose img { max-width: 100%; height: auto; border-radius: .5rem; }

.prose table {
  display: block;
  overflow-x: auto;
  max-width: 100%;
}
