/* ===== MOBILE RESPONSIVE ENHANCEMENTS ===== */
/* Add to assets/css/mobile-responsive.css */

/* ===== EXTRA SMALL DEVICES (320px - 374px) ===== */
@media (max-width: 374px) {
  :root {
    --header-h: 52px;
  }

  /* Lock header on extra small screens and offset content */
  .site-header {
    position: fixed;
    top: 0; left: 0; right: 0;
    z-index: 10;
    /* Stabilize fixed header on mobile */
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
    will-change: transform;
    backface-visibility: hidden;
  }
  .site-main { padding-top: var(--header-h); }

  .container {
    padding: 0 10px;
  }

  .brand-avatar {
    width: 24px;
    height: 24px;
  }

  .brand-name {
    font-size: 14px;
  }

  .hero {
    padding: 48px 0;
  }

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

  .hero-sub {
    font-size: 14px;
    margin-bottom: 12px;
  }

  .hero-bio {
    font-size: 13px;
    line-height: 1.5;
  }

  .hero-avatar img {
    width: clamp(160px, 50vw, 220px);
    height: clamp(160px, 50vw, 220px);
  }

  .section {
    padding: 40px 0;
  }

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

  .section-title::after {
    width: 56px;
    bottom: -6px;
  }

  .section-desc {
    font-size: 13px;
    margin: -4px auto 14px;
  }

  .form {
    padding: 16px;
    margin-top: 18px;
  }

  .form-row {
    margin-bottom: 10px;
  }

  .form-row label {
    font-size: 13px;
  }

  .form-row input,
  .form-row textarea {
    padding: 8px 10px;
    font-size: 14px;
  }

  .btn {
    padding: 8px 14px;
    font-size: 13px;
  }

  /* Contact form submit button — smaller on extra small screens */
  #contact .form-actions .btn.primary {
    padding: 7px 12px;
    font-size: 12px;
    gap: 6px;
    border-radius: 32px;
  }
  #contact .form-actions .btn.primary i {
    font-size: 0.95em;
  }

  .skill-button {
    padding: 8px 14px;
    font-size: 12px;
    gap: 6px;
  }

  .skill-button i {
    font-size: 14px;
  }

  .info-card {
    padding: 14px 14px 12px;
    border-radius: 14px;
  }

  .info-card-title {
    font-size: 20px;
  }

  .info-item {
    gap: 12px;
  }

  .info-date {
    font-size: 12px;
  }

  .contact a {
    padding: 8px 12px;
    font-size: 12px;
  }

  .footer-brand {
    font-size: 18px;
  }

  .footer-nav {
    gap: 12px;
  }

  .footer-nav a {
    padding: 4px 8px;
    font-size: 12px;
  }

  #projects-grid {
    padding: 30px 0;
    padding-inline: 12px;
    gap: 14px;
  }

  .card {
    flex: 0 0 240px;
    min-height: 380px; /* wow: a bit taller */
    padding: 14px;
    border-radius: 16px;
  }
  /* Mobile XS: enforce 16:9 media */
  .card-media {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    border-radius: 12px;
    margin-bottom: 10px;
  }
  .card-media img {
    height: 100%;
    width: 100%;
    object-fit: cover;
    margin-bottom: 0;
  }

  .card-title {
    font-size: 1.2rem;
  }

  .card-desc {
    font-size: 0.8rem;
  }

  .tag {
    font-size: 10px;
    padding: 3px 6px;
  }

  .action-btn {
    padding: 4px 8px;
  }

  .action-btn .btn-label {
    font-size: 9px;
  }

  .hero-actions {
    margin-top: 14px;
  }

  .hero-actions .btn {
    max-width: 280px;
  }
}

/* ===== SMALL DEVICES (375px - 599px) ===== */
@media (max-width: 599px) {
  :root {
    --header-h: 56px;
    --scroll-thumb: transparent;
    --scroll-thumb-hover: transparent;
    --scroll-track: transparent;
  }

  /* Lock header on mobile and offset content */
  .site-header {
    position: fixed;
    top: 0; left: 0; right: 0;
    z-index: 10;
    /* Stabilize fixed header on mobile */
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
    will-change: transform;
    backface-visibility: hidden;
  }
  .site-main { padding-top: var(--header-h); }

  .container {
    padding: 0 12px;
  }

  .brand-avatar {
    width: 26px;
    height: 26px;
  }

  .brand-name {
    font-size: 16px;
  }

  .hero {
    padding: 56px 0;
  }

  .hero-title {
    font-size: 32px;
    margin-bottom: 6px;
  }

  .hero-sub {
    font-size: 15px;
    margin-bottom: 14px;
    min-height: 1.5em;
  }

  .hero-bio {
    font-size: 14px;
    line-height: 1.6;
  }

  .hero-avatar img {
    width: clamp(180px, 45vw, 260px);
    height: clamp(180px, 45vw, 260px);
  }

  .hero-content {
    gap: 10px;
  }

  .hero-content.role-on {
    gap: 14px;
  }

  .hero-content.role-off {
    gap: 6px;
  }

  .section {
    padding: 48px 0;
  }

  .section-title {
    font-size: 22px;
    margin-bottom: 18px;
  }

  .section-title::after {
    width: 64px;
    bottom: -7px;
  }

  .section-desc {
    font-size: 14px;
    margin: -5px auto 16px;
    line-height: 1.5;
  }

  .form {
    padding: 18px;
    max-width: 100%;
    margin-top: 20px;
  }

  .form-row {
    margin-bottom: 12px;
  }

  .form-row label {
    font-size: 13px;
  }

  .form-row input,
  .form-row textarea {
    padding: 9px 11px;
    font-size: 15px;
  }

  .btn {
    padding: 9px 15px;
    font-size: 14px;
  }

  /* Contact form submit button — slightly smaller on small screens */
  #contact .form-actions .btn.primary {
    padding: 8px 13px;
    font-size: 13px;
    gap: 6px;
    border-radius: 32px;
  }
  #contact .form-actions .btn.primary i {
    font-size: 1em;
  }

  .hero-actions .btn {
    max-width: 300px;
  }

  .skill-button {
    padding: 9px 16px;
    font-size: 13px;
  }

  .skill-button i {
    font-size: 15px;
  }

  .about-text {
    max-width: 100%;
    font-size: 14px;
  }

  .about-skills {
    font-size: 14px;
    margin: 6px;
  }

  .skills-buttons {
    gap: 10px;
  }

  .info-card {
    padding: 16px 16px 14px;
    border-radius: 16px;
    max-width: 100%;
  }

  .info-card-title {
    font-size: 22px;
  }

  .info-card-header {
    gap: 10px;
    margin-bottom: 10px;
  }

  .info-icon {
    width: 32px;
    height: 32px;
  }

  .info-icon svg,
  .info-icon i {
    width: 16px;
    height: 16px;
    font-size: 16px;
  }

  .info-item {
    grid-template-columns: 1fr auto;
    gap: 14px;
  }

  .timeline-item {
    grid-template-columns: 16px 1fr auto;
    gap: 12px;
  }

  .timeline-marker {
    width: 16px;
  }

  .timeline-marker::before {
    width: 8px;
    height: 8px;
  }

  .timeline-marker::after {
    top: 12px;
    bottom: -16px;
  }

  .contact {
    gap: 10px;
  }

  .contact a {
    padding: 9px 13px;
    font-size: 13px;
    gap: 7px;
  }

  .contact i {
    font-size: 16px;
  }

  .footer-nav {
    gap: 14px;
  }

  .footer-nav a {
    padding: 5px 10px;
    font-size: 13px;
  }

  .footer-social {
    gap: 14px;
  }

  .social-btn {
    width: 40px;
    height: 40px;
  }

  .social-btn i {
    font-size: 16px;
  }

  .scroll-home {
    right: 12px;
    bottom: 12px;
  }

  /* Projects Grid */
  #projects-grid {
    gap: 16px;
    padding: 40px 0;
    padding-inline: 18px;
  }

  .card {
    flex: 0 0 260px;
    min-height: 420px; /* wow: a bit taller */
    padding: 16px;
    border-radius: 20px;
  }
  /* Mobile S: enforce 16:9 media */
  .card-media {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    border-radius: 14px;
    margin-bottom: 14px;
  }
  .card-media img {
    height: 100%;
    width: 100%;
    object-fit: cover;
    margin-bottom: 0;
  }

  .card-title {
    font-size: 1.3rem;
    margin-bottom: 5px;
  }

  .card-desc {
    font-size: 0.85rem;
    margin-bottom: 8px;
  }

  .tag {
    font-size: 11px;
    padding: 4px 8px;
  }

  .card-actions {
    gap: 10px;
    margin-top: 8px;
  }

  .action-btn {
    padding: 5px 9px;
  }

  .action-btn .btn-label {
    font-size: 10px;
  }

  .action-btn .btn-icon i {
    font-size: 11px;
  }
}

/* ===== TABLET & UP (600px+) REFINEMENTS ===== */
@media (min-width: 600px) and (max-width: 768px) {
  .container {
    padding: 0 24px;
  }

  .brand-avatar {
    width: 28px;
    height: 28px;
  }

  .brand-name {
    font-size: 17px;
  }

  .section {
    padding: 52px 0;
  }

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

  .section-desc {
    font-size: 15px;
  }

  #projects-grid {
    gap: 20px;
    padding: 60px 0;
    padding-inline: 32px;
  }

  .card {
    flex: 0 0 300px;
    min-height: 420px;
  }

  .card-media img {
    height: 180px;
  }

  .info-card-title {
    font-size: 24px;
  }

  .form {
    max-width: 100%;
    padding: 20px;
  }
}

/* ===== LANDSCAPE MODE (any height under 500px) ===== */
@media (max-height: 500px) and (orientation: landscape) {
  .hero {
    min-height: auto;
    padding: 40px 0;
  }

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

  .hero-bio {
    display: none;
  }

  .hero-actions {
    margin-top: 12px;
    gap: 8px;
  }

  .hero-avatar img {
    width: clamp(120px, 20vh, 180px);
    height: clamp(120px, 20vh, 180px);
  }

  .section {
    padding: 32px 0;
  }

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

  .section-desc {
    margin-bottom: 12px;
  }
}

/* ===== TOUCH DEVICE ENHANCEMENTS ===== */
@media (hover: none) and (pointer: coarse) {
  .btn,
  .btn:hover {
    transform: none;
  }

  .card:hover {
    transform: rotateY(0deg) scale(1.05);
  }

  .skill-button:hover {
    transform: none;
  }

  .social-btn:hover {
    transform: none;
  }

  /* Increase touch target sizes */
  .btn {
    padding: 10px 16px;
    min-height: 44px;
    min-width: 44px;
  }

  .social-btn {
    width: 48px;
    height: 48px;
  }

  .action-btn {
    padding: 6px 10px;
  }

  .skill-button {
    padding: 10px 18px;
  }

  .contact a {
    padding: 10px 14px;
  }

  /* Disable transitions for snappier feel */
  * {
    -webkit-tap-highlight-color: transparent;
  }
}

/* ===== ACCESSIBILITY IMPROVEMENTS ===== */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  html {
    scroll-behavior: auto;
  }
}

/* ===== HIGH DPI DEVICES ===== */
@media (-webkit-min-device-pixel-ratio: 2),
       (min-resolution: 192dpi) {
  .brand-avatar {
    border-width: 1px;
  }

  .skill-gauge {
    box-shadow: inset 0 0 0 5px rgba(0, 0, 0, 0.55),
                0 4px 12px rgba(0, 0, 0, 0.35);
  }

  .card {
    border-width: 1px;
  }
}

/* ===== DARK MODE SUPPORT ===== */
@media (prefers-color-scheme: dark) {
  .form-row input::placeholder,
  .form-row textarea::placeholder {
    color: #6a7a8a;
  }
}

/* ===== SAFE AREA SUPPORT (Notch/Island devices) ===== */
@supports (padding: max(0px)) {
  .container {
    padding-left: max(18px, env(safe-area-inset-left));
    padding-right: max(18px, env(safe-area-inset-right));
  }

  .site-header {
    padding-top: env(safe-area-inset-top);
  }

  .site-footer {
    padding-bottom: max(28px, env(safe-area-inset-bottom));
  }

  .scroll-home {
    right: max(12px, env(safe-area-inset-right));
    bottom: max(12px, env(safe-area-inset-bottom));
  }
}

/* ===== FIX SKILLS VISUAL FOR MOBILE ===== */
@media (max-width: 374px) {
  .skills-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .skills-media {
    justify-content: center;
  }

  .skills-lottie {
    margin: 0 auto;
  }

  .skills-lottie {
    margin: 12px auto 18px;
  }

  .skills-lottie dotlottie-player {
    max-width: 240px;
  }

  .skills-visual {
    height: 120px;
    margin-bottom: 16px;
    padding: 0 6px;
    display: flex;
    align-items: center;
    overflow: hidden;
    flex-wrap: nowrap;
    gap: 10px;
  }
  
  .skills-right{
    margin-left:0;
  }
  .skills-left, .skills-right {
    flex: 1 1 0;
    max-width: 45%;
    flex-wrap: nowrap;
    overflow: hidden;
    min-width: 0;
  }
  .skills-track {
    flex-wrap: nowrap;
    display: flex;
    width: max-content;
  }
  .skills-left .skill, .skills-right .skill {
    min-width: 50px;
    width: 50px;
    height: 50px;
    font-size: 22px;
    
  }
  
  .skill-center i, .skills-left .skill i, .skills-right .skill i {
    font-size: 20px !important;
  }
  .skills-left .skills-track, .skills-right .skills-track {
    gap: 10px;
  }
  .skills-buttons {
    gap: 6px;
  }
  .about-skills {
    font-size: 12px;
    margin: 4px;
  }

  .skills-scanner {
    position: relative;
    flex: 0 0 6px;
    height: 80px;
    
}
}

@media (max-width: 599px) and (min-width: 375px) {
  .skills-grid {
    grid-template-columns: 1fr;
    gap: 18px;
  }
.skills-right{
    margin-left: 0px;
  }
  .skills-media {
    justify-content: center;
  }

  .skills-visual {
    height: 130px;
    margin-bottom: 20px;
    padding: 0 8px;
    overflow: hidden;
    flex-wrap: nowrap;
    gap: 10px;
  }
  .skills-left, .skills-right {
    flex: 1 1 0;
    max-width: 45%;
    flex-wrap: nowrap;
    overflow: hidden;
    min-width: 0;
  }
  .skills-track {
    flex-wrap: nowrap;
    display: flex;
    width: max-content;
  }
  .skills-left .skill, .skills-right .skill {
    min-width: 58px;
    width: 58px;
    height: 58px;
    font-size: 24px;
    
  }
  .skill-center i, .skills-left .skill i, .skills-right .skill i {
    font-size: 26px !important;
  }
  .skills-left .skills-track, .skills-right .skills-track {
    gap: 14px;
  }
  .skills-buttons {
    gap: 8px;
  }
  .about-skills {
    font-size: 13px;
    margin: 5px;
  }
}

/* Hide skills-visual section on mobile if empty */
@media (max-width: 599px) {
  .skills-visual:empty {
    display: none !important;
    height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
  }
}