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

:root {
    --bg:       #0f0f0f;
    --surface:  #1a1a1a;
    --border:   #2d2d2d;
    --text:     #e0e0e0;
    --muted:    #888;
    --accent:   #d4006b;
    --radius:   6px;
    --thumb-w:  320px;
    --thumb-h:  240px;
}

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 + gallery
   + image pages after the 2026-05-09 SEO header pass. Tighter rules:
   slightly smaller than default, lighter weight than default's 700.
   Existing .gallery-header h1 (1.5rem) further down overrides for that
   one specific page. */
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; }
.image-meta h1 { font-size: 1.3rem; }

/* ── 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: 1400px;
    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 {
    position: relative;
    flex: 1;
    max-width: 480px;
    display: flex;
    gap: 0.5rem;
}
.search-form input {
    flex: 1;
    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); }

/* ── Suggester 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.5);
}
.suggest-dropdown li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.55rem 0.9rem;
    cursor: pointer;
    gap: 1rem;
}
.suggest-dropdown li:hover,
.suggest-dropdown li.active { background: var(--border); }
.suggest-name { color: var(--text); }
.suggest-count { color: var(--muted); font-size: 0.85rem; flex-shrink: 0; }

/* ── Main ── */
main {
    flex: 1;
    max-width: 1400px;
    width: 100%;
    margin: 0 auto;
    padding: 1.5rem;
}

/* ── Image grid ── */
.image-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(var(--thumb-w), 1fr));
    gap: 8px;
}
.image-card {
    display: block;
    background: var(--surface);
    border-radius: var(--radius);
    overflow: hidden;
    aspect-ratio: 4/3;
}
.image-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: opacity 0.2s;
}
.image-card:hover img { opacity: 0.85; }
[data-slideshow] video {
    display: none;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* ── Gallery header ── */
.gallery-header {
    display: flex;
    align-items: baseline;
    gap: 1rem;
    margin-bottom: 1.25rem;
}
.gallery-header h1 { font-size: 1.5rem; }
.gallery-count { color: var(--muted); font-size: 0.9rem; }

/* ── Pagination ── */
.pagination {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px;
    margin-top: 2rem;
    justify-content: center;
}
.pagination a, .pagination .ellipsis {
    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 a.current { background: var(--accent); border-color: var(--accent); color: #fff; }
.pagination .prev, .pagination .next { padding: 0 0.9rem; }
.pagination .ellipsis { border: none; background: none; color: var(--muted); }

/* ── Individual image page ── */
main:has(.image-page) {
    /* Native cga_images are 2132×1274; 2150px lets the single-image
       view display close to native size on wide monitors. */
    max-width: 2150px;
    padding: 0.75rem;
}

.image-page {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}
.image-meta h1 { font-size: 1.25rem; margin-bottom: 0.75rem; word-break: break-word; }
.image-meta-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1rem;
}
.download-btn {
    display: inline-block;
    background: var(--accent);
    color: #fff;
    font-size: 0.95rem;
    font-weight: 600;
    padding: 0.6rem 1.4rem;
    border-radius: var(--radius);
    text-decoration: none;
    transition: filter 0.15s;
    white-space: nowrap;
}
.download-btn:hover { filter: brightness(1.2); text-decoration: none; }
.performer-link { margin: 0; }
.meta-list { display: flex; flex-wrap: wrap; gap: 0.25rem 1.5rem; }
.meta-list dt { color: var(--muted); font-size: 0.85rem; margin-right: 0.3rem; }
.meta-list dt::after { content: ':'; }
.meta-list dd { font-size: 0.9rem; margin-right: 0.5rem; }
.image-wrap img { max-width: 100%; height: auto; border-radius: var(--radius); display: block; }

/* ── Search page ── */
.search-page h1 { font-size: 1.4rem; margin-bottom: 1.25rem; }
.result-count { color: var(--muted); margin-bottom: 1rem; }
.no-results { color: var(--muted); }
.performer-list { list-style: none; }
.performer-list li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.65rem 0;
    border-bottom: 1px solid var(--border);
    gap: 1rem;
}
.performer-list .count { color: var(--muted); font-size: 0.85rem; flex-shrink: 0; }

/* ── Home page ── */
.home-search-bar {
    display: flex;
    justify-content: center;
    padding: 1.5rem 0 2rem;
}
.home-search-bar .search-form {
    max-width: 520px;
    width: 100%;
}

.browse-section { padding-bottom: 3rem; }
.browse-heading {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 1.25rem;
}

.performer-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(var(--thumb-w), 1fr));
    gap: 8px;
}
.performer-tile {
    display: block;
    background: var(--surface);
    border-radius: var(--radius);
    overflow: hidden;
    text-decoration: none;
    color: var(--text);
    transition: opacity 0.2s;
}
.performer-tile:hover { opacity: 0.85; text-decoration: none; }
.performer-tile-img {
    aspect-ratio: 4/3;
    overflow: hidden;
}
.performer-tile-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.performer-tile-info {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.5rem 0.65rem;
    border-top: 1px solid var(--border);
}
.performer-tile-name {
    font-size: 0.85rem;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.performer-tile-count {
    color: var(--muted);
    font-size: 0.78rem;
    flex-shrink: 0;
}

/* ── "You might also like" section (single-image 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;
}

/* ── 404 ── */
.error-page { text-align: center; padding: 4rem 1rem; }
.error-page h1 { font-size: 2rem; 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) {
    .image-page { grid-template-columns: 1fr; }
    .image-grid { --thumb-w: 160px; }
    main { padding: 1rem; }
}
