/* ========================================
   persona.quest - Translucent Frost Design
   ======================================== */

/* --- Reset & Base --- */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --deep-bg: #0a0e1a;
    --bokeh-warm: #f5a623;
    --bokeh-cool: #00e5ff;
    --frost-surface: #1a2744;
    --frost-highlight: #e8edf5;
    --text-primary: #cdd5e0;
    --text-secondary: #8892a8;
    --accent-active: #00d4aa;
    --accent-hover: #ff6b9d;
    --border-divider: #2a3a5c;
    --tile-bg: rgba(20, 28, 48, 0.55);
    --spring-bezier: cubic-bezier(0.34, 1.56, 0.64, 1);
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    background-color: var(--deep-bg);
    color: var(--text-primary);
    font-family: 'Inter', sans-serif;
    font-weight: 400;
    line-height: 1.7;
    overflow-x: hidden;
    min-height: 100vh;
}

/* --- Bokeh Background --- */
#bokeh-background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
    overflow: hidden;
}

.bokeh-circle {
    position: absolute;
    border-radius: 50%;
    filter: blur(1px);
    will-change: transform;
}

/* --- Particle Canvas --- */
#particle-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2;
    pointer-events: none;
}

/* --- Navigation Bar --- */
#nav-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 48px;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 30px;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    background: rgba(10, 14, 26, 0.5);
    border-bottom: 1px solid rgba(42, 58, 92, 0.3);
    opacity: 0;
    transition: opacity 0.8s ease;
}

#nav-bar.visible {
    opacity: 1;
}

.nav-title {
    font-family: 'Barlow Condensed', sans-serif;
    font-weight: 600;
    font-size: 0.9rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--frost-highlight);
}

.nav-dots {
    display: flex;
    gap: 10px;
    align-items: center;
}

.nav-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-secondary);
    cursor: pointer;
    transition: all 0.3s var(--spring-bezier);
}

.nav-dot.active {
    background: var(--accent-active);
    box-shadow: 0 0 8px rgba(0, 212, 170, 0.5);
}

.nav-dot:hover {
    background: var(--accent-hover);
    transform: scale(1.3);
}

/* --- Hero Section --- */
#hero {
    position: relative;
    z-index: 3;
    width: 100%;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

#title-container {
    display: flex;
    align-items: baseline;
    gap: 0;
    user-select: none;
}

#title-persona,
#title-quest {
    font-family: 'Barlow Condensed', sans-serif;
    font-weight: 600;
    font-size: clamp(3rem, 10vw, 8rem);
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--frost-highlight);
    text-shadow: 0 0 40px rgba(0, 229, 255, 0.3), 0 0 80px rgba(0, 229, 255, 0.1);
    transition: transform 1.2s var(--spring-bezier), opacity 0.8s ease;
}

#title-dot {
    font-family: 'Barlow Condensed', sans-serif;
    font-weight: 600;
    font-size: clamp(3rem, 10vw, 8rem);
    color: var(--accent-active);
    text-shadow: 0 0 30px rgba(0, 212, 170, 0.4);
    transition: opacity 0.6s ease;
}

#title-container.split #title-persona {
    transform: translateX(-8vw);
}

#title-container.split #title-quest {
    transform: translateX(8vw);
}

#title-container.split #title-dot {
    opacity: 0;
}

/* --- Masonry Container --- */
#masonry-container {
    position: relative;
    z-index: 3;
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px 20px 100px;
    column-count: 3;
    column-gap: 20px;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.8s ease, transform 0.8s ease;
}

#masonry-container.visible {
    opacity: 1;
    transform: translateY(0);
}

/* --- Masonry Tiles --- */
.masonry-tile {
    break-inside: avoid;
    margin-bottom: 20px;
    position: relative;
    background: var(--tile-bg);
    backdrop-filter: blur(12px) saturate(140%);
    -webkit-backdrop-filter: blur(12px) saturate(140%);
    border: 1px solid rgba(42, 58, 92, 0.4);
    border-radius: 8px;
    padding: 24px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s var(--spring-bezier);
}

.masonry-tile:hover {
    border-color: rgba(0, 212, 170, 0.3);
    box-shadow: 0 4px 30px rgba(0, 212, 170, 0.08), inset 0 0 30px rgba(0, 229, 255, 0.03);
}

/* Tile size variants */
.masonry-tile.tall {
    min-height: 280px;
}

.masonry-tile.short {
    min-height: 180px;
}

.masonry-tile.wide {
    column-span: none;
}

/* --- Mask Motifs --- */
.mask-motif {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 80%;
    height: 80%;
    color: var(--border-divider);
    opacity: 0.3;
    z-index: 0;
    pointer-events: none;
    transition: opacity 0.8s ease;
}

.mask-motif path,
.mask-motif circle,
.mask-motif rect,
.mask-motif line {
    stroke-dasharray: 1000;
    stroke-dashoffset: 0;
    transition: stroke-dashoffset 0.8s ease, stroke 0.4s ease;
}

.masonry-tile[data-level="1"] .mask-motif,
.masonry-tile[data-level="2"] .mask-motif {
    opacity: 0.7;
    color: var(--accent-active);
}

.masonry-tile[data-level="1"] .mask-motif path,
.masonry-tile[data-level="1"] .mask-motif circle,
.masonry-tile[data-level="1"] .mask-motif rect,
.masonry-tile[data-level="1"] .mask-motif line,
.masonry-tile[data-level="2"] .mask-motif path,
.masonry-tile[data-level="2"] .mask-motif circle,
.masonry-tile[data-level="2"] .mask-motif rect,
.masonry-tile[data-level="2"] .mask-motif line {
    stroke: var(--accent-active);
}

/* --- Tile Header --- */
.tile-header {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0;
}

.tile-title {
    font-family: 'Barlow Condensed', sans-serif;
    font-weight: 600;
    font-size: clamp(1.4rem, 3vw, 2.8rem);
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--frost-highlight);
    line-height: 1.2;
}

.depth-indicator {
    font-family: 'Fira Code', monospace;
    font-size: 0.75rem;
    color: var(--text-secondary);
    background: rgba(42, 58, 92, 0.5);
    padding: 3px 10px;
    border-radius: 20px;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    white-space: nowrap;
    flex-shrink: 0;
}

/* --- Tile Content Levels --- */
.tile-level1,
.tile-level2 {
    position: relative;
    z-index: 1;
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: max-height 0.5s var(--spring-bezier), opacity 0.4s ease, margin-top 0.3s ease;
}

.masonry-tile[data-level="1"] .tile-level1,
.masonry-tile[data-level="2"] .tile-level1 {
    max-height: 200px;
    opacity: 1;
    margin-top: 16px;
}

.masonry-tile[data-level="2"] .tile-level2 {
    max-height: 600px;
    opacity: 1;
    margin-top: 16px;
}

.tile-level1 p,
.tile-level2 p {
    font-family: 'Inter', sans-serif;
    font-weight: 400;
    font-size: clamp(0.9rem, 1.5vw, 1.05rem);
    line-height: 1.7;
    color: var(--text-primary);
    margin-bottom: 12px;
}

.tile-level2 p em {
    font-style: italic;
    color: var(--accent-active);
}

/* --- Code Snippets --- */
.code-snippet {
    display: block;
    font-family: 'Fira Code', monospace;
    font-size: 0.85rem;
    line-height: 1.6;
    color: var(--accent-active);
    background: rgba(10, 14, 26, 0.7);
    border: 1px solid rgba(42, 58, 92, 0.5);
    border-radius: 6px;
    padding: 14px 18px;
    margin-top: 12px;
    overflow-x: auto;
    white-space: pre-wrap;
    word-break: break-word;
}

/* --- Persona Cards --- */
.persona-card {
    width: 120px;
    height: 160px;
    perspective: 600px;
    cursor: pointer;
    margin: 16px 0;
    display: inline-block;
}

.persona-card .card-front,
.persona-card .card-back {
    position: absolute;
    width: 120px;
    height: 160px;
    border-radius: 8px;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    transition: transform 0.6s var(--spring-bezier);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 12px;
}

.persona-card .card-front {
    background: rgba(26, 39, 68, 0.7);
    border: 2px solid transparent;
    background-clip: padding-box;
    position: relative;
}

.persona-card .card-front::before {
    content: '';
    position: absolute;
    inset: -2px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--bokeh-cool), var(--accent-hover));
    z-index: -1;
}

.persona-card .card-back {
    background: rgba(26, 39, 68, 0.85);
    border: 2px solid var(--accent-active);
    transform: rotateY(180deg);
    text-align: center;
}

.persona-card[data-flipped="true"] .card-front {
    transform: rotateY(180deg);
}

.persona-card[data-flipped="true"] .card-back {
    transform: rotateY(0deg);
}

.card-mask {
    width: 60px;
    height: 75px;
    color: var(--bokeh-cool);
}

.card-label {
    font-family: 'Noto Sans JP', sans-serif;
    font-weight: 300;
    font-size: 1.1rem;
    color: var(--accent-active);
    margin-bottom: 6px;
    display: block;
}

.card-back p {
    font-family: 'Inter', sans-serif;
    font-size: 0.7rem;
    line-height: 1.4;
    color: var(--text-secondary);
}

/* --- Column Hairline (proximity-revealed) --- */
.column-hairline {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 2px;
    background: rgba(0, 229, 255, 0.15);
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
    z-index: 1;
}

.column-hairline.visible {
    opacity: 1;
}

/* --- Depth Indicator Updates --- */
.masonry-tile[data-level="1"] .depth-indicator,
.masonry-tile[data-level="2"] .depth-indicator {
    color: var(--accent-active);
    background: rgba(0, 212, 170, 0.15);
}

/* --- Responsive --- */
@media (max-width: 1024px) {
    #masonry-container {
        column-count: 2;
    }

    #title-persona,
    #title-quest,
    #title-dot {
        font-size: clamp(2.5rem, 8vw, 5rem);
    }

    #title-container.split #title-persona {
        transform: translateX(-5vw);
    }

    #title-container.split #title-quest {
        transform: translateX(5vw);
    }
}

@media (max-width: 640px) {
    #masonry-container {
        column-count: 1;
        padding: 16px 16px 80px;
    }

    #title-persona,
    #title-quest,
    #title-dot {
        font-size: clamp(2rem, 12vw, 3.5rem);
    }

    #title-container.split #title-persona {
        transform: translateX(-3vw);
    }

    #title-container.split #title-quest {
        transform: translateX(3vw);
    }

    .masonry-tile {
        padding: 20px;
    }

    .tile-title {
        font-size: clamp(1.2rem, 5vw, 1.6rem);
    }
}

/* --- Scrollbar Styling --- */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: var(--deep-bg);
}

::-webkit-scrollbar-thumb {
    background: var(--border-divider);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

/* --- Selection --- */
::selection {
    background: rgba(0, 212, 170, 0.3);
    color: var(--frost-highlight);
}
