/* Palette: #c0603a #8fa88b #d4a54a #6b3e26 #f5ede0 #ebe3d3 #3d2b1f #4a3c2f #8a7a68 #b8a089 #7a6b5a */

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

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

body {
    font-family: 'Source Serif 4', Georgia, serif;
    background-color: #f5ede0;
    color: #4a3c2f;
    line-height: 1.72;
    overflow-x: hidden;
    position: relative;
}

/* === Typography === */
h1, h2, h3 {
    font-family: 'Arbutus Slab', 'Courier New', serif;
    color: #3d2b1f;
    letter-spacing: 0.02em;
    font-weight: 400;
}

/* === Background Wash Blobs === */
.wash-blob {
    position: fixed;
    border-radius: 30% 70% 70% 30% / 30% 30% 70% 70%;
    pointer-events: none;
    z-index: 0;
    filter: blur(40px);
    mix-blend-mode: multiply;
}

.wash-blob-1 {
    width: 600px;
    height: 600px;
    top: -100px;
    left: -150px;
    background: radial-gradient(ellipse at 30% 40%, rgba(192,96,58,0.08) 0%, transparent 70%);
    animation: blobMorph1 12s ease-in-out infinite;
}

.wash-blob-2 {
    width: 500px;
    height: 500px;
    top: 40vh;
    right: -100px;
    background: radial-gradient(ellipse at 60% 50%, rgba(143,168,139,0.07) 0%, transparent 70%);
    animation: blobMorph2 15s ease-in-out infinite;
}

.wash-blob-3 {
    width: 700px;
    height: 700px;
    bottom: -200px;
    left: 30%;
    background: radial-gradient(ellipse at 50% 60%, rgba(212,165,74,0.06) 0%, transparent 70%);
    animation: blobMorph3 10s ease-in-out infinite;
}

@keyframes blobMorph1 {
    0%, 100% { border-radius: 30% 70% 70% 30% / 30% 30% 70% 70%; }
    50% { border-radius: 50% 50% 30% 70% / 60% 40% 60% 40%; }
}

@keyframes blobMorph2 {
    0%, 100% { border-radius: 60% 40% 30% 70% / 50% 60% 40% 50%; }
    50% { border-radius: 40% 60% 70% 30% / 40% 50% 60% 50%; }
}

@keyframes blobMorph3 {
    0%, 100% { border-radius: 40% 60% 50% 50% / 60% 40% 60% 40%; }
    50% { border-radius: 60% 40% 40% 60% / 40% 60% 40% 60%; }
}

/* === Navigation Dots === */
.nav-dots {
    position: fixed;
    right: 24px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    gap: 20px;
    z-index: 100;
}

.nav-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    display: block;
    transition: transform 0.4s ease, width 0.4s ease, border-radius 0.4s ease;
    position: relative;
    text-decoration: none;
}

.nav-dot::after {
    content: attr(data-label);
    position: absolute;
    right: 24px;
    top: 50%;
    transform: translateY(-50%);
    font-family: 'IBM Plex Sans', sans-serif;
    font-size: 0.75rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #8a7a68;
    white-space: nowrap;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.nav-dot:hover {
    transform: scale(1.8);
}

.nav-dot:hover::after {
    opacity: 1;
}

.nav-dot.active {
    transform: scale(1.4);
}

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

.hero-wash {
    position: absolute;
    inset: 0;
    background: 
        radial-gradient(ellipse at 20% 30%, rgba(192,96,58,0.25) 0%, transparent 60%),
        radial-gradient(ellipse at 80% 70%, rgba(212,165,74,0.2) 0%, transparent 60%),
        radial-gradient(ellipse at 50% 50%, rgba(143,168,139,0.1) 0%, transparent 70%);
    animation: heroWashShift 30s ease-in-out infinite;
    z-index: 1;
}

.hero-wash-2 {
    background:
        radial-gradient(ellipse at 70% 20%, rgba(107,62,38,0.08) 0%, transparent 50%),
        radial-gradient(ellipse at 30% 80%, rgba(143,168,139,0.12) 0%, transparent 50%);
    animation: heroWashShift2 25s ease-in-out infinite;
}

@keyframes heroWashShift {
    0%, 100% { opacity: 1; transform: scale(1) translate(0, 0); }
    50% { opacity: 0.85; transform: scale(1.05) translate(2%, -2%); }
}

@keyframes heroWashShift2 {
    0%, 100% { opacity: 0.7; transform: scale(1.05) translate(-1%, 1%); }
    50% { opacity: 1; transform: scale(1) translate(1%, -1%); }
}

.hero-content {
    position: relative;
    z-index: 2;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 32px;
}

.hero-title {
    font-size: clamp(2.5rem, 6vw, 5rem);
    color: #3d2b1f;
    letter-spacing: 0.03em;
}

.compass-rose-large {
    animation: compassSpin 60s linear infinite;
}

.compass-label {
    font-family: 'IBM Plex Sans', sans-serif;
    font-size: 10px;
    fill: #8a7a68;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

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

.scroll-arrow {
    animation: arrowPulse 3s ease-in-out infinite;
}

@keyframes arrowPulse {
    0%, 100% { opacity: 0.4; }
    50% { opacity: 1; }
}

/* === Masonry Section === */
.masonry-section {
    position: relative;
    z-index: 1;
    max-width: 1200px;
    margin: 0 auto;
    padding: 60px 24px 80px;
}

.masonry-grid {
    display: grid;
    grid-template-columns: 30% 40% 30%;
    gap: 24px;
    align-items: start;
}

/* === Relation Cards === */
.relation-card {
    position: relative;
    background-color: #ebe3d3;
    border: 1px solid #b8a089;
    padding: 28px 24px;
    overflow: hidden;
    box-shadow: inset 0 0 60px rgba(184,160,137,0.15);
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.6s ease, transform 0.6s ease, box-shadow 0.3s ease;
    background-image:
        radial-gradient(ellipse at 30% 40%, rgba(192,96,58,0.06) 0%, transparent 70%),
        radial-gradient(ellipse at 70% 70%, rgba(212,165,74,0.05) 0%, transparent 70%);
}

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

.relation-card:hover {
    box-shadow: inset 0 0 60px rgba(184,160,137,0.25), 0 4px 20px rgba(61,43,31,0.08);
}

/* Card aspect variants */
.card-portrait {
    min-height: 380px;
}

.card-landscape {
    min-height: 220px;
    grid-column: span 2;
}

.card-square {
    min-height: 280px;
}

/* Torn edge effect */
.torn-edge {
    clip-path: polygon(0% 4%, 5% 0%, 12% 3%, 18% 1%, 25% 4%, 32% 0%, 38% 2%, 45% 0%, 52% 3%, 58% 1%, 65% 4%, 72% 0%, 78% 2%, 85% 0%, 92% 3%, 100% 1%, 100% 100%, 0% 100%);
}

/* Card blobs */
.card-blob {
    position: absolute;
    width: 100px;
    height: 100px;
    border-radius: 40% 60% 50% 50% / 50% 40% 60% 50%;
    transition: transform 0.6s ease, opacity 0.6s ease;
    pointer-events: none;
    z-index: 0;
    animation: cardBlobMorph 10s ease-in-out infinite;
}

.blob-corner-tl { top: -20px; left: -20px; }
.blob-corner-tr { top: -20px; right: -20px; }
.blob-corner-bl { bottom: -20px; left: -20px; }
.blob-corner-br { bottom: -20px; right: -20px; }

.relation-card:hover .card-blob {
    transform: scale(1.5);
    opacity: 1;
}

@keyframes cardBlobMorph {
    0%, 100% { border-radius: 40% 60% 50% 50% / 50% 40% 60% 50%; }
    33% { border-radius: 50% 50% 40% 60% / 60% 50% 50% 40%; }
    66% { border-radius: 60% 40% 60% 40% / 40% 60% 40% 60%; }
}

.card-meta {
    display: block;
    font-family: 'IBM Plex Sans', sans-serif;
    font-size: 0.75rem;
    font-weight: 400;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #8a7a68;
    margin-bottom: 12px;
    position: relative;
    z-index: 1;
}

.card-title {
    font-size: clamp(1.2rem, 2.5vw, 1.8rem);
    margin-bottom: 14px;
    position: relative;
    z-index: 1;
}

.card-body {
    font-size: clamp(1rem, 1.2vw, 1.15rem);
    line-height: 1.72;
    max-width: 62ch;
    color: #4a3c2f;
    position: relative;
    z-index: 1;
}

.card-annotation {
    margin-top: 16px;
    position: relative;
    z-index: 1;
    opacity: 0.6;
}

/* === Section Divider === */
.section-divider {
    grid-column: 1 / -1;
    display: flex;
    justify-content: center;
    padding: 24px 0;
}

.compass-rose-medium {
    animation: compassSpinReverse 45s linear infinite;
}

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

/* === Measurement Lines === */
.measurement-line {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 24px 0;
    position: relative;
}

.measurement-line::before {
    content: '';
    flex: 1;
    height: 1px;
    background-color: #b8a089;
    position: relative;
}

.measurement-line::after {
    content: '';
    flex: 1;
    height: 1px;
    background-color: #b8a089;
}

.measurement-line::before {
    background-image: linear-gradient(to right, #b8a089 1px, transparent 0);
}

.measure-label {
    font-family: 'IBM Plex Sans', sans-serif;
    font-size: 0.75rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #8a7a68;
    white-space: nowrap;
}

/* Tick marks on measurement lines */
.measurement-line::before,
.measurement-line::after {
    position: relative;
}

/* === Connection Paths SVG === */
.connection-paths {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 2;
}

/* === Root Section === */
.root-section {
    padding: 80px 24px 40px;
    max-width: 1200px;
    margin: 0 auto;
    position: relative;
    z-index: 1;
}

.root-network {
    width: 100%;
    height: auto;
}

.root-path {
    stroke-dasharray: 500;
    stroke-dashoffset: 500;
    transition: stroke-dashoffset 2s ease;
}

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

.root-node {
    opacity: 0;
    transition: opacity 0.6s ease 1.5s;
}

.root-node.visible {
    opacity: 1;
}

.root-label {
    font-family: 'IBM Plex Sans', sans-serif;
    font-size: 9px;
    fill: #8a7a68;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    opacity: 0;
    transition: opacity 0.6s ease 2s;
}

.root-label.visible {
    opacity: 1;
}

/* === Footer === */
.site-footer {
    text-align: center;
    padding: 40px 24px;
    position: relative;
    z-index: 1;
}

.site-footer p {
    font-family: 'Arbutus Slab', serif;
    font-size: 0.8rem;
    color: #7a6b5a;
    letter-spacing: 0.02em;
}

/* === Dot Grid Overlay === */
.dot-grid-overlay {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    background-image: radial-gradient(circle, #8a7a68 1px, transparent 1px);
    background-size: 40px 40px;
    opacity: 0.04;
}

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

    .card-landscape {
        grid-column: span 2;
    }

    .nav-dots {
        right: 12px;
    }

    .nav-dot::after {
        display: none;
    }

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

@media (max-width: 480px) {
    .masonry-grid {
        grid-template-columns: 1fr;
    }

    .card-landscape {
        grid-column: span 1;
    }

    .section-divider {
        grid-column: span 1;
    }

    .masonry-section {
        padding: 40px 16px 60px;
    }
}
