/* Series page v2 — scoped to .as-series. Uses the theme's --ai-* tokens (black + neon green). */

.as-series {
	--s-card: var(--ai-card, rgba(255, 255, 255, .03));
	--s-border: var(--ai-border, rgba(255, 255, 255, .08));
	--s-accent: var(--ai-cyan, #00ff88);
	--s-text: var(--ai-text, #fff);
	--s-muted: var(--ai-text-muted, rgba(255, 255, 255, .7));
	--s-ink: #03150c;
	--s-radius: 12px;
	color: var(--s-text);
	min-width: 0;
}

.as-series *,
.as-series *::before,
.as-series *::after { box-sizing: border-box; }

.as-series img { max-width: 100%; height: auto; }

.as-series .screen-reader-text,
.as-eplist[data-view="grid"] .as-ep__title {
	position: absolute !important;
	width: 1px; height: 1px;
	margin: -1px; padding: 0;
	overflow: hidden; clip: rect(0, 0, 0, 0);
	white-space: nowrap; border: 0;
}

/* ---------- Breadcrumb ---------- */
.as-crumbs ol { display: flex; flex-wrap: wrap; gap: .35rem; margin: 0 0 .9rem; padding: 0; list-style: none; font-size: .85rem; color: var(--s-muted); }
.as-crumbs li + li::before { content: "›"; margin-right: .35rem; opacity: .6; }
.as-crumbs a { color: var(--s-muted) !important; text-decoration: none; }
.as-crumbs a:hover { color: var(--s-accent) !important; }
.as-crumbs [aria-current] span { color: var(--s-text); }

/* ---------- Boxes ---------- */
.as-box {
	margin: 0 0 1rem;
	padding: 1.1rem 1.25rem;
	background: var(--s-card);
	border: 1px solid var(--s-border);
	border-radius: var(--s-radius);
}
.as-box > h2,
.as-episodes__head h2 {
	margin: 0 0 .8rem;
	padding: 0 0 0 .7rem;
	border-left: 3px solid var(--s-accent);
	font-size: 1.1rem;
	line-height: 1.3;
	color: var(--s-text);
}
.as-warning { border-color: rgba(255, 170, 0, .4); color: #ffcf66; }
.as-editor-note { margin: .8rem 0 0; padding: .6rem .8rem; border: 1px dashed #ffcf66; border-radius: 8px; color: #ffcf66; font-size: .85rem; }

/* ---------- Hero ---------- */
.as-hero {
	position: relative;
	overflow: hidden;
	margin: 0 0 1rem;
	border: 1px solid var(--s-border);
	border-radius: var(--s-radius);
	background: #000;
	isolation: isolate;
}
.as-hero__backdrop {
	position: absolute; inset: -24px;
	z-index: -1;
	background-size: cover; background-position: center;
	filter: blur(22px) brightness(.35) saturate(1.2);
	transform: translateZ(0);
}
.as-hero__inner {
	display: grid;
	grid-template-columns: 230px minmax(0, 1fr);
	gap: 1.5rem;
	padding: 1.5rem;
}
.as-hero__poster { display: flex; flex-direction: column; gap: .75rem; }
.as-hero__poster > img {
	width: 100%; aspect-ratio: 2 / 3; object-fit: cover;
	border-radius: 10px; background: #0a0a0a;
	box-shadow: 0 10px 30px rgba(0, 0, 0, .55);
}

.as-hero__title { margin: 0; font-size: clamp(1.4rem, 3.2vw, 2.1rem); line-height: 1.2; font-weight: 800; color: var(--s-text); }
.as-hero__alt { margin: .35rem 0 0; color: var(--s-muted); font-size: .9rem; }
.as-hero__lead { margin: .9rem 0 0; max-width: 70ch; color: var(--s-muted); line-height: 1.6; }

.as-chips { display: flex; flex-wrap: wrap; gap: .4rem; margin: .9rem 0 0; }
.as-chip {
	padding: .25rem .7rem; border: 1px solid var(--s-border); border-radius: 999px;
	font-size: .8rem; text-decoration: none; background: rgba(255, 255, 255, .04);
}
.as-chip:hover { border-color: var(--s-accent); }

/* ---------- Buttons ---------- */
.as-btn {
	display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
	min-height: 44px; padding: .55rem 1rem;
	border: 1px solid var(--s-border); border-radius: 10px;
	font: inherit; font-weight: 700; font-size: .92rem; line-height: 1.2;
	cursor: pointer; text-decoration: none; transition: border-color .15s, background-color .15s;
}
.as-btn--primary { background: var(--s-accent); border-color: var(--s-accent); color: var(--s-ink) !important; }
.as-btn--primary:hover { background: #fff; border-color: #fff; }
.as-btn--outline { background: transparent; border-color: var(--s-accent); color: var(--s-accent) !important; }
.as-btn--outline:hover { background: rgba(0, 255, 136, .1); }
.as-btn--ghost { width: 100%; background: rgba(255, 255, 255, .05); color: var(--s-text); }
.as-btn--ghost:hover { border-color: var(--s-accent); }
.as-btn:focus-visible,
.as-toggle button:focus-visible,
.as-ep__link:focus-visible,
.as-card a:focus-visible,
.as-chip:focus-visible { outline: 2px solid var(--s-accent); outline-offset: 2px; }
.btn-rate-series.rated { border-color: #f59e0b; color: #f59e0b; }
.as-series .bookmark { user-select: none; }

.as-cta { display: flex; flex-wrap: wrap; gap: .6rem; margin: 1.1rem 0 0; }

/* ---------- Rating ---------- */
.as-rating { display: grid; gap: .5rem; }
.as-rating__score { display: inline-flex; align-items: baseline; gap: .35rem; font-size: 1.6rem; font-weight: 800; }
.as-rating__score .fa-star { color: #f59e0b; font-size: 1.1rem; }
.as-rating__score small { font-size: .85rem; font-weight: 600; color: var(--s-muted); }
.as-rating__bar { height: 6px; border-radius: 99px; background: rgba(255, 255, 255, .12); overflow: hidden; }
.as-rating__bar span { display: block; height: 100%; background: linear-gradient(90deg, #f59e0b, #ffd166); }
.as-rating__count { font-size: .82rem; color: var(--s-muted); }

/* ---------- Reactions Bar ---------- */
.as-reactions-bar {
	display: flex;
	align-items: center;
	flex-wrap: wrap;
	gap: .65rem 1rem;
	margin: 1.1rem 0 0;
	padding: .75rem 1rem;
	background: rgba(255, 255, 255, .03);
	border: 1px solid var(--s-border);
	border-radius: var(--s-radius);
}
.as-reactions-title {
	display: inline-flex;
	align-items: center;
	gap: .4rem;
	font-size: .8rem;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: .5px;
	color: var(--s-muted);
}
.as-reactions-title i {
	color: var(--s-accent);
	font-size: .95rem;
}
.as-reactions-list {
	display: flex;
	align-items: center;
	flex-wrap: wrap;
	gap: .45rem;
}
.as-react-btn {
	display: inline-flex;
	align-items: center;
	gap: .35rem;
	min-height: 36px;
	padding: .25rem .65rem;
	background: rgba(255, 255, 255, .05);
	border: 1px solid var(--s-border);
	border-radius: 999px;
	cursor: pointer;
	color: var(--s-text);
	font: inherit;
	font-size: .85rem;
	line-height: 1;
	transition: transform .15s ease, background-color .15s ease, border-color .15s ease, box-shadow .15s ease;
	user-select: none;
}
.as-react-btn:hover {
	transform: translateY(-2px) scale(1.05);
	background: rgba(255, 255, 255, .1);
	border-color: var(--s-accent);
}
.as-react-btn.active {
	background: rgba(0, 255, 136, .15);
	border-color: var(--s-accent);
	box-shadow: 0 0 12px rgba(0, 255, 136, .25);
}
.as-react-btn .emoji {
	font-size: 1.15rem;
	line-height: 1;
	transition: transform .15s ease;
}
.as-react-btn:hover .emoji {
	transform: scale(1.15);
}
.as-react-btn.active .emoji {
	filter: drop-shadow(0 0 4px rgba(0, 255, 136, .6));
	transform: scale(1.1);
}
.as-react-btn .count {
	font-size: .8rem;
	font-weight: 700;
	color: var(--s-muted);
}
.as-react-btn.active .count {
	color: var(--s-accent);
}
.as-react-btn:focus-visible {
	outline: 2px solid var(--s-accent);
	outline-offset: 2px;
}

/* ---------- Share ---------- */
.as-share { display: flex; gap: .5rem; margin: 1rem 0 0; }
.as-share a {
	display: inline-flex; align-items: center; justify-content: center;
	width: 40px; height: 40px; border: 1px solid var(--s-border); border-radius: 50%;
	text-decoration: none;
}
.as-share a:hover { border-color: var(--s-accent); }

/* ---------- Specs ---------- */
.as-specs {
	display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
	gap: .6rem 1.2rem; margin: 1.2rem 0 0; padding: 1rem 0 0;
	border-top: 1px solid var(--s-border);
}
.as-specs > div { min-width: 0; }
.as-specs dt { font-size: .75rem; color: var(--s-muted); margin: 0 0 .1rem; }
.as-specs dd { margin: 0; font-size: .92rem; overflow-wrap: anywhere; }
.as-specs a { text-decoration: none; }
.as-specs a:hover { text-decoration: underline; }
.as-specs__wide { grid-column: 1 / -1; }

/* ---------- Prose ---------- */
.as-prose { line-height: 1.75; max-width: 75ch; color: var(--s-muted); }
.as-prose p { margin: 0 0 1em; }
.as-prose p:last-child { margin-bottom: 0; }

.as-video { position: relative; aspect-ratio: 16 / 9; border-radius: 10px; overflow: hidden; background: #000; }
.as-video iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

/* ---------- Episodes ---------- */
.as-episodes__head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem; margin: 0 0 .8rem; }
.as-episodes__head h2 { margin: 0; }
.as-tools { display: flex; align-items: center; gap: .6rem; }
.as-tools[hidden] { display: none; }
.as-find input {
	width: 120px; min-height: 40px; padding: .4rem .7rem;
	border: 1px solid var(--s-border); border-radius: 10px;
	background: rgba(255, 255, 255, .05); color: var(--s-text); font: inherit; font-size: .9rem;
}
.as-find input:focus { outline: 2px solid var(--s-accent); outline-offset: 1px; }
.as-toggle { display: inline-flex; border: 1px solid var(--s-border); border-radius: 10px; overflow: hidden; }
.as-toggle button {
	width: 42px; height: 40px; border: 0; background: transparent; color: var(--s-muted); cursor: pointer;
}
.as-toggle button[aria-pressed="true"] { background: var(--s-accent); color: var(--s-ink); }

.as-eplist__items {
	margin: 0; padding: 0 .25rem 0 0; list-style: none;
	max-height: 560px; overflow-y: auto; overscroll-behavior: contain;
	scrollbar-width: thin;
}
.as-ep[hidden] { display: none; }
.as-ep__link { text-decoration: none; color: var(--s-text) !important; }

/* grid view: compact numbered tiles (titles stay in the DOM, visually hidden) */
.as-eplist[data-view="grid"] .as-eplist__items {
	display: grid; grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); gap: .5rem;
}
.as-eplist[data-view="grid"] .as-ep__link {
	position: relative; display: flex; align-items: center; justify-content: center; flex-direction: column;
	min-height: 52px; padding: .4rem;
	border: 1px solid var(--s-border); border-radius: 10px; background: rgba(255, 255, 255, .04);
	font-weight: 700; font-size: .9rem; text-align: center;
}
.as-eplist[data-view="grid"] .as-ep__link:hover { border-color: var(--s-accent); background: rgba(0, 255, 136, .08); }
.as-eplist[data-view="grid"] .as-ep__flags,
.as-eplist[data-view="grid"] .as-ep__date { display: none; }

/* list view */
.as-eplist[data-view="list"] .as-eplist__items { display: block; }
.as-eplist[data-view="list"] .as-ep + .as-ep { margin-top: .4rem; }
.as-eplist[data-view="list"] .as-ep__link {
	display: grid; grid-template-columns: 64px minmax(0, 1fr) auto; align-items: center; gap: .2rem .8rem;
	padding: .65rem .9rem; border: 1px solid var(--s-border); border-radius: 10px; background: rgba(255, 255, 255, .03);
}
.as-eplist[data-view="list"] .as-ep__link:hover { border-color: var(--s-accent); }
.as-ep__num { font-weight: 800; color: var(--s-accent); }
.as-eplist[data-view="list"] .as-ep__title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .92rem; }
.as-ep__flags { grid-column: 2; display: flex; flex-wrap: wrap; gap: .3rem; }
.as-ep__flags em { padding: .05rem .45rem; border: 1px solid var(--s-border); border-radius: 99px; font-size: .7rem; font-style: normal; color: var(--s-muted); }
.as-ep__date { grid-column: 3; grid-row: 1; font-size: .78rem; color: var(--s-muted); white-space: nowrap; }
.as-empty { margin: .5rem 0 0; color: var(--s-muted); }

/* ---------- Related cards ---------- */
.as-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 1rem; margin: 0; padding: 0; list-style: none; }
.as-card a { display: block; text-decoration: none; color: var(--s-text) !important; }
.as-card__img { display: block; aspect-ratio: 2 / 3; overflow: hidden; border-radius: 10px; background: #0a0a0a; border: 1px solid var(--s-border); }
.as-card__img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.as-card a:hover .as-card__img { border-color: var(--s-accent); }
.as-card__title { margin: .5rem 0 0; font-size: .9rem; line-height: 1.35; font-weight: 700; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.as-card__meta { display: block; margin-top: .15rem; font-size: .78rem; color: var(--s-muted); }

/* ---------- YouTube Comment Preview & Slide-Up Modal ---------- */
.youtube-comment-preview {
	background: rgba(255, 255, 255, 0.05);
	border-radius: 12px;
	padding: 15px;
	margin: 10px 0 10px 0;
	cursor: pointer;
	transition: background 0.2s, border-color 0.2s;
	border: 1px solid var(--s-border);
}
.youtube-comment-preview:hover {
	background: rgba(255, 255, 255, 0.08);
	border-color: var(--s-accent);
}
.yt-cp-header h4 {
	margin: 0 0 10px 0;
	font-size: 14px;
	color: #fff;
	font-weight: 700;
}
.yt-cp-header .comment-count {
	color: var(--s-muted);
	font-weight: normal;
	margin-left: 5px;
}
.yt-cp-input-fake {
	display: flex;
	align-items: center;
	gap: 10px;
	margin-bottom: 12px;
}
.yt-cp-avatar i {
	font-size: 24px;
	color: var(--s-muted);
}
.yt-cp-placeholder {
	background: rgba(255, 255, 255, 0.08);
	color: var(--s-muted);
	font-size: 13px;
	padding: 8px 15px;
	border-radius: 20px;
	flex-grow: 1;
}
.yt-cp-comment-item {
	font-size: 13px;
	color: #ddd;
	margin-bottom: 6px;
	line-height: 1.4;
	display: -webkit-box;
	-webkit-line-clamp: 1;
	-webkit-box-orient: vertical;
	overflow: hidden;
}
.yt-cp-comment-item strong {
	color: #fff;
	margin-right: 5px;
	font-weight: 600;
}

/* Bottom Sheet Modal Overlay */
.yt-modal-overlay {
	position: fixed;
	top: 0; left: 0; width: 100%; height: 100%;
	background: rgba(0, 0, 0, 0.7);
	z-index: 999999;
	display: flex;
	align-items: flex-end;
	opacity: 0;
	visibility: hidden;
	transition: opacity 0.3s ease, visibility 0.3s ease;
}
.yt-modal-overlay.active {
	opacity: 1 !important;
	visibility: visible !important;
}
.yt-bottom-sheet {
	width: 100%;
	height: 90vh;
	height: 90dvh;
	background: #111;
	border-top-left-radius: 20px;
	border-top-right-radius: 20px;
	transform: translateY(100%);
	transition: transform 0.35s cubic-bezier(0.25, 1, 0.5, 1);
	display: flex;
	flex-direction: column;
	box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.6);
	border: 1px solid var(--s-border);
	border-bottom: none;
}
.yt-modal-overlay.active .yt-bottom-sheet {
	transform: translateY(30vh);
	transform: translateY(30dvh);
}
.yt-modal-overlay.active .yt-bottom-sheet.expanded,
.yt-modal-overlay.active .yt-bottom-sheet.has-picker-open {
	transform: translateY(0);
}
.yt-bs-header {
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding: 15px 20px;
	border-bottom: 1px solid var(--s-border);
}
.yt-bs-header h3 {
	margin: 0;
	font-size: 18px;
	color: #fff;
	font-weight: 800;
}
.close-comment-modal {
	background: none;
	border: none;
	color: #fff;
	font-size: 20px;
	cursor: pointer;
}
.close-comment-modal:hover {
	color: var(--s-accent);
}
.yt-bs-content {
	flex-grow: 1;
	overflow-y: auto;
}

@media screen and (min-width: 1024px) {
	.yt-bottom-sheet, .yt-bottom-sheet.expanded {
		width: 480px;
		height: 100vh;
		margin-left: auto;
		border-radius: 0;
		transform: translateX(100%);
		border-left: 1px solid var(--s-border);
	}
	.yt-modal-overlay.active .yt-bottom-sheet,
	.yt-modal-overlay.active .yt-bottom-sheet.expanded {
		transform: translateX(0);
	}
}

/* ---------- Responsive ---------- */
@media (max-width: 820px) {
	.as-hero__inner { grid-template-columns: 170px minmax(0, 1fr); gap: 1rem; padding: 1rem; }
}
@media (max-width: 600px) {
	.as-hero__inner { grid-template-columns: 1fr; }
	.as-hero__poster { flex-direction: row; align-items: flex-start; gap: .9rem; }
	.as-hero__poster > img { width: 130px; flex: none; }
	.as-rating { flex: 1; min-width: 0; }
	.as-box { padding: .9rem; }
	.as-cta .as-btn { flex: 1 1 100%; }
	.as-eplist[data-view="list"] .as-ep__link { grid-template-columns: 52px minmax(0, 1fr); }
	.as-eplist[data-view="list"] .as-ep__date { grid-column: 2; grid-row: auto; }
}

@media (prefers-reduced-motion: reduce) {
	.as-series * { transition: none !important; scroll-behavior: auto !important; }
}
