/* ---------- the wall: one light theme, two colours ---------- */
/* The studio's black and white (founder, 3 Dec 2026, issue #5: «наш черный #1E1915, темную тему убераем», «наш белый
   F5F2EB»): the wall is --wall, every line of text and the logo are --ink, on the wall itself; no dark theme, no cards,
   no dot screen («Текстуру с фона. Вообще отовсюду текстуру»). Contrast: --ink on --wall is 15.6:1. --sk is the loading
   sheet under a poster before its image arrives (not text). */
:root { color-scheme: light; --wall: #F5F2EB; --ink: #1E1915; --sk: color-mix(in srgb, var(--wall) 92%, var(--ink)); }
/* Helvetica Neue (founder, 3 Dec 2026, after trying the faces side by side: «оставляем Helvetica New»). It comes with
   Apple devices; elsewhere Helvetica, then Arial. No web font is loaded, so nothing waits for one. Body 400, the buy line
   too; the poster's title 600 (Helvetica Neue has no 600 and draws its Bold). Same stack in pages.css. */
:root { --font: 'Helvetica Neue', Helvetica, Arial, sans-serif; }

* { box-sizing: border-box; }
/* the page never toggles overflow: Safari repaints the whole wall when the root's overflow changes,
   and the images blink. While a poster is open, main.js stops scrolling by wheel, touch and keys instead. */
/* one motion for everything you can press, taken from the logo (founder, 3 Dec 2026: «логотип правильно отрабатывает …
   унифицируйте анимацию»): a press squeezes it quickly (--press-t, --press), the release springs it back past its size
   and home (--spring-t, --spring). main.js marks the pressed element with data-pressed for mouse, touch and keys alike:
   iOS Safari does not apply :active to a touch without a touch listener. */
:root { --spring: cubic-bezier(.34, 1.56, .64, 1); --spring-t: 520ms; --press: cubic-bezier(.2, 0, 0, 1); --press-t: 110ms; }
html { background: var(--wall); -webkit-text-size-adjust: 100%; scrollbar-gutter: stable; overflow-x: hidden; }
body { margin: 0; color: var(--ink); background: transparent; font: 400 12px/16px var(--font); }   /* the artifact preview wraps the page and paints body white */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; border: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
:focus { outline: none; }
:focus-visible { outline: 3px solid var(--ink); outline-offset: 6px; }
/* the open view's close control: for screen readers only, never drawn (founder, 3 Dec 2026: «скрыть, чтобы кому надо
   работала, а визуально не отображалась»); a tap, Escape or a swipe closes */
#vclose:focus-visible { outline: none; }

/* ---------- logo: fixed at the top centre (logo.js) ---------- */
/* No band behind it (founder, 3 Dec 2026: «фон не нужен в хедере»): posters slide under the bare mark. Twice the
   first size («сделать его в 2 раза больше»). The box is 7:5, the shape of
   the hand's frames (.mark below). While a poster opens it flies off with the wall (main.js start()), under the view. */
:root { --bar: 112px; }
@media (min-width: 760px) { :root { --bar: 136px; } }
.bar { position: fixed; top: 0; left: 0; right: 0; z-index: 4; height: calc(var(--bar) + env(safe-area-inset-top));
  padding-top: env(safe-area-inset-top); display: grid; place-items: center; pointer-events: none;
  transition: opacity .3s ease-out, visibility .3s;
  /* its own layer: Safari can draw a moving poster's layer over a fixed bar while the wall scrolls (founder, 3 Dec 2026:
     «Логотип то под постером, то не под постером. Все время скачет») */
  transform: translateZ(0); }
/* back from Stripe (main.js data-back): the poster is already open, so the logo is not shown before it flies off */
html[data-back] .bar { opacity: 0; visibility: hidden; transition: none; }
.logo { pointer-events: auto; display: block; width: 126px; height: 90px; padding: 0; border: 0; background: none; color: var(--ink);
  cursor: pointer; -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
@media (min-width: 760px) { .logo { width: 154px; height: 110px; } }
.logo .stage { display: block; width: 100%; height: 100%; transition: transform var(--spring-t) var(--spring); will-change: transform; }
@media (hover: hover) { .logo:hover .stage { transform: scale(1.04); } }
.logo[data-pressed] .stage { transform: scale(.93); transition: transform var(--press-t) var(--press); }
/* the hand: one strip of 41 frames, 7:5 (cut close round the drawing, founder, 3 Dec 2026: «кропни его чтобы был не мелким») (logo.js steps --f); the last frame, the words RARE BISCUIT, until it plays */
.logo .mark { display: block; width: 100%; height: 100%; background: url(/logo/hand.webp?v=39cbdb9d) 0 0 / 4100% 100% no-repeat;
  background-position-x: calc(var(--f, 40) * 100% / 40); }
@media (prefers-reduced-motion: reduce) { .logo .stage, .bar { transition: none; } .logo[data-pressed] .stage { transform: none; } }
/* after a purchase (logo.js thanks()): THANK YOU flies down into the logo's place over the open poster, stays a moment
   and flies back up, shivering round its five frames all the while (founder, 3 Dec 2026: «не нужна рука, просто вылетает
   спасибо, держится и улетает»). logo/thanks.webp is cut from the artist's video like the logo's own strip. */
.thanks { position: fixed; z-index: 6; left: 50%; top: calc((var(--bar) - 90px) / 2 + env(safe-area-inset-top));
  width: 126px; height: 90px; margin-left: -63px; pointer-events: none; }
@media (min-width: 760px) { .thanks { top: calc((var(--bar) - 110px) / 2 + env(safe-area-inset-top)); width: 154px; height: 110px; margin-left: -77px; } }
.thanks .mark { display: block; width: 100%; height: 100%; background: url(/logo/thanks.webp?v=c2bf4892) 0 0 / 500% 100% no-repeat;
  background-position-x: calc(var(--f, 0) * 100% / 4); }
#wall { padding-top: calc(var(--bar) + env(safe-area-inset-top)); }

/* ---------- footer: one quiet line at the end of the wall ---------- */
.foot { margin: 0 auto; padding: 0 16px 32px; text-align: center; }   /* founder, 3 Dec 2026: «в футере тоже по центру текст» */
.foot p { margin: 0; }
.foot a { display: inline-block; color: inherit; text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; transition: transform var(--spring-t) var(--spring); }
.foot a:hover { text-decoration: none; }
.foot a:focus-visible { outline-offset: 3px; }

/* ---------- wall: 2 per row on phones, 3 from 760px ---------- */
/* posters flying off sideways must not widen the page on a phone (overflow-x on html alone does not stop it) */
#wall { position: relative; overflow-x: clip; transition: opacity .3s ease-out; }
/* hidden until it is built from Stripe's catalog (main.js), so no poster shows and then goes, and nothing jumps */
#wall.wait { visibility: hidden; opacity: 0; }
@media (prefers-reduced-motion: reduce) { #wall { transition: none; } }
/* an order link that leads nowhere (main.js note()): one line above the grid, in the flow. It used to sit over the
   grid's top margin; with the row now close under the logo it would cover the posters, so on this rare error the wall
   moves down a line instead. */
.note { margin: 4px auto 24px; padding: 0 16px; }
.note a { color: inherit; }
.grid {
  list-style: none; margin: 0 auto;
  /* the gap from the logo's words down to the row equals the gap from the screen's top edge to the words (founder,
     3 Dec 2026: «между было столько же сколько от браузера до логотипа»). The words fill rows 111 to 160 of the
     260-pixel frame, so in a 90 px logo on a 112 px bar they start 49 px down and leave 46 px of the bar below them:
     4 px more. At 760 px and up (110 px logo, 136 px bar): 60 down, 55 below, 5 more. A poster's own drop (--dy,
     0 to 10% of its height) comes on top, as everywhere on the wall. */
  padding: 4px 16px 72px;
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 32px 16px;
}
@media (min-width: 760px) {
  /* a poster on the wall stays at ~60% of its open size (open height is 82% of the screen), so opening reads as a zoom */
  .grid { max-width: min(1320px, calc(110vh + 192px)); gap: 64px 48px; padding: 5px 48px 96px; grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .foot { max-width: min(1320px, calc(110vh + 192px)); padding: 0 48px 48px; }
  .note { margin: 12px auto 32px; max-width: min(1320px, calc(110vh + 192px)); padding: 0 48px; }
}

/* ---------- poster: the artwork as it is, straight, no paper, no torn edge, no shadow ---------- */
.poster {
  position: relative; display: block; width: 100%; aspect-ratio: 3 / 4;
  padding: 0; border: 0; background: none; cursor: pointer;
  transform: translate(var(--dx), var(--dy));
  -webkit-tap-highlight-color: transparent;
  /* a link to the poster's page (main.js linkPoster) that feels as the button it was: no iOS long-press preview or
     callout, no link drag on a desktop (draggable="false" covers Firefox), no text colour or underline */
  color: inherit; text-decoration: none;
  -webkit-touch-callout: none; -webkit-user-drag: none; user-select: none; -webkit-user-select: none;
  /* one finger scrolls the page; a pinch over a poster is the poster's (main.js opens it), not a page zoom. A poster a
     finger is on takes none, so a second finger there stops a two-finger scroll too (the browser intersects the
     touch-action of every finger in a gesture). Double-tap zoom stays off, as with manipulation before. */
  touch-action: pan-x pan-y;
}
#grid li.touched .poster { touch-action: none; }
/* the page is zoomed in (main.js, visualViewport): a pinch anywhere is the browser's, so it can zoom back out */
html.zoomed #grid .poster, html.zoomed #grid li.touched .poster { touch-action: manipulation; }
#grid .poster.grow { z-index: 2; }   /* pinched: above its neighbours while it grows under the fingers */
.poster img, #big img { display: block; -webkit-user-drag: none; user-select: none; -webkit-user-select: none; }
.poster picture img, #big .b-wall, #big .b-img { position: absolute; inset: 0; width: 100%; height: 100%; }
.poster.away { visibility: hidden; }
/* hover (mouse only): the poster lifts a little, no shadow. Off while a poster opens, is open
   or closes, and after a close until the mouse moves (html.calm): posters flying under a still cursor stay calm.
   A press (any pointer) squeezes it where it hangs; both use the shared spring. */
.poster { transition: transform var(--spring-t) var(--spring); }
@media (hover: hover) and (pointer: fine) {
  html:not(.calm) .poster:hover { transform: translate(var(--dx), calc(var(--dy) - 6px)) scale(1.03); }
}
html .poster.poster[data-pressed] { transform: translate(var(--dx), var(--dy)) scale(.96); transition: transform var(--press-t) var(--press); }
@media (prefers-reduced-motion: reduce) { .poster { transition: none; } html .poster.poster[data-pressed] { transform: translate(var(--dx), var(--dy)); } }
/* skeleton: a quiet sheet that breathes until the image is decoded, then the image fades in */
.poster::before {
  content: ''; position: absolute; inset: 0; background: var(--sk);
  animation: breathe 1.4s ease-in-out infinite alternate;
}
.poster picture img { opacity: 0; transition: opacity .3s ease-out; }
.loaded .poster::before { animation: none; opacity: 0; transition: opacity .3s ease-out; }
.loaded .poster picture img { opacity: 1; }
@keyframes breathe { from { opacity: .55; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .poster::before { animation: none; } }

/* ---------- open view: nothing but the poster on the empty wall ---------- */
#view { position: fixed; inset: 0; z-index: 5; touch-action: none; }
#view:focus-visible { outline: none; }   /* focused on every open (main.js), never drawn */
#view.closing { pointer-events: none; }
#hand { position: absolute; inset: 0; transform-origin: var(--ox) var(--oy); }
#big { position: absolute; left: var(--x); top: var(--y); width: var(--w); height: var(--h); will-change: transform; }
#big .b-img { opacity: 0; transition: opacity .15s ease-out; }
#big .b-img.on { opacity: 1; }

/* posters added in Stripe (no wall id yet): the product image as it is, whole */
.poster.plain picture img, #big.plain img { object-fit: contain; }

/* ---------- the label: plain text on the wall beside the open poster, or under it ---------- */
/* No card, no sticker (founder, 3 Dec 2026: «карточку полностью убираем и кнопку делаем просто текстом. Заголовок, текст.
   Вместо кнопки тоже текст с суммой»). main.js places it (--lx, --ly, --lw): to the right of the poster where the screen
   is wide enough, its last line level with the poster's bottom edge; under the poster, as wide as it, otherwise. It is
   part of the open poster: it zooms in with it from the wall, about the poster's centre (--lox, --loy), and fades in on
   the way; the close plays that back. */
.label {
  position: absolute; left: var(--lx); top: var(--ly); width: var(--lw); transform-origin: var(--lox) var(--loy);
  text-align: left; pointer-events: none;
}
.label.on { pointer-events: auto; }   /* a press on it never closes the poster (main.js), and its text can be selected */
.l-name { margin: 0; font-size: 24px; line-height: 28px; font-weight: 600; overflow-wrap: anywhere; }
.l-meta { margin: 0; overflow-wrap: anywhere; }
.l-kind { margin-top: 8px; white-space: pre-line; }   /* the Stripe description, its line breaks kept */
/* no file lines on the label (founder, 3 Dec 2026: «digital files и до DPI убрать», the year stays); the page's
   description meta still says what the file is */
.l-year { margin-top: 8px; }
.l-msg { margin-top: 12px; }
/* the buy line: "Buy" and the price as an ordinary text line, underlined (founder, 3 Dec 2026: «Вместо кнопки тоже
   текст с суммой», then «очень большой шрифт»); "Download" in its place once paid, and "Copy your link" beside it.
   12 px text, 44 px tall to the finger (the padding), Apple's least target. Hover drops the underline («Ховер на
   ссылках просто убираем подчеркивание»). */
.l-act { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 20px; margin: 12px 0 0; }
.l-act[hidden] { display: none; }
.buy {
  display: inline-block; margin: -14px 0; padding: 14px 0; border: 0; background: none; color: inherit; cursor: pointer;
  font: inherit; text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px;
  transform-origin: 0 50%; -webkit-tap-highlight-color: transparent; touch-action: manipulation;
  transition: transform var(--spring-t) var(--spring);
}
.buy[hidden] { display: none; }
.buy:focus-visible { outline-offset: 4px; }
/* busy (checkout opening, download starting): the line itself says so (main.js setBusy), takes no press and is not
   underlined; its three dots blink in turn (founder, 3 Dec 2026: «подчеркивание убери, 3 точки просто заанимируй») */
.buy[aria-disabled='true'] { cursor: progress; text-decoration: none; }
.dots i { font-style: normal; animation: dot 1.2s infinite; }
.dots i:nth-child(2) { animation-delay: .2s; }
.dots i:nth-child(3) { animation-delay: .4s; }
@keyframes dot { 0%, 60%, 100% { opacity: .2; } 30% { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .dots i { animation: none; } }
/* no sale (main.js ACT_OFF), a payment still processing (ACT_WAIT, ACT_STUCK): the same line, plain text */
.buy[data-off] { text-decoration: none; cursor: default; }
@media (hover: hover) and (pointer: fine) { .buy:not([aria-disabled='true']):hover, a:hover { text-decoration: none; } }
.buy[data-pressed], .foot a[data-pressed] { transform: scale(.93); transition: transform var(--press-t) var(--press); }
@media (prefers-reduced-motion: reduce) { .buy, .buy[data-pressed], .foot a, .foot a[data-pressed] { transform: none; transition: none; } }
/* where the clipboard is refused, the link itself, selected, to copy by hand */
.l-link { display: block; width: 100%; margin: 4px 0 0; padding: 2px 0; border: 0; border-bottom: 1px solid var(--ink); background: none;
  color: var(--ink); font: inherit; border-radius: 0; }
.l-link:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
