/* ============================================================
   20241204.com — Digital Herbarium Styles
   Botanical Conservatory Design Language
   ============================================================ */

/* CSS Custom Properties */
:root {
    --winter-linen: #f4f5f6;
    --pressed-paper: #eaecee;
    --frost-edge: #d1d5da;
    --graphite: #2d3239;
    --slate-mist: #6b7785;
    --fern-green: #4a7c59;
    --dried-sage: #8fa88b;
    --lichen: #c4cfbf;
    --charcoal-veil: #1a1d21;
    --border-rule: #b0b8bf;

    --font-heading: 'Roboto Slab', serif;
    --font-body: 'Source Sans 3', sans-serif;
    --font-mono: 'IBM Plex Mono', monospace;

    --shadow-card: 0 2px 8px rgba(0,0,0,0.04), 0 8px 24px rgba(0,0,0,0.06);
    --shadow-card-hover: 0 4px 16px rgba(0,0,0,0.06), 0 12px 32px rgba(0,0,0,0.10);

    --sidebar-width: 64px;
    --topbar-height: 48px;
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-body);
    font-weight: 400;
    font-size: clamp(1rem, 1.2vw, 1.125rem);
    line-height: 1.65;
    color: var(--graphite);
    background-color: var(--winter-linen);
    overflow-x: hidden;
    padding-left: var(--sidebar-width);
}

/* Dot-grid background pattern */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: radial-gradient(circle, var(--frost-edge) 1px, transparent 1px);
    background-size: 24px 24px;
    opacity: 0.15;
    pointer-events: none;
    z-index: 0;
}

/* ============================================================
   Fixed Left Sidebar
   ============================================================ */
#sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background-color: var(--winter-linen);
    border-right: 1px solid var(--frost-edge);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
}

#sidebar-logotype {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 0.875rem;
    letter-spacing: 0.06em;
    color: var(--slate-mist);
    writing-mode: vertical-rl;
    text-orientation: mixed;
    transform: rotate(180deg);
    user-select: none;
}

/* ============================================================
   Top Navigation Bar
   ============================================================ */
#top-bar {
    position: fixed;
    top: 0;
    left: var(--sidebar-width);
    right: 0;
    height: var(--topbar-height);
    background-color: rgba(244, 245, 246, 0.92);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 clamp(16px, 3vw, 40px);
    z-index: 90;
    border-bottom: 1px solid var(--frost-edge);
}

#top-bar-domain {
    font-family: var(--font-heading);
    font-weight: 400;
    font-size: 0.9375rem;
    color: var(--graphite);
    letter-spacing: -0.01em;
}

#nav-toggle {
    background: none;
    border: none;
    cursor: pointer;
    width: 28px;
    height: 20px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 0;
}

.hamburger-line {
    display: block;
    width: 100%;
    height: 2px;
    background-color: var(--graphite);
    border-radius: 1px;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

#nav-toggle.active .hamburger-line:nth-child(1) {
    transform: translateY(9px) rotate(45deg);
}

#nav-toggle.active .hamburger-line:nth-child(2) {
    opacity: 0;
}

#nav-toggle.active .hamburger-line:nth-child(3) {
    transform: translateY(-9px) rotate(-45deg);
}

/* ============================================================
   Navigation Overlay
   ============================================================ */
#nav-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(244, 245, 246, 0.96);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 85;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s ease-out;
}

#nav-overlay.open {
    opacity: 1;
    pointer-events: auto;
}

#nav-menu {
    list-style: none;
    text-align: center;
}

#nav-menu li {
    margin: 24px 0;
    transform: translateY(20px);
    opacity: 0;
    transition: transform 0.4s ease-out, opacity 0.4s ease-out;
}

#nav-overlay.open #nav-menu li {
    transform: translateY(0);
    opacity: 1;
}

#nav-overlay.open #nav-menu li:nth-child(1) { transition-delay: 0.1s; }
#nav-overlay.open #nav-menu li:nth-child(2) { transition-delay: 0.18s; }
#nav-overlay.open #nav-menu li:nth-child(3) { transition-delay: 0.26s; }
#nav-overlay.open #nav-menu li:nth-child(4) { transition-delay: 0.34s; }

.nav-link {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: clamp(1.5rem, 4vw, 2.5rem);
    color: var(--graphite);
    text-decoration: none;
    transition: color 0.3s ease;
}

.nav-link:hover {
    color: var(--fern-green);
}

/* ============================================================
   Hero Section
   ============================================================ */
#hero {
    position: relative;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding-top: var(--topbar-height);
    overflow: hidden;
}

#hero-content {
    position: relative;
    z-index: 2;
    text-align: center;
    padding: 40px;
}

#hero-botanical {
    width: clamp(200px, 40vw, 400px);
    height: auto;
    margin: 0 auto 40px;
    display: block;
}

/* Botanical path-draw animation */
.botanical-path {
    fill: none;
    stroke: var(--frost-edge);
    stroke-width: 1.5;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-dasharray: 1000;
    stroke-dashoffset: 1000;
}

.path-animated .botanical-path {
    animation: pathDraw 2s ease-in-out forwards;
}

.path-animated .botanical-path.frond-delay-1 { animation-delay: 0.15s; }
.path-animated .botanical-path.frond-delay-2 { animation-delay: 0.3s; }
.path-animated .botanical-path.frond-delay-3 { animation-delay: 0.45s; }
.path-animated .botanical-path.frond-delay-4 { animation-delay: 0.6s; }
.path-animated .botanical-path.frond-delay-5 { animation-delay: 0.75s; }
.path-animated .botanical-path.frond-delay-6 { animation-delay: 0.9s; }
.path-animated .botanical-path.frond-delay-7 { animation-delay: 1.05s; }
.path-animated .botanical-path.frond-delay-8 { animation-delay: 1.2s; }
.path-animated .botanical-path.frond-delay-9 { animation-delay: 1.35s; }

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

#hero-title {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: clamp(1.75rem, 3vw, 3.25rem);
    letter-spacing: -0.02em;
    color: var(--graphite);
    opacity: 0;
    transform: translateY(12px);
    transition: opacity 0.8s ease-out 1.5s, transform 0.8s ease-out 1.5s;
}

#hero-subtitle {
    font-family: var(--font-mono);
    font-weight: 400;
    font-size: 0.8125rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--slate-mist);
    margin-top: 12px;
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 0.8s ease-out 1.8s, transform 0.8s ease-out 1.8s;
}

.hero-visible #hero-title,
.hero-visible #hero-subtitle {
    opacity: 1;
    transform: translateY(0);
}

/* Organic Blob Shapes */
.blob {
    position: absolute;
    border-radius: 50%;
    z-index: 1;
}

.blob-1 {
    width: clamp(300px, 50vw, 600px);
    height: clamp(300px, 50vw, 600px);
    background-color: var(--lichen);
    opacity: 0.12;
    top: 10%;
    right: -10%;
    animation: blobMorph1 25s ease-in-out infinite;
}

.blob-2 {
    width: clamp(200px, 35vw, 450px);
    height: clamp(200px, 35vw, 450px);
    background-color: var(--pressed-paper);
    opacity: 0.3;
    bottom: 5%;
    left: -5%;
    animation: blobMorph2 30s ease-in-out infinite;
}

@keyframes blobMorph1 {
    0%, 100% { border-radius: 42% 58% 63% 37% / 41% 44% 56% 59%; }
    25% { border-radius: 55% 45% 38% 62% / 52% 60% 40% 48%; }
    50% { border-radius: 38% 62% 55% 45% / 60% 38% 62% 40%; }
    75% { border-radius: 60% 40% 47% 53% / 45% 55% 45% 55%; }
}

@keyframes blobMorph2 {
    0%, 100% { border-radius: 50% 50% 45% 55% / 55% 45% 55% 45%; }
    33% { border-radius: 45% 55% 60% 40% / 40% 60% 40% 60%; }
    66% { border-radius: 58% 42% 42% 58% / 58% 42% 58% 42%; }
}

/* ============================================================
   Section Dividers — Botanical Rule Lines
   ============================================================ */
.section-divider {
    padding: 0 clamp(24px, 4vw, 56px);
    margin: clamp(60px, 8vw, 120px) 0;
}

.rule-line {
    width: 100%;
    height: 20px;
    display: block;
}

/* ============================================================
   Portfolio Grid — Specimens Section
   ============================================================ */
#specimens {
    position: relative;
    z-index: 1;
    padding: 0 clamp(24px, 4vw, 56px);
    max-width: 1400px;
    margin: 0 auto;
}

.section-heading {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: clamp(1.5rem, 2.5vw, 2.5rem);
    letter-spacing: -0.02em;
    color: var(--graphite);
    margin-bottom: 8px;
}

.section-label {
    font-family: var(--font-mono);
    font-weight: 400;
    font-size: 0.8125rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--slate-mist);
    margin-bottom: 48px;
    display: block;
}

#specimen-grid {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 24px;
    margin-top: 48px;
}

/* Specimen Cards */
.specimen-card {
    background-color: var(--pressed-paper);
    border-radius: 4px;
    box-shadow: var(--shadow-card);
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    position: relative;
}

.specimen-card.span-1 {
    grid-column: span 4;
}

.specimen-card.span-2 {
    grid-column: span 8;
}

.specimen-card.span-full {
    grid-column: span 12;
}

.specimen-card:hover {
    transform: scale(1.02);
    box-shadow: var(--shadow-card-hover);
}

.specimen-inner {
    padding: clamp(24px, 4vw, 56px);
}

.specimen-inner.specimen-horizontal {
    display: flex;
    align-items: center;
    gap: clamp(24px, 4vw, 56px);
}

.specimen-illustration {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px 0;
    margin-bottom: 20px;
}

.specimen-horizontal .specimen-illustration {
    flex: 0 0 40%;
    margin-bottom: 0;
}

.specimen-svg {
    width: 100%;
    max-width: 180px;
    height: auto;
}

.specimen-svg.wide {
    max-width: 320px;
}

.specimen-svg .botanical-path {
    stroke: var(--dried-sage);
}

.specimen-label {
    display: block;
    font-family: var(--font-mono);
    font-weight: 400;
    font-size: 0.8125rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--slate-mist);
    margin-bottom: 8px;
}

.specimen-title {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: clamp(1.25rem, 2vw, 1.75rem);
    letter-spacing: -0.02em;
    color: var(--graphite);
    margin-bottom: 12px;
}

.specimen-desc {
    font-family: var(--font-body);
    font-weight: 400;
    color: var(--graphite);
    margin-bottom: 16px;
    max-width: 600px;
}

.specimen-meta {
    display: block;
    font-family: var(--font-mono);
    font-weight: 400;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--slate-mist);
    padding-top: 16px;
    border-top: 1px solid var(--frost-edge);
}

/* Fade-in animation for scroll */
.fade-in {
    opacity: 0;
    transform: translateY(16px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.fade-in.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Stagger delays */
.fade-in:nth-child(2) { transition-delay: 0.08s; }
.fade-in:nth-child(3) { transition-delay: 0.16s; }
.fade-in:nth-child(4) { transition-delay: 0.24s; }
.fade-in:nth-child(5) { transition-delay: 0.32s; }
.fade-in:nth-child(6) { transition-delay: 0.40s; }

/* Dimming effect when a specimen is focused */
.specimens-dimmed .specimen-card {
    opacity: 0.4;
    filter: blur(1px);
    transition: opacity 0.3s ease, filter 0.3s ease;
}

/* ============================================================
   About Section
   ============================================================ */
#about {
    position: relative;
    z-index: 1;
    padding: clamp(60px, 10vw, 160px) clamp(24px, 4vw, 56px);
    max-width: 1400px;
    margin: 0 auto;
    overflow: hidden;
}

.about-content {
    position: relative;
    z-index: 2;
    max-width: 720px;
}

.about-text p {
    margin-bottom: 24px;
    color: var(--graphite);
}

.about-text p:last-child {
    margin-bottom: 0;
}

.watermark-botanical {
    position: absolute;
    top: -10%;
    right: -15%;
    width: 60%;
    height: auto;
    pointer-events: none;
    z-index: 1;
}

/* ============================================================
   Detail Overlay — Zoom Focus
   ============================================================ */
#detail-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease-out;
}

#detail-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

#detail-vignette {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(ellipse at center, transparent 40%, rgba(0,0,0,0.08) 100%);
    pointer-events: none;
}

#detail-content {
    position: relative;
    background-color: var(--pressed-paper);
    border-radius: 6px;
    box-shadow: 0 16px 64px rgba(0,0,0,0.12), 0 4px 16px rgba(0,0,0,0.06);
    max-width: 800px;
    width: 90%;
    max-height: 85vh;
    overflow-y: auto;
    padding: clamp(32px, 5vw, 64px);
    transform: scale(0.95);
    transition: transform 0.3s ease-out;
}

#detail-overlay.active #detail-content {
    transform: scale(1);
}

#detail-close {
    position: absolute;
    top: 16px;
    right: 16px;
    background: none;
    border: none;
    font-size: 1.75rem;
    color: var(--slate-mist);
    cursor: pointer;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s ease;
    line-height: 1;
}

#detail-close:hover {
    color: var(--graphite);
}

#detail-illustration {
    display: flex;
    justify-content: center;
    padding: 24px 0 32px;
}

#detail-illustration svg {
    width: 100%;
    max-width: 300px;
    height: auto;
}

#detail-label {
    display: block;
    font-family: var(--font-mono);
    font-weight: 400;
    font-size: 0.8125rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--slate-mist);
    margin-bottom: 8px;
}

#detail-title {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: clamp(1.5rem, 3vw, 2.25rem);
    letter-spacing: -0.02em;
    color: var(--graphite);
    margin-bottom: 16px;
}

#detail-desc {
    font-family: var(--font-body);
    font-weight: 400;
    color: var(--graphite);
    margin-bottom: 24px;
    line-height: 1.7;
}

#detail-meta {
    display: block;
    font-family: var(--font-mono);
    font-weight: 400;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--slate-mist);
    padding-top: 16px;
    border-top: 1px solid var(--frost-edge);
}

/* ============================================================
   Footer
   ============================================================ */
#contact {
    position: relative;
    z-index: 1;
    padding: clamp(60px, 10vw, 160px) clamp(24px, 4vw, 56px);
    border-top: 1px solid var(--frost-edge);
    margin-top: clamp(60px, 8vw, 120px);
}

.footer-content {
    max-width: 1400px;
    margin: 0 auto;
    text-align: center;
}

.footer-botanical {
    width: clamp(120px, 20vw, 200px);
    height: auto;
    margin: 0 auto 32px;
    display: block;
}

.footer-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.footer-label {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 1rem;
    color: var(--graphite);
    letter-spacing: -0.01em;
    margin-bottom: 8px;
}

.footer-meta {
    font-family: var(--font-mono);
    font-weight: 400;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--slate-mist);
}

/* ============================================================
   Floating Botanical Elements
   ============================================================ */
#floating-botanicals {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 50;
    overflow: hidden;
}

.floating-leaf {
    position: absolute;
    opacity: 0.08;
    transition: transform 0.1s linear;
}

.leaf-1 {
    width: 60px;
    top: 15%;
    right: 8%;
}

.leaf-2 {
    width: 45px;
    top: 55%;
    left: 12%;
}

.leaf-3 {
    width: 35px;
    top: 75%;
    right: 20%;
}

/* ============================================================
   Reduced Motion
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
    .botanical-path {
        stroke-dasharray: none;
        stroke-dashoffset: 0;
        animation: none !important;
    }

    .path-animated .botanical-path {
        animation: none !important;
        stroke-dashoffset: 0;
    }

    .blob {
        animation: none !important;
    }

    .fade-in {
        opacity: 1;
        transform: none;
        transition: none;
    }

    #hero-title,
    #hero-subtitle {
        opacity: 1;
        transform: none;
        transition: none;
    }

    #detail-content {
        transition: none;
    }

    #detail-overlay {
        transition: none;
    }
}

/* ============================================================
   Responsive — Tablet
   ============================================================ */
@media (max-width: 1024px) {
    .specimen-card.span-2 {
        grid-column: span 12;
    }

    .specimen-card.span-1 {
        grid-column: span 6;
    }

    .specimen-inner.specimen-horizontal {
        flex-direction: column;
    }

    .specimen-horizontal .specimen-illustration {
        flex: none;
    }
}

/* ============================================================
   Responsive — Mobile
   ============================================================ */
@media (max-width: 640px) {
    :root {
        --sidebar-width: 0px;
    }

    #sidebar {
        display: none;
    }

    #top-bar {
        left: 0;
    }

    body {
        padding-left: 0;
    }

    .specimen-card.span-1,
    .specimen-card.span-2,
    .specimen-card.span-full {
        grid-column: span 12;
    }

    #specimen-grid {
        gap: 16px;
    }

    .specimen-svg {
        max-width: 140px;
    }

    .specimen-svg.wide {
        max-width: 240px;
    }

    #hero-botanical {
        width: 60vw;
    }
}
