/* HWS Vorstand – Frontend
   Steuerung per CSS-Variablen aus den Plugin-Einstellungen:
   --hvs-maxw, --hvs-cols, --hvs-ratio, --hvs-align-d, --hvs-align-m,
   --hvs-minfo, --hvs-accent, --hvs-text, --hvs-name, --hvs-font
*/

.hvs {
  --hvs-maxw: 1600px;
  --hvs-cols: 4;
  --hvs-ratio: 4/5;
  --hvs-align-d: left;
  --hvs-align-m: left;
  --hvs-minfo: 0px;
  --hvs-accent: #e30613;
  --hvs-text: #fff;
  --hvs-name: #262523;
  --hvs-gap: clamp(14px, 2vw, 28px);

  box-sizing: border-box;
  width: 100%;
  max-width: var(--hvs-maxw);
  margin-inline: auto;
  font-family: var(--hvs-font, inherit);
}
.hvs *,
.hvs *::before,
.hvs *::after { box-sizing: border-box; }

.hvs__h {
  font-family: inherit;
  font-size: clamp(1.35rem, 2.4vw, 2rem);
  font-weight: 700;
  letter-spacing: .01em;
  color: var(--hvs-name);
  margin: 0 0 clamp(18px, 2.4vw, 34px);
  text-wrap: balance;
  text-align: var(--hvs-align-d, left);   /* Desktop + Tablet (iPad) */
}

/* ---------- Slider (Rahmen um das Raster, für die Pfeile) ---------- */
.hvs__slider { position: relative; }

.hvs__nav {
  display: none;
  position: absolute;
  top: 44%;
  transform: translateY(-50%);
  z-index: 5;
  width: 40px;
  height: 40px;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 1px solid var(--hvs-accent);
  border-radius: 999px;
  background: #fff;
  color: var(--hvs-accent);
  box-shadow: 0 2px 12px rgba(0,0,0,.18);
  cursor: pointer;
  transition: opacity .2s ease;
}
.hvs__nav svg { width: 20px; height: 20px; }
.hvs__nav--prev { left: 4px; }
.hvs__nav--next { right: 4px; }
.hvs__nav:disabled { opacity: 0; pointer-events: none; }

/* ---------- Raster ---------- */
.hvs__grid {
  display: grid;
  grid-template-columns: repeat(var(--hvs-cols), 1fr);
  gap: var(--hvs-gap);
}

.hvs__card {
  position: relative;
  overflow: hidden;
  background: #e8e6e3;
  border-radius: 2px;
  outline: none;
}

.hvs__photo,
.hvs__card > img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: var(--hvs-ratio);
  object-fit: cover;
  transition: transform .5s cubic-bezier(.16,.84,.44,1), filter .4s ease;
}

/* Info-Balken – standardmässig unter der Unterkante versteckt */
.hvs__info {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  background: var(--hvs-accent);
  color: var(--hvs-text);
  transform: translateY(100%);
  transition: transform .38s cubic-bezier(.16,.84,.44,1);
  will-change: transform;
}

.hvs__name { font-weight: 700; font-size: 1rem; line-height: 1.25; }
.hvs__pos  { font-weight: 500; font-size: .875rem; line-height: 1.3; opacity: .95; }
.hvs__firm { font-weight: 400; font-size: .8rem; line-height: 1.3; opacity: .8; margin-top: 3px; }

/* Hover / Fokus / Touch */
.hvs__card:hover .hvs__info,
.hvs__card:focus-visible .hvs__info,
.hvs__card.is-open .hvs__info { transform: translateY(0); }

.hvs__card:hover .hvs__photo,
.hvs__card:focus-visible .hvs__photo { transform: scale(1.04); }

.hvs__card:focus-visible { box-shadow: 0 0 0 3px var(--hvs-accent); }

/* ---------- Geschäftsstelle: gleiche Karten wie die Mitglieder ---------- */
.hvs__office { margin-top: clamp(46px, 6vw, 84px); }

.hvs__office-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: clamp(28px, 4vw, 56px);
}

.hvs__person {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: clamp(230px, 26vw, 300px);
}
.hvs__person .hvs__card { width: 100%; }

.hvs__mail {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-top: 14px;
  padding: 9px 18px;
  border-radius: 3px;
  background: var(--hvs-accent);
  color: var(--hvs-text);
  font-size: .8rem;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  text-decoration: none;
  transition: filter .2s ease, transform .2s ease;
}
.hvs__mail:hover,
.hvs__mail:focus-visible { filter: brightness(.9); color: var(--hvs-text); transform: translateY(-2px); }
.hvs__mail svg { flex: 0 0 auto; }

/* ---------- Geschäftsstelle: Enterprise-Kontaktzeile (nur ab Desktop/iPad) ----------
   Auf dem Handy bleibt immer die Foto-Karte (.hvs__card) sichtbar. Ab 783px wird bei
   aktiviertem Enterprise-Layout stattdessen .hvs__office-row gezeigt: Foto links -
   GLEICHE Grösse/Format wie eine Vorstands-Karte, kein Strecken - Info-Spalte
   steht separat daneben, KEIN gemeinsamer Rahmen/Hintergrund mit dem Foto. */
.hvs__office-row { display: none; }

/* Eigenständig gestylt (nicht .hvs__card wiederverwendet) - sonst gewinnt
   ".hvs__person .hvs__card { width:100% }" aus der einfachen Karten-Variante
   per Spezifität gegen die feste Breite hier. */
.hvs__office-row__photo {
  width: clamp(230px, 26vw, 300px);
  overflow: hidden;
  border-radius: 2px;
  background: #e8e6e3;
}
.hvs__office-row__photo img {
  display: block;
  transition: transform .5s cubic-bezier(.16, .84, .44, 1);
}
.hvs__office-row__photo:hover img { transform: scale(1.04); }

.hvs__office-row__info {
  max-width: 340px;
  color: var(--hvs-name);
}
.hvs__office-row__name { font-size: 1.3rem; font-weight: 700; line-height: 1.25; }
.hvs__office-row__pos {
  margin-top: 4px;
  font-size: .85rem; font-weight: 600; letter-spacing: .05em; text-transform: uppercase;
  color: var(--hvs-accent);
}
.hvs__office-row__firm { margin-top: 6px; font-size: .85rem; opacity: .65; }

.hvs__office-row__contacts {
  margin: 20px 0 0; padding: 0;
  display: flex; flex-direction: column; gap: 9px;
}
.hvs__office-row__contact { display: flex; align-items: center; gap: 10px; margin: 0; padding: 0; }
.hvs__office-row__contacts svg { flex: 0 0 auto; color: var(--hvs-accent); }
.hvs__office-row__contacts a {
  color: var(--hvs-name); text-decoration: none; font-size: .9rem;
  transition: color .2s ease;
}
.hvs__office-row__contacts a:hover,
.hvs__office-row__contacts a:focus-visible { color: var(--hvs-accent); text-decoration: underline; }

@media (min-width: 783px) {
  .hvs__office--enterprise .hvs__office-grid { flex-direction: column; align-items: stretch; gap: 30px; }
  .hvs__office--enterprise .hvs__person { width: 100%; }
  .hvs__office--enterprise .hvs__person > .hvs__card,
  .hvs__office--enterprise .hvs__person > .hvs__mail { display: none; }

  /* Zweispaltiges Raster, an der Seitenmitte gespiegelt: Foto endet rechts an der
     Mittellinie, Text beginnt links an derselben Mittellinie. --hvs-office-gap
     (Backend-Einstellung) ist der Abstand zwischen Foto-Kante und Text-Kante. */
  .hvs__office--enterprise .hvs__office-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    align-items: center;
    column-gap: var(--hvs-office-gap, 32px);
  }
  .hvs__office--enterprise .hvs__office-row__photo { justify-self: end; }
  .hvs__office--enterprise .hvs__office-row__info { justify-self: start; }
}

/* ---------- Mobil: seitlich scrollbar ---------- */
@media (max-width: 782px) {
  .hvs__grid {
    display: flex;
    gap: 14px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 12px;
    /* Innenabstand links/rechts, damit auch die erste/letzte Karte mittig
       einrasten kann (rechnerisch die Hälfte des freien Raums neben einer
       Karte – dieselbe Kartenbreite wie bei der Geschäftsstelle, siehe unten) */
    padding-inline: calc(50% - min(150px, 40vw));
  }
  .hvs__grid::-webkit-scrollbar { height: 4px; }
  .hvs__grid::-webkit-scrollbar-thumb { background: var(--hvs-accent); border-radius: 2px; }

  /* nur die Karten im seitlichen Slider, nicht die der Geschäftsstelle -
     exakt gleich gross wie eine Geschäftsstelle-Karte (.hvs__person unten:
     min(300px, 80vw)), eine Karte pro Ansicht mittig, kein Anschnitt der
     nächsten Karte am Rand */
  .hvs__grid > .hvs__card {
    flex: 0 0 min(300px, 80vw);
    scroll-snap-align: center;
  }
  /* Platz unter dem Foto, damit der Info-Balken nach unten rutschen kann */
  .hvs__grid > .hvs__card,
  .hvs__person .hvs__card { padding-bottom: var(--hvs-minfo, 0px); }

  /* auf Touch: Info-Balken dauerhaft sichtbar (kein Hover), evtl. ein paar px tiefer */
  .hvs__info { transform: translateY(0); }

  .hvs__person { width: min(300px, 80vw); }

  /* Pfeile < > nur zeigen, wenn wirklich seitlich gescrollt werden kann */
  .hvs--scrollable .hvs__nav { display: flex; }
}

/* Überschriften-Ausrichtung nur auf dem Handy abweichend (iPad = Desktop) */
@media (max-width: 600px) {
  .hvs__h { text-align: var(--hvs-align-m, left); }
}

@media (prefers-reduced-motion: reduce) {
  .hvs__photo, .hvs__info, .hvs__mail { transition: none; }
}
