/* ==========================================================================
   DV logo — static nav mark + first-load intro
   ========================================================================== */

/* Logo colour: near-white, lit by a light-blue glow (the same glow as the
   years in the Experience section). The mark is still wired as a four-stop
   gradient (14deg, like .gradient-text in site.css), so a ramp can come
   back by giving these stops different colours, e.g. alice-blue, sky-blue,
   cool-sky-2, brilliant-azure. */
:root {
  --dv-logo: #eaf6ff;   /* near-white; the glow below carries the blue */
  --dv-glow: 112, 182, 227; /* the site's light blue, as r, g, b */
  --dv-stop-1: var(--dv-logo);
  --dv-stop-2: var(--dv-logo);
  --dv-stop-3: var(--dv-logo);
  --dv-stop-4: var(--dv-logo);
}

.dv-stop-1 { stop-color: var(--dv-stop-1); }
.dv-stop-2 { stop-color: var(--dv-stop-2); }
.dv-stop-3 { stop-color: var(--dv-stop-3); }
.dv-stop-4 { stop-color: var(--dv-stop-4); }

/* Static mark in the navbar, filled with the blue gradient. */
.navbar-brand.dv-brand {
  display: inline-flex;
  align-items: center;
  line-height: 0;
}

.dv-mark {
  display: block;
  height: 26px;
  width: auto;
  fill: url(#dvBlue);
  overflow: visible;
  filter:
    drop-shadow(0 0 2px rgba(var(--dv-glow), .95))
    drop-shadow(0 0 7px rgba(var(--dv-glow), .6))
    drop-shadow(0 0 16px rgba(var(--dv-glow), .35));
}

/* ---------- Hover: DV opens into DavidVallejo.co ----------
   The D and V stay put; the letters between them slide out of zero
   width. The words carry on the logo's gradient, light to deep. */
.dv-brand { text-decoration: none; }

.dv-lockup {
  display: inline-flex;
  align-items: baseline;
}

/* SVGs sit on their bottom edge; pull it up to the glyph baseline */
.dv-lockup .dv-mark { margin-bottom: -1.6px; }

/* Each word is a one-column grid animating 0fr → 1fr, which tweens to
   the word's exact width — no overshooting max-width, so the motion
   eases all the way in and out. The letters fade and glide alongside. */
.dv-word {
  display: inline-grid;
  grid-template-columns: 0fr;
  transition:
    grid-template-columns .75s cubic-bezier(.65, 0, .35, 1),
    margin-left .75s cubic-bezier(.65, 0, .35, 1);
}

.dv-word > span {
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  font-family: "Barlow", system-ui, sans-serif;
  font-size: 33px;
  font-weight: 600;
  line-height: 1;
  letter-spacing: -0.02em;
  /* Room for the j's descender inside the clipped box */
  padding-bottom: .12em;
  margin-bottom: -.12em;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  opacity: 0;
  transform: translateX(-.3em);
  transition:
    opacity .45s ease,
    transform .75s cubic-bezier(.65, 0, .35, 1);
}

.dv-word > span {
  background-image: linear-gradient(14deg, var(--dv-stop-1), var(--dv-stop-2) 45%, var(--dv-stop-3) 75%, var(--dv-stop-4));
}

.dv-brand:hover .dv-word,
.dv-brand:focus-visible .dv-word { grid-template-columns: 1fr; }

.dv-brand:hover .dv-word > span,
.dv-brand:focus-visible .dv-word > span {
  opacity: 1;
  transform: none;
  transition:
    opacity .55s ease .12s,
    transform .75s cubic-bezier(.65, 0, .35, 1);
}

/* Opening, "allejo.co" trails a beat so the name unrolls left to right */
.dv-brand:hover .dv-word-2,
.dv-brand:focus-visible .dv-word-2 {
  transition-delay: .08s;
  /* Tuck "allejo" in under the V's slanted arm */
  margin-left: -4px;
}
.dv-brand:hover .dv-word-2 > span,
.dv-brand:focus-visible .dv-word-2 > span { transition-delay: .2s, .08s; }

/* While the intro plays, the nav mark waits for the hand-off */
.dv-intro-running .navbar-brand .dv-mark {
  opacity: 0;
}

/* ---------- Intro overlay ---------- */
.dv-intro {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: grid;
  place-items: center;
  background: var(--paper, #FBFCFF);
  color: var(--ink, #0B1020);
  cursor: pointer;
  /* Safety net: if the JS never runs, get out of the way anyway */
  animation: dv-intro-fallback .5s ease 4.2s forwards;
}

.dv-intro-mark {
  width: min(240px, 52vw);
  height: auto;
  overflow: visible;
  will-change: transform;
  /* Sized so it shrinks to the nav mark's glow when the mark flies up there */
  filter:
    drop-shadow(0 0 9px rgba(var(--dv-glow), .95))
    drop-shadow(0 0 32px rgba(var(--dv-glow), .6))
    drop-shadow(0 0 74px rgba(var(--dv-glow), .35));
}

/* The logo arrives as a shooting star: logo-intro.js flies the star into
   the middle of the screen and bursts it; out of the flash (.is-lit) the
   mark draws its outline, fills, and drops the stroke. */
.dv-intro-mark path {
  fill: url(#dvSpectrum);
  fill-opacity: 0;
  stroke: url(#dvSpectrum);
  stroke-width: 1.4;
  stroke-linejoin: round;
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
}

.dv-intro-mark.is-lit path {
  animation:
    dv-draw 1.1s cubic-bezier(.65, 0, .35, 1) forwards,
    dv-fill .5s ease-out .95s forwards,
    dv-unstroke .35s ease-out 1.35s forwards;
}

.dv-intro-mark.is-lit .dv-v {
  animation-delay: .22s, 1.1s, 1.45s;
}

/* Skipped early: show the finished mark straight away */
.dv-intro-mark.is-done path {
  animation: none;
  fill-opacity: 1;
  stroke-opacity: 0;
}

@keyframes dv-draw     { to { stroke-dashoffset: 0; } }
@keyframes dv-fill     { to { fill-opacity: 1; } }
@keyframes dv-unstroke { to { stroke-opacity: 0; } }

.dv-star { position: absolute; left: 50%; top: 50%; width: 0; height: 0; pointer-events: none; }
.dv-star-tail {
  position: absolute;
  right: 0;
  top: -2px;
  width: min(340px, 60vw);
  height: 4px;
  border-radius: 2px;
  background: linear-gradient(to left, #fff, rgba(112, 182, 227, .85) 14%, rgba(112, 182, 227, 0));
  filter: drop-shadow(0 0 7px rgba(112, 182, 227, .9));
}
.dv-star-head {
  position: absolute;
  left: -7px;
  top: -7px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 14px 4px #eaf6ff, 0 0 44px 14px rgba(112, 182, 227, .8);
}
.dv-star-flash {
  position: absolute;
  left: 50%;
  top: 50%;
  width: min(520px, 110vw);
  aspect-ratio: 1;
  margin: calc(min(520px, 110vw) / -2) 0 0 calc(min(520px, 110vw) / -2);
  border-radius: 50%;
  background: radial-gradient(circle, #fff 0, rgba(112, 182, 227, .7) 28%, rgba(112, 182, 227, 0) 66%);
  pointer-events: none;
}
.dv-star-spark {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 4px;
  height: 4px;
  margin: -2px;
  border-radius: 50%;
  background: #eaf6ff;
  box-shadow: 0 0 8px 2px rgba(112, 182, 227, .9);
  pointer-events: none;
}

@keyframes dv-intro-fallback { to { opacity: 0; visibility: hidden; } }

@media (prefers-reduced-motion: reduce) {
  .dv-intro { display: none; }
  .dv-word, .dv-word > span { transition: none !important; }
  .dv-intro-running .navbar-brand .dv-mark { opacity: 1; }
}
