/* ==========================================================
   completengine.net — Neubrutalist Botanical Engine Sketchbook
   Colors: #1A1A1A, #C4673A, #F5DCC3, #8B9A6B, #FFF8F0, #E8C87A, #A8623B, #4A3728
   Fonts: IBM Plex Mono, Caveat
   ========================================================== */

/* --- Reset & Base --- */

*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

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

body {
    background-color: #C4673A;
    color: #1A1A1A;
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 400;
    line-height: 1.9;
    -webkit-font-smoothing: antialiased;
}

/* --- Stacked Section Panels --- */

.panel {
    position: relative;
    min-height: 85vh;
    background-color: #FFF8F0;
    border: 4px solid #1A1A1A;
    margin: 0 24px;
    box-shadow: 8px 8px 0px #1A1A1A;
    overflow: hidden;
    opacity: 0;
    transition: opacity 200ms ease;
}

.panel.visible {
    opacity: 1;
}

.panel-title {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.panel-blueprint {
    min-height: 90vh;
}

.panel-fieldnotes {
    min-height: 85vh;
}

.panel-specimens {
    min-height: 90vh;
}

.panel-endpaper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* --- Cross-hatch background texture --- */

.panel::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image:
        repeating-linear-gradient(
            45deg,
            transparent,
            transparent 8px,
            rgba(164, 98, 59, 0.03) 8px,
            rgba(164, 98, 59, 0.03) 9px
        ),
        repeating-linear-gradient(
            -45deg,
            transparent,
            transparent 8px,
            rgba(164, 98, 59, 0.03) 8px,
            rgba(164, 98, 59, 0.03) 9px
        );
    pointer-events: none;
    z-index: 0;
}

.panel-content {
    position: relative;
    z-index: 1;
}

/* --- Section Separators --- */

.section-separator {
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 24px;
}

.section-separator svg {
    width: 100%;
    height: 40px;
}

/* --- Corner Ornaments --- */

.corner-ornament {
    position: absolute;
    width: 40px;
    height: 40px;
    z-index: 2;
    opacity: 0;
    transition: opacity 400ms ease;
}

.panel.visible .corner-ornament {
    opacity: 0.6;
}

.corner-ornament svg {
    width: 100%;
    height: 100%;
}

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

/* Ornament path draw-in animation */
.ornament-path {
    stroke-dasharray: 150;
    stroke-dashoffset: 150;
    transition: stroke-dashoffset 400ms ease 100ms;
}

.panel.visible .ornament-path {
    stroke-dashoffset: 0;
}

/* --- Section Headings --- */

.section-heading {
    font-family: 'Caveat', cursive;
    font-weight: 700;
    font-size: 60px;
    color: #C4673A;
    margin-bottom: 32px;
    line-height: 1.2;
}

.heading-tilt {
    transform: rotate(-1.5deg);
    transform-origin: left center;
}

/* --- Reveal Items (scroll animation) --- */

.reveal-item {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 300ms ease, transform 300ms ease;
}

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

/* --- Title Page --- */

.title-content {
    text-align: center;
    padding: 40px;
    width: 100%;
}

.title-wordmark {
    margin-bottom: 24px;
}

.title-svg {
    width: 100%;
    max-width: 800px;
    height: auto;
}

.vine-path {
    stroke-dasharray: 200;
    stroke-dashoffset: 200;
    transition: stroke-dashoffset 1500ms ease 500ms;
}

.panel.visible .vine-path {
    stroke-dashoffset: 0;
}

.title-subtitle {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 400;
    font-size: 16px;
    color: #A8623B;
    letter-spacing: 0.05em;
    margin-bottom: 48px;
}

.scroll-arrow {
    display: inline-block;
    animation: float 2.5s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(10px); }
}

/* --- Blueprint Section --- */

.blueprint-content {
    padding: 60px 40px;
}

.blueprint-diagram {
    width: 100%;
    display: flex;
    justify-content: center;
    margin-bottom: 32px;
}

.engine-svg {
    width: 100%;
    max-width: 700px;
    height: auto;
}

/* SVG path draw animation */
.draw-path {
    stroke-dasharray: 600;
    stroke-dashoffset: 600;
    transition: stroke-dashoffset 1800ms ease;
}

.panel.visible .draw-path {
    stroke-dashoffset: 0;
}

.engine-part {
    opacity: 0;
    transition: opacity 400ms ease 500ms;
}

.panel.visible .engine-part {
    opacity: 1;
}

.annotation {
    opacity: 0;
    transition: opacity 300ms ease 800ms;
}

.panel.visible .annotation {
    opacity: 1;
}

.blueprint-caption {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 400;
    font-size: 14px;
    color: #A8623B;
    max-width: 640px;
    text-align: left;
    line-height: 1.8;
}

/* --- Field Notes Section --- */

.fieldnotes-content {
    padding: 60px 40px;
    position: relative;
}

.journal-entries {
    max-width: 640px;
    margin: 0 auto;
}

.journal-entry {
    margin-bottom: 48px;
    position: relative;
}

.entry-date {
    font-family: 'Caveat', cursive;
    font-weight: 400;
    font-size: 22px;
    color: #C4673A;
    display: block;
    margin-bottom: 8px;
}

.journal-entry p {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 400;
    font-size: 16px;
    color: #1A1A1A;
    line-height: 1.9;
    margin-bottom: 12px;
}

.journal-entry em {
    font-style: italic;
    color: #4A3728;
}

.margin-note {
    font-family: 'Caveat', cursive;
    font-weight: 400;
    font-size: 14px;
    color: #A8623B;
    display: block;
    margin-top: 8px;
    padding-left: 16px;
    border-left: 2px solid #E8C87A;
}

.margin-illustration {
    position: absolute;
    right: 40px;
    top: 200px;
    opacity: 0.6;
}

.margin-sketch {
    width: 80px;
    height: 120px;
}

.annotation-hover {
    transition: transform 150ms cubic-bezier(0.34, 1.56, 0.64, 1);
    cursor: default;
}

.annotation-hover:hover {
    transform: scale(1.06);
}

/* --- Specimen Collection --- */

.specimens-content {
    padding: 60px 40px;
}

.specimens-intro {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 400;
    font-size: 15px;
    color: #A8623B;
    margin-bottom: 40px;
    max-width: 500px;
}

.specimen-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 24px;
    max-width: 900px;
    justify-content: flex-start;
}

.specimen-card {
    background-color: #FFF8F0;
    border: 3px solid #1A1A1A;
    box-shadow: 4px 4px 0px #1A1A1A;
    padding: 24px;
    width: 260px;
    transition: transform 150ms cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 150ms ease;
    cursor: default;
}

.specimen-card:hover {
    transform: scale(1.08) rotate(0deg) !important;
    box-shadow: 6px 6px 0px #1A1A1A;
    z-index: 5;
}

.specimen-icon {
    width: 60px;
    height: 60px;
    margin-bottom: 16px;
}

.specimen-icon svg {
    width: 100%;
    height: 100%;
}

.specimen-label {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 600;
    font-size: 14px;
    color: #1A1A1A;
    display: block;
    margin-bottom: 8px;
    background-color: #F5DCC3;
    padding: 2px 8px;
    display: inline-block;
}

.specimen-desc {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 400;
    font-size: 13px;
    color: #4A3728;
    line-height: 1.7;
}

/* --- Endpaper Section --- */

.endpaper-content {
    text-align: center;
    padding: 60px 40px;
    width: 100%;
    position: relative;
}

.endpaper-vines {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    z-index: 0;
}

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

.endpaper-text {
    position: relative;
    z-index: 1;
}

.endpaper-heading {
    font-family: 'Caveat', cursive;
    font-weight: 700;
    font-size: 64px;
    color: #C4673A;
    margin-bottom: 32px;
    transform: rotate(0deg);
}

.endpaper-signoff {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 400;
    font-size: 16px;
    color: #1A1A1A;
    max-width: 560px;
    margin: 0 auto 24px;
    line-height: 1.9;
}

.endpaper-colophon {
    font-family: 'Caveat', cursive;
    font-weight: 400;
    font-size: 18px;
    color: #A8623B;
    margin-bottom: 40px;
}

.endpaper-final-vine {
    width: 80px;
    height: auto;
    margin: 0 auto;
    display: block;
}

/* --- Compass Navigation --- */

.compass-nav {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 100;
}

.compass-icon {
    width: 50px;
    height: 50px;
    cursor: pointer;
    background-color: #FFF8F0;
    border: 3px solid #1A1A1A;
    box-shadow: 3px 3px 0px #1A1A1A;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 150ms cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 150ms ease;
}

.compass-icon:hover {
    transform: scale(1.15);
}

.compass-icon:active {
    box-shadow: 1px 1px 0px #1A1A1A;
    transform: translate(2px, 2px);
}

.compass-icon svg {
    width: 36px;
    height: 36px;
}

.compass-menu {
    display: none;
    position: absolute;
    bottom: 60px;
    right: 0;
    background-color: #FFF8F0;
    border: 3px solid #1A1A1A;
    box-shadow: 4px 4px 0px #1A1A1A;
    padding: 12px 16px;
    flex-direction: column;
    gap: 8px;
    min-width: 120px;
}

.compass-nav.open .compass-menu {
    display: flex;
}

.compass-link {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 400;
    font-size: 13px;
    color: #1A1A1A;
    text-decoration: none;
    padding: 4px 8px;
    transition: background-color 100ms ease, color 100ms ease;
}

.compass-link:hover {
    background-color: #E8C87A;
    color: #1A1A1A;
}

/* --- Illustrations hover --- */

.margin-sketch,
.endpaper-final-vine {
    transition: transform 150ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

.margin-sketch:hover {
    transform: scale(1.05) translateY(-4px);
}

.endpaper-final-vine:hover {
    transform: scale(1.05) translateY(-4px);
}

/* --- Mobile Responsive --- */

@media (max-width: 768px) {
    .panel {
        margin: 0 12px;
    }

    .section-separator {
        margin: 0 12px;
    }

    .section-heading {
        font-size: 40px;
    }

    .title-svg {
        max-width: 100%;
    }

    .title-subtitle {
        font-size: 14px;
    }

    .blueprint-content,
    .fieldnotes-content,
    .specimens-content,
    .endpaper-content {
        padding: 40px 20px;
    }

    .specimen-grid {
        justify-content: center;
    }

    .specimen-card {
        width: 100%;
        max-width: 300px;
    }

    .margin-illustration {
        display: none;
    }

    .endpaper-heading {
        font-size: 42px;
    }

    .endpaper-signoff {
        font-size: 14px;
    }

    .blueprint-caption {
        font-size: 13px;
    }

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

@media (max-width: 480px) {
    .section-heading {
        font-size: 32px;
    }

    .endpaper-heading {
        font-size: 36px;
    }

    .journal-entry p {
        font-size: 14px;
    }

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