:root {
    --month-width: 150px;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

body {
    margin: 0;
    font-family: Arial, sans-serif;
    font-size: 16px;
    color: white;
    background: #fff;
}

* {
    box-sizing: border-box;
    font-family: inherit;
}

a,
h1,
h2,
h3,
h4,
h5,
h6,
button,
input,
select,
textarea {
    font-weight: inherit;
    font-size: inherit;
}

a {
    color: inherit;
    text-decoration: underline dotted;
    text-underline-offset: 4px;
}

a:hover {
    text-decoration: none;
}

.section {
    padding: 40px;
}

.top {
    text-align: center;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    height: 60vh;
}

.title-video {
    width: 98vw;
    max-width: 98vw;
    max-height: 58vh;
    object-fit: contain;
    display: block;
    z-index: 1;
}

.timeline-section {
    position: relative;
    width: 100%;
    height: 100dvh;
    overflow: hidden;
}

.timeline-container {
    position: relative;
    width: 100%;
    height: 100dvh;
    overflow-x: auto;
    overflow-y: hidden;
    padding-bottom: env(safe-area-inset-bottom);
    touch-action: pan-y;
}

.timeline-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100dvh;
    z-index: 0;
    pointer-events: none;
    overflow: hidden;
}

.timeline-bg img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: blur(60px);
    transform: scale(1.1);
    opacity: 0;
}

.year,
.year-compressed {
    position: sticky;
    top: 0;
    left: var(--month-width);
    text-align: left;
    z-index: 30;
    background: none;
}

.year-compressed {
    left: auto;
}

.year:not(.year-compressed) {
    position: static;
    overflow: clip;
}

.year:not(.year-compressed) > span {
    display: block;
    position: sticky;
    top: 0;
    left: var(--month-width);
    z-index: 30;
    background: none;
    padding-right: 20px;
}

.info-cell {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: flex-start;
    text-align: left;
    justify-self: stretch;
    align-self: stretch;
    width: 80vw;
    height: 100%;
    padding: 20px;
    box-sizing: border-box;
    line-height: 1.5;
    z-index: 21;
    background: white;
    color: black;
    mix-blend-mode: luminosity;
}

.info-cell p {
    width: 100%;
    text-align: left;
}

.info-cell p a {
    margin-right: 25px;
}

.header {
    position: sticky;
    z-index: 25;
}

.today-line {
    position: fixed;
    top: 0;
    left: 0;
    width: 10px;
    height: 100vh;
    background: red;
    z-index: 2000;
    pointer-events: none;
    mix-blend-mode: multiply;
}

.timeline {
    display: grid;
    /* Data columns are written inline by Twig (views/index.twig) from the dynamic column count. */
    grid-template-columns: var(--month-width);

    width: max-content;
    height: 100vh;
    gap: 1px 0;
}

.year,
.header {
    padding-left: 0 !important;
}

.row-title {
    position: sticky;
    left: 0;
    z-index: 20;
    color: white;
    background: black;
    mix-blend-mode: luminosity;
    opacity: 0.5;
    align-items: flex-start !important;
    padding-top: 2px;
}

.cell {
    display: flex;
    align-items: center;
    white-space: normal;
    word-break: break-word;
    padding-left: 15px;
}

.media-cell {
    padding-left: 0;
    height: 100%;
    width: 100%;
    overflow: hidden;
    cursor: pointer;
}

.media-cell:has(.white-image) {
    background: #fafafa;
}

.row-highlight {
    background: gray;
}

.row-title.row-highlight {
    background: white;
    color: black;
}

.period {
    color: black;
    background: white;
    mix-blend-mode: luminosity;
    opacity: 1;
}

.lightbox {
    display: none;
    position: fixed;
    inset: 0;
    /* Above the timeline controls (3000), below the impressum overlay (4015). */
    z-index: 3500;
    justify-content: center;
    align-items: center;
    background: rgba(0, 0, 0, 0.2);
    -webkit-backdrop-filter: blur(40px) saturate(60%);
    backdrop-filter: blur(40px) saturate(60%);
}

/* Lock page scrolling while an overlay is open (classes toggled in script.js).
   The impressum overlay stays scrollable through its own overflow-y: auto. */
body.lightbox-open,
body.impressum-open {
    overflow: hidden;
}

@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
    .lightbox {
        background: rgba(0, 0, 0, 0.55);
    }
}

.lightbox-track {
    display: flex;
    gap: 60px;
    align-items: center;
    overflow: hidden;
    width: 100vw;
    padding: 0 20vw;
    box-sizing: border-box;
}

.lightbox-track.is-single {
    justify-content: center;
}

.lightbox-item {
    flex: 0 0 auto;
    max-width: 60vw;
    cursor: pointer;
}

.lightbox-caption {
    margin-top: 10px;
    text-align: center;
    width: 100%;
}

.lightbox-media {
    display: flex;
    justify-content: center;
    align-items: center;
}

.lightbox-media img,
.lightbox-media video {
    width: 100%;
    max-height: 70vh;
    object-fit: contain;
    display: block;
    background: transparent;
}

.white-image {
    mix-blend-mode: luminosity;
}

.cell.milestone {
    position: relative;
}

.cell.milestone::before {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    width: 10px;
    background: white;
    pointer-events: none;
}

.thumbnail {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    background: transparent;
    transition: filter 0.2s ease;
}

.media-cell:hover .thumbnail {
    filter: brightness(1.25);
}

a.cell[href^="http"] {
    position: relative;
    text-decoration: none;
}

a.cell[href^="http"]::after {
    content: "\2197\FE0E";
    position: absolute;
    top: 10px;
    right: 10px;
    font-size: 1.5rem;
    line-height: 1;
    opacity: 0.75;
    pointer-events: none;
    -webkit-text-stroke: 1px currentColor;
}

.timeline-controls {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 3000;
    display: flex;
    gap: 1px;
}

.timeline-controls button {
    padding: 0 12px;
    cursor: pointer;
    border-radius: 0;
    border: 0 solid #000;
    background: white;
    color: black;
    text-decoration: none;
}

.timeline-controls button:hover {
    background: #eee;
}

.impressum-overlay {
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100dvh;
    background: white;
    display: none;
    justify-content: center;
    align-items: flex-start;
    z-index: 4015;
    padding: 40px 20px;
    overflow-y: auto;
}

.impressum-content {
    width: 100%;
    color: black;
    display: flex;
    flex-direction: column;
    gap: 20px;
    line-height: 1.5;
}

.impressum-close {
    position: fixed;
    bottom: 20px;
    right: 20px;
    padding: 0 12px;
    background: black;
    color: white;
    border: none;
    cursor: pointer;
    z-index: 4100;
}

.impressum-close:hover {
    background: #eee;
}

@media (max-width: 800px) {
    .info-cell {
        width: 100vw;
    }

    .lightbox-track {
        gap: 10px;
        padding: 0 10vw;
    }
}
