/* =================================================================
   Departments page, in page order:
     page hero (breadcrumb, title, checkout photo) → department index
     (jump links) → one section per group of departments
   Department cards: css/components/department-card.css.
   ================================================================= */

/* ─────────────────────────── Page hero ─────────────────────────── */

.page-hero {
  padding-block: 2.4rem 4.8rem;
  background: linear-gradient(to bottom, var(--color-paper), var(--color-mist));
}

.page-hero__container {
  display: grid;
  gap: 3.2rem;
  align-items: center;
}

/* Phones: breadcrumb, title, text and the two group links centred */
.page-hero__content { text-align: center; }

.breadcrumb { margin-bottom: 2rem; font-size: var(--text-sm); }

.breadcrumb__list { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 0.4rem; }

.breadcrumb__item { display: inline-flex; align-items: center; gap: 0.4rem; color: var(--color-text-soft); }

/* Separator chevron, pointing toward the reading direction */
.breadcrumb__item + .breadcrumb__item::before {
  content: '';
  width: 0.7rem;
  height: 0.7rem;
  margin-inline: 0.4rem;
  border-top: 0.15rem solid currentColor;
  border-inline-end: 0.15rem solid currentColor;
  transform: rotate(45deg);
}
[dir="rtl"] .breadcrumb__item + .breadcrumb__item::before { transform: rotate(-45deg); }

.breadcrumb__link { color: var(--color-link); text-decoration: underline; text-underline-offset: 0.3rem; }

.breadcrumb__item[aria-current="page"] { font-weight: var(--font-weight-semibold); color: var(--color-text); }

.page-hero__title {
  margin-bottom: 1.6rem;
  font-size: var(--text-display);
  font-weight: var(--font-weight-black);
  line-height: 1.55;   /* room for the highlight box, see css/base.css */
}

.page-hero__text {
  max-width: 54ch;
  margin-inline: auto;
  font-size: var(--text-md);
  color: var(--color-text-soft);
}

.page-hero__groups {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1rem;
  margin-top: 2.4rem;
}

@media (min-width: 769px) {
  .page-hero__content { text-align: start; }
  .breadcrumb__list { justify-content: flex-start; }
  .page-hero__text { margin-inline: 0; }
  .page-hero__groups { justify-content: flex-start; }
}

.page-hero__group {
  display: inline-flex;
  align-items: center;
  gap: 0.8rem;
  min-height: 4.4rem;
  padding-block: 0.4rem;
  padding-inline: 0.6rem 1.6rem;
  border-radius: var(--radius-pill);
  background: var(--color-surface);
  border: 0.1rem solid var(--color-border);
  font-weight: var(--font-weight-semibold);
  transition: border-color var(--transition-base), background-color var(--transition-base);
}

.page-hero__group:hover { border-color: var(--color-teal-deep); background: var(--color-teal-mist); }

.page-hero__group-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 3.2rem;
  height: 3.2rem;
  padding-inline: 0.8rem;
  border-radius: var(--radius-pill);
  background: var(--color-teal-deep);
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  color: var(--color-paper);
}
.page-hero__group--fresh .page-hero__group-count { background: var(--color-leaf-deep); }

.page-hero__media { aspect-ratio: 16 / 9; box-shadow: var(--shadow-raised); }
.page-hero__image { object-position: 60% 50%; }

@media (min-width: 992px) {
  .page-hero { padding-block: 4rem 7.2rem; }
  .page-hero__container { grid-template-columns: 1fr 1.1fr; gap: 6.4rem; }
}

/* ─────────────────────────── Department index ─────────────────────────── */
/* Jump links to every department. Phones and tablets: one swipeable row
   that stays under the header. Laptops: a wrapped, static list. */

.department-index {
  position: sticky;
  top: var(--header-height);
  z-index: 10;
  border-block: 0.1rem solid var(--color-border);
  background: rgb(255 255 255 / 0.96);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}

.department-index__container {
  display: flex;
  align-items: center;
  gap: 1.2rem;
  padding-block: 1rem;
}

.department-index__label {
  flex-shrink: 0;
  font-size: var(--text-xs);
  font-weight: var(--font-weight-semibold);
  color: var(--color-text-soft);
}

.department-index__list {
  display: flex;
  gap: 0.6rem;
  overflow-x: auto;
  scrollbar-width: none;
  overscroll-behavior-x: contain;
}
.department-index__list::-webkit-scrollbar { display: none; }

.department-index__link {
  display: inline-flex;
  align-items: center;
  min-height: 4rem;
  padding-inline: 1.4rem;
  border-radius: var(--radius-pill);
  background: var(--color-teal-mist);
  font-size: var(--text-sm);
  font-weight: var(--font-weight-medium);
  white-space: nowrap;
  transition: background-color var(--transition-base), color var(--transition-base);
}
.department-index__link--fresh { background: var(--color-leaf-mist); }
.department-index__link:hover { background: var(--color-ink); color: var(--color-paper); }

/* Keyboard focus inside the scroll row: keep the ring inside the strip */
.department-index__link:focus-visible { outline-offset: -0.3rem; }

@media (min-width: 992px) {
  .department-index { position: static; background: var(--color-surface); -webkit-backdrop-filter: none; backdrop-filter: none; }
  .department-index__container { align-items: flex-start; padding-block: 1.6rem; }
  .department-index__label { padding-top: 0.9rem; }
  .department-index__list { flex-wrap: wrap; overflow: visible; }
}

/* ─────────────────────────── Department groups ─────────────────────────── */

/* Anchored targets clear the header and, on phones, the sticky index */
.department-group,
.department-group .department-card { scroll-margin-top: calc(var(--header-height) + 7.2rem); }

@media (min-width: 992px) {
  .department-group,
  .department-group .department-card { scroll-margin-top: calc(var(--header-height) + 2.4rem); }
}

.department-group__grid {
  display: grid;
  gap: 2rem;
}

/* Arriving from a link (e.g. a receipt line on the home page): the
   department's card is outlined in amber */
.department-card:target {
  border-color: var(--color-amber);
  box-shadow: 0 0 0 0.3rem var(--color-amber), var(--shadow-raised);
}

@media (min-width: 561px) {
  .department-group__grid { grid-template-columns: repeat(2, 1fr); gap: 2.4rem; }
}

@media (min-width: 992px) {
  .department-group__grid { grid-template-columns: repeat(3, 1fr); }
}

@media (min-width: 1201px) {
  .department-group__grid--fresh { grid-template-columns: repeat(4, 1fr); }
  .department-group__grid--grocery { grid-template-columns: repeat(4, 1fr); }
}
