/* ==========================================================
   lossless.dev - Neomorphism / Duotone / Crystalline / Warm
   ========================================================== */

/* ---- CSS Custom Properties ---- */
:root {
    --surface: #f0e6d6;
    --shadow: #c8b8a4;
    --highlight: #fffdf6;
    --text-primary: #5a4e42;
    --text-secondary: #8a7e72;
    --accent-amber: #d4a053;
    --accent-rose: #e8b4b8;
    --deep-inset: #3d3229;

    --neo-raised: 12px 12px 24px var(--shadow), -12px -12px 24px var(--highlight);
    --neo-raised-hover: 10px 10px 20px var(--shadow), -10px -10px 20px var(--highlight);
    --neo-raised-sm: 6px 6px 12px var(--shadow), -6px -6px 12px var(--highlight);
    --neo-inset: inset 4px 4px 8px var(--shadow), inset -4px -4px 8px var(--highlight);
    --neo-inset-deep: inset 6px 6px 12px var(--shadow), inset -6px -6px 12px var(--highlight);

    --font-headline: 'Caveat', cursive;
    --font-body: 'DM Sans', sans-serif;
    --font-code: 'Fira Code', monospace;
}

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

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

body {
    background-color: var(--surface);
    color: var(--text-primary);
    font-family: var(--font-body);
    font-weight: 400;
    font-size: clamp(1rem, 1.8vw, 1.15rem);
    line-height: 1.85;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

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

.bokeh-circle {
    position: absolute;
    border-radius: 50%;
    pointer-events: none;
}

.bokeh-amber {
    background: radial-gradient(circle, rgba(212, 160, 83, 0.06) 0%, transparent 70%);
}

.bokeh-rose {
    background: radial-gradient(circle, rgba(232, 180, 184, 0.04) 0%, transparent 70%);
}

@keyframes bokeh-drift-1 {
    0%, 100% { transform: translate(0, 0); }
    25% { transform: translate(15px, -20px); }
    50% { transform: translate(-10px, 15px); }
    75% { transform: translate(20px, 10px); }
}

@keyframes bokeh-drift-2 {
    0%, 100% { transform: translate(0, 0); }
    25% { transform: translate(-20px, 10px); }
    50% { transform: translate(15px, -15px); }
    75% { transform: translate(-10px, -20px); }
}

@keyframes bokeh-drift-3 {
    0%, 100% { transform: translate(0, 0); }
    25% { transform: translate(10px, 25px); }
    50% { transform: translate(-20px, -10px); }
    75% { transform: translate(15px, -15px); }
}

/* ---- Signal Wave ---- */
.signal-wave {
    position: fixed;
    left: calc(15vw - 30px);
    top: 0;
    width: 20px;
    height: 100vh;
    z-index: 2;
    pointer-events: none;
}

.signal-wave path {
    transition: stroke 0.6s ease, opacity 0.6s ease;
}

.signal-wave.pulse path {
    stroke: var(--accent-amber);
    opacity: 0.6;
}

@media (max-width: 900px) {
    .signal-wave {
        display: none;
    }
}

/* ---- Scroll Indicator ---- */
.scroll-indicator {
    position: fixed;
    right: calc(15vw - 20px);
    top: 50%;
    transform: translateY(-50%);
    z-index: 10;
    pointer-events: none;
}

.scroll-track {
    width: 8px;
    height: 120px;
    border-radius: 4px;
    box-shadow: var(--neo-inset);
    background: var(--surface);
    position: relative;
}

.scroll-dot {
    width: 8px;
    height: 20px;
    border-radius: 4px;
    background: var(--surface);
    box-shadow: var(--neo-raised-sm);
    position: absolute;
    top: 0;
    left: 0;
    transition: top 0.15s ease-out;
}

@media (max-width: 900px) {
    .scroll-indicator {
        right: 8px;
    }
}

/* ---- Content Column ---- */
.content-column {
    max-width: 720px;
    margin: 0 auto;
    padding: 0 24px;
    position: relative;
    z-index: 1;
}

@media (min-width: 901px) {
    .content-column {
        margin-left: 15vw;
        margin-right: 15vw;
        max-width: calc(100vw - 30vw);
    }
    @media (min-width: 1200px) {
        .content-column {
            max-width: 720px;
            margin-left: auto;
            margin-right: auto;
        }
    }
}

/* ---- Typography ---- */
.section-title {
    font-family: var(--font-headline);
    font-weight: 700;
    font-size: clamp(2.2rem, 5vw, 4rem);
    letter-spacing: 0.01em;
    color: var(--text-primary);
    margin-bottom: 1.5rem;
    /* Inset / carved effect */
    text-shadow:
        1px 1px 2px var(--highlight),
        -1px -1px 1px var(--shadow);
}

.lead-text {
    font-family: var(--font-body);
    font-weight: 500;
    font-size: clamp(1.1rem, 2.2vw, 1.35rem);
    color: var(--text-secondary);
    margin-bottom: 2rem;
    line-height: 1.7;
}

.section-body p {
    margin-bottom: 1.4rem;
    color: var(--text-primary);
}

.section-body p:last-child {
    margin-bottom: 0;
}

/* ---- Neomorphic Elements ---- */
.neo-raised {
    background: var(--surface);
    box-shadow: var(--neo-raised);
    border-radius: 24px;
    transition: box-shadow 0.2s ease;
}

.neo-raised:hover {
    box-shadow: var(--neo-raised-hover);
}

.neo-raised-sm {
    background: var(--surface);
    box-shadow: var(--neo-raised-sm);
    border-radius: 12px;
}

.neo-inset {
    box-shadow: var(--neo-inset);
    border-radius: 12px;
}

.neo-inset-panel {
    background: var(--surface);
    box-shadow: var(--neo-inset-deep);
    border-radius: 16px;
}

.neo-card {
    background: var(--surface);
    box-shadow: var(--neo-raised);
    border-radius: 24px;
    padding: 3rem;
    transition: box-shadow 0.2s ease;
}

.neo-card:hover {
    box-shadow: var(--neo-raised-hover);
}

.neo-code {
    font-family: var(--font-code);
    font-weight: 400;
    font-size: 0.9em;
    display: inline-block;
    padding: 0.6em 1em;
    background: var(--surface);
    box-shadow: var(--neo-inset);
    border-radius: 8px;
    color: var(--text-primary);
    margin-top: 1rem;
}

.inline-code {
    display: block;
    margin-bottom: 0.8rem;
}

/* ---- Hero Zone ---- */
.hero-zone {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4rem 0;
}

.hero-panel {
    text-align: center;
    padding: 4rem 3rem;
    max-width: 520px;
    width: 100%;
    position: relative;
}

.hero-title {
    font-family: var(--font-headline);
    font-weight: 700;
    font-size: clamp(3rem, 8vw, 5.5rem);
    letter-spacing: 0.01em;
    color: var(--text-primary);
    /* Carved / letterpress inset effect */
    text-shadow:
        2px 2px 3px var(--highlight),
        -1px -1px 2px var(--shadow),
        0 0 0 transparent;
    margin-bottom: 2rem;
}

.hero-prism-container {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 2.5rem;
}

.hero-prism {
    width: 140px;
    height: 140px;
    animation: prism-rotate 60s linear infinite;
}

@keyframes prism-rotate {
    0% { transform: perspective(1000px) rotateY(0deg) rotateX(5deg); }
    50% { transform: perspective(1000px) rotateY(180deg) rotateX(-5deg); }
    100% { transform: perspective(1000px) rotateY(360deg) rotateX(5deg); }
}

.scroll-arrow {
    opacity: 0;
    transition: opacity 1.5s ease;
    display: flex;
    justify-content: center;
}

.scroll-arrow.visible {
    opacity: 0.6;
}

.scroll-arrow svg {
    animation: arrow-bob 2.5s ease-in-out infinite;
}

@keyframes arrow-bob {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(6px); }
}

/* ---- Content Sections ---- */
.content-section {
    padding: 8rem 0;
}

/* ---- Progressive Disclosure ---- */
.progressive-reveal {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.progressive-reveal.revealed {
    opacity: 1;
    transform: translateY(0);
}

.progressive-reveal[data-stagger="1"] {
    transition-delay: 0.2s;
}

.progressive-reveal[data-stagger="2"] {
    transition-delay: 0.4s;
}

/* ---- Crystal Dividers ---- */
.crystal-divider {
    padding: 2rem 0;
}

.divider-svg {
    width: 100%;
    height: 30px;
}

/* ---- Capsules (Crystal Chamber) ---- */
.neo-capsule {
    background: var(--surface);
    box-shadow: var(--neo-raised);
    border-radius: 20px;
    padding: 2rem 2.5rem;
    display: flex;
    align-items: flex-start;
    gap: 1.5rem;
    margin-bottom: 2.5rem;
    transition: box-shadow 0.2s ease;
}

.neo-capsule:last-of-type {
    margin-bottom: 0;
}

.neo-capsule:hover {
    box-shadow: var(--neo-raised-hover);
}

.capsule-icon {
    flex-shrink: 0;
    width: 60px;
    height: 60px;
}

.crystal-icon {
    width: 60px;
    height: 60px;
    transition: transform 0.6s ease;
}

.neo-capsule.revealed .crystal-icon {
    animation: crystal-grow 0.6s ease forwards;
}

@keyframes crystal-grow {
    0% { transform: scale(0.8) rotate(-5deg); }
    100% { transform: scale(1) rotate(0deg); }
}

.capsule-content {
    flex: 1;
}

.capsule-title {
    font-family: var(--font-headline);
    font-weight: 700;
    font-size: clamp(1.6rem, 3vw, 2.2rem);
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    text-shadow:
        1px 1px 2px var(--highlight),
        -1px -1px 1px var(--shadow);
}

.capsule-content p {
    color: var(--text-primary);
}

/* ---- Demonstration Section ---- */
.demo-container {
    margin-top: 2rem;
}

.demo-toggle-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 2rem;
}

.toggle-label {
    font-family: var(--font-body);
    font-weight: 500;
    font-size: 0.95rem;
    color: var(--text-secondary);
    transition: color 0.3s ease;
}

.toggle-label.active {
    color: var(--accent-amber);
}

.neo-toggle {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    outline: none;
}

.toggle-track {
    width: 60px;
    height: 30px;
    border-radius: 15px;
    background: var(--surface);
    box-shadow: var(--neo-inset);
    position: relative;
    transition: all 0.3s ease;
}

.toggle-thumb {
    width: 24px;
    height: 24px;
    border-radius: 12px;
    background: var(--surface);
    box-shadow: var(--neo-raised-sm);
    position: absolute;
    top: 3px;
    right: 3px;
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.toggle-thumb.lossy {
    transform: translateX(-30px);
}

.demo-display {
    padding: 2.5rem;
    border-radius: 16px;
    min-height: 200px;
    transition: all 0.4s ease;
}

.demo-content {
    transition: all 0.4s ease-out;
}

.demo-content.lossy .demo-headline {
    filter: blur(0.8px);
    opacity: 0.6;
    color: var(--text-secondary);
}

.demo-content.lossy .demo-body {
    filter: blur(0.5px);
    opacity: 0.5;
    color: var(--text-secondary);
}

.demo-content.lossy .demo-code {
    filter: blur(1px);
    opacity: 0.4;
}

.demo-content.lossless .demo-headline {
    filter: none;
    opacity: 1;
    color: var(--text-primary);
}

.demo-content.lossless .demo-body {
    filter: none;
    opacity: 1;
    color: var(--text-primary);
}

.demo-content.lossless .demo-code {
    filter: none;
    opacity: 1;
}

.demo-headline {
    font-family: var(--font-headline);
    font-weight: 700;
    font-size: clamp(1.5rem, 3vw, 2rem);
    margin-bottom: 1rem;
    transition: all 0.4s ease-out;
    text-shadow:
        1px 1px 2px var(--highlight),
        -1px -1px 1px var(--shadow);
}

.demo-body {
    margin-bottom: 1rem;
    transition: all 0.4s ease-out;
}

.demo-code {
    transition: all 0.4s ease-out;
}

.code-text {
    font-family: var(--font-code);
    font-size: 0.85em;
    color: var(--accent-amber);
}

/* ---- Archive Section ---- */
.archive-card {
    padding: 2rem 2.5rem;
    margin-bottom: 2rem;
    display: flex;
    align-items: flex-start;
    gap: 1.2rem;
}

.archive-card:last-of-type {
    margin-bottom: 0;
}

.archive-icon {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
}

.crystal-icon-sm {
    width: 40px;
    height: 40px;
}

.archive-content {
    flex: 1;
}

.archive-title {
    font-family: var(--font-headline);
    font-weight: 700;
    font-size: clamp(1.3rem, 2.5vw, 1.8rem);
    color: var(--text-primary);
    margin-bottom: 0.4rem;
    text-shadow:
        1px 1px 2px var(--highlight),
        -1px -1px 1px var(--shadow);
}

.archive-body {
    color: var(--text-primary);
}

/* ---- Closing Section ---- */
.closing-section {
    padding: 10rem 0 8rem;
    text-align: center;
}

.closing-content {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.closing-prism-container {
    margin-bottom: 3rem;
}

.closing-prism {
    width: 200px;
    height: 200px;
    animation: prism-rotate 60s linear infinite;
}

.closing-inscription {
    font-family: var(--font-headline);
    font-weight: 700;
    font-size: clamp(1.8rem, 4vw, 3rem);
    color: var(--text-primary);
    max-width: 540px;
    line-height: 1.4;
    text-shadow:
        2px 2px 3px var(--highlight),
        -1px -1px 2px var(--shadow);
}

/* ---- Intensified closing bokeh (added via JS) ---- */
.bokeh-layer.closing-intense .bokeh-amber {
    background: radial-gradient(circle, rgba(212, 160, 83, 0.10) 0%, transparent 70%);
}

.bokeh-layer.closing-intense .bokeh-rose {
    background: radial-gradient(circle, rgba(232, 180, 184, 0.08) 0%, transparent 70%);
}

/* ---- Responsive ---- */
@media (max-width: 600px) {
    .neo-card {
        padding: 2rem 1.5rem;
        border-radius: 18px;
    }

    .neo-capsule {
        flex-direction: column;
        align-items: center;
        text-align: center;
        padding: 1.5rem;
    }

    .archive-card {
        flex-direction: column;
        align-items: center;
        text-align: center;
        padding: 1.5rem;
    }

    .hero-panel {
        padding: 3rem 1.5rem;
        border-radius: 18px;
    }

    .content-section {
        padding: 5rem 0;
    }

    .demo-display {
        padding: 1.5rem;
    }

    .closing-section {
        padding: 6rem 0 5rem;
    }

    .scroll-indicator {
        right: 8px;
    }
}
