/* Large desktop / small laptop — header compression */
@media (max-width: 1200px) {
    .header-grid { grid-template-columns: 15% 85%; }
    .header-right { gap: 15px; }
    .nav { margin: 0 15px; }
    .nav a { font-size: 12px; }
    .logo-sub { font-size: 12px; max-width: 180px; }
    .contact-phones div { letter-spacing: 0.15em; font-size: 15px; }
}

/* Tablet */
@media (max-width: 1024px) {
    .container {
        padding: 0 30px;
    }

    .hero-title {
        font-size: 38px;
    }

    .section-title {
        font-size: 40px;
    }

    .hero-page {
        padding-top: 150px;
        height: auto !important;
        min-height: auto !important;
        overflow: visible !important;
    }

    .hero-grid {
        height: auto !important;
    }

    .hero-content {
        flex-direction: column;
        gap: 30px;
        padding-left: 0;
        padding-top: 20px;
        height: auto;
        justify-content: flex-start;
    }

    .hero-text {
        max-width: 100% !important;
    }

    .hero-stats {
        max-width: 100% !important;
        margin-right: 0 !important;
        margin-top: 20px !important;
    }

    .hero-text,
    .hero-stats {
        max-width: 100%;
        text-align: left;
    }

    .features-strip {
        position: relative !important;
        bottom: auto !important;
        flex-direction: column;
        gap: 0;
        padding: 30px 0;
        margin-top: 60px;
        background: rgba(8, 12, 21, 0.9);
    }

    .feature-box {
        border-right: none;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
        padding: 30px 20px !important;
        max-width: 100%;
    }

    .feature-box:last-child {
        border-bottom: none;
        padding-bottom: 0;
    }

    .about-content {
        flex-direction: column;
        gap: 40px;
        align-items: flex-start;
    }

    .about-text {
        max-width: 100%;
    }

    .about-stats {
        flex-direction: row;
        justify-content: space-around;
        width: 100%;
        margin-right: 0;
        align-items: center;
    }

    .services-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 30px;
    }

    .contacts-content {
        flex-direction: column;
        gap: 40px;
    }

    .contacts-info {
        max-width: 100%;
    }

    .contacts-content-centered {
        gap: 40px;
    }

    .contacts-map-large {
        min-height: 400px;
    }

    .contacts-map-large iframe {
        min-height: 400px;
    }

    .hero-page,
    .about-page,
    .services-page,
    .contacts-page,
    .page {
        background-attachment: scroll !important;
        min-height: auto !important;
    }

    /* Grid: switch to single column, hide empty side columns */
    .hero-grid,
    .split-grid {
        grid-template-columns: 1fr;
    }

    .hero-side-col,
    .side-col {
        display: none;
    }

    .hero-page::before {
        transform: none;
    }
}

/* Burger menu activates — fullscreen nav with contacts */
@media (max-width: 960px) {
    /* Header */
    .header-grid { grid-template-columns: auto 1fr; }
    .logo-sub { display: none; }
    .header-contacts { display: none; }
    .header-right { justify-content: flex-end; gap: 10px; }

    /* Burger touch target >= 44px */
    .burger-menu {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 44px;
        height: 44px;
        font-size: 22px;
    }

    /* Fullscreen nav */
    .nav {
        position: fixed;
        top: 0;
        left: -100%;
        width: 100%;
        height: 100vh;
        background: rgba(8, 12, 21, 0.98);
        backdrop-filter: blur(10px);
        padding: 100px 30px 40px;
        z-index: 99;
        margin: 0;
        overflow-y: auto;
        transition: left 0.3s ease;
    }
    .nav.active { left: 0; }
    .nav ul { flex-direction: column; gap: 0; }
    .nav a {
        font-size: 16px;
        display: block;
        padding: 16px 0;
        border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    }

    /* Contacts inside mobile nav */
    .nav-mobile-contacts {
        display: block;
        margin-top: 30px;
        padding-top: 20px;
        border-top: 1px solid rgba(255, 255, 255, 0.15);
    }
    .nav-mobile-contacts a {
        display: block;
        color: #fff;
        font-size: 18px;
        padding: 12px 0;
        border-bottom: none;
    }
    .nav-mobile-socials {
        display: flex;
        gap: 20px;
        margin-top: 20px;
    }
    .nav-mobile-socials a {
        width: 40px;
        height: 40px;
        border-radius: 50%;
        border: 1px solid rgba(255, 255, 255, 0.2);
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 18px;
        padding: 0;
    }

    /* Overlay */
    .menu-overlay {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.5);
        z-index: 98;
    }
    .menu-overlay.active { display: block; }

    /* On mobile: stats before publications */
    .hero-text {
        display: contents;
    }
    .hero-stats {
        order: 1;
    }
    .hero-publications {
        order: 2;
    }

    /* Hide desktop-only fixed elements, show mobile FAB */
    .page-indicators { display: none; }
    .call-btn-fixed { display: none; }
    .mobile-call-fab {
        display: flex;
        position: fixed;
        top: 20%;
        right: 20px;
        width: 56px;
        height: 56px;
        background: var(--accent);
        color: #000;
        border-radius: 50%;
        align-items: center;
        justify-content: center;
        font-size: 22px;
        z-index: 97;
        box-shadow: 0 4px 15px rgba(212, 175, 104, 0.4);
        text-decoration: none;
    }
}

/* Mobile */
@media (max-width: 768px) {
    .container {
        padding: 0 20px;
    }

    .header {
        padding: 10px 0;
        background: linear-gradient(to bottom, rgba(8, 12, 21, 0.95), rgba(8, 12, 21, 0.85)) !important;
        backdrop-filter: blur(10px);
    }

    .logo-text h1 {
        font-size: 16px;
    }

    .page {
        padding: 20px 0 60px;
    }

    .hero-title {
        font-size: 38px;
        line-height: 1.1;
    }

    .hero-page {
        padding-top: 100px;
        padding-bottom: 20px;
    }

    /* Grid: switch to single column, hide empty side columns */
    .hero-grid,
    .split-grid {
        grid-template-columns: 1fr;
    }

    .hero-side-col,
    .side-col {
        display: none;
    }

    .hero-grid {
        height: auto !important;
        min-height: auto !important;
    }

    .hero-page::before {
        transform: none;
        height: 120vh;
        background-size: cover;
        background-position: center center;
    }

    .hero-content {
        flex-direction: column !important;
        gap: 25px;
        padding-top: 10px;
    }

    .hero-text {
        max-width: 100% !important;
    }

    .hero-stats {
        max-width: 100% !important;
        margin-right: 0 !important;
        margin-top: 10px !important;
        min-width: auto !important;
    }

    .hero-description {
        font-size: 14px;
        max-width: 100%;
        margin-top: 10px;
    }

    .section-title {
        font-size: 32px;
        margin-bottom: 20px;
    }

    .stat-number {
        font-size: 48px;
    }

    .services-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .service-item {
        padding: 30px 20px;
    }

    .scroll-indicator {
        bottom: 20px;
        right: 20px;
        font-size: 20px;
    }

    .features-strip {
        position: relative !important;
        bottom: auto !important;
        margin-top: 40px;
        padding: 25px 15px;
        flex-direction: column;
        gap: 0;
        background: rgba(8, 12, 21, 0.95);
        border-radius: 8px;
    }

    .feature-box {
        padding: 25px 15px !important;
        max-width: 100%;
    }

    .feature-title {
        font-size: 16px;
        margin-bottom: 10px;
    }

    .feature-desc {
        font-size: 13px;
        line-height: 1.5;
    }

    /* About section */
    .about-content {
        gap: 30px;
    }

    .about-stats {
        flex-direction: column;
        gap: 30px;
    }

    /* Contacts: stack vertically */
    .contacts-layout {
        flex-direction: column;
        gap: 30px;
    }

    .contacts-map-small {
        height: 300px;
    }

    .contacts-map-large {
        min-height: 300px;
    }

    .contacts-map-large iframe {
        min-height: 300px;
    }

    /* Reviews: single column */
    .reviews-grid {
        grid-template-columns: 1fr;
    }

    .review-card {
        padding: 24px 20px;
    }

    /* Socials font size */
    .socials-centered a {
        font-size: 22px;
    }

    .contacts-footer-text {
        font-size: 13px;
    }

    /* Touch targets */
    .btn,
    .btn-hero-cta,
    .btn-primary {
        min-height: 44px;
    }

    /* Publications page */
    .publications-page-container {
        padding-top: 100px;
        padding-bottom: 60px;
    }

    .pub-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .pub-card {
        padding: 24px 20px;
    }

    /* Article pages */
    .article-container { padding-top: 100px; }
    .article-card { padding: 30px 20px; }
    .article-card h1 { font-size: 24px; }
    .comments-section { margin-top: 40px; }
    .comment-form input,
    .comment-form textarea { padding: 12px; font-size: 14px; }
    .comment-btn { min-height: 44px; width: 100%; }
    .comment-author { flex-direction: column; gap: 4px; }
}

/* Small Mobile */
@media (max-width: 480px) {
    .container {
        padding: 0 15px;
    }

    .hero-title {
        font-size: 28px;
        letter-spacing: 0.02em;
    }

    .hero-page {
        padding-top: 90px;
        min-height: auto;
    }

    .hero-page::before {
        background-size: cover;
        background-position: center center;
    }

    .hero-content {
        flex-direction: column !important;
        gap: 20px;
        padding-top: 5px;
    }

    .hero-text {
        max-width: 100% !important;
    }

    .hero-stats {
        max-width: 100% !important;
        margin-right: 0 !important;
        margin-top: 5px !important;
        min-width: auto !important;
    }

    .section-title {
        font-size: 24px;
    }

    .hero-description {
        font-size: 13px;
        max-width: 100%;
        margin-top: 8px;
    }

    .stat-number-inline {
        font-size: 24px;
        width: 80px;
    }

    .stat-item {
        font-size: 16px;
    }

    .stat-number {
        font-size: 36px;
    }

    .feature-title {
        font-size: 14px;
    }

    .feature-desc {
        font-size: 12px;
    }

    .service-icon {
        font-size: 36px;
    }

    .service-title {
        font-size: 16px;
    }

    .service-desc {
        font-size: 13px;
    }

    .socials-centered a {
        font-size: 20px;
    }

    .contacts-footer-text {
        font-size: 12px;
    }

    /* Modal responsive */
    .modal-content {
        padding: 40px 30px;
        max-width: 90%;
    }

    .modal-title {
        font-size: 22px;
        margin-bottom: 30px;
    }

    .modal-form input {
        padding: 15px 20px;
        font-size: 14px;
    }

    .modal-form .btn {
        font-size: 16px;
        padding: 15px 30px;
        min-height: 52px;
    }

    /* CTA button full width on very small screens */
    .btn-hero-cta {
        width: 100%;
        white-space: normal;
        font-size: 14px;
        min-width: unset;
    }

    .btn-outline { min-width: unset; width: 100%; }
    .pub-link { max-width: 100%; }
    .pub-grid { grid-template-columns: 1fr; }
    .case-number { word-break: break-all; }

    /* Article pages */
    .article-card { padding: 20px 15px; }
    .article-card h1 { font-size: 20px; }

    /* Publications page */
    .publications-page-container {
        padding-top: 90px;
    }

    .pub-card {
        padding: 20px 16px;
    }

    .pub-card-title {
        font-size: 17px;
    }
}

/* Extra small — iPhone SE (375px) and narrower */
@media (max-width: 375px) {
    .container {
        padding: 0 16px;
    }

    .hero-title {
        font-size: 24px;
        letter-spacing: 0.01em;
        word-break: keep-all;
        overflow-wrap: normal;
    }

    .hero-description {
        font-size: 12px;
    }

    .section-title {
        font-size: 22px;
        letter-spacing: 1px;
    }

    .stat-number-inline {
        font-size: 20px;
        width: auto;
        min-width: 50px;
    }

    .stat-label-inline {
        font-size: 14px;
    }

    .about-text p {
        font-size: 16px;
        line-height: 1.6;
    }

    .service-title {
        font-size: 14px;
    }

    .feature-title {
        font-size: 13px;
    }

    .feature-desc {
        font-size: 11px;
    }

    .contacts-map-small {
        height: 280px;
    }

    /* Ensure contact info doesn't overflow */
    .contact-text-block p {
        font-size: 14px;
        flex-wrap: wrap;
        gap: 8px;
    }
}
