/* ==========================================================================
   Home page shop sections (index.html <main class="home">): best sellers,
   category tiles on the story-world photographs, story strip, review and
   the treatments band. Builds on the shared components in css/site.css.
   ========================================================================== */

.home { background: var(--cream); }

.home .section-head--split > div > * + * { margin-top: 14px; }

/* ---- Category tiles --------------------------------------------------- */

.cat-tiles {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin: 0;
  padding: 0;
  list-style: none;
}
@media (min-width: 900px) {
  .cat-tiles { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 24px; }
}

.cat-tile {
  position: relative;
  isolation: isolate;
  display: block;
  aspect-ratio: 4 / 5;
  overflow: hidden;
  color: var(--cream);
}
.cat-tile__img {
  position: absolute;
  inset: 0;
  z-index: -2;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.6s ease;
}
.cat-tile::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(to top, rgba(35, 22, 15, 0.66), rgba(35, 22, 15, 0.1) 55%, rgba(35, 22, 15, 0) 75%);
}
.cat-tile:hover .cat-tile__img,
.cat-tile:focus-visible .cat-tile__img { transform: scale(1.04); }
.cat-tile:focus-visible { outline: 2px solid var(--brown); outline-offset: 3px; }

.cat-tile__body {
  position: absolute;
  inset: auto 0 0 0;
  display: grid;
  gap: 8px;
  padding: clamp(14px, 2vw, 26px);
}
.cat-tile__label {
  font-family: var(--serif-display);
  font-weight: 500;
  font-size: clamp(24px, 2.5vw, 38px);
  line-height: 1;
  letter-spacing: -0.01em;
}
.cat-tile__meta {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--sans);
  font-size: clamp(12px, 1vw, 14px);
  letter-spacing: 0.04em;
  opacity: 0.92;
}
.cat-tile__meta svg {
  flex: none;
  width: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.3;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform 0.25s ease;
}
.cat-tile:hover .cat-tile__meta svg { transform: translateX(3px); }

.cat-more {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 22px;
  margin-top: clamp(22px, 3vw, 34px);
  font-family: var(--serif);
  font-size: 17px;
  color: var(--ink-soft);
}
.cat-more a {
  color: var(--ink);
  padding-bottom: 2px;
  border-bottom: 1px solid var(--rule);
  transition: border-color 0.2s ease;
}
.cat-more a:hover { border-color: var(--ink); }

/* ---- Story strip ------------------------------------------------------ */

.home-story__grid {
  display: grid;
  gap: clamp(28px, 4vw, 72px);
  align-items: center;
}
@media (min-width: 900px) {
  .home-story__grid { grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); }
}
.home-story__media {
  aspect-ratio: 16 / 9; /* the photograph's own frame: the product line-up runs edge to edge */
  overflow: hidden;
}
.home-story__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.home-story__body > * + * { margin-top: 18px; }
.home-story__body .link-arrow { margin-top: 28px; }

/* ---- Gifts + treatments cards ----------------------------------------- */

.promo-cards {
  display: grid;
  gap: clamp(20px, 3vw, 44px);
}
@media (min-width: 768px) {
  .promo-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.promo-card {
  display: flex;
  flex-direction: column;
  background: #fffdf9;
  border: 1px solid var(--rule-soft);
}
.promo-card__img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 5 / 2;
  object-fit: cover;
}
.promo-card__body {
  display: flex;
  flex: 1;
  flex-direction: column;
  padding: clamp(22px, 2.6vw, 34px);
}
.promo-card__title {
  font-family: var(--serif-display);
  font-weight: 500;
  font-size: clamp(25px, 2.2vw, 32px);
  line-height: 1.1;
  color: var(--ink);
}
.promo-card__text {
  max-width: 34em;
  margin-top: 12px;
  font-size: 16px;
  line-height: 1.6;
  color: var(--ink-soft);
}
.promo-card__action {
  margin-top: auto;
  padding-top: clamp(20px, 2.4vw, 28px);
}

/* ---- Testimonials band ------------------------------------------------- */
/* Honey panel with the statement and social badges; a light panel with the quote
   carousel (js/home.js) and a cut-out portrait at its right edge, her hair rising
   above the panel. The portrait sits outside the slides, so it stays put. */

.tm {
  --tm-accent: #ecb54b;
  --tm-panel: #fbf8f3;
  --tm-h: clamp(330px, 27vw, 390px);    /* quote panel height (desktop) */
  --tm-rise: clamp(20px, 2vw, 30px);    /* how far her hair rises above it */
  --tm-fig-ratio: 0.634;                /* portrait width / height: the cut-out's own shape (820 x 1294) */
  --tm-fig-w: calc((var(--tm-h) + var(--tm-rise)) * var(--tm-fig-ratio));
  padding-block: calc(var(--tm-rise) + clamp(36px, 5vw, 64px)) clamp(56px, 8vw, 112px);
  overflow-x: clip;
}
.tm__panel {
  display: grid;
  background: var(--tm-accent);
  border-radius: 20px;
  color: var(--ink);
}
.tm__intro {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(26px, 3vw, 40px);
  padding: clamp(28px, 3.4vw, 52px) clamp(24px, 3.4vw, 52px);   /* never taller than --tm-h, so her hair always rises */
  text-align: center;
}
.tm__statement {
  max-width: 15.5em;
  font-family: var(--sans);
  font-weight: 700;
  font-size: clamp(21px, 1.85vw, 27px);
  line-height: 1.3;
  letter-spacing: 0.01em;
  color: var(--ink);
}
.tm__badges {
  display: flex;
  justify-content: center;
  margin: 0;
  padding: 0;
  list-style: none;
}
.tm__badges li + li { border-left: 1.5px solid var(--ink); }
.tm__badge {
  display: grid;
  justify-items: center;
  gap: 8px;
  padding: 4px clamp(16px, 2vw, 28px);
  color: var(--ink);
}
.tm__badge-name {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--sans);
  font-weight: 600;
  font-size: clamp(17px, 1.5vw, 22px);
  line-height: 1;
}
.tm__badge-name svg {
  width: 1.15em;
  height: 1.15em;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.tm__badge-meta {
  font-family: var(--sans);
  font-weight: 500;
  font-size: 13.5px;
  letter-spacing: 0.02em;
}
.tm__badge:hover .tm__badge-meta,
.tm__badge:focus-visible .tm__badge-meta { text-decoration: underline; text-underline-offset: 3px; }
.tm__badge:focus-visible { outline: 2px solid var(--ink); outline-offset: 4px; }

.tm__stage {
  position: relative;
  background: var(--tm-panel);
  touch-action: pan-y;   /* horizontal swipes change the quote */
}
.tm__slides { display: grid; }
.tm__slide {
  grid-area: 1 / 1;
  margin: 0;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.45s ease, visibility 0s linear 0.45s;
}
.tm__slide.is-active {
  opacity: 1;
  visibility: visible;
  transition: opacity 0.45s ease;
}
.tm__quote {
  margin: 0;
  font-family: var(--sans);
  font-weight: 400;
  font-size: clamp(19px, 1.75vw, 25px);
  line-height: 1.34;
  color: var(--ink);
}
.tm__quote::before { content: "\201C"; }
.tm__quote::after { content: "\201D"; }
.tm__by {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  margin-top: clamp(18px, 2vw, 28px);
  font-family: var(--sans);
  font-size: 15px;
  color: var(--ink-soft);
}
.tm__name { text-wrap: balance; }
.tm__pill {
  padding: 5px 13px;
  border-radius: 999px;
  background: var(--tm-accent);
  font-weight: 700;
  font-size: 13.5px;
  color: var(--ink);
}
.tm__figure { pointer-events: none; }   /* swipes and the arrows work over her too */
.tm__figure img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 0;
}
.tm__arrow {
  position: absolute;
  z-index: 2;
  top: 50%;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1.5px solid var(--ink);
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  transform: translateY(-50%);
  transition: background-color 0.2s ease;
}
.tm__arrow:hover { background: var(--tm-accent); }
.tm__arrow:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }
.tm__arrow svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* desktop: side by side, the portrait standing on the panel's bottom edge, flush right */
@media (min-width: 900px) {
  .tm__panel { grid-template-columns: minmax(0, 0.43fr) minmax(0, 0.57fr); }
  .tm__stage {
    min-height: var(--tm-h);
    border-radius: 48px 20px 20px 48px;
  }
  .tm__slide {
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: var(--tm-h);
    padding-left: clamp(84px, 7vw, 100px);
    padding-right: calc(var(--tm-fig-w) + clamp(22px, 2.6vw, 40px));
  }
  .tm__body { padding-block: 32px; }
  .tm__figure {
    position: absolute;
    z-index: 1;
    right: 0;
    bottom: 0;
    width: var(--tm-fig-w);
    height: calc(var(--tm-h) + var(--tm-rise));   /* not the stage's: a taller panel never zooms her */
    /* follow the panel's rounded bottom-right corner; above the panel nothing is clipped */
    clip-path: inset(-200px 0 0 0 round 0 0 20px 0);
  }
  .tm__arrow--prev { left: clamp(20px, 2vw, 32px); }
  .tm__arrow--next { right: clamp(16px, 1.8vw, 28px); }
}

/* narrower desktops: more room for the quote */
@media (min-width: 900px) and (max-width: 1199px) {
  .tm__panel { grid-template-columns: minmax(0, 0.37fr) minmax(0, 0.63fr); }
  .tm__badge { padding-inline: clamp(10px, 4vw - 26px, 28px); }   /* both handles stay inside the honey column at 900px */
}

/* phones and tablets: stacked, the portrait (head to just below the jar) standing on
   a rule at the top of a bordered card, her hair breaking its top edge */
@media (max-width: 899px) {
  .tm {
    --tm-fw: min(58vw, 240px);
    --tm-fh: calc(var(--tm-fw) * 0.92);
    --tm-rise-m: calc(var(--tm-fh) * 0.09);
    padding-block: 0 clamp(48px, 10vw, 72px);
  }
  .tm .container { padding-inline: 0; }
  .tm__panel {
    grid-template-columns: minmax(0, 1fr);   /* never wider than the screen */
    border-radius: 0;
    padding-bottom: 28px;
  }
  .tm__intro { padding: 44px 24px 0; }
  .tm__badge { padding-inline: clamp(10px, 3.5vw, 28px); }   /* both handles fit on 360px phones */
  .tm__badge-meta { font-size: clamp(12px, 3.4vw, 13.5px); }
  .tm__stage {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin: calc(var(--tm-rise-m) + 34px) var(--gutter) 0;
    padding: 0 24px 56px;
    border: 1.5px solid var(--ink);
    border-radius: 40px 40px 24px 24px;
  }
  .tm__figure {
    position: relative;
    width: var(--tm-fw);
    height: var(--tm-fh);
    margin-top: calc(-1 * var(--tm-rise-m));
  }
  .tm__figure::after {   /* the rule she stands on */
    content: "";
    position: absolute;
    left: 0;
    right: -5%;
    bottom: 0;
    height: 1.5px;
    background: var(--ink);
  }
  .tm__slides { align-self: stretch; }
  .tm__slide {
    display: flex;
    flex-direction: column;
    text-align: center;
  }
  /* bylines line up at the card's foot on every slide, level with the arrows */
  .tm__body {
    display: flex;
    flex: 1;
    flex-direction: column;
    align-self: center;
    width: 100%;
    max-width: 32rem;   /* a readable measure on tablets */
    padding-top: 26px;
  }
  .tm__quote { margin-bottom: auto; text-wrap: balance; }
  .tm__by { justify-content: center; padding-inline: 16px; }   /* clear of the arrows */
  .tm__arrow { top: auto; bottom: 47px; transform: none; }
  .tm__arrow:focus-visible { outline-offset: 1px; }   /* the outline stays on screen */
  .tm__arrow--prev { left: -14px; }
  .tm__arrow--next { right: -14px; }
}

/* large phones and tablets: a narrow centred quote, as in the reference */
@media (min-width: 480px) and (max-width: 899px) {
  .tm__quote { max-width: 16.5em; margin-inline: auto; }
}

/* phones: the byline breaks into two even lines, the same on every slide */
@media (max-width: 479px) {
  .tm__name { max-width: 15em; }
}

/* the smallest phones: the badges stack */
@media (max-width: 339px) {
  .tm__badges { flex-direction: column; align-items: center; gap: 14px; }
  .tm__badges li + li { border-left: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .cat-tile__img,
  .cat-tile__meta svg,
  .tm__slide,
  .tm__slide.is-active,
  .tm__arrow { transition: none; }
}
