/**
 * @file responsive.css
 * @description Master Responsive Design System for Nemitha Ninduwara Portfolio
 * Fully calibrated for Mobile (320px - 480px), Phablets (481px - 767px),
 * Tablets (768px - 1023px), Laptops (1024px - 1439px), and Widescreens (>= 1440px).
 */

/* ==========================================================================
   1. GLOBAL TOUCH & MOBILE FOUNDATION
   ========================================================================== */
@media (hover: none) and (pointer: coarse) {
  /* Hide mouse-following dots on touch screens */
  .cursor-dot,
  .cursor-follower {
    display: none !important;
  }

  /* Restore standard touch interaction */
  html,
  body,
  a,
  button,
  input,
  textarea {
    cursor: auto !important;
  }

  /* Remove tap highlight grey box on mobile browsers */
  * {
    -webkit-tap-highlight-color: transparent;
  }

  /* Hide mouse-tracking hover project thumbnail on mobile */
  .project-modal-container {
    display: none !important;
  }
}

/* iOS Safari Auto-Zoom Fix: Inputs must be at least 16px on mobile */
@media (max-width: 768px) {
  input[type="text"],
  input[type="email"],
  input[type="tel"],
  input[type="number"],
  textarea,
  select {
    font-size: 16px !important;
  }
}

/* Global Container Fluid Padding */
.container,
.container.medium {
  width: 100%;
  max-width: 1560px;
  margin-left: auto;
  margin-right: auto;
  padding-left: clamp(1.2rem, 4.5vw, 4rem);
  padding-right: clamp(1.2rem, 4.5vw, 4rem);
  box-sizing: border-box;
}

/* ==========================================================================
   2. LARGE DESKTOP & WIDESCREEN (min-width: 1440px)
   ========================================================================== */
@media (min-width: 1440px) {
  .hero-marquee-wrap h1 {
    font-size: 15rem;
  }

  .home-intro .flex-col:nth-child(1) h2 {
    font-size: 3.2rem;
  }

  .home-intro .flex-col:nth-child(2) p {
    font-size: 1.3rem;
  }
}

/* ==========================================================================
   3. LAPTOP / SMALL DESKTOP (1024px to 1439px)
   ========================================================================== */
@media (max-width: 1439px) and (min-width: 1024px) {
  .fixed-nav {
    max-width: 92%;
  }

  .hero-marquee-wrap h1 {
    font-size: clamp(8rem, 11vw, 13rem);
  }

  .home-intro .flex-col:nth-child(1) h2 {
    font-size: clamp(2.2rem, 3.2vw, 3rem);
  }
}

/* ==========================================================================
   4. TABLETS (768px to 1023px)
   ========================================================================== */
@media (max-width: 1023px) {
  /* Navigation switch to burger menu */
  .fixed-nav .nav-links {
    display: none !important;
  }

  .menu-toggle {
    display: flex !important;
    width: 66px;
    height: 66px;
    top: 24px;
    right: 28px;
  }

  /* Scrolled capsule adapts neatly */
  .fixed-nav.is-scrolled {
    width: 92% !important;
    max-width: 820px;
  }

  /* Hero Section */
  .home-header {
    height: 100vh;
    min-height: 700px;
  }

  .home-header .hanger {
    top: 42%;
    left: 0;
    transform: translateY(-50%) scale(0.92);
    transform-origin: left center;
  }

  .hero-role-title {
    top: 40%;
    right: 2rem;
    transform: scale(0.92);
    transform-origin: right center;
  }

  .hero-marquee-wrap h1 {
    font-size: clamp(5.5rem, 12vw, 9.5rem);
  }

  /* Home Intro */
  .home-intro .row {
    flex-direction: column;
    gap: 3rem;
  }

  .home-intro .flex-col:nth-child(1),
  .home-intro .flex-col:nth-child(2) {
    width: 100% !important;
    max-width: 100% !important;
    padding: 0 !important;
  }

  .home-intro .flex-col:nth-child(1) h2 {
    font-size: clamp(1.8rem, 3.8vw, 2.6rem);
  }

  .home-intro .btn-round {
    margin-top: 2.5rem;
  }

  /* Work Page */
  .work-header-grid {
    grid-template-columns: 1fr;
    gap: 3rem;
  }

  .work-spotlight-card {
    max-width: 540px;
    margin: 0;
  }

  .work-header h1 {
    font-size: clamp(3.5rem, 8vw, 6rem);
  }

  .work-item a {
    padding: 2.2rem 0;
  }

  /* About Page */
  .about-image .row,
  .services-row {
    flex-direction: column;
    gap: 3.5rem;
  }

  .about-awwwards .row {
    grid-template-columns: 1fr;
    gap: 3.5rem;
  }

  .about-image .flex-col,
  .about-awwwards .flex-col {
    width: 100% !important;
    padding: 0 !important;
  }

  .about-stats-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 0.8rem;
  }

  /* Contact Page */
  .contact-header .row:nth-child(1) {
    flex-direction: column;
    margin-bottom: 3.5rem;
  }

  .contact-header .row:nth-child(1) .flex-col:nth-child(1),
  .contact-header .row:nth-child(1) .flex-col:nth-child(2) {
    width: 100%;
    padding: 0;
  }

  .contact-header .row:nth-child(2) {
    flex-direction: column;
  }

  .contact-header .form-column,
  .contact-header .details-column {
    width: 100% !important;
    padding: 0 !important;
  }

  .contact-header .details-column {
    margin-top: 4.5rem;
  }

  /* Footers */
  .footer-bottom,
  .footer-contact .footer-bottom {
    grid-template-columns: 1fr 1fr !important;
    gap: 2.5rem;
  }
}

/* ==========================================================================
   5. MOBILE SCREENS & PHABLETS (max-width: 767px)
   ========================================================================== */
@media (max-width: 767px) {
  /* Header & Navigation */
  .fixed-nav {
    padding: 16px 20px;
    width: 94%;
  }

  .fixed-nav.is-scrolled {
    width: 94% !important;
    top: 14px;
    padding: 0.65rem 1.4rem;
  }

  .nav-logo a {
    font-size: 0.92rem;
  }

  .menu-toggle {
    width: 54px !important;
    height: 54px !important;
    top: 16px !important;
    right: 16px !important;
    gap: 5px;
  }

  .menu-toggle span {
    width: 22px;
  }

  /* Fullscreen Navigation Drawer */
  .menu-overlay {
    width: 100vw !important;
    height: 100vh !important;
    padding: clamp(4.5rem, 12vh, 6rem) 1.8rem 2.5rem 1.8rem;
    box-sizing: border-box;
  }

  .menu-header-label {
    font-size: 0.72rem;
    margin-bottom: 1.5rem;
  }

  .menu-nav-item {
    margin-bottom: 0.8rem;
  }

  .menu-nav-item a {
    font-size: clamp(2.2rem, 9vw, 3.6rem);
  }

  .menu-footer {
    margin-top: 2rem;
  }

  .menu-social-links {
    flex-wrap: wrap;
    gap: 1.2rem;
  }

  /* Hero Section: Collision-Proof Multi-Level Placement */
  .home-header {
    height: 100vh;
    min-height: 580px;
    position: relative;
    overflow: hidden;
  }

  .hero-portrait-wrapper {
    position: absolute;
    inset: 0;
    display: flex;
    justify-content: center;
    align-items: center;
  }

  .hero-portrait {
    height: 100%;
    width: auto;
    max-width: 140%;
    object-fit: cover;
    object-position: center 20%;
  }

  /* Role Title placed at top-right (20vh) */
  .hero-role-title {
    top: clamp(140px, 20vh, 180px);
    right: 1.2rem;
    left: auto;
    transform: scale(0.85);
    transform-origin: right center;
    z-index: 10;
  }

  .hero-role-title h4 {
    font-size: 1.15rem;
    line-height: 1.25;
  }

  /* Hanger placed at middle-left (34vh) to avoid ANY horizontal collision */
  .home-header .hanger {
    top: clamp(240px, 34vh, 290px);
    left: 0;
    transform: scale(0.82);
    transform-origin: left center;
    z-index: 10;
  }

  .home-header .hanger p {
    font-size: 0.85rem;
  }

  /* Hero Giant Marquee */
  .hero-marquee-wrap {
    bottom: clamp(18px, 4vh, 32px);
  }

  .hero-marquee-wrap h1 {
    font-size: clamp(3.6rem, 15vw, 6.2rem);
    line-height: 0.95;
  }

  /* Home Intro */
  .home-intro {
    padding-top: clamp(4rem, 10vh, 6rem);
    padding-bottom: clamp(4rem, 10vh, 6rem);
  }

  .home-intro .flex-col:nth-child(1) h2 {
    font-size: clamp(1.45rem, 5.5vw, 2.2rem);
    line-height: 1.35;
  }

  .home-intro .flex-col:nth-child(2) p {
    font-size: 1.05rem;
    line-height: 1.6;
  }

  .home-intro .btn-round {
    width: 130px;
    height: 130px;
    margin-top: 2rem;
  }

  /* Work Showcase Section */
  .home-work {
    padding-top: 4rem;
    padding-bottom: 5rem;
  }

  .home-work .section-label {
    font-size: 0.75rem;
    margin-bottom: 2rem;
  }

  .work-item {
    border-top: 1px solid rgba(0, 0, 0, 0.08);
  }

  .work-item a {
    padding: 1.8rem 0;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.6rem;
  }

  .work-item h3 {
    font-size: clamp(1.6rem, 6vw, 2.4rem);
    line-height: 1.2;
  }

  .work-item .work-meta {
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    opacity: 0.65;
  }

  .btn-pill {
    padding: 0.9rem 2rem;
    font-size: 0.95rem;
    width: 100%;
    max-width: 280px;
    justify-content: center;
  }

  /* Work Page Category Filters & Spotlight */
  .work-header-grid {
    grid-template-columns: 1fr;
    gap: 2.2rem;
  }

  .work-spotlight-card {
    max-width: 100%;
    border-radius: 20px;
    padding: 10px;
  }

  .spotlight-media-wrap {
    border-radius: 14px;
  }

  .spotlight-titles h4 {
    font-size: 1.15rem;
  }

  .spotlight-titles p {
    font-size: 0.82rem;
  }

  .spotlight-arrow {
    width: 38px;
    height: 38px;
  }

  .work-header {
    padding-top: clamp(6.5rem, 14vh, 9rem);
    padding-bottom: 3rem;
  }

  .work-header h1 {
    font-size: clamp(2.8rem, 9vw, 4.8rem);
    line-height: 1.08;
  }

  .work-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    margin-bottom: 2.5rem;
  }

  .filter-btn {
    padding: 0.65rem 1.25rem;
    font-size: 0.88rem;
  }

  /* About Page */
  .about-header {
    padding-top: clamp(6.5rem, 14vh, 9rem);
    padding-bottom: 3rem;
  }

  .about-header h1 {
    font-size: clamp(2.6rem, 8.5vw, 4.5rem);
    line-height: 1.1;
  }

  .about-image .about-portrait {
    width: 100%;
    height: auto;
    border-radius: 16px;
  }

  .about-stats-grid {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }

  .services-list .service-item {
    padding: 1.8rem 0;
  }

  .service-item h3 {
    font-size: 1.5rem;
  }

  /* Contact Page */
  .contact-header {
    padding-top: clamp(6.5rem, 14vh, 9rem);
    padding-bottom: 4rem;
  }

  .contact-header h1 {
    font-size: clamp(2.4rem, 8.5vw, 4.8rem);
    line-height: 1.08;
  }

  .contact-header .profile-picture {
    width: 60px;
    height: 60px;
  }

  .contact-header .form-col {
    padding: 1.4rem 0;
  }

  .contact-header .form-col .label {
    font-size: clamp(1.05rem, 3.8vw, 1.3rem);
    margin-bottom: 0.8rem;
  }

  .contact-header .form-col .field {
    font-size: 1.05rem;
  }

  .btn-contact-send {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    margin: 2.5rem 0 1rem 0;
  }

  .btn-contact-send .btn-round {
    width: 130px;
    height: 130px;
  }

  .btn-contact-send .form-btn {
    width: 100%;
    height: 100%;
  }

  .form-status-msg {
    margin-top: 1.5rem;
    padding: 1rem 1.4rem;
    font-size: 0.95rem;
  }

  .details-column {
    margin-top: 3.5rem;
  }

  .details-column .links-wrap a {
    font-size: clamp(1.15rem, 4.5vw, 1.5rem);
  }

  /* Global Footers */
  .footer {
    padding-top: clamp(4rem, 10vh, 7rem);
    padding-bottom: 2.5rem;
  }

  .footer .footer-cta h2 {
    font-size: clamp(2.6rem, 8.5vw, 5rem);
    line-height: 1.1;
  }

  .footer .footer-cta .btn-round {
    width: 140px;
    height: 140px;
    margin-top: 2rem;
  }

  .footer-bottom,
  .footer-contact .footer-bottom {
    grid-template-columns: 1fr !important;
    gap: 1.8rem;
    padding-top: 2.5rem;
    margin-top: 3rem;
  }

  .footer-bottom-socials {
    display: flex;
    flex-wrap: wrap;
    gap: 1.2rem;
  }
}

/* ==========================================================================
   6. EXTRA SMALL MOBILE SCREENS (max-width: 380px — e.g. iPhone SE, Galaxy A)
   ========================================================================== */
@media (max-width: 380px) {
  .hero-role-title h4 {
    font-size: 1rem;
  }

  .home-header .hanger {
    transform: scale(0.75);
    transform-origin: left center;
  }

  .hero-marquee-wrap h1 {
    font-size: 3.2rem;
  }

  .home-intro .flex-col:nth-child(1) h2 {
    font-size: 1.35rem;
  }

  .contact-header h1 {
    font-size: 2.2rem;
  }

  .contact-header .form-col .label {
    font-size: 1rem;
  }

  .btn-contact-send .btn-round {
    width: 115px;
    height: 115px;
  }
}
