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

/* ── View Transitions (crossfade) ── */
@keyframes vt-fade-out {
  from { opacity: 1; }
  to { opacity: 0; }
}

@keyframes vt-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

::view-transition-old(root) {
  animation: vt-fade-out 500ms ease;
}

::view-transition-new(root) {
  animation: vt-fade-in 500ms ease;
}

/* ── Variables ── */
:root {
  --bg: #fafafa;
  --fg: #111;
  --fg-muted: #666;
  --border: #ddd;
  --card-shadow: rgba(0, 0, 0, 0.08);
  --header-bg: rgba(250, 250, 250, 0.82);
  --section-chip-bg: rgba(255, 255, 255, 0.9);
  --section-chip-border: rgba(0, 0, 0, 0.08);
  --section-chip-shadow: rgba(0, 0, 0, 0.08);
  --font-hand: "Caveat", cursive;
  --font-serif: Georgia, "Times New Roman", serif;
  --font-body: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  --max-width: 1600px;
  --gap: 0.5rem;
}

@media (prefers-color-scheme: dark) {
  :root {
  --bg: #111;
  --fg: #e8e8e8;
  --fg-muted: #888;
  --border: #333;
  --card-shadow: rgba(0, 0, 0, 0.4);
  --header-bg: rgba(17, 17, 17, 0.72);
  --section-chip-bg: rgba(20, 20, 20, 0.86);
  --section-chip-border: rgba(255, 255, 255, 0.14);
  --section-chip-shadow: rgba(0, 0, 0, 0.45);
  }
}

/* ── Base ── */
html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
}

html,
body {
  min-height: 100%;
}

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--fg);
  line-height: 1.6;
}

body.site-page {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

a {
  color: var(--fg);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

img {
  display: block;
  max-width: 100%;
  height: auto;
}

/* ── Site header ── */
.site-header {
  padding: 1.25rem 0;
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--header-bg);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid color-mix(in srgb, var(--border) 70%, transparent);
}

.site-header-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--gap);
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

.site-title {
  font-family: var(--font-hand);
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  line-height: 1;
}

.site-nav {
  display: flex;
  gap: 1.25rem;
  font-size: 0.9rem;
}


.site-nav a {
  color: var(--fg-muted);
  transition: color 0.15s;
}

.site-nav a:hover {
  color: var(--fg);
  text-decoration: none;
}

.site-main {
  max-width: var(--max-width);
  margin: 0 auto;
  width: 100%;
  flex: 1 0 auto;
  padding: 0.75rem var(--gap) 2rem;
}

/* ── Gallery ── */
.gallery {
  display: flex;
  flex-direction: column;
  gap: 2.5rem;
}

.gallery-section {
  display: flex;
  flex-direction: column;
}

.gallery-section-title {
  position: sticky;
  bottom: 0.75rem;
  z-index: 25;
  display: inline-flex;
  align-self: flex-end;
  order: 2;
  width: fit-content;
  margin: 0;
  margin-top: 0.55rem;
  margin-right: 0.75rem;
  padding: 0.3rem 0.55rem;
  font-family: var(--font-body);
  font-size: 1.1rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  text-transform: none;
  color: var(--fg);
  background: var(--section-chip-bg);
  border: 1px solid var(--section-chip-border);
  border-radius: 999px;
  box-shadow: 0 4px 14px var(--section-chip-shadow);
  backdrop-filter: blur(4px);
}

.gallery-grid {
  order: 1;
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  grid-auto-rows: 140px;
  grid-auto-flow: dense;
  gap: var(--gap);
}

/* Span driven by --col-span custom property set inline */
.photo-card-wrap {
  --row-span: 2;
  grid-column: span var(--col-span);
  grid-row: span var(--row-span);
  min-width: 0;
}

.photo-card-wrap.is-hero {
  --row-span: 4;
}

.photo-card-wrap .photo-card {
  width: 100%;
  height: 100%;
}

@media (max-width: 900px) {
  .gallery-grid {
    grid-auto-rows: 120px;
  }
}

@media (max-width: 520px) {
  .gallery-grid {
    grid-template-columns: repeat(2, 1fr);
    grid-auto-rows: 120px;
  }

  .photo-card-wrap { grid-column: span 1; }

  .photo-card-wrap.is-hero {
    grid-column: 1 / -1;
  }
}

/* ── Photo card ── */
.photo-card {
  position: relative;
  overflow: hidden;
  border-radius: 2px;
  box-shadow: 0 1px 3px var(--card-shadow);
}

.photo-card a {
  display: block;
  width: 100%;
  height: 100%;
}

.photo-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.35s ease;
}

.photo-card:hover img {
  transform: scale(1.04);
}

/* Hover overlay */
.photo-card-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.72) 0%, rgba(0,0,0,0) 55%);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 1rem 0.85rem 0.85rem;
  opacity: 0;
  transition: opacity 0.25s ease;
}

.photo-card:hover .photo-card-overlay {
  opacity: 1;
}

.photo-card-title {
  font-family: var(--font-serif);
  font-size: 1rem;
  font-weight: 700;
  color: #fff;
  line-height: 1.2;
  margin-bottom: 0.2rem;
}

.photo-card-meta {
  font-family: var(--font-body);
  font-size: 0.75rem;
  color: rgba(255,255,255,0.75);
}

/* ── Full-bleed photo page ── */
body.photo-page {
  background: #000;
  color: #e8e8e8;
  min-height: 100dvh;
}

.photo-hero {
  position: relative;
}

.photo-pager--hero {
  position: absolute;
  left: 1.25rem;
  right: 1.25rem;
  bottom: 1.25rem;
  justify-content: space-between;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
  z-index: 12;
}

.photo-pager--hero .photo-pager-link {
  color: rgba(255,255,255,0.85);
  background: rgba(0,0,0,0.35);
  padding: 0.35rem 0.6rem;
  border-radius: 999px;
  text-transform: lowercase;
  letter-spacing: 0.02em;
}

.photo-pager--hero .photo-pager-link:hover {
  color: #fff;
  text-decoration: none;
  background: rgba(0,0,0,0.55);
}

.photo-pager--hero .photo-pager-link.next {
  margin-left: auto;
}

.photo-nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 12;
  display: flex;
  justify-content: flex-start;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.5rem;
  background: linear-gradient(to bottom, rgba(0,0,0,0.6) 0%, rgba(0,0,0,0) 100%);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.photo-nav-title {
  font-family: var(--font-hand);
  font-size: 1.5rem;
  color: rgba(255,255,255,0.7);
  transition: color 0.15s;
}

.photo-nav-title:hover {
  color: #fff;
  text-decoration: none;
}

.photo-hero {
  width: 100%;
  height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.photo-hero img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.hover-zone {
  position: fixed;
  left: 0;
  right: 0;
  z-index: 5;
}

.hover-zone--top {
  top: 0;
  height: 72px;
}

.hover-zone--bottom {
  bottom: 0;
  height: 120px;
  z-index: 5;
}

.hover-zone--top:hover + .photo-nav,
.photo-nav:hover,
.photo-nav:focus-within {
  opacity: 1;
  pointer-events: auto;
}

.hover-zone--bottom:hover + .photo-pager--hero,
.photo-pager--hero:hover,
.photo-pager--hero:focus-within {
  opacity: 1;
  pointer-events: auto;
}

@media (hover: none), (pointer: coarse) {
  .photo-nav,
  .photo-pager--hero {
    opacity: 1;
    pointer-events: auto;
  }

  .hover-zone {
    display: none;
  }
}

@media (max-width: 900px) {
  .photo-nav,
  .photo-pager--hero {
    opacity: 1;
    pointer-events: auto;
  }

  .hover-zone {
    display: none;
  }
}

.photo-details {
  max-width: 680px;
  margin: 0 auto;
  padding: 4rem 1.5rem 6rem;
}

.photo-details-title {
  font-family: var(--font-hand);
  font-size: 2.2rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  color: #fff;
}

.photo-details-desc {
  color: rgba(255,255,255,0.6);
  font-size: 0.95rem;
  margin-bottom: 2rem;
}

.photo-meta-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  margin-bottom: 1.5rem;
}

/* ── Photo pager ── */
.photo-pager {
  margin-top: 1.5rem;
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  font-size: 0.9rem;
}

.photo-pager-link {
  color: var(--fg-muted);
  text-transform: lowercase;
  letter-spacing: 0.02em;
}

.photo-pager-link:hover {
  color: var(--fg);
  text-decoration: none;
}

.photo-meta-table th,
.photo-meta-table td {
  text-align: left;
  padding: 0.5rem 0;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}

.photo-meta-table th {
  width: 130px;
  color: rgba(255,255,255,0.45);
  font-weight: 400;
}

.photo-meta-table td {
  color: rgba(255,255,255,0.85);
}

/* ── Tags ── */
.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  list-style: none;
  margin-top: 1rem;
}

.tag-list a {
  font-size: 0.8rem;
  color: rgba(255,255,255,0.5);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 3px;
  padding: 0.2rem 0.5rem;
  transition: color 0.15s, border-color 0.15s;
}

.tag-list a:hover {
  color: #fff;
  border-color: rgba(255,255,255,0.6);
  text-decoration: none;
}

/* ── Tag page / gallery page header ── */
.page-header {
  margin-bottom: 1.5rem;
}

.page-header h1 {
  font-family: var(--font-hand);
  font-size: 1.8rem;
  font-weight: 700;
}

.page-header p {
  color: var(--fg-muted);
  font-size: 0.9rem;
}

/* ── About / prose ── */
.prose {
  max-width: 640px;
  line-height: 1.7;
}

.prose p + p {
  margin-top: 1rem;
}

.prose h2 {
  font-size: 1.4rem;
  margin-top: 2rem;
  margin-bottom: 0.5rem;
}

/* ── Footer ── */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 1.5rem 0;
  margin-top: auto;
  text-align: center;
  font-size: 0.8rem;
  color: var(--fg-muted);
}
