/*
  responsive.css
  Split from styles.css (source-of-truth provided by you)
*/

/* ==========================================================
   Motion preferences
   ========================================================== */
@media (prefers-reduced-motion: reduce){
  html{ scroll-behavior: auto; }
  .topbar{ transition: none; }
  .hero__slider{ scroll-behavior: auto; }
  .vcard__icon--link img{ transition: none; }
}

/* ==========================================================
   Feature support fallbacks
   ========================================================== */
@supports not (aspect-ratio: 1 / 1){
  #experience .vcard__icon{
    position: relative;
    margin: 0 0 12px;   /* antes: 10px 0 12px */
    margin-top: 0;
  }

  #experience .vcard__icon::before{
    content:"";
    display:block;
    padding-top:100%;
  }
  #experience .vcard__icon img{
    width: 100%;
    height: 100%;
    object-fit: cover;        /* llena el recuadro sin deformar */
    display: block;
  }
}

/* ==========================================================
   Hover interactions
   ========================================================== */
@media (hover:hover){
  .vcard__icon--link:hover img{
    transform: scale(1.01);
  }
  .vcard__icon--link img{
    transition: transform 180ms ease;
  }
}

/* ==========================================================
   Mobile / Tablet (<= 860px)
   ========================================================== */
@media (max-width: 860px){
  .hero__slide{
    aspect-ratio: 1 / 1;           /* cuadrado */
    height: min(100vw, 70vh);      /* cuadrado en portrait; evita “hero gigante” en landscape */
  }

  #accommodation .accom-card{
    margin-left: calc(var(--gutter) * -1);
    margin-right: calc(var(--gutter) * -1);
    border-radius: 22px;
  }
  #accommodation .accom-card::before{ left: 10px; }

  .hero__card,
  .room,
  .rates__panel,
  .avail__panel,
  .zcard,
  .review,
  details,
  .contact__panel,
  .faq__panel,
  .note{
    margin-left: calc(var(--gutter) * -1);
    margin-right: calc(var(--gutter) * -1);
    border-radius: 22px;
  }

  /* Map: full-bleed pero con 12px de margen lateral */
  .map__media{
    margin-left: calc(12px - var(--gutter));
    margin-right: calc(12px - var(--gutter));
    width: calc((100% + (var(--gutter) * 2)) - 24px);
    /* opcional: si quieres que también sea 22px en móvil */
    border-radius: 22px;
  }

  .faq details{
    margin-left: 0;
    margin-right: 0;
  }
}

/* ==========================================================
   Availability Calendar — iPhone overflow fix (narrow devices)
   ========================================================== */
@media (max-width: 420px){
  /* Let the 7 columns shrink without forcing overflow */
  #availability .cal__dow,
  #availability .cal__days{
    grid-template-columns: repeat(7, minmax(0, 1fr));
  }

  /* Slightly smaller cells on narrow phones (still tappable) */
  #availability .cal__day{
    min-width: 0;
    min-height: clamp(36px, 9.5vw, 42px);
  }
}

/* Extra-tight: iPhone SE / very narrow devices */
@media (max-width: 360px){
  #availability .cal{ padding: 10px; }
  #availability .cal__dow,
  #availability .cal__days{ gap: 4px; }

  #availability .cal__top{ grid-template-columns: 40px 1fr 40px; }
  #availability .cal__nav{ width: 40px; height: 40px; border-radius: 13px; }

  #availability .cal__day{
    min-height: 34px;   /* 7 cols fit without page overflow */
    border-radius: 12px;
  }
}

/* ==========================================================
   Desktop (>= 861px) — Base layout
   ========================================================== */
@media (min-width: 861px){
  :root{ --container: 1160px; } /* ✅ nuevo ancho máximo desktop */

  .hero__slide{
    aspect-ratio: 16 / 9;          /* evita saltos (CLS) */
    min-height: 300px;
    max-height: 70vh;
  }

  body{ padding-bottom: 0; }
  .nav{ display: flex; }
  .topbar__cta{ display: inline-flex; margin-left: 6px; }
  .topbar__menu{ display: none; }

  /* Desktop: el topbar nunca se oculta */
  .topbar.is-hidden{
    transform: translateY(0) !important;
    opacity: 1 !important;
    pointer-events: auto !important;
  }
  
  .hero__content{ margin-top: -56px; }

  /* ✅ Desktop: reduce la “pastilla” del hero un 10% por lado (80% total) */
  .hero__card{
    width: 90%;
    margin-left: auto;
    margin-right: auto;
  }

  .kicker--overlay{ bottom: calc(56px + 15px); }
  .hero__actions{ grid-template-columns: 1fr 1fr; }
  .hero__mini{ grid-template-columns: repeat(3, 1fr); }

  /* Hero + Why-here refinements (desktop) */
  .gallery--photo{ grid-template-columns: repeat(4, 1fr); }
  .gallery__item{ aspect-ratio: 4 / 3; }

  .value__cta{
    grid-template-columns: 1.4fr .6fr;
    align-items: center;
  }

  .section-head--row{ grid-template-columns: 1.2fr .8fr; align-items: center; }

  /* ✅ Desktop: si solo hay 1 bloque, que ocupe TODO el ancho (evita “columna fantasma”) */
  .section-head--row > :only-child{
    grid-column: 1 / -1;
  }

  .value__grid{ grid-template-columns: repeat(4, 1fr); }
  .gallery{ grid-template-columns: repeat(4, 1fr); }
  .rooms__grid{ grid-template-columns: repeat(2, 1fr); }
  .rates__meta{ grid-template-columns: repeat(3, 1fr); }
  .rates__grid{ grid-template-columns: repeat(2, 1fr); }
  .zone__grid{ grid-template-columns: repeat(3, 1fr); }
  .reviews__grid{ grid-template-columns: repeat(3, 1fr); }
  .faq__grid{ grid-template-columns: repeat(2, 1fr); }

  /* Availability: equal-width calendar + controls (desktop only) */
  #availability .avail__grid{
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px 10px;           /* row-gap 12px, col-gap 10px */
    align-items: stretch;     /* ambas cards igualan el alto de la más alta */
  }

  /* Prevent intrinsic sizing from shrinking columns */
  #availability .cal,
  #availability .avail__controls{
    min-width: 0;
  }

  .contact__panel{ grid-template-columns: 1.2fr .8fr; padding: 18px; }

  /* Contact: si el panel solo tiene 1 bloque, que ocupe TODO el ancho */
  #contact .contact__panel > :only-child{
    grid-column: 1 / -1;
  }

  .contact__grid{ grid-template-columns: repeat(3, 1fr); }
  .contact__actions{ grid-template-columns: 1fr 1fr 1fr; }

  .footer__inner{ grid-template-columns: 1fr auto 1fr; }
  .footer__brand{ justify-self: start; }
  .footer__links{ justify-self: center; }

  .sticky{ display: none; }

  /* ==========================================================
     Desktop (>= 861px) — Overrides / “priority” rules
     (kept AFTER base so they win)
     ========================================================== */

  /* Contact buttons (base desktop behaviour) */
  .contact__grid.contact__grid--buttons{
    grid-template-columns: repeat(2, minmax(0, 1fr));
    justify-items: stretch;
    max-width: none;
    margin-left: 0;
    margin-right: 0;
    width: 100%;
  }
  .contactBtn{ padding: 16px 16px; }

  /* Desktop: center the contact buttons as a column inside the card */
  #contact .contact__grid.contact__grid--buttons{
    grid-template-columns: 1fr;
    width: 100%;
    max-width: 520px;
    margin-inline: auto;
    justify-items: stretch;
  }

  /* Host: let the intro text use the full section width (desktop only) */
  #host .section-head--row{
    grid-template-columns: 1fr;
  }

  /* ✅ Desktop: deja que Intro/Amenities aprovechen el ancho del container */
  .value--heroAlign .section-head{
    max-width: none;
  }

  /* Accommodation + Services side-by-side (desktop only) */
  .accomServicesSplit{
    width: min(var(--container), calc(100% - (var(--gutter) * 2)));
    margin: 16px auto 18px; /* top | left/right | bottom */
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px 10px;          /* row-gap 12px, column-gap 10px */
    align-items: start;
  }

  /* Desktop: cuando el usuario despliega “Show all”, igualamos alturas sin tocar tipografía */
  .accomServicesSplit.is-expanded-both{
    align-items: stretch;
  }

  /* Make both sections feel like consistent “cards” (like the rest) */
  .accomServicesSplit > section{
    border-radius: calc(var(--radius) + 6px);
    border: 1px solid rgba(31,58,51,.14);
    box-shadow: var(--shadow-soft);
    overflow: hidden;
    background: rgba(255,255,255,.82);
  }

  /* Override #accommodation’s full-width background when it’s inside the split */
  .accomServicesSplit > #accommodation{
    background: rgba(255,255,255,.82);
  }

  /* Desktop: make #services match #accommodation 1:1 (spacing, type feel, muted color) */
  #services{
    position: relative;
    margin-top: 0px;
    padding-top: 0px;
    padding-bottom: 10px;
    background: #eaeee6;
    --muted: #111713c1;
  }
  #services::before{ display: none !important; }
  #services .container{ padding-top: 10px; }
  #services .section-head{
    max-width: 62ch;
    margin: 13px 0 14px;
  }
  #services h2{
    margin: 0 0 6px;
    letter-spacing: -0.02em;
  }

  /* ✅ Desktop-only: unifica el fondo “full page” (sin tocar las cards) */
  html,
  body{
    background: var(--page-bg, #f4f7ee);
  }

  .hero,
  .hero__media,
  #area.zone,
  #experience.value,
  .avail.zone,
  figure[aria-label="Cahuita National Park wildlife"] > figcaption,
  .footerToggleWrap,
  .footer{
    background: var(--page-bg, #f4f7ee);
  }

  /* ✅ #services en desktop se comporta como “card” (igual que #accommodation) */
  #services{
    background: rgba(255,255,255,.82);
  }

  /* Desktop: clamp + center elements marked as .desktopClamp */
  .desktopClamp{
    width: min(var(--container, 1120px), calc(100% - (var(--gutter, 28px) * 2)));
    margin-left: auto;
    margin-right: auto;
  }
}

/* Desktop refinements (>= 880px) */
@media (min-width: 880px){
  .hero__arrow{ width: 42px; height: 42px; margin: 0 14px; }
}

/* ==========================================================
   Calendar — Check-out only (no half-moon)
   Meaning: looks available (green), but cannot be used as CHECK-IN.
   Visual hint: right border is red.
   ========================================================== */
#availability .cal__day--unavail.cal__day--checkout-only:not(.cal__day--checkout):not(.cal__day--selected){
  background: rgba(15,183,166,.14);
  border-color: rgba(15,183,166,.20);
  border-right-color: rgba(255,107,107,.22); /* same "red" family */
}

/* Keep it stable on hover/press (no turning red / no gradients) */
#availability .cal__day--unavail.cal__day--checkout-only:not(.cal__day--checkout):not(.cal__day--selected):hover,
#availability .cal__day--unavail.cal__day--checkout-only:not(.cal__day--checkout):not(.cal__day--selected):active{
  background: rgba(15,183,166,.14);
  border-color: rgba(15,183,166,.22);
  border-right-color: rgba(255,107,107,.22);
  transform: none;
  opacity: 1;
}

/* When user taps a blocked day (feedback), keep the same style */
#availability .cal__day--unavail.cal__day--checkout-only.cal__day--blocked-hold:not(.cal__day--checkout):not(.cal__day--selected){
  background: rgba(15,183,166,.14);
  border-color: rgba(15,183,166,.22);
  border-right-color: rgba(255,107,107,.22);
}

/* ==========================================================
   Calendar — Checkout targets (solid green)
   Meaning: valid check-out date for the currently selected check-in
   ========================================================== */
#availability .cal__day--unavail.cal__day--checkout-target:not(.cal__day--checkout):not(.cal__day--selected){
  background: rgba(15,183,166,.14);
  border-color: rgba(15,183,166,.20);
}

/* Hover blanco para cualquier checkout válido (en verde normal o verde “rescatado”) */
#availability .cal__day.cal__day--checkout-target:not(.cal__day--checkout):not(.cal__day--selected):hover,
#availability .cal__day.cal__day--checkout-target:not(.cal__day--checkout):not(.cal__day--selected):active{
  background: rgba(255,255,255,.92);
  border-color: rgba(15,183,166,.26);
  transform: none;
  opacity: 1;
}

/* Días que NO se pueden elegir como check-out (porque hay un rojo en medio) */
#availability .cal__day--avail.cal__day--checkout-disabled:not(.cal__day--selected):not(.cal__day--checkout){
  cursor: not-allowed;
  opacity: .65;
}

/* Importante: NO hover blanco aquí */
#availability .cal__day--avail.cal__day--checkout-disabled:not(.cal__day--selected):not(.cal__day--checkout):hover,
#availability .cal__day--avail.cal__day--checkout-disabled:not(.cal__day--selected):not(.cal__day--checkout):active{
  background: rgba(15,183,166,.14);
  border-color: rgba(15,183,166,.20);
  transform: none;
  opacity: .65;
}

/* ==========================================================
   Mini toast (popup) — Check-out only message
   ========================================================== */
.cmAvailToast{
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, calc(-50% + 10px));
  z-index: 9999;

  max-width: min(520px, calc(100vw - 32px));
  padding: 10px 14px;
  border-radius: 14px;

  background: rgba(17, 23, 19, .92);
  color: rgba(255,255,255,.95);
  font-size: 14px;
  line-height: 1.25;
  letter-spacing: .01em;

  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease, transform 180ms ease;
}

.cmAvailToast.is-visible{
  opacity: 1;
  transform: translate(-50%, -50%);
}

@media (prefers-reduced-motion: reduce){
  .cmAvailToast{ transition: none; }
}

/* ==========================================================
   Calendar — Selected range “pill” (iOS / Booking style)
   Uses existing classes:
   • .cal__day--selected  = Check-in
   • .cal__day--stay      = Nights between
   • .cal__day--checkout  = Check-out
   ========================================================== */

#availability .cal{
  /* Tunable tokens for the range visuals */
  --cm-range-blue: 52, 120, 246;
  --cm-range-strong: rgba(var(--cm-range-blue), .92);
  --cm-range-soft: rgba(var(--cm-range-blue), .16);
  --cm-range-border: rgba(var(--cm-range-blue), .22);
  --cm-range-text: rgba(255,255,255,.96);
  --cm-range-radius-end: 999px;
  --cm-range-radius-mid: 12px;
  --cm-range-bridge: 4px;
}

/* Middle nights: soft blue */
#availability .cal__day.cal__day--stay{
  background: var(--cm-range-soft);
  border-color: var(--cm-range-border);
  border-style: solid;
  border-radius: var(--cm-range-radius-mid);
}

/* Check-in: solid blue, rounded on the LEFT */
#availability .cal__day.cal__day--selected{
  background: transparent;
  border-color: transparent;
  border-style: solid;
  border-radius: 14px;
  color: #fff;
  font-weight: 900;
}

/* Check-out: solid blue, rounded on the RIGHT (override any dashed border) */
#availability .cal__day.cal__day--checkout{
  background: var(--cm-range-strong);
  border-color: rgba(0,0,0,.10);
  border-style: solid; /* important: removes dashed */
  color: var(--cm-range-text);
  font-weight: 750;

  /* pill-right */
  border-top-right-radius: var(--cm-range-radius-end);
  border-bottom-right-radius: var(--cm-range-radius-end);
  border-top-left-radius: var(--cm-range-radius-mid);
  border-bottom-left-radius: var(--cm-range-radius-mid);
}

/* While waiting for check-out (selected check-in pulses), keep it premium */
#availability .cal__day.cal__day--selected.cal__day--awaiting{
  box-shadow: 0 0 0 3px rgba(var(--cm-range-blue), .22);
}

/* Avoid hover-white overriding the selected range */
#availability .cal__day.cal__day--stay:hover,
#availability .cal__day.cal__day--stay:active,
#availability .cal__day.cal__day--selected:hover,
#availability .cal__day.cal__day--selected:active,
#availability .cal__day.cal__day--checkout:hover,
#availability .cal__day.cal__day--checkout:active{
  transform: none;
  opacity: 1;
}