/* Danica Homes — styles.css
   :root tokens + custom CSS for patterns Tailwind can't express cleanly
   (apt-strip :has() hover-expand, rotated apartment labels). */

:root {
  --color-paper: #FFFFFF;
  --color-ink: #000000;
  --color-grey: #B3B3B3;  /* non-text only; do not use for body copy */
  --color-red: #973737;
  --color-white-20: rgba(255, 255, 255, 0.2);
  --color-white-60: rgba(255, 255, 255, 0.6);
  --font-primary: 'Montserrat', system-ui, sans-serif;
  --ease-out-quart: cubic-bezier(0.25, 1, 0.5, 1);
  --ease-out-quint: cubic-bezier(0.22, 1, 0.36, 1);
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-primary);
}

/* Form placeholder readability — browser defaults (~rgba(0,0,0,0.54)) fail WCAG AA 4.5:1.
   #595959 on #FFFFFF = 4.54:1. Firefox defaults opacity to 0.54 so we pin to 1. */
input::placeholder,
textarea::placeholder {
  color: #595959;
  opacity: 1;
}

/* Header KONTAKT trigger — icon rotates 45° (+ becomes ×) on hover or when popover open */
#kontakt-trigger:hover .kontakt-icon,
#kontakt-trigger[aria-expanded="true"] .kontakt-icon {
  transform: rotate(45deg);
}

/* Popover entrance — soft scale + fade so the open feels intentional, not jarring */
#kontakt-popover:not([hidden]) {
  animation: kontakt-pop 220ms var(--ease-out-quart);
  transform-origin: top right;
}
@keyframes kontakt-pop {
  from { opacity: 0; transform: scale(0.94) translateY(-6px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}
@media (prefers-reduced-motion: reduce) {
  #kontakt-popover:not([hidden]) { animation: none; }
}

/* Apartment strips — base appearance (mobile & tablet 2×2 grid) */
.apt-strip {
  position: relative;
  overflow: hidden;
  aspect-ratio: 192 / 605;
  display: block;
}

.apt-strip-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 900ms var(--ease-out-quart);
  will-change: transform;
}

.apt-strip:hover .apt-strip-img {
  transform: scale(1.06);
}

.apt-strip-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.4), transparent 60%);
  pointer-events: none;
  transition: background 500ms var(--ease-out-quart);
}

.apt-strip:hover .apt-strip-overlay {
  background: linear-gradient(to top, rgba(0, 0, 0, 0.55), rgba(0, 0, 0, 0.05) 70%);
}

.apt-label {
  position: absolute;
  bottom: 48px;
  left: 24px;
  transform: rotate(-90deg);
  transform-origin: bottom left;
  font-family: var(--font-primary);
  font-weight: 700;
  font-size: 23.38px;
  line-height: 29.223px;
  color: #ffffff;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
  white-space: nowrap;
  pointer-events: none;
  z-index: 2;
  letter-spacing: 0.02em;
}

/* Desktop-only hover-expand (user-confirmed locked interaction).
   Rest:  4 equal strips with 8px gaps.
   Hover: gaps collapse to 0, hovered strip flex-grows ~1.4×,
          non-hovered strips dim slightly. */
@media (hover: hover) and (min-width: 1536px) {
  .apt-strips {
    display: flex;
    flex-wrap: nowrap;
    height: 605px;
    gap: 8px;
    transition: gap 600ms var(--ease-out-quint);
  }

  .apt-strips .apt-strip {
    flex-grow: 1;
    flex-shrink: 1;
    flex-basis: 0;
    aspect-ratio: auto;
    height: 100%;
    opacity: 1;
    transition: flex-grow 600ms var(--ease-out-quint), opacity 500ms var(--ease-out-quart);
    will-change: flex-grow;
  }

  .apt-strips:has(.apt-strip:hover) {
    gap: 0;
  }

  .apt-strips:has(.apt-strip:hover) .apt-strip:not(:hover) {
    flex-grow: 0.78;
    opacity: 0.78;
  }

  .apt-strips .apt-strip:hover {
    flex-grow: 1.85;
  }
}

/* About-section vertical photo gallery — 3 thumbnails on top, 1 large active slide at bottom.
   Uses native flex column where :last-child gets the big slot. JS rotates DOM order on click. */
.gallery-stack {
  display: flex;
  flex-direction: column;
  gap: 0;
  height: 420px;                /* mobile default */
  list-style: none;
  margin: 0;
  padding: 0;
  width: 100%;
  overflow: hidden;
}

.gallery-slide {
  height: 50px;                 /* thumbnail height — mobile */
  min-height: 0;
  flex-shrink: 0;
  flex-grow: 0;
  overflow: hidden;
  position: relative;
}

.gallery-stack > .gallery-slide:last-child {
  height: auto;
  flex: 1 1 0;                  /* fills remaining space → large active slot */
}

/* Image is sized to the big-slot height and vertically centered. Thumbnails simply
   clip a horizontal band through the middle. This avoids object-fit:cover recomputing
   the crop as the slide aspect ratio changes — which was the "refresh" snap effect. */
.gallery-slide img {
  position: absolute;
  left: 0;
  top: 50%;
  width: 100%;
  height: 270px;                /* mobile big-slot height (= 420 - 3*50) */
  object-fit: cover;
  display: block;
  transform: translateY(-50%);
}

/* Pagination dots — vertical column anchored to right edge of the gallery */
.gallery-pagination {
  position: absolute;
  right: -1.25rem;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.gallery-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--color-grey);
  transition: background-color 200ms ease-out, transform 200ms ease-out;
}

.gallery-dot.is-active {
  background: var(--color-ink);
  transform: scale(1.25);
}

/* Tablet */
@media (min-width: 744px) {
  .gallery-stack { height: 560px; }
  .gallery-slide { height: 65px; }
  .gallery-slide img { height: 365px; }  /* = 560 - 3*65 */
}

/* Desktop */
@media (min-width: 1536px) {
  .gallery-stack { height: 664px; }
  .gallery-slide { height: 80px; }
  .gallery-slide img { height: 424px; }  /* = 664 - 3*80 */
  .gallery-pagination { right: -1.5rem; }
}

/* Reduced motion (gallery local) */
@media (prefers-reduced-motion: reduce) {
  .gallery-slide,
  .gallery-dot {
    transition: none !important;
  }
}

/* ────────────────────────────────────────────────────────────
   Animation layer — IntersectionObserver-driven reveals + ambient motion
   ──────────────────────────────────────────────────────────── */

/* Reveal-on-scroll: single element fade-up */
.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 800ms var(--ease-out-quart), transform 800ms var(--ease-out-quart);
  will-change: opacity, transform;
}
.reveal.is-revealed {
  opacity: 1;
  transform: none;
}

/* Reveal-on-scroll: staggered children (amenity cards, apt strips) */
.reveal-stagger > * {
  opacity: 0;
  transform: translateY(32px);
  transition: opacity 700ms var(--ease-out-quart), transform 700ms var(--ease-out-quart);
}
.reveal-stagger.is-revealed > *:nth-child(1) { transition-delay: 0ms;   }
.reveal-stagger.is-revealed > *:nth-child(2) { transition-delay: 120ms; }
.reveal-stagger.is-revealed > *:nth-child(3) { transition-delay: 240ms; }
.reveal-stagger.is-revealed > *:nth-child(4) { transition-delay: 360ms; }
.reveal-stagger.is-revealed > *:nth-child(5) { transition-delay: 480ms; }
.reveal-stagger.is-revealed > * { opacity: 1; transform: none; }

/* Reveal-on-scroll: slide in from right (about-section carousel) */
.reveal-from-right {
  opacity: 0;
  transform: translateX(60px);
  transition: opacity 900ms var(--ease-out-quart), transform 900ms var(--ease-out-quart);
  will-change: opacity, transform;
}
.reveal-from-right.is-revealed { opacity: 1; transform: none; }

/* Reveal-on-scroll: strong slide-up from below (footer card) */
.reveal-up-strong {
  opacity: 0;
  transform: translateY(60px);
  transition: opacity 900ms var(--ease-out-quart), transform 900ms var(--ease-out-quart);
  will-change: opacity, transform;
}
.reveal-up-strong.is-revealed { opacity: 1; transform: none; }

/* Section divider: a 1px line that draws left → right on intersect.
   Replaces the inline `border-b border-ink` Tailwind class (which can't animate width). */
.section-divider {
  position: relative;
}
.section-divider::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 1px;
  background: var(--color-ink);
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform 1200ms var(--ease-out-quart);
}
.section-divider.is-revealed::after {
  transform: scaleX(1);
}

/* Star/flower decoration: slow ambient rotation. Class wraps the existing <svg><use/></svg>. */
@keyframes star-spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}
.star-anim {
  animation: star-spin 120s linear infinite;
  transform-origin: center center;
  will-change: transform;
}

/* Hero photo Ken-Burns: ambient slow zoom in-out */
@keyframes ken-burns {
  0%   { transform: scale(1.0); }
  100% { transform: scale(1.06); }
}
.hero-photo {
  animation: ken-burns 24s var(--ease-out-quart) infinite alternate;
  transform-origin: center center;
  will-change: transform;
}

/* Hero text on page load: fade-up that fires once, no observer needed */
@keyframes hero-in {
  from { opacity: 0; transform: translateY(24px); }
  to   { opacity: 1; transform: none; }
}
.hero-fade-up {
  opacity: 0;
  animation: hero-in 800ms var(--ease-out-quart) forwards;
  animation-delay: 200ms;
  will-change: opacity, transform;
}
.hero-fade-up--delayed {
  animation-delay: 500ms;
}

/* Reduced motion — kill all entrance + ambient motion, keep static end state */
@media (prefers-reduced-motion: reduce) {
  .reveal,
  .reveal-stagger > *,
  .reveal-from-right,
  .reveal-up-strong,
  .hero-fade-up {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
    animation: none !important;
  }
  .section-divider::after {
    transform: scaleX(1) !important;
    transition: none !important;
  }
  .star-anim,
  .hero-photo {
    animation: none !important;
  }
}
