/* Storefront — only what Bootstrap does not provide.
 * If something here could be a Bootstrap class, it is a bug. Delete it. */

body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

main {
    flex: 1 0 auto;
}

/* Headings carry the display serif down to h3 — the families, the pieces and
   the fairs are all h3. h4 and below stay on the UI sans, beside badges and
   buttons. */
h1,
h2,
h3 {
    font-family: var(--font-display);
    font-weight: 600;
    letter-spacing: -.015em;
    text-wrap: balance;
}

.store-display {
    font-size: clamp(2.5rem, 4.6vw, 3.75rem);
    letter-spacing: -.025em;
    line-height: 1.05;
}

.measure-narrow {
    max-width: 30rem;
}

/* One gutter down the page: .section pads the container's own by 1.5rem (3rem
   from lg), and the bands on a bare container follow it. */
.navbar,
.hero,
footer {
    padding-left: 1.5rem;
    padding-right: 1.5rem;
}

@media screen and (min-width: 992px) {
    .navbar,
    .hero,
    footer {
        padding-left: 3rem;
        padding-right: 3rem;
    }
}

.navbar .nav-link {
    font-size: .9375rem;
    font-weight: 500;
}

.navbar .nav-link[aria-current] {
    color: var(--ccg-ink);
    font-weight: 600;
    border-bottom-color: var(--ccg-blue-500);
}

/* The hero: the lid of the round box, cropped to its circle. */
.hero-photo {
    width: min(100%, 26rem);
    aspect-ratio: 1 / 1;
    border-radius: 50%;
    object-fit: cover;
    object-position: 50% 52%;
}

/* The butterfly on the error pages. */
.error-mark {
    width: 6rem;
    height: 6rem;
    color: var(--ccg-blue-500);
}

/* Makes a name legible over a photograph. card-img-overlay positions it and
   nothing in Bootstrap tints it. */
.tile-scrim {
    background: linear-gradient(to top,
        rgba(28, 36, 48, .92) 0%,
        rgba(28, 36, 48, .72) 28%,
        rgba(28, 36, 48, .2) 55%,
        transparent 75%);
    transition: opacity .35s ease;
}

a:hover > .tile-scrim {
    opacity: .8;
}

.tile-caption {
    text-shadow: 0 1px 2px rgba(0, 0, 0, .35);
}

/* The owners' portrait beside the Origem copy: faces sit high in the frame. */
.origin-photo {
    object-position: center 18%;
}

/* ------------------------------------------------------------------
   A rail: a row that scrolls sideways, dragged with the mouse or walked
   with the arrows drag-rail.js shows when there is somewhere to go.
   ------------------------------------------------------------------ */

.drag-rail {
    display: flex;
    overflow-x: auto;
    cursor: grab;
    scrollbar-width: none;
}

.drag-rail::-webkit-scrollbar {
    display: none;
}

.drag-rail.has-fade-start {
    mask-image: linear-gradient(to right, transparent 0, #000 3rem);
}

.drag-rail.has-fade-end {
    mask-image: linear-gradient(to left, transparent 0, #000 3rem);
}

.drag-rail.has-fade-start.has-fade-end {
    mask-image: linear-gradient(to right,
        transparent 0, #000 3rem,
        #000 calc(100% - 3rem), transparent 100%);
}

.drag-rail.is-dragging {
    cursor: grabbing;
    scroll-snap-type: none;
    user-select: none;
}

/* Timeline. The connecting line is each entry's top border. */

.timeline-shell {
    position: relative;
}

.timeline {
    list-style: none;
    margin: 0;
    padding: 12px 0 0;
    scroll-snap-type: x mandatory;
}

.timeline-entry {
    position: relative;
    flex: 0 0 clamp(16rem, 24vw, 21rem);
    padding: 1.75rem 2rem 0 0;
    border-top: 1px solid var(--ccg-line);
    scroll-snap-align: start;
}

.timeline-entry:last-child {
    scroll-snap-align: end;
}

.timeline-marker {
    position: absolute;
    top: -5px;
    left: 0;
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--ccg-blue-500);
    /* The ring cuts the line around the dot; the section sits on mist. */
    box-shadow: 0 0 0 4px var(--ccg-mist);
}

.timeline-entry:first-child .timeline-marker {
    width: 13px;
    height: 13px;
    top: -7px;
    background: var(--ccg-blue-700);
}

.timeline-date {
    font-size: .75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--ccg-blue-600);
    margin-bottom: .35rem;
}

.timeline-body a,
.event-card a {
    color: inherit;
    border-bottom: 1px solid var(--ccg-blue-200);
}

.timeline-body a:hover,
.event-card a:hover {
    color: var(--ccg-blue-700);
    border-bottom-color: currentColor;
}

/* The one fair's card: the days of the month carry it. */
.event-days {
    font-size: clamp(3rem, 6vw, 4.5rem);
    line-height: 1;
    letter-spacing: -.03em;
    color: var(--ccg-blue-800);
}

/* Arrow buttons for visitors who would rather not drag. Shown on hover; always
   reachable by keyboard. */
.rail-arrow {
    position: absolute;
    top: 50%;
    z-index: 2;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    border: 1px solid var(--ccg-line);
    background: var(--ccg-white);
    color: var(--ccg-ink);
    font-size: .95rem;
    line-height: 1;
    cursor: pointer;
    opacity: 0;
    transition: background-color .15s ease, border-color .15s ease, opacity .15s ease;
}

.rail-arrow:hover {
    border-color: var(--ccg-blue-400);
    color: var(--ccg-blue-600);
}

.rail-arrow[hidden] {
    display: none;
}

.timeline-shell:hover .rail-arrow,
.rail-arrow:focus-visible {
    opacity: 1;
}

.rail-arrow-start {
    left: -1.25rem;
}

.rail-arrow-end {
    right: -1.25rem;
}

/* Vertical and centred on mobile: one entry per row, the rule down the middle. */
@media screen and (max-width: 767.98px) {
    .timeline {
        position: relative;
        flex-direction: column;
        align-items: center;
        padding-top: 0;
        overflow-x: visible;
        scroll-snap-type: none;
        cursor: auto;
    }

    .timeline::before {
        content: "";
        position: absolute;
        top: .5rem;
        bottom: .5rem;
        left: 50%;
        width: 1px;
        background: var(--ccg-line);
        transform: translateX(-50%);
    }

    .timeline-entry {
        flex: none;
        width: 100%;
        max-width: 22rem;
        padding: 0 0 2.5rem;
        border-top: none;
        text-align: center;
    }

    .timeline-entry:last-child {
        padding-bottom: 0;
    }

    .timeline-marker {
        position: relative;
        top: auto;
        left: auto;
        margin: 0 auto .9rem;
    }

    .timeline-entry:first-child .timeline-marker {
        top: auto;
    }

    .timeline-body {
        position: relative;
        background: var(--ccg-white);
        padding: .25rem .75rem;
    }

    .rail-arrow {
        display: none;
    }
}

/* ------------------------------------------------------------------
   The catalogue
   ------------------------------------------------------------------ */

/* The filters follow the grid down. Below lg they are an offcanvas drawer,
   which Bootstrap positions itself. */
@media screen and (min-width: 992px) {
    .filters {
        position: sticky;
        top: 1.5rem;
    }
}

.filter-group-label {
    font-size: .75rem;
    font-weight: 600;
    color: var(--ccg-ink-faint);
    padding: 0 .35rem;
    margin: 1.25rem 0 .5rem;
}

.filters .nav-link {
    display: block;
    padding: .4rem .35rem;
    border-radius: var(--radius);
    color: var(--ccg-ink);
    background: transparent;
}

.filters .nav-link:hover {
    background: var(--ccg-blue-50);
}

/* Filters are cumulative, so a selected entry is marked by its ticked box. */
.filters .nav-link.is-active {
    background: var(--ccg-blue-50);
    color: var(--ccg-blue-900);
}

.filter-line {
    display: flex;
    align-items: center;
    gap: .55rem;
}

/* An <a> with no href gets no focus ring of its own. */
.filters .nav-link.filter-entry:focus-visible {
    outline: 0;
    border-radius: var(--bs-border-radius-sm);
    box-shadow: 0 0 0 .25rem rgba(var(--bs-primary-rgb), .3);
}

.filters .nav-link.is-empty {
    color: var(--ccg-ink-faint);
    cursor: default;
}

.filters .nav-link.is-empty:hover {
    background: transparent;
}

/* Square, so it is not mistaken for a radio: these add up. */
.filter-box {
    flex: none;
    width: 1.05rem;
    height: 1.05rem;
    border: 1px solid var(--ccg-line);
    border-radius: 4px;
    background: var(--ccg-white);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: .58rem;
    color: transparent;
    transition: background-color .12s ease, border-color .12s ease;
}

.is-active .filter-box {
    background: var(--ccg-blue-800);
    border-color: var(--ccg-blue-800);
    color: #fff;
}

.filter-name {
    flex: 1 1 auto;
    min-width: 0;
}

.filter-count {
    flex: none;
    font-family: var(--font-data);
    font-variant-numeric: tabular-nums;
    font-size: .75rem;
    color: var(--ccg-ink-soft);
}

.is-active .filter-count {
    color: var(--ccg-blue-700);
}

/* A grid column's min-width is auto, so a wide scrolling child would grow it
   and scroll the whole catalogue sideways. */
.catalogue-main {
    min-width: 0;
}

/* While the next grid is on its way, the one on screen dims rather than vanishes. */
.catalogue-main .is-loading {
    opacity: .5;
    transition: opacity .15s ease;
}

.breadcrumb {
    --bs-breadcrumb-divider: '›';
}

.collection-tile img {
    transition: transform .2s ease;
}

.collection-tile:hover img {
    transform: scale(1.03);
}

#collection-grid .placeholder {
    color: var(--ccg-line);
}

/* An applied filter, as a navy pill that is itself the dismiss button. */
.filter-badge {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    padding: .3rem .5rem .3rem .7rem;
    border: 0;
    background: var(--ccg-blue-800);
    color: #fff;
    font-size: .75rem;
    line-height: 1.25;
    border-radius: 999px;
    cursor: pointer;
}

.filter-badge .btn-close {
    --bs-btn-close-opacity: .65;
    --bs-btn-close-hover-opacity: 1;
    width: .6em;
    height: .6em;
    padding: .25em;
}

.product-placeholder--stage {
    height: 100%;
    aspect-ratio: auto;
}

.product-placeholder--stage .product-placeholder-circle {
    width: 26%;
    max-width: 160px;
}

.product-card .ratio,
.product-card .product-placeholder {
    border-radius: var(--radius);
    overflow: hidden;
}

/* ------------------------------------------------------------------
   The piece
   ------------------------------------------------------------------ */

.spec-list {
    border-top: 1px solid var(--ccg-line);
}

.spec-row {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    padding: .7rem 0;
    border-bottom: 1px solid var(--ccg-line);
    font-size: .9375rem;
}

.spec-row dt {
    color: var(--ccg-ink-soft);
}

.spec-row dd {
    color: var(--ccg-blue-900);
    font-weight: 500;
    text-align: right;
}

/* Stage above, thumbnails below; from lg the thumbnails run down the left of
   the stage. row-reverse rather than reordering the markup — the stage stays
   first in the DOM, where the gallery script and the keyboard expect it. */
.gallery {
    display: flex;
    flex-direction: column;
    gap: .75rem;
}

@media screen and (min-width: 992px) {
    .gallery {
        flex-direction: row-reverse;
        align-items: flex-start;
        gap: .625rem;
    }

    .thumb-strip {
        flex: none;
        flex-direction: column;
        align-items: flex-start;
        overflow-x: visible;
        overflow-y: auto;
        gap: .75rem;
        max-height: 34rem;
    }

    .strip-track {
        flex-direction: column;
    }
}

.thumb-strip {
    display: flex;
    align-items: flex-end;
    gap: 1rem;
    overflow-x: auto;
    scroll-behavior: smooth;
    scrollbar-width: none;
    padding-bottom: .2rem;
}

.thumb-strip::-webkit-scrollbar {
    display: none;
}

.thumb-strip[hidden] {
    display: none;
}

.strip-group {
    display: flex;
    flex-direction: column;
    gap: .3rem;
}

.strip-track {
    display: flex;
    gap: .5rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.strip-track li {
    flex: 0 0 auto;
}

.strip-thumb {
    width: 72px;
    height: 72px;
    padding: 0;
    border: 2px solid var(--ccg-line);
    border-radius: var(--radius);
    background: var(--ccg-mist);
    cursor: pointer;
    overflow: hidden;
    display: block;
    transition: border-color .15s ease, opacity .15s ease;
    opacity: .75;
}

.strip-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.strip-thumb:hover {
    opacity: 1;
}

.strip-thumb.is-active {
    border-color: var(--ccg-blue-500);
    opacity: 1;
}

/* Its own shape, not the panel's: a 4:5 stage and the facts beside it come out
   the same height on their own. */
.gallery-stage {
    position: relative;
    flex: 1 1 auto;
    min-width: 0;
    aspect-ratio: 4 / 5;
    background: var(--ccg-mist);
    border: 1px solid var(--ccg-line);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.gallery-stage img,
.gallery-stage .product-placeholder {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.gallery-stage img[hidden] {
    display: none;
}

/* Arrows are revealed on hover but stay reachable by keyboard. */
.stage-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 44px;
    height: 44px;
    border: 1px solid var(--ccg-line);
    background: rgba(255, 255, 255, .94);
    color: var(--ccg-blue-800);
    font-size: .9rem;
    line-height: 1;
    cursor: pointer;
    opacity: 0;
    transition: opacity .15s ease, background-color .15s ease;
}

.gallery-stage:hover .stage-arrow,
.stage-arrow:focus-visible {
    opacity: 1;
}

.stage-arrow:hover {
    background: #fff;
}

.stage-arrow[disabled] {
    opacity: 0 !important;
    pointer-events: none;
}

.stage-arrow-left {
    left: .75rem;
}

.stage-arrow-right {
    right: .75rem;
}

.stage-counter,
.stage-zoom {
    position: absolute;
    bottom: .75rem;
    background: rgba(255, 255, 255, .94);
    border-radius: 999px;
    padding: .15rem .6rem;
    font-size: .75rem;
    color: var(--ccg-ink-soft);
}

.stage-counter {
    right: .75rem;
    font-family: var(--font-data);
}

/* Part of the photograph's furniture, not a control: the whole stage is the target. */
.stage-zoom {
    left: .75rem;
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    pointer-events: none;
}

.stage-zoom[hidden] {
    display: none;
}

/* A colourway is a control here: the overlapping circles inside the 44px hit
   area a fingertip needs. */
.variant-option {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.75rem;
    height: 2.75rem;
    padding: 0;
    border: 1px solid var(--ccg-line);
    border-radius: 50%;
    background: var(--ccg-white);
    cursor: pointer;
    transition: transform .18s ease;
}

.variant-option:hover {
    transform: scale(1.08);
}

.variant-option[aria-pressed="true"] {
    border-color: var(--ccg-ink);
    outline: 1px solid var(--ccg-ink);
    outline-offset: 2px;
}

#size-options {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
}

#size-options .btn {
    min-width: 2.75rem;
    min-height: 2.75rem;
}

/* Below lg the piece opens on one screen: the photograph as a 150px square
   beside its name, description and material line, the one action right under
   them, then the colours, the thumbnails, the sizes and the details. The
   columns and the gallery become display: contents, so their children fall
   into one grid and the lg+ markup is not touched. */
@media screen and (max-width: 991.98px) {
    #product-detail {
        display: grid;
        grid-template-columns: 150px minmax(0, 1fr);
        column-gap: 1rem;
        margin: 0;
    }

    #product-detail > .col-lg-7,
    #product-detail > .col-lg-5,
    #product-detail .gallery {
        display: contents;
    }

    #gallery-stage {
        order: 1;
        grid-row: span 3;
        width: 150px;
        height: 150px;
        aspect-ratio: auto;
    }

    #product-name,
    #product-description,
    #product-line {
        grid-column: 2;
    }

    #product-name {
        order: 2;
    }

    #product-description {
        order: 3;
    }

    #product-line {
        order: 4;
    }

    #enquiry-block,
    #variants-block,
    #thumb-strip,
    #sizes-block,
    #product-meta,
    #gallery-empty {
        grid-column: 1 / -1;
    }

    #enquiry-block {
        order: 5;
        margin-bottom: 1.5rem;
    }

    #variants-block {
        order: 6;
    }

    #thumb-strip {
        order: 7;
        margin-bottom: 1.5rem;
    }

    #sizes-block {
        order: 8;
    }

    #product-meta {
        order: 9;
    }

    #gallery-empty {
        order: 10;
    }

    /* No room on a 150px square for the arrows and the count: the thumbnails
       and a swipe change the photograph, and the cue to enlarge stays. */
    .stage-arrow,
    .stage-counter {
        display: none;
    }
}

/* Below lg the page is touched: the same controls, 44px tall. */
@media (max-width: 991.98px) {
    .variant-option,
    #size-options .btn,
    .btn[data-bs-target="#catalogue-filters"],
    .filter-badge,
    #store-nav .nav-link,
    .filters .nav-link,
    footer a {
        min-height: 44px;
    }

    #size-options .btn,
    .btn[data-bs-target="#catalogue-filters"] {
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    /* Grid rather than flex: the one child keeps the full width, as a block would. */
    #store-nav .nav-link,
    .filters .nav-link,
    footer nav a {
        display: grid;
        align-content: center;
    }

    #size-options {
        gap: .75rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    .card,
    .strip-thumb,
    .variant-option,
    .collection-tile img,
    .tile-scrim {
        animation: none;
        transition: none;
    }
}
