/* pctrs — dark, minimal, photos first */

:root {
  --bg: #0c0c0e;
  --surface: #151518;
  --field: #0f0f12;
  --line: #26262c;
  --text: #f0efec;
  --muted: #98979f;
  --faint: #5b5b63;
  --accent: #f0b429;
  --accent-ink: #1a1408;
  --danger: #ff6b6b;
}

* { box-sizing: border-box; }

html { color-scheme: dark; }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

main { flex: 1; }

a { color: inherit; text-decoration: none; }
p a, .byline a { border-bottom: 1px solid var(--line); }
p a:hover, .byline a:hover { border-color: var(--accent); }

::selection { background: var(--accent); color: var(--accent-ink); }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

.muted { color: var(--muted); }

/* ---------- nav ---------- */

.nav {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  height: 56px;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}

.brand {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.brand .dot { color: var(--accent); }

.nav-actions { display: flex; align-items: center; gap: 8px; }
.nav-actions form { display: contents; }

/* ---------- buttons ---------- */

.btn {
  display: inline-block;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 7px 16px;
  font: 500 14px/1.4 inherit;
  color: var(--text);
  background: none;
  cursor: pointer;
}
.btn-accent { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-accent:hover { filter: brightness(1.07); }
.btn-ghost { border-color: var(--line); }
.btn-ghost:hover { background: var(--surface); }
.btn-sm { padding: 5px 13px; font-size: 13px; }
.btn-wide { width: 100%; margin-top: 6px; }
.danger { color: var(--danger); }
.danger:hover { background: rgba(255, 107, 107, 0.08); }

/* ---------- gallery ---------- */

#gallery {
  display: flex;
  flex-direction: column;   /* no-JS fallback: single column */
  gap: 6px;
  padding: 6px;
}
#gallery.laid { flex-direction: row; align-items: flex-start; }
#gallery .col { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }

.ph {
  display: block;
  background: var(--dc, var(--surface));
  aspect-ratio: var(--ar, 1.5);
  overflow: hidden;
  border-radius: 2px;
}
.ph img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  opacity: 0;
  transition: opacity 0.45s ease;
}
.ph img.loaded { opacity: 1; }
.ph:hover img { opacity: 0.92; }

/* ---------- profile head / empty state ---------- */

.profile-head { padding: 30px 20px 6px; text-align: center; }
.profile-head h1 { margin: 0; font-size: 24px; }
.profile-head p { margin: 4px 0 0; font-size: 14px; }
.profile-head .bio {
  max-width: 480px;
  margin: 10px auto 0;
  color: var(--muted);
  font-size: 15px;
  white-space: pre-line;
}
.profile-head .head-action { margin-top: 14px; }
.feed-label {
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--faint);
}

.empty { text-align: center; margin: 18vh auto 0; padding: 0 20px; max-width: 420px; }
.empty h2 { font-size: 20px; margin-bottom: 8px; }
.empty p { color: var(--muted); }

/* ---------- photo page ---------- */

.stage {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px 64px;
  min-height: 40vh;
}
.photo-large {
  max-width: 100%;
  max-height: 78vh;
  width: auto;
  height: auto;
  border-radius: 2px;
  background: var(--dc, var(--surface));
  cursor: zoom-in;
  user-select: none;
  -webkit-user-select: none;
}

/* ---------- fullscreen viewer ---------- */

#viewer {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  touch-action: pan-y;
}
#viewer[hidden] { display: none; }
#viewer img {
  max-width: 100vw;
  max-height: 100vh;
  width: auto;
  height: auto;
  object-fit: contain;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
}
#viewer-close {
  position: fixed;
  top: 14px;
  right: 14px;
  z-index: 101;
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
}
#viewer-close:hover { background: rgba(255, 255, 255, 0.22); }
body.no-scroll { overflow: hidden; }

.stage-nav {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 34px;
  color: var(--faint);
}
.stage-nav:hover { color: var(--text); }
.stage-nav.left { left: 0; }
.stage-nav.right { right: 0; }

.photo-meta { max-width: 760px; margin: 6px auto 64px; padding: 0 20px; }
.photo-meta h1 { font-size: 22px; margin: 8px 0 4px; }
.photo-meta h1.untitled { color: var(--faint); font-weight: 500; }
.caption { color: var(--muted); white-space: pre-line; margin: 4px 0 8px; }
.byline { color: var(--faint); font-size: 14px; margin: 4px 0 0; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.chip {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 12px;
  font-size: 13px;
  color: var(--muted);
  white-space: nowrap;
}
.chip-link:hover { border-color: var(--accent); color: var(--text); }

.owner-actions { display: flex; gap: 8px; margin-top: 22px; }

/* ---------- forms ---------- */

.card {
  max-width: 400px;
  margin: 11vh auto 0;
  padding: 28px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
}
.card h1 { margin: 0 0 6px; font-size: 22px; }
.card .muted { font-size: 14px; margin-top: 0; }

label { display: block; font-size: 13px; color: var(--muted); margin: 14px 0 0; }
label .hint { color: var(--faint); font-size: 12px; }
input, textarea {
  display: block;
  width: 100%;
  margin-top: 6px;
  padding: 10px 12px;
  background: var(--field);
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--text);
  font: inherit;
  font-size: 15px;
}
input:focus, textarea:focus { border-color: var(--accent); outline: none; }
textarea { resize: vertical; }

.form-error { color: var(--danger); font-size: 14px; margin: 10px 0 0; }
.form-row { display: flex; gap: 8px; margin-top: 16px; }

#edit-form { margin-top: 18px; padding: 18px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; }
#edit-form label { margin-top: 0; }
#edit-form label + label { margin-top: 12px; }

/* ---------- upload ---------- */

.narrow { max-width: 680px; margin: 0 auto; padding: 32px 20px; width: 100%; }
.page-title { font-size: 24px; margin: 0 0 20px; }

#drop {
  border: 2px dashed var(--line);
  border-radius: 16px;
  padding: 56px 24px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}
#drop:hover, #drop.over { border-color: var(--accent); background: rgba(240, 180, 41, 0.04); }
.drop-big { font-size: 18px; font-weight: 600; margin: 0 0 4px; }
#drop .muted { margin: 0; }
.drop-hint { color: var(--faint); font-size: 13px; margin: 14px 0 0; }

#queue { list-style: none; padding: 0; margin: 24px 0 0; display: flex; flex-direction: column; gap: 10px; }
#queue li {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  font-size: 14px;
}
#queue img { width: 44px; height: 44px; object-fit: cover; border-radius: 6px; }
#queue .q-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#queue .q-status { color: var(--muted); font-size: 13px; white-space: nowrap; }
#queue .q-status.ok { color: var(--accent); }
#queue .q-status.err { color: var(--danger); }
#queue .bar { flex: 0 0 90px; height: 4px; background: var(--field); border-radius: 2px; overflow: hidden; }
#queue .bar i { display: block; height: 100%; width: 0; background: var(--accent); transition: width 0.2s ease; }

#done { margin-top: 24px; text-align: center; }

/* ---------- footer ---------- */

.foot {
  padding: 40px 20px;
  text-align: center;
  color: var(--faint);
  font-size: 13px;
}

/* ---------- responsive ---------- */

@media (max-width: 640px) {
  .stage { padding: 12px 44px; }
  .stage-nav { width: 42px; font-size: 28px; }
  .card { margin-top: 6vh; }
}
