/* Editorial content: pages with rich text, gallery and video blocks. */

.content-page {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

/*=================================*/
/*           Rich text             */
/*=================================*/

.rte {
    display: flex;
    flex-direction: column;
    gap: 1rem;

    /* Running text stays readable on phones, where --font-size is small (as in the old app) */
    p, li {
        font-size: max(var(--font-size), 1rem);
        line-height: 1.6;
    }

    h2, h3 {
        margin-top: 1rem;
    }

    a {
        color: var(--primary);
        text-decoration: underline;
    }

    a.button {
        align-self: flex-start;
        text-decoration: none;
    }

    img {
        max-width: 100%;
        max-height: 32rem;
        height: auto;
    }

    figure {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: .5rem;
    }

    figcaption {
        font-size: calc(var(--font-size) * .85);
        color: var(--primary-disabled);
    }

    blockquote {
        padding-left: 1rem;
        border-left: 4px solid var(--tertiary);
        font-style: italic;
    }

    hr {
        border: 0;
        border-top: 1px solid var(--secondary);
    }
}

/*=================================*/
/*            Gallery              */
/*=================================*/

.gallery {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: .5rem;
}

.gallery-stage {
    position: relative;
}

.gallery-track {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    scrollbar-width: none;
}

.gallery-track::-webkit-scrollbar {
    display: none;
}

.gallery-item {
    flex: 0 0 100%;
    height: 16rem;
    scroll-snap-align: center;
    display: flex;
    justify-content: center;
    align-items: center;

    img {
        max-width: 100%;
        max-height: 100%;
        object-fit: contain;
    }
}

.gallery-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    padding: .25rem;
    background: none;
    font-size: 2rem;

    &:hover {
        box-shadow: none;
    }

    i {
        color: var(--primary);
    }
}

.gallery-prev {
    left: .5rem;
}

.gallery-next {
    right: .5rem;
}

.gallery-dots {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: .25rem;
}

.gallery-dot {
    width: .75rem;
    height: .75rem;
    padding: 0;
    border-radius: 50%;
    border: 2px solid var(--primary);
    background: transparent;

    &:hover {
        box-shadow: none;
    }

    &.active {
        background: var(--primary);
    }
}

@media (min-width: 768px) {
    .gallery-item {
        height: 24rem;
    }
}

@media (min-width: 992px) {
    .gallery-item {
        height: 36rem;
    }
}

/*=================================*/
/*             Video               */
/*=================================*/

.video-block {
    display: flex;
    flex-direction: column;
    gap: 1rem;

    video {
        width: 100%;
    }
}

/* Videos in articles are often portrait phone videos: limit the height, keep the aspect ratio */
.rte .video-block video {
    width: auto;
    max-width: 100%;
    max-height: 32rem;
    align-self: center;
}

/*=================================*/
/*            Articles             */
/*=================================*/

.article-list {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.article-preview {
    display: flex;

    img {
        width: 128px;
        height: 128px;
        flex-shrink: 0;
        object-fit: cover;
    }

    .content {
        display: flex;
        flex-direction: column;
    }

    p {
        color: var(--dark);
    }

    &:hover h3 {
        color: var(--primary);
    }
}

.article > h1 {
    word-break: break-word;
}

.article .cover-image {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .5rem;

    img {
        max-width: 100%;
        max-height: 32rem;
    }

    figcaption {
        font-size: calc(var(--font-size) * .85);
        color: var(--primary-disabled);
    }
}

/* Previous article, all articles, next article (stacked on phones) */
.article-nav {
    display: grid;
    grid-template-columns: 1fr;
    grid-template-areas: "previous" "all" "next";
    gap: 1rem;
    padding-top: 2rem;
    border-top: 1px solid var(--secondary);
}

/* Links are only as wide as their content (plus a small padding), so the space between them
   does not react to the mouse; the negative margin keeps the text aligned with the page */
.nav-card {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .5rem;
    margin: -.5rem;
    font-size: max(var(--font-size), .95rem);
    font-weight: 500;
    line-height: 1.35;
    color: var(--dark);
    transition: color 150ms;

    .circle {
        flex: 0 0 2rem;
        height: 2rem;
        border-radius: 50%;
        display: flex;
        justify-content: center;
        align-items: center;
        background: var(--primary);
        color: var(--light);
        transition: background-color 150ms, transform 150ms;
    }

    .title {
        font-size: inherit;
        line-height: inherit;
    }

    &:hover {
        color: var(--primary);

        .circle {
            background: var(--tertiary);
        }
    }

    &.previous {
        grid-area: previous;
        justify-self: start;

        &:hover .circle {
            transform: translateX(-.25rem);
        }
    }

    &.all {
        grid-area: all;
        justify-self: center;
    }

    &.next {
        grid-area: next;
        justify-self: end;
        text-align: right;

        &:hover .circle {
            transform: translateX(.25rem);
        }
    }
}

@media (min-width: 768px) {
    .article-nav {
        grid-template-columns: 1fr auto 1fr;
        grid-template-areas: "previous all next";
        gap: 2rem;
    }
}

.article-list-loading {
    display: flex;
    justify-content: center;
    font-size: 1.5rem;
}

.pagination[hidden] {
    display: none;
}

.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
}

/*=================================*/
/*        Appointment card         */
/*=================================*/

.appointment-preview {
    width: 100%;
    padding: 0;
    display: flex;
    align-items: stretch;
    text-align: left;
    text-transform: none;
    font-weight: normal;
    background: none;

    .date {
        background: var(--primary);
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        padding: 1rem 1.5rem;
        color: var(--light);
        font-weight: bold;
        font-size: var(--font-size);

        span:first-of-type {
            font-size: 1.8rem;
            font-weight: normal;
        }
    }

    .content {
        background: var(--secondary);
        flex: 1;
        display: flex;
        flex-direction: column;
        justify-content: center;
        padding: 1rem;
    }

    .title {
        font-size: var(--font-size);
        text-transform: uppercase;
        font-weight: bold;
        color: var(--dark);
    }

    .details {
        display: flex;
        flex-direction: column;
        justify-content: space-between;
        gap: .5rem;
        font-size: var(--font-size);
        color: var(--dark);
    }

    .location, .time {
        display: flex;
        gap: .5rem;
        align-items: flex-start;
    }
}

@media (min-width: 576px) {
    .appointment-preview .details {
        flex-direction: row;
    }

    .appointment-preview .location {
        flex-direction: row-reverse;
    }
}

/*=================================*/
/*       Appointment dialog        */
/*=================================*/

.appointment-dialog {
    margin: auto;
    max-width: min(40rem, calc(100vw - 2rem));
    padding: 1rem 1.5rem;
    background: var(--secondary);
    border: 4px solid var(--primary);

    &[open] {
        display: flex;
        flex-direction: column;
        gap: 1rem;
    }

    &::backdrop {
        background: #04040499;
    }

    h2 {
        word-break: break-word;
        color: var(--primary);
    }

    .details {
        display: grid;
        grid-template-columns: auto 1fr;
        align-items: start;
        justify-items: center;
        gap: .5rem;

        span, .description {
            width: 100%;
            font-size: var(--font-size);
        }
    }

    > button {
        align-self: flex-start;
    }
}

.appointment-details {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/*=================================*/
/*            Calendar             */
/*=================================*/

.page-title .calendar-nav {
    align-items: center;

    a {
        padding: .5rem;
    }

    h2 {
        min-width: 12ch;
        text-align: center;
    }
}

.calendar-weekday {
    display: none;
    padding: .25rem;
}

.calendar-weekday-short {
    padding: .25rem;
}

.calendar-cells {
    display: grid;
    grid-template-columns: repeat(7, 14.29%);
    grid-template-rows: auto repeat(6, auto);
    margin-left: -1rem;
    margin-right: -1rem;
}

.calendar-cell {
    border: 1px solid grey;
    aspect-ratio: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    gap: .25rem;
    padding: .25rem;

    h4 {
        text-align: center;
    }

    &.current-day h4 {
        font-weight: bold;
    }

    &.in-past {
        background: var(--secondary);
        filter: brightness(.9);
    }

    &.other-month h4 {
        color: gray;
    }

    .appointments {
        display: none;
        flex-direction: column;
        gap: .25rem;
    }

    .appointment {
        width: 100%;
        background: var(--tertiary);
        border-left: .5rem solid var(--primary);
        padding: .5rem;
        font-size: .9rem;
        font-weight: normal;
        text-transform: none;
        text-align: left;
        text-overflow: ellipsis;
        overflow: hidden;
        white-space: nowrap;
    }

    .appointments-marker {
        padding: 0;
        background: none;

        &:hover {
            box-shadow: none;
        }
    }
}

.months-appointments {
    display: grid;
    gap: 1rem;
}

@media (min-width: 768px) {
    .calendar-cells {
        grid-template-rows: auto repeat(6, minmax(6rem, auto));
    }

    .calendar-cell {
        aspect-ratio: unset;
        display: block;
        padding: 0;

        h4 {
            padding: .5rem .5rem .25rem .5rem;
        }

        .appointments {
            display: flex;
            padding: 0 .25rem .25rem;
        }

        .appointments-marker {
            display: none;
        }
    }

    .months-appointments {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 992px) {
    .calendar-weekday-short {
        display: none;
    }

    .calendar-weekday {
        display: unset;
    }
}

@media (min-width: 1200px) {
    .months-appointments {
        grid-template-columns: repeat(3, 1fr);
    }
}

/*=================================*/
/*            Contact              */
/*=================================*/

.contact {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.contact-info {
    flex: 1;
    display: flex;
    flex-direction: column;

    > div {
        display: flex;
        flex-direction: column;
    }

    h2 {
        color: var(--primary);
    }
}

.contact-links {
    display: flex;
    flex-direction: column;
    margin: 0;
    list-style: none;

    li {
        display: flex;
        align-items: center;
        gap: .75rem;
    }

    i {
        font-size: 1.5rem;
        width: 1.75rem;
        text-align: center;
    }
}

.contact-form {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding: 2rem;
    background: var(--secondary);

    h2 {
        color: var(--primary);
    }

    form {
        display: flex;
        flex-direction: column;
    }

    label {
        display: flex;
        flex-direction: column;
        gap: .25rem;
        font-weight: bold;
    }

    input, textarea {
        font-size: var(--font-size);
        font-weight: normal;
    }

    textarea {
        height: 8rem;
        resize: vertical;
    }

    .input-with-icon {
        position: relative;

        input {
            padding-right: 2.5rem;
        }

        i {
            position: absolute;
            right: .75rem;
            top: 50%;
            transform: translateY(-50%);
        }
    }

    button {
        align-self: flex-end;
    }

    .contact-website {
        position: absolute;
        left: -10000px;
        width: 1px;
        height: 1px;
        overflow: hidden;
    }
}

.form-message {
    padding: 1rem;
    border-left: 4px solid;

    &.success {
        border-color: var(--primary);
        background: var(--light);
    }

    &.error {
        border-color: var(--error);
        background: var(--light);
        color: var(--error);
    }
}

@media (min-width: 768px) {
    .contact-form {
        padding: 4rem;
    }
}

@media (min-width: 992px) {
    .contact {
        flex-direction: row;
        gap: 4rem;
    }
}
