/* ============================================
   continu.st — Mcbling Thesis Defense
   Cool-gray academic sparkle
   ============================================ */

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

html {
    scroll-behavior: smooth;
    overflow-x: hidden;
}

body {
    font-family: 'Nunito Sans', sans-serif;
    font-weight: 400;
    font-size: clamp(0.95rem, 1.6vw, 1.15rem);
    line-height: 1.72;
    color: #4A5568;
    background: #F7FAFC;
    overflow-x: hidden;
    /* Grid-line underlay */
    background-image:
        repeating-linear-gradient(0deg, transparent, transparent 47.5px, rgba(168,178,189,0.06) 47.5px, rgba(168,178,189,0.06) 48px),
        repeating-linear-gradient(90deg, transparent, transparent 47.5px, rgba(168,178,189,0.06) 47.5px, rgba(168,178,189,0.06) 48px);
}

/* --- Typography --- */
h1, h2, h3 {
    font-family: 'Josefin Sans', sans-serif;
    font-weight: 700;
    color: #2C3E50;
    letter-spacing: 0.06em;
    text-shadow: 0 0 12px rgba(74, 144, 184, 0.15);
}

.section-heading {
    font-size: clamp(2rem, 4.5vw, 3.8rem);
    margin-bottom: 1.5rem;
    position: relative;
    transition: text-shadow 0.3s ease;
}

.section-heading:hover {
    text-shadow: 0 0 20px rgba(74, 144, 184, 0.3), 0 0 40px rgba(74, 144, 184, 0.1);
}

.section-num {
    font-weight: 300;
    font-size: 70%;
    color: #A8B2BD;
    margin-right: 0.3em;
}

p {
    max-width: 38em;
    margin-bottom: 1.2em;
}

.mono {
    font-family: 'DM Mono', monospace;
    font-size: 0.9em;
    color: #6B7C8D;
    background: rgba(168, 178, 189, 0.08);
    padding: 2px 6px;
    border-radius: 3px;
}

.formula {
    text-align: center;
    margin: 2em 0;
}

.formula .mono {
    font-size: 1.05em;
    padding: 8px 16px;
}

/* --- Pull Quotes --- */
.pull-quote {
    font-family: 'Josefin Sans', sans-serif;
    font-weight: 300;
    font-style: italic;
    font-size: clamp(1.3rem, 2.8vw, 2rem);
    color: #4A90B8;
    margin: 2em 0;
    padding-left: 1em;
    border-left: none;
    max-width: 32em;
}

.pull-quote span {
    display: block;
    margin-top: 0.5em;
}

.quote-squiggle {
    display: block;
    margin-bottom: 0.3em;
}

/* --- Diagonal Sections --- */
.diagonal-section {
    position: relative;
    min-height: 100vh;
    padding: 10vh 6vw 12vh;
    overflow: hidden;
}

.section-odd {
    background: #F7FAFC;
    clip-path: polygon(0 6vh, 100% 0, 100% calc(100% - 6vh), 0 100%);
    margin-top: -6vh;
}

.section-even {
    background: #EDF2F7;
    clip-path: polygon(0 0, 100% 6vh, 100% 100%, 0 calc(100% - 6vh));
    margin-top: -6vh;
}

.section-header {
    background: linear-gradient(180deg, #1A2530 0%, #2C3E50 40%, #F7FAFC 100%);
    clip-path: polygon(0 0, 100% 0, 100% calc(100% - 7vh), 0 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.section-footer {
    background: #1A2530;
    clip-path: polygon(0 7vh, 100% 0, 100% 100%, 0 100%);
    margin-top: -6vh;
    min-height: 50vh;
}

/* Watercolor wash overlay */
.diagonal-section::before {
    content: '';
    position: absolute;
    inset: 0;
    opacity: 0.45;
    pointer-events: none;
    z-index: 0;
}

.section-odd::before {
    background:
        radial-gradient(ellipse at 20% 30%, rgba(209,216,224,0.5) 0%, transparent 60%),
        radial-gradient(ellipse at 80% 70%, rgba(191,207,218,0.4) 0%, transparent 55%),
        radial-gradient(ellipse at 50% 50%, rgba(237,242,247,0.3) 0%, transparent 70%);
    filter: url(#watercolor-wash-1);
}

.section-even::before {
    background:
        radial-gradient(ellipse at 70% 20%, rgba(209,216,224,0.5) 0%, transparent 55%),
        radial-gradient(ellipse at 30% 80%, rgba(191,207,218,0.4) 0%, transparent 60%),
        radial-gradient(ellipse at 50% 40%, rgba(237,242,247,0.3) 0%, transparent 65%);
    filter: url(#watercolor-wash-2);
}

.section-break::before {
    background:
        radial-gradient(ellipse at 40% 30%, rgba(209,216,224,0.6) 0%, transparent 50%),
        radial-gradient(ellipse at 60% 70%, rgba(191,207,218,0.55) 0%, transparent 50%),
        radial-gradient(ellipse at 50% 50%, rgba(168,178,189,0.2) 0%, transparent 60%);
    filter: url(#watercolor-wash-3);
    opacity: 0.55;
}

.section-continuum::before {
    background:
        radial-gradient(ellipse at 25% 25%, rgba(209,216,224,0.5) 0%, transparent 50%),
        radial-gradient(ellipse at 75% 75%, rgba(191,207,218,0.5) 0%, transparent 50%),
        radial-gradient(ellipse at 50% 50%, rgba(127,179,211,0.1) 0%, transparent 70%);
    filter: url(#watercolor-wash-1);
    opacity: 0.5;
}

/* Intensified grid for "The Break" section */
.section-break {
    background-image:
        repeating-linear-gradient(0deg, transparent, transparent 47px, rgba(74,144,184,0.1) 47px, rgba(74,144,184,0.1) 48px),
        repeating-linear-gradient(90deg, transparent, transparent 47px, rgba(74,144,184,0.1) 47px, rgba(74,144,184,0.1) 48px);
    background-color: #F7FAFC;
}

/* Full grid for "The Continuum" section */
.section-continuum {
    background-image:
        repeating-linear-gradient(0deg, transparent, transparent 47px, rgba(74,144,184,0.12) 47px, rgba(74,144,184,0.12) 48px),
        repeating-linear-gradient(90deg, transparent, transparent 47px, rgba(74,144,184,0.12) 47px, rgba(74,144,184,0.12) 48px);
    background-color: #F7FAFC;
}

/* Background section numbers */
.section-bg-number {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-family: 'Josefin Sans', sans-serif;
    font-weight: 300;
    font-size: clamp(4rem, 12vw, 10rem);
    color: #A8B2BD;
    opacity: 0.04;
    pointer-events: none;
    z-index: 0;
    user-select: none;
}

/* --- Section Content Layout --- */
.section-content-wrap {
    position: relative;
    z-index: 1;
    display: grid;
    gap: 3rem;
    max-width: 1200px;
    margin: 0 auto;
    align-items: center;
}

.section-odd .section-content-wrap {
    grid-template-columns: 2fr 1fr;
}

.section-even .section-content-wrap {
    grid-template-columns: 1fr 2fr;
}

.section-full-width {
    grid-template-columns: 2fr 1fr;
}

.section-header .section-content-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.section-footer .section-content-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
}

/* --- Header --- */
.header-content {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.lemniscate {
    margin-bottom: 2rem;
}

#lemniscate-path {
    stroke-dasharray: 600;
    stroke-dashoffset: 600;
}

.site-title {
    font-size: clamp(3rem, 8vw, 6rem);
    font-weight: 700;
    color: #F7FAFC;
    letter-spacing: 0.08em;
    text-shadow: 0 0 30px rgba(74, 144, 184, 0.25), 0 0 60px rgba(74, 144, 184, 0.1);
    margin-bottom: 1rem;
}

.site-tagline {
    font-family: 'Nunito Sans', sans-serif;
    font-weight: 400;
    font-style: italic;
    font-size: clamp(1rem, 2vw, 1.3rem);
    color: #BFCFDA;
    max-width: 36em;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 1s ease 2.2s, transform 1s ease 2.2s;
}

.site-tagline.visible {
    opacity: 1;
    transform: translateY(0);
}

/* --- Footer --- */
.footer-content {
    text-align: center;
}

.footer-domain {
    font-family: 'Josefin Sans', sans-serif;
    font-weight: 300;
    font-size: clamp(1.5rem, 3vw, 2.5rem);
    color: #D1D8E0;
    letter-spacing: 0.1em;
    margin-bottom: 0.5em;
}

.footer-line {
    font-family: 'Nunito Sans', sans-serif;
    font-style: italic;
    font-weight: 300;
    color: #6B7C8D;
    margin-bottom: 2em;
}

.footer-diamond {
    animation: sparkle-pulse 2s ease-in-out infinite;
}

/* --- Accent Column --- */
.section-accent {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
}

.accent-curve {
    display: block;
    margin: 0 auto;
}

.accent-path {
    stroke-dasharray: 800;
    stroke-dashoffset: 800;
    transition: stroke-dashoffset 1.5s cubic-bezier(0.25, 0.1, 0.25, 1);
}

.accent-path.drawn {
    stroke-dashoffset: 0;
}

.accent-grid-pattern {
    width: 180px;
    height: 280px;
    background-image:
        repeating-linear-gradient(0deg, transparent, transparent 23px, rgba(168,178,189,0.15) 23px, rgba(168,178,189,0.15) 24px),
        repeating-linear-gradient(90deg, transparent, transparent 23px, rgba(168,178,189,0.15) 23px, rgba(168,178,189,0.15) 24px);
    border-radius: 4px;
    position: relative;
    overflow: hidden;
}

.accent-grid-pattern::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at center, rgba(74,144,184,0.12) 0%, transparent 70%);
    filter: url(#watercolor-wash-2);
    opacity: 0.6;
}

/* --- Diagonal Rule Line --- */
#diagonal-rule {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 10;
    opacity: 0.5;
}

/* --- Crystal Navigator --- */
#crystal-nav {
    position: fixed;
    right: 24px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 100;
    display: flex;
    flex-direction: column;
    gap: 16px;
    align-items: center;
}

.crystal-diamond {
    cursor: pointer;
    transition: transform 0.3s ease, filter 0.3s ease;
    opacity: 0.8;
}

.crystal-diamond:hover {
    transform: scale(1.3);
}

.crystal-diamond.active svg rect {
    fill: #4A90B8;
    transition: fill 0.3s ease;
}

.crystal-diamond.active {
    filter: drop-shadow(0 0 3px rgba(74, 144, 184, 0.4));
    animation: sparkle-pulse 2s ease-in-out infinite;
}

/* --- Seam Zones --- */
.seam-zone {
    position: relative;
    height: 60px;
    z-index: 5;
    margin: -3vh 0;
}

.seam-zone svg {
    width: 100%;
    height: 100%;
}

.seam-curve {
    stroke-dasharray: 1200;
    stroke-dashoffset: 1200;
    transition: stroke-dashoffset 1.2s cubic-bezier(0.25, 0.1, 0.25, 1);
}

.seam-curve.drawn {
    stroke-dashoffset: 0;
}

.seam-sparkle {
    transition: opacity 0.4s ease, r 0.4s ease;
}

.seam-sparkle.visible {
    opacity: 1;
}

/* --- Sparkle Clusters --- */
.sparkle-cluster {
    position: relative;
    display: flex;
    gap: 6px;
    align-items: center;
    justify-content: center;
    margin-top: 1.5rem;
}

.sparkle {
    opacity: 0;
    transform: scale(0.5);
    transition: opacity 0.5s ease, transform 0.5s ease;
}

.sparkle.visible {
    opacity: 1;
    transform: scale(1);
    animation: sparkle-pulse var(--sparkle-duration, 2s) ease-in-out var(--sparkle-delay, 0s) infinite;
}

.sparkle-point {
    transition: opacity 0.5s ease;
}

.sparkle-point.visible {
    opacity: 1;
    animation: sparkle-pulse 2.5s ease-in-out infinite;
}

/* --- Sparkle Animations --- */
@keyframes sparkle-pulse {
    0%, 100% {
        opacity: 0.3;
        transform: scale(0.8);
    }
    50% {
        opacity: 1;
        transform: scale(1.1);
    }
}

/* Heading sparkle on hover */
.section-heading .heading-sparkle {
    display: inline-flex;
    gap: 3px;
    margin-left: 8px;
    vertical-align: middle;
    opacity: 0;
    transform: scale(0.3);
    transition: opacity 0.25s ease, transform 0.25s ease;
}

.section-heading:hover .heading-sparkle {
    opacity: 1;
    transform: scale(1);
}

.heading-sparkle svg {
    animation: sparkle-pulse 0.8s ease-in-out;
}

/* --- Gem Markers on Diagonal Rule --- */
.gem-marker {
    transition: fill 0.3s ease, opacity 0.3s ease;
}

.gem-marker.passed {
    fill: #4A90B8;
    animation: gem-flash 0.6s ease-out;
}

@keyframes gem-flash {
    0% {
        fill: #BFCFDA;
        opacity: 0.6;
    }
    50% {
        fill: #4A90B8;
        opacity: 1;
    }
    100% {
        fill: #7FB3D3;
        opacity: 0.8;
    }
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .section-odd .section-content-wrap,
    .section-even .section-content-wrap,
    .section-full-width {
        grid-template-columns: 1fr;
    }

    .section-even .section-accent {
        order: -1;
    }

    .diagonal-section {
        padding: 8vh 5vw 10vh;
    }

    #crystal-nav {
        right: 10px;
        gap: 12px;
    }

    .accent-curve,
    .accent-grid-pattern {
        max-width: 150px;
        max-height: 200px;
    }

    .seam-zone {
        height: 40px;
    }
}

@media (max-width: 480px) {
    .section-heading {
        font-size: clamp(1.5rem, 6vw, 2.2rem);
    }

    .site-title {
        font-size: clamp(2rem, 10vw, 3.5rem);
    }

    #crystal-nav {
        display: none;
    }
}
