/* ============================================================
   AFFAN SHAIKH — MOBILE RESPONSIVE SYSTEM v1.0
   Covers: Phone (≤480px), Small Phone (≤375px),
           Tablet (481–768px), Tablet-L (769–1024px)
   ============================================================ */

/* ===== DISABLE CUSTOM CURSOR ON TOUCH DEVICES ===== */
@media (hover: none) and (pointer: coarse) {
  body { cursor: auto; }
  #cursor-dot,
  #cursor-ring,
  #cursor-cross-h,
  #cursor-cross-v { display: none !important; }
}

/* ===== HAMBURGER BUTTON ANIMATED X STATE ===== */
.nav-burger {
  cursor: pointer;
  display: none;
  flex-direction: column;
  gap: 6px;
  background: none;
  border: none;
  padding: 10px;
  z-index: 9999;
}
.nav-burger span {
  display: block;
  width: 26px;
  height: 2px;
  background: #00f0ff;
  border-radius: 1px;
  transition: transform 0.3s ease, opacity 0.3s ease;
  transform-origin: center;
}
.nav-burger.is-open span:nth-child(1) { transform: translateY(8px) rotate(45deg); }
.nav-burger.is-open span:nth-child(2) { opacity: 0; transform: scaleX(0); }
.nav-burger.is-open span:nth-child(3) { transform: translateY(-8px) rotate(-45deg); }

/* Mobile menu backdrop overlay */
.nav-links.open::before {
  content: '';
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: -1;
  backdrop-filter: blur(2px);
}

/* Smooth slide-in animation for nav menu */
@media (max-width: 1024px) {
  .nav-links {
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s ease;
    transform: translateX(100%);
    opacity: 0;
    display: flex !important; /* always rendered for animation */
    pointer-events: none;
  }
  .nav-links.open,
  .nav-links.mobile-active {
    transform: translateX(0);
    opacity: 1;
    pointer-events: auto;
  }
}

/* ============================================================
   TABLET LANDSCAPE (769px – 1024px)
   ============================================================ */
@media (max-width: 1024px) {
  .section { padding: 70px 30px; }

  /* NAVBAR */
  #navbar {
    grid-template-columns: auto 1fr auto;
    padding: 0 20px;
    height: 68px;
  }
  .nav-logo {
    min-width: 0;
    gap: 10px;
  }
  .nav-logo-text-wrap { border-left-width: 1.5px; padding-left: 10px; }
  .nav-logo-text { max-width: min(28vw, 200px); }
  img.nav-logo-text { height: 0.9rem !important; }
  .nav-photo-wrap,
  .nav-photo { width: 44px; height: 44px; }
  .nav-photo-wrap { flex-basis: 44px; }

  /* Hamburger visible */
  .nav-burger { display: flex; }

  /* Mobile Slide-out menu */
  .nav-links {
    display: none;
    position: fixed;
    top: 68px;
    right: 0;
    width: 260px;
    height: calc(100vh - 68px);
    background: rgba(5, 11, 18, 0.98);
    flex-direction: column;
    justify-content: flex-start;
    align-items: flex-start;
    padding: 16px 0;
    gap: 0;
    border-left: 1px solid rgba(0, 240, 255, 0.15);
    box-shadow: -8px 0 30px rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    overflow-y: auto;
    z-index: 9998;
  }
  .nav-links.open,
  .nav-links.mobile-active { display: flex; }
  .nav-links li {
    width: 100%;
    opacity: 1 !important;
    animation: none !important;
  }
  .nav-links a {
    display: block;
    width: 100%;
    padding: 14px 24px;
    font-size: 12px;
    letter-spacing: 2px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    transition: background 0.2s, color 0.2s;
  }
  .nav-links a:hover,
  .nav-links a.active { background: rgba(0, 240, 255, 0.06); }

  .page { padding-top: 88px; }

  /* FOOTER GRID */
  .sf-main-grid {
    grid-template-columns: 1fr 1fr;
    padding: 40px 30px;
    gap: 36px;
  }
  .sf-col-brand { grid-column: 1 / -1; }

  /* Section/page section padding */
  .about-grid { gap: 40px; }
}

/* ============================================================
   TABLET PORTRAIT (481px – 768px)
   ============================================================ */
@media (max-width: 768px) {

  /* ── GLOBAL ── */
  body { font-size: 15px; }
  .section { padding: 60px 20px; }
  .sh-title { font-size: clamp(1.8rem, 6vw, 2.6rem); }

  /* ── NAVBAR ── */
  #navbar {
    height: 62px;
    padding: 0 16px;
    grid-template-columns: auto 1fr auto;
  }
  .nav-photo-wrap,
  .nav-photo { width: 38px; height: 38px; }
  .nav-photo-wrap { flex-basis: 38px; }
  img.nav-logo-text { height: 0.8rem !important; }
  .nav-links { top: 62px; height: calc(100vh - 62px); }
  .page { padding-top: 82px; }

  /* ── HERO EDITORIAL ── */
  .hero-editorial { min-height: auto; }
  .hero-ed-photo-col {
    position: relative;
    width: 100%;
    left: 0;
    transform: none;
    height: 55vw;
    max-height: 340px;
  }
  .hero-ed-content {
    grid-template-columns: 1fr !important;
    padding: 18px 20px 14px;
  }
  .hero-ed-left-top { grid-column: 1; grid-row: auto; }
  .hero-ed-right-top { display: none !important; }
  .hero-ed-right-mid { display: none !important; }
  .hero-bg-word { font-size: 16vw; bottom: 10px; }
  .hero-bg-word2 { display: none; }
  .hero-ed-name { font-size: clamp(2.2rem, 9vw, 3.2rem); margin-bottom: 16px; }
  .hero-ed-meta { margin-bottom: 24px; }
  .hero-ed-terminal { max-width: 100%; margin-top: 10px; }
  .hero-ed-bottom {
    grid-template-columns: 1fr !important;
    gap: 14px;
    padding: 12px 20px 14px;
  }
  .hero-ed-stats { justify-content: center; flex-wrap: wrap; }
  .hero-ed-stat { padding: 10px 14px; }
  .hero-ed-stat-n { font-size: 1.4rem; }
  .hero-ed-role-title { text-align: left; }
  .hero-ed-bio-strip { padding: 10px 20px 14px; }
  .hero-ed-socials { gap: 8px; flex-wrap: wrap; }
  .hero-ed-soc { font-size: 0.55rem; padding: 5px 8px; }
  .hero-ed-btns { gap: 10px; }

  /* ── STRIP STRIP ── */
  .strip {
    flex-direction: column;
    gap: 0;
    padding: 24px 20px;
  }
  .strip-item {
    border-right: none;
    border-bottom: 1px solid var(--panel-border);
    padding: 18px 0;
    width: 100%;
    justify-content: flex-start;
    gap: 16px;
  }
  .strip-item:last-child { border-bottom: none; padding-bottom: 0; }

  /* ── ABOUT GRID ── */
  .about-grid { grid-template-columns: 1fr; gap: 30px; }
  .about-card { padding: 20px; }
  .about-tags { gap: 8px; }
  .atag { font-size: 0.6rem; padding: 6px 12px; }

  /* ── TIMELINE ── */
  .tl-item { gap: 14px; }
  .tl-content { padding: 16px 18px; }
  .tl-yr { font-size: 0.9rem; }

  /* ── SKILLS GRID ── */
  .skills-grid { grid-template-columns: 1fr 1fr !important; gap: 12px; }
  .skill-card { padding: 20px 16px; }

  /* ── PROJECTS ── */
  .proj-grid { grid-template-columns: 1fr !important; gap: 16px; }
  .proj-card { padding: 22px 18px; min-height: 220px; }

  /* ── ACHIEVEMENTS ── */
  .ach-stats { grid-template-columns: repeat(3, 1fr) !important; gap: 14px; }
  .ach-stat { padding: 20px 10px; }
  .ach-n { font-size: 1.6rem; }
  .awards-grid { grid-template-columns: 1fr !important; gap: 16px; }
  .award-card { padding: 22px 18px; }

  /* ── HOBBIES ── */
  .hobby-grid { grid-template-columns: 1fr 1fr !important; gap: 14px; }
  .hobby-card { padding: 22px 14px; }
  .hobby-name { font-size: 0.95rem; }

  /* ── SOCIAL MEDIA ── */
  .social-grid { grid-template-columns: 1fr 1fr !important; gap: 14px; }

  /* ── SERVICES PAGE ── */
  .afk-hero { padding: 50px 20px 30px !important; }
  .afk-filters { padding: 0 20px 24px !important; }
  .afk-grid { grid-template-columns: 1fr !important; padding: 0 20px 30px !important; }
  .afk-strip { margin: 0 20px 40px !important; padding: 30px 20px !important; }
  .afk-strip-h { font-size: 1.4rem !important; }

  /* ── CONTACT PAGE ── */
  .contact-grid { grid-template-columns: 1fr !important; }

  /* ── MEDIA PAGE ── */
  .med-section { padding: 60px 20px !important; }
  .med-grid,
  .med-grid-single { grid-template-columns: 1fr !important; max-width: 100% !important; }
  .med-hero-card { grid-column: auto !important; }
  .med-title { font-size: clamp(1.8rem, 6vw, 2.8rem) !important; }

  /* ── HOW I WORK / TESTIMONIALS ── */
  .how-grid { grid-template-columns: 1fr !important; }
  .testimonials-grid { grid-template-columns: 1fr !important; }

  /* ── EXPERIENCE PAGE ── */
  .exp-grid { grid-template-columns: 1fr !important; }
  .exp-tabs { flex-wrap: wrap; gap: 6px; }
  .exp-tab { padding: 8px 16px; font-size: 0.6rem; }

  /* ── FOOTER ── */
  footer,
  .stark-footer { display: block; }
  .freelance-bar {
    padding: 10px 16px;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
  }
  .fb-label { font-size: 10px; }
  .fb-hire-btn { padding: 6px 16px; font-size: 10px; }
  .sf-main-grid {
    grid-template-columns: 1fr !important;
    padding: 28px 20px !important;
    gap: 30px;
  }
  .sf-col-brand { grid-column: 1 / -1; }
  .sf-brand-name { font-size: 20px; }
  .sf-bot-bar {
    flex-direction: column;
    gap: 8px;
    text-align: center;
    padding: 14px 20px;
  }
  .sf-copy { font-size: 10px; }

  /* ── BUTTONS ── */
  .btn {
    padding: 11px 22px;
    font-size: 0.55rem;
    letter-spacing: 2px;
  }
  .hero-ed-btns .btn { width: 100%; justify-content: center; }

  /* ── STARK TERMINAL ── */
  .stark-terminal { max-width: 100%; }
  .st-label { display: none; }

  /* ── CTA BLOCK ── */
  .cta-block { padding: 50px 20px; }
  .cta-block h2 { font-size: 2rem; }
  .cta-btns { flex-direction: column; align-items: center; }

  /* ── LOADER ── */
  .loader-name { width: min(300px, 80vw); height: 56px; }
  .loader-progress-track { width: 240px; }
}

/* ============================================================
   MOBILE PHONES (≤ 480px)
   ============================================================ */
@media (max-width: 480px) {

  /* ── GLOBAL ── */
  body { font-size: 14px; }
  .section { padding: 50px 16px; }
  .sh-title { font-size: clamp(1.5rem, 7vw, 2rem); }
  .sh { margin-bottom: 36px; }

  /* ── NAVBAR ── */
  #navbar {
    height: 58px;
    padding: 0 14px;
  }
  .nav-logo { gap: 8px; }
  .nav-photo-wrap,
  .nav-photo { width: 34px; height: 34px; }
  .nav-photo-wrap { flex-basis: 34px; }
  img.nav-logo-text { height: 0.72rem !important; }
  .nav-logo-text-wrap { padding-left: 8px; }
  .nav-links { top: 58px; height: calc(100vh - 58px); width: 100%; border-left: none; }
  .nav-links a { padding: 13px 20px; font-size: 11px; }
  .page { padding-top: 76px; }

  /* ── HERO EDITORIAL ── */
  .hero-ed-photo-col { height: 60vw; max-height: 260px; margin-bottom: 10px; }
  .hero-ed-name { font-size: clamp(1.8rem, 10vw, 2.8rem); line-height: 1.1; margin-bottom: 12px; }
  .hero-ed-meta { font-size: 0.52rem; margin-bottom: 20px; }
  .hero-ed-status { font-size: 0.52rem; padding: 4px 10px; margin-bottom: 16px; }
  .hero-ed-terminal { max-width: 100%; margin-top: 10px; }
  .stark-terminal { border-radius: 4px; overflow: hidden; }
  .st-content { font-size: 0.65rem !important; line-height: 1.5; }
  .hero-ed-stats { gap: 0; }
  .hero-ed-stat { padding: 8px 12px; }
  .hero-ed-stat-n { font-size: 1.2rem; }
  .hero-ed-stat-l { font-size: 0.44rem; letter-spacing: 1.5px; }
  .hero-ed-bio { font-size: 0.78rem; line-height: 1.7; }
  .hero-bg-word { font-size: 22vw; }
  .hero-ed-role-big { font-size: 1.3rem; }
  .hero-ed-socials { gap: 6px; }
  .hero-ed-soc { font-size: 0.5rem; padding: 5px 7px; }

  /* ── STRIP ── */
  .strip { padding: 18px 16px; }
  .strip-item { padding: 14px 0; }
  .strip-title { font-size: 0.6rem; }
  .strip-sub { font-size: 0.55rem; }

  /* ── STATS ── */
  .hstat { padding: 10px 14px; }
  .hstat-n { font-size: 1.6rem; }
  .hstat-l { font-size: 0.5rem; }

  /* ── ABOUT ── */
  .about-para { font-size: 0.88rem; }
  .about-quote { font-size: 0.9rem; padding: 14px 16px; }
  .tl-content { padding: 14px 14px; }
  .tl-yr { font-size: 0.85rem; }

  /* ── SKILLS ── */
  .skills-grid { grid-template-columns: 1fr !important; }
  .skill-card { padding: 18px 14px; }

  /* ── ACHIEVEMENTS ── */
  .ach-stats { grid-template-columns: 1fr 1fr !important; gap: 10px; }
  .ach-n { font-size: 1.4rem; }
  .ach-l { font-size: 0.52rem; }
  .award-item { padding: 12px 16px; gap: 14px; }
  .award-yr { font-size: 0.72rem; }
  .award-txt { font-size: 0.82rem; }

  /* ── HOBBIES ── */
  .hobby-grid { grid-template-columns: 1fr 1fr !important; gap: 10px; }
  .hobby-card { padding: 18px 10px; }
  .hobby-name { font-size: 0.85rem; }
  .hobby-sub { font-size: 0.72rem; }

  /* ── SOCIAL GRID ── */
  .social-grid { grid-template-columns: 1fr !important; gap: 12px; }
  .social-card { padding: 20px 16px; }
  .social-count { font-size: 1.2rem; }

  /* ── PROJECTS ── */
  .proj-card { padding: 18px 14px; min-height: auto; }
  .proj-name { font-size: 0.9rem; }
  .proj-desc { font-size: 0.78rem; }

  /* ── SERVICES ── */
  .afk-title { font-size: clamp(1.6rem, 7vw, 2.2rem) !important; }
  .afk-filter { font-size: 0.65rem; padding: 7px 14px; }
  .afk-card { padding: 20px 16px; gap: 10px; }
  .afk-name { font-size: 0.65rem; letter-spacing: 2px; }
  .afk-what { font-size: 0.82rem; }
  .afk-info-row { grid-template-columns: 1fr !important; }
  .afk-strip-h { font-size: 1.3rem !important; }
  .afk-strip-btn { padding: 12px 28px !important; font-size: 0.7rem !important; }

  /* ── HOW I WORK ── */
  .how-step { padding: 20px 16px; }
  .how-step-num { font-size: 1.4rem; }

  /* ── TESTIMONIALS ── */
  .testi-card { padding: 20px 16px; }

  /* ── CONTACT ── */
  .contact-card { padding: 20px 16px; }
  .contact-form input,
  .contact-form textarea { padding: 12px 14px; font-size: 0.85rem; }

  /* ── EXPERIENCE ── */
  .exp-card { padding: 20px 16px; }
  .exp-tabs { gap: 4px; }
  .exp-tab { padding: 7px 12px; font-size: 0.55rem; letter-spacing: 1.5px; }

  /* ── MEDIA PAGE ── */
  .med-card { padding: 14px 14px; }
  .med-card-name { font-size: 0.75rem; }
  .med-card-logo { width: 38px; height: 38px; }

  /* ── FOOTER ── */
  .freelance-bar { padding: 9px 14px; gap: 8px; }
  .fb-divider { display: none; }
  .sf-main-grid { padding: 24px 16px !important; gap: 24px; }
  .sf-brand-name { font-size: 18px; }
  .sf-brand-tagline { font-size: 12px; }
  .sf-social-icons a { width: 32px; height: 32px; }
  .sf-social-icons a svg { width: 14px; height: 14px; }
  .sf-links-list a { font-size: 12px; }
  .sf-bot-bar { padding: 12px 16px; }

  /* ── BUTTONS ── */
  .btn {
    padding: 10px 18px;
    font-size: 0.52rem;
    letter-spacing: 1.5px;
    clip-path: polygon(8px 0%, 100% 0%, calc(100% - 8px) 100%, 0% 100%);
  }

  /* ── PANEL CARDS ── */
  .panel { border-radius: 3px; }

  /* ── LOADER ── */
  .loader-hex { width: 70px; height: 70px; }
  .loader-inner { width: 35px; height: 35px; }
  .loader-name { width: min(260px, 80vw); height: 48px; }
  .loader-progress-track { width: 200px; }
  .loader-status { font-size: 0.56rem; letter-spacing: 3px; }

  /* ── MARVEL/AFFAN PAGE ── */
  .marvel-hero { padding: 50px 16px 30px !important; }
  .marvel-title { font-size: clamp(1.6rem, 7vw, 2.5rem) !important; }

  /* ── TRAVEL PAGE ── */
  .travel-grid { grid-template-columns: 1fr 1fr !important; gap: 10px; }
  .travel-card { padding: 16px 12px !important; }
}

/* ============================================================
   SMALL PHONES (≤ 375px)
   ============================================================ */
@media (max-width: 375px) {

  .section { padding: 44px 14px; }
  #navbar { height: 54px; padding: 0 12px; }
  .page { padding-top: 72px; }
  img.nav-logo-text { height: 0.65rem !important; }
  .nav-photo-wrap,
  .nav-photo { width: 30px; height: 30px; }
  .nav-photo-wrap { flex-basis: 30px; }
  .nav-links { top: 54px; height: calc(100vh - 54px); }

  /* Hero name smaller */
  .hero-ed-name { font-size: clamp(1.5rem, 11vw, 2.2rem); }

  /* Stats 1 col on very small screens */
  .ach-stats { grid-template-columns: 1fr 1fr !important; }
  .hobby-grid { grid-template-columns: 1fr 1fr !important; }
  .social-grid { grid-template-columns: 1fr !important; }

  /* Services filter wrap */
  .afk-filter { font-size: 0.58rem; padding: 6px 10px; }

  /* Footer super compact */
  .sf-main-grid { padding: 20px 14px !important; gap: 20px; }
  .sf-brand-name { font-size: 16px; letter-spacing: 2px; }
  .freelance-bar { flex-direction: column; gap: 6px; align-items: center; }
}

/* ============================================================
   TOUCH DEVICE ADJUSTMENTS
   ============================================================ */
@media (hover: none) {
  /* Remove hover transforms that cause layout jumps on touch */
  .panel:hover { transform: none; }
  .tl-content:hover { transform: none; }
  .afk-card:hover { transform: none; }
  .proj-card:hover::before { opacity: 0; }
  .hero-ed-stat:hover { transform: none; }
  .hstat:hover { transform: none; }

  /* Make nav tap targets bigger */
  .nav-links a { padding: 16px 24px; }

  /* Ensure burger is always easy to tap */
  .nav-burger { padding: 10px; min-width: 44px; min-height: 44px; align-items: center; justify-content: center; }
}

/* ============================================================
   LANDSCAPE PHONE ORIENTATION
   ============================================================ */
@media (max-width: 768px) and (orientation: landscape) {
  .hero-editorial { min-height: auto; }
  .hero-ed-photo-col { height: 40vw; max-height: 240px; }
  .hero-ed-stat-n { font-size: 1.1rem; }
  .hero-ed-name { font-size: clamp(1.4rem, 5vw, 2rem); }
  .nav-links {
    width: 220px;
    overflow-y: auto;
    height: calc(100vh - 58px);
  }
  .nav-links a { padding: 10px 20px; font-size: 10px; }
}

/* ============================================================
   GLOBAL OVERFLOW PREVENTION
   ============================================================ */
@media (max-width: 768px) {
  /* Page-level hard overflow lock */
  html, body {
    overflow-x: hidden;
    max-width: 100vw;
  }

  .hero-editorial,
  .hero-ed-content,
  .hero-ed-bottom,
  .strip,
  .section,
  footer,
  .sf-main-grid,
  .freelance-bar,
  .sf-bot-bar {
    overflow-x: hidden;
    max-width: 100vw;
    box-sizing: border-box;
  }

  /* Absolute-positioned photo column: prevent it exceeding viewport */
  .hero-ed-photo-col {
    width: 100% !important;
    max-width: 100vw !important;
  }

  /* HUD corners: limit their negative offsets to avoid bleedover */
  .hero-ed-hud-corner {
    display: none;
  }

  /* Ensure no element bleeds out */
  * { max-width: 100%; }

  /* Images scale down */
  img { max-width: 100%; height: auto; }

  /* Pre/code blocks don't overflow */
  pre, code { overflow-x: auto; }

  /* Nav logo stays in bounds */
  .nav-logo { overflow: hidden; }

  /* Buttons: allow wrapping */
  .hero-btns,
  .cta-btns,
  .hero-ed-btns { flex-wrap: wrap; }
}
  