/* Reset и базовые стили */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

/* Theme tokens: components use only these; the light theme is the default, dark redefines them */
body {
    --color-bg: #F5F5F5;
    --color-navbar: #FFFFFF;
    --color-footer: #2C3E50;
    --color-surface: #FFFFFF;
    --color-surface-inset: #FAFAFA;
    --color-panel: #F5F5F5;
    --color-body-text: #333333;
    --color-text: #555555;
    --color-heading: #2C3E50;
    --color-lead: #555555;
    /* Brand gold is 2.4-2.7:1 on light backgrounds; text uses a darker gold for AA contrast */
    --color-accent-text: #77643D;
    --color-border: rgba(0, 0, 0, 0.1);
    --color-divider: rgba(0, 0, 0, 0.1);
    --color-control-border: rgba(184, 155, 94, 0.3);
    --color-input-border: rgba(0, 0, 0, 0.1);
    --color-tint-subtle: rgba(184, 155, 94, 0.08);
    --color-tint: rgba(184, 155, 94, 0.08);
    --color-tint-hover: rgba(184, 155, 94, 0.12);
    --color-tint-active: rgba(184, 155, 94, 0.15);
    --color-toggle-track: #DDDDDD;
    --color-toggle-track-on: #333333;
    --gradient-header: linear-gradient(135deg, #FFFFFF 0%, #F5F5F5 100%);
    --gradient-cta: linear-gradient(135deg, #FFFFFF 0%, #F5F5F5 100%);
    --color-accent: #B89B5E;
    --color-accent-hover: #A9965A;
    --color-on-accent: #0B0C0D;
    /* Opaque: page text showing through ran into the caption on phones */
    --color-lightbox-bg: #F5F5F5;
    /* Section titles share one size so the phone breakpoints can shrink them in one place */
    --section-title-size: 2rem;

    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: var(--color-body-text);
    background-color: var(--color-bg);

    /* Sticky footer: short pages (404, contacts) keep it at the viewport bottom */
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
}

/* Тёмная тема */
body[data-theme="dark"] {
    --color-bg: #0B0C0D;
    --color-navbar: #0B0C0D;
    --color-footer: #0B0C0D;
    --color-surface: #16181A;
    --color-surface-inset: #0B0C0D;
    --color-panel: #0B0C0D;
    --color-body-text: #B3B3B3;
    --color-text: #B3B3B3;
    --color-heading: #FFFFFF;
    --color-lead: #FFFFFF;
    --color-accent-text: #B89B5E;
    --color-border: rgba(184, 155, 94, 0.15);
    --color-divider: rgba(184, 155, 94, 0.3);
    --color-control-border: rgba(184, 155, 94, 0.2);
    --color-input-border: #333333;
    --color-tint-subtle: rgba(184, 155, 94, 0.05);
    --color-tint: rgba(184, 155, 94, 0.1);
    --color-tint-hover: rgba(184, 155, 94, 0.15);
    --color-tint-active: rgba(184, 155, 94, 0.2);
    --color-toggle-track: #333333;
    --color-toggle-track-on: #DDDDDD;
    --gradient-header: linear-gradient(135deg, #0B0C0D 0%, #16181A 100%);
    --gradient-cta: linear-gradient(135deg, #16181A 0%, #0B0C0D 100%);
    --color-lightbox-bg: #000000;
}

/* A long word in a title must wrap rather than push the page sideways on narrow phones;
   not h3: card headings would break mid-word where they only brushed the padding */
h1,
h2 {
    overflow-wrap: break-word;
}

/* Контейнер */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Off-screen until focused, so keyboard users can jump past the navbar */
.skip-link {
    position: absolute;
    top: -100px;
    left: 1rem;
    z-index: 2000;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    background: var(--color-accent);
    color: var(--color-on-accent);
    text-decoration: none;
}

.skip-link:focus {
    top: 0.5rem;
}

/* Навбар */
.navbar {
    background-color: var(--color-navbar);
    color: var(--color-heading);
    padding: 0.75rem 0;
    position: sticky;
    top: 0;
    z-index: 100;
    border-bottom: 1px solid var(--color-border);
}

.navbar .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    gap: 2rem;
}

.nav-controls {
    display: none;
    gap: 1rem;
    align-items: center;
    height: 32px;
}

.hamburger {
    background: none;
    border: none;
    color: var(--color-heading);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0;
    margin: 0;
    z-index: 1000;
    line-height: 1;
    height: 32px;
    display: none;
    flex-shrink: 0;
    align-items: center;
    justify-content: center;
}

.nav-theme-toggle {
    display: flex;
    align-items: center;
    height: 32px;
}

.logo {
    font-size: 1.5rem;
    font-weight: bold;
    white-space: nowrap;
    flex-shrink: 0;
    /* last resort on very narrow screens: clip the name instead of overflowing the page */
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}

.navbar-contacts {
    display: flex;
    gap: 1.5rem;
    align-items: center;
    height: 32px;
}

.contact-link {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    color: var(--color-text);
    text-decoration: none;
    transition: color 0.3s ease;
    font-weight: 500;
    font-size: 0.9rem;
    padding: 0;
    margin: 0;
    height: 32px;
    line-height: 1;
}

.contact-link:hover {
    color: var(--color-accent-text);
}

.contact-icon {
    /* Below 1100px the icon is the only visible part of the link, so it needs 3:1 contrast */
    color: var(--color-accent-text);
    flex-shrink: 0;
    line-height: 1;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0;
    padding: 0;
}

.contact-text {
    white-space: nowrap;
}

.nav-menu {
    display: flex;
    list-style: none;
    gap: 2rem;
    flex-wrap: wrap;
}

.nav-menu a {
    color: var(--color-heading);
    text-decoration: none;
    transition: color 0.3s ease;
    font-weight: 500;
}

.nav-menu a:hover,
.nav-menu a.active {
    color: var(--color-accent-text);
}

/* Заголовок страницы */
.hero,
.page-header {
    background: var(--gradient-header);
    color: var(--color-heading);
    text-align: center;
}

.hero {
    padding: 4rem 0;
    margin-bottom: 3rem;
    border-bottom: 1px solid var(--color-border);
}

body[data-theme="dark"] .hero {
    border-bottom: none;
}

.hero h1 {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.hero .subtitle,
.page-header p {
    color: var(--color-lead);
}

.hero .subtitle {
    font-size: 1.3rem;
    opacity: 0.9;
}

.page-header {
    padding: 3rem 0;
    margin-bottom: 2rem;
    border-bottom: 1px solid var(--color-border);
}

.page-header h1 {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
}

/* Основная секция */
main {
    /* Grows to push the footer down; width: 100% because auto margins would otherwise shrink-wrap a flex item */
    flex: 1 0 auto;
    width: 100%;
}

/* Flex items don't collapse margins, so the last section's gap would add to the footer's */
main > :last-child {
    margin-bottom: 0;
}

/* Section cards */
.concept,
.equipment,
.services-detail-section,
.testimonials,
.not-found,
.faq {
    background: var(--color-surface);
    padding: 3rem 2rem;
    border-radius: 8px;
    border: 1px solid var(--color-border);
}

.concept,
.equipment,
.services-detail-section,
.testimonials {
    margin-bottom: 3rem;
}

.features h2,
.equipment h2,
.testimonials h2,
.map h2,
.faq h2 {
    color: var(--color-heading);
    text-align: center;
    margin-bottom: 2rem;
    font-size: var(--section-title-size);
}

/* Lists with check / arrow markers */
.concept-grid li,
.overview-column li,
.service-description-content li,
.info-item li {
    color: var(--color-text);
    padding: 0.5rem 0;
    padding-left: 1.5rem;
    position: relative;
}

.concept-grid li:before,
.overview-column li:before,
.service-description-content li:before {
    content: "✓";
    position: absolute;
    left: 0;
    color: var(--color-accent);
    font-weight: bold;
}

/* Преимущества */
.features {
    margin-bottom: 3rem;
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    margin-bottom: 3rem;
}

.feature-card {
    background: var(--color-surface);
    padding: 2rem;
    border-radius: 8px;
    border: 1px solid var(--color-border);
    transition: transform 0.3s ease, border-color 0.3s ease;
}

.feature-card:hover {
    transform: translateY(-5px);
    border-color: var(--color-accent);
}

.feature-card h3 {
    color: var(--color-heading);
    margin-bottom: 1rem;
}

.feature-card p {
    color: var(--color-text);
}

/* Концепция */
.concept h2 {
    color: var(--color-heading);
    margin-bottom: 2rem;
    font-size: var(--section-title-size);
    text-align: center;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--color-divider);
}

.concept-content p {
    color: var(--color-text);
    margin-bottom: 1.5rem;
    line-height: 1.8;
    text-align: justify;
}

.concept-content h3 {
    color: var(--color-heading);
    margin: 2rem 0 1.5rem 0;
    font-size: 1.2rem;
}

.concept-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 2rem;
    margin-bottom: 2rem;
}

.concept-grid ul {
    list-style: none;
    margin: 0;
    background: var(--color-tint-subtle);
    padding: 1.5rem;
    border-radius: 6px;
    border-left: 3px solid var(--color-accent);
}

.concept-grid li {
    padding-top: 0.6rem;
    padding-bottom: 0.6rem;
}

/* Галерея оборудования */
.equipment-gallery {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
}

/* Gallery tiles are <button>s for keyboard access; drop native button look */
.equipment-item,
.portfolio-item {
    display: block;
    width: 100%;
    font: inherit;
    color: inherit;
    text-align: inherit;
}

.equipment-item {
    cursor: pointer;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--color-border);
    transition: transform 0.3s ease, border-color 0.3s ease;
    background: var(--color-surface-inset);
}

.equipment-item:hover {
    transform: scale(1.05);
    border-color: var(--color-accent);
}

.equipment-image {
    width: 100%;
    height: 250px;
    object-fit: cover;
    display: block;
}

/* Секция услуг с описанием и переключателем */
.services-wrapper {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 2rem;
}

/* Горизонтальный layout для overview */
.overview-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4rem;
}

.overview-column h3 {
    color: var(--color-heading);
    margin-bottom: 1rem;
    font-size: 1.2rem;
}

.overview-column ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.service-description-panel,
.services-list-panel {
    border-radius: 8px;
    padding: 2rem;
    background: var(--color-panel);
    border: 1px solid var(--color-border);
}

.service-description-panel h2,
.services-list-panel h2 {
    color: var(--color-heading);
    margin-bottom: 1.5rem;
    font-size: 1.3rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--color-divider);
}

.service-description-content h3 {
    color: var(--color-heading);
    margin-bottom: 1.5rem;
    font-size: 1.3rem;
}

.service-description-content p {
    color: var(--color-text);
    margin-bottom: 1rem;
    line-height: 1.8;
    text-align: justify;
}

.service-description-content ul {
    list-style: none;
    margin-left: 0;
    margin-top: 1rem;
    margin-bottom: 1rem;
}

.service-description-content ol li:before {
    content: "";
    display: none;
}

.service-description-content strong {
    color: var(--color-heading);
}

.service-description-content .service-note {
    margin-top: 1.5rem;
}

.services-list {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.service-button {
    background-color: var(--color-surface);
    border: 2px solid var(--color-control-border);
    color: var(--color-text);
    padding: 1rem 1.5rem;
    border-radius: 6px;
    cursor: pointer;
    transition: border-color 0.3s ease, color 0.3s ease, background-color 0.3s ease, transform 0.3s ease;
    text-align: left;
    font-size: 0.95rem;
    font-weight: 500;
}

.service-button:hover {
    border-color: var(--color-accent);
    color: var(--color-heading);
    transform: translateX(5px);
}

.service-button.active {
    background-color: var(--color-accent);
    border-color: var(--color-accent);
    color: var(--color-on-accent);
    font-weight: 600;
}

/* Портфолио */
.portfolio-section {
    margin-bottom: 3rem;
}

.portfolio-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 2rem;
}

.portfolio-item {
    background: var(--color-surface);
    padding: 2rem;
    border-radius: 8px;
    border: 1px solid var(--color-border);
    transition: transform 0.3s ease, border-color 0.3s ease;
    cursor: pointer;
}

.portfolio-item:hover {
    transform: translateY(-5px);
    border-color: var(--color-accent);
}

.portfolio-image {
    width: 100%;
    height: 250px;
    object-fit: cover;
    border-radius: 8px;
    margin-bottom: 1rem;
    display: block;
}

/* Отзывы */
.testimonials-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2rem;
}

.testimonial {
    background: var(--color-surface-inset);
    padding: 1.5rem;
    border-radius: 8px;
    border-left: 4px solid var(--color-accent);
}

.testimonial p {
    color: var(--color-text);
    margin-bottom: 1rem;
    font-style: italic;
    line-height: 1.6;
}

.testimonial-author {
    color: var(--color-heading);
    font-weight: 600;
    font-size: 0.9rem;
}

/* Контакты */
.contacts-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 3rem;
    margin-bottom: 3rem;
}

/* While the form is hidden, contact info takes the full row and splits into two columns */
.contacts-content--info-only {
    grid-template-columns: 1fr;
}

.contacts-content--info-only .contact-info {
    display: grid;
    grid-template-columns: 1fr 1fr;
    column-gap: 3rem;
}

.contacts-content--info-only .contact-info h2,
.contacts-content--info-only .info-item:last-child {
    grid-column: 1 / -1;
}

@media (max-width: 768px) {
    .contacts-content,
    .contacts-content--info-only .contact-info {
        grid-template-columns: 1fr;
    }

    .concept-grid {
        grid-template-columns: 1fr;
    }
}

.contact-info,
.contact-form {
    background: var(--color-surface);
    padding: 2rem;
    border-radius: 8px;
    border: 1px solid var(--color-border);
}

.contact-info h2,
.contact-form h2 {
    color: var(--color-heading);
    margin-bottom: 1.5rem;
}

.info-item {
    margin-bottom: 2rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid var(--color-border);
}

.info-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
    margin-bottom: 0;
}

.info-item h3 {
    color: var(--color-heading);
    margin-bottom: 0.5rem;
}

.info-item p {
    color: var(--color-text);
    margin-bottom: 0.5rem;
}

.info-item a {
    color: var(--color-accent-text);
    text-decoration: none;
    font-weight: 600;
}

.info-item a:hover {
    text-decoration: underline;
}

.info-item ul {
    list-style: none;
    margin-left: 0;
}

.info-item li:before {
    content: "→";
    position: absolute;
    left: 0;
    color: var(--color-accent);
}

/* Форма */
.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--color-heading);
    font-weight: 600;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--color-input-border);
    border-radius: 4px;
    font-family: inherit;
    font-size: 1rem;
    transition: border-color 0.3s ease;
    background-color: var(--color-surface-inset);
    color: var(--color-body-text);
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--color-accent);
    box-shadow: 0 0 5px rgba(184, 155, 94, 0.2);
}

/* Кнопка */
.btn {
    display: inline-block;
    background-color: var(--color-accent);
    color: var(--color-on-accent);
    padding: 0.75rem 2rem;
    border: 2px solid transparent;
    border-radius: 4px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.3s ease, transform 0.2s ease;
    text-decoration: none;
    text-align: center;
}

.btn:hover {
    background-color: var(--color-accent-hover);
    transform: translateY(-2px);
}

.btn:active {
    transform: translateY(0);
}

.btn-outline {
    background-color: transparent;
    border-color: var(--color-accent);
    color: var(--color-heading);
}

.btn-outline:hover {
    background-color: var(--color-accent);
    color: var(--color-on-accent);
}

.form-message {
    margin-top: 1rem;
    padding: 1rem;
    border-radius: 4px;
    text-align: center;
    display: none;
}

.form-message.success {
    display: block;
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

/* Страница 404 */
.not-found {
    text-align: center;
    margin-bottom: 3rem;
}

.not-found p {
    color: var(--color-text);
    font-size: 1.1rem;
    margin-bottom: 1.5rem;
}

.not-found-links {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 1rem;
}

/* CTA секция */
.cta-section {
    background: var(--gradient-cta);
    color: var(--color-heading);
    padding: 3rem 2rem;
    border-radius: 8px;
    text-align: center;
    margin-bottom: 3rem;
    border: 1px solid var(--color-border);
}

.cta-section h2 {
    margin-bottom: 1rem;
    font-size: var(--section-title-size);
}

.cta-section p {
    margin-bottom: 1.5rem;
    font-size: 1.1rem;
}

.cta-contacts {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.cta-more {
    color: var(--color-accent-text);
    text-decoration: none;
    font-weight: 500;
}

.cta-more:hover {
    text-decoration: underline;
}

/* Карта */
.map {
    margin-bottom: 3rem;
}

.map-frame {
    display: block;
    width: 100%;
    height: 420px;
    border: 1px solid var(--color-border);
    border-radius: 8px;
}

.map-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--color-surface-inset);
}

.map-link {
    display: block;
    margin-top: 0.75rem;
    text-align: center;
    color: var(--color-accent-text);
    text-decoration: none;
    font-weight: 500;
}

.map-link:hover {
    text-decoration: underline;
}

/* FAQ */
.faq-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
}

.faq-item {
    padding: 1.5rem;
    background: var(--color-surface-inset);
    border-radius: 8px;
    border-left: 4px solid var(--color-accent);
}

.faq-item h3 {
    color: var(--color-heading);
    margin-bottom: 0.5rem;
}

.faq-item p {
    color: var(--color-text);
    line-height: 1.6;
}

/* Футер: тёмный в обеих темах, поэтому цвета текста фиксированные */
.footer {
    background-color: var(--color-footer);
    color: #C9CED6;
    padding: 3rem 0 1.5rem;
    margin-top: 3rem;
    border-top: 1px solid rgba(184, 155, 94, 0.15);
}

.footer-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2rem;
    margin-bottom: 2rem;
}

.footer p {
    margin: 0 0 0.5rem;
}

.footer-title {
    color: #FFFFFF;
    font-weight: 600;
    font-size: 1.1rem;
    margin-bottom: 0.75rem;
}

.footer a {
    color: #FFFFFF;
    text-decoration: none;
}

.footer a:hover {
    color: var(--color-accent);
    text-decoration: underline;
}

.footer-nav {
    list-style: none;
}

.footer-nav li {
    margin-bottom: 0.5rem;
}

.footer-bottom {
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding-top: 1.5rem;
    text-align: center;
    font-size: 0.9rem;
}

.footer-bottom p {
    margin: 0;
}

/* Адаптивность */
/* Таблеты среднего размера (880px - 1150px) */
@media (max-width: 1150px) and (min-width: 768px) {
    .features-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 840px) {
    .nav-menu {
        gap: 1rem;
        font-size: 0.9rem;
    }
}

@media (max-width: 768px) {
    body {
        --section-title-size: 1.6rem;
    }

    /* Justified narrow columns leave wide gaps between words */
    .concept-content p,
    .service-description-content p {
        text-align: left;
    }

    .hero h1 {
        font-size: 2rem;
    }

    .hero .subtitle {
        font-size: 1rem;
    }

    .page-header h1 {
        font-size: 1.8rem;
    }

    .features-grid,
    .portfolio-grid,
    .testimonials-grid,
    .faq-grid {
        grid-template-columns: 1fr;
    }

    .concept,
    .equipment,
    .services-detail-section,
    .testimonials,
    .not-found,
    .faq,
    .contact-info,
    .contact-form {
        padding: 1.5rem;
    }

    .service-description-panel,
    .services-list-panel {
        padding: 1.25rem;
    }

    .footer-grid {
        grid-template-columns: 1fr;
    }

    .map-frame {
        height: 300px;
    }
}

/* Кастомный dropdown для услуг на экранах < 850px */
.custom-dropdown {
    display: none;
    position: relative;
}

.dropdown-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 0.8rem 1rem;
    border: 1px solid var(--color-control-border);
    background-color: var(--color-panel);
    color: var(--color-text);
    border-radius: 6px;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: border-color 0.3s ease, color 0.3s ease, background-color 0.3s ease;
}

.dropdown-toggle:hover {
    border-color: var(--color-accent);
    color: var(--color-heading);
}

.dropdown-toggle.active {
    border-color: var(--color-accent);
    background-color: var(--color-tint);
}

.dropdown-icon {
    margin-left: 0.5rem;
    transition: transform 0.3s ease;
    color: var(--color-accent);
}

.dropdown-toggle.active .dropdown-icon {
    transform: rotate(180deg);
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    list-style: none;
    margin: 0.5rem 0 0 0;
    padding: 0;
    background-color: var(--color-panel);
    border: 1px solid var(--color-control-border);
    border-radius: 6px;
    overflow: hidden;
    z-index: 10;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    /* visibility flips instantly on open (options must be focusable right away) and waits for the fade on close */
    transition: opacity 0.3s ease, transform 0.3s ease, visibility 0s linear 0.3s;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.dropdown-menu.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    transition-delay: 0s;
}

.dropdown-menu li {
    padding: 0.8rem 1rem;
    color: var(--color-text);
    cursor: pointer;
    /* not "all": inherited visibility would animate too and block focus on open */
    transition: background-color 0.2s ease, color 0.2s ease, padding-left 0.2s ease;
    border-bottom: 1px solid var(--color-border);
}

.dropdown-menu li:last-child {
    border-bottom: none;
}

.dropdown-menu li:hover {
    background-color: var(--color-tint-hover);
    color: var(--color-heading);
    padding-left: 1.5rem;
}

.dropdown-menu li:focus-visible {
    outline: 2px solid var(--color-accent);
    outline-offset: -2px;
}

.dropdown-menu li.active {
    background-color: var(--color-tint-active);
    color: var(--color-accent-text);
    font-weight: 600;
}

@media (max-width: 1100px) {
    .contact-text {
        display: none;
    }

    .navbar-contacts {
        gap: 0.5rem;
    }
}

@media (max-width: 850px) {
    .services-wrapper {
        grid-template-columns: 1fr;
        grid-template-areas:
            "services"
            "description";
    }

    .overview-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .service-description-panel {
        grid-area: description;
    }

    .services-list-panel {
        grid-area: services;
    }

    .services-list {
        display: none;
    }

    .custom-dropdown {
        display: block;
    }
}

@media (max-width: 750px) {
    .hamburger {
        display: block;
    }

    .nav-controls {
        display: flex;
    }

    .nav-theme-toggle {
        display: none;
    }

    .navbar-contacts {
        gap: 1rem;
    }

    .nav-menu {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background-color: var(--color-navbar);
        flex-direction: column;
        gap: 0;
        width: 100%;
        border-top: 1px solid var(--color-border);
        padding: 1rem 0;
        list-style: none;
        z-index: 999;
    }

    .nav-menu.active {
        display: flex;
    }

    .nav-menu li {
        padding: 0.75rem 1.5rem;
    }

    .nav-menu a {
        display: block;
    }

    /* Мобильный переключатель - просто иконка без дорожки и ползунка */
    .nav-controls .theme-toggle-label,
    .nav-controls .theme-toggle-input:checked + .theme-toggle-label {
        width: 1.5rem;
        height: 1.5rem;
        border-radius: 0;
        background-color: transparent;
    }

    .nav-controls .theme-toggle-switch,
    .nav-controls .theme-toggle-input:checked + .theme-toggle-label .theme-toggle-switch {
        position: static;
        width: 1.5rem;
        height: 1.5rem;
        background-color: transparent;
        box-shadow: none;
        color: var(--color-heading);
    }

    .nav-controls .theme-icon {
        width: 1.5rem;
        height: 1.5rem;
    }

    .logo {
        flex: 1 1 auto;
    }

    /* Мобильная галерея оборудования */
    .equipment-gallery {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }

    .equipment-image {
        height: 180px;
    }

    /* Мобильная структура услуг */
    .services-wrapper {
        gap: 1.5rem;
    }
}

@media (max-width: 480px) {
    /* logo + contact icons + hamburger + toggle overflow 375px with 2rem gaps */
    .navbar .container {
        gap: 1rem;
    }

    body {
        --section-title-size: 1.4rem;
    }

    .logo {
        font-size: 1.2rem;
    }

    .hero h1 {
        font-size: 1.5rem;
    }

    .page-header h1 {
        font-size: 1.5rem;
    }

    /* Card and panel padding stacked up to a 200px text column at 375px */
    .concept,
    .equipment,
    .services-detail-section,
    .testimonials,
    .not-found,
    .faq,
    .contact-info,
    .contact-form,
    .cta-section {
        padding: 1.5rem 1rem;
    }

    .service-description-panel,
    .services-list-panel {
        padding: 1rem;
    }
}

/* Лайтбокс: follows the theme through tokens */
.lightbox {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: var(--color-lightbox-bg);
    flex-direction: column;
    justify-content: center;
    /* safe: when content is tall, overflow scrolls instead of being cut off at the top */
    justify-content: safe center;
    align-items: center;
    overflow-y: auto;
}

.lightbox-image {
    max-width: 90%;
    max-height: 90%;
    object-fit: contain;
    /* Light-background photos need an edge against the light overlay; invisible on the dark one */
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.18);
}

/* Лайтбокс с подписью под фото (оборудование) */
.lightbox-with-caption {
    padding: 2rem 0 4rem;
}

.lightbox-with-caption .lightbox-image {
    max-height: 55vh;
}

.lightbox-caption {
    color: var(--color-text);
    text-align: center;
    max-width: 800px;
    padding: 0 2rem;
    margin-bottom: 2rem;
}

.lightbox-caption h3 {
    color: var(--color-heading);
    margin-bottom: 1rem;
    font-size: 1.5rem;
}

.lightbox-caption p {
    line-height: 1.6;
    font-size: 0.95rem;
}

@media (max-width: 750px) {
    .lightbox-caption {
        max-width: 90%;
        font-size: 0.9rem;
    }
}

.lightbox-close,
.lightbox-arrow {
    background: none;
    border: none;
    font-family: inherit;
    line-height: 1.6;
}

/* fixed, not absolute: the lightbox scrolls, controls must stay on screen */
.lightbox-close {
    position: fixed;
    top: 20px;
    right: 35px;
    color: var(--color-accent-text);
    font-size: 40px;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.3s ease;
}

.lightbox-close:hover {
    color: var(--color-heading);
}

.lightbox-arrow {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    color: var(--color-accent-text);
    font-size: 40px;
    font-weight: bold;
    cursor: pointer;
    padding: 10px 20px;
    user-select: none;
    transition: color 0.3s ease;
}

.lightbox-arrow:hover {
    color: var(--color-heading);
}

.lightbox-prev {
    left: 20px;
}

.lightbox-next {
    right: 20px;
}

.lightbox-counter {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    color: var(--color-heading);
    font-size: 18px;
    font-weight: 500;
}

@media (max-width: 768px) {
    /* Room above and below the photo for the close button and the bottom control row */
    .lightbox,
    .lightbox-with-caption {
        padding: 3.5rem 0 4.5rem;
    }

    .lightbox-image {
        max-width: 95%;
        max-height: 100%;
    }

    /* Mid-height arrows sat on top of the caption; next to the counter they stay clear */
    .lightbox-arrow {
        top: auto;
        bottom: 0;
        transform: none;
        font-size: 30px;
        padding: 8px 15px;
    }

    .lightbox-close {
        font-size: 30px;
        top: 15px;
        right: 25px;
    }

    .lightbox-counter {
        font-size: 16px;
        bottom: 20px;
    }
}

/* Переключатель темы */
.theme-toggle-wrapper {
    display: flex;
    align-items: center;
}

/* Visually hidden but still focusable, so the theme can be switched from the keyboard */
.theme-toggle-input {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

.theme-toggle-input:focus-visible + .theme-toggle-label {
    outline: 2px solid var(--color-accent);
    outline-offset: 2px;
}

.theme-toggle-label {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 50px;
    height: 32px;
    background-color: var(--color-toggle-track);
    border-radius: 16px;
    cursor: pointer;
    position: relative;
    transition: background-color 0.3s ease;
    padding: 0;
    margin: 0;
    line-height: 1;
    flex-shrink: 0;
}

.theme-toggle-input:checked + .theme-toggle-label {
    background-color: var(--color-toggle-track-on);
}

.theme-toggle-switch {
    width: 28px;
    height: 28px;
    background-color: var(--color-accent);
    color: var(--color-on-accent);
    border-radius: 50%;
    position: absolute;
    left: 2px;
    transition: left 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0;
    padding: 0;
}

/* Sun while dark (tap for light), moon while light; SVG so it looks the same on every OS */
.theme-icon {
    position: absolute;
    width: 16px;
    height: 16px;
    transition: opacity 0.3s ease;
}

.theme-icon-moon,
.theme-toggle-input:checked + .theme-toggle-label .theme-icon-sun {
    opacity: 0;
}

.theme-toggle-input:checked + .theme-toggle-label .theme-icon-moon {
    opacity: 1;
}

.theme-toggle-input:checked + .theme-toggle-label .theme-toggle-switch {
    left: 20px;
}
