/* ═══════════════════════════════════════════════════════════════════════════
   PRELOADER / LANDING — Crimson Rose Homes
   The cinematic gate that precedes the homepage. Inherits tokens, reset, the
   custom cursor, and fadeUp from style.css. Everything here is screen-specific.

   Entrance choreography (master clock, ms from load):
     200    logo fades in, centred
     ~1640  logo begins rising to the top · blueprint strokes begin tracing (JS)
            — the outlines lay down as the logo lifts
     2600   logo settles · tagline line 1 fades up
     2800   tagline line 2 fades up
     3500   BEGIN CONSULTATION button fades up
     3600   contact panel and contact items rise in together
   ═══════════════════════════════════════════════════════════════════════════ */

.pl-body {
  margin: 0;
  min-height: 100vh;
  background: #EBEBEB;
  color: #2A2624;          /* warm charcoal default for the light theme */
  overflow: hidden;
  cursor: auto;
  position: relative;
}

html.custom-cursor-enabled .pl-body {
  cursor: none;
}

/* Light-theme custom cursor — the global warm-white ring/glow is invisible on
   a pale background, so darken the ring and give the glow a soft crimson tint
   so the cursor stays easy to track on #EBEBEB. */
.pl-body .cursor-ring { border-color: rgba(38, 34, 32, 0.62); }
.pl-body .cursor-glow {
  display: block;
  width: 140px;
  height: 140px;
  background: radial-gradient(circle,
    rgba(156, 61, 61, 0.22) 0%,
    rgba(156, 61, 61, 0.11) 34%,
    transparent 68%);
}

/* ── Background architectural blueprint — full-bleed, strokes trace in ─────── */
.pl-art {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
}
.pl-blueprint {
  width: 100%;
  height: 100%;
  display: block;
  overflow: visible;
  opacity: 0;            /* revealed by JS once every stroke is primed undrawn,
                            so the full lines never flash on first paint */
}
/* NB: no vector-effect: non-scaling-stroke here — it measures the dash pattern
   in screen pixels while getTotalLength() returns user units, so a scaled-up
   SVG would leave short segments partly visible at offset = length. Letting the
   stroke scale with the SVG keeps the dash math and the trace-in exact. */

/* Light-theme line colour — subtle black-tinted hairlines on #EBEBEB. The
   circle keeps a touch more weight, mirroring the source SVG's darker stroke. */
.pl-blueprint path   { stroke: rgba(0, 0, 0, 0.30); }
.pl-blueprint circle { stroke: rgba(0, 0, 0, 0.42); }

/* ── Logo — fade in centred, then rise ─────────────────────────────────────── */
.pl-logo {
  --pl-logo-settled: 22px;   /* resting gap from the top; overridden on mobile */
  position: fixed;
  top: 0;
  left: 50%;
  z-index: 6;
  pointer-events: none;
  opacity: 0;
  transform: translateX(-50%) translateY(calc(50vh - 36px));
  animation: plLogoRise 2400ms var(--ease-soft) 200ms both;
}
.pl-logo img {
  height: 72px;
  width: auto;
  display: block;
  object-fit: contain;
}
@keyframes plLogoRise {
  0%   { opacity: 0; transform: translateX(-50%) translateY(calc(50vh - 36px)); }
  22%  { opacity: 1; transform: translateX(-50%) translateY(calc(50vh - 36px)); }
  60%  { opacity: 1; transform: translateX(-50%) translateY(calc(50vh - 36px)); }
  100% { opacity: 1; transform: translateX(-50%) translateY(var(--pl-logo-settled)); }
}

/* ── Centre stage ──────────────────────────────────────────────────────────── */
.pl-stage {
  position: relative;
  z-index: 4;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 0 32px;
}

/* ── Tagline ───────────────────────────────────────────────────────────────── */
.pl-tagline {
  margin: 0;
  font-family: 'Cormorant Garamond', serif;
  font-style: italic;
  font-weight: 600;
  font-size: clamp(30px, 4.4vw, 52px);
  line-height: 1.12;
  letter-spacing: -0.05em;
}
.pl-tagline__line {
  display: block;
  opacity: 0;
  transform: translateY(12px);
  animation: fadeUp 900ms var(--ease-soft) both;
}
.pl-tagline__line--1 {
  color: #2A2624;            /* warm charcoal */
  animation-delay: 2600ms;   /* enters with the blueprint trace */
}
.pl-tagline__line--2 {
  color: #6C6C6C;            /* muted grey second line */
  animation-delay: 2800ms;
}

/* ── CTA button ────────────────────────────────────────────────────────────── */
.pl-cta {
  margin-top: 40px;
  opacity: 0;
  transform: translateY(14px);
  animation: fadeUp 800ms var(--ease-soft) 3500ms both;
}
.pl-enter-btn {
  --pl-video-progress: 0;
  appearance: none;
  cursor: pointer;
  position: relative;
  isolation: isolate;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 11px;
  padding: 16px 38px;
  border-radius: 100px;
  border: none;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.10), rgba(255, 255, 255, 0) 46%),
    var(--crimson);
  color: var(--warm-white);
  box-shadow:
    0 6px 18px rgba(88, 35, 35, 0.30),
    inset 0 0 0 1px rgba(255, 255, 255, 0.12);
  transition:
    background 320ms var(--ease-out),
    transform  260ms var(--ease-out),
    box-shadow 320ms var(--ease-out);
}

html.custom-cursor-enabled .pl-enter-btn {
  cursor: none;
}
.pl-enter-btn::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  background: var(--crimson);
  opacity: 0;
  transform: scaleX(var(--pl-video-progress));
  transform-origin: left center;
  transition:
    opacity 260ms var(--ease-out),
    transform 260ms var(--ease-out);
}
.pl-enter-btn[data-loading="true"] {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0) 46%),
    rgba(88, 35, 35, 0.28);
  color: rgba(245, 240, 232, 0.88);
  box-shadow:
    0 5px 14px rgba(88, 35, 35, 0.18),
    inset 0 0 0 1px rgba(88, 35, 35, 0.20);
}
.pl-enter-btn[data-loading="true"]::before { opacity: 1; }
.pl-enter-btn:disabled {
  cursor: wait;
  transform: none;
}
.pl-enter-btn:disabled .pl-enter-btn__arrow {
  opacity: 0;
  transform: none;
}

@media (hover: none), (pointer: coarse), (prefers-reduced-motion: reduce) {
  .pl-body {
    cursor: auto !important;
  }

  .pl-enter-btn {
    cursor: pointer !important;
  }
}
/* Label matches the selector-page submit buttons: Montserrat 300, 0.22em, caps */
.pl-enter-btn__label {
  position: relative;
  z-index: 1;
  font-family: 'Montserrat', sans-serif;
  font-size: 11px;
  font-weight: 300;
  letter-spacing: 0.22em;
  text-transform: uppercase;
}
.pl-enter-btn__arrow {
  position: relative;
  z-index: 1;
  width: 14px;
  height: 8px;
  display: block;
  transition: transform 240ms var(--ease-out);
}
.pl-enter-btn:hover .pl-enter-btn__arrow {
  transform: translateX(4px);
}
.pl-enter-btn:hover {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.13), rgba(255, 255, 255, 0) 46%),
    var(--crimson-hover);
  color: var(--warm-white);
  transform: translateY(-1px);
  box-shadow:
    0 10px 28px rgba(88, 35, 35, 0.38),
    inset 0 0 0 1px rgba(255, 255, 255, 0.16);
}
.pl-enter-btn[data-loading="true"]:hover {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0) 46%),
    rgba(88, 35, 35, 0.28);
  transform: none;
  box-shadow:
    0 5px 14px rgba(88, 35, 35, 0.18),
    inset 0 0 0 1px rgba(88, 35, 35, 0.20);
}
.pl-enter-btn[data-loading="true"]:hover .pl-enter-btn__arrow { transform: none; }
.pl-enter-btn:active {
  transform: translateY(0);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0) 46%),
    var(--crimson-active);
  box-shadow:
    0 4px 12px rgba(88, 35, 35, 0.30),
    inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}
.pl-enter-btn:focus-visible {
  outline: 1px solid rgba(0, 0, 0, 0.35);
  outline-offset: 4px;
}

/* ── Contact panel — grey rounded card anchored at the bottom edge ─────────── */
.pl-contact {
  position: fixed;
  left: 50%;
  bottom: 0;
  z-index: 4;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 30px;
  padding: 24px 60px;
  background: #CFCFCF;
  border-radius: 16px 16px 0 0;
  box-shadow:
    0 -2px 26px rgba(0, 0, 0, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.30);   /* crisp top bevel on the light bg */
  /* both: holds the from-state (below, faded) through the delay, then rises */
  transform: translateX(-50%) translateY(44px);
  opacity: 0;
  animation: plPanelRise 800ms var(--ease-soft) 3600ms both;
}
@keyframes plPanelRise {
  from { opacity: 0; transform: translateX(-50%) translateY(44px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* Items row — direct flex children of the panel on desktop; the panel centres
   this single child, so the desktop layout is unchanged. */
.pl-contact__items {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 30px;
}

/* "Contact info" toggle — hidden on desktop, shown only at ≤720px. */
.pl-contact__toggle {
  display: none;
  align-items: center;
  gap: 9px;
  min-height: 44px;
  padding: 6px 4px;
  background: none;
  border: none;
  cursor: pointer;
  font-family: 'Montserrat', sans-serif;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #34302D;
}
.pl-contact__chevron {
  transition: transform 300ms var(--ease-soft);
}
.pl-contact.is-open .pl-contact__chevron {
  transform: rotate(180deg);
}
.pl-contact__toggle:focus-visible {
  outline: 1px solid rgba(0, 0, 0, 0.42);
  outline-offset: 3px;
  border-radius: 2px;
}

.pl-contact__item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: 'Montserrat', sans-serif;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #34302D;
  text-decoration: none;
  white-space: nowrap;
  /* fade in just after the panel settles — opacity only, so the panel's own
     rise isn't compounded with a second transform */
  opacity: 1;
  transition: color 280ms var(--ease-out);
}
a.pl-contact__item:hover { color: #1E1B19; }
a.pl-contact__item:hover .pl-contact__icon { opacity: 1; }
.pl-contact__item:focus-visible {
  outline: 1px solid rgba(0, 0, 0, 0.42);
  outline-offset: 3px;
  border-radius: 2px;
}

.pl-contact__icon {
  width: 15px;
  height: 15px;
  display: block;
  flex-shrink: 0;
  opacity: 0.78;
  transition: opacity 280ms var(--ease-out);
}

.pl-contact__divider {
  width: 1px;
  height: 13px;
  background: rgba(0, 0, 0, 0.22);
}

/* ── Exit overlay ──────────────────────────────────────────────────────────── */
.pl-exit {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: var(--ink);
  opacity: 0;
  pointer-events: none;
  transition: opacity 520ms var(--ease-soft);
}
.pl-exit.is-active { opacity: 1; pointer-events: auto; }

/* ── Responsive ────────────────────────────────────────────────────────────── */
@media (max-width: 720px) {
  .pl-logo img { height: 45.9px; }
  .pl-logo { --pl-logo-settled: 15px; }     /* −7px gap from the top */
  .pl-stage { transform: translateY(-44px); }
  .pl-tagline { font-size: 33px; }          /* fixed on mobile (≈ +5px) */

  /* Contact panel becomes a "Contact info" accordion, collapsed by default. */
  .pl-contact {
    flex-direction: column;
    gap: 10px;
    padding: 7px 30px 11px;
  }
  .pl-contact__toggle { display: inline-flex; }
  .pl-contact__items { display: none; }     /* collapsed until toggled open */
  .pl-contact.is-open .pl-contact__items {
    display: flex;
    flex-direction: column;
    gap: 14px;
    animation: fadeUp 360ms var(--ease-soft) both;
  }
  .pl-contact__divider { display: none; }   /* dividers don't read in a column */
  .pl-contact__item { font-size: 10px; letter-spacing: 0.08em; }
}

/* ── Combined homepage (index.html) — preloader + homepage in one document ────
   The landing lives under .pl-body: while it's present the preloader shows and
   the homepage is hidden. Clicking BEGIN removes .pl-body, which hides the
   preloader and reveals the homepage. One class drives the entire swap.
   display:none (not visibility) so the homepage's own entrance animations stay
   primed and play fresh the moment it appears, exactly like the standalone page. */
.pl-body .hp-logo,
.pl-body .hp-chat,
.pl-body .hp-fade-overlay { display: none; }

.pl-body .hp-viewport {
  display: block;
  position: fixed;
  inset: 0;
  opacity: 0;
  pointer-events: none;
}

body:not(.pl-body) .pl-art,
body:not(.pl-body) .pl-logo,
body:not(.pl-body) .pl-stage,
body:not(.pl-body) .pl-contact { display: none; }

/* ── Reduced motion — show the final composition, no choreography ──────────── */
@media (prefers-reduced-motion: reduce) {
  .pl-logo {
    animation: none;
    opacity: 1;
    transform: translateX(-50%) translateY(var(--pl-logo-settled));
  }
  .pl-tagline__line,
  .pl-cta {
    animation: none;
    opacity: 1;
    transform: none;
  }
  .pl-contact {
    animation: none;
    opacity: 1;
    transform: translateX(-50%);
  }
  .pl-contact__item { animation: none; opacity: 1; }
  .pl-contact.is-open .pl-contact__items { animation: none; }
  .pl-blueprint path, .pl-blueprint circle { transition: none; }
}
