/* ── InletAngler — Coastal Kayak Fishing Forecasts ── */
/* Colors tuned for WCAG AA contrast in direct Florida sunlight */

:root {
    --ocean-dark: #0a1628;
    --ocean-mid: #163356;
    --ocean-light: #246e96;
    --sand: #f4e8c1;
    --sunrise: #d9540e;
    /* High-contrast score palette — all ≥ 4.5:1 on white */
    --score-excellent: #15803d;  /* darker green */
    --score-good: #4d7c0f;      /* darker olive-green */
    --score-fair: #a16207;       /* dark amber */
    --score-poor: #c2410c;       /* dark orange */
    --score-bad: #dc2626;        /* true red */
    /* Text colors for readability */
    --text-primary: #111827;
    --text-secondary: #374151;
    --text-muted: #4b5563;
    /* Spacing scale */
    --space-1: 0.25rem;
    --space-2: 0.5rem;
    --space-3: 0.75rem;
    --space-4: 1rem;
    --space-5: 1.25rem;
}

/* Responsive base typography */
html {
    font-size: clamp(15px, 0.5vw + 14px, 18px);
}

/* Global tap target minimum on mobile interactive elements (WCAG 2.5.5) */
@media (hover: none) and (pointer: coarse) {
    button,
    .btn,
    select,
    .form-select,
    input[type="text"],
    input[type="email"],
    input[type="number"],
    input[type="date"],
    input[type="time"],
    input[type="file"] + label,
    .nav-link {
        min-height: 44px;
    }
    /* Icon-only buttons: also enforce minimum width so they're easier to tap. */
    .btn.btn-sm > i.bi:only-child,
    button > i.bi:only-child {
        min-width: 24px;
    }
    .navbar .btn-sm,
    .nav-link {
        min-width: 44px;
    }
}

/* Honor user reduced-motion preference (WCAG 2.3.3). */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.001ms !important;
        scroll-behavior: auto !important;
    }
}

body {
    background: #f0f4f8;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
    padding-bottom: 80px;
    padding-bottom: calc(80px + env(safe-area-inset-bottom, 0px));
    -webkit-text-size-adjust: 100%;
}

/* ── Navbar ── */
.navbar {
    background: linear-gradient(135deg, var(--ocean-dark), var(--ocean-mid)) !important;
}

/* InletAngler brand styling — sand/sage palette from wordmark */
.inletangler-navbar {
    background: #f3ead4 !important;
    border-bottom: 3px solid #b9803a;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.18);
    /* Keep navbar above the spot-selector strip so dropdowns aren't clipped
       (ca65 fix: Skill/Risk profile menu was hiding under the dark strip). */
    position: relative;
    z-index: 1040;
}
/* Force dropdown menus opened from the navbar to layer above every page
   chrome element (spot selector strip z=auto, sticky tabs, etc.). */
.inletangler-navbar .dropdown-menu,
.navbar .dropdown-menu {
    z-index: 1060 !important;
}
/* ca66: on narrow viewports anchor the navbar dropdown to the LEFT edge of
   the screen so the Skill/Risk menu (and any future right-aligned menu)
   does not overflow off the right side of the device. */
@media (max-width: 575.98px) {
    .inletangler-navbar .dropdown-menu.dropdown-menu-end,
    .inletangler-navbar .dropdown-menu {
        right: auto !important;
        left: 8px !important;
        /* Bootstrap applies inline transform via Popper; neutralize it so our
           left/right rules win on small screens. */
        transform: none !important;
        position: fixed !important;
        top: 56px !important;
        max-width: calc(100vw - 16px);
        width: calc(100vw - 16px);
    }
}
.brand-wordmark-img {
    height: 56px;
    width: auto;
    max-width: 100%;
    display: block;
    object-fit: contain;
}
/* ca66: on phones stretch the wordmark to fill the available navbar width
   so the InletAngler logotype is actually readable. */
@media (max-width: 575.98px) {
    /* ca67: Force the navbar contents to wrap so the brand image gets a
       full-width row of its own. Without this, the right-side cluster
       (theme, notify, skill, date) eats most of the row and the SVG
       (1400x360 aspect) is contained down to ~30px tall. */
    .inletangler-navbar .container-fluid {
        flex-wrap: wrap !important;
        row-gap: 4px;
    }
    .inletangler-navbar .navbar-brand {
        flex: 0 0 100% !important;
        order: 0;
        min-width: 0;
        margin-right: 0;
        justify-content: center;
        display: flex !important;
    }
    .inletangler-navbar .container-fluid > .d-flex {
        flex: 0 0 100%;
        order: 1;
        justify-content: flex-end;
    }
    /* ca68: actively SIZE the wordmark instead of letting object-fit shrink
       it. The container is 100vw, so explicitly set width and let height
       follow aspect ratio. */
    .brand-wordmark-img {
        display: block !important;
        width: calc(100vw - 24px) !important;
        max-width: calc(100vw - 24px) !important;
        height: auto !important;
        max-height: none !important;
        min-height: 80px;
        object-fit: contain;
    }
    /* Pull dropdowns down to account for the now-taller two-row navbar. */
    .inletangler-navbar .dropdown-menu.dropdown-menu-end,
    .inletangler-navbar .dropdown-menu {
        top: 160px !important;
    }
}
html[data-theme="dark"] .inletangler-navbar {
    background: linear-gradient(135deg, #2a1e14 0%, #3d2614 70%, #5a3a1e 100%) !important;
    border-bottom-color: #d97706;
}
html[data-theme="dark"] .brand-wordmark-img {
    filter: brightness(1.15) drop-shadow(0 1px 2px rgba(0, 0, 0, 0.6));
}
html[data-theme="hc"] .inletangler-navbar {
    background: #000 !important;
    border-bottom: 3px solid #facc15;
}
html[data-theme="hc"] .brand-wordmark-img {
    filter: invert(1) brightness(1.5);
}
/* Restore navbar control colors against the light brand bg (light theme) */
html[data-theme="light"] .inletangler-navbar .btn-outline-warning,
html[data-theme="system"] .inletangler-navbar .btn-outline-warning,
html:not([data-theme]) .inletangler-navbar .btn-outline-warning {
    color: #6b3a1e; border-color: #b9803a;
}
html[data-theme="light"] .inletangler-navbar .btn-outline-warning:hover,
html[data-theme="system"] .inletangler-navbar .btn-outline-warning:hover,
html:not([data-theme]) .inletangler-navbar .btn-outline-warning:hover {
    color: #fff; background: #b9803a; border-color: #b9803a;
}
html[data-theme="light"] .inletangler-navbar .btn-outline-light,
html[data-theme="system"] .inletangler-navbar .btn-outline-light,
html:not([data-theme]) .inletangler-navbar .btn-outline-light {
    color: #2a1e14; border-color: #6b3a1e;
}
html[data-theme="light"] .inletangler-navbar .btn-outline-light:hover,
html[data-theme="system"] .inletangler-navbar .btn-outline-light:hover,
html:not([data-theme]) .inletangler-navbar .btn-outline-light:hover {
    color: #fff; background: #2a1e14; border-color: #2a1e14;
}
.inletangler-navbar .badge.bg-warning {
    color: #2a1e14 !important;
}

/* ── Score Circle ── */
.score-circle {
    width: 140px;
    height: 140px;
    border-radius: 50%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: conic-gradient(
        var(--score-fair) 0deg,
        var(--score-fair) 360deg
    );
    position: relative;
}

.score-circle::before {
    content: '';
    position: absolute;
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: white;
}

.score-number {
    position: relative;
    z-index: 1;
    font-size: 2.8rem;
    font-weight: 800;
    line-height: 1;
    color: var(--ocean-dark);
}

.score-label {
    position: relative;
    z-index: 1;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* ── Stat Cards ── */
.stat-card {
    background: white;
    border-radius: 12px;
    padding: 10px 6px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.12);
}

.stat-card i {
    font-size: 1.1rem;
}

.stat-value {
    font-size: 1.05rem;
    font-weight: 800;
    color: var(--text-primary);
}

.stat-label {
    font-size: 0.7rem;
    color: var(--text-secondary);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ── Factor Bars ── */
.factor-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}

.factor-name {
    width: 80px;
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-primary);
    text-align: right;
    flex-shrink: 0;
}

.factor-bar-container {
    flex: 1;
    height: 18px;
    background: #e5e7eb;
    border-radius: 9px;
    overflow: hidden;
    position: relative;
}

.factor-bar {
    height: 100%;
    border-radius: 9px;
    transition: width 0.8s ease;
}

.factor-score {
    width: 30px;
    font-size: 0.8rem;
    font-weight: 800;
    text-align: left;
    flex-shrink: 0;
}

/* ── Cards ── */
.card {
    border: none;
    border-radius: 12px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.12);
    overflow: hidden;
}

.card-header {
    background: white;
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--text-primary);
    border-bottom: 1px solid #e5e7eb;
}

/* ── Tide Schedule ── */
.tide-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 4px;
    border-bottom: 1px solid #f3f4f6;
}

.tide-item:last-child {
    border-bottom: none;
}

.tide-type {
    font-weight: 700;
    font-size: 0.8rem;
    padding: 2px 10px;
    border-radius: 12px;
}

.tide-high {
    background: #dbeafe;
    color: #1d4ed8;
}

.tide-low {
    background: #fef3c7;
    color: #b45309;
}

/* ── Solunar Periods ── */
.solunar-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 4px;
    border-bottom: 1px solid #f3f4f6;
}

.solunar-item:last-child {
    border-bottom: none;
}

.solunar-badge {
    font-weight: 700;
    font-size: 0.7rem;
    padding: 2px 8px;
    border-radius: 10px;
    width: 55px;
    text-align: center;
}

.solunar-major {
    background: #fce7f3;
    color: #be185d;
}

.solunar-minor {
    background: #ede9fe;
    color: #6d28d9;
}

/* ── Weekly Cards ── */
.weekly-day {
    background: white;
    border-radius: 12px;
    padding: 12px;
    margin-bottom: 10px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.12);
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    transition: transform 0.1s;
}

.weekly-day:active {
    transform: scale(0.98);
}

.weekly-score-badge {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 1.2rem;
    color: white;
    flex-shrink: 0;
}

.weekly-info {
    flex: 1;
    min-width: 0;
}

.weekly-day-name {
    font-weight: 800;
    font-size: 0.95rem;
    color: var(--text-primary);
}

.weekly-detail {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.weekly-rating {
    font-size: 0.75rem;
    font-weight: 700;
    text-align: right;
    flex-shrink: 0;
}

/* ── Compare / Best Spot ── */
.spot-rank {
    background: white;
    border-radius: 12px;
    padding: 12px;
    margin-bottom: 8px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.12);
    display: flex;
    align-items: center;
    gap: 12px;
}

.rank-number {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--ocean-mid);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 0.8rem;
    flex-shrink: 0;
}

.rank-number.gold {
    background: linear-gradient(135deg, #f59e0b, #d97706);
}

/* ── Floating Action Button ── */
.fab {
    position: fixed;
    bottom: calc(24px + env(safe-area-inset-bottom, 0px));
    right: calc(24px + env(safe-area-inset-right, 0px));
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--ocean-mid), var(--ocean-light));
    color: white;
    border: none;
    font-size: 1.4rem;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    transition: transform 0.2s;
}

.fab:active {
    transform: scale(0.9);
}

/* ── Warning Alerts ── */
.warning-alert {
    border-radius: 10px;
    padding: 10px 14px;
    margin-bottom: 10px;
    font-size: 0.8rem;
    font-weight: 500;
}

/* ── Conditions Detail ── */
.condition-row {
    display: flex;
    justify-content: space-between;
    padding: 6px 4px;
    font-size: 0.8rem;
    border-bottom: 1px solid #f3f4f6;
}

.condition-row:last-child {
    border-bottom: none;
}

.condition-label {
    color: var(--text-secondary);
    font-weight: 500;
}

.condition-value {
    font-weight: 700;
    color: var(--text-primary);
}

/* ── Tip Items ── */
.tip-item {
    padding: 6px 4px;
    font-size: 0.85rem;
    color: var(--text-primary);
    border-bottom: 1px solid #f3f4f6;
    display: flex;
    gap: 8px;
}

.tip-item:last-child {
    border-bottom: none;
}

.tip-icon {
    color: #15803d;
    flex-shrink: 0;
}

/* ── Responsive ── */
@media (min-width: 768px) {
    .tab-content {
        max-width: 720px;
        margin: 0 auto;
    }
}
@media (min-width: 1200px) {
    .tab-content {
        max-width: 960px;
    }
}

/* ── Dark elements inside select ── */
.bg-dark .form-select option {
    background: #1a1a2e;
}

/* ── Weather strip ── */
.weather-strip-cell {
    background: #f8fafc;
    border-radius: 8px;
    padding: 8px 4px;
    text-align: center;
}

.weather-strip-label {
    font-weight: 800;
    font-size: 0.8rem;
    color: var(--text-primary);
}

.weather-strip-temp {
    font-weight: 800;
    font-size: 1.15rem;
    color: var(--text-primary);
}

.weather-strip-desc {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.weather-strip-wind {
    font-size: 0.7rem;
    font-weight: 500;
    color: var(--text-secondary);
}

/* ── Warning severity ── */
.warning-danger {
    background: #fef2f2 !important;
    border: 2px solid #dc2626 !important;
    color: #991b1b !important;
}

.warning-caution {
    background: #fffbeb !important;
    border: 2px solid #d97706 !important;
    color: #92400e !important;
}

.warning-info {
    background: #eff6ff !important;
    border: 2px solid #3b82f6 !important;
    color: #1e3a8a !important;
}

/* ── Tab Navigation (6 tabs, mobile-friendly) ── */
#mainTabs {
    overflow-x: auto;
    flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    position: sticky;
    top: 0;
    z-index: 1020;
}
#mainTabs::-webkit-scrollbar { display: none; }
#mainTabs .nav-item { flex: 0 0 auto; }
#mainTabs .nav-link {
    font-size: 0.72rem;
    padding: 0.5rem 0.6rem;
    white-space: nowrap;
}

/* ── Map Tab ── */
#mapPanel { padding: 0 !important; }
#mapPanel.active #mapContainer {
    position: relative;
    /* Use dynamic viewport height (iOS Safari) with fallback */
    height: calc(100vh - 200px);
    height: calc(100dvh - 200px);
    min-height: 350px;
}
#mapContainer #map {
    height: 100%;
    width: 100%;
}
.spot-marker-icon, .catch-marker-icon {
    background: none !important;
    border: none !important;
}
/* Sticky horizontal chip bar for layer toggles */
#mapControls {
    position: sticky;
    top: 0;
    z-index: 20;
    font-size: 0.85rem;
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    gap: 0.5rem;
    align-items: center;
    padding: 0.6rem max(12px, env(safe-area-inset-right, 12px))
             0.6rem max(12px, env(safe-area-inset-left, 12px));
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}
#mapControls::-webkit-scrollbar { display: none; }
#mapControls .form-check {
    /* Larger touch targets for thumb use */
    min-height: 40px;
    display: flex;
    align-items: center;
    padding-left: 2.4em;
    flex: 0 0 auto;
    white-space: nowrap;
    margin: 0;
}
#mapControls .form-check-input {
    width: 2.4em;
    height: 1.3em;
    margin-top: 0;
}
#mapControls .btn {
    /* Larger locate button for easy thumb tap */
    min-height: 40px;
    min-width: 40px;
    padding: 6px 12px;
    flex: 0 0 auto;
    white-space: nowrap;
}
#mapControls > span {
    flex: 0 0 auto;
    white-space: nowrap;
}

/* ── Map Bottom Sheet ── */
.map-sheet {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 600;
    /* When closed, ignore pointer events so the map underneath stays usable
       (ca65 fix: closed sheet was still blocking clicks). */
    pointer-events: none;
}
.map-sheet.is-open {
    transform: translateY(0);
    pointer-events: auto;
}
.map-sheet.is-expanded {
    max-height: 92%;
}
.map-sheet__handle {
    width: 40px;
    height: 4px;
    background: #cbd5e1;
    border-radius: 2px;
    margin: 8px auto 4px;
    flex: 0 0 auto;
    cursor: grab;
}
.map-sheet__close {
    position: absolute;
    top: 8px;
    right: 12px;
    width: 36px;
    height: 36px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: #f1f5f9;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 0.9rem;
    /* ca65: ensure close always sits above photo/title so the X is clickable. */
    z-index: 2;
    border: 0
    right: 12px;
    width: 36px;
    height: 36px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: #f1f5f9;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 0.9rem;
}
.map-sheet__close:hover {
    background: #e2e8f0;
}
.map-sheet__content {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 0.5rem 1rem 1rem;
    flex: 1 1 auto;
}
.map-sheet__title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 2.5rem 0.25rem 0;
}

/* Launch marker pin (statewide FWC + OSM dataset) */
.launch-pin {
    background: #0d6efd;
    color: #fff;
    border: 2px solid #fff;
    border-radius: 50%;
    width: 22px !important;
    height: 22px !important;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    line-height: 1;
    box-shadow: 0 1px 3px rgba(0,0,0,0.4);
}
.launch-pin i {
    color: #fff;
}
/* Type-specific colors */
.launch-pin--ramp  { background: #0d6efd; }   /* boat ramp - blue */
.launch-pin--kayak { background: #16a34a; }   /* kayak/paddle - green */
.launch-pin--shore { background: #f59e0b; }   /* shore/pier - orange */

/* Inline color legend dot */
.legend-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-right: 4px;
    vertical-align: middle;
    border: 1px solid rgba(255,255,255,0.3);
}

/* ── Nearby Launches list cards ──────────────────────── */
.launch-card {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 0.75rem;
    padding: 0.75rem;
    border-radius: 12px;
    background: var(--card-bg, #1f2937);
    border: 1px solid rgba(255,255,255,0.08);
    align-items: center;
}
.launch-card__icon {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    color: #fff;
    font-size: 1.1rem;
    flex-shrink: 0;
}
.launch-card__body { min-width: 0; }
.launch-card__title {
    font-weight: 700;
    color: #f9fafb;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.launch-card__meta {
    font-size: 0.85rem;
    color: #d1d5db;
    margin-top: 2px;
}
.launch-card__amenities {
    margin-top: 4px;
    display: flex;
    gap: 0.4rem;
    align-items: center;
    color: #e5e7eb;
}
.launch-card__actions {
    text-align: right;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.35rem;
}
.launch-card__distance {
    font-weight: 800;
    color: #fde68a;
    font-size: 0.95rem;
}

/* Spot favorite star button (next to spot select) */
#spotFavoriteBtn {
    flex: 0 0 auto;
    line-height: 1;
    padding: 0.35rem 0.55rem;
}
#spotFavoriteBtn .bi-star-fill { color: #fbbf24; }
#spotFavoriteBtn.btn-warning { color: #1f2937; }

/* Spot picker trigger button */
#spotPickerBtn {
    min-height: 2.4rem;
    text-align: left;
    overflow: hidden;
}
#spotPickerBtn #spotPickerSubLabel {
    font-size: 0.72rem;
    color: #9ca3af;
}

/* Spot picker modal list items */
#spotPickerModal .list-group-item {
    border-left: 0;
    border-right: 0;
    border-radius: 0;
    color: #e5e7eb;
}
#spotPickerModal .list-group-item:hover,
#spotPickerModal .list-group-item:focus {
    background-color: rgba(255,255,255,0.06);
}
#spotPickerModal .modal-body { background: #111827; }
#spotPickerModal .form-control:focus {
    background-color: #000;
    color: #fff;
    border-color: #6b7280;
    box-shadow: none;
}

/* Launch filter chips bar */
#launchFilters {
    border-top: 1px solid rgba(255,255,255,0.08);
}
.launch-chip {
    border-radius: 999px;
    padding: 0.15rem 0.65rem;
    font-size: 0.78rem;
    line-height: 1.4;
}
#launchRegionFilter {
    font-size: 0.8rem;
}
#launchRegionFilter option {
    background: #212529;
    color: #fff;
}

/* ── Forecast day strip ──────────────────────────────── */
.forecast-strip {
    display: flex;
    flex-wrap: nowrap;
    gap: 0.45rem;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 0.25rem 0.1rem 0.5rem;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
}
.forecast-strip::-webkit-scrollbar {
    height: 4px;
}
.forecast-strip::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.2);
    border-radius: 2px;
}
.forecast-day {
    flex: 0 0 auto;
    width: 78px;
    min-height: 96px;
    padding: 0.45rem 0.25rem;
    background: var(--card-bg, #1f2937);
    color: #f9fafb;
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 12px;
    text-align: center;
    cursor: pointer;
    position: relative;
    transition: transform 0.1s ease, border-color 0.15s ease, background 0.15s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}
.forecast-day:hover {
    border-color: rgba(13,110,253,0.5);
}
.forecast-day.active {
    border-color: #38bdf8;
    background: rgba(56,189,248,0.18);
    box-shadow: 0 0 0 2px rgba(56,189,248,0.35);
}
.forecast-day .fd-weekday {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #cbd5e1;
    font-weight: 700;
}
.forecast-day .fd-daynum {
    font-size: 1.15rem;
    font-weight: 800;
    line-height: 1;
    color: #f9fafb;
}
.forecast-day .fd-score {
    margin-top: 2px;
    color: #fff;
    font-weight: 800;
    font-size: 0.9rem;
    border-radius: 999px;
    padding: 1px 8px;
    line-height: 1.3;
    min-width: 36px;
}
.forecast-day .fd-rating {
    font-size: 0.7rem;
    color: #d1d5db;
    line-height: 1.1;
    text-overflow: ellipsis;
    overflow: hidden;
    white-space: nowrap;
    max-width: 100%;
    font-weight: 600;
}
.forecast-day .fd-wind {
    font-size: 0.68rem;
    color: #d1d5db;
    font-weight: 600;
}
.forecast-day .fd-warn {
    position: absolute;
    top: 4px;
    right: 6px;
    color: #fbbf24;
    font-size: 0.8rem;
    text-shadow: 0 0 2px rgba(0,0,0,0.6);
}
.map-sheet__subtitle {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
}
.map-sheet__photo {
    width: 100%;
    max-height: 200px;
    object-fit: cover;
    border-radius: 8px;
    margin-bottom: 0.75rem;
}
.map-sheet__row {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 0;
    border-bottom: 1px solid #f1f5f9;
    font-size: 0.9rem;
}
.map-sheet__row:last-child {
    border-bottom: none;
}
.map-sheet__row-label {
    color: var(--text-muted);
    font-weight: 500;
}
.map-sheet__row-value {
    color: var(--text-primary);
    font-weight: 600;
    text-align: right;
}
.map-sheet__actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
    margin-top: 0.75rem;
}
.map-sheet__actions .btn {
    min-height: 44px;
}
/* Ensure mapContainer is positioned so sheet anchors to it */
#mapContainer {
    overflow: hidden;
}

/* ── iOS Safe Area Padding ── */
.pb-safe {
    padding-bottom: calc(24px + env(safe-area-inset-bottom, 0px)) !important;
}

/* ── Catch Log optimizations ── */
#catchlogPanel {
    /* Let page scroll naturally — no nested scroll container */
}
#catchlogPanel .form-control,
#catchlogPanel .form-select {
    /* Prevent iOS zoom on focus (must be >= 16px) */
    font-size: 16px;
    min-height: 44px;
}
#catchlogPanel .btn {
    min-height: 44px;
}
#catchlogPanel .card-header .btn {
    min-height: 36px;
}

/* ───────────────────────────────────────────────────────────────────
   Dark Theme — activated by <html data-theme="dark">
   System-aware: applied automatically when user pref is 'system' and
   the OS reports prefers-color-scheme: dark. Brand-aligned ocean palette.
─────────────────────────────────────────────────────────────────── */
html[data-theme="dark"] {
    color-scheme: dark;
    --text-primary: #f3f4f6;
    --text-secondary: #d1d5db;
    --text-muted: #9ca3af;
}
html[data-theme="dark"] body {
    background: #0a1628 !important;
    color: #e5e7eb;
}
html[data-theme="dark"] .navbar {
    background: linear-gradient(135deg, #050d18, #0f2440) !important;
    border-bottom: 1px solid #1e3a5f;
}

/* Spot picker bar */
html[data-theme="dark"] #spotPickerBar {
    background: #0f2440 !important;
    border-color: #1e3a5f !important;
}
html[data-theme="dark"] #spotPickerBtn,
html[data-theme="dark"] #spotFavoriteBtn {
    background: #163356 !important;
    color: #f3f4f6 !important;
    border-color: #2a4a72 !important;
}
html[data-theme="dark"] #spotPickerSubLabel { color: #9ca3af !important; }

/* Tabs */
html[data-theme="dark"] .nav-tabs {
    background: #0f2440 !important;
    border-bottom-color: #1e3a5f !important;
}
html[data-theme="dark"] .nav-tabs .nav-link { color: #cbd5e1 !important; }
html[data-theme="dark"] .nav-tabs .nav-link.active {
    background: #163356 !important;
    color: #f3f4f6 !important;
    border-color: #1e3a5f #1e3a5f #163356 !important;
}

/* Cards & surfaces */
html[data-theme="dark"] .card,
html[data-theme="dark"] .stat-card,
html[data-theme="dark"] .accordion-item,
html[data-theme="dark"] .list-group-item,
html[data-theme="dark"] .modal-content {
    background: #163356 !important;
    color: #e5e7eb !important;
    border-color: #1e3a5f !important;
}
html[data-theme="dark"] .card-header,
html[data-theme="dark"] .accordion-button {
    background: #0f2440 !important;
    color: #e5e7eb !important;
    border-color: #1e3a5f !important;
}
html[data-theme="dark"] .accordion-button:not(.collapsed) {
    background: #1e3a5f !important;
    color: #f3f4f6 !important;
    box-shadow: none !important;
}
html[data-theme="dark"] .accordion-button::after { filter: invert(1) brightness(2); }
html[data-theme="dark"] .list-group-item-action:hover,
html[data-theme="dark"] .list-group-item-action:focus {
    background: #1e3a5f !important;
    color: #fff !important;
}
html[data-theme="dark"] .border,
html[data-theme="dark"] .border-top,
html[data-theme="dark"] .border-bottom,
html[data-theme="dark"] .border-start,
html[data-theme="dark"] .border-end { border-color: #1e3a5f !important; }

/* Text utility recolor */
html[data-theme="dark"] .text-muted,
html[data-theme="dark"] .text-secondary { color: #9ca3af !important; }
html[data-theme="dark"] .text-dark { color: #e5e7eb !important; }
html[data-theme="dark"] .bg-light { background: #163356 !important; color: #e5e7eb !important; }
html[data-theme="dark"] .bg-white { background: #163356 !important; color: #e5e7eb !important; }

/* Forms */
html[data-theme="dark"] .form-control,
html[data-theme="dark"] .form-select {
    background: #0f2440 !important;
    color: #f3f4f6 !important;
    border-color: #2a4a72 !important;
}
html[data-theme="dark"] .form-control::placeholder { color: #6b7d99 !important; }
html[data-theme="dark"] .form-control:focus,
html[data-theme="dark"] .form-select:focus {
    border-color: #4a90c2 !important;
    box-shadow: 0 0 0 0.2rem rgba(74,144,194,0.25) !important;
}
html[data-theme="dark"] .form-select option { background: #0f2440; color: #f3f4f6; }
html[data-theme="dark"] .input-group-text {
    background: #1e3a5f !important;
    color: #cbd5e1 !important;
    border-color: #2a4a72 !important;
}

/* Buttons */
html[data-theme="dark"] .btn-light,
html[data-theme="dark"] .btn-outline-secondary { color: #e5e7eb; border-color: #2a4a72; }
html[data-theme="dark"] .btn-outline-secondary:hover { background: #1e3a5f; color: #fff; }

/* Dropdown */
html[data-theme="dark"] .dropdown-menu {
    background: #163356 !important;
    border-color: #1e3a5f !important;
    color: #e5e7eb;
}
html[data-theme="dark"] .dropdown-item { color: #e5e7eb; }
html[data-theme="dark"] .dropdown-item:hover,
html[data-theme="dark"] .dropdown-item:focus { background: #1e3a5f; color: #fff; }
html[data-theme="dark"] .dropdown-header { color: #9ca3af; }
html[data-theme="dark"] .dropdown-divider { border-color: #1e3a5f; }

/* Forecast / weather strip */
html[data-theme="dark"] .forecast-day {
    background: #0f2440 !important;
    color: #e5e7eb !important;
    border-color: #1e3a5f !important;
}
html[data-theme="dark"] .forecast-day.active {
    background: #1e3a5f !important;
    border-color: #4a90c2 !important;
}
html[data-theme="dark"] .weather-strip-cell {
    background: #0f2440 !important;
    color: #e5e7eb !important;
}

/* Score circle inner — keep numeric readable */
html[data-theme="dark"] .score-circle::before { background: #163356 !important; }
html[data-theme="dark"] .score-number { color: #f3f4f6 !important; }

/* Bottom tab nav */
html[data-theme="dark"] .nav-bottom,
html[data-theme="dark"] #mainTab {
    background: #0f2440 !important;
    border-top-color: #1e3a5f !important;
}

/* Map controls bar already uses bg-dark — keep it. */
/* Leaflet popup */
html[data-theme="dark"] .leaflet-popup-content-wrapper,
html[data-theme="dark"] .leaflet-popup-tip {
    background: #163356 !important;
    color: #e5e7eb !important;
}

/* Modal */
html[data-theme="dark"] .modal-header,
html[data-theme="dark"] .modal-footer { border-color: #1e3a5f !important; }
html[data-theme="dark"] .btn-close { filter: invert(1) grayscale(1) brightness(2); }

/* Tables */
html[data-theme="dark"] .table { color: #e5e7eb; }
html[data-theme="dark"] .table > :not(caption) > * > * {
    background: transparent;
    border-color: #1e3a5f;
}

/* Alerts (info/light variants get washed out) */
html[data-theme="dark"] .alert-light,
html[data-theme="dark"] .alert-info {
    background: #1e3a5f !important;
    color: #e5e7eb !important;
    border-color: #2a4a72 !important;
}

/* ───────────────────────────────────────────────────────────────────
   High-Contrast Sunlight Theme — activated by <html data-theme="hc">
   Designed for readability in direct outdoor light. Pure black/white,
   bigger text, thicker borders, no muted grays.
─────────────────────────────────────────────────────────────────── */
html[data-theme="hc"] {
    font-size: clamp(16px, 0.6vw + 15px, 19px);
}
html[data-theme="hc"] body { background: #000 !important; color: #fff; }
html[data-theme="hc"] .navbar { background: #000 !important; border-bottom: 2px solid #facc15; }
html[data-theme="hc"] .navbar-brand,
html[data-theme="hc"] .navbar-text { color: #facc15 !important; }

/* Spot picker bar */
html[data-theme="hc"] #spotPickerBtn,
html[data-theme="hc"] #spotFavoriteBtn {
    background: #000 !important;
    color: #fff !important;
    border: 2px solid #facc15 !important;
    font-weight: 700;
}
html[data-theme="hc"] #spotPickerSubLabel { color: #fde68a !important; }
html[data-theme="hc"] #spotFavoriteBtn .bi-star-fill { color: #facc15 !important; }

/* Tabs */
html[data-theme="hc"] .nav-tabs { background: #000 !important; border-bottom-color: #facc15; }
html[data-theme="hc"] .nav-tabs .nav-link {
    color: #e5e7eb !important; font-weight: 700; border-color: transparent;
}
html[data-theme="hc"] .nav-tabs .nav-link.active {
    background: #facc15 !important; color: #000 !important; border-color: #facc15;
}

/* Cards */
html[data-theme="hc"] .card,
html[data-theme="hc"] .stat-card {
    background: #fff !important;
    color: #000 !important;
    border: 2px solid #000 !important;
    box-shadow: 0 0 0 1px rgba(0,0,0,0.4);
}
html[data-theme="hc"] .stat-value,
html[data-theme="hc"] .card-title,
html[data-theme="hc"] .stat-label { color: #000 !important; }
html[data-theme="hc"] .text-muted,
html[data-theme="hc"] .text-white-50 { color: #1f2937 !important; }

/* Score circle keeps its color but bigger + black ring */
html[data-theme="hc"] .score-circle::before { background: #fff !important; }
html[data-theme="hc"] .score-number { color: #000 !important; font-weight: 900; }

/* Forecast day strip */
html[data-theme="hc"] .forecast-day {
    background: #000 !important;
    color: #fff !important;
    border: 2px solid #facc15 !important;
}
html[data-theme="hc"] .forecast-day .fd-weekday,
html[data-theme="hc"] .forecast-day .fd-rating,
html[data-theme="hc"] .forecast-day .fd-wind { color: #fde68a !important; }
html[data-theme="hc"] .forecast-day .fd-daynum { color: #fff !important; }
html[data-theme="hc"] .forecast-day.active {
    background: #facc15 !important;
    color: #000 !important;
    box-shadow: 0 0 0 3px #fff;
}
html[data-theme="hc"] .forecast-day.active .fd-weekday,
html[data-theme="hc"] .forecast-day.active .fd-rating,
html[data-theme="hc"] .forecast-day.active .fd-wind,
html[data-theme="hc"] .forecast-day.active .fd-daynum { color: #000 !important; }

/* Launch cards (Nearby tab) */
html[data-theme="hc"] .launch-card {
    background: #000 !important;
    border: 2px solid #facc15 !important;
}
html[data-theme="hc"] .launch-card__title { color: #fff !important; font-size: 1rem; }
html[data-theme="hc"] .launch-card__meta,
html[data-theme="hc"] .launch-card__amenities { color: #fde68a !important; font-weight: 600; }
html[data-theme="hc"] .launch-card__distance { color: #facc15 !important; font-size: 1.05rem; }

/* Spot picker modal */
html[data-theme="hc"] #spotPickerModal .modal-content {
    background: #000 !important; color: #fff !important; border: 2px solid #facc15;
}
html[data-theme="hc"] #spotPickerModal .modal-body { background: #000 !important; }
html[data-theme="hc"] #spotPickerModal .list-group-item {
    background: #000 !important; color: #fff !important;
    border-bottom: 1px solid #4b5563 !important;
}
html[data-theme="hc"] #spotPickerModal .list-group-item:hover { background: #1f2937 !important; }
html[data-theme="hc"] #spotPickerModal .small,
html[data-theme="hc"] #spotPickerModal .text-muted { color: #fde68a !important; }
html[data-theme="hc"] #spotPickerModal .badge { background: #facc15 !important; color: #000 !important; }

/* High-contrast toggle button */
#themeToggleBtn { color: #facc15; }
html[data-theme="hc"] #themeToggleBtn { color: #facc15; background: rgba(0,0,0,0.3); }



/* ─────────────────────────────────────────────────────────────────────
   WCAG-AAA contrast pass (default theme).
   Targets ≥ 7:1 for normal text and ≥ 4.5:1 for large/UI text on white.
   The high-contrast theme (data-theme="hc") already exceeds these — see
   below for confirmation overrides only.
   ───────────────────────────────────────────────────────────────────── */

/* Bootstrap's default .text-muted is #6c757d on white = ~4.6:1 (AA only).
   Replace with our token (#4b5563 on white = ~7.5:1). */
.text-muted,
.text-body-secondary {
    color: var(--text-muted) !important;
}

/* Bootstrap .text-secondary is #6c757d in v5; raise to AAA. */
.text-secondary {
    color: var(--text-secondary) !important;
}

/* navbar "text-white-50" = white at 50% opacity on #246e96 ≈ 3.4:1 (fails AA).
   Force a flat 87% white which gives ~5.6:1 on the primary blue. */
.navbar-dark .text-white-50,
.navbar .text-white-50 {
    color: rgba(255, 255, 255, 0.87) !important;
}

/* Bootstrap .text-info / .text-success default light shades fail AAA on
   white backgrounds. Re-tone for the rare in-card uses. */
.text-info  { color: #0e639c !important; }   /* ~6.5:1 on white */
.text-success { color: #15803d !important; } /* matches --score-excellent */
.text-danger  { color: #b91c1c !important; } /* ~6.7:1 on white */
.text-warning { color: #92400e !important; } /* ~7.5:1 on white */
.text-primary { color: #1d4ed8 !important; } /* ~6.4:1 on white */

/* Visible focus ring for keyboard nav — AAA requires non-color cue. */
:focus-visible {
    outline: 3px solid #1d4ed8 !important;
    outline-offset: 2px !important;
    border-radius: 4px;
}
html[data-theme="hc"] :focus-visible {
    outline-color: #facc15 !important;
}

/* Form-check labels inside dark navs were sometimes rendered with
   --bs-secondary which fails AAA on dark blue. Force pure white. */
.bg-dark .form-check-label,
.bg-primary .form-check-label,
.navbar-dark .form-check-label {
    color: #fff !important;
}

/* Disabled button text (Bootstrap default ~3.5:1) — bump to 5:1+ */
.btn:disabled,
.btn.disabled {
    opacity: 0.7;
}

/* GPS paddle tracker — floating control on the map */
.paddle-tracker-ctl {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 1000;
    background: rgba(15, 23, 42, 0.92);
    color: #fff;
    padding: 8px 10px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
    min-width: 130px;
    font-size: 0.78rem;
    line-height: 1.3;
}
.paddle-tracker-ctl .btn { width: 100%; }
.paddle-tracker-ctl.recording .btn { background: #dc2626; border-color: #dc2626; }
.paddle-tracker-ctl.recording .btn:hover { background: #b91c1c; border-color: #b91c1c; }


/* ── ca65: Catch list image sizing defence ── */
/* The catch list renders 60x60 inline thumbnails, but defensively cap any */
/* <img> inside the catch list so an off-spec render never blows up the row. */
#catchesList img,
#catchInsightsContent img {
    max-width: 80px;
    max-height: 80px;
    object-fit: cover;
}
/* Catch photo preview inside the "Log Catch" modal also gets a hard cap. */
#photoPreviewImg {
    max-width: 100%;
    max-height: 180px;
    object-fit: contain;
}

/* ── ca65: Forecast caution flag tooltip cursor ── */
.forecast-day .fd-warn {
    cursor: help;
}

/* ── ca65: Best Launch step-down ── */
.best-launch-step {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}
.best-launch-step select {
    flex: 1 1 160px;
    min-width: 140px;
}
