/* ---------------------------------------------------------------
   Bittarelli's Wildlife
   Palette + type live here. Copy text lives in data/paintings.json.
   --------------------------------------------------------------- */

:root {
  --bg:          #faf8f4;
  --bg-sunk:     #f1ede5;
  --surface:     #ffffff;
  --ink:         #23201b;
  --ink-soft:    #5f594e;
  --ink-faint:   #8c8578;
  --rule:        #e2dbcd;
  --accent:      #6c4f2a;
  --sold:        #9a3b2a;

  --shadow-sm: 0 1px 2px rgba(35, 32, 27, .06), 0 4px 12px rgba(35, 32, 27, .06);
  --shadow-lg: 0 8px 24px rgba(35, 32, 27, .14), 0 24px 60px rgba(35, 32, 27, .12);

  --page-max: 1180px;
  --gutter: clamp(1.1rem, 4vw, 3rem);

  --serif: "Cormorant Garamond", Georgia, "Times New Roman", serif;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg:        #16150f;
    --bg-sunk:   #1e1c15;
    --surface:   #23211a;
    --ink:       #f0ece3;
    --ink-soft:  #b8b1a3;
    --ink-faint: #8b8477;
    --rule:      #363327;
    --accent:    #d8b483;
    --sold:      #e08a72;
    --shadow-sm: 0 1px 2px rgba(0,0,0,.4), 0 4px 12px rgba(0,0,0,.3);
    --shadow-lg: 0 8px 24px rgba(0,0,0,.5), 0 24px 60px rgba(0,0,0,.45);
  }
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

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

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

a { color: var(--accent); }

.visually-hidden {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---------- Masthead ---------- */

.masthead {
  max-width: var(--page-max);
  margin: 0 auto;
  padding: clamp(2.75rem, 8vw, 5.5rem) var(--gutter) clamp(1.25rem, 3vw, 2rem);
  text-align: center;
}

.masthead__title {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(2.5rem, 9vw, 4.75rem);
  line-height: 1.05;
  letter-spacing: .005em;
  margin: 0;
}

.masthead__tagline {
  margin: .9rem 0 0;
  font-size: clamp(.72rem, 2.4vw, .82rem);
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

/* ---------- Artist blurb ---------- */

.about {
  max-width: 46rem;
  margin: 0 auto;
  padding: clamp(1.5rem, 4vw, 2.5rem) var(--gutter) clamp(2.5rem, 6vw, 4rem);
  border-bottom: 1px solid var(--rule);
}

.about__blurb p {
  font-family: var(--serif);
  font-size: clamp(1.15rem, 3.4vw, 1.4rem);
  line-height: 1.62;
  color: var(--ink-soft);
  margin: 0 0 1.1em;
}

.about__blurb p:last-child { margin-bottom: 0; }

/* ---------- Gallery ---------- */

.section-heading {
  max-width: var(--page-max);
  margin: clamp(2.5rem, 6vw, 4rem) auto clamp(1.25rem, 3vw, 2rem);
  padding: 0 var(--gutter);
  font-family: var(--sans);
  font-weight: 500;
  font-size: .74rem;
  letter-spacing: .24em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

.gallery {
  max-width: var(--page-max);
  margin: 0 auto;
  padding: 0 var(--gutter) clamp(3rem, 8vw, 5rem);
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 270px), 1fr));
  gap: clamp(1.5rem, 4vw, 2.75rem);
  align-items: start;
}

.gallery__status {
  grid-column: 1 / -1;
  text-align: center;
  color: var(--ink-faint);
  padding: 3rem 0;
}

.gallery__status code {
  font-size: .9em;
  background: var(--bg-sunk);
  padding: .15em .45em;
  border-radius: 4px;
}

/* ---------- Card ----------
   Tiles are square: the thumbnails in images/thumbs/ are already cropped
   square by tools/make_thumbs.sh, and the rules below hold the shape even
   if a thumbnail is missing and the full-size file is used instead.
   No caption here by design — details appear in the lightbox on click. */

.card__button {
  appearance: none;
  border: 0;
  padding: 0;
  margin: 0;
  background: var(--bg-sunk);
  cursor: zoom-in;
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 3px;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: transform .28s ease, box-shadow .28s ease;
}

.card__button:hover,
.card__button:focus-visible {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
}

.card__button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.card__img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: var(--bg-sunk);
}

/* ---------- Footer ---------- */

.site-footer {
  border-top: 1px solid var(--rule);
  max-width: 46rem;
  margin: 0 auto;
  padding: clamp(2.5rem, 6vw, 3.5rem) var(--gutter) clamp(3rem, 8vw, 4.5rem);
  text-align: center;
  color: var(--ink-faint);
  font-size: .9rem;
}

.site-footer p { margin: 0 0 .7rem; }

.site-footer__contact {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: .75rem 2.25rem;
  margin-top: 1.35rem;
}

/* display:inline-flex below would otherwise beat the [hidden] attribute and
   the link would flash in before the JS has decided whether to show it. */
.site-footer__link[hidden] { display: none; }

.site-footer__link {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  font-family: var(--serif);
  font-size: 1.3rem;
  line-height: 1.2;
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  padding-bottom: 2px;
  transition: border-color .2s ease;
}

.site-footer__link:hover,
.site-footer__link:focus-visible { border-bottom-color: currentColor; }

.site-footer__link:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
  border-radius: 2px;
}

.site-footer__icon { flex: none; }

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

body.is-locked { overflow: hidden; }

/* [hidden] alone loses to display:flex below, so it needs to be explicit. */
.lightbox[hidden] { display: none; }

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(18, 16, 12, .93);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(1rem, 4vw, 3rem);
  animation: lb-in .22s ease both;
  overscroll-behavior: contain;
}

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

.lightbox__figure {
  margin: 0;
  max-width: 100%;
  max-height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}

.lightbox__img {
  max-width: 100%;
  max-height: 76vh;
  width: auto;
  object-fit: contain;
  cursor: zoom-out;
  border-radius: 2px;
  box-shadow: 0 20px 70px rgba(0, 0, 0, .6);
  touch-action: pan-y;
}

.lightbox__caption {
  color: #efe9dd;
  text-align: center;
  max-width: 42rem;
  font-size: .9rem;
  line-height: 1.55;
}

.lightbox__caption strong {
  display: block;
  font-family: var(--serif);
  font-weight: 600;
  font-size: 1.5rem;
  margin-bottom: .3rem;
  color: #fff;
}

.lightbox__caption em {
  display: block;
  font-style: normal;
  color: #b6ada0;
}

.lightbox__caption .lb-price { color: #e8dcc4; font-weight: 600; }
.lightbox__caption .lb-price--sold {
  color: #e08a72; font-weight: 500;
  text-transform: uppercase; letter-spacing: .12em; font-size: .78rem;
}
.lightbox__caption .lb-desc {
  margin-top: .7rem;
  font-family: var(--serif);
  font-size: 1.08rem;
  color: #cfc6b6;
}

/* Lightbox controls */

.lightbox__close,
.lightbox__nav {
  position: absolute;
  appearance: none;
  border: 0;
  background: rgba(255, 255, 255, .08);
  color: #f3eee4;
  cursor: pointer;
  border-radius: 50%;
  display: grid;
  place-items: center;
  line-height: 1;
  transition: background .2s ease;
  -webkit-tap-highlight-color: transparent;
}

.lightbox__close:hover,
.lightbox__nav:hover { background: rgba(255, 255, 255, .18); }

.lightbox__close:focus-visible,
.lightbox__nav:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }

.lightbox__close {
  top: clamp(.75rem, 2vw, 1.5rem);
  right: clamp(.75rem, 2vw, 1.5rem);
  width: 2.75rem; height: 2.75rem;
  font-size: 1.9rem;
  padding-bottom: .18em;
}

.lightbox__nav {
  top: 50%;
  transform: translateY(-50%);
  width: 3rem; height: 3rem;
  font-size: 2.1rem;
  padding-bottom: .12em;
}

.lightbox__nav--prev { left: clamp(.5rem, 2vw, 1.5rem); }
.lightbox__nav--next { right: clamp(.5rem, 2vw, 1.5rem); }

.lightbox__nav[hidden] { display: none; }

/* On narrow screens move the arrows to the bottom so they don't sit on the art */
@media (max-width: 560px) {
  .lightbox__nav {
    top: auto;
    bottom: max(1rem, env(safe-area-inset-bottom));
    transform: none;
    width: 3.25rem; height: 3.25rem;
  }
  .lightbox__nav--prev { left: 1.25rem; }
  .lightbox__nav--next { right: 1.25rem; }
  .lightbox__img { max-height: 62vh; }
  .lightbox__caption { padding-bottom: 4.5rem; }
}

/* Two-up grid on small phones reads better than one giant column */
@media (max-width: 520px) {
  .gallery {
    grid-template-columns: repeat(2, 1fr);
    gap: .9rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    transition-duration: .01ms !important;
  }
}
