:root {
    /* Proportions on vertical cards */
    --card-image-ratio: 0.4;
    --card-description-ratio: 0.3;
    --card-total-ratio: calc(
        var(--card-image-ratio) + var(--card-description-ratio)
    );

    --card-large-description-ratio: 0.2;

    /* Proportions on horizontal cards */
    --card-image-h-ratio: 0.4;
    --card-description-h-ratio: 0.5;
}

.narrow-col {
    width: 24%;
    aspect-ratio: 1 / var(--card-total-ratio);
}

/* Moved from Marc's CSS */
.highlights {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.load-more-button-container {
    max-width: inherit;
}

.load-more-button {
    width: 12rem; /* Previously --card-size=12rem */
    text-align: left;
}

/* @TODO: Rename these are they are used for "cards" */
.icon-shadow {
    box-shadow: 0 0 30px 10px rgba(0, 0, 0, 0.05);
    background: radial-gradient(circle, rgba(0, 0, 0, 0.07), rgba(0, 0, 0, 0.02));
    transition: box-shadow 0.08s ease;
}
.icon-wrap {
    border-radius: 50%;
    width: calc(12rem * 0.1); /* Previously --card-size=12rem */
    height: calc(12rem * 0.3); /* Previously --card-size=12rem */
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 1rem;
    overflow: visible;
}

/* Responsivitet */
/* alt mindre end en mobilenhed på 425 */
@media (max-width: 425px) {
    :root {
        /* Proportions on horizontal cards */
        /*--card-image-h-ratio: 0.8; */ /* Not needed in cards after setting <a> width and image-h width */
    }

    /* Set explicit flex properties for card <a> and description on mobile due to interaction that overwrites width */
    .card-lefttag > a {
        flex: 0 0 50%;
    }

    .card-description-h {
        flex: 1 1 50%;
    }

    .grid-col {
        width: 100%;
        aspect-ratio: 1 / var(--card-total-ratio);
    }

    .narrow-col {
        width: 100%;
        aspect-ratio: 1 / var(--card-total-ratio);
    }

    .slide-card {
        width: 90%;
        aspect-ratio: 1 / var(--card-total-ratio);
    }

    .highlights--slim {
        justify-content: flex-start !important;
        min-height: 400px;
    }
}

/* alt større end en mobilenhed på 425px */
@media (min-width: 426px) and (max-width: 768px) {
    :root {
        /* Proportions on horizontal cards */
        /*--card-image-h-ratio: 0.5; */ /* Not needed in cards after setting <a> width and image-h width */
    }

    .grid-col {
        width: 100%;
        aspect-ratio: 1 / var(--card-total-ratio);
    }

    .narrow-col {
        width: 100%;
        aspect-ratio: 1 / var(--card-total-ratio);
    }

    .slide-card {
        width: 33%;
        aspect-ratio: 1 / var(--card-total-ratio);
    }

    .highlights--slim {
        justify-content: flex-start !important;
    }
}

/* alt større end tablet på 768px */
@media (min-width: 769px) and (max-width: 1024px) {
    :root {
        /* Proportions on vertical cards */
        --card-image-ratio: 0.4;
        --card-description-ratio: 0.4;
        --card-total-ratio: calc(
            var(--card-image-ratio) + var(--card-description-ratio)
        );

        /* Proportions on horizontal cards */
        /*--card-image-h-ratio: 0.5; */ /* Not needed in cards after setting <a> width and image-h width */
    }

    .grid-col {
        width: 49%;
        aspect-ratio: 1 / var(--card-total-ratio);
    }

    .narrow-col {
        width: 49%;
        aspect-ratio: 1 / var(--card-total-ratio);
    }

    .slide-card {
        width: 49%;
        aspect-ratio: 1 / var(--card-total-ratio);
    }

    .highlights--slim {
        justify-content: flex-start !important;
    }
}

/* alt større end tablet på 1024px */
@media (min-width: 1025px) and (max-width: 1399px) {
    :root {
        /* Proportions on horizontal cards */
        /*--card-image-h-ratio: 0.4; */ /* Not needed in cards after setting <a> width and image-h width */
    }

    .grid-col {
        width: 32%;
        aspect-ratio: 1 / var(--card-total-ratio);
    }

    .narrow-col {
        width: 49%;
        aspect-ratio: 1 / var(--card-total-ratio);
    }

    .slide-card {
        width: 32%;
        aspect-ratio: 1 / var(--card-total-ratio);
    }
}

@media (min-width: 1400px) and (max-width: 2000px) {
    :root {
        /* Proportions on horizontal cards */
        /*--card-image-h-ratio: 0.4; */ /* Not needed in cards after setting <a> width and image-h width */
    }

    .grid-col {
        width: 32%;
        aspect-ratio: 1 / var(--card-total-ratio);
    }

    .narrow-col {
        width: 32%;
        aspect-ratio: 1 / var(--card-total-ratio);
    }

    .slide-card {
        width: 24%;
        aspect-ratio: 1 / var(--card-total-ratio);
    }
}

/* alt større end desktop på 2000px */
@media (min-width: 2000px) {
    :root {
        --some-variable: 0;
    }

    .grid-col {
        width: 32%;
        aspect-ratio: 1 / var(--card-total-ratio);
    }

    .narrow-col {
        width: 32%;
        aspect-ratio: 1 / var(--card-total-ratio);
    }

    .slide-card {
        width: 24%;
        aspect-ratio: 1 / var(--card-total-ratio);
    }
}

.case-background {
    background-color: var(--praksis-color);
}

.aktivitet-background {
    background-color: var(--aktivitet-color);
}

.article-background {
    background-color: var(--fokusomraade-color);
}

.technology-background {
    background-color: var(--technology-color);
}

.case-textcolor {
    color: var(--praksis-color);
}

.aktivitet-textcolor {
    color: var(--aktivitet-color);
}

.article-textcolor {
    color: var(--fokusomraade-color);
}

.technology-textcolor {
    color: var(--technology-color);
}

.grid-wrap {
    width: 100%;
    /*max-width: 1000px;*/
    display: flex;
    flex-direction: row;
    justify-content: flex-start;
    row-gap: 1rem;
    column-gap: 1%;
    flex-wrap: wrap;
    margin: auto;
}

/* HIGHLIGHTS LAYOUT FOR CARDS */
.highlights-wrap {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    width: 100%;
    /*max-width: 1000px;*/
    /*margin: auto;*/
}

.highlights--slim {
    width: 100%;
    max-width: 1000px;
    margin: auto; /* center it */
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    aspect-ratio: 1 / calc(var(--card-image-h-ratio));
    row-gap: 1rem;
}

.highlights-rowwrap {
    width: 49.2%;
    aspect-ratio: 1 / var(--card-total-ratio);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    /*background: blue;*/
}

.highlights-mainwrap {
    width: 49.2%;
}

.highlights-row {
    height: 30%;
}

/* Stuff for cards */
.card {
    box-shadow: 0 0 3px lightgrey;
    background-color: white;
}

.card-notag {
    width: 100%;
    aspect-ratio: 1 / var(--card-image-ratio); /* Ratio for image */
    cursor: pointer;
}

.card-tag {
    width: 100%;
    aspect-ratio: 1 / var(--card-total-ratio); /* Ratio for image + text */
    display: flex;
    flex-direction: column;
}

.card-lefttag {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: row;
    /*aspect-ratio: 1/0.4;*/
}

/* All horizontal cards should have 50% width for image - <a> wraps image */
.card-lefttag > a {
    width: 50%;
}

.card-large {
    width: 100%;
    aspect-ratio: 1 /
        calc(var(--card-large-description-ratio) + var(--card-image-ratio)); /* Ratio for image + text */
    display: flex;
    flex-direction: column;
}

.card-image {
    /* Fit to box, using width */
    position: relative;
    width: 100%;
    aspect-ratio: 1 / var(--card-image-ratio); /* Ratio for image */

    /* Set the background image */
    /*background-image: url("/public/images/placeholder-case.png");*/
    background-size: auto 100%;
    background-position: center;
}

.card-image-h {
    /* Fit to box, using width */
    position: relative;
    height: 100%;
    max-width: 100%;
    width: 100%;

    /* Set the background image */
    background-image: url("/public/images/placeholder-case.png");
    background-size: auto 100%;
    background-position: center;
}

.card-overlay {
    /* Fit the box to entire .card-image area */
    height: 100%;
    width: 100%;
    position: absolute;
    top: 0;
    left: 0;
    z-index: 1; /* Lower z-index */

    /* Set overlay color */
    opacity: 0.8;
    /*background-color: var(--praksis-color);*/
    transition:
        background-color 0.2s,
        opacity 0.2s; /* Smooth transition */
}

/* Apply hover effect when hovering over the parent card */
.card:hover .card-overlay {
    opacity: 0.7;
}

.card-info {
    /* Spacing for title and bookmark */
    padding: 7px 10px;

    /* Fit the box to entire .card-image area */
    height: 100%;
    width: 100%;
    position: absolute;
    top: 0;
    left: 0;
    z-index: 2; /* Higher z-index to stay on top */
    pointer-events: none; /* This lets hover events pass through to elements below */

    /* Organize content inside */
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    text-shadow: 0 0 5px grey;
    color: whitesmoke;
}

.card-description {
    font-size: var(--font-size-m1);
    line-height: 1.2em;
    font-weight: 200;

    /* Organize content */
    display: flex;
    flex-direction: column;
    padding: 10px;

    /* Scale by width */
    width: 100%;
    aspect-ratio: 1 / var(--card-description-ratio); /* Ratio for description */
    flex-grow: 1;

    /* Avoid text overflow */
    overflow: hidden;
}

.card-description-large {
    font-size: var(--font-size-m1);
    line-height: 1.2em;
    font-weight: 200;

    /* Organize content */
    display: flex;
    flex-direction: column;
    padding: 10px;

    /* Scale by width */
    width: 100%;
    /* @M: Where is this variable defined? */
    aspect-ratio: 1 / var(--card-large-description-ratio-ratio); /* Ratio for description */
    flex-grow: 1;

    /* Avoid text overflow */
    overflow: hidden;
}

.fontsize0 {
    font-size: var(--font-size-0);
}

.card-description-h {
    font-size: var(--font-size-m1);
    line-height: 1.2em;
    font-weight: 200;

    /* Organize content */
    display: flex;
    flex-direction: column;
    padding: 10px;

    /* Scale by height */
    height: 100%;
    aspect-ratio: 1 / var(--card-description-h-ratio); /* Ratio for h-description */
    flex-grow: 1;

    /* Avoid text overflow */
    overflow: hidden;
}

.card--bookmark {
    position: absolute; /*This has to be placed out of the normal flow - otherwise headers will overflow the description box*/
    top: 5px;
    right: 5px;
    color: white;
    pointer-events: auto; /* Enable pointer events again for interactive elements */
}

.card--title {
    line-height: 1.2em;
    font-size: var(--font-size-0);
}

.card--title-large {
    line-height: 1.2em;
    font-size: var(--font-size-p1);
}

.card-format {
    font-size: var(--font-size-m1);
    padding-bottom: 0.2rem;
}
