/* The walk through the garden.
 *
 * With the 3D garden (html.garden-3d): the garden fills the screen behind the
 * page, and the page is mostly empty space whose scrolling walks the path.
 * Each painting's label scrolls in as you reach its easel.
 *
 * Without it (html.garden-static: reduced motion, no WebGL, or too slow to
 * load): the same page reads as a simple gallery, one painting after another.
 */

:root {
  --linen: #f3ecdf;
  --paper: rgba(250, 246, 238, 0.88);
  --ink: #2c1a1d;
  --ink-soft: #6b4f45;
  --poppy: #c8321f;
  --poppy-dark: #9e2414;
  --serif: 'Cormorant Garamond', 'Iowan Old Style', 'Palatino Linotype', Palatino, Georgia, serif;
  --sans: system-ui, -apple-system, 'Segoe UI', sans-serif;
}

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

html {
  background: #2f4a22; /* a garden green, if anything ever shows behind the 3D view */
  color: var(--ink);
}

html.garden-3d {
  scroll-snap-type: y proximity; /* settle gently in front of each painting */
}

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

/* ─── The 3D garden, behind the page ──────────────────────────────────────── */

.garden-view {
  position: fixed;
  inset: 0;
  z-index: 0;
  display: block;
  width: 100%;
  height: 100vh;
  height: 100lvh;
}

html:not(.garden-3d) .garden-view {
  display: none;
}

/* ─── The walk ─────────────────────────────────────────────────────────────── */

.tour {
  position: relative;
  z-index: 1;
}

/* How far each stretch of the walk takes to scroll. */
.tour__window {
  height: 170vh;
}

.tour__meadow {
  height: 240vh;
}

.stop__rest {
  position: relative;
  height: 100vh;
  height: 100svh; /* the small viewport, so a phone's toolbar never covers the label */
  scroll-snap-align: start;
}

.stop__walk {
  height: 130vh;
}

.tour__end {
  position: relative;
  min-height: 180vh;
}

/* ─── A painting's label ──────────────────────────────────────────────────── */

.art-card {
  position: absolute;
  left: clamp(16px, 5vw, 76px);
  bottom: clamp(20px, 8vh, 96px);
  width: min(390px, calc(100vw - 32px));
  padding: 22px 24px 20px;
  border-radius: 18px;
  background: var(--paper);
  -webkit-backdrop-filter: blur(12px) saturate(1.15);
  backdrop-filter: blur(12px) saturate(1.15);
  box-shadow: 0 14px 48px rgba(16, 26, 8, 0.28), 0 1px 0 rgba(255, 255, 255, 0.6) inset;
  transition: transform 0.6s cubic-bezier(0.2, 0.7, 0.2, 1), box-shadow 0.6s ease;
}

.stop.is-here .art-card {
  transform: translateY(-4px);
  box-shadow: 0 20px 60px rgba(16, 26, 8, 0.34), 0 1px 0 rgba(255, 255, 255, 0.6) inset;
}

.art-card__image {
  display: none; /* the painting is on its easel; the gallery view shows it here */
}

.art-card__title {
  margin: 0 0 4px;
  font-size: clamp(1.55rem, 2.4vw, 2.05rem);
  font-style: italic;
  font-weight: 500;
  line-height: 1.08;
}

.art-card__meta {
  margin: 0;
  font: 500 0.8rem/1.4 var(--sans);
  letter-spacing: 0.02em;
  color: var(--ink-soft);
}

.art-card__price {
  margin: 12px 0 14px;
  font-size: 1.4rem;
  font-weight: 600;
}

.art-card__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.art-card__buy,
.art-card__view,
.end-card__shop,
.end-card__back {
  display: inline-flex;
  align-items: center;
  min-height: 44px; /* big enough for a fingertip */
  padding: 0 20px;
  border-radius: 999px;
  font: 600 0.8rem/1 var(--sans);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease;
}

.art-card__buy,
.end-card__shop {
  border: 0;
  background: var(--poppy);
  color: #fff;
}

.art-card__buy:hover,
.end-card__shop:hover {
  background: var(--poppy-dark);
}

.art-card__view,
.end-card__back {
  border: 1px solid rgba(44, 26, 29, 0.25);
  background: rgba(255, 255, 255, 0.5);
  color: var(--ink);
}

.art-card__view:hover,
.end-card__back:hover {
  background: rgba(255, 255, 255, 0.9);
}

:is(.art-card__buy, .art-card__view, .end-card__shop, .end-card__back, .art-viewer__close):focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 3px;
}

.art-card__badge {
  display: inline-block;
  margin-left: 8px;
  padding: 3px 9px;
  border-radius: 999px;
  vertical-align: 0.35em;
  font: 600 0.62rem/1.4 var(--sans);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  background: rgba(44, 26, 29, 0.08);
  color: var(--ink-soft);
}

.art-card__badge--sold {
  background: rgba(200, 50, 31, 0.12);
  color: var(--poppy-dark);
}

.art-card__note {
  margin: 14px 0 0;
  font: italic 0.95rem/1.35 var(--serif);
  color: var(--ink-soft);
}

/* While Stripe's page is being made. */
.art-card__buy.is-busy {
  cursor: progress;
  background: var(--poppy-dark);
}

/* In place of Buy while someone else pays: a quiet label, not a button,
   with the gallery's red dot drawn hollow (spoken for, but not sold). */
.art-card__reserved {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 16px 0 4px;
  color: var(--ink-soft);
  font: 600 0.8rem/1 var(--sans);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

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

/* What Buy has to say: someone else is paying, it has just sold… */
.art-card__said {
  margin: 12px 0 0;
  font: italic 1rem/1.35 var(--serif);
  color: var(--ink-soft);
}

.art-card__said:empty {
  margin: 0; /* nothing to say: no gap (it stays on the page, so its words are read out when they come) */
}

@media (max-width: 700px) {
  .art-card {
    left: max(12px, env(safe-area-inset-left));
    right: max(12px, env(safe-area-inset-right));
    bottom: max(12px, env(safe-area-inset-bottom));
    width: auto;
    padding: 16px 18px;
  }

  .art-card__price {
    margin: 8px 0 12px;
  }
}

/* ─── The end of the walk ─────────────────────────────────────────────────── */

.end-card {
  position: absolute;
  left: 50%;
  bottom: clamp(24px, 12vh, 140px);
  width: min(520px, calc(100vw - 32px));
  padding: 26px 28px;
  border-radius: 18px;
  background: var(--paper);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  box-shadow: 0 14px 48px rgba(16, 26, 8, 0.28);
  text-align: center;
  transform: translateX(-50%);
}

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

.end-card__title {
  margin: 10px 0 6px;
  font-size: clamp(1.7rem, 3.4vw, 2.4rem);
  font-style: italic;
  font-weight: 500;
  line-height: 1.1;
}

.end-card__text {
  margin: 0 0 18px;
}

.end-card__actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
}

/* ─── The way back to the shop ────────────────────────────────────────────── */

/* A small frosted pill in the top corner, the same as the window's "Skip intro",
   so it sits as happily on the glass as on the garden. */
.garden-home {
  position: fixed;
  top: max(14px, env(safe-area-inset-top));
  left: max(14px, env(safe-area-inset-left));
  z-index: 1100; /* above the window (1000) */
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 40px;
  padding: 0 16px 0 11px;
  border: 1px solid rgba(44, 26, 29, 0.18);
  border-radius: 999px;
  background: rgba(250, 244, 233, 0.62);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  box-shadow: 0 6px 18px -10px rgba(16, 26, 8, 0.45);
  color: #3b2a26;
  font: 600 0.72rem/1 var(--sans);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  text-decoration: none;
  animation: garden-home-appear 0.6s ease 0.5s both;
  transition: background-color 0.2s ease;
}

.garden-home svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform 0.3s cubic-bezier(0.2, 0.7, 0.2, 1);
}

.garden-home:hover {
  background: rgba(250, 244, 233, 0.92);
}

.garden-home:hover svg {
  transform: translateX(-3px);
}

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

@keyframes garden-home-appear {
  from {
    opacity: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .garden-home {
    animation: none;
  }
}

/* ─── A closer look at a painting ─────────────────────────────────────────── */

.art-viewer {
  max-width: min(1200px, 94vw);
  max-height: 94vh;
  padding: 0;
  border: 0;
  border-radius: 10px;
  background: #1d1a17;
  color: #f4efe6;
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.5);
}

.art-viewer::backdrop {
  background: rgba(12, 14, 8, 0.72);
}

.art-viewer__image {
  display: block;
  max-width: 100%;
  max-height: calc(94vh - 64px);
  margin: 0 auto;
}

.art-viewer__caption {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 16px;
}

.art-viewer__title {
  margin: 0;
  font-size: 1.25rem;
  font-style: italic;
  font-weight: 500;
}

.art-viewer__close {
  min-height: 40px;
  padding: 0 16px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 999px;
  background: transparent;
  color: inherit;
  font: 600 0.75rem/1 var(--sans);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
}

/* ─── The simple gallery (no 3D garden) ───────────────────────────────────── */

html.garden-static {
  background: var(--linen);
}

html.garden-static .tour__window {
  height: 100vh;
}

html.garden-static .tour__meadow,
html.garden-static .stop__walk {
  height: 0;
}

html.garden-static .stop__rest {
  height: auto;
  padding: 7vh 16px;
}

html.garden-static .art-card {
  position: static;
  width: min(760px, 100%);
  margin: 0 auto;
  transform: none;
}

html.garden-static .art-card__image {
  display: block;
  width: 100%;
  height: auto;
  margin: 0 0 18px;
  border-radius: 6px;
  box-shadow: 0 10px 30px rgba(44, 26, 29, 0.2);
}

html.garden-static .tour__end {
  min-height: 0;
  padding: 8vh 16px 12vh;
}

html.garden-static .end-card {
  position: static;
  margin: 0 auto;
  transform: none;
}

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