/* ph.ai4bis — тёмная editorial-тема фотоархива.
   Палитра: тёплый графит + шампань. Дисплей Prata, текст Manrope. */

:root {
  --bg: oklch(0.17 0.012 60);          /* тёплый графит */
  --bg-raise: oklch(0.21 0.014 60);
  --bg-soft: oklch(0.245 0.016 62);
  --line: oklch(0.30 0.018 65);
  --ink: oklch(0.92 0.015 80);          /* тёплый почти-белый */
  --ink-dim: oklch(0.68 0.02 75);
  --ink-faint: oklch(0.50 0.02 70);
  --accent: oklch(0.82 0.11 85);        /* шампань */
  --accent-deep: oklch(0.70 0.13 75);
  --accent-ink: oklch(0.22 0.03 75);
  --st-new: oklch(0.80 0.12 85);
  --st-favorite: oklch(0.76 0.12 25);
  --st-contacted: oklch(0.78 0.08 230);
  --st-scheduled: oklch(0.74 0.10 310);
  --st-done: oklch(0.75 0.10 150);
  --st-rejected: oklch(0.55 0.02 60);
  --st-archived: oklch(0.45 0.015 60);
  --serif: "Prata", "Georgia", serif;
  --sans: "Manrope", system-ui, sans-serif;
  --radius: 10px;
}

* { box-sizing: border-box; margin: 0; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.55;
  min-height: 100vh;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-deep); }
img { max-width: 100%; display: block; }
button { font-family: var(--sans); cursor: pointer; }

/* ---------- шапка ---------- */

.topbar {
  display: flex; justify-content: space-between; align-items: baseline;
  padding: clamp(14px, 2.5vw, 22px) clamp(18px, 4vw, 48px);
  border-bottom: 1px solid var(--line);
}
.brand {
  font-family: var(--serif);
  font-size: 1.35rem;
  color: var(--ink);
  letter-spacing: 0.02em;
  display: flex; align-items: center; gap: 10px;
}
.brand-logo { width: 34px; height: 34px; border-radius: 50%; }
.brand span { color: var(--accent); }
.topbar-nav { display: flex; gap: 18px; align-items: baseline; }
.whoami { color: var(--ink-dim); font-size: 0.9rem; }
.ghost-link {
  color: var(--ink-dim); font-size: 0.9rem;
  border: 1px solid var(--line); border-radius: 999px;
  padding: 5px 14px; transition: border-color 0.2s, color 0.2s;
}
.ghost-link:hover { color: var(--accent); border-color: var(--accent-deep); }

.page { padding: clamp(20px, 3vw, 36px) clamp(18px, 4vw, 48px) 80px; max-width: 1480px; margin: 0 auto; }
.page-title { font-family: var(--serif); font-size: clamp(1.7rem, 3.5vw, 2.4rem); font-weight: 400; }
.count { color: var(--ink-faint); font-size: 0.8em; }
.muted { color: var(--ink-faint); }
.crumbs { margin-bottom: 18px; font-size: 0.9rem; }
.crumbs a { color: var(--ink-dim); }
.crumbs a:hover { color: var(--accent); }

/* ---------- вход ---------- */

.login-stage { min-height: 82vh; display: grid; place-items: center; }
.login-box { text-align: center; max-width: 420px; padding: 24px; }
.login-mark {
  width: 140px; height: 140px; border-radius: 50%;
  margin: 0 auto 26px;
  box-shadow: 0 0 60px oklch(0.7 0.12 80 / 0.25);
}
.login-title { font-family: var(--serif); font-weight: 400; font-size: 2.2rem; }
.login-title span { color: var(--accent); }
.login-sub { color: var(--ink-dim); margin: 10px 0 34px; }
.login-error {
  color: oklch(0.78 0.13 25); border: 1px solid oklch(0.45 0.09 25);
  border-radius: var(--radius); padding: 10px 14px; margin-bottom: 22px; font-size: 0.9rem;
}
.tg-widget { display: flex; justify-content: center; min-height: 48px; }
.login-alt {
  margin-top: 30px; color: var(--ink-faint); font-size: 0.85rem; line-height: 1.7;
}
.login-alt code {
  background: var(--bg-soft); border: 1px solid var(--line);
  border-radius: 6px; padding: 1px 7px; color: var(--accent);
}

/* ---------- список ---------- */

.list-head {
  display: flex; flex-wrap: wrap; gap: 16px 28px;
  justify-content: space-between; align-items: baseline; margin-bottom: 28px;
}
.filters { display: flex; flex-wrap: wrap; gap: 8px; }
.filter {
  color: var(--ink-dim); font-size: 0.88rem;
  border: 1px solid var(--line); border-radius: 999px; padding: 5px 14px;
  transition: all 0.2s;
}
.filter:hover { border-color: var(--accent-deep); color: var(--ink); }
.filter.active { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.filter.active .count { color: var(--accent-ink); opacity: 0.7; }

.empty {
  max-width: 460px; margin: 12vh auto; text-align: center; color: var(--ink-dim);
}
.empty-title { font-family: var(--serif); font-size: 1.5rem; color: var(--ink); margin-bottom: 10px; }

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: clamp(14px, 2vw, 24px);
}
.card {
  position: relative; background: var(--bg-raise);
  border-radius: var(--radius); overflow: hidden;
  border: 1px solid transparent;
  transition: transform 0.25s cubic-bezier(0.22, 1, 0.36, 1), border-color 0.25s;
}
.card:hover { transform: translateY(-4px); border-color: var(--accent-deep); }
.card-link { color: var(--ink); display: block; }
.card-link:hover { color: var(--ink); }
.card-photo { position: relative; aspect-ratio: 3 / 4; background: var(--bg-soft); }
.card-photo img { width: 100%; height: 100%; object-fit: cover; }
.no-photo { display: grid; place-items: center; height: 100%; font-size: 2rem; opacity: 0.35; }
.status-chip {
  position: absolute; left: 10px; top: 10px;
  font-size: 0.72rem; font-weight: 600; letter-spacing: 0.04em;
  padding: 3px 10px; border-radius: 999px; color: var(--accent-ink);
}
.refill-chip {
  position: absolute; right: 10px; top: 10px;
  font-size: 0.7rem; padding: 3px 8px; border-radius: 999px;
  background: oklch(0.25 0.02 60 / 0.85); color: var(--ink-dim);
}
.st-new { background: var(--st-new); }
.st-favorite { background: var(--st-favorite); }
.st-contacted { background: var(--st-contacted); }
.st-scheduled { background: var(--st-scheduled); }
.st-done { background: var(--st-done); }
.st-rejected { background: var(--st-rejected); color: var(--ink); }
.st-archived { background: var(--st-archived); color: var(--ink); }

.filter.basement { border-style: dashed; }
.filter.small { font-size: 0.8rem; padding: 3px 11px; }

.field-filters {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px 26px;
  margin: -10px 0 26px; padding: 12px 16px;
  background: var(--bg-raise); border-radius: var(--radius);
}
.ff-group { display: flex; align-items: center; gap: 8px; }
.ff-title {
  font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.1em;
  color: var(--ink-faint); margin-right: 2px;
}
.ff-reset { color: var(--ink-dim); font-size: 0.82rem; margin-left: auto; }
.ff-reset:hover { color: oklch(0.75 0.13 25); }

.fav-controls {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 14px; border-top: 1px solid var(--line);
}
.fav-rank { color: var(--accent); font-size: 0.85rem; font-weight: 700; flex: 1; }
.fav-controls form { display: flex; gap: 6px; }
.fav-controls button {
  background: var(--bg-soft); color: var(--ink-dim);
  border: 1px solid var(--line); border-radius: 8px;
  width: 34px; height: 30px; font-size: 1rem; transition: all 0.15s;
}
.fav-controls button:hover:not(:disabled) { color: var(--accent); border-color: var(--accent-deep); }
.fav-controls button:disabled { opacity: 0.3; cursor: default; }
.card-body { padding: 14px 16px 16px; }
.card-name { font-family: var(--serif); font-weight: 400; font-size: 1.15rem; margin-bottom: 4px; }
.card-meta { color: var(--ink-dim); font-size: 0.85rem; }
.card-sub { color: var(--ink-faint); font-size: 0.8rem; margin-top: 6px; display: flex; justify-content: space-between; gap: 8px; }

/* ---------- анкета ---------- */

.detail {
  display: grid; grid-template-columns: minmax(0, 7fr) minmax(320px, 5fr);
  gap: clamp(24px, 4vw, 56px); align-items: start;
}
@media (max-width: 900px) { .detail { grid-template-columns: 1fr; } }

.gallery-kind {
  font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.14em;
  color: var(--ink-faint); margin: 26px 0 10px;
}
.gallery-kind:first-child { margin-top: 0; }
.gallery-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; }
.gallery-grid.single { grid-template-columns: minmax(0, 420px); }
.shot {
  padding: 0; border: 0; background: var(--bg-soft);
  border-radius: var(--radius); overflow: hidden;
  transition: opacity 0.2s;
}
.shot img { width: 100%; aspect-ratio: 3 / 4; object-fit: cover; }
.shot:hover { opacity: 0.85; }

.detail-title-row { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; }
.detail-name { font-family: var(--serif); font-weight: 400; font-size: clamp(1.6rem, 3vw, 2.2rem); }
.detail-sub { color: var(--ink-faint); font-size: 0.85rem; margin: 6px 0 20px; }

.status-row { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.basement-row { margin-bottom: 26px; opacity: 0.75; }
.status-btn {
  border: 1px solid var(--line); background: transparent; color: var(--ink-dim);
  border-radius: 999px; padding: 6px 14px; font-size: 0.85rem; transition: all 0.2s;
}
.status-btn:hover:not(:disabled) { border-color: var(--accent-deep); color: var(--ink); }
.status-btn.active { color: var(--accent-ink); cursor: default; }
.status-btn.active.st-new { background: var(--st-new); border-color: var(--st-new); }
.status-btn.active.st-favorite { background: var(--st-favorite); border-color: var(--st-favorite); }
.status-btn.active.st-contacted { background: var(--st-contacted); border-color: var(--st-contacted); }
.status-btn.active.st-scheduled { background: var(--st-scheduled); border-color: var(--st-scheduled); }
.status-btn.active.st-done { background: var(--st-done); border-color: var(--st-done); }
.status-btn.active.st-rejected { background: var(--st-rejected); border-color: var(--st-rejected); color: var(--ink); }
.status-btn.active.st-archived { background: var(--st-archived); border-color: var(--st-archived); color: var(--ink); }

.facts { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.facts > div { background: var(--bg-raise); padding: 10px 14px; }
.facts dt { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.1em; color: var(--ink-faint); }
.facts dd { margin-top: 2px; }

.tags { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.tag {
  font-size: 0.8rem; color: var(--accent);
  border: 1px solid oklch(0.45 0.06 80); border-radius: 999px; padding: 4px 12px;
}

.block-label {
  font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.14em;
  color: var(--ink-faint); margin: 26px 0 10px;
}
.prose { white-space: pre-line; color: var(--ink); }

/* ---------- заметки ---------- */

.comment { border-left: 2px solid var(--line); padding: 8px 0 8px 14px; margin-bottom: 14px; }
.comment-head { display: flex; align-items: baseline; gap: 10px; }
.comment-author { font-weight: 600; font-size: 0.88rem; }
.comment-author.me { color: var(--accent); }
.comment-date { color: var(--ink-faint); font-size: 0.78rem; flex: 1; }
.comment-text { margin-top: 4px; white-space: pre-line; }
.tiny-delete {
  background: none; border: 0; color: var(--ink-faint); font-size: 0.8rem;
  padding: 2px 6px; border-radius: 6px;
}
.tiny-delete:hover { color: oklch(0.75 0.15 25); background: var(--bg-soft); }

.comment-form textarea,
.edit-form input, .edit-form select, .edit-form textarea {
  width: 100%; background: var(--bg-soft); color: var(--ink);
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 10px 12px; font: inherit; margin-top: 4px;
}
.comment-form textarea:focus, .edit-form :is(input, select, textarea):focus {
  outline: none; border-color: var(--accent-deep);
}
.comment-form { margin-top: 18px; }

.primary {
  margin-top: 12px; background: var(--accent); color: var(--accent-ink);
  border: 0; border-radius: 999px; padding: 10px 24px;
  font-weight: 700; font-size: 0.92rem; transition: background 0.2s;
}
.primary:hover { background: var(--accent-deep); }

/* ---------- правка ---------- */

.edit-form { max-width: 760px; margin-top: 20px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px 18px; }
.edit-form label { display: block; font-size: 0.82rem; color: var(--ink-dim); }
.edit-form .wide { margin-top: 16px; }
.formats-set {
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 16px; margin-top: 20px;
  display: flex; flex-wrap: wrap; gap: 10px 18px;
}
.formats-set legend { padding: 0 8px; color: var(--ink-faint); font-size: 0.82rem; }
.check { display: flex; gap: 8px; align-items: center; color: var(--ink); font-size: 0.9rem; }
.check input { accent-color: var(--accent); width: 16px; height: 16px; }

.photo-admin { margin-top: 44px; }
.photo-kind-block h3 { font-weight: 500; font-size: 0.95rem; color: var(--ink-dim); margin: 18px 0 10px; }
.photo-admin-grid { display: flex; flex-wrap: wrap; gap: 12px; }
.photo-admin-item { position: relative; width: 130px; }
.photo-admin-item img { width: 130px; height: 174px; object-fit: cover; border-radius: var(--radius); }
.photo-admin-item form { position: absolute; top: 6px; right: 6px; }
.photo-admin-item .tiny-delete { background: oklch(0.2 0.01 60 / 0.8); color: var(--ink); }
.photo-upload { width: 130px; }
.upload-label {
  display: grid; place-items: center; width: 130px; height: 174px;
  border: 1px dashed var(--line); border-radius: var(--radius);
  color: var(--ink-faint); font-size: 0.85rem; cursor: pointer; transition: all 0.2s;
}
.upload-label:hover { border-color: var(--accent-deep); color: var(--accent); }

/* ---------- лайтбокс ---------- */

.lightbox {
  position: fixed; inset: 0; z-index: 50;
  background: oklch(0.10 0.01 60 / 0.94);
  display: grid; place-items: center;
}
.lightbox[hidden] { display: none; }
.lightbox img {
  max-width: min(92vw, 1200px); max-height: 86vh;
  border-radius: 6px; object-fit: contain;
}
.lb-close, .lb-prev, .lb-next {
  position: fixed; background: none; border: 0; color: var(--ink-dim);
  font-size: 2rem; padding: 14px; z-index: 51; transition: color 0.15s;
}
.lb-close:hover, .lb-prev:hover, .lb-next:hover { color: var(--ink); }
.lb-close { top: 12px; right: 18px; }
.lb-prev { left: 8px; top: 50%; transform: translateY(-50%); font-size: 3rem; }
.lb-next { right: 8px; top: 50%; transform: translateY(-50%); font-size: 3rem; }
.lb-caption {
  position: fixed; bottom: 18px; left: 0; right: 0;
  text-align: center; color: var(--ink-dim); font-size: 0.85rem;
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
