:root {
    --bg-dark: #090909;
    --color-primary: #3b00ff;
    --text-muted: #8a8a8a;
    --space-mobile: 20px;
    --space-tablet: 40px;
    --sidebar-w: 100px;
    --sidebar-w-lg: 120px;

    --theme-bg: #090909;
    --theme-sidebar-bg: #090909;
    --theme-text: #fff;
    --theme-text-muted: #8a8a8a;
    --theme-nav-inactive: #999;
    --theme-hero-bg: var(--color-primary);
    --theme-hero-text: #fff;
    --theme-switch-border: #fff;
    --theme-switch-dot: #fff;
    --theme-menu-btn-bg: #1c1c1c;
    --theme-menu-btn-bar: #fff;
    --theme-mobile-menu-bg: #1c1c1c;
    --theme-mobile-menu-text: #808080;
    --theme-sun-icon: var(--text-muted);
}

[data-theme="light"] {
    --theme-bg: #f0f0f0;
    --theme-sidebar-bg: #f0f0f0;
    --theme-text: #090909;
    --theme-text-muted: #5a5a5a;
    --theme-nav-inactive: #555;
    --theme-hero-bg: #f5e600;
    --theme-hero-text: #090909;
    --theme-switch-border: #090909;
    --theme-switch-dot: #090909;
    --theme-menu-btn-bg: #e0e0e0;
    --theme-menu-btn-bar: #090909;
    --theme-mobile-menu-bg: #e8e8e8;
    --theme-mobile-menu-text: #444;
    --theme-sun-icon: #090909;
}

html,
body {
    overflow-x: hidden;
}

body {
    background-color: var(--theme-bg);
    color: var(--theme-text);
    font-family: "Geologica", sans-serif;
    margin: 0;
    width: 100%;
    -webkit-font-smoothing: antialiased;
    transition:
        background-color 0.3s ease,
        color 0.3s ease;
}

a {
    color: inherit;
}

button {
    font-family: inherit;
}

/* ================================
   Layout Grid
   ================================ */
.layout-grid {
    display: grid;
    grid-template-columns: var(--sidebar-w) 1fr;
    grid-template-rows: 150px 400px;
    height: 550px;
}

.sidebar {
    grid-column: 1 / 2;
    grid-row: 1 / 3;
    position: relative;
    z-index: 5;
    background-color: var(--theme-sidebar-bg);
    transition: background-color 0.3s ease;
}

.brand-wrapper {
    position: absolute;
    bottom: 0;
    left: var(--sidebar-w);
    width: 400px;
    height: 100px;
    display: flex;
    justify-content: flex-start;
    align-items: center;
    transform: rotate(-90deg);
    transform-origin: bottom left;
}

.logo-img {
    display: block;
    max-width: 100%;
    max-height: 80px;
    width: auto;
    height: auto;
}

[data-theme="light"] .logo-img {
    filter: invert(1);
}

.header {
    grid-column: 2 / 3;
    grid-row: 1 / 2;
    display: flex;
    align-items: flex-start;
    padding: 40px 40px 0 0;
    z-index: 5;
}

.btn-mobile-menu {
    width: 80px;
    height: 80px;
    padding: 0;
    background-color: var(--theme-menu-btn-bg);
    border: none;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 10px;
    transition: background-color 0.3s ease;
}

.btn-mobile-menu span {
    display: block;
    width: 42px;
    height: 4px;
    background-color: var(--theme-menu-btn-bar);
    transition: background-color 0.3s ease;
}

.main-hero {
    grid-column: 2 / 3;
    grid-row: 2 / 3;
    position: relative;
    height: 400px;
    max-height: 400px;
    padding: 0 var(--space-tablet);
    background:
        url("/images/truchet.svg") repeat,
        var(--theme-hero-bg);
    background-size:
        384px 384px,
        auto;
    z-index: 1;
    transition: background-color 0.3s ease;
}

[data-theme="light"] .main-hero {
    background:
        url("/images/truchet-inverted.svg") repeat,
        var(--theme-hero-bg);
    background-size:
        384px 384px,
        auto;
}

.hero-content {
    position: relative;
    height: 100%;
    display: flex;
    flex-direction: column;
    z-index: 2;
}

@media (min-width: 992px) {
    .layout-grid {
        grid-template-columns: var(--sidebar-w-lg) 1fr;
    }
    .brand-wrapper {
        left: var(--sidebar-w-lg);
        height: var(--sidebar-w-lg);
    }
}

/* ================================
   Header Nav & Theme
   ================================ */
.desktop-nav .nav-link {
    padding: 0;
    color: var(--theme-nav-inactive);
    font-size: 1rem;
    font-weight: 400;
    text-decoration: none;
    transition: color 0.2s ease;
}

.desktop-nav .nav-link:hover {
    color: var(--theme-text);
}

.desktop-nav .nav-link.active {
    color: var(--theme-text);
    font-size: 1.8rem;
    font-weight: 300;
    letter-spacing: -0.5px;
}

.theme-toggle__icon {
    width: 22px;
    height: 22px;
    color: var(--theme-sun-icon);
    transition: color 0.3s ease;
    margin-top: 3px;
    margin-right: -8px;
}

.custom-switch {
    position: relative;
    width: 44px;
    height: 24px;
    border: 1.5px solid var(--theme-switch-border);
    border-radius: 12px;
    cursor: pointer;
    margin-top: 3px;
    transition: border-color 0.3s ease;
}

.custom-switch::after {
    content: "";
    position: absolute;
    top: 50%;
    right: 4px;
    width: 14px;
    height: 14px;
    border: 1.5px solid var(--theme-switch-dot);
    border-radius: 50%;
    transform: translateY(-50%);
    transition:
        border-color 0.3s ease,
        right 0.3s ease,
        left 0.3s ease;
}

[data-theme="light"] .custom-switch::after {
    right: auto;
    left: 4px;
}

/* ================================
   Hero Title & Buttons
   ================================ */
.hero-title {
    margin-top: -0.6em;
    font-size: clamp(2.5rem, 5.5vw, 72px);
    font-weight: 900;
    line-height: 1.2;
    letter-spacing: -1px;
    text-transform: uppercase;
    overflow-wrap: break-word;
    color: var(--theme-hero-text);
    transition: color 0.3s ease;
}

.hero-actions {
    margin-top: auto;
    margin-bottom: var(--space-tablet);
}

.hero-actions .btn {
    height: 54px;
    transition:
        transform 0.2s ease,
        color 0.2s ease,
        background 0.2s ease;
}

.btn-order {
    display: inline-flex;
    align-items: center;
    padding: 4px 8px 4px 16px;
    background-color: #fff;
    border: none;
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
}

[data-theme="light"] .btn-order {
    background-color: #090909;
}

[data-theme="light"] .btn-order__text {
    color: #f5e600;
}

[data-theme="light"] .btn-order__icon {
    background-color: #f5e600;
}

[data-theme="light"] .btn-order__icon img {
    filter: invert(1);
}

.btn-order:hover {
    background: rgba(255, 255, 255, 1);
    transform: scale(1.05);
}

[data-theme="light"] .btn-order:hover {
    background: rgba(0, 0, 0, 0.85);
}

.btn-order__text {
    padding: 0 8px 0 12px;
    color: var(--color-primary);
    font-weight: 700;
}

.btn-order__icon {
    width: 42px;
    height: 42px;
    background-color: var(--color-primary);
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-order__icon svg {
    width: 18px;
    height: 18px;
}

.btn-outline-portfolio {
    padding: 0 1.5rem;
    background: transparent;
    border: 1px solid var(--theme-hero-text);
    color: var(--theme-hero-text);
    font-weight: 500;
    align-items: center;
    transition:
        background 0.2s,
        color 0.2s,
        border-color 0.3s ease;
}

.btn-outline-portfolio:hover {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid var(--theme-hero-text);
}

[data-theme="light"] .btn-outline-portfolio:hover {
    background: rgba(0, 0, 0, 0.1);
}

/* ================================
   Hero 3D Image
   ================================ */
.hero-image {
    position: absolute;
    top: -130px;
    right: 0;
    width: 60%;
    height: calc(90% + 135px);
    object-fit: contain;
    object-position: right center;
    pointer-events: none;
    filter: brightness(2.5);
    z-index: 0;
}

[data-theme="light"] .hero-image {
    filter: brightness(2.5) contrast(1.1);
}

/* ================================
   Tablet (< 992px)
   ================================ */
@media (max-width: 991.98px) {
    .header {
        align-items: center;
        padding: 0 var(--space-tablet) 0 0;
    }
    .custom-switch {
        margin-top: 0;
    }
}

/* ================================
   Mobile (< 768px)
   ================================ */
@media (max-width: 767.98px) {
    .layout-grid {
        display: flex;
        flex-direction: column;
        height: auto;
    }

    .header {
        order: 1;
        padding: var(--space-mobile) var(--space-mobile) 0;
        align-items: center;
        height: auto;
    }

    .sidebar {
        order: 2;
        padding: 34px var(--space-mobile);
    }

    .main-hero {
        order: 3;
        height: 326px;
        max-height: 326px;
        padding: 0 var(--space-mobile);
    }

    .hero-content {
        padding-top: 30px;
    }

    .hero-title {
        margin-top: 0;
        font-size: clamp(24px, 7vw, 38px);
        line-height: 1.2;
    }

    .brand-wrapper {
        position: relative;
        left: 0;
        width: 100%;
        height: auto;
        transform: none;
    }

    .logo-img {
        max-width: 326px;
        max-height: none;
    }

    .hero-image {
        top: 20px;
        bottom: 20px;
        left: calc(100% - 130px);
        right: auto;
        width: 400px;
        height: calc(100% - 40px);
        object-position: left center;
    }
}

/* ================================
   Mobile Menu Overlay
   ================================ */
.mobile-menu-overlay {
    position: fixed;
    inset: 0;
    z-index: 1050;
    padding: var(--space-mobile);
    box-sizing: border-box;
    background-color: rgba(0, 0, 0, 0.4);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    display: flex;
    align-items: flex-start;
    justify-content: center;
}

.mobile-menu-overlay--active,
.mobile-menu-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.mobile-menu-content {
    position: relative;
    width: 100%;
    max-width: 420px;
    padding: 60px var(--space-mobile) var(--space-tablet);
    box-sizing: border-box;
    background-color: var(--theme-mobile-menu-bg);
    color: var(--theme-mobile-menu-text);
    border-radius: 2px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6);
    transition:
        background-color 0.3s ease,
        color 0.3s ease;
}

.close-menu-btn {
    position: absolute;
    top: var(--space-mobile);
    left: var(--space-mobile);
    z-index: 2;
    padding: 0;
    background: none;
    border: none;
    color: var(--theme-text);
    cursor: pointer;
    transition: color 0.3s ease;
}

.close-menu-btn svg {
    width: 40px;
    height: 40px;
}

.mobile-menu-nav {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.mobile-nav-link {
    color: var(--text-muted);
    font-size: 24px;
    font-weight: 100;
    line-height: 1.2;
    text-decoration: none;
    transition: color 0.2s;
}

.mobile-nav-link:hover,
.mobile-nav-link.active {
    color: var(--theme-text);
}

.mobile-nav-link.active {
    font-weight: 500;
}

.mobile-menu-contacts {
    text-align: center;
    word-break: break-word;
}

.mobile-menu-logo {
    margin-bottom: 16px;
}

[data-theme="light"] .mobile-menu-logo {
    filter: invert(1);
}

.mobile-menu-address {
    margin-bottom: 4px;
    font-size: 0.95rem;
    font-weight: 100;
}

.mobile-menu-phone {
    margin-bottom: 1.5rem;
    color: var(--theme-text);
    font-size: 1.25rem;
    font-weight: 700;
    transition: color 0.3s ease;
}

.mobile-menu-socials {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
}

.mobile-menu-social {
    color: var(--text-muted);
    text-decoration: none;
    transition: color 0.2s;
}

.mobile-menu-social:hover {
    color: var(--theme-text);
}
