/**
 * @package     mod_easy_articles_pro
 * @copyright   (C) 2024-2026 Easylogic CO LP / Agamemnon Fakas. All rights reserved.
 * @license     GNU General Public License version 3 or later; see LICENSE
 * @author      Agamemnon Fakas <info@easylogic.gr>
 */

.mod-easy-articles-pro {
    --mod-easy-articles-accent: var(--easy-action-primary-bg, #333);
    --mod-easy-articles-gap: 16px;

    /* Colour aliases: declared once here, used by name below. Each takes the site's
       --easy-* colour when the site sets one, and the module's own value otherwise;
       the Style tab sets them for one module. */
    --easy-articles-surface: var(--easy-surface, #fff);
    /* Writing on that surface. `inherit` by default, so the module keeps taking
       the page's own text colour until a merchant or the palette says otherwise. */
    --easy-articles-surface-color: var(--easy-surface-color, inherit);
    /* Text that should recede: the empty-state message. */
    --easy-articles-muted: var(--easy-muted-color, #6b7280);
    --easy-articles-hairline: var(--easy-hairline, #e2e2e2);
    --easy-articles-radius: var(--easy-radius, 4px);
    /* A card's own background, inside its border and corners: the surface unless the module
       or a block sets one (Palette, slotColourCss); a block's own background stays around it. */
    --easy-articles-card-bg: var(--easy-articles-surface);
    /* Its border's colour: the module's lines unless the module or a block sets one. */
    --easy-articles-card-border-color: var(--easy-articles-hairline);
    /* An overlay card sets its text on the photo, so it is dark in both modes: its
       ground where an article has no image, and the colour of the writing on it. */
    --easy-articles-overlay: #111827;
    --easy-articles-overlay-color: #fff;
    /* What an overlay card's text sits on: a gradient toward the image at the bottom
       and at the top, a band in the middle. A card's Overlay background replaces it. */
    --easy-articles-overlay-bottom: linear-gradient(to top, rgb(0 0 0 / 0.85), rgb(0 0 0 / 0.55) 60%, transparent);
    --easy-articles-overlay-middle: rgb(0 0 0 / 0.6);
    --easy-articles-overlay-top: linear-gradient(to bottom, rgb(0 0 0 / 0.85), rgb(0 0 0 / 0.55) 60%, transparent);
    /* How long a hover or focus change takes, for everything in the module that eases
       (never the slider track: Keen moves the slides itself). */
    --easy-articles-transition: 0.2s ease;

    color: var(--easy-articles-surface-color);
}

/* TABS */

.mod-easy-articles-pro .tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    margin: 0 0 1rem;
    border-bottom: 1px solid var(--easy-articles-hairline);
}

.mod-easy-articles-pro .tab {
    appearance: none;
    background: none;
    border: 0;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    padding: 0.6rem 1rem;
    font: inherit;
    color: inherit;
    cursor: pointer;
    opacity: 0.7;
    transition: opacity var(--easy-articles-transition), border-color var(--easy-articles-transition);
}

.mod-easy-articles-pro .tab:hover,
.mod-easy-articles-pro .tab:focus-visible {
    opacity: 1;
}

.mod-easy-articles-pro .tab[data-state="active"] {
    opacity: 1;
    font-weight: 600;
    border-bottom-color: var(--mod-easy-articles-accent);
}

.mod-easy-articles-pro .panel[hidden] {
    display: none;
}

/* A panel being fetched keeps its skeleton (default_placeholder.php) on
   screen; the shapes shimmer until the cards arrive. Rules an edition sharing
   the page must not inherit are scoped by the root marker. */
.mod-easy-articles-pro[data-mod-easy-articles-pro] .panel[data-state="loading"] {
    min-height: 6rem;
}

.mod-easy-articles-pro .slot-placeholder {
    display: flex;
}

.mod-easy-articles-pro .placeholder-row {
    display: grid;
    grid-template-columns: repeat(var(--placeholder-count, 1), minmax(0, 1fr));
    gap: var(--mod-easy-articles-gap);
    width: 100%;
}

.mod-easy-articles-pro .placeholder-card,
.mod-easy-articles-pro .placeholder-block {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    width: 100%;
    min-width: 0;
}

.mod-easy-articles-pro .placeholder-image,
.mod-easy-articles-pro .placeholder-line,
.mod-easy-articles-pro .placeholder-block {
    display: block;
    border-radius: var(--easy-articles-radius);
    background: linear-gradient(90deg, rgba(0, 0, 0, 0.08) 25%, rgba(0, 0, 0, 0.16) 37%, rgba(0, 0, 0, 0.08) 63%);
    background-size: 400% 100%;
    animation: mod-easy-articles-pro-shimmer 1.4s ease infinite;
}

.mod-easy-articles-pro .placeholder-image {
    aspect-ratio: 16 / 10;
}

.mod-easy-articles-pro .placeholder-line {
    height: 0.9rem;
}

.mod-easy-articles-pro .placeholder-line-short {
    width: 55%;
}

.mod-easy-articles-pro .placeholder-block {
    min-height: 6rem;
}

/* A placeholder takes its card's look: the frame's shape, and for an overlay card the
   frame alone, since its text sits on the image. */
.mod-easy-articles-pro .placeholder-card[data-ratio="16-9"] .placeholder-image {
    aspect-ratio: 16 / 9;
}

.mod-easy-articles-pro .placeholder-card[data-ratio="4-3"] .placeholder-image {
    aspect-ratio: 4 / 3;
}

.mod-easy-articles-pro .placeholder-card[data-ratio="1-1"] .placeholder-image {
    aspect-ratio: 1;
}

.mod-easy-articles-pro .placeholder-card[data-ratio="3-4"] .placeholder-image {
    aspect-ratio: 3 / 4;
}

.mod-easy-articles-pro .placeholder-card[data-style="overlay"] .placeholder-line {
    display: none;
}

@keyframes mod-easy-articles-pro-shimmer {
    from { background-position: 100% 0; }
    to   { background-position: 0 0; }
}

.mod-easy-articles-pro .empty {
    margin: 0;
    color: var(--easy-articles-muted);
}

/* TEXTS AROUND A TAB + VIEW ALL */

.mod-easy-articles-pro .tab-text-before {
    margin: 0 0 1rem;
}

.mod-easy-articles-pro .tab-text-after {
    margin: 1rem 0 0;
}

.mod-easy-articles-pro .view-all {
    margin: 1rem 0 0;
    text-align: right;
}

.mod-easy-articles-pro .view-all a {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    color: var(--mod-easy-articles-accent);
    font-weight: 600;
    text-decoration: none;
}

.mod-easy-articles-pro .view-all a:hover,
.mod-easy-articles-pro .view-all a:focus-visible {
    text-decoration: underline;
}

.mod-easy-articles-pro .view-all svg {
    width: 1rem;
    height: 1rem;
}

/* CUSTOM LAYOUT — the tab's own grid of slots; the areas and column count come
   from the layout's descriptor (inline custom properties on the block). */

.mod-easy-articles-pro .pattern {
    display: grid;
    grid-template-columns: repeat(var(--mod-easy-articles-columns, 4), minmax(0, 1fr));
    grid-template-areas: var(--mod-easy-articles-areas);
    gap: var(--mod-easy-articles-pattern-gap, var(--mod-easy-articles-gap));
}

.mod-easy-articles-pro .pattern + .pattern {
    margin-top: var(--mod-easy-articles-gap);
}

.mod-easy-articles-pro .slot {
    min-width: 0;
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
}

/* A styled slot (background, padding…) wraps its card like a tile. */
.mod-easy-articles-pro .slot-card > .teaser {
    flex: 1 1 auto;
}

/* The block's own texts, above and below its content. */
.mod-easy-articles-pro .slot-text {
    width: 100%;
    min-width: 0;
}

.mod-easy-articles-pro .slot-text-before {
    margin-bottom: 0.5rem;
}

.mod-easy-articles-pro .slot-text-after {
    margin-top: 0.5rem;
}

.mod-easy-articles-pro .slot-text > :last-child {
    margin-bottom: 0;
}

.mod-easy-articles-pro .slot > .teaser,
.mod-easy-articles-pro .slot > .slider {
    width: 100%;
}

.mod-easy-articles-pro .slot-content {
    width: 100%;
    min-width: 0;
}

/* A slider inside a slot keeps its arrows within the slot. */
.mod-easy-articles-pro .slot .arrow-prev {
    left: 0.25rem;
}

.mod-easy-articles-pro .slot .arrow-next {
    right: 0.25rem;
}

/* TEASER — one article card. Its classes are not `card-*`: templates style those
   globally. The title's link is stretched over the whole card, so the card is a
   single target; keyboard focus is drawn on the card itself. Decoration such as a
   hover effect is left to the site's own CSS.

   This is the default card with every part showing. What a module, a tab or a
   layout block sets instead — on every screen, or for one breakpoint — is written
   as rules for the card's place (`data-look`) by CardLook::css, from the same
   list of declarations, so every property a setting can change is declared here. */

.mod-easy-articles-pro .teaser {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: normal;
    min-width: 0;
    height: 100%;
    overflow: hidden;
    border: 1px solid var(--easy-articles-card-border-color);
    /* Its width on each side; 0 removes it there. */
    border-width: var(--easy-articles-card-border, 1px);
    border-radius: var(--easy-articles-card-radius, var(--easy-articles-radius));
    color: inherit;
    background: var(--easy-articles-card-bg);
    box-shadow: var(--easy-articles-card-shadow, var(--easy-shadow, none));
    transition: box-shadow var(--easy-articles-transition);
}

/* An overlay card stacks its image and its text in one grid cell. */
.mod-easy-articles-pro .teaser > * {
    grid-area: auto;
}

.mod-easy-articles-pro .teaser:has(.teaser-title a:focus-visible) {
    outline: 2px solid var(--mod-easy-articles-accent);
    outline-offset: 2px;
}

/* Shadows: none unless a card setting asks, or the site's --easy-shadow and
   --easy-shadow-hover. The hover shadow also shows while the card holds focus. */
.mod-easy-articles-pro .teaser:is(:hover, :focus-within) {
    box-shadow: var(--easy-articles-card-shadow-hover, var(--easy-shadow-hover, var(--easy-articles-card-shadow, var(--easy-shadow, none))));
}

@media (prefers-reduced-motion: reduce) {
    .mod-easy-articles-pro :is(.tab, .arrow, .dot, .teaser) {
        transition: none;
    }
}

/* A slider's track clips what sticks out of it: a place whose cards have a shadow
   gives it room (12px) in its rules. */
.mod-easy-articles-pro .slider .track {
    padding-block: 0;
}

.mod-easy-articles-pro .teaser-image {
    display: block;
    flex: 0 1 auto;
    align-self: auto;
    aspect-ratio: 16 / 10;
    max-height: none;
    overflow: hidden;
    border-radius: var(--easy-articles-card-image-radius, 0);
    background: var(--easy-articles-hairline);
}

.mod-easy-articles-pro .teaser-image img {
    display: block;
    width: 100%;
    height: 100%;
    max-height: none;
    margin-inline: 0;
    object-fit: cover;
    object-position: center;
}

.mod-easy-articles-pro .teaser-body {
    z-index: auto;
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    align-self: auto;
    gap: 0.5rem;
    min-width: 0;
    padding: var(--easy-articles-card-padding, 1rem);
    background: none;
}

.mod-easy-articles-pro .teaser-title {
    display: block;
    overflow: visible;
    margin: 0;
    font-size: 1.125rem;
    line-height: 1.3;
    -webkit-line-clamp: none;
}

.mod-easy-articles-pro .teaser-title a {
    color: inherit;
    text-decoration: none;
}

.mod-easy-articles-pro .teaser-title a::after {
    content: "";
    position: absolute;
    inset: 0;
}

.mod-easy-articles-pro .teaser-title a:focus-visible {
    outline: none;
}

.mod-easy-articles-pro .teaser-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0 0.75rem;
    margin: 0;
    color: var(--easy-articles-muted);
    font-size: 0.8125rem;
    opacity: 1;
}

.mod-easy-articles-pro .teaser-date {
    display: inline;
}

.mod-easy-articles-pro .teaser-category {
    display: inline;
}

.mod-easy-articles-pro .teaser-author {
    display: inline;
}

.mod-easy-articles-pro .teaser-intro {
    display: block;
    overflow: visible;
    margin: 0;
    font-size: 0.9375rem;
    line-height: 1.5;
    -webkit-line-clamp: none;
}

.mod-easy-articles-pro .teaser-more {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    margin-top: auto;
    padding-top: 0.25rem;
    color: var(--mod-easy-articles-accent);
    font-size: 0.875rem;
    font-weight: 600;
    opacity: 1;
}

.mod-easy-articles-pro .teaser-more svg {
    width: 1rem;
    height: 1rem;
}

/* SLIDER */

.mod-easy-articles-pro .slider {
    position: relative;
}

.mod-easy-articles-pro .slide {
    display: flex;
}

/* keen-slider clips each slide, and a card fills its slide: left clipped, the room the
   track makes above and below a card with a shadow would still cut the shadow off. */
.mod-easy-articles-pro .slider .slide.keen-slider__slide {
    overflow: visible;
}

.mod-easy-articles-pro .slide > .teaser {
    width: 100%;
}

.mod-easy-articles-pro .arrow {
    position: absolute;
    top: 50%;
    z-index: 2;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    padding: 0;
    border: 1px solid var(--easy-articles-hairline);
    border-radius: 50%;
    background: var(--easy-articles-surface);
    color: var(--mod-easy-articles-accent);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12);
    cursor: pointer;
    transform: translateY(-50%);
    transition: opacity var(--easy-articles-transition);
}

.mod-easy-articles-pro .arrow-prev {
    left: -1.25rem;
}

.mod-easy-articles-pro .arrow-next {
    right: -1.25rem;
}

.mod-easy-articles-pro .arrow:disabled {
    opacity: 0.35;
    cursor: default;
}

.mod-easy-articles-pro .arrow svg {
    width: 1.25rem;
    height: 1.25rem;
}

.mod-easy-articles-pro .dots {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 1rem;
}

.mod-easy-articles-pro .dot {
    width: 0.6rem;
    height: 0.6rem;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.2);
    cursor: pointer;
    transition: background-color var(--easy-articles-transition);
}

.mod-easy-articles-pro .dot[data-state="active"] {
    background: var(--mod-easy-articles-accent);
}

@media (max-width: 767px) {
    .mod-easy-articles-pro .arrow-prev {
        left: 0.25rem;
    }

    .mod-easy-articles-pro .arrow-next {
        right: 0.25rem;
    }

}

/* The layout's tablet / mobile behaviour (designed arrangements, automatic collapse,
   hidden slots) is emitted per module instance at the merchant's own breakpoint
   widths — see EasyArticlesProHelper::responsiveCss(). */

@media (prefers-reduced-motion: reduce) {
    .mod-easy-articles-pro .placeholder-image,
    .mod-easy-articles-pro .placeholder-line,
    .mod-easy-articles-pro .placeholder-block {
        animation: none;
    }
}

/* ---------------------------------------------------------------------------
   DARK
   The module's own dark values, so it is correct in both modes on its own. A site
   that sets the --easy-* colours wins over them, and so do the module's Style
   settings; these are the floor, not the ceiling.

   Keyed on what the PAGE declares, never on the device alone: a visitor who picks
   light on a dark laptop must get light. The third selector is the case where the
   template declares neither attribute, so the device decides.
   --------------------------------------------------------------------------- */
:is(:root[data-theme="dark"], :root[data-theme-default="dark"]:not([data-theme]))
.mod-easy-articles-pro {
    --mod-easy-articles-accent: var(--easy-action-primary-bg, #e5e7eb);
    --easy-articles-surface: var(--easy-surface, #1f2937);
    --easy-articles-surface-color: var(--easy-surface-color, #e5e7eb);
    --easy-articles-muted: var(--easy-muted-color, #9ca3af);
    --easy-articles-hairline: var(--easy-hairline, #374151);
    --easy-articles-card-bg: var(--easy-articles-surface);
    --easy-articles-card-border-color: var(--easy-articles-hairline);
}

@media (prefers-color-scheme: dark) {
    :is(:root[data-theme="auto"],
        :root[data-theme-default="auto"]:not([data-theme]),
        :root:not([data-theme]):not([data-theme-default]))
    .mod-easy-articles-pro {
        --mod-easy-articles-accent: var(--easy-action-primary-bg, #e5e7eb);
        --easy-articles-surface: var(--easy-surface, #1f2937);
        --easy-articles-surface-color: var(--easy-surface-color, #e5e7eb);
        --easy-articles-muted: var(--easy-muted-color, #9ca3af);
        --easy-articles-hairline: var(--easy-hairline, #374151);
        --easy-articles-card-bg: var(--easy-articles-surface);
        --easy-articles-card-border-color: var(--easy-articles-hairline);
    }
}
