/* ============================================================
   Merch storefront — extends gallery.css (read its header first).
   Linked ONLY by pages built while merch is on, so a merch-off
   build keeps the exact html it had. Same tokens, same serif,
   same single warm accent; merch gets its colour from the
   designs themselves, never from new UI colour.

   Motion: only transform + opacity; --ease-out; under 200ms;
   nothing enters from scale(0); hover effects only under
   (hover: hover) and (pointer: fine); reduced motion keeps
   fades and drops movement (gallery.css already zeroes durations).
   ============================================================ */

/* ---------- masthead menus: "Wall art" and "Gifts & merch" ---------- */

.masthead-in { position: relative; }
.nav-menu { position: static; }
.nav-menu-btn {
  display: inline-flex; align-items: center; gap: 7px;
  font: inherit; font-size: .92rem; color: var(--ink-soft);
  background: none; border: 0; padding: 6px 0; cursor: pointer;
  transition: color 180ms var(--ease-out), transform 140ms var(--ease-out);
}
.nav-menu-btn:active { transform: scale(.97); }
.nav-menu-btn::after {
  content: ""; width: 6px; height: 6px; flex: none;
  border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor;
  transform: translateY(-2px) rotate(45deg);
  transition: transform 180ms var(--ease-out);
}
.nav-menu-btn[aria-expanded="true"] { color: var(--ink); }
.nav-menu-btn[aria-expanded="true"]::after { transform: translateY(1px) rotate(-135deg); }
@media (hover: hover) and (pointer: fine) {
  .nav-menu-btn:hover { color: var(--ink); }
}

.nav-panel {
  position: absolute; top: calc(100% - 4px); right: 0; z-index: 50;
  display: grid; grid-auto-flow: column; gap: 6px 44px; align-items: start;
  padding: 22px 28px 20px;
  background: var(--wall); border: 1px solid var(--line); border-radius: 4px;
  box-shadow: 0 26px 46px -30px var(--shadow);
  transform-origin: top right;
}
.nav-panel[hidden] { display: none; }
.nav-panel:not([hidden]) { animation: panel-in 160ms var(--ease-out); }
@keyframes panel-in { from { opacity: 0; transform: translateY(-6px) scale(.98); } to { opacity: 1; transform: none; } }

.nav-col { display: flex; flex-direction: column; min-width: 148px; }
.nav-col-h {
  font-size: .72rem; letter-spacing: .16em; text-transform: uppercase;
  color: var(--ink-soft); margin-bottom: 8px;
}
.nav .nav-panel a { padding: 5px 0; white-space: nowrap; }

@media (max-width: 720px) {
  /* Inside the phone Menu each button is an accordion row and its panel opens in the flow. */
  .nav-menu-btn {
    width: 100%; justify-content: space-between;
    padding: 12px 0; font-size: 1rem; border-bottom: 1px solid var(--line);
  }
  .nav-panel {
    position: static; display: block; padding: 6px 0 10px 12px;
    border: 0; border-bottom: 1px solid var(--line); border-radius: 0; box-shadow: none;
    background: transparent; animation: none !important;
  }
  .nav-col { margin-top: 8px; }
  .nav .nav-panel a { padding: 9px 0; border-bottom: 0; font-size: .95rem; }
}

/* ---------- merch card: the design large on its fabric colour, the real product as a small inset ---------- */

.mart {
  position: relative; aspect-ratio: 1 / 1; overflow: hidden;
  background: var(--wall-deep);
  box-shadow: 0 14px 34px -18px var(--shadow);
}
.mart::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  box-shadow: inset 0 0 0 1px rgba(26, 23, 20, .07);
}
.mart-img { display: block; width: 100%; height: 100%; object-fit: cover; }
.mart-inset {
  position: absolute; right: 8px; bottom: 8px; width: 27%; height: auto; aspect-ratio: 1 / 1;
  object-fit: cover; background: var(--wall);
  border: 1px solid rgba(26, 23, 20, .14); border-radius: 2px;
  transition: opacity 160ms var(--ease-out);
}
/* Added by merch.js on the first hover: the real product, faded in over the design. Opacity only. */
/* Design-led card: the design centred at about 72% on its swatch (nudged up), the product inset small in the bottom-right corner. */
.mart--swatch .mart-img { position: absolute; left: 14%; top: 8%; width: 72%; height: 72%; }
.mart--swatch .mart-inset { right: 4%; bottom: 4%; width: 18%; }
.mart-hover {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover;
  opacity: 0; transition: opacity 160ms var(--ease-out); pointer-events: none;
}
@media (hover: hover) and (pointer: fine) {
  .mcard-link:hover .mart-hover { opacity: 1; }
  .mcard-link:hover .mart-inset { opacity: 0; }
}

.mcard-link { display: block; text-decoration: none; }
.mcard .card-title { min-width: 0; overflow-wrap: anywhere; }
.mcard .card-collection { line-height: 1.5; }
.mcard-also { margin: 8px 0 0; line-height: 1.55; max-width: none; }
.mcard-also a { text-decoration: underline; text-decoration-color: var(--line); text-underline-offset: 3px; transition: color 160ms var(--ease-out), text-decoration-color 160ms var(--ease-out); }
@media (hover: hover) and (pointer: fine) {
  .mcard-also a:hover { color: var(--ink); text-decoration-color: var(--ink-soft); }
}

/* ---------- chips: theme and "who it is for" links ---------- */

.chips { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.chips a {
  display: inline-flex; align-items: center; min-height: 40px; padding: 0 14px;
  border: 1px solid var(--line); border-radius: 3px;
  font-size: .9rem; text-decoration: none; color: var(--ink);
  transition: border-color 160ms var(--ease-out), transform 140ms var(--ease-out);
}
.chips a:active { transform: scale(.97); }
@media (hover: hover) and (pointer: fine) {
  .chips a:hover { border-color: var(--ink-soft); }
}

/* ---------- home: two doors of equal weight ---------- */

.doors {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(20px, 3vw, 40px); margin-top: 28px;
}
.door { display: block; text-decoration: none; min-width: 0; }
.door-art .art, .door-art .mart { box-shadow: 0 30px 70px -34px var(--shadow); }
.door-art .art img { width: 100%; aspect-ratio: 1 / 1; object-fit: cover; }
.door-art .mart { aspect-ratio: 1 / 1; }
.door-title { font-size: clamp(1.5rem, 2.6vw, 2rem); margin: 18px 0 .3em; transition: color 180ms var(--ease-out); }
.door-copy { margin: 0 0 .7em; color: var(--ink-soft); max-width: 42ch; }
.door-go { font-size: .92rem; border-bottom: 1px solid currentColor; padding-bottom: 1px; }
@media (hover: hover) and (pointer: fine) {
  .door:hover .door-title { color: var(--accent); }
}
@media (max-width: 720px) {
  /* Two compact tiles side by side so both doors and the heading sit in the first phone screen. */
  .doors { gap: 14px; margin-top: 20px; }
  .door-art .art img, .door-art .mart { aspect-ratio: 1 / 1; }
  .door-title { font-size: 1.15rem; margin: 10px 0 .25em; line-height: 1.15; }
  .door-copy { display: none; }
  .door-go { font-size: .8rem; }
}

/* ---------- home: occasions row ---------- */

.occs {
  list-style: none; margin: 20px 0 0; padding: 0;
  display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); gap: 0 36px;
}
.occ { display: flex; flex-direction: column; gap: 2px; padding: 16px 0; border-top: 1px solid var(--line); text-decoration: none; }
.occ-title { font-family: var(--font-display); font-size: 1.2rem; line-height: 1.25; transition: color 180ms var(--ease-out); }
.occ-meta { font-size: .85rem; color: var(--ink-soft); }
@media (hover: hover) and (pointer: fine) {
  .occ:hover .occ-title { color: var(--accent); }
}

/* ---------- product gallery: one native scroll-snap track ---------- */

.mg-main { position: relative; min-width: 0; }
.mg-track {
  list-style: none; margin: 0; padding: 0;
  display: flex; overflow-x: auto; overscroll-behavior-x: contain;
  scroll-snap-type: x mandatory; scrollbar-width: thin;
}
.js .mg-track { scrollbar-width: none; }
.js .mg-track::-webkit-scrollbar { display: none; }
.mg-slide { flex: 0 0 100%; min-width: 0; scroll-snap-align: start; scroll-snap-stop: always; }
.mg-slide figure { margin: 0; }
.mg-slide figcaption { margin-top: 8px; line-height: 1.45; }
.mg-frame { background: var(--wall-deep); box-shadow: 0 30px 70px -34px var(--shadow); }
.mg-frame img { display: block; width: 100%; aspect-ratio: 1 / 1; object-fit: contain; max-height: min(640px, calc(100vh - 260px)); margin-inline: auto; }
.mg-track:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 2px; }

/* The counter sits on the picture's corner, so it costs the phone no height. */
.mg-count {
  position: absolute; top: 10px; right: 10px; margin: 0; padding: 3px 9px;
  background: color-mix(in srgb, var(--wall) 90%, transparent); border-radius: 3px;
  font-variant-numeric: tabular-nums; color: var(--ink);
}
.mg-thumbs { display: none; }
@media (min-width: 901px) {
  .mg-count { display: none; }
  .js .mg-thumbs { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
}
.mg-thumb {
  width: 64px; height: 64px; padding: 0; overflow: hidden; cursor: pointer;
  background: var(--wall-deep); border: 1px solid var(--line); border-radius: 2px;
  opacity: .7; transition: opacity 160ms var(--ease-out), border-color 160ms var(--ease-out), transform 140ms var(--ease-out);
}
.mg-thumb img { width: 100%; height: 100%; object-fit: cover; }
.mg-thumb:active { transform: scale(.97); }
.mg-thumb[aria-current="true"] { opacity: 1; border-color: var(--ink); }
@media (hover: hover) and (pointer: fine) {
  .mg-thumb:hover { opacity: 1; }
}

/* On a phone the gallery dissolves into the product grid exactly as the single picture did (gallery.css, phone buy path):
   picture first, then the buy box. */
@media (max-width: 900px) {
  /* The next picture peeks (about 10% of the width) so a swipe is obvious. */
  .mg-track { gap: 8px; }
  .mg-slide { flex-basis: 92%; }
  .mg-slide:only-child { flex-basis: 100%; }
  .mgallery { display: contents; }
  .mgallery .mg-main { order: 0; }
  .mg-frame img { max-height: 46vh; }
}

@media (prefers-reduced-motion: reduce) {
  .nav-panel:not([hidden]) { animation: none; }
  .mg-track { scroll-behavior: auto; }
}

/* ---------- phones: merch card grids show two cards per row (art print grids are untouched) ---------- */
@media (max-width: 600px) {
  .grid:has(> .mcard) { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px 12px; }
  .mcard .card-meta { flex-direction: column; gap: 2px; padding-top: 10px; }
  .mcard .card-title { font-size: .95rem; line-height: 1.25; }
  .mcard .card-price { font-size: .85rem; }
  .mcard .card-collection { font-size: .66rem; letter-spacing: .08em; }
  .mcard-also { font-size: .76rem; line-height: 1.3; }
  .mcard-also a { display: inline-block; padding: 5px 2px; }
  .mart-inset { right: 4%; bottom: 4%; }
}
