/* ========================================
   Gallery CSS
   ======================================== */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #0f0f0f;
  --surface: #1a1a1a;
  --surface2: #242424;
  --border: #2e2e2e;
  --text: #e8e8e8;
  --text-muted: #888;
  --accent: #c9a96e;
  --accent-dim: #9a7a4e;
  --radius: 6px;
  --gap: 4px;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Helvetica Neue', Arial, 'Hiragino Sans', sans-serif;
  font-size: 14px;
  min-height: 100vh;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--text); }

/* ── Header ── */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(15,15,15,0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}
.header-inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.site-header h1 { font-size: 18px; font-weight: 600; letter-spacing: 0.05em; }
.site-header h1 a { color: var(--text); }
.site-header nav { display: flex; gap: 12px; align-items: center; }

.btn-admin, .btn-login, .btn-logout {
  padding: 6px 14px;
  border-radius: var(--radius);
  font-size: 12px;
  font-weight: 500;
}
.btn-admin  { background: var(--accent); color: #000; }
.btn-login  { border: 1px solid var(--border); color: var(--text-muted); }
.btn-logout { border: 1px solid var(--border); color: var(--text-muted); }
.btn-admin:hover  { background: var(--accent-dim); color: #000; }
.btn-login:hover, .btn-logout:hover { border-color: var(--accent); color: var(--accent); }

/* ── Main ── */
.main-content {
  max-width: 1400px;
  margin: 0 auto;
  padding: 32px 20px 60px;
}

.section-title {
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 20px;
}

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 24px;
}
.breadcrumb a { color: var(--accent); }

/* ── Album Grid ── */
.albums-section { margin-bottom: 48px; }

.album-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
}
.album-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color .2s, transform .2s;
  color: var(--text);
}
.album-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  color: var(--text);
}
.album-cover { aspect-ratio: 4/3; overflow: hidden; background: var(--surface2); }
.album-cover img { width: 100%; height: 100%; object-fit: cover; transition: transform .3s; }
.album-card:hover .album-cover img { transform: scale(1.04); }
.album-no-cover { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; font-size: 40px; }
.album-info { padding: 12px; }
.album-name         { font-weight: 600; font-size: 15px; margin-bottom: 4px; }
.album-count-inline { font-size: 12px; color: var(--text-muted); font-weight: 400; margin-left: 4px; }
.album-date         { font-size: 12px; color: var(--text-muted); margin-bottom: 6px; }
.album-desc         { font-size: 12px; color: var(--text-muted); margin-top: 4px; line-height: 1.5; }

/* アルバムページヘッダー */
.album-page-header { margin-top: 8px; margin-bottom: 32px; }
.album-page-title  { font-size: 24px; font-weight: 700; margin-bottom: 8px; }
.album-page-date   { font-size: 13px; color: var(--text-muted); margin-bottom: 10px; }
.album-page-desc   { font-size: 14px; color: var(--text-muted); line-height: 1.8; max-width: 560px; }

/* ── Photo Grid (Masonry-like) ── */
.photo-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--gap);
}
@media (max-width: 900px) { .photo-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 600px) { .photo-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 380px) { .photo-grid { grid-template-columns: 1fr; } }

.photo-item {
  position: relative;
  overflow: hidden;
  border-radius: 3px;
  cursor: pointer;
  background: var(--surface2);
  aspect-ratio: 1;
}
.photo-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.photo-item img {
  width: 100%;
  display: block;
  transition: transform .3s;
}
.photo-item:hover img { transform: scale(1.03); }
.photo-overlay {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  padding: 24px 10px 10px;
  background: linear-gradient(transparent, rgba(0,0,0,0.7));
  opacity: 0;
  transition: opacity .2s;
}
.photo-item:hover .photo-overlay { opacity: 1; }
.photo-title { font-size: 12px; color: #fff; font-weight: 500; }

.empty-msg { color: var(--text-muted); text-align: center; padding: 60px 0; }

/* ── Lightbox ── */
.lightbox {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(0,0,0,0.96);
  align-items: center;
  justify-content: center;
}
.lightbox.active { display: flex; }

.lb-inner {
  display: flex;
  flex-direction: row;
  max-width: 96vw;
  max-height: 94vh;
  border-radius: var(--radius);
}
.lb-image-wrap {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  background: #000;
  position: relative;
}
#lbImg {
  max-width: 75vw;
  max-height: 90vh;
  object-fit: contain;
  display: block;
}
@media (max-width: 760px) {
  .lb-inner { flex-direction: column; width: 100vw; }
  #lbImg { max-width: 100vw; max-height: 60vh; }
}

.lb-info {
  width: 260px;
  flex-shrink: 0;
  background: var(--surface);
  padding: 24px 18px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
@media (max-width: 760px) { .lb-info { width: 100vw; max-height: 40vh; overflow-y: auto; box-sizing: border-box; } }

.lb-title { font-size: 15px; font-weight: 600; }
.lb-description { font-size: 13px; color: var(--text-muted); line-height: 1.6; }

/* EXIF: 縦リスト */
.lb-exif { display: flex; flex-direction: column; gap: 0; }
.exif-row {
  display: grid;
  grid-template-columns: 20px 80px 1fr;
  gap: 4px;
  align-items: start;
  padding: 5px 0;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
}
.exif-row:last-child { border-bottom: none; }
.exif-icon  { font-size: 13px; }
.exif-label { color: var(--text-muted); }
.exif-value { color: var(--text); word-break: break-all; }

/* .lightbox は position:fixed でinset:0 → absolute子要素の基準になる */
.lb-close, .lb-prev, .lb-next {
  position: absolute;
  border: none; cursor: pointer; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,0.65); color: #fff;
  border: 1px solid rgba(255,255,255,0.25);
  z-index: 1001;
  transition: background .2s;
}
.lb-close:hover, .lb-prev:hover, .lb-next:hover { background: rgba(0,0,0,0.9); }
.lb-close { top: 16px; right: 16px; width: 44px; height: 44px; font-size: 20px; }
.lb-prev  { left: 16px;  top: 50%; transform: translateY(-50%); width: 48px; height: 48px; font-size: 28px; }
.lb-next  { right: 16px; top: 50%; transform: translateY(-50%); width: 48px; height: 48px; font-size: 28px; }

/* スマホ: 矢印非表示・スワイプで操作 */
@media (max-width: 760px) {
  .lb-prev, .lb-next { display: none !important; }
}

/* ── Admin pages ── */
.admin-wrap {
  max-width: 960px;
  margin: 40px auto;
  padding: 0 20px 60px;
}
.admin-wrap h2 { font-size: 20px; margin-bottom: 24px; padding-bottom: 12px; border-bottom: 1px solid var(--border); }

.admin-nav {
  display: flex;
  gap: 8px;
  margin-bottom: 32px;
  flex-wrap: wrap;
}
.admin-nav a {
  padding: 8px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 13px;
  color: var(--text-muted);
  transition: all .2s;
}
.admin-nav a:hover, .admin-nav a.active {
  border-color: var(--accent);
  color: var(--accent);
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 20px;
}
.card h3 { font-size: 15px; margin-bottom: 16px; color: var(--text-muted); font-weight: 500; }

label { display: block; font-size: 13px; color: var(--text-muted); margin-bottom: 6px; margin-top: 14px; }
label:first-child { margin-top: 0; }

input[type="text"], input[type="password"], textarea, select {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  padding: 9px 12px;
  font-size: 14px;
  font-family: inherit;
  transition: border-color .2s;
}
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--accent);
}
textarea { resize: vertical; min-height: 80px; }

.btn {
  display: inline-block;
  padding: 9px 20px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all .2s;
  font-family: inherit;
}
.btn-primary { background: var(--accent); color: #000; }
.btn-primary:hover { background: var(--accent-dim); }
.btn-danger  { background: #c0392b; color: #fff; }
.btn-danger:hover  { background: #a93226; }
.btn-secondary { background: var(--surface2); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { border-color: var(--accent); color: var(--accent); }

.msg-ok  { background: #1a3a2a; border: 1px solid #2e7d52; color: #5dbf8a; padding: 12px 16px; border-radius: var(--radius); margin-bottom: 16px; font-size: 13px; }
.msg-err { background: #3a1a1a; border: 1px solid #7d2e2e; color: #bf5d5d; padding: 12px 16px; border-radius: var(--radius); margin-bottom: 16px; font-size: 13px; }

/* Admin photo grid */
.admin-photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
}
.admin-photo-item {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.admin-photo-item img {
  width: 100%; aspect-ratio: 1; object-fit: cover; display: block;
}
.admin-photo-meta { padding: 10px; }
.admin-photo-name { font-size: 11px; color: var(--text-muted); word-break: break-all; margin-bottom: 8px; }
.admin-photo-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.admin-photo-actions a,
.admin-photo-actions button {
  font-size: 11px; padding: 4px 8px;
  border-radius: 3px; cursor: pointer;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  font-family: inherit;
  transition: all .15s;
}
.admin-photo-actions a:hover { border-color: var(--accent); color: var(--accent); }
.admin-photo-actions button:hover { border-color: #c0392b; color: #c0392b; }

.drop-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 40px;
  text-align: center;
  color: var(--text-muted);
  transition: all .2s;
  cursor: pointer;
  margin-bottom: 16px;
}
.drop-zone.drag-over { border-color: var(--accent); color: var(--accent); background: rgba(201,169,110,0.05); }
.drop-zone p { font-size: 15px; margin-bottom: 8px; }
.drop-zone small { font-size: 12px; }

/* Login */
.login-wrap {
  max-width: 360px;
  margin: 100px auto;
  padding: 0 20px;
}
.login-wrap h2 { text-align: center; margin-bottom: 24px; font-size: 20px; }

/* ── Lightbox spinner & download ── */
.lb-spinner {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  color: var(--text-muted);
  font-size: 13px;
  letter-spacing: 0.1em;
}
.lb-image-wrap { position: relative; }

