/* Crunchables homepage v2 (prototype).
   Idea: the page is the jar label, blown up. Each section is a label colour, the brand's own serif
   lettering carries the type, and the HD jar photos are the only imagery. */
:root {
  --almond: #742321;
  --ivory: #F4EFE7;
  --cocoa: #2A1612;
  --cocoa-soft: rgba(42, 22, 18, .72);
  --brass: #C29A5B;
  --field: var(--almond);
  --serif: "Cormorant Garamond", "Iowan Old Style", Baskerville, serif;
  --sans: "Manrope", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --gutter: clamp(22px, 5vw, 80px);
  --ease: cubic-bezier(.22, 1, .36, 1);
}

*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; padding: 0; }
/* no CSS smooth scrolling: it breaks ScrollTrigger's measurements; anchor links glide via JS instead */
html { -webkit-text-size-adjust: 100%; }
body {
  background: var(--almond);
  color: var(--ivory);
  font: 400 17px/1.6 var(--sans);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
img { display: block; max-width: none; }
a { color: inherit; text-decoration: none; }
:focus-visible { outline: 2px solid var(--brass); outline-offset: 3px; border-radius: 4px; }

.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.skip { position: absolute; left: -9999px; top: 8px; z-index: 100; background: var(--ivory); color: var(--cocoa); padding: 10px 16px; border-radius: 8px; }
.skip:focus { left: 8px; }

/* Studio light behind the product on any label colour */
.field {
  background:
    radial-gradient(ellipse 62% 52% at var(--lx, 50%) var(--ly, 46%),
      color-mix(in oklab, var(--field) 78%, #f6dcb8) 0%,
      var(--field) 58%,
      color-mix(in oklab, var(--field), #000 34%) 100%);
}

/* ---------- Nav ---------- */
.nav {
  position: fixed;
  inset: 0 0 auto;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px var(--gutter);
  color: var(--ivory);
  transition: color .4s var(--ease);
}
.nav-mark {
  font: 600 17px/1 var(--serif);
  letter-spacing: .3em;
  text-transform: uppercase;
  opacity: 0;
  transform: translateY(-6px);
  transition: opacity .4s var(--ease), transform .4s var(--ease);
}
.nav.show-mark .nav-mark { opacity: 1; transform: none; }
.nav nav { display: flex; gap: 26px; align-items: center; font-size: 15px; }
.nav-shop { padding: 8px 18px; border: 1px solid currentColor; border-radius: 999px; }
.nav.on-light { color: var(--cocoa); background: rgba(244, 239, 231, .9); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); }
@media (max-width: 899px) {
  .nav-mark { font-size: 15px; letter-spacing: .24em; }
  .nav nav .nav-flavours { display: none; }
  .nav nav { gap: 18px; }
}

/* ---------- Shared type ---------- */
h2 {
  font: 500 clamp(40px, 5.6vw, 84px)/1.02 var(--serif);
  letter-spacing: -.01em;
  text-wrap: balance;
}
.tagline {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  font: 500 20px/1.2 var(--serif);
  letter-spacing: .02em;
}
.tagline::before, .tagline::after { content: ""; width: 44px; height: 1px; background: var(--brass); transform-origin: center; }
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 52px;
  padding: 0 30px;
  border-radius: 999px;
  font: 600 15px/1 var(--sans);
  letter-spacing: .01em;
  transition: background-color .3s var(--ease), transform .3s var(--ease);
}
.btn:active { transform: scale(.98); }
.btn-light { background: var(--ivory); color: var(--cocoa); }
.btn-light:hover { background: #fff; }
.btn-dark { background: var(--cocoa); color: var(--ivory); }
.btn-dark:hover { background: #3d2219; }

.contact {
  position: absolute;
  left: 12%;
  right: 12%;
  bottom: -1.5%;
  height: 5%;
  border-radius: 50%;
  background: radial-gradient(closest-side, rgba(12, 4, 3, .55), transparent);
  filter: blur(4px);
  z-index: -1;
}

/* ---------- Opening ---------- */
.hero {
  --field: var(--almond);
  position: relative;
  height: 100svh;
  min-height: 620px;
  overflow: hidden;
}
.hero-word {
  position: absolute;
  left: 0;
  right: 0;
  top: 13svh;
  z-index: 1;
  text-align: center;
  font: 500 11.4vw/.9 var(--serif);
  letter-spacing: .055em;
  text-transform: uppercase;
  white-space: nowrap;
  color: var(--ivory);
}
.hero-word-inner { display: inline-block; }
.hero-word .ch { display: inline-block; will-change: transform, opacity; }
.hero-jar {
  position: absolute;
  z-index: 2;
  left: 0;
  right: 0;
  margin: 0 auto;
  top: 17svh;
  height: 56svh;
  width: calc(56svh * 555 / 1194);
}
.hero-jar img { width: 100%; height: 100%; filter: drop-shadow(0 30px 30px rgba(12, 4, 3, .35)); }
/* all six jars sit on top of each other; site.js fades from one to the next */
.hero-jars, .hero-jars img { position: absolute; inset: 0; }
.hero-foot {
  position: absolute;
  z-index: 3;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 0 var(--gutter) max(28px, env(safe-area-inset-bottom));
  display: grid;
  justify-items: center;
  gap: 14px;
  text-align: center;
}
.hero-copy { max-width: 30ch; font-size: 16px; opacity: .9; }
.hero-foot .btn { margin-top: 4px; }

/* ---------- Inside the almond ---------- */
.crack {
  --crack-bg: #F4EFE7;
  position: relative;
  height: 300vh;
  background: var(--crack-bg);
  color: var(--cocoa);
}
.crack-sticky {
  position: sticky;
  top: 0;
  height: 100svh;
  overflow: hidden;
}
.crack-stage {
  position: absolute;
  left: 50%;
  top: 9svh;
  width: min(118vw, calc(54svh * 1424 / 1224));
  aspect-ratio: 1424 / 1224;
  transform: translateX(-50%);
}
/* a tiny blurred almond shows at once, so the space is never empty while the real pictures load on a slow connection */
.crack-stage::before {
  content: "";
  position: absolute;
  left: 28.5%; top: 14.6%; width: 55.8%; height: 75.7%;
  background: url("data:image/webp;base64,UklGRvACAABXRUJQVlA4WAoAAAAQAAAAJwAALgAAQUxQSAUBAAARb6CgjSQ1dQKY7yEiAnLG1fBHxwigZtu2bLl+dyA7ieTWfABbwMnWSP8IWHepTnZ3d3im+d/3ef4RIvo/AVi7pqowb4hIzLIvIjJtmBdnSNX370poir7FndasirdGUfnn61acib/f1/mvGPN9Sh6GRNvv+VK1uYZEXeP61JU6+kSfcrwb4jn1/4ZIzqkYg0DRn+EAYE6M2ZxPSw1QL9YksGuKAN+WB6BerFlgxVQKvJuiwK/lAKgXazcwZ0oAJ5aHAPBm6Qf4tMRzvgybgXxUk4eHkOND14rzVfUQcu2oWnFPag6CnqJ/RTH+D18W5aRnM6ThwnEQQV15LSILYYxFo1MtAdQAVlA4IMQBAAAwCgCdASooAC8APtFUo0woJKMiLjgMyQAaCWQArDN2EaGCA6lJbyk+dRmNNl1YmdXl8epIljK4wfnHw6GWrFr2A56HoR84I1bsrJLH3/pAVqdQc33Z1+4zh+AA/v27NX4jh2jMQbPtZ+Y8AXyLX9lBaU8Hu6NuN6va8hPysoF9kppjCwhtXFJFC4YYR7vEj4M+3Xm98z10KLUb1gF6pOaYpauMzaIvkzQJzoVBU0agr8yKe25l54ug+uPXM4R7sK1TKjkw+CQP0ktJKnj80ZDoMnzWsJslMFZoZOJpK9CACefxj7wboTGte2p0g/HwClMbEhJDAsfhRFPEtuXECqGYCsLq6w1mFb9jcJYqFjm6HAK6p7YsKDDFBforWOaXpnq8LdnJpf9S6P2+8pfRvRVzfW0brjsbr70e/6F/SvSqPzs98hbFZffefp3XYy7sWkiem50HkYcfiibZNut6dBhp+PEGdvWMrrQvbvoQY/P+UnE9f4qyZiXnA6jzjukN8VK95ZrR2A2SZaf1So+nbwG29hjS3vkRuAGTSWnPXXcXQwHAICcp9scj1xsc08Yu7C5J+Xc4H4/Jpo+Kr63872BKdAAAAA==") center / contain no-repeat;
  filter: blur(10px);
  opacity: .85;
  transition: opacity .6s ease;
}
.crack-stage.is-ready::before { opacity: 0; }
.crack-piece { position: absolute; will-change: transform, opacity; }
.crack-piece img { width: 100%; height: auto; }
.crack-copy {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 0 var(--gutter) 44px;
  text-align: center;
}
.crack-copy h2 { font-size: clamp(36px, 9.6vw, 76px); max-width: 14ch; margin: 0 auto; }
.crack-copy p { margin: 16px auto 0; max-width: 34ch; color: var(--cocoa-soft); }

/* ---------- The shelf ---------- */
.shelf { position: relative; height: 600svh; }
.shelf-sticky {
  position: sticky;
  top: 0;
  height: 100svh;
  overflow: hidden;
}
.shelf-name {
  position: absolute;
  left: 0;
  right: 0;
  top: 11svh;
  text-align: center;
  font: 500 13.5vw/.92 var(--serif);
  letter-spacing: -.01em;
  transform: translateY(var(--dy, 0px));
  will-change: transform, opacity;
}
.shelf-name span { display: block; }
.shelf-jars {
  position: absolute;
  z-index: 2;
  left: 50%;
  top: 30svh;
  height: 42svh;
  aspect-ratio: 555 / 1194;
  transform: translateX(-50%);
  perspective: 1400px;
}
.shelf-tilt { position: absolute; inset: 0; transform-style: preserve-3d; }
/* tap the jar: the cap twists off and nuts tumble out; tap a nut to crack it */
.shelf-tilt .jar { position: absolute; inset: 0; filter: drop-shadow(0 28px 26px rgba(12, 4, 3, .38)); will-change: transform, opacity; }
.jar .body, .jar .cap { position: absolute; left: 0; width: 100%; }
.jar .body { top: 15.33%; height: 84.67%; }
.jar .cap { top: 0; height: 15.33%; transform-origin: 50% 85%; z-index: 2; }
.jar .mouth {
  position: absolute;
  left: 11%;
  width: 78%;
  top: 14.2%;
  height: 3.8%;
  border-radius: 50%;
  background: radial-gradient(ellipse at 50% 60%, #120705 0%, #2c150d 55%, rgba(60, 34, 22, .9) 78%, rgba(255, 255, 255, .25) 100%);
  opacity: 0;
  transition: opacity .3s .25s;
  z-index: 1;
}
.jar.is-open .mouth { opacity: 1; }
/* an opened jar settles a little smaller (from its base) to make room for the nuts above it */
.shelf-jars { --open-scale: .84; transform-origin: 50% 100%; transition: scale .55s var(--ease); }
.shelf-jars.is-open { scale: var(--open-scale); }
.jar-hit {
  position: absolute;
  inset: 0;
  z-index: 30;
  background: none;
  border: 0;
  cursor: pointer;
  border-radius: 24px;
}
.jar-hint {
  position: absolute;
  left: 50%;
  bottom: -30px;
  transform: translateX(-50%);
  white-space: nowrap;
  font-size: 13px;
  opacity: .75;
  pointer-events: none;
}
.shelf-nuts { position: absolute; inset: 0; z-index: 6; pointer-events: none; }
.nut-btn {
  position: absolute;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  pointer-events: auto;
  will-change: transform, opacity;
  border-radius: 50%;
}
.nut-btn img, .nut-btn .half { display: block; width: 100%; height: auto; filter: drop-shadow(0 14px 14px rgba(12, 4, 3, .42)); }
.nut-btn .float { animation: nutbob 3.6s ease-in-out infinite; animation-delay: var(--d, 0s); }
@keyframes nutbob { 50% { transform: translateY(-7%) rotate(3deg); } }
.nut-btn .nut-turn { position: relative; display: block; }
.nut-btn .half { position: absolute; inset: 0; }
.shelf-crumb { position: absolute; z-index: 7; background: #3b2216; pointer-events: none; }

.shelf-details { position: absolute; left: 0; right: 0; bottom: 0; height: 26svh; }
.shelf-detail {
  position: absolute;
  inset: auto 0 0;
  padding: 0 var(--gutter) max(30px, env(safe-area-inset-bottom));
  display: grid;
  justify-items: center;
  gap: 12px;
  text-align: center;
  opacity: 0;
  visibility: hidden;
  transform: translateY(12px);
  transition: opacity .45s var(--ease), transform .45s var(--ease), visibility 0s .45s;
}
.shelf-detail.is-on { opacity: 1; visibility: visible; transform: none; transition-delay: .08s, .08s, 0s; }
.shelf-detail p { max-width: 34ch; font-size: 16px; opacity: .9; }
.sizes { display: flex; gap: 22px; font-size: 15px; }
.sizes span b { font: 600 22px/1 var(--serif); margin-left: 6px; }
.shelf-index { display: none; }

/* ---------- Closing ---------- */
.closing {
  position: relative;
  min-height: 100svh;
  background: var(--ivory);
  color: var(--cocoa);
  display: grid;
  align-content: end;
  padding: 0 var(--gutter) 56px;
  overflow: hidden;
}
.lineup {
  position: absolute;
  left: 50%;
  top: 11svh;
  width: min(94vw, 980px);
  height: 40svh;
  transform: translateX(-50%);
}
.lineup { --jw: calc(40svh * 555 / 1194); }
.lineup img {
  position: absolute;
  bottom: 0;
  height: calc(100% * var(--s, 1));
  left: calc(var(--i) * (100% - var(--jw)) / 5);
  z-index: var(--z, 1);
  filter: drop-shadow(0 22px 20px rgba(42, 22, 18, .28));
}
.closing-copy { position: relative; display: grid; justify-items: center; gap: 16px; text-align: center; }
.closing-copy p:not(.tagline) { max-width: 36ch; color: var(--cocoa-soft); }
.tagline-dark { color: var(--cocoa); }

/* ---------- Footer ---------- */
.foot {
  background: var(--cocoa);
  color: var(--ivory);
  padding: 56px var(--gutter) max(40px, env(safe-area-inset-bottom));
  display: grid;
  gap: 34px;
}
.foot-top { display: grid; gap: 10px; }
.foot-mark { font: 600 22px/1 var(--serif); letter-spacing: .3em; text-transform: uppercase; }
.foot-line { font-size: 15px; opacity: .7; max-width: 34ch; }
.foot-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 28px 20px; }
.foot-cols nav { display: grid; gap: 10px; align-content: start; font-size: 15px; }
.foot-cols h2 { font: 500 20px/1 var(--serif); color: var(--brass); margin-bottom: 4px; }
.foot-cols a { opacity: .85; width: fit-content; }
.foot-cols a:hover { opacity: 1; text-decoration: underline; text-underline-offset: 3px; }
.foot-contact { display: grid; gap: 10px; }
.foot-contact:empty { display: none; }
.foot-note { font-size: 13px; opacity: .5; padding-top: 18px; border-top: 1px solid rgba(244, 239, 231, .12); }

/* ---------- Wider screens ---------- */
@media (min-width: 900px) {
  .hero-word { top: 50%; transform: translateY(-58%); font-size: 12.1vw; }
  .hero-jar { top: 7vh; height: 86vh; width: calc(86vh * 555 / 1194); }
  .hero-foot {
    grid-template-columns: 1fr auto;
    align-items: end;
    justify-items: start;
    text-align: left;
    padding-bottom: 44px;
  }
  .hero-foot .tagline { justify-content: flex-start; grid-column: 1; }
  .hero-foot .tagline::before { display: none; }
  .hero-copy { grid-column: 1; max-width: 34ch; }
  .hero-foot .btn { grid-column: 2; grid-row: 1 / span 2; align-self: end; }

  .crack-stage { left: auto; right: 2vw; top: 50%; width: min(60vw, calc(90vh * 1424 / 1224)); transform: translateY(-50%); }
  .crack-copy { inset: 50% auto auto 0; transform: translateY(-50%); text-align: left; padding: 0 0 0 var(--gutter); width: 40vw; }
  .crack-copy h2 { margin: 0; font-size: clamp(44px, 4.8vw, 80px); }
  .crack-copy p { margin-left: 0; }

  .shelf-name { left: var(--gutter); right: auto; top: 50%; text-align: left; font-size: clamp(64px, 7.6vw, 132px); transform: translateY(calc(-62% + var(--dy, 0px))); max-width: 46vw; }
  .shelf-sticky { --lx: 70%; --ly: 50%; }
  .hero { --lx: 50%; --ly: 52%; }
  .shelf-jars { left: auto; right: 12vw; top: 8vh; height: 84vh; transform: none; --open-scale: .74; }
  .jar-hint { bottom: auto; top: -26px; }
  .shelf-details { left: var(--gutter); right: auto; width: min(420px, 40vw); bottom: 13vh; height: auto; }
  .shelf-detail { position: absolute; inset: auto 0 0 0; padding: 0; justify-items: start; text-align: left; }
  .shelf-index {
    display: flex;
    position: absolute;
    right: var(--gutter);
    bottom: 34px;
    gap: 22px;
    list-style: none;
    font-size: 13px;
  }
  .shelf-index button {
    font: inherit;
    color: inherit;
    background: none;
    border: 0;
    padding: 4px 0;
    cursor: pointer;
    opacity: .55;
    border-bottom: 1px solid transparent;
    transition: opacity .3s, border-color .3s;
  }
  .shelf-index button[aria-current="true"] { opacity: 1; border-color: var(--brass); }

  .closing { align-content: center; padding-bottom: 0; }
  .closing-copy { justify-items: start; text-align: left; width: min(40vw, 520px); }
  .closing-copy .tagline { justify-content: flex-start; }
  .closing-copy .tagline::before { display: none; }
  .lineup { left: auto; right: 3vw; top: 50%; width: min(56vw, 900px); height: 64vh; transform: translateY(-50%); --jw: calc(64vh * 555 / 1194); }
  .foot { grid-template-columns: 1fr 1.6fr; align-items: start; padding-top: 72px; }
  .foot-cols { grid-template-columns: repeat(3, 1fr); }
  .foot-note { grid-column: 1 / -1; }
}

@media (prefers-reduced-motion: reduce) {
  .shelf-detail, .nav, .nav-mark { transition: none; }
}
