:root {
    --tmln-pixel-per-sec: 0.2px;
    --tmln-pixel-per-loc: 200px;
    --tmln-header-width: var(--tmln-pixel-per-loc);
    --placement-header-width: 250px;
    --track-gap: 15px;
    --border-radius: 15px;
    --title-lines: 3;
    background-color: var(--timetable-background-color);
    
}

/* PAGE & LAYOUT */
body {
    margin: 0;
    user-select: none;
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
    padding: 0;
}

body[data-modal="opened"] {
    overflow: hidden;
}

.timetable-title {
    width: 100%;
    text-align: center;
    font-family: AvenirBlack;
    font-size: 3vh;
    color: white;
}

/* DATE SELECTOR */
.date-selector {
    flex: 0 0 auto;
    margin: 2vh 0;
    width: 100%;
    display: flex;
    justify-content: center;
    gap: 4px;
    position: sticky;
    top: 0;
    z-index: 5;
    background: var(--timetable-background-color);
}
.date-selector .date {
    position: relative;
    min-width: 12vh;
    max-width: 30vw;
    padding: 12px;
    display: flex;
    flex-wrap: wrap;
    border: 2px solid transparent;
    background-color: black;
    background-clip: padding-box;
}
.date-selector .date::after {
    position: absolute;
    top: -2px;
    bottom: -2px;
    left: -2px;
    right: -2px;
    content: '';
    z-index: -1;
    background: var(--timetable-gradient-one);
}
.date-selector .date:first-child {
    border-top-left-radius: 1vh;
    border-bottom-left-radius: 1vh;
}
.date-selector .date:first-child::after {
    border-top-left-radius: 1vh;
    border-bottom-left-radius: 1vh;
}
.date-selector .date:last-child {
    border-top-right-radius: 1vh;
    border-bottom-right-radius: 1vh;
}
.date-selector .date:last-child::after {
    border-top-right-radius: 1vh;
    border-bottom-right-radius: 1vh;
}
.date-selector .date.selected {
    background: var(--timetable-gradient-one);
    border-color: var(--timetable-background-color);
}
.date-selector .date.selected::after {
    display: none;
}
.date-selector .date > * {
    display: block;
    width: 100%;
    text-align: center;
    text-transform: uppercase;
    color: white;
}
.date-selector .date .month-day {
    font-family: AvenirLight;
    font-size: 0.75vh;
}
.date-selector .date .week-day {
    margin-top: -0.25vh;
    font-family: AvenirBlack;
    font-size: 1.5vh;
}

/* TIMETABLE WRAPPER */
.all-timetables {
    flex: 1 1 auto;
    overflow-x: auto;
    overflow-y: hidden;
    position: relative;
    -ms-overflow-style: none;
    scrollbar-width: none;
    /* height: calc(var(--vh, 1vh) * 100); */
    /* height: -webkit-fill-available; */
    height: 110vh;
}
.all-timetables::-webkit-scrollbar { display: none; }

.timetable {
    position: relative;
    display: grid;
    grid-template-rows: auto 1fr;
    width: max-content;
    height: 100%;
    visibility: hidden;
    display: none;
}
.timetable.active {
    display: grid;
    visibility: visible;
    /* margin-left: calc(var(--tmln-pixel-per-loc) - 8px); */
}

/* TIMEZONES */
.timezones {
    width: 100%;
    position: sticky;
    top: 0;
    left: 0;
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding: 0px 50px;
    border-bottom: 1px solid rgb(80, 80, 80);
    background: #000;
    z-index: 4;
}
.timezones .hour {
    display: flex;
    flex-wrap: wrap;
    justify-content: left;
    align-items: end;
    height: 45px;
}
.timezones .hour span {
    position: absolute;
    top: 0;
    transform: translateX(-50%);
    display: flex;
    text-align: center;
    font-family: AvenirBlack;
}
.timetable .time-separator {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 1px;
  z-index: 1;
}
.timetable .hour-line {
  background-color: rgba(200,200,200,0.8);
}
.timetable .half-line {
  border-left: 1px dashed rgba(200,200,200,0.7);
  background: none;
}
.timetable .quarter-line {
  border-left: 1px dotted rgba(200,200,200,0.5);
  background: none;
}
.timezones::after {
    content: "";
    position: absolute;
    bottom: -15px;
    left: 0;
    width: 100%;
    height: 30px;
    pointer-events: none;
    background: linear-gradient(to bottom, rgba(0,0,0,1), rgba(0,0,0,0));
    z-index: 5;
}

/* LOCATIONS */
.timetable .locations {
    overflow-y: auto;
    overflow-x: hidden;
    position: relative;
    height: 100%;
}
.timetable .locations::-webkit-scrollbar { display: none; }
.timetable .locations {
    -ms-overflow-style: none;
    scrollbar-width: none;
}
.timeline-location {
    height: var(--tmln-pixel-per-loc);
    position: relative;
}
.timeline-location .header {
    position: sticky;
    left: 0px;
    height: calc(100% + var(--track-gap));
    width: var(--tmln-pixel-per-loc);
    transform: translateY(calc(var(--track-gap) / -2));
    margin-left: calc(-1 * var(--tmln-pixel-per-loc));
    padding: 1em;
    padding-top: 2em;
    box-sizing: border-box;
    z-index: 3;
    font-family: AvenirBlack;
    font-size: 20px;
    text-transform: uppercase;
    border-right: 1px solid rgb(80, 80, 80);
    background: #000;
    transform: translateX(var(--x-scroll, 0px));
    will-change: transform;
    /* transform: translateZ(0); */
}

/* Smooth fade only, no layout changes */
.timeline-location .header {
  transition: opacity 150ms linear;
  will-change: opacity;
  backface-visibility: hidden;
}

/* While scrolling, make them transparent (and non-interactive if needed) */
.timeline-location .header.is-fading {
  opacity: 0;
  pointer-events: none; /* remove if headers are clickable */
}


.timeline-location .header.vertical {
  writing-mode: sideways-lr;
  text-orientation: mixed; 
  width: 100px;
  text-align: center;
  padding: 0.25em 0.25em;
}

.timeline-location .header::after {
    content: "";
    position: absolute;
    top: 0;
    right: -15px;
    width: 30px;
    height: 100%;
    pointer-events: none;
    background: linear-gradient(to right, rgba(0,0,0,1), rgba(0,0,0,0));
    z-index: 4;
}

/* SESSION */
.timetable .session {
    position: absolute;
    top: 0;
    height: calc(100% - 10px);
    background: linear-gradient(114.55deg, #366a8c, #152f42);
    border-radius: 20px;
    padding: 20px;
    box-sizing: border-box;
    margin-top: 10px;
    display: flex;
    flex-direction: column;
    container-type: inline-size;
    z-index: 2;
}
.timetable .session-header {
    flex: 1 1 auto;
}
.timetable .session .title {
    width: 100%;
    flex: 0 0 auto;
    min-height: 0;
    overflow: hidden;
    position: relative;
    height: auto;
}
.timetable .session .title p {
    overflow: hidden;
    font-family: AvenirBlack;
    font-size: 20px;
    text-transform: uppercase;
    word-break: normal;
    text-overflow: ellipsis;
    line-height: 1.2;
    margin: 0;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: var(--title-lines);
    line-clamp: var(--title-lines);
}
.timetable .session .subtitle {
    width: 100%;
    flex: 0 0 auto;
    overflow: hidden;
    position: relative;
    margin-top: 0.3em;
}
.timetable .session .subtitle p {
    margin: 0;
    font-family: AvenirLight;
    font-size: 12px;
    font-style: italic;
    line-height: 1;
    overflow: hidden;
    word-break: normal;
    text-transform: uppercase;
    text-overflow: ellipsis;
    margin-bottom: 0.5em;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    --subtitle-lines: 2;
    -webkit-line-clamp: var(--subtitle-lines);
    line-clamp: var(--subtitle-lines);
}
.timetable .session .schedule {
    display: block;
    width: 100%;
    height: fit-content;
    font-family: AvenirLight;
    font-size: 12px;
}
.timetable .session .format-speaker {
    width: 100%;
    height: fit-content;
}
.timetable .session .format-speaker p {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    font-family: AvenirLight;
    font-size: 10px;
    word-break: normal;
    text-overflow: ellipsis;
    line-clamp: 2;
    -webkit-line-clamp: 2;
    overflow: hidden;
    margin: 0;
}
.timetable .session .sessionfooter {
    margin-top: auto;
    display: grid;
    gap: 6px;
}

.all-timetables {
  cursor: grab;
}

.all-timetables.dragging {
  cursor: grabbing;
}

.timeline-nav {
  position: absolute;
  top: 10%;
  left: 0px;
  right: 0px;
  display: flex;
  justify-content: space-between;
  pointer-events: none;
  z-index: 10;
}

.timeline-nav .nav-btn {
  pointer-events: all;
  background: rgba(0,0,0,0.6);
  border: none;
  color: white;
  font-size: 1.25rem;
  padding: 0.5em 0.8em;
  margin: 0 1em;
  border-radius: 50%;
  cursor: pointer;
  transition: background 0.2s;
}
.timeline-nav .nav-btn:hover {
  background: rgba(0,0,0,0.9);
}

/* SESSION DETAILS POPUP */
.session-details {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    box-sizing: border-box;
    padding: 0 15vw;
    background-color: rgba(0, 0, 0, 0.87);
    opacity: 0;
    visibility: hidden;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}
.session-details.active {
    opacity: 1;
    visibility: visible;
}
.session-details .close {
    position: absolute;
    top: 3vh;
    right: 3vh;
    height: 2vh;
    width: 2vh;
    z-index: 5;
    padding: 5px;
    background-color: black;
}

.session-details .content {
    width: 100%;
    display: flex;
    height: fit-content;
}

.session-details .content .picture {
    width: 45%;
    height: auto;
    max-height: 40vh;
    position: relative;
}

.session-details .content .picture img {
    width: 100%;
    max-height: 100%;
    object-fit: contain;
    object-position: top left;
}

.session-details .content .picture .text {
    position: absolute;
    top: 3vh;
    left: 3vh;
    width: 50%;
}

.session-details .content .picture .name {
    font-family: AvenirRegular;
    font-size: 1.5vh;
    line-height: 1.5;
    word-break: normal;
    display: block;
}

.session-details .content .picture .description {
    font-family: AvenirLight;
    font-size: 1vh;
    display: block;
    white-space: pre-line;
}

.session-details .content .text-content {
    flex: 1;
    margin-left: 3vw;
}

.session-details .content .text-content .title {
    font-family: AvenirBlack;
    font-size: 2.5vh;
    line-height: 1;
    width: 100%;
    text-transform: uppercase;
    word-break: normal;
    display: block;
    margin-bottom: 0.2em;
}

.session-details .content .text-content .subtitle {
    font-family: AvenirLight;
    font-style: italic;
    font-size: 2.5vh;
    line-height: 1;
    width: 100%;
    word-break: normal;
    display: block;
    margin-bottom: 0.5em;
}

.session-details .content .text-content .schedule-stage {
    display: flex;
    gap: 1vw;
    align-items: end;
}

.session-details .content .text-content .schedule {
    font-family: AvenirBlack;
    font-size: 2vh;
    margin-bottom: -0.2em;
}

.session-details .content .text-content .stage {
    font-family: AvenirRegular;
    font-size: 2vh;
    text-transform: uppercase;
    margin-bottom: -0.2em;
}

.session-details .content .text-content .description {
    font-family: AvenirLight;
    font-size: 1.75vh;
    line-height: 1.25;
    margin-top: 2em;
    white-space: pre-line;
}

/* RESPONSIVE */

@media only screen and (max-width: 2000px) {
    :root { --tmln-pixel-per-loc: 175px; }
    .timeline-location .header { font-size: 16px; }
    .timetable .session .title p { font-size: 16px; }
    .timetable .session .description p { font-size: 11px; }
    .timetable .session .schedule { font-size: 11px; }
    .timetable .session .format-speaker p { font-size: 9px; }
}
@media only screen and (max-width: 1600px) {
    :root { --tmln-pixel-per-loc: 150px; }
    /* body { padding: 1vh 1vw 1vh 1vw; } */
    .date-selector .date .week-day { font-size: 1.5vw; }
    .timeline-location .header { font-size: 14px; }
    .timetable .session .title p { font-size: 14px; }
    .timetable .session .description p { font-size: 10px; }
    .timetable .session .schedule { font-size: 10px; }
    .timetable .session .format-speaker p { font-size: 8px; }
    .session-details { padding: 0 10vw; }
}
@media only screen and (max-width: 1200px) {
    .date-selector .date .week-day { font-size: 2vw; }
}
@media only screen and (max-width: 1000px) {
    .session-details .content .picture .name { font-size: 1vh; }
}
@media only screen and (max-width: 800px) and (orientation: portrait) {
    :root { --tmln-header-width: 100px; }
    .date-selector .date .month-day { font-size: 2vw; }
    .date-selector .date .week-day { font-size: 3vw; }
    .timeline-location .header { writing-mode: sideways-lr; text-orientation: mixed; width: 100px; text-align: center; padding: 0.5em 1em;}
    .timetable.active { margin-left: 0; }
    /* .timetable .session {margin-left: 80px;} */
    .session-details { padding: 0 5vw; }
    .session-details .content { flex-wrap: wrap; overflow: scroll; gap: 5vw; }
    .session-details .content .picture { width: 100%; }
    .session-details .content .picture img { width: 100%; object-fit: cover; object-position: bottom center; }
    .session-details .content .picture .name { font-size: 1.5vh; }
    .session-details .content .text-content { width: 100%; margin: 0; }

    
}
@media only screen and (max-height: 1000px) and (orientation: landscape) {
    .date-selector .date .month-day { font-size: 1.25vw; }
    .session-details { padding: 0 5vw; }
    .session-details .content .picture { height: 60vh; }
    .session-details .content .text-content .title { font-size: 2vw; }
    .session-details .content .text-content .schedule { font-size: 1.5vw; }
    .session-details .content .text-content .stage { font-size: 1.25vw; }
    .session-details .content .text-content .description { font-size: 1vw; }
}
@supports (max-block-size: 1lh) {
  .timetable .session .subtitle p { max-block-size: calc(var(--subtitle-lines) * 1lh); }
}
@supports not (-webkit-line-clamp: 1) {
  .timetable .session .subtitle p {
    max-height: calc(var(--subtitle-lines, 2) * 1.2em);
    --fade-w: 1.2em;
    mask-image: linear-gradient(90deg, #000 calc(100% - var(--fade-w)), transparent);
    -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - var(--fade-w)), transparent);
  }
  .timetable .session .subtitle.is-truncated::after {
    content: '…';
    position: absolute;
    right: 0.25em;
    bottom: 0.1em;
    pointer-events: none;
    color: currentColor;
  }
}

@container (min-width: 300px) { 
  .timetable .session .subtitle p { --subtitle-lines: 3; }
}
@container (min-width: 380px) { 
  .timetable .session .subtitle p { --subtitle-lines: 4; }
}