/* ==========================================================================
   FINLANDIAN LINES - PEAMINE STIILIFAIL
   ========================================================================== */

/* --- 1. GLOBAALNE OPTIMEERIMINE JA TÜPOGRAAFIA --- */
html {
    scroll-behavior: smooth;
    /* UUS: Jätab ankur-linkidele kerides üleval ruumi, et kleepuv päis ei kataks pealkirja */
    scroll-padding-top: 100px;
}

body {
    /* Muudab tekstid teravamaks ja luksuslikumaks (Mac/iOS seadmetel) */
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    /* Eemaldab mobiilis inetu sinise/halli vilkumise, kui nupule või lingile vajutad */
    -webkit-tap-highlight-color: transparent;
}

/* UUS: Klaviatuuriga navigeerijatele ilus fookus (aga peidame hiirega klikkides) */
*:focus-visible {
    outline: 2px solid #fed488;
    outline-offset: 2px;
}

/* Peidab horisontaalse kerimisriba mobiili slideritel, aga jätab näpuga kerimise funktsionaalsuse */
.hide-scrollbar::-webkit-scrollbar { 
    display: none; 
}
.hide-scrollbar { 
    -ms-overflow-style: none; 
    scrollbar-width: none; 
}

/* Safe-area padding, et mobiili alumine äpi-menüü ei jääks iPhone'i triibu taha */
.pb-safe { 
    padding-bottom: env(safe-area-inset-bottom, 20px); 
}


/* --- 2. IKOONID JA VORMID --- */
/* Google Material Icons seadistused (muudab ikoonid õhemaks ja elegantsemaks) */
.material-symbols-outlined { 
    font-variation-settings: 'FILL' 0, 'wght' 300, 'GRAD' 0, 'opsz' 24; 
}
.icon-filled { 
    font-variation-settings: 'FILL' 1, 'wght' 400; 
}

/* Peidame brauseri inetu kuupäeva-ikooni, kuna me kasutame disainitud Material ikooni */
input[type="date"]::-webkit-calendar-picker-indicator {
    opacity: 0; 
    width: 100%; 
    height: 100%; 
    position: absolute; 
    top: 0; 
    left: 0; 
    cursor: pointer;
}

/* UUS: Peidame HTML5 numbrilahtrite inetumad nooled (spinnerid) broneerimisvormis */
input[type="number"]::-webkit-inner-spin-button, 
input[type="number"]::-webkit-outer-spin-button { 
    -webkit-appearance: none; 
    margin: 0; 
}
input[type="number"] {
    -moz-appearance: textfield; /* Firefox tuki */
}

/* Parandab brauseri automaattäite (autofill) koleda taustavärvi vormides */
input:-webkit-autofill,
input:-webkit-autofill:hover, 
input:-webkit-autofill:focus, 
input:-webkit-autofill:active{
    -webkit-box-shadow: 0 0 0 30px #f7f9fc inset !important;
    -webkit-text-fill-color: #001b44 !important;
    transition: background-color 5000s ease-in-out 0s;
}


/* --- 3. GLASSMORPHISM (Klaasefektid) --- */
.glass-panel {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px); /* Oluline Safari (iPhone) toe jaoks! */
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.dark-glass-panel {
    background: rgba(0, 27, 68, 0.75);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}


/* --- 4. DÜNAAMILISED EFEKTID JA ANIMATSIOONID --- */
/* Dünaamiline hiirekuma (Mouse Glow) Hero sektsioonides */
#mouse-glow {
    background: radial-gradient(
        600px circle at var(--mouse-x, 50%) var(--mouse-y, 50%), 
        rgba(254, 212, 136, 0.15), 
        transparent 40%
    );
    pointer-events: none;
    z-index: 10;
}

/* Hero piltide Ken Burns (sujuv ja aeglane sissesuumimine) */
.hero-slide { 
    transition: opacity 2s ease-in-out, transform 10s ease-out; 
    will-change: transform, opacity;
}
.hero-slide.active { 
    opacity: 1; 
    transform: scale(1.05); 
}
.hero-slide.inactive { 
    opacity: 0; 
    transform: scale(1); 
}

/* Logo lainetav animatsioon (Päises ja jaluses) */
@keyframes logo-wave-1 { 
    0%, 100% { transform: translate(0, 0); color: #fed488; } 
    50% { transform: translate(2px, -2px); color: #ffffff; } 
}
@keyframes logo-wave-2 { 
    0%, 100% { transform: translate(0, 0); opacity: 0.7; } 
    50% { transform: translate(4px, -4px); opacity: 1; } 
}
@keyframes logo-wave-3 { 
    0%, 100% { transform: translate(0, 0); opacity: 0.4; } 
    50% { transform: translate(6px, -6px); opacity: 1; } 
}

.group:hover .logo-line-1 { animation: logo-wave-1 0.8s ease-in-out forwards; }
.group:hover .logo-line-2 { animation: logo-wave-2 0.8s ease-in-out 0.1s forwards; }
.group:hover .logo-line-3 { animation: logo-wave-3 0.8s ease-in-out 0.2s forwards; }


/* --- 5. SCROLL REVEAL (Sujuv ilmumine kerimisel) --- */
.reveal-up {
    opacity: 0;
    transform: translateY(40px);
    transition: opacity 0.8s ease-out, transform 0.8s cubic-bezier(0.2, 0.8, 0.2, 1);
    will-change: opacity, transform;
}
.reveal-up.active {
    opacity: 1;
    transform: translateY(0);
}

/* Astmelised viivitused elementidele (Stagger effect) */
.delay-100 { transition-delay: 100ms; }
.delay-200 { transition-delay: 200ms; }
.delay-300 { transition-delay: 300ms; }
.delay-400 { transition-delay: 400ms; }

/* Eemalda viivitused mobiilis, et leht laeks kiiremini ja ei tunduks "katki", kui näpuga kiirelt kerida */
@media (max-width: 768px) {
    .delay-100, .delay-200, .delay-300, .delay-400 {
        transition-delay: 0ms !important;
    }
}


/* --- 6. MAGNETIC BUTTONS (Interaktiivsed nupud) --- */
/* Nupp naaseb oma kohale pehmelt (spring efektiga) */
.magnetic-btn {
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.1), box-shadow 0.3s, background-color 0.3s, color 0.3s;
    will-change: transform;
}

/* Hoveril eemaldame transform transitioni, et JavaScripti hiire liigutamine ei tunduks uimane */
.magnetic-btn:hover {
    transition: transform 0s, box-shadow 0.3s, background-color 0.3s, color 0.3s;
}

/* Mobiilis lülitame magnetic efekti visuaalselt välja, sest puute-ekraanil pole kursorit */
@media (max-width: 768px) {
    .magnetic-btn {
        transition: background-color 0.3s, color 0.3s, box-shadow 0.3s, transform 0.1s !important;
    }
    .magnetic-btn:active {
        transform: scale(0.95) !important;
    }
}


/* --- 7. TÄIUSLIK TÜPOGRAAFIA (Modern text-wrapping) --- */
/* Tagab, et suured pealkirjad murduvad sümmeetriliselt ja loogiliselt */
h1, h2, h3, h4, h5, h6, .font-headline {
    text-wrap: balance;
}
/* Lõigud ei jäta kunagi viimasele reale vaid ühte sõna */
p {
    text-wrap: pretty;
}


/* --- 8. PÄISE (HEADER) KERIMISE EFEKT --- */
/* Seda klassi lisab JavaScript, kui kasutaja kerib lehte allapoole */
#main-header {
    transition: background-color 0.4s ease, padding 0.4s ease, box-shadow 0.4s ease, border 0.4s ease;
}
#main-header.scrolled {
    background-color: rgba(0, 27, 68, 0.95); /* bg-primary kerge läbipaistvusega */
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow: 0 10px 30px rgba(0,0,0,0.15);
    /* border-bottom: 1px solid rgba(255, 255, 255, 0.1); */
    /* Teeme päise kerides veidi õhemaks, et säästa ekraaniruumi */
    padding-top: 0.25rem;
    padding-bottom: 0.25rem;
}


/* --- 9. VORMIDE LISAPARANDUSED --- */
/* Eemaldab IE/Edge brauserites inetu topelt-noole select kastidelt */
select::-ms-expand {
    display: none;
}


/* --- 10. SPETSIIFILISED ANIMATSIOONID (nt 404 leht) --- */
/* Ikooni hõljumine (üles-alla) */
@keyframes float-icon {
    0%, 100% { transform: translateY(0px) scale(1); }
    50% { transform: translateY(-15px) scale(1.02); }
}
.animate-float {
    animation: float-icon 4s ease-in-out infinite;
}

/* --- 11. BLOGI JA UUDISTE ARTIKLITE STIILID (Rich Text) --- */
/* Formateerib artiklite sisu, kuna Tailwind nullib vaikimisi HTML stiilid */
.rich-text h2 {
    font-family: 'Manrope', sans-serif;
    font-size: 1.875rem;
    font-weight: 800;
    color: #001b44;
    margin-top: 2.5rem;
    margin-bottom: 1.25rem;
    letter-spacing: -0.02em;
}

.rich-text h3 {
    font-family: 'Manrope', sans-serif;
    font-size: 1.5rem;
    font-weight: 700;
    color: #001b44;
    margin-top: 2rem;
    margin-bottom: 1rem;
}

.rich-text p {
    color: #475569;
    margin-bottom: 1.5rem;
    line-height: 1.8;
}

.rich-text a {
    color: #fed488;
    text-decoration: underline;
    text-underline-offset: 4px;
    transition: color 0.3s;
    font-weight: 600;
}

.rich-text a:hover {
    color: #001b44;
}

.rich-text ul {
    list-style-type: disc;
    margin-left: 1.5rem;
    margin-bottom: 1.5rem;
    color: #475569;
    line-height: 1.8;
}

.rich-text ol {
    list-style-type: decimal;
    margin-left: 1.5rem;
    margin-bottom: 1.5rem;
    color: #475569;
    line-height: 1.8;
}

.rich-text li {
    margin-bottom: 0.5rem;
}

.rich-text blockquote {
    border-left: 4px solid #fed488;
    padding-left: 1.25rem;
    font-style: italic;
    color: #64748b;
    margin: 2rem 0;
    background: #f7f9fc;
    padding-top: 1rem;
    padding-bottom: 1rem;
    border-radius: 0 1rem 1rem 0;
}

.rich-text img {
    border-radius: 1.5rem;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    margin: 2.5rem 0;
    max-width: 100%;
    height: auto;
}

/* --- 12. MOBIILI VÄLJANÄGEMISE JA LIGIPÄÄSETAVUSE PARANDUSED --- */
@media (max-width: 768px) {
    
    /* 1. Väldime sisu kleepumist vastu ekraani külgi */
    .px-4, .px-6 {
        padding-left: 1.25rem !important;
        padding-right: 1.25rem !important;
    }

    /* 2. Parandame Hero ala kattuvuse (Tekst vs Vorm) */
    /* Lükkame teksti ekraani ülaossa (mitte keskele) ja anname piisava miinimumkõrguse */
    section#hero-section,
    section:first-of-type {
        align-items: flex-start !important; 
        padding-top: 130px !important;
        min-height: 750px !important; /* Tagab, et lühikesel ekraanil ei pressita asju kokku */
    }
    
    section:first-of-type > .relative.z-10.-mt-10,
    section:first-of-type > .relative.z-10.-mt-20 {
        margin-top: 0 !important;
    }
    
    section.z-20.-mt-20, 
    section.z-20.-mt-28, 
    section.z-20.-mt-32 {
        margin-top: -2rem !important;
    }

    /* 3. Parandame "liiga all" probleemi (mobiilimenüü taha jäämine) */
    main {
        padding-bottom: calc(120px + env(safe-area-inset-bottom, 20px)) !important;
    }

    /* Otsinguvormi positsioneerimine ja suuruse kohandamine mobiilis */
    section:first-of-type > .absolute.bottom-24,
    section:first-of-type > .absolute.bottom-36,
    section:first-of-type > .absolute.bottom-48 {
        bottom: calc(90px + env(safe-area-inset-bottom, 20px)) !important;
    }

    /* Teeme avalehe otsinguvormi mobiilis veidi kompaktsemaks, et säästa ruumi */
    form.max-w-5xl {
        padding: 0.75rem !important;
    }
    form.max-w-5xl .p-3, 
    form.max-w-5xl .py-4 {
        padding-top: 0.5rem !important;
        padding-bottom: 0.5rem !important;
    }
    
    /* 4. Loetavuse parandamine: Nutikas tüpograafia suurte pealkirjade jaoks */
    h1 {
        font-size: clamp(2.25rem, 8vw, 3rem) !important;
        line-height: 1.15 !important;
    }
    
    /* 5. Hoiame ära horisontaalse kerimise */
    body, html {
        overflow-x: hidden;
    }

    /* 6. Lülitame sisu ilmumise animatsioonid mobiilis TÄIELIKULT välja maksimaalse kiiruse tagamiseks! */
    .reveal-up {
        opacity: 1 !important;
        transform: translateY(0) !important;
        transition: none !important;
        animation: none !important;
    }
}