:root {
  --bg: #ffffff;
  --ink: #2a2a2a;
  --muted: #6b6b6b;
  --rule: #e8e8e8;
  --accent: #1a1a1a;
  --serif: "Cormorant Garamond", Georgia, serif;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 4px; }

/* ---------- Layout ---------- */

.site {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.site-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 3rem 1.5rem 1.5rem;
}

.site-logo-link {
  display: block;
  margin: 0 0 1.25rem;
  line-height: 0; /* collapse inline whitespace around the img */
}

.site-logo-link:hover { text-decoration: none; }

.site-logo {
  width: clamp(140px, 30vw, 220px);
  height: auto;
  display: block;
}

.site-nav {
  display: flex;
  gap: 2rem;
  font-size: 0.9rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.site-nav a {
  color: var(--muted);
  padding-bottom: 2px;
}
.site-nav a:hover,
.site-nav a.active {
  color: var(--ink);
  text-decoration: none;
  border-bottom: 1px solid var(--ink);
}

main {
  flex: 1;
  width: 100%;
  max-width: 1440px;
  margin: 0 auto;
  padding: 3rem 2rem 5rem;
}

.site-footer {
  text-align: center;
  padding: 2rem 1.5rem;
  font-size: 0.8rem;
  color: var(--muted);
}

/* ---------- Tag chips (above the grid) ---------- */

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0 0 3rem;
  font-size: 0.85rem;
  letter-spacing: 0.04em;
}

.tag {
  display: inline-flex;
  align-items: baseline;
  gap: 0.4rem;
  padding: 0.4rem 0.9rem;
  border: 1px solid var(--rule);
  border-radius: 999px;
  color: var(--ink);
  text-decoration: none;
  transition: background 150ms ease, border-color 150ms ease;
  white-space: nowrap;
}

.tag:hover {
  text-decoration: none;
  border-color: var(--ink);
}

.tag.active {
  background: var(--ink);
  color: #fff;
  border-color: var(--ink);
}

.tag-count {
  font-size: 0.75em;
  opacity: 0.6;
  font-variant-numeric: tabular-nums;
}

.tag.active .tag-count { opacity: 0.7; }

/* ---------- Works grid ---------- */

/* 3-column grid with generous gaps. Span classes let select paintings
   stretch across 2 columns based on aspect ratio. Images keep their
   natural proportions via inline aspect-ratio + masonry rows. */
.grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4rem;
  align-items: start;
  grid-auto-flow: dense;
}

@supports (grid-template-rows: masonry) {
  .grid { grid-template-rows: masonry; }
}

.thumb.span-wide  { grid-column: span 2; }
.thumb.span-hero  { grid-column: span 2; }

.grid-spacer { /* intentional whitespace */ }

.thumb {
  position: relative;
  display: block;
  overflow: hidden;
  background: #f4f4f4;
  width: 100%;
}

.thumb img {
  width: 100%;
  height: auto;
  display: block;
  transition: transform 600ms ease;
}

.thumb:hover img {
  transform: scale(1.02);
}

.thumb .caption {
  position: absolute;
  inset: auto 0 0 0;
  padding: 0.75rem 1rem;
  background: linear-gradient(180deg, rgba(0,0,0,0) 0%, rgba(0,0,0,0.55) 100%);
  color: #fff;
  font-family: var(--serif);
  font-size: 1.1rem;
  letter-spacing: 0.02em;
  opacity: 0;
  transition: opacity 250ms ease;
}

.thumb:hover .caption { opacity: 1; }

.thumb a, .thumb { text-decoration: none; }

/* ---------- Lightbox ---------- */

.lightbox {
  position: fixed;
  inset: 0;
  background: #fff;
  color: var(--ink);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3rem 4.5rem;
  z-index: 100;
  overflow: auto;
}

/* The figure is sized to exactly match the rendered image so the caption
   below can align flush-left with the painting's left edge. Width is
   whichever is smaller: the horizontal viewport budget, or the width
   the image would have at the maximum allowed height. --aspect is set
   inline (image_width / image_height) from the data. */
.lightbox-figure {
  margin: 0;
  display: flex;
  flex-direction: column;
  width: min(
    calc(100vw - 9rem),
    calc((100vh - 6rem - 9rem) * var(--aspect, 1.333))
  );
}

.lightbox-figure img {
  width: 100%;
  height: auto;
  aspect-ratio: var(--aspect, 1.333);
  display: block;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.08);
}

.lightbox-meta {
  text-align: left;
  margin: 1.5rem 0 0;
  /* figcaption inherits the figure's width, so it's already aligned to
     the painting's left edge. */
}

.lightbox-meta h2 {

  font-weight: 500;
  font-size: 1rem;
  margin: 0 0 0.4rem;
  letter-spacing: 0.02em;
  color: var(--ink);
}

.lightbox-meta .specs {
  font-size: 0.75rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 0.75rem;
}

.lightbox-meta .desc {
  font-size: 0.95rem;
  color: var(--ink);
  margin: 0;
  max-width: 60ch;
}

.lightbox-arrow,
.lightbox-close {
  position: fixed;
  background: none;
  border: none;
  color: var(--ink);
  cursor: pointer;
  padding: 0.75rem;
  line-height: 0;
  opacity: 0.45;
  transition: opacity 150ms ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

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

/* Size the inline SVGs via CSS — stroke="currentColor" inherits colour */
.lightbox-arrow svg { width: 2rem; height: 2rem; }
.lightbox-close svg { width: 1.5rem; height: 1.5rem; }

.lightbox-arrow.prev { left: 0.5rem; top: 50%; transform: translateY(-50%); }
.lightbox-arrow.next { right: 0.5rem; top: 50%; transform: translateY(-50%); }
.lightbox-close { top: 0.75rem; right: 1rem; }

.lightbox-counter {
  position: fixed;
  top: 1rem;
  left: 1.25rem;
  font-size: 0.8rem;
  letter-spacing: 0.15em;
  color: var(--muted);
}

/* ---------- Prose pages (About / Contact) ---------- */

.prose {
  max-width: 640px;
  margin: 0 auto;
}

.prose h2 {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 2rem;
  margin: 0 0 1.5rem;
  letter-spacing: 0.02em;
}

.prose p { margin: 0 0 1.1rem; }

.prose a { border-bottom: 1px solid var(--rule); }
.prose a:hover { border-color: var(--ink); text-decoration: none; }

/* ---------- States ---------- */

.loading, .empty {
  text-align: center;
  color: var(--muted);
  padding: 4rem 0;
  font-style: italic;
}

/* ---------- Mobile ---------- */

/* Tablet — 2 columns, tighter gaps. */
@media (max-width: 1000px) {
  .grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 2.5rem;
  }
}

@media (max-width: 600px) {
  .site-header { padding: 2rem 1rem 1rem; }
  .site-nav { gap: 1.25rem; font-size: 0.8rem; }
  main { padding: 1.5rem 1rem 3rem; }
  .grid {
    grid-template-columns: 1fr;
    gap: 2rem;
  }
  .thumb.span-wide,
  .thumb.span-hero  { grid-column: span 1; }
  .grid-spacer { display: none; }
  .lightbox { padding: 3rem 1rem; }
  .lightbox-figure {
    width: min(
      calc(100vw - 2rem),
      calc((100vh - 4rem - 8rem) * var(--aspect, 1.333))
    );
  }
  .lightbox-meta { margin-top: 1rem; }
  .lightbox-meta h2 { font-size: 1.35rem; }
  .lightbox-arrow.prev { left: 0; font-size: 2rem; }
  .lightbox-arrow.next { right: 0; font-size: 2rem; }
}

