/**
 * Cinema theme — docs/revamp/README.md
 *
 * Sets the Cinema palette on the semantic tokens of layout-site/master.css and on the older
 * token names (--bg-card, --text-primary...) that page CSS still reads, and skins the Bootstrap
 * components the pages use. The global chrome is in layout-site/chrome.css.
 * Rules use `.theme-cinema` (and `body.theme-cinema` where a later stylesheet must be beaten).
 */

/* ================== TOKENS ================== */
:root {
    --cinema-bg: #0b0b0e;
    --cinema-surface: #15151b;
    --cinema-surface-2: #1d1d25;
    --cinema-surface-3: #26262f;
    --cinema-field: #0f0f13;
    --cinema-line: #26262f;
    --cinema-line-soft: #23232c;
    --cinema-line-strong: #3a3a46;
    --cinema-text: #f2efe9;
    --cinema-text-2: #b3aeb8;
    --cinema-text-nav: #d6d2da;
    --cinema-accent: #f5b83d;
    --cinema-accent-hover: #ffc95e;
    --cinema-accent-soft: rgba(245, 184, 61, 0.14);
    --cinema-accent-ring: rgba(245, 184, 61, 0.28);
    --cinema-ink: #0b0b0e;
    --cinema-success: #5fd08a;
    --cinema-danger: #ff6b6b;
    --cinema-radius: 12px;
    --cinema-radius-sm: 6px;
    --cinema-font-display: 'Bebas Neue', 'Oswald', 'Arial Narrow', sans-serif;
    --cinema-font-body: 'DM Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;

    /* Semantic tokens of master.css that Cinema styles differently */
    --font-display: var(--cinema-font-display);
    --font-display-weight: 400;
    --font-body: var(--cinema-font-body);
    --on-accent: #0b0b0e;
    --surface-3: #26262f;
    --line-strong: #3a3a46;
    --field-bg: #0f0f13;
    --field-line: #4a4654;
    --success: #5fd08a;
    --danger: #ff6b6b;

    /* Older token names that page CSS still reads */
    --primary-color: #f5b83d;
    --primary-hover: #ffc95e;
    --primary-light: #ffd27a;
    --primary-dark: #d99a1f;
    --secondary-color: #b3aeb8;
    --secondary-hover: #d6d2da;
    --secondary-light: #d6d2da;
    --secondary-dark: #8e8994;
    --accent-color: #f5b83d;
    --accent-hover: #ffc95e;
    --bg-primary: #0b0b0e;
    --bg-secondary: #15151b;
    --bg-tertiary: #1d1d25;
    --bg-card: #15151b;
    --bg-hover: #1d1d25;
    --text-primary: #f2efe9;
    --text-secondary: #d6d2da;
    --text-muted: #b3aeb8;
    --text-link: #ffd27a;
    --border-color: #26262f;
    --border-light: #3a3a46;
    --gradient-primary: linear-gradient(135deg, #1d1d25 0%, #15151b 100%);
    --gradient-secondary: linear-gradient(135deg, #26262f 0%, #1d1d25 100%);
    --gradient-header: linear-gradient(180deg, #15151b 0%, #0b0b0e 100%);
    --gradient-card: linear-gradient(180deg, #15151b 0%, #15151b 100%);
    --overlay-dark: rgba(11, 11, 14, 0.8);
    --overlay-light: rgba(21, 21, 27, 0.8);
    --theme-gradient-start: #1d1d25;
    --theme-gradient-end: #15151b;
}

/* ================== BASE ================== */
.site-module.theme-cinema {
    background: var(--cinema-bg);
    color: var(--cinema-text);
    font-family: var(--cinema-font-body);
    -webkit-font-smoothing: antialiased;
}

.theme-cinema ::selection {
    background: var(--cinema-accent);
    color: var(--cinema-ink);
}

/* Heading defaults stay at element specificity so component classes (media kit, pages) win */
:where(.theme-cinema) h1,
:where(.theme-cinema) .h1,
:where(.theme-cinema) h2,
:where(.theme-cinema) .h2 {
    font-family: var(--cinema-font-display);
    letter-spacing: 0.01em;
    line-height: 1.05;
}

/* Bebas Neue has a single weight: Bootstrap's .fw-bold would fake-bold it. Headings set in the
   text font opt out with .heading-sans (media-kit.css). */
body.theme-cinema :is(h1, .h1, h2, .h2):not(.heading-sans) {
    font-weight: 400 !important;
}

:where(.theme-cinema) h1,
:where(.theme-cinema) .h1 {
    font-size: calc(1.9rem + 1.4vw);
}

:where(.theme-cinema) h2,
:where(.theme-cinema) .h2 {
    font-size: calc(1.5rem + 0.8vw);
}

:where(.theme-cinema) h3,
:where(.theme-cinema) h4,
:where(.theme-cinema) h5,
:where(.theme-cinema) h6 {
    font-family: var(--cinema-font-body);
    letter-spacing: 0;
}

/* Plain text links (buttons and nav items carry classes and keep their own colors) */
:where(.theme-cinema) a:not([class]) {
    color: var(--primary-light);
}

:where(.theme-cinema) a:not([class]):hover {
    color: var(--cinema-accent-hover);
}

.theme-cinema :focus-visible {
    outline: 2px solid var(--cinema-accent);
    outline-offset: 2px;
}

body.theme-cinema .text-muted,
body.theme-cinema .text-white-50 {
    color: var(--cinema-text-2) !important;
}

body.theme-cinema .text-primary {
    color: var(--cinema-accent) !important;
}

body.theme-cinema .text-success {
    color: var(--cinema-success) !important;
}

body.theme-cinema .text-danger {
    color: var(--cinema-danger) !important;
}

.theme-cinema hr {
    border-color: var(--cinema-line);
    opacity: 1;
}

/* Eyebrow / kicker label used across the Cinema screens */
.theme-cinema .cinema-eyebrow {
    font-family: var(--cinema-font-body);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--cinema-text-2);
}

/* ================== MENUS & DROPDOWNS ================== */
/* Bootstrap dropdowns; the header's menus are in layout-site/chrome.css */
.theme-cinema .dropdown-menu {
    background: var(--cinema-surface-2);
    border: 1px solid var(--cinema-line-strong);
    border-radius: 10px;
    box-shadow: 0 24px 48px -16px rgba(0, 0, 0, 0.85);
    padding: 0.4rem;
}

.theme-cinema .dropdown-item {
    color: var(--cinema-text-nav);
    border-radius: var(--cinema-radius-sm);
    font-size: 0.9rem;
}

.theme-cinema .dropdown-item:hover,
.theme-cinema .dropdown-item:focus {
    background: var(--cinema-surface-3);
    color: var(--cinema-text);
    transform: none;
}

.theme-cinema .dropdown-item.active,
.theme-cinema .dropdown-item:active {
    background: var(--cinema-accent-soft);
    color: var(--cinema-text);
}

.theme-cinema .dropdown-item.active i,
.theme-cinema .dropdown-item:active i {
    color: var(--cinema-accent);
}

.theme-cinema .dropdown-divider {
    border-top-color: var(--cinema-line-strong);
}

.theme-cinema .dropdown-toggle::after {
    color: var(--cinema-text-nav) !important;
    border-top-color: var(--cinema-text-nav) !important;
}

/* ================== CONTENT ================== */
.theme-cinema .site-content {
    padding: 2.25rem 0 2rem;
}

.theme-cinema .site-content--bleed {
    padding-top: 0;
}

/* ================== BUTTONS ================== */
/* Page buttons are the media kit's .kit-button (components/media-kit.css) */
body.theme-cinema .btn-close {
    filter: invert(1) grayscale(1) brightness(1.6);
}

/* ================== FORMS ================== */
body.theme-cinema .form-control,
body.theme-cinema .form-select {
    background-color: var(--cinema-field);
    border: 1px solid var(--field-line);
    border-radius: var(--cinema-radius-sm);
    color: var(--cinema-text);
    font-family: var(--cinema-font-body);
}

body.theme-cinema .form-control:focus,
body.theme-cinema .form-select:focus {
    background-color: var(--cinema-field);
    border-color: var(--cinema-accent);
    box-shadow: 0 0 0 3px var(--cinema-accent-ring);
    color: var(--cinema-text);
}

body.theme-cinema .form-control::placeholder {
    color: var(--cinema-text-2);
    opacity: 1;
}

body.theme-cinema .form-control:disabled,
body.theme-cinema .form-select:disabled {
    background-color: var(--cinema-surface);
    color: var(--cinema-text-2);
}

/* Bootstrap's arrow is dark. Page CSS that sets the `background` shorthand also resets its position,
   size and repeat, so all four come back together */
body.theme-cinema .form-select {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23b3aeb8' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 16px 12px;
}

/* Multi-selects and list boxes have no dropdown, so no arrow (Bootstrap's own reset loses to the rule above) */
body.theme-cinema .form-select[multiple],
body.theme-cinema .form-select[size]:not([size="1"]) {
    padding-right: 0.75rem;
    background-image: none;
}

body.theme-cinema .form-select option {
    background: var(--cinema-surface-2);
    color: var(--cinema-text);
}

.theme-cinema .form-label,
.theme-cinema label {
    color: var(--cinema-text-nav);
}

.theme-cinema .form-text {
    color: var(--cinema-text-2);
}

body.theme-cinema .form-check-input {
    background-color: var(--cinema-field);
    border-color: var(--cinema-line-strong);
}

body.theme-cinema .form-check-input:focus {
    border-color: var(--cinema-accent);
    box-shadow: 0 0 0 3px var(--cinema-accent-ring);
}

body.theme-cinema .form-check-input:checked {
    background-color: var(--cinema-accent);
    border-color: var(--cinema-accent);
}

body.theme-cinema .form-check-input[type="checkbox"]:checked {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3e%3cpath fill='none' stroke='%230b0b0e' stroke-linecap='round' stroke-linejoin='round' stroke-width='3' d='M6 10l3 3l6-6'/%3e%3c/svg%3e");
}

body.theme-cinema .form-check-input[type="radio"]:checked {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3e%3ccircle r='2' fill='%230b0b0e'/%3e%3c/svg%3e");
}

body.theme-cinema .form-switch .form-check-input {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3e%3ccircle r='3' fill='%23b3aeb8'/%3e%3c/svg%3e");
}

body.theme-cinema .form-switch .form-check-input:checked {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3e%3ccircle r='3' fill='%230b0b0e'/%3e%3c/svg%3e");
}

body.theme-cinema .input-group-text {
    background: var(--cinema-surface-2);
    border-color: #34343f;
    color: var(--cinema-text-2);
}

.theme-cinema input[type="date"],
.theme-cinema input[type="month"] {
    color-scheme: dark;
}

/* Chrome paints autofilled fields light; keep them in the field colors */
.theme-cinema input:-webkit-autofill,
.theme-cinema textarea:-webkit-autofill,
.theme-cinema select:-webkit-autofill {
    -webkit-box-shadow: 0 0 0 100px var(--cinema-field) inset;
    -webkit-text-fill-color: var(--cinema-text);
    caret-color: var(--cinema-text);
}

.theme-cinema input:-webkit-autofill:focus,
.theme-cinema textarea:-webkit-autofill:focus {
    -webkit-box-shadow: 0 0 0 100px var(--cinema-field) inset, 0 0 0 3px var(--cinema-accent-ring);
}

/* ================== SURFACES ================== */
body.theme-cinema .card {
    background: var(--cinema-surface);
    border: 1px solid var(--cinema-line) !important;
    border-radius: var(--cinema-radius);
    box-shadow: none;
    color: var(--cinema-text);
}

body.theme-cinema .card:hover {
    box-shadow: none;
    border-color: var(--cinema-line-strong);
}

.theme-cinema .card-header {
    background: var(--cinema-surface-2);
    border-bottom: 1px solid var(--cinema-line);
    color: var(--cinema-text);
}

.theme-cinema .card-footer {
    background: var(--cinema-surface);
    border-top: 1px solid var(--cinema-line);
}

body.theme-cinema .card-body {
    background: transparent;
}

.theme-cinema .list-group-item {
    background: var(--cinema-surface);
    border-color: var(--cinema-line);
    color: var(--cinema-text);
}

.theme-cinema .list-group-item:hover {
    background: var(--cinema-surface-2);
}

.theme-cinema .list-group-item.active {
    background: var(--cinema-accent-soft);
    border-color: var(--cinema-accent);
    color: var(--cinema-text);
}

.theme-cinema .table {
    --bs-table-bg: transparent;
    --bs-table-striped-bg: rgba(242, 239, 233, 0.03);
    --bs-table-hover-bg: var(--cinema-surface-2);
    color: var(--cinema-text);
    background: transparent;
    border-color: var(--cinema-line);
}

.theme-cinema .table thead th {
    background: var(--cinema-surface);
    color: var(--cinema-text-2);
    border-color: var(--cinema-line);
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.theme-cinema .table tbody tr:hover {
    background: var(--cinema-surface-2);
}

.theme-cinema .table-striped tbody tr:nth-of-type(odd) {
    background: rgba(242, 239, 233, 0.03);
}

/* ================== FEEDBACK ================== */
.theme-cinema .badge.bg-primary {
    background: var(--cinema-accent) !important;
    color: var(--cinema-ink);
}

.theme-cinema .badge.bg-secondary {
    background: var(--cinema-surface-3) !important;
    color: var(--cinema-text);
}

.theme-cinema .alert {
    border-radius: var(--cinema-radius-sm);
    background: var(--cinema-surface);
    border: 1px solid var(--cinema-line-strong);
    color: var(--cinema-text);
}

.theme-cinema .alert-success {
    background: rgba(95, 208, 138, 0.1);
    border-color: rgba(95, 208, 138, 0.5);
    color: #b7ecc9;
}

.theme-cinema .alert-danger {
    background: rgba(255, 107, 107, 0.1);
    border-color: rgba(255, 107, 107, 0.5);
    color: #ffc2c2;
}

.theme-cinema .alert-warning {
    background: var(--cinema-accent-soft);
    border-color: rgba(245, 184, 61, 0.5);
    color: #ffe0a3;
}

.theme-cinema .alert-info {
    background: rgba(111, 180, 255, 0.1);
    border-color: rgba(111, 180, 255, 0.45);
    color: #c9e2ff;
}

.theme-cinema .progress {
    background: var(--cinema-surface-3);
    border-radius: 999px;
}

.theme-cinema .progress-bar {
    background: var(--cinema-accent);
    color: var(--cinema-ink);
}

.theme-cinema .tooltip-inner {
    background: var(--cinema-surface-3);
    color: var(--cinema-text);
    border: 1px solid var(--cinema-line-strong);
}

/* ================== BREADCRUMBS ================== */
/* Bootstrap breadcrumbs; the pages use the media kit's .page-breadcrumb */
.theme-cinema .breadcrumb-item,
.theme-cinema .breadcrumb-item + .breadcrumb-item::before {
    color: var(--cinema-text-2);
}

.theme-cinema .breadcrumb-item.active {
    color: var(--cinema-text);
}

/* ================== PAGINATION ================== */
.theme-cinema .pagination {
    gap: 6px;
}

.theme-cinema .pagination .page-link {
    background: transparent;
    border: 1px solid var(--cinema-line-strong);
    border-radius: var(--cinema-radius-sm) !important;
    color: var(--cinema-text-nav);
    min-width: 40px;
    text-align: center;
}

.theme-cinema .pagination .page-link:hover {
    background: var(--cinema-surface-2);
    border-color: var(--cinema-line-strong);
    color: var(--cinema-text);
}

.theme-cinema .pagination .page-item.active .page-link {
    background: var(--cinema-accent);
    border-color: var(--cinema-accent);
    color: var(--cinema-ink);
    font-weight: 700;
}

.theme-cinema .pagination .page-item.disabled .page-link {
    background: transparent;
    border-color: var(--cinema-line);
    color: #6e6977;
}

/* ================== SCROLLBAR ================== */
.theme-cinema ::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

.theme-cinema ::-webkit-scrollbar-track {
    background: var(--cinema-bg);
}

.theme-cinema ::-webkit-scrollbar-thumb {
    background: var(--cinema-surface-3);
    border-radius: 5px;
}

.theme-cinema ::-webkit-scrollbar-thumb:hover {
    background: var(--cinema-line-strong);
}

@media (prefers-reduced-motion: reduce) {
    .theme-cinema *,
    .theme-cinema *::before,
    .theme-cinema *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}
