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

:root {
    --deep-indigo: #1a1a2e;
    --parchment: #f0e6d3;
    --electric-coral: #ff6b6b;
    --muted-lavender: #7b6fa0;
    --spring-sage: #a8c5a0;
    --slate-fog: #e8e2d8;
    --slate-mid: #3d3d56;
    --surface-alt: #d4cfc7;

    --fg: var(--deep-indigo);
    --bg: var(--parchment);
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'DM Sans', sans-serif;
    font-size: clamp(0.95rem, 1.1vw, 1.1rem);
    line-height: 1.7;
    letter-spacing: 0.005em;
    color: var(--slate-mid);
    background: var(--parchment);
    overflow-x: hidden;
}

/* === Typography === */
.heading-primary {
    font-family: 'Libre Baskerville', serif;
    font-weight: 700;
    font-size: clamp(2.5rem, 6vw, 5rem);
    letter-spacing: -0.02em;
    line-height: 1.1;
    color: var(--fg);
    margin-bottom: 1.5rem;
}

.heading-secondary {
    font-family: 'Libre Baskerville', serif;
    font-weight: 400;
    font-style: italic;
    font-size: clamp(1.5rem, 3vw, 2.5rem);
    letter-spacing: -0.02em;
    color: var(--fg);
}

.body-text {
    font-family: 'DM Sans', sans-serif;
    font-weight: 400;
    font-size: clamp(0.95rem, 1.1vw, 1.1rem);
    line-height: 1.7;
    color: var(--slate-mid);
    max-width: 540px;
}

.label {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.75rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--muted-lavender);
    display: block;
    margin-bottom: 1rem;
}

.text-accent {
    position: relative;
    display: inline;
}

.text-accent::after {
    content: '';
    position: absolute;
    left: 0;
    bottom: -2px;
    width: 100%;
    height: 4px;
    background: var(--electric-coral);
}

/* === Sections === */
.section {
    position: relative;
    width: 100vw;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.section[data-theme="light"] {
    --fg: var(--deep-indigo);
    --bg: var(--parchment);
    background: var(--parchment);
}

.section[data-theme="dark"] {
    --fg: var(--parchment);
    --bg: var(--deep-indigo);
    background: var(--deep-indigo);
}

.section[data-theme="dark"] .body-text {
    color: var(--surface-alt);
}

.section[data-theme="dark"] .label {
    color: var(--muted-lavender);
}

.section__inner {
    width: 100%;
    max-width: 1200px;
    padding: 4rem 2rem;
    position: relative;
    z-index: 2;
}

/* === Grid === */
.grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4rem;
    align-items: center;
}

@media (max-width: 768px) {
    .grid {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
}

/* === Hero === */
.section--hero {
    flex-direction: column;
    gap: 0;
}

.hero-circle {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1;
}

.hero-circle__path {
    animation: drawCircle 1.2s ease-out 0.2s forwards;
}

@keyframes drawCircle {
    to {
        stroke-dashoffset: 175.9;
    }
}

.hero-text {
    position: relative;
    z-index: 2;
    text-align: center;
}

.hero-title {
    font-family: 'Libre Baskerville', serif;
    font-weight: 400;
    font-style: italic;
    font-size: clamp(3rem, 8vw, 6rem);
    letter-spacing: -0.02em;
    color: var(--deep-indigo);
    opacity: 0;
    animation: letterReveal 0.8s ease-out 0.6s forwards;
}

.hero-subtitle {
    font-family: 'DM Sans', sans-serif;
    font-size: clamp(1rem, 1.5vw, 1.25rem);
    color: var(--slate-mid);
    margin-top: 1rem;
    opacity: 0;
    animation: fadeIn 0.6s ease-out 1.2s forwards;
}

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

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* === Section Wipe Transitions === */
.section-wipe {
    height: 30vh;
    position: relative;
    overflow: hidden;
}

.section-wipe[data-wipe="light-to-dark"] {
    background: linear-gradient(to bottom, var(--parchment), var(--deep-indigo));
}

.section-wipe[data-wipe="dark-to-light"] {
    background: linear-gradient(to bottom, var(--deep-indigo), var(--parchment));
}

/* === Geometric Accents === */
.geo-accent--triangle {
    width: 0;
    height: 0;
    border-left: 80px solid transparent;
    border-right: 80px solid transparent;
    border-bottom: 140px solid var(--electric-coral);
    justify-self: end;
    transition: transform 0.3s ease-out;
}

.geo-accent--triangle:hover {
    transform: scale(1.05);
    border-bottom-color: var(--electric-coral);
}

.geo-shape {
    justify-self: end;
    opacity: 0;
    transition: opacity 0.6s ease-out;
}

.geo-shape.visible {
    opacity: 1;
}

.geo-shape:hover {
    animation: shapePulse 0.3s ease-out;
}

@keyframes shapePulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

/* === Diamond Divider === */
.diamond-divider {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    padding: 3rem 0;
    background: var(--parchment);
}

.diamond {
    display: block;
    background: var(--deep-indigo);
    transform: rotate(45deg);
}

.diamond--lg { width: 16px; height: 16px; }
.diamond--md { width: 12px; height: 12px; }
.diamond--sm { width: 10px; height: 10px; }
.diamond--xs { width: 7px; height: 7px; }
.diamond--xxs { width: 5px; height: 5px; }

/* === Dot Grid === */
.dot-grid {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
}

/* === Line Fields === */
.line-field {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
}

/* === Tessellation === */
.tessellation {
    width: 100%;
    height: 300px;
    position: relative;
}

/* === Scroll Reveal === */
.reveal {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.6s cubic-bezier(0.34, 1.56, 0.64, 1),
                transform 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

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

/* === Closing Section === */
.section--closing {
    min-height: 80vh;
}

.hero-circle--closing {
    opacity: 0.3;
}

/* === Responsive === */
@media (max-width: 768px) {
    .section__inner {
        padding: 3rem 1.5rem;
    }

    .geo-accent--triangle {
        border-left-width: 50px;
        border-right-width: 50px;
        border-bottom-width: 87px;
    }

    .hero-circle {
        width: 220px;
        height: 220px;
    }
}
