/* ============================================================
   bishoujo·art — Main CSS
   Dark anime aesthetic  |  accent: #e91e8c (pink)
   ============================================================ */

/* ---------- Reset & base ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:          #0d0d0f;
  --bg-surface:  #141418;
  --bg-elevated: #1c1c22;
  --border:      #2a2a35;
  --accent:      #e91e8c;
  --accent-dim:  #b5166d;
  --accent-glow: rgba(233,30,140,.18);
  --text:        #e8e6f0;
  --text-muted:  #7a7890;
  --text-sub:    #b0aec8;
  --safe:        #22c55e;
  --questionable:#f59e0b;
  --explicit:    #ef4444;
  --radius:      8px;
  --radius-lg:   14px;
  --shadow:      0 4px 24px rgba(0,0,0,.6);
}

html { scroll-behavior: smooth; }

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
}

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

img { max-width: 100%; display: block; }

/* ---------- Layout ---------- */
.container { max-width: 1280px; margin: 0 auto; padding: 0 1.25rem; }

/* ---------- Header ---------- */
.site-header {
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 100;
}
.header-inner {
  display: flex; align-items: center; gap: 2rem;
  height: 60px; padding: 0 1.25rem; max-width: 1280px; margin: 0 auto;
}
.site-logo {
  font-size: 1.25rem; font-weight: 700; color: var(--text);
  white-space: nowrap;
}
.site-logo span { color: var(--accent); }
.site-nav { display: flex; gap: 1.5rem; margin-left: auto; }
.site-nav a { color: var(--text-sub); font-size: .9rem; transition: color .2s; }
.site-nav a:hover { color: var(--accent); }

/* ---------- Footer ---------- */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 2rem 1.25rem;
  text-align: center;
  color: var(--text-muted);
  font-size: .85rem;
  margin-top: 4rem;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: .55rem 1.2rem; border-radius: var(--radius);
  font-size: .9rem; font-weight: 500; cursor: pointer;
  border: 1px solid transparent; transition: all .2s; text-decoration: none;
}
.btn--primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn--primary:hover { background: var(--accent-dim); border-color: var(--accent-dim); color: #fff; }
.btn--outline { background: transparent; color: var(--text); border-color: var(--border); }
.btn--outline:hover { border-color: var(--accent); color: var(--accent); }
.btn--danger { background: var(--explicit); color: #fff; border-color: var(--explicit); }
.btn--danger:hover { background: #c93a3a; border-color: #c93a3a; color: #fff; }
.btn--sm { padding: .35rem .8rem; font-size: .8rem; }
.btn--full { width: 100%; }

/* ---------- Badges ---------- */
.badge {
  display: inline-block; padding: .2rem .6rem; border-radius: 20px;
  font-size: .75rem; font-weight: 600;
  background: var(--bg-elevated); color: var(--text-sub);
}
.badge--safe { background: rgba(34,197,94,.15); color: var(--safe); }
.badge--questionable { background: rgba(245,158,11,.15); color: var(--questionable); }
.badge--explicit { background: rgba(239,68,68,.15); color: var(--explicit); }
.badge--sm { font-size: .7rem; padding: .15rem .45rem; }

/* ---------- Hero ---------- */
.hero {
  padding: 5rem 0 4rem;
  text-align: center;
  background: radial-gradient(ellipse at 50% 0%, rgba(233,30,140,.08) 0%, transparent 70%);
}
.hero-title {
  font-size: clamp(2.5rem, 6vw, 4rem);
  font-weight: 800; letter-spacing: -.02em;
  color: var(--text);
}
.logo-dot { color: var(--accent); }
.hero-sub { color: var(--text-muted); margin: .75rem 0 2rem; font-size: 1.1rem; }

/* ---------- Sections ---------- */
.section { padding: 3rem 0; }
.section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.5rem; }
.section-title { font-size: 1.4rem; font-weight: 700; }
.section-link { color: var(--accent); font-size: .9rem; }

/* ---------- Category grid (home) ---------- */
.category-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}
.category-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1rem;
  text-align: center;
  transition: border-color .2s, transform .2s;
  color: var(--text);
}
.category-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.category-card__name { font-weight: 600; font-size: 1rem; margin-bottom: .25rem; }
.category-card__count { font-size: .8rem; color: var(--text-muted); }

/* ---------- Image grid ---------- */
.image-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
}
.image-grid--small {
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: .75rem;
}
.image-card {
  position: relative; overflow: hidden;
  border-radius: var(--radius-lg);
  background: var(--bg-surface);
  border: 1px solid var(--border);
  aspect-ratio: 3/4;
  display: block;
  transition: transform .2s, box-shadow .2s;
}
.image-card:hover { transform: translateY(-3px); box-shadow: 0 8px 32px rgba(233,30,140,.2); }
.image-card__thumb {
  width: 100%; height: 100%;
  object-fit: cover; object-position: top;
  transition: transform .3s;
}
.image-card:hover .image-card__thumb { transform: scale(1.04); }
.image-card__overlay {
  position: absolute; bottom: 0; left: 0; right: 0;
  background: linear-gradient(transparent, rgba(0,0,0,.85));
  padding: 1.5rem .75rem .75rem;
  opacity: 0; transition: opacity .2s;
}
.image-card:hover .image-card__overlay { opacity: 1; }
.image-card__title { color: #fff; font-size: .8rem; font-weight: 500; line-height: 1.3; }

/* ---------- Gallery header ---------- */
.gallery-header { display: flex; align-items: baseline; gap: 1rem; margin: 1.5rem 0 1rem; flex-wrap: wrap; }
.gallery-title { font-size: 1.8rem; font-weight: 700; }
.gallery-count { color: var(--text-muted); font-size: .9rem; }

/* ---------- Category pills ---------- */
.category-pills { display: flex; gap: .5rem; flex-wrap: wrap; margin-bottom: 1rem; }
.pill {
  padding: .35rem .9rem; border-radius: 20px;
  border: 1px solid var(--border); background: var(--bg-surface);
  color: var(--text-sub); font-size: .85rem; transition: all .2s;
}
.pill:hover, .pill--active {
  border-color: var(--accent); color: var(--accent);
  background: var(--accent-glow);
}
.pill--more {
  background: none; border: 1px dashed var(--border);
  color: var(--text-muted); cursor: pointer; font-size: .85rem;
}

/* ---------- Filter bar ---------- */
.filter-bar { display: flex; gap: .75rem; margin-bottom: 1.5rem; }
.filter-select {
  background: var(--bg-surface); border: 1px solid var(--border);
  color: var(--text); border-radius: var(--radius); padding: .4rem .75rem;
  font-size: .85rem; cursor: pointer;
}
.filter-select:focus { outline: none; border-color: var(--accent); }

/* ---------- Pagination ---------- */
.pagination { display: flex; align-items: center; justify-content: center; gap: 1rem; margin-top: 2.5rem; }
.page-btn {
  padding: .5rem 1.2rem; border-radius: var(--radius);
  border: 1px solid var(--border); color: var(--text-sub);
  background: var(--bg-surface); transition: all .2s;
}
.page-btn:hover { border-color: var(--accent); color: var(--accent); }
.page-info { color: var(--text-muted); font-size: .9rem; }

/* ---------- Empty state ---------- */
.empty-state { text-align: center; padding: 4rem 0; color: var(--text-muted); }
.empty-state p { margin-bottom: 1rem; }

/* ---------- Detail page ---------- */
.detail-layout { padding: 2rem 0; }
.detail-main { max-width: 900px; margin: 0 auto; }
.detail-image-wrap {
  border-radius: var(--radius-lg); overflow: hidden;
  margin-bottom: 1.25rem; background: var(--bg-surface);
}
.detail-image { width: 100%; max-height: 80vh; object-fit: contain; }
.detail-actions { display: flex; gap: .75rem; margin-bottom: 1.5rem; }
.detail-title { font-size: 1.6rem; font-weight: 700; margin-bottom: .75rem; }
.detail-badges { display: flex; gap: .5rem; flex-wrap: wrap; margin-bottom: 1rem; }
.detail-description { color: var(--text-sub); line-height: 1.7; margin-bottom: 1rem; }
.detail-tags { display: flex; gap: .5rem; flex-wrap: wrap; margin-bottom: 1rem; }
.tag {
  padding: .25rem .65rem; border-radius: 20px;
  background: var(--bg-elevated); color: var(--text-muted);
  font-size: .8rem; transition: color .2s;
}
.tag:hover { color: var(--accent); }
.detail-stats { display: flex; gap: 1.25rem; color: var(--text-muted); font-size: .85rem; }

/* Related section */
.related-section { margin-top: 3rem; padding-top: 2rem; border-top: 1px solid var(--border); }
.related-title { font-size: 1.2rem; font-weight: 600; margin-bottom: 1.25rem; }

/* ---------- Puzzle ---------- */
.puzzle-container { margin-top: 1.5rem; }
.puzzle-board {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 3px;
  max-width: 480px;
  margin: 0 auto 1rem;
  background: var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.puzzle-controls { display: flex; gap: .75rem; justify-content: center; }
.puzzle-tile {
  cursor: pointer;
  aspect-ratio: 1;
  background: var(--bg-elevated);
  transition: opacity .15s;
}
.puzzle-tile--empty { background: var(--bg); cursor: default; }

/* ---------- Modal ---------- */
.modal {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(0,0,0,.75); display: flex; align-items: center; justify-content: center;
}
.modal-box {
  background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 2.5rem;
  text-align: center; max-width: 360px; width: 90%;
}
.modal-box h2 { margin-bottom: .75rem; }
.modal-box p { color: var(--text-muted); margin-bottom: 1.5rem; }

/* ---------- Forms (shared) ---------- */
.form-group { margin-bottom: 1.25rem; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.form-label { display: block; margin-bottom: .45rem; font-size: .875rem; color: var(--text-sub); }
.form-input {
  width: 100%; padding: .55rem .9rem;
  background: var(--bg-elevated); border: 1px solid var(--border);
  border-radius: var(--radius); color: var(--text); font-size: .9rem;
  transition: border-color .2s;
}
.form-input:focus { outline: none; border-color: var(--accent); }
.form-textarea { resize: vertical; min-height: 80px; }
.form-actions { display: flex; gap: .75rem; align-items: center; margin-top: 1.5rem; }

/* ---------- Alerts ---------- */
.alert {
  padding: .75rem 1rem; border-radius: var(--radius);
  margin-bottom: 1rem; font-size: .9rem;
}
.alert--error { background: rgba(239,68,68,.12); color: var(--explicit); border: 1px solid rgba(239,68,68,.3); }
.alert--success { background: rgba(34,197,94,.12); color: var(--safe); border: 1px solid rgba(34,197,94,.3); }

/* ---------- Error page ---------- */
.error-page { text-align: center; padding: 6rem 0; }
.error-code { font-size: 6rem; font-weight: 900; color: var(--accent); line-height: 1; }
.error-title { font-size: 1.5rem; margin: 1rem 0 .5rem; }
.error-sub { color: var(--text-muted); margin-bottom: 2rem; }

/* ---------- Tag cloud ---------- */
.tag-cloud { display: flex; flex-wrap: wrap; gap: .5rem; }
.tag--lg { font-size: .9rem; padding: .4rem .9rem; }

/* ---------- Age gate ---------- */
.age-gate {
  position: fixed; inset: 0; z-index: 9999;
  background: rgba(0,0,0,.92);
  display: flex; align-items: center; justify-content: center;
  padding: 1.5rem;
}
.age-gate__box {
  background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 2.5rem;
  max-width: 460px; width: 100%; text-align: center;
}
.age-gate__icon { font-size: 2.5rem; margin-bottom: 1rem; }
.age-gate__title { font-size: 1.4rem; font-weight: 700; margin-bottom: .75rem; }
.age-gate__text { color: var(--text-sub); font-size: .95rem; line-height: 1.6; margin-bottom: 1.75rem; }
.age-gate__actions { display: flex; gap: .75rem; justify-content: center; flex-wrap: wrap; }

/* ---------- Cookie banner ---------- */
.cookie-banner {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 9000;
  background: var(--bg-surface); border-top: 1px solid var(--border);
  padding: .85rem 1.5rem;
  display: flex; align-items: center; justify-content: center; gap: 1.25rem;
  flex-wrap: wrap;
}
.cookie-banner__text { color: var(--text-sub); font-size: .9rem; margin: 0; }
.btn--sm { padding: .35rem .9rem; font-size: .85rem; }

/* ---------- Ads ---------- */
.ad-leaderboard {
  display: flex; justify-content: center;
  padding: .75rem 0; background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
}
.ad-mobile {
  display: none;
  justify-content: center;
  padding: 1rem 0;
}
.gallery-layout {
  display: flex;
  gap: 1.5rem;
  align-items: flex-start;
}
.gallery-main { flex: 1; min-width: 0; }
.gallery-sidebar {
  flex-shrink: 0;
  width: 250px;
  position: sticky;
  top: 80px;
}

/* ---------- Responsive ---------- */
@media (max-width: 1024px) {
  .gallery-sidebar { display: none; }
  .ad-leaderboard { display: none; }
  .ad-mobile { display: flex; }
}
@media (max-width: 640px) {
  .form-row { grid-template-columns: 1fr; }
  .image-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
  .hero { padding: 3rem 0 2rem; }
  .puzzle-board { max-width: 320px; }
}
