/* art-store — hand-built, square, no gimmicks */
:root {
  --ink: #141414;
  --paper: #ffffff;
  --muted: #6b6b6b;
  --hairline: 1px solid #141414;
  --fade: 8%;
}

* { box-sizing: border-box; border-radius: 0; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 14px; /* body text deliberately smaller than headings */
  line-height: 1.55;
}

img { -webkit-user-drag: none; }
a { color: var(--ink); }

/* ---------- header ---------- */
.site-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 18px 28px;
  border-bottom: var(--hairline);
}
.site-title { font-size: 20px; letter-spacing: 0.04em; }
.site-title a { text-decoration: none; }
.site-nav a {
  margin-left: 22px;
  text-decoration: none;
  font-size: 14px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border-bottom: 1px solid transparent;
}
.site-nav a:hover { border-bottom: 1px solid var(--ink); }

/* ---------- hero (fades down into the gallery; no overlap) ---------- */
.hero { line-height: 0; }
.hero-img {
  width: 100%;
  height: 56vh;
  min-height: 280px;
  object-fit: cover;
  display: block;
  mask-image: linear-gradient(180deg, #000 30%, rgba(0,0,0,0.82) 48%, rgba(0,0,0,0.58) 63%, rgba(0,0,0,0.34) 77%, rgba(0,0,0,0.14) 89%, transparent 100%);
  -webkit-mask-image: linear-gradient(180deg, #000 30%, rgba(0,0,0,0.82) 48%, rgba(0,0,0,0.58) 63%, rgba(0,0,0,0.34) 77%, rgba(0,0,0,0.14) 89%, transparent 100%);
}

/* ---------- gallery: 12:2 strip, edges fade, horizontal smooth scroll ---------- */
.gallery-section { margin: 0 0 30px; }
.gallery {
  width: min(1500px, 100%);
  /* image height = original (W/6 - 40px caption); + 96px of headroom above
     each painting so the caption reveal can lift it without clipping */
  height: calc(min(1500px, 100vw) / 6 + 56px);
  margin: 0 auto;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: thin;
  scrollbar-color: var(--ink) transparent;
  cursor: grab;
  mask-image: linear-gradient(90deg, transparent 0, #000 var(--fade), #000 calc(100% - var(--fade)), transparent 100%);
  -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 var(--fade), #000 calc(100% - var(--fade)), transparent 100%);
}
.gallery.dragging { cursor: grabbing; }
.gallery-track {
  display: flex;
  align-items: stretch;
  gap: 26px;
  height: 100%;
  width: max-content;
  padding: 0 var(--fade);
}
.g-item {
  height: 100%;
  margin: 0;
  display: flex;
  flex-direction: column;
  flex: 0 0 auto;
  position: relative; /* for the absolutely-positioned caption */
  min-width: 190px;
}
.g-imgbox {
  position: relative;
  height: calc(100% - 96px); /* 96px of headroom above; painting rests at the bottom */
  margin-top: auto;
  display: flex;
  transition: transform 0.3s ease;
}
/* caption folds out: the painting keeps its size and slides up into the
   headroom (never clipped), freeing its original slot for the caption */
.g-item.cap-open .g-imgbox { transform: translateY(-96px); }
.g-item img {
  display: block;
  height: 100%;
  width: auto;
  max-width: none;
  object-fit: contain;
}
.img-hold {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  background: var(--paper);
  border: var(--hairline);
  padding: 4px 12px;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  z-index: 4;
}

/* in-cart state: greyed, holds shown, buttons hidden */
.g-item.in-cart .g-imgbox img {
  filter: contrast(0.5) brightness(0.2) saturate(0.9);
  transition: filter 0.35s ease;
}
.g-item.in-cart .add-btn,
.g-item.in-cart .offer-btn { display: none; }

/* wrap-up-in-paper animation layer (built by gallery.js).
   The paper is a cross-shaped net: a base sheet exactly the painting's size
   plus a 15% overhang flap on each side. Each flap folds 90deg AROUND the
   painting's edge, away from the viewer — like the side of a box being
   folded in. Seen from the front it foreshortens (perspective does this
   naturally), darkens as it turns from the light, and disappears exactly
   when it is edge-on at the painting's edge. */
.wrap-layer {
  position: absolute;
  inset: 0; /* exactly the painting's bounds */
  pointer-events: none;
  z-index: 3;
  perspective: 900px;
}
.paper-sheet { position: absolute; inset: 0; background: #bda277; }
.paper-flap { position: absolute; }
.paper-flap.left { right: 100%; top: 0; bottom: 0; width: 15%; transform-origin: 100% 50%; }
.paper-flap.right { left: 100%; top: 0; bottom: 0; width: 15%; transform-origin: 0% 50%; }
.paper-flap.top { bottom: 100%; left: 0; right: 0; height: 15%; transform-origin: 50% 100%; }
.paper-flap.bottom { top: 100%; left: 0; right: 0; height: 15%; transform-origin: 50% 0%; }
.flap-front {
  position: absolute;
  inset: 0;
  background: #bda277;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}
/* darkens the flap as it turns from the light (opacity animated by JS);
   the right/bottom sides end darkest (light model: upper left) */
.flap-shade { position: absolute; inset: 0; background: #3a2c17; opacity: 0; }
/* the package core = the painting's own bounds */
.pkg-core { position: absolute; inset: 0; }
.wrap-twine { position: absolute; background: #6b4f2a; }
.wrap-twine.h { left: 0; right: 0; top: 50%; height: 3px; margin-top: -1px; transform-origin: left center; }
.wrap-twine.v { top: 0; bottom: 0; left: 50%; width: 3px; margin-left: -1px; transform-origin: center top; }
.wrap-knot {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 11px;
  height: 11px;
  margin: -5px 0 0 -5px;
  background: #6b4f2a;
}

/* the little package that flies to the cart link — identical to the wrapped
   package it replaces: plain kraft face, twine cross, knot */
.pkg-flyer {
  position: fixed;
  z-index: 80;
  pointer-events: none;
  background: #bda277;
}

/* cart count ping target */
#cart-count { display: inline-block; }

/* ---------- offer modal ---------- */
.offer-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 70;
}
.offer-modal[hidden] { display: none; }
.offer-panel {
  background: var(--paper);
  border: var(--hairline);
  padding: 22px;
  width: min(440px, 92vw);
  max-height: 88vh;
  overflow-y: auto;
}
.offer-piece { color: var(--muted); margin: 0 0 14px; }
.offer-actions { display: flex; gap: 12px; margin-top: 6px; }
.g-item figcaption {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 96px;
  padding-top: 7px;
  display: flex;
  flex-wrap: wrap;
  align-content: flex-start;
  align-items: center;
  gap: 5px 10px;
  font-size: 13px;
  background: var(--paper);
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  transition: transform 0.3s ease, opacity 0.3s ease, visibility 0s linear 0.3s;
}
.g-item.cap-open figcaption {
  opacity: 1;
  visibility: visible;
  transform: none;
  transition: transform 0.3s ease, opacity 0.3s ease, visibility 0s;
}
.g-title {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.g-price { color: var(--muted); flex: none; }
/* buttons stack full-width, one per row, shorter than standard buttons */
.g-item figcaption .btn {
  flex: 0 0 100%;
  padding: 3px 14px;
}
.g-item figcaption .badge { flex: none; }

/* ---------- buttons & badges ---------- */
.btn {
  font: inherit;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: var(--paper);
  color: var(--ink);
  border: var(--hairline);
  padding: 8px 14px;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
}
.btn:hover { background: var(--ink); color: var(--paper); }
.btn-primary { padding: 12px 22px; font-size: 13px; }
.btn:disabled { opacity: 0.45; cursor: default; }
.btn:disabled:hover { background: var(--paper); color: var(--ink); }

.badge {
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  border: 1px solid #9a9a9a;
  padding: 2px 7px;
}

/* ---------- blurbs with side paintings ---------- */
.blurbs { max-width: 1240px; margin: 90px auto; padding: 0 28px; }
.blurb-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 48px;
  align-items: center;
  margin-bottom: 72px;
}
.blurb-row:last-child { margin-bottom: 0; }
.blurb-text { font-size: 18px; line-height: 1.75; white-space: pre-line; }
.blurb-img img { width: 100%; display: block; }
/* fade end must face the neighbouring text, not the page edge;
   multi-stop ease curve (starts earlier, no hard "knee") for a soft blend */
.fade-right img {
  mask-image: linear-gradient(270deg, #000 30%, rgba(0,0,0,0.82) 48%, rgba(0,0,0,0.58) 63%, rgba(0,0,0,0.34) 77%, rgba(0,0,0,0.14) 89%, transparent 100%);
  -webkit-mask-image: linear-gradient(270deg, #000 30%, rgba(0,0,0,0.82) 48%, rgba(0,0,0,0.58) 63%, rgba(0,0,0,0.34) 77%, rgba(0,0,0,0.14) 89%, transparent 100%);
}
.fade-left img {
  mask-image: linear-gradient(90deg, #000 30%, rgba(0,0,0,0.82) 48%, rgba(0,0,0,0.58) 63%, rgba(0,0,0,0.34) 77%, rgba(0,0,0,0.14) 89%, transparent 100%);
  -webkit-mask-image: linear-gradient(90deg, #000 30%, rgba(0,0,0,0.82) 48%, rgba(0,0,0,0.58) 63%, rgba(0,0,0,0.34) 77%, rgba(0,0,0,0.14) 89%, transparent 100%);
}

/* ---------- photography wall ---------- */
.photography { max-width: 1400px; margin: 90px auto 0; padding: 0 28px; }
.section-title {
  font-weight: normal;
  font-size: 26px;
  letter-spacing: 0.04em;
  border-bottom: var(--hairline);
  padding-bottom: 10px;
}
.photo-wall { columns: 4 240px; column-gap: 14px; margin-top: 24px; }
.photo-cell {
  display: block;
  width: 100%;
  border: 0;
  padding: 0;
  margin: 0 0 14px;
  background: none;
  cursor: pointer;
  break-inside: avoid;
}
.photo-cell img { width: 100%; display: block; }

/* ---------- lightbox ---------- */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.93);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  z-index: 60;
  opacity: 0;
  transition: opacity 0.25s ease;
}
.lightbox.open { opacity: 1; }
.lightbox img { max-width: 92vw; max-height: 80vh; }
.lightbox-caption { color: #eee; text-align: center; }
.lb-name { font-size: 17px; }
.lb-date { font-size: 13px; color: #bbb; margin-top: 4px; }

/* ---------- checkout / order ---------- */
.checkout { max-width: 680px; margin: 44px auto 80px; padding: 0 20px; }
.page-title { font-weight: normal; font-size: 26px; border-bottom: var(--hairline); padding-bottom: 10px; }
.panel { border: var(--hairline); padding: 22px; margin-bottom: 22px; }
.panel-title { font-size: 17px; font-weight: normal; margin: 0 0 12px; }
.panel-note { font-size: 14px; color: var(--muted); }
.choice-row { display: flex; gap: 14px; flex-wrap: wrap; }
.choice { padding: 14px 18px; }

label { display: block; margin-bottom: 12px; font-size: 14px; }
input[type="text"], input[type="email"], input[type="password"], input[type="number"], input[type="date"], select, textarea {
  width: 100%;
  padding: 9px 10px;
  border: var(--hairline);
  font: inherit;
  font-size: 15px;
  background: var(--paper);
  color: var(--ink);
  margin-top: 4px;
}
input:focus, select:focus, textarea:focus { outline: 1px solid var(--ink); outline-offset: 0; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.checkbox { display: flex; gap: 10px; align-items: flex-start; font-size: 13px; line-height: 1.5; }
.checkbox input { width: auto; margin-top: 3px; }

.summary { border-top: var(--hairline); margin-top: 18px; padding-top: 12px; }
.summary-line { display: flex; justify-content: space-between; gap: 20px; font-size: 14px; padding: 3px 0; }
.summary-total { font-size: 17px; border-top: var(--hairline); margin-top: 8px; padding-top: 8px; }
.summary-items .summary-line span:first-child { overflow: hidden; text-overflow: ellipsis; }

.pay-box { border: var(--hairline); padding: 16px; margin: 14px 0; }
.pay-address { font-family: 'Courier New', monospace; word-break: break-all; border: var(--hairline); padding: 10px; }
.pay-qr { display: block; margin: 12px 0; }

.error-note { color: #8a1f11; font-size: 14px; }
.empty-note { color: var(--muted); padding: 30px 0; text-align: center; }

/* ---------- footer ---------- */
.site-footer { border-top: var(--hairline); margin-top: 90px; padding: 26px 28px; }
.footer-inner { display: flex; gap: 22px; font-size: 14px; flex-wrap: wrap; }
.footer-email { text-decoration: none; border-bottom: 1px solid transparent; }
.footer-email:hover { border-bottom: 1px solid var(--ink); }

/* ---------- scroll-in reveal (the only motion) ---------- */
.reveal { opacity: 0; transform: translateY(10px); transition: opacity 0.7s ease, transform 0.7s ease; }
.reveal.revealed { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
  html { scroll-behavior: auto; }
  .g-imgbox, .g-item figcaption { transition: none; }
}

@media (max-width: 760px) {
  .blurb-row { grid-template-columns: 1fr; }
  .gallery { height: 276px; } /* 180px image + 96px headroom */
  .field-row { grid-template-columns: 1fr; }
}
