/*
  Articles listing page styles — /articles/index.html
  Requires: articles-base.css
*/

/* -------------------------------------------------------------------------- */
/* Listing layout (sidebar + main) — width from .articles-container           */
/* -------------------------------------------------------------------------- */

.articles-layout {
    display: flex;
    padding-top: 90px;
    text-align: left;
}

.articles-nav__label {
    display: none;
}

.articles-nav {
    display: flex;
    flex-direction: column;
    flex: 0 0 25%;
    margin-top: 69px;
}

.articles-nav ul {
    margin: 0;
    padding: 0;
    list-style: none;
}

.articles-nav ul li {
    padding: 8px 0;
    text-align: left;
}

.articles-page > main a.articles-nav__link {
    display: inline-block;
    padding-left: 5px;
    color: #333333;
    font-size: var(--article-font-size);
    text-decoration: underline;
}

.articles-page > main a.articles-nav__link--active {
    border-left: 4px solid #0271c2;
    color: #333333;
    font-weight: 700;
}

.articles-main {
    flex: 1;
    min-width: 0;
    max-width: 100%;
}

.articles-index {
    margin: 0;
    padding: 0 0 64px;
}

/* -------------------------------------------------------------------------- */
/* Featured + grid                                                            */
/* -------------------------------------------------------------------------- */

.articles-featured {
    position: relative;
    display: block;
    min-height: 320px;
    margin-bottom: 40px;
    border-radius: 12px;
    overflow: hidden;
    background-color: #1a1a1a;
    background-position: center;
    background-repeat: no-repeat;
    background-size: cover;
    color: #fff;
    text-decoration: none;
}

.articles-featured:hover {
    text-decoration: none;
}

.articles-featured__overlay {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 24px;
    min-height: 500px;
    padding: 0 20px 48px 48px;
    background: linear-gradient(180deg, rgba(0, 0, 0, 0.05) 0%, rgba(0, 0, 0, 0.75) 100%);
    box-sizing: border-box;
}

.articles-featured__content {
    max-width: 720px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.articles-featured__title {
    margin: 0;
    font-size: 48px;
    font-weight: 700;
    line-height: 1.3;
    color: #ffffff;
}

.articles-featured__summary {
    margin: 0;
    font-size: 18px;
    line-height: 2;
    color: #ffffff;
}

.articles-featured__meta {
    display: flex;
    gap: 16px;
    margin: 0;
    font-size: 16px;
    line-height: 1.4;
    color: #ffffff;
}

.articles-featured__read-time,
.articles-card__read-time {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.articles-read-time__icon {
    display: block;
    flex-shrink: 0;
}

.articles-featured__arrow {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
}

.articles-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 30px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.articles-grid:empty {
    display: none;
}

.articles-card {
    display: flex;
    flex-direction: column;
    height: 100%;
    border: 1px solid var(--article-border);
    border-radius: 14px;
    overflow: hidden;
    background: #fff;
    color: inherit;
    text-decoration: none;
    max-width: 330px;
}

.articles-card:hover {
    text-decoration: none;
}

.articles-card__image {
    display: block;
    width: 100%;
    height: 205px;
    object-fit: cover;
}

.articles-card__body {
    display: flex;
    flex-direction: column;
    flex: 1;
    padding: 20px;
}

.articles-card__title {
    margin: 12px 0;
    font-size: 20px;
    font-weight: 700;
    line-height: 1.3;
    color: var(--article-text);
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
}

.articles-card__text {
    margin: 0 0 16px;
    font-size: var(--article-font-size);
    line-height: 1.5;
    color: var(--article-text);
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
}

.articles-card__divider {
    margin: auto 0 16px;
    border: 0;
    border-top: 1px solid var(--article-border);
}

.articles-card__meta {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    margin: 0;
    font-size: var(--article-font-size);
    color: #6a7282;
    font-weight: 400;
    line-height: 20px;
}

/* -------------------------------------------------------------------------- */
/* Mobile                                                                     */
/* -------------------------------------------------------------------------- */

@media (max-width: 1024px) {
    .articles-main .articles-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .articles-card {
        max-width: none;
    }
}

/* Desktop: first grid card is a mobile-only duplicate of the featured hero — hide it */
@media (min-width: 768px) {
    .articles-grid > li:first-child {
        display: none;
    }
}

@media (max-width: 767px) {
    /* Hide featured hero on mobile — card duplicate (first grid item) is shown instead */
    .articles-featured {
        display: none;
    }

    .articles-featured__overlay {
        padding: 24px 20px;
    }

    .articles-featured__title {
        font-size: 24px;
    }

    .articles-layout {
        flex-direction: column;
        padding-top: 32px;
    }

    .articles-nav {
        flex: none;
        width: 100%;
        margin: 0 0 24px;
    }

    /* Mobile dropdown nav — mirrors static pages navigation.phtml pattern */
    .articles-nav__label {
        display: block;
        font-size: 14px;
        margin-bottom: 10px;
    }

    .articles-nav ul {
        display: flex;
        flex-direction: column;
        position: relative;
        cursor: pointer;
        border: 1px solid #0271c2;
        border-radius: 10px;
        list-style: none;
        padding: 10px;
        margin: 0;
        -webkit-tap-highlight-color: transparent;
    }

    .articles-nav ul::after {
        content: "\203A"; /* › */
        font-size: 24px;
        position: absolute;
        right: 10px;
        top: 12px;
        transition: transform 0.3s ease-in-out;
        color: #0271c2;
        pointer-events: none;
    }

    /* Hide all items by default, show only the active one */
    .articles-nav ul li {
        display: none;
        padding: 10px 0;
        text-align: left;
    }

    .articles-nav ul li:has(.articles-nav__link--active) {
        display: block;
        order: -1; /* Insights first on mobile, last in DOM (desktop order) */
    }

    /* When open: show all items */
    .articles-nav ul.active li {
        display: block;
    }

    /* Active item gets a separator when dropdown is open */
    .articles-nav ul.active li:has(.articles-nav__link--active) {
        padding-bottom: 15px;
        border-bottom: 1px solid #c2c2c2;
    }

    /* Rotate arrow when open */
    .articles-nav ul.active::after {
        transform: rotate(90deg);
    }

    /* Link colours inside dropdown */
    .articles-page > main a.articles-nav__link {
        display: block;
        width: 100%;
        font-size: 16px;
        color: #155DFC;
        text-decoration: none;
    }

    .articles-page > main a.articles-nav__link--active {
        border-left: none;
        pointer-events: none;
    }

    .articles-main .articles-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
}
