/* The /widgets/ gallery. Builds on landing.css (tokens, header, buttons, footer). */

.gallery-intro {
    display: grid;
    justify-items: center;
    gap: clamp(16px, 2vw, 24px);
    padding: calc(var(--header-height) + clamp(56px, 9vw, 120px)) 0 clamp(40px, 5vw, 64px);
    text-align: center;
}
.gallery-intro h1 { font-size: clamp(3.1rem, 8.6vw, 6rem); line-height: .95; letter-spacing: -.035em; font-weight: 700; }
.gallery-intro p { max-width: 46ch; color: var(--text-soft); font-size: clamp(1.1rem, 1.5vw, 1.32rem); line-height: 1.45; letter-spacing: -.008em; }

/* ---- Filters: two quiet segmented controls that stay in reach while scrolling ---- */
.gallery-filters {
    position: sticky;
    z-index: 10;
    top: calc(var(--header-height) + 10px);
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
}
.gallery-filters .glass-segments {
    background: var(--glass);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    backdrop-filter: saturate(180%) blur(20px);
    box-shadow: inset 0 0 0 1px var(--glass-line), 0 8px 24px -14px var(--shadow-deep);
}
/* Same selected state as the homepage Premium tabs. */
.gallery-filters button, .widget-detail-styles button { color: var(--text-soft); }
.gallery-filters button:hover, .widget-detail-styles button:hover { color: var(--text); }
.gallery-filters button[aria-pressed="true"], .widget-detail-styles button[aria-pressed="true"] {
    color: var(--text);
    background: var(--segment-active);
    box-shadow: 0 1px 3px var(--shadow), inset 0 1px 0 var(--glass-edge), inset 0 0 0 1px var(--line);
}
.gallery-count { margin-top: 18px; color: var(--text-faint); font-size: .82rem; text-align: center; }

.gallery { padding-bottom: var(--section-space); }
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr));
    gap: clamp(36px, 4vw, 56px) clamp(20px, 2.4vw, 32px);
    margin: clamp(28px, 3.4vw, 44px) 0 0;
    padding: 0;
    list-style: none;
}
.gallery-card { scroll-margin-top: calc(var(--header-height) + 80px); }
.gallery-card[hidden] { display: none; }
.gallery-card-link { display: block; border-radius: clamp(14px, 1.4vw, 20px); }
.gallery-card-image {
    display: block;
    overflow: hidden;
    border-radius: clamp(14px, 1.4vw, 20px);
    background: var(--bezel);
    box-shadow: 0 0 0 1px var(--line), 0 18px 36px -18px var(--shadow-deep);
}
.gallery-card-image img { width: 100%; aspect-ratio: 16 / 10; object-fit: cover; transition: transform 700ms var(--ease); }
.gallery-card-link:hover img { transform: scale(1.025); }
.gallery-card h2 {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-top: 16px;
    font-size: 1.06rem;
    font-weight: 650;
    letter-spacing: -.015em;
}
.gallery-card p { margin-top: 3px; color: var(--text-soft); font-size: .9rem; }
.gallery-card .gallery-card-facts { margin-top: 6px; color: var(--text-faint); font-size: .8rem; }

.gallery-cta { padding-top: 0; }

/* ---- Detail: every style and size of one widget, at one physical scale ---- */
.widget-detail {
    width: min(1120px, calc(100vw - 2 * var(--gutter)));
    max-height: calc(100dvh - 2 * var(--gutter));
    margin: auto;
    padding: 0;
    border: 0;
    border-radius: var(--radius-l);
    color: var(--text);
    background: var(--bg);
    box-shadow: 0 0 0 1px var(--line), 0 40px 120px -30px oklch(0 0 0 / .5);
    overscroll-behavior: contain;
}
.widget-detail::backdrop {
    background: oklch(0.15 0.01 326 / .42);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
}
.widget-detail[open] { animation: detail-in 420ms var(--ease); }
@keyframes detail-in { from { opacity: 0; transform: translateY(16px) scale(.985); } }
.widget-detail-inner { display: grid; gap: 20px; padding: clamp(22px, 3vw, 40px); }
.widget-detail-head { display: flex; align-items: start; justify-content: space-between; gap: 20px; }
.widget-detail-head h2 { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; font-size: clamp(1.8rem, 2.8vw, 2.5rem); line-height: 1.05; letter-spacing: -.03em; }
.widget-detail-head p { max-width: 56ch; margin-top: 8px; color: var(--text-soft); }
.widget-detail-close {
    display: grid;
    flex: 0 0 auto;
    place-items: center;
    width: 36px;
    height: 36px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    color: var(--text-soft);
    background: var(--bg-raised);
    transition: color 200ms ease, background-color 200ms ease;
}
.widget-detail-close:hover { color: var(--text); background: var(--line); }
.widget-detail-close svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.widget-detail-styles { justify-self: start; background: var(--bg-raised); box-shadow: inset 0 0 0 1px var(--line); max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.widget-detail-styles::-webkit-scrollbar { display: none; }
.widget-detail-style-note { min-height: 1.5em; color: var(--text-soft); font-size: .92rem; }
.widget-detail-style-note .new-tag, .widget-detail-style-note .premium-tag { margin-left: 8px; vertical-align: 1px; }
.widget-detail-sizes { display: flex; flex-wrap: wrap; align-items: flex-end; gap: clamp(16px, 2vw, 28px); margin: 0; padding: 0; list-style: none; }
.widget-detail-sizes figure { display: grid; gap: 10px; }
.widget-detail-sizes img {
    width: 100%;
    border-radius: clamp(10px, 1.1vw, 16px);
    background: var(--bezel);
    box-shadow: 0 0 0 1px var(--line), 0 14px 28px -16px var(--shadow-deep);
}
.widget-detail-sizes figcaption { display: flex; align-items: center; gap: 8px; color: var(--text-soft); font-size: .84rem; }
.widget-detail-more:empty { display: none; }

@media (max-width: 720px) {
    .gallery-filters { flex-wrap: nowrap; justify-content: flex-start; overflow-x: auto; margin-inline: calc(-1 * var(--gutter)); padding: 4px var(--gutter); scrollbar-width: none; }
    .gallery-filters::-webkit-scrollbar { display: none; }
    .gallery-filters .glass-segments { flex: 0 0 auto; }
    .widget-detail { width: 100vw; max-width: 100vw; max-height: 92dvh; margin: auto 0 0; border-radius: var(--radius-l) var(--radius-l) 0 0; }
    .widget-detail-sizes li { width: 100% !important; }
}
