/* ============================================
   Tour Booking — Custom Styles (Non-Tailwind)
   Animations, hero positioning, card effects
   ============================================
   NOTE: @theme and @custom-variant live in
   base.html <style type="text/tailwindcss">
   because the browser CDN only processes
   inline style tags.
   ============================================ */

/* --- Global --- */
html {
    scroll-behavior: smooth;
}

/* --- Hero Section --- */
.hero-section {
    position: relative;
    min-height: 80vh;
    display: flex;
    align-items: center;
    justify-content: center;
    /* z-index ensures dropdown appears above following sections */
    z-index: 20;
}

.hero-section picture {
    position: absolute;
    inset: 0;
    overflow: hidden;
    z-index: 0;
}

.hero-section .hero-overlay {
    z-index: 1;
}

.hero-section .hero-content {
    position: relative;
    z-index: 2;
}

.hero-section picture img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
}

@media (min-width: 768px) {
    .hero-section picture img {
        object-position: center 30%;
    }
}

.hero-overlay {
    position: absolute;
    inset: 0;
    /* Middle stop lifted so the headline zone always has enough contrast —
       the gradient keyword used to melt into bright foliage. */
    background: linear-gradient(
        180deg,
        rgba(0, 0, 0, 0.3) 0%,
        rgba(0, 0, 0, 0.45) 45%,
        rgba(0, 0, 0, 0.65) 100%
    );
}

/* Hero copy readability on photo backgrounds */
.hero-content h1,
.hero-content p {
    text-shadow: 0 2px 14px rgba(0, 0, 0, 0.45);
}

/* bg-clip-text glyphs ignore text-shadow (it bleeds through the transparent
   fill) — drop-shadow filters the rendered gradient glyphs instead. */
.hero-keyword {
    text-shadow: none;
    filter: drop-shadow(0 2px 10px rgba(0, 0, 0, 0.65));
}

/* --- Tour Card Image Zoom --- */
.tour-card-img {
    transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.group:hover .tour-card-img {
    transform: scale(1.07);
}

/* --- Destination Card Image Zoom --- */
.dest-card-img {
    transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.group:hover .dest-card-img {
    transform: scale(1.08);
}

/* --- Animations --- */
@keyframes fade-in-up {
    from {
        opacity: 0;
        transform: translateY(28px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-fade-in-up {
    animation: fade-in-up 0.7s ease-out forwards;
}

.animate-delay-100 { animation-delay: 0.1s; opacity: 0; }
.animate-delay-200 { animation-delay: 0.2s; opacity: 0; }
.animate-delay-300 { animation-delay: 0.3s; opacity: 0; }
.animate-delay-400 { animation-delay: 0.4s; opacity: 0; }

/* --- Dark Mode Toggle Button --- */
.theme-toggle {
    position: relative;
    width: 3rem;
    height: 1.625rem;
    border-radius: 9999px;
    cursor: pointer;
    border: none;
    transition: background-color 0.3s ease;
}

.theme-toggle-knob {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 1.375rem;
    height: 1.375rem;
    border-radius: 9999px;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
}

.theme-toggle-knob.toggled {
    transform: translateX(1.375rem);
}

/* --- HTMX loading indicator --- */
.htmx-indicator {
    display: none;
}

.htmx-request .htmx-indicator {
    display: inline-flex;
}

/* --- Smooth scroll offset for fixed navbar --- */
:target {
    scroll-margin-top: 5rem;
}

/* --- Feature card glow on hover (dark mode) --- */
.dark .feature-glow:hover {
    box-shadow: 0 0 30px -5px oklch(0.58 0.19 250 / 0.25);
}

/* --- Horizontal Tour Card (Listing Page) --- */
.tour-h-card {
    display: grid;
    grid-template-columns: 1fr;
}

@media (min-width: 640px) {
    .tour-h-card {
        grid-template-columns: 320px 1fr;
    }
}

@media (min-width: 1024px) {
    .tour-h-card {
        grid-template-columns: 380px 1fr;
    }
}

.tour-h-card-img {
    aspect-ratio: 16 / 10;
}

@media (min-width: 640px) {
    .tour-h-card-img {
        aspect-ratio: auto;
        height: 100%;
    }
}

/* --- Sidebar Scrollbar --- */
.sidebar-scroll {
    scrollbar-width: thin;
    scrollbar-color: oklch(0.8 0 0) transparent;
}

.sidebar-scroll::-webkit-scrollbar {
    width: 4px;
}

.sidebar-scroll::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar-scroll::-webkit-scrollbar-thumb {
    background-color: oklch(0.8 0 0);
    border-radius: 9999px;
}

.dark .sidebar-scroll {
    scrollbar-color: oklch(0.35 0 0) transparent;
}

.dark .sidebar-scroll::-webkit-scrollbar-thumb {
    background-color: oklch(0.35 0 0);
}

/* --- Performance: Defer rendering for below-fold homepage sections ---
   content-visibility: auto tells the browser to skip layout/paint work
   for off-screen content until the user scrolls near it.
   contain-intrinsic-size prevents layout shift from collapsed heights.
   IMPORTANT: Only apply to sections that are NEVER in the initial viewport. */
#recommended-section,
#bestseller-section,
#destinations-section,
#pois-section,
#blog-section,
#reviews-section,
#why-us-section {
    content-visibility: auto;
    contain-intrinsic-size: auto none auto 600px;
}
/* --- Rich text (.prose) ---------------------------------------------------
   Handwritten replacement for the Tailwind typography plugin, which is NOT
   compiled into output.css (blog/destination/POI/legal body text rendered as
   an unstyled wall of text). Scoped to .prose wrappers already present in the
   templates; the prose-* modifier utilities in class lists stay inert. */
.prose {
    color: #4b5563;
    font-size: 1.0625rem;
    line-height: 1.75;
}

.prose h1,
.prose h2,
.prose h3,
.prose h4 {
    color: #111827;
    font-weight: 700;
    letter-spacing: -0.015em;
    line-height: 1.3;
}

.prose h1 { font-size: 1.875rem; margin: 1.5em 0 0.6em; }
.prose h2 { font-size: 1.5rem;   margin: 1.5em 0 0.6em; }
.prose h3 { font-size: 1.25rem;  margin: 1.4em 0 0.5em; }
.prose h4 { font-size: 1.125rem; margin: 1.3em 0 0.5em; }

.prose p { margin: 1.05em 0; }

.prose a {
    color: oklch(0.52 0.2 22);
    font-weight: 600;
    text-decoration: none;
}

.prose a:hover { text-decoration: underline; }

.prose strong { color: #111827; font-weight: 700; }

.prose ul,
.prose ol {
    margin: 1.05em 0;
    padding-left: 1.5rem;
}

.prose ul { list-style: disc; }
.prose ol { list-style: decimal; }
.prose li { margin: 0.45em 0; }
.prose li::marker { color: #9ca3af; }

.prose blockquote {
    border-left: 4px solid #e5e7eb;
    padding-left: 1rem;
    margin: 1.4em 0;
    font-style: italic;
    color: #6b7280;
}

.prose img {
    border-radius: 1rem;
    margin: 1.6em 0;
    max-width: 100%;
    height: auto;
}

.prose hr {
    border-color: #e5e7eb;
    margin: 2.5em 0;
}

.prose table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95em;
    margin: 1.4em 0;
}

.prose th,
.prose td {
    border: 1px solid #e5e7eb;
    padding: 0.5rem 0.75rem;
    text-align: left;
}

.prose th { background: #f9fafb; font-weight: 700; }

.dark .prose { color: #9ca3af; }

.dark .prose h1,
.dark .prose h2,
.dark .prose h3,
.dark .prose h4,
.dark .prose strong { color: #f9fafb; }

.dark .prose a { color: oklch(0.76 0.15 22); }

.dark .prose blockquote {
    border-color: #374151;
    color: #9ca3af;
}

.dark .prose li::marker { color: #6b7280; }

.dark .prose th,
.dark .prose td { border-color: #374151; }

.dark .prose th { background: #111827; }

/* --- iOS focus-zoom guard -------------------------------------------------
   Mobile Safari force-zooms the page when a focused form control's font-size
   is below 16px (the navbar search was text-sm/14px → ugly zoom jump when
   tapping it mid-scroll). Raising controls to 16px on phones is the ONLY
   accessible fix — never add maximum-scale/user-scalable to the viewport
   meta, that blocks pinch-zoom for low-vision users. !important is needed
   because Tailwind utilities (.text-sm) are classes and outrank element
   selectors. */
@media (max-width: 767px) {
    input,
    select,
    textarea {
        font-size: 16px !important;
    }
}

/* --- Bookings filter bar: mobile layout -----------------------------------
   The phone view stacks the filter row (Tailwind flex-col). Today/Tomorrow
   and the supplier/status selects used to stay content-width, leaving an ugly
   gap on the right. sm:w-auto / sm:flex-none / contents are purged from
   output.css and can't be rebuilt (version drift), so the phone-only
   equalising is expressed here — styles.css loads after output.css. Desktop
   keeps the untouched Tailwind flex-wrap layout (this block is <640px only). */
@media (max-width: 639px) {
    #booking-filter-form .quick-dates { width: 100%; }
    #booking-filter-form .quick-dates > button { flex: 1 1 0; min-width: 0; }
    #booking-filter-form .filter-selects { width: 100%; }
    #booking-filter-form .filter-selects > div { flex: 1 1 0; min-width: 0; }
    #booking-filter-form .filter-selects select { width: 100%; min-width: 0; }
}

/* --- Visitors dashboard: 5-across summary cards on desktop ----------------
   lg:grid-cols-5 isn't in the purged Tailwind build (only 2/3/4/6 shipped) and
   output.css can't be rebuilt (version drift). Base grid-cols-2 covers mobile;
   this expresses the desktop 5-column layout. Scoped to .visitor-cards. */
@media (min-width: 1024px) {
    .visitor-cards { grid-template-columns: repeat(5, minmax(0, 1fr)); }
}

/* --- Manage panel: collapsible sidebar (desktop) --------------------------
   The bookings table is 14 columns wide and the fixed 16rem sidebar squeezed
   it. Collapsing to an icon rail hands ~11rem back to the table. The state
   lives as .nav-collapsed on <html> (set by an inline script before paint, so
   the rail never flashes wide), and the widths are plain CSS because a
   Tailwind rebuild would drift the whole output.css. Mobile is untouched —
   there the sidebar is an overlay that slides in/out. */
.admin-sidebar {
    transition-property: transform, width;
    transition-duration: 300ms;
}

/* Collapse toggle: desktop-only. `hidden lg:flex` can't do this — the purged
   output.css ships lg:flex-1 / lg:flex-row but not the bare lg:flex utility. */
.nav-toggle { display: none; }

/* --- Bookings table: collapsed ID column ---------------------------------
   Rows show a 6-char stub; clicking one reveals its full UUID. The value must
   WRAP inside the capped cell — a <td> that grows would shove every other
   column to the right, which is the space this collapse is meant to win. */
.booking-id-btn {
    display: inline-block;
    text-align: left;
    white-space: nowrap;
    line-height: 1.35;
}

.booking-id-btn.is-open {
    white-space: normal;
    overflow-wrap: anywhere;
    width: 6.5rem;
}

@media (min-width: 1024px) {
    .nav-toggle { display: flex; }
    html.nav-collapsed .admin-sidebar { width: 4.5rem; }
    html.nav-collapsed .admin-sidebar .nav-label { display: none; }
    html.nav-collapsed .admin-sidebar .nav-logo { display: none; }
    html.nav-collapsed .admin-sidebar .nav-head { justify-content: center; padding: 1rem 0.5rem; }
    html.nav-collapsed .admin-sidebar nav { padding-left: 0.5rem; padding-right: 0.5rem; }
    html.nav-collapsed .admin-sidebar nav a,
    html.nav-collapsed .admin-sidebar .nav-footer a {
        justify-content: center;
        padding-left: 0.5rem;
        padding-right: 0.5rem;
    }
    html.nav-collapsed .admin-sidebar .nav-footer { padding-left: 0.5rem; padding-right: 0.5rem; }
}

/* Native date inputs in the dark admin theme: without this Chrome draws the
   calendar icon black on the near-black field (channels filter bar). */
.dark input[type="date"] {
    color-scheme: dark;
}
