/* ============================================
   VISUAL2.CSS - 11 New Visual Features
   Variable Font · Oversized BG Text · SVG Headline
   Constellation · Scanlines · Depth Fog · Lava Blobs
   Progress Line Drawing · Transformer Diagram
   Section Particles · Avatar
   ============================================ */

/* ------------------------------------------------
   1. VARIABLE FONT BREATHING - headline
   ------------------------------------------------ */
/* Animation settings adapted for Syncopate (non-variable) */
@keyframes font-breathe {
    0%, 100% {
        letter-spacing: 0.1em;
        opacity: 0.85;
    }
    50% {
        letter-spacing: 0.2em;
        opacity: 1;
    }
}

/* Applied only to "Beyond." - the plain word, not .accent-text */
.headline .breathe-word {
    display: inline-block;
    font-family: var(--font-heading);
    font-size: inherit;
    font-weight: 700;
    animation: font-breathe 4s ease-in-out infinite;
    will-change: opacity, letter-spacing;
    text-shadow: 0 0 40px rgba(201, 168, 108, 0.15);
}

[data-theme="light"] .headline .breathe-word {
    text-shadow: 0 0 35px rgba(122, 98, 64, 0.2);
}

/* ------------------------------------------------
   2. OVERSIZED BACKGROUND TEXT behind sections
   ------------------------------------------------ */
.bg-word {
    position: absolute;
    font-family: var(--font-heading);
    font-size: clamp(100px, 20vw, 220px);
    font-weight: 800;
    letter-spacing: -0.06em;
    color: var(--text-primary);
    opacity: 0.022;
    pointer-events: none;
    user-select: none;
    white-space: nowrap;
    z-index: 0;
    line-height: 1;
}

/* Projects section "WORK" */
#projects {
    position: relative;
    overflow: hidden;
}

#projects .bg-word {
    bottom: -0.1em;
    right: -0.05em;
    transform: rotate(-4deg);
}

/* About section "BUILD" */
#about {
    position: relative;
    overflow: hidden;
}

#about .bg-word {
    top: 0.1em;
    left: -0.05em;
    transform: rotate(3deg);
    opacity: 0.018;
}

/* Skills section "CODE" */
#skills {
    position: relative;
    overflow: hidden;
}

#skills .bg-word {
    bottom: -0.05em;
    left: -0.05em;
    transform: rotate(-2deg);
    opacity: 0.018;
}

[data-theme="light"] .bg-word {
    opacity: 0.035;
}

/* ------------------------------------------------
   3. OUTLINE/FILL SPLIT TEXT - "Binary."
   ------------------------------------------------ */
.headline-split-wrap {
    position: relative;
    display: inline-block;
    overflow: hidden;
}

/* The SVG clip approach - two overlaid text elements */
.split-svg {
    display: block;
    overflow: visible;
    width: 100%;
    height: auto;
    max-width: 100%;
}

/* ------------------------------------------------
   3. GRADIENT TEXT
   ------------------------------------------------ */
/* Split text effect disabled - using simple gradient */

/* ------------------------------------------------
    4. CONSTELLATION BACKGROUND CANVAS (REMOVED)
    ------------------------------------------------ */

/* ------------------------------------------------
   5. SCANLINE CRT OVERLAY (REMOVED)
   ------------------------------------------------ */

/* ------------------------------------------------
   6. DEPTH FOG - sections fade by scroll distance
   ------------------------------------------------ */
/* JS will set --fog-amount on each section */
section {
    transition: filter 0.3s ease-out;
}

/* ------------------------------------------------
   7. LAVA LAMP BLOBS (REMOVED)
   ------------------------------------------------ */

/* ------------------------------------------------
   8. PROGRESS LINE DRAWING - fixed SVG
   ------------------------------------------------ */
#progress-circuit {
    position: fixed;
    right: 1.5rem;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 300px;
    z-index: 100;
    pointer-events: none;
    opacity: 0.35;
}

#progress-circuit path,
#progress-circuit circle {
    stroke: var(--accent-primary);
    fill: none;
    stroke-linecap: round;
    stroke-linejoin: round;
}

#circuit-path {
    stroke-width: 1.5;
    stroke-dasharray: 1000;
    stroke-dashoffset: 1000;
    transition: stroke-dashoffset 0.1s ease;
}

.circuit-node {
    fill: var(--accent-primary);
    opacity: 0;
    transition: opacity 0.3s ease;
    r: 3;
}

.circuit-node.lit {
    opacity: 1;
}

@media (max-width: 768px) {
    #progress-circuit { display: none; }
    .about-profile-content {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }
}

/* ------------------------------------------------
    9. LOSS LANDSCAPE VISUALIZATION (About section) - CANVAS BASED
    ------------------------------------------------ */
.loss-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: block;
    filter: drop-shadow(0 0 18px rgba(201, 168, 108, 0.28));
}

.loss-landscape {
    position: relative;
    width: 720px;
    height: 460px;
    max-width: 100%;
    margin: 6rem auto 6rem;
    z-index: 1;
    isolation: isolate;
    overflow: visible;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: 16px;
    box-shadow: var(--shadow-base);
}

.loss-landscape .ll-caption {
    position: absolute;
    bottom: -2.5rem;
    left: 0;
    right: 0;
    font-family: var(--font-mono);
    font-size: 0.68rem;
    color: var(--text-secondary);
    opacity: 0.45;
    text-align: center;
    margin-top: 0;
    letter-spacing: 0.08em;
    text-transform: lowercase;
}

.loss-landscape:not(.visible) {
    opacity: 0;
    transform: translateY(15px);
}

[data-theme="light"] .loss-canvas {
    filter: drop-shadow(0 0 15px rgba(90, 74, 48, 0.3));
}

[data-theme="light"] .loss-landscape {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    box-shadow: var(--shadow-base);
}

/* Globe light theme */
[data-theme="light"] #globe-container {
    /* Styles moved to enhancements.css */
}

[data-theme="light"] #globe-canvas {
    opacity: 1;
}

[data-theme="light"] .globe-label {
    opacity: 0.85;
    color: var(--text-primary);
}

[data-theme="light"] #globe-section {
    background: linear-gradient(to bottom, transparent, rgba(235,232,227,0.4));
}


/* ------------------------------------------------
   10. SECTION TRANSITION PARTICLES
   ------------------------------------------------ */
/* Injected via JS - no static CSS needed beyond base */
.divider-particle {
    position: absolute;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: var(--accent-primary);
    pointer-events: none;
    z-index: 500;
    will-change: transform, opacity;
}

/* Make divider a positioning context */
.section-divider {
    position: relative;
    overflow: visible;
}

/* ------------------------------------------------
   11. AVATAR - framed portrait with glow
   ------------------------------------------------ */
/* About section: text + avatar side-by-side */
.about-profile-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 3.5rem;
    margin: 0 auto 4rem;
    text-align: left;
    max-width: 900px;
}

.about-profile-content .large-text {
    flex: 1;
    margin: 0;
}

.avatar-wrap {
    position: relative;
    display: inline-block;
    width: 180px;
    margin: 0;
    padding: 6px 6px 36px 6px;
    background: var(--bg-card);
    box-shadow: var(--shadow-base);
    border: 1px solid var(--border-subtle);
    flex-shrink: 0;
}

/* Ambient glow (REMOVED) */

/* Corner brackets */
.avatar-bracket {
    position: absolute;
    width: 18px;
    height: 18px;
    border-color: var(--accent-primary);
    border-style: solid;
    border-width: 0;
    pointer-events: none;
    z-index: 2;
}
.avatar-bracket--tl { top: -6px; left: -6px; border-top-width: 2px; border-left-width: 2px; }
.avatar-bracket--tr { top: -6px; right: -6px; border-top-width: 2px; border-right-width: 2px; }
.avatar-bracket--bl { bottom: 30px; left: -6px; border-bottom-width: 2px; border-left-width: 2px; }
.avatar-bracket--br { bottom: 30px; right: -6px; border-bottom-width: 2px; border-right-width: 2px; }

.avatar-img {
    width: 100%;
    height: auto;
    object-fit: cover;
    display: block;
    transition: filter 0.4s ease;
}

/* Scan lines overlay on hover */
.avatar-wrap:hover .avatar-img {
    filter: brightness(1.05);
}
.avatar-wrap::after {
    content: '';
    position: absolute;
    top: 6px;
    left: 6px;
    right: 6px;
    bottom: 36px;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 3px,
        rgba(201, 168, 108, 0.04) 3px,
        rgba(201, 168, 108, 0.04) 4px
    );
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.4s ease;
    z-index: 10;
}
.avatar-wrap:hover::after {
    opacity: 1;
}

/* Code label in polaroid bottom */
.avatar-label {
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    font-family: var(--font-mono);
    font-size: 0.62rem;
    color: var(--text-secondary);
    white-space: nowrap;
    letter-spacing: 0.04em;
    opacity: 0.6;
}

/* Avatar placeholder (when no real photo) */
.avatar-placeholder {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: radial-gradient(
        circle at 35% 35%,
        rgba(201,168,108,0.3),
        rgba(26,24,22,0.8) 70%
    );
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-mono);
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--accent-primary);
    letter-spacing: 0.05em;
    filter: none;
}

/* Avatar in about section header */
.about-header {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    justify-content: center;
}

/* ------------------------------------------------
    12. LIVE TOKENIZER HERO
    ------------------------------------------------ */
.tokenizer-wrapper {
    display: inline-block;
    position: relative;
    cursor: pointer;
    vertical-align: baseline;
    line-height: inherit;
    z-index: 3;
    /* Removed padding to fix spacing between split tokens */
}

/* Prevent descender clipping on "Binary." */
.tokenizer-wrapper.is-accent {
    line-height: 1.25;
    padding-bottom: 0.08em;
}

.tokenizer-wrapper .token-char {
    display: inline-block;
    transition: transform 0.6s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.4s ease, color 0.3s ease;
    pointer-events: none;
    position: relative;
    z-index: 5;
    /* Inherit everything except for specific overrides */
    color: inherit;
    -webkit-text-fill-color: inherit;
    background: inherit;
    -webkit-background-clip: inherit;
    background-clip: inherit;
}

/* Specific fix for tokens inside .accent-text */
.tokenizer-wrapper.is-accent .token-char {
    background: linear-gradient(135deg, var(--accent-primary) 0%, var(--accent-warm) 100%) !important;
    -webkit-background-clip: text !important;
    background-clip: text !important;
    -webkit-text-fill-color: transparent !important;
    color: transparent !important;
}

.tokenizer-wrapper.scattered .token-char {
    opacity: 0.2;
    transform: translate(var(--tx), var(--ty)) rotate(var(--rot));
    /* Switch to solid color on hover for revealed ID contrast */
    color: var(--text-primary);
    -webkit-text-fill-color: var(--text-primary) !important;
    background: none !important;
    -webkit-background-clip: unset !important;
    background-clip: unset !important;
}

.tokenizer-wrapper.settling .token-char {
    transform: translate(0, 0) rotate(0deg);
    opacity: 1;
}

.tokenizer-wrapper .token-id-display {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.6);
    font-family: var(--font-mono);
    font-size: clamp(0.9rem, 1.5vw, 1.3rem);
    color: #a0b8c8;
    -webkit-text-fill-color: #a0b8c8; /* Fix for inheritance from .accent-text */
    font-weight: 900;
    opacity: 0;
    pointer-events: none;
    z-index: 1;
    transition: opacity 0.4s ease, transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    white-space: nowrap;
    letter-spacing: 0.02em;
}

.tokenizer-wrapper.scattered .token-id-display {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

/* Light theme adjustments */
[data-theme="light"] .tokenizer-wrapper.scattered .token-id-display {
    text-shadow: none;
    background: rgba(245, 242, 237, 0.9);
    padding: 0 4px;
    border-radius: 4px;
}


/* End of Tokenizer Hero */

/* ------------------------------------------------
    13. NEURAL PULSE SECTION DIVIDERS (Disabled)
    ------------------------------------------------ */

/* ------------------------------------------------
    14. ARCHITECTURE NAVIGATION STACK (Disabled)
    ------------------------------------------------ */

/* ------------------------------------------------
    REDUCED MOTION
    ------------------------------------------------ */
@media (prefers-reduced-motion: reduce) {
    @keyframes font-breathe { 0%, 100% { font-variation-settings: 'wght' 600; } }
    .tf-arrow.active { animation: none !important; }
    .avatar-wrap::after { animation: none !important; }
    .neural-pulse-dot { animation: none !important; }
    .neural-divider.glyph-pulse .divider-glyph { animation: none !important; }
    .tokenizer-wrapper .token-char { animation: none !important; }
}
