/* --- Theme variables --- */
:root[data-theme="dark"] {
  --color-bg:      #111;
  --color-surface: #1a1a1a;
  --color-text:    #e8e8e8;
  --color-muted:   #888;
  --color-accent:  #c8a96e;
  --color-border:  #2a2a2a;
}

:root[data-theme="light"] {
  --color-bg:      #f5f5f0;
  --color-surface: #fff;
  --color-text:    #1a1a1a;
  --color-muted:   #666;
  --color-accent:  #7a5c28;
  --color-border:  #ddd;
}

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

body {
  background: var(--color-bg);
  color: var(--color-text);
  font-family: system-ui, sans-serif;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

/* --- Header / nav --- */
.site-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 2rem;
  border-bottom: 1px solid var(--color-border);
  background: var(--color-surface);
}

.site-nav { display: flex; gap: 1.5rem; }

.nav-link {
  color: var(--color-text);
  text-decoration: none;
  font-size: 0.9rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.nav-link:hover { color: var(--color-accent); }

/* --- Theme toggle --- */
.theme-switcher {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.theme-icon {
  font-size: 0.85rem;
  line-height: 1;
  color: var(--color-muted);
}

.theme-toggle {
  background: none;
  border: 1px solid var(--color-border);
  border-radius: 999px;
  width: 2.5rem;
  height: 1.5rem;
  cursor: pointer;
  position: relative;
  padding: 0;
}

.theme-toggle-icon::before {
  content: '';
  display: block;
  width: 1rem;
  height: 1rem;
  border-radius: 50%;
  background: var(--color-accent);
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  transition: left 0.2s;
}

/* knob rests near ☀ in light mode, near 🌙 in dark mode */
[data-theme="light"] .theme-toggle-icon::before { left: 0.2rem; }
[data-theme="dark"]  .theme-toggle-icon::before { left: 1.1rem; }

/* --- Main content --- */
.site-main { flex: 1; padding: 2rem; }

/* --- Footer --- */
.site-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 2rem;
  border-top: 1px solid var(--color-border);
  background: var(--color-surface);
  font-size: 0.8rem;
  color: var(--color-muted);
}
.site-footer a { color: var(--color-muted); }
.site-footer a:hover { color: var(--color-accent); }

/* --- Feed page --- */
.feed {
  max-width: 860px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 3rem;
}

.feed__tag-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

/* --- Tag chips (shared: feed filter row + photo-post tags) --- */
.tag-chip {
  display: inline-block;
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  color: var(--color-muted);
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  text-decoration: none;
  text-transform: uppercase;
  transition: border-color 0.15s, color 0.15s;
}
.tag-chip:hover {
  border-color: var(--color-accent);
  color: var(--color-accent);
}

/* --- Photo post --- */
.photo-post {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.photo-post__header {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.photo-post__date {
  font-size: 0.8rem;
  color: var(--color-muted);
  letter-spacing: 0.05em;
}

.photo-post__date a {
  color: inherit;
  text-decoration: none;
}

.photo-post__date a:hover { color: var(--color-accent); }

.photo-post__title {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--color-text);
}

.photo-post__title a {
  color: inherit;
  text-decoration: none;
}

.photo-post__title a:hover { color: var(--color-accent); }

.photo-post__figure {
  margin: 0;
}

.photo-post__figure picture,
.photo-post__figure img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 2px;
}

.photo-post__description {
  font-size: 0.9rem;
  line-height: 1.6;
  color: var(--color-text);
}

.photo-post__description p { margin: 0; }

.photo-post__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

/* --- Galleries index --- */
.galleries {
  max-width: 860px;
  margin: 0 auto;
}

.galleries__heading {
  font-size: 1.4rem;
  font-weight: 600;
  margin-bottom: 1.5rem;
  color: var(--color-text);
}

.galleries__grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
}

@media (max-width: 600px) {
  .galleries__grid { grid-template-columns: repeat(2, 1fr); }
}

.gallery-card {
  text-decoration: none;
  color: var(--color-text);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.gallery-card__thumbnail {
  aspect-ratio: 1;
  overflow: hidden;
  border-radius: 6px;
  background: var(--color-surface);
}

.gallery-card__thumbnail img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.2s;
}

.gallery-card:hover .gallery-card__thumbnail img { transform: scale(1.03); }

.gallery-card__name {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-muted);
}

.gallery-card:hover .gallery-card__name { color: var(--color-accent); }

/* --- Home page --- */
.home {
  max-width: 860px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 3rem;
}

.home__section {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.home__section-heading {
  font-size: 1.4rem;
  font-weight: 600;
  color: var(--color-text);
}

.home__section-footer {
  text-align: right;
}

.home__section-link {
  font-size: 0.85rem;
  color: var(--color-accent);
  text-decoration: none;
  letter-spacing: 0.03em;
}
.home__section-link:hover { text-decoration: underline; }

/* --- Home carousel --- */
.home-carousel {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.home-carousel__slides {
  position: relative;
  border-radius: 4px;
  overflow: hidden;
  background: var(--color-surface);
  height: 65dvh;
}

.home-carousel__slide {
  display: none;
  margin: 0;
  cursor: pointer;
  height: 100%;
}

.home-carousel__slide.is-active { display: block; }

.home-carousel__slide picture,
.home-carousel__slide img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
}

.home-carousel__btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(0, 0, 0, 0.45);
  color: #fff;
  border: none;
  font-size: 2rem;
  line-height: 1;
  padding: 0.5rem 0.75rem;
  cursor: pointer;
  border-radius: 2px;
  z-index: 1;
  transition: background 0.15s;
}

.home-carousel__btn:hover { background: rgba(0, 0, 0, 0.7); }
.home-carousel__btn--prev { left: 0.5rem; }
.home-carousel__btn--next { right: 0.5rem; }

.home-carousel__dots {
  display: flex;
  justify-content: center;
  gap: 0.4rem;
}

.home-carousel__dot {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: var(--color-muted);
  cursor: pointer;
  transition: background 0.15s;
}

.home-carousel__dot.is-active { background: var(--color-accent); }

.home-carousel__caption {
  display: flex;
  gap: 0.75rem;
  align-items: baseline;
  font-size: 0.85rem;
  min-height: 1.2em;
}

.home-carousel__caption-title {
  font-weight: 600;
  color: var(--color-text);
}

.home-carousel__caption-date { color: var(--color-muted); }

/* --- Photo modal --- */
.photo-modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.photo-modal[hidden] { display: none; }

.photo-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  cursor: pointer;
}

.photo-modal__content {
  position: relative;
  z-index: 1;
  max-width: min(860px, 92vw);
  max-height: 90dvh;
  overflow-y: auto;
  background: var(--color-surface);
  border-radius: 4px;
  display: flex;
  flex-direction: column;
}

.photo-modal__figure { margin: 0; }

.photo-modal__figure picture,
.photo-modal__figure img {
  width: 100%;
  height: auto;
  display: block;
  max-height: 65dvh;
  object-fit: contain;
}

.photo-modal__info {
  padding: 1rem 1.25rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.photo-modal__header {
  display: flex;
  gap: 0.75rem;
  align-items: baseline;
  flex-wrap: wrap;
}

.photo-modal__title { font-size: 1.1rem; font-weight: 600; }

.photo-modal__date { font-size: 0.8rem; color: var(--color-muted); }

.photo-modal__description { font-size: 0.9rem; line-height: 1.6; }

.photo-modal__description p { margin: 0; }

.photo-modal__tags { display: flex; flex-wrap: wrap; gap: 0.4rem; }

.photo-modal__permalink {
  display: inline-block;
  margin-top: 0.5rem;
  font-size: 0.8rem;
  color: var(--color-muted);
  text-decoration: none;
}

.photo-modal__permalink:hover { color: var(--color-accent); }

.photo-modal__close {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  z-index: 2;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  border: none;
  font-size: 1.25rem;
  line-height: 1;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.photo-modal__prev,
.photo-modal__next {
  position: relative;
  z-index: 1;
  background: rgba(0, 0, 0, 0.4);
  color: #fff;
  border: none;
  font-size: 2.5rem;
  line-height: 1;
  padding: 1rem 0.6rem;
  cursor: pointer;
  border-radius: 2px;
  transition: background 0.15s;
  align-self: center;
  flex-shrink: 0;
}

.photo-modal__prev:hover,
.photo-modal__next:hover { background: rgba(0, 0, 0, 0.7); }

.photo-modal__prev.is-hidden,
.photo-modal__next.is-hidden {
  visibility: hidden;
  pointer-events: none;
}

/* --- About page --- */
.about {
  max-width: 860px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 2.5rem;
}

.about__heading {
  font-size: 1.4rem;
  font-weight: 600;
  color: var(--color-text);
}

.about__section {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.about__section-heading {
  font-size: 1rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-muted);
}

.about__bio {
  font-size: 0.95rem;
  line-height: 1.7;
  color: var(--color-text);
}

.about__links {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.about__link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
  color: var(--color-text);
  text-decoration: none;
}
.about__link:hover { color: var(--color-accent); }

.about__link-icon { color: var(--color-muted); width: 1em; }

.about__bio a { color: var(--color-accent); text-decoration: none; }
.about__bio a:hover { text-decoration: underline; }

/* --- Per-tag gallery page --- */
.gallery__header {
  display: flex;
  align-items: baseline;
  gap: 1rem;
  margin-bottom: 0.5rem;
}

.gallery__title {
  font-size: 1.4rem;
  font-weight: 600;
}

.gallery__count {
  font-size: 0.8rem;
  color: var(--color-muted);
}

/* --- Per-photo permalink page --- */
.photo-permalink {
  max-width: 900px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.photo-permalink__header {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.photo-permalink__title {
  font-size: 1.6rem;
  font-weight: 600;
  color: var(--color-text);
}

.photo-permalink__date {
  font-size: 0.8rem;
  color: var(--color-muted);
  letter-spacing: 0.05em;
}

.photo-permalink__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.photo-permalink__figure {
  margin: 0;
}

.photo-permalink__figure picture,
.photo-permalink__figure img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 2px;
}

.photo-permalink__description {
  font-size: 0.9rem;
  line-height: 1.6;
  color: var(--color-text);
}

.photo-permalink__description p { margin: 0; }

.photo-permalink__nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 0.5rem;
  border-top: 1px solid var(--color-border);
  margin-top: 0.5rem;
}

.photo-permalink__nav-link {
  font-size: 0.85rem;
  color: var(--color-muted);
  text-decoration: none;
}

.photo-permalink__nav-link:hover { color: var(--color-accent); }
