/*
Theme Name: ThemeJAV
Theme URI: https://avxee.com
Author: Anonymous
Description: AVX dark/red video theme (design tokens and components taken from public/assets/css/avx-theme.css). Standalone CSS - no Bootstrap/jQuery needed. Semantic HTML, built-in SEO.
Version: 4.0.0
License: GPL-2.0+
Text Domain: adult-theme
*/

/* ==================== TOKENS (from avx-theme.css) ==================== */
:root {
    color-scheme: dark;
    --primary: var(--primary-color, #e50914);
    --primary-dark: #b20710;
    --primary-rgb: 229, 9, 20;
    --primary-soft: rgba(var(--primary-rgb), 0.12);
    --secondary: #141414;
    --surface: #1f1f1f;
    --surface-light: #2a2a2a;
    --text: #ffffff;
    --text-muted: #b3b3b3;
    --text-dim: #8c8c8c;
    --border: #333333;
    --success: #46d369;
    --radius: 8px;
    --radius-lg: 12px;
    --shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    --shadow-red: 0 4px 20px rgba(var(--primary-rgb), 0.3);
    --heading: #ffffff;
    --prose: #d9d9d9;
    --link: #ff5a62;
    --link-hover: #ff8187;
    --bg-deep: #0d0d0d;
    --drawer-bg: #181818;
    --header-bg: rgba(20, 20, 20, 0.95);
    --overlay-bg: rgba(10, 10, 10, 0.97);
    --hover-bg: rgba(255, 255, 255, .06);
    --hover-bg-2: rgba(255, 255, 255, .1);
    --navbar-h: 64px;
    --bar-h: 60px;
    --gutter: 24px;
    --font: 'Kanit', 'Noto Sans Thai', 'Leelawadee UI', system-ui, -apple-system, 'Segoe UI', Tahoma, sans-serif;
}
@media (max-width: 991.98px) { :root { --gutter: 14px; } }

/* ==================== BASE ==================== */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; overflow-x: hidden; }
body {
    margin: 0; background: var(--secondary); color: var(--text);
    font-family: var(--font); font-size: 16px; line-height: 1.6;
    -webkit-font-smoothing: antialiased; overflow-x: hidden; max-width: 100vw;
}
body.drawer-open, body.no-scroll { overflow: hidden; }
::selection { background: rgba(var(--primary-rgb), 0.45); color: #fff; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--secondary); }
::-webkit-scrollbar-thumb { background: #444; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #555; }
img, svg, video, iframe { max-width: 100%; }
img { height: auto; display: block; }
a { color: var(--link); text-decoration: none; }
a:hover { color: var(--link-hover); }
p { margin: 0 0 1em; }
ul, ol { margin: 0; padding: 0; list-style: none; }
h1, h2, h3, h4, h5, h6 { margin: 0 0 .5em; font-weight: 600; line-height: 1.3; color: var(--heading); }
h1 { font-size: clamp(1.4rem, 1.1rem + 1.2vw, 1.9rem); }
h2 { font-size: clamp(1.1rem, 1rem + .5vw, 1.3rem); }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: 4px; }

.container { width: min(100% - (var(--gutter) * 2), 1440px); margin-inline: auto; }
.sr-only {
    position: absolute !important; 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: var(--gutter); top: -120px; z-index: 2000; background: var(--primary); color: #fff; padding: .6rem 1rem; border-radius: var(--radius); }
.skip-link:focus { top: .75rem; color: #fff; }
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

/* ==================== BUTTONS ==================== */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    padding: .55rem 1.25rem; border: 1px solid transparent; border-radius: var(--radius);
    font-weight: 600; transition: all .2s;
}
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); color: #fff; box-shadow: var(--shadow-red); }
.btn-outline { border-color: var(--border); color: var(--text-muted); }
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }

/* ==================== NAVBAR ==================== */
.site-header {
    position: sticky; top: 0; z-index: 1030;
    background: var(--header-bg); /* no backdrop-filter: it would trap the fixed mobile drawer inside the header */
    border-bottom: 1px solid var(--border);
}
body.admin-bar .site-header { top: 32px; }
@media (max-width: 782px) { body.admin-bar .site-header { top: 46px; } }

.site-header__bar { height: var(--navbar-h); display: flex; align-items: center; gap: 20px; }
.brand { margin: 0; flex-shrink: 0; }
.brand a {
    display: inline-flex; align-items: center; gap: 8px; color: var(--primary);
    font-size: 1.6rem; font-weight: 700; letter-spacing: -.3px;
}
.brand a:hover { color: var(--primary); }
.brand__mark { width: 30px; height: 30px; display: inline-grid; place-items: center; background: var(--primary); color: #fff; border-radius: 8px; }
.brand__mark svg { width: 16px; height: 16px; margin-left: 2px; }
.brand img { height: 34px; width: auto; max-width: 170px; object-fit: contain; }

.primary-nav { flex: 1; min-width: 0; }
.primary-nav .menu { display: flex; flex-wrap: wrap; gap: 2px; }
.primary-nav a {
    display: block; padding: 8px 14px; border-radius: var(--radius);
    color: var(--text-muted); font-weight: 500; font-size: .95rem; transition: all .2s;
}
.primary-nav a:hover { background: var(--hover-bg); color: var(--heading); }
.primary-nav .current-menu-item > a, .primary-nav .current-cat > a, .primary-nav .current-menu-ancestor > a { background: rgba(var(--primary-rgb), .1); color: var(--primary); }
.drawer-head { display: none; }

.header-actions { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.nav-search { display: none; }
@media (min-width: 992px) {
    :root { --navbar-h: 112px; }
    #search-toggle { display: none; }
    /* desktop: row 1 = logo | centered search ; row 2 = menu */
    .site-header__bar {
        height: auto; display: grid; align-items: center; column-gap: 24px;
        grid-template-columns: 1fr minmax(0, 560px) 1fr;
        grid-template-areas: "brand search ." "nav nav nav";
        padding-top: 10px;
    }
    .brand { grid-area: brand; }
    .header-actions { display: contents; }
    .nav-search { display: block; width: 100%; grid-area: search; }
    .primary-nav { grid-area: nav; flex: none; padding: 2px 0 6px; }
    .primary-nav .menu { justify-content: center; }
    .nav-search .search-form input[type="search"] { height: 44px; padding-left: 18px; }
    .nav-search .search-form button { top: 5px; right: 5px; }
}

.icon-btn { width: 42px; height: 42px; display: grid; place-items: center; color: var(--text); border-radius: var(--radius); transition: background .2s; }
.icon-btn:hover { background: var(--hover-bg-2); }
.icon-btn svg { width: 22px; height: 22px; }
#menu-toggle { display: none; }

/* search form (compact, like .form-control) */
.search-form { position: relative; display: flex; align-items: center; }
.search-form input[type="search"] {
    width: 100%; height: 40px; padding: 0 44px 0 14px;
    background: var(--secondary); color: var(--text); border: 1px solid var(--border); border-radius: 999px;
    font: inherit; font-size: .95rem; -webkit-appearance: none; appearance: none; transition: border-color .2s, box-shadow .2s;
}
.search-form input[type="search"]::placeholder { color: var(--text-dim); }
.search-form input[type="search"]:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(var(--primary-rgb), .15); }
.search-form input[type="search"]::-webkit-search-cancel-button { display: none; }
.search-form button { position: absolute; right: 3px; top: 3px; width: 34px; height: 34px; display: grid; place-items: center; border-radius: 50%; color: var(--text-muted); }
.search-form button:hover { background: var(--primary); color: #fff; }
.search-form svg { width: 17px; height: 17px; }

/* full-screen search (mobile) */
.search-overlay {
    position: fixed; inset: 0; z-index: 1060; background: var(--overlay-bg);
    display: flex; flex-direction: column; justify-content: center; padding: var(--gutter);
    opacity: 0; visibility: hidden; transition: opacity .25s, visibility .25s;
}
.search-overlay.is-open { opacity: 1; visibility: visible; }
.search-overlay__close { position: absolute; top: 12px; right: 12px; }
.search-overlay__inner { width: min(100%, 720px); margin-inline: auto; }
.search-overlay .page-sub { margin-bottom: 1rem; }
.search-overlay .search-form input[type="search"] { height: 54px; font-size: 1.15rem; padding-left: 20px; }
.search-overlay .search-form button { width: 44px; height: 44px; top: 5px; right: 5px; background: var(--primary); color: #fff; }

/* mobile drawer (from avx-sidebar) + overlay */
.nav-overlay {
    position: fixed; inset: 0; z-index: 1029; background: rgba(0, 0, 0, .6);
    opacity: 0; visibility: hidden; transition: opacity .3s ease, visibility .3s ease;
}
@media (max-width: 991.98px) {
    #menu-toggle { display: grid; }
    .primary-nav {
        position: fixed; top: 0; right: 0; width: 280px; max-width: 85vw; height: 100%; z-index: 1050;
        display: flex; flex-direction: column; background: var(--drawer-bg); border-left: 1px solid var(--border);
        padding: 0 0 16px; overflow-y: auto; flex: none;
        /* clip-path instead of translateX(100%): an off-screen fixed box makes mobile browsers scroll sideways */
        clip-path: inset(0 0 0 100%); visibility: hidden; pointer-events: none;
        transition: clip-path .35s cubic-bezier(.4, 0, .2, 1), visibility .35s;
    }
    .drawer-head {
        display: flex; align-items: center; justify-content: space-between; padding: 16px 20px;
        border-bottom: 1px solid var(--border); font-weight: 600; font-size: 1.1rem; color: var(--text);
    }
    .drawer-close { color: var(--text-muted); border-radius: 6px; padding: 4px; }
    .drawer-close:hover { color: var(--heading); background: var(--hover-bg-2); }
    .drawer-close svg { width: 22px; height: 22px; }
    .primary-nav .menu { flex-direction: column; padding: 12px; gap: 4px; }
    .primary-nav a { padding: 10px 12px; }
    .primary-nav .current-menu-item > a, .primary-nav .current-cat > a { box-shadow: inset 3px 0 0 var(--primary); }
    body.drawer-open .primary-nav { clip-path: inset(0 0 0 0); visibility: visible; pointer-events: auto; }
    body.drawer-open .nav-overlay { opacity: 1; visibility: visible; }
}

/* ==================== PAGE SCAFFOLD ==================== */
.site-main { padding-block: 28px 56px; min-height: 60vh; }
.page-header { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px; margin-bottom: 24px; }
.page-title { font-size: 1.6rem; font-weight: 600; display: flex; align-items: center; gap: 10px; margin: 0; }
.page-title__icon { color: var(--primary); display: inline-grid; }
.page-title__icon svg { width: 26px; height: 26px; }
.page-sub { color: var(--text-muted); margin: 4px 0 0; font-size: .95rem; }
.page-sub p:last-child { margin: 0; }
.result-count { color: var(--text-muted); font-size: .9rem; margin: 0; }
.page-header__text { min-width: 0; }

.section-title { font-size: 1.15rem; font-weight: 600; margin: 44px 0 16px; display: flex; align-items: center; gap: 10px; }
.section-title svg { width: 22px; height: 22px; color: var(--primary); }

.breadcrumbs { margin: 0 0 16px; font-size: .85rem; color: var(--text-dim); }
.breadcrumbs ol { display: flex; flex-wrap: wrap; gap: 2px 8px; }
.breadcrumbs li + li::before { content: "/"; margin-right: 8px; color: var(--border); }
.breadcrumbs a { color: var(--text-muted); font-weight: 500; }
.breadcrumbs a:hover { color: var(--primary); }
.breadcrumbs [aria-current="page"] { color: var(--text-dim); }

.surface { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); }
.badge { display: inline-block; font-weight: 500; font-size: .78rem; padding: .4em .75em; border-radius: 6px; letter-spacing: .2px; line-height: 1.2; }
.bg-label-primary { background: rgba(var(--primary-rgb), .15); color: var(--link); }
a.bg-label-primary:hover { background: var(--primary); color: #fff; }
.tag { display: inline-block; background: var(--surface-light); padding: 4px 12px; border-radius: 20px; font-size: .85rem; border: 1px solid var(--border); color: var(--text); transition: all .2s; }
a.tag:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-soft); }
.tag-list { display: flex; flex-wrap: wrap; gap: 8px; }

/* ==================== VIDEO GRID + CARD ==================== */
.grid-cards { display: grid; gap: 16px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 640px)  { .grid-cards { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; } }
@media (min-width: 1100px) { .grid-cards { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (min-width: 1500px) { .grid-cards { grid-template-columns: repeat(5, minmax(0, 1fr)); } }

.card {
    position: relative; display: flex; flex-direction: column;
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden;
    transition: transform .25s ease, border-color .25s ease, box-shadow .25s ease;
}
.card:hover, .card:focus-within { transform: translateY(-4px); border-color: var(--primary); box-shadow: var(--shadow-red); }
.card__media { position: relative; display: block; aspect-ratio: 16 / 10; background: var(--bg-deep); overflow: hidden; }
.card__img { width: 100%; height: 100%; object-fit: cover; transition: transform .5s ease; }
.card:hover .card__img { transform: scale(1.06); }
.card__ph { width: 100%; height: 100%; display: grid; place-items: center; color: var(--border); }
.card__ph svg { width: 40px; height: 40px; }
.card__play {
    position: absolute; left: 50%; top: 50%; width: 52px; height: 52px; margin: -26px 0 0 -26px; display: grid; place-items: center;
    background: var(--primary); color: #fff; border-radius: 50%; box-shadow: var(--shadow-red); opacity: 0; transform: scale(.8);
    transition: opacity .25s, transform .25s;
}
.card__play svg { width: 22px; height: 22px; margin-left: 2px; }
.card:hover .card__play, .card:focus-within .card__play { opacity: 1; transform: none; }
.card__body { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.card__cat { align-self: flex-start; position: relative; z-index: 2; max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card__title { margin: 0; font-size: .95rem; font-weight: 500; line-height: 1.45; }
.card__title a { color: var(--text); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card__title a::after { content: ""; position: absolute; inset: 0; z-index: 1; }
.card:hover .card__title a { color: var(--heading); }
.card__meta { margin: auto 0 0; font-size: .8rem; color: var(--text-dim); display: flex; align-items: center; gap: 6px; }
.card__meta svg { width: 14px; height: 14px; }

.empty-state { text-align: center; color: var(--text-muted); padding: 56px 16px; }

/* ==================== PAGINATION ==================== */
.pagination { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin: 36px 0 0; }
.pagination .page-numbers {
    min-width: 42px; height: 42px; padding: 0 14px; display: inline-grid; place-items: center;
    background: var(--surface); color: var(--text-muted); border: 1px solid var(--border); border-radius: var(--radius);
    font-weight: 500; font-size: .95rem; transition: all .2s;
}
.pagination a.page-numbers:hover { border-color: var(--primary); color: var(--heading); background: var(--primary-soft); }
.pagination .page-numbers.current { background: var(--primary); border-color: var(--primary); color: #fff; }
.pagination .page-numbers.dots { background: transparent; border-color: transparent; }

/* ==================== SINGLE ==================== */
.player { position: relative; width: 100%; max-width: calc((100vh - 190px) * 1.7778); min-width: min(100%, 480px); margin-inline: auto; aspect-ratio: 16 / 9; background: #000; border-radius: var(--radius-lg); overflow: hidden; box-shadow: var(--shadow); border: 1px solid var(--border); }
.player iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.player--missing { display: grid; place-items: center; color: var(--text-muted); background: var(--surface); }

.entry-layout { display: grid; gap: 24px; margin-top: 24px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 992px) { .entry-layout { grid-template-columns: minmax(0, 1fr) 300px; gap: 28px; } }
@media (min-width: 1200px) { .entry-layout { grid-template-columns: minmax(0, 1fr) 340px; gap: 32px; } }
.entry-main { padding: 22px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); }
@media (max-width: 575.98px) { .entry-main { padding: 16px; } }
.entry-cats { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.entry-title { margin: 0 0 10px; font-size: clamp(1.3rem, 1.1rem + 1vw, 1.8rem); }
.entry-meta { display: flex; flex-wrap: wrap; gap: 4px 20px; margin-bottom: 16px; color: var(--text-muted); font-size: .9rem; }
.entry-meta span { display: inline-flex; align-items: center; gap: 6px; }
.entry-meta svg { width: 16px; height: 16px; color: var(--primary); }

.entry-side { align-self: start; display: grid; gap: 16px; }
@media (min-width: 992px) { .entry-side { position: sticky; top: calc(var(--navbar-h) + 20px); } }
.poster { overflow: hidden; border-radius: var(--radius-lg); border: 1px solid var(--border); background: var(--bg-deep); }
.poster img { width: 100%; aspect-ratio: 16 / 10; object-fit: cover; }
.facts-card { padding: 6px 18px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); }
.facts { margin: 0; }
.facts > div { padding: 12px 0; border-bottom: 1px solid var(--border); }
.facts > div:last-child { border-bottom: 0; }
.facts dt { color: var(--text-muted); font-size: .8rem; margin-bottom: 4px; }
.facts dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }

.prose { color: var(--prose); overflow-wrap: anywhere; line-height: 1.8; }
.prose h2, .prose h3 { margin-top: 1.6em; }
.prose a { color: var(--link); text-decoration: underline; text-underline-offset: 3px; }
.prose img { border-radius: var(--radius); margin-block: 1rem; }
.prose ul { list-style: disc; padding-left: 1.4rem; margin-bottom: 1em; }
.prose ol { list-style: decimal; padding-left: 1.4rem; margin-bottom: 1em; }
.prose blockquote { margin: 1.2em 0; padding: .4em 1em; border-left: 4px solid var(--primary); background: var(--secondary); border-radius: 0 var(--radius) var(--radius) 0; }

/* ==================== ADS ==================== */
.ad-row { display: grid; gap: 12px; align-items: start; margin: 0 0 20px; grid-template-columns: 1fr; }
@media (min-width: 900px) { .ad-row { grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); } .ad-slot--left { grid-column: 1; } .ad-slot--center { grid-column: 2; } .ad-slot--right { grid-column: 3; } }
.ad-slot { text-align: center; min-width: 0; }
.ad-slot--left { text-align: left; }
.ad-slot--right { text-align: right; }
.ad-slot img { display: inline-block; max-width: 100%; height: auto; }
.ad-slot a, .ad-banner a { display: inline-block; cursor: pointer; }
@media (max-width: 899px) { .ad-slot:empty { display: none; } .ad-slot--left, .ad-slot--right { text-align: center; } }
.ad-banner { text-align: center; margin: 16px 0; }

.float-ad { position: fixed; z-index: 1020; }
.float-ad--left, .float-ad--right { top: 50%; transform: translateY(-50%); }
.float-ad--left { left: 1%; }
.float-ad--right { right: 1%; }
.float-ad--left img, .float-ad--right img { width: 100%; height: auto; max-width: 160px; }
.float-ad--bottom { left: 50%; bottom: 0; transform: translateX(-50%); width: min(100%, 728px); text-align: center; }
.float-ad--bottom img { width: 100%; height: auto; }
.float-ad__inner { position: relative; display: inline-block; }
.float-ad__stack { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.float-close {
    position: absolute; top: -10px; z-index: 2; width: 26px; height: 26px; display: grid; place-items: center;
    background: var(--primary); color: #fff; border-radius: 50%; font-size: 16px; line-height: 1; box-shadow: var(--shadow);
}
.float-ad--left .float-close { right: -10px; }
.float-ad--right .float-close { left: -10px; }
.float-ad--bottom .float-close { right: 6px; top: -13px; }
@media (max-width: 768px) { .float-ad--left img, .float-ad--right img { max-width: 100px; } }

/* ==================== FOOTER ==================== */
.site-footer { background: var(--surface); border-top: 1px solid var(--border); padding: 28px 0 24px; color: var(--text-muted); font-size: .9rem; text-align: center; }
.footer-content { margin: 0 auto 20px; max-width: 1200px; }
.footer-brand { font-size: 1.2rem; font-weight: 700; color: var(--primary); margin: 0 0 4px; }
.footer-desc { margin: 0 auto 12px; max-width: 60ch; color: var(--text-dim); }
.footer-nav .menu { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 20px; margin: 12px 0 16px; }
.footer-nav a { color: var(--text-muted); }
.footer-nav a:hover { color: var(--primary); }
.copyright { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--border); color: var(--text-dim); }
.copyright p { margin: 0; }
@media (max-width: 991.98px) { .site-footer { padding-bottom: calc(var(--bar-h) + 24px); } }

/* ==================== MOBILE BOTTOM NAV (avx-bottom-nav) ==================== */
.mobile-bar { display: none; }
@media (max-width: 991.98px) {
    .mobile-bar {
        position: fixed; left: 0; right: 0; bottom: 0; z-index: 1025;
        display: flex; justify-content: space-around; align-items: center;
        padding: 8px 0 calc(12px + env(safe-area-inset-bottom)); background: var(--bg-deep); border-top: 1px solid var(--border);
    }
    .mobile-bar__item {
        display: flex; flex-direction: column; align-items: center; gap: 2px; flex: 1; min-width: 0; padding: 4px 2px;
        color: var(--text-muted); font-size: .65rem; transition: color .2s;
    }
    .mobile-bar__item svg { width: 24px; height: 24px; }
    .mobile-bar__item:hover, .mobile-bar__item.is-active, .mobile-bar__item[aria-expanded="true"] { color: var(--primary); }
    .float-ad--bottom { bottom: calc(var(--bar-h) + env(safe-area-inset-bottom)); }
}

/* ==================== 404 ==================== */
.error-404 { text-align: center; padding: 48px 0 24px; }
.error-404__code { margin: 0; font-size: clamp(5rem, 20vw, 9rem); font-weight: 700; line-height: 1; color: var(--primary); text-shadow: var(--shadow-red); }
.error-404 .search-form { max-width: 420px; margin: 20px auto 24px; }
.page-card { max-width: 860px; margin-inline: auto; padding: clamp(16px, 3vw, 28px); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); }

/* ==================== RESPONSIVE REFINEMENTS ==================== */
button, a { -webkit-tap-highlight-color: transparent; }

/* user content never breaks the layout */
.prose table { display: block; max-width: 100%; overflow-x: auto; border-collapse: collapse; }
.prose pre { max-width: 100%; overflow-x: auto; padding: 12px; background: var(--bg-deep); border-radius: var(--radius); }
.prose iframe, .prose video, .prose embed, .prose object { max-width: 100%; }
.prose iframe { aspect-ratio: 16 / 9; height: auto; }
.footer-content { overflow-x: auto; }
.footer-content img, .footer-content iframe { max-width: 100%; height: auto; }

/* very large screens: wider container + 6 columns */
@media (min-width: 1900px) {
    .container { width: min(100% - (var(--gutter) * 2), 1760px); }
    .grid-cards { grid-template-columns: repeat(6, minmax(0, 1fr)); }
}

/* phones */
@media (max-width: 575.98px) {
    .site-main { padding-block: 18px 40px; }
    .page-title { font-size: 1.3rem; align-items: flex-start; }
    .page-title__icon svg { width: 22px; height: 22px; margin-top: 3px; }
    .grid-cards { gap: 12px 10px; }
    .card__body { padding: 10px 10px 12px; }
    .card__title { font-size: .88rem; }
    .pagination { gap: 4px; }
    .pagination .page-numbers { min-width: 38px; height: 38px; padding: 0 8px; font-size: .88rem; }
    .pagination .page-numbers.prev, .pagination .page-numbers.next { font-size: .8rem; }
    .poster { display: none; }          /* the player already shows the video; save scrolling */
    .facts-card { padding: 4px 14px; }
    .breadcrumbs { font-size: .8rem; }
    .section-title { margin-top: 32px; }
    .error-404 { padding-top: 24px; }
}

/* small phones */
@media (max-width: 359.98px) {
    :root { --gutter: 10px; }
    .brand a { font-size: 1.3rem; }
    .card__meta { font-size: .72rem; }
}

/* landscape phones: keep the drawer and bottom bar usable */
@media (max-height: 480px) and (orientation: landscape) {
    :root { --navbar-h: 52px; --bar-h: 48px; }
    .mobile-bar__item span, .mobile-bar__item { font-size: .6rem; }
    .mobile-bar__item svg { width: 20px; height: 20px; }
    .player { max-width: 100%; }
}

/* touch devices: no hover lift stuck after tap */
@media (hover: none) {
    .card:hover { transform: none; box-shadow: none; border-color: var(--border); }
    .card:hover .card__img { transform: none; }
    .card:hover .card__play { opacity: 0; }
}
