#timeline {
    background-color: var(--tl-bg);
    position: relative;
    display: flex;
    overflow: auto;
    position: absolute;
    height: 100%;
    width: 100%;
}

#timeline:not(.vertical) {
    flex-direction: column;
    padding-left: 10px;
    padding-right: 10px;
}

#timeline.vertical {
    flex-direction: row;
    padding-top: 70px;
    padding-bottom: 70px;
}

#timeline>#content {
    position: relative;
}

#timeline:not(.vertical)>#content {
    width: var(--content-size);
}

#timeline.vertical>#content {
    height: var(--content-size);
    display: flex;
    flex-direction: row-reverse;
}

#timeline>#content>.collapsible {
    transition: height 0.5s, max-height 0.5s, transform 0.5s;
    animation: overflow-expand 0.5s;
}

#timeline>#content>.collapsed {
    height: 0 !important;
    animation: overflow-collapse 0.5s;
    animation-fill-mode: forwards;
}

@keyframes overflow-collapse {
    0% {
        overflow: visible;
    }
    1% {
        overflow: hidden;
    }
    100% {
        overflow: hidden;
    }
}

@keyframes overflow-expand {
    0% {
        overflow: hidden;
    }
    99% {
        overflow: hidden;
    }
    100% {
        overflow: visible;
    }
}

#timeline>.content-pad.top,
#timeline>.content-pad.bottom {
    flex-grow: 1;
}

#today {
    position: absolute;
}

#timeline:not(.vertical) #today {
    top: 0;
    bottom: 0;
    left: var(--today-pos);
    width: 2px;
    background: linear-gradient(to bottom, var(--tl-today), var(--tl-today) 50%, transparent 50%, transparent);
    background-size: 100% 15px;
}

#timeline.vertical #today {
    left: 0;
    right: 0;
    top: var(--today-pos);
    height: 2px;
    background: linear-gradient(to left, var(--tl-today), var(--tl-today) 50%, transparent 50%, transparent);
    background-size: 15px 100%;
}

.timebar {
    position: relative;
    background-color: var(--tl-bg);
}

.vertical .timebar {
    display: flex;
    flex-direction: row;
}

.timebar>.line {
    position: relative;
    background-color: var(--tl-line);
}

#timeline:not(.vertical) .timebar>.line {
    height: 1.25px;
}

#timeline.vertical .timebar>.line {
    width: 1.25px;
}

.timebar>.line::before,
.timebar>.line::after {
    content: ' ';
    position: absolute;
}

#timeline:not(.vertical) .timebar>.line::before {
    background: linear-gradient(to left, var(--tl-line), transparent);
    height: 1.25px;
    width: 60px;
    left: -60px;
}

#timeline.vertical .timebar>.line::before {
    background: linear-gradient(to top, var(--tl-line), transparent);
    width: 1.25px;
    height: 60px;
    top: -60px;
}

#timeline:not(.vertical) .timebar>.line::after {
    background: linear-gradient(to right, var(--tl-line), transparent);
    height: 1.25px;
    width: 60px;
    right: -60px;
}

#timeline.vertical .timebar>.line::after {
    background: linear-gradient(to bottom, var(--tl-line), transparent);
    width: 1.25px;
    height: 60px;
    bottom: -60px;
}

.timebar-markers {
    position: relative;
}

#timeline:not(.vertical) .timebar-markers {
    height: 2.8em;
}

#timeline.vertical .timebar-markers {
    width: 3.4em;
}

.timebar-markers>.loading {
    display: inline;
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    letter-spacing: 1em;
    font-weight: bold;
}

.vertical .timebar-markers>.loading {
    writing-mode: vertical-lr;
    text-orientation: upright;
}

#short-events {
    position: relative;
    color: var(--tl-ev-color);
    height: var(--se-size);
}

.vertical #short-events {
    height: unset;
    width: var(--se-size);
}

#long-events {
    position: relative;
    color: var(--tl-ev-color);
    height: var(--le-size);
}

.vertical #long-events {
    height: unset;
    width: var(--le-size);
}

#tasks {
    position: relative;
    transform: scaleY(1);
    transform-origin: top;
    display: flex;
    flex-direction: column;
    animation: unset !important;
}

#tasks.collapsible {
    margin-top: 20px;
}

#timeline>#content>#tasks.collapsed {
    transform: scaleY(0);
    height: unset !important;
    max-height: 0 !important;
}

.marker {
    position: absolute;
    top: 0;
    bottom: 0;
    left: var(--startpos);
    right: var(--endpos);
    display: flex;
    justify-content: center;
    align-items: center;
}

.vertical .marker {
    left: 0;
    right: 0;
    top: var(--startpos);
    bottom: var(--endpos);
}

.marker:nth-child(even) {
    background-color: var(--tl-marker-odd-bg);
}

.marker>.tick {
    position: absolute;
    background-color: var(--tl-marker-tick);
    height: 9px;
    width: 2px;
}

.vertical .marker>.tick {
    width: 9px;
    height: 2px;
}

#timeline:not(.vertical) .marker>.tick:not(.last) {
    left: -1px;
}

#timeline.vertical .marker>.tick:not(.last) {
    top: -1px;
}

#timeline:not(.vertical) .marker>.tick.last {
    right: -1px;
}

#timeline.vertical .marker>.tick.last {
    bottom: -1px;
}

#timeline:not(.vertical) .marker>.tick.top {
    top: -3px;
}

#timeline.vertical .marker>.tick.top {
    right: -3px;
}

#timeline:not(.vertical) .marker>.tick.bottom {
    bottom: -4px;
}

#timeline.vertical .marker>.tick.bottom {
    left: -4px;
}

.marker>.label {
    font-size: 0.9em;
    text-align: center;
    cursor: default;
    color: var(--tl-marker-label);
    position: sticky;
}

#timeline:not(.vertical) .marker>.label {
    left: -60px;
    right: -60px;
    margin-left: 20px;
    margin-right: 20px;
}

#timeline.vertical .marker>.label {
    top: -60px;
    bottom: -60px;
    margin-top: 20px;
    margin-bottom: 20px;
}

#timeline:not(.vertical) .marker.vertical>.label {
    writing-mode: vertical-rl;
    font-size: 0.75em;
}


/* --- SHORT EVENTS --- */

.event {
    position: absolute;
    height: 0;
    width: 0;
    border-color: var(--tl-marker-label);
    background-color: var(--tl-marker-label);
}

#timeline:not(.vertical) .event {
    bottom: 0;
    left: var(--event-pos);
}

#timeline.vertical .event {
    left: 0;
    top: var(--event-pos);
}

.event.hidden {
    display: none;
}

.event>.tick,
.long_event>.tick {
    position: absolute;
    background-color: currentColor;
    height: 5px;
    width: 5px;
    border-radius: 10px;
    z-index: 1;
}

#timeline:not(.vertical) .event>.tick {
    top: -2px;
    left: -2px;
}

#timeline.vertical .event>.tick {
    right: -2px;
    top: -2px;
}

.event>.line {
    position: absolute;
    background-color: inherit;
}

#timeline:not(.vertical) .event>.line {
    width: 1.3px;
    height: 60px;
    top: -60px;
}

#timeline:not(.vertical).monthly .event>.line {
    height: 48px;
    top: -48px;
}

#timeline.vertical .event>.line {
    height: 1.3px;
    width: 60px;
    right: -60px;
}

#timeline.vertical.monthly .event>.line {
    width: 48px;
    right: -48px;
}

.event .label {
    color: inherit;
    font-size: 13px;
    font-family: "DinPro", Arial;
    font-weight: 300;
    white-space: nowrap;
    cursor: default;
    position: absolute;
    border-left: 1.4px solid;
    padding-left: 5px;
    text-shadow: -2px 0px 2px var(--tl-bg), -2px -2px 2px var(--tl-bg), 0px -2px 2px var(--tl-bg);
}

#timeline:not(.vertical) .event .label {
    transform: translate(-50%, -50%) rotate(-90deg) translate(50%, 0%);
}

#timeline.vertical .event .label {
    transform: translate(100%, -50%);
    right: 0px;
}

.event .label>a {
    color: inherit;
    border-bottom: 1px solid;
    border-bottom-color: inherit;
    text-decoration: none;
}

.event .label>a:not(.btn):hover {
    border-bottom-width: 2px;
}

.event .date {
    background-color: var(--tl-bg);
    font-size: 0.75em;
    font-weight: normal;
    padding: 5px;
    border: 1.4px solid;
    border-radius: 100px;
    min-width: 12px;
    text-align: center;
    cursor: default;
    z-index: 50;
    position: absolute;
}

.event.tentative .date,
.long_event.tentative .date {
    border: 1.4px dashed;
}

#timeline:not(.vertical) .event .date {
    top: -10px;
    transform: translate(-50%, -100%);
}

#timeline.vertical .event .date {
    transform: translate(10px, -50%);
}

#timeline.monthly .event .date {
    font-size: 0.8em;
}

#timeline.monthly .event:not(.tentative) .date {
    font-weight: bold;
}

#timeline.vertical .event .date>.month {
    display: inline;
    margin-left: 4px;
}

#timeline.monthly .event .date>.month {
    display: none;
}

.event .date:hover {
    z-index: 60;
}

.event .date:hover+.line>.label {
    z-index: 60;
}

.event .info {
    display: none;
    position: absolute;
    bottom: -5px;
    transform: translate(-50%, calc(100% - 1px));
    min-width: 300px;
    border: 1px solid var(--tl-desc-border);
    color: var(--tl-desc-label);
    background-color: var(--tl-desc-bg);
    padding: 8px 12px 12px;
    z-index: 70;
}

.event .info>.title {
    font-weight: bold;
    white-space: nowrap;
    margin-bottom: 8px;
}

.event:hover .info {
    display: initial;
}


/* --- LONG EVENTS --- */

.long_event {
    position: absolute;
}

#timeline:not(.vertical) .long_event {
    top: 0;
    left: var(--event-start);
    right: var(--event-end);
    border-left: 1.4px solid;
    border-right: 1.4px solid;
}

#timeline.vertical .long_event {
    right: 0;
    top: var(--event-start);
    bottom: var(--event-end);
    border-top: 1.4px solid;
    border-bottom: 1.4px solid;
    display: flex;
    flex-direction: row-reverse;
}

.long_event>.bg {
    background-color: var(--tl-bg);
    opacity: 0.5;
}

#timeline:not(.vertical) .long_event>.bg {
    min-height: 50px;
    height: var(--le-bg-size);
}

#timeline.vertical .long_event>.bg {
    min-width: 50px;
    width: var(--le-bg-size);
}

.long_event>.label_container {
    cursor: default;
    display: flex;
    justify-content: center;
}

#timeline.vertical .long_event>.label_container {
    width: calc(2.1em + 10px);
}

.long_event .label {
    font-size: 0.9em;
    text-align: center;
    overflow: hidden;
    margin: 5px;
}

#timeline:not(.vertical) .long_event .label {
    max-height: 2.8em;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

#timeline.vertical .long_event .label {
    transform: rotate(180deg);
    writing-mode: vertical-rl;
}

.long_event .date {
    position: absolute;
    padding: 6px;
    border: 1.4px solid;
    font-size: 0.8em;
    font-weight: bold;
    border-radius: 100px;
    text-align: center;
    cursor: default;
    background-color: var(--tl-bg);
    min-width: 15px;
}

#timeline:not(.vertical) .long_event>.date {
    top: 10px;
}

#timeline.vertical .long_event>.date {
    right: 10px;
    min-height: 15px;
}

#timeline:not(.vertical) .long_event>.date.from {
    border-right: none;
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
    left: -15px;
    padding-right: 0;
}

#timeline.vertical .long_event>.date.from {
    border-bottom: none;
    border-bottom-right-radius: 0;
    border-bottom-left-radius: 0;
    top: -15px;
    padding-bottom: 0;
}

#timeline:not(.vertical) .long_event>.date.to {
    border-left: none;
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
    right: -15px;
    padding-left: 0;
}

#timeline.vertical .long_event>.date.to {
    border-top: none;
    border-top-right-radius: 0;
    border-top-left-radius: 0;
    bottom: -15px;
    padding-top: 0;
}

#timeline .long_event {
    background-color: unset;
}

#timeline:not(.vertical) .long_event>.tick.left {
    top: -3px;
    left: -3.4px;
}

#timeline:not(.vertical) .long_event>.tick.right {
    top: -3px;
    right: -3.4px;
}

#timeline.vertical .long_event>.tick.left {
    right: -3px;
    top: -3.4px;
}

#timeline.vertical .long_event>.tick.right {
    right: -3px;
    bottom: -3.4px;
}


/* --- TASKS --- */

#tasks>.timebar {
    position: -webkit-sticky;
    position: sticky;
    top: 0;
    z-index: 1;
}

#long-events.collapsed+#tasks>.timebar {
    display: none;
}

#long-events.collapsed+#tasks {
    margin-top: 0;
}

.task-markers {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    right: 0;
}

.task-marker {
    position: absolute;
}

#timeline:not(.vertical) .task-marker {
    top: 0;
    bottom: 0;
    left: var(--marker-pos);
    width: 1.4px;
    background: linear-gradient(to bottom, var(--tl-task-marker), var(--tl-task-marker) 50%, transparent 50%, transparent);
    background-size: 100% 8px;
}

#timeline.vertical .task-marker {
    left: 0;
    right: 0;
    top: var(--marker-pos);
    height: 1.4px;
    background: linear-gradient(to left, var(--tl-task-marker), var(--tl-task-marker) 50%, transparent 50%, transparent);
    background-size: 8px 100%;
}

.list {
    margin-bottom: 5px;
}

.list:first-child {
    margin-top: 15px;
}

.list>label {
    display: inline-block;
    position: -webkit-sticky;
    position: sticky;
    left: 0;
    font-weight: bold;
    padding: 5px 0;
    color: var(--tl-task-list-title);
    align-self: flex-start;
    cursor: pointer;
}

.list>label:before {
    position: absolute;
    left: -15px;
    content: '\203A';
    transition: transform 0.3s;
}

.list>.toggle:checked+label:before {
    transform: rotate(90deg);
}

.list>.toggle:not(:checked)+label:before {
    transform: rotate(0);
}

.list>.contents {
    transition: max-height 0.3s, transform 0.3s;
    transform-origin: top;
}

.list>.toggle:checked~.contents {
    margin-bottom: 15px;
    transform: scaleY(1);
}

.list>.toggle:not(:checked)~.contents {
    max-height: 0 !important;
    transform: scaleY(0);
}

.task {
    cursor: default;
    padding: 5px 0;
}

.task:hover {
    background-color: var(--tl-task-hover);
}

.task.with-time {
    position: relative;
}

.task>.label {
    display: inline;
    position: -webkit-sticky;
    position: sticky;
    left: 0;
    color: var(--tl-task-label);
    font-size: 0.9em;
}

.task.without-time>.label {
    color: var(--tl-task-nt);
}

.task>.bar {
    background-color: var(--tl-task-bg);
    border: 1px solid var(--tl-task-border);
    border-radius: 5px;
    box-sizing: border-box;
    position: absolute;
    top: 2px;
    bottom: 2px;
}

:root {
    --tl-bg: #fff;
    --tl-line: #000;
    --tl-marker-odd-bg: #f8f8f8;
    --tl-marker-tick: #666;
    --tl-marker-label: #222;
    --tl-today: #fa0;
    --tl-desc-bg: #f4f4f4;
    --tl-desc-border: #aaa;
    --tl-desc-label: #444;
    --tl-ev-color: #222;
    --tl-task-list-title: #222;
    --tl-task-hover: #f0f0f080;
    --tl-task-bg: #e5f0ff80;
    --tl-task-border: #a3c5f5;
    --tl-task-label: #000;
    --tl-task-nt: #999;
    --tl-task-marker: #d6d6d6;
}

body.dark {
    --tl-bg: #111;
    --tl-line: #aaa;
    --tl-marker-odd-bg: #181818;
    --tl-marker-tick: #888;
    --tl-marker-label: #ccc;
    --tl-today: yellow;
    --tl-desc-bg: #222;
    --tl-desc-label: #eee;
    --tl-ev-color: #ddd;
    --tl-task-list-title: #eee;
    --tl-task-hover: #30303080;
    --tl-task-bg: #36486380;
    --tl-task-border: #47566b;
    --tl-task-label: #ccc;
    --tl-task-nt: #888;
    --tl-task-marker: #444;
}