/* ==========================================================================
   SK Active — MOTION LAYER
   Sits on top of colors_and_type.css + Website.css.
   Brand-safe by design: NO font, colour, spacing or identity changes here.
   Pure motion: smooth scroll, scroll-reveals, hero choreography, count-ups,
   refined micro-interactions.

   Safety contract:
   - Every reveal/initial-hidden state is gated behind `html.sk-motion`,
     a class added by sk-motion.js ONLY when the browser supports it AND the
     user has not requested reduced motion. With no JS (or reduced motion)
     the page renders fully visible exactly as before.
   - Reuses the existing motion tokens (--ease-cinema, --ease-out, --accent…).
   ========================================================================== */

/* -------- Lenis smooth-scroll baseline (recommended by the library) ------ */
html.lenis,
html.lenis body { height: auto; }
.lenis.lenis-smooth { scroll-behavior: auto !important; }
.lenis.lenis-smooth [data-lenis-prevent] { overscroll-behavior: contain; }
.lenis.lenis-stopped { overflow: hidden; }

/* -------- Scroll progress hairline (brand accent) ------------------------ */
.sk-scroll-progress {
  position: fixed; top: 0; left: 0; right: 0; height: 2px;
  background: var(--accent);
  transform: scaleX(var(--sk-progress, 0));
  transform-origin: 0 50%;
  z-index: calc(var(--z-nav) + 1);
  pointer-events: none;
  opacity: 0.9;
}

/* ==========================================================================
   REVEAL SYSTEM — only armed under html.sk-motion
   ========================================================================== */
/* Exploratory feel: longer, smoothly decelerating (ease-out-expo). */
html.sk-motion { --sk-ease-explore: cubic-bezier(0.16, 1, 0.3, 1); }
/* "Popolamento" allo scroll: SOLA dissolvenza, nessuno spostamento o
   ridimensionamento (richiesta cliente). I contenuti compaiono morbidi quando
   entrano nello schermo; lo stagger (--reveal-delay) li fa apparire in sequenza. */
html.sk-motion [data-reveal] {
  opacity: 0;
  transition-property: opacity;
  transition-duration: 0.85s;
  transition-timing-function: var(--sk-ease-explore);
  transition-delay: var(--reveal-delay, 0s);
}
html.sk-motion [data-reveal]:not(.is-in) { will-change: opacity; }
html.sk-motion [data-reveal].is-in { opacity: 1; }

/* Con GSAP attivo è GSAP a controllare l'opacità: spegniamo le transition CSS
   (niente doppia animazione) e il clip-wipe del jagged (solo dissolvenza). */
html.sk-gsap [data-reveal] { transition: none !important; }
html.sk-gsap .sk-jagged { clip-path: none !important; transition: none !important; }

/* ==========================================================================
   HERO — subtle parallax layers (transform driven by JS, no transition)
   ========================================================================== */
html.sk-motion .page-header .bg-mesh,
html.sk-motion .oblique-wrap[data-parallax] { will-change: transform; }

/* ==========================================================================
   COUNT-UP — keep figures from jittering width while ticking
   ========================================================================== */
.stat .num.is-counting { font-variant-numeric: tabular-nums; font-feature-settings: "tnum" 1; }

/* ==========================================================================
   REFINED MICRO-INTERACTIONS  (brand colours untouched — motion only)
   ========================================================================== */
.btn-primary, .btn-ghost-light, .btn-ghost-dark {
  transition: background 0.3s var(--ease-out), color 0.3s var(--ease-out),
              border-color 0.3s var(--ease-out), transform 0.28s var(--ease-out),
              box-shadow 0.3s var(--ease-out);
  will-change: transform;
}
.btn-primary:hover  { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.btn-ghost-light:hover, .btn-ghost-dark:hover { transform: translateY(-2px); }
.btn-primary:active, .btn-ghost-light:active, .btn-ghost-dark:active,
.nav-cta:active, .book-cta:active, .sk-overlay-cta:active { transform: translateY(0) scale(0.975); }

/* Room cards: lift the whole card (image-scale already exists in Website.css) */
.room-card { transition: box-shadow 0.45s var(--ease-out), transform 0.45s var(--ease-out); }
.room-card.is-clickable:hover { transform: translateY(-4px); }

/* Pillars (dark band): quiet hover warmth + icon lift */
.pillar { transition: background 0.4s var(--ease-out); }
.pillar:hover { background: rgba(241, 240, 236, 0.03); }
.pillar .icon svg { transition: transform 0.5s var(--ease-out); }
.pillar:hover .icon svg { transform: translateY(-3px); }

/* FAQ disclosure marker: rotate the + into a × on open */
details > summary span:last-child { transition: transform 0.3s var(--ease-out); display: inline-block; }
details[open] > summary span:last-child { transform: rotate(45deg); }

/* Footer / nav link hover already animated in Website.css — left intact. */

/* ==========================================================================
   BRAND "JAGGED" LINE-ART LAYER — scroll-driven (uses bg-wireframe.jpg)
   On dark surfaces the artwork is inverted to luminous lines and screen-blended;
   it "draws in" with a clip-path wipe as the surface enters, then drifts with
   a gentle parallax. Purely decorative: hidden when motion is off.
   ========================================================================== */
.page-header, .section.dark { position: relative; }
.page-header > *:not(.sk-jagged),
.section.dark > *:not(.sk-jagged) { position: relative; z-index: 1; }

.sk-jagged {
  position: absolute; inset: -18% -9%;
  background-image: var(--jag-img, url('bg-wireframe.jpg'));
  background-position: right center; background-size: cover; background-repeat: no-repeat;
  pointer-events: none; z-index: 0; opacity: 0;
  mix-blend-mode: multiply;   /* light surfaces: dark line-art on the paper field */
}
/* Dark surfaces → invert to luminous lines on the deep-mineral field */
.page-header:not(.light) .sk-jagged,
.section.dark .sk-jagged {
  filter: invert(1) contrast(1.15) brightness(1.1);
  mix-blend-mode: screen;
}
/* Corner accent for dark content sections */
.sk-jagged.accent {
  inset: auto -6% -14% auto;
  width: min(48%, 600px); height: 78%;
  background-position: right bottom;
}

html.sk-motion .sk-jagged {
  clip-path: inset(0 100% 0 0);
  transition: clip-path 1.9s var(--sk-ease-explore), opacity 1.7s ease;
  will-change: transform, clip-path, opacity;
}

/* Light/paper sections keep the ORIGINAL fixed-attachment CSS backdrop (the
   "beige reveals the drawing while scrolling" parallax the brand loves). It's
   made element-matched per page via --sk-page-pattern (set in sk-motion.js).
   So we intentionally do NOT disable ::before here, and we do NOT inject a
   .sk-jagged layer into light/paper sections. */
html.sk-motion .sk-jagged.is-drawn {
  clip-path: inset(0 0 0 0);
  opacity: var(--jag-opacity, 0.16);
}

@media (max-width: 880px) {
  .sk-jagged.accent { width: 78%; height: 60%; }
  html.sk-motion .sk-jagged.is-drawn { opacity: calc(var(--jag-opacity, 0.16) * 0.7); }
}

/* ==========================================================================
   FULL-BLEED VIDEO BAND (home, before Active Soul) — full-size video, not a
   background. Gentle parallax drift handled in sk-motion.js.
   ========================================================================== */
.sk-video-band {
  position: relative; width: 100%;
  height: 80vh; min-height: 440px; max-height: 760px;
  overflow: hidden; background: var(--sk-deep-mineral);
}
.sk-video-full {
  position: absolute; left: 0; top: -10%;
  width: 100%; height: 120%;
  object-fit: cover; display: block;
  will-change: transform;
}
@media (max-width: 880px) { .sk-video-band { height: 58vh; min-height: 320px; } }

/* ==========================================================================
   RELATED OUTDOOR — "Ti potrebbe interessare anche" cross-link cards.
   ========================================================================== */
.related-outdoor .related-head h2 { font-family: var(--font-display); font-weight: 400; font-size: clamp(1.8rem, 3vw, 2.6rem); line-height: 1.05; margin: 0.6rem 0 0; }
.related-outdoor .related-head h2 em { font-style: italic; color: var(--accent); }
.related-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 1.2rem; margin-top: 2.5rem; }
.related-card { text-align: left; background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--radius-xs); padding: 1.4rem 1.5rem; cursor: pointer; display: flex; flex-direction: column; gap: 0.4rem; font-family: var(--font-body); transition: border-color 0.3s var(--ease-out), transform 0.3s var(--ease-out), box-shadow 0.3s var(--ease-out); }
.related-card:hover { border-color: var(--border-strong); transform: translateY(-3px); box-shadow: var(--shadow-md); }
.related-card-label { font-family: var(--font-display); font-size: 1.2rem; color: var(--fg); }
.related-card-hint { font-weight: 300; font-size: 0.85rem; color: var(--fg-muted); line-height: 1.45; }
.related-card-arrow { margin-top: 0.4rem; font-weight: 600; font-size: 0.68rem; letter-spacing: 0.18em; text-transform: uppercase; color: var(--accent); }

/* ==========================================================================
   BREADCRUMBS — slim, elegant internal-nav aid under the sticky nav.
   ========================================================================== */
.breadcrumbs { background: #f4f1ea; border-bottom: 1px solid var(--border); padding: 0.55rem 2.5rem; }
.breadcrumbs ol { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; }
.breadcrumbs li { display: inline-flex; align-items: center; gap: 0.5rem; font-family: var(--font-body); font-weight: 500; font-size: 0.7rem; letter-spacing: 0.12em; text-transform: uppercase; }
.breadcrumbs a { color: var(--fg-muted); cursor: pointer; transition: color 0.2s var(--ease-out); }
.breadcrumbs a:hover { color: var(--accent); }
.breadcrumbs [aria-current] { color: var(--fg); }
.breadcrumbs .sep { color: var(--accent); opacity: 0.55; }
@media (max-width: 880px) { .breadcrumbs { padding: 0.5rem 1.25rem; } }

/* ==========================================================================
   Hide the legacy image-edit controls (↻ replace / ✕ clear) that came from the
   Claude-design prototype. They're no longer needed in production. This covers
   both the component-rendered .card-tools and the JS-injected .slot-tools, plus
   the media upload hint/input.
   ========================================================================== */
.card-tools, .slot-tools, .media-card .upload-hint, .media-input { display: none !important; }

/* ==========================================================================
   CONCEPT ROOMS GRID (.rooms-grid.tall) — 3+2 on desktop, swipe carousel on
   mobile. Bigger cards so the title + "Apri Gallery" link stay legible.
   ========================================================================== */
.rooms-grid.tall {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1.5rem;
}
.rooms-grid.tall > * {
  flex: 0 1 calc((100% - 3rem) / 3);   /* 3 per row; the 5th+ wrap and centre */
  min-width: 0;
}

/* Gallery CTA is hover-revealed on desktop; on touch there's no hover, so
   keep it visible there. */
@media (hover: none) {
  .room-card .cta-link { opacity: 1; transform: none; }
}

@media (max-width: 880px) {
  /* One card at a time, peek of the next, horizontal snap-scroll. */
  .rooms-grid.tall {
    flex-wrap: nowrap;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    gap: 1rem;
    padding-bottom: 0.25rem;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;              /* hide native bar; we draw our own */
  }
  .rooms-grid.tall::-webkit-scrollbar { display: none; }
  .rooms-grid.tall > * {
    flex: 0 0 82%;                      /* ~18% of the next card peeks in */
    scroll-snap-align: center;
  }
  /* No hover on the carousel — keep the gallery CTA visible. */
  .rooms-grid.tall .room-card .cta-link { opacity: 1; transform: none; }
}

/* Swipe progress bar (shown only when the row actually scrolls = mobile). */
.sk-carousel-progress {
  display: none;
  height: 3px;
  max-width: 180px;
  margin: 1.1rem auto 0;
  background: rgba(26, 42, 68, 0.12);
  border-radius: 999px;
  overflow: hidden;
}
.section.dark .sk-carousel-progress { background: rgba(241, 240, 236, 0.18); }
.sk-carousel-progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 999px;
  transform-origin: left center;
  transform: scaleX(0.2);
  transition: transform 0.12s linear;
}

/* ==========================================================================
   LANGUAGE SWITCH — compact dropdown (fits the nav on mobile)
   ========================================================================== */
.lang-switch { position: relative; }
.lang-current {
  display: inline-flex; align-items: center; gap: 0.3rem;
  border: 1px solid rgba(26,42,68,0.25); border-radius: 999px;
  padding: 0.35rem 0.7rem; background: transparent; cursor: pointer;
  font-family: var(--font-body); font-weight: 600; font-size: 0.65rem;
  letter-spacing: 0.12em; color: var(--sk-deep-mineral);
  transition: background 0.2s var(--ease-out), border-color 0.2s var(--ease-out), color 0.25s var(--ease-out);
}
.lang-current:hover { background: rgba(26,42,68,0.06); }
.lang-caret { transition: transform 0.2s var(--ease-out); }
.lang-switch.open .lang-caret { transform: rotate(180deg); }
.lang-menu {
  position: absolute; top: calc(100% + 6px); right: 0;
  background: #f9f7f2; border: 1px solid var(--border);
  box-shadow: var(--shadow-md); border-radius: 6px; padding: 0.3rem;
  list-style: none; margin: 0; z-index: var(--z-nav); min-width: 62px;
  animation: sk-langpop 0.18s var(--ease-out);
}
@keyframes sk-langpop { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
.lang-menu li { margin: 0; }
.lang-menu button {
  display: block; width: 100%; text-align: left; padding: 0.4rem 0.7rem;
  background: none; border: 0; cursor: pointer; border-radius: 4px;
  font-family: var(--font-body); font-weight: 600; font-size: 0.7rem;
  letter-spacing: 0.1em; color: var(--sk-deep-mineral);
}
.lang-menu button:hover, .lang-menu button.active { background: rgba(196,168,120,0.18); color: var(--accent); }
/* On the dark full-screen overlay the trigger turns light */
.nav-on-overlay .lang-current { color: var(--sk-cloud-dancer); border-color: rgba(241,240,236,0.3); }

/* ==========================================================================
   BACK-TO-TOP button — sits at the TOP of the floating FAB column
   (above the accessibility + WhatsApp icons), so no overlap.
   ========================================================================== */
.fab.fab-totop {
  background: var(--sk-deep-mineral); color: var(--accent);
  animation: sk-fab-in 0.3s var(--ease-out);
}
.fab.fab-totop:hover { background: var(--sk-deep-mineral-2); }
@keyframes sk-fab-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* ==========================================================================
   ACCESSIBILITY WIDGET (EAA) — panel + user preference classes
   ========================================================================== */
.a11y-overlay { position: fixed; inset: 0; background: rgba(26,42,68,0.45); backdrop-filter: blur(2px); z-index: var(--z-modal); display: grid; place-items: center; padding: 1rem; }
.a11y-panel { background: #f9f7f2; width: min(380px, 100%); border-radius: 6px; padding: 1.6rem; box-shadow: var(--shadow-xl); font-family: var(--font-body); color: var(--fg); }
.a11y-head { display: flex; justify-content: space-between; align-items: center; font-family: var(--font-display); font-size: 1.3rem; margin-bottom: 1.2rem; }
.a11y-head button { background: none; border: 0; font-size: 1.05rem; cursor: pointer; color: var(--fg-muted); }
.a11y-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; font-size: 0.9rem; }
.a11y-btns button { border: 1px solid var(--border-strong); background: #fff; padding: 0.35rem 0.7rem; cursor: pointer; font-family: var(--font-body); margin-left: 0.35rem; border-radius: 3px; min-width: 38px; }
.a11y-toggle { display: block; width: 100%; text-align: left; padding: 0.7rem 0.9rem; margin-bottom: 0.5rem; border: 1px solid var(--border-strong); background: #fff; cursor: pointer; font-family: var(--font-body); font-size: 0.9rem; border-radius: 3px; transition: background 0.2s, color 0.2s; }
.a11y-toggle.on { background: var(--sk-deep-mineral); color: #f9f7f2; border-color: var(--sk-deep-mineral); }
.a11y-reset { margin-top: 0.4rem; background: none; border: 0; color: var(--accent); cursor: pointer; font-family: var(--font-body); font-size: 0.72rem; letter-spacing: 0.12em; text-transform: uppercase; }
.a11y-note { font-size: 0.72rem; color: var(--fg-subtle); margin-top: 1rem; line-height: 1.5; }
.a11y-note a { color: var(--accent); }

/* User preference classes applied to <html> */
html.a11y-contrast {
  --fg-muted: var(--sk-deep-mineral);
  --fg-subtle: rgba(26,42,68,0.78);
  --fg-on-dark-muted: #f1f0ec;
  --fg-on-dark-subtle: rgba(241,240,236,0.82);
  --border: rgba(26,42,68,0.3);
}
html.a11y-underline a { text-decoration: underline; text-underline-offset: 2px; }
html.a11y-noanim *, html.a11y-noanim *::before, html.a11y-noanim *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
html.a11y-noanim [data-reveal] { opacity: 1 !important; transform: none !important; clip-path: none !important; }
html.a11y-noanim .sk-jagged { clip-path: none !important; transform: none !important; opacity: var(--jag-opacity, 0.14) !important; }
html.a11y-noanim .sk-scroll-progress { display: none; }

/* ==========================================================================
   ACCESSIBILITY — hard stop for reduced motion (belt & braces)
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
  html.sk-motion [data-reveal] {
    opacity: 1 !important;
    transform: none !important;
    clip-path: none !important;
    transition: none !important;
  }
  .sk-scroll-progress { display: none; }
  .btn-primary:hover, .btn-ghost-light:hover, .btn-ghost-dark:hover,
  .room-card.is-clickable:hover { transform: none; }
  html.sk-motion .sk-jagged { transition: none; clip-path: none; opacity: var(--jag-opacity, 0.14); }
}

/* ==========================================================================
   TESTATA — nuova intestazione pagina (foto full-width + titolo centrato a due
   colori con effetto macchina da scrivere + banda blu testo/CTA).
   ========================================================================== */
.sk-testata { width: 100%; }
.sk-testata-photo { position: relative; width: 100%; aspect-ratio: 1366 / 620;
  overflow: hidden; background: var(--sk-deep-mineral); }
.sk-testata-photo img { position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; display: block; }
/* velo centrale per la leggibilità del titolo centrato */
.sk-testata-photo::after { content: ""; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(ellipse 72% 58% at 50% 50%, rgba(26,42,68,.50) 0%, rgba(26,42,68,.18) 55%, transparent 78%); }
.sk-testata-title { position: absolute; inset: 0; z-index: 2; margin: 0;
  display: flex; align-items: center; justify-content: center; text-align: center; padding: 0 6%;
  font-family: var(--font-display); font-weight: 500; font-size: clamp(32px, 6.4vw, 92px);
  line-height: 1.04; letter-spacing: -0.5px; }
.sk-testata-title .tw { text-align: center; }
.sk-testata-title .ch { opacity: 0; }            /* svelati uno a uno dalla macchina da scrivere */
.sk-testata-title .wd { white-space: nowrap; }
.sk-testata-title .c-cream { color: #f1f0ec; }
.sk-testata-title .c-white { color: #ffffff; }
.sk-testata-title .c-blue  { color: var(--sk-deep-mineral); font-style: italic; }
.sk-testata-title .c-oak   { color: var(--sk-raw-oak); font-style: italic; }
.sk-testata-title .sk-caret { display: inline-block; width: .055em; height: 1.05em;
  transform: translateY(.16em); background: var(--sk-raw-oak); margin-left: .02em; }
.sk-testata-title .sk-caret.blink { animation: sk-caret-blink .9s steps(1) infinite; }
@keyframes sk-caret-blink { 50% { opacity: 0; } }

.sk-testata-band { background: var(--sk-deep-mineral); color: var(--sk-textural-white);
  display: grid; grid-template-columns: 1.55fr 1fr; gap: 44px; align-items: center;
  padding: 42px clamp(20px, 5vw, 66px); }
.sk-testata-block { font-family: var(--font-display); font-weight: 600; margin: 0 0 6px;
  font-size: clamp(24px, 2.7vw, 38px); line-height: 1.1; color: var(--sk-textural-white); }
.sk-testata-titoletto { font-size: 12px; letter-spacing: .2em; text-transform: uppercase;
  color: var(--sk-raw-oak); margin: 0 0 14px; font-weight: 600; }
.sk-testata-body { margin: 0; font-size: clamp(16px, 1.4vw, 20px); line-height: 1.62;
  color: #d8d6cf; max-width: 64ch; }
.sk-testata-body strong { color: var(--sk-textural-white); font-weight: 600; }
.sk-testata-cta { display: flex; flex-direction: column; gap: 12px; align-items: stretch; }
.sk-testata-cta .btn-primary, .sk-testata-cta .btn-ghost-light { width: 100%; }
/* La banda è blu scuro: il ghost-light di default è blu-su-blu (invisibile).
   Qui lo forziamo chiaro per renderlo leggibile. */
.sk-testata-cta .btn-ghost-light {
  color: var(--sk-textural-white);
  border: 1px solid rgba(241, 240, 236, 0.45);
  background: transparent;
}
.sk-testata-cta .btn-ghost-light:hover {
  border-color: var(--sk-raw-oak);
  color: var(--sk-textural-white);
  background: rgba(241, 240, 236, 0.06);
}

@media (max-width: 880px) {
  .sk-testata-photo { aspect-ratio: 4 / 5; }
  .sk-testata-photo::after { background: linear-gradient(0deg, rgba(26,42,68,.62) 0%, transparent 55%); }
  .sk-testata-band { grid-template-columns: 1fr; gap: 22px; }
}
/* Reduced-motion / accessibilità: nessuna scrittura animata, titolo pieno visibile */
@media (prefers-reduced-motion: reduce) { .sk-testata-title .ch { opacity: 1; } }
html.a11y-noanim .sk-testata-title .ch { opacity: 1 !important; }

/* ═══════════════ SELETTORE LINGUA — sigla + nome nella lingua stessa ═══════════════
   La sigla resta la chiave di lettura rapida; il nome nativo dice a chi
   scorre il menu che quella lingua e' la sua. L'arabo NON prende
   letter-spacing: distanziare le lettere arabe spezza le legature e rende la
   parola quasi illeggibile — e' scrittura corsiva, non lettere staccate. */
.lang-menu button{display:flex !important;align-items:baseline;gap:.55rem;white-space:nowrap}
.lang-menu .lang-sigla{min-width:1.6em}
.lang-menu .lang-nome{font-weight:400;font-size:.72rem;letter-spacing:0;
  text-transform:none;opacity:.72}
.lang-menu [lang="ar"]{letter-spacing:0;font-size:.85rem}
