/* i_am_a_photographer — gallery styles */
:root {
  color-scheme: dark;
  --bg: #0d0e10;
  --bg-raised: #16181c;
  --bg-input: #101215;
  --border: #2a2e36;
  --border-strong: #3c414c;
  --text: #eceef2;
  --text-muted: #9aa1ad;
  --accent: #d8b26a;
  --danger: #e0655c;
  --radius: 10px;
  --wrap: 1240px;
  --row-h: 260px;
  --tile-gap: 14px;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

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

a { color: inherit; }
a:hover { color: var(--accent); }

h1, h2, h3 { font-weight: 600; letter-spacing: -0.015em; line-height: 1.25; }

.wrap { width: 100%; max-width: var(--wrap); margin: 0 auto; padding: 0 24px; }

.skip-link {
  position: absolute; left: -9999px; top: 0; background: var(--accent);
  color: #101215; padding: 10px 16px; border-radius: 0 0 var(--radius) 0; z-index: 10;
}
.skip-link:focus { left: 0; }

.visually-hidden {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* Header ------------------------------------------------------------------ */

.site-header {
  border-bottom: 1px solid var(--border);
  background: rgba(13, 14, 16, 0.92);
  position: sticky; top: 0; z-index: 5;
  backdrop-filter: blur(8px);
}
.header-inner {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; min-height: 68px;
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; font-weight: 600; letter-spacing: 0.02em; }
.brand-mark {
  width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid var(--accent); box-shadow: inset 0 0 0 2px var(--bg);
}
.brand-text { font-size: 1.05rem; }
.site-nav { display: flex; align-items: center; gap: 18px; font-size: 0.92rem; }
.site-nav a { text-decoration: none; color: var(--text-muted); }
.site-nav a:hover, .site-nav a[aria-current="page"] { color: var(--text); }
.inline-form { display: inline; margin: 0; }

/* Gallery ----------------------------------------------------------------- */

main.wrap { flex: 1; padding: 40px 24px 72px; }

.tagline { color: var(--text-muted); margin: 0 0 28px; max-width: 60ch; }

/* Justified rows: each tile grows in proportion to its aspect ratio (set per
   photograph in an inline, nonce-protected style block), so every row lands at
   the same height with nothing cropped and the gallery order left intact. */
.gallery { display: flex; flex-wrap: wrap; gap: var(--tile-gap); }

.tile {
  display: block; position: relative; text-decoration: none;
  flex: var(--ar, 1.5) 1 calc(var(--ar, 1.5) * var(--row-h));
  border-radius: var(--radius); overflow: hidden;
  background: var(--bg-raised); line-height: 0;
}
/* Absorb the leftover space so a short final row keeps its natural size. */
.tile-filler { flex-grow: 1000; height: 0; }
.tile img {
  width: 100%; height: auto; display: block;
  transition: transform 420ms cubic-bezier(0.2, 0.6, 0.2, 1), opacity 200ms;
}
.tile:hover img, .tile:focus-visible img { transform: scale(1.03); }
.tile-caption {
  position: absolute; inset: auto 0 0 0; padding: 34px 14px 12px;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.78), rgba(0, 0, 0, 0));
  line-height: 1.35; opacity: 0; transition: opacity 200ms;
}
.tile:hover .tile-caption, .tile:focus-visible .tile-caption { opacity: 1; }
.tile-title { font-size: 0.92rem; color: #fff; }

.empty { text-align: center; padding: 80px 0; color: var(--text-muted); }
.empty h1 { color: var(--text); margin-bottom: 8px; }

/* Hashtags ---------------------------------------------------------------- */

.tag-head { margin: 0 0 20px; }
.tag-head h1 { margin: 0 0 4px; font-size: 1.5rem; }

.tag-bar { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 24px; }

.tag-chip {
  display: inline-flex; align-items: baseline; gap: 6px;
  padding: 5px 12px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--bg-raised);
  color: var(--text-muted); text-decoration: none;
  font-size: 0.82rem; line-height: 1.4; white-space: nowrap;
}
.tag-chip:hover { border-color: var(--border-strong); color: var(--text); }
.tag-chip.is-active {
  border-color: var(--accent); color: var(--accent);
}
.tag-count { font-size: 0.72rem; opacity: 0.7; font-variant-numeric: tabular-nums; }

.photo-tags {
  display: flex; flex-wrap: wrap; gap: 8px;
  list-style: none; margin: 20px 0 0; padding: 0;
}

/* Detail ------------------------------------------------------------------ */

.detail { display: grid; gap: 28px; }
.detail-figure { margin: 0; text-align: center; }
.detail-figure img {
  max-width: 100%; max-height: 78vh; width: auto; height: auto;
  border-radius: var(--radius); background: var(--bg-raised);
}
.detail-body { max-width: 68ch; margin: 0 auto; width: 100%; }
.detail-body h1 { margin: 0 0 12px; font-size: 1.6rem; }
.detail-description { color: var(--text-muted); }
.detail-description p { margin: 0 0 12px; }
.detail-meta {
  display: flex; flex-wrap: wrap; gap: 8px 32px; margin: 24px 0 0;
  padding-top: 20px; border-top: 1px solid var(--border);
  font-size: 0.86rem; color: var(--text-muted);
}
.detail-meta dt { text-transform: uppercase; letter-spacing: 0.08em; font-size: 0.7rem; opacity: 0.75; }
.detail-meta dd { margin: 2px 0 0; }
/* The shot data sits directly above the file data, so it borrows the rule
   above it rather than drawing a second one. */
.shot-meta + .detail-meta { border-top: 0; padding-top: 0; margin-top: 16px; }
.detail-admin { margin-top: 20px; font-size: 0.88rem; }

.detail-nav {
  display: grid; grid-template-columns: 1fr auto 1fr; gap: 16px; align-items: center;
  margin-top: 48px; padding-top: 20px; border-top: 1px solid var(--border);
  font-size: 0.9rem; color: var(--text-muted);
}
.nav-next { text-align: right; }
.nav-link { text-decoration: none; }
.nav-index { white-space: nowrap; }

/* Buttons and forms ------------------------------------------------------- */

.button {
  display: inline-block; padding: 9px 18px; border-radius: var(--radius);
  border: 1px solid var(--border-strong); background: var(--bg-raised);
  color: var(--text); font: inherit; font-size: 0.92rem; cursor: pointer;
  text-decoration: none; transition: border-color 150ms, background 150ms;
}
.button:hover { border-color: var(--accent); color: var(--text); }
.link-button {
  background: none; border: 0; padding: 0; color: var(--text-muted);
  font: inherit; font-size: 0.92rem; cursor: pointer; text-decoration: underline;
}
.link-button:hover { color: var(--text); }
.site-nav .link-button { text-decoration: none; }
.link-button.danger:hover { color: var(--danger); }

input[type="text"], input[type="password"], textarea {
  width: 100%; padding: 9px 12px; border-radius: var(--radius);
  border: 1px solid var(--border); background: var(--bg-input); color: var(--text);
  font: inherit; font-size: 0.94rem;
}
input:focus, textarea:focus, .button:focus-visible, .tile:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}
textarea { resize: vertical; min-height: 74px; }

.alert { padding: 10px 14px; border-radius: var(--radius); font-size: 0.9rem; }
.alert-error { background: rgba(224, 101, 92, 0.12); border: 1px solid rgba(224, 101, 92, 0.4); color: #f3b1ac; }

/* Login ------------------------------------------------------------------- */

.login { max-width: 380px; margin: 40px auto; }
.login h1 { font-size: 1.4rem; margin: 0 0 6px; }
.login-help, .login-back { color: var(--text-muted); font-size: 0.9rem; }
.login-form { display: grid; gap: 8px; margin: 20px 0; }
.login-form label { font-size: 0.85rem; color: var(--text-muted); }
.login-form .button { margin-top: 8px; justify-self: start; }

/* Admin ------------------------------------------------------------------- */

.admin-head { margin-bottom: 24px; }
.admin-head h1 { font-size: 1.5rem; margin: 0 0 6px; }
.muted { color: var(--text-muted); font-size: 0.92rem; margin: 0; }

.dropzone {
  border: 2px dashed var(--border-strong); border-radius: 14px;
  padding: 40px 24px; text-align: center; transition: border-color 150ms, background 150ms;
  background: rgba(255, 255, 255, 0.012);
}
.dropzone.is-dragover {
  border-color: var(--accent); border-style: solid;
  background: rgba(216, 178, 106, 0.09);
  box-shadow: inset 0 0 0 1px rgba(216, 178, 106, 0.35);
}
.dropzone.is-dragover .dropzone-title { color: var(--accent); }
.dropzone-inner { display: grid; gap: 8px; justify-items: center; }
.dropzone-icon {
  width: 34px; height: 34px; border-radius: 50%;
  border: 2px solid var(--border-strong); position: relative; margin-bottom: 4px;
}
.dropzone-icon::after {
  content: ""; position: absolute; inset: 7px; border-radius: 50%; border: 2px solid var(--accent);
}
.dropzone-title { font-size: 1.05rem; margin: 0; }
.dropzone-hint { color: var(--text-muted); font-size: 0.85rem; margin: 0; }
.dropzone .button { margin-top: 6px; }

.upload-queue { list-style: none; margin: 18px 0 0; padding: 0; display: grid; gap: 8px; }
.upload-item {
  display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; align-items: center;
  padding: 10px 14px; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--bg-raised); font-size: 0.88rem;
}
.upload-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.upload-state { color: var(--text-muted); font-size: 0.82rem; }
.upload-item.is-error { border-color: rgba(224, 101, 92, 0.5); }
.upload-item.is-error .upload-state { color: #f3b1ac; }
.upload-item.is-done .upload-state { color: var(--accent); }
.upload-bar { grid-column: 1 / -1; height: 3px; border-radius: 3px; background: var(--border); overflow: hidden; }
.upload-bar > span { display: block; height: 100%; width: 0; background: var(--accent); transition: width 120ms linear; }

.admin-list-head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 16px; margin: 44px 0 14px;
}
.admin-list-head h2 { font-size: 1.05rem; margin: 0; }
.order-status { color: var(--text-muted); font-size: 0.82rem; }

.admin-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.admin-card {
  display: grid; grid-template-columns: 200px 1fr auto; gap: 18px; align-items: start;
  padding: 14px; border: 1px solid var(--border); border-radius: 14px; background: var(--bg-raised);
}
.admin-card.is-new { border-color: var(--accent); }
.admin-card.is-dragging { opacity: 0.4; }
.admin-card.is-drop-target { border-color: var(--accent); }
.admin-card-media { display: flex; gap: 8px; align-items: flex-start; }
.drag-handle {
  cursor: grab; background: none; border: 1px solid transparent; border-radius: 6px;
  color: var(--text-muted); padding: 6px 4px; line-height: 1; font-size: 0.9rem;
  user-select: none; touch-action: none; align-self: flex-start;
}
.drag-handle:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.drag-handle:hover { color: var(--text); border-color: var(--border); }
.drag-handle:active { cursor: grabbing; }
.admin-thumb { display: block; flex: 1; line-height: 0; }
.admin-thumb img {
  width: 100%; aspect-ratio: 4 / 3; object-fit: cover;
  border-radius: 8px; background: var(--bg-input);
}
.admin-form { display: grid; gap: 10px; min-width: 0; }
.admin-form label { display: grid; gap: 4px; font-size: 0.8rem; color: var(--text-muted); }
.field-hint { font-size: 0.74rem; opacity: 0.7; }
.admin-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.admin-actions .spacer { flex: 1; }
.save-status { font-size: 0.82rem; color: var(--accent); }
.save-status.is-error { color: #f3b1ac; }
.file-meta { font-size: 0.76rem; color: var(--text-muted); }
.delete-form { margin: 0; }
.empty-admin { color: var(--text-muted); margin-top: 32px; }

/* Footer ------------------------------------------------------------------ */

.site-footer {
  border-top: 1px solid var(--border); padding: 22px 0;
  color: var(--text-muted); font-size: 0.82rem;
}
.site-footer .dot { margin: 0 8px; }

@media (max-width: 720px) {
  main.wrap { padding: 28px 16px 56px; }
  .wrap { padding: 0 16px; }
  :root { --row-h: 150px; --tile-gap: 10px; }
  .tile-caption { opacity: 1; padding: 24px 10px 8px; }
  .admin-card { grid-template-columns: 1fr; }
  .admin-thumb img { aspect-ratio: 16 / 9; }
  .detail-nav { grid-template-columns: 1fr; text-align: center; }
  .nav-next { text-align: center; }
}

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