/* ===== 家庭相册 · 基础变量与重置 ===== */
:root {
  --bg: #f7f8fa;
  --surface: #ffffff;
  --text: #1f2937;
  --muted: #6b7280;
  --brand: #0d9488;          /* 青绿，相册/家庭感 */
  --brand-dark: #0f766e;
  --brand-soft: #ccfbf1;
  --border: #e5e7eb;
  --radius: 14px;
  --shadow: 0 1px 3px rgba(17, 24, 39, .06), 0 10px 28px rgba(17, 24, 39, .06);
  --maxw: 1080px;
  --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }

/* 关键：让 HTML 的 hidden 属性始终生效（否则会被后续 display 规则覆盖） */
[hidden] { display: none !important; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; display: block; }

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

.container { width: min(100% - 48px, var(--maxw)); margin-inline: auto; }

/* ===== 顶部导航 ===== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(255, 255, 255, .88);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}
.site-header .container { display: flex; align-items: center; gap: 24px; height: 64px; }

.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 700; font-size: 1.05rem; color: var(--text); }
.brand:hover { text-decoration: none; }
.brand img { width: 28px; height: 28px; border-radius: 8px; }

.site-nav { display: flex; gap: 4px; margin-left: auto; }
.site-nav a { padding: 8px 14px; border-radius: 8px; color: var(--muted); font-weight: 500; font-size: .95rem; }
.site-nav a:hover { background: var(--brand-soft); color: var(--brand); text-decoration: none; }
.site-nav a.active { background: var(--brand-soft); color: var(--brand); }

/* ===== Hero ===== */
.hero { padding: 72px 0 40px; text-align: center; }
.hero-badge {
  display: inline-block; padding: 4px 14px; margin: 0 0 16px;
  border-radius: 999px; background: var(--brand-soft); color: var(--brand-dark);
  font-size: .85rem; font-weight: 600;
}
.hero h1 { margin: 0 0 14px; font-size: clamp(2rem, 5vw, 3.2rem); letter-spacing: -.02em; }
.lead { color: var(--muted); font-size: 1.1rem; max-width: 640px; margin: 0 auto 30px; }

/* ===== 登录框 ===== */
.login-box { max-width: 460px; margin: 0 auto; padding: 26px 24px; }
.login-box .btn { width: 100%; justify-content: center; padding: 13px 22px; font-size: 1.05rem; gap: 8px; }
.hint { color: var(--muted); font-size: .86rem; text-align: center; margin: 12px 0 0; }
.btn-lg { }

/* ===== 按钮 ===== */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 10px 22px; border-radius: 10px; border: 1px solid transparent;
  font-weight: 600; font-size: .95rem; cursor: pointer;
  transition: background .15s, border-color .15s, color .15s;
}
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); }
.btn-primary:disabled { background: #99b8b4; cursor: not-allowed; }
.btn-ghost { background: var(--surface); border-color: var(--border); color: var(--text); }
.btn-ghost:hover { border-color: var(--brand); color: var(--brand); }

/* ===== 通用区块 ===== */
.section { padding: 44px 0; }
.section h2, .page-head h1, .prose h2 { text-align: center; margin: 0 0 8px; font-size: 1.55rem; letter-spacing: -.01em; }
.sub { text-align: center; color: var(--muted); margin: 0 0 32px; }

/* ===== 卡片 ===== */
.feature-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 20px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 26px 24px; box-shadow: var(--shadow); }
.card .icon { font-size: 1.8rem; margin-bottom: 10px; }
.card h3 { margin: 0 0 8px; font-size: 1.06rem; }
.card p { margin: 0; color: var(--muted); font-size: .95rem; }
.form-note { color: var(--muted); font-size: .9rem; text-align: center; margin: 0 0 16px; }

/* ===== 隐私横幅 ===== */
.privacy-banner { padding: 8px 0; }
.privacy-banner .container {
  background: #fffbeb; border: 1px solid #fde68a; color: #92400e;
  border-radius: var(--radius); padding: 14px 20px; text-align: center; font-size: .95rem;
}
.privacy-banner p { margin: 0; }

/* ===== 相册占位页 ===== */
.page-head { padding: 52px 0 0; text-align: center; }
.page-head h1 { font-size: clamp(1.9rem, 4vw, 2.5rem); }
.page-head .lead { margin-bottom: 0; }

.login-wall { text-align: center; padding: 30px 0 10px; }
.login-wall-title { font-weight: 700; font-size: 1.15rem; margin: 0 0 6px; }
.login-wall-sub { color: var(--muted); margin: 0 0 18px; }

.gallery-preview { padding-top: 26px; }
.gallery-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px; max-width: 860px; margin: 0 auto;
}
.photo { aspect-ratio: 1/1; border-radius: 12px; background: linear-gradient(135deg, #e5e7eb, #f3f4f6); }
.ph1 { background: linear-gradient(135deg, #a7f3d0, #99f6e4); }
.ph2 { background: linear-gradient(135deg, #bae6fd, #a5f3fc); }
.ph3 { background: linear-gradient(135deg, #fde68a, #fcd34d); }
.ph4 { background: linear-gradient(135deg, #ddd6fe, #c4b5fd); }
.ph5 { background: linear-gradient(135deg, #fecdd3, #fda4af); }
.ph6 { background: linear-gradient(135deg, #d1fae5, #a7f3d0); }

/* ===== 内页正文 ===== */
.prose { max-width: 760px; margin-inline: auto; }
.prose h2 { text-align: left; margin-top: 40px; font-size: 1.3rem; }
.prose h2:first-child { margin-top: 0; }
.prose li { margin: 6px 0; }

/* ===== 页脚 ===== */
.site-footer { border-top: 1px solid var(--border); padding: 26px 0; margin-top: 56px; color: var(--muted); font-size: .9rem; text-align: center; }
.site-footer p { margin: 0; }
.site-footer .beian { margin-top: 8px; font-size: .85rem; }
.site-footer .beian a { color: inherit; text-decoration: none; }
.site-footer .beian a:hover { text-decoration: underline; }

/* ===== 相册工具条与上传 ===== */
.album-toolbar { display: flex; flex-wrap: wrap; gap: 18px; align-items: flex-end; margin-bottom: 18px; }
.album-toolbar .tool { display: flex; flex-direction: column; gap: 6px; }
.album-toolbar .tool-right { margin-left: auto; }
.album-toolbar label { font-size: .85rem; font-weight: 600; color: var(--muted); }
.album-toolbar select,
.album-toolbar input[type="text"] {
  padding: 9px 12px; border: 1px solid var(--border); border-radius: 10px;
  font: inherit; background: var(--bg); color: var(--text);
}
.inline-form { display: flex; gap: 8px; align-items: center; }
.upload-btn { cursor: pointer; }
.upload-status { text-align: center; color: var(--brand-dark); font-size: .92rem; margin: 0 0 14px; }

/* ===== 照片墙 ===== */
.gallery-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 14px; margin-top: 12px;
}
.photo-card {
  margin: 0; background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; overflow: hidden; box-shadow: var(--shadow);
}
.photo-card img { width: 100%; aspect-ratio: 1/1; object-fit: cover; display: block; background: #eef2f7; }
.photo-card figcaption { padding: 8px 10px; font-size: .8rem; color: var(--muted); }

/* ===== 照片操作与灯箱 ===== */
.photo-card figcaption { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.photo-meta { color: var(--muted); }
.photo-actions { display: inline-flex; gap: 10px; white-space: nowrap; }
.link-btn.danger { color: #b91c1c; }

.lightbox {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(17, 24, 39, .92);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 16px; padding: 24px;
}
.lightbox img {
  max-width: min(96vw, 1200px); max-height: 78vh;
  object-fit: contain; border-radius: 10px; background: #0b1220;
}
.lightbox-close {
  position: absolute; top: 16px; right: 20px;
  background: rgba(255, 255, 255, .14); color: #fff; border: 0;
  width: 40px; height: 40px; border-radius: 50%; font-size: 1.1rem; cursor: pointer;
}
.lightbox-close:hover { background: rgba(255, 255, 255, .26); }
.lightbox-download { background: rgba(255, 255, 255, .92); }

/* ===== 小按钮 / 链接按钮 ===== */
.btn-sm { padding: 6px 12px; font-size: .85rem; }
.link-btn {
  background: none; border: 0; padding: 0; color: var(--brand);
  font: inherit; font-size: inherit; cursor: pointer; text-decoration: underline;
}

/* ===== 登录/邀请码表单 ===== */
.invite-form { text-align: left; }
.invite-form .btn { width: 100%; justify-content: center; }
.login-box .logout-btn { margin-top: 10px; width: 100%; justify-content: center; }

/* ===== 管理页 ===== */
.admin-card { max-width: 900px; margin: 0 auto 22px; }
.card-title { text-align: left; font-size: 1.1rem; margin: 0 0 10px; }
.admin-table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.admin-table th, .admin-table td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.admin-table th { color: var(--muted); font-weight: 600; }
.login-wall { text-align: center; padding: 30px 0; font-weight: 600; color: var(--muted); }

/* ===== 响应式 ===== */
@media (max-width: 560px) {
  .container { width: min(100% - 32px, var(--maxw)); }
  .site-nav a { padding: 8px 10px; }
  .album-toolbar .tool-right { margin-left: 0; }
  .gallery-grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
}
