﻿/* ==========================================================================
   Hero: scroll-driven curtain reveal
   Adapted from ref_code/curtain_effect-1 (smoothing + sway) and
   ref_code/curtain-effect-3 (linen fabric, piping, hem), restyled to the
   logo palette: linen drapes with a forest-green lining and a gold rod.

   --p    : open progress 0 -> 1 (set by js/components/hero-curtain.js)
   --sway : small skew while scrolling for a natural swing
   ========================================================================== */

.curtain-scene {
  position: relative;
  height: 260vh;                 /* scroll distance used to open the curtain */
}
@media (min-width: 768px) {
  .curtain-scene { height: 300vh; }
}

.curtain-pin {
  --p: 0;
  --sway: 0deg;
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100svh;                /* stable height on mobile browsers */
  overflow: hidden;
  isolation: isolate;
}

/* No-JS fallback: curtain already open, no pinning */
.no-js .curtain-scene { height: auto; }
.no-js .curtain-pin { position: relative; --p: 1; }

/* ---------------- Stage (content revealed behind the curtain) ---------------- */
.curtain-stage {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: flex-end;         /* arch stands on the floor */
  justify-content: center;
  padding-top: calc(var(--nav-h) + 22px);
  background:
    radial-gradient(ellipse at 50% 38%, #fffdf8 0%, var(--c-cream) 38%, #f1e6d2 78%, #e7d6b8 100%);
}

/* Soft light that blooms as the curtain opens */
.curtain-stage::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(circle at 50% 42%, rgba(255, 236, 196, 0.75), transparent 55%);
  opacity: var(--p);
  will-change: opacity;
}

/* Arched window, echoing the arch inside the logo.
   It is the container for the hero content, so everything inside is sized
   with container units (cqw) and can never spill over the arch border. */
.curtain-stage__arch {
  position: relative;
  width: min(88vw, 560px);
  height: 100%;
  max-height: 800px;
  container-type: inline-size;
  border: 1px solid rgba(196, 154, 90, 0.55);
  border-bottom: none;
  border-radius: 999px 999px 0 0;
}
.curtain-stage__arch::before {
  content: "";
  position: absolute;
  inset: 12px 12px 0;
  border: 1px solid rgba(196, 154, 90, 0.25);
  border-bottom: none;
  border-radius: inherit;
  pointer-events: none;
}

.curtain-stage__content {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  text-align: center;
  /* top padding keeps content below the curved part of the arch */
  padding: 30cqw 9cqw 64px;
  transform: translateY(calc((1 - var(--p)) * 28px)) scale(calc(0.92 + var(--p) * 0.08));
  opacity: calc(0.15 + var(--p) * 0.85);
  will-change: transform, opacity;
}

.hero-logo {
  width: clamp(96px, min(40cqw, 24vh), 220px);
  height: auto;
  filter: drop-shadow(0 20px 26px rgba(31, 58, 48, 0.25));
}

/* Letter-spaced text gets matching left padding so it is optically centred */
.hero-wordmark {
  margin-top: clamp(0.9rem, 4cqw, 1.5rem);
  padding-left: 0.18em;
  font-family: Cinzel, serif;
  font-weight: 600;
  font-size: clamp(1.05rem, 6cqw, 2.1rem);
  line-height: 1.2;
  letter-spacing: 0.18em;
  white-space: nowrap;
  color: var(--c-green);
}
.hero-wordmark span { color: var(--c-gold-dark); }

.hero-subline {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  width: min(100%, 260px);
  margin-top: 0.4rem;
  font-size: clamp(0.62rem, 2.4cqw, 0.75rem);
  font-weight: 700;
  letter-spacing: 0.5em;
  text-transform: uppercase;
  color: var(--c-ink);
}
.hero-subline span { padding-left: 0.5em; }
.hero-subline::before,
.hero-subline::after {
  content: "";
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--c-gold));
}
.hero-subline::after { background: linear-gradient(90deg, var(--c-gold), transparent); }

.hero-tagline {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.35rem 0.6rem;
  margin-top: clamp(0.9rem, 4cqw, 1.4rem);
  font-size: clamp(0.6rem, 2.3cqw, 0.7rem);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: rgba(23, 32, 28, 0.75);
}
.hero-tagline svg { width: 14px; height: 14px; color: var(--c-sage); }

/* Compact buttons: stacked + equal width in a narrow arch, side by side when wide */
.hero-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.6rem;
  width: 100%;
  margin-top: clamp(1.25rem, 6cqw, 2rem);
}
.hero-actions .btn {
  width: min(100%, 236px);
  min-height: 44px;
  padding: 0 1.25rem;
  font-size: 0.66rem;
  letter-spacing: 0.2em;
}
.hero-actions .btn svg { width: 14px; height: 14px; }
@container (min-width: 480px) {
  .hero-actions { flex-direction: row; justify-content: center; }
  .hero-actions .btn { width: auto; }
}

/* ---------------- Curtain panels ---------------- */
.curtain-panel {
  position: absolute;
  top: calc(var(--nav-h) + 6px);
  bottom: 0;
  width: 50.5%;                  /* tiny overlap so there is no centre gap */
  z-index: 3;
  will-change: transform;
  backface-visibility: hidden;
  /* Same look as the old drop-shadow filter on a plain rectangle, but painted once
     instead of being re-filtered on the GPU every frame while the curtain moves. */
  box-shadow: 0 18px 24px rgba(60, 40, 15, 0.35);
}
.curtain-panel--left {
  left: 0;
  transform-origin: 0 0;
  transform: scaleX(calc(1 - var(--p) * 0.84)) skewX(var(--sway));
}
.curtain-panel--right {
  right: 0;
  transform-origin: 100% 0;
  transform: scaleX(calc(1 - var(--p) * 0.84)) skewX(calc(var(--sway) * -1));
}

/* Linen fabric with soft ripple folds */
.curtain-fabric {
  position: absolute;
  inset: 0;
  background:
    /* shadow under the rod */
    linear-gradient(to bottom, rgba(90, 60, 20, 0.35), transparent 14%),
    /* ripple folds */
    linear-gradient(90deg,
      rgba(120, 85, 35, 0.42) 0%,
      rgba(255, 255, 255, 0.34) 36%,
      rgba(255, 255, 255, 0.08) 58%,
      rgba(120, 85, 35, 0.42) 100%) 0 0 / 64px 100% repeat-x,
    /* secondary, offset folds for an organic look */
    linear-gradient(90deg,
      rgba(0, 0, 0, 0.06) 0%, rgba(255, 255, 255, 0.1) 50%, rgba(0, 0, 0, 0.06) 100%) 23px 0 / 41px 100% repeat-x,
    /* fine linen weave */
    repeating-linear-gradient(0deg, rgba(0, 0, 0, 0.025) 0 1px, transparent 1px 3px),
    var(--c-linen);
}
@media (min-width: 768px) {
  .curtain-fabric { background-size: auto, 88px 100%, 53px 100%, auto, auto; }
}

/* Linen grain */
.curtain-fabric::before {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.45;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='180' height='180'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2'/><feColorMatrix values='0 0 0 0 .55  0 0 0 0 .42  0 0 0 0 .22  0 0 0 .3 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}

/* Weighted hem */
.curtain-fabric::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 44px;
  border-top: 1px solid rgba(154, 112, 56, 0.6);
  background: linear-gradient(rgba(154, 112, 56, 0.18), rgba(154, 112, 56, 0.3));
}

/* Folds deepen as the fabric gathers */
.curtain-shade {
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(70, 45, 10, 0.45), rgba(70, 45, 10, 0.12) 50%, rgba(70, 45, 10, 0.45));
  opacity: calc(var(--p) * 0.9);
  /* own layer: changing its opacity must not repaint the whole fabric underneath */
  will-change: opacity;
}

/* Forest-green lining with gold piping on the leading edge (from the logo) */
.curtain-lining {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 16px;
  background: linear-gradient(90deg, var(--c-green-deep), var(--c-sage) 55%, var(--c-green));
}
.curtain-lining::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  width: 3px;
  background: linear-gradient(90deg, var(--c-gold-dark), var(--c-gold-light), var(--c-gold-dark));
}
.curtain-panel--left .curtain-lining { right: 0; }
.curtain-panel--left .curtain-lining::after { right: 0; }
.curtain-panel--right .curtain-lining { left: 0; transform: scaleX(-1); }
.curtain-panel--right .curtain-lining::after { right: 0; }

/* ---------------- Gold rod ---------------- */
.curtain-rod {
  position: absolute;
  top: var(--nav-h);
  left: 10px;
  right: 10px;
  height: 10px;
  z-index: 4;
  border-radius: 999px;
  background: linear-gradient(#f6e4b8, var(--c-gold) 45%, var(--c-gold-dark));
  box-shadow: 0 4px 10px rgba(60, 40, 15, 0.35);
}
.curtain-rod::before,
.curtain-rod::after {
  /* finials */
  content: "";
  position: absolute;
  top: 50%;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  transform: translateY(-50%);
  background: radial-gradient(circle at 35% 30%, #fff3d1, var(--c-gold) 45%, var(--c-gold-dark));
  box-shadow: 0 3px 8px rgba(60, 40, 15, 0.4);
}
.curtain-rod::before { left: -6px; }
.curtain-rod::after { right: -6px; }

/* ---------------- Logo medallion on the closed seam ---------------- */
.curtain-medallion {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 5;
  width: clamp(88px, 22vw, 128px);
  aspect-ratio: 1;
  border-radius: 50%;
  transform: translate(-50%, -50%) scale(calc(1 - var(--p) * 0.6));
  opacity: calc(1 - var(--p) * 4);
  box-shadow: 0 18px 40px -10px rgba(60, 40, 15, 0.55);
  pointer-events: none;
  will-change: transform, opacity;
}
.curtain-medallion img { width: 100%; height: 100%; object-fit: contain; }

/* ---------------- Scroll hint ---------------- */
.curtain-hint {
  position: absolute;
  /* Raised off the bottom edge so it sits in view on every screen, below the medallion */
  bottom: clamp(56px, 13vh, 150px);
  bottom: clamp(56px, 13svh, 150px);
  left: 50%;
  z-index: 6;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  padding: 0.7rem 1.4rem 0.55rem;
  transform: translateX(-50%);
  white-space: nowrap;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--c-green);
  /* Cream pill so the seam and folds never run through the text */
  background: rgba(251, 247, 239, 0.92);
  border: 1px solid rgba(196, 154, 90, 0.55);
  border-radius: 999px;
  box-shadow: 0 12px 28px -14px rgba(60, 40, 15, 0.55);
  cursor: pointer;
  opacity: calc(1 - var(--p) * 6);
  pointer-events: auto;
  will-change: opacity;
}
.curtain-hint[hidden] { display: none; }
.curtain-hint svg {
  width: 18px;
  height: 18px;
  color: var(--c-gold-dark);
  animation: curtain-bob 1.8s ease-in-out infinite;
}
@keyframes curtain-bob { 50% { transform: translateY(5px); } }

.curtain-scene.is-open .curtain-hint,
.curtain-scene.is-open .curtain-medallion { visibility: hidden; }
