/* Landing block presentation styles
 *
 * First-party landing block widgets (apps/shortcodes/landing_widgets.py) used
 * to ship their structural CSS inside an inline <style> block in each template.
 * The HTML sanitizer (apps/content/services/html_sanitizer.py) strips <style>
 * tags and style attributes on non-God-Mode content, which silently removed the
 * CSS that these blocks depend on. Presentation CSS that a block needs in order
 * to render at all must therefore live here, in a stylesheet that is loaded in
 * every render context (public base, standalone landing pages, editor preview).
 *
 * Only static rules belong here. Per-instance values (e.g. background image,
 * overlay opacity) are passed as CSS custom properties via an inline style on a
 * <div>/<span>, which the sanitizer preserves.
 */

/* ============================================================
   Parallax Section (parallax_section / parallax-section)
   ============================================================ */
.parallax-section {
    position: relative;
    min-height: var(--parallax-min-height, 60vh);
    display: flex;
    align-items: center;
    background-position: center;
    background-size: cover;
    background-repeat: no-repeat;
    color: var(--parallax-text-color, #ffffff);
    background-attachment: fixed;
}

.parallax-section__overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, var(--parallax-overlay-opacity, 0.45));
}

.parallax-section__content {
    position: relative;
    z-index: 2;
}

@media (max-width: 991.98px) {
    .parallax-section {
        /* fixed attachment is unreliable on mobile; fall back to scroll */
        background-attachment: scroll;
    }
}

/* ============================================================
   Gallery (gallery / ck-gallery-widget)
   Builtin widget in apps/shortcodes/widgets.py; its inline <style>
   is stripped by the sanitizer, so its structural CSS lives here.
   The --ck-gallery-columns custom property is passed inline on the
   wrapper <div> (preserved by the sanitizer).
   ============================================================ */
.ck-gallery-widget {
    margin: 1.5rem 0;
}

.ck-gallery-widget__items {
    display: grid;
}

.ck-gallery-widget--stack .ck-gallery-widget__items {
    grid-template-columns: 1fr;
}

.ck-gallery-widget--grid .ck-gallery-widget__items {
    grid-template-columns: repeat(var(--ck-gallery-columns, 3), minmax(0, 1fr));
}

.ck-gallery-widget--gap-none .ck-gallery-widget__items {
    gap: 0;
}

.ck-gallery-widget--gap-small .ck-gallery-widget__items {
    gap: 0.5rem;
}

.ck-gallery-widget--gap-medium .ck-gallery-widget__items {
    gap: 1rem;
}

.ck-gallery-widget--gap-large .ck-gallery-widget__items {
    gap: 1.5rem;
}

.ck-gallery-widget__item {
    margin: 0;
}

.ck-gallery-widget__link {
    display: block;
}

.ck-gallery-widget__image {
    display: block;
    width: 100%;
    height: auto;
    border-radius: 0.5rem;
}

/* Grid presentation: uniform cropped tiles so mixed-orientation photos
   line up instead of rendering at full natural height. */
.ck-gallery-widget--grid .ck-gallery-widget__image {
    aspect-ratio: 4 / 3;
    object-fit: cover;
}

.ck-gallery-widget__image--carousel {
    max-height: min(75vh, 720px);
    object-fit: contain;
    background: rgba(0, 0, 0, 0.04);
}

@media (max-width: 767px) {
    .ck-gallery-widget--grid .ck-gallery-widget__items {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

/* ============================================================
   Team Grid (team_grid)
   The img sizing is set via an inline style attribute that the
   sanitizer strips, so photos rendered at full resolution. Static
   sizing + card styling restored here; the rounded-circle/rounded-3
   shape classes are Bootstrap and survive sanitization.
   ============================================================ */
.team-section .team-photo img,
.team-section .photo-placeholder {
    width: 150px;
    height: 150px;
    object-fit: cover;
}

.team-section .team-photo img {
    display: block;
    margin: 0 auto;
}

.team-section .team-card {
    background: white;
    border-radius: 1rem;
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.team-section .team-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
}

.team-section .team-name {
    font-weight: 600;
}

.team-section .team-role {
    font-weight: 500;
    font-size: 0.9rem;
}

.team-section .team-bio {
    line-height: 1.5;
}

.team-section .team-social .btn {
    width: 36px;
    height: 36px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

@media (max-width: 768px) {
    .team-section .team-photo img,
    .team-section .photo-placeholder {
        width: 120px;
        height: 120px;
    }
}

/* ============================================================
   Product grid card image box (product-catalog 14a fixup b)
   Classes, not inline styles: the sanitizer drops style attributes in
   rendered bodies. The theme tokens --ck-product-card-ratio (1 / 1, 4 / 3,
   3 / 4) and --ck-product-card-fit (cover, contain) choose the box.
   ============================================================ */
.ck-product-card__media {
    aspect-ratio: var(--ck-product-card-ratio, 1 / 1);
    overflow: hidden;
}

.ck-product-card__media img {
    object-fit: var(--ck-product-card-fit, cover);
}

.ck-product-card__placeholder {
    background: var(--bg-tertiary);
}

/* ============================================================
   Compact product row (product-catalog 14b-2)
   One dense row per product for large catalogues: thumbnail, title with
   author and condition, price and availability. Single line from md up,
   two lines on a phone; long text wraps. Classes, not inline styles, so it
   survives sanitized bodies. Theme variables only.
   ============================================================ */
.ck-products-list {
    margin: 0;
    padding: 0;
}

.ck-product-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem 0.75rem;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border-color);
    min-width: 0;
}

.ck-product-row__thumb {
    flex: 0 0 64px;
    width: 64px;
    height: 64px;
    object-fit: contain;
    object-position: center;
    background: var(--bg-tertiary);
    border-radius: 0.25rem;
}

.ck-product-row__placeholder {
    display: block;
    background: var(--bg-tertiary);
}

.ck-product-row__text {
    flex: 1 1 12rem;
    min-width: 0;
    display: flex;
    flex-direction: column;
    overflow-wrap: anywhere;
}

.ck-product-row__title {
    display: inline-block;
    min-height: 44px;
    line-height: 44px;
    font-weight: 600;
    text-decoration: none;
    overflow-wrap: anywhere;
    min-width: 0;
}

.ck-product-row__author,
.ck-product-row__condition {
    min-width: 0;
    overflow-wrap: anywhere;
    color: var(--text-muted);
    font-size: 0.875rem;
}

.ck-product-row__meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    min-width: 0;
}

.ck-product-row--sold-out .ck-product-row__thumb {
    opacity: 0.6;
}

@media (min-width: 768px) {
    .ck-product-row {
        flex-wrap: nowrap;
    }

    .ck-product-row__meta {
        flex: 0 0 auto;
        justify-content: flex-end;
        text-align: right;
    }
}

/* ============================================================
   Product archive filters toggle (product-catalog 28, row 485)
   Below md the filter form folds behind a button. The collapsing class is
   added by JavaScript only, so without JS the form stays open and the
   (server-hidden) button never shows.
   ============================================================ */
.ck-products-filters-toggle {
    min-height: 44px;
    width: 100%;
    color: var(--text-primary);
    border-color: var(--border-color);
}

.ck-products-filters-toggle[hidden] {
    display: none;
}

@media (max-width: 767.98px) {
    .ck-products-filters.is-collapsed {
        display: none;
    }
}

@media (min-width: 768px) {
    .ck-products-filters-toggle {
        display: none;
    }
}
