/* =============================================================
   s-mobile.css  —  Responsive layer for Jay Records
   Drop this file into /a/css/ alongside s.css
   It overrides the fixed-width desktop rules at smaller screens
   and adds the album card grid for department pages.
   ============================================================= */

/* ── Viewport fix ── */
@viewport { width: device-width; }

/* ── Base: fluid container ── */
#container {
    width: 100%;
    max-width: 1100px;
    box-sizing: border-box;
}

/* ── Header: always full width ── */
#header {
    width: 100%;
    box-sizing: border-box;
    overflow: hidden;
    min-height: 87px;
}

/* ── Logo: fixed dimensions on ALL screen sizes ── */
#header img {
    float: left;
    position: relative;
    left: 0;
    top: 0;
    width: 87px;
    height: 87px;
    object-fit: contain;
}

/* ── Nav toggle button: hidden on desktop ── */
#nav-toggle {
    display: none;
}

/* =============================================================
   DESKTOP BASE — recording detail layout fixes
   ============================================================= */

/* Contain the floated left/right columns */
#mainRecordings {
    overflow: hidden;
}

/* On desktop, mainRecordings is float:right width:800px in s.css.
   Now our container is fluid (max-width:1100px), so we need to
   let mainRecordings fill the remaining space after the 166px nav. */
#mainRecordings {
    float: right;
    width: calc(100% - 186px);
    min-width: 0;
}

/* mainRecordingsLeft stays at its fixed 280px from s.css — fine.
   mainRecordingsRight should fill the rest of mainRecordings. */
#mainRecordingsRight {
    float: right;
    width: calc(100% - 300px);
    min-width: 0;
}

/* The "You may also like" wrapper clears both columns on desktop too */
.jay-also-wrap {
    clear: both;
    width: 100%;
    padding-top: 12px;
}

/* Track group headers from database often have inline styles —
   stop them bleeding outside their container */
#mainRecordingsRight div[style*="background-color"],
#mainRecordingsRight div[style*="background"] {
    box-sizing: border-box;
    max-width: 100%;
    overflow: hidden;
}

/* ── Logo: fixed dimensions on all screen sizes ── */
#header img {
    width: 87px !important;
    height: 87px !important;
    object-fit: contain;
}

/* ── Nav toggle: hidden on desktop, shown in mobile media query ── */
#nav-toggle {
    display: none;
}

/* ── Department intro text ── */
.dept-intro {
    font-size: 13px;
    color: #333;
    margin: 0 0 18px 0;
    line-height: 1.6;
    text-align: left;
}

/* ── Album card grid ── */
.rec-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 16px;
    padding: 4px 0 20px;
    text-align: left;
}

/* ── Individual card ── */
.rec-card {
    display: flex;
    flex-direction: column;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    overflow: hidden;
    background: #fff;
    transition: box-shadow 0.15s ease;
}

.rec-card:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.12);
}

/* ── Cover image ── */
.rec-card__img-link {
    display: block;
    background: #f5f5f5;
    border-bottom: 1px solid #e8e8e8;
    line-height: 0;
}

.rec-card__img {
    width: 100%;
    height: auto;
    display: block;
    aspect-ratio: 1 / 1;
    object-fit: cover;
}

.rec-card__img-placeholder {
    width: 100%;
    aspect-ratio: 1 / 1;
    background: #ebebeb;
}

/* ── Card body ── */
.rec-card__body {
    padding: 10px 10px 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
}

/* ── Title ── */
.rec-card__title {
    font-size: 12px;
    font-weight: bold;
    color: #222;
    text-decoration: none;
    line-height: 1.35;
    display: block;
}

.rec-card__title:hover {
    color: #c90e20;
    text-decoration: underline;
}

/* ── Strapline / cast description ── */
.rec-card__strapline {
    font-size: 11px;
    color: #555;
    margin: 0;
    line-height: 1.4;
}

/* ── Catalogue number ── */
.rec-card__catno {
    font-size: 11px;
    color: #888;
    margin: 0;
}

/* ── Price ── */
.rec-card__price {
    font-size: 12px;
    font-weight: bold;
    color: #333;
    margin: 2px 0 0;
}

/* ── Streaming / download links ── */
.rec-card__links {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin-top: 6px;
    border-top: 1px solid #f0f0f0;
    padding-top: 6px;
}

.rec-card__link {
    font-size: 11px;
    color: #333;
    text-decoration: none;
    display: block;
    padding: 1px 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.rec-card__link:hover {
    text-decoration: underline;
    color: #c90e20;
}

.rec-card__link-arrow {
    color: #c90e20;
    margin-right: 3px;
    font-size: 13px;
}

/* =============================================================
   RECORDING DETAIL PAGE  (recording.php / artist.php)
   ============================================================= */

/* Mobile-only cover: shown above the two-column split on small screens */
.rec-detail-mobile-cover {
    display: none;
}

/* Desktop cover: shown inside the left column */
.rec-detail-desktop-cover {
    display: block;
    margin-bottom: 10px;
}
.rec-detail-cover-img-desktop {
    width: 100%;
    max-width: 250px;
    height: auto;
    display: block;
}

.rec-detail-meta {
    font-size: 11px;
    color: #555;
    margin-bottom: 10px;
    line-height: 1.6;
}
.rec-detail-meta p { margin: 2px 0; }

/* Buy button link (North America / ROW) */
.jay-buy-btn {
    display: inline-block;
    background: #c90e20;
    color: #fff;
    font-size: 12px;
    font-weight: bold;
    padding: 6px 12px;
    border: 1px solid #c90e20;
    text-decoration: none;
    margin: 4px 0;
    border-radius: 2px;
}
.jay-buy-btn:hover {
    background: #a00b1a;
    border-color: #a00b1a;
}

/* Grey header boxes (Buy now / Download Links / Share / You may also like) */
.jay-box {
    width: 100%;
    border: 1px solid #ccc;
    margin-bottom: 8px;
    box-sizing: border-box;
}
.jay-box__head {
    background: #ccc;
    color: #fff;
    font-size: 12px;
    font-weight: bold;
    padding: 4px 6px;
}
.jay-box__body {
    padding: 6px 8px;
    border-top: 1px solid #ccc;
    font-size: 12px;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.jay-buy-row {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 6px;
}
.jay-buy-form { margin: 0; }

.rec-price {
    font-size: 16px;
    font-weight: bold;
    color: #c90e20;
}

/* Track listing */
.track-group-head {
    background: #ccc;
    color: #fff;
    font-size: 12px;
    padding: 3px 8px;
    margin-top: 10px;
}
.track-list {
    font-size: 12px;
    padding-left: 24px;
    margin: 6px 0 10px;
    line-height: 1.6;
}

/* "You may also like" / artist recordings grid */
.rec-also-grid {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.rec-also-item {
    display: flex;
    align-items: flex-start;
    gap: 8px;
}
.rec-also-img {
    width: 60px;
    height: 60px;
    object-fit: cover;
    flex-shrink: 0;
    border: 1px solid #e0e0e0;
}
.rec-also-title {
    font-size: 12px;
    color: #333;
    text-decoration: none;
    font-weight: bold;
    line-height: 1.4;
}
.rec-also-title:hover { color: #c90e20; text-decoration: underline; }

.rec-share-box .jay-box__body {
    flex-direction: row;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

/* =============================================================
   DESKTOP BASE — recording detail layout fix
   The s.css float layout needs clearing so #mainRecordingsRight
   doesn't wrap oddly when the container is narrower than 800px.
   ============================================================= */

/* Make the recording detail wrapper clear its floated children */
#mainRecordings {
    overflow: hidden; /* clearfix */
}

/* =============================================================
   RESPONSIVE BREAKPOINTS
   ============================================================= */

/* ── Tablet (≤900px): fluid container, collapse nav to pills ── */
@media (max-width: 900px) {

    /* White background — remove the grey side tile */
    body {
        background-image: none !important;
        background-color: #fff !important;
    }

    #container {
        width: 100%;
        padding: 0 12px;
        box-sizing: border-box;
    }

    /* ── Header: flex to keep logo + text together ── */
    #header {
        height: auto !important;
        min-height: 60px !important;
        display: flex !important;
        flex-wrap: wrap !important;
        align-items: center !important;
        padding: 8px 12px !important;
        box-sizing: border-box !important;
    }

    #header img {
        float: none !important;
        position: static !important;
        width: 52px !important;
        height: 52px !important;
        object-fit: contain !important;
        flex-shrink: 0;
        order: 1;
        align-self: center;
    }

    #header h1 {
        float: none !important;
        clear: none !important;
        font-size: 14px !important;
        padding: 0 0 0 10px !important;
        margin: 0 !important;
        color: #fff !important;
        line-height: 1.2 !important;
        order: 2;
        flex-basis: calc(100% - 72px);
        flex-shrink: 1;
    }

    #header h2 {
        float: none !important;
        clear: none !important;
        font-size: 11px !important;
        padding: 0 !important;
        margin: 0 0 0 62px !important;
        color: rgba(255,255,255,0.85) !important;
        line-height: 1.4 !important;
        order: 3;
        flex-basis: 100%;
    }

    /* ── Nav toggle button: show on mobile ── */
    #nav-toggle {
        display: flex !important;
        align-items: center;
        gap: 8px;
        width: 100%;
        background: #f5f5f5;
        border: 1px solid #ddd;
        border-radius: 4px;
        padding: 8px 12px;
        font-size: 13px;
        font-family: Arial, Helvetica, sans-serif;
        color: #333;
        cursor: pointer;
        text-align: left;
        box-sizing: border-box;
    }
    #nav-toggle:hover { background: #ebebeb; }
    #nav-toggle .nav-toggle-arrow {
        margin-left: auto;
        font-size: 11px;
        transition: transform 0.2s ease;
        display: inline-block;
    }
    #nav-toggle.open .nav-toggle-arrow {
        transform: rotate(180deg);
    }

    /* ── Nav: float off, collapsible ── */
    #nav {
        float: none !important;
        width: 100% !important;
        border-bottom: 1px solid #ddd;
        padding-bottom: 0;
        margin-bottom: 10px;
        background: #fff;
    }

    #navArea {
        width: 100% !important;
        left: 0 !important;
        position: static !important;
        display: none; /* hidden by default, JS toggles this */
        flex-wrap: wrap;
        gap: 4px;
        padding: 8px 0 6px;
        border-top: 1px solid #eee;
        margin-top: 0;
    }

    /* When open */
    #navArea.nav-open {
        display: flex !important;
    }

    /* Each nav paragraph becomes inline */
    #navMain p,
    #navHeader p {
        margin: 0 !important;
        padding: 0 !important;
        display: inline;
    }

    /* Nav links become pills */
    #nav #navMain p a {
        display: inline-block;
        padding: 4px 10px;
        background: #fff;
        border: 1px solid #ccc;
        border-radius: 14px;
        font-size: 11px;
        color: #333 !important;
        text-decoration: none !important;
        white-space: nowrap;
        line-height: 2;
    }

    #nav #navMain p a:hover {
        background: #c90e20 !important;
        color: #fff !important;
        border-color: #c90e20 !important;
    }

    /* Hide decorative elements */
    #navMain hr,
    #navHeader hr,
    #navHeader p {
        display: none !important;
    }

    /* Partner logos */
    #nav #navMain img {
        width: 70px;
        height: auto;
    }

    /* ── Main content: full width ── */
    #main,
    #mainRecordings {
        float: none !important;
        width: 100% !important;
    }

    /* ── Catalogue grid ── */
    .rec-grid {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
        gap: 12px;
    }

    /* ── Recording detail: side-by-side still works at tablet ── */
    #mainRecordingsLeft {
        float: left !important;
        width: 260px !important;
        position: static !important;
        top: auto !important;
    }

    #mainRecordingsRight {
        float: right !important;
        width: calc(100% - 280px) !important;
    }
}

/* ── Mobile (≤640px): fully stacked, left column goes first ── */
@media (max-width: 640px) {

    #container {
        padding: 0 8px;
        box-sizing: border-box;
    }

    /* ── Catalogue grid: two columns ── */
    .rec-grid {
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }
    .rec-card__title    { font-size: 11px; }
    .rec-card__strapline,
    .rec-card__catno,
    .rec-card__link     { font-size: 10px; }
    .rec-card__body     { padding: 7px 7px 9px; }

    /* ── Recording detail: fully stacked ──
       Left column (cover + buy/download boxes) comes FIRST in HTML
       so it naturally appears above the right column (description).
       We just need to cancel the floats and make both full-width.      */
    #mainRecordingsLeft {
        float: none !important;
        width: 100% !important;
        position: static !important;
        top: auto !important;
    }

    #mainRecordingsRight {
        float: none !important;
        width: 100% !important;
        margin-top: 16px;
    }

    /* Show the mobile cover image (full-width, above left col content) */
    .rec-detail-mobile-cover {
        display: block;
        margin-bottom: 12px;
    }
    .rec-detail-cover-img {
        width: 100%;
        max-width: 260px;
        height: auto;
        display: block;
        margin: 0 auto;
    }

    /* Hide the desktop cover (it's inside #mainRecordingsLeft) */
    .rec-detail-desktop-cover {
        display: none !important;
    }

    /* Titles */
    #mainRecordings h1 { font-size: 17px; }
    #mainRecordings h2 { font-size: 12px; }

    /* Buy buttons full width */
    .jay-buy-btn {
        display: block;
        text-align: center;
        margin: 5px 0;
    }

    /* Jay boxes full width */
    .jay-box {
        width: 100% !important;
    }
}

/* ── Small mobile (≤380px): single column catalogue ── */
@media (max-width: 380px) {
    .rec-grid {
        grid-template-columns: 1fr;
    }
}
