:root {
  --bg: #a1b0b4;
  --bg-alt: #f6f5f2;
  --text: #1a1a1a;
  --text-dim: #33393b; /* darkened from #6b6b68 to keep ~5:1 contrast on the new grey background */
  --border: #5c6b6f; /* darkened from #e4e2dc so dividers stay visible on the new grey background */
  --radius: 12px;
  --font-serif: "Playfair Display", Georgia, "Times New Roman", serif;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
}

a { color: inherit; }

/* ---- Masthead ---- */
.masthead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 22px 32px;
  border-bottom: 1px solid var(--border);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.masthead-brand { display: flex; align-items: center; gap: 10px; }
.masthead-icon { font-size: 1rem; }
.masthead-back {
  text-decoration: none;
  color: var(--text-dim);
  text-transform: none;
  letter-spacing: normal;
  font-weight: 500;
  font-size: 0.9rem;
}
.masthead-back:hover { color: var(--text); }

/* ---- Hero ---- */
.hero {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 20px;
  padding: 28px 32px 32px;
  border-bottom: 1px solid var(--border);
}
.hero h1 {
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: 2.8rem;
  margin: 0;
  line-height: 1.1;
}
.hero-title-en {
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 500;
  font-size: 1.69rem; /* 1.3rem + 30% */
  color: var(--text-dim);
  margin: 6px 0 0;
}
.hero-subtitle {
  font-family: var(--font-sans);
  font-style: italic;
  color: var(--text-dim);
  max-width: 420px;
  margin: 0;
  font-size: 0.95rem;
  line-height: 1.5;
}
.album-hero { display: block; }
.album-hero h1 { font-size: 2.2rem; margin-bottom: 8px; }
.album-hero .hero-subtitle { font-style: normal; max-width: none; }

/* ---- Layout ---- */
.layout {
  max-width: 1280px;
  margin: 0 auto;
  padding: 32px;
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 48px;
  align-items: start;
}
.layout[hidden] { display: none; }

/* ---- Date-grouped feed ---- */
.date-section { margin-bottom: 40px; }
.date-section:last-child { margin-bottom: 0; }
.date-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding-bottom: 10px;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--border);
}
.date-label { font-family: var(--font-sans); font-size: 0.95rem; color: var(--text); font-weight: 600; }

.story-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 28px;
}

.story-card { display: block; text-decoration: none; color: inherit; }
.story-card .thumb {
  aspect-ratio: 4 / 3;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.story-card .thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.story-card .thumb.no-cover { display: flex; align-items: center; justify-content: center; color: var(--text-dim); font-size: 0.85rem; }
.story-card h2 {
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: 1.25rem;
  line-height: 1.3;
  margin: 14px 0 6px;
}
.story-card:hover h2 { text-decoration: underline; }
.story-card .excerpt {
  color: var(--text-dim);
  font-size: 0.92rem;
  line-height: 1.5;
  margin: 0 0 8px;
}
.story-card .meta { color: var(--text-dim); font-size: 0.82rem; margin: 0; }

/* ---- Sidebar ---- */
.sidebar-header {
  font-family: var(--font-serif);
  font-size: 1.15rem;
  font-weight: 600;
  padding-bottom: 10px;
  margin-bottom: 8px;
  border-bottom: 1px solid var(--border);
}
.sidebar-item {
  display: flex;
  gap: 14px;
  padding: 16px 0;
  border-bottom: 1px solid var(--border);
  text-decoration: none;
  color: inherit;
}
.sidebar-item:last-child { border-bottom: none; }
.sidebar-item .thumb {
  width: 72px; height: 72px;
  border-radius: 8px;
  overflow: hidden;
  background: var(--bg-alt);
  flex-shrink: 0;
}
.sidebar-item .thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.sidebar-item h3 { font-family: var(--font-serif); font-weight: 600; font-size: 0.95rem; margin: 0 0 6px; line-height: 1.3; }
.sidebar-item .meta { color: var(--text-dim); font-size: 0.78rem; margin: 0; }

/* ---- Album page thumbnail grid ---- */
main { max-width: 1280px; margin: 0 auto; padding: 32px; }
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 18px;
}
.item-tile {
  border: 1px solid var(--border);
  padding: 0;
  background: var(--bg-alt);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  aspect-ratio: 1 / 1;
}
.item-tile img { width: 100%; height: 100%; object-fit: cover; display: block; }

.video-placeholder {
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #2a2d33, #14161a);
}
.play-icon { font-size: 2rem; color: #f2f0ea; }

.empty-state {
  color: var(--text-dim);
  text-align: center;
  padding: 64px 32px;
  line-height: 1.6;
  max-width: 1280px;
  margin: 0 auto;
}
.empty-state code {
  background: var(--bg-alt);
  border: 1px solid var(--border);
  padding: 2px 6px;
  border-radius: 4px;
}

.site-footer {
  text-align: center;
  color: var(--text-dim);
  font-size: 0.8rem;
  padding: 24px;
  border-top: 1px solid var(--border);
  margin-top: 24px;
}

/* ---- Lightbox (kept dark regardless of site theme — standard for photo viewing) ---- */
.lightbox {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.92);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  z-index: 100;
}
.lightbox[hidden] { display: none; }
.lb-content { max-width: 92vw; max-height: 82vh; display: flex; }
.lb-content img, .lb-content video { max-width: 92vw; max-height: 82vh; object-fit: contain; border-radius: 6px; }
.lb-caption { color: #a9a9a9; margin-top: 12px; font-family: var(--font-sans); }

.lb-close, .lb-prev, .lb-next, .lb-playpause {
  position: absolute;
  background: rgba(255,255,255,0.08);
  border: none;
  color: #f2f0ea;
  font-size: 1.6rem;
  cursor: pointer;
  border-radius: 50%;
  width: 44px; height: 44px;
}
.lb-close { top: 20px; right: 20px; }
.lb-playpause { top: 20px; left: 20px; font-size: 1.2rem; }
.lb-prev { left: 20px; top: 50%; transform: translateY(-50%); }
.lb-next { right: 20px; top: 50%; transform: translateY(-50%); }
.lb-close:hover, .lb-prev:hover, .lb-next:hover, .lb-playpause:hover { background: rgba(255,255,255,0.18); }

@media (max-width: 860px) {
  .layout { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .masthead, .hero, .layout, main { padding-left: 20px; padding-right: 20px; }
  .hero h1 { font-size: 2.1rem; }
  .hero-title-en { font-size: 1.43rem; } /* 1.1rem + 30% */
  .hero-subtitle { text-align: left; max-width: none; }
  .lb-prev, .lb-next { width: 36px; height: 36px; font-size: 1.3rem; }
  .lb-playpause { width: 36px; height: 36px; }
}
