/*
 * Castle Studio v5 hardening layer.
 * Visual composition remains the approved v4.0.1 baseline.
 * This file addresses legibility, collisions, keyboard access and builder compatibility only.
 */

/* Preserve intended inheritance inside dark/light section skins. */
.castle-home-module :where(h1,h2,h3,h4,h5,h6),
.castle-manifesto :where(h1,h2,h3,h4,h5,h6),
.castle-costa-rica :where(h1,h2,h3,h4,h5,h6),
.castle-location :where(h1,h2,h3,h4,h5,h6),
.castle-services-text :where(h1,h2,h3,h4,h5,h6){color:inherit}

/* Prevent long editable copy from colliding with neighboring grid tracks. */
.castle-editorial-heading>*,
.castle-source-intro>*,
.castle-manifesto__grid>*,
.castle-group-lodging__grid>*,
.castle-location>.castle-shell>*,
.castle-hero-pro__content>*,
.castle-services-text__intro>*,
.castle-costa-rica>*{min-width:0}

.castle-editorial-heading h2,
.castle-source-intro h2,
.castle-manifesto h2,
.castle-group-lodging h2,
.castle-weddings__content h2,
.castle-costa-rica__copy h2,
.castle-final-pro h2,
.castle-hero-pro__left h1,
.castle-hero-pro__left h2{
  max-inline-size:100%;
  overflow-wrap:break-word;
  text-wrap:balance;
}

.castle-home-module p,
.castle-home-module li,
.castle-hero-pro__right p,
.castle-footer p{overflow-wrap:anywhere}

/* Micro-copy legibility: preserve treatment, remove failing opacity levels. */
.castle-kicker--auto{opacity:1}
.castle-index{opacity:1}
.castle-capacity__item>span{opacity:1}
.castle-venue-services__grid article>span{opacity:1}
.castle-faq__list summary span{opacity:1}

/* Keyboard navigation for desktop dropdowns. */
.castle-menu li:focus-within>.sub-menu{opacity:1;visibility:visible;transform:none}
.castle-menu .sub-menu a:focus-visible{outline-offset:2px}

/* Elementor live-home mode uses the theme's exact full-width visual canvas. */
.castle-main--elementor-live,
.castle-elementor-homepage-live,
.castle-main--elementor-live .elementor,
.castle-main--elementor-live .elementor-element,
.castle-main--elementor-live .e-con{max-width:none}
.castle-main--elementor-live>.elementor,
.castle-main--elementor-live>.elementor>.elementor-element,
.castle-elementor-homepage-live{width:100%}
.castle-main--elementor-live .castle-elementor-homepage-live{margin:0;padding:0}

/* Existing Elementor page layouts should not be forced into the theme reading shell. */
body.castle-elementor-built .castle-entry--elementor,
body.castle-elementor-built .castle-entry--elementor .castle-entry__content{max-width:none;margin:0;padding:0}

/* Preserve embedded lead forms without modifying provider logic. */
.elementor-widget-html iframe[src*="leadconnectorhq.com"],
.elementor-widget-html iframe[src*="msgsndr.com"],
.elementor-widget-html iframe[src*="gohighlevel.com"],
iframe[src*="api.leadconnectorhq.com"],
iframe[src*="leadconnectorhq.com"]{
  display:block!important;
  width:100%!important;
  max-width:100%!important;
  min-height:720px;
  border:0!important;
  opacity:1!important;
  visibility:visible!important;
  overflow:visible;
  background:transparent;
}

@media(max-width:720px){
  .elementor-widget-html iframe[src*="leadconnectorhq.com"],
  .elementor-widget-html iframe[src*="msgsndr.com"],
  .elementor-widget-html iframe[src*="gohighlevel.com"],
  iframe[src*="api.leadconnectorhq.com"],
  iframe[src*="leadconnectorhq.com"]{min-height:860px}
}

/* Responsive copy safety only; section layout remains unchanged. */
@media(max-width:700px){
  .castle-editorial-heading h2,
  .castle-source-intro h2,
  .castle-manifesto h2,
  .castle-group-lodging h2,
  .castle-costa-rica__copy h2,
  .castle-weddings__content h2,
  .castle-final-pro h2{hyphens:auto}
}

/* === v5.2.0 trust rail: compact Option B shaped ribbon; logos stay horizontal === */
.castle-trust-rail{
  position:relative;
  height:var(--castle-trust-height,132px);
  margin:0;
  background:#0b0e0c;
  overflow:hidden;
  isolation:isolate;
}
.castle-trust-rail__plane{
  position:absolute;
  z-index:0;
  left:var(--castle-trust-inset,clamp(14px,2.2vw,42px));
  right:var(--castle-trust-inset,clamp(14px,2.2vw,42px));
  top:14px;
  bottom:14px;
  background:var(--castle-trust-bg,#F1EEE7);
  clip-path:polygon(0 var(--castle-trust-slant,22px),100% 0,100% calc(100% - var(--castle-trust-slant,22px)),0 100%);
  box-shadow:inset 0 1px color-mix(in srgb,var(--castle-trust-line,#C9A96A) 42%,transparent),inset 0 -1px color-mix(in srgb,var(--castle-trust-line,#C9A96A) 42%,transparent);
}
.castle-trust-rail__viewport{
  position:absolute;
  z-index:1;
  inset:14px 0;
  display:flex;
  align-items:center;
  overflow:hidden;
  width:100%;
  padding:10px clamp(34px,5vw,84px);
  box-sizing:border-box;
}
.castle-trust-rail__track{
  display:flex;
  align-items:center;
  width:max-content;
  will-change:transform;
  animation:castle-trust-marquee var(--castle-trust-speed,38s) linear infinite;
}
.castle-trust-rail--right .castle-trust-rail__track{animation-direction:reverse}
.castle-trust-rail--pause:hover .castle-trust-rail__track,
.castle-trust-rail--pause:focus-within .castle-trust-rail__track{animation-play-state:paused}
.castle-trust-rail__group{
  display:flex;
  align-items:center;
  gap:var(--castle-trust-gap,54px);
  padding-right:var(--castle-trust-gap,54px);
}
.castle-trust-rail__item{
  display:flex;
  align-items:center;
  justify-content:center;
  flex:0 0 auto;
  min-width:150px;
  height:88px;
  padding:8px 10px;
  border-radius:4px;
  transition:opacity .25s ease,transform .25s ease;
  opacity:.96;
  overflow:visible;
  box-sizing:border-box;
}
.castle-trust-rail__item:hover,
.castle-trust-rail__item:focus-visible{opacity:1;transform:translateY(-1px)}
.castle-trust-rail__item img{
  display:block;
  width:auto;
  height:auto;
  max-width:170px;
  max-height:var(--castle-trust-logo-height,70px);
  object-fit:contain;
  object-position:center;
  filter:none!important;
  opacity:1!important;
  transform:none!important;
  margin:0!important;
}
@keyframes castle-trust-marquee{to{transform:translateX(-50%)}}
@media(max-width:767px){
  .castle-trust-rail{height:108px}
  .castle-trust-rail__plane{left:10px;right:10px;top:10px;bottom:10px;clip-path:polygon(0 14px,100% 0,100% calc(100% - 14px),0 100%)}
  .castle-trust-rail__viewport{inset:10px 0;padding:8px 28px}
  .castle-trust-rail__item{min-width:124px;height:72px;padding:6px 8px}
  .castle-trust-rail__item img{max-height:min(var(--castle-trust-logo-height,58px),58px);max-width:140px}
  .castle-trust-rail__group{gap:40px;padding-right:40px}
}
@media(prefers-reduced-motion:reduce){
  .castle-trust-rail__track{animation:none;transform:none}
  .castle-trust-rail__viewport{overflow-x:auto;scrollbar-width:thin}
  .castle-trust-rail__group[aria-hidden="true"]{display:none}
}

/* v5.2 image-fill hardening: image cards occupy the full approved card area. */
.castle-portal-card,
.castle-stay-tile{position:relative;overflow:hidden}
.castle-portal-card > img,
.castle-stay-tile > img{
  position:absolute!important;
  inset:0!important;
  width:100%!important;
  height:100%!important;
  min-width:100%!important;
  min-height:100%!important;
  max-width:none!important;
  max-height:none!important;
  margin:0!important;
  display:block!important;
}

/* Shared media behavior for all editable image cards. Defaults preserve approved v4.0.1 composition. */
.castle-portal-card img,.castle-stay-tile img,.castle-journal-card__image img,.castle-weddings__media img,.castle-costa-rica__media img,.castle-final-pro>img{
  object-fit:var(--castle-media-fit,cover)!important;
  object-position:var(--castle-media-x,50%) var(--castle-media-y,50%)!important;
  transform:scale(var(--castle-media-scale,1));
  transform-origin:var(--castle-media-x,50%) var(--castle-media-y,50%);
}
/* The hero uses its saved slide-position preset by default. The v5.3
   shared-card rule unintentionally centered every slide and removed its motion. */
.castle-hero-pro__media img{
  object-fit:var(--castle-media-fit,cover)!important;
  object-position:var(--castle-media-position,center center)!important;
  transform-origin:center center;
}
/* Elementor responsive controls set an explicit object-position on the img. */
.castle-portal-card:hover img,.castle-stay-tile:hover img,.castle-journal-card:hover img{transform:scale(calc(var(--castle-media-scale,1) * 1.04))}
.castle-stay-tile:after{opacity:var(--castle-stay-overlay-opacity,1);transition:opacity .25s ease}

/* Recovery: do not force a square aspect ratio on the 300x262 original logo or 199x168 option.
   A logo image must retain its actual intrinsic width:height ratio. */

/* v5.3.8: October 27 Lighthouse contrast audit — only failing microcopy.
 * Do not change the owner's section skins, type sizes or visible wording.
 * Inherit the readable section text rather than blend it with transparency.
 */
.castle-home-amenities .castle-service-accordion summary > span {
  opacity:1;
  color:inherit;
}
.castle-home-story .castle-manifesto__body p,
.castle-home-story .castle-manifesto__body .castle-arrow-link {
  opacity:1;
  color:inherit;
}

/* v5.3.12 — Oct 29 Lighthouse WCAG 1.4.3: three READ STORY labels.
 * Inheritance alone was insufficient (v5.3.9). Explicit foregrounds are
 * scoped to the original section skin; preserve copy, spacing and images.
 * castle.js checks custom Elementor skins against their actual backgrounds. */
.castle-home-journal .castle-journal-card a i {
    opacity:1 !important;
    font-style:normal;
}
.castle-home-journal:is(.castle-section--paper,.castle-section--soft) .castle-journal-card a i {
    color:#181d18 !important;
}
.castle-home-journal:is(.castle-section--dark,.castle-section--forest) .castle-journal-card a i {
    color:#f9faf7 !important;
}
.castle-home-journal.castle-section--custom .castle-journal-card a i {
    color:var(--castle-section-text, #181d18) !important;
}
/* The affected copyright is third-party Elementor content, NOT footer.php.
 * Retain its author-provided words and background; remove fading only.
 * The scoped runtime guard corrects foreground only when WCAG AA fails. */
body.home .elementor-element[data-id="a328cc1"] p.copyrights,
body.home .elementor-element-a328cc1 p.copyrights {
    opacity:1 !important;
}
