:root {
  --wall: #eeeeee;
  --ink: #111;
  --muted: rgba(0,0,0,.13);
  --muted-active: rgba(0,0,0,.34);
  --serif: 'EB Garamond', Georgia, serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--wall);
  color: var(--ink);
  font-family: var(--serif);
  overflow: hidden;
}

/* ── Layout ── */
.gallery {
  min-height: 100svh;
  display: grid;
  grid-template-rows: 1fr auto 1fr;
  justify-items: center;
}

.brand {
  display: flex;
  justify-content: center;
  align-items: center;
  align-self: center;
}

.bottom-stack {
  align-self: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.25rem;
}

.brand img {
  width: clamp(120px, 12vw, 180px);
  height: auto;
  display: block;
}

/* ── Viewer ── */
.viewer {
  position: relative;
  width: 100%;
  min-height: 0;
  display: grid;
  grid-template-columns: 1fr minmax(280px, 700px) 1fr;
  align-items: center;
  justify-items: center;
}

.art-button {
  grid-column: 2;
  justify-self: center;
  width: min(76vw, 700px, 62svh);
  aspect-ratio: 1 / 1;
  padding: 0;
  border: 0;
  background: transparent;
  position: relative;
  perspective: 1200px;
  cursor: zoom-in;
}

/* ── Card flip ── */
.card-inner {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  transition: transform 0.6s ease;
}

.art-button.is-flipped .card-inner {
  transform: rotateY(180deg);
}

.card-face {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  background: #ffffff;
  border: 1px solid rgba(0,0,0,.05);
  box-shadow: 0 1.4rem 2.6rem rgba(0,0,0,.12);
}

.card-front {
  transform: rotateY(0deg);
  padding: 0;
  font: inherit;
  color: inherit;
  cursor: zoom-in;
  border: 0;
  background: transparent;
}

.card-back {
  transform: rotateY(180deg);
  padding: 2rem;
  text-align: center;
  align-content: center;
  gap: .45rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

#galleryCanvas {
  width: 100%;
  height: 100%;
  display: block;
  pointer-events: none;
}

/* Zoom hint on hover */
.zoom-hint {
  position: absolute;
  bottom: 13%;
  right: 13%;
  font-size: 1.15rem;
  color: rgba(0,0,0,.18);
  pointer-events: none;
  transition: color .2s ease, opacity .2s ease;
  opacity: 0;
  line-height: 1;
}

.art-button:hover .zoom-hint,
.card-front:focus-visible .zoom-hint {
  opacity: 1;
  color: rgba(0,0,0,.38);
}

/* ── Card back detail styles ── */
.detail-title {
  font-size: clamp(1.1rem, 2vw, 1.55rem);
  font-weight: 400;
  letter-spacing: -0.02em;
  margin-bottom: .2rem;
}

.detail-line {
  font-size: .9rem;
  color: rgba(0,0,0,.6);
  letter-spacing: .01em;
}

.detail-edition {
  font-style: italic;
  color: rgba(0,0,0,.45);
  font-size: .85rem;
}

.detail-price {
  font-size: clamp(1.15rem, 2vw, 1.4rem);
  font-weight: 500;
  letter-spacing: -0.01em;
  margin-top: .35rem;
}

.buy-button {
  display: inline-block;
  margin-top: .9rem;
  padding: .55rem 1.4rem;
  background: var(--ink);
  color: #eee;
  font-family: var(--serif);
  font-size: .95rem;
  letter-spacing: .01em;
  text-decoration: none;
  border: 1px solid var(--ink);
  transition: background .18s ease, color .18s ease;
  cursor: pointer;
}

.buy-button:hover,
.buy-button:focus-visible {
  background: transparent;
  color: var(--ink);
}

/* ── Nav arrows ── */
.nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 4rem;
  height: 6rem;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: clamp(4rem, 6vw, 6rem);
  font-weight: 200;
  line-height: 1;
  cursor: pointer;
  transition: color .18s ease, transform .18s ease;
  -webkit-user-select: none;
  user-select: none;
}
.nav:hover,
.nav:focus-visible { color: var(--muted-active); }
.nav:active { transform: translateY(-50%) scale(.96); }
.nav-prev { left: max(5vw, calc(50% - 470px)); }
.nav-next { right: max(5vw, calc(50% - 470px)); }

/* ── Caption ── */
.caption {
  text-align: center;
}

.caption h1 {
  margin: 0 0 .6rem;
  font-size: clamp(1.15rem, 1.9vw, 1.65rem);
  line-height: 1.1;
  font-weight: 400;
  letter-spacing: -0.025em;
}

.caption-meta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .65rem;
  opacity: .65;
}

.caption-price {
  font-size: .9rem;
  font-style: italic;
}

.caption-sep {
  opacity: .5;
  font-size: .85rem;
}

.details-link {
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: .9rem;
  cursor: pointer;
}

.details-link:hover,
.details-link:focus-visible {
  text-decoration: underline;
  opacity: 1;
}

/* ── Site footer ── */
.site-footer {
  display: flex;
  align-items: center;
  gap: .7rem;
  font-size: .78rem;
  letter-spacing: .06em;
  text-transform: uppercase;
  opacity: .4;
  padding-bottom: .25rem;
  transition: opacity .2s;
}

.site-footer:hover { opacity: .65; }

.footer-link {
  color: var(--ink);
  text-decoration: none;
  border: 0;
  background: transparent;
  font: inherit;
  cursor: pointer;
  padding: 0;
  letter-spacing: inherit;
  text-transform: inherit;
}

.footer-link:hover,
.footer-link:focus-visible {
  text-decoration: underline;
}

/* ── About Modal ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(0,0,0,.38);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  cursor: pointer;
}

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

.modal {
  position: fixed;
  inset: 0;
  z-index: 101;
  display: grid;
  place-items: center;
  pointer-events: none;
}

.modal-body {
  pointer-events: all;
  background: #eeeeee;
  max-width: 460px;
  width: calc(100% - 3rem);
  padding: 3rem 2.5rem 2.5rem;
  text-align: center;
  position: relative;
  animation: modalIn .28s ease;
}

@keyframes modalIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.modal-logo {
  width: 90px;
  height: auto;
  display: block;
  margin: 0 auto 1.75rem;
}

.modal-text {
  font-size: 1rem;
  line-height: 1.65;
  margin: 0 0 .9rem;
  color: rgba(0,0,0,.75);
}

.modal-links {
  display: flex;
  gap: 1.5rem;
  justify-content: center;
  margin-top: 1.75rem;
  padding-top: 1.5rem;
  border-top: 1px solid rgba(0,0,0,.1);
}

.modal-link {
  color: var(--ink);
  font-size: .88rem;
  letter-spacing: .04em;
  text-transform: uppercase;
  text-decoration: none;
}

.modal-link:hover { text-decoration: underline; }

.modal-close {
  position: absolute;
  top: 1rem;
  right: 1.25rem;
  background: transparent;
  border: 0;
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  color: var(--ink);
  opacity: .35;
  font-family: inherit;
  padding: .25rem;
}

.modal-close:hover { opacity: .75; }

/* ── Lightbox ── */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(0,0,0,.93);
  display: grid;
  place-items: center;
  cursor: zoom-out;
  animation: fadeIn .2s ease;
}

.lightbox[hidden] { display: none; }

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.lightbox img {
  max-width: 92vw;
  max-height: 92vh;
  object-fit: contain;
  display: block;
  animation: scaleIn .25s ease;
  cursor: default;
}

@keyframes scaleIn {
  from { transform: scale(.96); opacity: 0; }
  to   { transform: scale(1);   opacity: 1; }
}

.lightbox-close {
  position: fixed;
  top: 1.25rem;
  right: 1.5rem;
  background: transparent;
  border: 0;
  color: rgba(255,255,255,.55);
  font-size: 2rem;
  line-height: 1;
  cursor: pointer;
  font-family: inherit;
  padding: .25rem;
  z-index: 201;
}

.lightbox-close:hover { color: #fff; }

/* ── Loader ── */
.loader {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  background: #eeeeee;
  opacity: 1;
  transition: opacity 1.2s ease, visibility 1.2s ease;
}

.loader img {
  width: clamp(160px, 22vw, 280px);
  height: auto;
}

.loader.is-hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

/* ── Mobile ── */
@media (max-width: 700px) {
  .bottom-stack { gap: 1rem; }

  .viewer {
    grid-template-columns: 44px 1fr 44px;
  }

  .art-button {
    width: min(82vw, 430px, 58svh);
    cursor: default;
  }

  .zoom-hint { display: none; }

  .brand img {
    width: clamp(110px, 34vw, 165px);
  }

  .nav {
    font-size: 4.5rem;
    width: 3.2rem;
    height: 5rem;
    color: rgba(0,0,0,.1);
  }

  .nav-prev { left: -0.35rem; }
  .nav-next { right: -0.35rem; }

  .caption h1 {
    margin-bottom: .5rem;
    font-size: 1.35rem;
    max-width: 88vw;
  }

  .caption-meta { gap: .5rem; }

  .details-link,
  .caption-price { font-size: 1rem; }

  .modal-body { padding: 2.5rem 1.75rem 2rem; }
}
