/* =============================================
   sbom.wiki -- Coastal Botanical SBOM Ecosystem
   ============================================= */

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

:root {
    --deep-teal: #134E4A;
    --seafoam: #A7F3D0;
    --ocean-blue: #0EA5E9;
    --coral-warm: #FB923C;
    --kelp-green: #166534;
    --sand-light: #F5F0E8;
    --reef-purple: #7C3AED;
    --abyss: #0A2E2A;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Lora', Georgia, serif;
    font-weight: 400;
    font-size: clamp(16px, 1.5vw, 18px);
    line-height: 1.85;
    color: var(--sand-light);
    background: var(--abyss);
    overflow-x: hidden;
}

h1, h2, h3, h4 {
    font-family: 'Poiret One', 'Didot', serif;
    font-weight: 400;
    letter-spacing: 0.05em;
}

code {
    font-family: 'Source Code Pro', 'Courier New', monospace;
    font-weight: 400;
    font-size: 14px;
}

/* --- Ripple Overlay --- */
.ripple-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9999;
}

/* =============================================
   Section 1: The Ecosystem (Hero)
   ============================================= */
.ecosystem {
    position: relative;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: linear-gradient(175deg, var(--deep-teal) 0%, #0f3d38 30%, #0b2e2a 60%, var(--abyss) 100%);
    overflow: hidden;
}

/* Botanical SVG frames */
.botanical-frame {
    position: absolute;
    bottom: 0;
    height: 80vh;
    width: 160px;
    z-index: 1;
    opacity: 0.7;
}

.botanical-frame--left {
    left: 0;
}

.botanical-frame--right {
    right: 0;
}

.botanical-path {
    stroke-dasharray: 600;
    stroke-dashoffset: 600;
    animation: drawBotanical 2s ease-out forwards;
}

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

/* Stagger the botanical paths */
.botanical-frame--left .botanical-path:nth-child(1) { animation-delay: 0s; }
.botanical-frame--left .botanical-path:nth-child(2) { animation-delay: 0.15s; }
.botanical-frame--left .botanical-path:nth-child(3) { animation-delay: 0.3s; }
.botanical-frame--left .botanical-path:nth-child(4) { animation-delay: 0.45s; }
.botanical-frame--left .botanical-path:nth-child(5) { animation-delay: 0.6s; }
.botanical-frame--left .botanical-path:nth-child(6) { animation-delay: 0.2s; }
.botanical-frame--left .botanical-path:nth-child(7) { animation-delay: 0.4s; }
.botanical-frame--left .botanical-path:nth-child(8) { animation-delay: 0.55s; }
.botanical-frame--left .botanical-path:nth-child(9) { animation-delay: 0.7s; }
.botanical-frame--left .botanical-path:nth-child(10) { animation-delay: 0.8s; }
.botanical-frame--left .botanical-path:nth-child(11) { animation-delay: 0.9s; }

.botanical-frame--right .botanical-path:nth-child(1) { animation-delay: 0.1s; }
.botanical-frame--right .botanical-path:nth-child(2) { animation-delay: 0.25s; }
.botanical-frame--right .botanical-path:nth-child(3) { animation-delay: 0.4s; }
.botanical-frame--right .botanical-path:nth-child(4) { animation-delay: 0.55s; }
.botanical-frame--right .botanical-path:nth-child(5) { animation-delay: 0.2s; }
.botanical-frame--right .botanical-path:nth-child(6) { animation-delay: 0.35s; }
.botanical-frame--right .botanical-path:nth-child(7) { animation-delay: 0.7s; }
.botanical-frame--right .botanical-path:nth-child(8) { animation-delay: 0.85s; }

/* Ecosystem content */
.ecosystem__content {
    position: relative;
    z-index: 2;
    text-align: center;
    padding: 0 2rem;
}

.ecosystem__wordmark {
    font-family: 'Poiret One', serif;
    font-size: clamp(42px, 8vw, 96px);
    color: var(--sand-light);
    letter-spacing: 0.12em;
    opacity: 0;
    animation: wordmarkFadeIn 1.2s ease-out 0.6s forwards;
}

@keyframes wordmarkFadeIn {
    0% {
        opacity: 0;
        letter-spacing: 0.4em;
    }
    100% {
        opacity: 1;
        letter-spacing: 0.12em;
    }
}

.ecosystem__subtitle {
    font-family: 'Lora', serif;
    font-size: clamp(14px, 2vw, 20px);
    font-style: italic;
    color: var(--seafoam);
    opacity: 0;
    animation: fadeIn 1s ease-out 1.2s forwards;
    margin-top: 0.5rem;
}

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

/* Ripple rings emanating from wordmark */
.ecosystem__ripples {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
}

.ripple-ring {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 0;
    height: 0;
    border: 1px solid var(--ocean-blue);
    border-radius: 50%;
    opacity: 0;
    animation: rippleExpand 2.5s ease-out forwards;
}

.ripple-ring--1 { animation-delay: 0.8s; }
.ripple-ring--2 { animation-delay: 1.1s; }
.ripple-ring--3 { animation-delay: 1.4s; }

@keyframes rippleExpand {
    0% {
        width: 0;
        height: 0;
        opacity: 0.2;
    }
    100% {
        width: 500px;
        height: 500px;
        opacity: 0;
    }
}

/* Hex previews */
.ecosystem__hex-previews {
    display: flex;
    gap: 1.2rem;
    justify-content: center;
    margin-top: 3rem;
    flex-wrap: wrap;
}

.hex-preview {
    width: 100px;
    height: 110px;
    clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    animation: fadeIn 0.8s ease-out forwards;
    cursor: default;
    transition: transform 0.3s ease;
}

.hex-preview:nth-child(1) { background: rgba(22, 101, 52, 0.35); animation-delay: 1.6s; }
.hex-preview:nth-child(2) { background: rgba(14, 165, 233, 0.25); animation-delay: 1.8s; }
.hex-preview:nth-child(3) { background: rgba(124, 58, 237, 0.25); animation-delay: 2.0s; }
.hex-preview:nth-child(4) { background: rgba(251, 146, 60, 0.25); animation-delay: 2.2s; }

.hex-preview:hover {
    transform: scale(1.1);
}

.hex-preview__label {
    font-family: 'Source Code Pro', monospace;
    font-size: 11px;
    color: var(--seafoam);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

/* Scroll indicator */
.ecosystem__scroll-indicator {
    position: absolute;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    opacity: 0;
    animation: fadeIn 1s ease-out 2.5s forwards, floatBounce 2s ease-in-out infinite 3s;
    z-index: 2;
}

@keyframes floatBounce {
    0%, 100% { transform: translateX(-50%) translateY(0); }
    50% { transform: translateX(-50%) translateY(8px); }
}

/* =============================================
   Section 2: Knowledge Cells (Honeycomb)
   ============================================= */
.knowledge-cells {
    padding: 6rem 2rem;
    background: linear-gradient(180deg, var(--abyss) 0%, #0d3935 50%, var(--deep-teal) 100%);
    position: relative;
}

.section-title {
    font-family: 'Poiret One', serif;
    font-size: clamp(28px, 5vw, 60px);
    color: var(--seafoam);
    text-align: center;
    margin-bottom: 1rem;
    letter-spacing: 0.05em;
}

.section-intro {
    font-family: 'Lora', serif;
    font-size: clamp(14px, 1.3vw, 17px);
    color: rgba(167, 243, 208, 0.7);
    text-align: center;
    max-width: 680px;
    margin: 0 auto 4rem;
    line-height: 1.85;
    font-style: italic;
}

/* Honeycomb grid */
.honeycomb-grid {
    max-width: 1000px;
    margin: 0 auto;
}

.honeycomb-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-bottom: -30px;
}

.honeycomb-row--offset {
    margin-left: calc(100% / 6);
    margin-right: calc(-100% / 6);
}

/* Hex cells */
.hex-cell {
    clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
    background: var(--sand-light);
    aspect-ratio: 1 / 1.15;
    transition: transform 0.35s ease;
    cursor: default;
    opacity: 0;
    transform: translateY(30px);
}

.hex-cell.visible {
    opacity: 1;
    transform: translateY(0);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.hex-cell:hover {
    transform: scale(1.05);
}

.hex-cell.visible:hover {
    transform: translateY(0) scale(1.05);
}

.hex-cell__inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    padding: 22% 12% 18%;
    text-align: center;
}

.hex-cell__botanical {
    width: 70px;
    height: 40px;
    margin-bottom: 0.3rem;
    opacity: 0.8;
}

.botanical-draw {
    stroke-dasharray: 200;
    stroke-dashoffset: 200;
    transition: stroke-dashoffset 1.2s ease;
}

.hex-cell.visible .botanical-draw {
    stroke-dashoffset: 0;
}

.hex-cell__category {
    font-family: 'Source Code Pro', monospace;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    padding: 2px 8px;
    border-radius: 2px;
    margin-bottom: 0.25rem;
}

.hex-cell[data-category="library"] .hex-cell__category {
    color: var(--kelp-green);
    background: rgba(22, 101, 52, 0.12);
}

.hex-cell[data-category="framework"] .hex-cell__category {
    color: var(--ocean-blue);
    background: rgba(14, 165, 233, 0.12);
}

.hex-cell[data-category="runtime"] .hex-cell__category {
    color: var(--reef-purple);
    background: rgba(124, 58, 237, 0.12);
}

.hex-cell[data-category="tool"] .hex-cell__category {
    color: var(--coral-warm);
    background: rgba(251, 146, 60, 0.12);
}

.hex-cell__title {
    font-family: 'Poiret One', serif;
    font-size: clamp(14px, 1.5vw, 18px);
    color: var(--deep-teal);
    margin-bottom: 0.2rem;
    letter-spacing: 0.03em;
}

.hex-cell__desc {
    font-family: 'Lora', serif;
    font-size: clamp(10px, 1vw, 13px);
    color: #3d5a56;
    line-height: 1.55;
}

/* Category stripe on hex cells */
.hex-cell[data-category="library"]::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--kelp-green);
}

.hex-cell[data-category="framework"]::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--ocean-blue);
}

.hex-cell[data-category="runtime"]::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--reef-purple);
}

.hex-cell[data-category="tool"]::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--coral-warm);
}

/* =============================================
   Section 3: The Canopy
   ============================================= */
.canopy {
    padding: 6rem 2rem;
    background: linear-gradient(180deg, var(--deep-teal) 0%, #0b2e2a 40%, var(--abyss) 100%);
    position: relative;
}

.section-title--light {
    color: var(--seafoam);
}

.section-intro--light {
    color: rgba(167, 243, 208, 0.65);
}

.canopy__tree-container {
    max-width: 900px;
    margin: 0 auto 4rem;
    position: relative;
}

.canopy__tree {
    width: 100%;
    height: auto;
}

.tree-path {
    stroke-dasharray: 500;
    stroke-dashoffset: 500;
    opacity: 0.8;
}

.tree-path.drawn {
    stroke-dashoffset: 0;
    transition: stroke-dashoffset 1.5s ease;
}

.tree-bloom {
    opacity: 0;
    transform-origin: center;
}

.tree-bloom.visible {
    animation: bloomIn 0.6s ease-out forwards;
}

@keyframes bloomIn {
    0% {
        opacity: 0;
        r: 0;
    }
    60% {
        opacity: 1;
    }
    100% {
        opacity: 0.9;
    }
}

.tree-thorn {
    opacity: 0;
}

.tree-thorn.visible {
    animation: fadeIn 0.4s ease-out forwards;
}

/* Legend */
.canopy__legend {
    display: flex;
    justify-content: center;
    gap: 2rem;
    margin-top: 1.5rem;
    flex-wrap: wrap;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
}

.legend-label {
    font-family: 'Source Code Pro', monospace;
    font-size: 12px;
    color: rgba(245, 240, 232, 0.7);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Format cards */
.canopy__formats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    max-width: 1000px;
    margin: 0 auto;
}

.format-card {
    background: rgba(245, 240, 232, 0.04);
    border: 1px solid rgba(167, 243, 208, 0.12);
    border-radius: 4px;
    padding: 2rem;
    transition: background 0.3s ease, border-color 0.3s ease;
}

.format-card:hover {
    background: rgba(245, 240, 232, 0.08);
    border-color: rgba(167, 243, 208, 0.25);
}

.format-card__code {
    display: inline-block;
    font-family: 'Source Code Pro', monospace;
    font-size: 13px;
    color: var(--ocean-blue);
    background: rgba(14, 165, 233, 0.1);
    padding: 3px 10px;
    border-radius: 3px;
    margin-bottom: 0.8rem;
}

.format-card__title {
    font-family: 'Poiret One', serif;
    font-size: clamp(18px, 2.5vw, 24px);
    color: var(--sand-light);
    margin-bottom: 0.6rem;
    letter-spacing: 0.04em;
}

.format-card__desc {
    font-family: 'Lora', serif;
    font-size: clamp(13px, 1.2vw, 15px);
    color: rgba(245, 240, 232, 0.6);
    line-height: 1.75;
}

/* =============================================
   Section 4: Seabed Footer
   ============================================= */
.seabed {
    position: relative;
    background: var(--abyss);
    padding: 5rem 2rem 3rem;
    overflow: hidden;
}

.seabed__plants {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 200px;
    z-index: 0;
}

.seaweed {
    animation: seaweedSway 4s ease-in-out infinite;
    transform-origin: bottom center;
}

.seaweed:nth-child(odd) {
    animation-duration: 5s;
    animation-delay: 0.5s;
}

.seaweed:nth-child(3n) {
    animation-duration: 4.5s;
    animation-delay: 1s;
}

@keyframes seaweedSway {
    0%, 100% { transform: rotate(0deg); }
    25% { transform: rotate(1.5deg); }
    75% { transform: rotate(-1.5deg); }
}

.seabed__content {
    position: relative;
    z-index: 1;
    max-width: 900px;
    margin: 0 auto;
    text-align: center;
}

.seabed__title {
    font-family: 'Poiret One', serif;
    font-size: clamp(24px, 4vw, 42px);
    color: var(--seafoam);
    letter-spacing: 0.1em;
    margin-bottom: 0.5rem;
}

.seabed__tagline {
    font-family: 'Lora', serif;
    font-size: clamp(13px, 1.2vw, 16px);
    font-style: italic;
    color: rgba(167, 243, 208, 0.5);
    margin-bottom: 3rem;
}

.seabed__links {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2rem;
    margin-bottom: 3rem;
    text-align: left;
}

.seabed__link-heading {
    font-family: 'Poiret One', serif;
    font-size: 16px;
    color: var(--seafoam);
    letter-spacing: 0.05em;
    margin-bottom: 0.8rem;
}

.seabed__link {
    display: block;
    font-family: 'Lora', serif;
    font-size: 14px;
    color: rgba(245, 240, 232, 0.45);
    padding: 0.2rem 0;
    cursor: default;
    transition: color 0.2s ease;
}

.seabed__link:hover {
    color: rgba(245, 240, 232, 0.75);
}

.seabed__bottom {
    border-top: 1px solid rgba(167, 243, 208, 0.1);
    padding-top: 1.5rem;
}

.seabed__copyright {
    font-family: 'Source Code Pro', monospace;
    font-size: 12px;
    color: rgba(167, 243, 208, 0.3);
    letter-spacing: 0.05em;
}

/* =============================================
   Responsive
   ============================================= */
@media (max-width: 768px) {
    .botanical-frame {
        width: 80px;
        height: 60vh;
    }

    .ecosystem__hex-previews {
        gap: 0.6rem;
    }

    .hex-preview {
        width: 72px;
        height: 80px;
    }

    .honeycomb-row {
        grid-template-columns: repeat(2, 1fr);
    }

    .honeycomb-row--offset {
        margin-left: calc(100% / 4);
        margin-right: calc(-100% / 4);
    }

    .seabed__links {
        grid-template-columns: 1fr;
        text-align: center;
    }

    .canopy__formats {
        grid-template-columns: 1fr;
    }
}

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

    .honeycomb-row--offset {
        margin-left: 0;
        margin-right: 0;
    }

    .hex-cell {
        max-width: 250px;
        margin: 0 auto;
    }

    .ecosystem__hex-previews {
        flex-direction: column;
        align-items: center;
    }

    .canopy__legend {
        gap: 1rem;
    }
}
