/*
    BASE STYLES (shared by all pages)

    [ 1. VARIABLES & RESET ]
    [ 2. NAVIGATION & GLOBAL UI (scroll progress, back to top) ]
    [ 3. BUTTONS ]
    [ 4. COMPARISON SLIDER COMPONENT (homepage sliders) ]
    [ 5. REVEAL ON SCROLL ]
    [ 6. FOOTER ]
    [ 7. SHARED RESPONSIVE ]

    Page-specific styles live in:
    - home.css          (index.html)
    - before-after.css  (before-after.html)
    - pricing.css       (pricing.html)
*/

/* 1. VARIABLES & RESET */
:root {
    --bg: #ffffff;
    --bg-alt: #fcfcfc;
    --text: #333333;
    --subtle: #888888;
    --accent: #000000;
    --glass: rgba(255, 255, 255, 0.4);
    --position: 50%;
    --ease: cubic-bezier(0.19, 1, 0.22, 1);
    --transition: all 0.4s cubic-bezier(0.19, 1, 0.22, 1);
    --hero-shadow: rgba(0, 0, 0, 0.15);
    --about-shadow: rgba(0, 0, 0, 0.1);
}

/* Dark Mode Variables */
body.dark-mode {
    --bg: #121212;
    --bg-alt: #1a1a1a;
    --text: #e0e0e0;
    --subtle: #a0a0a0;
    --accent: #ffffff;
    --glass: rgba(0, 0, 0, 0.4);
    --hero-shadow: rgba(0, 0, 0, 0.7);
    --about-shadow: rgba(0, 0, 0, 0.6);
}

/* Alternating section background pattern */
.bg-light { background: var(--bg); }
.bg-alt { background: var(--bg-alt); }

html {
    scroll-behavior: smooth;
}

/* Only enable scroll snapping on larger screens for the main page */
@media (min-width: 1024px) {
    html:not(.before-after-page) {
        scroll-snap-type: y proximity;
    }
}

/* Prevent footer from "locking" the scroll on the before-after page */
.before-after-page .footer {
    scroll-snap-align: none;
    scroll-snap-stop: normal;
}

@font-face {
    font-family: 'Montserrat';
    src: url('../fonts/Montserrat.ttf') format('truetype');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Roboto';
    src: url('../fonts/Roboto.ttf') format('truetype');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Roboto', sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    overflow-x: hidden;
    transition: background-color 0.4s var(--ease), color 0.4s var(--ease);
    -webkit-user-select: none;
    user-select: none;
}

a {
    text-decoration: none;
    color: inherit;
    transition: var(--transition);
}

/* 2. NAVIGATION & GLOBAL UI */
.navbar {
    position: fixed;
    top: 0;
    width: 100%;
    padding: 30px 5%;
    z-index: 1000;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    transition: transform 0.3s ease, opacity 0.3s ease, padding 0.4s var(--ease), background 0.4s var(--ease), box-shadow 0.4s var(--ease);
    animation: navEntrance 1.2s var(--ease) both;
    will-change: transform;
}

body.dark-mode .navbar {
    background: rgba(18, 18, 18, 0.9);
}

.navbar.is-scrolled {
    padding: 15px 5%;
    background: rgba(255, 255, 255, 0.98);
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.05);
}

body.dark-mode .navbar.is-scrolled {
    background: rgba(18, 18, 18, 0.98);
}

.navbar.is-hidden {
    transform: translateY(-100%);
    opacity: 0;
}

@keyframes navEntrance {
    from {
        opacity: 0;
        transform: translateY(-100%);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.scroll-progress {
    position: fixed;
    top: 0;
    left: 0;
    width: 0%;
    height: 4px;
    background: linear-gradient(to right, var(--subtle), var(--accent));
    transition: width 0.1s var(--ease), background 0.6s ease;
    z-index: 1100;
}

.scroll-progress.is-about {
    /* A subtle shift to a deeper, more premium slate tone */
    background: linear-gradient(to right, #4a4a4a, #1a1a1a);
}

body.dark-mode .scroll-progress.is-about {
    background: linear-gradient(to right, #888888, #ffffff);
}

.back-to-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 48px;
    height: 48px;
    background: var(--text);
    color: #fff;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    transition: all 0.4s var(--ease);
    z-index: 1050;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
}

.back-to-top.is-visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.back-to-top:hover {
    background: var(--accent);
    transform: translateY(-5px);
}

body.dark-mode .back-to-top {
    color: #000;
}

.nav-container {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
}

.logo {
    font-family: 'Montserrat', sans-serif;
    font-weight: 800;
    letter-spacing: 2px;
    font-size: 1.1rem;
    transition: letter-spacing 0.5s var(--ease);
}

.logo:hover {
    letter-spacing: 5px;
    color: var(--subtle);
}

.theme-toggle {
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    color: var(--text);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    z-index: 1001;
    margin-left: auto;
}

.sun-icon { display: none; }
.moon-icon { display: block; }

body.dark-mode .sun-icon { display: block; }
body.dark-mode .moon-icon { display: none; }

.theme-toggle:hover {
    transform: scale(1.1);
}

.menu-toggle {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
    padding: 8px;
    border: 0;
    background: transparent;
    cursor: pointer;
}

.menu-toggle span {
    display: block;
    width: 24px;
    height: 2px;
    background: var(--text);
    border-radius: 999px;
    transition: var(--transition);
    transform-origin: center;
}

/* Hamburger to X Transformation */
.menu-toggle.is-active span:nth-child(1) {
    transform: translateY(6px) rotate(45deg);
}

.menu-toggle.is-active span:nth-child(2) {
    opacity: 0;
    transform: translateX(-10px);
}

.menu-toggle.is-active span:nth-child(3) {
    transform: translateY(-6px) rotate(-45deg);
}

.nav-links {
    display: flex;
    align-items: center;
}

.nav-links a {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-left: 40px;
    font-weight: 500;
    position: relative;
    padding: 5px 0;
    opacity: 0;
    animation: fadeInUp 0.8s var(--ease) both;
}

/* Staggered entrance for links */
.nav-links a:nth-child(1) { animation-delay: 0.6s; }
.nav-links a:nth-child(2) { animation-delay: 0.7s; }
.nav-links a:nth-child(3) { animation-delay: 0.8s; }
.nav-links a:nth-child(4) { animation-delay: 0.9s; }
.nav-links a:nth-child(5) { animation-delay: 1s; }

.nav-links a:hover {
    color: var(--accent);
}

/* Modern sliding underline */
.nav-links a::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 1.5px;
    background-color: var(--accent);
    transform: scaleX(0);
    transform-origin: bottom right;
    transition: transform 0.5s var(--ease);
}

.nav-links a:hover::after {
    transform: scaleX(1);
    transform-origin: bottom left;
}

/* 3. BUTTONS */
.btn {
    display: inline-block;
    padding: 18px 35px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 2px;
    text-decoration: none;
    border: 1px solid var(--text);
    background: var(--text);
    color: #fff;
}

.btn-secondary { background: transparent; color: var(--text); }
.btn:hover { background: var(--accent); color: #fff; transform: translateY(-3px); }

/* Primary CTA — defined once, used at every main conversion point */
.btn-primary {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}

.btn-primary:hover {
    background: var(--accent);
    color: #fff;
    opacity: 0.85;
}

body.dark-mode .btn-primary {
    color: #000;
}

.cta-container {
    display: flex;
    gap: 20px;
    justify-content: center;
    opacity: 0;
    animation: fadeInUp 1.2s var(--ease) 0.8s both;
}

/* 4. COMPARISON SLIDER COMPONENT */
/* Scoped to .comparison-slider (used on the homepage service cards and
   before/after grid). The before/after page modal uses its own unscoped
   variants — see before-after.css. */
.comparison-slider {
    border-radius: 14px;
    overflow: hidden;
    background: #eee;
    /* Prevent iOS tap highlight / selection boxes on the slider */
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    user-select: none;
    -webkit-user-select: none;
}

.comparison-slider .comparison-wrapper {
    position: relative;
    width: 100%;
    aspect-ratio: 4 / 3;
    overflow: hidden;
    box-shadow: none;
    max-height: none;
}

.comparison-slider .comparison-wrapper img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    max-height: none;
}

.comparison-slider .img-before {
    z-index: 2;
    clip-path: inset(0 calc(100% - var(--position)) 0 0);
}

/* Top-aligned crop for vertical portrait photos (head & shoulders framing) */
.comparison-slider .crop-top img {
    object-position: center top;
}

.comparison-slider .slider-line {
    position: absolute;
    inset: 0 auto 0 var(--position);
    width: 1px;
    background: rgba(255, 255, 255, 0.6);
    transform: translateX(-50%);
    z-index: 9;
    pointer-events: none;
}

.comparison-slider .slider-line::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 48px;
    height: 48px;
    background: rgba(255, 255, 255, 0.4);
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.4);
}

.comparison-slider .slider-line::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 12px;
    height: 12px;
    background: #ff3b30;
    border-radius: 50%;
    z-index: 1;
}

/* Global red center dot for every comparison slider handle, on all pages
   (homepage service previews, before/after grid, and the before-after page
   modal which uses unscoped .slider-line). Scoped above for homepage sliders;
   this unscoped rule covers everything else, desktop and mobile alike. */
.slider-line::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 8px;
    height: 8px;
    background: #ff3b30;
    border-radius: 50%;
    z-index: 1;
    pointer-events: none;
}

.comparison-slider .slider-input {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    -webkit-appearance: none;
    appearance: none;
    background: transparent;
    z-index: 10;
    cursor: col-resize;
    margin: 0;
    -webkit-tap-highlight-color: transparent;
    outline: none;
    box-shadow: none;
}

.comparison-slider .slider-input:focus,
.comparison-slider .slider-input:focus-visible {
    outline: none;
    box-shadow: none;
}

.comparison-slider .slider-input::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 48px;
    height: 48px;
    background: transparent;
    border: none;
    cursor: col-resize;
    -webkit-tap-highlight-color: transparent;
    outline: none;
    box-shadow: none;
}

.comparison-slider .slider-input::-moz-range-thumb {
    width: 48px;
    height: 48px;
    background: transparent;
    border: none;
    cursor: col-resize;
}

.comparison-slider .label {
    position: absolute;
    top: 20px;
    color: white;
    font-size: 0.6rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    z-index: 8;
    background: rgba(0, 0, 0, 0.2);
    padding: 4px 8px;
    pointer-events: none;
}

.comparison-slider .label-before {
    left: 20px;
}

.comparison-slider .label-after {
    right: 20px;
}

/* Mobile-only overrides for homepage sliders (labels sizing only —
   the red center dot on the handle now renders at all widths). */
@media (max-width: 768px) {
    .comparison-slider .label {
        font-size: 0.75rem;
        padding: 6px 12px;
    }

    /* The red center dot now renders on mobile too (see global
       .slider-line::before rule above) for consistent handles. */
}

/* 5. REVEAL ON SCROLL */
.reveal-on-scroll {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 1.2s var(--ease), transform 1.2s var(--ease);
    will-change: transform, opacity;
}

.reveal-on-scroll.is-revealed {
    opacity: 1;
    transform: translateY(0);
}

/* Shared entrance animation (nav links, filter buttons, hero text, etc.) */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 6. FOOTER */
.footer {
    padding: 60px 5%;
    text-align: center;
    font-size: 0.7rem;
    color: var(--subtle);
}

/* 7. SHARED RESPONSIVE */

/* --- TABLET CORE (1024px and below) --- */
@media (max-width: 1024px) {
    .btn { padding: 16px 30px; font-size: 0.75rem; text-align: center; white-space: nowrap; }
}

/* --- MOBILE CORE (768px and below) --- */
@media (max-width: 768px) {
    .menu-toggle { display: inline-flex; }

    .nav-container { flex-wrap: wrap; }

    .nav-links {
        display: none;
        width: 100%;
        margin-top: 12px;
        flex-direction: column;
        align-items: flex-end;
        gap: 12px;
        text-align: right;
    }

    .nav-links.is-open {
        display: flex;
    }

    .theme-toggle {
        margin-left: auto;
        margin-right: 10px;
    }

    .nav-links a {
        margin-left: 0;
        padding: 10px 0; /* ~44px tap target with line-height */
        animation-duration: 0.4s;
    }

    /* Faster staggered entrance for mobile */
    .nav-links a:nth-child(1) { animation-delay: 0.05s; }
    .nav-links a:nth-child(2) { animation-delay: 0.1s; }
    .nav-links a:nth-child(3) { animation-delay: 0.15s; }
    .nav-links a:nth-child(4) { animation-delay: 0.2s; }
    .nav-links a:nth-child(5) { animation-delay: 0.25s; }

    .btn { padding: 14px 22px; font-size: 0.65rem; }

    .theme-toggle { padding: 12px; } /* 44x44 tap target */

    .back-to-top {
        bottom: 20px;
        right: 20px;
        width: 44px;
        height: 44px;
    }
}