/*
 * Shared WWTS card primitive.
 *
 * Elementor owns the Loop Item structure and responsive grid controls.
 * This component only gives classed card parts a reusable visual language.
 * Variant classes (for example .wwts-card--life) may tune content semantics
 * without duplicating the common card surface/body/CTA rules.
 */

.wwts-card {
    --wwts-card-media-height: 230px;
    display: flex;
    min-width: 0;
    height: 100%;
    flex-direction: column;
    gap: 0 !important;
    overflow: hidden;
    padding: 0 !important;
    background: var(--wwts-card-surface);
    border: var(--wwts-card-border);
    border-radius: var(--wwts-card-radius);
    box-shadow: var(--wwts-card-shadow);
    color: #5a514c;
    transition: box-shadow 0.25s ease;
}

/* Elementor Loop Grid may stretch the item wrapper while leaving the saved
   Loop Item template at content height. Keep the card itself stretched too. */
.elementor-loop-container .e-loop-item > .elementor,
.elementor-loop-container .e-loop-item .wwts-card {
    height: 100%;
}

.wwts-card__media {
    position: relative;
    display: flex;
    box-sizing: border-box;
    width: 100%;
    height: var(--wwts-card-media-height) !important;
    min-height: var(--wwts-card-media-height);
    align-items: stretch;
    justify-content: stretch;
    overflow: hidden;
    padding: 8px !important;
    border-radius: var(--wwts-card-radius) var(--wwts-card-radius) 0 0;
    background: #ede7dd;
    transition: background-color 180ms ease;
}

.wwts-card__image,
.wwts-card__image > .elementor-widget-container,
.wwts-card__image a {
    display: block;
    width: 100%;
    height: 100%;
}

.wwts-card__image img {
    display: block;
    width: 100%;
    height: 100% !important;
    max-width: none;
    object-fit: cover;
    object-position: center;
    transition: transform 0.25s ease;
    border-radius: var(--wwts-card-radius) var(--wwts-card-radius) 0 0;
}

.wwts-card__body {
    display: flex;
    min-width: 0;
    flex: 1 1 auto;
    flex-direction: column;
    gap: 0 !important;
    padding: 20px 20px 22px !important;
    background: var(--wwts-card-surface);
}

.wwts-card__meta {
    display: flex;
    width: 100%;
    min-width: 0;
    flex-direction: row !important;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 5px;
    padding-inline: 0 !important;
}

.wwts-card__eyebrow,
.wwts-card__date {
    min-width: 0;
    font-family: var(--wwts-font-text);
    line-height: 1.25;
}

.wwts-card__eyebrow {
    font-size: 10px;
    font-weight: 500;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: #9b8264;
}

.wwts-card__date {
    flex: 0 0 auto;
    font-size: 11px;
    font-weight: 400;
    color: rgba(90, 81, 76, 0.62);
}

.wwts-card__eyebrow .elementor-widget-container,
.wwts-card__date .elementor-widget-container,
.wwts-card__eyebrow p,
.wwts-card__date p {
    margin: 0;
    font: inherit;
    letter-spacing: inherit;
    text-transform: inherit;
    color: inherit;
}

.wwts-card__eyebrow a {
    color: inherit;
    text-decoration: none;
}

/*
 * Task 030 / Alexandra 08.10: hide editorial category labels on LIFE cards
 * and Home Inside cards without changing their taxonomy terms, query filters,
 * post dates, links or Elementor Loop Item data. Home badges may contain only
 * an empty label while their white background remains visible, so hide the
 * entire badge container rather than just its text. Keep this strictly scoped
 * to the two requested card presentations.
 */
.wwts-card.wwts-card--life .wwts-card__eyebrow,
.wwts-home-inside-card .wwts-card-badge {
    display: none !important;
}

/* With category removed, the LIFE date keeps its original right alignment. */
.wwts-card.wwts-card--life .wwts-card__date {
    margin-inline-start: auto;
}

.wwts-card__title {
    margin: 0;
}

/* Elementor 4 / Theme Post Title can emit a per-element typography rule with
   higher specificity than a component class. These values are part of the
   shared card contract, so make that contract authoritative here. */
.wwts-card .wwts-card__title .elementor-heading-title {
    margin: 0;
    font-family: var(--wwts-font-primary);
    font-size: 24px !important;
    font-weight: 600 !important;
    line-height: 1.06 !important;
    color: #4a382c;
    transition: color 180ms ease;
}

.wwts-card__title a {
    color: inherit;
    text-decoration: none;
}

.wwts-card__description {
    margin-top: 14px;
    font-family: var(--wwts-font-text);
    font-size: 14px;
    line-height: 1.55;
    color: #5a514c;
}

.wwts-card__description .elementor-widget-container,
.wwts-card__description p {
    margin: 0;
    font: inherit;
    line-height: inherit;
    color: inherit;
}

.wwts-card__description p,
.wwts-card__description .elementor-widget-container:not(:has(p)) {
    display: -webkit-box;
    overflow: hidden;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
}

.wwts-card__footer {
    width: 100%;
    margin-top: 15px !important;
    padding-top: 10px !important;
    padding-inline: 0 !important;
}

/* Meta and footer are layout groups inside the padded card body. They must not
   add their own horizontal inset: category/date, title, description and CTA
   all share the same left/right baseline. */
.wwts-card__meta > .elementor-element,
.wwts-card__footer > .elementor-element {
    margin-inline: 0 !important;
    padding-inline: 0 !important;
}

/* The divider belongs to the CTA group. The fixed margin on the footer creates
   the requested space before the line without relying on internal padding. */
.wwts-card__footer::before {
    content: '';
    display: block;
    width: 100%;
    margin-bottom: 18px;
    border-top: 1px solid rgba(90, 81, 76, 0.12);
}

/* Neutralise the global Elementor pill button only inside a WWTS card. */
.wwts-card__cta,
.wwts-card__cta > .elementor-widget-container {
    width: 100%;
}

.wwts-card__cta .elementor-button {
    display: flex;
    width: 100%;
    min-width: 0;
    min-height: 0;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 0 !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    font-family: var(--wwts-font-text);
    font-size: 11px;
    font-weight: 500;
    line-height: 1.2;
    letter-spacing: 0.09em;
    text-transform: uppercase;
    color: #5a514c !important;
    text-decoration: none;
}

.wwts-card__cta .elementor-button::after {
    content: '→';
    flex: 0 0 auto;
    font-size: 19px;
    line-height: 1;
    transition: transform 180ms ease;
}

.wwts-card:hover,
.wwts-card:focus-within {
    box-shadow: var(--wwts-card-shadow-hover);
}

.wwts-card:hover .wwts-card__media {
    background: #e9e1d5;
}

.wwts-card:hover .wwts-card__image img {
    transform: scale(1.022);
}

.wwts-card:hover .wwts-card__title .elementor-heading-title {
    color: #9b8264;
}

.wwts-card:hover .wwts-card__cta .elementor-button::after,
.wwts-card__cta .elementor-button:focus-visible::after {
    transform: translateX(4px);
}

.wwts-card a:focus-visible,
.wwts-card .elementor-button:focus-visible {
    outline: 2px solid var(--wwts-color-accent);
    outline-offset: 3px;
}

/* Home / Inside Italian Design editorial cards.
   Elementor owns the surrounding grid. Large mode may be applied either on
   the card root itself or on a Loop Grid wrapper that contains this card.
   Small cards keep a normal body below the image; only the large variant turns
   the body into a full-card media overlay. */
.wwts-home-inside-card {
    position: relative;
    isolation: isolate;
}

/* Inside cards use full-bleed media instead of the framed archive-card media. */
.wwts-home-inside-card .wwts-card__media {
    height: auto !important;
    min-height: 0;
    aspect-ratio: 4 / 3;
    padding: 0 !important;
    background: transparent;
}

.wwts-home-inside-card .wwts-card__image img {
    border-radius: var(--wwts-card-radius) var(--wwts-card-radius) 0 0;
}

/* Badge sits over the image for both small and large editorial cards. */
.wwts-home-inside-card .wwts-card-badge {
    position: absolute;
    top: 14px;
    left: 14px;
    z-index: 3;
    width: auto !important;
    max-width: calc(100% - 28px);
    padding: 7px 10px !important;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.92);
    box-shadow: 0 1px 4px rgba(30, 27, 23, 0.08);
    font-family: var(--wwts-font-text);
    font-size: 10px;
    font-weight: 500;
    line-height: 1;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #5a514c;
}

.wwts-home-inside-card .wwts-card-badge .elementor-widget-container,
.wwts-home-inside-card .wwts-card-badge .elementor-heading-title,
.wwts-home-inside-card .wwts-card-badge p {
    margin: 0;
    font: inherit;
    line-height: inherit;
    letter-spacing: inherit;
    text-transform: inherit;
    color: inherit;
}

/* Large editorial card: image becomes the full card background and the body
   becomes a readable overlay. The aspect ratio also gives the card intrinsic
   height when the Elementor grid does not assign an explicit row height. */
.wwts-home-inside-card.card-large,
.card-large .wwts-home-inside-card {
    aspect-ratio: 16 / 10;
    background: #1e1b17;
}

.wwts-home-inside-card.card-large .wwts-card__media,
.card-large .wwts-home-inside-card .wwts-card__media {
    position: absolute;
    inset: 0;
    z-index: 0;
    width: 100%;
    height: 100% !important;
    min-height: 0;
    aspect-ratio: auto;
    border-radius: var(--wwts-card-radius);
}

.wwts-home-inside-card.card-large .wwts-card__image img,
.card-large .wwts-home-inside-card .wwts-card__image img {
    border-radius: var(--wwts-card-radius);
}

.wwts-home-inside-card.card-large .wwts-card__body,
.card-large .wwts-home-inside-card .wwts-card__body {
    position: absolute;
    inset: 0;
    z-index: 2;
    width: 100%;
    height: 100%;
    min-height: 0;
    justify-content: flex-end;
    padding: 24px 24px 22px !important;
    background: linear-gradient(
        180deg,
        rgba(30, 27, 23, 0) 28%,
        rgba(30, 27, 23, 0.12) 48%,
        rgba(30, 27, 23, 0.88) 100%
    );
    color: #fff;
}

.wwts-card.wwts-home-inside-card.card-large .wwts-card__title .elementor-heading-title,
.card-large .wwts-card.wwts-home-inside-card .wwts-card__title .elementor-heading-title {
    font-size: 36px !important;
    font-weight: 500 !important;
    line-height: 1.05 !important;
    color: #fff !important;
}

.wwts-home-inside-card.card-large .wwts-card__description,
.card-large .wwts-home-inside-card .wwts-card__description {
    margin-top: 10px;
    color: rgba(255, 255, 255, 0.92);
}

.wwts-home-inside-card.card-large .wwts-card__footer,
.card-large .wwts-home-inside-card .wwts-card__footer {
    margin-top: 10px !important;
    padding-top: 0 !important;
}

.wwts-home-inside-card.card-large .wwts-card__footer::before,
.card-large .wwts-home-inside-card .wwts-card__footer::before {
    display: none;
}

.wwts-home-inside-card.card-large .wwts-card__cta .elementor-button,
.card-large .wwts-home-inside-card .wwts-card__cta .elementor-button {
    color: #fff !important;
}

@media (max-width: 1024px) {
    .wwts-card {
        --wwts-card-media-height: 190px;
    }

    .wwts-card--life {
        --wwts-card-media-height: 220px;
    }

    .wwts-card__media {
        padding: 10px !important;
    }

    .wwts-card__body {
        padding: 18px 18px 20px !important;
    }

    .wwts-home-inside-card.card-large .wwts-card__body,
    .card-large .wwts-home-inside-card .wwts-card__body {
        padding: 20px !important;
    }

    .wwts-card.wwts-home-inside-card.card-large .wwts-card__title .elementor-heading-title,
    .card-large .wwts-card.wwts-home-inside-card .wwts-card__title .elementor-heading-title {
        font-size: 32px !important;
    }
}

@media (max-width: 767px) {
    .wwts-card {
        --wwts-card-media-height: 200px;
    }

    .wwts-card--life {
        --wwts-card-media-height: 220px;
    }

    .wwts-card__media {
        padding: 8px !important;
    }

    .wwts-card__body {
        padding: 15px 16px 16px !important;
    }

    .wwts-card__meta {
        gap: 10px;
        margin-bottom: 12px;
    }

    .wwts-card__eyebrow {
        font-size: 9px;
    }

    .wwts-card__date {
        font-size: 10px;
    }

    .wwts-card__description {
        margin-top: 10px;
        margin-bottom: 0;
        font-size: 14px;
        line-height: 1.45;
    }

    .wwts-card__description p,
    .wwts-card__description .elementor-widget-container:not(:has(p)) {
        -webkit-line-clamp: 2;
    }

    .wwts-card__footer::before {
        margin-bottom: 14px;
    }

    .wwts-card__cta .elementor-button {
        font-size: 10.5px;
    }

    .wwts-card__cta .elementor-button::after {
        font-size: 18px;
    }

    .wwts-home-inside-card .wwts-card-badge {
        top: 12px;
        left: 12px;
        max-width: calc(100% - 24px);
        padding: 6px 8px !important;
        font-size: 9px;
    }

    .wwts-home-inside-card.card-large,
    .card-large .wwts-home-inside-card {
        aspect-ratio: 4 / 3;
    }

    .wwts-home-inside-card.card-large .wwts-card__body,
    .card-large .wwts-home-inside-card .wwts-card__body {
        padding: 18px !important;
    }

    .wwts-card.wwts-home-inside-card.card-large .wwts-card__title .elementor-heading-title,
    .card-large .wwts-card.wwts-home-inside-card .wwts-card__title .elementor-heading-title {
        font-size: 28px !important;
    }
}

@media (prefers-reduced-motion: reduce) {
    .wwts-card,
    .wwts-card__media,
    .wwts-card__image img,
    .wwts-card__title .elementor-heading-title,
    .wwts-card__cta .elementor-button::after {
        transition: none;
    }
}
