/* ═══════════════════════════════════════════════════════════════════════════
   TTM Single Machine Page v1.0.0
   Layout: specs left · gallery right
   Lightbox: full image with thumbnail strip
   Responsive: stacks to gallery-top on mobile
═══════════════════════════════════════════════════════════════════════════ */

/* ── CSS variables ───────────────────────────────────────────────────────── */
.ttms-page {
    --ttms-primary:   #ffc701;
    --ttms-font:      'Oswald', sans-serif;
    --ttms-bg:        #1a1a1a;
    --ttms-bg-light:  #222222;
    --ttms-border:    #2a2a2a;
    --ttms-text:      #ffffff;
    --ttms-muted:     #888888;
    --ttms-label:     #666666;

    font-family: var(--ttms-font);
    color: var(--ttms-text);
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 0 60px;
    box-sizing: border-box;
}

/* ══════════════════════════════════════════════════════════════════════════
   VIEW DETAILS — two injection points per card
   Both appended to .ttm-card-front by JS (same technique as delete plugin).
══════════════════════════════════════════════════════════════════════════ */

/* A: Title link — always visible, cursor pointer on hover */
.ttms-title-link {
    text-decoration: none !important;
    color: inherit !important;
    display: block;
    cursor: pointer;
}
.ttms-title-link:hover .ttm-card-name {
    text-decoration: underline;
    text-decoration-color: rgba(0,0,0,0.35);
    text-underline-offset: 2px;
}

/* B: Yellow "View Details" bar
   - position: absolute on .ttm-card-front
   - bottom is set by JS to exactly match the bottom of .ttm-card-media
   - opacity: 0 at rest, opacity: 1 on .ttm-card-wrapper:hover
   - z-index: 25 (above slide controls at 10, above delete btn at 20)
   - pointer-events: none on the <a> so it doesn't block slider arrows,
     but pointer-events: all on the <span> so the label itself IS clickable
*/
.ttms-img-overlay {
    position: absolute;
    left:   0;
    right:  0;
    bottom: 260px;   /* JS overrides this with exact measured value */
    height: 40px;
    z-index: 25;
    pointer-events: none;
    text-decoration: none !important;
    display: flex;
    align-items: stretch;
}

.ttms-img-overlay__label {
    pointer-events: all;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    height: 100%;
    padding: 0 14px;
    background: rgba(255, 199, 1, 0.95);
    color: #111111 !important;
    font-family: var(--ttm-font, 'Oswald', sans-serif) !important;
    font-size: 12px !important;
    font-weight: 700 !important;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    text-decoration: none !important;
    box-sizing: border-box;
    /* Hidden by default — shown on card hover */
    opacity: 0;
    transition: opacity 0.2s ease;
}

.ttms-img-overlay__label svg {
    stroke: #111111 !important;
    flex-shrink: 0;
}

/* Show when hovering the CARD WRAPPER — reliable trigger */
.ttm-card-wrapper:hover .ttms-img-overlay__label {
    opacity: 1;
}

/* Mobile (touch) — always visible since no hover */
@media ( hover: none ), ( max-width: 660px ) {
    .ttms-img-overlay__label {
        opacity: 1 !important;
        font-size: 11px !important;
    }
}

/* ── Back nav ────────────────────────────────────────────────────────────── */
.ttms-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
    padding: 20px 0 24px;
    border-bottom: 1px solid var(--ttms-border);
    margin-bottom: 36px;
}

.ttms-back-link {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-family: var(--ttms-font);
    font-size: 12px;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    font-weight: 700;
    color: var(--ttms-muted) !important;
    text-decoration: none !important;
    transition: color 0.2s;
}
.ttms-back-link:hover { color: var(--ttms-primary) !important; }
.ttms-back-link svg { stroke: currentColor; flex-shrink: 0; }

.ttms-breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
}
.ttms-breadcrumb__badge {
    font-size: 9px;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--ttms-label);
    font-weight: 700;
}
.ttms-breadcrumb__type {
    background: var(--ttms-primary);
    color: #111;
    font-size: 9px;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    font-weight: 700;
    padding: 3px 9px;
    border-radius: 4px;
}

/* ── Main layout ─────────────────────────────────────────────────────────── */
.ttms-layout {
    display: grid;
    grid-template-columns: 380px 1fr;
    gap: 48px;
    align-items: start;
}

/* ══════════════════════════════════════════════════════════════════════════
   LEFT — SPECS CARD
   Single white card: yellow header → white body sections with dividers
══════════════════════════════════════════════════════════════════════════ */

/* Card wrapper — white, rounded, shadow */
.ttms-specs {
    display: flex;
    flex-direction: column;
    gap: 0;
    background: #ffffff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 28px rgba(0,0,0,0.13);
    border: 1px solid #e8e8e8;
}

/* ── YELLOW HEADER — title, year, make, stars ─────────────────────────── */
.ttms-title-block {
    background: var(--ttms-primary);
    padding: 24px 24px 20px;
    position: relative;
}

.ttms-year {
    font-size: 11px;
    letter-spacing: 2.5px;
    text-transform: uppercase;
    color: rgba(0,0,0,0.45);
    font-weight: 700;
    margin-bottom: 6px;
}

.ttms-title {
    font-family: var(--ttms-font) !important;
    font-size: 1.9rem !important;
    font-weight: 700 !important;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    line-height: 1.15;
    color: #111111 !important;
    margin: 0 0 6px !important;
    padding: 0 !important;
}

.ttms-make {
    font-size: 11px;
    color: rgba(0,0,0,0.5);
    font-weight: 700;
    letter-spacing: 2px;
    text-transform: uppercase;
}

/* ── CONDITION (stars) ───────────────────────────────────────────────────── */
.ttms-condition-block {
    padding: 18px 24px;
    background: #fafafa;
    border-bottom: 1px solid #eeeeee;
    border-radius: 0;
    border: none;
    border-bottom: 1px solid #eeeeee;
}
.ttms-condition-label {
    font-size: 9px;
    letter-spacing: 2.5px;
    text-transform: uppercase;
    color: #999999;
    font-weight: 700;
    margin-bottom: 8px;
}
.ttms-stars { display: flex; gap: 4px; }
.ttms-star {
    font-size: 22px;
    color: #dddddd;
    line-height: 1;
    transition: color 0.1s;
}
.ttms-star.active { color: var(--ttms-primary); }

/* ── PRICE ───────────────────────────────────────────────────────────────── */
.ttms-price-block {
    padding: 18px 24px;
    background: #ffffff;
    border-bottom: 1px solid #eeeeee;
    border-top: 3px solid var(--ttms-primary);
    border-radius: 0;
    border-left: none;
    border-right: none;
}
.ttms-price-label {
    font-size: 9px;
    letter-spacing: 2.5px;
    text-transform: uppercase;
    color: #999999;
    font-weight: 700;
    margin-bottom: 6px;
}
.ttms-price {
    font-size: 2rem;
    font-weight: 700;
    color: #111111;
    line-height: 1;
    font-family: var(--ttms-font);
}
.ttms-price span,
.ttms-poa {
    font-size: 13px;
    color: #888888;
    font-weight: 400;
    margin-left: 4px;
}

/* ── SPECIFICATIONS ──────────────────────────────────────────────────────── */
.ttms-stats-block {
    background: #ffffff;
    border-bottom: 1px solid #eeeeee;
    border-radius: 0;
    overflow: hidden;
    border: none;
    border-bottom: 1px solid #eeeeee;
}
.ttms-stats-label {
    font-size: 9px;
    letter-spacing: 2.5px;
    text-transform: uppercase;
    color: #999999;
    font-weight: 700;
    padding: 14px 24px 10px;
    border-bottom: 1px solid #eeeeee;
    background: #fafafa;
}
.ttms-stats-table { padding: 0; }
.ttms-stat-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 24px;
    border-bottom: 1px solid #f0f0f0;
    transition: background 0.15s;
}
.ttms-stat-row:last-child { border-bottom: none; }
.ttms-stat-row:hover { background: #fafafa; }
.ttms-stat-icon { font-size: 15px; flex-shrink: 0; width: 20px; text-align: center; }
.ttms-stat-name {
    font-size: 11px;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: #888888;
    font-weight: 700;
    flex: 1;
}
.ttms-stat-val {
    font-size: 14px;
    font-weight: 700;
    color: #111111;
    text-align: right;
}

/* ── NOTES ───────────────────────────────────────────────────────────────── */
.ttms-notes-block {
    background: #fffdf0;
    border-bottom: 1px solid #eeeeee;
    border-left: 4px solid var(--ttms-primary);
    border-radius: 0;
    border-top: none;
    border-right: none;
    padding: 16px 20px 16px 20px;
}
.ttms-notes-label {
    font-size: 9px;
    letter-spacing: 2.5px;
    text-transform: uppercase;
    color: #999999;
    font-weight: 700;
    margin-bottom: 8px;
}
.ttms-notes-text {
    font-size: 13px;
    color: #444444;
    line-height: 1.75;
    margin: 0 !important;
    font-family: sans-serif;
}

/* ── ENQUIRE BUTTON ──────────────────────────────────────────────────────── */
.ttms-enquire-block {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 20px 24px 24px;
    background: #ffffff;
}

.ttms-enquire-btn {
    display: flex !important;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 16px !important;
    background: var(--ttms-primary) !important;
    background-color: #ffc701 !important;
    color: #111111 !important;
    border: none !important;
    border-radius: 8px;
    font-family: var(--ttms-font) !important;
    font-size: 15px !important;
    font-weight: 700 !important;
    letter-spacing: 2px;
    text-transform: uppercase;
    cursor: pointer;
    transition: background 0.2s, letter-spacing 0.2s;
    min-height: 54px;
}
.ttms-enquire-btn:hover { background: #ffd740 !important; letter-spacing: 2.5px; }
.ttms-enquire-btn svg { stroke: currentColor; flex-shrink: 0; }
.ttms-enquire-note {
    font-size: 11px;
    color: #999999;
    text-align: center;
    margin: 0 !important;
    letter-spacing: 0.5px;
}

/* ══════════════════════════════════════════════════════════════════════════
   RIGHT — GALLERY
══════════════════════════════════════════════════════════════════════════ */
.ttms-gallery { display: flex; flex-direction: column; gap: 12px; }

/* Main image — fixed 16:9 ratio, object-fit:cover so all images fill equally */
.ttms-gallery__main {
    width: 100%;
    aspect-ratio: 16 / 10;
    background: #111;
    border-radius: 10px;
    overflow: hidden;
    position: relative;
    cursor: zoom-in;
}
.ttms-gallery__main-inner {
    width: 100%; height: 100%;
    position: relative;
}
.ttms-gallery__main img,
#ttms-main-img-el {
    width: 100%;
    height: 100%;
    object-fit: cover;     /* always fills the frame regardless of upload dimensions */
    display: block;
    transition: opacity 0.18s ease;
}
#ttms-main-img-el.ttms-fading { opacity: 0; }

/* Expand icon */
.ttms-gallery__expand {
    position: absolute;
    top: 12px; right: 12px;
    width: 40px; height: 40px;
    background: rgba(0,0,0,0.55);
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 8px;
    color: #fff;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    opacity: 0;
    transition: opacity 0.2s, background 0.2s;
    backdrop-filter: blur(4px);
    padding: 0;
    z-index: 2;
}
.ttms-gallery__main:hover .ttms-gallery__expand { opacity: 1; }
.ttms-gallery__expand:hover { background: rgba(255,199,1,0.9); color: #111; }
.ttms-gallery__expand svg { stroke: currentColor; }

/* Inline prev/next arrows */
.ttms-gallery__arrow {
    position: absolute;
    top: 50%; transform: translateY(-50%);
    width: 42px; height: 42px;
    background: rgba(0,0,0,0.55);
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 50%;
    color: #fff;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    opacity: 0;
    transition: opacity 0.2s, background 0.2s;
    backdrop-filter: blur(4px);
    padding: 0;
    z-index: 2;
}
.ttms-gallery__arrow--prev { left: 14px; }
.ttms-gallery__arrow--next { right: 14px; }
.ttms-gallery__main:hover .ttms-gallery__arrow { opacity: 1; }
.ttms-gallery__arrow:hover { background: rgba(255,199,1,0.9); color: #111; }
.ttms-gallery__arrow svg { stroke: currentColor; }

/* ── Thumbnail grid — all exactly the same size ───────────────────────── */
/* Grid wraps automatically — same size regardless of image source ratio  */
.ttms-gallery__thumbs {
    display: grid;
    grid-template-columns: repeat( auto-fill, minmax(90px, 1fr) );
    gap: 8px;
}

.ttms-gallery__thumb {
    /* Fixed aspect ratio — every thumbnail is exactly 16:10 */
    aspect-ratio: 16 / 10;
    border-radius: 6px;
    overflow: hidden;
    border: 2px solid #2a2a2a;
    cursor: pointer;
    padding: 0;
    transition: border-color 0.2s, transform 0.15s, opacity 0.15s;
    background: #111;
    display: block;
    width: 100%;
}
.ttms-gallery__thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;  /* crop to fill — uniform regardless of original size */
    display: block;
}
.ttms-gallery__thumb:hover {
    border-color: rgba(255,199,1,0.6);
    transform: translateY(-2px);
    opacity: 0.9;
}
.ttms-gallery__thumb.active {
    border-color: var(--ttms-primary);
    opacity: 1;
}

/* Empty state */
.ttms-gallery__empty {
    aspect-ratio: 16 / 10;
    background: #1a1a1a;
    border: 1px solid #2a2a2a;
    border-radius: 10px;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    gap: 12px; color: #666;
}
.ttms-gallery__empty span { font-size: 44px; }
.ttms-gallery__empty p { margin: 0; font-size: 14px; }

/* ══════════════════════════════════════════════════════════════════════════
   LIGHTBOX
══════════════════════════════════════════════════════════════════════════ */
.ttms-lightbox {
    position: fixed; inset: 0; z-index: 999999;
    display: flex; align-items: center; justify-content: center;
}
.ttms-lightbox[hidden] { display: none; }

.ttms-lightbox__backdrop {
    position: absolute; inset: 0;
    background: rgba(0,0,0,0.92);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.28s ease;
}
.ttms-lb-open .ttms-lightbox__backdrop { opacity: 1; }

.ttms-lightbox__box {
    position: relative; z-index: 1;
    width: 100%; height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 60px 120px;
    box-sizing: border-box;
    opacity: 0;
    transform: scale(0.96);
    transition: opacity 0.28s ease, transform 0.28s ease;
}
.ttms-lb-open .ttms-lightbox__box { opacity: 1; transform: scale(1); }

/* Close button */
.ttms-lightbox__close {
    position: absolute; top: 16px; right: 16px;
    width: 40px; height: 40px;
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 8px;
    color: #fff;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    padding: 0; z-index: 10;
    transition: background 0.2s;
}
.ttms-lightbox__close:hover { background: rgba(255,255,255,0.2); }
.ttms-lightbox__close svg { stroke: currentColor; }

/* Counter */
.ttms-lightbox__counter {
    position: absolute; top: 22px; left: 50%; transform: translateX(-50%);
    font-family: var(--ttms-font);
    font-size: 12px; letter-spacing: 2px; color: rgba(255,255,255,0.5);
    font-weight: 700; text-transform: uppercase;
}

/* Main image */
.ttms-lightbox__img-wrap {
    max-width: 100%; max-height: 100%;
    display: flex; align-items: center; justify-content: center;
    flex: 1;
    width: 100%;
    position: relative;
}
#ttms-lb-img {
    max-width: 100%;
    max-height: calc(100vh - 200px);
    object-fit: contain;
    border-radius: 4px;
    display: block;
    transition: opacity 0.2s;
    box-shadow: 0 20px 80px rgba(0,0,0,0.7);
}
#ttms-lb-img.ttms-lb-loading { opacity: 0.3; }

/* Prev / Next */
.ttms-lightbox__nav {
    position: absolute;
    top: 50%; transform: translateY(-50%);
    width: 48px; height: 48px;
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 50%;
    color: #fff; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    padding: 0; z-index: 5;
    transition: background 0.2s, border-color 0.2s;
}
.ttms-lightbox__nav--prev { left: 16px; }
.ttms-lightbox__nav--next { right: 16px; }
.ttms-lightbox__nav:hover {
    background: rgba(255,199,1,0.85);
    border-color: transparent;
    color: #111;
}
.ttms-lightbox__nav svg { stroke: currentColor; }

/* Thumbnail strip inside lightbox */
.ttms-lightbox__thumbs {
    position: absolute;
    bottom: 20px; left: 50%; transform: translateX(-50%);
    display: flex; gap: 8px;
    max-width: 90vw; overflow-x: auto;
    padding: 4px 0;
}
.ttms-lb-thumb {
    flex: 0 0 56px; height: 42px;
    border-radius: 5px; overflow: hidden;
    border: 2px solid rgba(255,255,255,0.15);
    cursor: pointer; padding: 0;
    transition: border-color 0.18s;
    background: #111;
}
.ttms-lb-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ttms-lb-thumb.active { border-color: var(--ttms-primary); }
.ttms-lb-thumb:hover { border-color: rgba(255,199,1,0.6); }

/* ══════════════════════════════════════════════════════════════════════════
   ENQUIRY MODAL (single page)
══════════════════════════════════════════════════════════════════════════ */
.ttms-enq-modal {
    position: fixed; inset: 0; z-index: 99999;
    display: flex; align-items: center; justify-content: center;
    padding: 16px; box-sizing: border-box;
}
.ttms-enq-modal[hidden] { display: none; }

.ttms-enq-modal__backdrop {
    position: absolute; inset: 0;
    background: rgba(0,0,0,0.75);
    backdrop-filter: blur(3px);
    cursor: pointer;
    opacity: 0; transition: opacity 0.28s;
}
.ttms-enq-open .ttms-enq-modal__backdrop { opacity: 1; }

.ttms-enq-modal__box {
    position: relative; z-index: 1;
    width: 100%; max-width: 540px;
    max-height: 90dvh;
    background: #0d0d0d;
    border-radius: 14px;
    border: 2px solid #252525;
    box-shadow: 0 24px 80px rgba(0,0,0,0.7);
    display: flex; flex-direction: column;
    overflow: hidden;
    opacity: 0; transform: translateY(20px) scale(0.97);
    transition: opacity 0.28s, transform 0.28s;
}
.ttms-enq-open .ttms-enq-modal__box { opacity: 1; transform: translateY(0) scale(1); }

.ttms-enq-modal__header {
    background: var(--ttms-primary);
    padding: 18px 22px;
    display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
    flex-shrink: 0;
}
.ttms-enq-modal__eyebrow {
    font-family: 'Oswald', sans-serif;
    font-size: 9px; font-weight: 700;
    letter-spacing: 3px; text-transform: uppercase;
    color: rgba(0,0,0,0.45);
    margin-bottom: 3px;
}
.ttms-enq-modal__title {
    font-family: 'Oswald', sans-serif !important;
    font-size: 18px !important; font-weight: 700 !important;
    text-transform: uppercase; color: #111 !important;
    margin: 0 !important; padding: 0 !important;
    line-height: 1.2;
}
.ttms-enq-modal__close {
    display: flex; align-items: center; justify-content: center;
    width: 32px; height: 32px;
    background: rgba(0,0,0,0.12); border: none; border-radius: 6px;
    color: rgba(0,0,0,0.5); cursor: pointer; padding: 0;
    transition: background 0.15s;
}
.ttms-enq-modal__close:hover { background: rgba(0,0,0,0.22); color: #111; }
.ttms-enq-modal__close svg { stroke: currentColor; }

.ttms-enq-modal__body {
    flex: 1; overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 20px 22px 22px;
}

/* Re-use TTM enquiry form styling inside the modal */
.ttms-enq-form .ttm-dyn-field select,
.ttms-enq-form .ttm-form-row input,
.ttms-enq-form .ttm-form-row textarea {
    font-size: 14px !important;
}

.ttms-enq-submit {
    width: 100%; margin-top: 12px;
    display: flex; align-items: center; justify-content: center; gap: 10px;
    padding: 14px !important;
    background: var(--ttms-primary) !important; background-color: #ffc701 !important;
    color: #111111 !important;
    border: none !important; border-radius: 8px;
    font-family: 'Oswald', sans-serif !important;
    font-size: 14px !important; font-weight: 700 !important;
    letter-spacing: 2px; text-transform: uppercase;
    cursor: pointer; transition: background 0.2s;
    min-height: 50px;
}
.ttms-enq-submit:hover { background: #ffd740 !important; }

/* ── Empty / not found states ────────────────────────────────────────────── */
.ttms-page--empty { display: flex; justify-content: center; padding: 80px 20px; }
.ttms-empty-state {
    text-align: center; max-width: 400px;
}
.ttms-empty-state span { font-size: 52px; display: block; margin-bottom: 16px; }
.ttms-empty-state h2 {
    font-family: var(--ttms-font); font-size: 1.6rem;
    text-transform: uppercase; margin: 0 0 10px;
}
.ttms-empty-state p { color: var(--ttms-muted); margin: 0 0 24px; }

/* ══════════════════════════════════════════════════════════════════════════
   RESPONSIVE
══════════════════════════════════════════════════════════════════════════ */
@media ( max-width: 900px ) {
    .ttms-layout {
        grid-template-columns: 1fr;
        gap: 32px;
    }
    /* Gallery goes first on mobile, then specs below */
    .ttms-gallery { order: -1; }
}

@media ( max-width: 640px ) {
    .ttms-title { font-size: 1.5rem !important; }
    .ttms-price { font-size: 1.6rem; }
    .ttms-gallery__thumb { aspect-ratio: 16 / 10; }
    .ttms-gallery__thumbs {
        grid-template-columns: repeat( auto-fill, minmax(72px, 1fr) );
    }
    .ttms-nav { padding: 14px 0 18px; }
}

@media ( max-width: 480px ) {
    .ttms-enquire-btn { font-size: 14px !important; }
    .ttms-lightbox__nav { width: 38px; height: 38px; }
    .ttms-lightbox__close { top: 8px; right: 8px; }
}
