* {
    box-sizing: border-box;
}

body.anim-logo {
    display: grid;
    align-items: center;
    justify-items: center;
    width: 100vw;
    height: 100vh;
}

.logo-container {
    max-width: 200px;
    width: 100%;
}

body {
    font-family: 'Inter', sans-serif;
    margin: 0;
    padding: 20px;
    background-color: #F0F4F8;
    color: #102a43;
}

h1, h2, h3 {
    margin: unset;
}

h1 {
    font-size: 24px;
    line-height: 32px;
    color: #102A43;
}

h2 {
    font-size: 16px;
    line-height: 20px;
    color: #486581;
}

h3 {
    font-size: 14px;
}

body:not(.anim-logo) {
    display: flex;
    flex-direction: column;
    gap: 16px;
    color: #102a43;
    font-size: 14px;
    line-height: 24px;
}

/* if less than 768px, lower font size to 12px */
@media (max-width: 768px) {
    body {
        font-size: 12px;
    }
}

.container {
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 1200px;
    gap: 16px;
}

main {
    display: flex;
    grid-area: content;
    width: 100%;
    justify-content: center;
}

main.error {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    height: 100dvh;
    max-width: unset;
}

.error-card {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    border-radius: 8px;
    background: #FFF;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05), 0 4px 5px 0 rgba(0, 0, 0, 0.03);
}

.error-card div.message {
    display: flex;
    padding: 40px 40px 35px 40px;
    flex-direction: column;
    align-items: center;
    align-self: stretch;
}

.error-card div.message-title {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.error-card div.additional {
    display: flex;
    padding: 25px 40px 30px 40px;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 8px;
    align-self: stretch;
    border-top: 1px solid #F0F4F8;
}

.error-card div.additional span {
    display: flex;
    padding: 3px 13px;
    justify-content: center;
    align-items: center;
    gap: 10px;
    border-radius: 4px;
    background: #F0F4F8;
}


.heading-toc {
    color: #334e68;
    font-weight: normal;
}

.heading-date {
    font-size: 16px;
    line-height: 24px;
    letter-spacing: -0.32px;
    color: #486581;
    font-weight: 600;
    margin-bottom: 10px;
}

.block {
    --block-padding: 30px;

    display: flex;
    flex-direction: column;
    background-color: #FFFFFF;
    padding: var(--block-padding);
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    height: min-content;
    row-gap: 16px;
    width: 100%;
    overflow-x: auto;
}

.block.with-warning {
    border-top-left-radius: 0;
    border-top-right-radius: 0;
}

.darwin-actual-true {
    font-weight: 600;
}

.darwin-actual-false {
    font-weight: normal;
    font-style: italic;
}

table {
    width: 100%;
    border-collapse: collapse;
}

thead {
    border-bottom: 2px solid #d9e2ec;
}

/* Stripe him #E6F6FF */
/* But not the header */
tbody tr:nth-child(even) {
    background-color: #f0f4f8;
}

.table-subheading {
    color: #476581;
    font-size: 12px;
    line-height: 20px;
    font-weight: 500;
}

th {
    font-weight: 600;
}

/* make all the cells vertical-align: center */
td, th {
    vertical-align: middle;
}

table td {
    padding: 10px 20px;
}

/* first row .line gets background line1.svg
 */

td.line {
    margin-right: -1rem;
    width: 5px;
}

tbody tr:first-of-type td.line {
    background-image: url('/assets/line1.svg');
    background-repeat: no-repeat;
    background-size: 1rem;
    background-position: 50% 0.85rem;
    overflow: hidden;
}

/* final one gets line2.svg */
tbody tr:last-of-type td.line {
    background-image: url('/assets/line2.svg');
    background-repeat: no-repeat;
    background-size: 1rem;
    background-position: 50% calc(100% - 0.85rem);
}

/* everything else gets line_peg */
tbody tr:not(:first-of-type):not(:last-of-type) td.line {
    background-image: url('/assets/line_peg.svg');
    background-repeat: no-repeat;
    background-size: 1rem;
    background-position: center;
}

.darwin-actual-cancelled {
    text-transform: uppercase;
    font-weight: 600;
    color: #AB091E;
}

.darwin-actual-delayed {
    color: #AB091E;
}

td:not(.line):not(.location) {
    text-align: center;
}

.alert {
    display: block;
    text-align: left;
    padding: 16px 12px;
    position: relative;
    border-radius: 8px;
    box-shadow: rgba(0, 0, 0, 0) 0 0 0 0, rgba(0, 0, 0, 0) 0 0 0 0, rgba(0, 0, 0, 0) 0 0 0 0, rgba(0, 0, 0, 0) 0 0 0 0, rgba(0, 0, 0, 0.1) 0 1px 2px 0, rgba(0, 0, 0, 0.1) 0 1px 2px -1px;
}

.alert.with-service {
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
    box-shadow: unset;
    border-bottom: 1px solid #f0f4f8;
}

#warnings {
    display: block;
}

:where(#warnings > :not(:last-child)) {
    margin-block-end: 10px;
}

.alert.alert-warning {
    background-color: #fffbea;
    color: #8d2b0b;
}

.alert-warning .title {
    background: #b44d12;
    color: #fffbea;
    display: inline-block;
    width: 100%;
}

.alert.alert-danger {
    background-color: #ffe3e3;
    color: #610316;
}

p {
    margin: 0;
}

.service-info-cards {
    display: inline-flex;
    align-items: baseline;
    column-gap: 8px;
}

.service-info-card {
    padding: 4px 8px;
    background-color: #e2eefc;
    color: #0d59a2;
    border-radius: 4px;
    width: fit-content;
    box-shadow: rgba(0, 0, 0, 0) 0 0 0 0, rgba(0, 0, 0, 0) 0 0 0 0, rgba(0, 0, 0, 0) 0 0 0 0, rgba(0, 0, 0, 0) 0 0 0 0, rgba(0, 0, 0, 0.1) 0 1px 3px 0, rgba(0, 0, 0, 0.1) 0 1px 2px -1px;
}

strong {
    font-weight: 600;
}

@property --selected-page {
    syntax: "<number>";
    inherits: true;
    initial-value: 0;
}

@property --page {
    syntax: "<number>";
    inherits: true;
    initial-value: 0;
}

.allocations {
    --allox-x-padding: var(--block-padding);
    --allox-y-padding: 20px;

    --selected-page: 0;

    background: #f7fafc;

    /* Make it full-width */
    margin: 0 calc(-1 * var(--block-padding));
    padding: var(--allox-y-padding) 0 calc(var(--allox-y-padding) / 2) 0;
}

.allocations h3 {
    padding: 0 var(--allox-x-padding);
}

:where(.allocations ul) {
    list-style: none;
    margin: 0;
    padding: 0;
}

.allocation-pager {
    --button-size: 32px;

    display: grid;
    align-items: center;

    grid-template-rows: 1fr;
    grid-template-columns: [prev] 1fr [content] auto [next] 1fr;
    place-items: center;

    overflow: hidden;
}

.allocation-pager > * {
    grid-row: 1 / span 1;
}

.allocation-pager button {
    margin: 0;
    padding: 0;
    overflow: visible;
    border: none;
    font: inherit;
    line-height: normal;
    -webkit-font-smoothing: inherit;
    -moz-osx-font-smoothing: inherit;
    -webkit-appearance: none;

    border-radius: 50%;
    cursor: pointer;
    width: var(--button-size);
    height: var(--button-size);
    background: #beddf9;
    color: #0c2645;

    display: flex;
    align-items: center;
    justify-content: center;

    position: relative;
    z-index: 1;

    transition: transform 0.2s ease-out;
    transform-origin: center;
}


.allocation-pager button[aria-hidden="true"] {
    transform: scale(0);
}

#prev-formation-btn {
    grid-column: prev;
    justify-self: start;
    margin-left: calc(var(--allox-x-padding) / 2);
}

#next-formation-btn {
    grid-column: next;
    justify-self: end;
    margin-right: calc(var(--allox-x-padding) / 2);
}

#prev-formation-btn svg {
    transform: translateX(-1px);
}

#next-formation-btn svg {
    transform: translateX(1px);
}

.allocation-pager button svg {
    display: block;
}

.allocation-pager .unit:first-child {
    padding-left: calc(var(--allox-x-padding) / 2);
}

.allocation-pager .unit:last-child {
    padding-right: calc(var(--allox-x-padding) / 2);
}

.allocation-pager:has(button) .unit:first-child {
    padding-left: calc(var(--allox-x-padding) / 2 + var(--button-size));
}

.allocation-pager:has(button) .unit:last-child {
    padding-right: calc(var(--allox-x-padding) / 2 + var(--button-size));
}

.allocations-list {
    display: grid;
    grid-template-columns: 1fr;
    grid-column: 1 / 4;
    width: 100%;
}

.allocation {
    display: block;
    width: 100%;
    min-width: 0;
    /* place overlapping in grid */
    grid-column: 1 / 1;
    grid-row: 1 / 1;

    transform: translateX(calc((var(--page) - var(--selected-page)) * 100%));
    transition: transform 0.2s ease-in-out;
}

@media (prefers-reduced-motion: reduce) {
    .allocation {
        transition: none;
    }
}

.allocation-locations {
    padding: 0 var(--allox-x-padding);
    text-align: center;
}

.allocation-diagram {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    padding: 8px calc(var(--allox-x-padding) / 2) calc(var(--allox-y-padding) / 2) calc(var(--allox-x-padding) / 2);
}

.unit-list {
    width: max-content;
    margin: 0 auto;
}

.unit-list,
.vehicle-list {
    display: grid;
    grid-template-rows: 1fr;
    grid-auto-flow: column;
    grid-auto-columns: min-content;
    gap: 2px;
    place-items: center;
}

.unit-number {
    display: block;
    width: 100%;
    background: #e2eefc;
    margin-top: 4px;
    border-radius: 8px;
    text-align: center;
    font-size: 0.75rem;
    line-height: 1em;
    padding: 4px;
}

.vehicle,
.unit {
    display: block;
}

.vehicle svg {
    display: block;
}

.coach-counts {
    display: inline-grid;
}

.coach-count {
    grid-row: 1;
    grid-column: 1;

    /* Show the selected page's */
    opacity: calc(1 - clamp(0, max(var(--page) - var(--selected-page), var(--selected-page) - var(--page)) * 10000, 1));
}

.inline-coach-count {
    display: none;
}

/* Handle users without JavaScript */
body.no-js .allocation {
    /* Shows all allocations vertically rather than with horizontal paging */
    grid-row: unset;
    transform: none;
}

body.no-js .allocation-pager:has(button) .unit:first-child {
    padding-left: calc(var(--allox-x-padding) / 2);
}

body.no-js .allocation-pager:has(button) .unit:last-child {
    padding-right: calc(var(--allox-x-padding) / 2);
}

body.no-js .coach-counts-separator,
body.no-js .coach-counts,
body.no-js #prev-formation-btn,
body.no-js #next-formation-btn {
    display: none;
}

body.no-js .inline-coach-count {
    display: inline;
}
