/* ===== Reset & Base ===== */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans SC", sans-serif;
  background: #faf8f5;
  color: #333;
  min-height: 100vh;
  transition: background 0.3s ease, color 0.3s ease;
}

/* ===== Header ===== */
.site-header {
  text-align: center;
  padding: 3rem 1rem 1.5rem;
  position: relative;
}

.header-controls {
  position: absolute;
  top: 1rem;
  right: 1rem;
  display: flex;
  gap: 0.5rem;
}

.ctrl-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid #d8cef0;
  background: #fff;
  color: #7c5cbf;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  user-select: none;
  line-height: 1;
}

.site-header h1 {
  font-size: 2rem;
  font-weight: 700;
  color: #2c2c2c;
}

.site-header .subtitle {
  margin-top: 0.5rem;
  font-size: 1rem;
  color: #888;
  font-style: italic;
}

.site-header .header-email {
  margin-top: 0.35rem;
  font-size: 0.78rem;
  font-variant-numeric: tabular-nums;
}

.site-header .header-email a {
  color: #9b85d0;
  text-decoration: none;
  padding: 0.1rem 0.5rem;
  border-radius: 999px;
  border: 1px solid rgba(124, 92, 191, 0.15);
  transition: all 0.2s ease;
}

.site-header .header-email a:hover {
  color: #7c5cbf;
  border-color: rgba(124, 92, 191, 0.35);
  background: rgba(124, 92, 191, 0.05);
}

/* ===== Filter Bar (sticky container) ===== */
.filter-bar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(250, 248, 245, 0.96);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(124, 92, 191, 0.1);
  padding-bottom: 0.4rem;
}

/* ===== Timeline Navigation ===== */
.timeline-nav {
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
  -ms-overflow-style: none;
  padding: 0.6rem 1rem 0.2rem;
  cursor: grab;
}

.timeline-nav::-webkit-scrollbar { display: none; }
.timeline-nav:active { cursor: grabbing; }

.timeline-track {
  display: flex;
  align-items: center;
  gap: 0;
  position: relative;
  min-width: min-content;
  justify-content: center;
  margin: 0 auto;
  max-width: 1400px;
}

.tl-node {
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
  user-select: none;
  padding: 0 0.3rem;
  position: relative;
  flex-shrink: 0;
  transition: all 0.2s ease;
}

.tl-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  border: 2px solid #c4b3e0;
  background: #fff;
  transition: all 0.2s ease;
  position: relative;
  z-index: 2;
}

.tl-node:hover .tl-dot {
  border-color: #7c5cbf;
  background: #f0ebfa;
}

.tl-node.active .tl-dot {
  background: #7c5cbf;
  border-color: #7c5cbf;
  box-shadow: 0 0 0 3px rgba(124, 92, 191, 0.2);
}

.tl-label {
  font-size: 0.58rem;
  color: #aaa;
  margin-top: 0.2rem;
  white-space: nowrap;
  transition: all 0.2s ease;
}

.tl-node:hover .tl-label { color: #7c5cbf; }

.tl-node.active .tl-label {
  color: #7c5cbf;
  font-weight: 700;
}

/* Connecting line between nodes */
.tl-line {
  flex-shrink: 0;
  width: 10px;
  height: 2px;
  background: #d8cef0;
}

/* Year label divider */
.tl-year-label {
  flex-shrink: 0;
  font-size: 0.6rem;
  font-weight: 700;
  color: #7c5cbf;
  padding: 0 0.3rem;
  white-space: nowrap;
}

.tl-year-gap {
  flex-shrink: 0;
  width: 6px;
  height: 2px;
  background: transparent;
  border-top: 2px dashed #d8cef0;
  margin: 0 2px;
}

/* "All" node */
.tl-node-all .tl-dot {
  width: 11px;
  height: 11px;
  background: #7c5cbf;
  border-color: #7c5cbf;
}

.tl-node-all .tl-label {
  font-weight: 600;
  color: #7c5cbf;
  font-size: 0.6rem;
}

.tl-node-all.active .tl-dot {
  box-shadow: 0 0 0 3px rgba(124, 92, 191, 0.25);
}

/* ===== Medium Filter ===== */
.medium-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  justify-content: center;
  padding: 0.35rem 1rem 0;
}

.mf-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  border: 1.5px solid transparent;
  font-size: 0.68rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
  color: #fff;
  opacity: 0.5;
}

.mf-btn:hover { opacity: 0.8; }

.mf-btn.active {
  opacity: 1;
  box-shadow: 0 2px 8px rgba(0,0,0,0.18);
  transform: scale(1.05);
}

.mf-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 8px;
  background: rgba(255,255,255,0.3);
  font-size: 0.58rem;
  font-weight: 700;
  line-height: 1;
}

.mf-btn.active .mf-count {
  background: rgba(255,255,255,0.45);
}

/* ===== Content Tags ===== */
.content-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  justify-content: center;
  align-items: center;
  padding: 0.3rem 1rem 0;
  min-height: 0;
}

.cc-word {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  cursor: pointer;
  user-select: none;
  font-size: 0.68rem;
  font-weight: 500;
  color: #9b85d0;
  border: 1.5px solid #d8cef0;
  background: transparent;
  border-radius: 999px;
  padding: 0.18rem 0.55rem;
  transition: all 0.2s ease;
  line-height: 1.3;
}

.cc-word:hover {
  color: #7c5cbf;
  border-color: #b8a4e0;
  background: #f5f0ff;
}

.cc-word.active {
  color: #fff;
  background: #7c5cbf;
  border-color: #7c5cbf;
}

.cc-count {
  font-size: 0.56rem;
  font-weight: 700;
  opacity: 0.6;
}

.cc-word.active .cc-count {
  opacity: 0.85;
}

/* ===== Active Filter Chips ===== */
.active-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  justify-content: center;
  align-items: center;
  padding: 0;
  min-height: 0;
  transition: padding 0.2s ease;
}

.active-filters.has-filters {
  padding: 0.35rem 1rem 0;
}

.af-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  background: #7c5cbf;
  color: #fff;
  font-size: 0.62rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
  border: none;
  user-select: none;
}

.af-chip:hover {
  background: #6a4aad;
}

.af-chip .af-x {
  font-size: 0.7rem;
  opacity: 0.7;
  font-weight: 700;
}

.af-clear {
  font-size: 0.6rem;
  color: #999;
  cursor: pointer;
  border: none;
  background: none;
  text-decoration: underline;
  padding: 0.1rem 0.3rem;
  user-select: none;
}

.af-clear:hover { color: #7c5cbf; }

/* ===== Timeline Gallery ===== */
.gallery {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0.5rem 1.5rem 3rem;
}

/* -- Month group -- */
.timeline-group {
  display: grid;
  grid-template-columns: 40px 12px 1fr;
  gap: 0;
  position: relative;
  padding-bottom: 0.5rem;
}

.timeline-group::before {
  content: "";
  position: absolute;
  left: 45px;
  top: 0;
  bottom: 0;
  width: 1.5px;
  background: linear-gradient(to bottom, #c4b3e0, #d8cef0);
}

.timeline-group:first-child::before { top: 1rem; }
.timeline-group:last-child::before { bottom: 50%; }

.timeline-group::after {
  content: "";
  position: absolute;
  left: 45px;
  top: 1.2rem;
  width: 7px;
  height: 7px;
  background: #a78bda;
  border-radius: 50%;
  transform: translateX(-50%);
  z-index: 1;
}

.timeline-label {
  grid-column: 1;
  position: sticky;
  top: 5.5rem;
  align-self: start;
  padding-top: 0.6rem;
  text-align: right;
  padding-right: 0.5rem;
  z-index: 2;
}

.timeline-month {
  font-size: 0.65rem;
  font-weight: 600;
  color: #7c5cbf;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  line-height: 1.2;
}

.timeline-year {
  font-size: 0.72rem;
  font-weight: 400;
  color: #9b85d0;
  line-height: 1.2;
  margin-top: 0.3rem;
  font-variant-numeric: tabular-nums;
}

.timeline-cards {
  grid-column: 3;
  column-count: 2;
  column-gap: 1rem;
  padding: 0.3rem 0 1.5rem 0.6rem;
}

/* ===== Card ===== */
.card {
  break-inside: avoid;
  background: #fff;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 1px 8px rgba(0, 0, 0, 0.06);
  cursor: pointer;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
  position: relative;
  margin-bottom: 1rem;
}

.card:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12);
}

.card > img,
.card-grid img {
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  pointer-events: none;
}

.card > img {
  width: 100%;
  display: block;
  border-radius: 10px 10px 0 0;
}

.card > img[data-src],
.card-grid img[data-src] {
  min-height: 120px;
  background: #f0ede8;
}

/* Card grid */
.card-grid {
  display: grid;
  gap: 2px;
  border-radius: 10px 10px 0 0;
  overflow: hidden;
}

.card-grid.grid-2 { grid-template-columns: 1fr 1fr; }
.card-grid.grid-3 { grid-template-columns: 1fr 1fr; grid-template-rows: auto auto; }
.card-grid.grid-3 img:first-child { grid-column: 1 / 3; }
.card-grid.grid-4 { grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; }

.card-grid img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #f5f3f0;
  display: block;
  transition: opacity 0.2s;
}

.card-grid img:hover { opacity: 0.85; }

.card-info { padding: 0.5rem 0.7rem; }
.card-info .card-title { font-size: 0.85rem; font-weight: 600; color: #2c2c2c; }
.card-info .card-meta { margin-top: 0.15rem; font-size: 0.72rem; color: #aaa; }
.card-info .card-meta .card-date { margin-right: 0.4rem; }

/* ===== Card Tags (on card) ===== */
.card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  margin-top: 0.3rem;
}

.tag {
  display: inline-block;
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
  font-size: 0.6rem;
  font-weight: 500;
  color: #fff;
  line-height: 1.4;
}

.tag-chalkboard     { background: #4a5568; }
.tag-oil-painting   { background: #c53030; }
.tag-collage        { background: #2b6cb0; }
.tag-mixed-media    { background: #c05621; }
.tag-craft          { background: #2f855a; }
.tag-3d-sculpture   { background: #6b46c1; }
.tag-drawing        { background: #4c51bf; }
.tag-clay           { background: #975a16; }

/* ===== Filtering visibility ===== */
.card.filter-hidden { display: none; }
.timeline-group.filter-hidden { display: none; }

/* ===== Empty state ===== */
.empty-state { text-align: center; padding: 4rem 1rem; color: #bbb; font-size: 1.1rem; }

/* ===== Lightbox ===== */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(0, 0, 0, 0.88);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.lightbox[hidden] { display: none; }
.lightbox.is-visible { opacity: 1; }

.lightbox-content {
  max-width: 90vw;
  max-height: 90vh;
  text-align: center;
  position: relative;
}

.lightbox-content img {
  max-width: 90vw;
  max-height: 80vh;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 4px 40px rgba(0, 0, 0, 0.5);
  transition: opacity 0.2s ease;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  pointer-events: none;
}

.lightbox-caption { color: #eee; margin-top: 1rem; font-size: 1rem; }
.lightbox-counter { color: #999; font-size: 0.85rem; margin-top: 0.4rem; }

.lightbox-close,
.lightbox-prev,
.lightbox-next {
  position: absolute;
  background: none;
  border: none;
  color: #fff;
  cursor: pointer;
  font-size: 2.4rem;
  line-height: 1;
  padding: 0.4rem 0.8rem;
  opacity: 0.7;
  transition: opacity 0.2s;
  user-select: none;
}

.lightbox-close:hover,
.lightbox-prev:hover,
.lightbox-next:hover { opacity: 1; }

.lightbox-close { top: 1rem; right: 1.2rem; font-size: 2.8rem; }
.lightbox-prev { left: 1rem; top: 50%; transform: translateY(-50%); }
.lightbox-next { right: 1rem; top: 50%; transform: translateY(-50%); }
.lightbox-prev.is-hidden,
.lightbox-next.is-hidden { display: none; }

/* ===== Dark Mode ===== */
body.dark { background: #1a1a2e; color: #e0e0e0; }
body.dark .site-header h1 { color: #e8e8e8; }
body.dark .site-header .subtitle { color: #999; }
body.dark .site-header .header-email a {
  color: #b8a4e0;
  border-color: rgba(184, 164, 224, 0.2);
}
body.dark .site-header .header-email a:hover {
  color: #d4c5f0;
  border-color: rgba(184, 164, 224, 0.45);
  background: rgba(124, 92, 191, 0.12);
}
body.dark .ctrl-btn { background: #2a2a40; border-color: #4a4a6a; color: #b8a4e0; }

body.dark .filter-bar {
  background: rgba(26, 26, 46, 0.96);
  border-bottom-color: rgba(124, 92, 191, 0.2);
}

body.dark .tl-dot { border-color: #6a5a8a; background: #2a2a40; }
body.dark .tl-node:hover .tl-dot { border-color: #b8a4e0; background: #3a3a55; }
body.dark .tl-node.active .tl-dot { background: #7c5cbf; border-color: #7c5cbf; }
body.dark .tl-label { color: #666; }
body.dark .tl-node.active .tl-label { color: #b8a4e0; }
body.dark .tl-node-all .tl-dot { background: #7c5cbf; border-color: #7c5cbf; }
body.dark .tl-node-all .tl-label { color: #b8a4e0; }
body.dark .tl-line { background: #4a3a6e; }
body.dark .tl-year-label { color: #b8a4e0; }
body.dark .tl-year-gap { border-top-color: #4a3a6e; }

body.dark .cc-word { color: #8a7aaa; border-color: #4a4a6a; background: transparent; }
body.dark .cc-word:hover { color: #b8a4e0; border-color: #7c5cbf; background: #2a2a40; }
body.dark .cc-word.active { color: #fff; background: #7c5cbf; border-color: #7c5cbf; }

body.dark .af-chip { background: #5a3d9e; }
body.dark .af-chip:hover { background: #7c5cbf; }
body.dark .af-clear { color: #777; }

body.dark .card { background: #24243a; box-shadow: 0 1px 8px rgba(0, 0, 0, 0.25); }
body.dark .card:hover { box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4); }
body.dark .card-info .card-title { color: #e8e8e8; }
body.dark .card-info .card-meta { color: #888; }
body.dark .card > img[data-src],
body.dark .card-grid img[data-src] { background: #2a2a40; }
body.dark .card-grid img { background: #2a2a40; }

body.dark .timeline-group::before { background: linear-gradient(to bottom, #4a3a6e, #3a2a5e); }
body.dark .timeline-group::after { background: #7c5cbf; }
body.dark .timeline-month { color: #b8a4e0; }
body.dark .timeline-year { color: #8a7aaa; }
body.dark .empty-state { color: #666; }
body.dark .site-footer { color: #666; }
body.dark .site-footer .copyright { color: #777; }
body.dark .site-footer .copyright-notice { color: #666; }
body.dark .site-footer .contact { color: #888; }
body.dark .site-footer .contact a { color: #b8a4e0; }

/* ===== Footer ===== */
.site-footer { text-align: center; padding: 2rem 1rem; color: #bbb; font-size: 0.85rem; }
.site-footer .copyright { font-weight: 600; color: #999; margin-bottom: 0.3rem; }
.site-footer .copyright-notice { font-size: 0.78rem; color: #bbb; max-width: 480px; margin: 0 auto 0.8rem; line-height: 1.5; }
.site-footer .contact { font-size: 0.8rem; color: #999; margin-bottom: 0.4rem; font-variant-numeric: tabular-nums; }
.site-footer .contact a { color: #7c5cbf; text-decoration: none; font-weight: 500; }
.site-footer .contact a:hover { text-decoration: underline; }

/* ===== Responsive ===== */
@media (max-width: 700px) {
  .timeline-nav { padding: 0.4rem 0.5rem 0.15rem; }
  .tl-node { padding: 0 0.2rem; }
  .tl-dot { width: 7px; height: 7px; }
  .tl-node-all .tl-dot { width: 9px; height: 9px; }
  .tl-label { font-size: 0.48rem; }
  .tl-line { width: 6px; }
  .tl-year-label { font-size: 0.52rem; padding: 0 0.15rem; }
  .tl-year-gap { width: 4px; }

  .medium-filter { padding: 0.25rem 0.5rem 0; gap: 0.25rem; }
  .mf-btn { padding: 0.15rem 0.45rem; font-size: 0.6rem; }
  .mf-count { min-width: 14px; height: 14px; font-size: 0.5rem; }

  .content-cloud { padding: 0.2rem 0.5rem 0; gap: 0.25rem; }
  .cc-word { padding: 0.12rem 0.4rem; font-size: 0.58rem; }
  .cc-count { font-size: 0.48rem; }

  .active-filters.has-filters { padding: 0.25rem 0.5rem 0; }
  .af-chip { font-size: 0.55rem; padding: 0.1rem 0.4rem; }
  .af-clear { font-size: 0.52rem; }

  .gallery { padding: 0.5rem 0.6rem 2rem; }
  .timeline-group { grid-template-columns: 32px 10px 1fr; }
  .timeline-group::before { left: 37px; }
  .timeline-group::after { left: 37px; width: 5px; height: 5px; }
  .timeline-label { padding-right: 0.3rem; }
  .timeline-month { font-size: 0.55rem; }
  .timeline-year { font-size: 0.6rem; }
  .timeline-cards { column-count: 2; column-gap: 0.6rem; padding-left: 0.4rem; }
  .card { margin-bottom: 0.6rem; border-radius: 8px; }
  .card > img { border-radius: 8px 8px 0 0; }
  .card-info { padding: 0.4rem 0.5rem; }
  .card-info .card-title { font-size: 0.75rem; }
  .card-info .card-meta { font-size: 0.65rem; }
  .site-header h1 { font-size: 1.5rem; }
  .site-header .header-email { font-size: 0.68rem; margin-top: 0.3rem; }
  .site-header .header-email a { padding: 0.08rem 0.4rem; }
  .site-footer .contact { font-size: 0.7rem; }
  .header-controls { top: 0.6rem; right: 0.5rem; gap: 0.3rem; }
  .ctrl-btn { width: 30px; height: 30px; font-size: 0.75rem; }
  .lightbox-prev { left: 0.3rem; }
  .lightbox-next { right: 0.3rem; }
}

@media (min-width: 900px) {
  .timeline-cards { column-count: 3; }
}
