/* Not Another Movie DB */
:root {
    color-scheme: dark;
    --bg: #111217;
    --surface: #1b1c23;
    --surface-2: #262730;
    --text: #eeede8;
    --muted: #a3a5af;
    --line: #33343e;
    --accent: #e04a2f;
    --accent-hover: #f0604a;
    --on-accent: #ffffff;
    --link: #ff8a73;
    --star: #f1b53c;
    --ok-bg: #173223; --ok-text: #b6e6c3;
    --err-bg: #3c1a14; --err-text: #ffc2b6;
    --warn-bg: #352b10; --warn-text: #f2dc9e;
    --header-bg: #0b0c10;
    --header-text: #f4f3ef;
    --radius: 8px;
    --shadow: 0 1px 3px rgba(0, 0, 0, .5);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font: 16px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5em; }
h1 { font-size: clamp(1.7rem, 4vw, 2.4rem); letter-spacing: -.01em; }
h3 { font-size: 1.05rem; }
p { margin: 0 0 1em; }
a { color: var(--link); }
img { max-width: 100%; display: block; }
.wrap { width: 100%; max-width: 1200px; margin: 0 auto; padding: 0 16px; }
.main { flex: 1; padding-top: 24px; padding-bottom: 48px; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.star { color: var(--star); }
.sr-only {
    position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
    overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
.skip-link { position: absolute; left: -9999px; }
.skip-link:focus { left: 8px; top: 8px; z-index: 10; background: var(--surface); padding: 8px 12px; border-radius: var(--radius); }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

/* Header */
.site-header { background: var(--header-bg); color: var(--header-text); }
.header-row { display: flex; align-items: center; gap: 16px; padding-top: 10px; padding-bottom: 10px; flex-wrap: wrap; }
.logo { display: inline-flex; align-items: center; gap: 8px; color: inherit; text-decoration: none; font-weight: 700; white-space: nowrap; }
.logo-mark { background: #e04a2f; color: #fff; padding: 2px 7px; border-radius: 4px; font-weight: 800; letter-spacing: .04em; font-size: .9rem; }
.header-search { display: flex; flex: 1 1 240px; min-width: 0; max-width: 480px; }
.header-search input {
    flex: 1; min-width: 0; border: 0; border-radius: var(--radius) 0 0 var(--radius);
    padding: 8px 12px; font: inherit; background: #fff; color: #1b1c22;
}
.header-search button {
    border: 0; background: #33343e; color: #fff; padding: 8px 14px; font: inherit; cursor: pointer;
    border-radius: 0 var(--radius) var(--radius) 0;
}
.header-search button:hover { background: #454652; }
.site-nav { display: flex; align-items: center; gap: 16px; margin-left: auto; flex-wrap: wrap; }
.site-nav a { color: var(--header-text); text-decoration: none; }
.site-nav a:hover { text-decoration: underline; }
.site-nav a.btn { color: #fff; background: #d03d23; }
.site-nav a.btn:hover { text-decoration: none; background: #e04a2f; }
.nav-form { margin: 0; display: inline; }
.site-nav .link-button { color: var(--header-text); }
.nav-toggle { display: none; background: none; color: var(--header-text); border: 1px solid #555; border-radius: var(--radius); padding: 6px 12px; font: inherit; cursor: pointer; margin-left: auto; }
.badge { background: #e04a2f; color: #fff; font-size: .75rem; font-weight: 700; border-radius: 10px; padding: 1px 7px; }
.notice-bar { background: var(--warn-bg); color: var(--warn-text); padding: 8px 0; font-size: .95rem; }
.notice-bar a { color: inherit; font-weight: 600; }
@media (max-width: 860px) {
    .nav-toggle { display: block; }
    .header-search { order: 3; flex-basis: 100%; max-width: none; }
    .site-nav { display: none; flex-basis: 100%; order: 4; flex-direction: column; align-items: flex-start; gap: 10px; margin: 0; padding: 4px 0; }
    .site-nav.is-open { display: flex; }
}

/* Footer */
.site-footer { background: var(--surface-2); color: var(--muted); padding: 20px 0; font-size: .9rem; }
.footer-row { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.site-footer nav { display: flex; gap: 16px; flex-wrap: wrap; }
.site-footer a { color: inherit; }

/* Buttons */
.btn {
    display: inline-block; background: var(--accent); color: var(--on-accent); border: 1px solid transparent;
    border-radius: var(--radius); padding: 9px 18px; font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; text-align: center;
}
.btn:hover { background: var(--accent-hover); }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--line); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-danger { background: #a3200c; color: #fff; }
.btn-danger:hover { background: #861a09; }
.btn-small { padding: 5px 12px; font-size: .9rem; }
.link-button { background: none; border: 0; padding: 0; font: inherit; color: var(--link); cursor: pointer; text-decoration: underline; }

/* Alerts */
.alert { padding: 12px 16px; border-radius: var(--radius); margin-bottom: 16px; }
.alert p:last-child { margin-bottom: 0; }
.alert p { margin-bottom: .5em; }
.alert-success { background: var(--ok-bg); color: var(--ok-text); }
.alert-error { background: var(--err-bg); color: var(--err-text); }
.alert-warning { background: var(--warn-bg); color: var(--warn-text); }
.alert a { color: inherit; font-weight: 600; }

/* Forms */
.stack { display: flex; flex-direction: column; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field label, .field-label { font-weight: 600; font-size: .95rem; }
.field small { color: var(--muted); }
input:not([type=checkbox]):not([type=radio]), select, textarea {
    width: 100%; font: inherit; color: var(--text); background: var(--surface);
    border: 1px solid var(--line); border-radius: var(--radius); padding: 8px 10px;
}
textarea { resize: vertical; }
.check { display: flex; gap: 8px; align-items: flex-start; }
.check input { margin-top: .3em; flex: none; }
.hp-field { position: absolute; left: -9999px; }
.form-page { max-width: 440px; margin: 16px auto; }
.prose-page { max-width: 720px; margin: 0 auto; }
.prose-page h2 { margin-top: 1.4em; font-size: 1.25rem; }
.prose { overflow-wrap: anywhere; }
.row-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; min-width: 0; }
.panel h2 { font-size: 1.2rem; }
.panel-danger { border-color: #a3200c; }
.account-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(320px, 100%), 1fr)); gap: 16px; align-items: start; }
.filters { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 20px; }
.empty-state { text-align: center; padding: 48px 16px; color: var(--muted); }
.empty-state h1, .empty-state h2 { color: var(--text); }

/* Home */
.hero { background: var(--header-bg); color: var(--header-text); border-radius: 12px; padding: clamp(24px, 5vw, 48px); margin-bottom: 32px; }
.hero h1 { max-width: 20em; }
.hero-search { display: flex; gap: 8px; max-width: 560px; margin-bottom: 16px; flex-wrap: wrap; }
.hero-search input { flex: 1 1 220px; width: auto; background: #fff; color: #1b1c22; border: 0; }
.hero .chip { background: rgba(255, 255, 255, .12); color: #f4f3ef; border-color: transparent; }
.hero .chip:hover { background: rgba(255, 255, 255, .22); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.chip { border: 1px solid var(--line); border-radius: 999px; padding: 3px 12px; font-size: .875rem; color: var(--text); text-decoration: none; background: var(--surface); }
.chip:hover { background: var(--surface-2); }
.chip.is-active { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }

/* Sections */
.shelf { margin-top: 36px; }
.shelf-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.section-title { font-size: 1.35rem; padding-left: 10px; border-left: 4px solid var(--accent); margin-bottom: 14px; }
.count { color: var(--muted); font-weight: 400; font-size: 1rem; }

/* Title cards */
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 16px; }
.card { display: flex; flex-direction: column; background: var(--surface); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); color: var(--text); text-decoration: none; transition: transform .12s ease; }
.card:hover { transform: translateY(-2px); }
.card:hover .card-title { text-decoration: underline; }
.card-body { display: flex; flex-direction: column; gap: 2px; padding: 10px; }
.card-title { font-weight: 600; line-height: 1.25; overflow-wrap: anywhere; }
.card-meta, .card-score { font-size: .85rem; }
.card-meta { color: var(--muted); }
.poster { width: 100%; aspect-ratio: 2 / 3; object-fit: cover; background: var(--surface-2); }
.headshot { width: 100%; aspect-ratio: 1 / 1; object-fit: cover; object-position: top; background: var(--surface-2); border-radius: var(--radius); }
.placeholder { display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: 2.6rem; font-weight: 700; }
@media (prefers-reduced-motion: reduce) { .card { transition: none; } .card:hover { transform: none; } }

/* Title and person pages */
.title-hero { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 28px; }
.title-poster .poster { border-radius: var(--radius); box-shadow: var(--shadow); }
.eyebrow { text-transform: uppercase; letter-spacing: .08em; font-size: .8rem; font-weight: 700; color: var(--muted); margin-bottom: .3em; }
.title-info h1 { margin-bottom: .2em; overflow-wrap: anywhere; }
.title-meta { color: var(--muted); }
.tagline { font-style: italic; color: var(--muted); }
.rating-row { display: flex; flex-wrap: wrap; gap: 28px; padding: 14px 0; margin-bottom: 14px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.score-block { display: flex; flex-direction: column; gap: 2px; }
.score-label { font-size: .8rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.score-value { font-size: 1.7rem; font-weight: 700; line-height: 1.2; }
.score-out { font-size: 1rem; font-weight: 400; color: var(--muted); }
.score-none { font-size: 1.1rem; font-weight: 600; }
.rate-form { display: flex; flex-wrap: wrap; align-items: center; }
.rate-star { background: none; border: 0; padding: 2px 1px; font-size: 1.5rem; line-height: 1; color: var(--line); cursor: pointer; }
.rate-star.is-on, .rate-star.is-hover { color: var(--star); }
.rate-form .link-button { margin-left: 10px; }
.synopsis { margin-bottom: 14px; }
.crew-line { margin-bottom: .4em; }
.crew-line strong { margin-right: 4px; }
.title-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }
.details { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 4px 16px; margin: 0 0 14px; }
.details dt { font-weight: 600; }
.details dd { margin: 0; }
@media (max-width: 680px) {
    .title-hero { grid-template-columns: 1fr; }
    .title-poster { max-width: 200px; }
}

/* Cast */
.cast-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 16px; }
.cast-card { display: flex; flex-direction: column; gap: 2px; color: var(--text); text-decoration: none; min-width: 0; }
.cast-card:hover .cast-name { text-decoration: underline; }
.cast-name { font-weight: 600; margin-top: 6px; line-height: 1.25; overflow-wrap: anywhere; }

.birthday-today { color: var(--star); font-weight: 600; }

/* News */
.news-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(280px, 100%), 1fr)); gap: 16px; }
.news-card { display: flex; flex-direction: column; background: var(--surface); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); color: var(--text); text-decoration: none; min-width: 0; }
.news-card:hover .news-headline { text-decoration: underline; }
.news-image { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; background: var(--surface-2); }
.news-image-large { border-radius: var(--radius); margin-bottom: 16px; }
.news-headline { font-size: 1.1rem; font-weight: 700; line-height: 1.25; overflow-wrap: anywhere; }
.news-excerpt { color: var(--muted); font-size: .95rem; margin-top: 4px; overflow-wrap: anywhere; }

.story h2, .story h3 { margin-top: 1.3em; }
.story ul, .story ol { margin: 0 0 1em; padding-left: 1.6em; }
.story blockquote { margin: 0 0 1em; padding: 4px 0 4px 14px; border-left: 3px solid var(--line); color: var(--muted); }
.story pre { margin: 0 0 1em; padding: 12px; overflow-x: auto; background: var(--surface-2); border-radius: var(--radius); }
.story img { height: auto; margin: 1em 0; border-radius: var(--radius); }
.story-video { display: block; width: 100%; aspect-ratio: 16 / 9; border: 0; margin: 1em 0; border-radius: var(--radius); }

/* Story editor (Quill), recolored for the dark site */
.news-editor .ql-toolbar.ql-snow { background: var(--surface-2); border-color: var(--line); border-radius: var(--radius) var(--radius) 0 0; }
.news-editor .ql-container.ql-snow { background: var(--surface); border-color: var(--line); border-radius: 0 0 var(--radius) var(--radius); font: inherit; }
.news-editor .ql-editor { min-height: 320px; color: var(--text); font-size: 1rem; line-height: 1.55; }
.news-editor .ql-editor.ql-blank::before { color: var(--muted); }
.news-editor .ql-editor a { color: var(--link); }
.news-editor .ql-editor .ql-video { width: 100%; max-width: 560px; aspect-ratio: 16 / 9; height: auto; margin: 1em 0; }
.news-editor .ql-editor blockquote { border-left-color: var(--line); color: var(--muted); }
.news-editor .ql-editor pre { background: var(--surface-2); color: var(--text); }
.news-editor .ql-snow .ql-stroke { stroke: var(--text); }
.news-editor .ql-snow .ql-fill { fill: var(--text); }
.news-editor .ql-snow .ql-picker { color: var(--text); }
.news-editor .ql-snow .ql-picker-options { background: var(--surface-2); border-color: var(--line); }
.news-editor .ql-snow.ql-toolbar button:hover .ql-stroke,
.news-editor .ql-snow.ql-toolbar button.ql-active .ql-stroke,
.news-editor .ql-snow.ql-toolbar .ql-picker-label:hover .ql-stroke,
.news-editor .ql-snow.ql-toolbar .ql-picker-label.ql-active .ql-stroke { stroke: var(--link); }
.news-editor .ql-snow.ql-toolbar button:hover .ql-fill,
.news-editor .ql-snow.ql-toolbar button.ql-active .ql-fill { fill: var(--link); }
.news-editor .ql-snow.ql-toolbar button:hover,
.news-editor .ql-snow.ql-toolbar button.ql-active,
.news-editor .ql-snow.ql-toolbar .ql-picker-label:hover,
.news-editor .ql-snow.ql-toolbar .ql-picker-label.ql-active,
.news-editor .ql-snow.ql-toolbar .ql-picker-item:hover,
.news-editor .ql-snow.ql-toolbar .ql-picker-item.ql-selected { color: var(--link); }
.news-editor .ql-snow .ql-tooltip { background: var(--surface-2); border-color: var(--line); color: var(--text); box-shadow: var(--shadow); }
.news-editor .ql-snow .ql-tooltip input[type=text] { background: var(--surface); border-color: var(--line); color: var(--text); width: 180px; }
.news-editor .ql-snow .ql-tooltip a { color: var(--link); }

/* Episodes */
.season-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.episode-list { list-style: none; margin: 0; padding: 0; }
.episode { display: flex; gap: 14px; padding: 14px 0; border-top: 1px solid var(--line); }
.episode p:last-child { margin-bottom: 0; }
.episode h3 { margin-bottom: .2em; }
.episode-number { flex: none; width: 2.2em; font-size: 1.15rem; font-weight: 700; color: var(--muted); }

/* Filmography */
.filmography { list-style: none; margin: 0; padding: 0; }
.filmography li { display: flex; gap: 14px; padding: 8px 0; border-top: 1px solid var(--line); }
.film-year { flex: none; width: 6.5em; color: var(--muted); }
.plain-list { list-style: none; margin: 0; padding: 0; }
.plain-list li { padding: 5px 0; }

/* Reviews and comments */
.review, .comment { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-top: 14px; }
.review h3 { margin-bottom: .25em; }
.review .prose :last-child, .comment .prose :last-child { margin-bottom: 0; }
.review-for { font-weight: 600; margin-bottom: .3em; }
.review-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(280px, 100%), 1fr)); gap: 14px; }
.review-card { margin-top: 0; }
.comment p { margin-bottom: .4em; }
.comment-pending { border-style: dashed; }
.post-box { margin: 10px 0 18px; }
.post-box > summary { display: inline-block; list-style: none; }
.post-box > summary::-webkit-details-marker { display: none; }
.post-box[open] > summary { margin-bottom: 14px; }
.spoiler summary { cursor: pointer; font-weight: 600; }
.spoiler[open] summary { margin-bottom: 8px; }
.report-box { margin-top: 8px; font-size: .85rem; color: var(--muted); }
.report-box summary { cursor: pointer; }
.report-form { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.report-form input { flex: 1 1 200px; width: auto !important; }
.two-col { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 32px; margin-top: 16px; }
@media (max-width: 760px) { .two-col { grid-template-columns: minmax(0, 1fr); } }
.pagination { display: flex; justify-content: center; align-items: center; gap: 16px; margin-top: 28px; flex-wrap: wrap; }

/* Admin */
.admin-nav { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 22px; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.admin-nav a { padding: 5px 12px; border-radius: var(--radius); text-decoration: none; color: var(--text); }
.admin-nav a:hover { background: var(--surface-2); }
.admin-nav a.is-active { background: var(--accent); color: var(--on-accent); }
.page-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.page-head h1 { margin: 0; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; margin-bottom: 28px; }
.stat { display: block; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; color: var(--text); text-decoration: none; }
a.stat:hover { background: var(--surface-2); }
.stat strong { display: block; font-size: 1.9rem; line-height: 1.1; }
.stat.attention { border-color: var(--accent); }
.nowrap { white-space: nowrap; }
.table-wrap { position: relative; overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
th { font-size: .85rem; color: var(--muted); white-space: nowrap; }
td form { margin: 0; display: inline; }
.table-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.tag { display: inline-block; font-size: .78rem; font-weight: 600; padding: 1px 8px; border-radius: 999px; background: var(--surface-2); color: var(--text); white-space: nowrap; }
.tag-warn { background: var(--warn-bg); color: var(--warn-text); }
.tag-bad { background: var(--err-bg); color: var(--err-text); }
.tag-good { background: var(--ok-bg); color: var(--ok-text); }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 1fr)); gap: 14px; }
.wide { grid-column: 1 / -1; }
.check-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px; }
.current-image { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.current-image img { width: 80px; border-radius: 4px; }
.mod-item { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 14px; }
.mod-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.mod-actions form { margin: 0; }
.inline-form { display: flex; gap: 8px; flex-wrap: wrap; align-items: flex-end; }
.inline-form .field { flex: 1 1 140px; }
.season-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 18px; }
.edit-row > summary { cursor: pointer; }
.edit-row form { margin-top: 12px; }
