/* ═══════════════════════════════════════════════════════════════
   THE BARNHOUSE, the sauce bench (#sauces)
   Seven hand labelled tubs as a keyboard radiogroup, a heat rail
   underneath, and a red warmth that rises with the chosen sauce.
   Depends on: style.css tokens, main.js (.reveal, BARNHOUSE.reduced)
   ═══════════════════════════════════════════════════════════════ */

/* --heat is registered so the flame slides and the warmth fades
   between tubs instead of jumping. Without @property support the
   change is simply instant, which is also the reduced motion state. */
@property --heat {
  syntax: '<number>';
  inherits: true;
  initial-value: 0;
}

.sauces {
  --heat: .6667;                      /* Barnhouse, tub 4 of 0 to 6 */
  /* Tub size in the scroll row, sized from the viewport so about two and a
     half tubs show under 760px (a cut tub is the scroll affordance) */
  --sauces-tub: clamp(116px, calc((100vw - 2 * var(--gutter) - 2 * var(--sauces-gap)) / 2.5), 140px);
  --sauces-gap: 12px;
  --sauces-flame: 30px;
  --sauces-rail-inset: calc(var(--sauces-flame) / 2);

  /* Sauce swatches, sampled from the tub photo. Illustration colours
     for the SVG fills only, never used for text. */
  --sauces-bc-a: #F7F8F4;  --sauces-bc-b: #DCE2DE;  --sauces-bc-fleck: #C4CDCC;
  --sauces-em-a: #F8E8AE;  --sauces-em-b: #E4C566;  --sauces-em-fleck: #D8A63A;
  --sauces-ra-a: #F8F4E9;  --sauces-ra-b: #E3DBC6;  --sauces-ra-fleck: #5C7848;
  --sauces-ga-a: #F9F1DD;  --sauces-ga-b: #E8D8B3;  --sauces-ga-fleck: #FFFDF6;
  --sauces-bh-a: #F3BF52;  --sauces-bh-b: #C9841F;
  --sauces-bhc-a: #A3251A; --sauces-bhc-b: #4E0C08; --sauces-bhc-fleck: #260604;
  --sauces-xc-a: #4E0C08;  --sauces-xc-b: #1B0403;  --sauces-xc-fleck: #8F1B12;
  --sauces-seed: #E2B462;

  isolation: isolate;
}

/* The warmth: a red toned wash that rises with --heat over the timber */
.sauces::before {
  content: '';
  position: absolute; inset: 0; z-index: 0;
  pointer-events: none;
  background: radial-gradient(110% 70% at 50% 62%,
              var(--red) 0%,
              color-mix(in srgb, var(--red) 55%, transparent) 42%,
              transparent 74%);
  opacity: calc(var(--heat) * .35);
}
.sauces > .shell { position: relative; z-index: 1; }

@media (prefers-reduced-motion: no-preference) {
  .sauces { transition: --heat var(--t-slow) var(--ease-out); }
}

/* ── Heading and the real tubs ─────────────────────────────────── */
.sauces__top {
  display: grid;
  grid-template-columns: minmax(0, 1fr); /* minmax(0) stops the 1600px photo blowing the column out */
  gap: clamp(1.5rem, 4vw, 3rem);
  margin-bottom: clamp(2rem, 4vw, 3rem);
}
.sauces__head { min-width: 0; }
.sauces__head .lede { margin: 1rem 0 0; }

.sauces__photo { min-width: 0; aspect-ratio: 1600 / 742; }
.sauces__photo img { width: 100%; height: 100%; object-fit: cover; }

@media (min-width: 980px) {
  .sauces__top {
    grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
    align-items: end;
  }
}

/* ── The bench ─────────────────────────────────────────────────── */
.sauces__bench {
  position: relative;
  margin-inline: calc(-1 * var(--gutter));
  padding: 0 0 1.25rem;
  border-top: 1px solid var(--line-light);
  border-bottom: 1px solid var(--line-light);
  background: linear-gradient(180deg,
              color-mix(in srgb, var(--char) 55%, transparent),
              color-mix(in srgb, var(--char) 22%, transparent));
}
@media (min-width: 1080px) {
  .sauces__bench {
    margin-inline: 0;
    padding: 0 clamp(1rem, 1rem + 1.5vw, 2.5rem) 1.5rem;
    border: 1px solid var(--line-light);
    border-radius: var(--r-board);
    box-shadow: inset 0 1px 0 color-mix(in srgb, var(--paper) 10%, transparent), var(--shadow);
  }
}

/* ── The shelf: scroll snap row, then a seven column grid ──────── */
.sauces__shelf {
  position: relative;
  display: flex;
  gap: var(--sauces-gap);
  padding: 2.2rem var(--gutter) 1.5rem;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x mandatory;
  scroll-padding-inline: var(--gutter);
  overscroll-behavior-x: contain;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.sauces__shelf::-webkit-scrollbar { display: none; }
/* sauces.js sets data-more to the side(s) with tubs still out of view */
.sauces__shelf[data-more="right"] {
  -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 56px), transparent);
  mask-image: linear-gradient(90deg, #000 calc(100% - 56px), transparent);
}
.sauces__shelf[data-more="left"] {
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 56px);
  mask-image: linear-gradient(90deg, transparent, #000 56px);
}
.sauces__shelf[data-more="both"] {
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 56px, #000 calc(100% - 56px), transparent);
  mask-image: linear-gradient(90deg, transparent, #000 56px, #000 calc(100% - 56px), transparent);
}

.sauces__tub {
  position: relative;
  isolation: isolate;
  flex: 0 0 var(--sauces-tub);
  width: var(--sauces-tub);
  aspect-ratio: 1;
  border-radius: 50%;
  scroll-snap-align: center;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.sauces__tub:focus-visible { border-radius: 50%; }

.sauces__tub-art {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
  transform-origin: 50% 50%;
}

/* Ground shadow under each tub. Deeper when the tub is lifted. */
.sauces__tub::after {
  content: '';
  position: absolute; z-index: -1;
  left: 8%; right: 8%; bottom: -5%; height: 26%;
  border-radius: 50%;
  background: radial-gradient(50% 50% at 50% 50%,
              color-mix(in srgb, var(--char) 78%, transparent),
              transparent);
  opacity: .6;
}
.sauces__tub[aria-checked="true"]::after {
  opacity: 1;
  transform: translateY(6px) scale(1.1, 1.2);
}
.sauces__tub[aria-checked="true"] .sauces__tub-art { transform: translateY(-6px); }

@media (hover: hover) and (pointer: fine) {
  .sauces__tub:hover .sauces__tub-art { transform: rotate(3deg); }
  .sauces__tub[aria-checked="true"]:hover .sauces__tub-art { transform: translateY(-6px) rotate(3deg); }
}

@media (prefers-reduced-motion: no-preference) {
  .sauces__tub-art { transition: transform var(--t) var(--ease-out); }
  .sauces__tub::after { transition: transform var(--t) var(--ease-out), opacity var(--t) var(--ease-out); }
}
@media (prefers-reduced-motion: reduce) {
  .sauces__tub:hover .sauces__tub-art { transform: none; }
  .sauces__tub[aria-checked="true"]:hover .sauces__tub-art { transform: translateY(-6px); }
}

@media (min-width: 760px) {
  /* about four and a half tubs, then five and a half from 900px */
  .sauces { --sauces-tub: clamp(128px, calc((100vw - 2 * var(--gutter) - 4 * var(--sauces-gap)) / 4.5), 150px); }
}
@media (min-width: 900px) {
  .sauces { --sauces-tub: clamp(128px, calc((100vw - 2 * var(--gutter) - 5 * var(--sauces-gap)) / 5.5), 150px); }
}

@media (min-width: 1080px) {
  .sauces__shelf {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    padding: 3.6rem 0 1.5rem;
    overflow: visible;
    scroll-snap-type: none;
  }
  .sauces__tub { width: 100%; max-width: 150px; justify-self: center; }
}

/* Entrance: sauces.js hands the shelf to BARNHOUSE.observeReveal, which adds
   .is-in once the bench scrolls into view; the tubs then rise in a stagger.
   Gated on data-reveal so the tubs stay visible if the script never runs. */
.js .sauces__shelf[data-reveal]:not(.is-in) .sauces__tub { opacity: 0; transform: translateY(16px); }
@media (prefers-reduced-motion: no-preference) {
  .js .sauces__shelf[data-reveal] .sauces__tub {
    transition: opacity 640ms var(--ease-out) var(--d, 0s), transform 640ms var(--ease-out) var(--d, 0s);
  }
}
@media (prefers-reduced-motion: reduce) {
  .js .sauces__shelf[data-reveal]:not(.is-in) .sauces__tub { opacity: 1; transform: none; }
}

/* Tub drawing parts (inline SVG classes) */
.sauces__plastic {
  fill: var(--paper); fill-opacity: .07;
  stroke: var(--paper); stroke-opacity: .55; stroke-width: 2;
}
.sauces__ridge { fill: none; stroke: var(--paper); stroke-opacity: .28; stroke-width: 1; }
.sauces__glint { fill: none; stroke: var(--paper); stroke-opacity: .6; stroke-width: 2.5; stroke-linecap: round; }
.sauces__sheen { fill: var(--paper); fill-opacity: .2; }
.sauces__sheen--gloss { fill-opacity: .3; }
.sauces__strip { fill: var(--cream); stroke: var(--char); stroke-opacity: .14; stroke-width: .8; }
.sauces__strip-shadow { fill: var(--char); fill-opacity: .4; }
.sauces__ink {
  font-family: var(--font-marker);
  fill: var(--char);
  letter-spacing: .02em;
}

/* The pinned note above the extreme chilli tub */
.sauces__note {
  position: absolute; z-index: 2;
  top: 0;
  /* starts at the left edge of the seventh tub so it stays inside the scroll row */
  left: calc(var(--gutter) + 6 * (var(--sauces-tub) + var(--sauces-gap)) - .25rem);
  white-space: nowrap;
  pointer-events: none;
}
.sauces__note::after {
  /* curly arrow down to the tub, paper colour (#F5EEE1) baked into the data URI */
  content: '';
  position: absolute;
  left: 1.1rem; top: 100%;
  width: 16px; height: 16px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 22 24' fill='none' stroke='%23F5EEE1' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M16 2c-4 2-10 6-8 12 1 3 3 5 3 8'/%3E%3Cpath d='M7 18l4 4 4-3'/%3E%3C/svg%3E") no-repeat center / contain;
}
@media (min-width: 1080px) {
  .sauces__note { left: auto; right: 0; top: .2rem; }
  .sauces__note::after { width: 22px; height: 24px; }
}

/* ── The heat rail ─────────────────────────────────────────────── */
.sauces__rail {
  position: relative;
  height: 60px;
  margin: 0 var(--gutter);
  contain: paint;
  overflow-x: clip;   /* the flame's shifted box must not widen the page on small phones */
}
@media (min-width: 1080px) {
  .sauces__rail {
    margin-inline: 0;
    /* inset so heat 0 and 1 sit exactly under the first and last tub centres */
    --sauces-rail-inset: calc((100% - 6 * var(--sauces-gap)) / 14);
  }
}
.sauces__track {
  position: absolute;
  left: var(--sauces-rail-inset); right: var(--sauces-rail-inset);
  top: 20px; height: 6px;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--sage) 0%, var(--gold) 50%, var(--red) 100%);
  box-shadow: 0 1px 0 color-mix(in srgb, var(--paper) 12%, transparent);
}
.sauces__ticks {
  position: absolute; inset: -3px 0;
  display: flex; justify-content: space-between; align-items: center;
}
.sauces__ticks i {
  display: block;
  width: 2px; height: 12px;
  border-radius: 1px;
  background: var(--barn);
  opacity: .55;
}
.sauces__flame {
  position: absolute; left: 0; top: 50%;
  width: 100%; height: 0;
  transform: translateX(calc(var(--heat) * 100%));
  pointer-events: none;
}
.sauces__flame svg {
  position: absolute; left: 0; top: 0;
  width: var(--sauces-flame); height: var(--sauces-flame);
  overflow: visible;
  transform: translate(-50%, -62%);
  filter: drop-shadow(0 3px 4px color-mix(in srgb, var(--char) 60%, transparent));
}
.sauces__flame-outer { fill: var(--red); stroke: var(--barn); stroke-width: 1.2; stroke-linejoin: round; }
.sauces__flame-inner { fill: var(--gold); }

.sauces__scale {
  position: absolute;
  left: var(--sauces-rail-inset); right: var(--sauces-rail-inset);
  bottom: 0;
  display: flex; justify-content: space-between;
  font-family: var(--font-cond);
  font-size: .74rem; font-weight: 700;
  letter-spacing: .18em; text-transform: uppercase;
  line-height: 1;
  color: var(--paper-soft);
}
@media (min-width: 1080px) {
  /* centre the words under the first and last tub */
  .sauces__scale span:first-child { transform: translateX(-50%); }
  .sauces__scale span:last-child { transform: translateX(50%); }
}

/* ── Caption and price line ────────────────────────────────────── */
.sauces .sauces__caption {
  margin: .9rem var(--gutter) 0;
  min-height: 2.9em;
  text-align: center;
  font-size: clamp(1.05rem, .9rem + .6vw, 1.3rem);
  line-height: 1.45;
  color: var(--paper);
  text-wrap: balance;
}
.sauces .sauces__caption b { color: var(--paper); font-weight: 700; }
@media (min-width: 1080px) {
  .sauces .sauces__caption { margin-inline: 0; min-height: 1.45em; }
}
@media (prefers-reduced-motion: no-preference) {
  .sauces__caption.is-fresh { animation: saucesCaption 360ms var(--ease-out) both; }
}
@keyframes saucesCaption {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: none; }
}


/* ── The price board: every width ─────────────────────────────────
   A small timber price board (the menu board's material, no dashed leaders)
   under the intro: house sauces $1.50 each, BBQ and tomato free. It replaced
   the old price line under the bench. */
.sauces .sauces__prices {
  display: grid;
  max-width: 26rem;
  margin: 1.4rem 0 0;
  padding: .35rem 1.1rem;
  background-color: var(--timber);
  background-image:
    repeating-linear-gradient(90deg, transparent 0 96px, rgba(74, 46, 24, .12) 96px 97px, transparent 97px 100px),
    var(--grain);
  background-size: auto, var(--grain-size);
  border: 2px solid var(--brown);
  border-radius: var(--r-sign);
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, .35);
  color: var(--brown);
}
.sauces__prices > div {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: .75rem;
  padding: .6rem 0;
}
.sauces__prices > div + div { border-top: 1px solid var(--timber-2); }
.sauces__prices dt {
  min-width: 0;
  font-family: var(--font-cond);
  font-weight: 700;
  font-size: 1.1rem;
  letter-spacing: .04em;
  text-transform: uppercase;
  line-height: 1.15;
}
.sauces__prices dd {
  flex: none;
  margin: 0;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 1.4rem;
  line-height: 1;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.sauces__prices dd small {
  font-family: var(--font-cond);
  font-weight: 700;
  font-size: .8rem;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

/* Phones: the photo of the real tubs sat right above the tub picker and read
   as a second picker, so it goes. Delete this rule to bring it back. */
@media (max-width: 759px) {
  .sauces__photo { display: none; }
  .sauces .sauces__prices { max-width: none; }
}
