/* The shop.
 *
 * Calm, warm and gallery-like: cream paper, ink-dark serif type, poppy red
 * for anything you can press. The motion is gentle and always means
 * something — the window opening, a painting catching the light, a red
 * "sold" dot. Anyone who asks their device for less motion gets none of it.
 *
 * .js-motion  (set before the first paint) things start hidden, ready to animate in
 * .is-open    (set when the window opens) the hero animates in
 */

:root {
  --paper: #f6f0e5;
  --paper-deep: #ede3d2;
  --mat: #fcf9f3;
  --ink: #2a1a1c;
  --ink-soft: #6b5048;
  --ink-faint: rgba(42, 26, 28, 0.12);
  --poppy: #c8321f;
  --poppy-deep: #9b2313;
  --leaf: #3d5a2b;
  --serif: 'Cormorant Garamond', 'Iowan Old Style', 'Palatino Linotype', Palatino, Georgia, serif;
  --script: 'Cookie', var(--serif);
  --sans: system-ui, -apple-system, 'Segoe UI', sans-serif;
  --ease-out: cubic-bezier(0.2, 0.7, 0.2, 1);
  --ease-spring: cubic-bezier(0.34, 1.45, 0.55, 1);
  --gutter: clamp(16px, 4vw, 56px);
  --max: 1240px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  background: var(--paper);
  color: var(--ink);
  scroll-behavior: smooth;
  scroll-padding-top: 76px; /* so a section's heading isn't hidden under the header */
}

body {
  margin: 0;
  font-family: var(--serif);
  font-size: 1.15rem;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}

img {
  max-width: 100%;
}

/* "hidden" always wins, even over a display set below. */
[hidden] {
  display: none !important;
}

:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 3px;
}

.skip-link {
  position: absolute;
  left: 12px;
  top: -60px;
  z-index: 3000;
  padding: 10px 16px;
  border-radius: 8px;
  background: var(--ink);
  color: #fff;
  font: 600 0.85rem/1 var(--sans);
  transition: top 0.2s;
}

.skip-link:focus {
  top: 12px;
}

/* ─── Buttons ──────────────────────────────────────────────────────────────── */

.button {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 48px;
  padding: 0 26px;
  border: 1px solid transparent;
  border-radius: 999px;
  font: 600 0.82rem/1 var(--sans);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-decoration: none;
  cursor: pointer;
  overflow: hidden;
  transition: transform 0.35s var(--ease-out), background-color 0.3s, color 0.3s, box-shadow 0.35s;
}

.button--primary {
  background: var(--poppy);
  color: #fff;
  box-shadow: 0 10px 24px -12px rgba(155, 35, 19, 0.7);
}

.button--primary:hover {
  background: var(--poppy-deep);
  transform: translateY(-2px);
  box-shadow: 0 16px 30px -14px rgba(155, 35, 19, 0.75);
}

/* A glint runs across a primary button when you point at it. */
.button--primary::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(105deg, transparent 35%, rgba(255, 255, 255, 0.35) 50%, transparent 65%);
  transform: translateX(-120%);
  transition: transform 0.7s var(--ease-out);
}

.button--primary:hover::after {
  transform: translateX(120%);
}

.button--quiet {
  border-color: rgba(42, 26, 28, 0.22);
  background: rgba(255, 255, 255, 0.55);
  color: var(--ink);
}

.button--quiet:hover {
  background: #fff;
  transform: translateY(-2px);
}

/* ─── Header ──────────────────────────────────────────────────────────────── */

.masthead {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px var(--gutter);
  transition: background-color 0.4s, box-shadow 0.4s, padding 0.4s var(--ease-out);
}

.masthead.is-scrolled {
  padding-top: 10px;
  padding-bottom: 10px;
  background: rgba(246, 240, 229, 0.84);
  -webkit-backdrop-filter: blur(14px) saturate(1.2);
  backdrop-filter: blur(14px) saturate(1.2);
  box-shadow: 0 1px 0 var(--ink-faint);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  font: italic 500 1.4rem/1 var(--serif);
  text-decoration: none;
}

.brand__mark {
  width: 30px;
  height: 30px;
  transform-origin: 50% 95%;
  transition: transform 0.6s var(--ease-spring);
}

.brand:hover .brand__mark {
  transform: rotate(-9deg);
}

.masthead__nav {
  display: flex;
  gap: clamp(14px, 3vw, 32px);
}

.masthead__nav a {
  position: relative;
  padding: 6px 0;
  color: var(--ink);
  font: 600 0.78rem/1 var(--sans);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  text-decoration: none;
}

/* An underline grows from the middle on hover. */
.masthead__nav a::after {
  content: '';
  position: absolute;
  left: 50%;
  right: 50%;
  bottom: 0;
  height: 1.5px;
  background: var(--poppy);
  transition: left 0.35s var(--ease-out), right 0.35s var(--ease-out);
}

.masthead__nav a:hover::after {
  left: 0;
  right: 0;
}

@media (max-width: 560px) {
  .brand__name {
    font-size: 1.15rem;
  }

  .masthead__nav a[data-needs] {
    display: none; /* the collection matters most on a small screen */
  }
}

/* ─── The hero ────────────────────────────────────────────────────────────── */

.hero {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr);
  align-items: center;
  gap: clamp(28px, 5vw, 80px);
  min-height: min(880px, calc(100svh - 70px));
  /* Full width (so the glow fades out at the screen's edges, not in mid-air);
     the content stays within the page's width through the side padding. */
  padding: clamp(24px, 5vh, 72px) max(var(--gutter), calc((100% - var(--max)) / 2 + var(--gutter))) clamp(48px, 9vh, 110px);
  /* The warm glow spills past the edges on purpose; don't let it widen the page
     (on a phone that zooms everything out). "clip", not "hidden", so the
     header can still stick. */
  overflow-x: clip;
}

/* Warm light from the top left, where the sun is in the window. */
.hero__glow {
  position: absolute;
  inset: -30% -20% 0 -20%;
  z-index: -1;
  background:
    radial-gradient(38% 46% at 14% 20%, rgba(255, 213, 140, 0.55), transparent 70%),
    radial-gradient(30% 36% at 88% 76%, rgba(200, 50, 31, 0.08), transparent 70%);
  pointer-events: none;
}

.hero__text {
  position: relative;
  z-index: 2;
}

.hero__eyebrow {
  margin: 0;
  font: 600 0.78rem/1 var(--sans);
  letter-spacing: 0.34em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

/* Cookie, a brush script with one upright weight. The italic is for the serif,
   should Cookie not load; Cookie itself is never slanted or thickened. */
.hero__title {
  margin: 0.18em 0 0.28em;
  font-family: var(--script);
  font-size: clamp(3.1rem, 7.4vw, 6.3rem);
  font-style: italic;
  font-weight: 500;
  font-synthesis: none;
  line-height: 0.98;
  letter-spacing: 0; /* any spacing pulls a script's joined letters apart */
}

.hero__title .word {
  display: inline-block;
  white-space: nowrap;
}

.hero__title .letter {
  display: inline-block;
}

.hero__lede {
  max-width: 26rem;
  margin: 0 0 1.6em;
  font-size: clamp(1.25rem, 2vw, 1.5rem);
  color: var(--ink-soft);
}

/* The buttons rise in together (the row has data-rise, not each button, so
   their own hover movements keep their own timing). */
.hero__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 14px;
}

/* "View the garden" carries a little stained-glass window. Point at it and
   the light comes through, pane by pane: sky, then leaves, then the poppy. */
.button__glass {
  flex: none;
  width: 17px;
  height: 21px;
  margin: -2px 0 0 -6px;
}

.button__lead {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linejoin: round;
}

.button__pane {
  opacity: 0.4;
  transition: opacity 0.5s var(--ease-out);
}

.button__pane--sky {
  fill: #7fa6d1;
}

.button__pane--sky-light {
  fill: #a9c6e3;
  transition-delay: 0.06s;
}

.button__pane--leaf {
  fill: #5f8a3c;
  transition-delay: 0.12s;
}

.button__pane--leaf-light {
  fill: #86a957;
  transition-delay: 0.18s;
}

.button__pane--poppy {
  fill: var(--poppy);
  transition-delay: 0.26s;
}

.button--garden:hover .button__pane,
.button--garden:focus-visible .button__pane {
  opacity: 1;
}

.hero__art {
  position: relative;
  z-index: 1;
  justify-self: center;
  width: min(100%, 560px);
  margin: 0;
}

.hero__art figcaption {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 16px;
  font: 500 0.8rem/1.3 var(--sans);
  color: var(--ink-soft);
}

.hero__art figcaption a {
  color: var(--ink);
  font: italic 500 1.15rem/1.2 var(--serif);
  text-decoration: none;
}

.hero__art figcaption a:hover {
  color: var(--poppy);
}

.hero__petals {
  position: absolute;
  inset: 0;
  z-index: 3;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

@media (max-width: 860px) {
  .hero {
    grid-template-columns: 1fr;
    min-height: 0;
    padding-top: 8px;
  }

  .hero__art {
    width: min(100%, 460px);
  }
}

/* A painting in its frame: a mat, a soft shadow, and a slow drift inside. */
.frame {
  position: relative;
  display: block;
  padding: clamp(12px, 2.1vw, 24px);
  border-radius: 2px;
  background: var(--mat);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.9) inset,
    0 44px 80px -34px rgba(42, 26, 28, 0.5),
    0 14px 26px -14px rgba(42, 26, 28, 0.32);
}

.frame__window {
  position: relative;
  overflow: hidden;
  background: var(--paper-deep);
}

.frame__window img {
  display: block;
  width: 100%;
  height: auto;
  transform-origin: 62% 38%;
  animation: drift 28s ease-in-out infinite alternate;
}

/* Now and then, light moves across the varnish. */
.frame__window::after {
  content: '';
  position: absolute;
  inset: -40%;
  background: linear-gradient(105deg, transparent 43%, rgba(255, 250, 238, 0.32) 50%, transparent 57%);
  transform: translateX(-70%);
  animation: sheen 10s ease-in-out 3s infinite;
  pointer-events: none;
}

@keyframes drift {
  from {
    transform: scale(1);
  }
  to {
    transform: scale(1.065) translate(-1.2%, 0.8%);
  }
}

@keyframes sheen {
  0% {
    transform: translateX(-70%);
  }
  24%,
  100% {
    transform: translateX(70%);
  }
}

/* ─── Arriving: the hero animates in as the window opens ─────────────────── */

.js-motion:not(.is-open) .hero__title .letter {
  opacity: 0;
  transform: translateY(0.5em) rotate(5deg);
}

.js-motion .hero__title .letter {
  transition:
    opacity 0.9s var(--ease-out),
    transform 1.2s var(--ease-out);
  transition-delay: calc(var(--n) * 40ms + 150ms);
}

.js-motion:not(.is-open) [data-rise] {
  opacity: 0;
  transform: translateY(18px);
}

.js-motion [data-rise] {
  transition:
    opacity 1s var(--ease-out),
    transform 1.1s var(--ease-out);
  transition-delay: calc(var(--d, 0) * 1ms);
}

.js-motion:not(.is-open) .hero__art {
  opacity: 0;
  transform: translateY(34px) scale(0.965);
}

.js-motion .hero__art {
  transition:
    opacity 1.5s var(--ease-out) 0.35s,
    transform 1.7s var(--ease-out) 0.35s;
}

/* ─── Butterflies ─────────────────────────────────────────────────────────── */

/* One canvas over the whole window (js/shop/butterflies/), which clicks pass
   straight through. Above the header, below the toast. While a painting is
   open it moves into the dialog, so they can fly over that too. */
.butterflies {
  position: fixed;
  inset: 0;
  z-index: 60;
  width: 100%;
  height: 100%;
  pointer-events: none;
  /* While the cards glide (the All / Available filter's view transition), each
     card is drawn as a layer of its own above the page. The butterflies get
     their own layer too, drawn after the cards' (it's later in the page), and
     shown live: no frozen copy of them cross-fading with the moving ones. */
  view-transition-name: butterflies;
}

::view-transition-group(butterflies),
::view-transition-new(butterflies) {
  animation: none;
}

::view-transition-old(butterflies) {
  display: none;
}

/* On paper they'd be stretched to the page's shape, over the paintings.
   (Hidden, not removed: the canvas keeps its size, so the flock isn't disturbed.) */
@media print {
  .butterflies,
  .hero__petals {
    visibility: hidden;
  }
}

/* ─── Section headings, with a poppy that draws itself ───────────────────── */

.section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 10px 24px;
  margin-bottom: clamp(26px, 4vw, 52px);
}

.section-head__title {
  margin: 0;
  font-size: clamp(2.2rem, 4.2vw, 3.3rem);
  font-style: italic;
  font-weight: 500;
  line-height: 1;
}

.drawn-poppy {
  flex: none;
  width: 104px;
  height: 52px;
}

.drawn-poppy path {
  fill: none;
  stroke: var(--poppy);
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.js-motion .drawn-poppy path {
  stroke-dasharray: var(--length, 300);
  stroke-dashoffset: var(--length, 300);
  transition: stroke-dashoffset 1.9s var(--ease-out);
  transition-delay: calc(var(--k, 0) * 220ms);
}

.js-motion .drawn-poppy.is-drawn path {
  stroke-dashoffset: 0;
}

/* ─── Filter: all / available ─────────────────────────────────────────────── */

.filters {
  position: relative;
  display: inline-flex;
  margin-left: auto;
  padding: 4px;
  border-radius: 999px;
  background: rgba(42, 26, 28, 0.06);
}

.filters__thumb {
  position: absolute;
  top: 4px;
  bottom: 4px;
  left: var(--x, 4px);
  width: var(--w, 0);
  border-radius: 999px;
  background: var(--mat);
  box-shadow: 0 2px 10px rgba(42, 26, 28, 0.12);
  transition:
    left 0.5s var(--ease-spring),
    width 0.5s var(--ease-spring);
}

.filters__button {
  position: relative;
  z-index: 1;
  min-height: 38px;
  padding: 0 18px;
  border: 0;
  border-radius: 999px;
  background: none;
  color: var(--ink-soft);
  font: 600 0.75rem/1 var(--sans);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  cursor: pointer;
  transition: color 0.3s;
}

.filters__button[aria-pressed='true'] {
  color: var(--ink);
}

/* ─── The collection ──────────────────────────────────────────────────────── */

.collection {
  max-width: var(--max);
  margin: 0 auto;
  padding: clamp(40px, 8vh, 100px) var(--gutter) clamp(64px, 12vh, 140px);
}

.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 290px), 1fr));
  gap: clamp(34px, 4.5vw, 64px) clamp(22px, 3vw, 44px);
  margin: 0;
  padding: 0;
  list-style: none;
}

.gallery__empty {
  font-size: 1.4rem;
  font-style: italic;
  color: var(--ink-soft);
}

.card__link {
  display: block;
  color: inherit;
  text-decoration: none;
}

.card__link:focus-visible {
  outline: none;
}

/* Each painting sits on a mat, as if hung. Wide or tall, they all line up. */
.card__frame {
  position: relative;
  display: grid;
  /* One cell exactly the size of the mat's inside, so a tall painting is
     shrunk to fit rather than stretching its mat ("min 0" stops the
     content from making the square grow). */
  grid-template: minmax(0, 1fr) / minmax(0, 1fr);
  place-items: center;
  aspect-ratio: 1;
  min-height: 0;
  padding: 10%;
  border-radius: 3px;
  background: linear-gradient(180deg, #fdfbf6, #f3ebde);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.95) inset,
    0 20px 44px -30px rgba(42, 26, 28, 0.55);
  transform: perspective(900px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)) translateY(var(--lift, 0px));
  transition:
    transform 0.6s var(--ease-out),
    box-shadow 0.6s var(--ease-out);
}

.card__frame img {
  display: block;
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  box-shadow:
    0 1px 2px rgba(0, 0, 0, 0.18),
    0 16px 28px -16px rgba(42, 26, 28, 0.6);
  background: var(--paper-deep);
}

/* Light catches the painting where you point at it. */
.card__sheen {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: radial-gradient(circle at var(--mx, 50%) var(--my, 20%), rgba(255, 255, 255, 0.55), transparent 48%);
  mix-blend-mode: soft-light;
  opacity: 0;
  transition: opacity 0.45s;
  pointer-events: none;
}

.card__link:hover .card__frame,
.card__link:focus-visible .card__frame {
  --lift: -8px;
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.95) inset,
    0 34px 60px -32px rgba(42, 26, 28, 0.6);
}

.card__link:hover .card__sheen {
  opacity: 1;
}

.card__link:focus-visible .card__frame {
  outline: 2px solid var(--ink);
  outline-offset: 5px;
}

.card__title {
  margin: 18px 0 2px;
  font-size: 1.5rem;
  font-style: italic;
  font-weight: 500;
  line-height: 1.12;
}

.card__meta {
  margin: 0;
  font: 500 0.78rem/1.45 var(--sans);
  color: var(--ink-soft);
}

.card__price {
  margin: 6px 0 0;
  font-size: 1.2rem;
  font-weight: 600;
}

.card__badge {
  display: inline-block;
  margin-left: 8px;
  padding: 2px 9px;
  border-radius: 999px;
  background: rgba(42, 26, 28, 0.07);
  color: var(--ink-soft);
  font: 600 0.6rem/1.6 var(--sans);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  vertical-align: 0.4em;
}

/* Galleries mark a sold painting with a little red dot. */
.dot {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: radial-gradient(circle at 34% 30%, #ec6650, var(--poppy) 55%, var(--poppy-deep));
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
}

.card.is-in .dot {
  animation: dot-pop 0.7s var(--ease-spring) 0.5s both;
}

@keyframes dot-pop {
  from {
    transform: scale(0);
  }
  to {
    transform: scale(1);
  }
}

/* Someone is paying for it right now: said quietly, beside the price, with
   the gallery's red dot drawn hollow (spoken for, but not sold). */
.reserved {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: 6px;
  color: var(--ink-soft);
  font: 600 0.62rem/1 var(--sans);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  white-space: nowrap;
  vertical-align: 0.2em;
}

.reserved::before {
  content: '';
  flex: none;
  width: 8px;
  height: 8px;
  border: 1.5px solid var(--poppy);
  border-radius: 50%;
}

/* As you scroll, each painting rises into place, one after another. */
.js-motion .card {
  opacity: 0;
  transform: translateY(28px);
  transition:
    opacity 0.9s var(--ease-out),
    transform 1s var(--ease-out);
  transition-delay: calc(var(--i, 0) * 80ms);
}

.js-motion .card.is-in {
  opacity: 1;
  transform: none;
}

.card[hidden] {
  display: none;
}

/* ─── About and contact ───────────────────────────────────────────────────── */

.about,
.contact {
  padding: clamp(56px, 10vh, 120px) var(--gutter);
}

.about {
  background: var(--paper-deep);
}

.about__inner,
.contact {
  max-width: 44rem;
  margin: 0 auto;
}

.about__text p {
  font-size: clamp(1.25rem, 2vw, 1.45rem);
}

.contact {
  text-align: center;
}

.contact .section-head__title {
  margin-bottom: 18px;
}

.contact__text {
  font-size: clamp(1.25rem, 2vw, 1.45rem);
  color: var(--ink-soft);
}

.contact__links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
}

.site-foot {
  padding: 36px var(--gutter) max(36px, env(safe-area-inset-bottom));
  border-top: 1px solid var(--ink-faint);
  color: var(--ink-soft);
  font: 500 0.8rem/1.5 var(--sans);
  text-align: center;
}

.site-foot p {
  margin: 4px 0;
}

/* ─── One painting, up close ─────────────────────────────────────────────── */

.artwork {
  width: min(1200px, 100vw);
  max-width: none;
  height: min(840px, 100dvh);
  max-height: none;
  padding: clamp(0px, 2vw, 24px);
  border: 0;
  background: transparent;
  overflow: visible;
}

.artwork::backdrop {
  background: rgba(30, 22, 18, 0.62);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}

.artwork__panel {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(300px, 1fr);
  height: 100%;
  overflow: hidden;
  border-radius: 16px;
  background: var(--paper);
  box-shadow: 0 50px 140px rgba(0, 0, 0, 0.45);
}

.artwork[open] .artwork__panel {
  animation: panel-in 0.55s var(--ease-out) both;
}

.artwork[open]::backdrop {
  animation: fade-in 0.4s ease both;
}

/* Opened from a card: the painting flies out of its card, so the panel just fades in around it. */
.artwork.is-growing[open] .artwork__panel {
  animation: fade-in 0.28s ease both;
}

@keyframes panel-in {
  from {
    opacity: 0;
    transform: translateY(26px) scale(0.985);
  }
}

@keyframes fade-in {
  from {
    opacity: 0;
  }
}

.artwork__stage {
  position: relative;
  display: grid;
  /* One cell exactly the size of the stage's inside, so a tall painting is
     shrunk to fit it, rather than the cell growing to fit the painting. */
  grid-template: minmax(0, 1fr) / minmax(0, 1fr);
  place-items: center;
  min-height: 0;
  padding: clamp(18px, 4.5vw, 56px);
  overflow: hidden;
  background:
    radial-gradient(70% 60% at 50% 40%, rgba(255, 250, 240, 0.7), transparent 70%),
    #e7dccb;
}

.artwork__img {
  display: block;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  cursor: zoom-in;
  box-shadow:
    0 1px 2px rgba(0, 0, 0, 0.2),
    0 30px 50px -26px rgba(42, 26, 28, 0.7);
}

/* A round magnifying glass that follows the pointer, to see the brushwork. */
.artwork__loupe {
  position: absolute;
  left: 0;
  top: 0;
  width: 200px;
  height: 200px;
  margin: -100px 0 0 -100px;
  border-radius: 50%;
  background-repeat: no-repeat;
  box-shadow:
    0 0 0 3px rgba(255, 255, 255, 0.92),
    0 14px 34px rgba(0, 0, 0, 0.38);
  opacity: 0;
  transform: scale(0.6);
  transition:
    opacity 0.2s,
    transform 0.3s var(--ease-spring);
  pointer-events: none;
}

.artwork__loupe.is-on {
  opacity: 1;
  transform: scale(1);
}

/* More than one photo: the painting above, a strip of small ones beneath. */
.artwork__stage.has-photos {
  grid-template-rows: minmax(0, 1fr) auto;
  row-gap: clamp(14px, 2vh, 22px);
  padding-bottom: clamp(16px, 2.6vh, 28px);
}

.artwork__photos {
  display: flex;
  gap: 12px;
  max-width: 100%;
  padding: 6px; /* room for the ring round the one showing */
  overflow-x: auto;
  scrollbar-width: none;
}

/* Centred. (Should they ever not fit, they start at the left edge and
   scroll, rather than spilling off both sides out of reach.) */
.artwork__photo:first-child {
  margin-left: auto;
}

.artwork__photo:last-child {
  margin-right: auto;
}

/* Each in its own shape, but a very narrow or very wide photo is trimmed to
   something easy to see and to tap; with five wide ones on a small screen,
   they all narrow a little, so they always fit. */
.artwork__photo {
  flex: 0 1 auto;
  min-width: 36px;
  padding: 0;
  border: 0;
  border-radius: 3px;
  background: none;
  cursor: pointer;
  opacity: 0.6;
  transition:
    opacity 0.25s,
    transform 0.35s var(--ease-spring),
    box-shadow 0.25s;
}

.artwork__photo img {
  display: block;
  width: 100%;
  max-width: 112px;
  height: 54px;
  object-fit: cover;
  border-radius: 2px;
  background: var(--paper-deep);
  box-shadow:
    0 1px 2px rgba(0, 0, 0, 0.18),
    0 8px 14px -10px rgba(42, 26, 28, 0.65);
}

.artwork__photo:hover {
  opacity: 1;
  transform: translateY(-2px);
}

/* The one showing: in full colour, ringed like a picture in its mount. */
.artwork__photo[aria-current='true'] {
  opacity: 1;
  box-shadow:
    0 0 0 3px var(--paper),
    0 0 0 4.5px var(--ink);
}

.artwork__info {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: clamp(26px, 3.6vw, 48px);
  overflow-y: auto;
}

.artwork__eyebrow {
  margin: 0;
  font: 600 0.72rem/1 var(--sans);
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.artwork__title {
  margin: 6px 48px 4px 0;
  font-size: clamp(2rem, 3.4vw, 2.8rem);
  font-style: italic;
  font-weight: 500;
  line-height: 1.05;
}

.artwork__meta {
  margin: 0;
  font: 500 0.88rem/1.5 var(--sans);
  color: var(--ink-soft);
}

.artwork__price {
  margin: 14px 0 10px;
  font-size: 1.7rem;
  font-weight: 600;
}

.artwork__price .dot {
  position: relative;
  top: 0;
  right: 0;
  display: inline-block;
  margin-right: 10px;
  vertical-align: 0.05em;
}

.artwork__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 18px;
}

/* While the checkout is being made, the glint keeps running across Buy. */
.button.is-busy {
  cursor: progress;
}

.button--primary.is-busy::after {
  animation: glint 1.5s var(--ease-out) infinite;
}

@keyframes glint {
  from {
    transform: translateX(-120%);
  }
  to {
    transform: translateX(120%);
  }
}

/* In place of Buy while someone else pays: a calm note, not a button. */
.artwork__reserved {
  flex-basis: 100%;
  margin: 0;
  padding: 14px 18px 15px;
  border-radius: 14px;
  background: rgba(42, 26, 28, 0.055);
}

/* These are given the keyboard only when the Buy that had it turns into them
   (Reserved, or Sold): they aren't something to press, so no ring. */
.artwork__reserved:focus,
.artwork__price:focus {
  outline: none;
}

.artwork__reserved strong {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--ink);
  font: 600 0.72rem/1 var(--sans);
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.artwork__reserved strong::before {
  content: '';
  flex: none;
  width: 9px;
  height: 9px;
  border: 1.5px solid var(--poppy);
  border-radius: 50%;
}

.artwork__reserved span {
  display: block;
  margin-top: 7px;
  color: var(--ink-soft);
  font: italic 1.08rem/1.4 var(--serif);
}

.artwork__views {
  display: inline-flex;
  align-self: flex-start;
  gap: 4px;
  padding: 4px;
  border-radius: 999px;
  background: rgba(42, 26, 28, 0.06);
}

.artwork__view {
  min-height: 36px;
  padding: 0 16px;
  border: 0;
  border-radius: 999px;
  background: none;
  color: var(--ink-soft);
  font: 600 0.72rem/1 var(--sans);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  transition:
    background-color 0.3s,
    color 0.3s;
}

.artwork__view[aria-pressed='true'] {
  background: var(--mat);
  color: var(--ink);
  box-shadow: 0 2px 8px rgba(42, 26, 28, 0.12);
}

.artwork__wall-note {
  margin: 8px 0 0;
  font: italic 1rem/1.4 var(--serif);
  color: var(--ink-soft);
}

.artwork__description {
  margin: 18px 0 0;
}

.artwork__share {
  align-self: flex-start;
  margin-top: auto;
  padding: 18px 0 0;
  border: 0;
  background: none;
  color: var(--ink-soft);
  font: 600 0.74rem/1.3 var(--sans);
  letter-spacing: 0.06em;
  text-decoration: underline;
  text-underline-offset: 0.25em;
  cursor: pointer;
}

.artwork__share:hover {
  color: var(--poppy);
}

.artwork__close,
.artwork__step {
  position: absolute;
  z-index: 5;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 50%;
  background: rgba(252, 249, 243, 0.86);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.18);
  cursor: pointer;
  transition:
    transform 0.3s var(--ease-spring),
    background-color 0.2s;
}

.artwork__close:hover,
.artwork__step:hover {
  background: #fff;
  transform: scale(1.08);
}

.artwork__close svg,
.artwork__step svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: var(--ink);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.artwork__close {
  top: 16px;
  right: 16px;
}

.artwork__step {
  top: 50%;
  margin-top: -22px;
}

.artwork__step--prev {
  left: 16px;
}

/* The "next" arrow sits at the right edge of the picture, not of the whole panel. */
.artwork__step--next {
  right: calc(100% / 2.55 + 16px);
}

/* On a wall: the painting at real size above a sofa. */
.wall {
  position: absolute;
  inset: 0;
}

.wall__paint {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(60% 50% at 30% 20%, rgba(255, 246, 228, 0.6), transparent 70%),
    linear-gradient(180deg, #e9ddcb 0%, #dccbb4 var(--floor, 88%), #a98d70 var(--floor, 88%), #94785d 100%);
}

.wall__painting {
  position: absolute;
  box-shadow:
    0 2px 3px rgba(0, 0, 0, 0.18),
    0 22px 34px -16px rgba(50, 30, 18, 0.55);
  transform-origin: 50% -10%;
  animation: hang 1.6s var(--ease-out) both;
}

.wall__painting img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Hung on a nail: it drops into place and swings to rest. */
@keyframes hang {
  0% {
    opacity: 0;
    transform: translateY(-26px) rotate(-6deg);
  }
  30% {
    opacity: 1;
    transform: translateY(0) rotate(4deg);
  }
  55% {
    transform: rotate(-2.2deg);
  }
  78% {
    transform: rotate(1deg);
  }
  100% {
    transform: rotate(0);
  }
}

.wall__sofa {
  position: absolute;
  filter: drop-shadow(0 10px 12px rgba(50, 30, 18, 0.25));
}

@media (max-width: 860px) {
  .artwork {
    width: 100vw;
    height: 100dvh;
    padding: 0;
  }

  .artwork__panel {
    grid-template-columns: 1fr;
    grid-template-rows: 58svh auto;
    border-radius: 0;
    overflow-y: auto;
  }

  .artwork__info {
    overflow: visible;
  }

  .artwork__step--next {
    right: 16px;
  }

  .artwork__step {
    top: 29svh;
  }

  .artwork__loupe {
    display: none;
  }

  .artwork__photos {
    gap: 10px;
  }

  .artwork__photo img {
    height: 44px; /* still big enough for a fingertip */
  }
}

/* ─── A message along the bottom ─────────────────────────────────────────── */

.toast {
  position: fixed;
  left: 50%;
  bottom: max(22px, env(safe-area-inset-bottom));
  z-index: 2000;
  /* As wide as its words need, up to the screen's width: centred from
     halfway across, it would otherwise wrap at half a phone's width. */
  width: max-content;
  max-width: min(560px, calc(100vw - 32px));
  padding: 16px 22px;
  border-radius: 18px;
  background: var(--ink);
  color: #fff;
  font: 500 0.95rem/1.45 var(--sans);
  text-align: center;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.3);
  opacity: 0;
  transform: translate(-50%, 24px);
  transition:
    opacity 0.4s,
    transform 0.5s var(--ease-spring);
}

.toast.is-shown {
  opacity: 1;
  transform: translate(-50%, 0);
}

.toast strong {
  display: block;
  margin-bottom: 2px;
  font: italic 500 1.35rem/1.2 var(--serif);
}

.no-script {
  max-width: 34rem;
  margin: 10vh auto;
  padding: 0 16px;
  font-size: 1.4rem;
  text-align: center;
}

/* ─── Less motion, when asked for ────────────────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .frame__window img,
  .frame__window::after,
  .wall__painting,
  .card.is-in .dot,
  .artwork[open] .artwork__panel,
  .button--primary.is-busy::after {
    animation: none !important;
  }

  .artwork__photo {
    transform: none !important;
  }

  .js-motion .hero__title .letter,
  .js-motion [data-rise],
  .js-motion .hero__art,
  .js-motion .card,
  .js-motion .drawn-poppy path {
    opacity: 1 !important;
    transform: none !important;
    stroke-dashoffset: 0 !important;
    transition: none !important;
  }

  .card__frame {
    transform: none !important;
  }

  .butterflies,
  .hero__petals {
    display: none;
  }
}
