/* ------------------------------------------------------------------ *
 * Photo Albums — stylesheet
 * Everything is driven by the CSS variables in :root, so you can
 * restyle the whole app by editing the values below.
 * ------------------------------------------------------------------ */

:root {
  --bg:          #f6f6f4;
  --surface:     #ffffff;
  --ink:         #1c1b1a;
  --muted:       #6b6a67;
  --line:        #e6e5e1;
  --accent:      #2f6f4f;
  --accent-ink:  #ffffff;
  --danger:      #b23a34;
  --radius:      14px;
  --radius-sm:   9px;
  --shadow:      0 1px 2px rgba(0,0,0,.05), 0 8px 24px rgba(0,0,0,.05);
  --maxw:        1080px;
  --font:        -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1 { font-size: 1.6rem; margin: 0 0 .4em; letter-spacing: -.01em; }
h2 { font-size: 1.15rem; }
a  { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.wrap { max-width: var(--maxw); margin: 0 auto; padding: 28px 20px 64px; }
.wrap.narrow { max-width: 440px; }

.muted { color: var(--muted); }
.small { font-size: .875rem; }
.lead  { font-size: 1.05rem; }
.empty { padding: 32px 0; }

/* --- Top bar --------------------------------------------------------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 20px; background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.brand { font-weight: 650; color: var(--ink); }
.brand:hover { text-decoration: none; }

/* --- Cards ----------------------------------------------------------- */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow);
  margin: 18px 0;
}
.section-title { margin: 0 0 8px; font-size: 1rem; }
details.card > summary {
  cursor: pointer; list-style: revert; font-weight: 600;
}
details.card[open] > summary { margin-bottom: 12px; }
hr { border: none; border-top: 1px solid var(--line); margin: 20px 0; }

/* --- Layout helpers -------------------------------------------------- */
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.row-end { display: flex; gap: 10px; justify-content: flex-end; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.inline { display: inline; }
.back { font-size: .9rem; }

/* --- Forms ----------------------------------------------------------- */
label { display: flex; flex-direction: column; gap: 6px; font-size: .9rem; font-weight: 550; color: #34332f; }
label.checkbox { flex-direction: row; align-items: center; gap: 8px; font-weight: 450; }
input[type=text], input[type=password], textarea {
  font: inherit; padding: 10px 12px;
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: #fff; color: var(--ink); width: 100%;
}
input:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: var(--accent); }
input[type=file] { font-size: .9rem; }
textarea { resize: vertical; }

/* --- Buttons --------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  font: inherit; font-weight: 550; cursor: pointer;
  padding: 10px 16px; border-radius: var(--radius-sm);
  border: 1px solid var(--line); background: #fff; color: var(--ink);
}
.btn:hover { text-decoration: none; border-color: #cfcec9; }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.primary:hover { filter: brightness(1.05); }
.btn.ghost { background: transparent; }
.btn.danger { color: #fff; background: var(--danger); border-color: var(--danger); }
.btn.link-btn { border: none; background: none; color: var(--accent); padding: 6px 0; }
.link-btn:hover { text-decoration: underline; }

/* --- Notices --------------------------------------------------------- */
.notice { padding: 10px 14px; border-radius: var(--radius-sm); margin: 14px 0; font-size: .92rem; }
.notice.ok   { background: #e8f3ec; color: #22553b; }
.notice.warn { background: #fbeceb; color: #8f2b26; }

/* --- Server checks (setup) ------------------------------------------ */
.checks { list-style: none; padding: 0; margin: 6px 0 4px; }
.checks li { display: flex; align-items: center; gap: 10px; padding: 5px 0; font-size: .92rem; }
.checks .dot { width: 9px; height: 9px; border-radius: 50%; background: #ccc; flex: none; }
.checks li.ok  .dot { background: #3a9d6b; }
.checks li.bad .dot { background: var(--danger); }

/* --- Album grid (admin dashboard) ----------------------------------- */
.album-grid {
  display: grid; gap: 18px; margin-top: 20px;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
}
.album-card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); overflow: hidden; color: var(--ink);
  box-shadow: var(--shadow); transition: transform .08s ease;
}
.album-card:hover { text-decoration: none; transform: translateY(-2px); }
.album-cover { aspect-ratio: 4 / 3; background: #efeee9; }
.album-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.album-cover-empty { width: 100%; height: 100%; display: grid; place-items: center; color: var(--muted); font-size: .85rem; }
.album-meta { padding: 12px 14px; display: flex; flex-direction: column; gap: 2px; }
.album-meta strong { font-weight: 600; }

/* --- Share link row -------------------------------------------------- */
.share-row { display: flex; gap: 8px; margin: 8px 0; }
.share-row input { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .85rem; }

/* --- Admin thumbnail grid ------------------------------------------- */
.thumb-grid {
  display: grid; gap: 10px; margin-top: 12px;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
}
.thumb { position: relative; aspect-ratio: 1; border-radius: var(--radius-sm); overflow: hidden; background: #efeee9; }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb.is-cover { outline: 3px solid var(--accent); outline-offset: -3px; }
.thumb-actions { position: absolute; top: 6px; right: 6px; display: flex; gap: 5px; opacity: 0; transition: opacity .12s; }
.thumb:hover .thumb-actions, .thumb:focus-within .thumb-actions { opacity: 1; }
.thumb-actions form { margin: 0; }
.mini {
  width: 28px; height: 28px; border: none; border-radius: 6px; cursor: pointer;
  background: rgba(0,0,0,.6); color: #fff; font-size: 15px; line-height: 1;
}
.mini:hover { background: rgba(0,0,0,.8); }
.mini.danger:hover { background: var(--danger); }

/* --- Public gallery -------------------------------------------------- */
.album-header { margin-bottom: 8px; }
.album-header h1 { font-size: 2rem; }
.gallery {
  display: grid; gap: 8px; margin-top: 16px;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
}
.gallery-item {
  display: block; aspect-ratio: 1; overflow: hidden;
  border-radius: var(--radius-sm); background: #eae9e4;
}
.gallery-item img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .3s ease; }
.gallery-item:hover img { transform: scale(1.04); }
.album-footer { margin-top: 40px; text-align: center; }

/* --- Modal (new album) ---------------------------------------------- */
.modal { border: none; border-radius: var(--radius); padding: 24px; max-width: 440px; width: 92%; box-shadow: var(--shadow); }
.modal::backdrop { background: rgba(0,0,0,.4); }

/* --- Lightbox -------------------------------------------------------- */
.lb-overlay {
  position: fixed; inset: 0; z-index: 1000; display: none;
  align-items: center; justify-content: center;
  background: rgba(12,12,12,.94);
}
.lb-overlay.open { display: flex; }
.lb-img { max-width: 92vw; max-height: 82vh; object-fit: contain; border-radius: 6px; }
.lb-overlay button {
  position: absolute; background: rgba(255,255,255,.12); color: #fff;
  border: none; cursor: pointer; border-radius: 50%;
  width: 46px; height: 46px; font-size: 26px; line-height: 1;
  display: grid; place-items: center;
}
.lb-overlay button:hover { background: rgba(255,255,255,.25); }
.lb-close { top: 18px; right: 18px; }
.lb-prev  { left: 14px; top: 50%; transform: translateY(-50%); }
.lb-next  { right: 14px; top: 50%; transform: translateY(-50%); }
.lb-bar {
  position: absolute; bottom: 18px; left: 0; right: 0;
  display: flex; align-items: center; justify-content: center; gap: 20px;
  color: #ddd; font-size: .9rem;
}
.lb-download { color: #fff; text-decoration: underline; }

@media (max-width: 560px) {
  .lb-prev, .lb-next { width: 40px; height: 40px; font-size: 22px; }
  .album-header h1 { font-size: 1.5rem; }
}
