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

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Nunito', sans-serif;
    font-weight: 400;
    font-size: 16px;
    line-height: 1.6;
    color: #2a2a2a;
    background-color: #f5f0e8;
    /* Paper grain texture using CSS noise */
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='200' height='200' filter='url(%23n)' opacity='0.03'/%3E%3C/svg%3E");
    overflow-x: hidden;
}

/* === HERO CARD === */
.hero-card {
    width: 100%;
    min-height: 60vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px max(32px, 4vw);
    position: relative;
}

.hero-content {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.site-title {
    font-family: 'Caveat', cursive;
    font-weight: 700;
    font-size: clamp(32px, 5vw, 72px);
    letter-spacing: 0.01em;
    line-height: 1.15;
    color: #2a2a2a;
    margin-bottom: 12px;
}

.hero-subtitle {
    font-family: 'Caveat', cursive;
    font-weight: 400;
    font-size: clamp(16px, 2.5vw, 28px);
    color: #6b6b6b;
    letter-spacing: 0.02em;
    margin-bottom: 32px;
}

.hero-botanical {
    width: clamp(200px, 40vw, 300px);
    height: auto;
    margin-bottom: 24px;
}

.pencil-divider {
    width: 100%;
    height: 20px;
    display: block;
}

/* === FLIP TOGGLE === */
.flip-toggle {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 100;
    background: #f5f0e8;
    border: 1.5px solid #2a2a2a;
    border-radius: 3px;
    padding: 8px 14px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    transition: background-color 0.3s ease, border-color 0.3s ease;
    box-shadow: 2px 3px 0 rgba(42,42,42,0.12);
}

.flip-toggle:hover {
    border-color: #e8a0a0;
    background: #f0ebe0;
}

.flip-label {
    font-family: 'Caveat', cursive;
    font-weight: 400;
    font-size: 14px;
    color: #2a2a2a;
    line-height: 1;
}

.flip-toggle.active {
    background: #f0ebe0;
    border-color: #e8a0a0;
}

.flip-toggle.active .flip-label {
    color: #e8a0a0;
}

/* === SPECIMEN GRID === */
.specimen-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 24px;
    padding: 24px max(32px, 4vw);
    position: relative;
    max-width: 1400px;
    margin: 0 auto;
}

/* === MARGINALIA === */
.marginalia {
    position: absolute;
    font-family: 'Caveat', cursive;
    font-size: 12px;
    color: #b0b0b0;
    writing-mode: vertical-rl;
    text-orientation: mixed;
    pointer-events: none;
    z-index: 1;
    opacity: 0.6;
}

.marginalia-1 {
    left: max(8px, 1vw);
    top: 120px;
}

.marginalia-2 {
    right: max(8px, 1vw);
    top: 380px;
}

.marginalia-3 {
    left: max(8px, 1vw);
    top: 640px;
}

/* === ERASER SMUDGES === */
.eraser-smudge {
    position: absolute;
    border-radius: 50%;
    pointer-events: none;
    z-index: 0;
}

.smudge-1 {
    width: 120px;
    height: 80px;
    background: radial-gradient(ellipse, rgba(232,160,160,0.08) 0%, transparent 70%);
    top: 200px;
    left: 15%;
}

.smudge-2 {
    width: 100px;
    height: 100px;
    background: radial-gradient(ellipse, rgba(232,160,160,0.06) 0%, transparent 70%);
    top: 500px;
    right: 20%;
}

.smudge-3 {
    width: 80px;
    height: 110px;
    background: radial-gradient(ellipse, rgba(232,160,160,0.07) 0%, transparent 70%);
    top: 900px;
    left: 40%;
}

/* === SPECIMEN CARD === */
.specimen-card {
    background: #f5f0e8;
    border: 1.5px solid #2a2a2a;
    border-radius: 3px;
    padding: 28px 24px;
    box-shadow: 2px 3px 0 rgba(42,42,42,0.12);
    position: relative;
    z-index: 2;
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.5s ease, transform 0.5s ease;
}

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

.specimen-card:nth-child(even) {
    background: #f0ebe0;
}

.specimen-card:nth-child(3n) {
    background: #d9d0c4;
}

/* Card height variations */
.card-short {
    min-height: 280px;
}

.card-medium {
    min-height: 360px;
}

.card-tall {
    min-height: 440px;
}

/* Hover interaction */
@media (hover: hover) {
    .specimen-card {
        transition: opacity 0.5s ease, transform 0.5s ease;
    }

    .specimen-card.visible {
        transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.3s ease;
    }

    .specimen-card.visible:hover {
        transform: scale(1.03);
        box-shadow: 4px 6px 0 rgba(42,42,42,0.15);
    }

    .specimen-card:hover .divider-path {
        stroke: #e8a0a0;
        transition: stroke 0.6s ease;
    }

    .specimen-card:hover .card-loose .card-text-loose,
    .specimen-card:hover .card-loose .card-title-loose {
        transform: rotate(-1.5deg);
    }
}

/* === CARD INNER / DUALITY SPLIT === */
.card-inner {
    display: flex;
    height: 100%;
    gap: 0;
    align-items: stretch;
}

.card-side {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.card-precise {
    padding-right: 14px;
}

.card-loose {
    padding-left: 14px;
}

/* Divider line */
.divider-line {
    width: 4px;
    flex-shrink: 0;
    align-self: stretch;
    min-height: 100%;
}

.divider-path {
    stroke: #b0b0b0;
    transition: stroke 0.6s ease;
}

/* === SPECIMEN LABELS === */
.specimen-label {
    font-family: 'Nunito', sans-serif;
    font-weight: 700;
    font-size: 11px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #888888;
    display: block;
    margin-bottom: 4px;
}

/* === CARD TITLES === */
.card-title-precise {
    font-family: 'Caveat', cursive;
    font-weight: 700;
    font-size: clamp(20px, 3vw, 28px);
    line-height: 1.15;
    letter-spacing: 0.01em;
    color: #2a2a2a;
}

.card-title-loose {
    font-family: 'Caveat', cursive;
    font-weight: 400;
    font-size: clamp(22px, 3.2vw, 30px);
    line-height: 1.15;
    letter-spacing: 0.01em;
    color: #4a4a4a;
    transform: rotate(-0.8deg);
    transition: transform 0.4s ease;
}

/* === CARD TEXT === */
.card-text-precise {
    font-family: 'Nunito', sans-serif;
    font-weight: 400;
    font-size: 14px;
    line-height: 1.6;
    color: #2a2a2a;
}

.card-text-loose {
    font-family: 'Caveat', cursive;
    font-weight: 400;
    font-size: 16px;
    line-height: 1.5;
    color: #4a4a4a;
    transform: rotate(-0.8deg);
    transition: transform 0.4s ease;
}

/* === BOTANICAL ILLUSTRATIONS === */
.botanical-precise,
.botanical-loose {
    width: 50px;
    height: 66px;
    display: block;
    margin: 4px 0;
}

/* Accent word highlighting */
.card-text-precise .accent,
.card-text-loose .accent {
    color: #e8a0a0;
    font-weight: 700;
}

/* === FLIPPED STATE === */
.specimen-grid.flipped .card-precise .card-title-precise {
    font-family: 'Caveat', cursive;
    font-weight: 400;
    font-size: clamp(22px, 3.2vw, 30px);
    color: #4a4a4a;
    transform: rotate(-0.8deg);
}

.specimen-grid.flipped .card-precise .card-text-precise {
    font-family: 'Caveat', cursive;
    font-weight: 400;
    font-size: 16px;
    line-height: 1.5;
    color: #4a4a4a;
    transform: rotate(-0.8deg);
}

.specimen-grid.flipped .card-loose .card-title-loose {
    font-family: 'Caveat', cursive;
    font-weight: 700;
    font-size: clamp(20px, 3vw, 28px);
    color: #2a2a2a;
    transform: rotate(0deg);
}

.specimen-grid.flipped .card-loose .card-text-loose {
    font-family: 'Nunito', sans-serif;
    font-weight: 400;
    font-size: 14px;
    line-height: 1.6;
    color: #2a2a2a;
    transform: rotate(0deg);
}

.specimen-grid.flipped .card-precise {
    transition: all 0.8s ease;
}

.specimen-grid.flipped .card-loose {
    transition: all 0.8s ease;
}

.specimen-grid.flipped .card-title-precise,
.specimen-grid.flipped .card-text-precise,
.specimen-grid.flipped .card-title-loose,
.specimen-grid.flipped .card-text-loose {
    transition: font-family 0.8s ease, color 0.8s ease, transform 0.8s ease, font-size 0.8s ease;
}

/* Normal state transitions */
.card-title-precise,
.card-text-precise,
.card-title-loose,
.card-text-loose {
    transition: font-family 0.8s ease, color 0.8s ease, transform 0.8s ease, font-size 0.8s ease;
}

/* === COMPASS ROSE === */
.compass-rose {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 100;
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
}

.compass-star {
    transition: stroke 0.3s ease, fill 0.3s ease;
}

.compass-rose:hover .compass-star {
    stroke: #e8a0a0;
}

.compass-labels {
    position: absolute;
    width: 120px;
    height: 120px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.compass-rose:hover .compass-labels {
    opacity: 1;
    pointer-events: auto;
}

.compass-label {
    position: absolute;
    font-family: 'Caveat', cursive;
    font-weight: 400;
    font-size: 12px;
    color: #6b6b6b;
    cursor: pointer;
    pointer-events: auto;
    white-space: nowrap;
    transition: color 0.2s ease;
}

.compass-label:hover {
    color: #e8a0a0;
}

.compass-n {
    top: -18px;
    left: 50%;
    transform: translateX(-50%);
}

.compass-e {
    right: -32px;
    top: 50%;
    transform: translateY(-50%);
}

.compass-s {
    bottom: -18px;
    left: 50%;
    transform: translateX(-50%);
}

.compass-w {
    left: -32px;
    top: 50%;
    transform: translateY(-50%);
}

/* === FOOTER === */
.site-footer {
    padding: 40px max(32px, 4vw);
    text-align: center;
    max-width: 800px;
    margin: 40px auto 0;
}

.footer-divider {
    margin-bottom: 24px;
}

.footer-text {
    font-family: 'Caveat', cursive;
    font-weight: 400;
    font-size: 18px;
    color: #6b6b6b;
    margin-bottom: 8px;
}

.footer-meta {
    font-family: 'Nunito', sans-serif;
    font-weight: 700;
    font-size: 11px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #b0b0b0;
}

/* === SVG DRAW ANIMATION === */
.botanical-precise path,
.botanical-precise circle,
.botanical-precise ellipse,
.botanical-precise line,
.botanical-loose path,
.botanical-loose circle,
.botanical-loose ellipse,
.botanical-loose line {
    stroke-dasharray: 200;
    stroke-dashoffset: 200;
    transition: stroke-dashoffset 1.2s ease-in-out;
}

.specimen-card.visible .botanical-precise path,
.specimen-card.visible .botanical-precise circle,
.specimen-card.visible .botanical-precise ellipse,
.specimen-card.visible .botanical-precise line,
.specimen-card.visible .botanical-loose path,
.specimen-card.visible .botanical-loose circle,
.specimen-card.visible .botanical-loose ellipse,
.specimen-card.visible .botanical-loose line {
    stroke-dashoffset: 0;
}

/* Hero botanical draw animation */
.hero-botanical path,
.hero-botanical circle,
.hero-botanical line {
    stroke-dasharray: 300;
    stroke-dashoffset: 300;
    animation: drawHero 2s ease-in-out forwards;
}

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

/* === MOBILE RESPONSIVE === */
@media (max-width: 700px) {
    .specimen-grid {
        grid-template-columns: 1fr;
        padding: 16px;
        gap: 16px;
    }

    .hero-card {
        min-height: 50vh;
        padding: 40px 16px;
    }

    .marginalia {
        display: none;
    }

    .compass-rose {
        bottom: 16px;
        right: 16px;
    }

    .flip-toggle {
        top: 16px;
        right: 16px;
    }

    .card-inner {
        flex-direction: column;
        gap: 16px;
    }

    .divider-line {
        width: 100%;
        height: 4px;
        min-height: 4px;
    }

    .card-precise {
        padding-right: 0;
        padding-bottom: 8px;
    }

    .card-loose {
        padding-left: 0;
        padding-top: 8px;
    }

    .specimen-card {
        padding: 20px 16px;
    }

    .card-short,
    .card-medium,
    .card-tall {
        min-height: auto;
    }
}
