/* ==========================================================================
   Carpe Diem Beauty – landing page
   Vanilla CSS, no dependencies.
   ========================================================================== */

/* --------------------------------------------------------------------------
   Font
   -------------------------------------------------------------------------- */
@font-face {
  font-family: "Helvetica Neue LT Pro";
  src: url("../fonts/HelveticaNeueLTPro-Roman.woff2") format("woff2"),
       url("../fonts/HelveticaNeueLTPro-Roman.woff") format("woff");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

/* --------------------------------------------------------------------------
   Design tokens
   -------------------------------------------------------------------------- */
:root {
  --color-rust: #994316;
  --color-cream: #e3d6c4;
  --color-white: #ffffff;

  --font-sans: "Helvetica Neue LT Pro", "Helvetica Neue", Helvetica, Arial, sans-serif;

  /* Fluid type: ~13px on phones → 16px on the 1512px design */
  --text-sm: clamp(0.8125rem, 0.72rem + 0.35vw, 1rem);
  --text-cta: clamp(0.75rem, 0.68rem + 0.3vw, 0.875rem);
  --tracking: 0.04em;

  /* Vertical rhythm, derived from the design (982px tall) */
  --space-top: clamp(2.25rem, 7vh, 4.25rem);
  --space-eyebrow-logo: clamp(2rem, 8vh, 5rem);
  --space-logo-hero: clamp(1.5rem, 4.7vh, 3rem);
  --space-hero-footer: clamp(1.5rem, 5vh, 3.25rem);
  --space-bottom: clamp(2rem, 6vh, 4rem);
  --space-side: clamp(1rem, 4vw, 3rem);

  /* Hero geometry.
     The hero box IS the collage: 940×422 on the design (and in the poster,
     whose 950×430 canvas has a 5px rust margin around a 940×423 collage).
     Bounded by viewport width/height so the single-screen layout holds. */
  --hero-collage-w: 940;
  --hero-collage-h: 422;
  --hero-ratio: calc(var(--hero-collage-w) / var(--hero-collage-h));
  --hero-max-width: calc(var(--hero-collage-w) * 1px);
  --hero-width: max(18rem, min(var(--hero-max-width), 100vw - 2 * var(--space-side), (100vh - 24rem) * var(--hero-ratio)));

  /* Poster: 950×430 file, collage 940 wide inside it → render at 950/940 of
     the box so the collage fills the box edge-to-edge. */
  --poster-scale: calc(950 / 940);

  /* Video: 848×480 frame with the collage centred and 480px wide. Scale the
     frame so that collage width == box width (the rust around it is baked in
     and matches the page, so overflow is invisible). Update these two numbers
     if the video is re-exported with different dimensions. */
  --video-frame-w: 848;
  --video-collage-w: 480;
  --video-scale: calc(var(--video-frame-w) / var(--video-collage-w));

  /* Motion */
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --reveal-duration: 900ms;
  --reveal-stagger: 140ms;
}

/* --------------------------------------------------------------------------
   Base
   -------------------------------------------------------------------------- */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: var(--space-top) var(--space-side) var(--space-bottom);
  padding-left: max(var(--space-side), env(safe-area-inset-left));
  padding-right: max(var(--space-side), env(safe-area-inset-right));
  background-color: var(--color-rust);
  color: var(--color-cream);
  font-family: var(--font-sans);
  font-weight: 400;
  font-size: var(--text-sm);
  line-height: 1.4;
  letter-spacing: var(--tracking);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-synthesis: none;
  overflow-x: hidden;
}

a {
  color: inherit;
  text-decoration: none;
  transition: opacity 240ms ease;
}

a:hover {
  opacity: 0.72;
}

a:focus-visible,
.cta:focus-visible {
  outline: 2px solid var(--color-cream);
  outline-offset: 4px;
  border-radius: 2px;
}

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* --------------------------------------------------------------------------
   Header: eyebrow + logo
   -------------------------------------------------------------------------- */
.site-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.eyebrow {
  text-transform: uppercase;
  white-space: nowrap;
}

.logo {
  margin-top: var(--space-eyebrow-logo);
  line-height: 0;
  color: var(--color-cream);
}

.logo__svg {
  display: block;
  width: clamp(12.5rem, 22.75vw, 21.5rem); /* 344px on the design */
  height: auto;
}

/* --------------------------------------------------------------------------
   Hero: cropped video + CTA
   -------------------------------------------------------------------------- */
.hero {
  position: relative;
  width: var(--hero-width);
  margin-top: var(--space-logo-hero);
  display: grid;
  place-items: center;
}

.hero__media {
  position: relative;
  grid-area: 1 / 1;
  width: 100%;
  aspect-ratio: var(--hero-ratio);
  overflow: hidden;
  background-color: var(--color-rust);
}

/* Poster and video are both centred in the box and sized so that their
   collage spans exactly the box width. The poster is a real <img> so it can
   paint immediately and stay underneath while the video fades in. */
.hero__poster,
.hero__video {
  position: absolute;
  top: 50%;
  left: 50%;
  height: auto;
  transform: translate(-50%, -50%);
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
}

.hero__poster {
  width: calc(100% * var(--poster-scale));
}

.hero__video {
  width: calc(100% * var(--video-scale));
  background-color: transparent;
  opacity: 0;
  transition: opacity 600ms ease;
}

.hero__video.is-playing {
  opacity: 1;
}

.cta {
  grid-area: 1 / 1;
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.9em 2.3em;
  min-height: 2.75rem;
  border-radius: 999px;
  background-color: var(--color-white);
  color: var(--color-rust);
  font-size: var(--text-cta);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
  box-shadow: 0 10px 30px rgba(50, 20, 5, 0.18);
  transition: transform 320ms var(--ease-out), box-shadow 320ms var(--ease-out), background-color 240ms ease;
  will-change: transform;
}

.cta:hover {
  opacity: 1;
  background-color: var(--color-cream);
  transform: translateY(-2px) scale(1.03);
  box-shadow: 0 14px 36px rgba(50, 20, 5, 0.26);
}

.cta:active {
  transform: translateY(0) scale(0.99);
  transition-duration: 120ms;
}

/* --------------------------------------------------------------------------
   Footer: three columns aligned to the hero width
   -------------------------------------------------------------------------- */
.site-footer {
  width: var(--hero-width); /* outer columns align with the collage edges */
  margin-top: var(--space-hero-footer);
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 1.5rem;
  text-transform: uppercase;
  white-space: nowrap;
}

.footer__col {
  display: flex;
  align-items: center;
  gap: 0.75em;
  font-style: normal;
}

/* The address keeps its own casing ("8a" must stay lowercase) */
.footer__col--right {
  text-transform: none;
}

.footer__col--left   { justify-self: start; }
.footer__col--center { justify-self: center; }
.footer__col--right  { justify-self: end; }

.sep {
  display: inline-block;
  opacity: 0.9;
  transform: scaleX(0.6); /* thinner bar, like the "I" separator in the design */
}

/* --------------------------------------------------------------------------
   Appear animations (pure CSS, staggered via --i)
   -------------------------------------------------------------------------- */
@keyframes reveal-up {
  from {
    opacity: 0;
    transform: translate3d(0, 18px, 0);
  }
  to {
    opacity: 1;
    transform: translate3d(0, 0, 0);
  }
}

@keyframes reveal-logo {
  from {
    opacity: 0;
    transform: translate3d(0, 14px, 0) scale(0.97);
    filter: blur(6px);
  }
  to {
    opacity: 1;
    transform: translate3d(0, 0, 0) scale(1);
    filter: blur(0);
  }
}

@keyframes star-spin {
  from { transform: rotate(-120deg) scale(0.6); opacity: 0; }
  to   { transform: rotate(0deg) scale(1); opacity: 1; }
}

.reveal {
  opacity: 0; /* hidden until the animation starts; fill-mode keeps the end state */
  animation: reveal-up var(--reveal-duration) var(--ease-out) both;
  animation-delay: calc(var(--i, 0) * var(--reveal-stagger) + 80ms);
}

.reveal--logo {
  animation-name: reveal-logo;
  animation-duration: 1100ms;
}

.logo__star {
  transform-box: fill-box;
  transform-origin: center;
  animation: star-spin 1200ms var(--ease-out) both;
  animation-delay: calc(1 * var(--reveal-stagger) + 420ms);
}

/* Hover spin lives on a wrapper so it never fights the load animation.
   main.js bumps --star-angle by ±120° (the 12-ray star is symmetric every
   30°, so it always settles looking identical) in the pointer's direction. */
.logo__star-wrap {
  transform-box: fill-box;
  transform-origin: center;
  transform: rotate(var(--star-angle, 0deg));
  transition: transform 1000ms var(--ease-out);
}

/* Reduced motion: show everything immediately, no transforms */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }

  .reveal,
  .reveal--logo,
  .logo__star {
    animation: none;
    opacity: 1;
    transform: none;
    filter: none;
  }

  .logo__star-wrap {
    transition: none;
  }

  .cta,
  .cta:hover,
  .cta:active {
    transform: none;
    transition: none;
  }
}

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */

/* Tablets and below: hero fills the width, footer stacks */
@media (max-width: 47.9375em) {
  :root {
    --hero-width: 100%;
    --space-eyebrow-logo: clamp(1.75rem, 6vh, 3.5rem);
  }

  /* No desktop-style empty bottom band on phones: balance the block vertically */
  body {
    justify-content: center;
  }

  .hero {
    width: 100%;
    margin-top: clamp(1.5rem, 4vh, 2.5rem);
  }

  .site-footer {
    width: 100%;
    grid-template-columns: 1fr;
    justify-items: center;
    gap: 1rem;
    text-align: center;
    margin-top: clamp(1.75rem, 5vh, 2.5rem);
  }

  .footer__col--left,
  .footer__col--center,
  .footer__col--right {
    justify-self: center;
  }

  /* Stacked order: tagline, social links, address */
  .footer__col--center { order: 1; }
  .footer__col--left   { order: 2; }
  .footer__col--right  { order: 3; }
}

/* Small phones: tighter rhythm */
@media (max-width: 30em) {
  :root {
    --space-top: clamp(1.75rem, 5vh, 2.5rem);
    --space-bottom: 2rem;
    --space-side: 1rem;
  }

  .site-footer {
    white-space: normal;
  }
}

/* Very short landscape viewports (e.g. phones rotated): let it scroll gracefully */
@media (max-height: 30em) and (orientation: landscape) {
  :root {
    --hero-width: min(60vw, 40rem);
    --space-eyebrow-logo: 1.25rem;
  }
}
