/** Responsive CSS for RC Taxonomy Grid Plugin
 * File: assets/css/front.css
 * Author: Rober Crea
 * License: GPLv2 or later
 * License URI: http://www.gnu.org/licenses/gpl-2.0.html
 */


/**
 * Custom properties: set them on the group (`.rctagr-taxonomies`, `.rctagr-{style}-style`) or on a parent
 * to restyle a grid from the theme or Additional CSS. Every one falls back to the style's own default.
 *
 *   --rctagr-gap              Space between items.
 *   --rctagr-columns          Columns from 360px (Grid) / 400px (Cards) up; the three below win over it.
 *   --rctagr-columns-mobile   Grid ≥ 360px (2), Cards ≥ 400px (2).
 *   --rctagr-columns-tablet   Grid ≥ 720px (3), Cards ≥ 600px (3).
 *   --rctagr-columns-desktop  Grid ≥ 1270px (4), Cards ≥ 900px (4) and ≥ 1200px (5).
 *   --rctagr-text             Name color.
 *   --rctagr-bg               Item background (name background in Grid).
 *   --rctagr-bg-hover         Item background on hover.
 *   --rctagr-accent           Hover color (Classic text, Minimalist Text background).
 *   --rctagr-accent-text      Text on the accent color (Minimalist Text).
 *   --rctagr-border           Border color (List, Cards, Classic).
 *   --rctagr-radius           Corner radius (List, Cards, Overlay, Classic, Minimalist Text).
 *   --rctagr-description      Description color (Grid uses --rctagr-text on --rctagr-bg).
 *   --rctagr-image-ratio      Image proportion, e.g. `4 / 3` (Grid, Cards and Classic need the
 *                             `rctagr-has-image-ratio` class on the group; Overlay always uses it, default 1 / 1).
 *
 * The group's own display options (columns per device, gap, image ratio) are printed as these properties in
 * the group's `style` attribute, so they win over a stylesheet; use `!important` to override them.
 *
 * Theme presets work too, e.g. `.rctagr-taxonomies { --rctagr-accent: var(--wp--preset--color--primary); }`.
 */

/** Common */
h1.rctagr-taxonomy-name,
h2.rctagr-taxonomy-name,
h3.rctagr-taxonomy-name,
h4.rctagr-taxonomy-name,
h5.rctagr-taxonomy-name,
h6.rctagr-taxonomy-name,
p.rctagr-taxonomy-name,
div.rctagr-taxonomy-name,
span.rctagr-taxonomy-name {
    margin: 0;
    padding: 0;
    font-size: 16px;
    font-weight: 400;
    transition: all 0.35s ease-in-out;
}

.rctagr-taxonomy-description {
    display: block;
    margin: 4px 0 0;
    font-size: 14px;
    font-weight: 400;
    line-height: 1.4;
    color: var(--rctagr-description, #555555);
}

.rctagr-has-image-ratio.rctagr-grid-style .rctagr-taxonomy img,
.rctagr-has-image-ratio.rctagr-cards-style .rctagr-taxonomy img {
    width: 100%;
    height: auto;
    aspect-ratio: var(--rctagr-image-ratio);
    object-fit: cover;
}

.rctagr-has-image-ratio.rctagr-classic-style .rctagr-taxonomy img {
    width: auto;
    height: 125px;
    aspect-ratio: var(--rctagr-image-ratio);
}

/** Grid Style */
.rctagr-grid-style {
    display: grid;
    width: 100%;
    align-items: end;
    gap: var(--rctagr-gap, 20px);
}

.rctagr-grid-style .rctagr-taxonomy {
    background-color: transparent;
    display: grid;
    align-items: center;
    text-align: center;
    color: var(--rctagr-text, #ffffff);
    font-size: 16px;
    font-weight: 600;
    text-decoration: none !important;
}

.rctagr-grid-style .rctagr-taxonomy .rctagr-taxonomy-name {
    background-color: var(--rctagr-bg, #111111);
    color: var(--rctagr-text, #ffffff);
    padding: 10px 5px;
}

.rctagr-grid-style .rctagr-taxonomy img {
    margin: 0 auto;
}

.rctagr-grid-style .rctagr-taxonomy .rctagr-taxonomy-description {
    margin: 0;
    padding: 0 5px 10px;
    background-color: var(--rctagr-bg, #111111);
    color: var(--rctagr-text, #ffffff);
}

.rctagr-grid-style .rctagr-taxonomy:hover .rctagr-taxonomy-name {
    background-color: var(--rctagr-bg-hover, #222222);
}

@media only screen and (min-width: 360px) {
    .rctagr-grid-style {
        grid-template-columns: repeat(var(--rctagr-columns-mobile, var(--rctagr-columns, 2)), 1fr);
    }
}

@media only screen and (min-width: 720px) {
    .rctagr-grid-style {
        grid-template-columns: repeat(var(--rctagr-columns-tablet, var(--rctagr-columns, 3)), 1fr);
    }
}

@media only screen and (min-width: 1270px) {
    .rctagr-grid-style {
        grid-template-columns: repeat(var(--rctagr-columns-desktop, var(--rctagr-columns, 4)), 1fr);
    }
}


/** Circles Style */
.rctagr-circles-style {
    display: grid;
    width: 100%;
    gap: var(--rctagr-gap, 20px);
    grid-template-columns: repeat(auto-fit, 120px);
}

.rctagr-circles-style .rctagr-taxonomy {
    background-color: transparent;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    text-decoration: none !important;
}

.rctagr-circles-style .rctagr-taxonomy .rctagr-taxonomy-name {
    transition: all 0.35s ease-in-out;
    color: var(--rctagr-text, #000000);
    padding: 10px 5px;
    font-size: 16px;
    font-weight: 600;
}

.rctagr-circles-style .rctagr-taxonomy img {
    width: 100%;
    height: auto;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    border-radius: 50%;
    margin: 0;
}

/** List Style */
.rctagr-list-style {
    display: flex;
    flex-direction: column;
    gap: var(--rctagr-gap, 15px);
    width: 100%;
    border: 1px solid var(--rctagr-border, #eee);
    padding: 15px;
    border-radius: var(--rctagr-radius, 4px);
}

.rctagr-list-style .rctagr-taxonomy {
    display: flex;
    align-items: center;
    gap: 15px;
    background-color: var(--rctagr-bg, #f9f9f9);
    padding: 10px;
    border-radius: var(--rctagr-radius, 4px);
    text-decoration: none !important;
    transition: all 0.2s ease-in-out;
}

.rctagr-list-style .rctagr-taxonomy:hover {
    background-color: var(--rctagr-bg-hover, #f1f1f1);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.05);
}

.rctagr-list-style .rctagr-taxonomy img {
    flex-shrink: 0;
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: var(--rctagr-radius, 4px);
}

.rctagr-list-style .rctagr-taxonomy .rctagr-taxonomy-name {
    font-size: 16px;
    font-weight: 600;
    color: var(--rctagr-text, #333);
    margin: 0;
}

/** Cards Style */
.rctagr-cards-style {
    column-count: 1;
    column-gap: var(--rctagr-gap, 20px);
    width: 100%;
}

.rctagr-cards-style .rctagr-taxonomy {
    display: inline-block;
    display: block;
    width: 100%;
    margin-bottom: var(--rctagr-gap, 20px);
    break-inside: avoid;
    background-color: var(--rctagr-bg, #ffffff);
    border: 1px solid var(--rctagr-border, #e0e0e0);
    border-radius: var(--rctagr-radius, 8px);
    overflow: hidden;
    text-decoration: none !important;
    transition: all 0.25s ease-in-out;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.rctagr-cards-style .rctagr-taxonomy:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 15px rgba(0, 0, 0, 0.1);
}

.rctagr-cards-style .rctagr-taxonomy img {
    width: 100%;
    height: auto;
    display: block;
}

.rctagr-cards-style .rctagr-taxonomy-name {
    font-size: 18px;
    font-weight: 700;
    color: var(--rctagr-text, #222);
    padding: 8px 0;
    text-align: center;
}

.rctagr-cards-style .rctagr-taxonomy-description {
    margin: 0;
    padding: 0 12px 12px;
    text-align: center;
}

@media only screen and (min-width: 400px) {
    .rctagr-cards-style {
        column-count: var(--rctagr-columns-mobile, var(--rctagr-columns, 2));
    }
}

@media only screen and (min-width: 600px) {
    .rctagr-cards-style {
        column-count: var(--rctagr-columns-tablet, var(--rctagr-columns, 3));
    }
}

@media only screen and (min-width: 900px) {
    .rctagr-cards-style {
        column-count: var(--rctagr-columns-desktop, var(--rctagr-columns, 4));
    }
}

@media only screen and (min-width: 1200px) {
    .rctagr-cards-style {
        column-count: var(--rctagr-columns-desktop, var(--rctagr-columns, 5));
    }
}

/** Overlay Style */
.rctagr-overlay-style {
    display: grid;
    gap: var(--rctagr-gap, 20px);
    grid-template-columns: repeat(auto-fit, 250px);
}

.rctagr-overlay-style .rctagr-taxonomy {
    position: relative;
    display: block;
    overflow: hidden;
    border-radius: var(--rctagr-radius, 8px);
    text-decoration: none !important;
    aspect-ratio: var(--rctagr-image-ratio, 1 / 1);
    max-height: 300px;
}

.rctagr-overlay-style .rctagr-taxonomy img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.rctagr-overlay-style .rctagr-taxonomy .rctagr-taxonomy-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;

    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;

    background: linear-gradient(to top, rgba(0, 0, 0, 0.5) 0%, rgba(0, 0, 0, 0.2) 100%);
    color: #ffffff;
    padding: 20px;
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
}

.rctagr-overlay-style .rctagr-taxonomy .rctagr-taxonomy-name {
    font-size: 20px;
    font-weight: 700;
    margin: 0 0 5px 0;
    color: var(--rctagr-text, #ffffff);
    transition: transform 0.3s ease-in-out;
    text-align: center;
    padding: 0 10px;
}

/* Hover effects */
.rctagr-overlay-style .rctagr-taxonomy:hover .rctagr-taxonomy-overlay {
    opacity: 1;
}

.rctagr-overlay-style .rctagr-taxonomy:hover img {
    transform: scale(1.1);
}

.rctagr-overlay-style .rctagr-taxonomy:hover .rctagr-taxonomy-name {
    transform: translateY(-60px);
}

@media only screen and (max-width: 959px) {
    .rctagr-overlay-style {
        justify-content: center;
    }
}

/** Classic Style */
.rctagr-classic-style {
    list-style: none;
    padding: 0;
    margin: 0;
    border: 1px solid var(--rctagr-border, #e0e0e0);
    border-radius: var(--rctagr-radius, 4px);
    overflow: hidden;
}

.rctagr-classic-style .rctagr-taxonomy {
    display: flex;
    justify-content: space-between;
    align-items: center;

    padding: 12px 15px;
    border-bottom: 1px solid var(--rctagr-border, #e0e0e0);

    text-decoration: none !important;
    color: var(--rctagr-text, #333333);
    font-size: 14px;
    transition: background-color 0.2s ease;
}

.rctagr-classic-style .rctagr-taxonomy img {
    width: auto;
    max-height: 125px;
    object-fit: cover;
    border-radius: 4px;
    margin-right: 15px;
}

.rctagr-classic-style .rctagr-taxonomy:last-child {
    border-bottom: none;
}

.rctagr-classic-style .rctagr-taxonomy:hover {
    background-color: var(--rctagr-bg-hover, #f5f5f5);
    color: var(--rctagr-accent, #0073aa);
}

.rctagr-classic-style .rctagr-taxonomy-name {
    font-weight: 500;
}

.rctagr-classic-style .rctagr-taxonomy-description,
.rctagr-list-style .rctagr-taxonomy-description {
    flex: 1;
    margin: 0;
}

.rctagr-classic-style .rctagr-taxonomy-description {
    margin-left: 15px;
}

/* Post/product count */
.rctagr-classic-style .rctagr-taxonomy-count {
    background-color: #e9e9e9;
    color: #555555;
    padding: 3px 9px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    margin-left: 15px;
}

/** Minimalist Text Style */
.rctagr-minimalist-text-style {
    display: flex;
    flex-wrap: wrap;
    gap: var(--rctagr-gap, 10px);
    padding: 5px;
    justify-content: flex-start;
}

.rctagr-minimalist-text-style .rctagr-taxonomy {
    display: inline-block;
    background-color: var(--rctagr-bg, #f0f0f1);
    color: var(--rctagr-text, #3c434a);
    padding: 8px 16px;
    border-radius: var(--rctagr-radius, 20px);

    text-decoration: none !important;
    font-size: 14px;
    font-weight: 500;
    line-height: 1.5;

    border: 1px solid transparent;
    transition: all 0.2s ease-in-out;
}

.rctagr-minimalist-text-style .rctagr-taxonomy:hover {
    background-color: var(--rctagr-accent, #007cba);
    color: var(--rctagr-accent-text, #ffffff);
    border-color: var(--rctagr-accent, #006ba1);
    transform: translateY(-2px);
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.08);
}