/* =========================================================
   Restaurant Reviews (Public) — Layout A (List | Map | Panel)
   Clean + functional + visually consistent
   ========================================================= */

/* ---------------- Tokens ---------------- */
:root{
  --rr-gap: 14px;
  --rr-radius: 16px;
  --rr-radius2: 22px;

  --rr-surface: rgba(255,255,255,.92);
  --rr-surface2: rgba(255,255,255,.80);

  --rr-field-bg: rgba(255,255,255,.98);
  --rr-field-border: rgba(0,0,0,.18);

  --rr-border: rgba(0,0,0,.14);
  --rr-border-strong: rgba(0,0,0,.55);

  --rr-shadow: 0 16px 48px rgba(0,0,0,.18);

  --rr-map-min-h: 420px;
  --rr-map-min-h-mobile: 360px;
  --rr-map-max-h: 600px;

  --rr-panel-w: 520px;

  /* outer spacing around the "card" */
  --rr-card-pad: 16px;
  --rr-card-margin-y: 16px;

  /* panel fade background (match content card) */
  --rr-content-bg: rgba(255,255,255,.92);
}

*{ box-sizing:border-box; }
html,body{ height:100%; }
body{ margin:0; }

/* Root: inherit Squarespace theme typography/colors */
#app{ position: relative; }
#app, #app *{ font-family: inherit; color: inherit; }
#app a{ text-decoration:none; }
#app a:hover{ text-decoration:underline; }

/* Panel under Squarespace header (set via app.js: --rr-header-offset) */
#app{ --rr-header-offset: 0px; }

/* =========================================================
   App "rounded card" wrapper
   ========================================================= */
#app .app{
  min-height: 100%;
  display:flex;
  flex-direction:column;

  background: var(--rr-surface);
  border: 1px solid rgba(0,0,0,0.08);
  border-radius: var(--rr-radius);
  padding: var(--rr-card-pad);
  margin: var(--rr-card-margin-y) 0;

  /* keep rounded corners clean + prevent horizontal overflow */
  overflow: hidden;
  overflow-x: hidden;
}

/* =========================================================
   Topbar
   ========================================================= */
#app .topbar{
  position: sticky;
  top: 0;
  z-index: 5;
  background: transparent;

  padding: 6px 0 12px 0;
  display:flex;
  gap: 14px;
  align-items:flex-start;
  justify-content:space-between;
}

/* Critical: allow flex children to shrink (prevents pushing page width) */
#app .topbar > *{ min-width: 0; }

#app .brand__title{ font-weight: 600; letter-spacing:.2px; }
#app .brand__sub{ opacity:.75; font-size:13px; margin-top:2px; }

#app .controls{
  display:flex;
  gap:10px;
  flex-wrap:wrap;
  justify-content:flex-end;
  align-items:center;

  min-width: 0;
  max-width: 100%;
}

/* Fields */
#app .control{
  background: var(--rr-field-bg);
  border: 1px solid var(--rr-field-border);
  border-radius: 12px;
  padding: 10px 12px;
  outline: none;

  max-width: 100%;
}
#app .control:focus{
  border-color: var(--rr-border-strong);
  box-shadow: 0 0 0 3px rgba(0,0,0,.08);
}

/* Distance toggle */
#app .distanceToggle{ display:flex; gap:8px; align-items:center; }
#app .distanceLabel{
  font-size: 13px;
  opacity: .75;
  margin-right: 6px;
  align-self: center;
  white-space: nowrap;
}
#app .rr-toggle{ cursor:pointer; }
#app .rr-toggle.is-active{
  border-color: var(--rr-border-strong);
  box-shadow: 0 0 0 3px rgba(0,0,0,.08);
}

/* Mobile toggle */
#app .mobileToggle{
  display:none;
  margin-top:10px;
  justify-content:flex-end;
  gap:8px;
}
#app .toggleBtn{
  background: var(--rr-field-bg);
  border:1px solid var(--rr-field-border);
  border-radius:999px;
  padding:8px 12px;
  cursor:pointer;
}
#app .toggleBtn.is-active{
  border-color: var(--rr-border-strong);
  box-shadow: 0 0 0 3px rgba(0,0,0,.08);
}

/* =========================================================
   Layout A: main grid
   ========================================================= */
#app .main{
  flex: 1;
  min-height: 0;
  display:grid;

  grid-template-columns: 420px 1fr 0px;
  gap: var(--rr-gap);

  /* prevent grid stretch weirdness + allow children to shrink */
  align-items: start;
  min-width: 0;
}

#app .main.has-panel{
  grid-template-columns: 420px 1fr min(var(--rr-panel-w), 100%);
}

#app .col{
  min-height: 0;
  position: relative;
  min-width: 0; /* critical for overflow */
}

/* Left column */
#app .col--list{
  border-right: 1px solid rgba(0,0,0,.08);
  padding-right: var(--rr-gap);
  min-width: 0;
}

/* =========================================================
   List
   ========================================================= */
#app .list{
  padding: 0;
  display:flex;
  flex-direction:column;
  gap:10px;
  overflow:auto;
  height:100%;
}

#app .status{
  margin: 0 0 12px 0;
  padding: 12px;
  border: 1px solid rgba(0,0,0,.08);
  border-radius: var(--rr-radius);
  background: rgba(255,255,255,.85);
  opacity:.9;
}

/* Cards */
#app .card{
  background: rgba(255,255,255,.95);
  border: 1px solid rgba(0,0,0,.12);
  border-radius: var(--rr-radius);
  padding: 12px;
  cursor:pointer;
  transition: transform .12s ease, border-color .12s ease, box-shadow .12s ease;
}
#app .card:hover{
  transform: translateY(-1px);
  border-color: rgba(0,0,0,.18);
}
#app .card.is-selected{
  border-color: rgba(0,0,0,.35);
  box-shadow: 0 0 0 3px rgba(0,0,0,.08);
}

#app .card__title{
  font-weight: 600;
  line-height: 1.25;
  margin-bottom: 6px;
  font-size: 16px;
}

#app .card__row1{
  display:flex;
  gap:10px;
  align-items:baseline;
  opacity:.9;
  font-size:13px;
}
#app .card__stars{ letter-spacing:.8px; }
#app .card__date{ opacity:.75; }

#app .card__row2{
  margin-top: 6px;
  opacity:.75;
  font-size:13px;
}

/* =========================================================
   Map (single source of truth)
   ========================================================= */
#app #colMap{
  width: 100%;
  max-width: 100%;

  border-radius: 16px;
  border: 1px solid rgba(0,0,0,0.08);
  overflow: hidden;
  background: rgba(255,255,255,.80);

  /* Height strategy:
     - keep it tall enough
     - cap it so it doesn't create huge page
  */
  min-height: var(--rr-map-min-h);
  height: clamp(320px, 55vh, var(--rr-map-max-h));
  max-height: var(--rr-map-max-h);

  /* optional desktop feel: square-ish but capped */
  aspect-ratio: 1 / 1;
  max-height: min(70vh, 900px);

  min-width: 0; /* critical for overflow in grids */
}

/* map container inside */
#app .map{
  position:absolute;
  inset:0;
}

/* the actual map element must fill its card */
#app #map{
  height: 100%;
  width: 100%;
  max-width: 100%;
}

/* Map hint */
#app .mapHint{
  position:absolute;
  left:12px;
  bottom:12px;
  z-index:2;
  background: rgba(0,0,0,.55);
  border:1px solid rgba(255,255,255,.14);
  border-radius: 12px;
  padding:10px 12px;
  font-size:13px;
  color: rgba(255,255,255,.82);
}

/* =========================================================
   Panel (3rd column)
   ========================================================= */
#app #reviewPanel{
  grid-column: 3;
  grid-row: 1;

  position: relative;
  width: 100%;
  height: 100%;

  background: rgba(255,255,255,.95);
  border: 1px solid rgba(0,0,0,0.08);
  border-radius: 16px;

  overflow: hidden;

  display:flex;
  flex-direction:column;

  /* Closed by default (no layout shift) */
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(6px);
  transition: opacity 160ms ease, transform 160ms ease, visibility 0s linear 160ms;
  will-change: opacity, transform;

  min-width: 0;
}

/* Open */
#app #reviewPanel.is-open{
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: none;
  transition: opacity 160ms ease, transform 160ms ease, visibility 0s;
}

/* Panel header */
#app .panel__header{
  position: sticky;
  top: 0;
  z-index: 2;
  background: inherit;

  border-bottom: 1px solid rgba(0,0,0,.08);

  padding: 14px 14px 10px 14px;

  /* layout for close btn + right meta */
  position: relative;
  padding-left: 54px;   /* room for close button */
  padding-right: 260px; /* room for right meta stack */
  min-height: 92px;     /* avoids overlap */
}

#app #panelCloseBtn{
  position: absolute;
  top: 14px;
  left: 14px;
}

#app .panel__title{ font-weight:800; line-height: 1.15; font-size: 18px; margin-top: 0; }
#app .panel__meta{
  opacity:.75;
  font-size:13px;
  margin-top:6px;
  display:flex;
  gap:10px;
  flex-wrap:wrap;
}

/* Right meta stack (panel.js uses these classes) */
#app .panel__metaTop{
  position: absolute;
  top: 14px;
  right: 14px;
  text-align: right;
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-width: 240px;
}
#app .pm-title{
  font-weight: 800;
  line-height: 1.15;
  font-size: 18px;
  opacity: 1;
}
#app .pm-row1{
  font-size: 16px;
  line-height: 1.1;
  letter-spacing: .6px;
  opacity: .95;
}
#app .pm-row2{
  font-size: 13px;
  line-height: 1.2;
  opacity: .75;
}

/* Buttons */
#app .iconBtn{
  background: rgba(255,255,255,.95);
  border: 1px solid var(--rr-field-border);
  border-radius: 12px;
  padding: 8px 10px;
  cursor: pointer;
}
#app .iconBtn:hover{ border-color: rgba(0,0,0,.35); }

#app .panel__body{
  padding: 14px;
  padding-top: 16px;
  overflow:auto;
  height:100%;
  min-width: 0;
}

/* =========================================================
   Gallery
   ========================================================= */
#app .gallery{
  display:grid;
  grid-template-columns: repeat(3, 1fr);
  gap:10px;
  margin-bottom:14px;
}
#app .gallery__item{
  border-radius: 14px;
  border: 1px solid rgba(0,0,0,.10);
  background: rgba(255,255,255,.92);
  overflow:hidden;
  cursor:pointer;
  aspect-ratio: 1 / 1;
  display:flex;
  align-items:center;
  justify-content:center;
}
#app .gallery__item img{
  width:100%;
  height:100%;
  object-fit:cover;
  display:block;
}

/* =========================================================
   Content (Quill HTML)
   ========================================================= */
#app .content{
  border:1px solid rgba(0,0,0,.10);
  background: var(--rr-content-bg);
  border-radius: var(--rr-radius);
  padding:12px;
  margin-bottom:16px;

  /* protect against Squarespace themes using light text */
  color: rgba(0,0,0,.88);
}
#app .content *{ color: inherit; }
#app .content a{ color: rgba(0,0,0,.88); text-decoration: underline; }

#app .content :first-child{ margin-top:0; }
#app .content p{ line-height:1.6; }
#app .content h1,#app .content h2,#app .content h3{ margin:.6em 0 .35em; }
#app .content ul,#app .content ol{ padding-left: 1.2em; }
#app .content blockquote{
  margin: 10px 0;
  padding: 8px 10px;
  border-left: 3px solid rgba(0,0,0,.25);
  opacity:.85;
  background: rgba(0,0,0,.03);
  border-radius: 12px;
}

/* Collapsed review text (5 lines) + fade */
#app #panelContent{
  position: relative;
}
#app #panelContent.is-collapsed{
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 5;
  overflow: hidden;
}
#app #panelContent.is-collapsed::after{
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 3.2em;
  pointer-events: none;

  background: linear-gradient(
    to bottom,
    rgba(255,255,255,0),
    var(--rr-content-bg) 70%,
    var(--rr-content-bg) 100%
  );
}

/* Read more button */
#app .readMoreBtn{
  margin-top: 10px;
  margin-left: auto;
  display: inline-flex;
  align-self: flex-end;

  background: rgba(0,0,0,.06);
  border: 1px solid rgba(0,0,0,.18);
  border-radius: 12px;
  padding: 10px 12px;
  cursor: pointer;
  font-weight: 600;
}
#app .readMoreBtn:hover{ border-color: rgba(0,0,0,.35); }
#app .readMoreBtn[hidden]{ display:none !important; }

/* =========================================================
   Comments
   ========================================================= */
#app .comments{ margin-top:14px; color: rgba(0,0,0,.88); }
#app .comments__header{ display:flex; flex-direction:column; gap:6px; margin-bottom:10px; }
#app .comments__title{ font-weight:700; }
#app .comments__disclaimer{ font-size:12px; opacity:.75; }

#app .comments__list{ display:flex; flex-direction:column; gap:10px; margin-bottom:14px; }
#app .comment{
  border:1px solid rgba(0,0,0,.10);
  background: rgba(255,255,255,.92);
  border-radius: var(--rr-radius);
  padding:10px;
  color: rgba(0,0,0,.88);
}
#app .comment__top{
  display:flex;
  gap:10px;
  align-items:baseline;
  justify-content:space-between;
}
#app .comment__name{ font-weight:600; }
#app .comment__time{ opacity:.7; font-size:12px; }
#app .comment__body{ margin-top:8px; white-space:pre-wrap; line-height:1.45; }

#app .commentForm{
  border:1px solid rgba(0,0,0,.10);
  background: rgba(255,255,255,.92);
  border-radius: var(--rr-radius);
  padding:12px;
  color: rgba(0,0,0,.88);
}

#app .row{ display:grid; grid-template-columns: 1fr 1fr; gap:10px; }
#app .field{ display:flex; flex-direction:column; gap:6px; margin-bottom:10px; }
#app .field span{ font-size:12px; opacity:.75; }
#app .field input, #app .field textarea{
  width:100%;
  background: var(--rr-field-bg);
  border:1px solid var(--rr-field-border);
  border-radius: 12px;
  padding:10px 12px;
  outline:none;
}
#app .field input:focus, #app .field textarea:focus{
  border-color: var(--rr-border-strong);
  box-shadow: 0 0 0 3px rgba(0,0,0,.08);
}
#app .field textarea{ min-height: 96px; resize: vertical; }

#app .btn{
  background: rgba(0,0,0,.06);
  border: 1px solid var(--rr-field-border);
  border-radius: 12px;
  padding:10px 12px;
  cursor:pointer;
  font-weight:600;
}
#app .btn:hover{ border-color: rgba(0,0,0,.35); }
#app .btn:disabled{ opacity:.6; cursor:not-allowed; }
#app .commentForm__actions{ display:flex; align-items:center; gap:10px; }
#app .formNote{ opacity:.75; font-size:12px; }

/* =========================================================
   Modal (slideshow)
   ========================================================= */
#app .modal{
  position: fixed;
  inset: 0;
  display: none;
  z-index: 1000;
}
#app .modal.is-open{ display:block; }

#app .modal__overlay{
  position:absolute;
  inset:0;
  background: rgba(0,0,0,.65);
  backdrop-filter: blur(8px);
}

#app .modal__dialog{
  position:absolute;
  left:50%;
  top:50%;
  transform: translate(-50%,-50%);
  width:min(980px, calc(100% - 24px));
  background: rgba(255,255,255,.96);
  border:1px solid rgba(0,0,0,.14);
  border-radius: var(--rr-radius2);
  box-shadow: var(--rr-shadow);
  padding:12px;
}

#app .modal__close{
  position:absolute;
  right:12px;
  top:12px;
  z-index: 2;
}

#app .modal__media{
  display:grid;
  grid-template-columns: 46px 1fr 46px;
  gap:10px;
  align-items:center;
  padding:10px;
}
#app .modal__media img{
  width:100%;
  height: min(72vh, 720px);
  object-fit: contain;
  border-radius: 18px;
  background: rgba(0,0,0,.03);
  border:1px solid rgba(0,0,0,.12);
}

#app .navBtn{
  background: rgba(255,255,255,.95);
  border: 1px solid rgba(0,0,0,.18);
  border-radius: 14px;
  height: 46px;
  cursor:pointer;
  font-size:24px;
}
#app .navBtn:hover{ border-color: rgba(0,0,0,.35); }

/* single source of truth for caption/counter */
#app .modal__caption{
  padding: 0 12px 10px 12px;
  opacity: .95;
  font-size: 18px;
  line-height: 1.35;
}
#app .modal__counter{
  padding: 0 12px 10px 12px;
  opacity:.7;
  font-size: 12px;
}

/* =========================================================
   InfoWindow
   ========================================================= */
#app .rr-iw{ font-size: 13px; line-height: 1.35; }
#app .rr-iw__title{ font-weight: 700; margin-bottom: 4px; }
#app .rr-iw__meta{ opacity:.85; display:flex; gap:8px; align-items:baseline; margin-bottom: 4px; }
#app .rr-iw__sub{ opacity:.75; margin-bottom: 6px; }
#app .rr-iw__link a{ font-weight: 600; }

/* =========================================================
   Responsive
   ========================================================= */
@media (max-width: 980px){
  /* Stack everything */
  #app .main,
  #app .main.has-panel{
    grid-template-columns: 1fr;
    gap: 12px;
  }

  #app .mobileToggle{ display:flex; }
  #app .row{ grid-template-columns: 1fr; }

  /* On mobile, let map height rule (avoid square pushing layout) */
  #app #colMap{
    min-height: var(--rr-map-min-h-mobile);
    aspect-ratio: auto;
    height: clamp(280px, 48vh, 520px);
    max-height: 520px;
  }

  /* When panel open: hide list/map (matches app.js behavior) */
  #app .main.has-panel #colList,
  #app .main.has-panel #colMap{
    display: none !important;
  }

  /* Panel is overlay on mobile */
  #app #reviewPanel{
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    top: var(--rr-header-offset, 0px);
    height: calc(100dvh - var(--rr-header-offset, 0px));
    z-index: 9999;
    overflow: auto;
    transform: translateY(10px);
  }

  /* --- Mobile: keep slideshow modal below Squarespace header --- */
  #app .modal{
    top: var(--rr-header-offset, 0px);
    left: 0;
    right: 0;
    bottom: 0;
    height: calc(100dvh - var(--rr-header-offset, 0px));
  }
  #app .modal__overlay{ top:0; left:0; right:0; bottom:0; }
  #app .modal__dialog{
    max-height: calc(100dvh - var(--rr-header-offset, 0px) - 24px);
    overflow: auto;
  }
  #app .modal__close{ top: 12px; }

  /* ===========================
     Mobile overflow fixes
     =========================== */
  #app .topbar{
    flex-wrap: wrap;
    gap: 12px;
  }

  /* Put brand on its own line and controls below */
  #app .topbar__left,
  #app .topbar__right{
    width: 100%;
  }

  #app .controls{
    width: 100%;
    justify-content: flex-start;
  }
}

/* Very small screens: 2-col control grid */
@media (max-width: 520px){
  #app .controls .control{
    width: calc(50% - 6px);
  }

  #app .distanceToggle{
    flex-wrap: wrap;
    justify-content: flex-start;
    gap: 8px;
    width: 100%;
  }

  #app .mobileToggle{
    flex-wrap: wrap;
    justify-content: flex-end;
  }
}

/* Mobile: distance label above, two buttons on same row */
@media (max-width: 520px){
  /* Force distance block to take its own full row inside .controls */
  #app .controls .distanceToggle{
    flex: 0 0 100%;          /* 🔑 THIS IS THE KEY */
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
  }

  /* Label on its own row */
  #app .controls .distanceToggle .distanceLabel{
    flex: 0 0 100%;
    margin: 0 0 2px 0;
    opacity: .75;
  }

  /* Two buttons on same row, equal width */
  #app .controls .distanceToggle .rr-toggle{
    flex: 1 1 0;
    min-width: 0;
  }
}
/* =========================================================
   Slideshow modal: maximize image area + overlay arrows
   ========================================================= */

/* Make dialog use more of the viewport */
#app .modal__dialog{
  width: min(1100px, calc(100% - 16px));
  padding: 10px;
}

/* Media area becomes a "stage" */
#app .modal__media{
  position: relative;
  display: block;           /* override grid */
  padding: 0;
  margin: 0;
}

/* Image takes almost all available height */
#app .modal__media img,
#app #modalImage{
  width: 100%;
  height: min(78vh, 760px); /* desktop default */
  object-fit: contain;
  display: block;
  border-radius: 18px;
}

/* Arrows on top of image (centered vertically) */
#app .modal__media .navBtn,
#app #modalPrevBtn,
#app #modalNextBtn{
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 3;

  width: 44px;
  height: 44px;
  border-radius: 999px;

  /* keep your existing button style but more "overlay" */
  background: rgba(255,255,255,.88);
  border: 1px solid rgba(0,0,0,.18);
  box-shadow: 0 10px 26px rgba(0,0,0,.18);

  display: grid;
  place-items: center;
  touch-action: manipulation;
}

#app #modalPrevBtn{ left: 10px; }
#app #modalNextBtn{ right: 10px; }

/* --- Desktop: round the REAL visible image (contain), not the container --- */
#app .modal__media{
  position: relative;            /* keep for arrows + gradient */
  display: flex;                 /* center the image box */
  align-items: center;
  justify-content: center;

  /* remove "frame rounding" here; the image will own the rounding */
  border-radius: 0;
  overflow: visible;
  background: transparent;
  border: 0;
}

/* The IMG becomes its own visible box (auto size), bounded by max-* */
#app #modalImage{
  display: block;

  width: auto !important;        /* override earlier width:100% rules */
  height: auto !important;       /* override earlier fixed heights */
  max-width: 100%;
  max-height: min(78vh, 760px);

  object-fit: contain !important;
  border-radius: 18px !important;
  background: rgba(0,0,0,.03);
  border: 1px solid rgba(0,0,0,.12);
}

/* Optional: subtle edge gradient so arrows read better on light photos */
#app .modal__media::before{
  content:"";
  position:absolute;
  inset:0;
  pointer-events:none;
  border-radius: 18px;
  background:
    linear-gradient(to right, rgba(0,0,0,.10), rgba(0,0,0,0) 22%, rgba(0,0,0,0) 78%, rgba(0,0,0,.10));
  opacity: .55;
}

/* Mobile: make the modal close to full-screen for maximum image area */
@media (max-width: 520px){
  #app .modal__dialog{
    width: 100%;
    height: calc(100dvh - var(--rr-header-offset, 0px));
    left: 0;
    top: 0;
    transform: none;
    border-radius: 0;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
  }

  /* Give image almost all vertical space */
  #app .modal__media{
    flex: 1;
    min-height: 0;
  }

  #app .modal__media img,
  #app #modalImage{
    height: 100%;
    max-height: none;
    border-radius: 16px;
  }

  /* Bigger tap targets on mobile */
  #app #modalPrevBtn,
  #app #modalNextBtn{
    width: 48px;
    height: 48px;
    left: 10px;
    right: 10px;
  }
}
/* =========================================================
   Mobile fullscreen modal (anchored, cannot float to top)
   ========================================================= */
@media (max-width: 520px){
  /* Modal container always covers the viewport under header offset */
  #app #slideshowModal.modal{
    top: var(--rr-header-offset, 0px) !important;
    height: calc(100dvh - var(--rr-header-offset, 0px)) !important;
  }

  /* Fullscreen dialog */
  #app #slideshowModal .modal__dialog{
    position: absolute !important;
    inset: 0 !important;          /* 🔑 fills container */
    left: 0 !important;
    right: 0 !important;
    top: 0 !important;
    bottom: 0 !important;

    transform: none !important;   /* 🔑 disable centering transforms */
    margin: 0 !important;
    width: 100% !important;
    height: 100% !important;
    max-height: none !important;

    border-radius: 0 !important;
    padding: 12px !important;

    display: flex !important;
    flex-direction: column !important;
    gap: 8px !important;
  }

  /* Media area takes almost all height */
  #app #slideshowModal .modal__media{
    position: relative !important;
    flex: 1 1 auto !important;
    min-height: 0 !important;
  }

  #app #slideshowModal #modalImage{
    width: auto !important;
    height: auto !important;

    max-width: 100% !important;
    max-height: calc(100dvh - 140px) !important; /* justera vid behov */
    object-fit: contain !important;

    border-radius: 18px !important;
    background: rgba(0,0,0,.03);
    border: 1px solid rgba(0,0,0,.12);
  }
  /* Close button stays at top-right */
  #app #slideshowModal .modal__close{
    position: absolute !important;
    top: 12px !important;
    right: 12px !important;
    z-index: 4 !important;
  }

  /* Arrows: fixed to left/right over image (no overlap) */
  #app #modalPrevBtn{
    left: 10px !important;
    right: auto !important;
  }
  #app #modalNextBtn{
    right: 10px !important;
    left: auto !important;
  }
}


/* =========================================================
   HARD z-index fix (must be last)
   ========================================================= */
#app{ isolation: isolate; }

#app #slideshowModal{
  position: fixed !important;
  inset: 0 !important;
  z-index: 2147483000 !important; /* near max int, beats Squarespace header */
}

#app #slideshowModal .modal__overlay{
  z-index: 2147483001 !important;
}

#app #slideshowModal .modal__dialog{
  z-index: 2147483002 !important;
}

#app #slideshowModal .modal__close,
#app #slideshowModal #modalPrevBtn,
#app #slideshowModal #modalNextBtn{
  z-index: 2147483003 !important;
}