/* ============================================================
   matsurika.moe — Botanical meets Circuit-Board
   Palette: burgundy-cream | Typography: DM Sans + IBM Plex Mono
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@300;700&family=IBM+Plex+Mono:wght@400;500&family=DM+Serif+Text:ital@1&display=swap');

/* ============================================================
   CSS Custom Properties
   ============================================================ */
:root {
    --burgundy:       #7C2D3E;
    --cream:          #F5ECD7;
    --wine-black:     #2C1A1D;
    --warm-tan:       #C4A882;
    --botanical-green: #3A6B4F;
    --mid-cream:      #D4B896;
    --deep-crimson:   #8B1A2E;
    --off-white:      #E8DCC8;
    --deep-wine:      #3D1F27;

    --font-display: 'DM Sans', sans-serif;
    --font-body: 'IBM Plex Mono', monospace;
    --font-taxonomy: 'DM Serif Text', serif;

    --nav-width: 48px;
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-body);
    font-size: 15px;
    line-height: 1.8;
    color: var(--wine-black);
    background-color: var(--cream);
    overflow-x: hidden;
}

/* ============================================================
   Vertical Navigation
   ============================================================ */
.nav-vertical {
    position: fixed;
    left: 0;
    top: 0;
    width: var(--nav-width);
    height: 100vh;
    background: var(--burgundy);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 32px;
    z-index: 100;
}

.nav-item {
    color: var(--cream);
    font-family: var(--font-body);
    font-size: 11px;
    font-weight: 500;
    writing-mode: vertical-rl;
    letter-spacing: 0.15em;
    cursor: pointer;
    opacity: 0.55;
    transition: opacity 0.3s ease;
    position: relative;
}

.nav-item::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 1px;
    background: var(--warm-tan);
    transition: width 0.4s ease;
}

.nav-item:hover {
    opacity: 0.85;
}

.nav-item.active {
    opacity: 1;
}

.nav-item.active::after {
    width: 100%;
    animation: circuit-trace 0.6s ease forwards;
}

@keyframes circuit-trace {
    from { width: 0; }
    to   { width: 100%; }
}

/* ============================================================
   Main Content
   ============================================================ */
.main-content {
    margin-left: var(--nav-width);
}

/* ============================================================
   Split Container
   ============================================================ */
.split-container {
    display: grid;
    grid-template-columns: 55fr 45fr;
    min-height: 100vh;
    position: relative;
}

/* ============================================================
   Botanical Panel (Left — sticky)
   ============================================================ */
.panel-botanical {
    background: var(--cream);
    position: sticky;
    top: 0;
    height: 100vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    /* Herbarium sheet ruled lines — CSS background */
    background-image: repeating-linear-gradient(
        to bottom,
        transparent,
        transparent 31px,
        rgba(196, 168, 130, 0.05) 31px,
        rgba(196, 168, 130, 0.05) 32px
    );
}

/* Vine boundary divider */
.vine-boundary {
    position: absolute;
    right: 0;
    top: 0;
    width: 20px;
    height: 100%;
    z-index: 10;
}

/* Specimen display area */
.specimen-display {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.specimen-plate {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    opacity: 0;
    transition: opacity 0.5s ease;
    pointer-events: none;
}

.specimen-plate.active {
    opacity: 1;
    pointer-events: auto;
}

.specimen-label-top {
    text-align: center;
    margin-bottom: 1.5rem;
    width: 100%;
}

.specimen-number {
    font-family: var(--font-body);
    font-size: 10px;
    font-weight: 500;
    letter-spacing: 0.18em;
    color: var(--warm-tan);
    display: block;
    margin-bottom: 0.5rem;
}

.label-rule {
    width: 200px;
    height: 1px;
    background: var(--wine-black);
    margin: 0.4rem auto;
    opacity: 0.25;
}

.site-title {
    font-family: var(--font-display);
    font-size: 3.5vw;
    font-weight: 700;
    letter-spacing: 0.04em;
    color: var(--wine-black);
    margin: 0.2rem 0;
}

.botanical-svg {
    width: 100%;
    max-width: 280px;
    height: auto;
    max-height: 65vh;
}

.specimen-annotation {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    margin-top: 1rem;
    text-align: center;
}

.annotation-label {
    font-family: var(--font-body);
    font-size: 10px;
    letter-spacing: 0.12em;
    color: var(--warm-tan);
}

/* ============================================================
   Circuit Panel (Right — scrollable)
   ============================================================ */
.panel-circuit {
    background: var(--off-white);
    overflow-y: auto;
    position: relative;
    /* Dot grid — engineering graph paper */
    background-image: radial-gradient(
        circle at 1px 1px,
        rgba(196, 168, 130, 0.08) 1px,
        transparent 0
    );
    background-size: 24px 24px;
}

/* Callout overlay SVG */
.callout-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 20;
}

/* ============================================================
   Circuit Section
   ============================================================ */
.circuit-section {
    padding: 4rem 3rem;
    min-height: 80vh;
    position: relative;
}

.circuit-section--dark {
    background-color: var(--deep-wine);
    color: var(--cream);
    /* Switch dot grid to light on dark */
    background-image: radial-gradient(
        circle at 1px 1px,
        rgba(196, 168, 130, 0.12) 1px,
        transparent 0
    );
    background-size: 24px 24px;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid rgba(196, 168, 130, 0.3);
}

.panel-label {
    font-family: var(--font-body);
    font-size: 10px;
    font-weight: 500;
    letter-spacing: 0.2em;
    color: var(--warm-tan);
}

.panel-number {
    font-family: var(--font-body);
    font-size: 10px;
    letter-spacing: 0.12em;
    color: var(--warm-tan);
    opacity: 0.7;
}

/* ============================================================
   Circuit SVG
   ============================================================ */
.circuit-svg {
    width: 100%;
    max-width: 420px;
    height: auto;
    margin: 1.5rem auto;
    display: block;
    background: var(--off-white);
    border: 1px solid rgba(196, 168, 130, 0.2);
}

/* ============================================================
   Typography
   ============================================================ */
.section-heading {
    font-family: var(--font-display);
    font-size: clamp(36px, 4vw, 60px);
    font-weight: 700;
    letter-spacing: 0.04em;
    color: var(--wine-black);
    line-height: 1.1;
    margin-bottom: 0.5rem;
}

.circuit-section--dark .section-heading {
    color: var(--cream);
}

.taxonomy {
    font-family: var(--font-taxonomy);
    font-style: italic;
    color: var(--burgundy);
    font-size: 20px;
}

.circuit-section--dark .taxonomy {
    color: var(--warm-tan);
}

.block-taxonomy {
    display: block;
    font-size: 24px;
    margin-bottom: 1.5rem;
}

.circuit-body {
    font-family: var(--font-body);
    font-size: 14px;
    line-height: 1.85;
    color: var(--deep-wine);
    margin-bottom: 1.5rem;
}

.circuit-section--dark .circuit-body {
    color: var(--off-white);
}

.circuit-body p + p {
    margin-top: 1rem;
}

/* ============================================================
   Code Block
   ============================================================ */
.code-block {
    margin: 1.5rem 0;
    padding: 1.25rem 1.5rem;
    overflow-x: auto;
}

.code-comment {
    display: block;
    font-family: var(--font-body);
    font-size: 12px;
    color: var(--botanical-green);
    margin-bottom: 0.5rem;
    letter-spacing: 0.04em;
}

.code-block pre {
    font-family: var(--font-body);
    font-size: 13px;
    line-height: 1.7;
    color: var(--wine-black);
    white-space: pre;
}

/* Silkscreen frame — component outline style */
.silkscreen-frame {
    background: rgba(255, 255, 255, 0.45);
    border: 1px solid var(--warm-tan);
    position: relative;
}

.silkscreen-frame::before {
    content: '';
    position: absolute;
    top: -4px;
    left: -4px;
    right: -4px;
    bottom: -4px;
    border: 1px solid rgba(196, 168, 130, 0.25);
    pointer-events: none;
}

.silkscreen-frame p {
    font-family: var(--font-body);
    font-size: 13px;
    line-height: 1.8;
    color: var(--wine-black);
    padding: 1.25rem 1.5rem;
}

.silkscreen-frame--dark {
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid rgba(196, 168, 130, 0.35);
    position: relative;
    padding: 1.25rem 1.5rem;
}

.silkscreen-frame--dark::before {
    content: '';
    position: absolute;
    top: -4px;
    left: -4px;
    right: -4px;
    bottom: -4px;
    border: 1px solid rgba(196, 168, 130, 0.15);
    pointer-events: none;
}

.silkscreen-frame--dark .code-comment {
    color: var(--botanical-green);
}

.silkscreen-frame--dark pre {
    color: var(--cream);
}

/* ============================================================
   Specimen Callout
   ============================================================ */
.specimen-callout {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
    margin-top: 1.5rem;
    padding: 1rem;
    border-left: 2px solid var(--warm-tan);
    background: rgba(196, 168, 130, 0.08);
}

.callout-dot {
    width: 10px;
    height: 10px;
    min-width: 10px;
    border-radius: 50%;
    border: 1.5px solid var(--warm-tan);
    background: var(--cream);
    margin-top: 4px;
    position: relative;
    cursor: pointer;
}

.callout-dot::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: var(--warm-tan);
}

.callout-text {
    font-family: var(--font-body);
    font-size: 12px;
    line-height: 1.75;
    color: var(--wine-black);
}

.circuit-section--dark .callout-text {
    color: var(--off-white);
}

/* ============================================================
   Section Ripple
   ============================================================ */
.section-ripple {
    width: calc(100% + var(--nav-width));
    margin-left: calc(-1 * var(--nav-width));
    overflow: hidden;
    line-height: 0;
}

.section-ripple svg {
    width: 100%;
    height: 40px;
    display: block;
}

.section-ripple--dark + .circuit-section {
    background-color: var(--cream);
}

/* ============================================================
   Animation: Entrance
   ============================================================ */
.animate-entry {
    opacity: 0;
    transform: translateY(40px);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.animate-entry.visible {
    opacity: 1;
    transform: translateY(0);
}

/* ============================================================
   Circuit Annotation Block
   ============================================================ */
.circuit-annotation-block {
    margin-top: 1.5rem;
}

/* ============================================================
   Hero section specifics
   ============================================================ */
.hero-section {
    min-height: 100vh;
}

/* ============================================================
   Footer
   ============================================================ */
.site-footer {
    background: var(--cream);
    padding: 3rem;
    border-top: 1px solid rgba(196, 168, 130, 0.4);
    position: relative;
    overflow: hidden;
}

.footer-content {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 2rem;
    gap: 2rem;
}

.footer-left {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.site-title-small {
    font-family: var(--font-display);
    font-size: 20px;
    font-weight: 700;
    letter-spacing: 0.04em;
    color: var(--wine-black);
}

.footer-taxonomy {
    font-size: 16px;
    color: var(--burgundy);
    opacity: 0.8;
}

.footer-right {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.3rem;
}

.footer-label {
    font-family: var(--font-body);
    font-size: 10px;
    letter-spacing: 0.18em;
    color: var(--warm-tan);
    display: block;
}

.footer-strip {
    width: 100%;
    height: 60px;
    display: block;
    margin-top: 1rem;
}

/* ============================================================
   Scrollbar styling (webkit)
   ============================================================ */
.panel-circuit::-webkit-scrollbar {
    width: 4px;
}

.panel-circuit::-webkit-scrollbar-track {
    background: var(--off-white);
}

.panel-circuit::-webkit-scrollbar-thumb {
    background: var(--warm-tan);
    border-radius: 2px;
}

/* ============================================================
   Hover: Botanical element interaction highlight
   ============================================================ */
.botanical-svg g:hover path,
.botanical-svg g:hover line {
    stroke-opacity: 0.8;
}

[data-annotation]:hover {
    transform: scale(1.3);
    border-color: var(--burgundy);
    transition: transform 0.2s ease, border-color 0.2s ease;
}

/* ============================================================
   Responsive — narrow viewports
   ============================================================ */
@media (max-width: 900px) {
    .split-container {
        grid-template-columns: 1fr;
    }

    .panel-botanical {
        position: static;
        height: 50vh;
    }

    .vine-boundary {
        display: none;
    }

    .site-title {
        font-size: 7vw;
    }
}
