/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    width: 100%;
    height: 100%;
    background-color: #0D0D0D;
    color: #B0B0B0;
    font-family: 'Bitter', serif;
    font-weight: 400;
    line-height: 1.75;
    letter-spacing: 0.01em;
}

html {
    scroll-behavior: smooth;
}

body {
    overflow-x: hidden;
}

/* Typography */
h1, h2 {
    font-family: 'Roboto Slab', serif;
    font-weight: 700;
    color: #FFFFFF;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

h1 {
    font-size: clamp(2.8rem, 7vw, 5.5rem);
    letter-spacing: 0.06em;
}

h2 {
    font-size: clamp(1.6rem, 4vw, 2.8rem);
    letter-spacing: 0.04em;
    margin-bottom: 1rem;
}

p {
    font-size: clamp(1rem, 1.8vw, 1.25rem);
    line-height: 1.75;
    letter-spacing: 0.01em;
    color: #B0B0B0;
}

/* Background Grid */
.background-grid {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
    opacity: 0;
}

.grid-line {
    stroke: #1A1A1A;
    stroke-width: 1;
}

/* Timeline Container */
.timeline-container {
    position: relative;
    width: 100%;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    z-index: 2;
}

/* Page Title */
.page-title {
    position: fixed;
    top: 60px;
    left: 50%;
    transform: translateX(-50%);
    font-family: 'Roboto Slab', serif;
    font-size: clamp(1.4rem, 3vw, 2.5rem);
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #FFFFFF;
    z-index: 100;
    opacity: 0;
}

/* Timeline Axis */
.timeline-axis {
    position: fixed;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 2px;
    height: 100%;
    background-color: #2A2A2A;
    z-index: 10;
}

.axis-fill {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 0;
    background-color: #FFFFFF;
    transition: height 0.1s linear;
}

/* Timeline Content */
.timeline-content {
    position: relative;
    width: 100%;
    max-width: 1000px;
    margin: 0 auto;
    padding: 200px 0 300px 0;
}

/* Timeline Nodes */
.timeline-node {
    position: relative;
    height: 0;
    display: flex;
    justify-content: center;
    margin: 120px 0;
}

.node-marker {
    position: absolute;
    width: 24px;
    height: 24px;
    border: 2px solid #FFFFFF;
    background-color: transparent;
    left: 50%;
    transform: translateX(-50%);
    z-index: 20;
    transition: background-color 0.3s ease, border-radius 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.timeline-node.active .node-marker {
    background-color: #FFFFFF;
    border-radius: 50%;
    border-radius: 0;
}

/* Timeline Entries */
.timeline-entry {
    position: relative;
    margin-bottom: 300px;
    display: flex;
    opacity: 0;
}

.timeline-entry[data-side="left"] {
    flex-direction: row;
    justify-content: flex-end;
    padding-right: 60px;
}

.timeline-entry[data-side="right"] {
    flex-direction: row-reverse;
    justify-content: flex-start;
    padding-left: 60px;
}

.entry-date {
    position: absolute;
    top: -40px;
    font-family: 'Roboto Mono', monospace;
    font-size: 0.75rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #666666;
    white-space: nowrap;
    opacity: 0;
}

.timeline-entry[data-side="left"] .entry-date {
    right: 60px;
}

.timeline-entry[data-side="right"] .entry-date {
    left: 60px;
}

.timeline-entry.active .entry-date {
    animation: slideInDate 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    animation-delay: 0s;
}

.entry-panel {
    width: 100%;
    max-width: 440px;
    display: flex;
    gap: 30px;
    align-items: flex-start;
    border: 1px solid transparent;
    padding: 40px;
    position: relative;
}

.timeline-entry[data-side="left"] .entry-panel {
    justify-content: flex-end;
}

.timeline-entry[data-side="right"] .entry-panel {
    justify-content: flex-start;
}

.entry-panel svg {
    border: 1px solid transparent;
}

.entry-panel.animating .border-anim {
    animation: drawBorder 0.8s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes drawBorder {
    from {
        stroke-dashoffset: var(--perimeter);
    }
    to {
        stroke-dashoffset: 0;
    }
}

.entry-content {
    flex: 1;
}

.entry-graphic {
    width: 200px;
    height: 200px;
    flex-shrink: 0;
}

.timeline-entry.active .entry-panel {
    animation: slidePanel 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes slidePanel {
    from {
        opacity: 0;
        transform: translateX(0);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.timeline-entry[data-side="left"].active .entry-panel {
    animation: slidePanelLeft 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes slidePanelLeft {
    from {
        opacity: 0;
        transform: translateX(80px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.timeline-entry[data-side="right"].active .entry-panel {
    animation: slidePanelRight 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes slidePanelRight {
    from {
        opacity: 0;
        transform: translateX(-80px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideInDate {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Breathing Rooms */
.breathing-room {
    position: relative;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 200px 0;
}

.breathing-form {
    width: 200px;
    height: 200px;
    animation: rotateForm 60s linear infinite;
}

.breathing-room[data-form="circle"] .breathing-form {
    animation: rotateForm 90s linear infinite;
}

.breathing-room[data-form="triangle"] .breathing-form {
    animation: rotateForm 120s linear infinite;
}

.breathing-room[data-form="square"] .breathing-form {
    animation: rotateForm 60s linear infinite;
}

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

/* Initial Page Load Animation */
@keyframes gridFadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes axisSlide {
    from {
        height: 0;
    }
    to {
        height: 100%;
    }
}

@keyframes titleFadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.background-grid.loading {
    animation: gridFadeIn 0.4s ease-out forwards;
    animation-delay: 0.4s;
}

.timeline-axis.loading {
    animation: axisSlide 0.4s ease-out forwards;
    animation-delay: 0.8s;
}

.page-title.loading {
    animation: titleFadeIn 0.4s ease-out forwards;
    animation-delay: 1.2s;
}

/* Responsive Design */
@media (max-width: 768px) {
    .timeline-axis {
        left: 16px;
        transform: translateX(0);
    }

    .timeline-entry {
        flex-direction: column !important;
        margin-left: 80px;
        padding-right: 0 !important;
        padding-left: 0 !important;
    }

    .timeline-entry[data-side="left"],
    .timeline-entry[data-side="right"] {
        justify-content: flex-start;
    }

    .timeline-entry[data-side="left"] .entry-date,
    .timeline-entry[data-side="right"] .entry-date {
        left: 0;
        right: auto;
        transform: translateX(0);
    }

    .entry-panel {
        max-width: 100%;
        flex-direction: column;
    }

    .entry-graphic {
        width: 150px;
        height: 150px;
    }

    .page-title {
        font-size: clamp(1rem, 2vw, 1.5rem);
        top: 40px;
    }

    /* Mobile grid adjustment */
    .grid-line {
        /* Grid interval 32px on mobile */
    }
}

/* Grid pulse animation keyframes */
@keyframes gridPulse {
    0% {
        stroke: #1A1A1A;
    }
    50% {
        stroke: #2A2A2A;
    }
    100% {
        stroke: #1A1A1A;
    }
}

.grid-line.pulse {
    animation: gridPulse 1.5s ease-in-out forwards;
}

/* Additional Text Styles */
em, i {
    font-style: italic;
    color: #D4D4D4;
}

strong, b {
    font-weight: 700;
    color: #D4D4D4;
}

/* Secondary borders, divider lines */
hr, .divider {
    border: none;
    border-top: 1px solid #444444;
    margin: 2rem 0;
}

/* Timestamp / metadata text */
.entry-meta, time, .metadata {
    color: #999999;
    font-family: 'Roboto Mono', monospace;
    font-size: 0.75rem;
    letter-spacing: 0.12em;
}

/* Link styles if needed */
a {
    color: #FFFFFF;
    text-decoration: none;
    transition: color 0.3s ease;
}

a:hover {
    color: #ECECEC;
}
