@import url("https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,400;9..144,500;9..144,600;9..144,700&family=Work+Sans:wght@400;500;600&family=JetBrains+Mono:wght@400;500;600&display=swap");

/* ---------- Theme tokens (shared with runlog/travellog for a consistent "log" family look) ---------- */
:root {
  --font-display: "Fraunces", Georgia, serif;
  --font-body: "Work Sans", -apple-system, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, monospace;

  --series-1: #2a78d6;
  --series-5: #4a3aa7;
  --series-6: #e34948;

  --status-good: #0ca30c;
  --status-critical: #d03b3b;

  --page: #f9f9f7;
  --surface: #fcfcfb;
  --surface-raised: #ffffff;
  --ink-primary: #0b0b0b;
  --ink-secondary: #52514e;
  --ink-muted: #898781;
  --border: rgba(11, 11, 11, 0.1);
  --contour: rgba(11, 11, 11, 0.035);
  --contour-texture: rgba(11, 11, 11, 0.154);
  --accent: var(--series-1);
}

/* ---------- Reset & page shell ---------- */
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--page);
  color: var(--ink-primary);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.5;
  position: relative;
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  background-color: var(--contour-texture);
  -webkit-mask-image: url("../img/contours.svg");
  mask-image: url("../img/contours.svg");
  -webkit-mask-repeat: repeat;
  mask-repeat: repeat;
  -webkit-mask-size: 360px 360px;
  mask-size: 360px 360px;
  pointer-events: none;
  z-index: 0;
}
.app-shell {
  position: relative;
  z-index: 1;
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 20px 64px;
}

/* ---------- Header ---------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 28px 0 18px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 20px;
}
.wordmark {
  display: flex;
  align-items: baseline;
  gap: 10px;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 26px;
  letter-spacing: 0.01em;
}
.wordmark .peak { color: #34a853; font-size: 20px; position: relative; top: -3px; }
.auth-control { display: flex; align-items: center; }
.auth-form { display: flex; align-items: center; gap: 8px; }
.auth-form input[type="password"] { width: 140px; padding: 6px 10px; font-size: 13px; }
.crumbs { min-height: 1px; }

/* ---------- Forms & buttons (shared conventions) ---------- */
label { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-muted); margin-bottom: 4px; }
input, select, textarea {
  width: 100%; font-family: var(--font-body); font-size: 14px; padding: 8px 10px;
  background: var(--surface-raised); border: 1px solid var(--border); border-radius: 6px; color: var(--ink-primary);
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
button.btn {
  font-family: var(--font-body); font-weight: 600; font-size: 13.5px; padding: 9px 18px;
  background: var(--accent); color: #fff; border: none; border-radius: 6px; cursor: pointer;
  transition: transform 0.1s ease, opacity 0.15s ease;
}
button.btn:hover { opacity: 0.9; }
button.btn:active { transform: scale(0.97); }
button.btn.ghost { background: transparent; color: var(--ink-primary); border: 1px solid var(--border); }
button.btn.danger { background: var(--status-critical); }
button.btn.btn-sm { padding: 5px 10px; font-size: 12.5px; }
button.btn:disabled { opacity: 0.35; cursor: default; }
.form-status { font-size: 12px; color: var(--ink-muted); margin-top: 8px; min-height: 16px; }
.form-status.ok { color: var(--status-good); }
.form-status.error { color: var(--status-critical); }
.empty-note { color: var(--ink-muted); font-size: 13px; font-style: italic; }

.badge {
  display: inline-block; font-family: var(--font-mono); font-size: 10px; font-weight: 600;
  padding: 2px 7px; border-radius: 4px; letter-spacing: 0.04em; border: 1px solid var(--border);
  color: var(--ink-secondary); background: var(--contour);
}

/* ---------- Album grid ---------- */
.album-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 20px;
}
.album-tile {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  cursor: pointer;
  padding: 0;
  text-align: left;
  font-family: inherit;
}
.album-tile:hover { border-color: var(--accent); }
.album-cover {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  background: var(--contour);
  overflow: hidden;
}
.album-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.album-meta { padding: 12px 14px; }
.album-name { display: block; font-family: var(--font-display); font-weight: 600; font-size: 15px; }
.album-count { display: block; font-size: 12px; color: var(--ink-muted); margin-top: 2px; }

/* ---------- Album detail / photo grid ---------- */
.album-detail-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
}
.album-detail-header h2 { font-family: var(--font-display); font-size: 20px; margin: 0; }
.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 6px;
}
.photo-tile {
  padding: 0;
  border: none;
  background: var(--contour);
  cursor: pointer;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  border-radius: 4px;
}
.photo-tile img { width: 100%; height: 100%; object-fit: cover; display: block; }
.load-more-row { display: flex; justify-content: center; margin-top: 24px; }

/* ---------- Lightbox ---------- */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 50;
}
.lightbox-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(11, 11, 11, 0.88);
}
.lightbox-body {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-columns: 1fr 320px;
  grid-template-rows: 1fr;
}
.lightbox-image-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
  overflow: hidden;
}
.lightbox-image { max-width: 100%; max-height: 100%; object-fit: contain; }
.lightbox-info {
  background: var(--surface-raised);
  padding: 24px;
  overflow-y: auto;
  color: var(--ink-primary);
}
.lightbox-info h3 { font-family: var(--font-display); font-size: 18px; margin: 0 0 10px; }
.lightbox-description { font-size: 13.5px; color: var(--ink-secondary); white-space: pre-wrap; }
.lightbox-meta { font-size: 12px; color: var(--ink-muted); margin-top: 14px; }
.tag-list { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.lightbox-actions { display: flex; gap: 8px; margin-top: 16px; flex-wrap: wrap; }
.lightbox-edit-form label { margin-top: 12px; }
.lightbox-edit-form textarea { resize: vertical; }
.lightbox-close {
  position: absolute;
  top: 16px; right: 16px;
  width: 36px; height: 36px;
  border-radius: 50%;
  border: none;
  background: rgba(255,255,255,0.12);
  color: #fff;
  font-size: 20px;
  cursor: pointer;
  z-index: 2;
}
.lightbox-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 48px; height: 48px;
  border-radius: 50%;
  border: none;
  background: rgba(255,255,255,0.12);
  color: #fff;
  font-size: 26px;
  cursor: pointer;
  z-index: 2;
}
.lightbox-nav-prev { left: 16px; }
.lightbox-nav-next { right: 336px; }

@media (max-width: 760px) {
  .lightbox-body { grid-template-columns: 1fr; grid-template-rows: 1fr auto; }
  .lightbox-nav-next { right: 16px; }
  .lightbox-info { max-height: 40vh; }
}
