/* Palette references: #d4c9e2 #c8b6d9 #ffffff #fff */
/* === Base Reset & Setup === */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    background: #faf5ef;
    color: #4a4258;
    font-family: 'Nunito Sans', sans-serif;
    font-weight: 400;
    font-size: clamp(1rem, 1.8vw, 1.15rem);
    line-height: 1.72;
    overflow-x: hidden;
}

/* === Floating Background Shapes === */
.bg-shapes {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: -1;
    overflow: hidden;
}

.bg-shape {
    position: absolute;
    border-radius: 50%;
    opacity: 0.05;
}

.shape-1 {
    width: 350px;
    height: 350px;
    background: radial-gradient(circle, #9b8ec4 0%, transparent 70%);
    top: 10%;
    left: -5%;
    animation: floatShape 30s ease-in-out infinite alternate;
}

.shape-2 {
    width: 250px;
    height: 250px;
    background: radial-gradient(circle, #d4b896 0%, transparent 70%);
    top: 30%;
    right: -3%;
    animation: floatShape 25s ease-in-out infinite alternate-reverse;
}

.shape-3 {
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, #9b8ec4 0%, transparent 70%);
    top: 55%;
    left: 20%;
    animation: floatShape 35s ease-in-out infinite alternate;
}

.shape-4 {
    width: 200px;
    height: 200px;
    background: radial-gradient(circle, #d4b896 0%, transparent 70%);
    top: 75%;
    right: 15%;
    animation: floatShape 22s ease-in-out infinite alternate-reverse;
}

.shape-5 {
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, #c9a0a0 0%, transparent 70%);
    top: 5%;
    right: 30%;
    animation: floatShape 40s ease-in-out infinite alternate;
}

@keyframes floatShape {
    0% { transform: translate(0, 0); }
    50% { transform: translate(50px, -30px); }
    100% { transform: translate(-30px, 20px); }
}

/* === Hero Section === */
.hero {
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.hero-reticle {
    position: absolute;
    width: clamp(300px, 60vw, 600px);
    height: clamp(300px, 60vw, 600px);
    animation: rotateReticle 60s linear infinite;
    opacity: 1;
}

@keyframes rotateReticle {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

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

.hero-title {
    font-family: 'Playfair Display', serif;
    font-weight: 700;
    font-size: clamp(3.5rem, 10vw, 8rem);
    color: #3a2e4a;
    letter-spacing: 0.08em;
    line-height: 1.1;
}

.letter {
    display: inline-block;
    animation: letterSpread 3s cubic-bezier(0.25, 0.1, 0.25, 1.0) forwards;
    animation-delay: var(--delay, 0s);
}

@keyframes letterSpread {
    0% { transform: translateX(0) translateY(0); opacity: 1; }
    60% { transform: translateX(0) translateY(0); opacity: 1; }
    100% { transform: translateX(var(--spread-x, 0)) translateY(var(--spread-y, 0)); opacity: 1; letter-spacing: 0.15em; }
}

.hero-connections {
    width: clamp(300px, 80vw, 1000px);
    height: 120px;
    margin-top: -20px;
    opacity: 0;
    animation: fadeInConnections 1.5s ease forwards 2.5s;
}

.hero-line {
    stroke-dasharray: 100;
    stroke-dashoffset: 100;
    animation: drawLine 1.5s ease forwards 2.5s;
}

.hero-node {
    opacity: 0;
    animation: fadeInNode 0.8s ease forwards 3s;
}

@keyframes drawLine {
    to { stroke-dashoffset: 0; }
}

@keyframes fadeInNode {
    to { opacity: 0.5; }
}

@keyframes fadeInConnections {
    to { opacity: 1; }
}

.hero-subtitle {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 500;
    font-size: clamp(1.1rem, 3vw, 1.6rem);
    color: #5a4d6b;
    letter-spacing: 0.03em;
    margin-top: 8px;
    opacity: 0;
    animation: fadeUp 1s ease forwards 3.2s;
}

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

/* === Section Titles === */
.section-title {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 500;
    font-size: clamp(1.5rem, 4vw, 2.8rem);
    color: #5a4d6b;
    letter-spacing: 0.03em;
    text-align: center;
}

.bracket {
    font-family: 'Fira Code', monospace;
    font-weight: 400;
    color: #d4b896;
    font-size: 0.8em;
}

.section-underline {
    display: block;
    width: 200px;
    height: 10px;
    margin: 8px auto 0;
}

.trace-path {
    stroke-dasharray: 400;
    stroke-dashoffset: 400;
    transition: stroke-dashoffset 1.2s ease;
}

.trace-path.visible {
    stroke-dashoffset: 0;
}

/* === Card Grid Section === */
.fragment-grid {
    padding: clamp(60px, 10vw, 120px) clamp(24px, 5vw, 80px);
    max-width: 1200px;
    margin: 0 auto;
}

.card-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 40px 48px;
    margin-top: 60px;
}

.card {
    backdrop-filter: blur(8px);
    background: rgba(250, 245, 239, 0.7);
    border: 1px solid rgba(200, 182, 217, 0.4);
    border-radius: 24px;
    padding: 32px;
    box-shadow: 0 4px 20px rgba(58, 46, 74, 0.06);
    position: relative;
    transition: all 0.4s cubic-bezier(0.25, 0.1, 0.25, 1.0);
    opacity: 0;
    transform: translateY(30px);
}

.card.visible {
    opacity: 1;
    transform: translateY(0);
}

.card.visible.card-offset-up {
    transform: translateY(-20px);
}

.card.visible.card-offset-none {
    transform: translateY(0);
}

.card.visible.card-offset-down {
    transform: translateY(15px);
}

.card:hover {
    box-shadow: 0 12px 40px rgba(58, 46, 74, 0.12);
    border-color: rgba(155, 142, 196, 0.6);
}

.card.visible.card-offset-up:hover {
    transform: translateY(-28px);
}

.card.visible.card-offset-none:hover {
    transform: translateY(-8px);
}

.card.visible.card-offset-down:hover {
    transform: translateY(7px);
}

.card::after {
    content: '';
    position: absolute;
    right: -30px;
    top: 50%;
    width: 0;
    height: 1.5px;
    background: #9b8ec4;
    transition: width 0.5s ease;
}

.card:hover::after {
    width: 60px;
}

.card-label {
    font-family: 'Fira Code', monospace;
    font-size: 0.8rem;
    color: #9b8ec4;
    letter-spacing: 0.04em;
    display: block;
    margin-bottom: 12px;
}

.card-title {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 600;
    font-size: clamp(1.2rem, 2.5vw, 1.6rem);
    color: #3a2e4a;
    margin-bottom: 12px;
}

.card-text {
    color: #4a4258;
    font-size: clamp(0.9rem, 1.5vw, 1rem);
    line-height: 1.7;
}

.card-node {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: radial-gradient(circle, #9b8ec4 0%, transparent 70%);
    animation: pulseNode 3s ease-in-out infinite alternate;
}

@keyframes pulseNode {
    from { opacity: 0.4; }
    to { opacity: 0.7; }
}

/* === Parallax Section === */
.parallax-section {
    min-height: 200vh;
    position: relative;
    background: #f3ece1;
}

.parallax-container {
    position: relative;
    perspective: 1000px;
    transform-style: preserve-3d;
    min-height: 200vh;
}

.parallax-grid-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
}

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

.parallax-content-layer {
    position: relative;
    z-index: 1;
    max-width: 800px;
    margin: 0 auto;
    padding: clamp(80px, 15vw, 160px) clamp(24px, 5vw, 60px);
    display: flex;
    flex-direction: column;
    gap: clamp(60px, 10vw, 120px);
}

.parallax-text-block {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.parallax-text-block.visible {
    opacity: 1;
    transform: translateY(0);
}

.parallax-body {
    color: #4a4258;
    line-height: 1.8;
    font-size: clamp(1rem, 2vw, 1.15rem);
    margin-top: 20px;
}

.parallax-fg-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 2;
    overflow: hidden;
}

.fg-shape {
    position: absolute;
    border-radius: 50%;
    opacity: 0.06;
}

.fg-shape-1 {
    width: 200px;
    height: 200px;
    background: radial-gradient(circle, #9b8ec4, transparent 70%);
    top: 15%;
    right: 5%;
    animation: floatShape 20s ease-in-out infinite alternate;
}

.fg-shape-2 {
    width: 150px;
    height: 150px;
    background: radial-gradient(circle, #d4b896, transparent 70%);
    top: 50%;
    left: 3%;
    animation: floatShape 28s ease-in-out infinite alternate-reverse;
}

.fg-shape-3 {
    width: 180px;
    height: 180px;
    background: radial-gradient(circle, #c9a0a0, transparent 70%);
    top: 78%;
    right: 12%;
    animation: floatShape 24s ease-in-out infinite alternate;
}

/* === Connection Map Section === */
.connection-map {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: clamp(40px, 8vw, 80px) clamp(24px, 5vw, 60px);
}

.graph-container {
    width: 100%;
    max-width: 800px;
    margin-top: 40px;
}

.graph-svg {
    width: 100%;
    height: auto;
}

.node-label {
    font-family: 'Fira Code', monospace;
    font-size: 11px;
    fill: #9b8ec4;
    letter-spacing: 0.04em;
}

.node-pulse {
    animation: nodePulse 4s ease-in-out infinite alternate;
}

@keyframes nodePulse {
    from { transform: scale(1); }
    to { transform: scale(1.03); }
}

.graph-line {
    stroke-dasharray: 300;
    stroke-dashoffset: 300;
    transition: stroke-dashoffset 1.5s ease;
}

.graph-line.visible {
    stroke-dashoffset: 0;
}

/* === Quiet Close Section === */
.quiet-close {
    min-height: 50vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: clamp(40px, 8vw, 80px) clamp(24px, 5vw, 60px);
}

.closing-text {
    font-family: 'Playfair Display', serif;
    font-style: italic;
    font-weight: 400;
    font-size: clamp(1.4rem, 4vw, 2.4rem);
    color: #3a2e4a;
    text-align: center;
    margin-bottom: 40px;
}

.email-form {
    width: 100%;
    max-width: 400px;
}

.email-input {
    width: 100%;
    padding: 16px 24px;
    border: 1px solid rgba(200, 182, 217, 0.4);
    border-radius: 12px;
    background: rgba(250, 245, 239, 0.5);
    backdrop-filter: blur(8px);
    font-family: 'Nunito Sans', sans-serif;
    font-size: 1rem;
    color: #4a4258;
    outline: none;
    transition: border-color 0.4s ease, box-shadow 0.4s ease;
}

.email-input::placeholder {
    color: #9b8ec4;
    opacity: 0.6;
}

.email-input:focus {
    border-color: rgba(155, 142, 196, 0.8);
    box-shadow: 0 0 20px rgba(155, 142, 196, 0.15);
}

/* === Responsive === */
@media (max-width: 768px) {
    .card-grid {
        grid-template-columns: 1fr;
        gap: 24px;
    }

    .card.visible.card-offset-up,
    .card.visible.card-offset-down {
        transform: translateY(0);
    }

    .card.visible.card-offset-up:hover,
    .card.visible.card-offset-none:hover,
    .card.visible.card-offset-down:hover {
        transform: translateY(-8px);
    }

    .card::after {
        display: none;
    }
}
