/* ── Reset & base ──────────────────────────────────────────────────────────── */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }

body {
    font-family: system-ui, -apple-system, sans-serif;
    font-size: 16px;
    line-height: 1.5;
    color: #111827;
    background: #f3f4f6;
}

a { color: #2563eb; text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Utility classes ───────────────────────────────────────────────────────── */

.muted    { color: #6b7280; font-size: 0.875rem; }
.required { color: #ef4444; }
.optional { color: #9ca3af; font-size: 0.8em; }

.notice {
    padding: 0.75rem 1rem;
    border-radius: 6px;
    margin-bottom: 1.25rem;
    font-size: 0.9rem;
}
.notice.success { background: #d1fae5; color: #065f46; }
.notice.error   { background: #fee2e2; color: #991b1b; }

.error-msg {
    background: #fee2e2;
    color: #991b1b;
    padding: 0.75rem 1rem;
    border-radius: 6px;
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

.error-list {
    background: #fee2e2;
    color: #991b1b;
    padding: 0.75rem 1rem 0.75rem 2rem;
    border-radius: 6px;
    margin-bottom: 1.25rem;
    font-size: 0.9rem;
}

/* ── Buttons ───────────────────────────────────────────────────────────────── */

.btn {
    display: inline-block;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    background: #2563eb;
    color: #fff;
    text-decoration: none;
    transition: background 0.15s;
}
.btn:hover { background: #1d4ed8; text-decoration: none; color: #fff; }

.btn-secondary {
    background: #fff;
    color: #374151;
    border: 1px solid #d1d5db;
}
.btn-secondary:hover { background: #f9fafb; color: #374151; }

.btn-danger {
    background: #ef4444;
}
.btn-danger:hover { background: #dc2626; }

.btn-small { font-size: 0.8rem; padding: 0.35rem 0.75rem; }

/* ── Status pills ──────────────────────────────────────────────────────────── */

.status-pill {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: 99px;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}
.status-upcoming  { background: #dbeafe; color: #1e40af; }
.status-active    { background: #d1fae5; color: #065f46; animation: pulse-bg 2s infinite; }
.status-completed { background: #f3f4f6; color: #374151; }
.status-import    { background: #fef3c7; color: #92400e; }
.status-library   { background: #e0e7ff; color: #3730a3; }
.status-unscheduled { background: #e0e7ff; color: #3730a3; }

@keyframes pulse-bg {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0.7; }
}

/* ── Auth / login page ─────────────────────────────────────────────────────── */

.auth-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 1.5rem;
}

.auth-card {
    background: #fff;
    border-radius: 10px;
    padding: 2rem;
    width: 100%;
    max-width: 380px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
}
.auth-card h1 { font-size: 1.1rem; color: #6b7280; margin-bottom: 0.25rem; }
.auth-card h2 { font-size: 1.5rem; margin-bottom: 1.5rem; }

.auth-card form { display: flex; flex-direction: column; gap: 1rem; }
.auth-card label { font-weight: 500; font-size: 0.9rem; display: block; margin-bottom: 0.3rem; }
.auth-card input[type="password"] {
    width: 100%;
    padding: 0.6rem 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 1rem;
}
.auth-card input:focus { outline: 2px solid #2563eb; border-color: transparent; }
.auth-card button { align-self: stretch; padding: 0.65rem; font-size: 1rem; }

/* ── Admin layout ──────────────────────────────────────────────────────────── */

.admin-page { background: #f3f4f6; min-height: 100vh; }

.admin-header {
    background: #fff;
    border-bottom: 1px solid #e5e7eb;
    padding: 0.85rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}
.admin-header h1 { font-size: 1.1rem; font-weight: 600; }
.admin-header nav { display: flex; gap: 0.5rem; flex-wrap: wrap; }

.admin-main {
    max-width: 860px;
    margin: 0 auto;
    padding: 2rem 1.25rem;
}
.admin-main h2 { font-size: 1.25rem; margin-bottom: 1.25rem; }

/* ── Admin route list ──────────────────────────────────────────────────────── */

.route-list { display: flex; flex-direction: column; gap: 1rem; }

.admin-route-card {
    background: #fff;
    border-radius: 8px;
    padding: 1.1rem 1.25rem;
    border: 1px solid #e5e7eb;
}

.route-card-header {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex-wrap: wrap;
    margin-bottom: 0.35rem;
}
.route-card-meta { font-size: 0.85rem; color: #6b7280; margin-bottom: 0.5rem; }
.route-card-url  { font-size: 0.8rem; margin-bottom: 0.75rem; word-break: break-all; }
.route-card-url a { color: #2563eb; }
.route-card-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; }

/* ── Upload form ───────────────────────────────────────────────────────────── */

.upload-form { background: #fff; border-radius: 8px; padding: 1.5rem; border: 1px solid #e5e7eb; }
.admin-section { background: #fff; border-radius: 8px; padding: 1.5rem; border: 1px solid #e5e7eb; margin-top: 1.5rem; }
.admin-section h2, .admin-section h3 { font-size: 1.1rem; margin-bottom: 1rem; }

.form-group { margin-bottom: 1.25rem; }
.form-group label {
    display: block;
    font-weight: 500;
    font-size: 0.9rem;
    margin-bottom: 0.35rem;
}
.form-group input[type="text"],
.form-group input[type="datetime-local"],
.form-group input[type="file"],
.form-group textarea {
    width: 100%;
    padding: 0.6rem 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 0.95rem;
    font-family: inherit;
    background: #fff;
}
.form-group textarea { resize: vertical; }
.form-group input:focus,
.form-group textarea:focus { outline: 2px solid #2563eb; border-color: transparent; }

.hint { display: block; margin-top: 0.3rem; font-size: 0.8rem; color: #6b7280; }
.hint code { background: #f3f4f6; padding: 0.1em 0.3em; border-radius: 3px; }

/* ── GPX drop zone ─────────────────────────────────────────────────────────── */

.gpx-drop-zone {
    border: 2px dashed #d1d5db;
    border-radius: 8px;
    padding: 2rem 1rem;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
    background: #f9fafb;
    color: #6b7280;
    font-size: 0.95rem;
    position: relative;
}
.gpx-drop-zone:hover,
.gpx-drop-zone.drag-over {
    border-color: #2563eb;
    background: #eff6ff;
    color: #1d4ed8;
}
.gpx-drop-zone.has-file {
    border-color: #16a34a;
    background: #f0fdf4;
    color: #15803d;
}
.gpx-drop-zone input[type="file"] {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
    width: 100%;
    height: 100%;
    padding: 0;
    border: none;
}
.gpx-drop-zone .drop-icon { font-size: 2rem; display: block; margin-bottom: 0.4rem; }
.gpx-drop-zone .drop-label { font-weight: 500; }
.gpx-drop-zone .drop-sub { font-size: 0.8rem; margin-top: 0.25rem; color: inherit; opacity: 0.75; }

#gpx-preview-map {
    width: 100%;
    height: 320px;
    border-radius: 8px;
    border: 1px solid #d1d5db;
    margin-top: 0.75rem;
    display: none;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1.25rem;
}
@media (max-width: 500px) { .form-row { grid-template-columns: 1fr; } }

.form-actions { display: flex; gap: 0.75rem; flex-wrap: wrap; margin-top: 0.5rem; }

/* ── Checkbox label (inline checkbox + text) ────────────────────────────── */
.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.9rem;
    cursor: pointer;
    margin-bottom: 0.35rem;
}

/* ── Public index page ─────────────────────────────────────────────────────── */

.index-page { min-height: 100vh; }

/* ── Site (public/walker) layout ───────────────────────────────────────────── */

.site-page { background: #f3f4f6; min-height: 100vh; }

.site-main {
    max-width: 960px;
    margin: 0 auto;
    padding: 2rem 1.25rem;
}
.site-main h2 { font-size: 1.25rem; margin-bottom: 1.25rem; }

.site-header {
    background: #fff;
    border-bottom: 1px solid #e5e7eb;
    padding: 1rem 1.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.site-header h1 { font-size: 1.2rem; font-weight: 700; }
.site-header nav { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.site-header-nav { display: flex; gap: .5rem; align-items: center; }

.index-main {
    max-width: 960px;
    margin: 0 auto;
    padding: 2rem 1.25rem;
}

.route-section { margin-bottom: 2.5rem; }
.route-section h2 { font-size: 1.1rem; font-weight: 600; color: #374151; margin-bottom: 1rem; }

.route-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
}

.route-card {
    background: #fff;
    border-radius: 10px;
    padding: 1.1rem 1.25rem;
    border: 1px solid #e5e7eb;
    transition: box-shadow 0.15s, border-color 0.15s;
}
.route-card-link {
    display: block;
    color: inherit;
    text-decoration: none;
}
.route-card-link:hover {
    box-shadow: 0 4px 16px rgba(0,0,0,0.08);
    border-color: #93c5fd;
    text-decoration: none;
    color: inherit;
}

.route-card-title { font-size: 1rem; font-weight: 600; margin: 0.5rem 0 0.35rem; }
.route-card-desc  { font-size: 0.85rem; color: #6b7280; margin-bottom: 0.5rem; }
.route-card-meta  {
    font-size: 0.8rem;
    color: #9ca3af;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    margin-top: 0.75rem;
}

/* ── Route map page ────────────────────────────────────────────────────────── */

.route-page {
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
}

.status-banner {
    padding: 0.6rem 1rem;
    font-size: 0.9rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    flex-shrink: 0;
}
.status-banner.upcoming  { background: #dbeafe; color: #1e40af; }
.status-banner.active    { background: #d1fae5; color: #065f46; }
.status-banner.completed { background: #f3f4f6; color: #374151; border-bottom: 1px solid #e5e7eb; }

.route-desc { font-weight: 400; color: inherit; opacity: 0.75; }

.stats-bar {
    background: #1e293b;
    color: #e2e8f0;
    padding: 0.45rem 1rem;
    font-size: 0.82rem;
    display: flex;
    align-items: center;
    gap: 1.5rem;
    flex-shrink: 0;
    flex-wrap: wrap;
}
.stat strong { color: #fff; }

.btn-unit {
    margin-left: auto;
    background: transparent;
    border: 1px solid #475569;
    color: #cbd5e1;
    border-radius: 4px;
    padding: 0.15rem 0.5rem;
    font-size: 0.75rem;
    cursor: pointer;
    line-height: 1.4;
}
.btn-unit:hover { background: #334155; color: #fff; }

.stats-nav-link {
    color: #cbd5e1;
    font-size: 0.75rem;
    text-decoration: none;
    white-space: nowrap;
    border: 1px solid #475569;
    border-radius: 4px;
    padding: 0.15rem 0.5rem;
    line-height: 1.4;
}
.stats-nav-link:hover { background: #334155; color: #fff; text-decoration: none; }

#map {
    flex: 1;
    min-height: 0; /* Required for flex children to shrink below content size */
}

#elevation-profile {
    height: 200px;
    background: #fff;
    border-top: 1px solid #e5e7eb;
    flex-shrink: 0;
    overflow: hidden;
}

@media (max-width: 640px) {
    #map { height: 52vh; flex: none; }
    #elevation-profile { height: 120px; }
    .stats-bar { font-size: 0.78rem; gap: 4px 10px; padding: 4px 8px; }
    .btn-unit { margin-left: auto; }
}

/* ── Route distance markers ─────────────────────────────────────────────────── */

.dist-marker-pill {
    background: #f97316;
    color: #fff;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 10px;
    white-space: nowrap;
    display: inline-block;
    transform: translate(-50%, -50%);
    box-shadow: 0 1px 4px rgba(0,0,0,0.35);
    pointer-events: none;
}

/* ── leaflet-elevation height-focus marker: keep the dot, hide spike & label  */

.height-focus-group line,
.height-focus-group text { display: none !important; }

/* ── Pulsing live marker (injected as a Leaflet divIcon) ───────────────────── */

.live-marker {
    width: 20px;
    height: 20px;
    background: #ef4444;
    border-radius: 50%;
    border: 3px solid #fff;
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7);
    animation: live-pulse 1.5s ease-out infinite;
}

@keyframes live-pulse {
    0%   { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7); }
    70%  { box-shadow: 0 0 0 12px rgba(239, 68, 68, 0); }
    100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

/* ── Map layer control legend swatches ─────────────────────────────────────── */

.legend-line {
    display: inline-block;
    width: 22px;
    height: 0;
    vertical-align: middle;
    margin-right: 4px;
    position: relative;
    top: -1px;
}

.legend-route { border-top: 3px dashed #f97316; }
.legend-track  { border-top: 3px solid  #2563eb; }

.legend-dot {
    display: inline-block;
    width: 11px;
    height: 11px;
    border-radius: 50%;
    vertical-align: middle;
    margin-right: 4px;
    position: relative;
    top: -1px;
}

.legend-live {
    background: #ef4444;
    border: 2px solid #fff;
    box-shadow: 0 0 0 1px #ef4444;
}

.leaflet-control-layers-expanded {
    border-radius: 8px !important;
    padding: 8px 10px !important;
    font-size: 0.85rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15) !important;
}

.leaflet-control-layers label {
    display: flex;
    align-items: center;
    gap: 2px;
    padding: 2px 0;
    cursor: pointer;
}

/* ── Admin data table ────────────────────────────────────────────────────────── */

.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
    margin-bottom: 1rem;
}
.admin-table th,
.admin-table td {
    text-align: left;
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid #e5e7eb;
}
.admin-table th {
    background: #f9fafb;
    font-weight: 600;
}
.admin-table tr:hover td { background: #f9fafb; }

/* ── Hill detail page ──────────────────────────────────────────────────────── */

.hill-detail-meta {
    background: #fff;
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.hill-detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.hill-meta-item {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.hill-meta-label {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #6b7280;
}

.hill-external-links {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

#hill-map {
    height: 350px;
    border-radius: 8px;
    margin-bottom: 1.5rem;
}

.hill-bag-summary {
    background: #fff;
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.hill-bag-stats {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
    font-size: 0.95rem;
}

/* ── Classification progress bars ──────────────────────────────────────────── */

.classification-progress {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 2rem;
}

.progress-row {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.progress-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-width: 200px;
}

.progress-count {
    font-size: 0.85rem;
    color: #6b7280;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.progress-bar-track {
    flex: 1;
    height: 20px;
    background: #e5e7eb;
    border-radius: 10px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding-right: 6px;
    transition: width 0.3s ease;
    min-width: 0;
}

.progress-pct {
    font-size: 0.7rem;
    color: white;
    font-weight: 600;
}

@media (max-width: 640px) {
    .progress-row { flex-direction: column; align-items: stretch; gap: 0.25rem; }
    .progress-label { min-width: 0; }
    .progress-bar-track { width: 100%; }
}

/* ── Hill browse page ───────────────────────────────────────────────────────── */

.hills-browse-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
    margin-bottom: 1rem;
}

.hills-browse-search {
    min-width: 200px;
}

.hills-browse-count {
    margin-bottom: 0.75rem;
}

#hills-browse-map {
    height: 350px;
    border-radius: 8px;
    margin-bottom: 1.25rem;
}

.hills-browse-pagination {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    align-items: center;
    margin-top: 1.25rem;
    justify-content: center;
}

/* ── Hill summit markers: pulse animation when within bagging distance ─────── */

.hill-candidate svg {
    animation: hill-pulse 1.2s ease-in-out infinite alternate;
}
@keyframes hill-pulse {
    from { filter: drop-shadow(0 0 2px white); }
    to   { filter: drop-shadow(0 0 8px gold) brightness(1.4); }
}

/* ── Walker picker ────────────────────────────────────────────────────────── */
.walker-picker {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding: 0.5rem;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    max-height: 200px;
    overflow-y: auto;
}
.walker-checkbox {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.5rem;
    background: #f8f9fa;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
}
.walker-checkbox:hover { background: #e9ecef; }

/* ── Invitation cards ─────────────────────────────────────────────────────── */
.invitation-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.75rem 1rem;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    margin-bottom: 0.5rem;
    flex-wrap: wrap;
}
.invitation-info { display: flex; flex-direction: column; gap: 0.15rem; }
.invitation-actions { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; }

/* ── Attributed badge ─────────────────────────────────────────────────────── */
.badge-attributed {
    display: inline-block;
    background: #dbeafe;
    color: #1d4ed8;
    font-size: 0.75rem;
    padding: 0.15rem 0.5rem;
    border-radius: 9999px;
    margin-left: 0.35rem;
    vertical-align: middle;
}

/* ── Route walkers list ───────────────────────────────────────────────────── */
.route-walkers { color: #6b7280; font-size: 0.85rem; }
.route-walkers a { color: #2563eb; text-decoration: none; }
.route-walkers a:hover { text-decoration: underline; }

/* ── Nav badge ────────────────────────────────────────────────────────────── */
.nav-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.25rem;
    height: 1.25rem;
    padding: 0 0.35rem;
    background: #dc2626;
    color: #fff;
    font-size: 0.7rem;
    font-weight: 700;
    border-radius: 9999px;
    margin-left: 0.25rem;
    vertical-align: middle;
}

/* ── Profile invitation banner ────────────────────────────────────────────── */
.profile-invite-banner {
    background: #fef3c7;
    border: 1px solid #f59e0b;
    border-radius: 6px;
    padding: 0.75rem 1rem;
    margin-bottom: 1rem;
    color: #92400e;
}
.profile-invite-banner a { color: #d97706; font-weight: 600; text-decoration: underline; }

/* ── Hill confirmation panel ──────────────────────────────────────────────── */
.hill-confirm-panel {
    background: #f0fdf4;
    border: 1px solid #16a34a;
    border-radius: 6px;
    padding: 1rem;
    margin-bottom: 1.5rem;
}
.hill-confirm-panel h3 { margin-top: 0; color: #15803d; }
.hill-confirm-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0.25rem;
    cursor: pointer;
    border-radius: 4px;
}
.hill-confirm-row:hover { background: #dcfce7; }
.hill-meta { color: #6b7280; font-size: 0.85rem; margin-left: auto; }

/* ── Utility ──────────────────────────────────────────────────────────────── */
.hidden { display: none !important; }
.visually-hidden {
    position: absolute;
    width: 1px; height: 1px;
    padding: 0; margin: -1px;
    overflow: hidden;
    clip: rect(0,0,0,0);
    white-space: nowrap;
    border: 0;
}

/* ── Map control buttons (Download GPX, Embed) ───────────────────────────── */

.leaflet-control-btn {
    display: block;
    background: #fff;
    color: #333;
    font-size: 0.75rem;
    font-family: inherit;
    padding: 0.3rem 0.6rem;
    border: 2px solid rgba(0,0,0,0.2);
    border-radius: 4px;
    cursor: pointer;
    text-decoration: none;
    white-space: nowrap;
    box-shadow: 0 1px 5px rgba(0,0,0,0.2);
}
.leaflet-control-btn:hover {
    background: #f4f4f4;
    color: #333;
    text-decoration: none;
}
.leaflet-control-download { margin-bottom: 0; }
.leaflet-control-embed { margin-top: 6px; }

/* ── Embed ────────────────────────────────────────────────────────────────── */

.embed-fieldset {
    margin-top: 1.5rem;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 1rem 1.25rem;
}
.embed-fieldset legend {
    font-weight: 600;
    font-size: 0.95rem;
    padding: 0 0.5rem;
}
.embed-fieldset .checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    cursor: pointer;
}

.embed-snippet {
    width: 100%;
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', monospace;
    font-size: 0.78rem;
    background: #f9fafb;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    padding: 0.5rem;
    resize: vertical;
    color: #374151;
}

.embed-snippet-wrapper {
    display: flex;
    gap: 0.5rem;
    align-items: flex-start;
}
.embed-snippet-wrapper .embed-snippet { flex: 1; }
.embed-snippet-wrapper .btn { flex-shrink: 0; align-self: flex-start; margin-top: 2px; }

.embed-preview-hint {
    font-size: 0.75rem;
    color: #6b7280;
    margin-top: 0.35rem;
}

.embed-snippet-section {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid #e5e7eb;
}

/* Embed modal overlay (route.php embed button) */
.embed-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}
.embed-modal {
    background: #fff;
    border-radius: 12px;
    padding: 1.5rem;
    max-width: 520px;
    width: 90%;
    box-shadow: 0 8px 32px rgba(0,0,0,0.2);
}

/* Embed page body (inside iframe) */
body.embed-mode .leaflet-control-zoom { margin-top: 8px; margin-left: 8px; }

/* ── Hill photo gallery ────────────────────────────────────────────────────── */

.hill-photo-gallery {
    margin-bottom: 2rem;
}

.hill-photo-gallery h2 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    color: #111827;
}

.photo-gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 0.75rem;
}

.photo-card {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.photo-thumb {
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    display: block;
    background: #f3f4f6;
}

.photo-meta {
    padding: 0.5rem 0.75rem 0.6rem;
    font-size: 0.78rem;
    flex: 1;
}

.photo-attr {
    color: #374151;
    margin: 0.15rem 0;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.photo-license {
    display: inline-block;
    font-size: 0.7rem;
    color: #6b7280;
    background: #f3f4f6;
    border-radius: 3px;
    padding: 0.1rem 0.35rem;
    margin-top: 0.2rem;
}

.photo-tag {
    display: inline-block;
    font-size: 0.7rem;
    background: #dbeafe;
    color: #1d4ed8;
    border-radius: 3px;
    padding: 0.1rem 0.4rem;
    margin-bottom: 0.2rem;
    font-weight: 500;
}

.photo-tag-distant {
    background: #f0fdf4;
    color: #15803d;
}

.photo-attribution-note {
    font-size: 0.75rem;
    margin-top: 0.5rem;
}

@media (max-width: 500px) {
    .photo-gallery-grid {
        grid-template-columns: 1fr 1fr;
        gap: 0.5rem;
    }
}

/* ── Photo popup styling ───────────────────────────────────────────────────── */

.leaflet-popup-content img {
    display: block;
    margin: 0 auto;
}

.photo-nav-btn {
    font-size: 0.8rem;
    text-decoration: none;
    color: var(--link, #2563eb);
    cursor: pointer;
    padding: 2px 4px;
}
.photo-nav-btn:hover { text-decoration: underline; }
.photo-nav-disabled {
    color: #ccc;
    cursor: default;
}
.photo-nav-disabled:hover { text-decoration: none; }
