/* CSS Reset & Normalize */
*,
*::before,
*::after {
    box-sizing: border-box;
}

* {
    margin: 0;
    padding: 0;
}

body {
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

img,
picture,
video,
canvas,
svg {
    display: block;
    max-width: 100%;
}

input,
button,
textarea,
select {
    font: inherit;
}

/* CSS Custom Properties */
:root {
    --text-color: #e0e0ee;
    --highlight-color: #f0f0ff;
    --background-color: #05020a;
    --nebula-purple: rgba(138, 43, 226, 0.15);
    --nebula-blue: rgba(30, 144, 255, 0.12);
    --nebula-pink: rgba(255, 20, 147, 0.1);
    --nebula-cyan: rgba(0, 255, 255, 0.08);

    /* Spacing Scale */
    --space-xs: 0.5rem;
    --space-sm: 1rem;
    --space-md: 1.5rem;
    --space-lg: 2rem;
    --space-xl: 3rem;
    --space-xxl: 4rem;

    /* Typography Scale */
    --text-xs: 0.875rem;
    --text-sm: 1rem;
    --text-md: 1.125rem;
    --text-lg: 1.25rem;
    --text-xl: 1.5rem;
    --text-xxl: 2rem;

    /* Container widths */
    --container-sm: 320px;
    --container-md: 768px;
    --container-lg: 1024px;
}

/* Animations */
@keyframes blink {
    0%,
    100% {
        opacity: 0.2;
    }
    50% {
        opacity: 1;
    }
}

@keyframes nebulaDrift1 {
    0%,
    100% {
        transform: translateX(-20%) translateY(-10%) scale(1);
        opacity: 0.6;
    }
    50% {
        transform: translateX(20%) translateY(10%) scale(1.1);
        opacity: 0.8;
    }
}

@keyframes nebulaDrift2 {
    0%,
    100% {
        transform: translateX(15%) translateY(20%) scale(0.9);
        opacity: 0.4;
    }
    50% {
        transform: translateX(-25%) translateY(-15%) scale(1.2);
        opacity: 0.7;
    }
}

@keyframes nebulaDrift3 {
    0%,
    100% {
        transform: translateX(-10%) translateY(25%) scale(1.1);
        opacity: 0.5;
    }
    50% {
        transform: translateX(30%) translateY(-20%) scale(0.8);
        opacity: 0.9;
    }
}

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

/* Base Styles */
.page {
    background-color: var(--background-color);
    color: var(--text-color);
    font-family: "Courier New", Courier, monospace;
    overflow-x: hidden;
    min-height: 100vh;
}

/* Background Elements */
.background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -2;
    overflow: hidden;
}

.background__nebula {
    position: absolute;
    border-radius: 50%;
    filter: blur(40px);
    mix-blend-mode: screen;
    will-change: transform, opacity;
}

.background__nebula--1 {
    top: 10%;
    left: 20%;
    width: 300px;
    height: 200px;
    background: radial-gradient(ellipse, var(--nebula-purple), transparent);
    animation:
        nebulaDrift1 45s ease-in-out infinite,
        nebulaRotate 120s linear infinite;
}

.background__nebula--2 {
    top: 60%;
    right: 15%;
    width: 400px;
    height: 250px;
    background: radial-gradient(ellipse, var(--nebula-blue), transparent);
    animation:
        nebulaDrift2 60s ease-in-out infinite,
        nebulaRotate 180s linear infinite reverse;
}

.background__nebula--3 {
    bottom: 20%;
    left: 10%;
    width: 350px;
    height: 180px;
    background: radial-gradient(ellipse, var(--nebula-pink), transparent);
    animation:
        nebulaDrift3 40s ease-in-out infinite,
        nebulaRotate 90s linear infinite;
}

.background__nebula--4 {
    top: 30%;
    right: 40%;
    width: 250px;
    height: 300px;
    background: radial-gradient(ellipse, var(--nebula-cyan), transparent);
    animation:
        nebulaDrift1 55s ease-in-out infinite reverse,
        nebulaRotate 150s linear infinite;
    animation-delay: -20s;
}

.background__stars {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    overflow: hidden;
}

.background__star {
    position: absolute;
    background-color: white;
    border-radius: 50%;
    animation-name: blink;
    animation-timing-function: ease-in-out;
    animation-iteration-count: infinite;
}

/* Star positions and animations */
.background__star:nth-child(1) {
    top: 20%;
    left: 15%;
    width: 1px;
    height: 1px;
    animation-duration: 4s;
}
.background__star:nth-child(2) {
    top: 50%;
    left: 30%;
    width: 2px;
    height: 2px;
    animation-duration: 5s;
    animation-delay: 1s;
}
.background__star:nth-child(3) {
    top: 80%;
    left: 70%;
    width: 1px;
    height: 1px;
    animation-duration: 3s;
    animation-delay: 2s;
}
.background__star:nth-child(4) {
    top: 10%;
    left: 80%;
    width: 1px;
    height: 1px;
    animation-duration: 6s;
}
.background__star:nth-child(5) {
    top: 90%;
    left: 10%;
    width: 2px;
    height: 2px;
    animation-duration: 4.5s;
    animation-delay: 0.5s;
}
.background__star:nth-child(6) {
    top: 40%;
    left: 50%;
    width: 1px;
    height: 1px;
    animation-duration: 3.5s;
}
.background__star:nth-child(7) {
    top: 60%;
    left: 90%;
    width: 1px;
    height: 1px;
    animation-duration: 5.5s;
    animation-delay: 1.5s;
}
.background__star:nth-child(8) {
    top: 5%;
    left: 5%;
    width: 1px;
    height: 1px;
    animation-duration: 4s;
    animation-delay: 3s;
}
.background__star:nth-child(9) {
    top: 75%;
    left: 25%;
    width: 2px;
    height: 2px;
    animation-duration: 6s;
    animation-delay: 2.5s;
}
.background__star:nth-child(10) {
    top: 33%;
    left: 66%;
    width: 1px;
    height: 1px;
    animation-duration: 5s;
}
.background__star:nth-child(11) {
    top: 15%;
    left: 95%;
    width: 1px;
    height: 1px;
    animation-duration: 3.8s;
    animation-delay: 1.8s;
}
.background__star:nth-child(12) {
    top: 85%;
    left: 55%;
    width: 2px;
    height: 2px;
    animation-duration: 5.2s;
}

/* Main Content Container */
.content {
    position: relative;
    z-index: 1;
    padding: var(--space-lg) var(--space-sm);
    max-width: var(--container-sm);
    margin: 0 auto;
    text-align: center;
}

/* Typography */
.content__title {
    color: var(--highlight-color);
    text-transform: uppercase;
    letter-spacing: 2px;
    font-size: var(--text-xl);
    margin-top: var(--space-sm);
    margin-bottom: var(--space-md);
    font-weight: bold;
}

.content__heading {
    color: var(--highlight-color);
    text-transform: uppercase;
    letter-spacing: 2px;
    font-size: var(--text-lg);
    margin-top: var(--space-xl);
    margin-bottom: var(--space-md);
    font-weight: bold;
}

.content__subheading {
    color: var(--highlight-color);
    text-transform: uppercase;
    letter-spacing: 1px;
    font-size: var(--text-md);
    margin-top: var(--space-lg);
    margin-bottom: var(--space-sm);
    font-weight: bold;
}

.content__text {
    line-height: 1.8;
    font-size: var(--text-md);
    margin: var(--space-xs) 0;
}

.content__text--emphasized {
    font-weight: bold;
}

.content__link {
    color: var(--highlight-color);
    text-decoration: none;
    border-bottom: 1px dotted var(--highlight-color);
    transition: all 0.3s ease;
    display: inline-block;
    padding: 2px 4px;
}

.content__link:hover,
.content__link:focus {
    color: #fff;
    background-color: rgba(255, 255, 255, 0.1);
    border-bottom-style: solid;
}

/* Image Styles */
.content__image {
    width: 100%;
    height: auto;
    margin-bottom: var(--space-xl);
    border: 2px solid var(--text-color);
    border-radius: 4px;
}

/* Section Layout */
.section {
    margin-bottom: var(--space-xxl);
}

.section__separator {
    border: 0;
    height: 1px;
    background-image: linear-gradient(
        to right,
        rgba(224, 224, 224, 0),
        rgba(224, 224, 224, 0.5),
        rgba(224, 224, 224, 0)
    );
    margin: var(--space-xxl) 0;
}

/* Train Schedule Styling */
.section--program .section__column h4 {
    color: var(--highlight-color);
    text-transform: uppercase;
    letter-spacing: 1px;
    font-size: var(--text-sm);
    margin-top: var(--space-md);
    margin-bottom: var(--space-xs);
    font-weight: bold;
}

/* Crew listing styles */
.section .content__text:first-of-type {
    margin-top: var(--space-xs);
}

/* Enhanced train time styling */
.content__text:has-text("→") {
    font-family: "Courier New", monospace;
    letter-spacing: 1px;
}

/* Timetable (Program) */
.timetable {
    list-style: none;
    margin: 0 auto;
    padding: 0;
    max-width: 24rem;
    text-align: left;
}

.timetable__item {
    display: grid;
    grid-template-columns: 9.5ch 1fr;
    column-gap: var(--space-sm);
    align-items: center;
    padding: var(--space-xs) 0;
}

.timetable__item + .timetable__item {
    border-top: 1px solid rgba(224, 224, 238, 0.12);
}

.timetable__time {
    width: 9.5ch;
    text-align: right;
    font-family: "Courier New", Courier, monospace;
    font-variant-numeric: tabular-nums;
    font-weight: 700;
    color: var(--highlight-color);
    letter-spacing: 0;
    line-height: 1.4;
}

.timetable__act {
    opacity: 0.95;
    line-height: 1.4;
}

/* Tablet Breakpoint */
@media (min-width: 768px) {
    :root {
        --text-sm: 1.125rem;
        --text-md: 1.25rem;
        --text-lg: 1.5rem;
        --text-xl: 1.875rem;
        --text-xxl: 2.25rem;
    }

    .content {
        max-width: var(--container-md);
        padding: var(--space-xl) var(--space-lg);
    }

    .content__title {
        font-size: var(--text-xxl);
    }

    .content__heading {
        font-size: var(--text-xl);
    }

    .content__subheading {
        font-size: var(--text-lg);
    }

    /* Better spacing for train schedule on tablets */
    .section h3 + p,
    .section h4 + p {
        margin-top: var(--space-xs);
    }
}

/* Desktop Breakpoint */
@media (min-width: 1024px) {
    .content {
        max-width: var(--container-lg);
        padding: var(--space-xxl) var(--space-xl);
    }

    /* Two-column layout for program section */
    .section--program {
        display: grid;
        grid-template-columns: 1fr;
        gap: var(--space-xl);
        text-align: left;
    }

    .section--program .content__heading {
        grid-column: 1 / -1;
        text-align: center;
    }

    /* Three-column layout for train schedules on large screens */
    .section:has(.content__subheading:contains("Hinfahrt")) {
        display: grid;
        grid-template-columns: 1fr;
        gap: var(--space-lg);
    }

    /* Better organization of train times */
    .section h3:contains("Hinfahrt") ~ p,
    .section h4:contains("Tagesgäste") ~ p,
    .section h4:contains("Übernachtungsgäste") ~ p {
        display: inline-block;
        margin-right: var(--space-md);
        margin-bottom: var(--space-xs);
        padding: var(--space-xs);
        background: rgba(255, 255, 255, 0.05);
        border-radius: 4px;
        font-family: "Courier New", monospace;
        letter-spacing: 1px;
    }
}

/* List Styling */
.content__list {
    list-style: none;
    padding-left: 0;
    text-align: left;
    max-width: 400px;
    margin: var(--space-md) auto;
}

.content__list li {
    margin-bottom: var(--space-md);
    line-height: 1.7;
    font-size: var(--text-md);
    text-align: center;
}

.content__list li::before {
    content: "";
}

/* Enhanced styling for specific content */
.content__text:contains("spelunkenkommando") {
    font-style: italic;
}

.content__text:contains("DANCEFLOOR OPENING") {
    color: var(--highlight-color);
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.content__text:contains("Stellar Deck") {
    color: var(--highlight-color);
}

/* Reduced Motion Preferences */
@media (prefers-reduced-motion: reduce) {
    .background__star {
        animation: none;
        opacity: 0.5;
    }

    .background__nebula {
        animation: none;
        opacity: 0.3;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    :root {
        --text-color: #ffffff;
        --highlight-color: #ffffff;
        --background-color: #000000;
    }

    .content__link {
        border-bottom-width: 2px;
    }

    .background__nebula {
        display: none;
    }
}

/* Train Schedule Tables */
.train-schedule {
    width: 100%;
    max-width: 400px;
    margin: var(--space-md) auto;
    border-collapse: collapse;
    font-family: "Courier New", Courier, monospace;
    font-variant-numeric: tabular-nums;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 4px;
    overflow: hidden;
}

.train-schedule th {
    background: rgba(240, 240, 255, 0.1);
    color: var(--highlight-color);
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-size: var(--text-sm);
    padding: var(--space-sm);
    border-bottom: 1px solid rgba(224, 224, 238, 0.2);
}

.train-schedule td {
    padding: var(--space-xs) var(--space-sm);
    border-bottom: 1px solid rgba(224, 224, 238, 0.1);
    text-align: center;
    color: var(--text-color);
}

.train-schedule tr:hover {
    background: rgba(255, 255, 255, 0.05);
}

.train-schedule tr:last-child td {
    border-bottom: none;
}

/* Tablet and larger screens */
@media (min-width: 768px) {
    .train-schedule {
        max-width: 500px;
    }

    .train-schedule th,
    .train-schedule td {
        padding: var(--space-sm) var(--space-md);
    }
}

/* Footer Styles */
.footer {
    position: relative;
    z-index: 1;
    padding: var(--space-xl) var(--space-sm) var(--space-lg);
    max-width: var(--container-sm);
    margin: 0 auto;
    text-align: center;
    border-top: 1px solid rgba(224, 224, 238, 0.1);
}

.footer__text {
    font-size: var(--text-xs);
    opacity: 0.6;
    color: var(--text-color);
    line-height: 1.6;
    margin: 0;
}

.footer__link {
    color: var(--text-color);
    text-decoration: none;
    opacity: 0.7;
    transition: all 0.3s ease;
    font-family: "Courier New", Courier, monospace;
    letter-spacing: 0.5px;
}

.footer__link:hover,
.footer__link:focus {
    opacity: 1;
    color: var(--highlight-color);
    text-shadow: 0 0 8px rgba(240, 240, 255, 0.3);
}

/* Tablet Breakpoint */
@media (min-width: 768px) {
    .footer {
        max-width: var(--container-md);
        padding: var(--space-xl) var(--space-lg) var(--space-lg);
    }
}

/* Desktop Breakpoint */
@media (min-width: 1024px) {
    .footer {
        max-width: var(--container-lg);
        padding: var(--space-xl) var(--space-xl) var(--space-lg);
    }
}

/* Print styles */
@media print {
    .background,
    .background__stars,
    .background__nebula {
        display: none;
    }

    .page {
        background: white;
        color: black;
    }

    .content__title,
    .content__heading,
    .content__subheading {
        color: black;
    }

    .content__link {
        color: black;
        border-bottom: 1px solid black;
    }

    .train-schedule {
        background: white;
        border: 1px solid black;
    }

    .train-schedule th {
        background: #f0f0f0;
        color: black;
    }

    .train-schedule td {
        color: black;
        border-bottom: 1px solid #ccc;
    }

    .footer {
        border-top: 1px solid #ccc;
    }

    .footer__text,
    .footer__link {
        color: black;
        opacity: 1;
    }
}
