/* ========================================================================== 
   RESPONSIVE LAYOUT OVERRIDES
   Optimized for phones, tablets, laptops and large displays.
   ========================================================================== */

html, body {
    max-width: 100%;
    overflow-x: hidden;
}

img, svg, video, canvas {
    max-width: 100%;
}

/* Large screens */
@media (min-width: 1200px) {
    .container {
        max-width: 1180px;
    }

    .about-layout,
    .contact-layout {
        gap: 72px;
    }
}

/* Tablets and smaller laptops */
@media (max-width: 992px) {
    .container {
        padding-left: 22px;
        padding-right: 22px;
    }

    .navbar {
        gap: 16px;
    }

    .logo {
        flex-shrink: 0;
    }

    .nav-menu {
        gap: 20px;
    }

    .about-layout {
        align-items: stretch;
    }

    .about-main-content {
        min-width: 0;
    }

    .about-main-content h3 {
        overflow-wrap: anywhere;
    }

    .project-card {
        min-width: 0;
    }

    .project-left,
    .project-right {
        min-width: 0;
    }
}

/* Mobile navigation and content */
@media (max-width: 768px) {
    .container {
        padding-left: 18px;
        padding-right: 18px;
    }

    .navbar {
        height: 64px;
        padding-top: 0;
        padding-bottom: 0;
    }

    .logo {
        font-size: 1.15rem;
        max-width: calc(100% - 56px);
    }

    .nav-actions {
        margin-left: auto;
    }

    .nav-menu {
        top: 64px;
        max-height: calc(100vh - 64px);
        overflow-y: auto;
        padding: 10px 18px 18px;
    }

    .nav-menu li {
        padding: 11px 0;
    }

    .hero-wrapper {
        padding: 44px 0;
    }

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

    .hero-buttons {
        flex-wrap: wrap;
    }

    .spotlight-card,
    .project-card,
    .athletic-card,
    .skills-block,
    .edu-card,
    .review-card,
    .timeline-content,
    .contact-form-container {
        max-width: 100%;
    }

    .about-sidebar {
        margin-bottom: 8px;
    }

    .profile-container {
        width: 190px;
        height: 190px;
    }

    .sidebar-name {
        font-size: 1.55rem;
    }

    .bio-paragraph {
        font-size: 0.98rem;
        text-align: left;
    }

    .interests-grid {
        gap: 12px;
    }

    .edu-card,
    .review-card,
    .timeline-content,
    .project-card,
    .athletic-card,
    .skills-block,
    .contact-form-container {
        padding: 22px;
    }

    .review-card {
        align-items: flex-start;
    }

    .review-badge-icon {
        width: 56px;
        height: 56px;
        font-size: 1.9rem;
    }

    .timeline {
        padding-left: 24px;
    }

    .timeline-dot {
        left: -24px;
    }

    .project-card-title {
        font-size: 1.35rem;
    }

    .project-right {
        width: 100%;
    }

    .contact-layout {
        gap: 32px;
    }

    .contact-form {
        gap: 16px;
    }

    .footer-nav {
        flex-wrap: wrap;
        gap: 12px 20px;
    }

    /* Keep request controls compact and vertically stacked. */
    .request-actions {
        width: min(100%, 330px);
        gap: 12px;
    }
}

/* Small phones */
@media (max-width: 480px) {
    .container {
        padding-left: 14px;
        padding-right: 14px;
    }

    .hero-wrapper {
        padding: 34px 0;
    }

    .hero-title {
        font-size: clamp(2rem, 10vw, 2.35rem);
        overflow-wrap: anywhere;
    }

    .section-title {
        font-size: 1.8rem;
    }

    .profile-container {
        width: 165px;
        height: 165px;
    }

    .sidebar-name {
        font-size: 1.4rem;
    }

    .sidebar-title {
        font-size: 0.88rem;
    }

    .social-badges {
        width: 100%;
        gap: 8px;
    }

    .social-badge-link {
        padding: 7px 10px;
        font-size: 0.78rem;
    }

    .request-actions {
        width: 100%;
        max-width: 330px;
    }

    .request-card .btn {
        min-height: 44px;
    }

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

    .review-card,
    .athletic-card {
        flex-direction: column;
    }

    .review-badge-icon,
    .athletic-icon {
        width: 52px;
        height: 52px;
    }

    .project-card,
    .timeline-content,
    .contact-form-container,
    .edu-card,
    .review-card,
    .skills-block,
    .athletic-card {
        padding: 18px;
    }

    .project-tags,
    .review-highlight-pills {
        gap: 6px;
    }

    .tag,
    .pill-sm {
        font-size: 0.72rem;
    }

    .form-input,
    .form-textarea {
        font-size: 16px; /* Prevents iOS Safari zoom on focus. */
    }

    .modal-card {
        width: calc(100% - 24px);
        max-height: calc(100vh - 24px);
        padding: 24px 18px;
        border-radius: 10px;
    }

    .modal-title {
        font-size: 1.3rem;
        padding-right: 28px;
    }

    .modal-overlay {
        padding: 12px;
    }

    .footer {
        padding: 26px 0;
    }

    .footer-credits {
        line-height: 1.5;
    }
}

/* Very narrow phones */
@media (max-width: 360px) {
    .logo {
        font-size: 1rem;
    }

    .profile-container {
        width: 145px;
        height: 145px;
    }

    .social-badges {
        flex-direction: column;
        align-items: stretch;
    }

    .social-badge-link {
        width: 100%;
    }

    .request-actions {
        max-width: 100%;
    }

    .hero-buttons .btn {
        padding-left: 18px;
        padding-right: 18px;
    }
}

/* Touch devices: avoid hover-only layout assumptions. */
@media (hover: none) and (pointer: coarse) {
    .btn:hover,
    .social-badge-link:hover,
    .project-card:hover,
    .edu-card:hover,
    .review-card:hover,
    .timeline-content:hover,
    .athletic-card:hover,
    .spotlight-card:hover {
        transform: none;
    }
}
