/* ==========================================================================
   Frames — Home-only editorial stylesheet
   Loaded by index.html only. Extends styles.css (which owns the tokens and the
   header/footer/button shell); nothing here redefines a shared token.

   Everything is visible at rest. home.js may add motion on top; the stable
   hooks it can target are .is-masked, .is-revealing, .is-lifted and
   .is-caption-visible. None of them hide content in CSS.
   ========================================================================== */

/* ---------- Section rhythm ---------- */

.home-section {
  position: relative;
  padding-block: clamp(5rem, 9vw, 9rem);
  border-bottom: 1px solid var(--line);
}

.home-section:last-of-type {
  border-bottom: 0;
}

.home-section__inner {
  display: grid;
  grid-template-columns: minmax(0, 0.92fr) minmax(0, 1.08fr);
  align-items: center;
  column-gap: clamp(1.75rem, 4.5vw, 4.5rem);
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

[data-home-section="hero"] .home-section__inner {
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
}

[data-home-section="smoke-spice"] .home-section__inner {
  grid-template-columns: minmax(0, 0.82fr) minmax(0, 1.18fr);
}

.home-section__copy,
.home-section__media {
  min-width: 0;
}

.home-section__copy {
  position: relative;
  z-index: 2;
}

/* Alternate the photo side on two chapters for editorial rhythm. */
[data-home-section="table"] .home-section__copy,
[data-home-section="pour"] .home-section__copy {
  grid-column: 2;
  grid-row: 1;
}

[data-home-section="table"] .home-section__media,
[data-home-section="pour"] .home-section__media {
  grid-column: 1;
  grid-row: 1;
}

/* ---------- Labels, headings and body copy ---------- */

.home-label {
  display: inline-flex;
  align-items: center;
  gap: 0.85rem;
  margin-bottom: 1.6rem;
  color: var(--ember);
  font-size: var(--label-size);
  font-weight: 600;
  letter-spacing: var(--label-tracking);
  line-height: 1.4;
  text-transform: uppercase;
}

.home-label::before {
  content: "";
  flex: 0 0 auto;
  width: 26px;
  height: 1px;
  background: currentColor;
}

.home-label::after {
  content: "";
  flex: 0 0 auto;
  width: 52px;
  height: 1px;
  background: var(--line);
}

.home-heading {
  font-size: clamp(2.6rem, 4.4vw, 4.6rem);
  font-weight: 400;
  letter-spacing: -0.02em;
  line-height: 1.03;
  text-wrap: balance;
}

.home-heading em {
  color: var(--ember);
}

.home-body {
  max-width: 46ch;
  margin-top: 1.65rem;
  color: var(--muted);
  font-size: clamp(0.98rem, 1.05vw, 1.1rem);
  line-height: 1.75;
}

.home-body p + p {
  margin-top: 1.1rem;
}

.home-quote {
  max-width: 38ch;
  margin-top: 1.8rem;
  padding-left: 1.25rem;
  border-left: 2px solid var(--ember);
  color: var(--bone);
  font-family: var(--display);
  font-size: clamp(1.4rem, 2.1vw, 1.9rem);
  font-style: italic;
  line-height: 1.3;
}

/* ---------- Collage layout ---------- */

.home-section__media {
  position: relative;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  align-items: start;
  /* Room for the offset backing cards without borrowing from the gutter. */
  padding: 10px 16px 18px 0;
}

.home-collage__tile {
  position: relative;
  z-index: 0;
  width: 100%;
  min-width: 0;
  margin: 0;
  background: var(--charcoal);
  transition: transform 0.5s var(--ease), box-shadow 0.5s var(--ease);
}

/* Offset backing card, ember on small tiles, quiet bone on the lead tile. */
.home-collage__tile::before {
  content: "";
  position: absolute;
  inset: 10px -10px -10px 10px;
  z-index: -1;
  border: 1px solid rgba(210, 104, 28, 0.55);
  pointer-events: none;
}

.home-collage__tile--lead::before {
  inset: -10px 10px 10px -10px;
  border-color: rgba(243, 237, 226, 0.24);
}

.home-collage__tile img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  /* Warm, slightly graded image treatment — no colour accents introduced. */
  filter: saturate(1.08) contrast(1.05) brightness(0.96) sepia(0.07);
  /* Only filter is transitioned here: GSAP owns transform on this element. */
  transition: filter 0.5s var(--ease);
}

/* Fine local grain over the photography (the global grain stays in styles.css). */
.home-collage__tile::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  opacity: 0.07;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 160 160'%3E%3Cfilter id='g'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23g)'/%3E%3C/svg%3E");
}

.home-collage__caption {
  position: absolute;
  inset: auto 0 0;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 1.9rem 0.9rem 0.75rem;
  background: linear-gradient(0deg, rgba(12, 11, 10, 0.9), rgba(12, 11, 10, 0));
  color: var(--bone);
  font-size: 0.72rem;
  font-variant-caps: all-small-caps;
  letter-spacing: 0.16em;
  line-height: 1.3;
  /* GSAP owns transform (y/opacity) here; CSS keeps the hover colour fade. */
  transition: color 0.3s var(--ease);
}

.home-collage__caption::before {
  content: "";
  flex: 0 0 auto;
  width: 14px;
  height: 1px;
  background: var(--ember);
  transform: scaleX(0.45);
  transform-origin: left center;
  transition: transform 0.4s var(--ease);
}

/* Single-photo chapters. */
.home-section__media[data-home-collage="hero"],
.home-section__media[data-home-collage="come-through"] {
  grid-template-columns: minmax(0, 1fr);
}

.home-section__media[data-home-collage="hero"] .home-collage__tile--lead {
  aspect-ratio: 4 / 5;
  max-height: min(74vh, 720px);
}

.home-section__media[data-home-collage="come-through"] .home-collage__tile--lead {
  aspect-ratio: 5 / 4;
}

/* Two-photo chapters: a large lead with a smaller tile sitting over its edge. */
.home-section__media[data-home-collage="room"],
.home-section__media[data-home-collage="table"],
.home-section__media[data-home-collage="pour"] {
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 0.85fr);
}

.home-section__media[data-home-collage="room"] .home-collage__tile--lead,
.home-section__media[data-home-collage="table"] .home-collage__tile--lead,
.home-section__media[data-home-collage="pour"] .home-collage__tile--lead {
  aspect-ratio: 4 / 5;
  max-height: min(72vh, 660px);
}

.home-section__media[data-home-collage="room"] .home-collage__tile:not(.home-collage__tile--lead),
.home-section__media[data-home-collage="table"] .home-collage__tile:not(.home-collage__tile--lead),
.home-section__media[data-home-collage="pour"] .home-collage__tile:not(.home-collage__tile--lead) {
  z-index: 1;
  aspect-ratio: 1 / 1;
  margin-top: clamp(2rem, 5vw, 4.5rem);
  margin-left: -1.25rem;
}

/* The dish chapter uses a tight five-image mosaic. */
.home-section__media[data-home-collage="smoke-spice"] {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.home-section__media[data-home-collage="smoke-spice"] .home-collage__tile--lead {
  grid-column: 1 / -1;
  aspect-ratio: 16 / 9;
}

.home-section__media[data-home-collage="smoke-spice"] .home-collage__tile:not(.home-collage__tile--lead) {
  aspect-ratio: 4 / 3;
}

.home-section__media[data-home-collage="smoke-spice"] .home-collage__tile:nth-child(3) {
  margin-top: 1.25rem;
}

/* ---------- Dark closing panel ---------- */

.home-section--come-through {
  padding-block: clamp(5.5rem, 10vw, 10rem);
  border-top: 1px solid var(--line);
  border-bottom: 0;
  background: radial-gradient(circle at 76% 44%, rgba(210, 104, 28, 0.16), transparent 55%),
    var(--charcoal);
}

.home-section--come-through .home-label::after {
  background: rgba(243, 237, 226, 0.26);
}

.home-actions {
  margin-top: 1.6rem;
}

.home-actions + .home-actions {
  margin-top: 0.8rem;
}

/* ---------- Micro-interactions ---------- */

/* Home-scoped refinements; the shared shell in styles.css stays untouched. */
body.home .site-nav a::after {
  background: var(--ember);
}

body.home .site-nav a:hover::after,
body.home .site-nav a:focus-visible::after,
body.home .site-nav a.is-active::after {
  transform: scaleX(1);
}

body.home .btn:hover {
  box-shadow: inset 0 0 0 1px var(--ember);
}

body.home .btn:focus-visible,
body.home .social-link:focus-visible,
body.home .nav-toggle:focus-visible {
  outline: 2px solid var(--ember);
  outline-offset: 4px;
}

@media (hover: hover) {
  .home-collage__tile:hover,
  .home-collage__tile.is-lifted {
    z-index: 3;
    transform: translateY(-6px);
    box-shadow: 0 18px 40px rgba(12, 11, 10, 0.45);
  }

  .home-collage__tile:hover img,
  .home-collage__tile.is-lifted img {
    filter: saturate(1.16) contrast(1.08) brightness(1.02) sepia(0.05);
    transform: scale(1.03);
  }

  .home-collage__tile:hover .home-collage__caption,
  .home-collage__tile.is-caption-visible .home-collage__caption {
    transform: translateY(-3px);
    color: var(--ember);
  }

  .home-collage__tile:hover .home-collage__caption::before,
  .home-collage__tile.is-caption-visible .home-collage__caption::before {
    transform: scaleX(1.9);
  }
}

.home-collage__tile:focus-within {
  outline: 2px solid var(--ember);
  outline-offset: 4px;
}

/* Motion hooks: resting state of a masked tile is unclipped and visible. */
.home-collage__tile.is-masked img {
  clip-path: inset(0 0 0 0);
}

.home-section__media.is-revealing .home-collage__tile img {
  will-change: clip-path, transform;
}

/* ---------- Tablet and mobile ---------- */

@media (max-width: 820px) {
  .home-section {
    padding-block: clamp(3.75rem, 9vw, 6rem);
  }

  .home-section__inner,
  [data-home-section="hero"] .home-section__inner,
  [data-home-section="smoke-spice"] .home-section__inner,
  .home-section--come-through .home-section__inner {
    grid-template-columns: minmax(0, 1fr);
    row-gap: 2.5rem;
  }

  .home-section__copy,
  .home-section__media,
  [data-home-section="table"] .home-section__copy,
  [data-home-section="table"] .home-section__media,
  [data-home-section="pour"] .home-section__copy,
  [data-home-section="pour"] .home-section__media {
    grid-column: 1;
    grid-row: auto;
  }

  .home-heading {
    font-size: clamp(2.5rem, 6vw, 3.75rem);
  }

  .home-body {
    max-width: 58ch;
  }

  .home-section__media {
    padding: 8px 12px 14px 0;
  }

  .home-section__media[data-home-collage="room"] .home-collage__tile:not(.home-collage__tile--lead),
  .home-section__media[data-home-collage="table"] .home-collage__tile:not(.home-collage__tile--lead),
  .home-section__media[data-home-collage="pour"] .home-collage__tile:not(.home-collage__tile--lead) {
    margin-left: -0.75rem;
  }

  .home-section__media[data-home-collage="smoke-spice"] .home-collage__tile:nth-child(3) {
    margin-top: 0;
  }
}

@media (max-width: 480px) {
  /* Clear the fixed header so the hero label is not tucked underneath it. */
  .home-section--hero {
    padding-top: calc(var(--header-h) + 1rem);
  }

  .home-label {
    gap: 0.6rem;
    margin-bottom: 1.1rem;
  }

  .home-label::before {
    width: 18px;
  }

  .home-label::after {
    width: 30px;
  }

  .home-heading {
    font-size: clamp(2.05rem, 8.6vw, 2.75rem);
  }

  .home-body {
    margin-top: 1.2rem;
  }

  .home-section__inner,
  [data-home-section="hero"] .home-section__inner,
  [data-home-section="smoke-spice"] .home-section__inner,
  .home-section--come-through .home-section__inner {
    row-gap: 2rem;
  }

  .home-section__media,
  .home-section__media[data-home-collage="hero"],
  .home-section__media[data-home-collage="room"],
  .home-section__media[data-home-collage="table"],
  .home-section__media[data-home-collage="smoke-spice"],
  .home-section__media[data-home-collage="pour"],
  .home-section__media[data-home-collage="come-through"] {
    grid-template-columns: minmax(0, 1fr);
    padding: 6px 10px 12px 0;
  }

  .home-section__media[data-home-collage="smoke-spice"] .home-collage__tile--lead {
    grid-column: 1;
    aspect-ratio: 4 / 3;
  }

  .home-section__media[data-home-collage="hero"] .home-collage__tile--lead,
  .home-section__media[data-home-collage="room"] .home-collage__tile--lead,
  .home-section__media[data-home-collage="table"] .home-collage__tile--lead,
  .home-section__media[data-home-collage="pour"] .home-collage__tile--lead {
    max-height: none;
  }

  .home-section__media[data-home-collage="room"] .home-collage__tile:not(.home-collage__tile--lead),
  .home-section__media[data-home-collage="table"] .home-collage__tile:not(.home-collage__tile--lead),
  .home-section__media[data-home-collage="pour"] .home-collage__tile:not(.home-collage__tile--lead) {
    margin-top: 0;
    margin-left: 0;
  }

  .home-collage__tile::before {
    inset: 7px -7px -7px 7px;
  }

  .home-collage__tile--lead::before {
    inset: -7px 7px 7px -7px;
  }

  .home-actions {
    width: 100%;
  }
}

/* ---------- Reduced motion ---------- */

/* Transition-duration is already neutralised globally in styles.css; here we
   also drop the decorative lifts/scale so nothing moves for motion-sensitive
   visitors. Colour changes and all content remain available. */
@media (prefers-reduced-motion: reduce) {
  body.home .home-collage__tile:hover,
  body.home .home-collage__tile.is-lifted,
  body.home .home-collage__tile:hover img,
  body.home .home-collage__tile.is-lifted img,
  body.home .home-collage__caption,
  body.home .home-collage__caption::before {
    transform: none !important;
  }

}
