:root {
  font-family: "Inter", "Segoe UI", system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.45;
  font-synthesis: none;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; min-width: 280px; color: var(--ink); background: var(--base); }
[hidden] { display: none !important; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { opacity: .55; cursor: wait; }
button, input, select, textarea { color: inherit; }
button, .button { border: 1px solid transparent; border-radius: .55rem; padding: .62rem .95rem; font-weight: 650; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--focus); outline-offset: 3px;
}
button.primary, .button.primary { background: var(--accent); color: var(--accent-ink); }
button.primary:hover, .button.primary:hover { filter: brightness(.92); }
button.secondary, .button.secondary { background: var(--panel); border-color: var(--line); }
button.secondary:hover, .button.secondary:hover { border-color: var(--focus); }
h1, h2, p { margin: 0; }
h2 { font-size: 1.14rem; line-height: 1.25; letter-spacing: -.025em; }
.muted { color: var(--muted); }
.eyebrow { font-size: .76rem; font-weight: 750; letter-spacing: .12em; text-transform: uppercase; }
.actions { display: flex; gap: .7rem; flex-wrap: wrap; align-items: center; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.brand { display: inline-flex; align-items: center; gap: .68rem; font-size: 1.37rem; font-weight: 790; letter-spacing: -.05em; }
.brand-mark { width: 1.8rem; height: 1.8rem; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; border-radius: .5rem; flex: none; }
.brand-mark::before { content: ""; width: .56rem; height: .63rem; background: currentColor; clip-path: polygon(0 0, 100% 50%, 0 100%); }
.search { display: flex; gap: .55rem; align-items: center; padding: .52rem .7rem; border: 1px solid var(--line); border-radius: .52rem; background: var(--panel); color: var(--muted); }
.search input { min-width: 0; width: 100%; color: var(--ink); background: transparent; border: none; padding: 0; font-size: .88rem; line-height: 1.3; }
.search:focus-within { border-color: var(--focus); }
.search input:focus-visible { outline: none; }
.search-icon { width: .8rem; height: .8rem; border: 1.5px solid currentColor; border-radius: 100%; position: relative; margin-inline-end: .13rem; flex: none; }
.search-icon::after { content: ""; position: absolute; width: .34rem; height: 1.5px; background: currentColor; transform: rotate(45deg); right: -.25rem; bottom: -.13rem; }

/* Theater */
[data-view="theater"] {
  color-scheme: dark;
  --base: #0d1117; --panel: #171d25; --ink: #f5f8fa; --line: #2b3542;
  --muted: #a4b1bd; --accent: #a9f0d8; --accent-ink: #102620; --focus: #a9f0d8;
}
.theater-bar { display: flex; align-items: center; gap: clamp(1rem, 3.2vw, 3.5rem); min-height: 4.5rem; padding: .9rem clamp(1rem, 5vw, 5rem); border-bottom: 1px solid #202a32; background: #0e1319; }
.theater-bar nav { display: flex; align-items: center; gap: clamp(.8rem, 2.3vw, 2rem); color: var(--muted); font-size: .92rem; }
.theater-bar nav a:hover { color: var(--ink); }
.theater-bar .search { margin-left: auto; width: clamp(9rem, 21vw, 18rem); }
.feature { position: relative; isolation: isolate; display: grid; align-items: center; min-height: clamp(28rem, 43vw, 38rem); overflow: hidden; background: #131c25; }
.feature-art { position: absolute; inset: 0 0 0 34%; z-index: -1; background: radial-gradient(ellipse at 75% 15%, #47586e 0, #273745 42%, #111a21 78%); }
.feature-art img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: center 32%; }
.feature::after { content: ""; position: absolute; z-index: -1; inset: 0; pointer-events: none; background: linear-gradient(90deg,#0d1117 3%,#0e151e 30%,rgba(14,21,30,.84) 47%,rgba(14,21,30,0) 76%),linear-gradient(0deg,#0d1117 0%,transparent 33%); }
.feature-copy { padding: 3.7rem clamp(1rem, 5vw, 5rem) 5.7rem; max-width: min(49rem, 78%); }
.feature-copy .eyebrow { color: var(--accent); margin-bottom: 1rem; }
.feature-copy h1 { max-width: 16ch; font-size: clamp(2.65rem, 6.2vw, 5.3rem); font-weight: 780; letter-spacing: -.075em; line-height: .99; text-wrap: balance; }
.feature-description { max-width: 46ch; color: #c8d2dd; margin: 1rem 0 1.4rem; }
.play-icon { display: inline-block; background: currentColor; width: .68rem; height: .75rem; clip-path: polygon(0 0, 100% 50%, 0 100%); margin-right: .55rem; }
.theater-library { position: relative; margin-top: -1.7rem; padding: 0 clamp(1rem, 5vw, 5rem) 3.5rem; }
.feature[hidden] ~ .theater-library { margin-top: 0; padding-top: 1.7rem; }
.theater-library section + section { margin-top: 2.5rem; }
.section-head, .panel-head, .field-head { display: flex; justify-content: space-between; gap: .8rem; align-items: center; }
.section-head { margin-bottom: .9rem; }
.section-head h2 { font-size: clamp(1.35rem, 2.45vw, 2rem); }
.section-head p { font-size: .86rem; }
.shelf { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(10.4rem, 43%), 1fr)); gap: clamp(.65rem, 1.5vw, 1.25rem); }
.movie-card { display: block; text-align: left; min-width: 0; width: 100%; padding: 0; border: 0; background: transparent; font-weight: 650; }
.poster { display: grid; place-items: center; isolation: isolate; position: relative; aspect-ratio: 2/3; border: 1px solid #303b46; border-radius: .68rem; overflow: hidden; background: radial-gradient(at 80% 10%,#40556a,#222f3d 50%,#19232e); }
.poster img { width: 100%; height: 100%; position: absolute; object-fit: cover; inset: 0; transition: transform .25s ease; }
.poster-letter { font-size: 3.75rem; letter-spacing: -.12em; color: #8ca6b9; opacity: .55; }
.movie-card:hover .poster { border-color: var(--focus); }
.movie-card:hover img { transform: scale(1.045); }
.card-title { display: block; margin: .62rem 0 .12rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card-meta { display: block; color: var(--muted); font-size: .82rem; font-weight: 500; }
.progress { position: absolute; bottom: 0; width: 100%; height: .27rem; accent-color: var(--accent); }
.watch-section { position: relative; isolation: isolate; overflow: hidden; min-height: calc(100vh - 4.5rem); padding: clamp(2rem, 5vw, 4rem) clamp(1rem, 5vw, 5rem) 2.7rem; }
.watch-backdrop { position: absolute; z-index: -1; inset: 0 0 auto; height: clamp(25rem, 62vw, 46rem); overflow: hidden; background: radial-gradient(ellipse at 82% 10%, #304b5d, #15242f 62%, #0d1117 95%); }
.watch-backdrop img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: center 33%; }
.watch-backdrop::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, #0d1117f5, #0d1117bb 40%, #0d11172b 85%), linear-gradient(0deg, #0d1117 2%, transparent 65%); }
.watch-head, .watch-screen, .watch-options { max-width: 76rem; margin-inline: auto; }
.watch-head { display: flex; min-height: clamp(12rem, 27vw, 22rem); align-items: start; justify-content: space-between; flex-wrap: wrap; gap: .85rem; padding-bottom: clamp(2rem, 5vw, 4.5rem); }
.watch-head > div { align-self: end; }
.watch-head .eyebrow { color: var(--accent); margin-bottom: .35rem; }
.watch-head h1 { font-size: clamp(2.25rem, 5.9vw, 4.7rem); letter-spacing: -.065em; line-height: 1.02; max-width: 18ch; text-wrap: balance; }
#watch-description { max-width: 54ch; color: #d2dde5; margin-top: .75rem; }
#watch-description:empty { display: none; }
.watch-screen { position: relative; }
.watch-screen:not(:has(video[hidden])) { overflow: hidden; border-radius: .8rem; border: 1px solid var(--line); background: #05070a; }
.watch-loading { pointer-events: none; position: absolute; inset: 0; display: grid; place-items: center; background: #0d111762; }
.watch-loading span { width: 2.6rem; aspect-ratio: 1; border: .21rem solid #a9f0d82f; border-top-color: var(--accent); border-radius: 50%; animation: watch-spin .8s linear infinite; }
@keyframes watch-spin { to { transform: rotate(360deg); } }
[data-page="detail"] :is(.feature, .theater-library, .theater-bar .search) { display: none; }
[data-page="detail"] .theater-bar form { margin-left: auto; }
video { display: block; width: 100%; max-height: 70vh; aspect-ratio: 16/9; background: #05070a; }
.watch-options { margin-top: 1rem; padding: 1rem 1.15rem; border: 1px solid var(--line); background: var(--panel); border-radius: .8rem; }
.watch-options p:not(:empty) { margin-bottom: .7rem; }
.watch-options p:empty { display: none; }
.episode-list { display: flex; gap: .48rem; flex-wrap: wrap; margin-top: .5rem; }
.episode { font-size: .88rem; border-color: var(--line); background: var(--base); }
.episode[aria-pressed="true"], .episode:hover { border-color: var(--accent); color: var(--accent); }

/* Astro */
[data-view="admin"] {
  color-scheme: light;
  --base: #f3f6f6; --panel: #fff; --ink: #162c31; --line: #dce5e6;
  --muted: #546a6e; --accent: #126752; --accent-ink: #fff; --focus: #17836b;
  --rail: 13rem;
}
.rail { position: fixed; inset: 0 auto 0 0; width: var(--rail); display: flex; flex-direction: column; background: #132a2d; color: #eef7f4; padding: 1.55rem 1.1rem; z-index: 2; }
.rail .brand { margin: 0 .45rem 2rem; }
.rail .brand-mark { background: #a6edd8; color: #102c27; }
.rail nav { display: grid; gap: .35rem; }
.rail nav a, .rail-theater { display: flex; gap: .75rem; align-items: center; font-size: .92rem; color: #cededa; padding: .6rem .65rem; border-radius: .45rem; }
.rail nav a:hover, .rail-theater:hover { color: white; background: #254347; }
.rail-icon { display: grid; place-items: center; width: 1.15rem; color: #a6edd8; font-weight: 750; }
.rail-theater { margin-top: auto; }
.rail-logout { color: #cededa; background: transparent; font-size: .9rem; padding: .55rem .65rem; }
.rail-logout:hover { background: #254347; color: white; }
.admin-main { padding: 2rem clamp(1rem, 3vw, 3.75rem) 3.5rem; margin-left: var(--rail); max-width: 100rem; }
.admin-header { display: flex; align-items: end; justify-content: space-between; gap: 1rem; margin-bottom: 1.6rem; }
.admin-header .eyebrow { color: var(--accent); margin-bottom: .4rem; }
.admin-header h1 { font-size: clamp(2.2rem, 4.4vw, 3.3rem); font-weight: 760; letter-spacing: -.065em; line-height: 1.05; }
.admin-header p.muted { margin-top: .55rem; }
.metrics { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: .8rem; margin-bottom: 1rem; }
.metric, .panel { background: var(--panel); border: 1px solid var(--line); border-radius: .82rem; box-shadow: 0 2px 2px #16393604; }
.metric { display: grid; gap: .18rem; padding: .9rem 1rem .95rem; }
.metric span, .metric small, .metric a { color: var(--muted); font-size: .83rem; }
.metric a { color: var(--accent); text-decoration: underline; }
.metric strong { font-size: 2rem; font-variant-numeric: tabular-nums; letter-spacing: -.05em; }
.ingest-grid { display: grid; grid-template-columns: minmax(0,1.12fr) minmax(0,1fr); gap: 1rem; align-items: start; }
.panel { min-width: 0; padding: 1.15rem; }
.panel-head { margin-bottom: .95rem; }
.panel-head p { font-size: .87rem; margin-top: .22rem; }
.admin-main label { font-size: .9rem; font-weight: 650; }
.admin-main select, .admin-main textarea { display: block; width: 100%; margin: .34rem 0 .8rem; background: #fbfcfc; border: 1px solid #cbd9da; border-radius: .45rem; padding: .6rem .7rem; }
.admin-main textarea { min-height: 7rem; resize: vertical; margin-bottom: .35rem; font: .84rem/1.55 ui-monospace, monospace; }
.text-button { padding: .2rem .1rem; background: transparent; color: var(--accent); font-size: .86rem; }
.text-button:hover { text-decoration: underline; }
.helper, .form-notice { font-size: .83rem; color: var(--muted); }
.form-actions { margin-top: .85rem; }
.form-notice:not(:empty) { margin-top: .6rem; }
.form-notice[data-error="true"] { color: #9a302d; }
.status-pill { display: inline-flex; align-items: center; width: fit-content; white-space: nowrap; border-radius: .36rem; padding: .22rem .46rem; font-size: .77rem; font-weight: 700; color: #54686a; background: #edf2f2; }
.status-pill[data-status="running"], .status-pill[data-status="online"] { color: #136147; background: #e3f4ed; }
.status-pill[data-status="complete"] { color: #14534f; background: #e4f4f2; }
.status-pill[data-status="partial"], .status-pill[data-status="error"] { color: #954728; background: #faeee8; }
.job-list { display: grid; gap: .55rem; max-height: 24rem; overflow: auto; }
.job { padding: .65rem .72rem; border: 1px solid var(--line); border-radius: .55rem; }
.job-title { font-weight: 730; }
.job-details { margin-top: .25rem; font-size: .84rem; color: var(--muted); overflow-wrap: anywhere; }
.inventory { margin-top: 1rem; scroll-margin-top: 1rem; }
.inventory .search { width: min(13.5rem, 42%); }
.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .86rem; text-align: left; }
th, td { padding: .58rem .6rem; vertical-align: top; }
th { background: #f1f5f5; color: #496267; white-space: nowrap; font-size: .79rem; }
td { border-bottom: 1px solid #edf1f1; }
td a { color: var(--accent); }
td a:hover { text-decoration: underline; }
td:first-child { font-weight: 650; min-width: 9.7rem; }
td:nth-child(5) { overflow-wrap: anywhere; }
#failures td:nth-child(3) { min-width: 10rem; overflow-wrap: anywhere; }
.notice { color: var(--muted); font-size: .88rem; padding: .25rem 0; }
[data-view="login"] {
  color-scheme: dark;
  --base: #0e151b; --panel: #172229; --ink: #eef5f3; --muted: #abc1bd;
  --line: #394c50; --accent: #a9f0d8; --accent-ink: #102620; --focus: #a9f0d8;
}
.login-shell { min-height: 100vh; display: grid; place-items: center; padding: 1rem; background: radial-gradient(ellipse at 75% 15%, #263f48, transparent 52%); }
.login-panel { width: min(100%, 27rem); padding: clamp(1.5rem, 5vw, 2.4rem); border-radius: 1rem; border: 1px solid var(--line); background: var(--panel); }
.login-panel h1 { margin: 1.25rem 0; font-size: 2.2rem; letter-spacing: -.06em; }
.login-panel form { display: grid; gap: .65rem; }
.login-panel label { font-size: .9rem; font-weight: 650; }
.login-panel input:not([type="checkbox"], [type="hidden"]) { width: 100%; padding: .65rem .75rem; border: 1px solid var(--line); border-radius: .5rem; background: var(--base); }
.login-panel .remember { display: flex; align-items: center; gap: .55rem; margin-block: .45rem; color: var(--muted); }
.login-panel .remember input { accent-color: var(--accent); }
.login-error { color: #ffaba3; font-size: .86rem; }
.login-error:empty { display: none; }
@media (max-width: 970px) {
  [data-view="admin"] { --rail: 10.8rem; }
  .rail { padding-inline: .75rem; }
  .ingest-grid { grid-template-columns: 1fr; }
}
@media (max-width: 700px) {
  .rail { position: static; width: auto; gap: .8rem; padding: .8rem 1rem; }
  .rail .brand { margin: 0; }
  .rail nav { display: flex; flex-wrap: wrap; gap: .2rem; }
  .rail nav a { font-size: .83rem; padding: .26rem .3rem; gap: .25rem; }
  .rail-theater { align-self: start; margin: 0; padding-block: .2rem; }
  .admin-main { margin: 0; padding-top: 1.25rem; }
  .admin-header { align-items: start; flex-direction: column; }
  .metrics { grid-template-columns: repeat(2,minmax(0,1fr)); gap: .55rem; }
  .theater-bar { flex-wrap: wrap; gap: .85rem; }
  .theater-bar .search { width: min(12rem,44%); }
  .theater-bar nav { order: 3; width: 100%; }
  .feature { min-height: 28rem; }
  .feature-art { inset-inline-start: 15%; }
  .feature::after { background: linear-gradient(90deg,#0d1117 0%,rgba(14,21,30,.85) 36%,rgba(14,21,30,.14) 95%),linear-gradient(0deg,#0d1117 0%,transparent 28%); }
  .feature-copy { max-width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
  .watch-loading span { animation: none; }
}
