/*! AlpenPura · image carousel, plan section + lightbox (Oct 2026) · js/ap-carousel.js
 * Carousel: Chalet Gams pages (kitchen equipment). Scroll-snap track:
 * swipe on phones, arrow buttons and keyboard on desktop; a tap opens the
 * photo large in a lightbox. No zoom effects (owner request for /gams).
 * Plan section (.ap-plan): Chalet Steinbock pages, floor plans + site plan in
 * the lightbox, where they can be enlarged. */

.ap-car-host { min-width: 0; }
.ap-car { margin-top: 22px; max-width: 100%; min-width: 0; contain: inline-size; }
.ap-car-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 14px; }
.ap-car-head .ey { margin: 0; }
.ap-car-nav { display: flex; gap: 8px; }
.ap-car-btn {
  width: 40px; height: 40px; padding: 0; border-radius: 50%;
  border: 1px solid var(--o-soft, #D1C4BA); background: transparent; color: var(--on-s, #1C1914);
  display: grid; place-items: center; cursor: pointer;
  transition: background .25s, color .25s, border-color .25s, opacity .25s;
}
.ap-car-btn .material-symbols-outlined { font-size: 18px; }
.ap-car-btn:hover:not(:disabled), .ap-car-btn:focus-visible { background: var(--pine, #1E2B1F); border-color: var(--pine, #1E2B1F); color: #fff; outline: none; }
.ap-car-btn:disabled { opacity: .3; cursor: default; }

.ap-car-track {
  list-style: none; margin: 0; padding: 0; display: flex; gap: 12px;
  overflow-x: auto; scroll-snap-type: x mandatory; scroll-behavior: smooth;
  overscroll-behavior-x: contain; -webkit-overflow-scrolling: touch; scrollbar-width: none;
}
.ap-car-track::-webkit-scrollbar { display: none; }
.ap-car-track:focus-visible { outline: 2px solid var(--gold, #A08060); outline-offset: 4px; }
.ap-car-item { flex: 0 0 calc((100% - 24px) / 2.35); scroll-snap-align: start; }
.ap-car-item figure { margin: 0; }
.ap-car-link {
  position: relative; display: block; aspect-ratio: 4 / 3; overflow: hidden; border-radius: 3px;
  background: var(--s-low, #F3F0EB); cursor: zoom-in;
}
.ap-car-link img { display: block; width: 100%; height: 100%; object-fit: cover; transition: filter .4s ease; }
.ap-car-link:hover img { filter: brightness(1.06); }
.ap-car-zoom {
  position: absolute; right: 10px; bottom: 10px; width: 30px; height: 30px; border-radius: 50%;
  display: grid; place-items: center; font-size: 16px !important; color: #fff;
  background: rgba(20, 18, 14, .45); opacity: .85; transition: opacity .3s;
}
@media (hover: hover) { .ap-car-zoom { opacity: 0; } .ap-car-link:hover .ap-car-zoom, .ap-car-link:focus-visible .ap-car-zoom { opacity: 1; } }
.ap-car-cap { margin-top: 10px; }
.ap-car-cap b { display: block; font: 500 9px/1.5 'Inter', sans-serif; letter-spacing: .18em; text-transform: uppercase; color: var(--primary, #6C5943); }
.ap-car-cap span { display: block; margin-top: 3px; font: 300 .8rem/1.5 'Manrope', sans-serif; color: var(--on-v, #4E453C); }
.ap-car-bar { height: 2px; margin-top: 16px; border-radius: 2px; overflow: hidden; background: var(--o-soft, #D1C4BA); opacity: .6; }
.ap-car-bar i { display: block; height: 100%; width: 0; background: var(--gold, #A08060); transition: width .2s; }
@media (max-width: 767px) { .ap-car-item { flex-basis: 74%; } }

/* Lightbox (one <dialog> per page, created by the script) */
.ap-lb { border: 0; padding: 0; margin: 0; background: transparent; width: 100vw; height: 100vh; height: 100dvh; max-width: none; max-height: none; color: #fff; }
.ap-lb[open] { display: flex; align-items: center; justify-content: center; }
.ap-lb::backdrop { background: rgba(20, 18, 14, .93); }
.ap-lb figure { margin: 0; max-width: min(1400px, 92vw); text-align: center; }
.ap-lb img { display: block; margin: 0 auto; max-width: 100%; max-height: calc(100vh - 150px); max-height: calc(100dvh - 150px); object-fit: contain; border-radius: 3px; }
.ap-lb figcaption { margin-top: 14px; font: 300 .9rem/1.5 'Manrope', sans-serif; color: rgba(255, 255, 255, .85); }
.ap-lb figcaption b { display: block; margin-bottom: 6px; font: 500 10px/1.4 'Inter', sans-serif; letter-spacing: .2em; text-transform: uppercase; color: #E6D6BA; }
.ap-lb-btn {
  position: absolute; width: 46px; height: 46px; padding: 0; border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, .35); background: rgba(20, 18, 14, .35); color: #fff;
  display: grid; place-items: center; cursor: pointer; transition: background .25s;
}
.ap-lb-btn:hover, .ap-lb-btn:focus-visible { background: rgba(255, 255, 255, .15); outline: none; }
.ap-lb-close { top: 18px; right: 18px; }
.ap-lb-prev { left: 18px; top: 50%; transform: translateY(-50%); }
.ap-lb-next { right: 18px; top: 50%; transform: translateY(-50%); }
.ap-lb-count { position: absolute; top: 30px; left: 24px; font: 500 10px/1 'Inter', sans-serif; letter-spacing: .2em; color: rgba(255, 255, 255, .6); }
@media (max-width: 767px) {
  .ap-lb-prev, .ap-lb-next { top: auto; bottom: 20px; transform: none; }
  .ap-lb-prev { left: calc(50% - 58px); }
  .ap-lb-next { right: calc(50% - 58px); }
  .ap-lb img { max-height: calc(100dvh - 210px); }
}
/* Lightbox: zoom for floor plans (.ap-gal[data-zoom], Chalet Steinbock) */
.ap-lb-btn[hidden] { display: none; }
.ap-lb-btn, .ap-lb-count { z-index: 2; }
.ap-lb-zoom { top: 18px; right: 74px; }
.ap-lb-zoomable img { cursor: zoom-in; }
.ap-lb.is-zoomed figure {
  position: fixed; inset: 0; max-width: none; margin: 0; display: flex;
  overflow: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch;
}
.ap-lb.is-zoomed img { flex: none; margin: auto; max-width: none; max-height: none; height: auto; border-radius: 0; cursor: zoom-out; }
.ap-lb.is-zoomed figcaption { display: none; }
.ap-lb.is-zoomed .ap-lb-prev, .ap-lb.is-zoomed .ap-lb-next, .ap-lb.is-zoomed .ap-lb-count { display: none; }
.ap-lb.is-zoomed .ap-lb-btn { background: rgba(20, 18, 14, .78); border-color: rgba(255, 255, 255, .5); }

/* Plan section: heading + plan preview + button → lightbox with all plans */
.ap-plan { background: var(--surface, #FBFAF8); padding: 96px 24px; }
.ap-plan-in {
  max-width: 1180px; margin: 0 auto; display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr);
  grid-template-areas: "card txt" "card cta";
  column-gap: clamp(40px, 6vw, 96px); align-items: center;
}
.ap-plan-fig { grid-area: card; margin: 0; min-width: 0; }
.ap-plan-txt { grid-area: txt; align-self: end; }
.ap-plan-cta { grid-area: cta; align-self: start; margin-top: 32px; }
.ap-plan-h {
  margin-top: 14px; font-family: 'Noto Serif', serif; font-weight: 300; font-style: italic;
  font-size: clamp(2rem, 3.4vw, 3rem); line-height: 1.18; color: var(--on-s, #1B1C1C);
}
.ap-plan-card {
  position: relative; display: block; aspect-ratio: 4 / 3; overflow: hidden; border-radius: 4px;
  background: #FCFAF8; border: 1px solid var(--o-soft, #D1C4BA); cursor: zoom-in;
  box-shadow: 0 34px 64px -40px rgba(30, 43, 31, .38);
  transition: transform .5s cubic-bezier(.2, .7, .2, 1), box-shadow .5s;
}
.ap-plan-card img { display: block; width: 100%; height: 100%; object-fit: contain; }
.ap-plan-card:hover { transform: translateY(-3px); box-shadow: 0 40px 72px -38px rgba(30, 43, 31, .46); }
.ap-plan-card:focus-visible { outline: 2px solid var(--gold, #A08060); outline-offset: 4px; }
.ap-plan-zoom {
  position: absolute; right: 14px; bottom: 14px; width: 38px; height: 38px; border-radius: 50%;
  display: grid; place-items: center; font-size: 19px !important; color: #fff;
  background: var(--pine, #1E2B1F); opacity: .9; transition: transform .3s, opacity .3s;
}
.ap-plan-card:hover .ap-plan-zoom, .ap-plan-card:focus-visible .ap-plan-zoom { transform: scale(1.08); opacity: 1; }
@media (hover: hover) { .ap-plan-zoom { opacity: 0; } }
@media (hover: none) { .ap-plan-zoom { display: none; } }
.ap-plan-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  padding: 15px 30px; border-radius: 2px; text-decoration: none; color: #fff;
  background: linear-gradient(135deg, var(--p-dim, #86715A), var(--primary, #6C5943));
  font: 500 11px/1.2 'Inter', sans-serif; letter-spacing: .18em; text-transform: uppercase;
  transition: filter .25s, box-shadow .25s;
}
.ap-plan-btn .material-symbols-outlined { font-size: 17px; }
.ap-plan-btn:hover { filter: brightness(1.08); box-shadow: 0 10px 24px -14px rgba(108, 89, 67, .8); }
.ap-plan-btn:focus-visible { outline: 2px solid var(--gold, #A08060); outline-offset: 3px; }
@media (max-width: 860px) {
  .ap-plan { padding: 72px 20px; }
  .ap-plan-in { grid-template-columns: minmax(0, 1fr); grid-template-areas: "txt" "card" "cta"; row-gap: 28px; }
  .ap-plan-txt { text-align: center; }
  .ap-plan-cta { margin-top: 0; }
  .ap-plan-btn { display: flex; width: 100%; box-sizing: border-box; }
}

/* Followed by a section on the same background (Chalet Gams: Designkonzept): less empty space */
.ap-plan:has(+ section[style*="background:var(--surface)"]) { padding-bottom: 24px; }

@media (prefers-reduced-motion: reduce) { .ap-car-track { scroll-behavior: auto; } .ap-plan-card, .ap-plan-card:hover { transition: none; transform: none; } }
