/* Home page (docs/pages/home.md). Shared components live in site.css. */

/* ---------- Hero: the logo, big, on red, with a few shapes that answer the visitor ---------- */

.hero {
  position: relative;
  isolation: isolate;
  padding: var(--space-2) var(--gutter) var(--space-6);
  overflow-x: clip;
  text-align: center;
}

/* The bottom edge is a shop awning: the logo is the sign over the door (D-017) */
.hero::after {
  content: "";
  position: absolute;
  inset-inline: 0;
  top: 100%;
  height: 16px;
  background: radial-gradient(circle 16px at 50% 0, var(--color-brand-red) 15.5px, transparent 16px) center top / 32px 16px repeat-x;
}

/* The logo's place in the hero. The logo itself is in the header, and starts out drawn over this space (D-060) */
.hero__title {
  margin: 0;
}

.hero__space {
  display: block;
  width: min(100%, 340px);
  aspect-ratio: 860 / 410; /* the full logo, with the tagline */
  margin-inline: auto;
}

/* M-37: the hero becomes the header. home.js sets --s (scale), --ty (drop) and --p (0 at the top, 1 once the hero
   is gone) from the scroll; these defaults are the top of the page, so the first paint is the big logo.
   Scrolling is the only thing that moves it (DP-11) */
.site-header__brand--hero {
  --s: 3.7;
  --ty: 54px;
  --p: 0;
  transform-origin: 50% 0;
  translate: 0 var(--ty);
  scale: var(--s);
}

/* The full logo is sized by its letters, like everywhere else; the tagline hangs below and doesn't count */
.site-header__brand--hero .logo {
  height: calc(var(--mark-h) * 410 / 300);
  margin-block-end: calc(var(--mark-h) * -110 / 300);
}

/* At 330px and up the yellow tagline counts as large text (D-018); it's gone well before the logo is that small */
.site-header__brand--hero .logo-tagline {
  opacity: clamp(0, 1 - var(--p) * 3, 1);
}

/* The "קונספט" mark rides the logo's corner while the logo shrinks under it. It starts as the hero had it
   (13px, 6px off the corner) and ends as every other page has it (11px, 30px off), moving out only at the very end
   (--p3 is --p cubed), so it never runs into the buttons on the way */
.site-header__brand--hero {
  --p3: 0;
}

.site-header__brand--hero .concept-tag {
  inset: 0 auto auto 0;
  padding: 5px 10px;
  font-size: var(--text-xs);
  transform-origin: 0 0;
  --k: calc(1 - var(--p) * 0.154); /* 13px down to 11px */
  transform:
    scale(calc(var(--k) / var(--s)))
    translate(calc((-6px - 24px * var(--p3)) / var(--k)), calc((-4px - 6px * var(--p)) / var(--k)));
}

/* Without JavaScript nothing shrinks it, so the header simply scrolls away with the big logo, like a hero */
html:not(.js) .site-header {
  position: relative;
}

@media (min-width: 1024px) {
  .site-header__brand--hero {
    --s: 4.46;
    --ty: 66px;
  }
}

@media (min-width: 900px) {
  .hero {
    padding-block: var(--space-3) var(--space-6);
  }

  .quick {
    padding-top: var(--space-5);
  }

  .shelf {
    padding-top: var(--space-2);
  }

  .shelf .section-head {
    margin-bottom: var(--space-2);
  }

  .hero__space {
    width: 460px;
  }
}

/* M-24: the shapes come in once on load, then lean toward the pointer and drift as the page scrolls.
   Nothing moves until the visitor does (DP-11). Their offsets are set on .hero by home.js */
.hero__shapes {
  position: absolute;
  inset: 0;
  z-index: -1;
}

.shape {
  position: absolute;
  top: var(--y);
  inset-inline-start: var(--x);
  width: var(--s);
  color: var(--c, var(--color-brand-yellow));
  opacity: var(--o, 1);
  translate:
    calc(var(--px, 0) * var(--d) * 18px)
    calc((var(--py, 0) * 12px - var(--sy, 0) * 56px) * var(--d));
  transition: translate 900ms var(--ease-out);
}

/* A square box, so --x and --y place every shape the same way, whatever its proportions */
.shape svg {
  width: 100%;
  height: auto;
  aspect-ratio: 1;
  rotate: var(--r, 0deg);
  animation: shape-in var(--duration-peak) var(--ease-spring) both;
  animation-delay: calc(450ms + var(--i, 0) * 70ms);
}

/* M-25: poke a shape and it does a little spin */
.shape.is-poked svg {
  animation: shape-poke 700ms var(--ease-spring);
}

@keyframes shape-in {
  from { transform: scale(0) rotate(-90deg); }
}

@keyframes shape-poke {
  40% { transform: scale(1.4) rotate(160deg); }
  100% { transform: rotate(360deg); }
}

.shape--white { --c: var(--color-on-red); }
.shape--deep { --c: var(--color-red-deep); }

@media (max-width: 699px) {
  .shape--wide {
    display: none;
  }
}

/* ---------- Deals and departments, right under the hero ---------- */

.quick {
  padding-block: var(--space-6) 0;
}

.quick__list {
  display: flex;
  gap: var(--space-2);
  padding-block: var(--space-2);
  padding-inline: max(var(--gutter), (100% - var(--container)) / 2);
  overflow-x: auto;
  scroll-snap-type: x proximity;
  scroll-padding-inline: var(--gutter);
  scrollbar-width: none;
}

.quick__list::-webkit-scrollbar {
  display: none;
}

@media (min-width: 900px) {
  .quick__list {
    justify-content: space-between;
  }
}

/* ---------- Top items ---------- */

.shelf {
  padding-block: var(--space-4) var(--space-5);
}

/* ---------- The home corner: quieter colors and bigger pictures, in the same punched frames (D-039).
   No red or yellow surfaces, no stickers, no turns, no prices: these are departments (D-047) ---------- */

.showcase__grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-3);
}

.showcase__item--lead {
  grid-column: 1 / -1;
}

.showcase__tile {
  position: relative;
  display: block;
  text-decoration: none;
}

/* The frame carries the punch, so the arrow can sit in the hole without being cut out with it */
.showcase__frame {
  display: block;
  aspect-ratio: 1;
  overflow: hidden;
  border-radius: var(--radius-m);
  background: var(--color-bg-deep);
  mask:
    var(--shape-punch) 0 0 / var(--punch) var(--punch) no-repeat,
    linear-gradient(#000 0 0);
  mask-composite: exclude;
}

.showcase__img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: scale var(--duration-slow) var(--ease-out);
}

/* The arrow in the punched hole (M-11) */
.showcase__go {
  position: absolute;
  top: 4px;
  inset-inline-end: 4px;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--color-surface);
  box-shadow: 0 0 0 1px var(--color-line);
  transition:
    background-color var(--duration-base),
    color var(--duration-base);
}

.showcase__go svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* A label on the picture, like the sign over a store aisle: the department's name as real text (DP-7, D-047) */
.showcase__label {
  position: absolute;
  transition: translate var(--duration-slow) var(--ease-out);
  bottom: var(--space-2);
  inset-inline-start: var(--space-2);
  display: grid;
  gap: 2px;
  padding: 6px 10px;
  border-radius: var(--radius-s);
  background: var(--color-surface);
  box-shadow: var(--shadow-lift);
}

.showcase__name {
  font: 600 var(--text-s) / 1.2 var(--font-ui);
}

.showcase__item--lead .showcase__label {
  bottom: var(--space-3);
  inset-inline-start: var(--space-3);
  padding: 8px 12px;
}

.showcase__item--lead .showcase__name {
  font-size: var(--text-m);
}

/* M-29: under the pointer the picture moves in slowly and the arrow fills. Slow and soft, no bounce here */
.showcase__tile:is(:hover, :focus-visible) .showcase__img {
  scale: var(--zoom-in);
}

.showcase__tile:is(:hover, :focus-visible) .showcase__label {
  translate: 0 -3px;
}

.showcase__tile:hover .showcase__go,
.showcase__tile:focus-visible .showcase__go {
  background: var(--color-ink);
  color: var(--color-surface);
}

@media (min-width: 900px) {
  .showcase {
    padding-block: var(--space-8);
  }

  .showcase__grid {
    grid-template-columns: 2fr 1fr 1fr;
    gap: var(--space-5);
  }

  .showcase__item--lead {
    grid-column: 1;
    grid-row: 1 / span 2;
  }

  .showcase__item--lead .showcase__tile,
  .showcase__item--lead .showcase__frame {
    height: 100%;
    aspect-ratio: auto;
  }

  .showcase__label {
    bottom: var(--space-4);
    inset-inline-start: var(--space-4);
    padding: 10px 14px;
  }

  .showcase__name {
    font-size: var(--text-m);
  }

  .showcase__item--lead .showcase__label {
    bottom: var(--space-5);
    inset-inline-start: var(--space-5);
    padding: 14px 18px;
  }

  .showcase__item--lead .showcase__name {
    font-size: var(--text-xl);
  }
}

/* ---------- Nearest branch ---------- */

.branch__card {
  display: grid;
  justify-items: start;
  gap: var(--space-4);
  padding: var(--space-5);
  border-radius: var(--radius-m);
  background: var(--color-surface);
}

.branch__badge {
  display: grid;
  place-items: center;
  width: 84px;
  height: 84px;
  border-radius: 50%;
  background: var(--color-brand-red);
  transition: rotate var(--duration-base) var(--ease-spring);
}

.branch__badge .face {
  grid-area: 1 / 1;
  width: 46px;
  transition: opacity var(--duration-fast);
}

.branch__face--wink {
  opacity: 0;
}

/* M-34: reach for the branch card and the face tilts its head and winks: "come over" */
.branch__card:is(:hover, :focus-within) .branch__badge {
  rotate: -10deg;
}

.branch__card:is(:hover, :focus-within) .branch__face--smile { opacity: 0; }
.branch__card:is(:hover, :focus-within) .branch__face--wink { opacity: 1; }

.branch__title {
  font: 600 var(--text-xl) / 1.2 var(--font-ui);
}

.branch__text {
  margin-top: var(--space-1);
  max-width: 48ch;
}

.branch__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2) var(--space-4);
}

@media (min-width: 900px) {
  .branch__card {
    grid-template-columns: auto 1fr auto;
    align-items: center;
    column-gap: var(--space-5);
    padding: var(--space-6);
  }

  .branch__title {
    font-size: var(--text-2xl);
  }
}
