/* Ultra-Slim Micro-Frame Cards, Monocle Notes, Rising Tide Cascade & Proximity Focus */

#content-profile .timeline-card {
  position: absolute;
  left: var(--card-x, 0px);
  top: var(--card-y, 0px);
  width: var(--card-w, 280px);
  height: var(--card-h, 280px);
  z-index: var(--card-z, 10);
  opacity: 1;
  transform: translate3d(0, 0, 0) scale(1) rotate(var(--rot, 0deg));
  transition: transform 0.32s cubic-bezier(0.22, 1, 0.36, 1);
}

/* Only Chapters 4 & 5 override Stage 3's inherited --stage-accent / --stage-glow */
#content-profile .timeline-card[data-ch="4"] { --stage-accent: var(--ch4-accent); --stage-glow: var(--ch4-glow); }
#content-profile .timeline-card[data-ch="5"] { --stage-accent: var(--ch5-accent); --stage-glow: var(--ch5-glow); }

/* Hover lift rules placed below camera-rail specificity so hovered card always rises to top */

/* Rising Tide Cascade (Scroll-Linked Bottom-Up Wave across all 25 cards) */
#content-profile #stage1.is-rising .timeline-card[data-ch="1"],
#content-profile #stage2.is-rising .timeline-card[data-ch="2"],
#content-profile #stage3.is-rising .timeline-card[data-ch="3"],
#content-profile #stage3.is-rising-4 .timeline-card[data-ch="4"],
#content-profile #stage3.is-rising-5 .timeline-card[data-ch="5"] {
  opacity: var(--rise-op, 0);
  transform:
    translate3d(0, var(--rise-y, 120px), 0)
    scale(var(--rise-scale, 0.94))
    rotate(calc(var(--rot, 0deg) + var(--rise-rot-extra, 0deg)));
  transition: none;
  will-change: transform, opacity;
}

#content-profile .vertical-track.has-camera-rail #stage3.is-rising .timeline-card[data-ch="3"],
#content-profile .vertical-track.has-camera-rail #stage3.is-rising-4 .timeline-card[data-ch="4"],
#content-profile .vertical-track.has-camera-rail #stage3.is-rising-5 .timeline-card[data-ch="5"] {
  opacity: calc(var(--rise-op, 0) * (0.58 + 0.42 * var(--prox, 0)));
  transform:
    translate3d(0, var(--rise-y, 120px), 0)
    scale(calc(var(--prox-scale, 1) * var(--rise-scale, 0.94)))
    rotate(calc(var(--prox-rot, var(--rot, 0deg)) + var(--rise-rot-extra, 0deg)));
  transition: none;
}

#content-profile .vertical-track.has-camera-rail #stage3.is-rising .note-card[data-ch="3"],
#content-profile .vertical-track.has-camera-rail #stage3.is-rising-4 .note-card[data-ch="4"],
#content-profile .vertical-track.has-camera-rail #stage3.is-rising-5 .note-card[data-ch="5"] {
  opacity: var(--rise-op, 0);
}

/* Progressive Lazy-Loaded Media Fade-In */
#content-profile .is-lazy-shell {
  background: linear-gradient(135deg, rgba(16, 22, 42, 0.92), rgba(28, 34, 62, 0.85));
}

html[data-theme="light"] #content-profile .is-lazy-shell {
  background: linear-gradient(135deg, rgba(214, 222, 236, 0.92), rgba(228, 232, 244, 0.88));
}

#content-profile .photo-media img.lazy-img,
#content-profile .note-inset-media img.lazy-img {
  opacity: 0;
  transition: opacity 0.42s ease, transform 0.65s cubic-bezier(0.16, 1, 0.3, 1);
}

#content-profile .photo-media img.lazy-img.is-loaded,
#content-profile .note-inset-media img.lazy-img.is-loaded {
  opacity: 1;
}

/* Camera Rail Continuous Proximity Focus */
#content-profile .vertical-track.has-camera-rail .timeline-card {
  opacity: calc(0.58 + 0.42 * var(--prox, 0));
  transform: translate3d(0, 0, 0) scale(var(--prox-scale, 1)) rotate(var(--prox-rot, var(--rot, 0deg)));
  transition: opacity 0.12s linear, box-shadow 0.25s ease;
}

#content-profile.is-scrolling .vertical-track.has-camera-rail .timeline-card {
  will-change: transform, opacity;
}

#content-profile .vertical-track.has-camera-rail .note-card {
  opacity: calc(0.86 + 0.14 * var(--prox, 0));
  transition: opacity 0.12s linear, box-shadow 0.25s ease;
}

#content-profile .vertical-track.has-camera-rail .timeline-card.is-prox-focus {
  z-index: 26;
  box-shadow:
    var(--tp-card-hover-shadow),
    0 0 0 1.5px color-mix(in srgb, var(--stage-accent) 68%, transparent),
    0 0 26px var(--stage-glow);
}

#content-profile .vertical-track.has-camera-rail .timeline-card.note-card.is-prox-focus {
  z-index: 16;
}

@media (hover: hover) {
  #content-profile .timeline-card:hover,
  #content-profile .vertical-track.has-camera-rail .timeline-card:hover {
    z-index: 42;
    transform: translate3d(0, -4px, 0) scale(1.022) rotate(0deg);
    transition: transform 0.28s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.12s linear, box-shadow 0.25s ease;
    will-change: transform;
  }
}

/* Photo Cards — 4 Micro-Frame Variants */
#content-profile .photo-card {
  cursor: pointer;
  outline: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

#content-profile .photo-card:focus-visible {
  outline: 2px solid var(--stage-accent);
  outline-offset: 4px;
}

#content-profile .photo-card .photo-media {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #0a0d1c;
}

#content-profile .photo-card .photo-media img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  object-position: var(--img-pos, center center);
  transition: transform 0.65s cubic-bezier(0.16, 1, 0.3, 1);
}

#content-profile .photo-card:hover .photo-media img {
  transform: scale(1.035);
}

#content-profile .frame-hero {
  border-radius: 8px;
  border: 1.5px solid color-mix(in srgb, var(--stage-accent) 68%, transparent);
  box-shadow: var(--tp-card-shadow), 0 0 28px var(--stage-glow);
}

#content-profile .frame-hero .photo-media { border-radius: 6.5px; }

#content-profile .frame-rim {
  padding: 2.5px;
  border-radius: 7px;
  background: var(--rim-frame-bg);
  border: 1px solid var(--rim-frame-border);
  box-shadow: var(--tp-card-shadow);
}

#content-profile .frame-rim .photo-media { border-radius: 4.5px; }

#content-profile .frame-industrial {
  padding: 2px;
  border-radius: 6px;
  background: var(--industrial-frame-bg);
  border: 1px solid var(--industrial-frame-border);
  box-shadow: var(--tp-card-shadow);
}

#content-profile .frame-industrial .photo-media { border-radius: 4px; }

#content-profile .frame-industrial .corner-ticks {
  position: absolute;
  inset: -3px;
  pointer-events: none;
  z-index: 8;
  background:
    linear-gradient(var(--stage-accent), var(--stage-accent)) top left / 11px 1.8px no-repeat,
    linear-gradient(var(--stage-accent), var(--stage-accent)) top left / 1.8px 11px no-repeat,
    linear-gradient(var(--stage-accent), var(--stage-accent)) top right / 11px 1.8px no-repeat,
    linear-gradient(var(--stage-accent), var(--stage-accent)) top right / 1.8px 11px no-repeat,
    linear-gradient(var(--stage-accent), var(--stage-accent)) bottom left / 11px 1.8px no-repeat,
    linear-gradient(var(--stage-accent), var(--stage-accent)) bottom left / 1.8px 11px no-repeat,
    linear-gradient(var(--stage-accent), var(--stage-accent)) bottom right / 11px 1.8px no-repeat,
    linear-gradient(var(--stage-accent), var(--stage-accent)) bottom right / 1.8px 11px no-repeat;
}

#content-profile .frame-glass {
  border-radius: 8px;
  background: var(--glass-frame-bg);
  border: 1px solid var(--glass-frame-border);
  box-shadow: var(--tp-card-shadow), inset 0 1px 0 rgba(255, 255, 255, 0.25);
}

#content-profile .frame-glass .photo-media { border-radius: 7px; }

/* Floating Photo Caption & Zoom Hint (Zero moving backdrop-filter layers) */
#content-profile .photo-caption {
  position: absolute;
  bottom: 8px;
  left: 8px;
  z-index: 6;
  display: inline-flex;
  align-items: center;
  width: fit-content;
  max-width: calc(100% - 16px);
  padding: 4px 9px;
  border-radius: 5px;
  background: rgba(9, 12, 24, 0.88);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-left: 2.5px solid var(--stage-accent);
  color: #f7f6ff;
  font-family: var(--tp-font-serif);
  font-style: italic;
  font-weight: 600;
  font-size: clamp(0.58rem, calc(var(--card-w, 300px) * 0.032), 0.90rem);
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  pointer-events: none;
}

#content-profile .photo-caption.cap-right {
  left: auto;
  right: 8px;
  border-left: 1px solid rgba(255, 255, 255, 0.18);
  border-right: 2.5px solid var(--stage-accent);
}

#content-profile .photo-zoom-hint {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 6;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(9, 12, 24, 0.82);
  border: 1px solid rgba(255, 255, 255, 0.24);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transform: scale(0.86);
  pointer-events: none;
  transition: opacity 0.22s ease, transform 0.22s ease;
}

#content-profile .photo-card:hover .photo-zoom-hint,
#content-profile .photo-card:focus-visible .photo-zoom-hint {
  opacity: 1;
  transform: scale(1);
}

/* Monocle Magazine Print Notes */
#content-profile .note-card {
  display: flex;
  flex-direction: column;
  border-radius: 6px;
  background: var(--note-bg);
  color: var(--note-lead-ink);
  border: var(--note-border);
  box-shadow: var(--tp-card-shadow);
  overflow: hidden;
  contain: layout style;
}

#content-profile .note-card .note-inset-media {
  position: relative;
  flex: 0 0 38%;
  width: 100%;
  min-height: 0;
  overflow: hidden;
  background: #0c1222;
  border-bottom: 1px solid rgba(20, 24, 38, 0.1);
}

#content-profile .note-card .note-inset-media::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 58%, rgba(7, 11, 22, 0.36) 100%);
  pointer-events: none;
}

#content-profile .note-card .note-inset-media img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  object-position: var(--inset-pos, center center);
  transition: transform 0.7s cubic-bezier(0.16, 1, 0.3, 1);
}

#content-profile .note-card:hover .note-inset-media img {
  transform: scale(1.04);
}

#content-profile .note-card .note-surface {
  position: relative;
  flex: 1 1 auto;
  width: 100%;
  min-height: 0;
  padding: clamp(12px, calc(var(--card-w, 340px) * 0.068), 30px)
    clamp(12px, calc(var(--card-w, 340px) * 0.068), 28px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  overflow: hidden;
  contain: layout style;
}

#content-profile .note-card .note-ghost {
  position: absolute;
  bottom: calc(var(--card-h, 300px) * -0.04);
  right: clamp(8px, calc(var(--card-w, 340px) * 0.03), 16px);
  font-family: var(--tp-font-serif);
  font-style: italic;
  font-weight: 700;
  font-size: clamp(3rem, calc(var(--card-w, 340px) * 0.25), 6.2rem);
  line-height: 0.9;
  color: color-mix(in srgb, var(--stage-accent) 11%, transparent);
  pointer-events: none;
  user-select: none;
}

#content-profile .note-card .note-stack {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  gap: clamp(8px, calc(var(--card-h, 320px) * 0.042), 18px);
}

#content-profile .note-card.has-photo-inset .note-surface {
  padding: clamp(10px, calc(var(--card-w, 340px) * 0.052), 24px)
    clamp(12px, calc(var(--card-w, 340px) * 0.064), 26px);
}

#content-profile .note-card.has-photo-inset .note-stack {
  gap: clamp(7px, calc(var(--card-h, 460px) * 0.022), 14px);
}

#content-profile .note-card.has-photo-inset .note-ghost {
  font-size: clamp(2.6rem, calc(var(--card-w, 340px) * 0.21), 5.2rem);
}

#content-profile .note-card .note-lead {
  font-family: var(--tp-font-serif);
  font-style: italic;
  font-weight: 700;
  font-size: calc(var(--fit-font-size, 14px) * 1.26);
  line-height: 1.34;
  color: var(--note-lead-ink);
  padding: clamp(4px, calc(var(--card-h, 320px) * 0.018), 8px)
    clamp(8px, calc(var(--card-w, 340px) * 0.03), 12px)
    clamp(4px, calc(var(--card-h, 320px) * 0.018), 8px)
    clamp(9px, calc(var(--card-w, 340px) * 0.034), 14px);
  border-left: 3px solid var(--stage-accent);
  background: color-mix(in srgb, var(--stage-accent) 7.5%, transparent);
  border-radius: 0 5px 5px 0;
  transform: rotate(-1.3deg);
  transform-origin: left center;
  text-wrap: pretty;
}

#content-profile .note-card .note-lead .acc {
  color: var(--stage-accent);
}

#content-profile .note-card .note-body-text {
  font-family: var(--tp-font-sans);
  font-size: var(--fit-font-size, 14px);
  font-weight: 400;
  line-height: 1.62;
  color: var(--note-body-ink);
  text-wrap: pretty;
}

#content-profile .note-card .note-body-text .soft-hl {
  color: var(--note-lead-ink);
  font-weight: 500;
  background: linear-gradient(
    180deg,
    transparent 58%,
    color-mix(in srgb, var(--stage-accent) 24%, transparent) 58%,
    color-mix(in srgb, var(--stage-accent) 24%, transparent) 94%,
    transparent 94%
  );
  padding: 0 2px;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
}

#content-profile .note-card .note-bar {
  width: clamp(22px, calc(var(--card-w, 340px) * 0.11), 42px);
  height: 2px;
  border-radius: 2px;
  background: var(--stage-accent);
  opacity: 0.72;
  flex-shrink: 0;
}

#content-profile .timeline-card[data-card-id="N5"] {
  box-shadow:
    0 24px 54px rgba(0, 0, 0, 0.52),
    0 0 0 1px color-mix(in srgb, var(--ch5-accent) 32%, transparent);
}

html[data-theme="light"] #content-profile .timeline-card[data-card-id="N5"] {
  box-shadow:
    0 18px 40px rgba(10, 30, 56, 0.20),
    0 0 0 1px color-mix(in srgb, var(--ch5-accent) 36%, transparent);
}

@container tp-stage (max-height: 790px) {
  #content-profile .note-card.has-photo-inset .note-inset-media { flex-basis: 34%; }
}

@container tp-stage (max-height: 640px) {
  #content-profile .note-card.has-photo-inset .note-inset-media { flex-basis: 31%; }
}

#content-profile[data-vp-mode="phone-land"] .note-card.has-photo-inset .note-inset-media { flex-basis: 23%; }
#content-profile[data-vp-mode="phone-land"] .note-card.has-photo-inset .note-surface { padding: 7px 10px; }
#content-profile[data-vp-mode="phone-land"] .note-card.has-photo-inset .note-stack { gap: 5px; }
#content-profile[data-vp-mode="phone-land"] .note-card.has-photo-inset .note-lead { padding: 3px 7px 3px 8px; }
