/* Home page. The hero is the one loud thing: a kraft box net on a green
   cutting mat that folds up on scroll. Everything below stays quiet on the
   page's own background. */

:root {
  --font-display: "Archivo", var(--font-family);
  /* Space-black hero with a cool-white grid room. Same in both themes. */
  --mat: #000000;
  --glow: 225, 232, 255;
  --mat-text: #f2efe7;
  --mat-text-subtle: rgba(242, 239, 231, 0.74);
  --kraft-out: #bb8d5c;
  --kraft-in: #d2ab7e;
  --kraft-edge: #8d6238;
  --kraft-ink: #24532f;
}

/* Every block sits on an opaque background (no globe on the home page, but
   the body is still transparent). */
.fold,
.bulk,
.aim,
.home-picks,
.faq {
  background-color: var(--color-bg-base);
}

.landing-heading {
  font-family: var(--font-display);
  font-stretch: 108%;
  font-weight: 750;
  font-size: clamp(28px, 1.2rem + 1.6vw, 44px);
  line-height: 1.08;
  letter-spacing: -0.015em;
  margin: 0 0 20px;
  max-width: 22ch;
  text-wrap: balance;
}

.landing-text {
  font-size: 16px;
  line-height: 1.6;
  color: var(--color-fg-subtle);
  margin: 0 0 16px;
  max-width: 62ch;
}

/* ---------- Hero: the folding box ---------- */

.fold {
  background-color: var(--mat);
  color: var(--mat-text);
  position: relative;
}

/* home.js adds .is-scrubbed when motion is allowed: the section grows tall
   and the stage sticks while the scroll position drives the fold. */
.fold.is-scrubbed {
  height: 260vh;
}

.fold__sticky {
  position: relative;
  min-height: 600px;
  overflow: hidden;
}

/* The grid room behind the box is drawn on a canvas by home.js -- the same
   room in CSS 3D (five huge masked planes) was too heavy and broke
   rendering in Chrome. */
.grid-room {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.fold__layout {
  position: relative;
}

.fold.is-scrubbed .fold__sticky {
  position: sticky;
  top: var(--nav-height);
  height: calc(100svh - var(--nav-height));
}

.fold__layout {
  height: 100%;
  display: grid;
  grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.05fr);
  align-items: center;
  gap: 32px;
}

.fold__copy {
  padding-block: 64px;
  position: relative;
  z-index: 1;
}

.fold__title {
  font-family: var(--font-display);
  font-stretch: 112%;
  font-weight: 820;
  font-size: clamp(40px, 1rem + 3.9vw, 80px);
  line-height: 0.98;
  letter-spacing: -0.02em;
  margin: 0 0 24px;
  max-width: 13ch;
  text-wrap: balance;
}

.fold__lede {
  font-size: 18px;
  line-height: 1.55;
  color: var(--mat-text-subtle);
  margin: 0 0 32px;
  max-width: 40ch;
}

.fold__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.fold__secondary {
  color: var(--mat-text);
  border: 1px solid rgba(242, 239, 231, 0.4);
}
.fold__secondary:hover {
  background-color: rgba(242, 239, 231, 0.1);
}

.fold .button:focus-visible,
.fold__label:focus-visible {
  outline: 2px solid var(--mat-text);
  outline-offset: 3px;
}

.fold__stage {
  position: relative;
  height: 100%;
  min-height: 520px;
  perspective: 1500px;
  perspective-origin: 50% 20%;
}

/* Fold progress, 0 = flat net, 1 = done. These defaults are the finished
   state; home.js overwrites them while scrolling. */
.box-scene {
  --tilt: 58deg;
  --spin: 32deg;
  --f-left: 1;
  --f-right: 1;
  --f-front: 1;
  --f-back: 1;
  --lid: 1;
  --marks: 0;
  --rise-cup: 1;
  --rise-bowl: 1;
  --rise-cutlery: 1;
  --s: 1;
  --W: 240px;
  --D: 170px;
  --H: 96px;

  position: absolute;
  left: 50%;
  top: 56%;
  width: 0;
  height: 0;
  transform-style: preserve-3d;
  transform: scale(var(--s)) rotateX(var(--tilt)) rotateZ(var(--spin));
}

.panel {
  position: absolute;
  transform-style: preserve-3d;
}

.face {
  position: absolute;
  inset: 0;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  overflow: hidden;
}

.face--in {
  background-color: var(--kraft-in);
}

.face--out {
  background-color: var(--kraft-out);
  box-shadow: inset 0 0 0 1px var(--kraft-edge);
}

/* Fake light: walls darken a little as they turn away from the top-down
   light. An overlay, not filter -- filter flattens preserve-3d. */
.face::after {
  content: "";
  position: absolute;
  inset: 0;
  background-color: #2a1a0b;
  opacity: var(--shade, 0);
  pointer-events: none;
}

/* Dieline marks on the flat net: dashed crease lines along every hinge,
   fading out as the box folds. */
.face--in::before {
  content: "";
  position: absolute;
  inset: 0;
  opacity: var(--marks);
  pointer-events: none;
}

.panel--base > .face--in::before {
  border: 1.5px dashed var(--kraft-edge);
}

.panel--front > .face--in::before { border-top: 1.5px dashed var(--kraft-edge); }
.panel--back > .face--in::before { border-block: 1.5px dashed var(--kraft-edge); }
.panel--lid > .face--in::before { border-top: 1.5px dashed var(--kraft-edge); }
.panel--left > .face--in::before { border-right: 1.5px dashed var(--kraft-edge); }
.panel--right > .face--in::before { border-left: 1.5px dashed var(--kraft-edge); }

.panel--base {
  width: var(--W);
  height: var(--D);
  left: calc(var(--W) / -2);
  top: calc(var(--D) / -2);
  box-shadow: 0 0 60px 6px rgba(var(--glow), calc(0.05 + 0.07 * var(--f-front)));
}

.panel--front {
  top: 100%;
  left: 0;
  width: var(--W);
  height: var(--H);
  transform-origin: 50% 0;
  transform: rotateX(calc(var(--f-front) * 90deg));
  --shade: calc(var(--f-front) * 0.1);
}

.panel--back {
  bottom: 100%;
  left: 0;
  width: var(--W);
  height: var(--H);
  transform-origin: 50% 100%;
  transform: rotateX(calc(var(--f-back) * -90deg));
  --shade: calc(var(--f-back) * 0.16);
}

/* Lid hangs off the back wall's top edge; open, it leans back past upright. */
.panel--lid {
  bottom: 100%;
  left: 0;
  width: var(--W);
  height: var(--D);
  transform-origin: 50% 100%;
  transform: rotateX(calc(var(--lid) * 28deg));
  --shade: 0.04;
}

.panel--tuck {
  bottom: 100%;
  left: 6px;
  width: calc(var(--W) - 12px);
  height: 30px;
  border-radius: 10px 10px 0 0;
  transform-origin: 50% 100%;
  transform: rotateX(calc(var(--lid) * -24deg));
}
.panel--tuck > .face {
  border-radius: inherit;
}

.panel--left,
.panel--right {
  top: 0;
  width: var(--H);
  height: var(--D);
}

.panel--left {
  right: 100%;
  transform-origin: 100% 50%;
  transform: rotateY(calc(var(--f-left) * 90deg));
  --shade: calc(var(--f-left) * 0.2);
}

.panel--right {
  left: 100%;
  transform-origin: 0 50%;
  transform: rotateY(calc(var(--f-right) * -90deg));
  --shade: calc(var(--f-right) * 0.06);
}

/* Outer faces: flipped so the print reads upright once the wall stands. */
.panel--front > .face--out,
.panel--back > .face--out,
.panel--lid > .face--out,
.panel--tuck > .face--out {
  transform: rotateX(180deg);
}

.panel--left > .face--out,
.panel--right > .face--out {
  transform: rotateY(180deg);
}

.print {
  position: absolute;
  color: var(--kraft-ink);
  font-family: var(--font-display);
  white-space: nowrap;
}

.print--brand {
  left: 18px;
  top: 16px;
  font-size: 30px;
  font-weight: 850;
  font-stretch: 118%;
  letter-spacing: -0.02em;
}

.print--spec {
  left: 19px;
  bottom: 14px;
  font-size: 12px;
  font-weight: 600;
  font-stretch: 100%;
}

.print--arrows {
  left: 50%;
  top: 50%;
  font-size: 26px;
  font-weight: 700;
  letter-spacing: 2px;
}

.panel--left .print--arrows {
  transform: translate(-50%, -50%) rotate(90deg);
}

.panel--right .print--arrows {
  transform: translate(-50%, -50%) rotate(-90deg);
}

/* Items stand up out of the box as billboards: counter-rotated against the
   scene so they always face the viewer. */
.item {
  position: absolute;
  left: 50%;
  top: 50%;
  transform-origin: 50% 100%;
  transform:
    translate3d(-50%, -100%, 0)
    translate3d(var(--x), 0, calc(var(--rise) * var(--lift)))
    rotateZ(calc(var(--spin) * -1))
    rotateX(calc(var(--tilt) * -1));
  opacity: clamp(0, calc(var(--rise) * 3), 1);
}

.item svg {
  display: block;
  filter: drop-shadow(0 10px 8px rgba(0, 0, 0, 0.22));
}

.item--cup {
  --rise: var(--rise-cup);
  --x: calc(var(--rise) * -86px);
  --lift: 150px;
}

.item--bowl {
  --rise: var(--rise-bowl);
  --x: 0px;
  --lift: 120px;
}

.item--cutlery {
  --rise: var(--rise-cutlery);
  --x: calc(var(--rise) * 92px);
  --lift: 170px;
}

/* What came out of the box, as links -- appear once everything's out. */
.fold__labels {
  --labels: 1;
  position: absolute;
  left: 0;
  right: 0;
  bottom: 28px;
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  justify-content: center;
  gap: 12px;
  opacity: var(--labels);
  transform: translateY(calc((1 - var(--labels)) * 12px));
}

.fold__labels:focus-within {
  opacity: 1;
  transform: none;
}

.fold__label {
  display: flex;
  flex-direction: column;
  padding: 10px 14px;
  border-radius: 6px;
  background-color: rgba(18, 18, 22, 0.92);
  border: 1px solid rgba(242, 239, 231, 0.16);
  line-height: 1.35;
  transition: border-color 150ms ease;
}
.fold__label:hover {
  border-color: rgba(242, 239, 231, 0.5);
}

.fold__label-name {
  font-size: 13px;
  font-weight: 600;
}

.fold__label-price {
  font-size: 12px;
  color: var(--mat-text-subtle);
}

/* ---------- Bulk rates ---------- */

.bulk {
  scroll-margin-top: var(--nav-height);
  padding-block: 96px;
  border-bottom: 1px solid var(--color-border-base);
}

.bulk__inner {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr);
  gap: 64px;
  align-items: start;
}

.bulk__picker {
  border: 0;
  margin: 28px 0 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.bulk__choice {
  position: relative;
  cursor: pointer;
}

.bulk__choice input {
  position: absolute;
  opacity: 0;
  inset: 0;
  margin: 0;
  cursor: pointer;
}

.bulk__choice span {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 8px 14px;
  border-radius: var(--radius-full);
  border: 1px solid var(--color-border-base);
  font-size: 14px;
  color: var(--color-fg-subtle);
  transition: background-color 150ms ease, color 150ms ease, border-color 150ms ease;
}

.bulk__choice:hover span {
  color: var(--color-fg-base);
  border-color: var(--color-fg-subtle);
}

.bulk__choice input:checked + span {
  background-color: var(--color-fg-base);
  border-color: var(--color-fg-base);
  color: var(--color-bg-base);
}

.bulk__choice input:focus-visible + span {
  outline: 2px solid var(--color-in-cart);
  outline-offset: 2px;
}

.bulk__calc {
  background-color: var(--color-bg-subtle);
  border-radius: 12px;
  padding: 32px;
}

.bulk__label {
  display: block;
  font-size: 14px;
  color: var(--color-fg-subtle);
}

.bulk__qty {
  font-family: var(--font-display);
  font-stretch: 80%;
  font-weight: 700;
  font-size: 22px;
  margin: 4px 0 16px;
  font-variant-numeric: tabular-nums;
}

.bulk__qty output {
  font-size: 34px;
}

/* Native range, restyled: kraft track that fills up to the thumb. */
.bulk__range {
  --fill: 50%;
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 28px;
  background: transparent;
  margin: 0;
  cursor: pointer;
}

.bulk__range::-webkit-slider-runnable-track {
  height: 8px;
  border-radius: 4px;
  background: linear-gradient(to right, var(--kraft-out) var(--fill), var(--color-border-base) var(--fill));
}

.bulk__range::-moz-range-track {
  height: 8px;
  border-radius: 4px;
  background: linear-gradient(to right, var(--kraft-out) var(--fill), var(--color-border-base) var(--fill));
}

.bulk__range::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 26px;
  height: 26px;
  margin-top: -9px;
  border-radius: 5px;
  background-color: var(--kraft-in);
  border: 2px solid var(--kraft-edge);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.25);
}

.bulk__range::-moz-range-thumb {
  width: 22px;
  height: 22px;
  border-radius: 5px;
  background-color: var(--kraft-in);
  border: 2px solid var(--kraft-edge);
}

.bulk__range:focus-visible {
  outline: 2px solid var(--color-in-cart);
  outline-offset: 4px;
  border-radius: 4px;
}

.bulk__scale {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--color-fg-subtle);
  margin-top: 4px;
  font-variant-numeric: tabular-nums;
}

.bulk__result {
  margin-top: 28px;
}

.bulk__result p {
  margin: 0;
}

.bulk__per-piece {
  font-size: 16px;
  color: var(--color-fg-subtle);
}

.bulk__figure {
  font-family: var(--font-display);
  font-stretch: 70%;
  font-weight: 850;
  font-size: clamp(56px, 2rem + 4vw, 96px);
  line-height: 1;
  letter-spacing: -0.02em;
  color: var(--color-fg-base);
  font-variant-numeric: tabular-nums;
  margin-right: 6px;
}

.bulk__breakdown {
  margin-top: 12px !important;
  font-size: 15px;
}

.bulk__total {
  font-size: 15px;
  color: var(--color-fg-subtle);
}

.bulk__total strong {
  color: var(--color-fg-base);
  font-variant-numeric: tabular-nums;
}

.bulk__saving {
  min-height: 24px;
  font-size: 15px;
  font-weight: 600;
  color: var(--color-in-cart);
}

/* A carton is a big kraft square, a pack a small one. */
.bulk__stack {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 6px;
  min-height: 40px;
  margin: 20px 0;
}

.bulk__stack span {
  display: block;
  border-radius: 3px;
  background-color: var(--kraft-out);
  box-shadow: inset 0 0 0 1px var(--kraft-edge), inset 0 -6px 0 rgba(0, 0, 0, 0.08);
  animation: stack-in 220ms ease-out both;
}

.bulk__stack .is-carton {
  width: 36px;
  height: 36px;
}

.bulk__stack .is-pack {
  width: 16px;
  height: 16px;
  background-color: var(--kraft-in);
}

.bulk__stack .is-more {
  background: none;
  box-shadow: none;
  font-size: 13px;
  color: var(--color-fg-subtle);
  align-self: center;
}

@keyframes stack-in {
  from { transform: scale(0.4); opacity: 0; }
}

.bulk__link {
  font-size: 14px;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* ---------- Aim + materials ---------- */

.aim {
  padding-block: 96px;
  border-bottom: 1px solid var(--color-border-base);
}

.aim__inner {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
  gap: 64px;
  align-items: start;
}

.aim__materials {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.material {
  display: grid;
  gap: 2px;
}

.material__swatch {
  display: block;
  aspect-ratio: 16 / 10;
  border-radius: 8px;
  margin-bottom: 10px;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.08);
  transition: transform 200ms ease;
}

.material:hover .material__swatch {
  transform: translateY(-3px);
}

.material:focus-visible {
  outline: 2px solid var(--color-in-cart);
  outline-offset: 4px;
  border-radius: 8px;
}

/* Textures are SVG noise over a base colour -- no image files. */
.material__swatch--bagasse {
  background-color: #ebe2cc;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3'/%3E%3CfeColorMatrix values='0 0 0 0 .45 0 0 0 0 .38 0 0 0 0 .25 0 0 0 .35 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

.material__swatch--kraft {
  background-color: #b88a5b;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.05 .9' numOctaves='2'/%3E%3CfeColorMatrix values='0 0 0 0 .3 0 0 0 0 .18 0 0 0 0 .08 0 0 0 .45 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

.material__swatch--paper {
  background-color: #f4f1ea;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.7' numOctaves='2'/%3E%3CfeColorMatrix values='0 0 0 0 .5 0 0 0 0 .5 0 0 0 0 .45 0 0 0 .14 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

.material__swatch--wood {
  background-color: #dcbd8f;
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.004 .14' numOctaves='3' seed='4'/%3E%3CfeColorMatrix values='0 0 0 0 .45 0 0 0 0 .3 0 0 0 0 .15 0 0 0 .55 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: cover;
}

.material__name {
  font-weight: 600;
  font-size: 15px;
}

.material__count {
  font-size: 13px;
  color: var(--color-fg-subtle);
}

/* ---------- Featured products ---------- */

.home-picks.featured-products {
  padding-block: 96px 72px;
}

.home-picks__grid.featured-products__scroll {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 32px 20px;
  overflow: visible;
  -webkit-mask-image: none;
  mask-image: none;
}

.home-picks__all {
  display: inline-block;
  margin-top: 40px;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* ---------- FAQ ---------- */

.faq {
  padding-block: 24px 112px;
}

.faq__list {
  max-width: 760px;
  border-top: 1px solid var(--color-border-base);
}

.faq__item {
  border-bottom: 1px solid var(--color-border-base);
}

.faq__item summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 20px 0;
  font-size: 17px;
  font-weight: 600;
}

.faq__item summary::-webkit-details-marker {
  display: none;
}

.faq__item summary::after {
  content: "";
  flex-shrink: 0;
  width: 10px;
  height: 10px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: translateY(-3px) rotate(45deg);
  transition: transform 200ms ease;
}

.faq__item[open] summary::after {
  transform: translateY(2px) rotate(-135deg);
}

.faq__item summary:focus-visible {
  outline: 2px solid var(--color-in-cart);
  outline-offset: 2px;
}

.faq__item p {
  margin: 0 0 20px;
  max-width: 62ch;
  color: var(--color-fg-subtle);
  font-size: 15px;
  line-height: 1.6;
}

/* ---------- Tablet / phone ---------- */

@media (max-width: 1023px) {
  .fold__layout {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 1fr);
    align-items: stretch;
    gap: 0;
  }

  .fold__copy {
    padding-block: 32px 0;
  }

  .fold__stage {
    min-height: 420px;
  }

  .box-scene {
    --s: 0.8;
    top: 50%;
  }

  .home-picks__grid.featured-products__scroll {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .bulk__inner,
  .aim__inner {
    grid-template-columns: minmax(0, 1fr);
    gap: 40px;
  }

}

@media (max-width: 639px) {
  .fold__copy {
    padding-block: 24px 0;
  }

  .fold__title {
    font-size: 34px;
    margin-bottom: 14px;
  }

  .fold__lede {
    font-size: 15px;
    margin-bottom: 20px;
  }

  .fold__actions .button {
    flex: 1 1 auto;
  }

  .fold__stage {
    min-height: 280px;
  }

  .box-scene {
    --s: 0.56;
    top: 44%;
  }

  .fold__labels {
    bottom: 16px;
    gap: 6px;
  }

  .fold__labels {
    padding-inline: var(--content-container-padding-inline);
  }

  .fold__labels li {
    min-width: 0;
  }

  .fold__label {
    padding: 8px 10px;
  }

  .fold__label-name {
    font-size: 12px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .fold__label-price {
    display: none;
  }

  .bulk,
  .aim {
    padding-block: 64px;
  }

  .bulk__calc {
    padding: 24px 20px;
  }

  .home-picks.featured-products {
    padding-block: 64px 48px;
  }

  .home-picks__grid.featured-products__scroll {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 24px 12px;
  }

  .faq {
    padding-bottom: 72px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .bulk__stack span,
  .material__swatch {
    animation: none;
    transition: none;
  }
}
