/*
 * Earthlonis brand theme — retints Bootstrap 5's own CSS variables and the
 * handful of components Bootstrap hardcodes at build time (buttons, form
 * focus states, pagination). Views should use Bootstrap utility classes
 * (text-primary, bg-light, fs-*, fw-*, etc.) — this file is what makes those
 * classes resolve to brand colors instead of Bootstrap's defaults, so no
 * view should need raw hex colors in a style attribute.
 */

/* So <picture> (used for WebP-with-JPEG-fallback images) never affects
   layout — the <img> inside keeps behaving exactly as if it were a direct
   child of whatever container/utility classes style it. */
picture {
    display: contents;
}

:root {
    --bs-primary: #2176ae;
    --bs-primary-rgb: 33, 118, 174;
    --bs-secondary: #4a6a80;
    --bs-secondary-rgb: 74, 106, 128;
    --bs-dark: #0d2a3f;
    --bs-dark-rgb: 13, 42, 63;
    --bs-light: #eaf4fb;
    --bs-light-rgb: 234, 244, 251;
    --bs-body-color: #1f2937;
    --bs-body-color-rgb: 31, 41, 55;
    --bs-link-color: #2176ae;
    --bs-link-color-rgb: 33, 118, 174;
    --bs-link-hover-color: #1a4a6e;
    --bs-link-hover-color-rgb: 26, 74, 110;
    --bs-pagination-active-bg: #2176ae;
    --bs-pagination-active-border-color: #2176ae;
    --bs-warning: #f2c230;
    --bs-warning-rgb: 242, 194, 48;
    --bs-body-font-family: 'Inter', var(--bs-font-sans-serif);

    /* "subtle" tokens (badges, alerts) are separate hardcoded tokens in
       Bootstrap, not derived from --bs-primary at runtime. */
    --bs-primary-bg-subtle: #eaf4fb;
    --bs-primary-border-subtle: #b8d4e8;
    --bs-primary-text-emphasis: #1a4a6e;

    /* extra steps Bootstrap doesn't ship, named in its own convention */
    --brand-blue-deep: #1a4a6e;
    --brand-blue-soft: #b8d4e8;
    --brand-blue-soft-hover: #aac4d8;
    --brand-placeholder-bg: #dde8f0;
    --brand-muted-soft: #9aa5b1;
    --brand-page-bg: #ffffff;
    --brand-divider: #f0f4f8;
}

/* Bootstrap bakes button/focus colors into hex values at build time rather
   than referencing --bs-primary, so they need an explicit retint. */
.btn-primary {
    --bs-btn-bg: #2176ae;
    --bs-btn-border-color: #2176ae;
    --bs-btn-hover-bg: var(--brand-blue-deep);
    --bs-btn-hover-border-color: var(--brand-blue-deep);
    --bs-btn-active-bg: var(--brand-blue-deep);
    --bs-btn-active-border-color: var(--brand-blue-deep);
    --bs-btn-disabled-bg: #2176ae;
    --bs-btn-disabled-border-color: #2176ae;
    --bs-btn-focus-shadow-rgb: 33, 118, 174;
}

.btn-outline-primary {
    --bs-btn-color: #2176ae;
    --bs-btn-border-color: #2176ae;
    --bs-btn-hover-bg: #2176ae;
    --bs-btn-hover-border-color: #2176ae;
    --bs-btn-active-bg: #2176ae;
    --bs-btn-active-border-color: #2176ae;
    --bs-btn-disabled-color: #2176ae;
    --bs-btn-disabled-border-color: #2176ae;
    --bs-btn-focus-shadow-rgb: 33, 118, 174;
}

.btn-secondary {
    --bs-btn-bg: #4a6a80;
    --bs-btn-border-color: #4a6a80;
    --bs-btn-hover-bg: var(--brand-blue-deep);
    --bs-btn-hover-border-color: var(--brand-blue-deep);
    --bs-btn-active-bg: var(--brand-blue-deep);
    --bs-btn-active-border-color: var(--brand-blue-deep);
    --bs-btn-disabled-bg: #4a6a80;
    --bs-btn-disabled-border-color: #4a6a80;
}

.btn-outline-secondary {
    --bs-btn-color: #4a6a80;
    --bs-btn-border-color: #4a6a80;
    --bs-btn-hover-bg: #4a6a80;
    --bs-btn-hover-border-color: #4a6a80;
    --bs-btn-active-bg: #4a6a80;
    --bs-btn-active-border-color: #4a6a80;
    --bs-btn-disabled-color: #4a6a80;
    --bs-btn-disabled-border-color: #4a6a80;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--brand-blue-soft-hover);
    box-shadow: 0 0 0 .25rem rgba(33, 118, 174, .25);
}

/* Borderless input nested in the hero search capsule — the capsule itself
   provides the visual boundary, so skip the focus ring here. */
.search-capsule .form-control:focus {
    box-shadow: none;
    border-color: transparent;
}

.form-check-input:checked {
    background-color: #2176ae;
    border-color: #2176ae;
}

.form-check-input:focus {
    border-color: var(--brand-blue-soft-hover);
    box-shadow: 0 0 0 .25rem rgba(33, 118, 174, .25);
}

/* Page background — a half-shade off bg-light, used on <body> only. */
.bg-page {
    background-color: var(--brand-page-bg);
}

/* Image placeholder tiles (empty country/place thumbnails). */
.bg-placeholder {
    background-color: var(--brand-placeholder-bg);
}

/* Inactive icon / timestamp tone, one step lighter than text-secondary. */
.text-muted-soft {
    color: var(--brand-muted-soft) !important;
}

.border-brand-soft {
    border-color: var(--brand-blue-soft) !important;
}

.text-brand-deep {
    color: var(--brand-blue-deep) !important;
}

.border-faint {
    border-color: var(--brand-divider) !important;
}

/* Card/pill hover lift used across listing grids, replacing inline
   onmouseover/onmouseout handlers. */
.hover-lift {
    transition: transform .15s ease, border-color .15s ease, background-color .15s ease;
}

.hover-lift:hover {
    transform: translateY(-2px);
    border-color: var(--brand-blue-soft-hover) !important;
}

.hover-pill:not(.is-active):hover {
    background-color: #eaf4fb !important;
    border-color: var(--brand-blue-soft) !important;
}

/* Sidebar list rows (Browse by Region, etc) — plain link rows that just
   need a subtle hover, not the lift/border treatment of a card. */
.hover-row {
    transition: background-color .15s ease;
}

.hover-row:not(.is-active):hover {
    background-color: var(--bs-tertiary-bg, #f8f9fa);
}

/* One step smaller than Bootstrap's fs-6 (1rem), for uppercase eyebrow
   labels — named in Bootstrap's own fs-* convention. */
.fs-7 {
    font-size: .75rem !important;
}

.fs-8 {
    font-size: .6875rem !important;
}

/* Fixed-width wrapper for the auth card on the guest layout. */
.mw-auth {
    width: 100%;
    max-width: 420px;
}

/* Comfortable reading width for centered body copy. */
.mw-prose {
    max-width: 640px;
}

/* Search bar width on the homepage hero. */
.mw-search {
    width: 100%;
    max-width: 540px;
}

/* Letter-spacing for small uppercase eyebrow labels (stat labels, badges,
   section captions) — Bootstrap has no utility for this. */
.tracked {
    letter-spacing: 0.06em;
}

.tracked-wide {
    letter-spacing: 0.08em;
}

/* Editorial serif display font for the hero headline — everything else
   stays on Inter (the body font set via --bs-body-font-family above). */
.font-serif {
    font-family: 'Playfair Display', Georgia, serif;
}

/* Inter's recommended weights for nav links and buttons — Bootstrap's
   defaults (400/normal) read as too light for this typeface. Header is a
   plain white bar site-wide, so nav text is dark, not white. */
.navbar-nav .nav-link {
    font-weight: 600;
    font-size: 16px;
    color: var(--bs-body-color);
}

.navbar-light .navbar-nav .nav-link:hover,
.navbar-light .navbar-nav .nav-link:focus {
    color: var(--bs-primary);
}

.btn {
    font-weight: 600;
}

/* Wordmark next to the header/footer logo icon. */
.fs-logo {
    font-size: 34px;
}

/* Spacing between top-nav items, per spec (56-64px) — desktop only. Below
   the lg breakpoint the menu stacks vertically, so that gap would blow up
   the mobile dropdown; keep it compact there instead. */
.gap-nav {
    gap: 1rem;
}

@media (min-width: 992px) {
    .gap-nav {
        gap: 60px;
    }
}

/* Fixed-width admin sidebar. */
.sidebar-width {
    width: 230px;
}

/* Keeps the site header bar slim even when the logo image inside it is
   taller — the oversized logo overflows above/below instead of stretching
   the bar's background/border. */
.header-bar {
    height: 64px;
    overflow: visible;
    position: relative;
    z-index: 10;
}

/* Fixed-height thumbnail crops for card grids. */
.thumb-sm {
    height: 100px;
}

.thumb-md {
    height: 140px;
}

.thumb-lg {
    height: 180px;
}

.thumb-xl {
    height: 220px;
}

/* Gallery thumbnail in the place-detail 2x2 grid — sized so two rows plus
   the g-2 gap (8px) add up to exactly .thumb-xl's height, matching the lead
   photo's height. */
.thumb-gallery-sm {
    height: 106px;
}

@media (min-width: 768px) {
    .thumb-xl {
        height: 320px;
    }

    .thumb-gallery-sm {
        height: 156px;
    }
}

.thumb-hero {
    height: 260px;
}

.object-top {
    object-position: top;
}

/* Admin hero-image focal point picker — click anywhere on the preview to
   set which part of the photo stays visible when it's cropped. */
.focal-picker {
    position: relative;
    display: inline-block;
    cursor: crosshair;
}

.focal-picker-img {
    max-width: 100%;
    max-height: 260px;
    display: block;
    border-radius: var(--bs-border-radius);
    border: 1px solid var(--bs-border-color);
}

.focal-marker {
    position: absolute;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--bs-primary);
    border: 2px solid #fff;
    box-shadow: 0 0 0 2px rgba(0, 0, 0, .4);
    pointer-events: none;
}

/* Admin media previews. */
.mw-thumb-preview {
    max-width: 200px;
}

.img-h-150 {
    height: 150px;
}

/* Admin table thumbnail placeholder. */
.thumb-table {
    width: 70px;
    height: 50px;
}

/* Fixed-width publish/unpublish buttons so the row action group doesn't jiggle. */
.w-btn-fixed {
    width: 90px;
}

.w-btn-wide {
    width: 100px;
}

.mw-comment {
    max-width: 300px;
}

.mw-iso {
    max-width: 100px;
}

.mw-profile {
    max-width: 700px;
}

/* Google's own SERP colors, deliberately not brand colors — used only by
   the admin SEO-preview widget to mimic an actual search result. */
.text-serp-title {
    color: #1a0dab;
}

.text-serp-url {
    color: #006621;
}

.text-serp-desc {
    color: #545454;
}

/* One step past Bootstrap's spacing scale (which tops out at 5 = 3rem),
   named in its own convention, for the hero section's extra-generous padding. */
.py-6 {
    padding-top: 6rem !important;
    padding-bottom: 6rem !important;
}

.gap-6 {
    gap: 5rem !important;
}

.mb-6 {
    margin-bottom: 2rem !important;
}

@media (min-width: 768px) {
    .mb-6 {
        margin-bottom: 4rem !important;
    }
}

/* "Been here / Want to go" pill buttons — plain neutral outline by default
   (not Bootstrap's outline-secondary/-dark, both retinted brand-blue in
   this theme), JS toggles .is-active instead of mutating inline styles. */
.status-pill {
    background: #fff;
    border: none;
    box-shadow: 0 1px 4px rgba(13, 42, 63, .12);
    padding-top: .65rem;
    padding-bottom: .65rem;
    color: var(--bs-dark);
    font-weight: 500;
}

.status-pill .status-icon {
    color: var(--bs-dark);
}

.status-pill.is-active {
    background: #eaf4fb;
    color: #2176ae;
}

.status-pill.is-active .status-icon {
    color: #2176ae;
}

/* Round icon-only buttons (share links, copy-link). */
.icon-btn {
    width: 32px;
    height: 32px;
}

/* Comment author avatars. */
.avatar-sm {
    width: 32px;
    height: 32px;
}

.avatar-md {
    width: 38px;
    height: 38px;
}

/* Small square thumbnail (similar-places list, etc). */
.thumb-xs {
    width: 40px;
    height: 40px;
}

/* Inline dot separator between meta items. */
.dot-sep {
    width: 3px;
    height: 3px;
    border-radius: 50%;
    background: #ccc;
    display: inline-block;
}

/* Label column width in label/value rows (Know Before You Go, etc). */
.mw-label {
    min-width: 140px;
}

/* Sidebar card that sticks a little below the page header on scroll — only
   once its column actually sits beside other content; below that it's just
   a stacked block, and sticking it would freeze it over stuff scrolling
   past. The TOC sidebar (col-md-3) and the place-detail sidebar (col-lg-4)
   go side-by-side at different breakpoints, so each gets its own cutoff. */
.sticky-sidebar {
    position: sticky;
    top: 1.5rem;
}

@media (max-width: 767.98px) {
    .sticky-sidebar {
        position: static;
        top: auto;
    }
}

.sticky-sidebar-lg {
    position: sticky;
    top: 1.5rem;
}

@media (max-width: 991.98px) {
    .sticky-sidebar-lg {
        position: static;
        top: auto;
    }
}

/* Place-detail "Contents" TOC — a connected timeline: each item draws its
   own line segment down to the next one (skipped on the last item), with a
   circular marker on top that fills in solid once JS marks it .is-active
   while scrolling past that section. */
.toc-stepper-item {
    position: relative;
    padding-left: 1.5rem;
    padding-bottom: 1.1rem;
}

.toc-stepper-item:not(:last-child) {
    background-image: linear-gradient(var(--bs-border-color), var(--bs-border-color));
    background-repeat: no-repeat;
    background-size: 2px 100%;
    background-position: 4px 0;
}

.toc-stepper-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 4px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #fff;
    border: 2px solid var(--bs-secondary-color);
}

.toc-stepper-item.is-active::before {
    background: var(--bs-primary);
    border-color: var(--bs-primary);
    box-shadow: 0 0 0 3px var(--bs-primary-bg-subtle);
}

.toc-stepper-link {
    display: block;
    text-decoration: none;
    color: var(--bs-secondary-color);
    font-size: .875rem;
    line-height: 1.3;
    padding: .2rem .6rem;
    margin-left: -.6rem;
    border-radius: .5rem;
    transition: background-color .15s ease, color .15s ease;
}

.toc-stepper-link:hover {
    color: var(--bs-primary);
}

.toc-stepper-item.is-active .toc-stepper-link {
    background: var(--bs-primary-bg-subtle);
    color: var(--bs-primary-text-emphasis);
    font-weight: 600;
}

/* Embedded map heights. */
.map-sm {
    height: 160px;
}

.map-md {
    height: 300px;
}

/* Homepage hero — full-bleed photo background. */
.hero-photo {
    overflow: hidden;
    min-height: 60vh;
    display: flex;
    align-items: center;
    text-shadow: 0 1px 3px rgba(0, 0, 0, .7), 0 1px 10px rgba(0, 0, 0, .4);
}

/* A real <img> (not a CSS background) so the browser's preload scanner can
   discover and fetch it immediately, instead of only after CSSOM/render-blocking
   CSS finishes — this was the single biggest LCP cost on the homepage. */
.hero-photo-img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 0;
}

/* Light darkening so the photo stays bright while text stays readable. */
.hero-photo::before {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, .2);
    z-index: 1;
}

/* The text-shadow above is inherited by every descendant — undo it on
   form controls, whose dark text sits on a light input, not the photo. */
.hero-photo .form-control,
.hero-photo .btn {
    text-shadow: none;
}

/* "Explore by Experience" icon tiles. */
.icon-tile {
    border: 1px solid var(--bs-border-color);
    border-radius: var(--bs-border-radius);
    padding: 1.25rem 1rem;
    text-align: center;
    text-decoration: none;
    color: var(--bs-body-color);
    background: #fff;
    display: block;
}

.icon-tile i {
    font-size: 1.5rem;
    color: #2176ae;
}

/* Overlay badge/caption shared by card grids (category pill, NEW tag, etc). */
.card-caption-overlay {
    position: absolute;
    inset: auto 0 0 0;
    background: linear-gradient(180deg, transparent 0%, rgba(13, 42, 63, .55) 40%, rgba(13, 42, 63, .92) 100%);
    color: #fff;
    padding: 2rem .75rem .75rem;
}

/* Place detail hero — an inset rounded card (not full-bleed) via a real
   <img> (so a per-record photo URL never needs an inline style), dark
   gradient overlay for legible text. No flex/vertical-centering here on
   purpose — the height comes from the content wrapper's own padding, so
   the photo is only ever as tall as the actual content (breadcrumb, title,
   meta, author) needs, with min-height just a floor for very short pages. */
.place-hero {
    position: relative;
    min-height: 380px;
    overflow: hidden;
    text-shadow: 0 1px 3px rgba(0, 0, 0, .7), 0 1px 10px rgba(0, 0, 0, .4);
}

.place-hero-img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 0;
}

.place-hero-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, .4);
    z-index: 1;
}

/* Country hero overlay — a left-to-right fade (dark where the text sits,
   clear on the right) instead of .place-hero-overlay's flat tint, so the
   photo itself stays visible rather than being dimmed everywhere. Same navy
   used by .card-caption-overlay elsewhere, for a consistent brand tint. */
.country-hero-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, rgba(13, 42, 63, .88) 0%, rgba(13, 42, 63, .68) 32%, rgba(13, 42, 63, .25) 58%, rgba(13, 42, 63, 0) 78%);
    z-index: 1;
}

/* Country hero stats row — icon + stacked label/value. Plain gap spacing on
   narrow screens (where items wrap and a divider would land oddly at the
   start of a wrapped row); a thin divider between entries once they fit on
   one line. */
.hero-stats {
    row-gap: 1rem;
    column-gap: 1.5rem;
}

@media (min-width: 768px) {
    .hero-stats {
        column-gap: 0;
    }

    .hero-stat:not(:first-child) {
        border-left: 1px solid rgba(255, 255, 255, .3);
        margin-left: 1.75rem;
        padding-left: 1.75rem;
    }
}

/* Country page's regional context map — one static world SVG (all country
   paths), server-cropped to a region around the current country per-request
   via its viewBox, with the current country's <path> flagged .is-active.
   No JS, no tile requests, unlike the old Leaflet mini map. */
.country-context-map {
    min-height: 260px;
    background: var(--brand-placeholder-bg);
}

.country-context-map svg {
    display: block;
    width: 100%;
    height: 100%;
}

.country-context-map path {
    fill: #EEF3FA;
    stroke: #fff;
    stroke-width: 0.75;
}

.country-context-map path.is-active {
    fill: #1677FF;
}

/* Bootstrap's .display-2 (5rem/80px) has no responsive scaling of its own —
   on a phone-width hero that wraps the place/country title across several
   huge lines and blows out the hero's height. Dial it back on small screens. */
.place-hero h1.display-2 {
    font-size: 2.25rem;
}

@media (min-width: 576px) {
    .place-hero h1.display-2 {
        font-size: 3rem;
    }
}

@media (min-width: 768px) {
    .place-hero h1.display-2 {
        font-size: 5rem;
    }
}

/* Small dark pill overlay on the lead gallery photo ("View all photos") — a
   light icon chip sits inside the darker pill, not just an inline glyph. */
.photo-count-badge {
    position: absolute;
    left: .75rem;
    bottom: .75rem;
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    background: rgba(13, 42, 63, .75);
    color: #fff;
    border-radius: var(--bs-border-radius);
    padding: .3rem .9rem .3rem .3rem;
    font-size: .8rem;
    font-weight: 500;
    text-decoration: none;
}

.photo-count-badge-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 7px;
    background: rgba(255, 255, 255, .9);
    color: #0d2a3f;
    font-size: .7rem;
    flex-shrink: 0;
}

/* Same badge look, tucked in a corner instead of the bottom-left default
   ("+N more" on the last gallery thumbnail). */
.photo-count-badge-corner {
    left: auto;
    right: .5rem;
    bottom: auto;
    top: .5rem;
}

/* "Leave a Review" card header illustration. */
.review-form-banner {
    height: 150px;
    background: url('../img/review-mountains.jpg') center center / cover no-repeat;
}

/* Small icon sitting inside a form field (person / pencil). */
.input-icon-group {
    position: relative;
}

.input-icon-group > i {
    position: absolute;
    left: .75rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--brand-muted-soft, #6c757d);
    pointer-events: none;
}

.input-icon-group > .form-control {
    padding-left: 2.25rem;
}

.input-icon-group-top > i {
    top: .75rem;
    transform: none;
}

/* Per-comment like button — outline by default, fills red once liked. */
.like-btn {
    border: 1px solid var(--bs-border-color);
    background: #fff;
    color: var(--brand-muted-soft, #6c757d);
    font-size: .8rem;
}

.like-btn.is-liked {
    background: #fdeceb;
    border-color: #f3b4ae;
    color: #dc3545;
}

/* Truncated "Story" copy with a fade-out + Read more toggle. */
.description-collapse {
    position: relative;
    max-height: 220px;
    overflow: hidden;
}

.description-collapse::after {
    content: '';
    position: absolute;
    inset: auto 0 0 0;
    height: 60px;
    background: linear-gradient(180deg, transparent 0%, #fff 100%);
}

.description-collapse.is-expanded {
    max-height: none;
}

.description-collapse.is-expanded::after {
    display: none;
}

/* Featured Countries card image — taller/portrait ratio, per mockup. */
.thumb-country {
    height: 280px;
}
