:root {
    /* Design Tokens */
    --c-primary: #EE181A;
    --c-primary-hover: #c41416;
    --c-bg: #262626;
    --c-surface: #333333;
    --c-surface-light: #444444;
    --c-text: #ffffff;
    --c-text-muted: #cccccc;
    --c-border: #444444;
    --c-white: #ffffff;

    /* Spacing */
    --space-xs: 0.5rem;
    --space-s: 1rem;
    --space-m: 1.5rem;
    --space-l: 2.5rem;
    --space-xl: 4rem;

    /* Transitions */
    --transition: 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);

    /* Shadows */
    --shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

/* Reset & Base */
*,
*::after,
*::before {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
    font-size: 16px;
}

[id] {
    scroll-margin-top: 100px;
}

body {
    background-color: var(--c-bg);
    color: var(--c-text);
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
    padding-top: 80px;
    /* Pre-compensate for sticky header */
}

@media (max-height: 500px) and (orientation: landscape) {
    body {
        padding-top: 60px;
    }

    .hero {
        height: calc(100vh - 60px) !important;
        min-height: auto !important;
    }

    .hero h1 {
        font-size: 2.2rem !important;
        margin-bottom: 0.5rem !important;
    }

    .hero p {
        font-size: 1rem !important;
        margin-bottom: 1rem !important;
    }

    .hero-btns {
        margin-top: 1rem !important;
        gap: 0.75rem !important;
    }

    .hero-btns .btn {
        padding: 0.6rem 1.2rem !important;
        font-size: 0.9rem !important;
    }
}

h1,
h2,
h3,
h4 {
    line-height: 1.2;
    margin-bottom: var(--space-s);
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: -0.02em;
}

h1 {
    font-size: clamp(2rem, 8vw, 4.5rem);
}

h2 {
    font-size: clamp(1.4rem, 5vw, 2.2rem);
    color: var(--c-primary);
}

h3 {
    font-size: 1.25rem;
}

p {
    margin-bottom: var(--space-s);
}

ul {
    list-style: none;
}

a {
    color: inherit;
    text-decoration: none;
    transition: var(--transition);
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* Layout */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 var(--space-s);
}

.text-center {
    text-align: center;
}

.section {
    padding: var(--space-xl) 0;
}

/* UI Elements */
.btn {
    display: inline-block;
    padding: 1rem 2rem;
    background: var(--c-primary);
    color: var(--c-white);
    font-weight: 700;
    text-transform: uppercase;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    text-align: center;
    position: relative;
    overflow: hidden;
    z-index: 1;
}

.btn::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg,
            transparent,
            rgba(255, 255, 255, 0.2),
            transparent);
    transition: none;
    z-index: -1;
}

.btn:hover {
    background: var(--c-primary-hover);
    transform: translateY(-4px) scale(1.02);
    box-shadow: 0 12px 24px rgba(238, 24, 26, 0.4);
}

.btn:hover::after {
    left: 100%;
    transition: all 0.7s ease;
}

.btn-outline {
    background: transparent;
    border: 2px solid var(--c-primary);
}

.btn-outline:hover {
    background: var(--c-primary);
}

.btn-small {
    padding: 0.6rem 1.2rem;
    font-size: 0.85rem;
}

.btn-call {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    background: var(--c-surface-light);
    border: 1px solid var(--c-border);
    color: var(--c-text);
    padding: 0.75rem 1rem;
    border-radius: 6px;
    font-weight: 600;
    font-size: 0.95rem;
    width: 100%;
    margin-bottom: 0.75rem;
    transition: all 0.2s ease;
}

.btn-call:hover {
    background: var(--c-primary);
    border-color: var(--c-primary);
    color: var(--c-white);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(238, 24, 26, 0.2);
}

.btn-call span {
    font-size: 1.1rem;
}

/* Header */
header {
    position: fixed;
    top: 0;
    width: 100%;
    z-index: 1000;
    background: rgba(38, 38, 38, 0.7);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    transition: var(--transition);
}

header.scrolled {
    padding: 0.5rem 0;
    box-shadow: var(--shadow);
}

.main-nav {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    justify-content: flex-start !important;
    align-items: center !important;
    height: 80px;
}

.logo {
    display: flex;
    align-items: center;
    flex-shrink: 0;
    height: 60px;
    margin-right: var(--space-l);
}

.logo img {
    height: 100%;
    width: auto;
    object-fit: contain;
}

.nav-links {
    display: flex;
    gap: var(--space-m);
    flex-shrink: 1;
    overflow: hidden;
}

@media (min-width: 1251px) and (max-width: 1400px) {
    .logo {
        height: 50px;
        margin-right: var(--space-m);
    }

    .nav-links {
        gap: var(--space-s);
    }

    .nav-links a {
        font-size: 0.85rem;
    }
}

.nav-links a {
    font-size: 0.9rem;
    font-weight: 600;
    text-transform: uppercase;
    opacity: 0.8;
}

.nav-links a:hover,
.nav-links a.active {
    opacity: 1;
    color: var(--c-primary);
}

/* Hamburger */
.hamburger {
    display: none;
    flex-direction: column;
    gap: 5px;
    cursor: pointer;
}

.hamburger span {
    width: 25px;
    height: 3px;
    background: var(--c-text);
    transition: var(--transition);
}

/* Hero */
.hero {
    height: calc(100vh - 80px);
    display: flex;
    align-items: center;
    position: relative;
    overflow: hidden;
    background: linear-gradient(rgba(38, 38, 38, 0.6), rgba(38, 38, 38, 0.9)), url('../img/hero-bg.webp') center/cover;
}

.hero-content {
    max-width: 800px;
}

.hero h1 span {
    color: var(--c-primary);
    display: block;
}

.hero p {
    font-size: 1.25rem;
    margin-bottom: var(--space-m);
    color: var(--c-text-muted);
}

.section-hero {
    min-height: 50vh;
    display: flex;
    align-items: center;
    background: linear-gradient(rgba(0, 0, 0, 0.7), rgba(0, 0, 0, 0.7)), url('../img/hero-bg.webp') center/cover;
    padding: var(--space-xl) 0;
    text-align: center;
    border-bottom: 2px solid var(--c-primary);
    background-size: cover;
    background-position: center;
}

/* Specific heroes */
.hero-kolarikorjaamo {
    background-image: linear-gradient(rgba(38, 38, 38, 0.4), rgba(38, 38, 38, 0.6)), url('../img/kolarikorjaamo-hero.webp') !important;
    background-position: center 60% !important;
}

.hero-yhteystiedot {
    background-image: linear-gradient(rgba(45, 10, 10, 0.6), rgba(20, 20, 20, 0.7)), url('../img/kolarikorjaamo_muokattu.webp') !important;
    background-position: center 30% !important;
}

.hero-taksi,
.hero-takuuhuolto,
.hero-vuokraus,
.hero-automyynti {
    background-image: linear-gradient(rgba(38, 38, 38, 0.7), rgba(38, 38, 38, 0.8)), url('../img/hero-bg.webp') !important;
}

.btn-small {
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
    display: inline-block;
}

/* Service Grid */
.service-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-m);
    margin-top: var(--space-l);
}

.service-card {
    background: rgba(51, 51, 51, 0.4);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    padding: var(--space-l);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: var(--transition);
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-s);
    height: 100%;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

.service-card:hover {
    border-color: var(--c-primary);
    transform: translateY(-8px);
    box-shadow: 0 15px 40px rgba(238, 24, 26, 0.2);
    background: rgba(51, 51, 51, 0.6);
}

.service-card h3 {
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
    text-transform: none;
    letter-spacing: normal;
}

.service-card p {
    font-size: 0.95rem;
    color: var(--c-text-muted);
    margin: 0;
    line-height: 1.5;
}

.service-card .icon {
    width: 48px;
    height: 48px;
    color: var(--c-primary);
    margin-bottom: var(--space-s);
}

@media (min-width: 993px) {
    .service-grid {
        grid-template-columns: repeat(3, 1fr);
        grid-auto-rows: 1fr;
    }

    .service-grid-home {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 992px) and (min-width: 601px) {
    .service-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 600px) {
    .hero {
        height: auto;
        min-height: 80vh;
        padding: var(--space-xl) 0;
    }

    .section-hero {
        padding: var(--space-l) 0;
        min-height: 35vh;
    }

    .service-grid {
        grid-template-columns: 1fr;
    }

    .hero-btns {
        display: flex;
        flex-direction: column;
        gap: var(--space-s);
        align-items: center;
    }

    .hero-btns .btn {
        width: 100%;
        max-width: 300px;
    }
}

/* --- Animations --- */
@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.hero h1,
.section-hero h1 {
    animation: fadeInDown 0.8s ease-out forwards;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
}

.hero p,
.section-hero p {
    opacity: 0;
    animation: fadeInUp 0.8s ease-out 0.3s forwards;
}

/* Old animations removed to favor Scroll Reveal */


/* --- Scroll Reveal Animations --- */
.js-enabled .reveal {
    opacity: 0;
    transition: transform 1s cubic-bezier(0.215, 0.61, 0.355, 1), opacity 1s linear;
    will-change: transform, opacity;
}

.reveal-up {
    transform: translateY(40px);
}

.reveal-left {
    transform: translateX(-40px);
}

.reveal-right {
    transform: translateX(40px);
}

.reveal.active {
    opacity: 1 !important;
    transform: translate(0, 0) !important;
}

/* Staggered Delays */
.reveal-delay-1 {
    transition-delay: 0.1s;
}

.reveal-delay-2 {
    transition-delay: 0.2s;
}

.reveal-delay-3 {
    transition-delay: 0.3s;
}

.reveal-delay-4 {
    transition-delay: 0.4s;
}

.reveal-delay-5 {
    transition-delay: 0.5s;
}

.reveal-delay-6 {
    transition-delay: 0.6s;
}

/* Cards (Legacy) */

/* Footer */
footer {
    background: #1a1a1a;
    padding: var(--space-xl) 0 var(--space-s);
    border-top: 1px solid var(--c-border);
}

.footer-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--space-l);
    margin-bottom: var(--space-xl);
}

.footer-col h4 {
    margin-bottom: var(--space-m);
    font-size: 1.1rem;
}

.footer-bottom {
    text-align: center;
    padding-top: var(--space-l);
    border-top: 1px solid var(--c-border);
    font-size: 0.8rem;
    color: var(--c-text-muted);
}

/* Forms */
.form-group {
    margin-bottom: var(--space-s);
}

label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
}

input,
textarea {
    width: 100%;
    padding: 0.8rem;
    background: var(--c-surface);
    border: 1px solid var(--c-border);
    color: var(--c-text);
    border-radius: 4px;
}

input:focus,
textarea:focus {
    outline: 2px solid var(--c-primary);
    border-color: transparent;
}

/* --- Cookie Banner --- */
.cookie-banner {
    position: fixed;
    bottom: -100px;
    left: 1.5rem;
    right: 1.5rem;
    background: rgba(18, 18, 18, 0.7);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 1.5rem;
    z-index: 10000;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
    opacity: 0;
    transition: all 0.5s cubic-bezier(0.16, 1, 0.3, 1);
    max-width: 900px;
    margin: 0 auto;
}

.cookie-banner.active {
    bottom: 1.5rem;
    opacity: 1;
}

.cookie-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 2rem;
}

.cookie-content {
    display: flex;
    align-items: center;
    gap: 1.25rem;
}

.cookie-icon {
    flex-shrink: 0;
    background: rgba(238, 24, 26, 0.1);
    padding: 10px;
    border-radius: 12px;
}

.cookie-text h3 {
    font-size: 1.1rem;
    margin-bottom: 0.25rem;
    color: var(--c-white);
}

.cookie-text p {
    font-size: 0.85rem;
    color: var(--c-text-muted);
    margin: 0;
    line-height: 1.4;
}

.cookie-actions {
    display: flex;
    gap: 0.75rem;
    flex-shrink: 0;
}

.cookie-actions .btn {
    white-space: nowrap;
    font-weight: 600;
    font-size: 0.85rem;
    padding: 0.6rem 1.2rem;
}

@media (max-width: 768px) {
    .cookie-banner {
        left: 0.75rem;
        right: 0.75rem;
        padding: 1.25rem;
        bottom: -300px;
        border-radius: 20px;
    }

    .cookie-banner.active {
        bottom: 1rem;
    }

    .cookie-container {
        flex-direction: column;
        align-items: flex-start;
        gap: 1.25rem;
    }

    .cookie-content {
        gap: 1rem;
        align-items: flex-start;
    }

    .cookie-icon {
        padding: 6px;
    }

    .cookie-icon svg {
        width: 24px;
        height: 24px;
    }

    .cookie-text h3 {
        font-size: 1rem;
    }

    .cookie-text p {
        font-size: 0.8rem;
    }

    .cookie-actions {
        width: 100%;
        gap: 0.5rem;
    }

    .cookie-actions .btn {
        flex: 1;
        padding: 0.75rem 0.5rem;
        font-size: 0.75rem;
        letter-spacing: 0.5px;
    }
}

/* Mobile */
/* Mobile & Tablet Navigation */
@media (max-width: 1250px) {
    .nav-links {
        display: flex;
        opacity: 0;
        visibility: hidden;
        position: absolute;
        top: 80px;
        left: 0;
        width: 100%;
        background: var(--c-bg);
        flex-direction: column;
        padding: var(--space-m);
        border-bottom: 1px solid var(--c-border);
        transform: translateY(-10px);
        transition: opacity 0.4s ease, transform 0.4s ease, visibility 0.4s;
        pointer-events: none;
        max-height: calc(100vh - 80px);
        overflow-y: auto;
    }

    @media (max-height: 500px) and (orientation: landscape) {
        .nav-links {
            top: 60px;
            max-height: calc(100vh - 60px);
        }
    }

    .nav-links.active {
        opacity: 1;
        visibility: visible;
        transform: translateY(0);
        pointer-events: auto;
    }

    .main-nav {
        justify-content: space-between !important;
        height: 80px;
    }

    @media (max-height: 500px) and (orientation: landscape) {
        .main-nav {
            height: 60px;
        }

        .logo {
            height: 40px;
        }
    }

    .hamburger {
        display: flex;
        margin-left: auto;
        position: relative;
        width: 30px;
        height: 24px;
        justify-content: center;
        align-items: center;
    }

    .hamburger span {
        position: absolute;
        width: 25px;
        height: 3px;
    }

    .hamburger span:nth-child(1) {
        top: 0;
    }

    .hamburger span:nth-child(2) {
        top: 10px;
    }

    .hamburger span:nth-child(3) {
        top: 20px;
    }

    .hamburger.active span:nth-child(1) {
        transform: translateY(10px) rotate(45deg);
    }

    .hamburger.active span:nth-child(2) {
        opacity: 0;
    }

    .hamburger.active span:nth-child(3) {
        transform: translateY(-10px) rotate(-45deg);
    }

    .logo {
        margin-right: 0;
    }

    .hero-btns {
        display: flex;
        flex-direction: column;
        gap: 1.25rem;
        align-items: center;
        margin-top: 2rem;
    }

    .hero-btns .btn {
        width: 100%;
        max-width: 300px;
        margin: 0 !important;
    }

    .hero-btns .btn:first-child {
        margin-bottom: 1.5rem !important;
    }

    .hero-btns a.btn {
        margin-bottom: 1rem !important;
    }

    .hero {
        text-align: center;
    }

    /* Long titles scaling fix */
    h1 {
        font-size: 6.5vw !important;
        word-wrap: break-word;
        overflow-wrap: break-word;
        hyphens: auto;
        line-height: 1.1;
    }

    .section-hero h1 {
        font-size: 1.8rem !important;
        margin-bottom: var(--space-s);
    }

    h2 {
        font-size: 5.5vw !important;
    }

    .section {
        padding: var(--space-m) 0;
    }

    .section-hero {
        padding: var(--space-m) 0;
    }
}

/* Extra small devices */
@media (max-width: 400px) {
    h1 {
        font-size: 7vw !important;
        letter-spacing: -0.01em;
    }

    .section-hero h1 {
        font-size: 1.5rem !important;
    }
}

/* --- Lightbox Popup --- */
.lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    z-index: 2000;
    display: none;
    justify-content: center;
    align-items: center;
    cursor: zoom-out;
    opacity: 0;
    transition: opacity 0.3s ease;
    padding: 15px;
}

.lightbox.active {
    display: flex;
    opacity: 1;
}

.lightbox-content {
    position: relative;
    max-width: 100%;
    max-height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    transform: scale(0.95);
    transition: transform 0.3s ease;
}

.lightbox.active .lightbox-content {
    transform: scale(1);
}

.lightbox img {
    max-width: 100%;
    max-height: 90vh;
    display: block;
    border: 3px solid #fff;
    border-radius: 4px;
    object-fit: contain;
}

.lightbox-close {
    position: fixed;
    top: 25px;
    right: 25px;
    color: #ffffff !important;
    font-size: 30px;
    font-weight: bold;
    cursor: pointer;
    line-height: 1;
    z-index: 2100;
    width: 44px;
    height: 44px;
    display: flex;
    justify-content: center;
    align-items: center;
    background: rgba(0, 0, 0, 0.6);
    border: 2px solid rgba(255, 255, 255, 0.8);
    border-radius: 50%;
    text-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
}

.lightbox-close:hover {
    color: var(--c-primary);
    background: rgba(0, 0, 0, 0.7);
}

@media (max-width: 768px) {
    .lightbox-close {
        top: 15px;
        right: 15px;
        background: rgba(0, 0, 0, 0.5);
        width: 44px;
        height: 44px;
        font-size: 30px;
        display: flex;
        justify-content: center;
        align-items: center;
        border-radius: 50%;
    }
}