/* ============================================================
   Cafe 展示站 – 全局样式
   保留原站 1:1 UI，新增专辑 (Album) 组件样式
   ============================================================ */

/* ── Reset & Base ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box }

:root {
  --theme-primary:   #667eea;
  --theme-secondary: #764ba2;
  --theme-accent:    #28a745;
  --surface-body:    #f7f7f8;
  --surface-panel:   #ffffff;
  --surface-muted:   #f4f5f7;
  --surface-header:  #ffffff;
  --surface-footer:  #f9f7f2;
  --surface-card:    #ffffff;
  --border-default:  #e5e5e5;
  --text-color:      #1f1f1f;
  --text-muted:      #555555;
}

html.dark-mode {
  --surface-body:    #101113;
  --surface-panel:   #16171a;
  --surface-muted:   #1e1f23;
  --surface-header:  #151619;
  --surface-footer:  #151619;
  --surface-card:    #1b1c20;
  --border-default:  #2b2c31;
  --text-color:      #f2f3f5;
  --text-muted:      #9da0aa;
}

html {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial,
    'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol';
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  height: 100%;
}

body {
  margin: 0;
  background: var(--surface-body);
  color: var(--text-color);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: #0066cc; text-decoration: none }
a:hover { text-decoration: underline }

main.container { flex: 1 0 auto }

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
}
@media (max-width: 768px) { .container { padding: 16px } }

/* ── Layout ───────────────────────────────────────────────── */
.layout-sticky-injected {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
.layout-sticky-injected main.container {
  flex: 1 0 auto;
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
  padding: 0 20px;
}

/* ── Site Header ──────────────────────────────────────────── */
.site-header {
  background: var(--surface-header);
  border-bottom: 1px solid var(--border-default);
  box-shadow: 0 2px 4px rgba(0,0,0,.08);
  position: sticky;
  top: 0;
  z-index: 1000;
}
.site-header .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px 20px;
  max-width: 1400px;
}
.brand { font-size: 20px; font-weight: 600; color: var(--text-color) }
.brand a { color: inherit; text-decoration: none }

.menu-toggle {
  background: none;
  border: none;
  font-size: 28px;
  cursor: pointer;
  padding: 8px 12px;
  color: var(--text-color);
  transition: background .2s;
  line-height: 1;
}
.menu-toggle:hover { background: var(--surface-muted) }

/* ── Drawer Menu ──────────────────────────────────────────── */
.menu-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 1998;
  opacity: 0; visibility: hidden;
  transition: opacity .25s, visibility .25s;
}
.menu-overlay.open { opacity: 1; visibility: visible }

.drawer-menu {
  position: fixed;
  top: 0; right: 0;
  width: 320px; height: 100%;
  background: var(--surface-panel);
  z-index: 1999;
  opacity: 0; visibility: hidden;
  transition: opacity .25s, visibility .25s;
  box-shadow: -2px 0 8px rgba(0,0,0,.15);
  display: flex; flex-direction: column;
  overflow: hidden;
  max-height: 100vh;
}
.drawer-menu.open { opacity: 1; visibility: visible }

.drawer-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 20px;
  border-bottom: 1px solid var(--border-default);
  flex-shrink: 0;
}
.drawer-header h3 { margin: 0; font-size: 18px; color: var(--text-color) }

.close-btn {
  background: none; border: none;
  font-size: 24px; cursor: pointer;
  padding: 4px 8px; color: var(--text-muted);
  transition: color .2s;
}
.close-btn:hover { color: var(--text-color) }

.drawer-nav { flex: 1; overflow-y: auto; min-height: 0 }
.drawer-nav a {
  display: flex; align-items: center; gap: 12px;
  padding: 16px 20px;
  color: var(--text-color); font-size: 16px; font-weight: 500;
  border-bottom: 1px solid var(--border-default);
  text-decoration: none;
  transition: background .2s;
}
.drawer-nav a:hover { background: var(--surface-muted) }

.drawer-settings {
  border-top: 1px solid var(--border-default);
  padding: 20px;
  padding-bottom: calc(20px + env(safe-area-inset-bottom));
  flex-shrink: 0;
  overflow-y: auto;
  max-height: 50vh;
}
.setting-group { margin-bottom: 20px }
.setting-group:last-child { margin-bottom: 0 }
.setting-group h4 { margin: 0 0 12px; font-size: 14px; font-weight: 600; color: var(--text-muted) }

.option-buttons { display: flex; gap: 8px; padding: 10px; border: 1px solid var(--border-default) }
.option-btn {
  flex: 1; padding: 8px 12px;
  text-align: center; text-decoration: none;
  color: var(--text-color); background: var(--surface-panel);
  border: 1px solid var(--border-default); border-radius: 0;
  font-size: 14px; cursor: pointer;
  transition: all .2s;
}
.option-btn:hover { background: var(--surface-muted) }
.option-btn.active {
  background: var(--theme-primary);
  color: #fff;
  border-color: var(--theme-secondary);
}

@media (max-width: 768px) {
  .drawer-menu { width: 100%; max-width: 100%; height: 100dvh }
}

/* ── Theme Switch ─────────────────────────────────────────── */
.theme-switch { position: relative; display: inline-block; width: 44px; height: 22px }
.theme-switch input { opacity: 0; width: 0; height: 0 }
.slider {
  position: absolute; inset: 0; cursor: pointer;
  background: #ccc; border-radius: 0; transition: .3s;
}
.slider::before {
  position: absolute; content: '';
  height: 16px; width: 16px;
  left: 3px; bottom: 3px;
  background: white; border-radius: 0; transition: .3s;
}
input:checked + .slider { background: var(--theme-primary) }
input:checked + .slider::before { transform: translateX(22px) }

/* ── Grid ─────────────────────────────────────────────────── */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
}

/* ── Card ─────────────────────────────────────────────────── */
.card {
  border: 1px solid var(--border-default);
  border-radius: 0;
  padding: 0;
  background: var(--surface-card);
  overflow: hidden;
  transition: box-shadow .2s;
}
.card:hover { box-shadow: 0 4px 12px rgba(0,0,0,.08) }
html.dark-mode .card:hover { box-shadow: 0 4px 12px rgba(0,0,0,.3) }

.card-img img {
  width: 100%; height: auto; display: block;
  object-fit: cover; max-height: 220px;
}
.card-body { padding: 12px }
.card-title { font-weight: 600; margin-bottom: 8px; color: var(--text-color); font-size: 15px }
.card-meta  { font-size: 13px; color: var(--text-muted); margin-bottom: 6px }

.card-tags {
  display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 10px;
}
.tag-chip {
  display: inline-block;
  padding: 2px 8px;
  font-size: 12px;
  background: var(--surface-muted);
  border: 1px solid var(--border-default);
  color: var(--text-muted);
  cursor: pointer;
  transition: all .2s;
}
.tag-chip:hover { background: var(--theme-primary); color: #fff; border-color: var(--theme-primary) }

/* ── Buttons ──────────────────────────────────────────────── */
.btn {
  display: inline-block;
  padding: 8px 14px;
  border: none; border-radius: 0;
  font-size: 14px; font-weight: 500;
  cursor: pointer; text-decoration: none;
  transition: opacity .2s;
}
.btn:hover { opacity: .85; text-decoration: none }
.btn-primary {
  background: linear-gradient(135deg, var(--theme-primary), var(--theme-secondary));
  color: #fff;
}
.btn-ghost {
  background: transparent;
  border: 1px solid var(--border-default);
  color: var(--text-muted);
}
.btn-ghost:hover { border-color: var(--theme-primary); color: var(--theme-primary) }

/* ── Tag Filter Bar ───────────────────────────────────────── */
.tag-bar {
  display: flex; flex-wrap: wrap; gap: 8px;
  margin: 16px 0;
}
.tag-filter {
  padding: 6px 14px;
  background: var(--surface-muted);
  border: 1px solid var(--border-default);
  color: var(--text-color);
  font-size: 13px; cursor: pointer; border-radius: 0;
  transition: all .2s;
}
.tag-filter:hover { background: var(--theme-primary); color: #fff; border-color: var(--theme-primary) }
.tag-filter.active { background: var(--theme-primary); color: #fff; border-color: var(--theme-secondary) }

/* ── Search ───────────────────────────────────────────────── */
.search-bar {
  display: flex; gap: 8px; margin-bottom: 16px;
}
.search-input {
  flex: 1; padding: 10px 14px;
  border: 1px solid var(--border-default);
  background: var(--surface-panel); color: var(--text-color);
  font-size: 15px; border-radius: 0;
  transition: border-color .2s;
}
.search-input:focus { outline: none; border-color: var(--theme-primary) }

/* ── Result Count ─────────────────────────────────────────── */
.result-meta {
  font-size: 14px; color: var(--text-muted);
  margin-bottom: 12px;
}

/* ── Load More ────────────────────────────────────────────── */
#load-more-btn, #album-load-more {
  display: block;
  width: 200px; max-width: 100%;
  margin: 24px auto 0;
}
#end-of-list {
  text-align: center; padding: 24px;
  color: var(--text-muted); font-size: 14px;
}

/* ── Work Detail ──────────────────────────────────────────── */
.work-detail {
  display: grid;
  grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
  gap: 32px;
  padding: 24px 0;
}
@media (max-width: 768px) {
  .work-detail { grid-template-columns: 1fr }
}
.work-preview img {
  width: 100%; height: auto; display: block;
  border: 1px solid var(--border-default);
}
.work-header {
  display: flex; align-items: flex-start;
  justify-content: space-between; gap: 12px;
  margin-bottom: 16px;
}
.work-title { font-size: 22px; font-weight: 700; margin: 0; color: var(--text-color) }
.work-description {
  font-size: 15px; line-height: 1.7;
  color: var(--text-muted); margin-bottom: 20px;
  white-space: pre-wrap;
}
.work-meta {
  display: grid; grid-template-columns: 1fr 1fr; gap: 8px;
  margin-bottom: 20px;
}
.meta-item {
  background: var(--surface-muted);
  border: 1px solid var(--border-default);
  padding: 10px 12px;
}
.meta-item strong { display: block; font-size: 12px; color: var(--text-muted); margin-bottom: 4px }
.meta-item span   { font-size: 14px; color: var(--text-color) }

.work-tags, .work-albums {
  display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px;
}
.album-chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 4px 10px; font-size: 13px;
  border: 1px solid var(--theme-primary);
  color: var(--theme-primary); border-radius: 0;
  text-decoration: none; transition: all .2s;
}
.album-chip:hover { background: var(--theme-primary); color: #fff; text-decoration: none }

/* ── Albums List ──────────────────────────────────────────── */
.albums-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 20px;
  margin-top: 24px;
}
.album-card {
  text-decoration: none; color: inherit;
  display: block;
}
.album-card:hover { text-decoration: none }
.album-cover {
  width: 100%; height: 160px;
  overflow: hidden;
  background: var(--surface-muted);
  border-bottom: 1px solid var(--border-default);
}
.album-cover img { width: 100%; height: 100%; object-fit: cover; display: block }
.album-cover-placeholder {
  display: flex; align-items: center; justify-content: center;
  font-size: 48px;
}
.album-desc {
  font-size: 13px; color: var(--text-muted);
  margin: 4px 0 8px; line-height: 1.5;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.album-count { font-size: 13px; color: var(--theme-primary); font-weight: 500 }

/* ── Album Detail Header ──────────────────────────────────── */
.album-header {
  display: flex; gap: 24px; align-items: flex-start;
  padding: 24px 0 16px;
  border-bottom: 1px solid var(--border-default);
  margin-bottom: 24px;
}
@media (max-width: 600px) { .album-header { flex-direction: column } }
.album-header-cover {
  width: 120px; height: 120px; flex-shrink: 0;
  overflow: hidden; border: 1px solid var(--border-default);
}
.album-header-cover img { width: 100%; height: 100%; object-fit: cover; display: block }
.album-header-info { flex: 1 }
.album-header-title {
  font-size: 24px; font-weight: 700; margin: 0 0 8px; color: var(--text-color);
}
.album-header-desc {
  font-size: 15px; color: var(--text-muted); line-height: 1.6; margin: 0 0 12px;
}

/* ── Back Link ────────────────────────────────────────────── */
.back-link {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 14px; color: var(--text-muted);
  margin-bottom: 16px; padding: 4px 0;
}
.back-link:hover { color: var(--theme-primary) }

/* ── Page Heading ─────────────────────────────────────────── */
.page-heading { font-size: 26px; font-weight: 700; margin: 24px 0 8px; color: var(--text-color) }
.page-subheading { font-size: 15px; color: var(--text-muted); margin: 0 0 24px }

/* ── Loading Overlay ──────────────────────────────────────── */
#globalLoadingOverlay {
  position: fixed; inset: 0; z-index: 3000;
  background: rgba(255,255,255,.96);
  display: flex; align-items: center; justify-content: center;
  opacity: 1; transition: opacity 800ms ease-in-out;
}
html.dark-mode #globalLoadingOverlay { background: rgba(18,18,18,.96) }
#globalLoadingOverlay.hidden { opacity: 0; pointer-events: none }

.loading-close-btn {
  position: absolute; top: 16px; right: 16px;
  width: 36px; height: 36px; border: none;
  background: rgba(0,0,0,.1); color: #666;
  font-size: 24px; cursor: pointer; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  z-index: 3001;
}
html.dark-mode .loading-close-btn { background: rgba(255,255,255,.1); color: #999 }

.loader {
  display: flex; flex-direction: column; align-items: center;
  padding: 20px; min-width: 160px; max-width: 320px;
}
#loadingQuote {
  margin-top: 16px;
  font-family: SimSun, '宋体', STSong, '华文宋体', serif;
  font-size: 14px; color: var(--text-muted);
  text-align: center; max-width: 300px; line-height: 1.6;
}

/* ── Footer ───────────────────────────────────────────────── */
.site-footer {
  background: var(--surface-footer);
  border-top: 1px solid var(--border-default);
  padding: 16px;
  margin-top: auto;
}
.footer-content { max-width: 1200px; margin: 0 auto; text-align: center }
.footer-links {
  display: flex; justify-content: center; align-items: center;
  flex-wrap: wrap; gap: 8px 0; margin-bottom: 6px;
}
.footer-links a { color: var(--text-muted); font-size: 14px; font-weight: 300; padding: 4px 0 }
.footer-links a:hover { color: var(--theme-primary) }
.footer-divider { color: var(--text-muted); margin: 0 12px }
.footer-copyright { color: var(--text-muted); font-size: 13px }

@media (max-width: 768px) {
  .footer-links { flex-direction: row; gap: 12px }
  .footer-divider { display: none }
}

/* ── Home Hero ────────────────────────────────────────────── */
.hero {
  background: linear-gradient(135deg, var(--theme-primary), var(--theme-secondary));
  color: #fff;
  padding: 80px 20px;
  text-align: center;
  margin-bottom: 48px;
}
.hero h1 { font-size: clamp(28px, 6vw, 52px); font-weight: 800; margin: 0 0 16px }
.hero p  { font-size: clamp(14px, 3vw, 18px); opacity: .9; margin: 0 0 28px }
.hero-btns { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center }
.hero-btns .btn { font-size: 15px; padding: 12px 24px }
.btn-outline {
  background: transparent;
  border: 2px solid rgba(255,255,255,.8);
  color: #fff;
}
.btn-outline:hover { background: rgba(255,255,255,.15); opacity: 1 }
.btn-white { background: #fff; color: var(--theme-primary) }
.btn-white:hover { opacity: .9 }

/* ── Home Sections ────────────────────────────────────────── */
.section { margin-bottom: 48px }
.section-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 20px; padding-bottom: 12px;
  border-bottom: 2px solid var(--theme-primary);
}
.section-title { font-size: 20px; font-weight: 700; margin: 0; color: var(--text-color) }
.section-link  { font-size: 14px; color: var(--theme-primary) }

/* ── About Page ───────────────────────────────────────────── */
.about-content {
  max-width: 800px;
  font-size: 15px; line-height: 1.8;
  color: var(--text-color);
  white-space: pre-wrap;
}
