.piguchingallery {
    --pg-accent: #176b59;
    --pg-accent-soft: #eaf5f1;
    --pg-text: #24332f;
    --pg-muted: #6b7975;
    color: var(--pg-text);
    padding-block: clamp(1rem, 3vw, 2.5rem);
}

.piguchingallery__header {
    display: flex;
    flex-wrap: wrap;
    align-items: end;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 2rem;
    padding: clamp(1.25rem, 3vw, 2rem);
    border-radius: 1.25rem;
    background: linear-gradient(135deg, #edf7f3, #f7faf9);
    border: 1px solid #deebe5;
}

.piguchingallery__eyebrow {
    margin: 0 0 .45rem;
    color: var(--pg-accent);
    font-size: .78rem;
    font-weight: 750;
    letter-spacing: .12em;
    text-transform: uppercase;
}

.piguchingallery__header h1 {
    margin: 0;
    font-size: clamp(1.8rem, 4vw, 2.7rem);
    font-weight: 750;
    letter-spacing: -.035em;
}

.piguchingallery__summary {
    margin: .65rem 0 0;
    color: var(--pg-muted);
}

.piguchingallery__count {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    padding: .65rem .9rem;
    border-radius: 999px;
    background: white;
    border: 1px solid #dce9e3;
    color: var(--pg-accent);
    font-size: .9rem;
    font-weight: 700;
    white-space: nowrap;
}

.piguchingallery-category {
    margin-block: 2.5rem;
}

.piguchingallery__category-heading {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: .5rem 1rem;
    margin-bottom: 1rem;
    padding-bottom: .8rem;
    border-bottom: 1px solid #e2e9e6;
}

.piguchingallery__category-heading h2 {
    margin: 0;
    font-size: clamp(1.2rem, 2.5vw, 1.6rem);
    font-weight: 700;
    overflow-wrap: anywhere;
}

.piguchingallery__category-count {
    color: var(--pg-muted);
    font-size: .9rem;
    white-space: nowrap;
}

.piguchingallery__grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: clamp(.75rem, 2vw, 1.25rem);
}

.piguchingallery__card {
    min-width: 0;
    margin: 0;
    overflow: hidden;
    background: #fff;
    border: 1px solid #e5ebe8;
    border-radius: .9rem;
    box-shadow: 0 3px 12px rgb(25 55 44 / 5%);
    transition: box-shadow .2s ease, transform .2s ease;
}

.piguchingallery__image-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    height: clamp(145px, 23vw, 250px);
    padding: .5rem;
    background: #f4f6f5;
}

.piguchingallery__image {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.piguchingallery__caption {
    padding: .75rem .85rem;
}

.piguchingallery__filename {
    margin: 0;
    color: #35433e;
    font-size: .85rem;
    line-height: 1.45;
    overflow-wrap: anywhere;
}

.piguchingallery__notice {
    padding: 1.25rem;
    border-radius: .8rem;
}

@media (min-width: 600px) {
    .piguchingallery__grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (min-width: 1000px) {
    .piguchingallery__grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

@media (min-width: 1400px) {
    .piguchingallery__grid {
        grid-template-columns: repeat(5, minmax(0, 1fr));
    }
}

@media (hover: hover) {
    .piguchingallery__card:hover {
        transform: translateY(-3px);
        box-shadow: 0 10px 24px rgb(25 55 44 / 12%);
    }
}

@media (prefers-reduced-motion: reduce) {
    .piguchingallery__card {
        transition: none;
    }
}

/* Navegación compacta en árbol */
.piguchingallery__breadcrumbs {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .4rem;
    margin: 0 0 1rem;
    font-size: .92rem;
}

.piguchingallery__layout {
    display: grid;
    grid-template-columns: minmax(210px, 270px) minmax(0, 1fr);
    align-items: start;
    gap: 1.5rem;
}

.piguchingallery__tree-panel {
    min-width: 0;
    padding: 1rem;
    border: 1px solid #e0e8e4;
    border-radius: .75rem;
    background: #f8faf9;
}

.piguchingallery__tree-title {
    margin: 0 0 .75rem;
    padding-bottom: .65rem;
    border-bottom: 1px solid #e0e8e4;
    font-size: 1.05rem;
}

.piguchingallery__tree-root,
.piguchingallery__tree-row {
    display: flex;
    align-items: center;
    gap: .4rem;
    min-width: 0;
}

.piguchingallery__tree-root {
    padding: .45rem .25rem;
    border-bottom: 1px solid #e0e8e4;
}

.piguchingallery__tree-list {
    list-style: none;
    margin: 0;
    padding-left: 1rem;
    border-left: 1px solid #d9e4de;
}

.piguchingallery__tree-item {
    margin: 0;
    padding: .12rem 0;
}

.piguchingallery__tree-marker {
    flex: 0 0 1rem;
    color: #74827c;
    text-align: center;
    font-size: .85rem;
}

.piguchingallery__tree-link {
    display: flex;
    align-items: center;
    gap: .35rem;
    min-width: 0;
    flex: 1;
    padding: .35rem .3rem;
    border-radius: .35rem;
    color: #34443d;
    text-decoration: none;
}

.piguchingallery__tree-link:hover,
.piguchingallery__tree-link.is-current,
.piguchingallery__tree-root a[aria-current="page"] {
    background: #e6f2ec;
    color: #176b59;
}

.piguchingallery__tree-link.is-current {
    font-weight: 700;
}

.piguchingallery__tree-folder {
    flex: 0 0 auto;
    font-size: .95rem;
}

.piguchingallery__tree-name {
    min-width: 0;
    overflow-wrap: anywhere;
}

.piguchingallery__tree-count {
    flex: 0 0 auto;
    color: #6b7975;
    font-size: .75rem;
    white-space: nowrap;
}

.piguchingallery__content {
    min-width: 0;
}

.piguchingallery__content .piguchingallery-category {
    margin-block: 0 1.25rem;
}

.piguchingallery__folder-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr));
    gap: .5rem;
}

.piguchingallery__folder-link {
    display: flex;
    align-items: center;
    gap: .55rem;
    min-width: 0;
    padding: .65rem .75rem;
    border: 1px solid #e1e9e5;
    border-radius: .55rem;
    background: #fff;
    color: #34443d;
    text-decoration: none;
}

.piguchingallery__folder-link:hover {
    border-color: #b9d8ca;
    background: #f6faf8;
}

.piguchingallery__folder-icon {
    flex: 0 0 auto;
}

.piguchingallery__folder-name {
    flex: 1;
    min-width: 0;
    overflow-wrap: anywhere;
    font-weight: 600;
}

/* Tarjetas fotográficas más compactas */
.piguchingallery__grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .65rem;
}

.piguchingallery__card {
    border-radius: .65rem;
}

.piguchingallery__image-wrap {
    height: clamp(90px, 10vw, 145px);
    padding: .3rem;
}

.piguchingallery__caption {
    padding: .45rem .6rem;
}

.piguchingallery__filename {
    font-size: .78rem;
    line-height: 1.3;
}

.piguchingallery__content .piguchingallery__category-heading {
    margin-bottom: .65rem;
    padding-bottom: .5rem;
}

@media (min-width: 600px) {
    .piguchingallery__grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (min-width: 1000px) {
    .piguchingallery__grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (min-width: 1400px) {
    .piguchingallery__grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

@media (max-width: 760px) {
    .piguchingallery__layout {
        grid-template-columns: minmax(0, 1fr);
        gap: 1rem;
    }

    .piguchingallery__tree-panel {
        padding: .75rem;
    }

    .piguchingallery__tree-list {
        padding-left: .75rem;
    }

    .piguchingallery__image-wrap {
        height: clamp(95px, 28vw, 145px);
    }
}

/* Tarjetas de álbum en vertical: mosaico, nombre y contador */
.piguchingallery__folder-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 190px), 1fr));
    gap: .75rem;
    align-items: stretch;
}

.piguchingallery__folder-link {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    gap: .55rem;
    min-width: 0;
    min-height: 230px;
    padding: .75rem;
    border: 1px solid #e1e9e5;
    border-radius: .65rem;
    background: #fff;
    color: #34443d;
    text-decoration: none;
    writing-mode: horizontal-tb;
}

.piguchingallery__folder-link:hover {
    border-color: #b9d8ca;
    background: #f6faf8;
}

.piguchingallery__folder-preview {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-rows: repeat(2, minmax(0, 1fr));
    gap: 3px;
    width: 100%;
    height: 145px;
    min-width: 0;
    flex: 0 0 145px;
    overflow: hidden;
    border-radius: 7px;
    background: #edf0ed;
}

.piguchingallery__folder-preview img {
    display: block;
    width: 100% !important;
    height: 100% !important;
    min-width: 0;
    min-height: 0;
    max-width: none !important;
    max-height: none !important;
    object-fit: cover;
}

.piguchingallery__folder-preview img:only-child {
    grid-column: 1 / -1;
    grid-row: 1 / -1;
}

.piguchingallery__folder-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 145px;
    flex: 0 0 145px;
    font-size: 2rem;
    background: #f5f8f6;
    border-radius: 7px;
}

.piguchingallery__folder-name {
    display: block;
    flex: 0 0 auto;
    width: 100%;
    min-width: 0;
    font-size: .9rem;
    font-weight: 600;
    line-height: 1.35;
    white-space: normal;
    overflow-wrap: break-word;
    word-break: normal;
    writing-mode: horizontal-tb;
}

.piguchingallery__folder-link .piguchingallery__tree-count {
    display: block;
    margin-top: auto;
    flex: 0 0 auto;
    font-size: .75rem;
    line-height: 1.3;
    white-space: normal;
}

@media (max-width: 600px) {
    .piguchingallery__folder-list {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: .55rem;
    }

    .piguchingallery__folder-link {
        min-height: 205px;
        padding: .55rem;
    }

    .piguchingallery__folder-preview,
    .piguchingallery__folder-icon {
        height: 112px;
        min-height: 112px;
        flex-basis: 112px;
    }

    .piguchingallery__folder-name {
        font-size: .84rem;
    }
}
