/* Mona Barbu Art — Gallery landing page
   Brand: EB Garamond (display/serif) + DM Sans (body/sans)
   Palette derived from monabarbu.com — see BRANDING_KIT.md
   Single-screen hero: background painting + three collection collages,
   each opening a full-screen gallery popup for that collection. */

:root {
  --bg: #fcfcfc;
  --surface: #f5f1eb;
  --ink: #242424;
  --ink-body: rgba(36, 36, 36, 0.75);
  --ink-muted: rgba(36, 36, 36, 0.5);
  --accent: #f04664;
  --dark: #444444;
  --cream: #f5f1eb;
  --max: 1180px;
}

* { box-sizing: border-box; }
html { background: #0c0b0c; }

body {
  margin: 0;
  color: var(--ink-body);
  font-family: "DM Sans", -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

h1, h2, h3, .serif {
  font-family: "EB Garamond", Georgia, serif;
  font-weight: 400;
  color: var(--ink);
  margin: 0;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button { font: inherit; }

/* Discourage casual saving of the paintings (right-click / drag / long-press).
   Not bulletproof — a screenshot or devtools can still get the pixels, and
   that's fine — this just removes the one-click "Save image as" affordance.
   pointer-events:none on the <img> lets clicks fall through to its clickable
   parent (.artwork, .collage, .hero) rather than blocking them. */
.hero-bg, .collage img, .artwork img, .lightbox img {
  pointer-events: none;
  -webkit-user-drag: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

/* Header — logo (links to monabarbu.com) centered; "THE GALLERY" label to its
   left. Both fixed so they stay on screen and clickable at any scroll depth. */
.site-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 40;
  padding-top: 26px;
  pointer-events: none;
}
.header-row {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 32px;
}
.gallery-label {
  grid-column: 1;
  justify-self: start;
  pointer-events: auto;
  font-family: "EB Garamond", serif;
  font-weight: 600;
  font-size: clamp(13px, 2vw, 24px);
  line-height: 1.15;
  letter-spacing: 0.05em;
  color: var(--accent);
  max-width: 100%;
}
.brand {
  grid-column: 2;
  justify-self: center;
  pointer-events: auto;
  display: inline-block;
}
.logo-img {
  height: 54px;
  width: auto;
  filter: drop-shadow(0 2px 10px rgba(0, 0, 0, 0.45)) drop-shadow(0 0 22px rgba(0, 0, 0, 0.2));
  transition: opacity 0.2s ease;
}
.brand:hover .logo-img { opacity: 0.85; }

/* Where to buy the originals — partner-platform wordmarks, top right */
.buy-links {
  grid-column: 3;
  justify-self: end;
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 18px;
  filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.45));
}
.buy-label {
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(245, 241, 235, 0.7);
  white-space: nowrap;
}
.buy-logo { width: auto; opacity: 0.92; transition: opacity 0.2s ease; }
.buy-logo-cohart { height: 17px; }
.buy-logo-singulart { height: 22px; }
.buy-links a:hover .buy-logo { opacity: 1; }

/* Hero — full-bleed painting, three collage panels laid parallel on top
   (slightly unaligned at the top), copyright line at the bottom. This is
   the entire page; each collage opens that collection in a full-screen popup. */
.hero {
  position: relative;
  height: 100vh;
  min-height: 560px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fcfcfc;
}
.hero-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 40%;
  opacity: 0.4;
}
.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(10, 9, 10, 0.55) 0%, rgba(10, 9, 10, 0.25) 20%, rgba(10, 9, 10, 0.25) 75%, rgba(10, 9, 10, 0.5) 100%);
}

.hero-collages {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: clamp(10px, 2vw, 22px);
  width: 100%;
  max-width: 1280px;
  padding: 0 28px;
  margin-top: 64px;
}
.collage {
  flex: 1 1 0;
  max-width: 360px;
  box-shadow: 0 30px 60px -20px rgba(0, 0, 0, 0.5);
  transition: transform 0.4s ease, box-shadow 0.4s ease;
}
.collage img {
  width: 100%;
  max-height: 66vh;
  height: auto;
  object-fit: contain;
  display: block;
}
.collage:hover { transform: translateY(-6px); box-shadow: 0 40px 80px -18px rgba(0, 0, 0, 0.6); }
.collage:nth-child(1) { margin-top: 0; }
.collage:nth-child(2) { margin-top: 16px; }
.collage:nth-child(3) { margin-top: 6px; }

.hero-copyright {
  position: absolute;
  left: 0; right: 0; bottom: 26px;
  z-index: 2;
  text-align: center;
  font-size: 12px;
  letter-spacing: 0.04em;
  color: rgba(238, 236, 233, 0.62);
}

/* Collection popups — one per collection, opened by clicking its collage */
.collection-modal {
  position: fixed;
  inset: 0;
  z-index: 90;
  background: rgba(12, 11, 12, 0.97);
  display: none;
  flex-direction: column;
}
.collection-modal.open { display: flex; }

.modal-head {
  flex: 0 0 auto;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 24px 30px 8px;
}
.modal-title {
  font-family: "EB Garamond", serif;
  font-size: clamp(22px, 3vw, 30px);
  color: var(--cream);
}
.modal-title .count {
  font-family: "DM Sans", sans-serif;
  font-size: 11.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(245, 241, 235, 0.5);
  margin-left: 14px;
}
.modal-close {
  background: none;
  border: none;
  color: var(--cream);
  font-size: 30px;
  line-height: 1;
  cursor: pointer;
  padding: 4px 6px;
}
.modal-close:hover { color: var(--accent); }

/* Each collection gets its own soft, pastel mat color, picked from an
   analysis of that collection's own paintings — see BRANDING_KIT.md.
   Mat/gap size (--frame-pad) is also tuned per collection — Beginning has
   enough pieces to read well with a generous mat; Elements and Permission
   to Play have fewer, larger pieces, so a slimmer mat keeps the paintings
   themselves dominant. Keep js/main.js's SIZE_CONFIG in sync with these. */
#modal-beginning { --frame-bg: #e5eef0; --frame-pad: 9px; }
#modal-elements { --frame-bg: #ecefe7; --frame-pad: 5px; }
#modal-permission-to-play { --frame-bg: #f1e9e4; --frame-pad: 5px; }

/* Landscape / computer: paintings are laid out by JS (see js/main.js,
   layoutJustified) into a "tangram" of rows sized so the whole collection
   tiles together into one landscape rectangle, each piece keeping its own
   aspect ratio — no captions, hover blooms a piece into the featured item. */
.modal-body {
  flex: 1 1 auto;
  min-height: 0;
  position: relative;
  overflow: visible;
  padding: 10px 30px 30px;
}
.modal-body figcaption { display: none; }

.artwork {
  position: absolute;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  margin: 0;
}
.artwork:hover { z-index: 30; }

.artwork .frame {
  width: 100%;
  height: 100%;
  box-sizing: border-box;
  background: var(--frame-bg, #ffffff);
  padding: var(--frame-pad, 9px);
  box-shadow: 0 14px 30px -12px rgba(0, 0, 0, 0.4);
  transform-origin: var(--ox, 50%) var(--oy, 50%);
  transition: transform 0.45s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.45s ease;
}
.artwork:hover .frame {
  transform: scale(var(--safe-scale, 1.5));
  box-shadow: 0 40px 80px -18px rgba(0, 0, 0, 0.55);
}
.artwork img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}
.artwork .title {
  font-family: "EB Garamond", serif;
  font-size: 16px;
  color: var(--cream);
}
.artwork .year {
  font-size: 11px;
  color: rgba(245, 241, 235, 0.55);
  white-space: nowrap;
}

/* Phone / tablet portrait: one painting at a time, scrolling vertically.
   Gated on width too, so a merely-narrow desktop window still gets the grid. */
@media (orientation: portrait) and (max-width: 900px) {
  .modal-body {
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: y mandatory;
    gap: 0;
    padding: 0;
  }
  .modal-body figcaption {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 16px;
  }
  .artwork {
    position: relative;
    left: auto;
    top: auto;
    width: 100%;
    height: auto;
    min-height: 100%;
    flex: 0 0 auto;
    flex-direction: column;
    scroll-snap-align: center;
    padding: 56px 26px;
  }
  .artwork .frame { width: 88vw; height: 62vh; }
  .artwork:hover .frame { transform: none; box-shadow: 0 14px 30px -12px rgba(0, 0, 0, 0.4); }
}

/* Full single-image lightbox — reached by clicking a painting inside a popup */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(8, 7, 8, 0.96);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.lightbox.open { display: flex; }
.lightbox figure {
  margin: 0;
  max-width: 1100px;
  width: 100%;
  text-align: center;
}
.lightbox img {
  max-height: 78vh;
  width: auto;
  max-width: 100%;
  margin: 0 auto;
  box-shadow: 0 30px 80px rgba(0,0,0,0.5);
}
.lightbox figcaption {
  color: #f2eee8;
  margin-top: 18px;
  font-family: "EB Garamond", serif;
  font-size: 20px;
}
.lightbox figcaption .lb-collection {
  display: block;
  font-family: "DM Sans", sans-serif;
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  margin-top: 6px;
}
.lb-close, .lb-prev, .lb-next {
  position: absolute;
  background: none;
  border: none;
  color: #f2eee8;
  cursor: pointer;
  font-family: "DM Sans", sans-serif;
}
.lb-close { top: 22px; right: 28px; font-size: 28px; line-height: 1; }
.lb-prev, .lb-next { top: 50%; transform: translateY(-50%); font-size: 34px; padding: 12px; opacity: 0.7; }
.lb-prev:hover, .lb-next:hover, .lb-close:hover { opacity: 1; color: var(--accent); }
.lb-prev { left: 8px; }
.lb-next { right: 8px; }

@media (max-width: 720px) {
  .hero-collages { margin-top: 56px; gap: 8px; }
  .collage:nth-child(1) { margin-top: 0; }
  .collage:nth-child(2) { margin-top: 10px; }
  .collage:nth-child(3) { margin-top: 4px; }
  .modal-head { padding: 20px 20px 6px; }
  .lb-prev, .lb-next { font-size: 26px; padding: 8px; }
}

@media (max-width: 720px) {
  .buy-label { display: none; }
  .buy-links { gap: 12px; }
  .buy-logo-cohart { height: 13px; }
  .buy-logo-singulart { height: 17px; }
}

@media (max-width: 480px) {
  .header-row { padding: 0 16px; column-gap: 8px; }
  .logo-img { height: 44px; }
  .buy-links { gap: 8px; }
  .buy-logo-cohart { height: 11px; }
  .buy-logo-singulart { height: 14px; }
}
