/* ============================================
   RESPONSIVE STYLES
   ============================================ */

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

    section {
        padding: 60px 0;
    }

    .hero {
        padding: 120px 0 40px;
        min-height: auto;
    }

    .hero-container {
        grid-template-columns: 1fr;
        gap: 40px;
    }

    .hero-content {
        max-width: 100%;
        text-align: center;
        margin: 0 auto;
    }

    .hero-title {
        margin-left: auto;
        margin-right: auto;
    }

    .hero-description {
        margin-left: auto;
        margin-right: auto;
    }

    .hero-buttons {
        justify-content: center;
    }

    .hero-socials {
        justify-content: center;
    }

    .hero-visual {
        max-width: 360px;
        margin: 0 auto;
        min-height: 360px;
    }

    .hero-info-card {
        display: none;
    }

    .hero-stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }

    .stat-card {
        border-right: none;
        border-bottom: 1px solid var(--border-color);
        padding-bottom: 12px;
    }

    .stat-card:nth-last-child(-n+2) {
        border-bottom: none;
        padding-bottom: 0;
    }

    .about-grid {
        grid-template-columns: 1fr;
        gap: 40px;
    }

    .feature-cards {
        grid-template-columns: repeat(3, 1fr);
    }

    .skills-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .projects-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .gallery-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .videos-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .video-showreel {
        grid-template-columns: 1fr;
        gap: 24px;
    }

    .cv-section-content {
        grid-template-columns: 1fr;
        gap: 32px;
    }

    .cv-preview {
        max-width: 400px;
        margin: 0 auto;
    }

    .contact-grid {
        grid-template-columns: 1fr;
        gap: 32px;
    }

    .footer-grid {
        grid-template-columns: 1.5fr 1fr 1fr;
        gap: 32px;
    }

    .footer-brand {
        grid-column: span 3;
    }
}

/* Mobile (≤ 768px) */
@media (max-width: 768px) {
    :root {
        --header-height: 64px;
    }

    .nav-menu {
        position: fixed;
        top: var(--header-height);
        left: 0;
        right: 0;
        background: var(--bg-card);
        border-bottom: 1px solid var(--border-color);
        flex-direction: column;
        align-items: stretch;
        padding: 16px 20px;
        gap: 4px;
        transform: translateY(-100%);
        opacity: 0;
        pointer-events: none;
        transition: var(--transition);
        max-height: calc(100vh - var(--header-height));
        overflow-y: auto;
    }

    .nav-menu.active {
        transform: translateY(0);
        opacity: 1;
        pointer-events: auto;
        box-shadow: var(--shadow-lg);
    }

    .nav-link {
        padding: 12px 14px;
        font-size: 0.95rem;
        border-radius: var(--radius-md);
    }

    .nav-link.active {
        background: var(--bg-elevated);
    }

    .nav-link.active::after {
        display: none;
    }

    .nav-cta {
        margin: 8px 0 0;
    }

    .nav-toggle {
        display: flex;
    }

    .hero {
        padding: 100px 0 30px;
    }

    .hero-name {
        font-size: clamp(2.25rem, 10vw, 3.5rem);
    }

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

    .hero-title {
        font-size: 0.85rem;
    }

    .hero-buttons {
        flex-direction: column;
        width: 100%;
    }

    .hero-buttons .btn {
        width: 100%;
    }

    .hero-visual {
        max-width: 280px;
        min-height: 320px;
    }

    .hero-stats {
        margin-top: 40px;
    }

    .hero-stats-grid {
        grid-template-columns: 1fr;
        gap: 0;
    }

    .stat-card {
        border-bottom: 1px solid var(--border-color);
        padding: 14px;
    }

    .stat-card:last-child {
        border-bottom: none;
    }

    .feature-cards {
        grid-template-columns: 1fr;
    }

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

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

    .projects-filter {
        overflow-x: auto;
        flex-wrap: nowrap;
        padding-bottom: 8px;
        margin-bottom: 24px;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: thin;
    }

    .filter-btn {
        flex-shrink: 0;
    }

    .gallery-grid {
        grid-template-columns: repeat(2, 1fr);
        grid-auto-rows: 160px;
    }

    .gallery-item.wide {
        grid-column: span 2;
    }

    .gallery-item.tall {
        grid-row: span 1;
    }

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

    .video-showreel {
        padding: 24px;
    }

    .showreel-stats {
        gap: 16px;
    }

    .showreel-stat .value {
        font-size: 1.25rem;
    }

    .modal-body {
        padding: 24px;
    }

    .modal-title {
        font-size: 1.35rem;
    }

    .modal-features ul {
        grid-template-columns: 1fr;
    }

    .modal-actions {
        flex-direction: column;
    }

    .modal-actions .btn {
        width: 100%;
    }

    .contact-form-wrapper {
        padding: 24px;
    }

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

    .footer-brand {
        grid-column: span 1;
    }

    .footer-bottom {
        flex-direction: column;
        text-align: center;
    }

    .whatsapp-float {
        bottom: 16px;
        right: 16px;
        width: 52px;
        height: 52px;
    }

    .section-header {
        margin-bottom: 2rem;
    }

    .creative-lab-header {
        flex-direction: column;
        align-items: flex-start;
    }
}

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

    .nav-container {
        padding: 0 16px;
    }

    .hero-stats {
        padding: 0 16px;
    }

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

    .hero-greeting {
        font-size: 1.25rem;
    }

    .gallery-grid {
        grid-template-columns: 1fr;
        grid-auto-rows: 200px;
    }

    .gallery-item.wide {
        grid-column: span 1;
    }

    .stat-card {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
        text-align: left;
    }

    .stat-icon {
        width: 36px;
        height: 36px;
    }

    .stat-value {
        font-size: 0.95rem;
    }

    .stat-label {
        font-size: 0.7rem;
    }

    .education-card {
        flex-direction: column;
        text-align: center;
        align-items: center;
    }

    .education-content .meta {
        justify-content: center;
    }
}

/* Large screens (≥ 1440px) */
@media (min-width: 1440px) {
    :root {
        --container-width: 1320px;
    }

    section {
        padding: 100px 0;
    }
}

/* Reduce motion preference */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* Focus visible for accessibility */
:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
textarea:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* ============================================
   STAGE 1 EXTREME RESPONSIVENESS PASS
   ============================================ */

@media (min-width: 1600px) {
    :root {
        --container-width: 1480px;
    }

    .hero-container,
    .hero-stats,
    .nav-container {
        max-width: var(--container-width);
    }

    .projects-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (min-width: 1920px) {
    :root {
        --container-width: 1560px;
    }

    body {
        font-size: 16px;
    }

    .hero-name {
        font-size: clamp(4rem, 5vw, 5.8rem);
    }
}

@media (max-width: 1180px) {
    .nav-menu {
        gap: 0;
    }

    .nav-link {
        padding-inline: 10px;
        font-size: 0.8rem;
    }

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

    .creative-studio-visual {
        width: min(100%, 500px);
    }
}

@media (max-width: 980px) {
    .hero-container {
        grid-template-columns: 1fr;
        gap: clamp(28px, 6vw, 48px);
    }

    .creative-studio-visual {
        margin: 0 auto;
        width: min(92vw, 540px);
    }

    .hero-content {
        text-align: center;
    }

    .hero-title,
    .hero-description {
        margin-left: auto;
        margin-right: auto;
    }

    .hero-buttons,
    .hero-socials {
        justify-content: center;
    }

    .skills-grid,
    .feature-cards {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 1024px) {
    .nav-menu {
        position: fixed;
        top: var(--header-height);
        left: 12px;
        right: 12px;
        background: color-mix(in srgb, var(--bg-card) 96%, transparent);
        border: 1px solid var(--border-color);
        border-radius: 0 0 20px 20px;
        flex-direction: column;
        align-items: stretch;
        padding: 14px;
        gap: 2px;
        transform: translateY(-14px) scale(0.98);
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.24s ease, transform 0.24s ease;
        max-height: calc(100vh - var(--header-height) - 20px);
        overflow-y: auto;
        z-index: 999;
        box-shadow: var(--shadow-lg);
    }

    .nav-menu.active {
        transform: translateY(0) scale(1);
        opacity: 1;
        pointer-events: auto;
    }

    .nav-link {
        display: block;
        width: 100%;
        padding: 12px 14px;
        font-size: 0.95rem;
    }

    .nav-link.active {
        background: var(--bg-elevated);
    }

    .nav-link.active::after {
        display: none;
    }

    .nav-toggle {
        display: flex;
    }

    .nav-login-link {
        display: none;
    }

    .nav-login-mobile {
        display: block;
        margin-top: 6px;
        border-top: 1px solid var(--border-color);
        padding-top: 6px;
    }
}

@media (max-width: 720px) {
    .navbar .nav-container {
        width:100%;
        min-width:0;
        padding-left:14px;
        padding-right:14px;
        gap:8px;
    }
    .navbar .nav-logo {
        min-width:0;
        max-width:calc(100vw - 78px);
    }
    .navbar .nav-logo span {
        overflow:hidden;
        text-overflow:ellipsis;
        white-space:nowrap;
    }
    .navbar .nav-actions {
        margin-left:auto;
        flex:0 0 auto;
    }

    .container,
    .nav-container,
    .hero-container,
    .hero-stats {
        padding-left: clamp(14px, 4vw, 22px);
        padding-right: clamp(14px, 4vw, 22px);
    }

    section {
        padding: clamp(52px, 13vw, 74px) 0;
    }

    .hero {
        padding-top: calc(var(--header-height) + 36px);
    }

    .hero-name {
        font-size: clamp(2.08rem, 12vw, 3.7rem);
        line-height: 0.95;
    }

    .hero-title {
        justify-content: center;
        border-radius: 18px;
        line-height: 1.5;
    }

    .hero-buttons {
        display: grid;
        grid-template-columns: 1fr;
        width: 100%;
    }

    .hero-buttons .btn {
        width: 100%;
        min-height: 48px;
    }

    .creative-studio-visual {
        width: min(100%, 420px);
        aspect-ratio: 0.88 / 1;
    }

    .browser-panel {
        inset: 7% 2% 25% 2%;
        transform: none;
    }

    .browser-canvas {
        grid-template-columns: 1fr;
        padding: 22px;
    }

    .canvas-visual {
        min-height: 120px;
    }

    .design-panel {
        top: auto;
        bottom: 8%;
        right: 2%;
        width: 46%;
    }

    .code-panel {
        bottom: 9%;
        left: 2%;
        width: 50%;
    }

    .timeline-panel {
        display: none;
    }

    .profile-replace-card {
        width: 122px;
        height: 122px;
        padding: 20px;
    }

    .hero-stats-grid,
    .skills-grid,
    .feature-cards,
    .projects-grid,
    .videos-grid,
    .contact-grid,
    .cv-section-content {
        grid-template-columns: 1fr;
    }

    .projects-filter {
        overflow-x: auto;
        flex-wrap: nowrap;
        padding-bottom: 10px;
        scroll-snap-type: x proximity;
    }

    .filter-btn {
        flex: 0 0 auto;
        scroll-snap-align: start;
    }

    .gallery-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        grid-auto-rows: minmax(160px, 35vw);
    }

    .gallery-item.wide,
    .gallery-item.tall {
        grid-column: span 1;
        grid-row: span 1;
    }

    .video-showreel {
        padding: clamp(20px, 6vw, 30px);
    }

    .showreel-stats {
        flex-wrap: wrap;
    }

    .modal {
        padding: 12px;
        align-items: flex-start;
    }

    .modal-content {
        max-height: calc(100vh - 24px);
    }

    .modal-body {
        padding: 22px;
    }

    .lightbox {
        padding: 14px;
    }

    .lightbox-info {
        position: static;
        margin-top: 14px;
    }
}

@media (max-width: 520px) {
    :root {
        --header-height: 62px;
    }

    .nav-logo {
        font-size: 0.82rem;
    }

    .theme-toggle {
        padding: 5px;
    }

    .theme-toggle-track {
        width: 40px;
        height: 22px;
    }

    html[data-theme="light"] .theme-toggle-thumb {
        transform: translateX(18px);
    }

    .hero-greeting {
        font-size: 1.35rem;
    }

    .hero-description {
        font-size: 0.9rem;
    }

    .creative-studio-visual {
        width: min(100%, 360px);
    }

    .design-panel,
    .code-panel {
        padding: 12px;
    }

    .poster-preview {
        min-height: 68px;
        font-size: 0.72rem;
    }

    .swatch-row span {
        width: 24px;
        height: 24px;
    }

    .gallery-grid {
        grid-template-columns: 1fr;
        grid-auto-rows: 260px;
    }

    .contact-detail {
        align-items: flex-start;
    }

    .contact-detail-info .value {
        word-break: break-word;
    }

    .cv-actions,
    .contact-actions,
    .modal-actions {
        flex-direction: column;
    }

    .cv-actions .btn,
    .contact-actions .btn,
    .modal-actions .btn {
        width: 100%;
    }
}

@media (max-width: 430px) {
    .hero-name {
        font-size: clamp(1.95rem, 12.5vw, 3rem);
    }

    .hero-title {
        font-size: 0.78rem;
        padding: 8px 12px;
    }

    .hero-socials {
        gap: 6px;
    }

    .hero-socials a {
        width: 36px;
        height: 36px;
    }

    .stat-card {
        flex-direction: row;
    }

    .creative-studio-visual {
        width: min(100%, 330px);
        aspect-ratio: 0.82 / 1;
    }

    .canvas-copy strong {
        font-size: 1.25rem;
    }

    .profile-replace-card {
        width: 110px;
        height: 110px;
    }
}

@media (max-width: 375px) {
    .container,
    .nav-container,
    .hero-container,
    .hero-stats {
        padding-left: 14px;
        padding-right: 14px;
    }

    .hero-name {
        font-size: clamp(1.78rem, 12vw, 2.55rem);
    }

    .hero-title {
        font-size: 0.74rem;
    }

    .btn {
        padding: 11px 16px;
        font-size: 0.84rem;
    }

    .section-title {
        font-size: clamp(1.45rem, 9vw, 2rem);
    }

    .contact-form-wrapper,
    .skill-category,
    .feature-card,
    .project-content {
        padding: 18px;
    }
}

@media (max-width: 340px) {
    .nav-logo {
        font-size: 0.76rem;
    }

    .theme-toggle {
        transform: scale(0.92);
        transform-origin: right center;
    }

    .nav-actions {
        gap: 4px;
    }

    .hero-name {
        font-size: 1.68rem;
    }

    .creative-studio-visual {
        width: 292px;
    }

    .code-panel code {
        font-size: 0.62rem;
    }
}


@media (max-width: 1024px) {
    .services-grid, .pricing-grid { grid-template-columns:repeat(2,1fr); }
    .pricing-card:last-child { grid-column:1 / -1; max-width:calc(50% - 8px); width:100%; justify-self:center; }
    .why-grid { grid-template-columns:1fr; gap:36px; }
}

@media (max-width: 768px) {
    .service-heading, .custom-quote { align-items:flex-start; flex-direction:column; }
    .service-heading-cta { width:100%; justify-content:center; }
    .services-grid, .pricing-grid { grid-template-columns:1fr; }
    .pricing-card:last-child { grid-column:auto; max-width:none; }
    .service-card > p { min-height:0; }
    .custom-quote .btn { width:100%; justify-content:center; }
    .why-item { grid-template-columns:42px 1fr; }
    .why-icon { width:42px; height:42px; }
}

@media (max-width: 900px) {
  .marketing-grid { grid-template-columns:1fr 1fr; }
  .marketing-card:last-child { grid-column:1 / -1; }
  .journey-section .container { flex-direction:column; align-items:flex-start; }
}
@media (max-width: 640px) {
  .marketing-section { padding:72px 0; }
  .marketing-grid { grid-template-columns:1fr; gap:14px; margin-top:28px; }
  .marketing-card:last-child { grid-column:auto; }
  .marketing-card { min-height:0; padding:22px; }
  .social-cta { flex-direction:column; text-align:center; }
  .journey-section { padding:64px 0; }
  .journey-section .btn { width:100%; justify-content:center; }
}
