/* Collected Space — Gallery (products) page.
   Same visual language as the home page: white gallery wall, warm walnut accents,
   minimal editorial typography. Styles the class names emitted by products.js /
   checkout.js so those modules stay untouched. */

:root {
  --wood-hi: #8a5a37;
  --wood: #6d4526;
  --wood-lo: #4a2d18;
  --cream: #d8cdb2;
  --ink: #1a1512;
  --muted: #8a7f6c;
  --line: #e6e1d6;
  --amber: #c07a2e;
  --err: #b0402e;
  --ok: #4a7a45;
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0; min-height: 100%;
  background: #fcfcfb;
  color: var(--ink);
  font-family: "Helvetica Neue", Helvetica, Arial, system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }

/* ---- Nav: identical to the home page ---- */
.nav {
  position: sticky; top: 0; z-index: 30;
  background: rgba(252,252,251,0.9); backdrop-filter: blur(8px);
  display: flex; align-items: center; justify-content: space-between;
  padding: 26px 48px;
  font-size: 13px; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase;
}
.nav a { text-decoration: none; opacity: 0.9; transition: opacity .18s; }
.nav a:hover { opacity: 1; }
.nav .brand, .nav .right a { font-size: 18px; letter-spacing: 0.16em; }
.nav .center { font-weight: 700; }
.nav .right { display: flex; align-items: center; gap: 28px; }
.cart-toggle { position: relative; }
.cart-count {
  position: absolute; top: -10px; right: -16px;
  background: var(--wood); color: #fff; border-radius: 999px;
  font-size: 10px; min-width: 17px; height: 17px; line-height: 17px; text-align: center; padding: 0 5px;
}

/* ---- Layout ---- */
.wrap { max-width: 1200px; margin: 0 auto; padding: 0 48px; }
.section-title {
  font-size: 12px; letter-spacing: 0.28em; text-transform: uppercase; color: var(--muted);
  margin: 54px 0 26px; font-weight: 600;
}

/* =========================================================================
   VINTAGE PROJECTOR — the products are projected onto a screen, ~5s each,
   with early-1900s film effects (grain, flicker, gate weave, warm light,
   dust/scratches, vignette). Same white-gallery aesthetic as the home page.
   ========================================================================= */

.projector-stage {
  position: relative;
  min-height: calc(100vh - 74px);       /* fill the viewport below the nav */
  display: flex;
  align-items: center; justify-content: center;
  /* extra left padding reserves room for the projector so it isn't clipped */
  padding: 40px 24px 80px;
  padding-left: clamp(24px, 22vw, 340px);
  overflow: hidden;
}

/* --- The projection screen (where products appear) --- */
.screen-unit {
  position: relative;
  width: min(60vw, 820px, 132vh);
  aspect-ratio: 4 / 3;
  z-index: 1;                            /* sits BEHIND the projector's beam, beside the unit */
}
/* tripod-style stand + hanging screen frame */
.screen-frame {
  position: absolute; inset: 0;
  background: #ece7da;                    /* matte projection cloth */
  border: 10px solid #241a12;            /* dark screen border */
  border-radius: 2px;
  box-shadow:
    0 30px 70px rgba(40,25,12,0.28),
    0 8px 20px rgba(40,25,12,0.18),
    inset 0 0 60px rgba(120,90,50,0.15);
  overflow: hidden;
}

/* the projected picture area */
.proj-viewport {
  position: absolute; inset: 0;
  overflow: hidden;
  background: #e7ddc8;
}

/* two stacked layers so we can crossfade between products with a flash */
.proj-img {
  position: absolute; inset: 0;
  background-size: contain;              /* show full product, projected */
  background-position: center;
  background-repeat: no-repeat;
  opacity: 0;
  transition: opacity 320ms ease;
  /* sepia/aged film grade + slight bloom */
  filter: sepia(0.42) contrast(1.05) brightness(1.06) saturate(0.85);
  transform: translate3d(0,0,0);
}
.proj-img.show { opacity: 1; }

/* warm projector light wash + vignette over the picture */
.proj-light {
  position: absolute; inset: 0; z-index: 3; pointer-events: none;
  background:
    radial-gradient(60% 55% at 50% 45%, rgba(255,240,205,0.22) 0%, transparent 60%),
    radial-gradient(120% 120% at 50% 50%, transparent 55%, rgba(30,18,6,0.5) 100%);
  mix-blend-mode: multiply;
}

/* film grain */
.proj-grain {
  position: absolute; inset: -20%; z-index: 4; pointer-events: none;
  background-image: url("/img/crt-noise.svg");
  background-size: 200px 200px;
  opacity: 0.14;
  animation: grainMove 0.5s steps(3) infinite;
  mix-blend-mode: overlay;
}
@keyframes grainMove {
  0%{transform:translate(0,0)}33%{transform:translate(-8px,5px)}66%{transform:translate(6px,-7px)}100%{transform:translate(-4px,3px)}
}

/* occasional vertical scratches + dust */
.proj-scratches {
  position: absolute; inset: 0; z-index: 4; pointer-events: none;
  background:
    linear-gradient(90deg, transparent 22%, rgba(255,255,255,0.06) 22.3%, transparent 22.6%),
    linear-gradient(90deg, transparent 61%, rgba(0,0,0,0.05) 61.2%, transparent 61.5%),
    linear-gradient(90deg, transparent 78%, rgba(255,255,255,0.05) 78.2%, transparent 78.5%);
  animation: scratchShift 3.5s steps(1) infinite;
  opacity: 0.6;
}
@keyframes scratchShift {
  0%,100% { transform: translateX(0); opacity: 0.5; }
  40% { transform: translateX(4px); opacity: 0.8; }
  70% { transform: translateX(-3px); opacity: 0.3; }
}

/* projector flicker (brightness pulse) + gate weave (tiny jitter) on the whole viewport */
.proj-viewport {
  animation: projFlicker 0.28s steps(1) infinite, gateWeave 0.9s ease-in-out infinite;
}
@keyframes projFlicker {
  0%{filter:brightness(1.0)} 30%{filter:brightness(0.92)} 55%{filter:brightness(1.05)}
  70%{filter:brightness(0.88)} 100%{filter:brightness(1.0)}
}
@keyframes gateWeave {
  0%{transform:translate(0,0)} 25%{transform:translate(0.4px,-0.6px)}
  50%{transform:translate(-0.5px,0.5px)} 75%{transform:translate(0.3px,0.4px)} 100%{transform:translate(0,0)}
}

/* projected product caption (aged title card look) */
.proj-caption {
  position: absolute; left: 0; right: 0; bottom: 6%; z-index: 5; text-align: center;
  color: #3a2b18; pointer-events: none;
  font-family: "Courier New", monospace;
  text-shadow: 0 1px 0 rgba(255,245,220,0.5);
  opacity: 0; transition: opacity .4s;
}
.proj-caption.show { opacity: 0.92; }
.proj-caption .pc-name { font-size: clamp(14px, 2.4vw, 26px); letter-spacing: 0.14em; }
.proj-caption .pc-price { font-size: clamp(11px, 1.6vw, 16px); letter-spacing: 0.2em; margin-top: 4px; }

/* click hint */
.proj-hint {
  position: absolute; top: 5%; right: 5%; z-index: 5;
  font-family: "Courier New", monospace; font-size: 11px; letter-spacing: 0.18em;
  color: rgba(58,43,24,0.6); pointer-events: none; text-transform: uppercase;
}

/* the whole screen is clickable to open product detail */
.screen-unit.clickable .screen-frame { cursor: pointer; }

/* --- The real vintage projector, standing beside the screen, casting the beam --- */
.projector-unit {
  position: absolute; z-index: 3;                 /* in front of the screen */
  left: 2vw; top: 50%; transform: translateY(-50%);
  width: min(320px, 27vw);
  pointer-events: none;
}
.projector-img {
  width: 100%; height: auto; display: block;
  /* grounded shadow + a faint warm rim so it sits in the gallery light */
  filter: drop-shadow(0 26px 26px rgba(30,18,8,0.32));
  animation: projShudder 0.28s steps(1) infinite;  /* tiny motor shudder */
}
@keyframes projShudder {
  0%{transform:translate(0,0)} 33%{transform:translate(0.4px,-0.3px)}
  66%{transform:translate(-0.3px,0.4px)} 100%{transform:translate(0,0)}
}

/* the light beam from the lens to the screen. The TEATRE projector's lens sits at the
   lower-front of the body (~68% across, ~72% down the sprite), aimed right. */
.proj-beam {
  position: absolute; z-index: 2; pointer-events: none;
  /* start at the lens (lower-front of the projector) and fan up-right to the screen */
  left: calc(2vw + min(320px, 27vw) * 0.62);
  top: 46%;
  width: 46vw; height: 46vh;
  /* A warm cone of light. Normal blend + blur so it's clearly visible on the white wall. */
  background: linear-gradient(88deg,
    rgba(255,232,180,0.70) 0%,
    rgba(255,236,192,0.42) 26%,
    rgba(255,240,205,0.20) 58%,
    rgba(255,240,205,0.0) 86%);
  /* narrow at the lens, widening as it reaches the screen */
  clip-path: polygon(0 48%, 0 52%, 100% 96%, 100% 4%);
  filter: blur(7px);
  animation: beamFlicker 0.32s steps(1) infinite;
}
@keyframes beamFlicker { 0%{opacity:1} 45%{opacity:.78} 70%{opacity:1} 100%{opacity:.88} }

/* prev/next centered directly under the projection screen */
.proj-controls {
  position: absolute; z-index: 5;
  top: 100%; left: 50%; transform: translateX(-50%);
  margin-top: 18px;
  display: flex; gap: 14px;
}
.proj-controls .btn { padding: 10px 18px; font-size: 14px; }

/* =========================================================================
   MOBILE / NARROW: the side-by-side layout doesn't fit a phone, so switch to a
   vertical installation — projector on top, beam pointing DOWN into the screen
   below it. Both the projector and screen stay fully visible and responsive.
   ========================================================================= */
@media (max-width: 820px) {
  .projector-stage {
    flex-direction: column;
    justify-content: flex-start;
    gap: 2vh;
    padding: 24px 16px 64px;
    padding-left: 16px;                 /* no side reservation in stacked mode */
    min-height: calc(100dvh - 64px);
  }

  /* projector sits on top, centered, in normal flow */
  .projector-unit {
    position: relative; z-index: 3;
    left: auto; top: auto; transform: none;
    width: min(180px, 44vw);
    margin: 0 auto;
  }

  /* screen sits below, taking the width */
  .screen-unit {
    width: min(92vw, 620px);
    margin: 0 auto;
  }

  /* beam now fans DOWNWARD from the projector's lens into the screen */
  .proj-beam {
    left: 50%;
    top: min(180px, 44vw);              /* just under the projector */
    transform: translateX(-50%);
    width: 60vw; height: 12vh;
    background: linear-gradient(180deg,
      rgba(255,232,180,0.65) 0%,
      rgba(255,238,198,0.30) 45%,
      rgba(255,240,205,0.0) 100%);
    clip-path: polygon(42% 0, 58% 0, 100% 100%, 0 100%);  /* narrow top -> wide bottom */
    filter: blur(6px);
  }

  /* controls sit just below the screen (the frame is absolute, so anchor to top:100%) */
  .proj-controls {
    position: absolute; z-index: 5;
    top: 100%; left: 50%; transform: translateX(-50%);
    margin-top: 14px;
    justify-content: center;
  }

  .proj-hint { font-size: 9px; top: 4%; right: 4%; }
}

/* very small phones: shrink the projector a touch more */
@media (max-width: 420px) {
  .projector-unit { width: 46vw; }
  .proj-beam { top: 46vw; }
  .screen-unit { width: 94vw; }
}
@media (prefers-reduced-motion: reduce) {
  .proj-grain, .proj-scratches, .proj-viewport, .projector-img, .proj-beam { animation: none; }
  .proj-viewport { filter: none; }
  .projector-img { transform: none; }
}

/* ---- Product grid (kept for reference; no longer used on the gallery page) ---- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 34px; padding-bottom: 90px; }
.product-card { cursor: pointer; background: transparent; }
.product-card .thumb {
  aspect-ratio: 3 / 4; overflow: hidden; background: #f1eee7;
  border: 1px solid var(--line); transition: border-color .2s;
}
.product-card:hover .thumb { border-color: var(--wood); }
.product-card .thumb img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .4s ease; }
.product-card:hover .thumb img { transform: scale(1.03); }
.product-card .meta { padding: 14px 2px 0; }
.product-card .name { font-size: 14px; letter-spacing: 0.04em; }
.product-card .price { color: var(--muted); font-size: 13px; margin-top: 5px; }
.empty { color: var(--muted); font-size: 14px; padding: 40px 0; }

/* ---- Product detail modal ---- */
.modal-scrim {
  position: fixed; inset: 0; background: rgba(30,20,12,0.45); backdrop-filter: blur(3px);
  display: none; align-items: center; justify-content: center; z-index: 60; padding: 24px;
}
.modal-scrim.open { display: flex; }
.modal {
  background: #fcfcfb; border: 1px solid var(--line); max-width: 940px; width: 100%;
  max-height: 90vh; overflow: auto; display: grid; grid-template-columns: 1fr 1fr;
  box-shadow: 0 40px 90px rgba(60,40,20,0.25);
}
@media (max-width: 740px) { .modal { grid-template-columns: 1fr; } }
.modal .images { background: #f1eee7; }
.modal .images img { width: 100%; display: block; }
.modal .details { padding: 40px; }
.modal .details h2 { margin: 0 0 8px; font-size: 22px; letter-spacing: 0.02em; font-weight: 600; }
.modal .details .price { color: var(--muted); margin-bottom: 22px; font-size: 15px; }
.modal .details p.desc { color: #4a4136; font-size: 14px; line-height: 1.7; }

.variant-row { margin: 22px 0; }
.variant-row label { display: block; font-size: 11px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--muted); margin-bottom: 10px; }
.variants { display: flex; flex-wrap: wrap; gap: 9px; }
.variant {
  border: 1px solid var(--line); background: #fff; color: var(--ink);
  padding: 9px 15px; font-size: 13px; cursor: pointer; transition: all .15s;
}
.variant:hover { border-color: var(--wood); }
.variant.active { background: var(--wood); color: #fff; border-color: var(--wood); }
.variant.oos { opacity: 0.35; cursor: not-allowed; text-decoration: line-through; }
.avail { font-size: 12px; color: var(--muted); margin-top: 10px; min-height: 16px; }

.qty { display: inline-flex; align-items: center; border: 1px solid var(--line); }
.qty button { background: #fff; color: var(--ink); border: none; width: 36px; height: 36px; cursor: pointer; font-size: 16px; }
.qty button:hover { background: #f1eee7; }
.qty input { width: 46px; height: 36px; text-align: center; background: #fff; color: var(--ink); border: none; border-left: 1px solid var(--line); border-right: 1px solid var(--line); }

/* ---- Buttons ---- */
.btn {
  display: inline-block; background: var(--wood); color: #fff; border: none;
  padding: 14px 22px; font-size: 12px; letter-spacing: 0.16em; text-transform: uppercase;
  cursor: pointer; text-decoration: none; transition: background .15s;
}
.btn:hover { background: var(--wood-lo); }
.btn.ghost { background: transparent; color: var(--ink); border: 1px solid var(--line); }
.btn.ghost:hover { border-color: var(--wood); background: transparent; }
.btn[disabled] { opacity: 0.4; cursor: not-allowed; }
.btn.block { display: block; width: 100%; text-align: center; }

/* ---- Cart drawer ---- */
.drawer-scrim { position: fixed; inset: 0; background: rgba(30,20,12,0.4); display: none; z-index: 70; }
.drawer-scrim.open { display: block; }
.drawer {
  position: fixed; top: 0; right: 0; height: 100%; width: 400px; max-width: 92vw;
  background: #fcfcfb; border-left: 1px solid var(--line); z-index: 71;
  transform: translateX(100%); transition: transform .22s ease; display: flex; flex-direction: column;
  box-shadow: -20px 0 60px rgba(60,40,20,0.15);
}
.drawer.open { transform: translateX(0); }
.drawer header { padding: 22px 24px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; }
.drawer .items { flex: 1; overflow: auto; padding: 12px 24px; }
.cart-line { display: flex; gap: 14px; padding: 16px 0; border-bottom: 1px solid var(--line); }
.cart-line .ci-thumb { width: 60px; height: 76px; background: #f1eee7; object-fit: cover; flex: 0 0 auto; }
.cart-line .ci-meta { flex: 1; font-size: 13px; }
.cart-line .ci-meta .sub { color: var(--muted); font-size: 12px; margin-top: 3px; }
.cart-line .ci-remove { color: var(--muted); cursor: pointer; font-size: 11px; text-transform: uppercase; letter-spacing: .1em; margin-top: 8px; }
.cart-line .ci-remove:hover { color: var(--err); }
.drawer footer { padding: 22px 24px; border-top: 1px solid var(--line); }
.totline { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 8px; color: var(--muted); }
.totline.total { color: var(--ink); font-size: 15px; margin: 12px 0 18px; }
.close { cursor: pointer; color: var(--muted); font-size: 16px; }
.close:hover { color: var(--ink); }

/* ---- Checkout form ---- */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin: 22px 0; }
.form-grid .full { grid-column: 1 / -1; }
.field label { display: block; font-size: 11px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--muted); margin-bottom: 7px; }
.field input, .field select {
  width: 100%; background: #fff; border: 1px solid var(--line); color: var(--ink);
  padding: 11px 13px; font-size: 14px;
}
.field input:focus, .field select:focus { outline: none; border-color: var(--wood); }

/* ---- Notices / messages ---- */
.notice { padding: 12px 15px; border: 1px solid var(--line); font-size: 13px; margin: 14px 0; }
.notice.err { border-color: var(--err); color: var(--err); }
.notice.ok { border-color: var(--ok); color: var(--ok); }
.hidden { display: none !important; }

/* ---- Order status page ---- */
.center-narrow { max-width: 600px; margin: 60px auto; }
.status-badge {
  display: inline-block; padding: 7px 14px; border: 1px solid var(--line);
  font-size: 12px; letter-spacing: 0.16em; text-transform: uppercase;
}
.status-badge.paid, .status-badge.shipped { border-color: var(--ok); color: var(--ok); }
.status-badge.awaiting_payment, .status-badge.confirming,
.status-badge.partially_paid, .status-badge.manual_review { border-color: var(--amber); color: var(--amber); }
.status-badge.failed, .status-badge.expired, .status-badge.cancelled { border-color: var(--err); color: var(--err); }

/* ---- Footer ---- */
footer.site { border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; padding: 32px 0; margin-top: 40px; letter-spacing: 0.06em; }
.wrap.center-narrow { padding: 0 24px; }

@media (max-width: 680px) {
  .nav { padding: 16px; }
  .nav .center { display: none; }
  .nav .brand, .nav .right a { font-size: 15px; }
  .wrap { padding: 0 20px; }
}

/* ---- Payment method chooser (checkout modal) ----
   Only rendered when more than one provider is enabled. Uses the same warm wood/cream
   tokens as the rest of the shop so it reads as part of the form, not a bolted-on widget. */
.pay-methods { margin: 22px 0 18px; }
.pay-methods-title {
  font-size: 11px; letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--muted); margin-bottom: 10px;
}
.pay-option {
  display: flex; align-items: center; gap: 12px;
  border: 1px solid var(--line); padding: 14px 16px; margin-bottom: 8px;
  cursor: pointer; transition: border-color .15s, background .15s;
  background: #fff;
}
.pay-option:hover { border-color: var(--wood-hi); }
.pay-option:focus-visible { outline: 2px solid var(--amber); outline-offset: 2px; }
.pay-option.is-selected { border-color: var(--wood); background: #fdfbf7; }

/* Radio dot drawn from the border so it inherits the selected colour. */
.pay-dot {
  flex: none; width: 15px; height: 15px; border-radius: 50%;
  border: 1px solid var(--muted); position: relative; transition: border-color .15s;
}
.pay-option.is-selected .pay-dot { border-color: var(--wood); border-width: 2px; }
.pay-option.is-selected .pay-dot::after {
  content: ''; position: absolute; inset: 2px; border-radius: 50%; background: var(--wood);
}

.pay-text { display: flex; flex-direction: column; gap: 2px; }
.pay-label { font-size: 13px; letter-spacing: 0.06em; color: var(--ink); }
.pay-hint { font-size: 11px; color: var(--muted); letter-spacing: 0.04em; }
