/* ==========================================================================
   WORK -> ABOUT TRANSITION, SHARED PORTRAIT LAYER & SWISS EDITORIAL ABOUT
   - Final Work card unsticks, scales 1.00 -> 0.90 (sharp), and lifts the stack
   - .about-backdrop seals blurred Home and deepens #151515 -> #0a0a0a
   - Shared .outro__portrait-layer pins across About + Contact so the single
     unmodified portrait glides seamlessly from Right (About) -> Left (Contact)
   - Reuses BLUE's signature Home motion identity: choreographed blur-and-rise
     entrance + subtle continuous vertical levitation (8px / 5s)
   ========================================================================== */

:root {
  --color-bg-about: #0a0a0a;
  --about-portrait-opacity: 0.9;
}

/* Full-viewport solid backdrop layered between Home (z:1) and Work/About (z:3/4) */
.about-backdrop {
  position: fixed;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  background-color: var(--color-bg);
  opacity: 0;
}

/* Shared wrapper spanning #about and #contact so the single portrait stays sticky across both */
.outro-stage {
  position: relative;
  z-index: 3;
  width: 100%;
}

/* Full-viewport sticky portrait stage with inline container units (100cqi) for exact edge cropping */
.outro__portrait-layer {
  position: sticky;
  top: 0;
  z-index: 1;
  width: 100%;
  height: 100vh;
  height: 100dvh;
  margin-bottom: -100vh;
  margin-bottom: -100dvh;
  container-type: inline-size;
  overflow: hidden;
  overflow: clip;
  pointer-events: none;
  user-select: none;
}

.about__portrait-enter,
.about__portrait-float {
  position: absolute;
  inset: 0;
}

/*
  Sized directly to the portrait's exact 1095:1185 proportions so translate3d(%):
  - At About:   calc(100cqi - 51.2%) -> slices central nose flush on the RIGHT edge
  - At Contact: -51.2%               -> slices central nose flush on the LEFT edge
*/
.about__portrait-glide {
  position: absolute;
  top: clamp(1.5rem, 5dvh, 3.75rem);
  left: 0;
  height: clamp(820px, 168dvh, 1850px);
  aspect-ratio: 1095 / 1185;
  transform: translate3d(calc(100cqi - 51.2%), 0, 0);
}

.about__portrait-img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  /* Symmetric horizontal & bottom soft edge dissolve so BOTH left & right half-crops stay clean */
  -webkit-mask-image:
    linear-gradient(
      to right,
      transparent 0%,
      rgba(0, 0, 0, 0.25) 14%,
      #000000 32%,
      #000000 68%,
      rgba(0, 0, 0, 0.25) 86%,
      transparent 100%
    ),
    linear-gradient(to bottom, #000000 0%, #000000 56%, transparent 74%);
  -webkit-mask-composite: source-in;
  mask-image:
    linear-gradient(
      to right,
      transparent 0%,
      rgba(0, 0, 0, 0.25) 14%,
      #000000 32%,
      #000000 68%,
      rgba(0, 0, 0, 0.25) 86%,
      transparent 100%
    ),
    linear-gradient(to bottom, #000000 0%, #000000 56%, transparent 74%);
  mask-composite: intersect;
  user-select: none;
  -webkit-user-drag: none;
}

/* About section stage — spacious vertical framing between top BLUE and bottom dock */
.about-stage {
  position: relative;
  z-index: 4;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  width: 100%;
  min-height: 100vh;
  min-height: 100dvh;
  padding-left: clamp(1.5rem, 6vw, 6.5rem);
  padding-right: clamp(1.5rem, 4vw, 4rem);
  padding-top: clamp(6rem, 12dvh, 8rem);
  padding-bottom: calc(clamp(3.5rem, 8dvh, 5.5rem) + 72px);
  background: transparent;
}

/* Left-side Swiss architectural editorial container */
.about__layout {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  gap: clamp(1.75rem, 4dvh, 2.85rem);
  width: min(56vw, 820px);
}

/* Top lead statement block (left-aligned editorial hero) */
.about__lead {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: clamp(0.75rem, 1.5dvh, 1.1rem);
}

/* Technical monospace section indices (approved BLUE metadata voice) */
.about__label {
  display: inline-block;
  color: rgba(204, 204, 204, 0.46);
  font-family: var(--font-mono);
  font-size: clamp(0.68rem, 0.76vw, 0.75rem);
  font-weight: 400;
  line-height: 1;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.about__headline {
  max-width: 30ch;
  color: var(--color-text);
  font-family: var(--font-sans);
  font-size: clamp(1.25rem, 1.95vw, 1.95rem);
  font-weight: 400;
  line-height: 1.32;
  letter-spacing: 0.015em;
  text-align: left;
  text-wrap: pretty;
  font-kerning: none;
}

/* Brutalist 1px architectural hairline rule */
.about__divider {
  width: 100%;
  height: 1px;
  background-color: var(--color-grid);
  transform-origin: left center;
}

/* Editorial 2-column grid + full-width closing side note */
.about__columns {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: clamp(2rem, 4vw, 4rem);
  row-gap: clamp(1.75rem, 3.6dvh, 2.6rem);
  align-items: start;
  width: 100%;
}

.about__col {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: clamp(0.65rem, 1.3dvh, 0.95rem);
}

.about__body {
  color: var(--color-text);
  font-family: var(--font-sans);
  font-size: clamp(0.84rem, 0.96vw, 0.95rem);
  font-weight: 400;
  line-height: 1.62;
  letter-spacing: 0.02em;
  text-align: left;
  text-wrap: pretty;
  font-kerning: none;
}

/* Closing editorial side note spanning cleanly below the 2 columns */
.about__col--note {
  grid-column: 1 / -1;
  max-width: 58ch;
  padding-top: clamp(1.25rem, 2.6dvh, 1.85rem);
  border-top: 1px solid var(--color-grid);
}

.about__col--note .about__body {
  color: rgba(204, 204, 204, 0.72);
}

/* --------------------------------------------------------------------------
   BLUE Signature Entrance Choreography (Home-Matched Blur + Rise + Float)
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: no-preference) {
  .about__portrait-enter {
    opacity: 0;
    filter: blur(14px);
    transform: translate3d(4%, 24px, 0);
    will-change: transform, opacity, filter;
    transition:
      opacity 0.95s var(--ease-brutalist) 0.08s,
      filter 0.95s var(--ease-brutalist) 0.08s,
      transform 0.95s var(--ease-brutalist) 0.08s;
  }

  .outro-stage.is-portrait-visible .about__portrait-enter {
    opacity: var(--about-portrait-opacity);
    filter: blur(0px);
    transform: translate3d(0, 0, 0);
  }

  /* Subtle ambient vertical levitation matching Home's 5s ease-in-out rhythm */
  .about__portrait-float {
    will-change: transform;
    animation: about-portrait-levitate var(--float-duration) ease-in-out infinite;
  }

  .about__reveal {
    opacity: 0;
    filter: blur(10px);
    transform: translate3d(0, 28px, 0);
    will-change: transform, opacity, filter;
    transition:
      opacity 0.85s var(--ease-brutalist),
      filter 0.85s var(--ease-brutalist),
      transform 0.85s var(--ease-brutalist);
  }

  .about-stage.is-in-view .about__lead {
    opacity: 1;
    filter: blur(0px);
    transform: translate3d(0, 0, 0);
    transition-delay: 0.22s;
  }

  .about__divider {
    opacity: 0;
    transform: scaleX(0);
    will-change: transform, opacity;
    transition:
      opacity 0.75s var(--ease-brutalist) 0.42s,
      transform 0.85s var(--ease-brutalist) 0.42s;
  }

  .about-stage.is-in-view .about__divider {
    opacity: 1;
    transform: scaleX(1);
  }

  .about-stage.is-in-view .about__col:nth-child(1) {
    opacity: 1;
    filter: blur(0px);
    transform: translate3d(0, 0, 0);
    transition-delay: 0.54s;
  }

  .about-stage.is-in-view .about__col:nth-child(2) {
    opacity: 1;
    filter: blur(0px);
    transform: translate3d(0, 0, 0);
    transition-delay: 0.7s;
  }

  .about-stage.is-in-view .about__col:nth-child(3) {
    opacity: 1;
    filter: blur(0px);
    transform: translate3d(0, 0, 0);
    transition-delay: 0.88s;
  }

  /* Reset transitions quickly when leaving upward so re-entry always starts fresh */
  .outro-stage:not(.is-portrait-visible) .about__portrait-enter,
  .about-stage:not(.is-in-view) .about__reveal,
  .about-stage:not(.is-in-view) .about__divider {
    transition-duration: 0.45s;
    transition-delay: 0s;
  }
}

@keyframes about-portrait-levitate {
  0%,
  100% {
    transform: translate3d(0, 0, 0);
  }
  50% {
    transform: translate3d(0, -8px, 0);
  }
}

/* Native CSS Scroll-Driven Work Exit & Background Darkening (100% Reversible) */
@media (prefers-reduced-motion: no-preference) {
  @supports (
    (animation-timeline: view()) and
    (animation-range: entry) and
    (timeline-scope: --about-enter-tl)
  ) {
    #main-content {
      timeline-scope: --about-enter-tl, --contact-enter-tl;
    }

    .about-stage {
      view-timeline: --about-enter-tl block;
    }

    /* Final Work card subtly scales 1 -> 0.90 as it lifts the stack off screen */
    .work__slot:last-child .work__card {
      will-change: transform;
      animation: work-last-lift auto linear both;
      animation-timeline: --about-enter-tl;
      animation-range: entry 0% entry 100%;
    }

    /* Background seals blurred Home and smoothly deepens from #151515 -> #0a0a0a */
    .about-backdrop {
      will-change: opacity, background-color;
      animation: about-backdrop-darken auto linear both;
      animation-timeline: --about-enter-tl;
      animation-range: entry 0% entry 90%;
    }
  }
}

@keyframes work-last-lift {
  0% {
    transform: scale3d(1, 1, 1);
  }
  100% {
    transform: scale3d(0.9, 0.9, 1);
  }
}

@keyframes about-backdrop-darken {
  0% {
    opacity: 0;
    background-color: var(--color-bg);
  }
  20% {
    opacity: 1;
    background-color: var(--color-bg);
  }
  100% {
    opacity: 1;
    background-color: var(--color-bg-about);
  }
}

/* --------------------------------------------------------------------------
   Responsive Refinements (Tablet & Mobile)
   -------------------------------------------------------------------------- */
@media (max-width: 1120px) {
  :root {
    --about-portrait-opacity: 0.72;
  }

  .about__layout {
    width: min(62vw, 660px);
  }

  .about__portrait-glide {
    height: clamp(720px, 145dvh, 1300px);
  }
}

@media (max-width: 820px) {
  :root {
    --about-portrait-opacity: 0.22;
  }

  .about-stage {
    padding-inline: 1.5rem;
    padding-top: clamp(5.5rem, 11dvh, 7rem);
    padding-bottom: calc(2.75rem + 72px);
  }

  .about__layout {
    width: min(88vw, 560px);
    gap: 1.65rem;
  }

  .about__portrait-glide {
    top: 4dvh;
    height: clamp(640px, 120dvh, 980px);
  }

  .about__headline {
    font-size: clamp(1.125rem, 4.4vw, 1.45rem);
    line-height: 1.38;
  }

  .about__columns {
    grid-template-columns: 1fr;
    row-gap: 1.5rem;
  }

  .about__body {
    font-size: clamp(0.84rem, 3.4vw, 0.94rem);
    line-height: 1.6;
  }
}

/* Reduced motion: clean solid dark About surface without scroll or entrance motion */
@media (prefers-reduced-motion: reduce) {
  .about-backdrop {
    display: none;
  }

  .about-stage {
    background-color: var(--color-bg-about);
  }

  .outro__portrait-layer {
    display: none;
  }

  .about__portrait-enter {
    opacity: var(--about-portrait-opacity) !important;
    filter: none !important;
    transform: none !important;
    transition: none !important;
  }

  .about__portrait-float {
    animation: none !important;
    transform: none !important;
  }

  .about__reveal,
  .about__divider {
    transition: none !important;
    filter: none !important;
    opacity: 1 !important;
    transform: none !important;
  }
}
