/* Event (single product) page layout. See inc/event-page.php. */

.single-product {
    --ut-event-text: #1d1b2e;
    --ut-event-muted: #5f5d6e;
    --ut-event-border: #d9d8e3;
}

/* Header: seller, key facts and from-price ----------------------------- */

.single-product .product_title.entry-title {
    margin-bottom: 0;
    line-height: 1.15;
}

.ut-event-seller {
    margin: 0.4rem 0 0;
    font-size: 0.95rem;
    color: var(--ut-event-muted);
}

.ut-event-seller a {
    font-weight: 600;
    color: var(--brand-color);
    text-decoration: underline;
    text-underline-offset: 2px;
}

.ut-event-facts,
.ut-event-assure {
    list-style: none;
    margin: 0;
    padding: 0;
}

.ut-event-facts {
    display: grid;
    gap: 0.85rem;
    margin-top: 1.25rem;
}

.ut-event-facts li,
.ut-event-assure li {
    display: grid;
    grid-template-columns: 1.5rem minmax(0, 1fr);
    gap: 0.6rem;
    align-items: start;
    margin: 0;
    line-height: 1.45;
}

.ut-event-facts .ut-event-icon {
    width: 1.3rem;
    height: 1.3rem;
    margin-top: 0.05rem;
    color: var(--brand-color);
}

.ut-event-facts strong {
    color: var(--ut-event-text);
    font-weight: 700;
    font-variation-settings: normal;
}

.ut-event-fact__line {
    display: block;
}

.ut-event-directions {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    min-height: 24px;
    margin-top: 0.15rem;
    font-weight: 600;
    color: var(--brand-color);
    text-decoration: underline;
    text-underline-offset: 2px;
}

.ut-event-directions .ut-event-icon {
    width: 0.9rem;
    height: 0.9rem;
}

.ut-event-from {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.2rem 0.45rem;
    margin: 1.25rem 0 0;
}

.ut-event-from__label,
.ut-event-from__fee {
    font-size: 0.9rem;
    color: var(--ut-event-muted);
}

.ut-event-from__amount {
    font-size: 1.5rem;
    font-weight: 700;
    font-variation-settings: normal;
    color: var(--ut-event-text);
}

/* Tickets ---------------------------------------------------------------- */

.single-product div.product form.cart {
    margin-top: 1.5rem;
}

/* Reassurance under the buy button: refund terms, payment, delivery. */
.ut-event-assure {
    display: grid;
    gap: 0.6rem;
    margin-top: 1rem;
    font-size: 0.875rem;
    color: var(--ut-event-muted);
}

.ut-event-assure .ut-event-icon {
    width: 1.1rem;
    height: 1.1rem;
    margin-top: 0.1rem;
    color: var(--brand-color);
}

.ut-event-assure p {
    margin: 0;
}

.ut-event-assure__refund {
    color: var(--ut-event-text);
}

.ut-event-assure a {
    color: var(--brand-color);
    text-decoration: underline;
    text-underline-offset: 2px;
}

/* The classic dropdown floats its quantity box and button; keep the
   reassurance on its own line beneath them. */
.single_variation_wrap .ut-event-assure,
form.cart:not(.ut-tp) > .ut-event-assure {
    clear: both;
    padding-top: 0.5rem;
}

.single-product .woocommerce-product-details__short-description {
    margin-top: 1.75rem;
}

.ut-event-smallprint {
    margin-top: 0.75rem;
    font-size: 0.8rem;
    color: var(--ut-event-muted);
}

.ut-event-smallprint p {
    margin: 0 0 0.5em;
}

/* Older events' extra terms contain markup written for the previous layout
   (<div class="event-data terms_extra"><div class="event-data-box">…), for
   example door times for two sessions. Keep it readable: one line each. */
.single-product .event-data {
    margin: 0.75rem 0;
}

.single-product .event-data-box {
    padding: 0.25rem 0 0.5rem;
}

.single-product .event-data-box > strong,
.single-product .event-data-box > span {
    display: block;
}

/* Event information sections (the old tabs) ------------------------------ */

.ut-event-sections {
    margin: 2rem 0 2.5rem;
    border-top: 1px solid var(--ut-event-border);
}

.ut-event-section {
    border-bottom: 1px solid var(--ut-event-border);
}

.ut-event-section__title {
    margin: 0;
    padding: 1rem 0 0.5rem;
    scroll-margin-top: 1rem;
    font-size: 1.2rem;
    color: var(--brand-color);
}

.ut-event-section.is-enhanced .ut-event-section__title {
    padding: 0;
}

.ut-event-section__toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    width: 100%;
    min-height: 56px;
    margin: 0;
    padding: 0.75rem 0;
    border: 0;
    border-radius: 0;
    background: none;
    color: inherit;
    font: inherit;
    text-align: left;
    cursor: pointer;
}

.ut-event-section__toggle::after {
    content: "";
    flex: none;
    width: 0.6rem;
    height: 0.6rem;
    margin-right: 0.35rem;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: rotate(45deg) translateY(-25%);
    transition: transform 0.2s ease;
}

.ut-event-section__toggle[aria-expanded="true"]::after {
    transform: rotate(-135deg) translateY(-25%);
}

.ut-event-section__toggle:hover,
.ut-event-section__toggle:focus {
    background: none;
    color: inherit;
}

.ut-event-section__toggle:focus-visible {
    outline: 3px solid var(--brand-color);
    outline-offset: 2px;
}

/* flow-root keeps floated images in descriptions inside their section. */
.ut-event-section__body {
    display: flow-root;
    padding: 0 0 1.5rem;
}

.ut-event-section__body[hidden] {
    display: none;
}

/* Organisers' text can contain links; mark them by more than colour. */
.ut-event-section__body a {
    text-decoration: underline;
    text-underline-offset: 2px;
}

.ut-event-section__body > :last-child {
    margin-bottom: 0;
}

/* More events ------------------------------------------------------------ */

.single-product .related.products ul.products li.product img {
    aspect-ratio: 16 / 9;
    object-fit: cover;
}

/* Phones ---------------------------------------------------------------- */

@media (max-width: 767px) {
    /* One-line breadcrumb. */
    .single-product .storefront-breadcrumb {
        margin-bottom: 0.75rem;
        padding: 0.75rem 0;
    }

    .single-product .woocommerce-breadcrumb {
        overflow: hidden;
        white-space: nowrap;
        text-overflow: ellipsis;
    }

    /* A shorter photo, so the event details start on the first screen.
       Tapping it still opens the full image. */
    .single-product div.product .woocommerce-product-gallery {
        margin-bottom: 1.25rem;
    }

    .single-product div.product .woocommerce-product-gallery .woocommerce-product-gallery__image img {
        aspect-ratio: 4 / 3;
        object-fit: cover;
    }

    .single-product div.product .woocommerce-product-gallery .flex-viewport {
        margin-bottom: 0;
    }

    /* The thumbnail strip becomes dots over the bottom of the photo. The
       thumbnails stay in place (each is still what you tap to change photo);
       their picture is pushed out of view so only a dot drawn on a 24px tap
       area shows. Desktop keeps the thumbnails. */
    .single-product div.product .woocommerce-product-gallery ol.flex-control-thumbs {
        position: absolute;
        left: 50%;
        bottom: 0.5rem;
        z-index: 2;
        display: flex;
        gap: 0;
        width: auto;
        margin: 0;
        padding: 0 0.25rem;
        border-radius: 999px;
        background: rgba(0, 0, 0, 0.35);
        transform: translateX(-50%);
    }

    /* Specific enough to beat Storefront's full-width thumbnail widths. */
    .single-product div.product .woocommerce-product-gallery.woocommerce-product-gallery ol.flex-control-thumbs.flex-control-nav li {
        flex: none;
        width: 24px;
        margin: 0;
    }

    .single-product div.product .woocommerce-product-gallery .flex-control-thumbs li img {
        display: block;
        width: 24px;
        height: 24px;
        object-fit: none;
        object-position: -9999px -9999px;
        background: radial-gradient(circle, rgba(255, 255, 255, 0.6) 0 3.5px, transparent 4.5px);
        opacity: 1;
    }

    .single-product div.product .woocommerce-product-gallery .flex-control-thumbs li img.flex-active {
        background: radial-gradient(circle, #fff 0 4.5px, transparent 5.5px);
    }

    .single-product .product_title.entry-title {
        font-size: 1.6rem;
    }

    /* More events: a swipeable row of compact cards. */
    .single-product .related.products ul.products {
        display: flex;
        gap: 1rem;
        overflow-x: auto;
        scroll-snap-type: x mandatory;
        padding-bottom: 0.75rem;
    }

    .single-product .related.products ul.products li.product {
        flex: 0 0 75%;
        width: auto;
        margin: 0;
        float: none;
        scroll-snap-align: start;
    }

    .single-product .related.products ul.products::before,
    .single-product .related.products ul.products::after {
        content: none;
    }
}

/* Tablets and desktop: photo and information left, tickets right --------- */

@media (min-width: 768px) {
    /* Storefront hides horizontal overflow on .site, which stops anything
       inside from sticking; clip does the same job without that side effect. */
    .single-product .site {
        overflow-x: clip;
    }

    body.single-product div.product.type-product {
        display: grid;
        grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
        grid-template-rows: auto 1fr;
        column-gap: 3rem;
        overflow: visible;
    }

    /* Storefront's float-clearing pseudo-elements would become grid items. */
    body.single-product div.product.type-product::before,
    body.single-product div.product.type-product::after {
        content: none;
    }

    body.single-product div.product.type-product > * {
        grid-column: 1 / -1;
    }

    body.single-product div.product.type-product > .woocommerce-product-gallery {
        grid-column: 1;
        grid-row: 1;
        float: none;
        width: auto;
        margin: 0 0 1.5rem;
    }

    body.single-product div.product.type-product > .summary {
        grid-column: 2;
        grid-row: 1;
        align-self: start;
        float: none;
        width: auto;
        margin: 0 0 2.5rem;
    }

    /* Tablets: the information runs full width under the photo and tickets;
       a third of a tablet screen is too narrow for it. */
    body.single-product div.product.type-product > .ut-event-sections {
        grid-column: 1 / -1;
        grid-row: 2;
        margin-top: 0;
    }
}

/* Desktop: the information sits under the photo, beside the tickets. */
@media (min-width: 1024px) {
    body.single-product div.product.type-product {
        grid-template-rows: auto 1fr;
    }

    body.single-product div.product.type-product > .summary {
        grid-row: 1 / span 2;
    }

    /* Kept in view while reading; event-page.js works out the offset so a
       panel taller than the screen still shows its buy button. Without the
       script the panel scrolls normally. */
    body.single-product div.product.type-product > .summary.ut-summary-sticky {
        position: sticky;
        top: var(--ut-summary-top, 2rem);
    }

    body.single-product div.product.type-product > .ut-event-sections {
        grid-column: 1;
        grid-row: 2;
        align-self: start;
    }
}

@media (prefers-reduced-motion: reduce) {
    .ut-event-section__toggle::after {
        transition: none;
    }
}
