/* ═══════════════════════════════════════════════
   BELLUCCI | COMPONENTS — WIP Fixes
   DA: monochrome, glassmorphism focus on tiles
   ═══════════════════════════════════════════════ */

/* ══════════════════════════════════════════════
   CHARACTER TILE — glassmorphism focus system
   Default: heavily desaturated + blurred
   Hover:   sharp + exposed
══════════════════════════════════════════════ */
.char-tile {
    position: relative;
    width: 100px;
    height: 100px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.08);
    overflow: hidden;
    cursor: none;
    clip-path: polygon(8px 0, calc(100% - 8px) 0,
            100% 8px, 100% calc(100% - 8px),
            calc(100% - 8px) 100%, 8px 100%,
            0 calc(100% - 8px), 0 8px);
    /* Awwwards: filter + scale on the tile itself, GPU-accelerated */
    transition:
        filter 0.55s cubic-bezier(0.16, 1, 0.3, 1),
        transform 0.55s cubic-bezier(0.16, 1, 0.3, 1),
        border-color 0.4s ease,
        box-shadow 0.5s ease;
    will-change: filter, transform;
}

/* Video / image preview — desaturated by default */
.tile-preview {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0.5;
    filter: grayscale(100%) blur(1px) brightness(0.55);
    transition:
        opacity 0.45s cubic-bezier(0.16, 1, 0.3, 1),
        filter 0.45s cubic-bezier(0.16, 1, 0.3, 1);
    z-index: 1;
}

.tile-content {
    position: absolute;
    inset: 0;
    background-size: cover;
    background-position: center;
    opacity: 0.5;
    filter: grayscale(100%) blur(1px) brightness(0.55);
    transition:
        opacity 0.45s cubic-bezier(0.16, 1, 0.3, 1),
        filter 0.45s cubic-bezier(0.16, 1, 0.3, 1);
    z-index: 1;
}

/* Tile label */
.tile-info {
    position: absolute;
    bottom: 5px;
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
    opacity: 0;
    transition: opacity 0.3s;
    z-index: 8;
    white-space: nowrap;
}

.tile-id {
    display: none;
}

.tile-name {
    font-family: var(--font-tech);
    font-size: 10px;
    /* FIX: Increased from 6px */
    letter-spacing: 0.12em;
    color: rgba(255, 255, 255, 0.9);
    text-transform: uppercase;
    font-weight: 600;
}

/* ── AWWWARDS FOCUS SYSTEM ───────────────────────────────────────────────────
   :has() lets siblings know a peer is focused.
   Non-focused siblings → blur + darken + shrink.
   Active tile → sharp + bright + lift + halo.
─────────────────────────────────────────────────────────────────────────────── */

/* Siblings: blur + darken + shrink when any tile is active */
.grid-container:has(.focused) .char-tile:not(.focused),
.grid-container:has(.char-tile:hover) .char-tile:not(:hover):not(.focused) {
    filter: blur(3.5px) brightness(0.28) saturate(0.3);
    transform: scale(0.93);
}

/* Active tile: lift + sharpen */
.char-tile:hover,
.char-tile.focused {
    transform: scale(1.05);
    border-color: rgba(255, 255, 255, 0.35);
    box-shadow:
        0 0 0 1px rgba(255, 255, 255, 0.07),
        0 10px 40px rgba(0, 0, 0, 0.65),
        inset 0 0 24px rgba(255, 255, 255, 0.025);
    z-index: 5;
}

/* Tile label visible on active */
.char-tile:hover .tile-info,
.char-tile.focused .tile-info {
    opacity: 1;
}

/* Video / content: unblurred inside the active tile */
.char-tile:hover .tile-preview,
.char-tile.focused .tile-preview {
    opacity: 1;
    filter: grayscale(0%) brightness(1.05);
}

.char-tile:hover .tile-content,
.char-tile.focused .tile-content {
    opacity: 1;
    filter: grayscale(0%) brightness(1.05);
}


.char-tile.sel {
    border-color: rgba(255, 255, 255, 0.6);
}

.char-tile.sel::after {
    content: '';
    position: absolute;
    top: 4px;
    left: 4px;
    width: 10px;
    height: 10px;
    border-top: 1px solid rgba(255, 255, 255, 0.75);
    border-left: 1px solid rgba(255, 255, 255, 0.75);
    z-index: 9;
    pointer-events: none;
}

/* ── LOCKED — glitch on hover, doesn't lift ── */
.char-tile.locked:hover {
    animation: glitch 0.25s steps(2);
    transform: scale(1);
    /* overrides the lift */
    box-shadow: none;
}

.lock-text {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    z-index: 2;
}

.lt1 {
    font-family: var(--font-tech);
    font-size: 9px;
    /* FIX: Increased from 7px */
    letter-spacing: 0.08em;
    color: rgba(255, 255, 255, 0.8);
    /* Increased visibility */
    text-shadow: 0 0 5px rgba(255, 255, 255, 0.2);
    font-weight: bold;
}

.lt2 {
    font-family: var(--font-tech);
    font-size: 8px;
    /* FIX: Increased from 6px */
    letter-spacing: 0.14em;
    color: rgba(255, 255, 255, 0.6);
    /* Increased visibility */
}

.file-label {
    position: absolute;
    bottom: 10px;
    left: 0;
    width: 100%;
    text-align: center;
    font-family: var(--font-tech);
    font-size: 10px;
    /* FIX: Increased from 9px */
    letter-spacing: 0.1em;
    color: rgba(255, 255, 255, 0.9);
    opacity: 0;
    /* Hidden by default, shown on hover/interactions if needed, or always? User said "each tile represents a file", implied visible. */
    opacity: 1;
    z-index: 5;
    text-shadow: 0 0 8px rgba(0, 0, 0, 0.8);
    pointer-events: none;
}


/* ══════════════════════════════════════════════
   TERMINAL / PROJECT VIEW
══════════════════════════════════════════════ */
.terminal-container {
    width: 100%;
    font-family: var(--font-tech);
    font-size: 11px;
    line-height: 1.9;
    color: rgba(255, 255, 255, 0.55);
    padding: 20px 0;
    border-left: 1px solid rgba(255, 255, 255, 0.15);
    padding-left: 20px;
}

.terminal-line {
    display: flex;
    align-items: center;
    margin-bottom: 2px;
    color: rgba(255, 255, 255, 0.55);
}

.terminal-line::before {
    content: '›';
    margin-right: 10px;
    color: rgba(255, 255, 255, 0.2);
    flex-shrink: 0;
}

.terminal-target-name {
    font-family: var(--font-display);
    font-weight: 800;
    font-size: clamp(40px, 5vw, 80px);
    color: #fff;
    line-height: 0.9;
    letter-spacing: 0.04em;
    margin-top: 24px;
    opacity: 0;
    transform: translateY(20px);
    text-transform: uppercase;
}


/* ══════════════════════════════════════════════
   #WHO-BOX — PROFILE TOOLTIP
   Awwwards grade: clip-path hexagonal, parchment open
══════════════════════════════════════════════ */
#who-box {
    position: fixed;
    bottom: 80px;
    left: 48px;
    width: 440px;
    max-width: 90vw;
    background: linear-gradient(135deg,
            rgba(10, 10, 15, 0.98) 0%,
            rgba(5, 5, 10, 0.98) 100%);
    border: 1px solid var(--white-30);
    padding: 28px;
    padding-top: 30px;
    opacity: 0;
    pointer-events: none;
    box-shadow:
        0 20px 60px rgba(0, 0, 0, 0.8),
        0 0 1px rgba(255, 255, 255, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.06);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    z-index: 200;
    display: none;
    clip-path: polygon(12px 0, calc(100% - 12px) 0,
            100% 12px, 100% calc(100% - 12px),
            calc(100% - 12px) 100%, 12px 100%,
            0 calc(100% - 12px), 0 12px);
}

/* Inner subtle border */
#who-box::before {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    right: 2px;
    bottom: 2px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    pointer-events: none;
    clip-path: polygon(10px 0, calc(100% - 10px) 0,
            100% 10px, 100% calc(100% - 10px),
            calc(100% - 10px) 100%, 10px 100%,
            0 calc(100% - 10px), 0 10px);
}

/* Top accent line */
#who-box::after {
    content: '';
    position: absolute;
    top: 0;
    left: 20%;
    width: 60%;
    height: 1px;
    background: linear-gradient(90deg, transparent 0%,
            rgba(255, 255, 255, 0.55) 50%,
            transparent 100%);
    pointer-events: none;
}

/* ── WHO-BOX (Profile Panel) — 3D Glassmorphism ── */
#who-box {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 90%;
    max-width: 480px;
    background: rgba(10, 10, 10, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 40px 80px rgba(0, 0, 0, 0.8),
        0 0 0 1px rgba(255, 255, 255, 0.05);
    z-index: 50;
    padding: 40px;
    backdrop-filter: blur(16px);
    clip-path: inset(0 100% 0 0);
    /* Start hidden for GSAP reveal */
}

/* Inner subtle border */
#who-box::before {
    content: '';
    position: absolute;
    inset: 4px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    pointer-events: none;
}

/* Top accent line */
#who-box::after {
    content: '';
    position: absolute;
    top: 0;
    left: 20%;
    width: 60%;
    height: 1px;
    background: linear-gradient(90deg, transparent 0%, rgba(255, 255, 255, 0.55) 50%, transparent 100%);
    pointer-events: none;
}

#who-box.on {
    opacity: 1;
    pointer-events: all;
    /* Animation handled by GSAP in ui.js */
}

/* Close button - FIX: Larger touch target */
#who-close {
    position: absolute;
    top: 0;
    right: 0;
    width: 44px;
    /* FIX: Increased from 26px */
    height: 44px;
    /* FIX: Increased from 26px */
    padding: 10px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--white-30);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    /* FIX: Increased from 13px */
    color: var(--white-30);
    cursor: none;
    transition: all 0.3s;
    line-height: 1;
    user-select: none;
}

#who-close:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--white-60);
    color: #fff;
}

/* Content */
.wb-name {
    font-family: var(--font-display);
    font-weight: 800;
    font-size: 13px;
    letter-spacing: 0.4em;
    margin-bottom: 4px;
    color: rgba(255, 255, 255, 0.95);
    border-bottom: 1px solid var(--white-10);
    padding-bottom: 10px;
    text-transform: uppercase;
    /* Variable font — hover handled by JS */
    transition: font-variation-settings 0.4s;
}

.wb-role {
    font-family: var(--font-tech);
    font-size: 8px;
    letter-spacing: 0.22em;
    color: var(--white-30);
    margin: 8px 0 14px;
    text-transform: uppercase;
}

.wb-p {
    font-family: var(--font-tech);
    font-size: 10px;
    line-height: 1.9;
    color: rgba(200, 200, 200, 0.7);
    font-weight: 300;
    margin-bottom: 12px;
}

/* Stat bars */
.wb-stats {
    margin-top: 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.wb-stat-row {
    display: flex;
    justify-content: space-between;
    font-family: var(--font-tech);
    font-size: 8px;
    letter-spacing: 0.15em;
    color: var(--white-30);
    margin-bottom: 4px;
}

.wb-stat-bar {
    height: 1px;
    background: rgba(255, 255, 255, 0.08);
}

.wb-stat-fill {
    height: 100%;
    background: rgba(255, 255, 255, 0.65);
    width: 0%;
    transition: width 1.2s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 0 8px rgba(255, 255, 255, 0.2);
}

/* Tags */
.wb-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid var(--white-10);
}

.wb-tag {
    font-family: var(--font-tech);
    font-size: 8px;
    letter-spacing: 0.15em;
    padding: 5px 9px;
    background: var(--white-05);
    border: 1px solid var(--white-30);
    color: var(--white-30);
    cursor: none;
    transition: all 0.3s ease;
    text-transform: uppercase;
    clip-path: polygon(4px 0, calc(100% - 4px) 0,
            100% 4px, 100% calc(100% - 4px),
            calc(100% - 4px) 100%, 4px 100%,
            0 calc(100% - 4px), 0 4px);
}

.wb-tag:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--white-60);
    color: #fff;
    transform: translateY(-2px);
}


/* ══════════════════════════════════════════════
   CURSOR SYSTEM — minimalist Awwwards
   Dot: 5px diamond (rotated square)
   Ring: 4 corner brackets via multi-gradient
══════════════════════════════════════════════ */
#cur {
    position: fixed;
    width: 5px;
    height: 5px;
    background: #fff;
    pointer-events: none;
    z-index: 9999;
    transform: translate(-50%, -50%) rotate(45deg);
    mix-blend-mode: difference;
    transition: width 0.2s, height 0.2s;
}

/* Corner bracket ring — 8 gradients = 4 × (vertical + horizontal arm) */
#cur-ring {
    position: fixed;
    width: 22px;
    height: 22px;
    pointer-events: none;
    z-index: 9998;
    transform: translate(-50%, -50%);
    background:
        linear-gradient(#fff, #fff) top left / 1px 7px no-repeat,
        linear-gradient(#fff, #fff) top left / 7px 1px no-repeat,
        linear-gradient(#fff, #fff) top right / 1px 7px no-repeat,
        linear-gradient(#fff, #fff) top right / 7px 1px no-repeat,
        linear-gradient(#fff, #fff) bottom left / 1px 7px no-repeat,
        linear-gradient(#fff, #fff) bottom left / 7px 1px no-repeat,
        linear-gradient(#fff, #fff) bottom right / 1px 7px no-repeat,
        linear-gradient(#fff, #fff) bottom right / 7px 1px no-repeat;
    mix-blend-mode: difference;
    opacity: 0.7;
    transition:
        width 0.45s cubic-bezier(0.16, 1, 0.3, 1),
        height 0.45s cubic-bezier(0.16, 1, 0.3, 1),
        opacity 0.3s,
        transform 0.45s cubic-bezier(0.16, 1, 0.3, 1);
}

body.h #cur-ring {
    width: 38px;
    height: 38px;
    opacity: 0.9;
}

body.h-project #cur-ring {
    width: 54px;
    height: 54px;
    opacity: 1;
    transform: translate(-50%, -50%) rotate(4deg);
}

#cur-label {
    position: fixed;
    pointer-events: none;
    z-index: 10000;
    font-family: var(--font-tech);
    font-size: 7px;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.65);
    opacity: 0;
    transition: opacity 0.3s;
    white-space: nowrap;
}

#cur-label.on {
    opacity: 1;
}


/* ══════════════════════════════════════════════
   HOLD LOADER — track + fill
══════════════════════════════════════════════ */
#hold-loader {
    position: fixed;
    pointer-events: none;
    z-index: 9997;
    display: none;
    width: 60px;
    height: 60px;
    transform: translate(-50%, -50%);
}

#hold-loader svg {
    transform: rotate(-90deg);
}

.hr-track {
    fill: none;
    stroke: rgba(255, 255, 255, 0.1);
    stroke-width: 1.5;
}

.hr-fill {
    fill: none;
    stroke: rgba(255, 255, 255, 0.9);
    stroke-width: 1.5;
    stroke-dasharray: 283;
    stroke-dashoffset: 283;
    filter: drop-shadow(0 0 4px rgba(255, 255, 255, 0.45));
}