/* ============================================
   PODOJALAHOOLDUS — Custom Styles
   ============================================ */

/* --- Global --- */
html {
    scroll-behavior: smooth;
}

body {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Better text wrapping - prevent single letter line breaks */
p, span, li, div {
    word-spacing: normal;
    letter-spacing: normal;
}

/* Russian text optimization */
html[lang="ru"] .mobile-pair > span:first-child {
    word-spacing: 0.05em;
}

/* Hide scrollbar for carousel */
.carousel-container {
    overflow: hidden;
    width: 100%;
    -webkit-mask-image: linear-gradient(
        to right,
        transparent 0%,
        black 5%,
        black 95%,
        transparent 100%
    );
    mask-image: linear-gradient(
        to right,
        transparent 0%,
        black 5%,
        black 95%,
        transparent 100%
    );
}

/* ============================================
   CAROUSEL — Infinite Auto-Scroll
   ============================================ */
.carousel-track {
    display: flex;
    gap: 1rem;
    animation: carousel-scroll 50s linear infinite;
    will-change: transform;
    width: max-content;
}

.carousel-track:hover {
    animation-play-state: paused;
}

.carousel-item {
    flex-shrink: 0;
    width: 280px;
    height: 280px;
    border-radius: 1rem;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.carousel-item:hover {
    transform: scale(1.05);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.2);
}

.carousel-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease, filter 0.4s ease;
    filter: blur(6px);
    cursor: zoom-in;
}

.carousel-item:hover img {
    transform: scale(1.1);
    filter: blur(0);
}

@keyframes carousel-scroll {
    0% {
        transform: translateX(0);
    }
    100% {
        transform: translateX(-50%);
    }
}

/* ============================================
   PRODUCT IMAGES — Zoom Cursor
   ============================================ */
.grid.grid-cols-2 img[src^="resources/MeansUsed"] {
    cursor: zoom-in;
    transition: transform 0.3s ease;
}

.grid.grid-cols-2 img[src^="resources/MeansUsed"]:hover {
    transform: scale(1.05);
}

/* ============================================
   SCROLL REVEAL ANIMATIONS
   ============================================ */

/* Base: elements start hidden */
.anim {
    opacity: 0;
    transition: opacity 0.8s ease, transform 0.8s ease;
}

/* When visible */
.anim.visible {
    opacity: 1;
    transform: translate(0, 0) scale(1) !important;
}

/* Animation variants — initial states */
.anim-fade-left {
    transform: translateX(-50px);
}

.anim-fade-right {
    transform: translateX(50px);
}

.anim-fade-up {
    transform: translateY(30px);
}

.anim-fade-down {
    transform: translateY(-30px);
}

.anim-scale-in {
    transform: scale(0.9);
}

/* Also animate the hero on page load */
#hero .anim {
    transition-delay: 0.2s;
}

#hero .anim-fade-up {
    transition-delay: 0.6s;
}

/* ============================================
   MOBILE MENU
   ============================================ */
#mobile-menu {
    transition: opacity 0.4s ease, transform 0.4s ease;
    width: 100vw;
    height: 100svh;
    max-height: 100svh;
    overflow-y: auto;
    padding: 0;
    text-align: center;
}

#mobile-menu.open {
    display: flex !important;
    opacity: 1;
    transform: translateY(0);
    pointer-events: all;
}

/* ============================================
   MOBILE SERVICES/PRICES PAIRS
   ============================================ */
/* New vertical card design for mobile */
.mobile-pair {
    display: flex;
    flex-direction: column;
    gap: 6px;
    background: white;
    padding: 12px 14px;
    border-radius: 12px;
    border-left: 3px solid #3a6548;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    transition: all 0.2s ease;
}

.mobile-pair:active {
    transform: scale(0.98);
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.mobile-pair > span:first-child {
    overflow-wrap: break-word;
    word-wrap: break-word;
    hyphens: manual;
    color: #374151;
    font-size: 0.875rem;
    line-height: 1.4;
    font-weight: 500;
}

.mobile-price {
    color: #3a6548;
    font-weight: 700;
    font-size: 1rem;
    margin-top: 2px;
}

.mobile-price-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

@media (max-width: 420px) {
    .mobile-pair {
        padding: 10px 12px;
        gap: 5px;
    }
    .mobile-pair > span:first-child {
        font-size: 0.8125rem;
    }
    .mobile-price {
        font-size: 0.9375rem;
    }
}

@media (max-width: 360px) {
    .mobile-pair {
        padding: 9px 11px;
    }
    .mobile-pair > span:first-child {
        font-size: 0.75rem;
        overflow-wrap: anywhere;
    }
    .mobile-price {
        font-size: 0.875rem;
    }
}

/* Russian language optimization */
html[lang="ru"] .mobile-pair > span:first-child {
    word-spacing: 0.05em;
}

/* ============================================
   PRODUCT CARDS & IMAGES
   ============================================ */
.product-card img {
    cursor: zoom-in;
}

.product-card:hover img {
    transform: scale(1.05);
}

/* ============================================
   HEADER — scroll shadow
   ============================================ */
#header {
    transition: background-color 0.3s ease, box-shadow 0.3s ease, padding 0.3s ease;
}

#header.scrolled {
    background-color: rgba(58, 101, 72, 0.98);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    padding-top: 0.75rem;
    padding-bottom: 0.75rem;
}

/* ============================================
   LANGUAGE TOGGLE
   ============================================ */
#lang-toggle,
#lang-toggle-footer {
    user-select: none;
}

#lang-toggle:hover,
#lang-toggle-footer:hover {
    opacity: 0.9;
}

/* ============================================
   NAV LINK UNDERLINE ANIMATION
   ============================================ */
.nav-link span:last-child {
    transition: width 0.3s ease;
}

/* ============================================
   SELECTION COLOR
   ============================================ */
::selection {
    background-color: #3a6548;
    color: white;
}

/* ============================================
   SMOOTH IMAGE LOADING
   ============================================ */
img {
    transition: opacity 0.5s ease;
}

img[src] {
    opacity: 1;
}

/* ============================================
   TEXTURED GREEN BACKGROUNDS
   ============================================ */
.bg-texture {
    position: relative;
    isolation: isolate;
}

.bg-texture::before {
    content: "";
    position: absolute;
    inset: -10% 0;
    background-image: url('resources/Background.png'), url('resources/LandingPageBackground.png');
    background-size: cover, cover;
    background-position: center, center;
    opacity: 0.08;
    pointer-events: none;
    z-index: 0;
}

.bg-texture > * {
    position: relative;
    z-index: 1;
}

/* ============================================
   CUSTOM SCROLLBAR
   ============================================ */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #fdfcf8;
}

::-webkit-scrollbar-thumb {
    background: #3a6548;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #2a4c36;
}

/* Firefox */
* {
    scrollbar-width: thin;
    scrollbar-color: #3a6548 #fdfcf8;
}

/* ============================================
   RESPONSIVE ADJUSTMENTS
   ============================================ */
@media (max-width: 768px) {
    #services .services-card,
    #prices {
        padding: 24px;
        border-radius: 28px;
    }

    #prices ul li {
        align-items: flex-start;
    }

    #prices .price-text {
        display: block;
    }

    .carousel-item {
        width: 220px;
        height: 220px;
    }

    .carousel-container {
        -webkit-mask-image: linear-gradient(
            to right,
            transparent 0%,
            black 3%,
            black 97%,
            transparent 100%
        );
        mask-image: linear-gradient(
            to right,
            transparent 0%,
            black 3%,
            black 97%,
            transparent 100%
        );
    }
}

@media (max-width: 480px) {
    .carousel-item {
        width: 180px;
        height: 180px;
    }
}

/* ============================================
   BUTTON HOVER GLOW
   ============================================ */
a[href="#contact"]:hover,
button:hover {
    transition: all 0.3s ease;
}

/* ============================================
   FOOTER MAP TILT
   ============================================ */
@media (min-width: 768px) {
    .rotate-1 {
        transition: transform 0.5s ease;
    }
    .rotate-1:hover {
        transform: rotate(0deg) scale(1.02);
    }
}

/* ============================================
   PRICE LIST LINE HEIGHT ALIGNMENT
   ============================================ */
#services ul li {
    transition: background-color 0.2s ease;
}

#services .services-card ul li:hover {
    background-color: rgba(58, 101, 72, 0.05);
    border-radius: 8px;
    padding-left: 4px;
    margin-left: -4px;
}

/* ============================================
   CERTIFICATES MODAL
   ============================================ */
.modal {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal.hidden {
    display: none;
}

.modal-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
}

.modal-content {
    position: relative;
    z-index: 1;
    width: min(1000px, 92vw);
    max-height: 88vh;
    background: #fdfcf8;
    border-radius: 24px;
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.35);
    padding: 24px;
    overflow: hidden;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.modal-close {
    width: 36px;
    height: 36px;
    border-radius: 999px;
    border: none;
    background: #3a6548;
    color: white;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
}

.modal-body {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    overflow: auto;
    max-height: 72vh;
    padding-bottom: 6px;
}

.modal-image {
    width: 100%;
    border-radius: 16px;
    border: 1px solid rgba(58, 101, 72, 0.15);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

body.modal-open {
    overflow: hidden;
}

/* ============================================
   IMAGE ZOOM MODAL
   ============================================ */
#image-zoom-modal {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: rgba(0, 0, 0, 0.95);
    display: none;
    align-items: center;
    justify-content: center;
    cursor: zoom-out;
    padding: 20px;
}

#image-zoom-modal.active {
    display: flex;
}

#image-zoom-modal img {
    max-width: 95%;
    max-height: 95vh;
    object-fit: contain;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.8);
    cursor: default;
}

#image-zoom-modal .close-zoom {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 44px;
    height: 44px;
    background: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    cursor: pointer;
    color: #3a6548;
    font-weight: bold;
    transition: all 0.2s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

#image-zoom-modal .close-zoom:hover {
    transform: scale(1.1);
    background: #3a6548;
    color: white;
}
