/* Home page modules: hero intro, featured carousel, latest notes, brand strip.
   Loaded after components.css on the two home pages only. */

/* ---------- Hero intro ---------- */

.hero__intro {
  max-width: 60ch;
  margin-top: clamp(20px, 2.4vw, 32px);
  font-size: var(--step-1);
  line-height: 1.7;
  color: var(--ink-soft);
}

/* ---------- Section frame ---------- */

.home-sec {
  --home-pad: clamp(3.5rem, 2.2rem + 5vw, 7rem);
  padding-block: var(--home-pad);
  border-top: 1px solid var(--rule);
}

.home-sec__head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--space-m) var(--space-xl);
  margin-bottom: clamp(1.75rem, 1.2rem + 2.4vw, 3.25rem);
}

.home-sec__title {
  font-size: var(--step-4);
  line-height: 1;
  letter-spacing: -0.02em;
}

.home-sec__tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-s) var(--space-l);
}

/* ---------- Carousel ---------- */

.carousel__controls {
  display: none;
  gap: var(--space-2xs);
}

.js-ready .carousel__controls { display: flex; }

.carousel__btn {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border: 1px solid var(--charcoal);
  border-radius: var(--radius);
  background: transparent;
  color: var(--charcoal);
  cursor: pointer;
  transition: background-color var(--dur-s) ease, color var(--dur-s) ease, opacity var(--dur-s) ease;
}

.carousel__btn .icon-back { transform: rotate(180deg); }

.carousel__btn:hover:not(:disabled) {
  background: var(--charcoal);
  color: var(--ivory);
}

.carousel__btn:disabled {
  opacity: 0.35;
  cursor: default;
}

.carousel__track {
  --per-view: 1.7;
  display: flex;
  gap: var(--col-gap);
  margin: 0;
  padding: 0 var(--gutter) var(--space-2xs);
  margin-inline: calc(-1 * var(--gutter));
  list-style: none;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-snap-type: x mandatory;
  scroll-padding-inline: var(--gutter);
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

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

.carousel__slide {
  flex: 0 0 calc((100% - (var(--per-view) - 1) * var(--col-gap)) / var(--per-view));
  min-width: 0;
  scroll-snap-align: start;
}

@media (min-width: 640px) {
  .carousel__track { --per-view: 2.6; }
}

@media (min-width: 720px) {
  .carousel__track {
    --per-view: 3;
    margin-inline: 0;
    padding-inline: 0;
    scroll-padding-inline: 0;
  }
}

@media (min-width: 1040px) {
  .carousel__track { --per-view: 4; }
}

.carousel__progress {
  position: relative;
  height: 1px;
  margin-top: var(--space-m);
  background: var(--rule-strong);
}

.carousel__progress span {
  position: absolute;
  inset-block: -1px;
  left: 0;
  width: 100%;
  background: var(--clay);
}

.js:not(.js-ready) .carousel__progress { display: none; }

/* Featured product card (mirrors the shop card: same frame tint, type and price format) */

.fcard {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.fcard__media { display: block; }

.fcard__frame {
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  background: #efe8dc;
  overflow: hidden;
}

.fcard__frame img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
}

.fcard__body {
  display: flex;
  flex-direction: column;
  flex: 1;
  padding-top: var(--space-s);
}

.fcard__brand {
  color: var(--sage-deep);
  font-size: var(--step--2);
}

.fcard__name {
  margin: 4px 0 var(--space-2xs);
  font-size: var(--step-2);
  line-height: 1.15;
}

.fcard__name a:hover,
.fcard__name a:focus-visible { color: var(--clay-deep); }

.fcard__price {
  margin-top: auto;
  font-size: var(--step-0);
  letter-spacing: 0.02em;
}

.fcard__from { color: var(--ink-soft); }

@media (prefers-reduced-motion: no-preference) {
  .fcard__frame img { transition: transform var(--dur-l) var(--ease-out); }
  .fcard:hover .fcard__frame img { transform: scale(1.04); }
}

/* ---------- Latest notes ---------- */

.notes__grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-2xl) var(--col-gap);
}

.note-card {
  display: grid;
  align-content: start;
  gap: var(--space-s);
}

.note-card__media { display: block; overflow: hidden; }

.note-card .frame {
  aspect-ratio: 3 / 2;
  margin-bottom: var(--space-2xs);
}

.note-card__cat { color: var(--sage-deep); }

.note-card__title {
  font-size: var(--step-3);
  line-height: 1.1;
}

.note-card__title a {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
  text-decoration-color: transparent;
  transition: text-decoration-color var(--dur-m) var(--ease-out), color var(--dur-s) ease;
}

.note-card__title a:hover,
.note-card__title a:focus-visible { text-decoration-color: currentColor; }

.note-card__excerpt {
  color: var(--ink-soft);
  font-size: var(--step-0);
}

.note-card .text-link { justify-self: start; }

@media (prefers-reduced-motion: no-preference) {
  .note-card .frame img { transition: transform var(--dur-l) var(--ease-out); }
  .note-card:hover .frame img { transform: scale(1.03); }
}

@media (min-width: 720px) {
  .notes__grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .note-card .frame { aspect-ratio: 4 / 5; }
  .note-card__title { font-size: var(--step-2); }
}

/* ---------- Brand strip ---------- */

.brands {
  padding-block: clamp(2rem, 1.2rem + 3vw, 3.75rem);
  border-top: 1px solid var(--rule);
  background: #efe8dc;
}

.brands__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-m);
  margin-bottom: var(--space-m);
}

.brands__title {
  max-width: none;
  color: var(--sage-deep);
  font-weight: 500;
}

.brands__toggle {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius);
  background: transparent;
  color: var(--charcoal);
  cursor: pointer;
  transition: background-color var(--dur-s) ease, color var(--dur-s) ease;
}

.brands__toggle:hover {
  background: var(--charcoal);
  color: var(--ivory);
}

.brands__toggle .icon { width: 20px; height: 20px; }

.marquee { overflow: hidden; }

.marquee__list,
.marquee__group {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: var(--space-m) 0;
  margin: 0;
  padding: 0;
  list-style: none;
}

.marquee__list[hidden] { display: none; }

.brand-mark {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 64px;
  padding-inline: clamp(28px, 5vw, 72px);
  color: var(--charcoal);
}

.brand-mark img {
  width: auto;
  max-width: none;
  opacity: 0.9;
  filter: grayscale(1);
  transition: opacity var(--dur-s) ease, filter var(--dur-s) ease;
}

.brand-mark:hover img,
.brand-mark:focus-visible img {
  opacity: 1;
  filter: none;
}

.brand-mark .logo--marini { height: clamp(44px, 3.6vw, 56px); }
.brand-mark .logo--pavise { height: clamp(24px, 2.2vw, 32px); }
.brand-mark .logo--isclinical { height: clamp(20px, 1.8vw, 26px); }

.brand-mark__word {
  font-family: var(--font-display);
  font-size: clamp(1.75rem, 1.4rem + 1.2vw, 2.25rem);
  font-weight: 300;
  letter-spacing: 0.04em;
  line-height: 1;
  white-space: nowrap;
  opacity: 0.85;
  transition: opacity var(--dur-s) ease, color var(--dur-s) ease;
}

.brand-mark:hover .brand-mark__word,
.brand-mark:focus-visible .brand-mark__word {
  opacity: 1;
  color: var(--clay-deep);
}

/* Looping mode. JS adds .is-marquee only when motion is welcome; otherwise the logos stay a still, wrapping row. */

.marquee.is-marquee {
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 7%, #000 93%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 7%, #000 93%, transparent);
}

.marquee.is-marquee .marquee__track {
  display: flex;
  width: max-content;
  animation: marquee-slide var(--marquee-dur, 48s) linear infinite;
}

.marquee.is-marquee .marquee__group {
  flex: none;
  flex-wrap: nowrap;
  gap: 0;
}

.marquee.is-marquee .brand-mark { flex: none; }

.marquee.is-marquee:hover .marquee__track,
.marquee.is-marquee:focus-within .marquee__track,
.marquee.is-paused .marquee__track { animation-play-state: paused; }

.brands__toggle[hidden] { display: none; }

@keyframes marquee-slide {
  from { transform: translateX(0); }
  to { transform: translateX(calc(-1 * var(--marquee-shift, 50%))); }
}

@media (prefers-reduced-motion: reduce) {
  .marquee.is-marquee .marquee__track { animation: none; }
}
