/* ==========================================================================
   STILLHOUSE — Home page styles (Step A1)
   Base = desktop · max-width 1199px = tablet · max-width 809px = mobile.
   Initial "hidden" states exist only when JS is on AND motion is allowed.
   ========================================================================== */

[hidden] { display: none !important; }

.skip-link {
  position: fixed; left: 16px; top: -64px; z-index: 100;
  background: var(--color-olive); color: var(--color-linen);
  padding: 12px 18px; border-radius: 999px; text-decoration: none;
  transition: top var(--dur-fast) var(--ease-out);
}
.skip-link:focus { top: 16px; }

/* --- Shared utilities ------------------------------------------------------ */
.mask { display: inline-block; overflow: hidden; vertical-align: top; padding-bottom: 0.14em; margin-bottom: -0.14em; }
.mask__inner { display: inline-block; will-change: transform; }

.link-arrow {
  display: inline-flex; align-items: center; gap: 12px;
  font-size: 15px; font-weight: 500; text-decoration: none; color: var(--text);
  padding-bottom: 6px; border-bottom: 1px solid currentColor;
  align-self: flex-start;
}
.link-arrow .btn__arrow { transition: transform var(--dur-fast) var(--ease-out); }
.link-arrow:hover .btn__arrow { transform: translateX(5px); }

.circle-btn {
  width: 56px; height: 56px; border-radius: 50%;
  border: 1px solid var(--text); background: transparent; color: var(--text);
  display: inline-flex; align-items: center; justify-content: center; cursor: pointer;
  transition: background-color var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out);
}
.circle-btn:hover { background: var(--text); color: var(--bg); }
.circle-btn svg { width: 18px; height: 18px; }

/* Smooth colour handover when the day cycle flips text colour */
body, .navbar, .t-muted, .t-label, .hairline, .link-arrow, .circle-btn, .quote__by {
  transition: color 0.5s var(--ease-out), border-color 0.5s var(--ease-out);
}

/* Reveal start states (JS adds .js, user allows motion) */
@media (prefers-reduced-motion: no-preference) {
  .js [data-reveal="up"] { opacity: 0; transform: translateY(28px); }
  .js [data-img-reveal] { clip-path: inset(100% 0 0 0); }
  .js [data-img-reveal] img { transform: scale(1.18); }
  .js .mask__inner { transform: translateY(112%); }
  .js .room-row:not(.is-in) { border-top-color: transparent; }
  .js .room-list li:last-child .room-row:not(.is-in) { border-bottom-color: transparent; }
  .js .g-letter { transform: translateY(105%); }
}

/* --- Navbar (Home: fixed, transparent over hero, solid after scroll) ------- */
.page-home .navbar {
  position: fixed; left: 0; right: 0; top: 0; z-index: 30;
  background: transparent; border-bottom: 1px solid transparent;
  transition: background-color 0.5s var(--ease-out), border-color 0.5s var(--ease-out), color 0.5s var(--ease-out), transform 0.6s var(--ease-out);
}
.page-home .navbar.is-solid { background: var(--bg); border-bottom-color: var(--hairline); }
.page-home .navbar.is-hidden { transform: translateY(-100%); }
body.menu-open .navbar { visibility: hidden; background: transparent; border-bottom-color: transparent; transform: none; color: var(--color-linen); }
body.menu-open .navbar__wordmark,
body.menu-open .navbar__toggle { color: var(--color-linen); border-color: var(--color-linen); }
.navbar__wordmark, .navbar__links a, .navbar__toggle { color: var(--text); }
.navbar__links a[aria-current="page"] { background-size: 100% 1px; }
.navbar__cta { height: 48px; padding-inline: 24px; }

/* --- Mobile menu ----------------------------------------------------------- */
.menu {
  position: fixed; inset: 0; z-index: 20;
  background: var(--color-olive); color: var(--color-linen);
  display: flex; flex-direction: column; justify-content: space-between;
  padding: 120px max(20px, var(--gutter)) 40px;
  clip-path: inset(0 0 100% 0);
}
.menu.is-open { clip-path: inset(0 0 0 0); }
.menu__links { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.menu__links a {
  font-family: var(--font-display); font-weight: 500; font-size: 48px; line-height: 1.05;
  color: var(--color-linen); text-decoration: none;
}
.menu__links a:hover { color: var(--color-oak); }
.menu__mask { display: block; overflow: hidden; padding-bottom: 0.1em; }
.menu__line { display: block; transform: translateY(110%); }
.menu.is-open .menu__line { transform: none; }
.menu__cta { align-self: flex-start; }
.menu__bar {
  position: absolute; top: 0; left: 0; right: 0; height: 72px;
  display: flex; align-items: center; justify-content: space-between;
  padding-inline: max(20px, var(--gutter));
}
.menu__wordmark { font-family: var(--font-display); font-size: 30px; font-weight: 500; letter-spacing: -0.01em; color: var(--color-linen); text-decoration: none; }
.menu__close {
  width: 44px; height: 44px; display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%; border: 1px solid var(--color-linen); background: transparent;
  color: var(--color-linen); cursor: pointer;
}
.menu__close svg { width: 18px; height: 18px; }
/* menu covers the navbar: its own bar carries logo + close */
.menu { z-index: 40; }

/* --- Day cycle indicator --------------------------------------------------- */
.daycycle {
  position: fixed; right: 14px; top: 0; height: 100svh; width: 44px;
  z-index: 6; pointer-events: none; opacity: 0; transition: opacity 0.8s var(--ease-out);
}
.daycycle.is-on { opacity: 1; }
.daycycle svg { width: 100%; height: 100%; display: block; overflow: visible; }
.daycycle .daycycle__arc { stroke: var(--hairline); stroke-width: 1; }
.daycycle__body {
  position: absolute; left: 0; top: 0; width: 22px; height: 22px; margin: -11px 0 0 -11px;
  color: var(--color-clay); will-change: transform;
}
.daycycle__body svg { position: absolute; inset: 0; width: 22px; height: 22px; }
.daycycle__moon { color: var(--color-oak); opacity: 0; }

/* --- 1. Hero --------------------------------------------------------------- */
.hero { position: relative; height: 260svh; }
.hero__stage {
  position: sticky; top: 0; height: 100svh; overflow: hidden;
  --hero-ink: var(--color-ink);
  --pad: max(20px, 5vw);
  color: var(--hero-ink);
}
.hero__frame {
  position: absolute; inset: 0;
  clip-path: inset(22svh 33vw 22svh 33vw round 17vw 17vw 8px 8px);   /* JS animates this to inset(0) */
  will-change: clip-path;
  background: var(--color-sand);
}
.hero__img { width: 100%; height: 100%; object-fit: cover; border-radius: 0; transform: scale(1.25); will-change: transform; filter: saturate(0.94) contrast(0.97); }
.hero__scrim { position: absolute; inset: 0; background: var(--color-ink); opacity: 0; }

.hero__label {
  position: absolute; left: var(--pad); top: 112px; z-index: 3;
  color: var(--hero-ink); display: flex; gap: 10px;
}
.hero__label .t-time { color: inherit; }

.hero__title {
  position: absolute; inset: 0; z-index: 3; margin: 0; pointer-events: none;
  font-size: min(var(--display-xl-size), 11.6vw);
  color: var(--hero-ink);
}
.hero__line { position: absolute; display: block; }
.hero__line .mask { display: block; }
.hero__line--a { left: var(--pad); top: calc(112px + 44px); }
.hero__line--b { right: var(--pad); bottom: 25svh; text-align: right; }
.hero__title .t-italic { color: var(--color-clay); }

.hero__intro {
  position: absolute; z-index: 3; left: var(--pad); bottom: 25svh; width: min(300px, 24vw);
  display: flex; flex-direction: column; gap: 20px;
  color: var(--hero-ink);
}
.hero__intro .t-body-l { font-size: 16px; line-height: 1.6; }
.hero__link {
  display: inline-flex; align-items: center; gap: 12px; align-self: flex-start;
  font-size: 15px; font-weight: 500; color: inherit; text-decoration: none;
  padding-bottom: 6px; border-bottom: 1px solid currentColor;
}
.hero__link .btn__arrow { transition: transform var(--dur-fast) var(--ease-out); }
.hero__link:hover .btn__arrow { transform: translateX(5px); }

/* --- Booking bar (simple stay filter) --------------------------------------- */
.booking {
  position: absolute; z-index: 4; left: 0; right: 0; margin-inline: auto; bottom: 4svh;
  width: min(1080px, calc(100% - 2 * var(--pad)));
  display: grid; grid-template-columns: 1fr 1fr 0.8fr 1.1fr auto; align-items: stretch;
  background: var(--color-linen); color: var(--color-ink);
  border-radius: 999px; padding: 8px 8px 8px 12px;
  box-shadow: 0 18px 48px -20px rgba(31, 28, 24, 0.45);
}
.booking__field, .booking__summary {
  display: flex; flex-direction: column; justify-content: center; gap: 2px;
  padding: 6px 24px; border-right: 1px solid var(--color-line); min-width: 0;
}
.booking__summary { border-right: 0; }
.booking label, .booking .t-label { font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--color-stone); font-weight: 500; }
.booking input, .booking select {
  border: 0; background: transparent; font: inherit; font-size: 15px; color: var(--color-ink);
  padding: 0; height: 26px; width: 100%; outline-offset: 6px; appearance: none; -webkit-appearance: none;
}
.booking select { cursor: pointer; }
.booking input::-webkit-calendar-picker-indicator { opacity: .55; cursor: pointer; }
.booking select { padding-right: 40px; background-position: right 16px center; }
.booking__total { font-size: 15px; font-variant-numeric: tabular-nums; color: var(--color-ink); white-space: nowrap; }
.booking__total.is-error { color: var(--color-clay); }
.booking__submit { height: 56px; }
.booking__field:focus-within { background: rgba(232, 217, 192, 0.45); border-radius: 999px; }

/* --- 2. Welcome ------------------------------------------------------------- */
.welcome__inner { display: flex; flex-direction: column; gap: 48px; max-width: 1180px; }
.welcome__statement { font-size: clamp(34px, 5.4vw, 84px); line-height: 1.06; max-width: 1100px; font-weight: 500; }
.js .welcome__statement .w { opacity: 0.16; }
.welcome__statement .t-italic { color: var(--accent); }
.facts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 32px; margin: 24px 0 0; padding: 32px 0 0; border-top: 1px solid var(--hairline); }
.fact { margin: 0; display: flex; flex-direction: column-reverse; gap: 6px; }
.fact dt { }
.fact dd { margin: 0; font-family: var(--font-display); font-size: clamp(56px, 8vw, 120px); line-height: 1; font-weight: 500; font-variant-numeric: lining-nums tabular-nums; }
.welcome__intro-mobile { display: none; }

/* --- 3. Room browser ---------------------------------------------------------- */
.rooms-section__head { display: flex; align-items: flex-end; justify-content: space-between; gap: 32px; }
.room-list { list-style: none; margin: 0; padding: 0; }
.room-row { position: relative; border-top: 1px solid var(--hairline); transition: border-color 1.2s var(--ease-out); }
.room-list li:last-child .room-row { border-bottom: 1px solid var(--hairline); }
.room-row__thumb { display: none; }
.room-row__name .mask { padding-right: 0.06em; }

.cursor-preview {
  position: fixed; left: 0; top: 0; z-index: 8; width: 280px; aspect-ratio: 4 / 5;
  pointer-events: none; border-radius: 4px; overflow: hidden; opacity: 0;
  box-shadow: 0 30px 60px -30px rgba(31, 28, 24, 0.5);
  will-change: transform, opacity; background: var(--color-sand);
}
.cursor-preview img { width: 100%; height: 100%; object-fit: cover; border-radius: 0; transform: scale(1.15); }

/* Touch devices: no cursor, thumbnails shown inline */
@media (hover: none), (pointer: coarse) {
  .cursor-preview { display: none; }
  .room-row { grid-template-columns: 1fr auto; row-gap: 12px; }
  .room-row__index { display: none; }
  .room-row__thumb { display: block; grid-column: 1 / -1; order: 5; }
}

/* --- 4. Slow gallery ---------------------------------------------------------- */
.gallery { position: relative; height: 560svh; }   /* JS sets the exact runway */
.gallery__pin { position: sticky; top: 0; height: 100svh; overflow: hidden; display: flex; flex-direction: column; justify-content: center; }
.gallery__head { position: absolute; top: 108px; left: 0; right: 0; display: flex; justify-content: space-between; align-items: center; z-index: 2; }
.gallery__track {
  display: flex; align-items: center; gap: 7vw; width: max-content;
  padding-inline: max(20px, 6vw) 14vw; will-change: transform;
}
.g-item { flex: none; margin: 0; display: flex; flex-direction: column; gap: 14px; will-change: transform; }
.g-item .media { height: 50svh; aspect-ratio: 4 / 3; background: var(--color-oak); }
.g-item--s .media { height: 38svh; aspect-ratio: 3 / 4; }
.g-item--m .media { height: 46svh; aspect-ratio: 4 / 5; }
.g-item--l .media { height: 50svh; aspect-ratio: 4 / 3; }
.g-item--xl .media { height: 56svh; aspect-ratio: 16 / 9; }
.g-item--low { margin-top: 9svh; }
.g-item--high { margin-top: -9svh; }
/* Gallery images are 130 % wide so they can drift ±15 % inside their frame */
.g-item img { position: absolute; top: 0; left: -15%; width: 130%; max-width: none; height: 100%; object-fit: cover; will-change: translate; }
.media img[data-parallax-img] { position: absolute; left: 0; top: -8%; width: 100%; max-width: none; height: 116%; will-change: translate; }
.g-item figcaption { font-size: 13px; color: var(--text-muted); display: flex; gap: 10px; }
.gallery__progress { position: absolute; left: max(20px, 5vw); right: max(20px, 5vw); bottom: 7svh; height: 1px; background: var(--hairline); }
.gallery__progress span { position: absolute; inset: 0; background: var(--text); transform-origin: left; transform: scaleX(0); }

/* --- 5. Rhythm (marquee) ------------------------------------------------------ */
.rhythm { overflow: hidden; border-block: 1px solid var(--hairline); padding-block: 36px; }
.rhythm__track { display: flex; width: max-content; will-change: transform; }
.rhythm__group { display: flex; align-items: center; gap: 48px; padding-right: 48px; white-space: nowrap; font-family: var(--font-display); font-size: clamp(40px, 6vw, 88px); line-height: 1; font-weight: 500; font-style: italic; }
.rhythm__group i { font-style: normal; color: var(--accent); }

/* --- 6. Experiences ----------------------------------------------------------- */
.exp-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 32px; align-items: start; }
.exp-card:nth-child(2) { margin-top: 72px; }
.exp-card__link { display: flex; flex-direction: column; gap: 22px; text-decoration: none; color: inherit; }
.exp-card__body { display: flex; flex-direction: column; gap: 10px; }
.exp-card__body .card__title { transition: color var(--dur-fast) var(--ease-out); }
.exp-card__link:hover .card__title { color: var(--accent); }

/* --- 7. Dining teaser ---------------------------------------------------------- */
.dining__grid { display: grid; grid-template-columns: 1.1fr 0.9fr; gap: 96px; align-items: center; }
.dining__media { position: relative; padding-bottom: 12%; }
.dining__main { width: 74%; }
.dining__second { position: absolute; right: 0; bottom: 0; width: 42%; border: 8px solid var(--bg); }

/* --- 8. Guest words ------------------------------------------------------------ */
.words__inner { display: flex; flex-direction: column; gap: 56px; max-width: 1100px; }
.words__stage { position: relative; min-height: clamp(260px, 30vw, 380px); }
.words__slide { position: absolute; inset: 0 auto auto 0; margin: 0; width: 100%; opacity: 0; visibility: hidden; }
.words__slide.is-active { opacity: 1; visibility: visible; }
.words .quote { font-size: clamp(34px, 5.6vw, 80px); line-height: 1.1; text-wrap: balance; }
.words .quote .w { display: inline-block; }
.words__controls { gap: 16px; }
.words__controls .t-time { margin-left: 12px; }

/* --- 9. Final CTA --------------------------------------------------------------- */
.cta { background: var(--color-ink); color: var(--color-linen); }
.cta__inner { display: flex; flex-direction: column; align-items: flex-start; gap: 56px; }
.cta .t-display-l { max-width: 14ch; }

/* --- Footer extras --------------------------------------------------------------- */
.footer { position: relative; }
.footer__label { color: var(--color-oak); }
.footer__address { font-style: normal; color: var(--color-sand); line-height: 1.7; }
.footer__map { margin: 0; max-width: 240px; border-radius: 4px; overflow: hidden; border: 1px solid var(--hairline-dark); }
.footer__map svg { display: block; width: 100%; height: auto; }
.footer__giant {
  margin: 40px 0 0; font-family: var(--font-display); font-weight: 500;
  font-size: 22.5vw; line-height: 0.78; text-align: center; white-space: nowrap;
  color: var(--color-line-dark); user-select: none; overflow: hidden;
  height: 0.62em;                       /* crops the wordmark at the bottom */
  margin-bottom: 0; display: block;
}
.footer__giant-inner { display: inline-block; }
.g-letter { display: inline-block; will-change: transform; }

/* --- Tablet (810–1199) ------------------------------------------------------------ */
@media (max-width: 1199px) {
  .booking { grid-template-columns: 1fr 1fr 0.8fr auto; border-radius: 28px; }
  .booking__summary { display: none; }
  .hero__intro { width: min(260px, 26vw); }
  .exp-grid { grid-template-columns: repeat(2, 1fr); }
  .exp-card:nth-child(2) { margin-top: 0; }
  .exp-card:nth-child(3) { grid-column: 1 / -1; }
  .exp-card:nth-child(3) .exp-card__media { aspect-ratio: 16 / 9; }
  .dining__grid { gap: 56px; }
}

/* --- Mobile (0–809) --------------------------------------------------------------- */
@media (max-width: 809px) {
  .navbar__cta { display: none; }
  .daycycle { display: none; }
  .hero { height: 220svh; }
  .hero__frame { clip-path: inset(24svh 24vw 38svh 24vw round 24vw 24vw 8px 8px); }
  .hero__label { top: 92px; }
  .hero__line--a { top: calc(92px + 34px); }
  .hero__line--b { bottom: 36svh; }
  .hero__title { font-size: 17vw; }
  .hero__intro { display: none; }
  .welcome__intro-mobile { display: block; margin-bottom: 8px; }
  .booking {
    grid-template-columns: 1fr 1fr; border-radius: 20px; padding: 14px;
    bottom: 2.5svh; gap: 0;
  }
  .booking__field { border-right: 0; padding: 4px 10px; }
  .booking__field:nth-child(1) { border-right: 1px solid var(--color-line); }
  .booking__field:nth-child(3) { grid-column: 1 / -1; border-top: 1px solid var(--color-line); margin-top: 6px; padding-top: 10px; }
  .booking__submit { grid-column: 1 / -1; margin-top: 10px; justify-content: center; }
  .facts { grid-template-columns: 1fr; gap: 24px; }
  .fact { flex-direction: row-reverse; justify-content: space-between; align-items: baseline; }
  .rooms-section__head { flex-direction: column; align-items: flex-start; gap: 24px; }
  .room-row__name { font-size: 34px; }

  /* Gallery: no pin, native swipe */
  .gallery { height: auto !important; padding-block: 88px; }
  .gallery__pin { position: static; height: auto; display: block; overflow: visible; }
  .gallery__head { position: static; margin-bottom: 28px; }
  .gallery__track { width: auto; overflow-x: auto; padding-inline: 20px; gap: 16px; scroll-snap-type: x mandatory; align-items: flex-start; transform: none !important; scrollbar-width: none; }
  .gallery__track::-webkit-scrollbar { display: none; }
  .g-item { scroll-snap-align: center; transform: none !important; }
  .g-item .media, .g-item--s .media, .g-item--m .media, .g-item--l .media, .g-item--xl .media { height: 56svh; aspect-ratio: 3 / 4; width: 78vw; }
  .g-item--low, .g-item--high { margin-top: 0; }
  .gallery__progress { display: none; }

  .exp-grid { grid-template-columns: 1fr; gap: 48px; }
  .exp-card:nth-child(3) { grid-column: auto; }
  .exp-card:nth-child(3) .exp-card__media { aspect-ratio: 4 / 5; }
  .dining__grid { grid-template-columns: 1fr; gap: 40px; }
  .words__stage { min-height: 300px; }
  .menu__links a { font-size: 48px; }
  .footer__giant { font-size: 21vw; }
}

/* --- Motion extras (hidden start states, menu, page transition) --------------- */
@media (prefers-reduced-motion: no-preference) {
  .js .hero__label, .js .hero__intro, .js .booking { opacity: 0; }
  .js .words .quote .w { opacity: 0; }
  .js .words__slide figcaption { opacity: 0; }
  .js body { animation: pageIn 0.6s var(--ease-out) both; }
  body.is-leaving { opacity: 0; transition: opacity 0.38s var(--ease-out); }
}
@keyframes pageIn { from { opacity: 0; } to { opacity: 1; } }

.btn--magnetic { transition: translate 0.45s var(--ease-out), transform var(--dur-fast) var(--ease-out), background-color var(--dur-fast) var(--ease-out); }

.menu { transition: clip-path 0.7s var(--ease-out); }
.menu__line { transition: transform 0.9s var(--ease-out); }
.menu__links li:nth-child(1) .menu__line { transition-delay: 0.15s; }
.menu__links li:nth-child(2) .menu__line { transition-delay: 0.21s; }
.menu__links li:nth-child(3) .menu__line { transition-delay: 0.27s; }
.menu__links li:nth-child(4) .menu__line { transition-delay: 0.33s; }
.menu__links li:nth-child(5) .menu__line { transition-delay: 0.39s; }

/* Reduced motion: no pinned hero, swipeable gallery, everything simply visible */
@media (prefers-reduced-motion: reduce) {
  .hero { height: 100svh; }
  .gallery { height: auto !important; padding-block: 120px; }
  .gallery__pin { position: static; height: auto; display: block; overflow: visible; }
  .gallery__head { position: static; margin-bottom: 28px; }
  .gallery__track { width: auto; overflow-x: auto; scroll-snap-type: x mandatory; transform: none !important; }
  .g-item { scroll-snap-align: center; }
  .g-item--low, .g-item--high { margin-top: 0; }
  .gallery__progress { display: none; }
  .rhythm__track { overflow-x: auto; }
  .daycycle { display: none; }
  .footer__giant { height: auto; }
}

/* Secondary text on Sand blocks: Stone is only 4.2:1 there, so use a deeper tone (5.9:1) */
.section--alt { --text-muted: #554E44; }
