/* ==========================================================================
   senggack.com — Surrealist Botanical Manuscript
   Deep Burgundy palette, scholarly-intellectual tone
   ========================================================================== */

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: "IBM Plex Mono", "Courier New", monospace;
    font-size: clamp(0.85rem, 1.1vw, 1rem);
    line-height: 1.75;
    letter-spacing: 0.02em;
    color: #2B0D14;
    background-color: #F4EDE4;
    background-image:
        repeating-linear-gradient(
            0deg,
            transparent,
            transparent 99px,
            rgba(74, 21, 38, 0.03) 99px,
            rgba(74, 21, 38, 0.03) 100px
        );
    overflow-x: hidden;
    min-height: 100vh;
    position: relative;
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='240' height='240'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='4'/><feColorMatrix values='0 0 0 0 0.29 0 0 0 0 0.05 0 0 0 0 0.08 0 0 0 0.5 0'/></filter><rect width='240' height='240' filter='url(%23n)' opacity='0.03'/></svg>");
    background-repeat: repeat;
    pointer-events: none;
    z-index: 1;
    opacity: 0.5;
    mix-blend-mode: multiply;
}

.svg-filters {
    position: absolute;
    width: 0;
    height: 0;
    overflow: hidden;
}

/* -- Marginalia (decorative botanical illustrations) ----------------------- */
.marginalia {
    position: absolute;
    z-index: 2;
    pointer-events: none;
    opacity: 0.85;
    will-change: transform;
}

.marginalia-left-1 {
    top: 18vh;
    left: 1.5vw;
    width: 120px;
}

.marginalia-right-1 {
    top: 60vh;
    right: 1.5vw;
    width: 100px;
}

.marginalia-left-2 {
    top: 180vh;
    left: 2vw;
    width: 140px;
}

.marginalia-right-2 {
    top: 240vh;
    right: 2vw;
    width: 110px;
}

/* -- Opening Sequence ------------------------------------------------------ */
.opening-sequence {
    position: relative;
    height: 100vh;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 5;
}

.opening-content {
    text-align: center;
    width: 100%;
    max-width: 80vw;
    margin: 0 auto;
    padding: 0 120px;
}

.domain-title {
    font-family: "Cormorant Garamond", "Lora", serif;
    font-weight: 700;
    font-size: clamp(3rem, 8vw, 7rem);
    letter-spacing: -0.02em;
    color: #4A1526;
    line-height: 1;
    margin-bottom: 1.5rem;
    min-height: 1em;
}

.domain-title .char {
    display: inline-block;
    opacity: 0;
    transform: translateY(-1px);
    transition: opacity 200ms ease-out, transform 200ms ease-out;
}

.domain-title .char.visible {
    opacity: 1;
    transform: translateY(0);
}

.title-line {
    width: 0;
    height: 1px;
    background-color: #4A1526;
    margin: 1.75rem auto 1.5rem;
    transition: width 400ms ease-in-out;
    opacity: 0.6;
}

.title-line.drawn {
    width: 220px;
}

.subtitle {
    font-family: "IBM Plex Mono", monospace;
    font-weight: 300;
    font-size: 0.85rem;
    letter-spacing: 0.15em;
    color: #8C3A4A;
    text-transform: lowercase;
    min-height: 1.5em;
}

.subtitle .char {
    display: inline-block;
    opacity: 0;
    transition: opacity 100ms linear;
}

.subtitle .char.visible {
    opacity: 1;
}

/* -- Timeline -------------------------------------------------------------- */
.timeline {
    position: relative;
    width: 100%;
    padding: 4rem 0 2rem;
    z-index: 4;
}

.spine {
    position: absolute;
    top: 0;
    left: 50%;
    width: 2px;
    height: 100%;
    background-color: #4A1526;
    opacity: 0.4;
    transform: translateX(-50%);
    z-index: 3;
    transition: opacity 400ms ease-out;
}

/* -- Timeline Entries ------------------------------------------------------ */
.timeline-entry {
    position: relative;
    width: 100%;
    margin: 6rem 0;
    z-index: 4;
    contain: layout style;
}

.timeline-entry .entry-card {
    position: relative;
    max-width: 480px;
    padding: 2.25rem 2rem;
    background-color: #EAE0D4;
    background-image:
        linear-gradient(rgba(244, 237, 228, 0.55), rgba(244, 237, 228, 0.55));
    box-shadow: 0 1px 0 rgba(74, 21, 38, 0.05);
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 600ms ease-out, transform 800ms ease-out;
    will-change: transform, opacity;
}

.timeline-entry.in-view .entry-card {
    opacity: 1;
    transform: translateY(0);
}

.entry-left .entry-card {
    margin-left: 120px;
    margin-right: calc(50% + 60px);
    text-align: right;
}

.entry-right .entry-card {
    margin-left: calc(50% + 60px);
    margin-right: 120px;
    text-align: left;
}

.entry-connector {
    position: absolute;
    top: 3rem;
    width: 50%;
    height: 24px;
    pointer-events: none;
}

.entry-left .entry-connector {
    left: 0;
}

.entry-right .entry-connector {
    right: 0;
}

.connector-line {
    position: absolute;
    top: 50%;
    height: 1px;
    background-color: #4A1526;
    opacity: 0.7;
    width: 0;
    transition: width 300ms linear;
}

.entry-left .connector-line {
    right: 0;
    left: auto;
}

.entry-right .connector-line {
    left: 0;
    right: auto;
}

.timeline-entry.connect .connector-line {
    width: calc(100% - 60px);
}

.connector-node {
    position: absolute;
    top: 50%;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: #6B1D30;
    transform: translate(-50%, -50%) scale(1);
    transition: transform 400ms ease-out, opacity 400ms ease-out;
    opacity: 0.85;
}

.entry-left .connector-node {
    right: 0;
    left: auto;
    transform: translate(50%, -50%) scale(1);
}

.entry-right .connector-node {
    left: 0;
    right: auto;
    transform: translate(-50%, -50%) scale(1);
}

.timeline-entry.pulse .connector-node {
    animation: nodePulse 400ms ease-out;
}

@keyframes nodePulse {
    0% {
        opacity: 0.85;
    }
    50% {
        opacity: 1;
    }
    100% {
        opacity: 0.85;
    }
}

.entry-left.pulse .connector-node {
    animation: nodePulseLeft 400ms ease-out;
}

@keyframes nodePulseLeft {
    0% {
        transform: translate(50%, -50%) scale(1);
        opacity: 0.85;
    }
    50% {
        transform: translate(50%, -50%) scale(1.3);
        opacity: 1;
    }
    100% {
        transform: translate(50%, -50%) scale(1);
        opacity: 0.85;
    }
}

.entry-right.pulse .connector-node {
    animation: nodePulseRight 400ms ease-out;
}

@keyframes nodePulseRight {
    0% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 0.85;
    }
    50% {
        transform: translate(-50%, -50%) scale(1.3);
        opacity: 1;
    }
    100% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 0.85;
    }
}

/* Card content */
.specimen-number {
    display: block;
    font-family: "Cormorant Garamond", serif;
    font-style: italic;
    font-weight: 600;
    font-size: 2.5rem;
    color: #8C3A4A;
    opacity: 0.4;
    line-height: 1;
    letter-spacing: -0.02em;
    margin-bottom: 0.6rem;
}

.entry-date {
    display: block;
    font-family: "IBM Plex Mono", monospace;
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: #8C3A4A;
    margin-bottom: 1rem;
}

.specimen-name {
    font-family: "Cormorant Garamond", serif;
    font-weight: 600;
    font-style: italic;
    font-size: clamp(1.5rem, 3vw, 1.8rem);
    line-height: 1.15;
    color: #4A1526;
    letter-spacing: -0.02em;
    margin-bottom: 1.25rem;
    background-image: linear-gradient(currentColor, currentColor);
    background-position: 0 100%;
    background-repeat: no-repeat;
    background-size: 0% 1px;
    transition: background-size 400ms ease-out;
    display: inline-block;
}

.specimen-name:hover {
    background-size: 100% 1px;
}

.entry-description {
    font-family: "IBM Plex Mono", monospace;
    font-weight: 400;
    font-size: 0.9rem;
    line-height: 1.75;
    color: #2B0D14;
    margin-bottom: 1.25rem;
}

.entry-footnote {
    display: block;
    font-family: "IBM Plex Mono", monospace;
    font-weight: 300;
    font-size: 0.75rem;
    line-height: 1.55;
    color: #B8707E;
    border-top: 1px dotted rgba(184, 112, 126, 0.4);
    padding-top: 0.75rem;
}

/* -- Specimen Plates ------------------------------------------------------- */
.specimen-plate {
    position: relative;
    width: 100%;
    min-height: 90vh;
    margin: 8rem 0;
    background-color: #1A0A10;
    overflow: hidden;
    z-index: 4;
    color: #E8D0C8;
    contain: layout style;
}

.plate-bg-transition {
    position: absolute;
    top: -40vh;
    left: 0;
    right: 0;
    height: 40vh;
    background-image: linear-gradient(
        180deg,
        rgba(244, 237, 228, 0) 0%,
        rgba(58, 18, 28, 0.5) 60%,
        #1A0A10 100%
    );
    pointer-events: none;
    z-index: 5;
}

.specimen-plate::after {
    content: "";
    position: absolute;
    bottom: -40vh;
    left: 0;
    right: 0;
    height: 40vh;
    background-image: linear-gradient(
        180deg,
        #1A0A10 0%,
        rgba(58, 18, 28, 0.5) 40%,
        rgba(244, 237, 228, 0) 100%
    );
    pointer-events: none;
    z-index: 5;
}

.plate-content {
    position: relative;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 6rem 120px 4rem;
    z-index: 6;
}

.plate-image-container {
    position: relative;
    width: 100%;
    max-width: 70vw;
    margin: 0 auto;
    aspect-ratio: 6 / 5;
}

.plate-image {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    transform: scale(1);
    transition: transform 1200ms ease-out;
    will-change: transform;
}

.specimen-plate.in-view .plate-image {
    transform: scale(1.03);
}

.duotone-image {
    background:
        radial-gradient(ellipse at center, rgba(140, 58, 74, 0.18) 0%, transparent 60%),
        #0E0608;
}

.duotone-image::before {
    content: "";
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at center, rgba(74, 21, 38, 0.25) 0%, transparent 70%);
    mix-blend-mode: overlay;
    pointer-events: none;
}

.botanical-plate-svg {
    width: 100%;
    height: 100%;
    max-height: 50vh;
    object-fit: contain;
    filter: drop-shadow(0 2px 14px rgba(140, 58, 74, 0.25));
}

/* -- Plate Annotations ----------------------------------------------------- */
.plate-annotations {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.annotation {
    position: absolute;
    font-family: "Space Mono", "IBM Plex Mono", monospace;
    font-weight: 400;
    font-size: clamp(0.65rem, 0.8vw, 0.75rem);
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: rgba(232, 208, 200, 0.5);
    white-space: nowrap;
}

.annotation-text {
    display: inline-block;
    background-color: rgba(26, 10, 16, 0.4);
    padding: 0.25rem 0.5rem;
    border: 1px solid rgba(232, 208, 200, 0.2);
}

.annotation-line {
    position: absolute;
    display: block;
    height: 1px;
    background-color: rgba(232, 208, 200, 0.4);
    top: 50%;
    width: 0;
    transition: width 600ms ease-out;
    transform-origin: 0 0;
}

.annotation.line-drawn .annotation-line {
    /* width set via JS using calculated distances */
}

.typewriter-target .tw-char {
    opacity: 0;
}

.typewriter-target .tw-char.visible {
    opacity: 1;
}

/* -- Plate Caption --------------------------------------------------------- */
.plate-caption {
    text-align: center;
    margin-top: 2.5rem;
    opacity: 0;
    transform: translateY(15px);
    transition: opacity 700ms ease-out 200ms, transform 700ms ease-out 200ms;
}

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

.plate-title {
    font-family: "Cormorant Garamond", serif;
    font-weight: 600;
    font-style: italic;
    font-size: clamp(1.5rem, 3vw, 2.2rem);
    color: #E8D0C8;
    letter-spacing: -0.02em;
    margin-bottom: 0.85rem;
}

.plate-description {
    font-family: "IBM Plex Mono", monospace;
    font-weight: 300;
    font-size: 0.9rem;
    line-height: 1.6;
    color: #B8707E;
    max-width: 560px;
    margin: 0 auto;
}

/* -- Terminal Observation -------------------------------------------------- */
.terminal-observation {
    position: relative;
    width: 100%;
    min-height: 100vh;
    background-color: #1A0A10;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    z-index: 4;
}

.terminal-observation::before {
    content: "";
    position: absolute;
    top: -40vh;
    left: 0;
    right: 0;
    height: 40vh;
    background-image: linear-gradient(
        180deg,
        rgba(244, 237, 228, 0) 0%,
        rgba(58, 18, 28, 0.5) 60%,
        #1A0A10 100%
    );
    pointer-events: none;
}

.terminal-content {
    position: relative;
    text-align: center;
    padding: 0 120px;
    max-width: 800px;
    z-index: 5;
}

.terminal-text {
    font-family: "IBM Plex Mono", monospace;
    font-weight: 300;
    font-size: 1.1rem;
    line-height: 2;
    color: #B8707E;
    letter-spacing: 0.05em;
    margin-bottom: 4rem;
}

.terminal-spine-fade {
    position: absolute;
    top: 0;
    left: 50%;
    width: 2px;
    height: 60vh;
    background: linear-gradient(180deg, rgba(74, 21, 38, 0.6) 0%, rgba(74, 21, 38, 0) 100%);
    transform: translateX(-50%);
    z-index: 3;
}

.terminal-leaf {
    width: 80px;
    height: 120px;
    margin: 3rem auto 0;
    animation: rotateLeaf 120s linear infinite;
    opacity: 0.7;
    /* Botanical Accent — Pressed Leaf hue inherited by SVG strokes */
    color: #2D4A2E;
}

.rotating-leaf {
    width: 100%;
    height: 100%;
}

@keyframes rotateLeaf {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

/* -- Responsive ------------------------------------------------------------ */
@media (max-width: 900px) {
    .opening-content {
        padding: 0 40px;
    }

    .marginalia {
        display: none;
    }

    .entry-left .entry-card,
    .entry-right .entry-card {
        max-width: calc(100% - 80px);
        margin-left: 60px;
        margin-right: 20px;
        text-align: left;
    }

    .spine {
        left: 30px;
    }

    .entry-connector {
        width: 30px;
    }

    .entry-left .entry-connector {
        left: 0;
        right: auto;
    }

    .entry-left .connector-line {
        left: 0;
        right: auto;
    }

    .entry-left .connector-node {
        left: 0;
        right: auto;
        transform: translate(-50%, -50%) scale(1);
    }

    .timeline-entry.connect .connector-line {
        width: calc(100% - 8px);
    }

    .plate-content {
        padding: 4rem 20px 3rem;
    }

    .plate-image-container {
        max-width: 92vw;
    }

    .terminal-content {
        padding: 0 20px;
    }
}

@media (max-width: 540px) {
    .specimen-number {
        font-size: 2rem;
    }

    .specimen-name {
        font-size: 1.4rem;
    }

    .annotation {
        font-size: 0.6rem;
    }
}
