/* Factory & Quality — the hub, processing, quality inspection and export packaging.
   One module design serves all four templates: a full-width band per record with the text on one
   side and the photo set on the other. Only what those templates add lives here — tokens, buttons,
   chips, cards, prose, crumbs, notes, plates and the CTA band come from tokens.css and style.css.
   Every class is hm-fx-. Mobile first, CSS grid only, no !important, no horizontal scroll. */

/* ---------- page opener, with an optional hero photo ---------- */
.hm-fx-head {
  display: grid;
  gap: clamp(1.2rem, 3vw, 2.2rem);
  align-items: center;
}
.hm-fx-head h1 { margin-bottom: 0.5rem; max-width: 28ch; }
.hm-fx-head .hm-lede { max-width: 56ch; }
.hm-fx-head__text { min-width: 0; }

.hm-fx-head__media {
  aspect-ratio: 16 / 10;
  overflow: hidden;
  border: var(--hm-border);
  border-radius: var(--hm-radius-lg);
  background: var(--hm-tex-2b);
  box-shadow: var(--hm-shadow-sm);
}
.hm-fx-head__media img,
.hm-fx-head__media .hm-plate {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 0;
  object-fit: cover;
}

@media (min-width: 900px) {
  .hm-fx-head--media {
    grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
    gap: clamp(1.6rem, 3.6vw, 3.2rem);
  }
}

/* ---------- one band per record, alternating paper and tint ---------- */
/* html carries scroll-padding-top: 6.5rem for the sticky header; the sticky in-page nav adds
   about 2.7rem, so a band asks for the difference and lands below both. */
.hm-fx-band {
  padding-block: clamp(2.1rem, 4.4vw, 3.8rem);
  border-top: var(--hm-border);
  scroll-margin-top: 2.9rem;
}
/* The in-page nav already draws a rule under itself, so the first band needs none. */
.hm-subnav + .hm-fx-band { border-top: 0; }

.hm-fx-module {
  display: grid;
  gap: clamp(1.1rem, 2.8vw, 2.2rem);
  align-items: start;
}
.hm-fx-module__body,
.hm-fx-module__media { min-width: 0; }

@media (min-width: 880px) {
  .hm-fx-module {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.06fr);
    gap: clamp(1.6rem, 3.4vw, 3.4rem);
  }
  /* Container loading covers every product form, so it runs full width above its own text. */
  .hm-fx-module--wide { grid-template-columns: minmax(0, 1fr); }
  .hm-fx-module--wide .hm-fx-module__media { order: -1; }
}

/* ---------- the text of one record ---------- */
.hm-fx-module__body > .hm-eyebrow { margin-bottom: 0.5rem; }
.hm-fx-module__title {
  margin: 0 0 0.7rem;
  font-size: clamp(1.5rem, 1.25rem + 0.95vw, 2.1rem);
  letter-spacing: -0.018em;
}
.hm-fx-module__intro {
  margin: 0;
  max-width: 58ch;
  color: var(--hm-ink);
  line-height: 1.65;
}
.hm-fx-module__more {
  display: grid;
  gap: var(--hm-3);
  margin-top: var(--hm-4);
}

/* ---------- the video link, related products ---------- */
.hm-fx-video { margin: 0; }
.hm-fx-video a {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  font-family: var(--hm-font-display);
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--hm-blue);
  text-decoration: none;
}
.hm-fx-video a::before {
  content: "";
  width: 0;
  height: 0;
  border-left: 7px solid currentColor;
  border-top: 5px solid transparent;
  border-bottom: 5px solid transparent;
}
.hm-fx-video a:hover,
.hm-fx-video a:focus-visible {
  color: var(--hm-blue-dark);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.hm-fx-related { display: grid; gap: 0.55rem; }
.hm-fx-related__label { margin: 0; }

/* ---------- the note: a result and the limits that come with it ---------- */
.hm-note.hm-fx-note { max-width: 58ch; }
.hm-note .hm-fx-note__label {
  margin: 0 0 0.3rem;
  font-family: var(--hm-font-mono);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #40678a;
}

/* ---------- the photo set: one large photo, the rest as thumbnails ---------- */
.hm-fx-gallery {
  display: grid;
  gap: var(--hm-2);
  min-width: 0;
}
.hm-fx-gallery__stage {
  display: block;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  border: var(--hm-border);
  border-radius: var(--hm-radius-lg);
  background: var(--hm-tint-2);
  cursor: zoom-in;
}
.hm-fx-gallery__stage img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.6s var(--hm-ease);
}
.hm-fx-gallery__stage:hover img { transform: scale(1.03); }
.hm-fx-gallery__stage:focus-visible {
  outline: 2px solid var(--hm-blue);
  outline-offset: 2px;
}

.hm-fx-gallery__strip {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(4.2rem, 1fr));
  gap: 0.4rem;
  margin: 0;
  padding: 0;
  list-style: none;
}
.hm-fx-gallery__thumb { margin: 0; }
.hm-fx-gallery__thumb a {
  display: block;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  border: var(--hm-border);
  border-radius: var(--hm-radius);
  background: var(--hm-tint-2);
  cursor: zoom-in;
}
.hm-fx-gallery__thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.hm-fx-gallery__thumb a:hover { border-color: var(--hm-blue); }
.hm-fx-gallery__thumb a:focus-visible {
  outline: 2px solid var(--hm-blue);
  outline-offset: 2px;
}

/* No photo stored yet: a drawn steel finish, labelled with the record's own title. */
.hm-fx-plate {
  aspect-ratio: 16 / 10;
  overflow: hidden;
  border: var(--hm-border);
  border-radius: var(--hm-radius-lg);
}
.hm-fx-plate .hm-plate { min-height: 0; }
.hm-fx-plate .hm-plate__label { max-width: 100%; overflow-wrap: anywhere; }

/* ---------- the enlarged viewer ---------- */
.hm-fx-lightbox {
  width: min(960px, calc(100vw - 1.6rem));
  max-height: calc(100vh - 1.6rem);
  padding: 0;
  border: 0;
  border-radius: var(--hm-radius-lg);
  background: var(--hm-white);
  color: var(--hm-ink);
  box-shadow: var(--hm-shadow-lift);
  overflow: auto;
}
.hm-fx-lightbox::backdrop { background: rgba(7, 31, 54, 0.88); }

.hm-fx-lightbox__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--hm-2);
  padding: 0.7rem 0.9rem;
}
.hm-fx-lightbox__bar--nav { border-top: var(--hm-border); }

.hm-fx-lightbox__caption {
  margin: 0;
  color: var(--hm-muted);
  font-family: var(--hm-font-mono);
  font-size: var(--hm-fs-xs);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-variant-numeric: tabular-nums;
}

.hm-fx-lightbox__img {
  display: block;
  width: auto;
  max-width: 100%;
  max-height: 68vh;
  margin: 0 auto;
  background: var(--hm-tint-2);
}
.hm-fx-lightbox[data-state="loading"] .hm-fx-lightbox__img { opacity: 0.4; }

.hm-fx-lightbox__btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 0.8rem;
  border: var(--hm-border);
  border-radius: var(--hm-radius);
  background: var(--hm-white);
  color: var(--hm-ink);
  font-family: var(--hm-font-display);
  font-size: 0.84rem;
  font-weight: 600;
  line-height: 1.2;
  cursor: pointer;
}
.hm-fx-lightbox__btn:hover,
.hm-fx-lightbox__btn:focus-visible {
  border-color: var(--hm-blue);
  color: var(--hm-blue);
  text-decoration: none;
}
.hm-fx-lightbox__close { margin-left: auto; }

/* ---------- the navy band: container loading, set apart from the four forms ---------- */
.hm-fx-band--navy { border-top: 0; }
.hm-fx-band--navy .hm-fx-module__intro { color: #c6daea; }
.hm-fx-band--navy .hm-fx-gallery__stage,
.hm-fx-band--navy .hm-fx-gallery__thumb a {
  border-color: rgba(255, 255, 255, 0.24);
  background: rgba(255, 255, 255, 0.06);
}
.hm-fx-band--navy .hm-fx-gallery__stage:focus-visible,
.hm-fx-band--navy .hm-fx-gallery__thumb a:focus-visible { outline-color: #ffffff; }
.hm-fx-band--navy .hm-chip {
  border-color: rgba(255, 255, 255, 0.3);
  background: transparent;
  color: #e2eefa;
}
.hm-fx-band--navy .hm-chip:hover { border-color: #ffffff; color: #ffffff; }
.hm-fx-band--navy .hm-note {
  background: rgba(255, 255, 255, 0.09);
  border-left-color: #86b6d6;
  color: #dbe9f4;
}
.hm-fx-band--navy .hm-note .hm-fx-note__label { color: #a8cbe2; }
.hm-fx-band--navy .hm-fx-video a { color: #dcecf8; }
.hm-fx-band--navy .hm-fx-video a:hover,
.hm-fx-band--navy .hm-fx-video a:focus-visible { color: #ffffff; }
.hm-fx-band--navy .hm-fx-plate { border-color: rgba(255, 255, 255, 0.18); }

/* ---------- narrow screens, down to 360px ---------- */
@media (max-width: 620px) {
  .hm-fx-band { padding-block: 1.9rem; }
  .hm-fx-module__title { font-size: 1.42rem; }
  .hm-fx-module__more { margin-top: var(--hm-3); }
  .hm-fx-head__media,
  .hm-fx-gallery__stage,
  .hm-fx-plate { aspect-ratio: 4 / 3; }
}

@media (max-width: 420px) {
  .hm-fx-gallery__strip { grid-template-columns: repeat(auto-fill, minmax(3.6rem, 1fr)); }
  .hm-fx-lightbox__bar { flex-wrap: wrap; }
  .hm-fx-lightbox__bar--nav { gap: 0.4rem; }
  .hm-fx-lightbox__btn { padding: 0.4rem 0.6rem; font-size: 0.8rem; }
  .hm-fx-lightbox__img { max-height: 62vh; }
}

@media (prefers-reduced-motion: reduce) {
  .hm-fx-gallery__stage img { transition: none; }
  .hm-fx-gallery__stage:hover img { transform: none; }
}
