/* =============================================================================
   a'moda | أمودة: the home page (SPEC §9.1). Builds on amoda.css.
   Mobile first; logical properties only. Contents: 1 Stack rhythm · 2 Department switch ·
   3 Hero · 4 Rails · 5 Category stories · 6 Shop by category · 7 The houses ·
   8 Feature · 9 Motion
   ============================================================================= */

/* 1 Stack rhythm: one measure between sections, none doubled. */
.home-stack { display: flow-root; }
.home-block { margin-block-start: var(--s-7); }
@media (min-width: 1024px) { .home-block { margin-block-start: var(--s-8); } }
.home-break { margin-block-start: var(--s-7); }
@media (min-width: 1024px) { .home-break { margin-block-start: var(--s-8); } }
.home .service-bar { margin-block-start: var(--s-8); }

/* 2 Department switch (phones and tablets; the header has the tabs on desktop) */
.home-dept { border-block-end: var(--hairline); }
.home-dept ul { display: grid; grid-template-columns: 1fr 1fr; }
.home-dept a {
  display: flex; align-items: center; justify-content: center; min-block-size: 48px;
  color: var(--c-ink-2); border-block-end: 1px solid transparent; margin-block-end: -1px;
  transition: color var(--d-fast) var(--ease), border-color var(--d-fast) var(--ease);
}
.home-dept a:hover { color: var(--c-ink); }
.home-dept a[aria-current] { color: var(--c-ink); border-color: var(--c-ink); }
@media (min-width: 1024px) { .home-dept { display: none; } }

/* 3 Hero: 4:5 phone, 16:10 tablet, 21:9 desktop; copy on the bottom-start. */
.home-hero { position: relative; color: #fff; background: var(--c-image); }
.home-hero-media { aspect-ratio: 4 / 5; }
.home-hero-media > img { object-position: 50% 30%; }
@media (min-width: 600px) { .home-hero-media { aspect-ratio: 16 / 10; } }
@media (min-width: 1024px) {
  .home-hero-media { aspect-ratio: 21 / 9; max-block-size: calc(100svh - var(--header-h) - 80px); min-block-size: 440px; inline-size: 100%; }
}
.home-hero .shade::after { background: linear-gradient(to top, rgb(0 0 0 / .52), rgb(0 0 0 / .14) 42%, rgb(0 0 0 / 0) 68%); }
.home-hero-copy { position: absolute; z-index: 2; inset-inline: 0; inset-block-end: 0; padding-block: var(--s-6); }
@media (min-width: 1024px) { .home-hero-copy { padding-block: var(--s-8); } }
.home-hero-text { display: grid; justify-items: start; gap: var(--s-3); max-inline-size: 720px; }
.home-hero-text .label { opacity: .92; }
.home-hero-text .hero-t { text-wrap: balance; margin-block-end: var(--s-2); text-shadow: 0 1px 24px rgb(0 0 0 / .12); }
:root:lang(ar) .home-hero-text .hero-t { font-size: calc(var(--t-hero) * .86); }
.home-hero .btn-light:focus-visible { outline-color: #fff; }
.home-hero.is-plain { color: var(--c-ink); background: var(--c-ivory); }
.home-hero.is-plain .home-hero-copy { position: static; padding-block: var(--s-8); }

/* 4 Rails: the cards come from amoda.css. */
.home-rail .section-head-text p { max-inline-size: 46ch; }

/* 5 Category stories: two-up 3:4 tiles (4:5 from desktop, so two fit in one view). */
.home-tiles-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s-6) var(--grid-gap); }
@media (min-width: 1024px) { .home-tiles-list { grid-template-columns: repeat(var(--n, 2), minmax(0, 1fr)); } }
.home-tiles-list.is-single { grid-template-columns: 1fr; }
.home-tile { display: grid; gap: var(--s-3); }
.home-tile .ph { display: block; aspect-ratio: 3 / 4; }
@media (min-width: 1024px) { .home-tile .ph { aspect-ratio: 4 / 5; max-block-size: min(72svh, 680px); inline-size: 100%; } }
.home-tiles-list.is-single .home-tile .ph { aspect-ratio: 16 / 10; }
.home-tile img { transition: transform 900ms var(--ease); }
.home-tile-text { display: grid; gap: 2px; }
.home-tile .label { text-decoration: underline; text-decoration-color: transparent; text-underline-offset: 4px; text-decoration-thickness: 1px; transition: text-decoration-color var(--d-fast) var(--ease); }
@media (hover: hover) {
  .home-tile:hover img { transform: scale(1.025); }
  .home-tile:hover .label { text-decoration-color: currentColor; }
}

/* 6 Shop by category: square photographs, three a row on phones (the last row centred),
   one row from desktop. */
.home-cats-list { display: flex; flex-wrap: wrap; justify-content: center; gap: var(--s-5) var(--grid-gap); }
.home-cats-list > li { flex: 0 0 calc((100% - 2 * var(--grid-gap)) / 3); }
@media (min-width: 1024px) {
  .home-cats-list { flex-wrap: nowrap; }
  .home-cats-list > li { flex: 1 1 0; max-inline-size: calc((100% - (max(var(--n, 6), 5) - 1) * var(--grid-gap)) / max(var(--n, 6), 5)); }
}
.home-cat { display: grid; gap: var(--s-3); text-align: center; }
.home-cat .ph { display: block; aspect-ratio: 1; }
.home-cat img { mix-blend-mode: multiply; transition: transform 600ms var(--ease); }
.home-cat-name { font-size: var(--t-small); letter-spacing: .02em; }
:root:lang(ar) .home-cat-name { font-size: 14px; letter-spacing: 0; }
@media (min-width: 1024px) { .home-cat-name { font-size: 14px; } }
@media (hover: hover) {
  .home-cat:hover img { transform: scale(1.04); }
  .home-cat:hover .home-cat-name { text-decoration: underline; text-underline-offset: 4px; text-decoration-thickness: 1px; }
}

/* 7 The houses: names in display capitals in a hairline grid. */
.home-houses-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); border-block-start: var(--hairline); }
@media (min-width: 1024px) { .home-houses-list { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.home-houses-list li { border-block-end: var(--hairline); }
.home-houses-list li:nth-child(odd) { border-inline-end: var(--hairline); }
@media (min-width: 1024px) {
  .home-houses-list li:nth-child(odd) { border-inline-end: 0; }
  .home-houses-list li:not(:nth-child(4n)) { border-inline-end: var(--hairline); }
}
.home-houses-list a, :root:lang(ar) .home-houses-list a[lang="en"] {
  display: grid; place-items: center; min-block-size: 88px; padding: var(--s-3);
  font-family: var(--f-latin-display); font-size: 18px; font-weight: 500; line-height: 1.2;
  letter-spacing: .08em; text-transform: uppercase; text-align: center;
  transition: background-color var(--d-fast) var(--ease);
}
@media (min-width: 600px) { .home-houses-list a { min-block-size: 104px; font-size: 21px; } }
@media (min-width: 1024px) { .home-houses-list a { min-block-size: 120px; font-size: 23px; } }
.home-houses-list a:hover { background: var(--c-ivory); }
.home-houses-list a:focus-visible { outline-offset: -4px; }

/* 8 Feature: ivory, image and text stacked, side by side from desktop. */
.home-feature { background: var(--c-ivory); padding-block: var(--s-7); }
@media (min-width: 1024px) { .home-feature { padding-block: var(--s-8); } }
.home-feature-grid { display: grid; gap: var(--s-6); }
@media (min-width: 1024px) {
  .home-feature-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: center; gap: var(--s-8); }
  .home-feature-grid.is-text { grid-template-columns: 1fr; justify-items: center; text-align: center; }
}
.home-feature-media { display: block; aspect-ratio: 4 / 5; }
@media (min-width: 1024px) { .home-feature-media { max-block-size: min(76svh, 720px); inline-size: 100%; } }
@media (min-width: 600px) and (max-width: 1023.98px) { .home-feature-media { aspect-ratio: 16 / 10; } }
.home-feature-text { display: grid; justify-items: start; gap: var(--s-4); max-inline-size: 30rem; }
.home-feature-grid.is-text .home-feature-text { justify-items: center; }
.home-feature-kicker { color: var(--c-burgundy); }
.home-feature-text .h1 { text-wrap: balance; }
.home-feature-line { max-inline-size: 40ch; }
.home-feature-text .btn { margin-block-start: var(--s-3); }

/* 9 Motion */
@media (prefers-reduced-motion: reduce) {
  .home-tile img, .home-cat img { transition: none; }
  .home-tile:hover img, .home-cat:hover img { transform: none; }
}

/* When the ivory feature closes the page, it meets the service bar without a white band. */
.site-main:has(> .home-stack > .home-feature:last-child) + .service-bar { margin-block-start: 0; border-block-start: 0; }
