/* Gallery (Phase 3.6.2: final polish of 3.6.1): a boutique card shop. Three columns on wide screens (occasions · the live card · the card's
   details), stacked on phones; under the card, on every screen, the Phase 3.5 floating card bar (larger pictures, the
   card's controls in words). The card stage, its size and its shuffle are the Phase 3.5 ones.
   Colours and type: css/gallery-tokens.css only. */
*, *::before, *::after { box-sizing: border-box; }
html { background: var(--bc-stage); scroll-behavior: smooth; }
body.store {
  margin: 0;
  background: var(--bc-stage);
  color: var(--bc-ink);
  font: 15px/1.55 var(--bc-sans);
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}
a { color: inherit; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 1px solid var(--bc-ink); outline-offset: 3px; }
.sr { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.eyebrow {
  margin: 0;
  font: 500 11px/1.4 var(--bc-sans);
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--bc-muted);
}

/* ------------------------------------------------------------ top navigation */
.nav {
  position: relative;
  z-index: 3;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: calc(env(safe-area-inset-top, 0px) + 16px) max(20px, env(safe-area-inset-right, 0px)) 12px max(20px, env(safe-area-inset-left, 0px));
}
.brand { position: relative; font: 400 21px/1.15 var(--bc-serif); letter-spacing: 0.01em; text-decoration: none; white-space: nowrap; }
/* Phase 5B: the logo is laid over the name's own line (the name stays for its room and for screen readers), reaching
   up into the navigation's padding, so the line, the tagline and the card keep their places */
.brand-t { color: transparent; }
.brand img { position: absolute; left: 0; bottom: -2px; width: auto; height: 42px; max-width: none; }
.tagline { margin: 3px 0 0; font: italic 400 13px/1.3 var(--bc-serif); color: var(--bc-muted); }
.nav-r { display: flex; align-items: baseline; gap: 22px; padding-top: 3px; }
.nav-link {
  padding: 0;
  border: 0;
  background: none;
  font: 500 11.5px/1.4 var(--bc-sans);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
}
.nav-link:hover { text-decoration: underline; text-underline-offset: 4px; text-decoration-thickness: 1px; }
.cart { display: inline-flex; align-items: center; gap: 8px; }
.bag { flex: none; display: block; margin-top: -2px; }
.cart-t { display: inline-flex; flex-direction: column; align-items: flex-start; }
.cart-soon { font: 400 10px/1.3 var(--bc-sans); letter-spacing: 0.04em; text-transform: none; color: var(--bc-muted); }

/* ------------------------------------------------------------ the three columns */
.store-grid { position: relative; }
/* the showroom is one screen tall: the engine sizes the card from it exactly as the recipient viewer does from its
   window (the accepted design v2 size) */
.showroom {
  position: relative;
  height: 100vh;
  height: 100svh;
  overflow: hidden;
}
.live { position: absolute; inset: 0; z-index: 0; }
.live-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  /* vertical swipes scroll the page; taps and sideways drags are the card's */
  touch-action: pan-y;
  opacity: 0;
}
/* Phase 3.6 handover (no flicker): the canvas is shown at once, fully opaque, under the still picture, once its first
   live frame is drawn; then only the still fades away over it. Nothing is ever half transparent over the page. */
body[data-stage="live"] .live-canvas { opacity: 1; }
.live-canvas[data-grabbing] { cursor: grabbing !important; }
.still {
  position: absolute;
  z-index: 1;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.35s ease;
}
.still.shown { opacity: 1; transition: none; }
.still.shown.gone { opacity: 0; transition: opacity 0.35s ease; }
.still .paper { position: relative; width: 100%; height: 100%; overflow: hidden; background: transparent; box-shadow: var(--bc-shadow); }
.still img { position: absolute; inset: 0; display: block; width: 100%; height: 100%; object-fit: cover; }
.still img.full { opacity: 0; }
.still img.full.in { opacity: 1; transition: opacity 0.2s ease; }
.still .paper.sample { display: grid; place-items: center; background: linear-gradient(160deg, var(--a), var(--b)); color: var(--c); }
.still .paper.sample svg { width: 22%; height: auto; opacity: 0.8; }
.tag {
  position: absolute;
  top: 10px; left: 10px;
  padding: 3px 8px;
  background: rgba(255, 255, 255, 0.92);
  color: var(--bc-ink);
  font: 500 10px/1.4 var(--bc-sans);
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

/* the details and the card bar appear once the page has placed them (no layout shift while they are filled in) */
body:not([data-ready]) .product, body:not([data-ready]) .bar { visibility: hidden; }

/* ------------------------------------------------------------ the card bar (Phase 3.5 floating toolbar, 0f17b83) */
/* placed by gallery.js just under the card (never over it, shut or open); its thumbnails are larger than in 3.5 */
.bar {
  --tw: 88px;                 /* thumbnail width; height from the card's own shape */
  --tg: 14px;                 /* gap between thumbnails */
  position: absolute;
  z-index: 3;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 4px;
  max-width: min(1040px, calc(100vw - 96px));
  padding: 0 10px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.96);
  /* Phase 3.6.2: lighter than 3.6.1 (a fainter hairline, a softer and wider shadow): set apart from the card by air,
     not by weight */
  border: 1px solid rgba(30, 28, 25, 0.075);
  box-shadow: 0 14px 34px -24px rgba(30, 28, 25, 0.2), 0 1px 3px -2px rgba(30, 28, 25, 0.05);
  -webkit-backdrop-filter: blur(16px) saturate(1.1);
  backdrop-filter: blur(16px) saturate(1.1);
}
.bar-cards { display: flex; align-items: center; min-width: 0; }
.div { flex: none; width: 1px; align-self: stretch; margin: 18px 8px; background: var(--bc-line); }
.rail {
  display: flex;
  align-items: flex-end;
  gap: var(--tg);
  min-width: 0;
  max-width: calc(7 * var(--tw) + 6 * var(--tg) + 12px);
  padding: 0 6px;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scrollbar-width: none;
}
.rail::-webkit-scrollbar { display: none; }
.bar[data-over] .rail {
  -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 8px, #000 calc(100% - 8px), transparent 100%);
  mask-image: linear-gradient(90deg, transparent 0, #000 8px, #000 calc(100% - 8px), transparent 100%);
}
.thumb {
  position: relative;
  flex: none;
  width: var(--tw);
  padding: 11px 0 14px;
  border: 0;
  background: none;
  cursor: pointer;
  scroll-snap-align: center;
}
/* the card's whole cover, square corners like paper, a soft shadow */
.thumb .t {
  display: block;
  width: 100%;
  aspect-ratio: 3 / 4;
  overflow: hidden;
  background: #F6F4F0;
  opacity: 0.72;
  transform: scale(0.94);
  box-shadow: 0 3px 8px -4px rgba(30, 28, 25, 0.38);
  transition: opacity 0.25s ease, transform 0.35s cubic-bezier(0.34, 1.4, 0.64, 1), box-shadow 0.25s ease;
}
.thumb img { display: block; width: 100%; height: 100%; object-fit: cover; }
.thumb .t.sample { background: linear-gradient(160deg, var(--a), var(--b)); }
.thumb:hover .t { opacity: 0.92; }
.thumb[aria-selected="true"] .t { opacity: 1; transform: translateY(-3px); box-shadow: 0 10px 16px -8px rgba(30, 28, 25, 0.5); }
.thumb[aria-selected="true"]::after {
  content: '';
  position: absolute;
  left: 50%; bottom: 4px;
  width: 18px; height: 1.5px;
  margin-left: -9px;
  background: var(--bc-ink);
}
.thumb[hidden] { display: none; }
.arrow { flex: none; width: 28px; height: 44px; padding: 0; border: 0; background: none; font: 300 24px/1 var(--bc-serif); color: var(--bc-ink); cursor: pointer; }
.arrow:disabled { color: var(--bc-faint); cursor: default; }
.arrow[hidden] { display: none; }
.bar-ctl { flex: none; display: flex; align-items: center; gap: 16px; padding: 0 8px 0 4px; white-space: nowrap; }
.ctl {
  padding: 8px 2px;
  border: 0;
  border-bottom: 1px solid transparent;
  background: none;
  font: 500 11.5px/1.4 var(--bc-sans);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  cursor: pointer;
}
.ctl:hover:not(:disabled) { border-bottom-color: var(--bc-line-strong); }
.ctl:disabled { color: var(--bc-faint); cursor: default; }
.ctl-sep { width: 1px; height: 14px; background: var(--bc-line); }

/* occasions */
.cats { list-style: none; margin: 14px 0 0; padding: 0; }
.cat {
  position: relative;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  padding: 9px 0 9px 14px;
  border: 0;
  background: none;
  font: 400 15.5px/1.3 var(--bc-serif);
  text-align: left;
  cursor: pointer;
}
.cat::before { content: ''; position: absolute; left: 0; top: 9px; bottom: 9px; width: 1px; background: transparent; }
.cat[aria-current="true"] { background: linear-gradient(90deg, var(--bc-mark), transparent 85%); }
.cat[aria-current="true"]::before { background: var(--bc-ink); }
.cat:hover:not([aria-disabled="true"]) { text-decoration: underline; text-underline-offset: 4px; text-decoration-thickness: 1px; }
.cat .n { font: 400 11px/1 var(--bc-sans); color: var(--bc-muted); letter-spacing: 0.06em; }
.cat[aria-disabled="true"] { color: var(--bc-faint); cursor: default; }
.cat[aria-disabled="true"] .n { color: var(--bc-faint); font-style: italic; letter-spacing: 0.02em; }

/* the card's details */
.p-title { margin: 8px 0 0; font: 400 30px/1.15 var(--bc-serif); letter-spacing: 0.005em; }
.p-desc { margin: 16px 0 0; font: 400 16px/1.6 var(--bc-serif); color: #4A453E; }
.p-price { margin: 18px 0 0; padding-top: 16px; border-top: 1px solid var(--bc-line); font: 400 17px/1.3 var(--bc-sans); letter-spacing: 0.02em; }
.p-price .cur { font-size: 12px; color: var(--bc-muted); letter-spacing: 0.08em; margin-right: 4px; }
.btn {
  display: inline-block;
  margin-top: 18px;
  padding: 14px 26px;
  border: 1px solid var(--bc-ink);
  border-radius: 2px;
  background: var(--bc-ink);
  color: #FFFFFF;
  font: 500 12px/1 var(--bc-sans);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
}
.btn:hover { background: #FFFFFF; color: var(--bc-ink); }
.btn-quiet { background: #FFFFFF; color: var(--bc-ink); }
.btn-quiet:hover { background: var(--bc-ink); color: #FFFFFF; }
.btn[hidden], .p-notcard[hidden] { display: none; }
.p-notcard { margin: 18px 0 0; font: 500 11px/1.4 var(--bc-sans); letter-spacing: 0.16em; text-transform: uppercase; color: var(--bc-muted); }
.p-flow { margin: 18px 0 0; font-size: 13px; line-height: 1.6; color: var(--bc-muted); max-width: 30em; }
.p-soon { margin: 8px 0 0; font-size: 12px; color: var(--bc-muted); font-style: italic; }

/* ------------------------------------------------------------ folds (About this card, How it works on phones) */
.fold > summary { list-style: none; display: flex; align-items: center; justify-content: space-between; cursor: pointer; }
.fold > summary::-webkit-details-marker { display: none; }
.pm { position: relative; width: 11px; height: 11px; }
.pm::before, .pm::after { content: ''; position: absolute; left: 0; right: 0; top: 5px; height: 1px; background: var(--bc-ink); }
.pm::after { transform: rotate(90deg); transition: transform 0.2s ease; }
.fold[open] .pm::after { transform: rotate(0deg); }
.about { display: none; }

/* ------------------------------------------------------------ how it works, footer, cart */
.how { position: relative; z-index: 2; background: var(--bc-stage); padding: 40px max(20px, env(safe-area-inset-left, 0px)) 34px; border-top: 1px solid var(--bc-line); }
.steps { list-style: none; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 28px; margin: 22px 0 0; padding: 0; }
.steps h3 { margin: 8px 0 0; font: 400 18px/1.25 var(--bc-serif); }
.steps p { margin: 6px 0 0; font-size: 13.5px; color: var(--bc-muted); line-height: 1.6; }
.step-n { font: 400 12px/1 var(--bc-serif); color: var(--bc-muted); }
.nojs { text-align: center; }

/* ------------------------------------------------------------ wide screens: three columns over the showroom */
@media (min-width: 1100px) {
  .nav { position: absolute; top: 0; left: 0; right: 0; padding-left: 48px; padding-right: 48px; padding-top: 26px; }
  /* the columns stand beside the card, above the card bar (--bar-top: set by gallery.js) */
  .occasions, .product {
    position: absolute;
    z-index: 2;
    top: 0;
    height: var(--bar-top, 100svh);
    display: flex;
    flex-direction: column;
    justify-content: center;
  }
  .occasions { left: 48px; width: 220px; }
  /* an open card's spread (the accepted size) is wider than the middle column: the side columns step aside */
  .occasions, .product { transition: opacity 0.3s ease, visibility 0s linear 0s; }
  body[data-open] .occasions, body[data-open] .product { opacity: 0; visibility: hidden; transition: opacity 0.3s ease, visibility 0s linear 0.3s; }
  .product { right: 48px; width: min(300px, calc(50vw - var(--card-half, 230px) - 96px)); }
  .how { padding-left: 48px; padding-right: 48px; }
  .how-d > summary { cursor: default; pointer-events: none; }
  .how-d .pm { display: none; }
}

/* ------------------------------------------------------------ phones and narrow screens: stacked */
@media (max-width: 1099px) {
  .nav { padding-top: calc(env(safe-area-inset-top, 0px) + 12px); padding-bottom: 6px; }
  .tagline { margin-top: 2px; }
  .brand img { bottom: -3px; height: 33px; }
  /* the showroom slides up under the occasions row (its top is empty white wall) so the card sits just under it, and
     what follows comes just under the card bar: margins set by gallery.js from the card's own place; same card size */
  .occasions { position: relative; z-index: 3; padding: 0; border-bottom: 1px solid var(--bc-line); background: var(--bc-stage); }
  .occasions .eyebrow { display: none; }
  .cats { display: flex; gap: 22px; margin: 0; padding: 0 max(20px, env(safe-area-inset-left, 0px)); overflow-x: auto; scrollbar-width: none; }
  .cats::-webkit-scrollbar { display: none; }
  .cats li { flex: none; }
  .cat { padding: 8px 0 9px; font: 500 11.5px/1.3 var(--bc-sans); letter-spacing: 0.15em; text-transform: uppercase; white-space: nowrap; }
  .cat::before { left: 0; right: 0; top: auto; bottom: 0; width: auto; height: 1px; }
  .cat[aria-current="true"] { background: none; }
  .cat .n { display: none; }
  .cat[aria-disabled="true"]::after { content: ' · soon'; font: italic 400 11px/1 var(--bc-serif); letter-spacing: 0.02em; text-transform: none; }
  .bar { --tw: 80px; --tg: 12px; max-width: calc(100vw - 32px); }
  /* the card's details: theme; name and price on one line; Personalize card full width (the story is folded below) */
  .product {
    position: relative;
    z-index: 2;
    display: grid;
    grid-template-columns: 1fr auto;
    column-gap: 16px;
    align-items: baseline;
    padding: 4px max(20px, env(safe-area-inset-left, 0px)) 18px;
    background: var(--bc-stage);
  }
  .product > * { grid-column: 1 / -1; }
  .product .p-title { grid-column: 1; margin-top: 6px; font-size: 26px; }
  .product .p-price { grid-column: 2; margin: 0; padding: 0; border: 0; }
  .product .p-desc, .product .p-flow { display: none; }
  .product .btn { display: block; margin-top: 14px; text-align: center; }
  .product .btn[hidden] { display: none; }
  .p-soon { margin-top: 10px; }
  .about { display: block; position: relative; z-index: 2; background: var(--bc-stage); border-top: 1px solid var(--bc-line); }
  .fold > summary { min-height: 52px; padding: 0 max(20px, env(safe-area-inset-left, 0px)); }
  .fold-body { padding: 0 max(20px, env(safe-area-inset-left, 0px)) 22px; }
  .a-desc { margin: 0; font: 400 16px/1.6 var(--bc-serif); color: #4A453E; }
  .a-flow { margin: 12px 0 0; font-size: 13px; line-height: 1.6; color: var(--bc-muted); }
  .how { padding: 0; }
  .how .steps { margin: 0; padding: 0 max(20px, env(safe-area-inset-left, 0px)) 24px; grid-template-columns: 1fr; gap: 18px; }
}
/* phones: the card bar keeps its cards on one line and its controls on a second line, in the same bar */
@media (max-width: 699px) {
  /* as wide as its cards (and never wider than the screen less 12 px each side), centred under the card */
  /* two rows in a column: as wide as the wider row (its cards, or its controls), not the two side by side */
  .bar { --tw: 64px; --tg: 10px; flex-direction: column; align-items: stretch; gap: 0; left: 12px; right: 12px; transform: none; width: -webkit-fit-content; width: fit-content; min-width: 236px; max-width: min(520px, calc(100vw - 24px)); margin: 0 auto; padding: 0 6px; border-radius: 18px; }
  .bar-cards { justify-content: center; }
  .rail { max-width: none; padding: 0 4px; }
  .thumb { padding: 10px 0 12px; }
  .arrow { width: 22px; font-size: 22px; }
  .div { display: none; }
  .bar-ctl { justify-content: center; padding: 1px 0 3px; border-top: 1px solid rgba(30, 28, 25, 0.07); }
  .ctl { padding: 8px 2px; font-size: 11px; }
}
@media (max-width: 340px) {
  .bar { --tw: 60px; --tg: 8px; }
}
/* short phone screens (Safari with its bars, iPhone SE): the bar a little tighter, within the 60-72 px range */
@media (max-width: 699px) and (max-height: 600px) {
  .bar { --tw: 60px; --tg: 8px; }
  .thumb { padding: 6px 0 10px; }
  .ctl { padding: 6px 2px; }
}
/* the smallest phones: the header stays on two lines (the cart says "not open yet" in its name, its panel and under
   Personalize card) */
@media (max-width: 360px) {
  .cart-soon { display: none; }
  .tagline { font-size: 11.5px; }
}
/* phones: How it works is a fold on the page itself, so the navigation keeps only the brand and the cart */
@media (max-width: 699px) {
  .nav-r .nav-link[href="#how"] { display: none; }
}
@media (max-width: 420px) {
  .brand { font-size: 19px; }
  .tagline { font-size: 12px; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .still, .still.shown.gone, .still img.full.in, .btn, .thumb .t, .pm::after { transition: none; }
}

/* ------------------------------------------------------------ breathing space (Founder, 2026-11-26)
   More white between the parts of the stage, added on top of the air gallery.js sets (placeStill), so the card's size
   and place in its showroom, the bar's size, the type and the layout stay as they are. The page is allowed to be
   taller than one screen. The showroom no longer clips, so a bar moved lower is never cut off on short screens. */
.showroom { overflow: visible; }
@media (max-width: 1099px) {
  /* at 390 x 844: occasions row -> card 40 px, card -> bar 48 px, bar -> details 48 px */
  .occasions { margin-bottom: 18px; }
  .bar { margin-top: 21px; }
  .product { margin-top: 39px; }           /* the bar's 21 px plus 18 px more under it */
}
/* Desktop (Founder, 2026-11-26, second pass): the whole stage on one screen (navigation, occasions, card, details
   with Personalize, the whole card bar), with air around the card. The showroom is a little shorter than the screen,
   so the engine makes the card proportionally a little smaller (by 3.4 % of the height on tall screens, more on short
   ones, where the navigation and the bar take a larger share); gallery.js then places the bar under it as before.
   Over the card: less on tall screens, where the card already stands well under the navigation. The thumbnails keep
   their 3.6.2 widths (88 / 84 / 80 px by screen height) instead of stepping down for the shorter showroom.
   How it works and the footer follow below the first screen. */
@media (min-width: 1100px) {
  .showroom { height: calc(100vh - max(3.4vh, 190px - 17vh)); height: calc(100svh - max(3.4svh, 190px - 17svh)); }
  .store-grid { margin-top: clamp(-16px, 200px - 19vh, 20px); padding-bottom: calc(clamp(14px, 2vh, 28px) + clamp(24px, 4vh, 56px)); }
  .bar { margin-top: 1.4vh; --tw: 80px !important; }
}
@media (min-width: 1100px) and (min-height: 820px) { .bar { --tw: 84px !important; } }
@media (min-width: 1100px) and (min-height: 1000px) { .bar { --tw: 88px !important; } }
/* Phase 4: beside a landscape card on a narrow desktop the details column is very narrow (the card is wide): the
   "how personalizing works" lines are left to How it works below, so the column stays clear of the navigation */
@media (min-width: 1100px) and (max-width: 1279px) { body[data-landscape] .product .p-flow { display: none; } }
/* Phase 4 (Founder, 2026-11-30): every landscape card is shown 10 % smaller in the Gallery while shut, about its own
   centre (the engine's card centre: 45 % down the showroom); the card bar, the columns and upright cards stay where
   and as they are. Opened, it is at the full size as before (on a phone the open card runs to the screen's edge). The
   live canvas and the still picture are scaled alike; the pointer follows (the engine reads the canvas as shown). */
.live { transform-origin: 50% 45%; }
body[data-landscape] .still, body[data-landscape]:not([data-open]) .live { transform: scale(0.9); }
body[data-stage="live"] .live { transition: transform 0.6s ease; }
@media (prefers-reduced-motion: reduce) { body[data-stage="live"] .live { transition: none; } }
/* Phase 4A (Founder, 2026-11-30), phones only: an upright card wider than the 3:4 house shape is shown 5 % smaller,
   shut and open (3:4 cards unchanged); when the next card has another shape, the stage and the bar glide to their
   places for it. */
@media (max-width: 699px) {
  body[data-wide] .still, body[data-wide] .live { transform: scale(0.95); }
  body[data-stage="live"] .showroom { transition: margin 0.6s ease; }
  body[data-stage="live"] .bar { transition: top 0.6s ease; }
}
@media (max-width: 699px) and (prefers-reduced-motion: reduce) { body[data-stage="live"] .showroom, body[data-stage="live"] .bar { transition: none; } }
