:root {
  --paper: #F0EEE9;
  --ink: #2C2A26;
  --ink-soft: #5A5650;
  --clay: #B56A4C;
  --clay-soft: #C9876A;
  --line: #D9D4CB;
  --card: #F7F5F1;
  --shadow: rgba(44, 42, 38, 0.08);
  --caption-bg: rgba(44, 42, 38, 0.55);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  background: var(--paper);
  color: var(--ink);
  line-height: 1.45;
  min-height: 100vh;
}

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

.site-header {
  padding: 2.25rem 1.5rem 1.25rem;
  border-bottom: 1px solid var(--line);
  max-width: 1100px;
  margin: 0 auto;
}
.site-header .brand {
  margin: 0 0 0.35rem;
  font-size: 0.82rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-soft);
}
.site-header .brand a { color: inherit; text-decoration: none; }
.site-header .brand a:hover { color: var(--clay); }
.site-header h1 {
  margin: 0 0 0.35rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  font-size: clamp(1.6rem, 3vw, 2.1rem);
}
.site-header .tagline {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.98rem;
}
.nav-years {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 0.85rem;
  margin-top: 1.1rem;
  font-size: 0.95rem;
}
.nav-years a {
  color: var(--ink-soft);
  border-bottom: 1px solid transparent;
  padding-bottom: 1px;
}
.nav-years a:hover,
.nav-years a.active {
  color: var(--clay);
  border-bottom-color: var(--clay);
  text-decoration: none;
}

.nav-months {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 0.75rem;
  margin-top: 0.65rem;
  font-size: 0.88rem;
}
.nav-months a {
  color: var(--ink-soft);
  border-bottom: 1px solid transparent;
  padding-bottom: 1px;
}
.nav-months a:hover,
.nav-months a.active {
  color: var(--clay);
  border-bottom-color: var(--clay);
  text-decoration: none;
}
.nav-months[hidden] { display: none; }
.nav-months a.dim { opacity: 0.4; }

main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1.5rem 1.25rem 3rem;
}

.year-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 0.85rem;
}
.year-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 1.15rem 1rem;
  box-shadow: 0 1px 0 var(--shadow);
  transition: border-color 0.15s ease, transform 0.15s ease;
}
.year-card:hover {
  border-color: var(--clay);
  transform: translateY(-1px);
  text-decoration: none;
}
.year-card .year {
  display: block;
  font-size: 1.35rem;
  color: var(--ink);
  font-weight: 600;
}
.year-card .count {
  display: block;
  margin-top: 0.25rem;
  color: var(--ink-soft);
  font-size: 0.85rem;
}
.year-card.disabled {
  opacity: 0.55;
  pointer-events: none;
}

.gallery-meta {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  margin-bottom: 1.1rem;
  color: var(--ink-soft);
  font-size: 0.92rem;
}

.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 0.9rem;
}
.photo-card[id^="month-"] { scroll-margin-top: 1.25rem; }
.photo-card {
  position: relative;
  margin: 0;
  background: #ddd9d1;
  border-radius: 8px;
  overflow: hidden;
  aspect-ratio: 4 / 3;
  border: 1px solid var(--line);
}
.photo-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  background: #e5e1d8;
}
.caption {
  position: absolute;
  left: 0.55rem;
  bottom: 0.55rem;
  max-width: calc(100% - 1.1rem);
  padding: 0.28rem 0.5rem;
  border-radius: 4px;
  background: var(--caption-bg);
  color: #F7F5F1;
  font-size: 0.72rem;
  letter-spacing: 0.01em;
  line-height: 1.25;
  pointer-events: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.caption.empty { display: none; }

.site-footer {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 1.5rem 2.5rem;
  color: var(--ink-soft);
  font-size: 0.82rem;
}

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


/* Click-to-enlarge lightbox */
.photo-card { cursor: zoom-in; }
body.lb-open { overflow: hidden; }
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(28, 26, 22, 0.88);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem 3.5rem 6.5rem;
}
.lightbox[hidden] { display: none !important; }
.lb-frame {
  margin: 0;
  max-width: min(1100px, 100%);
  max-height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.65rem;
}
.lb-img {
  max-width: 100%;
  max-height: calc(100vh - 11.5rem);
  object-fit: contain;
  border-radius: 6px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.35);
  background: #1a1815;
}
.lb-caption {
  color: #F0EEE9;
  font-size: 0.85rem;
  letter-spacing: 0.01em;
  text-align: center;
  opacity: 0.92;
}
.lb-close, .lb-prev, .lb-next {
  position: absolute;
  background: transparent;
  border: 0;
  color: #F0EEE9;
  cursor: pointer;
  line-height: 1;
  opacity: 0.85;
}
.lb-close:hover, .lb-prev:hover, .lb-next:hover { opacity: 1; }
.lb-close {
  top: 0.75rem;
  right: 1rem;
  font-size: 2rem;
}
.lb-prev, .lb-next {
  top: 50%;
  transform: translateY(-50%);
  font-size: 2.6rem;
  padding: 0.4rem 0.6rem;
}
.lb-prev { left: 0.4rem; }
.lb-next { right: 0.4rem; }
@media (max-width: 560px) {
  .lightbox { padding: 1rem 2.5rem 7rem; }
  .lb-prev, .lb-next { font-size: 2rem; }
}


.lb-remove {
  position: absolute;
  left: 1.1rem;
  bottom: 1.1rem;
  transform: none;
  z-index: 1001;
  appearance: none;
  border: 1px solid rgba(240, 238, 233, 0.45);
  background: rgba(44, 42, 38, 0.72);
  color: #F0EEE9;
  font: inherit;
  font-size: 0.88rem;
  letter-spacing: 0.02em;
  padding: 0.5rem 1.1rem;
  border-radius: 999px;
  cursor: pointer;
  opacity: 0.95;
  white-space: nowrap;
}
.lb-remove:hover {
  opacity: 1;
  border-color: #C9876A;
  color: #F7F5F1;
  background: rgba(181, 106, 76, 0.7);
}
@media (max-width: 560px) {
  .lb-remove { left: 0.75rem; bottom: 0.85rem; font-size: 0.82rem; padding: 0.45rem 0.9rem; }
  .lb-img { max-height: calc(100vh - 12.5rem); }
}


/* ---- Photo tags ---- */
.tag-bar {
  margin: 0 0 1rem;
}
.tag-bar[hidden] { display: none !important; }
.tag-bar-chips,
.browse-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}
.tag-chip {
  appearance: none;
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink-soft);
  font: inherit;
  font-size: 0.82rem;
  padding: 0.28rem 0.65rem;
  border-radius: 999px;
  cursor: pointer;
  text-decoration: none;
  line-height: 1.2;
}
a.tag-chip:hover,
button.tag-chip:hover {
  border-color: var(--clay);
  color: var(--clay);
  text-decoration: none;
}
.tag-chip.active {
  background: rgba(181, 106, 76, 0.12);
  border-color: var(--clay);
  color: var(--clay);
}
.tag-showing {
  margin-bottom: 0.55rem;
  font-size: 0.92rem;
  color: var(--ink-soft);
}
.tag-showing strong { color: var(--ink); font-weight: 600; }
.tag-hint { font-size: 0.85rem; font-style: italic; opacity: 0.9; }
.tag-clear {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--clay);
  font: inherit;
  font-size: inherit;
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
}
.tag-empty {
  color: var(--ink-soft);
  font-size: 0.92rem;
  margin: 0;
}

.lb-tags {
  width: min(100%, 520px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.45rem;
  margin-bottom: 0.25rem;
  position: relative;
  z-index: 1002;
}
.lb-tag-chips {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.35rem;
}
.lb-tag-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  background: rgba(240, 238, 233, 0.14);
  border: 1px solid rgba(240, 238, 233, 0.28);
  border-radius: 999px;
  padding: 0.15rem 0.25rem 0.15rem 0.55rem;
  color: #F0EEE9;
  font-size: 0.78rem;
}
.lb-tag-chip a {
  color: inherit;
  text-decoration: none;
}
.lb-tag-chip a:hover { text-decoration: underline; color: #F7F5F1; }
.lb-tag-x {
  appearance: none;
  border: 0;
  background: transparent;
  color: #F0EEE9;
  opacity: 0.7;
  cursor: pointer;
  font-size: 0.95rem;
  line-height: 1;
  padding: 0 0.3rem;
}
.lb-tag-x:hover { opacity: 1; color: #C9876A; }
.lb-tag-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  width: 100%;
}
.lb-tag-input {
  appearance: none;
  border: 1px solid rgba(240, 238, 233, 0.35);
  background: rgba(28, 26, 22, 0.45);
  color: #F0EEE9;
  font: inherit;
  font-size: 0.82rem;
  padding: 0.35rem 0.65rem;
  border-radius: 6px;
  min-width: 8rem;
  max-width: 12rem;
}
.lb-tag-input::placeholder { color: rgba(240, 238, 233, 0.55); }
.lb-tag-input:focus {
  outline: none;
  border-color: var(--clay-soft);
}
.lb-tag-suggest {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  justify-content: center;
}
.lb-tag-suggest-btn {
  appearance: none;
  border: 1px dashed rgba(240, 238, 233, 0.35);
  background: transparent;
  color: rgba(240, 238, 233, 0.8);
  font: inherit;
  font-size: 0.72rem;
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
  cursor: pointer;
}
.lb-tag-suggest-btn:hover {
  border-color: var(--clay-soft);
  color: #F7F5F1;
}

.browse-tags-section {
  margin-top: 2rem;
}
.browse-tags-section h2 {
  font-size: 1.05rem;
  font-weight: 600;
  margin: 0 0 0.75rem;
  color: var(--ink-soft);
}


/* Favorites heart — sits on the photo */
.lb-img-wrap {
  position: relative;
  display: inline-block;
  max-width: 100%;
  line-height: 0;
}
.lb-img-wrap .lb-img {
  display: block;
  max-width: 100%;
}
.lb-heart {
  position: absolute;
  right: 0.65rem;
  bottom: 0.65rem;
  z-index: 2;
  appearance: none;
  border: none;
  background: rgba(28, 26, 22, 0.45);
  color: rgba(255, 255, 255, 0.92);
  font: inherit;
  font-size: 1.55rem;
  line-height: 1;
  width: 2.6rem;
  height: 2.6rem;
  border-radius: 999px;
  cursor: pointer;
  padding: 0;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(2px);
}
.lb-heart:hover {
  background: rgba(28, 26, 22, 0.62);
  color: #ff5a5f;
  transform: scale(1.06);
}
.lb-heart-icon {
  width: 1.35rem;
  height: 1.35rem;
  display: block;
  margin: 0 auto;
  pointer-events: none;
}
.lb-heart.on {
  color: #e03131;
  background: rgba(255, 255, 255, 0.95);
}
.lb-heart.on:hover {
  color: #c92a2a;
}
.lb-heart.on .lb-heart-icon {
  color: #e03131;
  fill: #e03131;
}
@media (max-width: 560px) {
  .lb-heart {
    right: 0.45rem;
    bottom: 0.45rem;
    width: 2.35rem;
    height: 2.35rem;
    font-size: 1.35rem;
  }
}

.photo-card.favorited::after {
  content: "♥\FE0E";
  position: absolute;
  top: 0.35rem;
  right: 0.4rem;
  color: #e03131;
  font-size: 1.05rem;
  text-shadow: 0 1px 3px rgba(255, 255, 255, 0.85), 0 1px 2px rgba(44, 42, 38, 0.45);
  pointer-events: none;
  z-index: 2;
}
.photo-card { position: relative; }

.nav-favorites {
  margin-left: 0.15rem;
}
.nav-favorites a.active {
  color: var(--clay);
  border-bottom-color: var(--clay);
}


/* Back to top */
.back-to-top {
  position: fixed;
  right: 1.15rem;
  bottom: 1.15rem;
  z-index: 900;
  appearance: none;
  border: 1px solid var(--line);
  background: rgba(247, 245, 241, 0.94);
  color: var(--ink-soft);
  font: inherit;
  font-size: 0.82rem;
  letter-spacing: 0.02em;
  padding: 0.55rem 0.85rem;
  border-radius: 999px;
  cursor: pointer;
  box-shadow: 0 4px 18px rgba(44, 42, 38, 0.14);
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition: opacity 0.18s ease, transform 0.18s ease, border-color 0.15s ease, color 0.15s ease;
}
.back-to-top.show {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}
.back-to-top:hover {
  color: var(--clay);
  border-color: var(--clay);
}
body.lb-open .back-to-top { opacity: 0; pointer-events: none; }
@media (max-width: 560px) {
  .back-to-top { right: 0.85rem; bottom: 0.85rem; font-size: 0.78rem; padding: 0.5rem 0.75rem; }
}
