:root {
    --nav-h: 3.5rem;
    --map-h: 340px;
}

body {
    padding-top: var(--nav-h);
}

nav.topnav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 200;
    display: flex;
    align-items: center;
    gap: 1.25rem;
    height: var(--nav-h);
    padding: 0 1.5rem;
    background: var(--pico-background-color);
    border-bottom: 1px solid var(--pico-muted-border-color);
}

nav.topnav .brand {
    margin-right: auto;
    font-size: 1.1rem;
    font-weight: 700;
    text-decoration: none;
}

nav.topnav a {
    font-size: 0.9rem;
    white-space: nowrap;
    text-decoration: none;
}

nav.topnav form {
    display: flex;
    align-items: center;
    margin: 0;
}

nav.topnav .nav-action {
    margin: 0;
    padding: 0.3rem 0.7rem;
    font-size: 0.85rem;
    line-height: 1.2;
}

.nav-signup-link {
    padding: 0.3rem 0.8rem;
    font-size: 0.85rem;
}

.app-alert-dismiss {
    display: inline-grid;
    place-items: center;
    width: 2rem;
    height: 2rem;
    margin: -0.15rem -0.15rem 0 0;
    padding: 0;
    color: var(--pico-muted-color);
    background: transparent;
    border: 0;
    border-radius: 999px;
    box-shadow: none;
    opacity: 0.82;
}

.app-alert-dismiss:is(:hover, :focus-visible) {
    color: var(--pico-color);
    background: color-mix(in srgb, var(--alert-accent) 12%, transparent);
}

.app-alert.is-dismissing {
    opacity: 0;
    transform: translateY(-0.35rem);
    transition:
        opacity 0.18s ease,
        transform 0.18s ease;
}

.map-wrap {
    overflow: hidden;
    height: var(--map-h);
    margin-bottom: 1rem;
    border-radius: var(--pico-border-radius);
}

.map-canvas {
    height: var(--map-h);
}

.checkin-media-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 0.5rem;
    margin: 0.75rem 0;
}

.checkin-media-grid img {
    display: block;
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    border: 1px solid var(--pico-muted-border-color);
    border-radius: var(--pico-border-radius);
}

.checkin-media-card {
    display: grid;
    gap: 0.5rem;
    margin: 0;
    padding: 0.5rem;
    background: var(--pico-card-background-color);
    border: 1px solid var(--pico-muted-border-color);
    border-radius: var(--pico-border-radius);
}

.checkin-media-card label,
.checkin-media-card input,
.checkin-media-card button {
    margin: 0;
}

.checkin-media-card input {
    font-size: 0.85rem;
}

.checkin-media-remove {
    width: 100%;
}

.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    padding: 1rem 0.5rem;
    text-align: center;
    background: var(--pico-card-background-color);
    border: 1px solid var(--pico-muted-border-color);
    border-radius: var(--pico-border-radius);
}

.stat-card .num {
    font-size: 2rem;
    font-weight: 700;
    line-height: 1;
}

.stat-card .lbl {
    margin-top: 0.25rem;
    font-size: 0.75rem;
    color: var(--pico-muted-color);
}

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

.badge-card {
    padding: 0.75rem 0.5rem;
    font-size: 0.8rem;
    text-align: center;
    border: 1px solid var(--pico-muted-border-color);
    border-radius: var(--pico-border-radius);
}

.badge-card .badge-icon {
    font-size: 2rem;
    line-height: 1;
}

.checkin-item {
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--pico-muted-border-color);
}

.checkin-item:last-child {
    border-bottom: none;
}

.checkin-content {
    margin: 0.25rem 0;
}

.checkin-meta {
    font-size: 0.78rem;
    color: var(--pico-muted-color);
}

.profile-header {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.profile-header .avatar {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 50%;
    flex-shrink: 0;
}

.profile-header .info {
    flex: 1;
    min-width: 180px;
}

.avatar-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 80px;
    height: 80px;
    font-size: 2.5rem;
    background: var(--pico-muted-border-color);
    border-radius: 50%;
}

.avatar-placeholder-small {
    font-size: 2rem;
}

.htmx-indicator {
    opacity: 0;
    transition: opacity 0.15s;
}

.htmx-request .htmx-indicator,
.htmx-request.htmx-indicator {
    opacity: 1;
}

.u-muted {
    color: var(--pico-muted-color);
}

.u-text-sm {
    font-size: 0.85rem;
}

.u-text-xs {
    font-size: 0.8rem;
}

.u-text-xxs {
    font-size: 0.75rem;
}

.u-m-0 {
    margin: 0;
}

.u-mt-0 {
    margin-top: 0;
}

.u-mt-xs {
    margin-top: 0.25rem;
}

.u-mt-sm {
    margin-top: 0.5rem;
}

.u-mt-md {
    margin-top: 0.75rem;
}

.u-mt-lg {
    margin-top: 1rem;
}

.u-mt-xl {
    margin-top: 1.5rem;
}

.u-mb-0 {
    margin-bottom: 0;
}

.u-mb-sm {
    margin-bottom: 0.5rem;
}

.u-mb-md {
    margin-bottom: 0.75rem;
}

.u-mb-lg {
    margin-bottom: 1rem;
}

.u-flex {
    display: flex;
}

.u-flex-wrap {
    flex-wrap: wrap;
}

.u-items-center {
    align-items: center;
}

.u-items-start {
    align-items: flex-start;
}

.u-justify-between {
    justify-content: space-between;
}

.u-gap-sm {
    gap: 0.5rem;
}

.u-gap-md {
    gap: 1rem;
}

.u-gap-lg {
    gap: 1.5rem;
}

.u-w-full {
    width: 100%;
}

.u-text-right {
    text-align: right;
}

.u-text-center {
    text-align: center;
}

.u-nowrap {
    white-space: nowrap;
}

.page-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.feed-container {
    margin-top: 1rem;
}

.feed-empty-state {
    color: var(--pico-muted-color);
}

.feed-load-more {
    margin-top: 1rem;
    text-align: center;
}

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

.profile-stats {
    display: flex;
    gap: 1.5rem;
    margin-top: 0.5rem;
    font-size: 0.9rem;
}

.reply-card {
    margin-top: 0.75rem;
}

.reply-card-header {
    margin-bottom: 0.4rem;
}

.reply-card-body {
    margin: 0;
}

.reply-card-actions {
    margin: 0.5rem 0 0;
}

.reply-children {
    margin-left: 1.25rem;
    padding-left: 1rem;
    border-left: 1px solid var(--pico-muted-border-color);
}

.settings-result {
    margin-top: 0.75rem;
}

.language-form {
    margin-bottom: 1rem;
}

.actor-uri {
    font-size: 0.85rem;
    color: var(--pico-muted-color);
}

.badge-meta {
    font-size: 0.75rem;
    color: var(--pico-muted-color);
}

/* Keep Pico's global element styles from distorting Leaflet controls and icons. */
.leaflet-container img,
.leaflet-pane img,
.leaflet-marker-icon,
.leaflet-marker-shadow,
.leaflet-tile {
    display: block;
    max-width: none !important;
    height: auto;
    margin: 0;
    background: transparent;
    border: 0;
    border-radius: 0;
    box-shadow: none;
}

.leaflet-control-zoom a {
    display: block;
    width: 30px;
    height: 30px;
    margin: 0;
    padding: 0;
    font-size: 20px;
    font-weight: 400;
    line-height: 30px;
    text-align: center;
    text-decoration: none;
}

@media (max-width: 640px) {
    .app-alert {
        grid-template-columns: auto minmax(0, 1fr);
    }

    .app-alert-dismiss {
        grid-column: 2;
        justify-self: end;
        margin-top: -0.35rem;
    }
}
