/* Villa page (/ville/{id}). Loaded after site.css, only by Pages/Villa.cshtml: same tokens, mobile first, breakpoint 960 px. */

:root {
  --busy: #E8E6E0;
  --busy-ink: #5F655F;
  --past-ink: #6E756F;
  --lightbox-bg: rgba(17, 24, 22, .96);
}

/* ---------- Top: title, gallery ---------- */
.villa-top {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding-top: 16px;
}

.villa-gallery { order: 1; position: relative; display: flex; flex-direction: column; gap: 10px; }
.villa-head { order: 2; display: flex; flex-direction: column; gap: 16px; }

.villa-head__text { display: flex; flex-direction: column; gap: 6px; }
.villa-head__title { font-size: 32px; font-weight: 800; overflow-wrap: anywhere; }
.villa-head__address {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  font-size: 14px;
  color: var(--muted);
}
.villa-head__address .icon { margin-top: 2px; }
.villa-head__address a { color: var(--ink2); font-weight: 600; text-decoration: underline; text-decoration-color: var(--input); text-underline-offset: 3px; }
.villa-head__address a:hover { color: var(--accent); text-decoration-color: currentColor; }
.villa-head__registry { font-size: 12px; color: var(--muted); }
.villa-head__actions { display: none; }

/* Phone: one photo at a time, edge to edge at the photos' own 4:3 (nothing cropped), swipe to browse. */
.villa-gallery__stage { position: relative; margin: 0 calc(-1 * var(--gutter)); }
.villa-gallery__grid {
  display: flex;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
}
.villa-gallery__grid::-webkit-scrollbar { display: none; }
.villa-gallery__item {
  flex: 0 0 100%;
  aspect-ratio: 4 / 3;
  scroll-snap-align: start;
  scroll-snap-stop: always;
  overflow: hidden;
  background: var(--photo-2);
}
.villa-gallery__item--empty { display: none; }
.villa-gallery__item--empty:first-child { display: flex; }
.villa-gallery__counter {
  position: absolute;
  right: 12px;
  bottom: 12px;
  padding: 4px 10px;
  border-radius: 99px;
  background: rgba(0, 0, 0, .6);
  color: #FFFFFF;
  font-size: 13px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  pointer-events: none;
}
.villa-gallery__link { display: block; width: 100%; height: 100%; }
.villa-gallery__link img { width: 100%; height: 100%; object-fit: cover; transition: filter .15s; }
.villa-gallery__link:hover img { filter: brightness(.94); }
.villa-gallery__link:focus-visible { outline-offset: -3px; }
/* Autoplay bar (wwwroot/js/villa.js): fills along the bottom of the photo, the end brings the next one. */
.villa-gallery__progress {
  display: none;
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 3px;
  background: rgba(255, 255, 255, .35);
  pointer-events: none;
}
.villa-gallery__progress::after {
  content: "";
  display: block;
  height: 100%;
  background: #FFFFFF;
  transform-origin: left center;
  transform: scaleX(0);
}
.villa-gallery.is-autoplay .villa-gallery__progress { display: block; }
.villa-gallery.is-autoplay .villa-gallery__progress::after {
  animation: villa-progress var(--gallery-autoplay, 5s) linear both;
}
.villa-gallery.is-autoplay-paused .villa-gallery__progress::after { animation-play-state: paused; }
@keyframes villa-progress {
  from { transform: scaleX(0); }
  to { transform: scaleX(1); }
}
/* Phone: tapping a photo opens the gallery, the extra button is only for larger screens. */
.villa-gallery__all { display: none; min-height: 44px; font-size: 14px; }

@media (min-width: 960px) {
  .villa-top { gap: 24px; padding-top: 28px; }
  .villa-head { order: 1; flex-direction: row; align-items: flex-end; justify-content: space-between; flex-wrap: wrap; gap: 24px; }
  .villa-gallery { order: 2; }
  .villa-head__text { gap: 10px; }
  .villa-head__title { font-size: 52px; }
  .villa-head__address { align-items: center; gap: 8px; font-size: 15px; }
  .villa-head__address .icon { margin-top: 0; }
  .villa-head__registry { font-size: 13px; }
  .villa-head__actions { display: flex; flex-wrap: wrap; gap: 12px; }

  .villa-gallery__grid {
    display: grid;
    grid-template-columns: minmax(0, 3fr) minmax(0, 1fr) minmax(0, 1fr);
    grid-template-rows: 250px 250px;
    gap: 12px;
    overflow: visible;
  }
  .villa-gallery__stage { margin: 0; }
  .villa-gallery__counter, .villa-gallery__progress, .villa-gallery.is-autoplay .villa-gallery__progress,
  .villa-gallery__item--extra { display: none; }
  .villa-gallery__item { aspect-ratio: auto; border-radius: 4px; }
  .villa-gallery__item:first-child { grid-row: 1 / span 2; border-radius: 18px 4px 4px 18px; }
  .villa-gallery__item:nth-child(3) { border-top-right-radius: 18px; }
  .villa-gallery__item:nth-child(5) { border-bottom-right-radius: 18px; }
  .villa-gallery__item--empty, .villa-gallery__item--empty:first-child { display: flex; }
  .villa-gallery__all { display: inline-flex; position: absolute; right: 16px; bottom: 16px; padding: 0 16px; }
}

/* ---------- Body: main column + sticky side column ---------- */
.villa-body {
  display: flex;
  flex-direction: column;
  gap: 36px;
  padding-top: 24px;
  padding-bottom: 40px;
}
.villa-main { display: flex; flex-direction: column; gap: 36px; min-width: 0; }
@media (min-width: 960px) {
  .villa-body {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 360px;
    align-items: start;
    gap: 56px;
    padding-top: 24px;
    padding-bottom: 72px;
  }
  .villa-main { gap: 56px; }
}

.villa-section { display: flex; flex-direction: column; gap: 12px; }
.villa-section__intro { display: flex; flex-direction: column; gap: 4px; }
.villa-section__head { display: flex; flex-direction: column; gap: 14px; }
.villa-h2 { font-size: 22px; font-weight: 800; }
.villa-lead { font-size: 14px; color: var(--muted); }
@media (min-width: 960px) {
  .villa-section { gap: 18px; }
  .villa-section__intro { gap: 6px; }
  .villa-section__head { flex-direction: row; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 16px; }
  .villa-section__head--end { align-items: flex-end; }
  .villa-h2 { font-size: 28px; }
  .villa-lead { font-size: 15px; }
}

/* ---------- Specs ---------- */
/* Two tiles: the wider one with the guests (and how they sleep), then the floor area. */
.villa-specs { display: flex; flex-wrap: wrap; gap: 10px; }
.villa-spec {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  flex: 1 1 120px;
  min-width: 0;
}
.villa-spec--guests { flex: 2 1 200px; }
.villa-spec__icon { color: var(--accent); }
.villa-spec__text { display: flex; flex-direction: column; min-width: 0; }
.villa-spec__value { font-family: var(--font-head); font-size: 17px; font-weight: 800; line-height: 1.1; }
.villa-spec__label { font-size: 12px; color: var(--muted); }
@media (min-width: 960px) {
  .villa-specs { gap: 12px; }
  .villa-spec { flex-basis: 160px; gap: 12px; padding: 16px 18px; border-radius: var(--radius-tile); }
  .villa-spec--guests { flex-basis: 280px; }
  .villa-spec__icon { width: 22px; height: 22px; }
  .villa-spec__value { font-size: 20px; }
  .villa-spec__label { font-size: 13px; }
}

/* ---------- About ---------- */
.villa-about__lead { font-size: 16px; font-weight: 500; color: var(--ink2); }
.villa-about__text { font-size: 15px; color: var(--ink2); overflow-wrap: anywhere; }
@media (min-width: 960px) {
  .villa-about__lead { font-size: 19px; }
  .villa-about__text { font-size: 16px; }
}

/* ---------- Amenities ---------- */
.amenities { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.amenity {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding: 11px 12px;
  border-radius: 10px;
  background: var(--stone);
  font-size: 14px;
  font-weight: 500;
  line-height: 1.3;
}
.amenity span { min-width: 0; overflow-wrap: anywhere; }
.amenity__icon { flex: none; width: 18px; color: var(--accent); font-size: 15px; text-align: center; }
@media (min-width: 960px) {
  .amenities { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
  .amenity { gap: 10px; padding: 12px 14px; border-radius: 12px; font-size: 15px; }
}

/* ---------- Availability ---------- */
/* Month arrows: laid over the cards, level with the month names, at the outer corners (the first card's
   left, the last visible card's right). The nav itself lets clicks through to the days below. */
.cal-frame { position: relative; }
.cal-nav {
  position: absolute;
  top: 6px;
  left: 6px;
  right: 6px;
  z-index: 1;
  display: flex;
  justify-content: space-between;
  pointer-events: none;
}
.cal-nav__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  pointer-events: auto;
  transition: background-color .12s;
}
.cal-nav__btn:hover { background: var(--stone); color: var(--ink); }
.cal-nav__btn.is-disabled,
.cal-nav__btn:disabled { color: var(--line); background: transparent; cursor: default; }
.cal-nav__btn.is-disabled { pointer-events: none; }

.cal-months { display: grid; grid-template-columns: minmax(0, 1fr); gap: 28px; }
.cal-month:nth-child(n + 2) { display: none; } /* one month on phones */
.cal-month { padding: 16px; border: 1px solid var(--line); border-radius: 16px; }
.cal {
  table-layout: fixed;
  border-collapse: separate;
  border-spacing: 4px;
  margin: -4px;
  width: calc(100% + 8px);
}
.cal__title {
  padding-bottom: 8px;
  font-family: var(--font-head);
  font-size: 16px;
  font-weight: 700;
  text-align: center;
}
.cal th {
  padding: 0 0 2px;
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: .04em;
  text-transform: uppercase;
}
.cal td { padding: 0; }
.cal__day {
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 1;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #FFFFFF;
  font-size: 14px;
  font-weight: 500;
}
.cal__day--busy {
  border-color: var(--busy);
  background: var(--busy);
  color: var(--busy-ink);
  text-decoration: line-through;
}
.cal__day--past { border-color: transparent; background: transparent; color: var(--past-ink); }

/* With js/availability.js the days are buttons: arrival, departure, the nights between. */
button.cal__day {
  width: 100%;
  padding: 0;
  color: var(--ink);
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: border-color .12s, background-color .12s;
}
button.cal__day[aria-disabled="true"] { cursor: default; }
button.cal__day:not([aria-disabled="true"]):hover { border-color: var(--accent); }
.cal__day.is-out:not(.cal__day--busy) { color: var(--past-ink); background: transparent; border-style: dashed; }
.cal__day.is-between { border-color: var(--accent-soft); background: var(--accent-soft); color: var(--accent-soft-ink); }
.cal__day.is-start,
.cal__day.is-end,
button.cal__day.is-start:hover,
button.cal__day.is-end:hover { border-color: var(--accent); background: var(--accent); color: #FFFFFF; text-decoration: none; }

.cal-pick {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 16px;
  padding: 14px 16px;
  border-radius: 14px;
  background: var(--stone);
}
.cal-pick[hidden], .cal-pick [hidden] { display: none; }
.cal-pick__status { flex: 1 1 260px; font-size: 14px; color: var(--ink2); }
.cal-pick__status.is-done { font-weight: 600; color: var(--ink); } /* same size as the hint: same height */
.cal-pick__actions { display: flex; flex-wrap: wrap; gap: 8px; }
.cal-pick__clear { background: #FFFFFF; }
.cal-pick__clear .icon { display: none; }
/* Hidden but still taking its room, so the bar keeps the same size before and after picking. */
.cal-pick__clear.is-hidden { visibility: hidden; }

/* "Departure only" dialog: a centred card; on phones a sheet anchored to the bottom, close to the thumb. */
.cal-dialog {
  width: min(420px, calc(100% - 32px));
  max-width: none;
  padding: 0;
  border: 0;
  border-radius: 20px;
  background: #FFFFFF;
  color: var(--ink);
  box-shadow: 0 24px 64px rgba(24, 32, 28, .22), 0 2px 8px rgba(24, 32, 28, .08);
}
.cal-dialog::backdrop { background: rgba(24, 32, 28, .45); }
.cal-dialog__body { display: flex; flex-direction: column; align-items: flex-start; gap: 12px; padding: 28px; }
.cal-dialog__title { font-family: var(--font-head); font-size: 20px; font-weight: 800; line-height: 1.25; }
.cal-dialog__text { font-size: 15px; line-height: 1.55; color: var(--ink2); }
.cal-dialog form { align-self: stretch; margin-top: 8px; }
.cal-dialog__ok { width: 100%; }
@media (max-width: 559px) {
  .cal-dialog {
    width: 100%;
    max-height: calc(100% - 48px);
    margin: auto 0 0;
    border-radius: 20px 20px 0 0;
  }
  .cal-dialog__body { padding: 24px 20px calc(20px + env(safe-area-inset-bottom)); }
  .cal-dialog__title { font-size: 19px; }
}
@media (prefers-reduced-motion: no-preference) {
  @keyframes cal-dialog-in { from { opacity: 0; transform: translateY(12px) scale(.98); } }
  @keyframes cal-sheet-in { from { transform: translateY(100%); } }
  @keyframes cal-backdrop-in { from { opacity: 0; } }
  .cal-dialog[open] { animation: cal-dialog-in .2s ease-out; }
  .cal-dialog[open]::backdrop { animation: cal-backdrop-in .2s ease-out; }
  @media (max-width: 559px) {
    .cal-dialog[open] { animation: cal-sheet-in .25s cubic-bezier(.2, .8, .2, 1); }
  }
}
@media (max-width: 559px) {
  /* Phones: two lines of text, then the quote button on its own row; "Cancella date" comes in beside it as
     a square ✕ button (its text stays for screen readers), so nothing wraps and the bar keeps its height. */
  .cal-pick__status { min-height: 2lh; }
  .cal-pick__actions { flex: 1 1 100%; flex-wrap: nowrap; }
  .cal-pick__quote { flex: 1 1 auto; }
  .cal-pick__clear { flex: none; width: 48px; padding: 0; }
  .cal-pick__clear .icon { display: block; }
  .cal-pick__clear-text { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .cal-pick__clear.is-hidden { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  button.cal__day, .cal-nav__btn { transition: none; }
}

.cal-legend { display: flex; flex-wrap: wrap; gap: 8px 18px; font-size: 13px; color: var(--ink2); }
.cal-legend li { display: inline-flex; align-items: center; gap: 6px; }
.cal-legend__swatch { width: 16px; height: 16px; border-radius: 5px; border: 1px solid var(--input); background: #FFFFFF; }
.cal-legend__swatch--busy { border-color: var(--busy); background: var(--busy); }
.cal-legend__swatch--past { border-style: dashed; background: transparent; }

@media (min-width: 960px) {
  .cal-months { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cal-month:nth-child(n + 2) { display: block; }
  .cal-month { padding: 20px; }
  .cal-nav { top: 10px; left: 10px; right: 10px; }
  .cal__title { font-size: 17px; }
  .cal-legend { gap: 8px 24px; font-size: 14px; }
  .cal-legend li { gap: 8px; }
  .cal-legend__swatch { width: 18px; height: 18px; }
}

/* ---------- Location ---------- */
.villa-map {
  flex-direction: column;
  gap: 8px;
  height: 200px;
  padding: 0 16px;
  border-radius: 16px;
  text-align: center;
}
.villa-where { font-size: 15px; color: var(--ink2); }
.villa-where a { display: inline-flex; align-items: center; min-height: 44px; font-weight: 600; }
@media (min-width: 960px) {
  .villa-map { height: 320px; gap: 10px; }
}

/* ---------- Guests: scores and reviews ---------- */
.scores { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.score {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  height: 100%;
  min-height: 44px;
  padding: 8px 12px 8px 8px;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--ink);
  text-decoration: none;
}
a.score:hover { border-color: var(--input); color: var(--ink); }
a.score:hover .score__name { color: var(--accent); }
.score__badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 8px;
  border-radius: 8px;
  background: var(--ink);
  color: #FFFFFF;
  font-family: var(--font-head);
  font-size: 16px;
  font-weight: 800;
  line-height: 1.2;
}
.score__badge--light { background: var(--stone); color: var(--ink); }
.score__text { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.score__name { font-size: 13px; font-weight: 700; }
.score__count { font-size: 12px; color: var(--muted); }

.villa-reviews { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
.villa-reviews__all {
  display: inline-flex;
  align-items: center;
  align-self: flex-start;
  gap: 6px;
  min-height: 44px;
  font-size: 15px;
  font-weight: 600;
}
@media (min-width: 960px) {
  .scores { display: flex; flex-wrap: wrap; }
  .score { padding-right: 14px; }
  .score__badge { padding: 6px 9px; font-size: 17px; }
  .score__name { font-size: 14px; }
  .villa-reviews { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
  .villa-reviews .review { padding: 22px; border-radius: 16px; }
}

/* ---------- Request form section (fields: form.css) ---------- */
.villa-request {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 22px 18px;
  border-radius: 18px;
  background: var(--stone);
}
@media (min-width: 960px) {
  .villa-request { gap: 20px; padding: 32px; border-radius: 20px; }
}

/* ---------- Side column ---------- */
.villa-aside { display: flex; flex-direction: column; gap: 16px; }
.talk {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #FFFFFF;
}
.talk__head { display: flex; flex-direction: column; gap: 4px; }
.talk__title { font-size: 20px; font-weight: 800; }
.talk__lead { font-size: 14px; color: var(--muted); }
.talk__contacts {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  font-size: 15px;
}
.talk__contacts li { display: flex; align-items: center; gap: 10px; min-height: 44px; overflow-wrap: anywhere; }
.talk__contacts .icon { color: var(--accent); }
.talk__contacts a { display: inline-flex; align-items: center; min-height: 44px; color: var(--ink); font-weight: 500; text-decoration: none; }
.talk__contacts a:hover { color: var(--accent); text-decoration: underline; }
.talk__contacts span { color: var(--ink2); }

.guides-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px 20px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--stone);
  color: var(--ink);
  text-decoration: none;
}
.guides-card .icon { color: var(--accent); }
.guides-card:hover { border-color: var(--input); color: var(--ink); }
.guides-card:hover .guides-card__title { color: var(--accent); }
.guides-card__text { display: flex; flex-direction: column; gap: 2px; }
.guides-card__title { font-size: 15px; font-weight: 700; }
.guides-card__sub { font-size: 13px; color: var(--muted); }

@media (min-width: 960px) {
  .villa-aside { position: sticky; top: calc(var(--header-h) + 24px); }
  .talk { gap: 18px; padding: 26px; border-radius: 20px; }
  .talk__contacts { padding-top: 18px; }
}

/* ---------- Other villas ---------- */
.others__title { font-size: 22px; font-weight: 800; }
.others__list { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
.other-villa {
  position: relative;
  display: grid;
  grid-template-columns: 110px minmax(0, 1fr);
  height: 100%;
  overflow: hidden;
  background: #FFFFFF;
  border: 1px solid var(--line);
  border-radius: var(--radius-tile);
}
/* The photo fills the row the text sets: absolutely placed, so a tall picture cannot stretch the card. */
.other-villa__photo { position: relative; min-height: 100px; overflow: hidden; background: var(--photo-2); }
.other-villa__photo img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.other-villa__body { display: flex; flex-direction: column; gap: 4px; padding: 14px; min-width: 0; }
.other-villa__title { font-family: var(--font-body); font-size: 16px; font-weight: 700; letter-spacing: 0; line-height: 1.3; }
.other-villa__title a { color: var(--ink); text-decoration: none; }
.other-villa:hover .other-villa__title a { color: var(--accent); }
.other-villa__capacity { display: flex; flex-direction: column; gap: 2px; }
.other-villa__stats { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 6px; font-size: 13px; color: var(--muted); }
.other-villa__stats .icon { color: var(--accent); }
.other-villa__stats strong { color: var(--ink); font-weight: 700; }
.other-villa__beds { padding-left: 22px; font-size: 12px; color: var(--muted); }
.other-villa__text { display: none; }
@media (min-width: 960px) {
  .others__title { font-size: 32px; }
  .others__list { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 28px; }
  .other-villa { grid-template-columns: 220px minmax(0, 1fr); border-radius: var(--radius-card); }
  .other-villa__photo { min-height: 190px; }
  .other-villa__body { gap: 8px; padding: 22px; }
  .other-villa__title { font-family: var(--font-head); font-size: 20px; letter-spacing: -0.02em; line-height: 1.12; }
  .other-villa__stats { font-size: 14px; }
  .other-villa__beds { font-size: 13px; }
  .other-villa__text { display: block; font-size: 15px; color: var(--ink2); }
}

/* ---------- Villa not found ---------- */
.missing__list { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; max-width: 640px; }
@media (min-width: 960px) {
  .missing__list { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
}

/* ---------- Full-screen gallery ---------- */
.lightbox {
  width: 100%;
  max-width: none;
  height: 100%;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: var(--lightbox-bg);
  color: #FFFFFF;
}
.lightbox[open] { display: flex; flex-direction: column; }
.lightbox::backdrop { background: var(--lightbox-bg); }
html.has-lightbox { overflow: hidden; }

.lightbox__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
}
.lightbox__counter { min-width: 60px; font-size: 14px; color: var(--footer-ink); }
.lightbox__actions { display: flex; align-items: center; gap: 8px; }
.lightbox__btn[hidden] { display: none; }
.lightbox__title {
  display: none;
  font-family: var(--font-head);
  font-size: 16px;
  font-weight: 700;
  text-align: center;
}
.lightbox__btn {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  padding: 0;
  border: 1px solid var(--dark-line);
  border-radius: 99px;
  background: transparent;
  color: #FFFFFF;
  cursor: pointer;
}
.lightbox__btn:hover { background: var(--footer-line); }
.lightbox__btn:focus-visible, .lightbox__thumb:focus-visible { outline-color: #FFFFFF; }

/* Phone: photo on top, arrows in a row below. */
.lightbox__stage {
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  grid-template-rows: minmax(0, 1fr) auto;
  grid-template-areas: "img img img" "prev . next";
  gap: 16px;
  padding: 0 0 calc(16px + env(safe-area-inset-bottom));
}
/* The photos sit side by side in a native scroll-snap track: the finger drags them with the page-like
   inertia the phone already has, and the arrows, thumbnails and autoplay just scroll the same track. */
.lightbox__track {
  grid-area: img;
  align-self: stretch;
  min-width: 0;
  display: flex;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
}
.lightbox__track::-webkit-scrollbar { display: none; }
.lightbox__slide {
  flex: 0 0 100%;
  container-type: size;
  display: flex;
  align-items: center;
  justify-content: center;
  scroll-snap-align: center;
  scroll-snap-stop: always;
}
/* The frame hugs the photo, so the autoplay bar lies exactly along its bottom edge. The photo runs
   edge to edge: on a portrait phone every pixel of width counts. */
.lightbox__frame { position: relative; display: flex; max-width: 100%; max-height: 100%; }
.lightbox__img { display: block; width: auto; height: auto; max-width: 100cqw; max-height: 100cqh; }
.lightbox__progress {
  display: none;
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 3px;
  background: rgba(255, 255, 255, .35);
  pointer-events: none;
}
.lightbox__progress::after {
  content: "";
  display: block;
  height: 100%;
  background: #FFFFFF;
  transform-origin: left center;
  transform: scaleX(0);
}
.lightbox.is-autoplay .lightbox__slide.is-current .lightbox__progress { display: block; }
.lightbox.is-autoplay .lightbox__slide.is-current .lightbox__progress::after {
  animation: villa-progress var(--gallery-autoplay, 5s) linear both;
}
.lightbox.is-autoplay-paused .lightbox__progress::after { animation-play-state: paused; }
.lightbox__prev { grid-area: prev; margin-left: 16px; }
.lightbox__next { grid-area: next; margin-right: 16px; }
.lightbox__thumbs { display: none; }

/* Phone held sideways: the arrows move to the sides so the photo gets the full height. */
@media (max-width: 959px) and (orientation: landscape) {
  .lightbox__bar { padding: 6px 16px; }
  .lightbox__stage {
    grid-template-columns: auto minmax(0, 1fr) auto;
    grid-template-rows: minmax(0, 1fr);
    grid-template-areas: "prev img next";
    align-items: center;
    gap: 8px;
    padding-bottom: 8px;
  }
}

@media (min-width: 960px) {
  .lightbox__bar { padding: 16px 24px; }
  .lightbox__title { display: block; }
  .lightbox__stage {
    grid-template-columns: auto minmax(0, 1fr) auto;
    grid-template-rows: minmax(0, 1fr);
    grid-template-areas: "prev img next";
    align-items: center;
    gap: 20px;
    padding: 0 24px;
  }
  .lightbox__img { max-height: min(100cqh, 76vh); border-radius: 12px; }
  .lightbox__progress { left: 12px; right: 12px; bottom: 10px; border-radius: 99px; overflow: hidden; }
  .lightbox__progress::after { border-radius: 99px; }
  .lightbox__prev, .lightbox__next { margin: 0; }
  .lightbox__thumbs {
    display: flex;
    gap: 8px;
    padding: 16px 24px 24px;
    overflow-x: auto;
  }
  .lightbox__thumbs li { flex: none; }
  .lightbox__thumbs li:first-child { margin-left: auto; }
  .lightbox__thumbs li:last-child { margin-right: auto; }
  .lightbox__thumb {
    display: block;
    width: 76px;
    height: 54px;
    padding: 0;
    overflow: hidden;
    border: 2px solid transparent;
    border-radius: 8px;
    background: var(--footer-line);
    cursor: pointer;
    opacity: .55;
  }
  .lightbox__thumb img { width: 100%; height: 100%; object-fit: cover; }
  .lightbox__thumb:hover { opacity: .85; }
  .lightbox__thumb[aria-current="true"] { border-color: #FFFFFF; opacity: 1; }
}
