/* The series page (series/serie_detail.html). The theme variables of layout/base.html and the shapes of
   static/site/site.css (the header, panels and release calendar): 12-14px controls, 20px cards, the accent bar
   before a heading. */

.sd { direction: rtl; color: var(--text); padding-bottom: 56px; }
.sd-wrap { max-width: 1110px; margin: 0 auto; padding: 0 16px; }

/* ================================================================ header */
.sd-hero { position: relative; isolation: isolate; overflow: hidden; padding: 32px 0 28px; }
.sd-hero-art {
  position: absolute; inset: -60px; z-index: -2; background-position: center; background-size: cover;
  filter: blur(48px) saturate(1.35); opacity: .5; transform: scale(1.1);
}
[data-theme="light"] .sd-hero-art { opacity: .32; }
.sd-hero::after {
  content: ''; position: absolute; inset: 0; z-index: -1;
  background: linear-gradient(180deg, color-mix(in srgb, var(--bg) 30%, transparent) 0%, color-mix(in srgb, var(--bg) 75%, transparent) 55%, var(--bg) 100%);
}
.sd-hero-in { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 32px; align-items: start; }

.sd-cover {
  position: relative; aspect-ratio: 3 / 4; border-radius: 18px; overflow: hidden; background: var(--surface-2);
  box-shadow: 0 30px 60px -28px rgba(0, 0, 0, .65), 0 0 0 1px var(--border);
}
.sd-cover img, .sd-cover .ph { display: block; width: 100%; height: 100%; object-fit: cover; }
.sd-status {
  position: absolute; right: 10px; bottom: 10px; display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px;
  border-radius: 999px; background: rgba(8, 10, 15, .72); color: #fff; font-size: 11px; font-weight: 800;
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
}
.sd-status::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: #10b981; box-shadow: 0 0 0 3px rgba(16, 185, 129, .28); }
.sd-status.is-end::before { background: #9aa1ba; box-shadow: none; }

.sd-info { min-width: 0; padding-top: 4px; }
.sd-crumbs { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; font-size: 12px; font-weight: 600; color: var(--text-soft); }
.sd-crumbs a { color: var(--text-muted); text-decoration: none; }
.sd-crumbs a:hover { color: var(--accent); }
.sd-crumbs svg { width: 13px; height: 13px; opacity: .7; }
.sd-crumbs span { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sd-title { margin: 10px 0 0; font-size: 32px; font-weight: 900; line-height: 1.35; color: var(--text); }

.sd-stats { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0 0; padding: 0; list-style: none; }
.sd-stats li {
  display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; border-radius: 12px; font-size: 13px;
  background: color-mix(in srgb, var(--surface) 72%, transparent); border: 1px solid var(--border);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
}
.sd-stats svg { width: 16px; height: 16px; color: var(--text-soft); }
.sd-stats svg.is-star { color: var(--accent-3); }
.sd-stats b { font-weight: 800; }
.sd-stats small { color: var(--text-muted); font-size: 12px; }

.sd-genres { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 14px; }
.sd-genres a {
  padding: 4px 12px; border-radius: 999px; font-size: 12px; font-weight: 700; text-decoration: none;
  color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, transparent); transition: background .15s;
}
.sd-genres a:hover { background: color-mix(in srgb, var(--accent) 22%, transparent); }

.sd-desc { max-width: 680px; margin-top: 14px; }
.sd-desc p {
  margin: 0; color: var(--text-muted); font-size: 14px; line-height: 2;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.sd-desc.is-open p { display: block; -webkit-line-clamp: unset; }

.sd-next {
  display: flex; align-items: center; flex-wrap: wrap; gap: 8px; width: fit-content; max-width: 100%; margin: 14px 0 0; padding: 8px 12px;
  border-radius: 12px; background: color-mix(in srgb, var(--accent-2) 10%, transparent); color: var(--text); font-size: 13px; line-height: 1.8;
}
.sd-next svg { width: 17px; height: 17px; flex: none; color: var(--accent-2); }
.sd-next b { font-weight: 800; }

/* the header buttons */
.sd-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 20px; }
.sd-actions form { display: flex; margin: 0; }

/* rating */
.sd-rate { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
.sd-stars { display: inline-flex; gap: 2px; margin: 0; text-decoration: none; }
.sd-stars button, .sd-stars span {
  display: grid; place-items: center; width: 34px; height: 34px; padding: 0; border: 0; border-radius: 9px; background: none; cursor: pointer;
  color: color-mix(in srgb, var(--text-soft) 50%, transparent); transition: color .12s, transform .12s;
}
.sd-stars button:hover { transform: scale(1.12); }
.sd-stars .is-lit { color: var(--accent-3); }
.sd-stars svg { width: 24px; height: 24px; }
.sd-rate-label { color: var(--text-muted); font-size: 12px; font-weight: 700; }
.sd-rate-label a { color: var(--accent); }

/* ================================================================ tabs */

/* ================================================================ body */
.sd-body { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 20px; align-items: start; }
.sd-body.is-single { grid-template-columns: minmax(0, 1fr); }
.sd-main { min-width: 0; }
.sd-side { position: sticky; top: 76px; }
@media (max-width: 959px) {
  .sd-body { grid-template-columns: minmax(0, 1fr); }
  .sd-side { position: static; }
}

.sd-tools { display: flex; align-items: center; gap: 8px; }
.sd-find {
  display: flex; align-items: center; gap: 6px; height: 36px; padding: 0 10px; border: 1px solid var(--border); border-radius: 11px;
  background: var(--surface-2); color: var(--text-soft); transition: border-color .15s;
}
.sd-find:focus-within { border-color: var(--accent); }
.sd-find svg { width: 16px; height: 16px; flex: none; }
.sd .sd-find input {
  width: 150px; height: 34px; padding: 0; border: 0; background: transparent; color: var(--text);
  font: 600 13px 'Vazirmatn', sans-serif; outline: none; box-shadow: none;
}
.sd-find input::placeholder { color: var(--text-soft); }
.sd-sort {
  display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 12px; border: 1px solid var(--border); border-radius: 11px;
  background: var(--surface-2); color: var(--text-muted); font: 700 12px 'Vazirmatn', sans-serif; cursor: pointer; transition: color .15s, border-color .15s;
}
.sd-sort:hover { color: var(--text); border-color: var(--border-strong); }
.sd-sort svg { width: 16px; height: 16px; }

.sd-alert {
  display: flex; align-items: flex-start; gap: 10px; margin: 12px 12px 4px; padding: 10px 12px; border-radius: 14px;
  background: color-mix(in srgb, var(--accent-3) 11%, transparent); border: 1px solid color-mix(in srgb, var(--accent-3) 30%, transparent);
}
.sd-alert svg { flex: none; width: 20px; height: 20px; margin-top: 3px; color: var(--accent-3); }
.sd-alert p { margin: 0; font-size: 13px; line-height: 1.9; color: var(--text); }
.sd-alert b { display: block; font-weight: 800; }
.sd-alert a { color: var(--accent-3); font-weight: 800; text-decoration: underline; text-underline-offset: 3px; }

/* the episodes: newest first; .is-asc only turns the list over */
.sd-eps { display: flex; flex-direction: column; gap: 2px; margin: 0; padding: 6px; list-style: none; }
.sd-eps.is-asc { flex-direction: column-reverse; }
.sd-ep-in { display: flex; align-items: center; gap: 12px; padding: 8px 10px; border-radius: 14px; color: var(--text); text-decoration: none; transition: background .15s; }
a.sd-ep-in:hover { background: var(--surface-2); }
.sd-ep-thumb { position: relative; flex: none; width: 56px; height: 56px; border-radius: 12px; overflow: hidden; background: var(--surface-2); }
.sd-ep-thumb img { display: block; width: 100%; height: 100%; object-fit: cover; }
.sd-ep-text { flex: 1; min-width: 0; }
.sd-ep-text b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; font-weight: 800; }
.sd-ep-text small { display: flex; align-items: center; gap: 6px; color: var(--text-soft); font-size: 12px; }
.sd-new { padding: 0 7px; border-radius: 999px; background: var(--accent-2); color: #fff; font-size: 10px; font-weight: 800; font-style: normal; line-height: 1.7; }
.sd-ep-state { flex: none; padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 800; font-style: normal; }
.sd-ep-state:empty { display: none; }
.sd-ep-state.is-read { background: color-mix(in srgb, #10b981 15%, transparent); color: #10b981; }
.sd-ep-state.is-going { background: color-mix(in srgb, var(--accent) 14%, transparent); color: var(--accent); }
a.is-read .sd-ep-text b { color: var(--text-muted); }
a.is-read .sd-ep-thumb img { opacity: .6; }
.sd-ep-n { flex: none; min-width: 38px; text-align: left; color: var(--accent); font-size: 13px; font-weight: 800; font-variant-numeric: tabular-nums; }
.sd-ep-go { flex: none; width: 18px; height: 18px; color: var(--text-soft); transition: transform .15s, color .15s; }
a.sd-ep-in:hover .sd-ep-go { transform: translateX(-3px); color: var(--accent); }
.sd-ep.is-soon .sd-ep-in {
  border: 1px dashed color-mix(in srgb, var(--accent-2) 40%, transparent);
  background: repeating-linear-gradient(-45deg, transparent 0 8px, color-mix(in srgb, var(--accent-2) 5%, transparent) 8px 16px);
}
.sd-ep.is-soon .sd-ep-thumb img { opacity: .45; filter: grayscale(1) blur(1px); }
.sd-ep.is-soon .sd-ep-thumb svg { position: absolute; inset: 0; width: 24px; height: 24px; margin: auto; color: var(--accent-2); }

/* suggestions */
.sd-sugs { padding: 6px; }
.sd-sug { display: flex; align-items: center; gap: 12px; padding: 8px 10px; border-radius: 14px; color: var(--text); text-decoration: none; transition: background .15s; }
.sd-sug:hover { background: var(--surface-2); }
.sd-sug img, .sd-sug .ph { flex: none; width: 54px; height: 72px; border-radius: 10px; object-fit: cover; background: var(--surface-2); }
.sd-sug-text { flex: 1; min-width: 0; }
.sd-sug-text b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; font-weight: 800; }
.sd-sug-text small { display: block; color: var(--text-muted); font-size: 12px; }
.sd-sug-text small + small { color: var(--text-soft); }
.sd-side-more {
  display: flex; align-items: center; justify-content: center; gap: 8px; padding: 12px; border-top: 1px solid var(--border);
  color: var(--accent); font-size: 13px; font-weight: 800; text-decoration: none;
}
.sd-side-more:hover { background: var(--surface-2); }
.sd-side-more svg { width: 16px; height: 16px; }

/* ================================================================ comments */

.sd-compose { display: flex; gap: 12px; padding: 16px; border-bottom: 1px solid var(--border); }
.sd-compose.is-reply { padding: 10px 0 0; border-bottom: 0; }
.sd-av {
  flex: none; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff; font-size: 16px; font-weight: 800;
}
.sd-compose-box { flex: 1; min-width: 0; border: 1px solid var(--border); border-radius: 14px; background: var(--surface-2); transition: border-color .15s; }
.sd-compose-box:focus-within { border-color: var(--accent); }
.sd .sd-compose-box textarea {
  display: block; width: 100%; min-height: 58px; padding: 10px 12px; resize: none; border: 0; background: transparent;
  color: var(--text); font: 500 14px/1.9 'Vazirmatn', sans-serif; outline: none; box-shadow: none;
}
.sd-compose-box textarea::placeholder { color: var(--text-soft); }
.sd-compose-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 4px 8px 8px 10px; }
.sd-compose.is-reply .sd-compose-foot { justify-content: flex-end; }
.sd-compose-foot small { color: var(--text-soft); font-size: 11px; }
.sd-login { margin: 0; padding: 16px; border-bottom: 1px solid var(--border); color: var(--text-muted); font-size: 13px; line-height: 2; }
.sd-login a { color: var(--accent); font-weight: 800; }

.sd-cms-top { scroll-margin-top: 80px; }
.sd-cms { margin: 0; padding: 4px 16px 8px; list-style: none; }
.sd-cmt { padding: 14px 0; border-bottom: 1px solid var(--border); }
.sd-cms > .sd-cmt:last-child { border-bottom: 0; }
.sd-cmt-in { display: flex; gap: 12px; }
.sd-cmt-main { flex: 1; min-width: 0; }
.sd-cmt-main header { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 8px; }
.sd-cmt-main header b { font-size: 13px; font-weight: 800; }
.sd-cmt-main header time { color: var(--text-soft); font-size: 11px; }
.sd-to { color: var(--text-soft); font-size: 11px; }
.sd-to bdi { color: var(--accent); font-weight: 700; }
.sd-cmt-main p { margin: 4px 0 0; color: var(--text); font-size: 14px; line-height: 1.95; white-space: pre-line; overflow-wrap: anywhere; }
.sd-cmt-main footer { display: flex; align-items: center; gap: 4px; margin-top: 6px; }
.sd-vote {
  display: inline-flex; align-items: center; gap: 5px; height: 30px; padding: 0 10px; border: 0; border-radius: 9px; background: none;
  color: var(--text-soft); font: 700 12px 'Vazirmatn', sans-serif; cursor: pointer; transition: background .15s, color .15s;
}
.sd-vote:hover { background: var(--surface-2); color: var(--text); }
.sd-vote svg { width: 16px; height: 16px; }
.sd-vote.is-on { background: color-mix(in srgb, var(--accent) 12%, transparent); color: var(--accent); }
.sd-vote.is-down.is-on { background: color-mix(in srgb, var(--accent-2) 12%, transparent); color: var(--accent-2); }
.sd-reply-btn { height: 30px; padding: 0 10px; border: 0; border-radius: 9px; background: none; color: var(--text-muted); font: 800 12px 'Vazirmatn', sans-serif; cursor: pointer; }
.sd-reply-btn:hover, .sd-reply-btn[aria-expanded="true"] { color: var(--accent); }
.sd-replies { margin: 8px 19px 0 0; padding: 0 16px 0 0; border-right: 2px solid var(--border); list-style: none; }
.sd-cmt.is-reply { padding: 10px 0; border-bottom: 0; }
.sd-cmt.is-reply .sd-av { width: 32px; height: 32px; border-radius: 10px; font-size: 13px; }
.sd-skel { display: grid; gap: 12px; padding: 16px; }
.sd-skel i { display: block; height: 76px; border-radius: 14px; background: linear-gradient(100deg, var(--surface-2) 30%, var(--bg-soft) 50%, var(--surface-2) 70%) 0 0 / 250% 100%; animation: rc-shine 1.4s linear infinite; }
.sd-pager { display: flex; align-items: center; justify-content: center; gap: 12px; padding: 12px 16px 16px; border-top: 1px solid var(--border); color: var(--text-muted); font-size: 12px; font-weight: 700; }

/* ================================================================ narrow screens */
@media (max-width: 859px) {
  .sd-hero-in { grid-template-columns: 200px minmax(0, 1fr); gap: 24px; }
  .sd-title { font-size: 28px; }
}
@media (max-width: 679px) {
  .sd-hero { padding: 18px 0 20px; }
  .sd-hero-in { grid-template-columns: minmax(0, 1fr); justify-items: center; gap: 18px; }
  .sd-cover { width: 176px; }
  .sd-info { display: flex; flex-direction: column; align-items: center; width: 100%; padding-top: 0; text-align: center; }
  .sd-crumbs { justify-content: center; }
  .sd-title { margin-top: 6px; font-size: 24px; }
  .sd-stats { justify-content: center; gap: 6px; }
  .sd-stats li { padding: 6px 10px; }
  .sd-genres { justify-content: center; }
  .sd-desc { width: 100%; text-align: right; }
  .sd-desc .ui-link { display: block; margin: 2px auto 0; }
  .sd-actions { width: 100%; }
  .sd-actions > .ui-btn.is-lg { flex: 1 1 100%; }
  .sd-actions form { flex: 1; }
  .sd-actions form .ui-btn, .sd-actions > a.ui-btn:not(.is-lg) { flex: 1; width: 100%; }
  .sd-rate { justify-content: center; }
  .ui-tabs a { flex: 1; justify-content: center; }
  .sd-wrap { padding: 0 12px; }
  .ui-card-head { padding: 12px; }
  .sd-tools { width: 100%; }
  .sd-find { flex: 1; }
  .sd .sd-find input { width: 100%; }
  .sd-eps { padding: 4px; }
  .sd-ep-in { gap: 10px; padding: 8px; }
  .sd-ep-go { display: none; }
  .sd-compose { padding: 12px; }
  .sd-compose > .sd-av { display: none; }
  .sd-cms { padding: 4px 12px 8px; }
  .sd-replies { margin-right: 8px; padding-right: 10px; }
}

@media (prefers-reduced-motion: reduce) {
  .ui-btn, .sd-stars button, .sd-ep-go, .sd-skel i { transition: none !important; animation: none !important; }
}
