/* ============================================
   COBEX - Mobile Responsive Design
   ============================================ */

/* Tablets (768px and below) */
@media (max-width: 768px) {
    :root {
        font-size: 16px;
    }

    h1 { font-size: 2.5rem; }
    h2 { font-size: 1.8rem; }
    h3 { font-size: 1.3rem; }

    .container {
        padding: 0 15px;
    }

    /* Top Bar */
    .top-bar {
        padding: 10px 0;
    }

    .top-bar-content {
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }

    .contact-info {
        flex-direction: column;
        gap: 10px;
    }

    .divider {
        display: none;
    }

    /* Navigation */
    .nav-wrapper {
        gap: 10px;
    }

    .mobile-menu-toggle {
        display: flex;
    }

    .desktop-menu {
        display: none;
    }

    .mobile-menu {
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background-color: var(--bg-white);
        flex-direction: column;
        padding: 20px;
        gap: 10px;
        border-bottom: 1px solid var(--border-color);
        box-shadow: var(--shadow-md);
    }

    .mobile-menu.active {
        display: flex;
    }

    .nav-link::after {
        display: none;
    }

    .cta-button {
        display: none;
    }

    /* Hero Section */
    .hero {
        padding: 60px 0;
        min-height: auto;
    }

    .hero-content {
        grid-template-columns: 1fr;
        gap: 30px;
    }

    .hero-text h1 {
        font-size: 2.2rem;
    }

    .hero-subtitle {
        font-size: 1rem;
    }

    .hero-buttons {
        flex-direction: column;
    }

    .hero-buttons .btn {
        width: 100%;
    }

    /* Solutions Grid */
    .solutions {
        padding: 60px 0;
    }

    .solutions-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .solution-card {
        padding: 25px 20px;
    }

    /* Services Grid */
    .services {
        padding: 60px 0;
    }

    .features-grid {
        grid-template-columns: 1fr;
        gap: 25px;
    }

    /* CTA Banner */
    .cta-banner {
        padding: 50px 0;
    }

    .banner-content h2 {
        font-size: 1.8rem;
    }

    .banner-content p {
        font-size: 1rem;
    }

    /* About Section */
    .about {
        padding: 60px 0;
    }

    .about-wrapper {
        grid-template-columns: 1fr;
        gap: 30px;
    }

    /* Contact Section */
    .contact {
        padding: 60px 0;
    }

    .contact-wrapper {
        grid-template-columns: 1fr;
        gap: 30px;
    }

    .contact-form {
        padding: 25px 15px;
    }

    /* Footer */
    .footer-content {
        grid-template-columns: 1fr;
        gap: 30px;
    }
}

/* Mobile (480px and below) */
@media (max-width: 480px) {
    h1 { font-size: 1.8rem; }
    h2 { font-size: 1.4rem; }
    h3 { font-size: 1.1rem; }

    .container {
        padding: 0 12px;
    }

    /* Top Bar */
    .top-bar-content {
        flex-direction: column;
        gap: 8px;
    }

    .contact-info {
        flex-direction: column;
        font-size: 0.85rem;
        gap: 8px;
    }

    .social-links {
        gap: 10px;
    }

    .social-links a {
        width: 28px;
        height: 28px;
        font-size: 0.8rem;
    }

    /* Navigation Header */
    .navbar {
        padding: 15px 0;
    }

    .nav-wrapper {
        gap: 5px;
    }

    .logo img {
        height: 40px;
    }

    .mobile-menu-toggle span {
        width: 20px;
        height: 2.5px;
    }

    /* Mobile Menu Styling */
    .mobile-menu {
        padding: 15px;
    }

    .mobile-menu.active {
        padding: 15px;
    }

    .nav-link {
        display: block;
        padding: 10px 0;
        font-size: 0.95rem;
    }

    /* Hero Section */
    .hero {
        padding: 40px 0;
    }

    .hero-text h1 {
        font-size: 1.6rem;
        line-height: 1.3;
    }

    .hero-subtitle {
        font-size: 0.95rem;
        line-height: 1.6;
    }

    .hero-buttons {
        flex-direction: column;
    }

    .hero-buttons .btn {
        padding: 10px 20px;
        font-size: 0.9rem;
    }

    /* Section Headers */
    .section-header {
        margin-bottom: 40px;
    }

    .section-title {
        font-size: 1.4rem;
    }

    .section-subtitle {
        font-size: 0.95rem;
    }

    /* Solutions */
    .solutions {
        padding: 40px 0;
    }

    .solution-card {
        padding: 20px 15px;
    }

    .card-icon {
        width: 60px;
        height: 60px;
        font-size: 1.5rem;
    }

    .solution-card h3 {
        font-size: 1.1rem;
    }

    .solution-card p {
        font-size: 0.9rem;
    }

    /* Services */
    .services {
        padding: 40px 0;
    }

    .features-grid {
        gap: 20px;
    }

    .feature-item {
        padding: 25px 15px;
    }

    .feature-number {
        font-size: 2rem;
    }

    .feature-item h3 {
        font-size: 1.1rem;
    }

    .feature-item p {
        font-size: 0.9rem;
    }

    /* CTA Banner */
    .cta-banner {
        padding: 40px 0;
    }

    .banner-content h2 {
        font-size: 1.4rem;
        margin-bottom: 10px;
    }

    .banner-content p {
        font-size: 0.95rem;
        margin-bottom: 20px;
    }

    /* About */
    .about {
        padding: 40px 0;
    }

    .stat h3 {
        font-size: 1.8rem;
    }

    .stat p {
        font-size: 0.85rem;
    }

    /* Contact */
    .contact {
        padding: 40px 0;
    }

    .contact-wrapper {
        gap: 25px;
    }

    .contact-info-box {
        gap: 20px;
    }

    .info-item {
        gap: 15px;
        padding: 15px;
    }

    .info-item i {
        width: 45px;
        height: 45px;
        font-size: 1.2rem;
    }

    .contact-form {
        padding: 20px 12px;
        gap: 15px;
    }

    .form-group input,
    .form-group textarea {
        padding: 12px;
        font-size: 0.95rem;
    }

    .btn {
        padding: 10px 20px;
        font-size: 0.9rem;
    }

    /* Footer */
    .footer {
        padding: 40px 0 15px;
    }

    .footer-content {
        gap: 25px;
        margin-bottom: 25px;
    }

    .footer-section h4 {
        font-size: 1rem;
        margin-bottom: 15px;
    }

    .footer-section p {
        font-size: 0.9rem;
    }

    .footer-section ul li {
        margin-bottom: 8px;
    }

    .footer-section a {
        font-size: 0.9rem;
    }

    .footer-social {
        gap: 10px;
    }

    .footer-social a {
        width: 36px;
        height: 36px;
        font-size: 0.9rem;
    }

    .footer-bottom p {
        font-size: 0.85rem;
    }

    /* Scrollbar */
    ::-webkit-scrollbar {
        width: 6px;
    }
}

/* Extra Small Devices (under 320px) */
@media (max-width: 320px) {
    h1 { font-size: 1.5rem; }
    h2 { font-size: 1.2rem; }
    h3 { font-size: 1rem; }

    .container {
        padding: 0 10px;
    }

    .hero-text h1 {
        font-size: 1.4rem;
    }

    .solution-card {
        padding: 15px 10px;
    }

    .feature-item {
        padding: 20px 10px;
    }

    .contact-form {
        padding: 15px 10px;
    }
}

/* High Resolution Displays */
@media (min-width: 1440px) {
    .container {
        max-width: 1320px;
    }

    h1 { font-size: 4rem; }
    h2 { font-size: 3rem; }

    .hero-text h1 {
        font-size: 4rem;
    }

    .solutions-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .features-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Landscape Mode Adjustments */
@media (max-height: 600px) and (orientation: landscape) {
    .hero {
        min-height: 400px;
        padding: 40px 0;
    }

    .hero-text h1 {
        font-size: 2rem;
    }

    .hero-subtitle {
        font-size: 0.9rem;
    }

    .navbar {
        padding: 10px 0;
    }

    .top-bar {
        display: none;
    }
}

/* Print Styles */
@media print {
    .top-bar,
    .navbar,
    .footer,
    .cta-button,
    .mobile-menu-toggle {
        display: none;
    }

    .hero,
    .solutions,
    .services,
    .about {
        page-break-inside: avoid;
    }
}

/* NOTE: A `prefers-color-scheme: dark` block used to live here. It flipped the
   global colour variables (--text-dark became near-white, --bg-white near-black)
   but only recoloured five components, so every other element kept its hardcoded
   light background while inheriting light text — the hero heading, hero subtitle
   and stat labels became unreadable on phones with dark mode enabled.
   The site is designed light-only, so the page now declares `color-scheme: light`
   in the <head> instead. Reintroduce dark mode only as a complete theme. */

/* ==========================================================================
   About page — the desktop grids (.story-grid, .story-visual, .metrics-grid,
   .profile-grid) previously had NO mobile overrides at all, so they kept their
   2- and 4-column desktop layouts on phones: copy crushed into half the width,
   photos rendered as narrow vertical slivers, names clipped mid-word and the
   fourth team card pushed off-screen. These rules collapse them properly.
   ========================================================================== */
@media (max-width: 768px) {
    .about-story { padding: 48px 0 24px; }

    /* Copy above, photos below — one column. */
    .story-grid {
        grid-template-columns: 1fr;
        gap: 32px;
    }
    .story-copy h2 {
        font-size: clamp(1.55rem, 6vw, 2.1rem);
        line-height: 1.25;
    }
    .story-copy p { line-height: 1.7; }
    .check-list { margin-top: 22px; }
    .story-actions { gap: 12px; margin-top: 24px; }
    .story-actions .btn { flex: 1 1 auto; text-align: center; }

    /* Photos sit side by side as a pair; aspect-ratio replaces the fixed
       520px min-height that was stretching them into slivers. */
    .story-visual {
        grid-template-columns: 1fr 1fr;
        gap: 14px;
        min-height: 0;
    }
    .visual-card { border-radius: 14px; box-shadow: 0 12px 24px -14px rgba(17, 24, 39, .35); }
    .visual-card.main,
    .visual-card.small {
        height: auto;
        align-self: stretch;
        aspect-ratio: 4 / 3;
    }

    /* Metrics: fit what the width allows instead of forcing four across. */
    .metrics-grid {
        grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
        gap: 14px;
    }
    .metric-item { padding: 18px 12px; border-radius: 14px; }
    .metric-item strong { font-size: 1.9rem; }
    .metric-item span { font-size: .85rem; line-height: 1.4; }

    /* Team cards: full width on phones, two-up on larger tablets. */
    .team-section { padding: 56px 0; }
    .profile-grid {
        grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
        gap: 20px;
    }
    .profile-image img {
        height: auto;
        aspect-ratio: 4 / 3;
        object-position: center 22%;   /* keep faces in frame on headshots */
    }
    .profile-content { padding: 18px 18px 16px; }
    .profile-content h3 { font-size: 1.2rem; }
    .profile-role { font-size: .82rem; }
}

/* Four metrics auto-fit to an ugly 3 + 1 around 480px; lock them to a
   balanced 2 x 2 until there is room for all four across. */
@media (max-width: 620px) {
    .metrics-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 480px) {
    .about-story { padding: 36px 0 20px; }
    .story-grid { gap: 26px; }
    .story-visual { gap: 10px; }
    .metrics-grid { gap: 10px; }
    .metric-item { padding: 15px 8px; }
    .metric-item strong { font-size: 1.6rem; }
    .metric-item span { font-size: .78rem; }
    .team-section { padding: 44px 0; }
    .profile-grid { grid-template-columns: 1fr; gap: 16px; }
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
    * {
        animation: none !important;
        transition: none !important;
    }
}

/* Touch Device Optimizations */
@media (hover: none) and (pointer: coarse) {
    .btn {
        padding: 14px 36px;
        min-height: 48px;
    }

    .nav-link {
        padding: 10px 5px;
    }

    .form-group input,
    .form-group textarea {
        min-height: 48px;
    }

    .card-link:hover {
        gap: 8px;
    }

    .solution-card:hover {
        transform: translateY(-5px);
    }
}
