/**
 * TLT Home - Custom CSS
 * All custom classes prefixed with 'tlt-' to avoid conflicts during integration.
 * Loads after Tailwind (dist/output.css).
 */

/* =====================================================
   Base Styles
   ===================================================== */

/* Prevent layout shift when scrollbar is hidden (e.g., megamenu open) */
/* Only on desktop - mobile doesn't need gutter */
@media (min-width: 768px) {
    html {
        scrollbar-gutter: stable;
    }
}

/* =====================================================
   Utility Classes
   ===================================================== */

/* Hide scrollbar for horizontal scroll sections */
.tlt-scrollbar-hide {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

.tlt-scrollbar-hide::-webkit-scrollbar {
    display: none;
}

/* Thin visible scrollbar */
.tlt-scrollbar-thin {
    scrollbar-width: thin;
    scrollbar-color: rgba(0, 0, 0, 0.2) transparent;
    padding-right: 12px;
}

.tlt-scrollbar-thin::-webkit-scrollbar {
    width: 4px;
}

.tlt-scrollbar-thin::-webkit-scrollbar-track {
    background: transparent;
}

.tlt-scrollbar-thin::-webkit-scrollbar-thumb {
    background-color: rgba(0, 0, 0, 0.2);
    border-radius: 2px;
}

/* Thin visible scrollbar - light (for dark backgrounds) */
.tlt-scrollbar-thin-light {
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.3) rgba(255, 255, 255, 0.08);
}

.tlt-scrollbar-thin-light::-webkit-scrollbar {
    width: 4px;
}

.tlt-scrollbar-thin-light::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.08);
    border-radius: 2px;
}

.tlt-scrollbar-thin-light::-webkit-scrollbar-thumb {
    background-color: rgba(255, 255, 255, 0.3);
    border-radius: 2px;
}

/* Line clamping for text truncation */
.tlt-line-clamp-3 {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Writing mode for vertical text (Why Travel With Us cards) */
.tlt-writing-vertical {
    writing-mode: vertical-rl;
}

/* Section padding utility */
.tlt-section-padding {
    padding: 4rem 1rem;
}

@media (min-width: 768px) {
    .tlt-section-padding {
        padding: 6rem 2rem;
    }
}

@media (min-width: 1024px) {
    .tlt-section-padding {
        padding: 6rem 4rem;
    }
}

/* Container utility */
.tlt-container-wide {
    width: 100%;
    margin-left: auto;
    margin-right: auto;
}

/* =====================================================
   Header Styles
   ===================================================== */

/* Header transition when megamenu state changes */
#tlt-site-header {
    transition: opacity 0.3s ease-in-out, background-color 0.3s ease, padding 0.3s ease, box-shadow 0.3s ease;
}

/* Logo color switching via CSS filter */
.tlt-logo-light {
    filter: brightness(1);
    transition: filter 0.3s ease;
}

.tlt-logo-dark {
    filter: brightness(0);
    transition: filter 0.3s ease;
}

/* =====================================================
   Destinations Megamenu Styles
   ===================================================== */

/* Megamenu container - desktop: fade in, mobile: reveal from top */
#tlt-destinations-megamenu {
    transition: opacity 0.4s ease-out, transform 0.4s ease-out;
    opacity: 0;
    transform: translateY(-20px);
}

#tlt-destinations-megamenu.tlt-megamenu-open {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

/* Mobile: clip-path reveal from top with fade (roll down effect) */
@media (max-width: 1023px) {
    #tlt-destinations-megamenu {
        transform: none;
        opacity: 0;
        clip-path: inset(0 0 100% 0);
        transition: clip-path 0.5s ease-out, opacity 0.4s ease-out;
    }
    
    #tlt-destinations-megamenu.tlt-megamenu-open {
        opacity: 1;
        clip-path: inset(0 0 0 0);
    }
}

/* Header state when megamenu is open */
#tlt-site-header.tlt-megamenu-active {
    background-color: #171B1F !important;
}

/* Keep header elements white when megamenu is open */
#tlt-site-header.tlt-megamenu-active [data-tlt-scroll-text] {
    color: white !important;
}

#tlt-site-header.tlt-megamenu-active [data-tlt-scroll-logo] {
    filter: brightness(1) !important;
}

/* Destinations nav link active state (white underline) */
#tlt-destinations-toggle.tlt-active::after {
    transform: scaleX(1);
}

/* Opacity utility classes for megamenu */
.tlt-opacity-0 {
    opacity: 0;
}

.tlt-opacity-30 {
    opacity: 0.3;
}

.tlt-opacity-100 {
    opacity: 1;
}

/* Region item transitions */
.tlt-region-item {
    transition: opacity 0.2s ease;
}

/* Nav link underline effect */
.tlt-nav-link {
    position: relative;
    padding-bottom: 4px;
}

.tlt-nav-link::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 1px;
    background-color: white;
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.2s ease;
}

.tlt-nav-link:hover::after,
.tlt-nav-link.tlt-active::after {
    transform: scaleX(1);
}

/* When header is scrolled/sticky, underline becomes black */
.tlt-nav-link.tlt-nav-scrolled::after {
    background-color: #171B1F;
}

/* Filter link underline effect (dark variant for light backgrounds) */
.tlt-filter-link {
    position: relative;
    padding-bottom: 8px;
}

.tlt-filter-link::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 2px;
    background-color: #171B1F;
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.3s ease;
}

.tlt-filter-link:hover::after,
.tlt-filter-link.tlt-active::after {
    transform: scaleX(1);
}

/* Mobile region items */
.tlt-mobile-region-item {
    transition: opacity 0.2s ease;
}

/* Megamenu image transition */
#tlt-megamenu-image {
    transition: background-image 0.5s ease-in-out, opacity 0.3s ease;
}

/* All destinations button fade */
#tlt-all-destinations-btn {
    transition: opacity 0.2s ease;
}

/* Mobile back button */
#tlt-mobile-back-btn {
    transition: opacity 0.2s ease;
}

#tlt-mobile-back-btn:hover {
    opacity: 1;
}

/* =====================================================
   Typography
   ===================================================== */

/* Font for region names in megamenu */
.tlt-font-serif {
    font-family: "ivypresto-display", Georgia, serif;
    font-weight: 300;
}

/* Testimonial quote icon */
.tlt-quote-icon {
    flex-shrink: 0;
}

/* =====================================================
   Component-specific styles
   ===================================================== */

/* Expandable cards (Why Travel With Us) */
.tlt-expandable-card {
    transition: flex 0.5s ease;
}

/* Image overlay fades to mask content swap */
.tlt-expandable-card [data-tlt-image-overlay] {
    transition: opacity 0.25s ease;
}

/* Text panel slides out like a drawer */
.tlt-text-panel {
    width: 0;
    transition: width 0.5s ease;
}

.tlt-text-panel.tlt-text-panel-open {
    width: 60%;
}

/* Inner content stays at fixed width, fades in after panel opens */
.tlt-text-panel-inner {
    min-width: 280px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.tlt-text-panel-open .tlt-text-panel-inner {
    opacity: 1;
    transition: opacity 0.3s ease 0.45s;
}

/* Carousel track */
.tlt-carousel-track {
    transition: transform 0.3s ease;
}

/* Footer accordion arrow rotation */
.tlt-footer-arrow {
    transition: transform 0.2s ease;
}

.tlt-footer-arrow.rotate-180 {
    transform: rotate(180deg);
}

/* =====================================================
   Hero Search Box Styles
   ===================================================== */

/* Default state - transparent with white text */
.tlt-hero-search {
    transition: background-color 0.2s ease, border-color 0.2s ease;
}

/* Focus state - white background */
.tlt-hero-search:focus-within {
    background-color: #F0E8E3;
    border-color: #F0E8E3;
}

.tlt-hero-search:focus-within .tlt-hero-search-input {
    color: #171B1F;
}

.tlt-hero-search:focus-within .tlt-hero-search-input::placeholder {
    color: rgba(23, 27, 31, 0.5);
}

/* Show clear button when focused and has value */
.tlt-hero-search.tlt-has-value .tlt-hero-search-clear {
    display: flex;
}

/* Dark close button when search has cream background */
.tlt-hero-search:focus-within .tlt-hero-search-clear {
    color: #171B1F;
}

/* =====================================================
   Contact Form - Radio & Checkbox
   ===================================================== */

/* Custom radio button */
.tlt-radio {
    appearance: none;
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border: 1px solid #d1d5db;
    border-radius: 50%;
    background: white;
    cursor: pointer;
    flex-shrink: 0;
    transition: border-color 0.15s ease;
    position: relative;
}

.tlt-radio:hover {
    border-color: #171B1F;
}

.tlt-radio:checked {
    border-color: #171B1F;
}

.tlt-radio:checked::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background-color: #171B1F;
}

.tlt-radio:focus-visible {
    outline: none;
    box-shadow: 0 0 0 2px white, 0 0 0 4px #171B1F;
}

/* Custom checkbox */
.tlt-checkbox {
    appearance: none;
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border: 1px solid #d1d5db;
    border-radius: 2px;
    background: white;
    cursor: pointer;
    flex-shrink: 0;
    transition: border-color 0.15s ease, background-color 0.15s ease;
    position: relative;
}

.tlt-checkbox:hover {
    border-color: #171B1F;
}

.tlt-checkbox:checked {
    border-color: #171B1F;
    background-color: #171B1F;
}

.tlt-checkbox:checked::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 5px;
    width: 5px;
    height: 9px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.tlt-checkbox:focus-visible {
    outline: none;
    box-shadow: 0 0 0 2px white, 0 0 0 4px #171B1F;
}
