/* ============================================================
   Boğaziçi Üniversitesi Film ve Medya Çalışmaları Enstitüsü
   Film arşivi — ana sayfa (FilmArchive New tasarımı)
   Satır içi stil yoktur; sayfa sıkı bir CSP ile sunulur.
   ============================================================ */
:root {
    --bg: #f5f6fa;
    --surface: #ffffff;
    --surface-2: #fafbfd;
    --border: #e4e7ee;
    --border-strong: #cfd4de;
    --text: #101828;
    --muted: #667085;
    --brand: #0a2b5c; /* Boğaziçi lacivert */
    --brand-2: #133e82;
    --brand-soft: #eaf0fb;
    --header: #173c77;
    --accent: #c8102e; /* Boğaziçi kırmızı */
    --accent-soft: #fdecef;
    --success: #067647;
    --success-soft: #e6f6ee;
    --warn: #b54708;
    --warn-soft: #fef0c7;
    --radius: 14px;
    --radius-sm: 9px;
    --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.05);
    --shadow: 0 6px 24px rgba(16, 24, 40, 0.07);
    --ring: 0 0 0 3px rgba(19, 62, 130, 0.18);
    --input-bg: #ffffff;
    --row-alt: #fcfcfe;
    --row-hover: #f3f7ff;
    --tag-bg: #f1f3f7;
    --tag-text: #475467;
    --chip-border: #d3def3;
    --chip-hover: #dfe8f8;
    --neutral-soft: #eef1f5;
    --neutral: #475467;
    --info: #175cd3;
    --info-soft: #e8f1fd;
    --f-dvd-bg: #e8f1fd;
    --f-dvd: #175cd3;
    --f-vhs-bg: #fdf2fa;
    --f-vhs: #c11574;
    --f-hd-bg: #ecfdf3;
    --f-hd: #067647;
    --f-vcd-bg: #fff6ed;
    --f-vcd: #c4320a;
    --tip-bg: #0f1b3d;
    --hero-from: var(--header);
    --hero-to: var(--brand);
    color-scheme: light;
}

/* Koyu tema: başlıktaki düğmeyle ya da cihazın ayarıyla (seçim yapılmamışsa). */
:root[data-theme='dark'] {
    --bg: #0b1220;
    --surface: #111a2b;
    --surface-2: #0f1828;
    --border: #1f2b40;
    --border-strong: #2d3b55;
    --text: #e6eaf2;
    --muted: #98a2b3;
    --brand: #3f7fe0;
    --brand-2: #8db8ff;
    --brand-soft: rgba(77, 141, 246, 0.16);
    --header: #0c1f40;
    --accent: #ff6b81;
    --accent-soft: rgba(255, 107, 129, 0.14);
    --success: #4ade80;
    --success-soft: rgba(74, 222, 128, 0.13);
    --warn: #fbbf24;
    --warn-soft: rgba(251, 191, 36, 0.14);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow: 0 6px 24px rgba(0, 0, 0, 0.35);
    --ring: 0 0 0 3px rgba(141, 184, 255, 0.3);
    --input-bg: #0c1424;
    --row-alt: #0f1828;
    --row-hover: #16233a;
    --tag-bg: #1a2539;
    --tag-text: #c3cad6;
    --chip-border: #2a3d63;
    --chip-hover: rgba(77, 141, 246, 0.26);
    --neutral-soft: #1c2638;
    --neutral: #b3bccb;
    --info: #8db8ff;
    --info-soft: rgba(77, 141, 246, 0.16);
    --f-dvd-bg: rgba(77, 141, 246, 0.18);
    --f-dvd: #9cc2ff;
    --f-vhs-bg: rgba(238, 70, 188, 0.16);
    --f-vhs: #f5a3d8;
    --f-hd-bg: rgba(74, 222, 128, 0.14);
    --f-hd: #86efac;
    --f-vcd-bg: rgba(251, 146, 60, 0.16);
    --f-vcd: #fdba74;
    --tip-bg: #26344f;
    --hero-from: #0c1f40;
    --hero-to: #08152d;
    color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
    :root:not([data-theme='light']) {
        --bg: #0b1220;
        --surface: #111a2b;
        --surface-2: #0f1828;
        --border: #1f2b40;
        --border-strong: #2d3b55;
        --text: #e6eaf2;
        --muted: #98a2b3;
        --brand: #3f7fe0;
        --brand-2: #8db8ff;
        --brand-soft: rgba(77, 141, 246, 0.16);
        --header: #0c1f40;
        --accent: #ff6b81;
        --accent-soft: rgba(255, 107, 129, 0.14);
        --success: #4ade80;
        --success-soft: rgba(74, 222, 128, 0.13);
        --warn: #fbbf24;
        --warn-soft: rgba(251, 191, 36, 0.14);
        --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
        --shadow: 0 6px 24px rgba(0, 0, 0, 0.35);
        --ring: 0 0 0 3px rgba(141, 184, 255, 0.3);
        --input-bg: #0c1424;
        --row-alt: #0f1828;
        --row-hover: #16233a;
        --tag-bg: #1a2539;
        --tag-text: #c3cad6;
        --chip-border: #2a3d63;
        --chip-hover: rgba(77, 141, 246, 0.26);
        --neutral-soft: #1c2638;
        --neutral: #b3bccb;
        --info: #8db8ff;
        --info-soft: rgba(77, 141, 246, 0.16);
        --f-dvd-bg: rgba(77, 141, 246, 0.18);
        --f-dvd: #9cc2ff;
        --f-vhs-bg: rgba(238, 70, 188, 0.16);
        --f-vhs: #f5a3d8;
        --f-hd-bg: rgba(74, 222, 128, 0.14);
        --f-hd: #86efac;
        --f-vcd-bg: rgba(251, 146, 60, 0.16);
        --f-vcd: #fdba74;
        --tip-bg: #26344f;
        --hero-from: #0c1f40;
        --hero-to: #08152d;
        color-scheme: dark;
    }
}

* {
    box-sizing: border-box;
}
html,
body {
    margin: 0;
    padding: 0;
}
body {
    font-family:
        -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue',
        Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}
main {
    flex: 1;
}
a {
    color: var(--brand-2);
    text-decoration: none;
}
a:hover {
    text-decoration: underline;
}
:focus-visible {
    outline: 3px solid #9fd4ff;
    outline-offset: 2px;
}
.icon {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    flex-shrink: 0;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}
.skip-link {
    position: absolute;
    left: 8px;
    top: -60px;
    z-index: 100;
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    background: var(--accent);
    color: #fff;
    font-weight: 600;
}
.skip-link:focus {
    top: 8px;
}

/* ============ Header ============ */
.site-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 80px;
    background: var(--header);
    color: #fff;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
@media (min-width: 1920px) {
    .site-header {
        padding: 16px 275px;
    }
}
.brand {
    display: flex;
    align-items: center;
    gap: 16px;
    color: inherit;
    text-decoration: none;
}
.brand:hover {
    text-decoration: none;
}
.brand-logo {
    width: 65px;
    height: 65px;
    object-fit: contain;
    flex-shrink: 0;
    transition: transform 0.25s;
}
.brand:hover .brand-logo {
    transform: scale(1.06);
}
.brand-text {
    display: flex;
    flex-direction: column;
    line-height: 1.15;
}
.brand-title {
    color: #fff;
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.3px;
}
.brand-sub {
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.95rem;
    font-weight: 400;
}

.site-header nav {
    display: flex;
    align-items: center;
    gap: 28px;
}
.site-header nav a,
.site-header nav .link-button {
    color: #fff;
    text-decoration: none;
    font-weight: 600;
    position: relative;
    transition: color 0.25s;
}
.site-header nav a::after,
.site-header nav .link-button::after {
    content: '';
    position: absolute;
    left: 0;
    bottom: -6px;
    width: 0;
    height: 2px;
    background: #9fd4ff;
    transition: width 0.25s;
}
.site-header nav a:hover,
.site-header nav .link-button:hover {
    color: #9fd4ff;
}
.site-header nav a:hover::after,
.site-header nav .link-button:hover::after {
    width: 100%;
}
.site-header form {
    margin: 0;
}
.link-button {
    padding: 0;
    border: 0;
    background: none;
    font: inherit;
    cursor: pointer;
}

.lang-switch {
    display: inline-flex;
    gap: 4px;
    padding: 3px;
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 999px;
}
.site-header nav .lang-switch a {
    padding: 2px 10px;
    border-radius: 999px;
    font-size: 12px;
}
.site-header nav .lang-switch a::after {
    display: none;
}
.site-header nav .lang-switch a.active {
    background: #fff;
    color: var(--header);
}

/* ============ Hero (üst bant) ============ */
.hero {
    color: #fff;
    background:
        radial-gradient(
            1200px 400px at 85% -20%,
            rgba(159, 212, 255, 0.22),
            transparent 60%
        ),
        linear-gradient(135deg, var(--hero-from) 0%, var(--hero-to) 100%);
    padding: 34px 24px 70px;
}
.hero-inner {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 24px;
    flex-wrap: wrap;
}
.hero h1 {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px 14px;
    margin: 0;
    font-size: clamp(26px, 3.4vw, 38px);
    font-weight: 800;
    letter-spacing: -0.5px;
}
.h1-tag {
    padding: 5px 14px;
    border-radius: 999px;
    border: 1px solid rgba(159, 212, 255, 0.45);
    background: rgba(159, 212, 255, 0.14);
    color: #cfe8ff;
    font-size: clamp(13px, 1.3vw, 16px);
    font-weight: 700;
    letter-spacing: 2px;
    text-transform: uppercase;
}
.hero .sub {
    margin: 6px 0 0;
    color: rgba(255, 255, 255, 0.75);
    font-size: 15px;
}

/* Sayaç kutuları (hangilerinin görüneceği yönetim panelinden seçilir) */
.stat-hero {
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
}
.stat-tile {
    --tone: #9fd4ff;
    position: relative;
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 190px;
    padding: 14px 20px 14px 14px;
    border-radius: 16px;
    background: linear-gradient(
        160deg,
        rgba(255, 255, 255, 0.14),
        rgba(255, 255, 255, 0.04)
    );
    border: 1px solid rgba(255, 255, 255, 0.16);
    box-shadow:
        0 1px 0 rgba(255, 255, 255, 0.1) inset,
        0 12px 32px rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    overflow: hidden;
    opacity: 0;
    transform: translateY(14px);
    animation: stat-in 0.7s cubic-bezier(0.2, 0.7, 0.2, 1) forwards;
    transition:
        transform 0.25s,
        border-color 0.25s;
}
.stat-tile:hover {
    border-color: rgba(255, 255, 255, 0.3);
}
.stat-tile::after {
    /* kutunun altında rengine göre ince bir şerit */
    content: '';
    position: absolute;
    left: 14px;
    right: 14px;
    bottom: 0;
    height: 3px;
    border-radius: 3px 3px 0 0;
    background: var(--tone);
    opacity: 0.85;
}
.stat-tile:nth-child(2) {
    animation-delay: 0.08s;
}
.stat-tile:nth-child(3) {
    animation-delay: 0.16s;
}
.stat-tile:nth-child(4) {
    animation-delay: 0.24s;
}
.stat-films {
    --tone: #ffd166;
}
.stat-available {
    --tone: #5ee6a8;
}
.stat-media {
    --tone: #ff9fb2;
}
.stat-records {
    --tone: #9fd4ff;
}
.stat-icon {
    display: grid;
    place-items: center;
    width: 46px;
    height: 46px;
    flex-shrink: 0;
    border-radius: 13px;
    color: var(--tone);
    background: rgba(255, 255, 255, 0.1);
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.12) inset;
}
.stat-icon .icon {
    width: 22px;
    height: 22px;
    stroke-width: 1.8;
}
.stat-body {
    display: flex;
    flex-direction: column;
    min-width: 0;
}
.stat-n {
    font-size: clamp(24px, 2.6vw, 32px);
    font-weight: 800;
    line-height: 1.05;
    letter-spacing: -0.3px;
    font-variant-numeric: tabular-nums;
    color: #fff;
}
/* Sayıların içinde akan renk (eski film arşivi sitesindeki gibi). Desteklemeyen tarayıcıda beyaz kalır. */
@supports ((-webkit-background-clip: text) or (background-clip: text)) {
    .stat-n {
        background: linear-gradient(
            90deg,
            #ffd166,
            #ff7aa2,
            #b79cff,
            #6fb6ff,
            #5ee6a8,
            #ffd166
        );
        background-size: 250% 100%;
        -webkit-background-clip: text;
        background-clip: text;
        color: transparent;
        -webkit-text-fill-color: transparent;
        animation: stat-colors 7s linear infinite;
    }
}
@keyframes stat-colors {
    to {
        background-position: 250% 0;
    }
}
/* Kutuların üzerinden açılışta bir kez geçen parıltı. */
.stat-tile::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    pointer-events: none;
    background: linear-gradient(
        115deg,
        transparent 30%,
        rgba(255, 255, 255, 0.22) 50%,
        transparent 70%
    );
    background-size: 250% 100%;
    background-position: 150% 0;
    animation: stat-shine 1.8s ease-in-out 0.6s 1 both;
}
@keyframes stat-shine {
    from {
        background-position: 150% 0;
    }
    to {
        background-position: -100% 0;
    }
}
.stat-l {
    margin-top: 4px;
    font-size: 11px;
    letter-spacing: 1.6px;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--tone);
}
@keyframes stat-in {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
.stat-n.is-pop {
    transform: scale(1.06);
    transition: transform 0.35s ease;
}

/* ============ Container ============ */
.container {
    max-width: 1400px;
    margin: -46px auto 0;
    padding: 0 24px 60px;
}

/* ============ Arama kartı ============ */
.search-card {
    position: relative;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 16px;
}
.quick {
    display: grid;
    grid-template-columns: 2.2fr 1.2fr 1fr 0.8fr auto;
    gap: 12px;
    align-items: end;
    padding: 18px;
}
.field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}
.field label,
.field legend {
    font-size: 12px;
    font-weight: 600;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 0;
}
fieldset.field {
    margin: 0;
    padding: 0;
    border: 0;
}
.search-card input[type='text'],
.search-card input[type='search'],
.search-card select {
    width: 100%;
    height: 42px;
    padding: 0 12px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-family: inherit;
    background: var(--input-bg);
    color: var(--text);
    transition:
        border-color 0.15s,
        box-shadow 0.15s;
}
.search-card input:focus,
.search-card select:focus {
    outline: none;
    border-color: var(--brand-2);
    box-shadow: var(--ring);
}
.input-icon {
    position: relative;
}
.input-icon .icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--muted);
    pointer-events: none;
}
.input-icon input {
    padding-left: 38px !important;
}

/* Detaylı arama */
.advanced {
    border-top: 1px solid var(--border);
}
.advanced summary {
    display: flex;
    align-items: baseline;
    gap: 12px;
    flex-wrap: wrap;
    padding: 13px 18px;
    cursor: pointer;
    list-style: none;
    font-weight: 700;
    color: var(--brand);
    user-select: none;
}
.advanced summary::-webkit-details-marker {
    display: none;
}
.advanced summary::before {
    content: '';
    width: 8px;
    height: 8px;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: rotate(-45deg);
    transition: transform 0.2s;
    align-self: center;
}
.advanced[open] summary::before {
    transform: rotate(45deg);
}
.advanced summary small {
    font-weight: 400;
    color: var(--muted);
}
.advanced summary:hover {
    background: var(--surface-2);
}
.advanced-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px 12px;
    padding: 4px 18px 16px;
}
.range {
    display: flex;
    align-items: center;
    gap: 8px;
}
.range span {
    color: var(--muted);
}
.check {
    display: flex;
    align-items: center;
    gap: 10px;
    align-self: end;
    height: 42px;
    font-weight: 600;
    cursor: pointer;
}
.check input {
    width: 18px;
    height: 18px;
    accent-color: var(--brand);
}
.advanced-actions {
    display: flex;
    gap: 10px;
    padding: 14px 18px;
    border-top: 1px solid var(--border);
    background: var(--surface-2);
    border-radius: 0 0 var(--radius) var(--radius);
}

/* ============ Buttons ============ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 42px;
    padding: 0 20px;
    background: var(--brand);
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition:
        background 0.15s,
        transform 0.05s;
    text-decoration: none;
    white-space: nowrap;
}
.btn:hover {
    background: var(--brand-2);
    text-decoration: none;
}
.btn:active {
    transform: translateY(1px);
}
.btn-ghost {
    background: transparent;
    color: var(--brand);
    border: 1px solid var(--border-strong);
}
.btn-ghost:hover {
    background: var(--brand-soft);
}

/* ============ Uygulanan süzgeçler ============ */
.chips {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin: 0 0 14px;
}
.chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 5px 8px 5px 12px;
    border-radius: 999px;
    background: var(--brand-soft);
    color: var(--brand);
    font-size: 13px;
    font-weight: 600;
    border: 1px solid var(--chip-border);
}
.chip:hover {
    background: var(--chip-hover);
    text-decoration: none;
}
.chip-label {
    font-weight: 400;
    color: var(--muted);
}
.chip-x {
    display: inline-grid;
    place-items: center;
    width: 18px;
    height: 18px;
    margin-left: 2px;
    border-radius: 50%;
    background: var(--brand-soft);
    font-size: 14px;
    line-height: 1;
}
.chip-clear {
    font-size: 13px;
    font-weight: 600;
    color: var(--accent);
}

/* ============ Sonuç çubuğu ============ */
.toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    padding: 2px 4px 12px;
    color: var(--muted);
    font-size: 13.5px;
}
.per-page {
    display: flex;
    align-items: center;
    gap: 4px;
}
.per-page > span:first-child {
    margin-right: 6px;
}
.per-page a,
.per-page .active {
    padding: 3px 10px;
    border-radius: 999px;
    font-weight: 600;
}
.per-page a:hover {
    background: var(--brand-soft);
    text-decoration: none;
}
.per-page .active {
    background: var(--brand);
    color: #fff;
}

/* ============ Table ============ */
.table-wrap {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    overflow-x: auto;
}
table.films {
    width: 100%;
    border-collapse: collapse;
    font-size: 13.5px;
}
table.films thead {
    background: var(--surface-2);
}
table.films th {
    position: sticky;
    top: 0;
    z-index: 2;
    box-shadow: inset 0 -1px 0 var(--border);
    text-align: left;
    padding: 12px 11px;
    font-size: 12px;
    font-weight: 700;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.4px;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
    background: var(--surface-2);
}
table.films th a.sort {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: var(--muted);
}
table.films th a.sort .arrow {
    opacity: 0.35;
    font-size: 11px;
}
table.films th a.sort:hover,
table.films th a.sorted {
    color: var(--brand);
    text-decoration: none;
}
table.films th a.sorted .arrow {
    opacity: 1;
}
table.films td {
    position: relative;
    padding: 12px 11px;
    border-bottom: 1px solid var(--border);
    vertical-align: top;
}
table.films tbody tr {
    transition: background 0.12s;
}
table.films tbody tr:nth-child(even) {
    background: var(--row-alt);
}
table.films tbody tr:hover {
    background: var(--row-hover);
}
table.films tbody tr:last-child td {
    border-bottom: none;
}
table.films .empty {
    text-align: center;
    padding: 48px;
    color: var(--muted);
    font-size: 15px;
}
.col-film {
    min-width: 200px;
}
.col-num {
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}
.col-title {
    font-weight: 600;
    color: var(--text);
}
.col-alt,
.col-muted {
    font-size: 12.5px;
    color: var(--muted);
}
.col-alt {
    margin-top: 2px;
}

.badge {
    display: inline-block;
    padding: 3px 9px;
    background: var(--brand-soft);
    color: var(--brand-2);
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.3px;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}
.tag {
    display: inline-block;
    padding: 2px 8px;
    background: var(--tag-bg);
    color: var(--tag-text);
    border-radius: 6px;
    font-size: 11.5px;
    margin: 1px 3px 1px 0;
}
.format {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 700;
    background: var(--neutral-soft);
    color: var(--neutral);
    white-space: nowrap;
}
.format-dvd {
    background: var(--f-dvd-bg);
    color: var(--f-dvd);
}
.format-vhs {
    background: var(--f-vhs-bg);
    color: var(--f-vhs);
}
.format-hd {
    background: var(--f-hd-bg);
    color: var(--f-hd);
}
.format-vcd {
    background: var(--f-vcd-bg);
    color: var(--f-vcd);
}
/* Uzun hücreler kısaltılır; tamamı fareyle üzerine gelince görünür. */
.cell-clip {
    display: block;
    max-width: 170px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    cursor: default;
}
.cell-clip-wide {
    max-width: 230px;
}
.cell-clip:focus-visible {
    outline-offset: 0;
}

/* Format ve altyazı tek satırda */
.format-line {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: nowrap;
}
.cc {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 11.5px;
    color: var(--muted);
    white-space: nowrap;
    cursor: default;
}
.cc abbr {
    padding: 0 4px;
    border: 1px solid var(--border-strong);
    border-radius: 4px;
    font-size: 9.5px;
    font-weight: 800;
    letter-spacing: 0.3px;
    line-height: 14px;
    text-decoration: none;
}
.cc-more {
    font-weight: 600;
}

/* Ödünç durumu */
.loan {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}
.loan::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
}
.loan-ok {
    background: var(--success-soft);
    color: var(--success);
}
.loan-out {
    background: var(--warn-soft);
    color: var(--warn);
}
.loan-soon {
    background: var(--info-soft);
    color: var(--info);
}
.loan-ref {
    background: var(--neutral-soft);
    color: var(--neutral);
}
.loan-until {
    display: block;
    margin-top: 3px;
    font-size: 11.5px;
    color: var(--muted);
    white-space: nowrap;
}
.loan-none {
    color: var(--muted);
}

/* Kısaltılmış hücrenin tamamı (app.js, sayfanın üstünde çizilir) */
.cell-tip {
    position: fixed;
    z-index: 60;
    max-width: 420px;
    padding: 8px 12px;
    border-radius: 8px;
    background: var(--tip-bg);
    color: #fff;
    font-size: 12.5px;
    line-height: 1.45;
    box-shadow: 0 8px 24px rgba(15, 27, 61, 0.3);
    pointer-events: none;
}
.cell-tip[hidden] {
    display: none;
}

/* ============ Arama önerileri ============ */
.suggest-list {
    position: absolute;
    left: 0;
    right: 0;
    top: calc(100% + 6px);
    z-index: 40;
    margin: 0;
    padding: 6px;
    list-style: none;
    max-height: 360px;
    overflow-y: auto;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow);
}
.suggest-list[hidden] {
    display: none;
}
.suggest-head {
    padding: 8px 10px 4px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    color: var(--muted);
}
.suggest-item {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    padding: 8px 10px;
    border-radius: 7px;
    cursor: pointer;
}
.suggest-item:hover,
.suggest-item[aria-selected='true'] {
    background: var(--brand-soft);
}
.sg-main {
    font-weight: 600;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.sg-sub {
    flex-shrink: 0;
    max-width: 50%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 12px;
    color: var(--muted);
}

/* ============ Tema düğmesi ============ */
.theme-toggle {
    display: inline-grid;
    place-items: center;
    width: 34px;
    height: 34px;
    padding: 0;
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 50%;
    background: transparent;
    color: #fff;
    cursor: pointer;
    transition: background 0.2s;
}
.theme-toggle:hover {
    background: rgba(255, 255, 255, 0.12);
}
.theme-toggle .icon {
    width: 16px;
    height: 16px;
}
.theme-toggle .icon-sun {
    display: none;
}
:root[data-theme='dark'] .theme-toggle .icon-sun {
    display: block;
}
:root[data-theme='dark'] .theme-toggle .icon-moon {
    display: none;
}
@media (prefers-color-scheme: dark) {
    :root:not([data-theme='light']) .theme-toggle .icon-sun {
        display: block;
    }
    :root:not([data-theme='light']) .theme-toggle .icon-moon {
        display: none;
    }
}

/* ============ Pagination ============ */
.pagination {
    display: flex;
    gap: 6px;
    align-items: center;
    flex-wrap: wrap;
    padding: 22px 0 0;
    justify-content: center;
}
.pagination a,
.pagination span {
    padding: 8px 12px;
    border-radius: 9px;
    background: var(--surface);
    color: var(--text);
    border: 1px solid var(--border);
    font-size: 13px;
    min-width: 38px;
    text-align: center;
}
.pagination a:hover {
    background: var(--brand-soft);
    color: var(--brand);
    border-color: var(--brand-2);
    text-decoration: none;
}
.pagination .active {
    background: var(--brand);
    color: #fff;
    border-color: var(--brand);
    font-weight: 700;
}
.pagination .gap {
    min-width: 0;
    padding: 8px 2px;
    border: 0;
    background: none;
    color: var(--muted);
}
.pager {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    padding-top: 22px;
}
.pager .pagination {
    padding: 0;
    justify-content: flex-start;
}
.goto {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--muted);
}
.goto input {
    width: 84px;
    height: 36px;
    padding: 0 10px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    background: var(--input-bg);
    color: var(--text);
    font: inherit;
    font-variant-numeric: tabular-nums;
}
.goto input:focus {
    outline: none;
    border-color: var(--brand-2);
    box-shadow: var(--ring);
}
.btn-sm {
    height: 36px;
    padding: 0 14px;
}

/* ============ Footer ============ */
.site-footer {
    border-top: 1px solid var(--border);
    background: var(--surface);
    color: var(--muted);
    font-size: 13px;
}
.footer-inner {
    max-width: 1400px;
    margin: 0 auto;
    padding: 18px 24px;
    display: flex;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

/* ============ Responsive ============ */
/* Geniş ekranda tablo kaydırma kutusuna alınmaz; böylece başlık satırı sayfa kayarken üstte kalır. */
@media (min-width: 1200px) {
    .table-wrap {
        overflow: visible;
    }
    table.films thead th:first-child {
        border-top-left-radius: var(--radius);
    }
    table.films thead th:last-child {
        border-top-right-radius: var(--radius);
    }
}

@media (max-width: 1100px) {
    .quick {
        grid-template-columns: 1fr 1fr 1fr;
    }
    .field-q {
        grid-column: 1 / -1;
    }
    .advanced-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}
@media (max-width: 900px) {
    .site-header {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
        padding: 14px 16px;
    }
    .brand {
        gap: 12px;
    }
    .brand-logo {
        width: 46px;
        height: 46px;
    }
    .brand-title {
        font-size: 1.2rem;
    }
    .brand-sub {
        font-size: 0.85rem;
        line-height: 1.3;
    }
    .site-header nav {
        flex-wrap: wrap;
        justify-content: space-between;
        gap: 10px 18px;
        padding-top: 10px;
        border-top: 1px solid rgba(255, 255, 255, 0.12);
        font-size: 0.95rem;
    }
    .site-header nav a::after,
    .site-header nav .link-button::after {
        bottom: -3px;
    }
    .site-header nav .lang-switch {
        margin-left: auto;
    }
    .hero {
        padding: 24px 16px 64px;
    }
    .stat-tile {
        min-width: 0;
        flex: 1;
        gap: 10px;
        padding: 10px 12px 12px 10px;
    }
    .stat-icon {
        width: 36px;
        height: 36px;
        border-radius: 10px;
    }
    .stat-icon .icon {
        width: 18px;
        height: 18px;
    }
    .container {
        padding: 0 14px 40px;
    }

    /* Tablo telefonda kartlara dönüşür; her hücre başlığını kendi taşır. */
    .table-wrap {
        background: transparent;
        border: 0;
        box-shadow: none;
        overflow: visible;
    }
    table.films,
    table.films tbody,
    table.films tr,
    table.films td {
        display: block;
        width: 100%;
    }
    table.films thead {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip: rect(0, 0, 0, 0);
    }
    table.films tbody tr,
    table.films tbody tr:nth-child(even) {
        margin-bottom: 12px;
        padding: 12px 14px;
        background: var(--surface);
        border: 1px solid var(--border);
        border-radius: var(--radius);
        box-shadow: var(--shadow-sm);
    }
    table.films td {
        display: grid;
        grid-template-columns: 110px 1fr;
        gap: 10px;
        padding: 6px 0;
        border-bottom: 1px dashed var(--border);
    }
    table.films td:last-child {
        border-bottom: 0;
    }
    table.films td::before {
        content: attr(data-label);
        font-size: 11.5px;
        font-weight: 700;
        color: var(--muted);
        text-transform: uppercase;
        letter-spacing: 0.4px;
        padding-top: 2px;
    }
    table.films td.is-empty {
        display: none;
    }
    table.films .empty-row td {
        display: block;
    }
    table.films .empty-row td::before {
        display: none;
    }
    .cell-clip,
    .cell-clip-wide {
        max-width: none;
        white-space: normal;
    }
}
@media (max-width: 600px) {
    .quick,
    .advanced-grid {
        grid-template-columns: 1fr;
    }
    .stat-hero {
        width: 100%;
    }
    .footer-inner {
        flex-direction: column;
    }
}

@media (prefers-reduced-motion: reduce) {
    .stat-tile {
        animation: none !important;
    }
    .stat-tile {
        opacity: 1;
        transform: none;
    }
}
/* Üst menüdeki dış bağlantılar */
.site-header nav .ext {
    margin-left: 3px;
    font-size: 0.8em;
    opacity: 0.7;
}
@media (min-width: 901px) and (max-width: 1199px) {
    .site-header nav {
        gap: 18px;
    }
}
/* ============ Üst bant görselleri (panelden yönetilir) ============ */
.hero.has-media {
    position: relative;
    overflow: hidden;
    isolation: isolate;
    min-height: 300px;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
}
.hero-media {
    position: absolute;
    inset: 0;
    z-index: -2;
    background: var(--hero-to);
}
.hero-slide {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0;
    transform: scale(1.04);
    transition:
        opacity 1.2s ease,
        transform 8s ease-out;
}
.hero-slide.is-active {
    opacity: 1;
    transform: scale(1);
}
.hero.has-media::before {
    /* yazı ve sayaçlar her görselde okunabilsin */
    content: '';
    position: absolute;
    inset: 0;
    z-index: -1;
    background:
        linear-gradient(
            90deg,
            rgba(8, 21, 45, 0.86) 0%,
            rgba(8, 21, 45, 0.55) 55%,
            rgba(8, 21, 45, 0.35) 100%
        ),
        linear-gradient(0deg, rgba(8, 21, 45, 0.7) 0%, transparent 60%);
}
.hero.has-media .hero-inner {
    width: 100%;
}
.hero.has-media h1,
.hero.has-media .sub {
    text-shadow: 0 2px 12px rgba(0, 0, 0, 0.35);
}
.stat-tile:nth-child(4) {
    animation-delay: 0.24s;
}
.stat-pages {
    --tone: #c9a7ff;
}
.stat-of {
    font-size: 0.6em;
    font-weight: 600;
    opacity: 0.7;
}
@media (max-width: 600px) {
    .hero.has-media {
        min-height: 240px;
    }
}
@media (prefers-reduced-motion: reduce) {
    .hero-slide {
        transition: none;
        transform: none;
    }
}

/* Görsel geçiş düğmeleri */
.hero-controls {
    position: absolute;
    top: 14px;
    right: 24px;
    z-index: 2;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 10px;
    border-radius: 999px;
    background: rgba(8, 21, 45, 0.45);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}
.hero-dot {
    width: 9px;
    height: 9px;
    padding: 0;
    border: 0;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.45);
    cursor: pointer;
    transition:
        width 0.3s,
        background 0.3s;
}
.hero-dot:hover {
    background: rgba(255, 255, 255, 0.8);
}
.hero-dot[aria-current='true'] {
    width: 24px;
    background: #fff;
}
.hero-dot:focus-visible {
    outline: 2px solid #9fd4ff;
    outline-offset: 2px;
}

/* Telefon: daha kısa bant, sayaçlar simgesiz ve tek satırda. */
@media (max-width: 600px) {
    .hero,
    .hero.has-media {
        min-height: 0;
        padding: 18px 14px 56px;
    }
    .hero-inner {
        gap: 14px;
    }
    .hero h1 {
        font-size: 24px;
        gap: 4px 10px;
    }
    .h1-tag {
        padding: 3px 10px;
        font-size: 11px;
        letter-spacing: 1.5px;
    }
    .hero .sub {
        font-size: 13px;
    }
    .stat-hero {
        flex-wrap: nowrap;
        gap: 8px;
    }
    .stat-tile {
        flex: 1 1 0;
        min-width: 0;
        padding: 8px 10px 10px;
        border-radius: 12px;
    }
    .stat-icon {
        display: none;
    }
    .stat-n {
        font-size: 19px;
        white-space: nowrap;
    }
    .stat-of {
        font-size: 0.7em;
    }
    .stat-l {
        margin-top: 3px;
        font-size: 9.5px;
        letter-spacing: 1px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    .hero-controls {
        top: 10px;
        right: 10px;
        padding: 6px 8px;
    }
    .hero.has-media {
        padding-top: 22px;
    }
    /* Arama kartı bandın üzerine 46px biner; sayaçlar kesilmesin. */
    .hero,
    .hero.has-media {
        padding-bottom: 66px;
    }
    /* Arama formu: ara tam satır, tür+format ve yıl+düğme yan yana. */
    .quick {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
        padding: 14px;
    }
    .quick .field-q {
        grid-column: 1 / -1;
    }
}
@media (prefers-reduced-motion: reduce) {
    .stat-n,
    .stat-tile::before {
        animation: none !important;
    }
    .stat-tile::before {
        display: none;
    }
}
