/* ==========================================================================
   RESPONSIVE + MOTION LAYER
   Loaded LAST on every page (see functions.php -> ds_motion_assets).
   1. Site-wide responsive safeguards
   2. Section-by-section responsive fixes
   3. Animation system (scroll reveals driven by assets/js/site-motion.js,
      plus pure-CSS entrances for header, banner and lightboxes)
   Everything in part 3 respects prefers-reduced-motion.
   ========================================================================== */


/* ==========================================================================
   1. SITE-WIDE RESPONSIVE SAFEGUARDS
   ========================================================================== */

html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

/* No sideways scrolling on phones. "clip" (unlike "hidden") keeps position:sticky working. */
html,
body {
    overflow-x: clip;
}
@supports not (overflow: clip) {
    body { overflow-x: hidden; }
}

img,
video,
iframe,
embed,
object {
    max-width: 100%;
}

/* Long names / emails / URLs must wrap instead of pushing the page wider */
h1, h2, h3, h4, h5, h6,
p, li, td, th, a, figcaption, label {
    overflow-wrap: break-word;
}

/* Reading size on small screens (was 18px / line-height 2 everywhere) */
@media (max-width: 767px) {
    body,
    p {
        font-size: 16px;
        line-height: 1.8;
    }
}

/* Comfortable tap targets on touch screens */
@media (pointer: coarse) {
    .btn,
    input[type="submit"],
    .page-numbers,
    .ds-af-tab,
    .ds-af-clear,
    .ds-pa-clear,
    .ds-pa-page {
        min-height: 44px;
    }
    .ds-af-tab,
    .ds-af-clear,
    .ds-pa-clear {
        display: inline-flex;
        align-items: center;
    }
    .footer-main ul li a {
        display: inline-block;
        padding: 4px 0;
    }
}


/* ==========================================================================
   2. SECTION-BY-SECTION RESPONSIVE FIXES
   ========================================================================== */

/* ---------- Header ------------------------------------------------------- */
@media (max-width: 767px) {
    #site-header .container {
        padding-top: 12px;
        padding-bottom: 12px;
    }
}

/* Long mobile menus scroll instead of running off the bottom of short phones */
@media (max-width: 1079px) {
    #mega-menu-wrap-primary .mega-menu-toggle.mega-menu-open + #mega-menu-primary {
        max-height: calc(100vh - 96px);
        max-height: calc(100dvh - 96px);
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
}

/* ---------- Inner page banner ------------------------------------------- */
.inner-banner-title {
    font-size: clamp(26px, 6vw, 39px);
    overflow-wrap: anywhere;
}
.inner-banner-breadcrumb #breadcrumbs {
    overflow-wrap: anywhere;
}
.inner-banner-meta {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 4px 12px;
    margin-top: 18px;
}
@media (max-width: 767px) {
    .inner-page-banner {
        padding: 45px 15px 42px;
    }
    .inner-banner-line {
        margin-top: 18px;
    }
    .inner-decoration-one {
        width: 190px;
        height: 190px;
        right: -80px;
        top: -100px;
    }
    .inner-decoration-two {
        width: 120px;
        height: 120px;
        left: -50px;
        bottom: -60px;
    }
}

/* ---------- Footer ------------------------------------------------------- */
.footer-newsletter h2 {
    font-size: clamp(28px, 5vw, 46px);
}
.footer-newsletter {
    padding: clamp(46px, 7vw, 80px) 0;
}
.footer-main {
    padding: clamp(46px, 8vw, 90px) 0;
}
.footer-main h4 {
    font-size: clamp(22px, 3vw, 30px);
}
.contact-content a,
.contact-content p {
    overflow-wrap: anywhere;
}
@media (max-width: 991px) {
    /* columns that wrap onto a second row need breathing space */
    .footer-main [class*="col-"] {
        margin-bottom: 30px;
    }
    .footer-main h4 {
        margin-top: 0;
    }
    .footer-bottom,
    .footer-bottom .text-right {
        text-align: center !important;
    }
    .footer-bottom [class*="col-"] {
        margin-bottom: 8px;
    }
    .ace-logo ul {
        justify-content: center !important;
        padding: 0 !important;
        margin: 0 !important;
    }
}
@media (max-width: 767px) {
    .footer-logo {
        max-width: 180px;
    }
    .contact-item {
        gap: 14px;
    }
    .newsletter-form .form-control,
    .btn-newsletter {
        width: 100%;
    }
    .btn-newsletter {
        margin-top: 10px;
    }
}

/* ---------- News archive / news slider / single news ---------------------- */
.news-archive {
    padding: 60px 0;
}
@media (max-width: 767px) {
    .news-archive { padding: 36px 0; }
    .news-filter  { padding: 16px; }
}
/* Equal-height cards (floated columns left ragged gaps when titles wrapped) */
.ds-news-grid {
    display: flex;
    flex-wrap: wrap;
}
.ds-news-grid::before,
.ds-news-grid::after {
    content: none;
    display: none;
}
.ds-news-grid > [class*="col-"] {
    display: flex;
    margin-bottom: 30px;
}
.ds-news-grid .news-item {
    width: 100%;
    transition: transform .3s ease, box-shadow .3s ease;
}
.ds-news-grid .news-item:hover {
    transform: translateY(-6px);
    box-shadow: 0 14px 34px rgba(0, 0, 0, .1);
}
.news-pagination {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 6px 0;
}
@media (max-width: 575px) {
    .news-image img {
        height: 220px !important;
    }
    .news-title {
        font-size: 21px;
    }
}
.news-content iframe,
.news-content video,
.news-content img {
    max-width: 100%;
}
.news-content table {
    display: block;
    max-width: 100%;
    overflow-x: auto;
}
@media (max-width: 767px) {
    .news-content-section {
        padding-left: 0;
        padding-right: 0;
    }
}

/* ---------- Founders / owl carousels ------------------------------------- */
@media (max-width: 575px) {
    .founder-image img {
        height: 300px !important;
    }
    .founder-name,
    .founder-name a {
        font-size: 24px !important;
    }
    .founders-slider .owl-nav,
    .news-slider .owl-nav {
        margin-top: 22px;
    }
}

/* ---------- Artists + collections archive -------------------------------- */
@media (max-width: 767px) {
    .ds-af {
        padding: 34px 0 48px;
    }
    .ds-af .container {
        padding-left: 18px;
        padding-right: 18px;
    }
    .ds-af-heading h2 {
        font-size: 32px;
    }
    .ds-af-filter input[type="text"] {
        flex-basis: 100%;
    }
    .ds-af-filter select {
        flex: 1 1 140px;
    }
    .ds-af-info {
        left: 14px;
        bottom: 12px;
        right: 40px;
    }
    .ds-af-arrow {
        right: 14px;
        bottom: 12px;
    }
}
@media (max-width: 575px) {
    .ds-af-grid {
        gap: 12px;
    }
    .ds-artist-overlay {
        left: 14px;
        right: 14px;
        bottom: 12px;
    }
}

/* ---------- Masonry artwork cards --------------------------------------- */
@media (max-width: 575px) {
    .ds-artwork-grid {
        margin-left: -6px;
        margin-right: -6px;
    }
    .ds-artwork-card,
    .grid-sizer {
        padding: 6px;
    }
    .ds-artwork-content {
        padding: 14px;
    }
}

/* ---------- Single artwork / poster / hub record ------------------------- */
.ds-ps-title,
.ds-ps-table td {
    overflow-wrap: anywhere;
}
.ds-ps-table th {
    overflow-wrap: normal;
}
.art-meta-dimensions {
    flex-wrap: wrap;
}
@media (max-width: 575px) {
    .art-meta-dimensions {
        display: block;
    }
    .art-meta-dimensions > strong {
        display: block;
        min-width: 0;
        margin-bottom: 6px;
    }
    .art-meta p {
        font-size: 16px;
    }
    .artwork-info h1 {
        font-size: 24px;
    }
    .ds-ps-table th {
        width: auto;
        padding-right: 10px;
        font-size: 13px;
        letter-spacing: .05em;
    }
    .ds-ps-table td {
        font-size: 16px;
    }
    .ds-ps-scan {
        padding: 16px;
    }
    .ds-ps-lightbox {
        padding: 12px;
    }
    .ds-ps-lightbox-close {
        top: 8px;
        right: 12px;
    }
    /* The 7 share buttons are one nowrap row on desktop; let them wrap on phones */
    .share-panel {
        flex-wrap: wrap;
        white-space: normal;
        max-width: 100%;
    }
    .artwork-share.active {
        display: block;
        width: 100%;
    }
    .artwork-share.active .share-panel {
        position: static;
        flex-wrap: wrap;
        margin-top: 0;
        white-space: normal;
        transform: none;
    }
    .share-toggle {
        padding: 12px 22px;
    }
}

/* ---------- Related works / featured masonry ----------------------------- */
@media (max-width: 767px) {
    .related-works {
        margin-top: 56px;
        padding-top: 40px;
    }
    .related-work-item {
        margin-bottom: 26px;
    }
    .related-artists {
        margin-top: 48px;
    }
    .related-artists-header h2,
    .ds-ps-related-head h2 {
        font-size: 24px;
    }
}
@media (max-width: 575px) {
    .ds-ps-related-img {
        height: 220px;
    }
}

/* ---------- Poster archive (older template) ------------------------------ */
.ds-poster-filter input,
.ds-poster-filter select {
    max-width: 100%;
}
@media (max-width: 767px) {
    .ds-poster-filter [class*="col-"] {
        margin-bottom: 12px;
    }
}

/* ---------- History timeline -------------------------------------------- */
@media (max-width: 600px) {
    .history-heading {
        font-size: 30px !important;
        margin-bottom: 34px !important;
    }
    .history-text p {
        font-size: 15px !important;
    }
    .museum-history .container {
        padding: 0 12px;
    }
}

/* ---------- Single history ---------------------------------------------- */
@media (max-width: 767px) {
    .single-history-extra-content {
        padding: 50px 0;
    }
}

/* ---------- Single artist ------------------------------------------------ */
.ds-artist-title {
    font-size: clamp(34px, 8vw, 55px);
    line-height: 1;
    overflow-wrap: anywhere;
}
.ds-artist-eyebrow {
    font-size: clamp(14px, 2.4vw, 18px);
}
.ds-artist-section-head h2 {
    font-size: clamp(26px, 4.2vw, 35px);
}
.ds-artist-profile-value,
.ds-artist-fact-value {
    overflow-wrap: anywhere;
}
@media (max-width: 991px) {
    .ds-artist-hero {
        padding: 40px 0;
    }
    .ds-artist-hero-content {
        padding-bottom: 20px;
    }
    /* Education | Artistic practice sit side by side on desktop only */
    .ds-artist-practice-layout {
        display: block !important;
    }
    .ds-artist-practice-layout > * {
        width: 100% !important;
        max-width: 100% !important;
        float: none !important;
    }
    .ds-artist-practice-layout > * + * {
        margin-top: 40px;
    }
}
@media (max-width: 767px) {
    .ds-artist-hero-image img {
        height: auto;
        max-height: 520px;
        object-position: center top;
    }
    .ds-artist-main-intro {
        font-size: 19px;
    }
    .ds-artist-single .container {
        overflow-wrap: break-word;
    }
    /* Sections 03-09 (education, practice, relationships, exhibitions, archive,
       oral history): collapse any multi-column grid to one column and keep
       media inside the screen. */
    .ds-artist-relationships-grid,
    .ds-artist-archive-grid,
    .ds-artist-exhibitions-list,
    .ds-artist-working-methods {
        grid-template-columns: minmax(0, 1fr) !important;
    }
    .ds-artist-education-item,
    .ds-artist-practice-row,
    .ds-artist-relationship-card,
    .ds-artist-exhibition-item,
    .ds-artist-archive-card {
        min-width: 0;
        max-width: 100%;
    }
    .ds-artist-single iframe,
    .ds-artist-single video,
    .ds-artist-single img {
        max-width: 100%;
    }
    .ds-artist-oral-history,
    .ds-artist-relationships {
        padding-top: 52px !important;
        padding-bottom: 52px !important;
    }
    .ds-artist-archive-works {
        padding: 48px 0;
    }
    .ds-artist-pills {
        gap: 6px;
    }
    .ds-pill {
        font-size: 13px;
        padding: 7px 11px;
    }
}

/* ---------- Home page shortcode sections --------------------------------- */
@media (max-width: 767px) {
    .dsv-head,
    .dsig-head {
        gap: 14px;
    }
    .dsv-wrap,
    .dsig-inner {
        --dsv-width: 92vw;
        --dsig-width: 92vw;
    }
}

/* ---------- Forms -------------------------------------------------------- */
.wpcf7-form input[type="text"],
.wpcf7-form input[type="email"],
.wpcf7-form input[type="tel"],
.wpcf7-form textarea,
.wpcf7-form select {
    max-width: 100%;
}
@media (max-width: 767px) {
    .wpcf7-form input[type="text"],
    .wpcf7-form input[type="email"],
    .wpcf7-form textarea {
        font-size: 16px; /* stops iOS zooming into the field */
    }
    .uacf7-step.step-content button.uacf7-next,
    .uacf7-step.step-content button.uacf7-prev {
        margin-top: 16px;
    }
}


/* ==========================================================================
   3. ANIMATION SYSTEM
   ========================================================================== */

/* ---- 3a. Scroll reveals --------------------------------------------------
   assets/js/site-motion.js adds .ds-anim to the elements listed in its
   TARGETS table and .is-inview when they scroll into view. Nothing is hidden
   unless the script has run, so a JS failure can never blank the page.      */

:root {
    --ds-ease: cubic-bezier(.22, .61, .36, 1);
    --ds-dur: .8s;
    --ds-shift: 34px;
}

.ds-anim {
    opacity: 0;
}
.ds-anim.is-inview {
    opacity: 1;
    animation: ds-up var(--ds-dur) var(--ds-ease) var(--ds-delay, 0ms) backwards;
}
.ds-anim[data-ds-anim="left"].is-inview  { animation-name: ds-from-left; }
.ds-anim[data-ds-anim="right"].is-inview { animation-name: ds-from-right; }
.ds-anim[data-ds-anim="zoom"].is-inview  { animation-name: ds-zoom; }
.ds-anim[data-ds-anim="fade"].is-inview  { animation-name: ds-fade; }
.ds-anim[data-ds-anim="grow"].is-inview  { animation-name: ds-grow; animation-duration: 1s; }
.ds-anim[data-ds-anim="grow"]            { transform-origin: left center; }

@keyframes ds-up {
    from { opacity: 0; transform: translate3d(0, var(--ds-shift), 0); }
    to   { opacity: 1; transform: none; }
}
@keyframes ds-from-left {
    from { opacity: 0; transform: translate3d(calc(var(--ds-shift) * -1.6), 0, 0); }
    to   { opacity: 1; transform: none; }
}
@keyframes ds-from-right {
    from { opacity: 0; transform: translate3d(calc(var(--ds-shift) * 1.6), 0, 0); }
    to   { opacity: 1; transform: none; }
}
@keyframes ds-zoom {
    from { opacity: 0; transform: scale(.94); }
    to   { opacity: 1; transform: none; }
}
@keyframes ds-fade {
    from { opacity: 0; }
    to   { opacity: 1; }
}
@keyframes ds-grow {
    from { opacity: 0; transform: scaleX(0); }
    to   { opacity: 1; transform: none; }
}

/* Smaller travel on phones so nothing slides in from off-screen */
@media (max-width: 767px) {
    :root {
        --ds-shift: 22px;
        --ds-dur: .65s;
    }
    .ds-anim[data-ds-anim="left"].is-inview,
    .ds-anim[data-ds-anim="right"].is-inview {
        animation-name: ds-up;
    }
}

/* ---- 3b. Page-load entrances (pure CSS, always end visible) ------------- */

/* Header: slides in when it becomes the sticky bar */
#site-header.sticky {
    animation: ds-header-in .45s var(--ds-ease) backwards;
}
@keyframes ds-header-in {
    from { transform: translateY(-100%); }
    to   { transform: none; }
}
#site-header .header-logo,
#site-header .header-navigation,
#site-header .header-cta {
    animation: ds-fade .8s ease backwards;
}
#site-header .header-navigation { animation-delay: .1s; }
#site-header .header-cta        { animation-delay: .2s; }

/* Inner-page banner: breadcrumb, title, line and category/meta rise in one after another */
.inner-banner-breadcrumb { animation: ds-up .7s var(--ds-ease) .05s backwards; }
.inner-banner-category   { animation: ds-up .7s var(--ds-ease) .12s backwards; }
.inner-banner-title      { animation: ds-up .8s var(--ds-ease) .18s backwards; }
.inner-banner-meta       { animation: ds-up .8s var(--ds-ease) .3s  backwards; }
.inner-banner-line       { animation: ds-grow .9s var(--ds-ease) .4s backwards; transform-origin: center; }

.inner-banner-decoration {
    animation: ds-fade 1.2s ease backwards, ds-drift 14s ease-in-out 1.2s infinite alternate;
}
.inner-decoration-two {
    animation-delay: .2s, 1.2s;
    animation-direction: normal, alternate-reverse;
}
@keyframes ds-drift {
    from { transform: translate3d(0, 0, 0) scale(1); }
    to   { transform: translate3d(-14px, 12px, 0) scale(1.06); }
}

/* Lightboxes: fade/zoom open instead of popping */
.ds-ps-lightbox.is-open,
.ds-photo-single.is-open,
.ds-poster-lightbox.is-visible {
    animation: ds-fade .3s ease;
}
.ds-ps-lightbox.is-open img,
.ds-photo-single.is-open .ds-photo-single-image,
.ds-poster-lightbox.is-visible .ds-poster-lightbox-dialog {
    animation: ds-zoom .4s var(--ds-ease);
}

/* ---- 3c. Hover / focus polish on elements that had none ------------------ */
.footer-social a,
.share-buttons a,
.ds-pill,
.ds-ps-pill,
.founder-item,
.dsig-item,
.contact-item {
    transition: transform .3s var(--ds-ease), background-color .3s ease, color .3s ease, border-color .3s ease, box-shadow .3s ease;
}
@media (hover: hover) {
    .footer-social a:hover,
    .share-buttons a:hover {
        transform: translateY(-3px);
    }
    .ds-pill:hover,
    a.ds-ps-pill-link:hover {
        transform: translateY(-2px);
    }
    .ds-artist-factbox,
    .ds-artist-taxonomy-panel {
        transition: transform .3s var(--ds-ease), box-shadow .3s ease;
    }
    .ds-artist-factbox:hover,
    .ds-artist-taxonomy-panel:hover {
        transform: translateY(-3px);
        box-shadow: 0 14px 34px rgba(0, 0, 0, .07);
    }
    .ds-artist-accordion-item {
        transition: background-color .25s ease;
    }
    .ds-artist-accordion-item:hover {
        background-color: rgba(178, 138, 59, .05);
    }
}

/* ---- 3d. Respect user settings ------------------------------------------ */
@media (prefers-reduced-motion: reduce) {
    .ds-anim,
    .ds-anim.is-inview {
        opacity: 1 !important;
        transform: none !important;
        animation: none !important;
    }
    #site-header.sticky,
    #site-header .header-logo,
    #site-header .header-navigation,
    #site-header .header-cta,
    .inner-banner-breadcrumb,
    .inner-banner-category,
    .inner-banner-title,
    .inner-banner-meta,
    .inner-banner-line,
    .inner-banner-decoration,
    .ds-ps-lightbox.is-open,
    .ds-ps-lightbox.is-open img,
    .ds-photo-single.is-open,
    .ds-photo-single.is-open .ds-photo-single-image,
    .ds-poster-lightbox.is-visible,
    .ds-poster-lightbox.is-visible .ds-poster-lightbox-dialog {
        animation: none !important;
    }
}
@media print {
    .ds-anim,
    .ds-anim.is-inview {
        opacity: 1 !important;
        transform: none !important;
        animation: none !important;
    }
}


/* ==========================================================================
   4. HOME-PAGE SHORTCODE SECTIONS
   [featured_artists]  [featured_artworks]  [artists_in_their_own_words]  [instagram_gallery]
   These are dropped into Elementor, so they must size themselves and never
   depend on the surrounding column for their height or width.
   ========================================================================== */

/* ---- Featured artists / artworks -------------------------------------------
   Card height now comes from padding (a normal in-flow box) instead of
   aspect-ratio on a box whose children are all absolutely positioned, so the
   grid always reserves the space its cards need and can never be overlapped
   by the next section.                                                       */
.ds-af-embed {
    display: flow-root;
    position: relative;
    width: 100%;
    max-width: 100%;
    height: auto !important;
    min-height: 0;
    margin: 0;
}
.ds-af-embed .ds-af-grid,
.ds-af-embed .ds-artist-grid {
    width: 100%;
    height: auto !important;
    align-items: start;
}
.ds-af-embed .ds-af-card,
.ds-af-embed .ds-artist-card {
    position: relative;
    min-width: 0;
    height: auto;
}
.ds-af-embed .ds-af-link,
.ds-af-embed .ds-artist-card > a {
    height: 0;
    padding-top: 75%;          /* 4 : 3 */
    aspect-ratio: auto;
}
.ds-af-embed .ds-af-link img,
.ds-af-embed .ds-artist-card > a img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.ds-af-embed .ds-af-name,
.ds-af-embed .ds-artist-overlay h3 {
    overflow-wrap: anywhere;
}
@media (max-width: 575px) {
    /* one card per row on phones: two squeezed columns made the captions collide */
    .ds-af-embed .ds-af-grid,
    .ds-af-embed .ds-artist-grid {
        grid-template-columns: minmax(0, 1fr) !important;
        gap: 14px;
    }
    .ds-af-embed .ds-af-link,
    .ds-af-embed .ds-artist-card > a {
        padding-top: 68%;
    }
}

/* ---- Full-width sections: stack above whatever precedes them -------------- */
.dsv,
.dsig {
    position: relative;
    z-index: 1;
    display: flow-root;
    clear: both;
}

/* The 90vw + negative-margin centring assumes the parent spans the screen.
   On tablets / phones centre by auto margins instead, so it also works when
   Elementor puts the shortcode in a padded column. */
@media (max-width: 991px) {
    .dsv-wrap,
    .dsig-inner {
        width: 92vw;
        max-width: 100%;
        margin-left: auto;
        margin-right: auto;
    }
}

/* ---- Artists in their own words (.dsv) ------------------------------------ */
@media (max-width: 767px) {
    .dsv {
        padding: 36px 0;
    }
    .dsv-head {
        display: block;
    }
    .dsv-head-text + * {
        margin-top: 16px;
    }
    .dsv .dsv-sec-title {
        font-size: clamp(24px, 7vw, 30px);
    }
    .dsv .dsv-intro {
        max-width: none;
        font-size: 15px;
    }
    .dsv .dsv-btn {
        display: block;
        text-align: center;
    }
    .dsv .dsv-body-btn {
        display: inline-block;
    }
    .dsv-stage {
        min-height: 0;
    }
    .dsv .dsv-title {
        font-size: 16px;
    }
    .dsv-play {
        width: 48px;
        height: 48px;
    }
    .dsv-item {
        min-height: 64px;
        padding: 8px;
    }
    .dsv-item-title {
        font-size: 13px;
    }
    .dsv-nav button {
        width: 38px;
        height: 38px;
    }
}
@media (max-width: 400px) {
    .dsv-item {
        grid-template-columns: 72px minmax(0, 1fr);
    }
    .dsv .dsv-body-desc {
        font-size: 15px;
    }
}

/* ---- Instagram gallery (.dsig) -------------------------------------------- */
@media (max-width: 767px) {
    .dsig {
        padding: 40px 0;
    }
    .dsig-head {
        display: block;
        margin-bottom: 22px;
    }
    .dsig-head-links {
        align-items: flex-start;
        margin-top: 16px;
        flex-direction: row;
        flex-wrap: wrap;
        gap: 14px 20px;
    }
    .dsig-title {
        font-size: clamp(24px, 7vw, 30px);
    }
    .dsig-sub {
        font-size: 15px;
    }
    .dsig-social a {
        width: 42px;
        height: 42px;
    }
    .dsig-item {
        flex-basis: 78%;
    }
    .dsig-nav button {
        width: 42px;
        height: 42px;
    }
}
@media (min-width: 561px) and (max-width: 767px) {
    .dsig-item {
        flex-basis: calc((100% - var(--dsig-gap, 18px)) / 2);
    }
}
