/* Scoped datocean v2 Profile Tokens & GPU-Composited Chapter Backdrop Layers
   --ch0..5-accent/glow & active --tp-* are driven from data.js via profile/theme.js */

#content-profile {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
  touch-action: none;
  isolation: isolate;
  container-type: size;
  container-name: tp-stage;

  --sat: env(safe-area-inset-top, 0px);
  --sab: env(safe-area-inset-bottom, 0px);
  --sal: env(safe-area-inset-left, 0px);

  --vp-w: 100cqw;
  --vp-h: 100cqh;
  --hud-h: 50px;

  --tp-bg-color: #090d1a;
  --tp-active-accent: #ff6b35;
  --tp-glow-color: rgba(255, 107, 53, 0.28);

  --tp-font-sans: 'Be Vietnam Pro', system-ui, -apple-system, sans-serif;
  --tp-font-tech: 'Space Grotesk', system-ui, sans-serif;
  --tp-font-serif: 'Playfair Display', Georgia, serif;
  --tp-font-display: 'Kanit', system-ui, sans-serif;

  --tp-text-primary: #f4f1ff;
  --tp-text-muted: rgba(242, 244, 255, 0.64);
  --tp-border-subtle: rgba(255, 255, 255, 0.12);

  /* Monocle Magazine Print Note Tokens */
  --note-bg: #fcfbf7;
  --note-lead-ink: #14121d;
  --note-body-ink: #464355;
  --note-border: 1px solid rgba(25, 24, 32, 0.12);

  /* Micro-Frame Tokens (Dark) */
  --rim-frame-bg: rgba(246, 248, 255, 0.92);
  --rim-frame-border: rgba(255, 255, 255, 0.28);
  --industrial-frame-bg: rgba(14, 18, 34, 0.94);
  --industrial-frame-border: rgba(255, 255, 255, 0.22);
  --glass-frame-bg: rgba(18, 24, 46, 0.55);
  --glass-frame-border: rgba(255, 255, 255, 0.24);

  --tp-card-shadow:
    0 20px 44px rgba(0, 0, 0, 0.54),
    0 6px 18px rgba(4, 8, 20, 0.38);
  --tp-card-hover-shadow:
    0 28px 64px rgba(0, 0, 0, 0.68),
    0 12px 28px rgba(4, 8, 20, 0.48);

  /* Stage Decor Tokens (Dark) */
  --grid-major: rgba(255, 255, 255, 0.045);
  --grid-minor: rgba(255, 255, 255, 0.02);
  --grid-dot: rgba(196, 222, 255, 0.22);
  --ghost-stroke: rgba(255, 255, 255, 0.10);
  --label-stroke: rgba(255, 255, 255, 0.95);
  --wave-opacity: 0.26;
  --tp-hairline-color: rgba(255, 255, 255, 0.16);

  /* Back-to-Top Button Tokens (Dark) */
  --hud-pill-bg: rgba(10, 14, 30, 0.82);
  --hud-pill-border: 1px solid rgba(255, 255, 255, 0.16);
  --hud-pill-shadow: 0 10px 28px rgba(0, 0, 0, 0.50), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  --hud-pill-text: #f4f6ff;

  background-color: var(--tp-bg-color);
  color: var(--tp-text-primary);
  font-family: var(--tp-font-sans);
  line-height: 1.4;
  transition: color 0.35s ease;
}

html[data-theme="light"] #content-profile {
  --tp-text-primary: #0e1e33;
  --tp-text-muted: rgba(14, 30, 51, 0.72);
  --tp-border-subtle: rgba(14, 42, 74, 0.16);

  --note-bg: #fbfdff;
  --note-lead-ink: #0e1e33;
  --note-body-ink: #384d66;
  --note-border: 1px solid rgba(14, 42, 74, 0.16);

  --rim-frame-bg: #ffffff;
  --rim-frame-border: rgba(14, 42, 74, 0.18);
  --industrial-frame-bg: #eaf1f8;
  --industrial-frame-border: rgba(14, 42, 74, 0.24);
  --glass-frame-bg: rgba(251, 253, 255, 0.86);
  --glass-frame-border: rgba(14, 42, 74, 0.18);

  --tp-card-shadow:
    0 16px 34px rgba(10, 30, 56, 0.16),
    0 4px 12px rgba(10, 30, 56, 0.09);
  --tp-card-hover-shadow:
    0 24px 52px rgba(10, 30, 56, 0.24),
    0 8px 20px rgba(10, 30, 56, 0.13);

  --grid-major: rgba(14, 36, 62, 0.065);
  --grid-minor: rgba(14, 36, 62, 0.028);
  --grid-dot: rgba(14, 42, 74, 0.22);
  --ghost-stroke: rgba(14, 42, 74, 0.11);
  --wave-opacity: 0.24;
  --tp-hairline-color: rgba(14, 42, 74, 0.18);

  --hud-pill-bg: rgba(251, 253, 255, 0.94);
  --hud-pill-border: 1px solid rgba(14, 42, 74, 0.20);
  --hud-pill-shadow: 0 10px 24px rgba(10, 30, 56, 0.16), inset 0 1px 0 #ffffff;
  --hud-pill-text: #0e1e33;
}

#content-profile .svg-sprite {
  display: none;
}

#content-profile .sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* Dual-Layer GPU Opacity Cross-Fade Chapter Backdrop (Zero Gradient Repaint) */
#content-profile .chapter-bg-layer {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-size: cover;
  background-repeat: no-repeat;
  opacity: 0;
  transition: opacity 0.65s var(--ease-out-quart);
}

#content-profile .chapter-bg-layer.is-front {
  opacity: 1;
}

/* Scoped Ambient Blueprint Grid */
#content-profile .global-grid {
  position: absolute;
  inset: -160px;
  background-image:
    radial-gradient(circle, var(--grid-dot) 1px, transparent 1.2px),
    linear-gradient(var(--grid-major) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-major) 1px, transparent 1px),
    linear-gradient(var(--grid-minor) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-minor) 1px, transparent 1px);
  background-size: 96px 96px, 96px 96px, 96px 96px, 24px 24px, 24px 24px;
  pointer-events: none;
  z-index: 1;
}

#content-profile .ambient-glow {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 60% 48%, var(--tp-glow-color), transparent 72%);
  pointer-events: none;
  z-index: 2;
  mix-blend-mode: screen;
  opacity: 0.22;
}

html[data-theme="light"] #content-profile .ambient-glow {
  mix-blend-mode: multiply;
  opacity: 0.14;
}

#content-profile .atmospheric-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 2;
}

#content-profile .atmospheric-overlay::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 50% 50%, transparent 50%, rgba(0, 0, 0, 0.24) 100%);
}

#content-profile .atmospheric-overlay::after {
  content: '';
  position: absolute;
  inset: 0;
  opacity: 0.016;
  background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgBAMAAACBVGfHAAAAHlBMVEUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMwA89AAAACnRSTlMA/////////9/f3+FBMFEAAABOSURBVCjPjcuhCQAxEATAtpE0kG7R/pswEGwI/mKwwX2b48qV/W1ZpB4zP1tWqcfMz5ZV6jHzs2WVesz8bFmlHjM/W1apx8zPllXqMb/MA2R3YI9P/2TBAAAAAElFTkSuQmCC");
  background-repeat: repeat;
}

html[data-theme="light"] #content-profile .atmospheric-overlay::before {
  background: radial-gradient(ellipse at 50% 50%, transparent 56%, rgba(14, 36, 62, 0.065) 100%);
}
