/* =====================================================================
   37 Customs: the Corvette C8 hero (preview)
   One real photograph (real-media\media\RAW05361.JPG, 7008x4672), shown
   exactly as photographed: no retouching, grading or overlays on it. The
   web copies are only resized. The camera movement is a scroll-tied
   dolly-in (a scale about the car's centre); the headline stays put and
   the photograph moves behind it.
   corvette-hero.js sets --push and --out from scroll, and starts the
   one-time entrance of the lettering (.cv-type-in) once the font is ready.
   ===================================================================== */

@font-face {
  /* Chomsky by Fredrick R. Brennan, SIL Open Font License 1.1 (licence
     beside the font file). Self-hosted; nothing loads from the internet. */
  font-family: "Chomsky";
  src: url("../fonts/chomsky/Chomsky.otf") format("opentype");
  font-weight: 400;
  font-style: normal;
  font-display: block;
}

.cv {
  position: relative;
  height: 175vh;                 /* 75vh of movement, then the next section */
  background: #070708;
  --push: 1;
  --out: 0;
}
.cv__stage {
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100svh;
  min-height: 30rem;
  overflow: hidden;
  isolation: isolate;
  background: #070708;
}

/* Phones only: the blurred, mirrored extension of the same photograph. */
.cv__bg { display: none; }

/* The photograph, filling the viewport; the push scales it about the car's centre. */
.cv__frame {
  position: absolute;
  inset: 0;
  transform: scale(var(--push));
  transform-origin: 50% 50%;
  will-change: transform;
}
.cv__photo {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 50%;
}

/* The hand-off: the whole stage darkens softly at the end of the scroll. */
.cv__out {
  position: absolute;
  inset: 0;
  z-index: 3;
  background: #070708;
  opacity: var(--out);
  pointer-events: none;
}

/* ---- Copy: the stacked headline and line centred, buttons at the foot ---- */
.cv__copy {
  position: absolute;
  inset: var(--header-h) 0 0;
  z-index: 2;
  display: grid;
  grid-template-rows: 1fr auto;
  justify-items: center;
  padding: clamp(.5rem, 2vh, 1.5rem) var(--gutter) clamp(1.25rem, 4.5vh, 2.75rem);
  text-align: center;
  opacity: calc(1 - var(--out) * 1.4);
  pointer-events: none;
}
.cv__head {
  align-self: center;
  display: grid;
  justify-items: center;
  gap: clamp(.9rem, 2.4vh, 1.6rem);
  translate: 0 -5.5vh;
}

/* "Hecho / Con / Orgullo." in Chomsky: three centred lines, tight leading,
   "Orgullo." set a little larger so it is the widest, strongest line.
   White with a soft shadow (needed where the letters cross the light grey
   bonnet); the period is red. */
.cv__title {
  margin: 0;
  display: grid;
  justify-items: center;
  font-family: "Chomsky", "Old English Text MT", "UnifrakturMaguntia", serif;
  font-weight: 400;
  font-size: clamp(3.4rem, min(9.6vw, 17vh), 11.5rem);
  line-height: .84;
  letter-spacing: .004em;
  color: #fbfaf7;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, .45)) drop-shadow(0 8px 30px rgba(0, 0, 0, .55));
}
.cv__l { display: block; }
.cv__l--3 { font-size: 1.12em; line-height: .9; }
.cv__title .dot { color: #d0141f; }

.cv__line {
  font-family: var(--font-mono);
  font-size: clamp(.66rem, .6rem + .24vw, .86rem);
  letter-spacing: .42em;
  margin: 0 -.42em 0 0;
  text-transform: uppercase;
  color: rgba(250, 249, 246, .94);
  filter: drop-shadow(0 1px 8px rgba(0, 0, 0, .8));
}
.cv__ctas {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: .75rem;
  pointer-events: auto;
}
.cv__ctas .btn { min-height: 3.3rem; min-width: 13rem; }
.cv__ctas .btn--ghost { background: rgba(5, 5, 6, .35); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }

/* ---- Entrance: once, on load (JS adds .cv-type-in when the font is ready).
   Each line fades in while rising a few pixels: Hecho, then Con, then
   Orgullo. (its red period with it), then the line. No blur, no bounce. ---- */
.cv-type-ready .cv__l,
.cv-type-ready .cv__line { opacity: 0; transform: translateY(14px); }
.cv-type-in .cv__l,
.cv-type-in .cv__line {
  animation: cv-rise 1.25s cubic-bezier(.22, .61, .2, 1) both;
}
.cv-type-in .cv__l--1 { animation-delay: .25s; }
.cv-type-in .cv__l--2 { animation-delay: .65s; }
.cv-type-in .cv__l--3 { animation-delay: 1.05s; animation-duration: 1.45s; }
.cv-type-in .cv__line { animation-delay: 1.75s; animation-duration: 1s; }
@keyframes cv-rise {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: none; }
}

.cv__note {
  position: absolute;
  right: var(--gutter);
  top: calc(var(--header-h) + 1rem);
  z-index: 2;
  max-width: 15rem;
  margin: 0;
}

/* Reduced motion: no movement, no entrance; everything simply visible. */
@media (prefers-reduced-motion: reduce) {
  .cv { height: auto; }
  .cv__stage { position: relative; }
  .cv__frame { transform: none; }
  .cv__l, .cv__line { opacity: 1 !important; transform: none !important; animation: none !important; }
}

/* ---- Phones and portrait tablets ----
   Not a scaled-down desktop: the whole photograph sits across the top at
   its true 3:2 shape (never cropped or stretched), the same photo mirrored
   and blurred around it so its edges melt away; the camera push grows it
   from 94% to 100% of the width. The three-line headline rises just over
   the photo's asphalt edge (never over the car), the line beneath it, and
   full-width buttons at the foot. */
@media (max-aspect-ratio: 1/1) {
  .cv { height: 150vh; --ph-w: 100vw; --ph-top: calc(var(--header-h) + 3svh); }
  .cv__bg {
    display: block;
    position: absolute;
    inset: 0;
    overflow: hidden;
  }
  .cv__bg > img {
    position: absolute;
    inset: -8%;
    width: 116%;
    height: 116%;
    object-fit: cover;
    filter: blur(26px) brightness(.55);
  }
  .cv__mosaic {
    position: absolute;
    left: calc((100vw - var(--ph-w)) / 2);
    top: var(--ph-top);
    width: var(--ph-w);
    height: calc(var(--ph-w) / 1.5);
    transform: scale(var(--push));
    transform-origin: 50% 50%;
    filter: blur(18px);
    will-change: transform;
  }
  .cv__mosaic img {
    position: absolute;
    width: 100%;
    height: 100%;
    max-width: none;
  }
  .cv__bg::after {
    content: "";
    position: absolute;
    inset: 0;
    background:
      linear-gradient(to bottom, rgba(7, 7, 8, .55), rgba(7, 7, 8, 0) calc(var(--ph-top) - 2svh)),
      linear-gradient(to bottom, rgba(7, 7, 8, 0) calc(var(--ph-top) + var(--ph-w) / 1.5 + 1svh), rgba(7, 7, 8, .62) calc(var(--ph-top) + var(--ph-w) / 1.5 + 13svh), rgba(7, 7, 8, .86) calc(var(--ph-top) + var(--ph-w) / 1.5 + 30svh));
  }
  .cv__frame {
    inset: auto;
    left: calc((100vw - var(--ph-w)) / 2);
    top: var(--ph-top);
    width: var(--ph-w);
    height: calc(var(--ph-w) / 1.5);
    transform-origin: 50% 50%;
  }
  .cv__copy {
    inset: 0;
    grid-template-rows: calc(var(--ph-top) + var(--ph-w) / 1.5 - clamp(1.5rem, 6vw, 2.75rem)) 1fr auto;
    padding-top: 0;
  }
  .cv__head { grid-row: 2; align-self: start; translate: none; gap: clamp(.8rem, 2.2svh, 1.3rem); }
  .cv__ctas { grid-row: 3; }
  .cv__title { font-size: clamp(2.6rem, min(17vw, 7.4svh), 6.5rem); line-height: .86; }
  .cv__line { letter-spacing: .24em; margin-right: -.24em; font-size: clamp(.62rem, 2.9vw, .8rem); }
  .cv__ctas { display: grid; grid-template-columns: 1fr; width: min(100%, 22rem); gap: .65rem; }
  .cv__ctas .btn { min-width: 0; }
  .cv__note { display: none; }
}
@media (max-aspect-ratio: 1/1) and (prefers-reduced-motion: reduce) {
  .cv__mosaic { transform: none; }
}

/* Captures (?still=1) */
.cv-still .cv__copy, .cv-still .cv__note,
.cv-still .site-header, .cv-still .proto-bar { display: none !important; }
