/* ============================================================
   digitaltelomere.com - Styles
   Earth-tone warm minimalism with editorial flow layout
   ============================================================ */

/* --- CSS Custom Properties (Earth-Tone Palette) --- */
:root {
    --bg-cotton: #F5F0E8;
    --text-umber: #5C4F3F;
    --accent-terracotta: #B4846C;
    --secondary-sage: #8A9A7B;
    --tertiary-sandstone: #D9CEBD;
    --deep-bark: #6B5744;
    --highlight-ochre: #C4A46A;
    --dark-forest: #3B352C;

    --font-heading: 'Nunito Sans', sans-serif;
    --font-body: 'Source Serif 4', serif;
    --font-mono: 'IBM Plex Mono', monospace;

    --ease-gentle: cubic-bezier(0.25, 0.1, 0.25, 1.0);
    --shadow-soft: 0 2px 40px rgba(92, 79, 63, 0.06);
    --shadow-softer: 0 1px 20px rgba(92, 79, 63, 0.04);

    --bg-gradient-opacity: 0.3;
}

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

html {
    font-size: 16px;
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    background-color: var(--bg-cotton);
    color: var(--text-umber);
    font-family: var(--font-body);
    font-weight: 400;
    font-size: clamp(1rem, 1.15vw, 1.15rem);
    line-height: 1.75;
    overflow-x: hidden;
    position: relative;
}

/* --- SVG Filters (hidden) --- */
.svg-filters {
    position: absolute;
    width: 0;
    height: 0;
    overflow: hidden;
}

/* --- Paper Texture Overlay --- */
.paper-texture {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1000;
    opacity: 0.5;
    filter: url(#paper-texture);
    mix-blend-mode: multiply;
}

/* --- Subtle background gradient (Cotton to Sandstone over full page) --- */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        to bottom,
        var(--bg-cotton) 0%,
        var(--bg-cotton) 30%,
        var(--tertiary-sandstone) 100%
    );
    opacity: var(--bg-gradient-opacity);
    z-index: -1;
    pointer-events: none;
}

/* ============================================================
   PHASE 1: EMERGENCE
   ============================================================ */
.phase-emergence {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding-bottom: 10vh;
    position: relative;
}

.emergence-spacer {
    flex: 1;
    min-height: 30vh;
}

.emergence-content {
    max-width: 1200px;
    width: 90%;
    margin: 0 auto;
    padding-left: 20%;
}

.site-title {
    font-family: var(--font-heading);
    font-weight: 300;
    font-size: clamp(1rem, 1.5vw, 1.3rem);
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--text-umber);
    margin-bottom: 0.5rem;
    opacity: 0;
    animation: fadeInSlow 2s var(--ease-gentle) 0.5s forwards;
}

.site-subtitle {
    font-family: var(--font-body);
    font-weight: 400;
    font-size: clamp(0.85rem, 1vw, 1rem);
    color: var(--deep-bark);
    opacity: 0;
    letter-spacing: 0.02em;
    margin-bottom: 3rem;
    animation: fadeInSlow 2s var(--ease-gentle) 1.2s forwards;
}

.emergence-line {
    width: 0;
    height: 1px;
    background-color: var(--accent-terracotta);
    animation: drawLine 3s var(--ease-gentle) 2s forwards;
}

@keyframes fadeInSlow {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes drawLine {
    from { width: 0; }
    to { width: 40%; }
}

/* ============================================================
   DIMINISHING SEQUENCES
   ============================================================ */
.diminishing-sequence {
    width: 90%;
    max-width: 1200px;
    margin: 6rem auto;
    padding-left: 20%;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    letter-spacing: 0.08em;
    color: var(--accent-terracotta);
    display: flex;
    gap: 1.2em;
    flex-wrap: wrap;
    opacity: 0;
    transform: translateY(12px);
    transition: opacity 0.8s var(--ease-gentle), transform 0.8s var(--ease-gentle);
}

.diminishing-sequence.revealed {
    opacity: 1;
    transform: translateY(0);
}

.sequence-1 .seq-unit {
    font-size: 0.85rem;
}

.sequence-2 .seq-unit {
    font-size: 0.75rem;
}

.sequence-3 {
    padding-left: 0;
    justify-content: center;
}

.sequence-3 .seq-unit {
    font-size: 0.65rem;
}

/* ============================================================
   PHASE 2: ACCUMULATION - Editorial Grid
   ============================================================ */
.phase-accumulation {
    padding: 10vh 0 15vh;
}

.editorial-grid {
    display: grid;
    grid-template-columns: 20% 1fr 280px;
    grid-template-areas: "gutter main margin";
    max-width: 1200px;
    width: 90%;
    margin: 0 auto;
    gap: 2rem;
    padding: 4rem 0;
}

.reading-column {
    grid-area: main;
    max-width: 680px;
}

.content-block {
    opacity: 0;
    transform: translateY(12px);
    transition: opacity 0.6s var(--ease-gentle), transform 0.6s var(--ease-gentle);
}

.content-block.revealed {
    opacity: 1;
    transform: translateY(0);
}

.section-heading {
    font-family: var(--font-heading);
    font-weight: 400;
    font-size: clamp(1.6rem, 3vw, 2.8rem);
    letter-spacing: 0.02em;
    color: var(--dark-forest);
    margin-bottom: 1.5rem;
    line-height: 1.2;
}

.content-block p {
    margin-bottom: 1.25rem;
    color: var(--text-umber);
}

.content-block p:last-child {
    margin-bottom: 0;
}

/* --- Margin Annotations --- */
.margin-annotation {
    grid-area: margin;
    padding-top: 2.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    opacity: 0;
    transform: translateY(12px);
    transition: opacity 0.6s var(--ease-gentle) 0.3s, transform 0.6s var(--ease-gentle) 0.3s;
}

.margin-annotation.revealed {
    opacity: 1;
    transform: translateY(0);
}

.annotation-label {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--accent-terracotta);
    opacity: 0.7;
}

.annotation-text {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    letter-spacing: 0.04em;
    color: var(--text-umber);
    opacity: 0.5;
    line-height: 1.6;
}

/* --- Section Borders (Animated terracotta lines) --- */
.section-border {
    width: 90%;
    max-width: 1200px;
    margin: 0 auto;
    padding-left: 20%;
    height: 1px;
    position: relative;
}

.section-border::after {
    content: '';
    position: absolute;
    left: 20%;
    top: 0;
    width: 0;
    height: 1px;
    background: var(--accent-terracotta);
    transition: width 1.2s var(--ease-gentle);
}

.section-border.animated::after {
    width: 40%;
}

/* ============================================================
   COLLAGE COMPOSITIONS
   ============================================================ */
.collage-composition {
    width: 90%;
    max-width: 1200px;
    margin: 6rem auto;
    position: relative;
    min-height: 400px;
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    grid-template-rows: repeat(6, 60px);
    gap: 0;
}

.collage-element {
    opacity: 0;
    transform: translateY(12px);
    transition: opacity 0.6s var(--ease-gentle), transform 0.6s var(--ease-gentle);
}

.collage-element.revealed {
    opacity: 1;
    transform: translateY(0);
}

/* Collage 1 Layout */
.collage-1 .collage-chromosome {
    grid-column: 5 / 8;
    grid-row: 1 / 6;
    z-index: 3;
}

.chromosome-svg {
    width: 100%;
    height: 100%;
}

.collage-1 .collage-texture-panel {
    grid-column: 7 / 11;
    grid-row: 2 / 5;
    z-index: 1;
}

.texture-block {
    width: 100%;
    height: 100%;
    border-radius: 2px;
}

.texture-block.sage {
    background-color: var(--secondary-sage);
    opacity: 0.12;
}

.texture-block.terracotta {
    background-color: var(--accent-terracotta);
    opacity: 0.1;
}

.collage-1 .collage-typo-fragment {
    grid-column: 3 / 7;
    grid-row: 5 / 7;
    z-index: 2;
    font-family: var(--font-mono);
    font-size: 0.7rem;
    letter-spacing: 0.1em;
    color: var(--accent-terracotta);
    opacity: 0.25;
    display: flex;
    gap: 1em;
    align-items: center;
    transform: rotate(-2deg);
}

.collage-1 .collage-typo-fragment.revealed {
    transform: rotate(-2deg);
}

.collage-1 .collage-circle {
    grid-column: 9 / 12;
    grid-row: 1 / 3;
    z-index: 2;
}

.collage-1 .collage-dots {
    grid-column: 2 / 4;
    grid-row: 2 / 4;
    z-index: 2;
}

/* Collage 2 Layout */
.collage-2 .collage-cell-diagram {
    grid-column: 4 / 9;
    grid-row: 1 / 5;
    z-index: 3;
}

.cell-division-svg {
    width: 100%;
    height: 100%;
}

.collage-2 .collage-parallel-lines {
    grid-column: 9 / 12;
    grid-row: 1 / 4;
    z-index: 1;
    transform: rotate(3deg);
}

.collage-2 .collage-parallel-lines.revealed {
    transform: rotate(3deg);
}

.collage-2 .collage-typo-fragment-2 {
    grid-column: 2 / 5;
    grid-row: 4 / 6;
    z-index: 2;
    font-family: var(--font-mono);
    font-size: 0.65rem;
    letter-spacing: 0.12em;
    color: var(--secondary-sage);
    opacity: 0.3;
    display: flex;
    gap: 1.5em;
    align-items: center;
    transform: rotate(-1.5deg);
}

.collage-2 .collage-typo-fragment-2.revealed {
    transform: rotate(-1.5deg);
}

.collage-2 .collage-geometric-arc {
    grid-column: 8 / 12;
    grid-row: 3 / 6;
    z-index: 2;
}

/* Collage 3 Layout */
.collage-3 .collage-telomerase-diagram {
    grid-column: 3 / 9;
    grid-row: 1 / 5;
    z-index: 3;
}

.telomerase-svg {
    width: 100%;
    height: 100%;
}

.collage-3 .collage-texture-panel-2 {
    grid-column: 8 / 12;
    grid-row: 2 / 5;
    z-index: 1;
}

.collage-3 .collage-typo-fragment-3 {
    grid-column: 2 / 5;
    grid-row: 5 / 7;
    z-index: 2;
    font-family: var(--font-mono);
    font-size: 0.6rem;
    letter-spacing: 0.12em;
    color: var(--accent-terracotta);
    opacity: 0.2;
    display: flex;
    gap: 1.5em;
    align-items: center;
    transform: rotate(-2.5deg);
}

.collage-3 .collage-typo-fragment-3.revealed {
    transform: rotate(-2.5deg);
}

.collage-3 .collage-geometric-dots-2 {
    grid-column: 9 / 12;
    grid-row: 4 / 6;
    z-index: 2;
}

/* ============================================================
   DEPTH PANELS
   ============================================================ */
.depth-panel-group {
    max-width: 1200px;
    width: 90%;
    margin: 6rem auto;
    padding-left: 20%;
    position: relative;
    min-height: 500px;
    opacity: 0;
    transform: translateY(12px);
    transition: opacity 0.6s var(--ease-gentle), transform 0.6s var(--ease-gentle);
}

.depth-panel-group.revealed {
    opacity: 1;
    transform: translateY(0);
}

.depth-panel {
    position: absolute;
    padding: 2.5rem;
    border-radius: 3px;
    transition: transform 0.3s var(--ease-gentle);
}

.depth-back {
    background-color: var(--tertiary-sandstone);
    border: 1px solid rgba(92, 79, 63, 0.06);
    box-shadow: var(--shadow-softer);
    top: 0;
    left: 0;
    width: 85%;
    transform: scale(0.98);
    z-index: 1;
}

.depth-mid {
    background-color: rgba(245, 240, 232, 0.9);
    border: 1px solid rgba(92, 79, 63, 0.1);
    box-shadow: var(--shadow-soft);
    top: 140px;
    left: 5%;
    width: 80%;
    z-index: 2;
}

.depth-front {
    background-color: var(--bg-cotton);
    border: 1px solid rgba(92, 79, 63, 0.15);
    box-shadow: var(--shadow-soft);
    top: 280px;
    left: 10%;
    width: 75%;
    z-index: 3;
}

.panel-content {
    position: relative;
}

.panel-number {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    letter-spacing: 0.1em;
    color: var(--accent-terracotta);
    opacity: 0.6;
    display: block;
    margin-bottom: 0.5rem;
}

.panel-label {
    font-family: var(--font-heading);
    font-weight: 400;
    font-size: clamp(1.1rem, 2vw, 1.5rem);
    letter-spacing: 0.02em;
    color: var(--dark-forest);
    display: block;
    margin-bottom: 0.75rem;
}

.panel-content p {
    font-family: var(--font-body);
    font-size: 0.95rem;
    line-height: 1.65;
    color: var(--text-umber);
    opacity: 0.85;
}

/* ============================================================
   PHASE 3: RESOLUTION
   ============================================================ */
.phase-resolution {
    min-height: 60vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20vh 5% 15vh;
    position: relative;
    background: linear-gradient(
        to bottom,
        transparent 0%,
        rgba(217, 206, 189, 0.15) 100%
    );
}

.resolution-content {
    max-width: 800px;
    text-align: center;
    margin: 4rem 0;
    opacity: 0;
    transform: translateY(12px);
    transition: opacity 1s var(--ease-gentle), transform 1s var(--ease-gentle);
}

.resolution-content.revealed {
    opacity: 1;
    transform: translateY(0);
}

.resolution-statement {
    font-family: var(--font-heading);
    font-weight: 300;
    font-size: clamp(2.4rem, 5vw, 4.8rem);
    line-height: 1.25;
    letter-spacing: 0.02em;
    color: var(--dark-forest);
}

.resolution-footer {
    margin-top: 8rem;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
}

.footer-domain {
    font-family: var(--font-heading);
    font-weight: 300;
    font-size: 0.8rem;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--text-umber);
    opacity: 0.4;
}

.footer-line {
    width: 60px;
    height: 1px;
    background-color: var(--accent-terracotta);
    opacity: 0.3;
}

/* ============================================================
   TELOMERE BORDER PATTERN (Signature Element)
   ============================================================ */
.depth-panel.depth-front {
    border-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='4'%3E%3Crect x='0' y='1' width='8' height='1' fill='%23B4846C' opacity='0.4'/%3E%3Crect x='12' y='1' width='8' height='1' fill='%23B4846C' opacity='0.4'/%3E%3Crect x='24' y='1' width='4' height='1' fill='%23B4846C' opacity='0.4'/%3E%3Crect x='32' y='1' width='12' height='1' fill='%23B4846C' opacity='0.4'/%3E%3Crect x='48' y='1' width='12' height='1' fill='%23B4846C' opacity='0.4'/%3E%3Crect x='64' y='1' width='4' height='1' fill='%23B4846C' opacity='0.4'/%3E%3Crect x='72' y='1' width='8' height='1' fill='%23B4846C' opacity='0.4'/%3E%3Crect x='84' y='1' width='8' height='1' fill='%23B4846C' opacity='0.4'/%3E%3Crect x='96' y='1' width='12' height='1' fill='%23B4846C' opacity='0.4'/%3E%3Crect x='112' y='1' width='4' height='1' fill='%23B4846C' opacity='0.4'/%3E%3C/svg%3E") 2 round;
    border-width: 1px;
    border-style: solid;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1024px) {
    .editorial-grid {
        grid-template-columns: 10% 1fr 200px;
    }

    .emergence-content {
        padding-left: 10%;
    }

    .diminishing-sequence {
        padding-left: 10%;
    }

    .section-border {
        padding-left: 10%;
    }

    .section-border::after {
        left: 10%;
    }

    .depth-panel-group {
        padding-left: 10%;
    }
}

@media (max-width: 768px) {
    .editorial-grid {
        grid-template-columns: 1fr;
        grid-template-areas:
            "main"
            "margin";
        width: 90%;
        padding: 2rem 0;
    }

    .emergence-content {
        padding-left: 5%;
    }

    .diminishing-sequence {
        padding-left: 5%;
    }

    .section-border {
        padding-left: 5%;
    }

    .section-border::after {
        left: 5%;
        width: 60%;
    }

    .section-border.animated::after {
        width: 60%;
    }

    .depth-panel-group {
        padding-left: 0;
        min-height: auto;
        position: static;
    }

    .depth-panel {
        position: relative;
        top: auto !important;
        left: auto !important;
        width: 100% !important;
        transform: none !important;
        margin-bottom: 1.5rem;
    }

    .margin-annotation {
        padding-top: 0;
        padding-left: 0;
        border-left: 1px solid rgba(180, 132, 108, 0.3);
        padding: 0.75rem 0 0.75rem 1rem;
        margin-top: 1rem;
    }

    .collage-composition {
        grid-template-columns: repeat(6, 1fr);
        grid-template-rows: repeat(6, 50px);
        min-height: 300px;
    }

    /* Collage 1 mobile */
    .collage-1 .collage-chromosome {
        grid-column: 2 / 5;
        grid-row: 1 / 6;
    }

    .collage-1 .collage-texture-panel {
        grid-column: 4 / 7;
        grid-row: 2 / 5;
    }

    .collage-1 .collage-typo-fragment {
        grid-column: 1 / 5;
        grid-row: 5 / 7;
    }

    .collage-1 .collage-circle {
        grid-column: 5 / 7;
        grid-row: 1 / 3;
    }

    .collage-1 .collage-dots {
        grid-column: 1 / 2;
        grid-row: 2 / 4;
    }

    /* Collage 2 mobile */
    .collage-2 .collage-cell-diagram {
        grid-column: 2 / 6;
        grid-row: 1 / 5;
    }

    .collage-2 .collage-parallel-lines {
        grid-column: 5 / 7;
        grid-row: 1 / 4;
    }

    .collage-2 .collage-typo-fragment-2 {
        grid-column: 1 / 4;
        grid-row: 4 / 6;
    }

    .collage-2 .collage-geometric-arc {
        grid-column: 4 / 7;
        grid-row: 3 / 6;
    }

    /* Collage 3 mobile */
    .collage-3 .collage-telomerase-diagram {
        grid-column: 1 / 6;
        grid-row: 1 / 5;
    }

    .collage-3 .collage-texture-panel-2 {
        grid-column: 4 / 7;
        grid-row: 2 / 5;
    }

    .collage-3 .collage-typo-fragment-3 {
        grid-column: 1 / 4;
        grid-row: 5 / 7;
    }

    .collage-3 .collage-geometric-dots-2 {
        grid-column: 5 / 7;
        grid-row: 4 / 6;
    }

    .resolution-statement {
        font-size: clamp(1.8rem, 5vw, 3rem);
    }
}

/* ============================================================
   REDUCED MOTION
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    .emergence-line {
        width: 40%;
    }

    .site-title,
    .site-subtitle {
        opacity: 1;
    }

    .content-block,
    .margin-annotation,
    .diminishing-sequence,
    .depth-panel-group,
    .collage-element,
    .resolution-content {
        opacity: 1;
        transform: none;
    }

    .section-border::after {
        width: 40%;
    }
}
