/* ════════════════════════════════════════════════════════
   MaisonVoxel — homepage sections (load after site.css)
   Signature: the hero photo sits in an arched niche and opens
   slat by slat on load — the page's only ambient motion.
   ════════════════════════════════════════════════════════ */

/* ── Section scaffolding ─────────────────────────────── */
.collection, .story, .made, .viz {
  padding: clamp(4.5rem, 10vw, 9rem) var(--gutter);
}
.collection > *, .story, .made > *, .viz > * {
  max-width: var(--max);
  margin-inline: auto;
}
.story { max-width: calc(var(--max) + 2 * var(--gutter)); }

/* ── Hero (homepage specifics) ───────────────────────── */
.hero__title { max-width: 11.5ch; } /* "Let your walls / grow wild." — no descender over an ascender */
.hero__colours {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: clamp(2rem, 4vw, 3rem);
  font-size: 0.9375rem;
  color: var(--moss);
}
.swatches { display: inline-flex; }
.swatches .swatch { width: 1.1rem; height: 1.1rem; box-shadow: 0 0 0 2px var(--plaster), inset 0 0 0 1px rgba(40,51,31,0.25); }
.swatches .swatch + .swatch { margin-left: -0.3rem; }

/* Slats: plaster strips that lift away one after another,
   like opening a slat wall — the page's single load moment. */
.hero__slats {
  position: absolute; inset: 0;
  display: flex;
  pointer-events: none;
}
.hero__slats i {
  flex: 1;
  background: var(--linen);
  box-shadow: 1px 0 0 var(--linen); /* hide sub-pixel seams between strips */
  transform-origin: top;
  animation: slat-open 1.1s var(--ease) both;
}
/* With JS, the slats stay shut until site.js says the photo is ready */
.js .hero__arch:not(.is-ready) .hero__slats i { animation-play-state: paused; }
.hero__slats i:nth-child(1)  { animation-delay: 0.15s; }
.hero__slats i:nth-child(2)  { animation-delay: 0.21s; }
.hero__slats i:nth-child(3)  { animation-delay: 0.27s; }
.hero__slats i:nth-child(4)  { animation-delay: 0.33s; }
.hero__slats i:nth-child(5)  { animation-delay: 0.39s; }
.hero__slats i:nth-child(6)  { animation-delay: 0.45s; }
.hero__slats i:nth-child(7)  { animation-delay: 0.51s; }
.hero__slats i:nth-child(8)  { animation-delay: 0.57s; }
.hero__slats i:nth-child(9)  { animation-delay: 0.63s; }
.hero__slats i:nth-child(10) { animation-delay: 0.69s; }
.hero__slats i:nth-child(11) { animation-delay: 0.75s; }
.hero__slats i:nth-child(12) { animation-delay: 0.81s; }
@keyframes slat-open {
  from { transform: scaleY(1); }
  to   { transform: scaleY(0); }
}

/* ── Collection ──────────────────────────────────────── */
.pots {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(1.25rem, 3vw, 2.5rem);
}
.pot { display: flex; flex-direction: column; align-items: flex-start; }
.pot img {
  width: 100%;
  aspect-ratio: 1200 / 1490;
  object-fit: cover;
  border-radius: var(--radius);
  background: var(--linen);
}
.pot h3 {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-top: 1.25rem;
}
.pot p { margin-top: 0.4rem; color: var(--moss); max-width: 34ch; }
.pot .link { margin-top: auto; padding-top: 0.9rem; }

.extras {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(1.25rem, 3vw, 2.5rem);
  margin-top: clamp(3.5rem, 7vw, 6rem);
  padding-top: clamp(2.5rem, 5vw, 4rem);
  border-top: 1px solid var(--line);
}
.extra {
  display: grid;
  grid-template-columns: minmax(0, 0.8fr) minmax(0, 1fr);
  gap: clamp(1.25rem, 2.5vw, 2rem);
  align-items: start;
}
.extra__text { padding-top: clamp(0.5rem, 2vw, 1.5rem); }
.extra img {
  width: 100%;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  border-radius: var(--radius);
}
.extra p { margin-top: 0.6rem; color: var(--moss); }
.extra .link { margin-top: 1rem; }

/* ── Why the wall ────────────────────────────────────── */
.story {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr);
  gap: clamp(2rem, 6vw, 6rem);
  align-items: center;
  padding-top: 0;
}
.story__img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: var(--radius);
}
.story__copy p { margin-top: 1.5rem; color: var(--moss); max-width: 42ch; }

/* ── How it's made ───────────────────────────────────── */
.made { background: var(--linen); }
.made__media {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
  gap: clamp(1.25rem, 3vw, 2.5rem) clamp(2rem, 6vw, 6rem);
  align-items: end;
}
.made__media img {
  width: 100%;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  border-radius: var(--radius);
}
.made__media figcaption {
  margin-top: 0.75rem;
  text-wrap: pretty;
  font-size: 0.875rem;
  color: var(--moss);
}

/* ── Try it on your wall ─────────────────────────────── */
.viz__app {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr);
  gap: clamp(1.25rem, 3vw, 2.5rem);
  align-items: start;
}
.viz__stage {
  position: relative;
  min-height: clamp(20rem, 40vw, 34rem);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.viz__drop {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  width: 100%;
  min-height: inherit;
  padding: 3rem 2rem;
  text-align: center;
  cursor: pointer;
  border: 1.5px dashed transparent;
  border-radius: var(--radius);
  transition: background-color 0.25s, border-color 0.25s;
}
.viz__drop:hover, .viz__drop.is-drag, .viz__drop:focus-visible { background: var(--linen); border-color: var(--forest); }
.viz__drop:focus-visible { outline-offset: -6px; }
.viz__drop-icon {
  width: 3rem; height: 3rem;
  margin-bottom: 0.5rem;
  border-radius: 50%;
  background: var(--forest);
  position: relative;
}
.viz__drop-icon::before, .viz__drop-icon::after {
  content: "";
  position: absolute; left: 50%; top: 50%;
  width: 1.1rem; height: 2px;
  background: var(--plaster);
  translate: -50% -50%;
}
.viz__drop-icon::after { rotate: 90deg; }
.viz__drop strong {
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 2.6vw, 2rem);
  font-weight: 500;
  line-height: 1.15;
}
.viz__drop-or { font-size: 0.9375rem; color: var(--moss); }

.viz__preview { position: absolute; inset: 0; }
.viz__preview img { width: 100%; height: 100%; object-fit: contain; }
.viz__change {
  position: absolute; left: 1rem; bottom: 1rem;
  min-height: 2.5rem;
  padding: 0.5rem 1rem;
  border-radius: 999px;
  background: var(--paper);
  border: 1px solid var(--line);
  font-size: 0.875rem;
  font-weight: 500;
}
.viz__change:hover { border-color: var(--forest); }

.viz__loading {
  position: absolute; inset: 0;
  z-index: 3;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.25rem;
  background: rgba(251, 249, 244, 0.92);
}
.viz__loading-bar {
  width: 10rem; height: 3px;
  border-radius: 3px;
  background: linear-gradient(90deg, transparent, var(--forest), transparent) 0 0 / 40% 100% no-repeat, var(--line);
  animation: loading-sweep 1.4s ease-in-out infinite;
}
@keyframes loading-sweep {
  from { background-position: -40% 0, 0 0; }
  to   { background-position: 140% 0, 0 0; }
}
.viz__loading p { font-size: 0.9375rem; color: var(--moss); }
.viz__loading .viz__loading-note { font-size: 0.8125rem; margin-top: -0.75rem; }

.viz__result { width: 100%; }
.ba {
  position: relative;
  width: 100%;
  aspect-ratio: 3 / 2;
  max-height: 70vh;
  overflow: hidden;
  user-select: none;
  touch-action: pan-y;
  background: var(--linen);
}
.ba img {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: contain;
  pointer-events: none;
}
.ba__before-wrap { position: absolute; inset: 0; clip-path: inset(0 50% 0 0); }
.ba--intro .ba__before-wrap { animation: ba-peek 2.6s var(--ease) 0.4s; }
.ba--intro .ba__handle { animation: ba-peek-handle 2.6s var(--ease) 0.4s; }
@keyframes ba-peek {
  0%, 100% { clip-path: inset(0 50% 0 0); }
  32% { clip-path: inset(0 24% 0 0); }
  72% { clip-path: inset(0 76% 0 0); }
}
@keyframes ba-peek-handle {
  0%, 100% { left: 50%; }
  32% { left: 76%; }
  72% { left: 24%; }
}
.ba__handle {
  position: absolute;
  top: 0; bottom: 0; left: 50%;
  width: 2px;
  translate: -50% 0;
  background: var(--paper);
  cursor: ew-resize;
}
.ba__handle::after {
  content: "";
  position: absolute; top: 50%; left: 50%;
  width: 2.75rem; height: 2.75rem;
  translate: -50% -50%;
  border-radius: 50%;
  background: var(--paper);
  box-shadow: 0 4px 18px rgba(40, 51, 31, 0.25);
  /* two small chevrons: ‹ on the left, › on the right */
  background-image:
    linear-gradient(135deg, transparent 46%, var(--forest) 46% 54%, transparent 54%),
    linear-gradient(45deg, transparent 46%, var(--forest) 46% 54%, transparent 54%),
    linear-gradient(45deg, transparent 46%, var(--forest) 46% 54%, transparent 54%),
    linear-gradient(135deg, transparent 46%, var(--forest) 46% 54%, transparent 54%);
  background-size: 0.5rem 0.5rem;
  background-position:
    0.6rem calc(50% - 0.25rem), 0.6rem calc(50% + 0.25rem),
    calc(100% - 0.6rem) calc(50% - 0.25rem), calc(100% - 0.6rem) calc(50% + 0.25rem);
  background-repeat: no-repeat;
}
.ba__range {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  margin: 0;
  opacity: 0;
  cursor: ew-resize;
  pointer-events: none; /* pointer dragging stays on .ba; this is for keyboards */
}
.ba__range:focus-visible ~ .ba__handle::after { outline: 2px solid var(--forest); outline-offset: 3px; }
.ba__tag {
  position: absolute; top: 0.9rem;
  padding: 0.3rem 0.7rem;
  border-radius: 999px;
  background: rgba(251, 249, 244, 0.9);
  font-size: 0.8125rem;
  font-weight: 500;
}
.ba__tag--before { left: 0.9rem; }
.ba__tag--after { right: 0.9rem; }
.viz__result-actions { display: flex; flex-wrap: wrap; gap: 0.75rem; padding: 1rem; }
.viz__scale-note { padding: 0 1rem 1rem; font-size: 0.8125rem; color: var(--moss); }

.viz__side {
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
  padding: clamp(1.25rem, 2.5vw, 2rem);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.viz__step {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  font-weight: 500;
}
.viz__step span {
  display: inline-grid;
  place-items: center;
  width: 1.75rem; height: 1.75rem;
  flex: none;
  border-radius: 50%;
  border: 1px solid var(--forest);
  font-size: 0.8125rem;
}
.viz__finishes { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.6rem; }
.finish {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 0.4rem 0.4rem 0.6rem;
  border-radius: var(--radius);
  border: 1.5px solid var(--line);
  text-align: center;
  font-size: 0.875rem;
  font-weight: 500;
  transition: border-color 0.2s, background-color 0.2s;
}
.finish img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 4px; }
.finish:hover { border-color: var(--moss); }
.finish.is-active { border-color: var(--forest); background: var(--linen); }
.viz__error {
  font-size: 0.9375rem;
  color: #8c2f1b;
  border-left: 2px solid #8c2f1b;
  padding-left: 0.75rem;
}
.viz__quota { font-size: 0.8125rem; color: var(--moss); }
.viz__privacy { font-size: 0.8125rem; color: var(--moss); }

/* ════ Responsive ════════════════════════════════════ */
@media (min-width: 861px) and (max-height: 700px) {
  .hero__colours { margin-top: 1.5rem; }
}

@media (max-width: 1080px) {
  .extras { grid-template-columns: 1fr; }
  .extra { grid-template-columns: minmax(0, 0.6fr) minmax(0, 1fr); }
}

@media (max-width: 860px) {
  .story { grid-template-columns: 1fr; }
  .viz__app { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .pots {
    grid-template-columns: none;
    grid-auto-flow: column;
    grid-auto-columns: min(78vw, 20rem);
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scroll-padding-inline: var(--gutter);
    margin-inline: calc(var(--gutter) * -1);
    padding-inline: var(--gutter);
    padding-bottom: 0.5rem;
    scrollbar-width: none;
  }
  .pots::-webkit-scrollbar { display: none; }
  .pot { scroll-snap-align: start; }
  .extra { grid-template-columns: minmax(0, 0.75fr) minmax(0, 1fr); align-items: start; }
  .extra h3 { font-size: 1.4rem; }
  .made__media { grid-template-columns: 1fr; }
  .made__macro { width: 72%; justify-self: end; }
}

@media (forced-colors: active) {
  .finish.is-active { outline: 3px solid Highlight; outline-offset: -3px; }
}

@media (prefers-reduced-motion: reduce) {
  .hero__slats { display: none; }
  .ba--intro .ba__before-wrap, .ba--intro .ba__handle { animation: none; }
  .viz__loading-bar { animation-duration: 3s; }
}
