/* set up CSS var to be used in CSS that is generated server side
   as well as in this stylesheet below
 */
:root {
    --year-column-width: minmax(5em, 1fr);
    --sidebar-width: minmax(315px, 20%);
    
    --timeline-scrollbar-foreground: #FF875C;
    --timeline-scrollbar-background: #171d2e;
    --timeline-scrollbar-color: var(--timeline-scrollbar-foreground)  var(--timeline-scrollbar-background);
}

.timeline-page main {
  background: #171d2e;
}

.timeline-and-filters .unit > div {
    padding: 0;
}

.timeline-and-filters {
    padding: 0;
    display: grid;
    grid-template-columns: [sidebar] var(--sidebar-width) [sidebar-toggle] 3.5em [timeline] minmax(0, 1fr);
    grid-template-rows: 1fr;
}

.timeline-and-filters--sidebar-closed {
    --sidebar-width: 0;
}

.timeline-sidebar-toggle {
    grid-column: sidebar-toggle;
    background-color: #192138;
    color: #fff;
    text-align: center;
    padding-top: .5em;
    border-right: 1px solid #a2acc8;
}

.timeline-sidebar-toggle__button {
    padding: 5px 10px;
    color: #fff;
    background-color: #192138;
    border: none;
}

.timeline {
    grid-column: timeline;
    grid-row: 1 / span 3;
}

.timeline-sidebar {
    grid-column: sidebar;
    height: 100vh;
    overflow-y: auto;
    overflow-x: hidden;
    display: grid;
    grid-template-rows: min-content 1fr min-content;
    background: #ebf3fd;
}

.timeline-header {
    padding: 20px;
}

.timeline-header .site-name {
    border: none;
    font-size: 2rem;
    line-height: 1.2;
    padding: 0;
}

.timeline-header h1 {
    font-size: 1em;
    line-height: 1.2;
    padding: 0;
    background: transparent;
}

* {
    box-sizing: border-box;
}

[x-cloak],
.hidden {
    display: none;
}

/* for modal close */
.icon-button {
    appearance: none;
    background: none;
    border: none;
    display: inline;
    color: inherit;
    font-size: 1.2em;
}

.page-block {
    display: none;
    background: rgba(0, 0, 0, .2);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(5px);
    position: fixed;
    height: 100vh;
    width: 100vw;
    top: 0;
    left: 0;
}

.page-block--show {
    display: block;
}

.modal-dialog {
	position: fixed;
	top: 0;
	right: 0;
	bottom: 0;
	left: 0;
}

.modal-dialog:target {
	opacity: 1;
	pointer-events: auto;
}

.modal-dialog__inner {
	width: 75%;
	max-width: 800px;
	max-height: calc(100vh - 150px);
	position: relative;
	margin: 75px auto;
	padding: 35px;
	background: #fff;
	color: #111;
	box-shadow: 0 0 7px 0px inset rgb(0 0 0 / 10%);
}

.modal-dialog__close {
	position: absolute;
	right: -24px;
	text-align: center;
	top: -10px;
	color: #f2622e;
	font-size: 24px;
	transition: .3s;
}

.modal-dialog__inner-toggle {
    margin-top: 20px;
    clear: both;
}

.modal-dialog__close .fa-times {
    color: #660000;
}

.modal-dialog__close:hover {
    color: #e1b200;
}

.modal-dialog__content {
	max-height: calc(100vh - 250px);
    padding: 10px;
	overflow: auto;
}

.timeline {
    position: relative;
}

.timeline__scroller {
    max-width: 100%;
    max-height: 1em;
    height: 2em;
    margin: auto;
    overflow-x: scroll;
    overflow-y: hidden;
    scrollbar-color: var(--timeline-scrollbar-color);
    background: var(--timeline-scrollbar-background);
    scroll-behavior: smooth;
    width:  auto;
    display: grid;
    
    /* use dynamically generated (PHP) rows and columns */
    grid-template-columns:
        var(--timeline-dynamic-columns)
        [date-blank-1] var(--year-column-width)
        [date-blank-2] var(--year-column-width)
        [date-blank-3] var(--year-column-width);
        
    grid-template-rows: 1em;
    
    column-gap: 20px;
    row-gap: 0;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
}

.timeline__scroller-inner {
    grid-column: 1 / -1;
    width: 100%;
    height: 1em;
}

.timeline__timeline {
    max-width: 100%;
    max-height: 100vh;
    margin: auto;
    overflow-x: scroll;
    overflow-y: scroll;
    scrollbar-color: var(--timeline-scrollbar-color);
    scroll-behavior: smooth;
    width:  auto;
    display: grid;
    
    /* use dynamically generated (PHP) rows and columns */
    grid-template-columns:
        var(--timeline-dynamic-columns)
        [date-blank-1] var(--year-column-width)
        [date-blank-2] var(--year-column-width)
        [date-blank-3] var(--year-column-width);
        
    grid-template-rows:
        [direction-buttons] 2em
        [dates] 4em
        [chair-lines] 1em
        [track-chairs] auto
        [milestone-lines] 3em
        var(--timeline-dynamic-rows);
    
    column-gap: 20px;
    row-gap: 0;
    position: relative;
}

.timeline__scroller::-webkit-scrollbar,
.timeline__timeline::-webkit-scrollbar {
  width: 10px; /* Mostly for vertical scrollbars */
  height: 10px; /* Mostly for horizontal scrollbars */
}

.timeline__scroller::-webkit-scrollbar-thumb,
.timeline__timeline::-webkit-scrollbar-thumb {
  background: var(--timeline-scrollbar-foreground);
} 

.timeline__scroller::-webkit-scrollbar-track,
.timeline__timeline::-webkit-scrollbar-track {
  background: var(--timeline-scrollbar-background);
}

.timeline ul {
    margin: 0;
    list-style-position: inside;
}

.dateline {
    grid-row: dates;
    grid-column: 1 / -1;
    height: 0;
    border-top:  2px solid #3c4868;
    border-bottom: 1px solid hsl(225deg 26% 86%);
    position: relative;
    top: 50%;
    margin-top: 3px;
}

.track-chairs {
    display: flex;
    flex-wrap: wrap;
    flex-direction: row-reverse;
    align-items: flex-end;
    justify-content: flex-end;
    scroll-snap-align: left;

    grid-row: track-chairs; 
    align-self: end;
    
    background: hsl(16deg 44% 92%);
    margin:  20px 20px 0 0;  
    padding:  10px 20px 30px 20px; /* extra bottom padding to give space for arrow */
    
    /* make height span rows so that anchor links go to the top of the timeline */
    height: calc(100% - 20px);
    
    position: relative;
    border-left: 1px solid #98a3c3;
}

.track-chairs:focus {
    outline: solid rgb(180 48 0);
}

.timeline__item-title * {
    margin: 0;
}

.track-chairs:before {
    content: ' ';
    display: block;
    width: 100%;
    height: 0;
    position: absolute;
    bottom: 0;
    left: 0;
    border-bottom: 20px solid #e48461;
}

.track-chairs:after {
    content: ' ';
    position: absolute;
    top: calc(100% - 30px);
    left: calc(100% - 7px);
    width: 0; 
    height: 0; 
    border-top: 20px solid transparent;
    border-bottom: 20px solid transparent;
    
    border-left: 30px solid #e48461;
    
}

.track-marker {
    display: block;
    border-left: 1px solid #98a3c3;
}

.track-chairs-marker,
.track-milestones-marker {
    display: block;
    border-left: 1px solid hsl(225deg 26% 86%);
    border-right: 1px solid hsl(225deg 26% 30%);
    width: 1px;
    grid-row: 1 / end;
}

.track-images,
.track-images-blur {
    grid-row:  1 / -1;
    max-height: 100vh;
    position: sticky;
    top: 0;
    width: 100%;
    height: 100%;
    background-size: auto 100%;
}

.track-images {
    background-repeat: no-repeat;
}

.track-images-blur {
    filter: blur(25px) brightness(50%);
    background-attachment: fixed;
}


.track-milestones-marker {
    /*grid-row: dates / track-milestones-2;*/
    margin-bottom: 20px;
}

.track-milestones {
    grid-row: track-milestones-1;
}

.track-milestones-1 {
    grid-row: track-milestones-1
}

.track-milestones-2 {
    grid-row: track-milestones-2
}

.track-milestones-2 + .track-milestones-marker {
    grid-row-end: track-milestones-3;
}

.track-milestones {
    background: #ebf3fd;
    margin-right:  20px;  
    padding:  10px;
    margin-bottom:  20px; 
    border-left: 1px solid #98a3c3;
    box-shadow:
        0 0 7px 0px inset rgb(0 0 0 / 10%),
        0 0 20px 0 rgb(0 0 0);
    position: relative;
    height: min-content;
    max-width: calc(100vw - 60px);
}

.track-milestones,
.track-chairs {
    box-shadow:
        0 0 7px 0px inset rgb(0 0 0 / 10%),
        0 0 20px 5px rgb(0 0 0 / 70%);
}

.tags {
    background-color: #c2d7ef;
    padding: 0 5px;
}

.timeline__date-wrapper {
    margin:  0;
    padding: 0;
    background-color: transparent;
    grid-row:  dates;
    position: sticky;
    top: 20px;
    font-size: 1.2em;
    display: grid;
    align-content:center;
    width: 4em;
}

.timeline__date-marker {
    display: block;
    position: relative;
    left:  -50%;
    background: #0371ef;
    color: #fff;
    height: 4em;
    width:  4em;
    line-height: 4em;
    text-align: center;
    border-radius:  50%;
    border: 2px solid #074798;
    box-shadow: 0 0 10px 0 rgb(0 0 0 / 75%);
}

.slide-point--active .timeline__date-marker {
    border-color: #fff;
}

.timeline__item-title {
    margin: 0;
    font-size: 1.1rem;
    line-height: 1.5;
}

.timeline__item *:last-child {
    margin-bottom:  0;
}

.timeline__item-content {
    max-width: 65vw;
}

.world-event {
    display: block;
    font-size: .8em;
    line-height: 1.2;
    background: #efefef;
    padding: 10px;
    box-shadow: 
        0 0 7px 0px inset rgb(0 0 0 / 10%),
}

.track-world-events {
    margin: 0 0 5px 1px;
}

.track-world-events-1 {
    grid-row: track-world-events-1;
}


/*
    borrow some styles from slider component
*/
.timeline__direction-buttons {
	 position: sticky;
	 grid-column: 1 / span 1;
	 grid-row: direction-buttons;
	 left: 0;
	 width: 100%;
}

.slider__button {
    padding: 0;
    color: #660000;
    background-color: #f2622e;
    font-size: 4rem;
    line-height: 1;
    border: none;
    position: absolute;
    top: calc(50vh - 1.5rem);
    border-radius: 50%;
    width: 4rem;
    box-shadow: 0 0 20px 0 rgb(0 0 0 / 50%);
}

.slider__previous {
    left: 3%;
    
}

.slider__next {
    right: 3%;
}

 .slider__button:hover {
	 background-color: #ff7c4d;
}
 .slider__button:disabled {
	 opacity: 0.3;
}
 .timeline__instructions {
	 display: none;
	 padding: 3px;
	 line-height: 1;
	 font-size: 0.8em;
	 position: absolute;
	 bottom: 0;
	 margin: 0;
}
 .timeline__timeline:focus ~ .timeline__instructions {
	 display: inline-block;
}

.filters {
    align-self: start;
    width: 100%;
    background: #ebf3fd;
}

.filters__heading {
    all: unset;
    box-sizing: border-box;
    background-color: #b43000;
    color: #fff;
    transition: .3s;
    padding: 20px;
    display: block;
    width: 100%;
}

.filters__toggle:hover {
    background-color: #0071ef;
}

.filters > * {
    padding-left: 10px;
    padding-right: 10px;
}

.filters__filters {
    padding: 20px;
    overflow: auto;
}

.filters__checkbox {
    display: block;
}

.filters__checkbox input {
    margin-right: 5px;
}

.filters__clear {
    color: #b43000;
    border: none;
    padding: 5px;
    float: right;
    transition: .3s;
}

.filters__clear:hover {
    color: #0071ef;
}

.filters__search {
    display: block;
    margin-bottom: 10px;
}

/* Manage all the z-indexes */

/*.track-images-blur {
    z-index: 2;
}

.track-images {
    z-index: 5;
}*/

.track-chairs-marker,
.track-milestones-marker,
.dateline {
    z-index: 3010;
}

.track-milestones,
.track-world-events {
	z-index: 3020;
}

.timeline__date-wrapper {
	z-index: 3030;
}

.track-chairs {
	z-index: 3040;
}

.timeline__mini-timeline {
    z-index: 3045;
}

.timeline__direction-buttons,
.filters{
	z-index: 3050;
}

.page-block {
	z-index: 10000;
}

.modal-dialog {
	z-index: 15000;
}

.track-chairs--open,
.track-milestones--open {
    z-index: 15500;
}

.timeline__scroller {
    z-index: 16000;
}

dd {
    margin-bottom: 5px;
}

.timeline__readmore {
    text-align: right;
}
