/* ═══════════════════════════════════════════════════════════════════════════
   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 rises from the bottom edge
     4000   contact items fade in (all together)
   ═══════════════════════════════════════════════════════════════════════════ */

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

/* 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: 200px;
  height: 200px;
  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 {
  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(22px); }
}

/* ── 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 {
  appearance: none;
  cursor: none;
  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);
}
/* Label matches the selector-page submit buttons: Montserrat 300, 0.22em, caps */
.pl-enter-btn__label {
  font-family: 'Montserrat', sans-serif;
  font-size: 11px;
  font-weight: 300;
  letter-spacing: 0.22em;
  text-transform: uppercase;
}
.pl-enter-btn__arrow {
  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: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); }
}

.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: 0;
  animation: plFadeIn 600ms var(--ease-out) both;
  transition: color 280ms var(--ease-out);
}
@keyframes plFadeIn { from { opacity: 0; } to { opacity: 1; } }
#pl-contact-1,
#pl-contact-2,
#pl-contact-3 { animation-delay: 4000ms; }

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; }

/* Combined root entry: the homepage lives in the same document, but waits
   behind the preloader until BEGIN CONSULTATION is pressed. */
.cr-entry .hp-entry {
  position: fixed;
  inset: 0;
  z-index: 2;
  opacity: 0;
  pointer-events: none;
  background: var(--ink);
  transition: opacity 520ms var(--ease-soft);
}

.cr-entry:not(.is-homepage-active) .hp-entry * {
  animation-play-state: paused !important;
}

.cr-entry.is-homepage-active {
  background: var(--ink);
  color: var(--warm-white);
}

.cr-entry.is-homepage-active .hp-entry {
  opacity: 1;
  pointer-events: auto;
}

.cr-entry.is-homepage-active .pl-art,
.cr-entry.is-homepage-active .pl-logo,
.cr-entry.is-homepage-active .pl-stage,
.cr-entry.is-homepage-active .pl-contact {
  opacity: 0 !important;
  pointer-events: none !important;
}

.cr-entry.is-homepage-active .cursor-ring {
  border-color: rgba(245, 240, 232, 0.72);
}

.cr-entry.is-homepage-active .cursor-glow {
  background: radial-gradient(circle,
    rgba(245, 240, 232, 0.16) 0%,
    rgba(88, 35, 35, 0.10) 36%,
    transparent 68%);
}

/* ── Responsive ────────────────────────────────────────────────────────────── */
@media (max-width: 720px) {
  .pl-logo img { height: 66px; }
  .pl-tagline { font-size: clamp(26px, 7vw, 38px); }
  .pl-contact { gap: 18px; padding: 20px 32px; }
  .pl-contact__item { font-size: 10px; letter-spacing: 0.08em; }
}

@media (max-width: 460px) {
  .pl-contact { flex-direction: column; gap: 12px; padding: 18px 30px; }
  .pl-contact__divider { 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(22px);
  }
  .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-blueprint path, .pl-blueprint circle { transition: none; }
}
