/* ════════════════════════════════════════════════
   M75 作戰藝廊 — 沿用主站／文庫 HUD 配色與字體
   ════════════════════════════════════════════════ */
:root {
  --hud-amber:   #f5a623;
  --hud-red:     #e8132c;
  --hud-green:   #39ff8e;
  --hud-blue:    #00cfff;
  --dark-void:   #04060a;
  --panel-dark:  #080d14;
  --panel-mid:   #0d1a26;
  --glass:       rgba(0,207,255,0.06);
  --glass-border:rgba(0,207,255,0.2);
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: 'Noto Sans TC', sans-serif;
  background: var(--dark-void);
  color: #c8d8e8;
  line-height: 1.8;
  overflow-x: hidden;
}
::selection { background: var(--hud-blue); color: #000; }
body::before {
  content: ''; position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background-image:
    linear-gradient(rgba(0,207,255,0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0,207,255,0.03) 1px, transparent 1px);
  background-size: 60px 60px;
}

/* ─── NAVBAR（與文庫一致）─── */
.blog-nav {
  position: sticky; top: 0; z-index: 100;
  display: flex; align-items: center; justify-content: space-between; gap: 1.5rem;
  padding: 0.85rem clamp(1rem, 4vw, 3rem);
  background: rgba(4,6,10,0.88); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--glass-border);
}
.blog-nav-logo {
  display: flex; align-items: center; gap: 0.7rem;
  text-decoration: none; color: #fff;
  font-family: 'Orbitron', sans-serif; font-weight: 900;
  letter-spacing: 0.08em; font-size: 1.05rem;
}
.blog-nav-logo img { width: 38px; height: 38px; }
.blog-nav ul {
  display: flex; align-items: center; gap: clamp(0.6rem, 2vw, 2rem);
  list-style: none; margin: 0; padding: 0; flex-wrap: wrap;
  font-family: 'Rajdhani', sans-serif; font-weight: 600;
  font-size: 1rem; letter-spacing: 0.05em;
}
.blog-nav a { color: #c8d8e8; text-decoration: none; transition: color 0.2s; }
.blog-nav a:hover, .blog-nav a.is-current { color: var(--hud-blue); }
.blog-nav-join {
  padding: 0.35rem 1rem; border: 1px solid var(--hud-amber);
  color: var(--hud-amber) !important;
  clip-path: polygon(8px 0, 100% 0, 100% calc(100% - 8px), calc(100% - 8px) 100%, 0 100%, 0 8px);
}
.blog-nav-join:hover { background: var(--hud-amber); color: #000 !important; }

/* ─── 版面 ─── */
.gallery-main {
  position: relative; z-index: 2;
  max-width: 1240px; margin: 0 auto;
  padding: clamp(2.2rem, 5vw, 4rem) clamp(1rem, 3vw, 2rem) 5rem;
}
.gallery-header { margin-bottom: 2.4rem; }
.gallery-kicker {
  display: block; font-family: 'Orbitron', sans-serif; font-size: 0.75rem;
  letter-spacing: 0.3em; color: var(--hud-blue); margin-bottom: 0.7rem;
}
.gallery-header h1 {
  font-family: 'Orbitron', sans-serif; font-weight: 900;
  font-size: clamp(2rem, 6vw, 3rem); color: #fff; margin: 0 0 0.5rem;
}
.gallery-header p { margin: 0; color: #8ea3b8; }

/* ─── 控制列（登入 / 上傳）─── */
.gallery-bar {
  display: flex; align-items: center; flex-wrap: wrap; gap: 0.8rem;
  margin-top: 1.6rem;
}
.gallery-user {
  display: flex; align-items: center; gap: 0.5rem;
  padding: 0.3rem 0.85rem 0.3rem 0.35rem;
  background: var(--glass); border: 1px solid var(--glass-border);
  border-radius: 999px; font-family: 'Rajdhani', sans-serif; font-weight: 600;
  color: #dbe8f4;
}
.gallery-user img { border-radius: 50%; }
.gallery-note {
  margin: 1rem 0 0; padding: 0.7rem 1rem;
  border-left: 3px solid var(--hud-amber); background: rgba(245,166,35,0.08);
  color: #f0d9b0; font-size: 0.92rem;
}

/* ─── 按鈕 ─── */
.g-btn {
  font-family: 'Rajdhani', sans-serif; font-weight: 700; font-size: 0.98rem;
  letter-spacing: 0.04em; cursor: pointer; padding: 0.5rem 1.15rem;
  border: 1px solid var(--glass-border); background: var(--glass);
  color: #dbe8f4; transition: all 0.2s;
  clip-path: polygon(7px 0, 100% 0, 100% calc(100% - 7px), calc(100% - 7px) 100%, 0 100%, 0 7px);
}
.g-btn:hover { border-color: var(--hud-blue); color: #fff; background: rgba(0,207,255,0.14); }
.g-btn:disabled { opacity: 0.45; cursor: not-allowed; }
.g-btn-upload { border-color: var(--hud-green); color: var(--hud-green); }
.g-btn-upload:hover { background: var(--hud-green); color: #04060a; }
.g-btn-login { border-color: #5865F2; color: #b9c0ff; }
.g-btn-login:hover { background: #5865F2; color: #fff; }
.g-btn-more { display: block; margin: 2rem auto 0; padding: 0.6rem 2rem; }
.g-btn-ghost { opacity: 0.85; }

/* ─── 相片格（masonry via CSS columns）─── */
.gallery-grid {
  column-count: 3; column-gap: 14px;
}
@media (max-width: 900px) { .gallery-grid { column-count: 2; } }
@media (max-width: 540px) { .gallery-grid { column-count: 1; } }

.g-card {
  position: relative; display: block; width: 100%;
  margin: 0 0 14px; break-inside: avoid;
  border: 1px solid var(--glass-border); background: var(--panel-dark);
  cursor: zoom-in; overflow: hidden;
  transition: border-color 0.2s, transform 0.2s;
}
.g-card:hover { border-color: var(--hud-blue); transform: translateY(-2px); }
.g-card img {
  display: block; width: 100%; height: auto;
  background: var(--panel-mid); transition: opacity 0.4s;
}
.g-card img.loading { opacity: 0; }
.g-card-info {
  position: absolute; inset: auto 0 0 0;
  padding: 1.4rem 0.85rem 0.6rem;
  background: linear-gradient(transparent, rgba(4,6,10,0.92));
  opacity: 0; transform: translateY(6px); transition: all 0.25s;
  pointer-events: none;
}
.g-card:hover .g-card-info { opacity: 1; transform: none; }
.g-card-title {
  font-family: 'Rajdhani', sans-serif; font-weight: 700; color: #fff;
  font-size: 1rem; line-height: 1.3;
}
.g-card-by { font-size: 0.78rem; color: var(--hud-blue); }
.g-card-del {
  position: absolute; top: 8px; right: 8px; z-index: 3;
  width: 30px; height: 30px; border: 1px solid rgba(232,19,44,0.6);
  background: rgba(4,6,10,0.75); color: var(--hud-red);
  font-size: 0.9rem; cursor: pointer; opacity: 0; transition: opacity 0.2s;
  display: flex; align-items: center; justify-content: center;
}
.g-card:hover .g-card-del { opacity: 1; }
.g-card-del:hover { background: var(--hud-red); color: #fff; }

.gallery-status { text-align: center; color: #8ea3b8; margin-top: 2rem; font-family: 'Rajdhani', sans-serif; }
.gallery-empty { text-align: center; color: #6f8296; padding: 3rem 0; }

/* ─── 燈箱 ─── */
.lightbox {
  position: fixed; inset: 0; z-index: 200;
  display: flex; align-items: center; justify-content: center;
  background: rgba(2,4,7,0.94); backdrop-filter: blur(6px);
}
.lb-figure { margin: 0; max-width: 92vw; max-height: 88vh; text-align: center; }
.lb-figure img { max-width: 92vw; max-height: 80vh; object-fit: contain; border: 1px solid var(--glass-border); }
.lb-figure figcaption {
  margin-top: 0.8rem; color: #c8d8e8; font-family: 'Rajdhani', sans-serif;
  font-size: 1rem; max-width: 800px; margin-inline: auto;
}
.lb-close, .lb-nav {
  position: fixed; z-index: 201; background: transparent; border: none;
  color: #c8d8e8; cursor: pointer; transition: color 0.2s;
}
.lb-close { top: 18px; right: 22px; font-size: 1.8rem; }
.lb-nav { top: 50%; transform: translateY(-50%); font-size: 3rem; padding: 0 1rem; }
.lb-prev { left: 6px; }
.lb-next { right: 6px; }
.lb-close:hover, .lb-nav:hover { color: var(--hud-blue); }

/* ─── 上傳對話框 ─── */
.modal {
  position: fixed; inset: 0; z-index: 210;
  display: flex; align-items: center; justify-content: center; padding: 1rem;
  background: rgba(2,4,7,0.9); backdrop-filter: blur(6px);
}
.modal-panel {
  position: relative; width: min(560px, 100%);
  max-height: 90vh; overflow-y: auto;
  background: var(--panel-dark); border: 1px solid var(--glass-border);
  padding: 2rem clamp(1.2rem, 4vw, 2rem);
  clip-path: polygon(14px 0, 100% 0, 100% calc(100% - 14px), calc(100% - 14px) 100%, 0 100%, 0 14px);
}
.modal-panel h2 {
  font-family: 'Orbitron', sans-serif; font-weight: 700; color: #fff;
  margin: 0 0 1.2rem; font-size: 1.4rem;
}
.modal-close {
  position: absolute; top: 12px; right: 16px; background: none; border: none;
  color: #8ea3b8; font-size: 1.3rem; cursor: pointer;
}
.modal-close:hover { color: var(--hud-red); }
.drop-zone {
  display: flex; align-items: center; justify-content: center;
  min-height: 150px; padding: 1rem; margin-bottom: 1rem;
  border: 2px dashed var(--glass-border); background: var(--glass);
  color: #8ea3b8; text-align: center; cursor: pointer; transition: all 0.2s;
}
.drop-zone.dragover { border-color: var(--hud-green); background: rgba(57,255,142,0.08); color: var(--hud-green); }
.drop-hint small { color: #6f8296; }
.drop-preview {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(64px, 1fr));
  gap: 6px; width: 100%;
}
.drop-preview img { width: 100%; aspect-ratio: 1; object-fit: cover; border: 1px solid var(--glass-border); }
.upload-fields { display: grid; gap: 0.6rem; margin-bottom: 1rem; }
.upload-fields input {
  width: 100%; padding: 0.6rem 0.8rem;
  background: var(--panel-mid); border: 1px solid var(--glass-border);
  color: #dbe8f4; font-family: 'Noto Sans TC', sans-serif; font-size: 0.95rem;
}
.upload-fields input:focus { outline: none; border-color: var(--hud-blue); }
.upload-progress { height: 6px; background: var(--panel-mid); margin-bottom: 0.6rem; overflow: hidden; }
.upload-progress-bar { height: 100%; width: 0; background: var(--hud-green); transition: width 0.2s; }
.upload-msg { min-height: 1.2em; margin: 0 0 1rem; font-size: 0.9rem; color: var(--hud-amber); }
.modal-actions { display: flex; justify-content: flex-end; gap: 0.8rem; }

/* ─── FOOTER ─── */
.blog-footer {
  position: relative; z-index: 2; text-align: center;
  padding: 2.5rem 1rem; border-top: 1px solid var(--glass-border);
  color: #6f8296; font-size: 0.85rem;
}
.blog-footer span { color: var(--hud-blue); }

[hidden] { display: none !important; }
