/* ===========================================
   nonri.xyz — Anti-Design / Candlelit Atelier
   =========================================== */

:root {
    /* Palette */
    --bg-cream: #F5EDE0;
    --bg-parchment: #E8D9C5;
    --text-ink: #5C1A2A;
    --accent-wine: #8B2D4A;
    --highlight-gold: #C9943E;
    --shadow-wick: #2A1A1E;
    --smoke-veil: rgba(92, 26, 42, 0.08);
    --ink-wash: rgba(139, 45, 74, 0.15);

    /* Spacing (deliberately irregular) */
    --gap-xs: 80px;
    --gap-sm: 120px;
    --gap-md: 160px;
    --gap-lg: 200px;
}

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

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

body {
    font-family: 'Libre Baskerville', serif;
    background: var(--bg-cream);
    color: var(--text-ink);
    line-height: 2.0;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

/* ===========================================
   Typography
   =========================================== */
.domain-name {
    font-family: 'Caveat', cursive;
    font-weight: 700;
    font-size: clamp(3rem, 8vw, 7rem);
    color: var(--text-ink);
    letter-spacing: -0.02em;
}

h2 {
    font-family: 'Caveat', cursive;
    font-weight: 700;
    font-size: clamp(1.8rem, 3vw, 2.6rem);
    color: var(--text-ink);
    margin-bottom: 1rem;
    line-height: 1.3;
}

p {
    font-family: 'Libre Baskerville', serif;
    font-weight: 400;
    font-size: clamp(1rem, 1.5vw, 1.25rem);
    line-height: 2.0;
    color: var(--text-ink);
}

.passage-italic {
    font-style: italic;
    margin-top: 1.5rem;
    opacity: 0.85;
}

.passage-continued {
    margin-top: 1.5rem;
}

.annotation-text {
    font-family: 'Caveat', cursive;
    font-weight: 400;
    font-size: clamp(0.75rem, 1.2vw, 1rem);
    line-height: 1.6;
    color: var(--accent-wine);
}

.mono-label {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 400;
    font-size: 0.75rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--shadow-wick);
    margin-bottom: 0.75rem;
}

.date-stamp {
    display: block;
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 400;
    font-size: 0.7rem;
    letter-spacing: 0.08em;
    color: var(--shadow-wick);
    opacity: 0.5;
    margin-top: 1.2rem;
}

/* ===========================================
   Opening Field (Header)
   =========================================== */
.opening-field {
    width: 100vw;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    background: var(--bg-cream);
    padding-left: 30%;
    padding-top: 0;
    position: relative;
}

.opening-field .domain-name {
    transform: rotate(var(--rotate, 0deg));
    transform-origin: bottom left;
    position: relative;
    top: -5vh;
}

/* ===========================================
   Main Content
   =========================================== */
main {
    position: relative;
    max-width: 100%;
    padding: 0;
}

/* ===========================================
   Smoke Wisps
   =========================================== */
.smoke-wisp {
    position: absolute;
    pointer-events: none;
    z-index: 0;
}

.wisp-1 {
    width: 200px;
    height: 600px;
    top: 120vh;
    right: 8%;
}

.wisp-2 {
    width: 180px;
    height: 500px;
    top: 300vh;
    left: 15%;
}

.wisp-3 {
    width: 160px;
    height: 550px;
    top: 430vh;
    right: 20%;
}

.wisp-4 {
    width: 140px;
    height: 480px;
    top: 550vh;
    left: 5%;
}

/* ===========================================
   Content Clusters
   =========================================== */
.content-cluster {
    position: relative;
    z-index: 1;
}

/* Cluster 1: 100vh - 250vh equivalent */
.cluster-1 {
    padding: var(--gap-lg) 8% var(--gap-md) 12%;
    min-height: 150vh;
    display: flex;
    flex-direction: column;
    gap: 0;
}

/* Cluster 2 */
.cluster-2 {
    padding: var(--gap-xs) 6% var(--gap-sm) 18%;
    min-height: 150vh;
    position: relative;
}

/* Cluster 3 */
.cluster-3 {
    padding: var(--gap-md) 10% var(--gap-lg) 8%;
    min-height: 150vh;
}

/* Cluster 4 */
.cluster-4 {
    padding: var(--gap-lg) 10% var(--gap-xs) 10%;
    min-height: 100vh;
    display: flex;
    align-items: flex-end;
    justify-content: center;
}

/* ===========================================
   Text Blocks (Anti-Grid)
   =========================================== */
.text-block {
    position: relative;
    max-width: 520px;
    padding: 2rem 2.2rem;
    transform: rotate(var(--rotate, 0deg));
    transform-origin: var(--origin, center);
    will-change: transform;
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    z-index: 2;
}

.text-block:hover {
    transform: rotate(var(--rotate, 0deg)) translateY(-4px);
    box-shadow: 0 8px 24px rgba(42, 26, 30, 0.1);
}

/* --- Anchor Block (Cluster 1) --- */
.anchor-block {
    max-width: 560px;
    padding: 2.5rem 2.8rem;
    border: 2px solid var(--accent-wine);
    background: var(--bg-cream);
    margin-left: 5%;
}

/* --- Annotation Block (Cluster 1) --- */
.annotation-block {
    background: transparent;
    margin-top: -25px;
    margin-left: 35%;
    max-width: 320px;
    padding: 1.5rem 1.8rem;
}

/* --- Secondary Block with Wax Drip (Cluster 1) --- */
.secondary-block {
    background: var(--smoke-veil);
    margin-top: -18px;
    margin-left: 15%;
    max-width: 400px;
    padding: 2rem 2.2rem;
}

/* Wax drip bottom edge */
.wax-drip {
    clip-path: polygon(
        0% 0%, 100% 0%, 100% 88%,
        95% 92%, 90% 88%, 85% 95%,
        78% 89%, 72% 93%, 65% 87%,
        58% 96%, 50% 90%, 42% 100%,
        35% 91%, 28% 94%, 20% 88%,
        12% 93%, 5% 87%, 0% 90%
    );
    padding-bottom: 3.5rem;
}

/* --- Passage Block (Cluster 2) --- */
.passage-block {
    max-width: 620px;
    padding: 2.5rem 3rem;
    margin-left: 8%;
    line-height: 2.2;
}

/* --- Small Note (Cluster 2) --- */
.small-note {
    max-width: 380px;
    padding: 1.8rem 2rem;
    margin-left: 40%;
    margin-top: var(--gap-xs);
    border-left: 2px solid var(--accent-wine);
}

/* --- Vertical Text Pillar (Cluster 2) --- */
.vertical-text {
    writing-mode: vertical-rl;
    position: absolute;
    left: 4%;
    top: 10%;
    font-family: 'Caveat', cursive;
    font-weight: 700;
    font-size: clamp(3rem, 6vw, 5rem);
    color: var(--text-ink);
    opacity: 0.07;
    letter-spacing: 0.15em;
    z-index: 0;
    pointer-events: none;
}

/* --- Horizontal Rule (off-center) --- */
.horizontal-rule {
    width: 55%;
    height: 1px;
    background: var(--accent-wine);
    margin: var(--gap-sm) 0 var(--gap-xs) 20%;
    opacity: 0.4;
}

/* --- Collage Annotation (Cluster 3) --- */
.collage-annotation {
    max-width: 480px;
    padding: 2rem 2.4rem;
    margin-top: var(--gap-sm);
    margin-left: 25%;
}

/* --- Closing Text (Cluster 4) --- */
.closing-text {
    font-family: 'Caveat', cursive;
    font-weight: 400;
    font-size: clamp(1rem, 1.8vw, 1.35rem);
    color: var(--text-ink);
    opacity: 0.6;
    max-width: 480px;
    text-align: center;
    line-height: 1.8;
}

/* ===========================================
   Collage Grid (Cluster 3)
   =========================================== */
.collage-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-template-rows: repeat(3, auto);
    gap: 1rem;
    max-width: 720px;
    position: relative;
}

.collage-item {
    transform: rotate(var(--rotate, 0deg));
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    will-change: transform;
}

.collage-item:hover {
    transform: rotate(var(--rotate, 0deg)) translateY(-4px);
    box-shadow: 0 8px 24px rgba(42, 26, 30, 0.1);
}

.item-text {
    padding: 1.5rem;
    z-index: 2;
}

.item-text p {
    font-size: clamp(0.85rem, 1.2vw, 1rem);
    line-height: 1.8;
}

.item-solid {
    min-height: 100px;
}

.burgundy-block {
    background: var(--accent-wine);
    grid-column: 3;
    grid-row: 1;
    min-height: 120px;
    margin-top: 15px;
    margin-left: -10px;
}

.item-bordered {
    border: 1px solid var(--accent-wine);
    background: transparent;
    min-height: 80px;
    grid-column: 2;
    grid-row: 1;
}

.item-bordered.tall {
    min-height: 140px;
    grid-column: 4;
    grid-row: 2 / 4;
}

.cream-block {
    background: var(--bg-parchment);
    grid-column: 1;
    grid-row: 2;
    min-height: 90px;
    margin-right: -15px;
}

.gold-block {
    background: var(--highlight-gold);
    opacity: 0.3;
    grid-column: 3;
    grid-row: 3;
    min-height: 70px;
    margin-top: -20px;
}

.wide-item {
    grid-column: 1 / 3;
    grid-row: 3;
}

.collage-grid .item-text:first-child {
    grid-column: 1 / 3;
    grid-row: 1;
    margin-bottom: -15px;
}

.collage-grid .item-text:nth-child(4) {
    grid-column: 4;
    grid-row: 1;
}

/* ===========================================
   Ink Splatter Accents
   =========================================== */
.ink-splatter {
    position: absolute;
    width: 1px;
    height: 1px;
    pointer-events: none;
}

.splatter-1 {
    top: -8px;
    right: 20px;
    box-shadow:
        0 0 0 2px rgba(139, 45, 74, 0.2),
        6px -4px 0 3px rgba(139, 45, 74, 0.12),
        -3px 5px 0 1.5px rgba(139, 45, 74, 0.25),
        10px 2px 0 2.5px rgba(139, 45, 74, 0.1),
        -8px -2px 0 1px rgba(139, 45, 74, 0.18);
    border-radius: 50%;
}

.splatter-2 {
    bottom: 15px;
    left: -12px;
    box-shadow:
        0 0 0 3px rgba(139, 45, 74, 0.15),
        5px 7px 0 2px rgba(139, 45, 74, 0.2),
        -4px -6px 0 1px rgba(139, 45, 74, 0.3),
        8px -3px 0 2.5px rgba(139, 45, 74, 0.1);
    border-radius: 50%;
}

.splatter-3 {
    top: 10px;
    left: -15px;
    box-shadow:
        0 0 0 2.5px rgba(139, 45, 74, 0.18),
        -6px 3px 0 1.5px rgba(139, 45, 74, 0.25),
        4px -5px 0 3px rgba(139, 45, 74, 0.12),
        -2px 8px 0 2px rgba(139, 45, 74, 0.1),
        7px 4px 0 1px rgba(139, 45, 74, 0.22);
    border-radius: 50%;
}

/* ===========================================
   Candle Flame
   =========================================== */
.candle-flame {
    width: 24px;
    height: 36px;
    background: radial-gradient(
        ellipse at 50% 60%,
        var(--highlight-gold) 0%,
        rgba(201, 148, 62, 0.6) 30%,
        rgba(201, 148, 62, 0.2) 55%,
        transparent 75%
    );
    border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
    animation: flame-pulse 2.5s ease-in-out infinite alternate;
    position: relative;
}

@keyframes flame-pulse {
    0% {
        transform: scale(1, 0.95);
        background: radial-gradient(
            ellipse at 50% 60%,
            var(--highlight-gold) 0%,
            rgba(201, 148, 62, 0.6) 30%,
            rgba(201, 148, 62, 0.2) 55%,
            transparent 75%
        );
    }
    50% {
        transform: scale(0.97, 1.05);
        background: radial-gradient(
            ellipse at 48% 58%,
            var(--highlight-gold) 0%,
            rgba(201, 148, 62, 0.55) 32%,
            rgba(201, 148, 62, 0.18) 56%,
            transparent 76%
        );
    }
    100% {
        transform: scale(1.02, 0.97);
        background: radial-gradient(
            ellipse at 52% 62%,
            var(--highlight-gold) 0%,
            rgba(201, 148, 62, 0.65) 28%,
            rgba(201, 148, 62, 0.22) 54%,
            transparent 74%
        );
    }
}

/* ===========================================
   Closing Field (Footer)
   =========================================== */
.closing-field {
    width: 100vw;
    min-height: 60vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: var(--bg-cream);
    padding: var(--gap-lg) 0;
    gap: 2rem;
}

.footer-domain {
    font-family: 'Caveat', cursive;
    font-weight: 400;
    font-size: 1.2rem;
    color: var(--text-ink);
    opacity: 0.35;
    letter-spacing: 0.05em;
}

/* ===========================================
   Responsive: Mobile (< 768px)
   =========================================== */
@media (max-width: 768px) {
    :root {
        --gap-xs: 40px;
        --gap-sm: 60px;
        --gap-md: 80px;
        --gap-lg: 100px;
    }

    .opening-field {
        padding-left: 8%;
        justify-content: flex-start;
    }

    .cluster-1 {
        padding: var(--gap-md) 6% var(--gap-sm) 6%;
    }

    .cluster-2 {
        padding: var(--gap-xs) 6% var(--gap-sm) 6%;
    }

    .cluster-3 {
        padding: var(--gap-sm) 6% var(--gap-md) 6%;
    }

    .cluster-4 {
        padding: var(--gap-md) 6% var(--gap-xs) 6%;
    }

    /* Reduce rotations by 50% on mobile */
    .text-block,
    .collage-item {
        --rotate: 0deg !important;
    }

    .anchor-block,
    .annotation-block,
    .secondary-block,
    .passage-block,
    .small-note,
    .collage-annotation {
        max-width: 100%;
        margin-left: 0;
        margin-top: 2rem;
    }

    .annotation-block {
        margin-left: 5%;
    }

    .secondary-block {
        margin-left: 0;
    }

    .small-note {
        margin-left: 5%;
    }

    .collage-annotation {
        margin-left: 0;
    }

    .vertical-text {
        display: none;
    }

    .horizontal-rule {
        width: 70%;
        margin-left: 10%;
    }

    .collage-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.8rem;
        max-width: 100%;
    }

    .collage-grid .item-text:first-child {
        grid-column: 1 / 3;
        grid-row: auto;
    }

    .burgundy-block {
        grid-column: auto;
        grid-row: auto;
        margin-top: 0;
        margin-left: 0;
    }

    .item-bordered {
        grid-column: auto;
        grid-row: auto;
    }

    .item-bordered.tall {
        grid-column: auto;
        grid-row: auto;
        min-height: 80px;
    }

    .cream-block {
        grid-column: auto;
        grid-row: auto;
        margin-right: 0;
    }

    .gold-block {
        grid-column: auto;
        grid-row: auto;
        margin-top: 0;
    }

    .wide-item {
        grid-column: 1 / 3;
        grid-row: auto;
    }

    .collage-grid .item-text:nth-child(4) {
        grid-column: auto;
        grid-row: auto;
    }

    .smoke-wisp {
        display: none;
    }

    .wax-drip {
        clip-path: none;
        padding-bottom: 2rem;
    }

    .domain-name {
        font-size: clamp(2.5rem, 10vw, 4rem);
    }
}
