/* ========================================
   mores.dev — Swiss Trellis Design System
   ======================================== */

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

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

body {
    font-family: 'Lora', Georgia, serif;
    color: #5c5043;
    background-color: #faf6f0;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    /* Decorative grid lines */
    background-image:
        repeating-linear-gradient(
            90deg,
            transparent,
            transparent calc(12.5% - 12px),
            #e0d8ca calc(12.5% - 12px),
            #e0d8ca calc(12.5% - 11px),
            transparent calc(12.5% - 11px),
            transparent 12.5%
        );
    background-size: 100% 100%;
    background-attachment: fixed;
}

/* --- Home Anchor --- */
.home-anchor {
    position: fixed;
    top: 24px;
    left: 24px;
    z-index: 100;
    display: flex;
    align-items: center;
    gap: 8px;
}

.home-word {
    font-family: 'Fira Sans', sans-serif;
    font-weight: 500;
    font-size: 14px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #3b3226;
}

.home-leaf {
    animation: slowSpin 8s linear infinite;
}

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

/* --- Pill Bar --- */
.pill-bar {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 100;
    display: flex;
    gap: 8px;
    padding: 8px 16px;
    background: #f0e8da;
    border-radius: 40px;
    box-shadow: 0 4px 16px rgba(59, 50, 38, 0.1);
}

.pill {
    font-family: 'Fira Sans', sans-serif;
    font-weight: 500;
    font-size: 12px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    line-height: 1.4;
    color: #8b7d6b;
    background: transparent;
    border: 1px solid #8b7d6b;
    border-radius: 20px;
    padding: 6px 16px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.pill:hover {
    background: #c9a88a;
    color: #3b3226;
    border-color: #c9a88a;
}

.pill--active {
    background: #7a8c65;
    color: #faf6f0;
    border-color: #7a8c65;
}

/* --- Zone 1: Canopy (Hero) --- */
.canopy {
    position: relative;
    width: 100%;
    height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

.canopy__leaves {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 1;
}

.canopy__leaf {
    position: absolute;
    opacity: 0;
    will-change: transform;
    animation: leafDrift linear infinite;
}

@keyframes leafDrift {
    0% {
        opacity: 0;
        transform: translateY(-10vh) translateX(0) rotate(0deg);
    }
    10% {
        opacity: var(--leaf-opacity, 0.2);
    }
    90% {
        opacity: var(--leaf-opacity, 0.2);
    }
    100% {
        opacity: 0;
        transform: translateY(110vh) translateX(var(--leaf-drift-x, 50px)) rotate(var(--leaf-rotation, 180deg));
    }
}

.canopy__title {
    font-family: 'Fira Sans', sans-serif;
    font-weight: 900;
    font-size: clamp(48px, 20vw, 200px);
    letter-spacing: -0.02em;
    line-height: 1.0;
    color: #3b3226;
    position: relative;
    z-index: 2;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.canopy__subtitle {
    font-family: 'Lora', Georgia, serif;
    font-style: italic;
    font-weight: 400;
    font-size: clamp(16px, 2.5vw, 24px);
    color: #8b7d6b;
    margin-top: 16px;
    position: relative;
    z-index: 2;
    opacity: 0;
    transform: translateY(20px);
    animation: fadeSlideUp 1s ease-out 1.5s forwards;
}

@keyframes fadeSlideUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* --- Zone 2: Understory (Portfolio Grid) --- */
.understory {
    position: relative;
    padding: 80px 24px 120px;
    min-height: 200vh;
}

.grid-lines {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 0;
}

/* Organic Blobs */
.blob {
    position: absolute;
    pointer-events: none;
    z-index: 0;
    background: #f0e8da;
    opacity: 0.6;
}

.blob--1 {
    width: 400px;
    height: 400px;
    top: 10%;
    left: -5%;
    border-radius: 30% 70% 70% 30% / 30% 30% 70% 70%;
    animation: blobFloat1 20s ease-in-out infinite;
}

.blob--2 {
    width: 350px;
    height: 350px;
    top: 40%;
    right: -8%;
    border-radius: 60% 40% 30% 70% / 60% 30% 70% 40%;
    animation: blobFloat2 25s ease-in-out infinite;
}

.blob--3 {
    width: 300px;
    height: 300px;
    top: 70%;
    left: 20%;
    border-radius: 40% 60% 60% 40% / 50% 40% 60% 50%;
    animation: blobFloat3 18s ease-in-out infinite;
}

@keyframes blobFloat1 {
    0%, 100% { transform: translate(0, 0) rotate(0deg); }
    33% { transform: translate(30px, -20px) rotate(5deg); }
    66% { transform: translate(-15px, 15px) rotate(-3deg); }
}

@keyframes blobFloat2 {
    0%, 100% { transform: translate(0, 0) rotate(0deg); }
    33% { transform: translate(-25px, 20px) rotate(-4deg); }
    66% { transform: translate(20px, -10px) rotate(6deg); }
}

@keyframes blobFloat3 {
    0%, 100% { transform: translate(0, 0) rotate(0deg); }
    33% { transform: translate(20px, 15px) rotate(3deg); }
    66% { transform: translate(-20px, -20px) rotate(-5deg); }
}

/* Portfolio Grid */
.portfolio-grid {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 24px;
    max-width: 1200px;
    margin: 0 auto;
    position: relative;
    z-index: 1;
}

/* --- Specimen Cards --- */
.specimen-card {
    grid-column: span 2;
    background: #faf6f0;
    border-radius: 8px;
    padding: 32px 24px;
    box-shadow: 0 2px 8px rgba(74, 63, 49, 0.06);
    position: relative;
    cursor: pointer;
    opacity: 0;
    transform: perspective(1000px) rotateX(8deg) rotateY(-4deg) translateZ(-30px);
    transition: opacity 0.6s cubic-bezier(0.23, 1, 0.32, 1),
                transform 0.6s cubic-bezier(0.23, 1, 0.32, 1),
                box-shadow 0.3s ease;
}

.specimen-card.is-visible {
    opacity: 1;
    transform: perspective(1000px) rotateX(0) rotateY(0) translateZ(0);
}

.specimen-card--wide {
    grid-column: span 3;
}

/* Asymmetric row pattern: every 3rd row gets varied spans */
.specimen-card:nth-child(3n+1):nth-child(n+4) {
    grid-column: span 3;
}

.specimen-card:nth-child(3n+2):nth-child(n+5) {
    grid-column: span 2;
}

.specimen-card:nth-child(3n+3):nth-child(n+6) {
    grid-column: span 3;
}

.specimen-card:hover {
    transform: perspective(800px) rotateY(3deg) translateY(-4px);
    box-shadow: 0 8px 24px rgba(74, 63, 49, 0.12);
}

.specimen-card:hover .leaf-path {
    fill: rgba(196, 168, 108, 0.2);
    stroke: #a3b87c;
    transform: perspective(800px) rotateY(3deg);
}

.specimen-card__leaf {
    margin-bottom: 16px;
    display: flex;
    justify-content: center;
}

.specimen-card__leaf svg {
    transition: transform 0.4s ease;
}

.leaf-path {
    transition: fill 0.4s ease;
}

.specimen-card__title {
    font-family: 'Fira Sans', sans-serif;
    font-weight: 600;
    font-size: 22px;
    letter-spacing: 0em;
    line-height: 1.2;
    color: #4a3f31;
    margin-bottom: 12px;
}

.specimen-card__desc {
    font-family: 'Lora', Georgia, serif;
    font-weight: 400;
    font-size: 15px;
    letter-spacing: 0.005em;
    line-height: 1.75;
    color: #5c5043;
    margin-bottom: 16px;
}

.specimen-card__label {
    font-family: 'Fira Sans', sans-serif;
    font-weight: 500;
    font-size: 11px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    line-height: 1.4;
    color: #8b7d6b;
    display: inline-block;
    padding: 3px 10px;
    border: 1px solid #8b7d6b;
    border-radius: 12px;
}

.specimen-card.is-hidden {
    display: none;
}

/* --- Zone 3: Forest Floor (Dark Section) --- */
.forest-floor {
    position: relative;
    background: #3b3226;
    color: #f0e8da;
    padding: 120px 24px;
    min-height: 150vh;
    overflow: hidden;
}

.forest-floor__watermark {
    position: absolute;
    opacity: 0.05;
    pointer-events: none;
    z-index: 0;
}

.forest-floor__watermark--1 {
    top: 5%;
    right: 10%;
}

.forest-floor__watermark--2 {
    top: 40%;
    left: 5%;
}

.forest-floor__watermark--3 {
    bottom: 10%;
    right: 15%;
}

.forest-floor__content {
    max-width: 640px;
    margin: 0 auto;
    position: relative;
    z-index: 1;
}

.forest-floor__heading {
    font-family: 'Fira Sans', sans-serif;
    font-weight: 900;
    font-size: clamp(36px, 8vw, 72px);
    letter-spacing: -0.02em;
    line-height: 1.0;
    color: #f0e8da;
    margin-bottom: 32px;
}

.forest-floor__intro {
    font-family: 'Lora', Georgia, serif;
    font-style: italic;
    font-weight: 400;
    font-size: 20px;
    line-height: 1.8;
    color: #c9a88a;
    margin-bottom: 64px;
}

.deep-more {
    margin-bottom: 64px;
    padding-bottom: 64px;
    border-bottom: 1px solid rgba(139, 125, 107, 0.3);
}

.deep-more:last-child {
    border-bottom: none;
}

.deep-more__title {
    font-family: 'Fira Sans', sans-serif;
    font-weight: 600;
    font-size: 28px;
    letter-spacing: 0em;
    line-height: 1.2;
    color: #c4a86c;
    margin-bottom: 24px;
}

.deep-more__text {
    font-family: 'Lora', Georgia, serif;
    font-weight: 400;
    font-size: 20px;
    letter-spacing: 0.005em;
    line-height: 1.8;
    color: #f0e8da;
    margin-bottom: 1.5em;
}

.deep-more__text:last-child {
    margin-bottom: 0;
}

/* --- Zone 4: Root System (Footer) --- */
.root-system {
    position: relative;
    background: #3b3226;
    padding: 80px 24px 48px;
    min-height: 50vh;
    overflow: hidden;
    border-top: 1px solid rgba(139, 125, 107, 0.2);
}

.root-svg {
    width: 100%;
    height: auto;
    max-height: 300px;
}

.root-path {
    stroke-dasharray: var(--path-length, 1000);
    stroke-dashoffset: var(--path-length, 1000);
    transition: stroke-dashoffset 3s ease-in-out;
}

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

.root-links {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.root-link {
    position: absolute;
    font-family: 'Fira Sans', sans-serif;
    font-weight: 500;
    font-size: 11px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #8b7d6b;
    text-decoration: none;
    pointer-events: auto;
    transition: color 0.3s ease;
}

.root-link::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 100%;
    height: 1px;
    background: #c4a86c;
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.3s ease;
}

.root-link:hover {
    color: #c4a86c;
}

.root-link:hover::after {
    transform: scaleX(1);
}

.root-system__colophon {
    text-align: center;
    font-family: 'Fira Sans', sans-serif;
    font-weight: 400;
    font-size: 12px;
    letter-spacing: 0.04em;
    color: #8b7d6b;
    margin-top: 48px;
}

/* --- Home Anchor Light Mode (dark sections) --- */
.home-anchor--light .home-word {
    color: #f0e8da;
}

.home-anchor--light .home-leaf path {
    stroke: #c4a86c;
}

/* --- Responsive --- */
@media (max-width: 1024px) {
    .portfolio-grid {
        grid-template-columns: repeat(4, 1fr);
    }

    .specimen-card,
    .specimen-card--wide,
    .specimen-card:nth-child(3n+1):nth-child(n+4),
    .specimen-card:nth-child(3n+2):nth-child(n+5),
    .specimen-card:nth-child(3n+3):nth-child(n+6) {
        grid-column: span 2;
    }

    .blob {
        display: none;
    }
}

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

    .specimen-card,
    .specimen-card--wide,
    .specimen-card:nth-child(3n+1):nth-child(n+4),
    .specimen-card:nth-child(3n+2):nth-child(n+5),
    .specimen-card:nth-child(3n+3):nth-child(n+6) {
        grid-column: span 1;
    }

    .pill-bar {
        flex-wrap: wrap;
        max-width: 90vw;
        justify-content: center;
    }

    .understory {
        padding: 60px 16px 100px;
    }

    .forest-floor {
        padding: 80px 16px;
    }

    .root-links {
        position: static;
        display: flex;
        flex-wrap: wrap;
        gap: 16px;
        justify-content: center;
        margin-top: 24px;
    }

    .root-link {
        position: static;
    }

    body {
        background-image: none;
    }
}
