/*
   pages.css — Catalog & Product pages
   Extends style.css (linked before this file in all pages)
*/

/* ─── Shared: Nav active state ─────────────────────────────── */
.nav-active {
    color: var(--color-brand-green-light) !important;
}

/* ─── Shared: Product item link wrapper (index.html) ─────── */
.product-item-link {
    display: block;
    text-decoration: none;
    color: inherit;
    grid-column: span 12;
}

.product-grid > .product-item-link:nth-child(1) { grid-column: 1 / 7; }
.product-grid > .product-item-link:nth-child(2) { grid-column: 8 / 13; padding-top: 12rem; }
.product-grid > .product-item-link:nth-child(3) { grid-column: 3 / 9; }


@media (max-width: 1024px) {
    .product-grid > .product-item-link:nth-child(1),
    .product-grid > .product-item-link:nth-child(2),
    .product-grid > .product-item-link:nth-child(3) {
        grid-column: span 1;
        padding-top: 0;
    }
}

@media (max-width: 640px) {
    .product-grid > .product-item-link {
        flex: 0 0 80vw;
        scroll-snap-align: start;
        padding-top: 0 !important;
        grid-column: unset;
    }
}

/* ─── Shared: Collection CTA (index.html) ─────────────────── */
.collection-cta {
    text-align: center;
    padding-top: 8rem;
}

/* ─── Shared: Breadcrumb ────────────────────────────────────── */
.breadcrumb {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: var(--color-text-muted);
    margin-bottom: 2.5rem;
}

.breadcrumb a {
    color: var(--color-text-muted);
    text-decoration: none;
    transition: color 0.3s var(--ease-expo);
}

.breadcrumb a:hover { color: var(--color-brand-green-light); }
.breadcrumb-sep { opacity: 0.35; }
.breadcrumb-current { color: var(--color-text); }

/* ─── Shared: Page Hero ─────────────────────────────────────── */
.page-hero {
    padding: 16rem 5% 8rem;
    background: var(--color-bg);
    position: relative;
}

.page-hero--compact {
    padding-bottom: 4rem;
}

/* ─────────────────────────────────────────────────────────────
   BRAND ABOUT SECTION
───────────────────────────────────────────────────────────── */
.brand-about-section {
    padding: 7rem 5%;
    background: var(--color-bg);
    border-bottom: 1px solid rgba(255,255,255,0.06);
}

.brand-about-inner {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 6rem;
    align-items: start;
    max-width: 1400px;
}

.brand-about-label {
    padding-top: 0.4rem;
}

.brand-about-title {
    font-size: clamp(2rem, 3.5vw, 3.5rem);
    font-weight: 400;
    line-height: 1.1;
    letter-spacing: -0.02em;
    color: var(--color-text);
    margin-bottom: 2rem;
}

.brand-about-text {
    font-size: clamp(0.9rem, 1.1vw, 1.05rem);
    color: var(--color-text-muted);
    line-height: 1.85;
    max-width: 56ch;
    margin-bottom: 3.5rem;
}

.brand-about-stats {
    display: flex;
    gap: 4rem;
}

.brand-stat {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.stat-value {
    font-family: var(--font-heading);
    font-size: clamp(1.8rem, 2.5vw, 2.6rem);
    font-weight: 600;
    color: var(--color-brand-green-light);
    line-height: 1;
    letter-spacing: -0.01em;
}

.stat-label {
    font-size: 0.68rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--color-text-muted);
    font-weight: 700;
}

@media (max-width: 768px) {
    .brand-about-inner {
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    .brand-about-stats {
        gap: 2.5rem;
    }

    .brand-about-section {
        padding: 4rem 5%;
    }
}

/* ─────────────────────────────────────────────────────────────
   CATALOG PAGE
───────────────────────────────────────────────────────────── */
.catalog-section {
    padding: 6rem 5% var(--section-padding);
    background: var(--color-bg);
}

.catalog-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 0.8rem;
    margin-bottom: 5rem;
}

.filter-btn {
    padding: 0.6rem 1.6rem;
    border: 1px solid rgba(255,255,255,0.18);
    border-radius: 999px;
    background: transparent;
    color: var(--color-text-muted);
    font-family: var(--font-body);
    font-size: 0.85rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    cursor: pointer;
    transition: background 0.22s, color 0.22s, border-color 0.22s;
}

.filter-btn:hover {
    background: rgba(255,255,255,0.06);
    color: var(--color-text-primary);
}

.filter-btn.active {
    background: var(--color-brand-green-light);
    border-color: var(--color-brand-green-light);
    color: #0B0E0B;
    font-weight: 600;
}

.catalog-section.section-light .filter-btn {
    border-color: rgba(11,14,11,0.18);
    color: rgba(11,14,11,0.55);
}

.catalog-section.section-light .filter-btn:hover {
    background: rgba(11,14,11,0.05);
    color: var(--color-obsidian);
}

.catalog-section.section-light .filter-btn.active {
    background: var(--color-brand-green-light);
    border-color: var(--color-brand-green-light);
    color: #0B0E0B;
}

.catalog-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 3rem;
}

.catalog-card {
    display: block;
    position: relative;
    text-decoration: none;
    color: inherit;
}

.catalog-card-img {
    width: 100%;
    aspect-ratio: 1 / 1;
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    overflow: hidden;
    position: relative;
    margin-bottom: 2rem;
    border: 1px solid rgba(255, 255, 255, 0.05);
    box-shadow: var(--shadow-soft);
}

.catalog-card-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    transition: none;
    background: var(--color-surface);
}

.catalog-card-img img:not([src]), 
.catalog-card-img img[src=""], 
.catalog-card-img img[src*="undefined"] {
    opacity: 0;
}

.catalog-card-img img[onerror] {
    opacity: 1;
}

.catalog-card:hover .catalog-card-img img { transform: none; }

.catalog-card-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.38);
    display: grid;
    place-items: center;
    opacity: 0;
    transition: opacity 0.4s var(--ease-expo);
}

.catalog-card:hover .catalog-card-overlay { opacity: 1; }

.catalog-card-meta {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 1rem;
}

.catalog-card-name {
    font-size: clamp(1.3rem, 2vw, 1.8rem);
    font-family: var(--font-heading);
    font-weight: 400;
    margin-bottom: 0.4rem;
    color: var(--color-text);
}

.catalog-card-series {
    font-size: var(--fs-body);
    color: var(--color-text-muted);
}

.catalog-card-price {
    display: none;
}

/* ─────────────────────────────────────────────────────────────
   PRODUCT PAGE
───────────────────────────────────────────────────────────── */
.product-section {
    padding: 10rem 5% var(--section-padding);
    background: var(--color-bg);
}

.product-layout {
    display: grid;
    grid-template-columns: 1.1fr 0.9fr;
    gap: 7rem;
    align-items: start;
    max-width: 1400px;
    margin: 0 auto;
}

.product-sticky-img {
    position: sticky;
    top: 10rem;
}

.product-img-frame {
    width: 100%;
    aspect-ratio: 1 / 1;
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.05);
    box-shadow: var(--shadow-premium);
}

.product-img-frame img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.product-info-panel {
    padding-top: 1rem;
}

.product-info-panel .eyebrow {
    margin-bottom: 1.2rem;
}

.product-display-name {
    font-family: var(--font-heading);
    font-size: clamp(2.8rem, 4.5vw, 5rem);
    font-weight: 400;
    line-height: 1;
    letter-spacing: -0.02em;
    margin-bottom: 1.5rem;
    color: var(--color-text);
}

.product-display-price {
    display: none;
}

.product-separator {
    width: 100%;
    height: 1px;
    background: rgba(255, 255, 255, 0.08);
    margin-bottom: 3rem;
}

.specs-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 3rem;
}

.specs-table tr { border-bottom: 1px solid rgba(255, 255, 255, 0.06); }
.specs-table tr:first-child { border-top: 1px solid rgba(255, 255, 255, 0.06); }

.specs-table td {
    padding: 1.2rem 0;
    font-size: var(--fs-body);
    vertical-align: middle;
}

.specs-table td:first-child {
    color: var(--color-text-muted);
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.68rem;
    letter-spacing: 0.12em;
    width: 38%;
}

.specs-table td:last-child { color: var(--color-text); }

.product-description {
    margin-bottom: 3rem;
    color: rgba(255, 255, 255, 0.7);
    line-height: 1.8;
}

.product-cta {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.product-cta .btn-primary {
    width: 100%;
    text-align: center;
    display: block;
}

.related-section {
    padding: var(--section-padding) 5%;
    background: #050605;
}

.related-section .section-title {
    margin-bottom: 5rem;
}

.related-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 2rem;
}

.related-grid .catalog-card:nth-child(n+5) {
    display: none;
}

.related-grid.related-expanded .catalog-card:nth-child(n+5) {
    display: block;
}

.related-toggle-wrap {
    display: flex;
    justify-content: center;
    margin-top: 3rem;
}

.related-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 1px solid rgba(255,255,255,0.18);
    background: transparent;
    color: var(--color-text-muted);
    cursor: pointer;
    transition: border-color 0.25s cubic-bezier(0.32,0.72,0,1),
                color 0.25s cubic-bezier(0.32,0.72,0,1),
                transform 0.35s cubic-bezier(0.32,0.72,0,1);
}

.related-toggle:hover {
    border-color: rgba(255,255,255,0.4);
    color: var(--color-text);
}

.related-toggle.expanded svg {
    transform: rotate(180deg);
}

.related-toggle svg {
    transition: transform 0.35s cubic-bezier(0.32,0.72,0,1);
}

@media (max-width: 1024px) {
    .catalog-grid { grid-template-columns: 1fr 1fr; }
    .product-layout {
        grid-template-columns: 1fr;
        gap: 4rem;
    }
    .product-sticky-img { position: static; }
    .related-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 640px) {
    .catalog-grid { grid-template-columns: 1fr; }
    .related-grid { grid-template-columns: repeat(2, 1fr); gap: 1.2rem; }
    .product-display-name { font-size: clamp(2rem, 8vw, 3rem); }
    .product-layout { gap: 3rem; }
}

/* ─────────────────────────────────────────────────────────────
   LIGHT SECTION OVERRIDES
───────────────────────────────────────────────────────────── */
.catalog-section.section-light {
    background: #F4F2EE !important;
}

.catalog-section.section-light .catalog-card-img {
    box-shadow: 0 20px 56px -8px rgba(11, 14, 11, 0.14), 0 6px 16px -4px rgba(11, 14, 11, 0.07);
    border-color: rgba(11, 14, 11, 0.06);
}

.catalog-section.section-light .catalog-card-name {
    color: var(--color-obsidian);
}

.catalog-section.section-light .catalog-card-series {
    color: rgba(11, 14, 11, 0.48);
}

/* Fix: 'Vedi Prodotto' must be white on dark overlay */
.catalog-section.section-light .btn-text {
    color: #FFF !important;
    border-color: rgba(255, 255, 255, 0.3);
}


.product-section.section-light {
    background: #F4F2EE !important;
}

.product-section.section-light .product-img-frame {
    box-shadow: 0 40px 100px -16px rgba(11, 14, 11, 0.20), 0 12px 32px -8px rgba(11, 14, 11, 0.10);
    border-color: rgba(11, 14, 11, 0.06);
}

.product-section.section-light .specs-table tr { border-bottom-color: rgba(11, 14, 11, 0.07); }
.product-section.section-light .specs-table tr:first-child { border-top-color: rgba(11, 14, 11, 0.07); }
.product-section.section-light .specs-table td:first-child { color: rgba(11, 14, 11, 0.45); }
.product-section.section-light .specs-table td:last-child { color: var(--color-obsidian); }

.product-section.section-light .product-separator { background: rgba(11, 14, 11, 0.08); }
.product-section.section-light .product-description { color: rgba(11, 14, 11, 0.58); }
.product-section.section-light .product-display-name { color: var(--color-obsidian); }

.legal-section.section-light {
    background: #F4F2EE !important;
}

/* ─────────────────────────────────────────────────────────────
   LEGAL PAGES
───────────────────────────────────────────────────────────── */
.legal-section {
    padding: 10rem 5% var(--section-padding);
    background: var(--color-bg);
}

.legal-content {
    max-width: 780px;
    margin: 0 auto;
}

.legal-content h2 {
    font-family: var(--font-heading);
    font-size: clamp(1.8rem, 3vw, 2.8rem);
    font-weight: 400;
    color: #0B0E0B;
    margin-top: 5rem;
    margin-bottom: 1.5rem;
    letter-spacing: -0.01em;
    text-transform: lowercase;
}

.legal-content h2::first-letter {
    text-transform: uppercase;
}

.legal-content h2:first-child {
    margin-top: 0;
}

.legal-content p {
    font-size: var(--fs-body);
    color: #0B0E0B;
    line-height: 1.85;
    margin-bottom: 1.6rem;
    max-width: 65ch;
}

.legal-content ul {
    list-style: none;
    padding: 0;
    margin-bottom: 2rem;
}

.legal-content ul li {
    font-size: var(--fs-body);
    color: #0B0E0B;
    line-height: 1.85;
    padding-left: 1.6rem;
    position: relative;
    margin-bottom: 0.8rem;
    max-width: 65ch;
}

.legal-content ul li::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0.7em;
    width: 6px;
    height: 6px;
    background: var(--color-brand-green-light);
    border-radius: 1px;
}

.legal-content strong {
    color: #0B0E0B;
    font-weight: 600;
}

.legal-content a {
    color: var(--color-brand-green-light);
    text-decoration: none;
    border-bottom: 1px solid rgba(45, 106, 79, 0.3);
    transition: all 0.3s var(--ease-expo);
}

.legal-content a:hover {
    color: var(--color-accent-mint);
    border-bottom-color: var(--color-accent-mint);
}

.legal-note {
    display: block;
    padding: 1.5rem 2rem;
    background: rgba(45, 106, 79, 0.04);
    border: 1px solid rgba(11, 14, 11, 0.1);
    border-radius: var(--radius-md);
    font-size: 0.85rem;
    color: rgba(11, 14, 11, 0.6);
    margin-bottom: 4rem;
    position: relative;
    box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.8);
}

.legal-note::before {
    content: '';
    position: absolute;
    inset: -1px;
    padding: 1px;
    background: linear-gradient(to bottom, rgba(255,255,255,0.1), transparent);
    border-radius: inherit;
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    pointer-events: none;
}

.legal-updated {
    font-size: 0.7rem;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.2em;
    margin-bottom: 4rem;
    display: block;
    opacity: 0.6;
}

/* ─── Catalog Toolbar: Search + Sort ─────────────────────────────── */
.catalog-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 2rem;
    margin-bottom: 3rem;
    flex-wrap: wrap;
}

.catalog-search {
    flex: 1;
    min-width: 280px;
    max-width: 400px;
}

.search-wrapper {
    position: relative;
}

.search-input-wrap {
    display: flex;
    align-items: center;
    background: var(--color-surface);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: var(--radius-md);
    padding: 0 1rem;
    transition: border-color 0.3s;
}

.search-input-wrap:focus-within {
    border-color: var(--color-brand-green-light);
}

.catalog-section.section-light .search-input-wrap {
    border-color: rgba(11,14,11,0.15);
    background: rgba(11,14,11,0.03);
}

.search-icon {
    color: var(--color-text-muted);
    flex-shrink: 0;
}

.search-input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    padding: 1rem;
    font-family: var(--font-body);
    font-size: 0.95rem;
    color: var(--color-text-primary);
}

.search-input::placeholder {
    color: var(--color-text-muted);
}

.search-clear {
    background: none;
    border: none;
    color: var(--color-text-muted);
    font-size: 1.4rem;
    cursor: pointer;
    padding: 0 0.5rem;
    opacity: 0.6;
    transition: opacity 0.2s;
}

.search-clear:hover {
    opacity: 1;
}

.search-results {
    position: absolute;
    top: calc(100% + 0.5rem);
    left: 0;
    right: 0;
    background: var(--color-surface);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: var(--radius-md);
    max-height: 400px;
    overflow-y: auto;
    z-index: 100;
    display: none;
    box-shadow: 0 20px 40px rgba(0,0,0,0.3);
}

.search-results.active {
    display: block;
    animation: fadeIn 0.2s ease-out;
}

.catalog-section.section-light .search-results {
    border-color: rgba(11,14,11,0.15);
    background: var(--color-bg);
    box-shadow: 0 20px 40px rgba(0,0,0,0.1);
}

.search-result-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    text-decoration: none;
    color: inherit;
    transition: background 0.2s;
}

.search-result-item:hover {
    background: rgba(255,255,255,0.05);
}

.catalog-section.section-light .search-result-item:hover {
    background: rgba(11,14,11,0.05);
}

.search-result-item img {
    width: 50px;
    height: 50px;
    object-fit: cover;
    border-radius: var(--radius-sm);
}

.search-result-info {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.search-result-name {
    font-size: 0.9rem;
    font-weight: 500;
}

.search-result-series {
    font-size: 0.75rem;
    color: var(--color-text-muted);
}

.search-no-results, .search-show-more {
    padding: 1.5rem;
    text-align: center;
    color: var(--color-text-muted);
    font-size: 0.9rem;
}

.search-show-more {
    cursor: pointer;
    color: var(--color-brand-green-light);
    border-top: 1px solid rgba(255,255,255,0.1);
}

.catalog-section.section-light .search-show-more {
    border-color: rgba(11,14,11,0.1);
}

/* ─── Sort Select ───────────────────────────────────────────────── */
.catalog-sort {
    flex-shrink: 0;
}

.sort-select {
    padding: 0.7rem 2.5rem 0.7rem 1rem;
    background: var(--color-surface);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: var(--radius-md);
    font-family: var(--font-body);
    font-size: 0.85rem;
    color: var(--color-text-primary);
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23aaa' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
}

.catalog-section.section-light .sort-select {
    border-color: rgba(11,14,11,0.15);
    background-color: rgba(11,14,11,0.03);
}

.sort-select:focus {
    outline: none;
    border-color: var(--color-brand-green-light);
}

/* ─── Results Count ─────────────────────────────────────────────── */
.catalog-results-info {
    margin-bottom: 2rem;
    font-size: 0.85rem;
    color: var(--color-text-muted);
}

/* ─── Pagination ──────────────────────────────────────────────── */
.catalog-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    margin-top: 5rem;
    flex-wrap: wrap;
}

.pagination-btn {
    min-width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--color-surface);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: var(--radius-md);
    color: var(--color-text-muted);
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
}

.catalog-section.section-light .pagination-btn {
    border-color: rgba(11,14,11,0.15);
    background: rgba(11,14,11,0.03);
}

.pagination-btn:hover {
    border-color: var(--color-brand-green-light);
    color: var(--color-brand-green-light);
}

.pagination-btn.active {
    background: var(--color-brand-green-light);
    border-color: var(--color-brand-green-light);
    color: #0B0E0B;
    font-weight: 600;
}

.pagination-ellipsis {
    color: var(--color-text-muted);
    padding: 0 0.5rem;
}

/* Responsive */
@media (max-width: 768px) {
    .catalog-toolbar {
        flex-direction: column;
        align-items: stretch;
    }
    
    .catalog-search {
        max-width: 100%;
    }
    
    .catalog-sort {
        width: 100%;
    }
    
    .sort-select {
        width: 100%;
    }
    
    .catalog-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 2rem;
    }
}

@media (max-width: 480px) {
    .catalog-grid {
        display: flex;
        flex-direction: row;
        overflow-x: auto;
        scroll-snap-type: x mandatory;
        -webkit-overflow-scrolling: touch;
        gap: 1.2rem;
        padding-bottom: 1.5rem;
    }
    .catalog-grid::-webkit-scrollbar { display: none; }
    .catalog-grid { -ms-overflow-style: none; scrollbar-width: none; }

    .catalog-grid > .catalog-card {
        flex: 0 0 78vw;
        scroll-snap-align: start;
    }
}
