/* ==========================================================
   telomere.digital — styles
   Muji aesthetic / dreamy-ethereal / muted vintage palette
   ========================================================== */

/* ---- CSS Custom Properties ---- */
:root {
    --bg: #F4EDE4;
    --text-primary: #3D3632;
    --text-secondary: #8B7E6E;
    --accent-warm: #C4896A;
    --accent-cool: #7E9AA7;
    --accent-muted: #A68E9B;
    --border: #C4B7A6;
    --deep-ground: #2A2520;
    --ease-out-cubic: cubic-bezier(0.33, 1, 0.68, 1);
    --gutter: 2vw;
}

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

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

body {
    background-color: var(--bg);
    color: var(--text-primary);
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-weight: 400;
    line-height: 1.85;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

/* ---- Fog Overlay ---- */
#fog-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    z-index: 100;
    pointer-events: none;
    background-color: var(--bg);
    transition: transform 1.2s var(--ease-out-cubic), opacity 0.8s var(--ease-out-cubic);
}

#fog-overlay.fog-lifted {
    transform: translateY(-50vh);
    opacity: 0;
    pointer-events: none;
}

.fog-layer {
    position: absolute;
    border-radius: 50%;
    background: radial-gradient(ellipse at center, rgba(196, 183, 166, 0.12) 0%, transparent 70%);
}

.fog-layer-1 {
    width: 60vw;
    height: 60vh;
    top: 10%;
    left: -10%;
    animation: fogDrift1 8s ease-in-out infinite alternate;
}

.fog-layer-2 {
    width: 50vw;
    height: 50vh;
    top: 25%;
    right: -5%;
    animation: fogDrift2 10s ease-in-out infinite alternate;
}

.fog-layer-3 {
    width: 70vw;
    height: 40vh;
    top: 40%;
    left: 15%;
    animation: fogDrift3 12s ease-in-out infinite alternate;
}

.fog-layer-4 {
    width: 45vw;
    height: 55vh;
    top: 5%;
    right: 20%;
    animation: fogDrift4 9s ease-in-out infinite alternate;
}

.fog-layer-5 {
    width: 55vw;
    height: 35vh;
    bottom: 10%;
    left: 25%;
    animation: fogDrift5 11s ease-in-out infinite alternate;
}

@keyframes fogDrift1 {
    0% { transform: translate(0, 0) scale(1); }
    100% { transform: translate(5vw, 3vh) scale(1.1); }
}

@keyframes fogDrift2 {
    0% { transform: translate(0, 0) scale(1.05); }
    100% { transform: translate(-4vw, 5vh) scale(0.95); }
}

@keyframes fogDrift3 {
    0% { transform: translate(0, 0) scale(0.9); }
    100% { transform: translate(6vw, -4vh) scale(1.1); }
}

@keyframes fogDrift4 {
    0% { transform: translate(0, 0) scale(1); }
    100% { transform: translate(-3vw, 6vh) scale(1.08); }
}

@keyframes fogDrift5 {
    0% { transform: translate(0, 0) scale(1.05); }
    100% { transform: translate(4vw, -3vh) scale(0.92); }
}

/* ---- Floating Header Zone ---- */
#site-header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 15vh;
    display: flex;
    align-items: center;
    padding-left: 3vw;
    z-index: 200;
    pointer-events: none;
}

.site-title {
    font-family: 'Josefin Sans', sans-serif;
    font-weight: 300;
    font-size: clamp(2.2rem, 5vw, 4.5rem);
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--text-primary);
    opacity: 0;
    transition: opacity 1.2s var(--ease-out-cubic);
}

.site-title.visible {
    opacity: 1;
}

.title-dot {
    color: var(--accent-warm);
}

/* ---- Scroll Hint ---- */
#scroll-hint {
    position: fixed;
    bottom: 5vh;
    left: 50%;
    transform: translateX(-50%);
    z-index: 200;
    opacity: 0;
    transition: opacity 1s var(--ease-out-cubic);
    pointer-events: none;
}

#scroll-hint.visible {
    opacity: 0.3;
}

#scroll-hint.hidden {
    opacity: 0;
}

.scroll-hint-text {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 300;
    font-size: 0.65rem;
    letter-spacing: 0.08em;
    color: var(--text-secondary);
}

/* ---- Telomere Length Bar ---- */
#telomere-bar {
    position: fixed;
    top: 0;
    right: 0;
    width: 2px;
    height: 100vh;
    background-color: var(--accent-warm);
    z-index: 150;
    transform-origin: top;
    transition: transform 0.1s linear;
}

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

.particle {
    position: absolute;
    width: 3px;
    height: 3px;
    border-radius: 50%;
    opacity: 0.35;
    pointer-events: none;
}

.particle-warm {
    background-color: var(--accent-warm);
}

.particle-cool {
    background-color: var(--accent-cool);
}

/* ---- Masonry Grid ---- */
#masonry-grid {
    padding: 20vh 3vw 10vh;
    column-count: 3;
    column-gap: var(--gutter);
    position: relative;
    z-index: 10;
}

/* ---- Masonry Items ---- */
.masonry-item {
    break-inside: avoid;
    margin-bottom: var(--gutter);
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.6s var(--ease-out-cubic), transform 0.6s var(--ease-out-cubic);
}

.masonry-item.revealed {
    opacity: 1;
    transform: translateY(0);
}

/* Drift items - terminal dissolution */
.drift-item.revealed {
    opacity: var(--drift-opacity, 1);
}

/* ---- Item Types ---- */

/* Statement blocks */
.item-statement {
    padding: 2.5rem 2rem;
}

.item-statement .item-label {
    display: block;
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 300;
    font-size: 0.7rem;
    letter-spacing: 0.08em;
    color: var(--text-secondary);
    opacity: 0.5;
    margin-bottom: 1.2rem;
}

.statement-text {
    font-family: 'Josefin Sans', sans-serif;
    font-weight: 300;
    font-size: clamp(1.1rem, 2.5vw, 1.8rem);
    letter-spacing: 0.05em;
    line-height: 1.6;
    color: var(--text-primary);
}

/* Dark variant */
.item-dark {
    background-color: var(--deep-ground);
    padding: 2.5rem 2rem;
}

.label-light {
    color: var(--border) !important;
}

.statement-light {
    color: var(--bg);
}

/* Ridgeline blocks */
.item-ridgeline {
    overflow: hidden;
    min-height: 80px;
}

.ridgeline-svg {
    width: 100%;
    height: auto;
    display: block;
}

/* Wide items span visual width */
.item-wide {
    column-span: none;
}

/* Tall items */
.item-tall {
    min-height: 320px;
}

/* Microscopy texture */
.item-microscopy {
    position: relative;
    min-height: 200px;
    overflow: hidden;
    background-color: rgba(244, 237, 228, 0.5);
}

.microscopy-field {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.microscopy-dot {
    position: absolute;
    border-radius: 50%;
}

.label-overlay {
    position: absolute;
    bottom: 1rem;
    left: 1rem;
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 300;
    font-size: 0.7rem;
    letter-spacing: 0.08em;
    color: var(--text-secondary);
    opacity: 0.5;
}

/* Body text blocks */
.item-text {
    padding: 2rem 1.8rem;
}

.body-text {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-weight: 400;
    font-size: 1.05rem;
    line-height: 1.85;
    color: var(--text-primary);
}

.item-text .item-label {
    display: block;
    margin-top: 1rem;
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 300;
    font-size: 0.7rem;
    letter-spacing: 0.08em;
    color: var(--text-secondary);
    opacity: 0.5;
}

/* Chromosome blocks */
.item-chromosome {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    position: relative;
}

.chromosome-svg {
    width: 60%;
    height: auto;
    max-width: 160px;
}

.item-chromosome .item-label {
    display: block;
    margin-top: 1.5rem;
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 300;
    font-size: 0.7rem;
    letter-spacing: 0.08em;
    color: var(--text-secondary);
    opacity: 0.5;
    text-align: center;
}

/* Data fragment blocks */
.item-data {
    padding: 1.8rem;
    border: 1px solid rgba(196, 183, 166, 0.3);
}

.data-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding: 0.4rem 0;
    border-bottom: 1px solid rgba(196, 183, 166, 0.15);
}

.data-row:last-child {
    border-bottom: none;
}

.data-key {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 300;
    font-size: 0.7rem;
    letter-spacing: 0.08em;
    color: var(--text-secondary);
    opacity: 0.5;
}

.data-val {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 400;
    font-size: 0.75rem;
    letter-spacing: 0.04em;
    color: var(--text-primary);
}

/* Vertical text blocks */
.item-vertical {
    position: relative;
    min-height: 280px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.vertical-gradient {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(180deg, rgba(196, 137, 106, 0.08) 0%, rgba(166, 142, 155, 0.06) 50%, transparent 100%);
}

.gradient-cool {
    background: linear-gradient(180deg, rgba(126, 154, 167, 0.1) 0%, rgba(196, 183, 166, 0.05) 50%, transparent 100%);
}

.gradient-fade {
    background: linear-gradient(180deg, rgba(196, 183, 166, 0.06) 0%, transparent 100%);
}

.vertical-text {
    writing-mode: vertical-rl;
    text-orientation: mixed;
    font-family: 'Josefin Sans', sans-serif;
    font-weight: 300;
    font-size: 0.9rem;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--text-secondary);
    opacity: 0.6;
    position: relative;
    z-index: 1;
}

/* Quote blocks */
.item-quote {
    padding: 2.5rem 2rem;
}

.quote-text {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-weight: 300;
    font-style: italic;
    font-size: 1.15rem;
    line-height: 1.85;
    color: var(--text-primary);
}

.quote-mark {
    font-family: 'Josefin Sans', sans-serif;
    font-weight: 300;
    font-size: 2.5rem;
    line-height: 0;
    vertical-align: -0.3em;
    color: var(--accent-warm);
    opacity: 0.4;
    margin-right: 0.1em;
}

/* Breath spaces */
.breath-space {
    column-span: all;
    height: 40vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    margin: 2vw 0;
}

.breath-line {
    width: 60%;
    height: 1px;
    background-color: var(--border);
    opacity: 0.3;
}

.breath-text {
    margin-top: 2rem;
    font-family: 'Josefin Sans', sans-serif;
    font-weight: 300;
    font-size: 0.75rem;
    letter-spacing: 0.1em;
    color: var(--text-secondary);
    opacity: 0.4;
    text-align: center;
    max-width: 40ch;
}

/* End block */
.item-end {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 200px;
}

.end-text {
    font-family: 'Josefin Sans', sans-serif;
    font-weight: 300;
    font-size: 0.8rem;
    letter-spacing: 0.15em;
    text-transform: lowercase;
    color: var(--text-secondary);
    opacity: 0.3;
}

/* ---- Hover States ---- */
.masonry-item:hover {
    cursor: default;
}

.item-data:hover {
    border-color: rgba(166, 142, 155, 0.4);
    transition: border-color 0.6s var(--ease-out-cubic);
}

.item-data:hover .data-key {
    color: var(--accent-muted);
    transition: color 0.6s var(--ease-out-cubic);
}

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

@media (max-width: 600px) {
    #masonry-grid {
        column-count: 1;
        padding: 18vh 5vw 10vh;
    }

    .site-title {
        font-size: clamp(1.6rem, 8vw, 2.5rem);
    }

    .item-tall {
        min-height: 220px;
    }

    .breath-space {
        height: 25vh;
    }

    .breath-text {
        font-size: 0.65rem;
    }
}

/* ---- Reduced Motion ---- */
@media (prefers-reduced-motion: reduce) {
    .fog-layer {
        animation: none;
    }

    #fog-overlay {
        transition: none;
    }

    .masonry-item {
        transition: none;
        opacity: 1;
        transform: none;
    }

    .site-title {
        transition: none;
        opacity: 1;
    }

    #scroll-hint {
        transition: none;
    }

    .particle {
        display: none;
    }
}
