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

:root {
  --bg:        #111318;
  --bg2:       #1b1e26;
  --bg3:       #232730;
  --border:    #2e3344;
  --text:      #dde1ea;
  --muted:     #6c7a91;
  --accent:    #7aa2cc;
  --accent2:   #a3c4e8;
  --patreon:   #ff424d;
  --twitter:   #dde1ea;
  --bluesky:   #0085ff;
  --youtube:   #ff0000;
  --radius:    10px;
  --shadow:    0 4px 28px rgba(0,0,0,.45);
}

html { font-size: 16px; scroll-behavior: smooth; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent2); }
img { display: block; max-width: 100%; }

/* ── Header ── */
.site-header {
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  padding: .75rem 1.5rem;
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(8px);
  overflow: visible;
}

/* Banner as header background with faded edges */
.site-header.has-banner {
  background-color: var(--bg2);
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  border-bottom-color: transparent;
  padding-top: 2.5rem;
}
.site-header.has-banner::before {
  content: '';
  position: absolute;
  inset: 0 0 -2px 0;
  z-index: 0;
  pointer-events: none;
  background:
    linear-gradient(to right,  #1b1e26 0%, rgba(27,30,38,0) 28%, rgba(27,30,38,0) 72%, #1b1e26 100%),
    linear-gradient(to bottom, rgba(17,19,24,0) 0%, rgba(17,19,24,0) 60%, rgba(17,19,24,.7) 80%, #111318 90%);
}
.site-header.has-banner .header-inner {
  position: relative;
  z-index: 1;
}

.header-inner {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 1.25rem;
  flex-wrap: wrap;
  overflow: visible;
}

/* Negative margin-bottom collapses the logo's layout height so the header
   height is determined by the social buttons / tagline, not the logo.
   The visual image still renders its full size, overhanging the border. */
.site-logo {
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--text);
  flex-shrink: 0;
  display: flex;
  align-items: flex-start;
  align-self: flex-end;
  margin-bottom: -52px;
  overflow: visible;
  position: relative;
  z-index: 101;
}
.site-logo:hover { color: var(--accent2); }
.logo-img {
  height: 100px;
  width: auto;
  max-width: 300px;
  object-fit: contain;
  filter: drop-shadow(0 8px 20px rgba(0,0,0,.55));
  transition: filter .2s ease;
}
.site-logo:hover .logo-img {
  filter: drop-shadow(0 10px 24px rgba(0,0,0,.7));
}

.site-tagline {
  color: var(--muted);
  font-size: .85rem;
  flex-shrink: 0;
}

.social-links {
  display: flex;
  gap: .5rem;
  flex-wrap: wrap;
  margin-left: auto;
}

/* ── Social Buttons ── */
.social-btn {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .4rem .85rem;
  border-radius: 999px;
  font-size: .82rem;
  font-weight: 600;
  transition: transform .15s, opacity .15s;
  white-space: nowrap;
}
.social-btn:hover { transform: translateY(-1px); opacity: .85; }
.social-btn svg { width: 15px; height: 15px; flex-shrink: 0; }

.social-btn.patreon  { background: var(--patreon); color: #fff; }
.social-btn.twitter  { background: var(--bg3); color: var(--text); border: 1px solid var(--border); }
.social-btn.bluesky  { background: var(--bluesky); color: #fff; }
.social-btn.youtube  { background: var(--youtube); color: #fff; }

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

/* ── Flash Messages ── */
.flash-container { margin-bottom: 1.25rem; display: flex; flex-direction: column; gap: .5rem; }
.flash {
  padding: .75rem 1rem;
  border-radius: var(--radius);
  font-size: .9rem;
}
.flash-success { background: #0f2e1a; color: #6ee7a0; border: 1px solid #1a4d2a; }
.flash-error   { background: #2e1010; color: #f87171; border: 1px solid #4d1a1a; }
.flash-message { background: var(--bg3); color: var(--text); border: 1px solid var(--border); }

/* ── Gallery ── */
.gallery-header {
  display: flex;
  align-items: baseline;
  gap: 1rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}
.gallery-title { font-size: 1.4rem; font-weight: 700; color: var(--text); }
.tag-highlight { color: var(--accent); }
.gallery-count { color: var(--muted); font-size: .88rem; margin-left: auto; }
.clear-tag {
  font-size: .82rem;
  padding: .25rem .65rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--muted);
}
.clear-tag:hover { color: var(--text); border-color: var(--accent); }

.gallery-grid {
  columns: 4 240px;
  gap: 12px;
}

.gallery-item {
  display: block;
  break-inside: avoid;
  margin-bottom: 12px;
  border-radius: var(--radius);
  overflow: hidden;
  position: relative;
  cursor: pointer;
  background: var(--bg3);
}

.gallery-item img {
  width: 100%;
  display: block;
  transition: transform .3s ease;
}

.gallery-item-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,.85) 0%, transparent 50%);
  opacity: 0;
  transition: opacity .2s;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: .75rem;
  gap: .35rem;
}

.gallery-item:hover .gallery-item-overlay { opacity: 1; }
.gallery-item:hover img { transform: scale(1.03); }

.gallery-item-title {
  font-size: .88rem;
  font-weight: 600;
  color: #fff;
  line-height: 1.3;
}

.gallery-item-tags { display: flex; gap: .3rem; flex-wrap: wrap; }

/* ── NSFW Blur ── */
.gallery-item.nsfw-blur {
  cursor: pointer;
}
.gallery-item.nsfw-blur img {
  filter: blur(20px);
  transform: scale(1.05);
}
.gallery-item.nsfw-blur:hover img {
  filter: blur(20px);
  transform: scale(1.08);
}
.nsfw-cover {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  background: rgba(0,0,0,.35);
  transition: background .2s;
}
.gallery-item.nsfw-blur:hover .nsfw-cover {
  background: rgba(0,0,0,.5);
}
.nsfw-badge {
  background: rgba(0,0,0,.7);
  border: 1.5px solid rgba(255,255,255,.35);
  color: #fff;
  font-size: .85rem;
  font-weight: 800;
  letter-spacing: .06em;
  padding: .25rem .65rem;
  border-radius: 999px;
}
.nsfw-badge-lg {
  font-size: 1.1rem;
  padding: .4rem 1rem;
}
.nsfw-hint {
  color: rgba(255,255,255,.75);
  font-size: .75rem;
  font-weight: 500;
}

/* ── Age Modal ── */
.age-modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1000;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(24px) brightness(.55) saturate(.7);
  -webkit-backdrop-filter: blur(24px) brightness(.55) saturate(.7);
  padding: 1rem;
}
.age-modal.active {
  display: flex;
}
.age-modal-inner {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 2.5rem 2rem;
  max-width: 420px;
  width: 100%;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.1rem;
  box-shadow: var(--shadow);
  position: relative;
  z-index: 1;
}
.age-modal-logo {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.03em;
}
.age-modal-logo-img {
  height: 48px;
  width: auto;
  max-width: 180px;
  object-fit: contain;
}
.age-modal-title {
  font-size: 1.35rem;
  font-weight: 700;
}
.age-modal-text {
  color: var(--muted);
  font-size: .92rem;
  line-height: 1.65;
}
.age-modal-text strong { color: var(--text); }
.age-modal-note {
  color: var(--muted);
  font-size: .75rem;
  line-height: 1.5;
}

/* ── Artwork NSFW overlay ── */
.artwork-nsfw-wrap {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
}
.artwork-blurred {
  filter: blur(28px);
  transform: scale(1.04);
}
.artwork-nsfw-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  background: rgba(0,0,0,.45);
  text-align: center;
  padding: 2rem;
}
.artwork-nsfw-overlay p {
  color: rgba(255,255,255,.8);
  font-size: .95rem;
}

/* ── Tag Pills ── */
.tag-pill {
  display: inline-block;
  padding: .15rem .5rem;
  background: rgba(122,162,204,.15);
  color: var(--accent);
  border-radius: 999px;
  font-size: .75rem;
  font-weight: 500;
  border: 1px solid rgba(122,162,204,.25);
  transition: background .15s;
}
.tag-pill:hover { background: rgba(122,162,204,.28); color: var(--accent2); }
.tag-pill.small { font-size: .7rem; padding: .1rem .4rem; }

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

/* ── Artwork Page ── */
.artwork-page { max-width: 1200px; margin: 0 auto; }
.back-link {
  display: inline-block;
  color: var(--muted);
  font-size: .88rem;
  margin-bottom: 1.5rem;
}
.back-link:hover { color: var(--accent); }

.artwork-layout {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 2rem;
  align-items: start;
}

.artwork-image-wrap {
  background: var(--bg2);
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
}
.artwork-full { width: 100%; height: auto; }

.artwork-meta {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  position: sticky;
  top: 80px;
}

.artwork-title { font-size: 1.35rem; font-weight: 700; line-height: 1.3; }
.artwork-desc { color: var(--muted); font-size: .92rem; line-height: 1.65; }
.artwork-tags { display: flex; flex-wrap: wrap; gap: .4rem; }
.artwork-date { color: var(--muted); font-size: .82rem; }

.patreon-cta {
  background: var(--bg3);
  border: 1px solid rgba(255,66,77,.25);
  border-radius: var(--radius);
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: .75rem;
}
.patreon-cta p { font-size: .88rem; color: var(--muted); }
.patreon-large { justify-content: center; padding: .65rem 1rem; font-size: .9rem; border-radius: var(--radius); }

.artwork-socials { display: flex; gap: .5rem; flex-wrap: wrap; }

/* ── Auth Page ── */
.auth-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 50vh;
}
.auth-box {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem;
  width: 100%;
  max-width: 380px;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}
.auth-box h1 { font-size: 1.25rem; }

/* ── Forms ── */
.field {
  display: flex;
  flex-direction: column;
  gap: .4rem;
  margin-bottom: 1rem;
}
label { font-size: .88rem; font-weight: 600; color: var(--text); }
.hint { font-weight: 400; color: var(--muted); }

input[type=text], input[type=password], input[type=url], textarea, select {
  background: var(--bg3);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: var(--radius);
  padding: .6rem .85rem;
  font-size: .95rem;
  font-family: inherit;
  outline: none;
  transition: border-color .15s;
  width: 100%;
}
input:focus, textarea:focus { border-color: var(--accent); }
textarea { resize: vertical; min-height: 80px; }

.file-plain {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .5rem .75rem;
  font-size: .88rem;
  color: var(--muted);
  cursor: pointer;
  width: 100%;
}
.file-plain:hover { border-color: var(--accent); }

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .5rem 1.1rem;
  border-radius: var(--radius);
  font-size: .88rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: opacity .15s, transform .15s;
  text-decoration: none;
  white-space: nowrap;
}
.btn:hover { opacity: .85; transform: translateY(-1px); }
.btn-primary { background: var(--accent); color: #0d1117; }
.btn-ghost { background: var(--bg3); color: var(--text); border: 1px solid var(--border); }
.btn-ghost:hover { color: var(--accent); border-color: var(--accent); }
.btn-danger { background: #2e1010; color: #f87171; border: 1px solid #4d1a1a; }
.btn-danger:hover { background: #4d1a1a; }
.btn-full { width: 100%; justify-content: center; }
.btn-sm { padding: .3rem .7rem; font-size: .8rem; }
.btn-age-enter { padding: .75rem 2rem; font-size: 1rem; }

.form-actions { display: flex; gap: .75rem; align-items: center; margin-top: .5rem; }

/* ── Admin ── */
.admin-wrap { max-width: 1400px; margin: 0 auto; }
.admin-toolbar {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}
.admin-toolbar h1 { font-size: 1.4rem; font-weight: 700; display: flex; align-items: center; gap: .5rem; }
.count-badge {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: .75rem;
  padding: .1rem .5rem;
  color: var(--muted);
  font-weight: 400;
}
.toolbar-actions { display: flex; gap: .5rem; margin-left: auto; }

.admin-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
}

.admin-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.admin-card-img { aspect-ratio: 1; overflow: hidden; background: var(--bg3); }
.admin-card-img img { width: 100%; height: 100%; object-fit: cover; }
.admin-card-body { padding: .75rem; display: flex; flex-direction: column; gap: .4rem; flex: 1; }
.admin-card-title { font-size: .85rem; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.admin-card-tags { display: flex; flex-wrap: wrap; gap: .25rem; }
.admin-card-date { color: var(--muted); font-size: .75rem; margin-top: auto; }
.admin-card-actions { display: flex; gap: .35rem; flex-wrap: wrap; margin-top: .5rem; }

/* ── Upload Form ── */
.upload-form { max-width: 640px; }

.drop-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  background: var(--bg3);
  cursor: pointer;
  transition: border-color .15s, background .15s;
  position: relative;
  min-height: 140px;
}
.drop-zone.drag-over { border-color: var(--accent); background: rgba(122,162,204,.06); }
.drop-zone:hover { border-color: var(--accent); }

.file-input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  width: 100%;
  height: 100%;
  z-index: 2;
}

.drop-zone-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: .6rem;
  padding: 2rem;
  color: var(--muted);
  font-size: .9rem;
  pointer-events: none;
}
.drop-zone-inner svg { width: 36px; height: 36px; opacity: .4; }

.preview-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: .75rem;
}
.preview-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .25rem;
  width: 90px;
}
.preview-item img { width: 90px; height: 90px; object-fit: cover; border-radius: 6px; }
.preview-item span { font-size: .68rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; width: 90px; text-align: center; }

/* ── Edit Layout ── */
.edit-layout { display: grid; grid-template-columns: 260px 1fr; gap: 2rem; align-items: start; }
.edit-preview img { width: 100%; border-radius: var(--radius); border: 1px solid var(--border); }

/* ── Empty State ── */
.empty-state {
  text-align: center;
  padding: 4rem 1rem;
  color: var(--muted);
}

/* ── Footer ── */
.site-footer {
  background: var(--bg2);
  border-top: 1px solid var(--border);
  padding: 1.25rem 1.5rem;
  margin-top: auto;
}
.footer-inner {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 1.5rem;
  flex-wrap: wrap;
}
.footer-inner p { color: var(--muted); font-size: .82rem; }
.footer-links { display: flex; gap: 1rem; margin-left: auto; flex-wrap: wrap; }
.footer-links a { color: var(--muted); font-size: .82rem; }
.footer-links a:hover { color: var(--accent); }

/* ── Checkbox ── */
.field-check { margin-bottom: 1rem; }
.check-label {
  display: inline-flex;
  align-items: center;
  gap: .6rem;
  cursor: pointer;
  font-size: .9rem;
  font-weight: 600;
}
.check-label input[type=checkbox] {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
  cursor: pointer;
}

/* ── Age Gate (standalone page — unused now but kept) ── */
.age-gate-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  padding: 1rem;
}
.age-gate-box {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2.5rem 2rem;
  max-width: 420px;
  width: 100%;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.25rem;
}
.age-gate-logo {
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--text);
}
.age-gate-title { font-size: 1.4rem; font-weight: 700; }
.age-gate-text { color: var(--muted); font-size: .92rem; line-height: 1.65; }
.age-gate-text strong { color: var(--text); }
.btn-age-enter { width: 100%; justify-content: center; }
.age-gate-leave {
  color: var(--muted);
  font-size: .85rem;
}
.age-gate-leave:hover { color: var(--accent); }
.age-gate-note { color: var(--muted); font-size: .75rem; line-height: 1.5; }

/* ── Settings ── */
.settings-section { margin-bottom: 2rem; }
.settings-heading {
  font-size: .8rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .08em;
  margin-bottom: 1rem;
  padding-bottom: .5rem;
  border-bottom: 1px solid var(--border);
}
.social-icon {
  width: 14px;
  height: 14px;
  vertical-align: middle;
  margin-right: .3rem;
  opacity: .7;
}
.current-asset-preview {
  max-height: 80px;
  width: auto;
  border-radius: 6px;
  border: 1px solid var(--border);
  margin-bottom: .35rem;
  background: var(--bg3);
  padding: .25rem;
}
.banner-preview {
  max-height: 100px;
  max-width: 100%;
  object-fit: cover;
}

/* ── Responsive ── */

/* Tablet */
@media (max-width: 1024px) {
  .gallery-grid { columns: 3 200px; }
  .artwork-layout { grid-template-columns: 1fr 260px; }
}

/* Small tablet / large phone */
@media (max-width: 900px) {
  .artwork-layout { grid-template-columns: 1fr; }
  .artwork-meta { position: static; }
  .edit-layout { grid-template-columns: 1fr; }
  .upload-form { max-width: 100%; }
  .gallery-grid { columns: 3 180px; }
}

/* Phone landscape / small phone portrait */
@media (max-width: 600px) {
  /* Header: stack social buttons below logo row */
  .site-header { padding: .75rem 1rem; }
  .header-inner {
    display: grid;
    grid-template-columns: 1fr auto;
    grid-template-rows: auto auto;
    gap: .5rem .75rem;
  }
  .site-logo { grid-column: 1; grid-row: 1; font-size: 1.2rem; }
  .site-tagline { grid-column: 1 / -1; grid-row: 2; font-size: .78rem; margin: 0; }
  .social-links {
    grid-column: 2;
    grid-row: 1;
    margin-left: 0;
    gap: .3rem;
    align-items: center;
  }
  .social-btn span { display: none; }
  .social-btn { padding: .4rem .5rem; min-width: 34px; justify-content: center; }
  .social-btn svg { width: 17px; height: 17px; }

  /* Gallery: 2 columns */
  .gallery-grid { columns: 2 140px; gap: 8px; }
  .gallery-grid .gallery-item { margin-bottom: 8px; }

  /* Main */
  .main-content { padding: 1rem; }

  /* Artwork page */
  .artwork-page { max-width: 100%; }
  .artwork-title { font-size: 1.15rem; }
  .artwork-socials { flex-wrap: wrap; }
  .artwork-nsfw-overlay { padding: 1.25rem; gap: .75rem; }

  /* Admin */
  .admin-toolbar {
    flex-direction: column;
    align-items: flex-start;
    gap: .75rem;
  }
  .toolbar-actions { margin-left: 0; width: 100%; justify-content: flex-start; }
  .admin-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .75rem; }

  /* Settings */
  .settings-section { margin-bottom: 1.5rem; }

  /* Footer */
  .footer-inner { flex-direction: column; align-items: flex-start; gap: .5rem; }
  .footer-links { margin-left: 0; gap: .75rem; }

  /* Age modal */
  .age-modal-inner { padding: 2rem 1.25rem; border-radius: 12px; }
  .age-modal-title { font-size: 1.15rem; }
  .btn-age-enter { padding: .7rem 1.5rem; }

  /* Buttons: touch-friendly min height */
  .btn { min-height: 40px; }
  .btn-sm { min-height: 32px; }
}

/* Small phones */
@media (max-width: 380px) {
  .gallery-grid { columns: 2 120px; gap: 6px; }
  .gallery-grid .gallery-item { margin-bottom: 6px; }
  .social-btn { padding: .35rem .4rem; }
  .main-content { padding: .75rem; }
  .age-modal-inner { padding: 1.5rem 1rem; }
  .header-inner { gap: .4rem .5rem; }
  .logo-img { height: 68px; }
}
