/* ═══════════════════════════════════════════════════════════════════════════
   carving-finder.css — Full-screen map with bottom sheet + floating controls
   ═══════════════════════════════════════════════════════════════════════════ */

/* ─── FULL SCREEN MAP ───────────────────────────────────────────────────── */
/* .cl-animate-in has CSS transforms (settle animations) which trap
   position:fixed children. Kill the animation, use absolute chain. */

.cl-main:has(.cl-map-page) {
    padding: 0 !important;
    position: relative;
    height: 100vh;
    overflow: hidden;
}

    .cl-main:has(.cl-map-page) > .cl-animate-in {
        position: absolute;
        top: var(--cl-topbar-height, 56px);
        left: 0;
        right: 0;
        bottom: 0;
        animation: none !important;
        transform: none !important;
    }

.cl-map-page {
    position: absolute;
    inset: 0;
    overflow: hidden;
}

.cl-map-canvas {
    width: 100%;
    height: 100%;
}

.cl-map-status {
    position: absolute;
    top: var(--cl-space-4, 16px);
    left: 50%;
    z-index: 26;
    display: flex;
    align-items: center;
    gap: var(--cl-space-3, 12px);
    width: min(420px, calc(100% - 32px));
    padding: var(--cl-space-3, 12px) var(--cl-space-4, 16px);
    color: var(--cl-charcoal, #2A2A2A);
    background: rgba(255, 255, 255, 0.96);
    border: 1px solid var(--cl-concrete, #E8E5E0);
    border-radius: var(--cl-radius-md, 8px);
    box-shadow: var(--cl-shadow-md, 0 4px 12px rgba(0, 0, 0, 0.12));
    transform: translateX(-50%);
}

.cl-map-status span {
    flex: 1;
    min-width: 0;
    font-size: var(--cl-text-sm, 0.875rem);
}

/* ─── MAP VIEW CONTROLS ────────────────────────────────────────────────── */

.cl-map-controls {
    position: absolute;
    top: var(--cl-space-3, 12px);
    right: var(--cl-space-3, 12px);
    z-index: 25;
    display: flex;
    align-items: center;
    gap: 6px;
}

.cl-map-control-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    min-height: 42px;
    padding: 0 12px;
    color: var(--cl-charcoal, #2A2A2A);
    background: rgba(255, 255, 255, 0.97);
    border: 1px solid rgba(42, 42, 42, 0.16);
    border-radius: var(--cl-radius-md, 8px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
    cursor: pointer;
    font-family: var(--cl-font-heading);
    font-size: var(--cl-text-sm, 0.875rem);
    font-weight: 700;
    white-space: nowrap;
    transition: border-color 140ms ease, box-shadow 140ms ease, transform 140ms ease;
}

.cl-map-control-btn:hover:not(:disabled) {
    border-color: var(--cl-stihl-orange, #F37A1F);
    box-shadow: 0 3px 11px rgba(0, 0, 0, 0.22);
    transform: translateY(-1px);
}

.cl-map-control-btn:focus-visible {
    outline: 3px solid rgba(243, 122, 31, 0.35);
    outline-offset: 2px;
}

.cl-map-control-btn:disabled {
    cursor: default;
    opacity: 0.55;
}

.cl-map-control-btn svg,
.cl-map-control-btn > .cl-spinner {
    flex: 0 0 auto;
    width: 18px;
    height: 18px;
}

@media (max-width: 620px) {
    .cl-map-controls {
        flex-direction: column;
        align-items: flex-end;
    }

    .cl-map-control-btn {
        width: 44px;
        min-height: 44px;
        padding: 0;
    }

    .cl-map-control-btn > span:not(.cl-spinner) {
        position: absolute;
        width: 1px;
        height: 1px;
        padding: 0;
        margin: -1px;
        overflow: hidden;
        clip: rect(0, 0, 0, 0);
        white-space: nowrap;
        border: 0;
    }
}


/* ─── FLOATING ACTION BUTTON (pin a carving) ────────────────────────────── */

.cl-map-fab {
    position: absolute;
    right: 16px;
    bottom: 90px;
    z-index: 10;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: none;
    background: var(--cl-stihl-orange, #F37A1F);
    color: #fff;
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
    transition: transform 180ms cubic-bezier(0.22, 0.61, 0.36, 1), box-shadow 180ms cubic-bezier(0.22, 0.61, 0.36, 1);
}

    .cl-map-fab:hover {
        transform: scale(1.08);
        box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
    }

    .cl-map-fab:active {
        transform: scale(0.95);
    }

.cl-map-pin-btn {
    position: absolute;
    bottom: calc(var(--cl-space-8) + env(safe-area-inset-bottom, 0px));
    left: 50%;
    transform: translateX(-50%);
    z-index: 25; /* above the bottom sheet, below app navigation and dialogs */

    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 22px;
    border: none;
    border-radius: 999px;
    cursor: pointer;
    background: var(--cl-stihl-orange);
    color: #fff;
    font-family: var(--cl-font-heading);
    font-weight: 700;
    font-size: var(--cl-text-base);
    letter-spacing: 0.01em;
    white-space: nowrap;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
    transition: transform 150ms var(--cl-ease-settle), box-shadow 150ms ease, background 150ms ease;
}

    .cl-map-pin-btn:hover {
        transform: translateX(-50%) translateY(-2px);
        box-shadow: 0 6px 18px rgba(0, 0, 0, 0.3);
    }

    .cl-map-pin-btn:active {
        transform: translateX(-50%) translateY(0);
    }

/* Nudge it up a little on mobile so it clears the bottom sheet handle */
@media (max-width: 768px) {
    .cl-map-pin-btn {
        bottom: calc(var(--cl-space-10) + env(safe-area-inset-bottom, 0px));
    }
}

/* ─── BOTTOM SHEET ──────────────────────────────────────────────────────── */

.cl-bottom-sheet {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 20;
    background: var(--cl-white, #FFFFFF);
    border-radius: 16px 16px 0 0;
    box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.12);
    transition: transform 360ms cubic-bezier(0.22, 0.61, 0.36, 1);
    max-height: 80vh;
    display: flex;
    flex-direction: column;
}

    /* Sheet states via transform */
    .cl-bottom-sheet.peek {
        transform: translateY(calc(100% - 56px));
    }

    .cl-bottom-sheet.half {
        transform: translateY(50%);
    }

    .cl-bottom-sheet.full {
        transform: translateY(0);
    }

    .cl-bottom-sheet.hidden {
        transform: translateY(100%);
    }

/* Drag handle */
.cl-sheet-handle {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 10px 16px 6px;
    cursor: grab;
    flex-shrink: 0;
    user-select: none;
    -webkit-user-select: none;
}

.cl-sheet-handle-bar {
    width: 36px;
    height: 4px;
    border-radius: 2px;
    background: var(--cl-concrete, #E8E5E0);
}

.cl-sheet-header {
    display: flex;
    width: 100%;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px 12px;
    color: inherit;
    text-align: left;
    cursor: pointer;
    background: none;
    border: 0;
    flex-shrink: 0;
}

.cl-sheet-header:focus-visible {
    outline: 2px solid var(--cl-stihl-orange, #F37A1F);
    outline-offset: -2px;
}

.cl-sheet-header-title {
    font-weight: 700;
    font-family: var(--cl-font-heading, 'Roboto Condensed', sans-serif);
    font-size: var(--cl-text-base, 1rem);
    color: var(--cl-charcoal, #2A2A2A);
}

.cl-sheet-header-count {
    font-size: var(--cl-text-xs, 0.75rem);
    color: var(--cl-steel, #6B6B6B);
}

.cl-sheet-body {
    flex: 1;
    overflow-y: auto;
    padding: 0 16px 16px;
    -webkit-overflow-scrolling: touch;
}

.cl-cluster-back {
    display: inline-flex;
    gap: 8px;
    align-items: center;
    margin: 0 0 4px;
    padding: 8px 0;
    border: 0;
    background: transparent;
    color: var(--cl-stihl-orange, #F37A1F);
    font: inherit;
    font-size: var(--cl-text-sm, 0.875rem);
    font-weight: 700;
    cursor: pointer;
}

.cl-cluster-back:focus-visible {
    outline: 2px solid var(--cl-stihl-orange, #F37A1F);
    outline-offset: 2px;
}


/* ─── SPOT CARDS (inside bottom sheet) ──────────────────────────────────── */

.cl-spot-card {
    display: flex;
    width: 100%;
    gap: 12px;
    align-items: center;
    padding: 12px 0;
    color: inherit;
    text-align: left;
    background: none;
    border: 0;
    border-bottom: 1px solid var(--cl-concrete-light, #F0EDE8);
    cursor: pointer;
    transition: opacity 120ms ease;
}

    .cl-spot-card:last-child {
        border-bottom: none;
    }

    .cl-spot-card:active {
        opacity: 0.7;
    }

    .cl-spot-card:focus-visible {
        outline: 2px solid var(--cl-stihl-orange, #F37A1F);
        outline-offset: -2px;
    }

.cl-spot-thumb {
    width: 48px;
    height: 48px;
    border-radius: 8px;
    object-fit: cover;
    flex-shrink: 0;
    background: var(--cl-concrete, #E8E5E0);
}

.cl-spot-info {
    flex: 1;
    min-width: 0;
}

.cl-spot-title {
    font-weight: 600;
    font-size: var(--cl-text-sm, 0.875rem);
    color: var(--cl-charcoal, #2A2A2A);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cl-spot-meta {
    font-size: var(--cl-text-xs, 0.75rem);
    color: var(--cl-steel, #6B6B6B);
    margin-top: 2px;
}


/* ─── DETAIL PANEL (inside drawer) ──────────────────────────────────────── */

.cl-spot-detail-photo {
    width: 100%;
    max-height: 360px;
    object-fit: contain;
    background: var(--cl-concrete-light, #F0EDE8);
    border-radius: var(--cl-radius-md, 8px);
    margin-bottom: var(--cl-space-4, 16px);
    display: block;
}

.cl-spot-detail-row {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
    font-size: var(--cl-text-sm, 0.875rem);
    border-bottom: 1px solid var(--cl-concrete-light, #F0EDE8);
}

    .cl-spot-detail-row:last-child {
        border-bottom: none;
    }

.cl-spot-detail-label {
    color: var(--cl-steel, #6B6B6B);
}

.cl-spot-detail-value {
    font-weight: 600;
    color: var(--cl-charcoal, #2A2A2A);
    text-align: right;
}


/* ─── POST FORM (inside drawer) ─────────────────────────────────────────── */

.cl-post-form {
    padding: var(--cl-space-4, 16px) 0;
}

    .cl-post-form .cl-input-group {
        margin-bottom: var(--cl-space-3, 12px);
    }

.cl-gps-btn {
    width: 100%;
    padding: var(--cl-space-4, 16px);
    border: 2px dashed var(--cl-concrete, #E8E5E0);
    border-radius: var(--cl-radius-md, 8px);
    background: transparent;
    cursor: pointer;
    text-align: center;
    transition: border-color 180ms ease, background 180ms ease;
}

    .cl-gps-btn:hover {
        border-color: var(--cl-stihl-orange, #F37A1F);
        background: var(--cl-orange-light, #FFF4EB);
    }

.cl-gps-locked {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    background: var(--cl-orange-light, #FFF4EB);
    border-radius: var(--cl-radius, 6px);
    margin-bottom: var(--cl-space-3, 12px);
}


/* ─── RESPONSIVE ────────────────────────────────────────────────────────── */

@media (min-width: 768px) {
    .cl-bottom-sheet {
        left: auto;
        right: 16px;
        width: 380px;
        border-radius: 16px 16px 0 0;
    }

    .cl-map-fab {
        bottom: 100px;
    }

    .cl-bottom-sheet.peek {
        transform: translateY(calc(100% - 56px));
    }

    .cl-bottom-sheet.half {
        transform: translateY(40%);
    }
}


/* ─── PUBLIC CARVING PAGE ──────────────────────────────────────────────── */

.cl-public-carving {
    width: min(1120px, 100%);
    margin: 0 auto;
    padding: var(--cl-space-6, 24px) 0;
}

.cl-public-carving-breadcrumb {
    display: flex;
    gap: var(--cl-space-2, 8px);
    align-items: center;
    margin-bottom: var(--cl-space-5, 20px);
    color: var(--cl-steel, #6B6B6B);
    font-size: var(--cl-text-sm, 0.875rem);
}

.cl-public-carving-breadcrumb a {
    color: var(--cl-stihl-orange, #F37A1F);
    font-weight: 600;
    text-decoration: none;
}

.cl-public-carving-breadcrumb span:last-child {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.cl-public-carving-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(320px, 0.8fr);
    overflow: hidden;
    background: var(--cl-white, #FFFFFF);
    border: 1px solid var(--cl-concrete, #E8E5E0);
    border-radius: var(--cl-radius-lg, 12px);
    box-shadow: var(--cl-shadow-md, 0 4px 12px rgba(0, 0, 0, 0.08));
}

.cl-public-carving-media {
    min-height: 520px;
    background: var(--cl-charcoal, #2A2A2A);
}

.cl-public-carving-media img,
.cl-public-carving-placeholder {
    display: block;
    width: 100%;
    height: 100%;
    min-height: 520px;
    object-fit: contain;
}

.cl-public-carving-placeholder {
    display: grid;
    place-items: center;
    color: var(--cl-white, #FFFFFF);
    font-size: 4rem;
}

.cl-public-carving-content {
    align-self: center;
    padding: clamp(24px, 5vw, 52px);
}

.cl-public-carving-kicker {
    margin-bottom: var(--cl-space-2, 8px);
    color: var(--cl-stihl-orange, #F37A1F);
    font-size: var(--cl-text-xs, 0.75rem);
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.cl-public-carving-content h1 {
    margin: 0 0 var(--cl-space-4, 16px);
    font-size: clamp(2rem, 5vw, 3.5rem);
    line-height: 1;
}

.cl-public-carving-badges {
    flex-wrap: wrap;
    margin-bottom: var(--cl-space-5, 20px);
}

.cl-public-carving-facts {
    margin: 0 0 var(--cl-space-6, 24px);
}

.cl-public-carving-facts > div {
    display: grid;
    grid-template-columns: minmax(90px, 0.7fr) minmax(0, 1.3fr);
    gap: var(--cl-space-4, 16px);
    padding: var(--cl-space-2, 8px) 0;
    border-bottom: 1px solid var(--cl-concrete-light, #F0EDE8);
}

.cl-public-carving-facts dt {
    color: var(--cl-steel, #6B6B6B);
    font-size: var(--cl-text-sm, 0.875rem);
}

.cl-public-carving-facts dd {
    margin: 0;
    overflow-wrap: anywhere;
    font-size: var(--cl-text-sm, 0.875rem);
    font-weight: 600;
}

.cl-public-carving-actions {
    display: flex;
    flex-wrap: wrap;
    gap: var(--cl-space-3, 12px);
}

.cl-public-carving-note {
    margin: var(--cl-space-4, 16px) 0 0;
    color: var(--cl-steel, #6B6B6B);
    font-size: var(--cl-text-sm, 0.875rem);
    line-height: 1.55;
}

.cl-public-carving-missing {
    width: min(560px, 100%);
    margin: var(--cl-space-10, 40px) auto;
    padding: var(--cl-space-8, 32px);
    text-align: center;
}

.cl-public-carving-missing p {
    margin: var(--cl-space-3, 12px) 0 var(--cl-space-5, 20px);
    color: var(--cl-steel, #6B6B6B);
}

@media (max-width: 860px) {
    .cl-public-carving-grid {
        grid-template-columns: 1fr;
    }

    .cl-public-carving-media,
    .cl-public-carving-media img,
    .cl-public-carving-placeholder {
        min-height: min(62vh, 520px);
        max-height: 520px;
    }
}

@media (max-width: 480px) {
    .cl-public-carving {
        padding-top: var(--cl-space-3, 12px);
    }

    .cl-public-carving-content {
        padding: var(--cl-space-5, 20px);
    }

    .cl-public-carving-actions > .cl-btn {
        width: 100%;
    }
}
