*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --bg:       #0a0a0a;
    --surface:  #141414;
    --border:   #252525;
    --text:     #e0e0e0;
    --muted:    #777;
    --accent:   #1a6b3c;   /* overridden per site via inline style in layout.php */
    --radius:   6px;
    --thumb-w:  360px;     /* min tile width — auto-fill respects this */
}

body {
    background: var(--bg);
    color: var(--text);
    font-family: system-ui, -apple-system, sans-serif;
    font-size: 15px;
    line-height: 1.5;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Headings (SEO H1/H2) ──
   Browser-default <h1>/<h2> sizing crowded the cards on home + performer
   + recording pages after the 2026-05-09 SEO header pass. Tighter rules:
   slightly smaller than default, lighter weight than default's 700. */
h1, h2, h3 {
    font-family: system-ui, -apple-system, sans-serif;
    font-weight: 500;
    line-height: 1.3;
}
h1 { font-size: 1.4rem;  margin: 0.5rem 0 1rem;  }
h2 { font-size: 1.15rem; margin: 0.4rem 0 0.6rem; }
h3 { font-size: 1rem;    margin: 0.3rem 0 0.5rem; }
.page-title       { text-align: center; margin: 0.75rem auto 1.5rem; }
.recording-title  { font-weight: 500; }

/* ── Header ── */
header {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 0.75rem 1.5rem;
    position: sticky;
    top: 0;
    z-index: 100;
}
.header-inner {
    max-width: 1800px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 1.5rem;
}
.logo {
    color: var(--accent);
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    transition: opacity 0.15s;
}
.logo:hover { text-decoration: none; opacity: 0.85; }
.site-logo  { display: block; height: 30px; width: auto; }

/* ── Search ── */
.search-form {
    display: flex;
    gap: 0.5rem;
    flex: 1;
    max-width: 480px;
}
.search-wrap {
    position: relative;
    flex: 1;
}
.search-form input {
    width: 100%;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    padding: 0.45rem 0.75rem;
    font-size: 0.95rem;
}
.search-form input:focus { outline: none; border-color: var(--accent); }
.search-form button {
    background: var(--accent);
    border: none;
    border-radius: var(--radius);
    color: #fff;
    cursor: pointer;
    padding: 0.45rem 1rem;
    font-size: 0.9rem;
    white-space: nowrap;
}
.search-form button:hover { filter: brightness(1.15); }

/* ── Suggest dropdown ── */
.suggest-dropdown {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    list-style: none;
    max-height: 320px;
    overflow-y: auto;
    z-index: 200;
    box-shadow: 0 4px 16px rgba(0,0,0,0.6);
}
.suggest-dropdown li {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0.9rem;
    cursor: pointer;
}
.suggest-dropdown li:hover,
.suggest-dropdown li.active { background: var(--border); }
.suggest-avatar { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; flex-shrink: 0; }
.suggest-name { color: var(--text); flex: 1; }
.suggest-count { color: var(--muted); font-size: 0.82rem; flex-shrink: 0; }

/* ── Main ──
   Native cga_images are 2132×1274 (~4.35M of the 12-month subset). 2150px
   gives the single-image recording page native-size display, and 2-col
   grid cards land at ~1055px each (~50% of native). */
main {
    flex: 1;
    max-width: 2150px;
    width: 100%;
    margin: 0 auto;
    padding: 1rem 0.75rem;
}

main:has(.recording-page) {
    max-width: 2150px;
}

/* ── Image grid — 2-wide on desktop, expands cards with viewport ── */
.image-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

/* ── Image card ── */
.image-card {
    background: var(--surface);
    border-radius: var(--radius);
    overflow: hidden;
    border: 1px solid var(--border);
}
.card-image-link { display: block; }
.card-image-link img,
.card-image-link video {
    width: 100%;
    height: auto;
    display: block;
}
.card-info {
    padding: 0.6rem 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}
.card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem 0.75rem;
    font-size: 0.85rem;
    color: var(--muted);
}
.card-performer { color: var(--accent); font-weight: 500; }
.card-date, .card-platform, .card-gender { color: var(--muted); }
.card-download {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}
.download-btn {
    display: inline-block;
    background: var(--accent);
    color: #fff;
    font-size: 0.85rem;
    font-weight: 600;
    padding: 0.35rem 0.9rem;
    border-radius: var(--radius);
    text-decoration: none;
    white-space: nowrap;
    transition: filter 0.15s;
}
.download-btn:hover { filter: brightness(1.2); text-decoration: none; }
.short-url {
    font-size: 0.8rem;
    color: var(--muted);
    font-family: monospace;
    word-break: break-all;
}

/* ── Home performer grid — 2-wide on desktop ── */
.performer-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}
.performer-tile {
    display: block;
    background: var(--surface);
    border-radius: var(--radius);
    overflow: hidden;
    border: 1px solid var(--border);
    color: var(--text);
    transition: border-color 0.15s;
}
.performer-tile:hover { border-color: var(--accent); text-decoration: none; }
.tile-img { display: block; }
.tile-img img,
.tile-img video {
    width: 100%;
    height: auto;
    display: block;
}
.tile-info {
    padding: 0.5rem 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}
.tile-name { font-weight: 600; font-size: 0.9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tile-meta { font-size: 0.78rem; color: var(--muted); }

/* ── "You might also like" tiles on recording page ── */
.you-might-like { margin-top: 2.5rem; }
.you-might-like h2 {
    font-size: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 1rem;
    color: var(--muted);
}
/* Denser grid than the home 2-wide — fits 16 tiles in 4 rows × 4 cols
   on desktop, collapses to 2 cols on narrow viewports. */
.you-might-grid {
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 0.6rem;
}

/* ── Performer page ── */
.performer-header {
    display: flex;
    align-items: flex-start;
    gap: 1.25rem;
    margin-bottom: 1.5rem;
    padding-bottom: 1.25rem;
    border-bottom: 1px solid var(--border);
}
.performer-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    border: 2px solid var(--border);
}
.performer-header-info h1 { font-size: 1.5rem; margin-bottom: 0.4rem; }
.performer-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem 1rem;
    font-size: 0.85rem;
    color: var(--muted);
}

/* ── Recording page ── */
.recording-page { display: flex; flex-direction: column; gap: 0.75rem; }
.recording-meta-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem 1rem;
    font-size: 0.9rem;
}
.meta-performer { font-weight: 600; color: var(--accent); }
.meta-date, .meta-platform, .meta-gender { color: var(--muted); }
.recording-image img,
.recording-image video { max-width: 100%; height: auto; border-radius: var(--radius); display: block; }

/* ── Pagination ── */
.pagination {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 2rem;
    justify-content: center;
}
.pagination a,
.pagination .ellipsis,
.pagination .dots,
.pagination .current {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2rem;
    height: 2rem;
    padding: 0 0.6rem;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    color: var(--text);
    font-size: 0.9rem;
    background: var(--surface);
}
.pagination a:hover { border-color: var(--accent); text-decoration: none; }
.pagination .current,
.pagination a.current { background: var(--accent); border-color: var(--accent); color: #fff; }
.pagination .ellipsis,
.pagination .dots     { border: none; background: none; color: var(--muted); }
.pagination .prev, .pagination .next { padding: 0 0.9rem; }
.pagination .page-jump {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    color: var(--muted);
    border: none;
    background: none;
    padding: 0 0.5rem;
    font-size: 0.85rem;
}
.pagination .page-jump input {
    width: 64px;
    padding: 4px 6px;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 0.85rem;
    text-align: center;
    background: var(--surface);
    color: var(--text);
}
.pagination .page-jump input:focus { outline: none; border-color: var(--accent); }

/* ── Search ── */
.search-page h1 { font-size: 1.4rem; margin-bottom: 1rem; }
.result-count { color: var(--muted); margin-bottom: 0.75rem; font-size: 0.9rem; }
.no-results { color: var(--muted); }
.performer-list { list-style: none; }
.performer-list li {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 0;
    border-bottom: 1px solid var(--border);
}
.result-avatar { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; flex-shrink: 0; }
.performer-list .count { color: var(--muted); font-size: 0.82rem; margin-left: auto; flex-shrink: 0; }
.performer-list .platform { color: var(--muted); font-size: 0.82rem; flex-shrink: 0; }

/* ── 404 ── */
.error-page { text-align: center; padding: 4rem 1rem; }
.error-page h1 { font-size: 2.5rem; margin-bottom: 1rem; }

/* ── Footer ── */
footer {
    text-align: center;
    padding: 1.5rem;
    color: var(--muted);
    font-size: 0.8rem;
    border-top: 1px solid var(--border);
}

/* ── Responsive ── */
@media (max-width: 768px) {
    :root { --thumb-w: 220px; }
    main { padding: 0.75rem; }
    .performer-header { flex-direction: column; }
    /* Single-column home grid on mobile — only the first tile is above
       the fold, so the fetchpriority="high" on tile 1 cleanly maps to the
       LCP element. With 2 columns at this width Lighthouse sometimes
       picked tile 2 as LCP based on paint-completion timing. */
    .performer-grid { grid-template-columns: 1fr; }
}

/* ── Back-to-top floating button ── */
.backtotop {
    position: fixed;
    right: 1.5rem;
    bottom: 1.5rem;
    width: 44px;
    height: 44px;
    background: var(--accent);
    color: var(--bg);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    line-height: 1;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
    text-decoration: none;
    opacity: 0;
    transform: translateY(12px);
    transition: opacity 0.2s ease, transform 0.2s ease, background 0.15s;
    z-index: 200;
}
.backtotop.active {
    opacity: 1;
    transform: translateY(0);
}
.backtotop:hover {
    background: var(--text);
    text-decoration: none;
}
@media (max-width: 768px) {
    .backtotop { right: 1rem; bottom: 1rem; width: 40px; height: 40px; }
}

/* ── Category nav (#229) — platform buttons + gender hover-dropdowns ── */
.cat-nav {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
}
.cat-nav-list {
    list-style: none;
    margin: 0;
    padding: 0 1rem;
    max-width: 1280px;
    margin-inline: auto;
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
}
.cat-item { position: relative; }
.cat-link {
    display: block;
    padding: 0.6rem 0.9rem;
    color: var(--text);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.92rem;
    border-bottom: 2px solid transparent;
}
.cat-item:hover > .cat-link { color: var(--accent); border-bottom-color: var(--accent); }
.cat-dropdown {
    list-style: none;
    margin: 0;
    padding: 0.25rem 0;
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 160px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
    opacity: 0;
    visibility: hidden;
    transform: translateY(4px);
    transition: opacity 0.15s ease, transform 0.15s ease, visibility 0.15s;
    z-index: 150;
}
.cat-item:hover > .cat-dropdown,
.cat-item:focus-within > .cat-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}
.cat-dropdown a {
    display: block;
    padding: 0.5rem 0.9rem;
    color: var(--text);
    text-decoration: none;
    font-size: 0.9rem;
}
.cat-dropdown a:hover { background: var(--border); color: var(--accent); }

/* Breadcrumb (category pages) */
.breadcrumb {
    font-size: 0.85rem;
    color: var(--muted);
    margin-bottom: 0.75rem;
}
.breadcrumb a { color: var(--muted); text-decoration: none; }
.breadcrumb a:hover { color: var(--accent); }

@media (max-width: 768px) {
    .cat-nav-list { overflow-x: auto; flex-wrap: nowrap; -webkit-overflow-scrolling: touch; }
    /* Touch: dropdowns expand on tap via :focus-within (link is focusable). */
    .cat-dropdown { position: static; opacity: 1; visibility: visible; transform: none;
                    box-shadow: none; border: 0; min-width: 0; display: none; }
    .cat-item:focus-within > .cat-dropdown { display: block; }
}
