/* ============================================================
   KPROD — Mobile Experience
   Brutalist mobile design: sharp, impactful, original.
   Every rule is inside @media — Desktop is UNTOUCHED.
   Loaded AFTER all other stylesheets to cascade properly.
   ============================================================ */

/* === PROGRESS BAR: hide on mobile (no horizontal scroll) === */
@media (max-width: 768px) {
  .progress-bar {
    display: none !important;
  }
}

/* ============================================================
   SCROLL REVEAL SYSTEM
   Elements get .mobile-reveal via JS, then .is-revealed on scroll
   ============================================================ */
@media (max-width: 768px) {
  .mobile-reveal {
    opacity: 0;
    transform: translateY(40px);
    transition: opacity 0.45s cubic-bezier(0, 0, 0, 1),
                transform 0.45s cubic-bezier(0, 0, 0, 1);
  }

  .mobile-reveal.is-revealed {
    opacity: 1;
    transform: translateY(0);
  }

  /* Stagger delays for sibling items */
  .mobile-reveal-d1 { transition-delay: 0.07s; }
  .mobile-reveal-d2 { transition-delay: 0.14s; }
  .mobile-reveal-d3 { transition-delay: 0.21s; }
  .mobile-reveal-d4 { transition-delay: 0.28s; }
}

/* ============================================================
   NAVIGATION — MOBILE
   ============================================================ */
@media (max-width: 768px) {
  .nav {
    padding: var(--space-xs) var(--space-md);
    border-bottom: 2px solid var(--color-gray);
  }

  .brand h1 {
    font-size: 1.4rem;
  }

  /* Toggle button — brutalist pill */
  .nav-toggle {
    font-size: 0.8rem;
    letter-spacing: 0.18em;
    padding: 8px 18px;
    border: 1px solid var(--color-gray);
    color: var(--color-white);
    transition: border-color 0.15s, color 0.15s;
  }

  .nav-toggle:active {
    border-color: var(--color-accent);
    color: var(--color-accent);
  }
}

/* ============================================================
   MOBILE MENU — Dramatic full-screen takeover
   ============================================================ */
@media (max-width: 768px) {
  .mobile-menu {
    padding: 100px var(--space-md) var(--space-lg);
    justify-content: flex-start;
    align-items: flex-start;
    gap: 0;
    border-left: 4px solid var(--color-accent);
  }

  .mobile-menu a {
    font-size: clamp(2.4rem, 10vw, 4rem);
    line-height: 1.15;
    display: block;
    width: 100%;
    position: relative;
    padding: var(--space-xs) 0;
    color: var(--color-white);
    transition: color 0.15s cubic-bezier(0,0,0,1),
                transform 0.15s cubic-bezier(0,0,0,1);
    will-change: transform;
  }

  .mobile-menu a:active {
    color: var(--color-accent);
    transform: translateX(12px);
  }

  /* Staggered slide-in when menu opens */
  .mobile-menu.is-active a {
    animation: mobileMenuSlide 0.35s cubic-bezier(0, 0, 0, 1) both;
  }
  .mobile-menu.is-active a:nth-child(1) { animation-delay: 0.04s; }
  .mobile-menu.is-active a:nth-child(2) { animation-delay: 0.09s; }
  .mobile-menu.is-active a:nth-child(3) { animation-delay: 0.14s; }
  .mobile-menu.is-active a:nth-child(4) { animation-delay: 0.19s; }
  .mobile-menu.is-active a:nth-child(5) { animation-delay: 0.24s; }

  @keyframes mobileMenuSlide {
    from {
      opacity: 0;
      transform: translateX(-40px);
    }
    to {
      opacity: 1;
      transform: translateX(0);
    }
  }

  /* Section index numbers next to menu links */
  .mobile-menu a[data-index]::before {
    content: attr(data-index);
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.65rem;
    color: var(--color-accent);
    font-family: var(--font-body);
    font-weight: 400;
    letter-spacing: 0.15em;
  }
}

/* ============================================================
   LAYOUT — MOBILE (overrides layout.css @media)
   ============================================================ */
@media (max-width: 768px) {
  .horizontal-wrapper {
    height: auto !important;
    border-bottom: none;
  }

  .horizontal-sticky {
    position: relative;
    height: auto;
    overflow: visible;
  }

  .horizontal-track {
    flex-direction: column;
    height: auto;
    width: 100%;
    transform: none !important;
  }

  /* Sections: vertical stack, no forced full-height for every section */
  .section {
    width: 100% !important;
    height: auto !important;
    min-height: 0;
    border-right: none;
    border-bottom: 1px solid var(--color-gray);
    padding: var(--space-lg) var(--space-md);
    flex-direction: column;
    justify-content: flex-start;
  }

  .section:last-child {
    border-bottom: none;
  }
}

/* ============================================================
   HERO — MOBILE
   Full screen, left-aligned, raw and impactful
   ============================================================ */
@media (max-width: 768px) {
  .section--hero {
    min-height: 100svh !important;
    min-height: 100vh !important;
    padding: 0 !important;
    justify-content: center !important;
  }

  .hero-content {
    padding: 0 var(--space-md);
    padding-top: 70px;
    justify-content: center;
    align-items: flex-start;
    height: 100svh;
    height: 100vh;
  }

  .hero-title {
    font-size: clamp(2.8rem, 11vw, 5rem);
    text-align: left;
    line-height: 0.85;
    margin-bottom: var(--space-md);
  }

  .hero-video-bg {
    opacity: 0.3;
    filter: grayscale(100%) contrast(150%);
  }

  /* Animated scroll prompt at bottom-left */
  .hero-scroll-prompt {
    bottom: var(--space-lg);
    right: auto;
    left: var(--space-md);
    font-size: 0.7rem;
    letter-spacing: 0.25em;
    animation: heroScrollPulse 2.5s ease-in-out infinite;
  }

  .hero-scroll-prompt::after {
    width: 30px;
  }

  @keyframes heroScrollPulse {
    0%, 100% {
      opacity: 1;
      transform: translateY(0);
    }
    50% {
      opacity: 0.3;
      transform: translateY(10px);
    }
  }
}

/* ============================================================
   SHOWREEL — MOBILE
   Clean 16:9, breathing play button, subtle desaturation
   ============================================================ */
@media (max-width: 768px) {
  .section--showreel {
    min-height: auto !important;
    padding: var(--space-lg) var(--space-md) !important;
    justify-content: center !important;
    border-bottom: 1px solid var(--color-gray);
  }

  .showreel-container {
    aspect-ratio: 16 / 9;
    border: 2px solid var(--color-gray);
  }

  .showreel-video-bg {
    filter: grayscale(50%);
  }

  .play-btn {
    width: 68px;
    height: 68px;
    font-size: 0.85rem;
    animation: playBreathe 3s ease-in-out infinite;
  }

  @keyframes playBreathe {
    0%, 100% { transform: translate(-50%, -50%) scale(1); }
    50% { transform: translate(-50%, -50%) scale(1.1); }
  }

  .showreel-caption {
    margin-top: var(--space-sm);
    font-size: 0.75rem;
    letter-spacing: 0.2em;
  }
}

/* ============================================================
   PORTFOLIO — MOBILE
   Full-bleed vertical stack with visible metadata,
   touch-active color reveal, accent line separators
   ============================================================ */
@media (max-width: 768px) {
  .section--portfolio {
    flex-direction: column !important;
    align-items: stretch !important;
    padding: var(--space-lg) 0 var(--space-md) 0 !important;
    gap: 0 !important;
    min-height: auto !important;
  }

  .portfolio-title {
    writing-mode: horizontal-tb !important;
    transform: none !important;
    -webkit-text-stroke: 0 !important;
    color: var(--color-white) !important;
    font-size: clamp(1.8rem, 7vw, 2.5rem);
    margin: 0 0 var(--space-xs) 0 !important;
    padding: 0 var(--space-md);
    white-space: normal;
  }

  /* Accent underline under portfolio heading */
  .portfolio-title::after {
    content: '';
    display: block;
    width: 50px;
    height: 3px;
    background: var(--color-accent);
    margin-top: var(--space-xs);
    margin-bottom: var(--space-md);
  }

  .portfolio-card {
    width: 100% !important;
    height: 65vw !important;
    margin: 0;
    border: none !important;
    border-bottom: 1px solid var(--color-gray) !important;
    position: relative;
  }

  .portfolio-card:last-of-type {
    border-bottom: none !important;
  }

  .portfolio-card img {
    filter: grayscale(70%);
    transition: filter 0.3s cubic-bezier(0,0,0,1),
                transform 0.3s cubic-bezier(0,0,0,1);
  }

  /* Touch feedback — color reveal on press */
  .portfolio-card:active img {
    filter: grayscale(0%);
    transform: scale(1.02);
  }

  .portfolio-meta {
    transform: translateY(0) !important;
    padding: var(--space-sm) var(--space-md) !important;
    background: linear-gradient(to top, rgba(0,0,0,0.85) 0%, rgba(0,0,0,0.4) 60%, transparent 100%) !important;
  }

  .portfolio-category {
    font-size: 0.7rem;
    letter-spacing: 0.15em;
    margin-bottom: 0.25rem;
  }

  .portfolio-name {
    font-size: clamp(1rem, 4vw, 1.4rem);
  }
}

/* ============================================================
   ABOUT — MOBILE
   Single column, left-aligned brutalist typography
   ============================================================ */
@media (max-width: 768px) {
  .section--about {
    min-height: auto !important;
    padding: var(--space-lg) var(--space-md) !important;
    justify-content: flex-start !important;
  }

  .section--about .editorial-grid {
    grid-template-columns: 1fr;
    gap: var(--space-md);
  }

  .section--about .editorial-title {
    font-size: clamp(2.4rem, 10vw, 4rem);
    line-height: 0.88;
    text-align: left;
  }

  .editorial-text {
    font-size: clamp(0.95rem, 3.8vw, 1.2rem);
    line-height: 1.65;
    max-width: 100%;
  }
}

/* ============================================================
   SERVICES — MOBILE
   Numbered list with touch-active accent feedback
   ============================================================ */
@media (max-width: 768px) {
  .section--services {
    min-height: auto !important;
    padding: var(--space-lg) var(--space-md) !important;
    justify-content: flex-start !important;
  }

  .section--services .editorial-grid {
    grid-template-columns: 1fr;
    gap: var(--space-sm);
  }

  .section--services .editorial-title {
    font-size: clamp(2.4rem, 10vw, 4rem);
    text-align: left;
    line-height: 0.88;
  }

  .services-list {
    margin-top: var(--space-md);
    gap: 0;
  }

  .service-item {
    font-size: clamp(1rem, 4.2vw, 1.35rem);
    padding: var(--space-sm) 0;
    min-height: 52px;
    align-items: center;
    transition: color 0.12s, border-color 0.12s, padding-left 0.2s;
  }

  .service-item span {
    color: var(--color-accent);
    font-size: 0.7em;
    min-width: 2rem;
    flex-shrink: 0;
  }

  /* Touch feedback */
  .service-item:active {
    color: var(--color-accent);
    border-color: var(--color-accent);
    padding-left: var(--space-sm);
  }
}

/* ============================================================
   CONTACT — MOBILE
   Single column, centered form, large touch-friendly inputs
   ============================================================ */
@media (max-width: 768px) {
  .section--contact {
    height: auto !important;
    min-height: auto !important;
    padding: var(--space-lg) var(--space-md) !important;
    border-bottom: none;
  }

  .section--contact .editorial-grid {
    grid-template-columns: 1fr;
    gap: var(--space-lg);
  }

  .contact-logo {
    width: 55px;
    margin-bottom: var(--space-sm);
  }

  .section--contact .editorial-title {
    font-size: clamp(2.2rem, 9vw, 3.5rem);
    text-align: left;
    line-height: 0.88;
  }

  .contact-form {
    max-width: 100%;
    gap: var(--space-sm);
  }

  .contact-input {
    font-size: clamp(0.95rem, 3.8vw, 1.3rem);
    padding: var(--space-sm) 0;
    min-height: 48px;
    border-bottom-width: 2px;
  }

  .contact-input:focus {
    border-bottom-color: var(--color-accent);
  }

  .contact-input::placeholder {
    font-size: inherit;
  }

  /* Social links — touch-friendly with min hit area */
  .footer-social {
    margin-top: var(--space-md);
    gap: var(--space-md);
  }

  .footer-social a {
    font-size: clamp(1.2rem, 5vw, 1.6rem);
    min-width: 48px;
    min-height: 48px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    -webkit-text-stroke-width: 1px;
  }

  .footer-social a:active {
    -webkit-text-stroke-color: var(--color-accent);
    color: var(--color-accent);
  }

  /* Full-width submit button */
  .btn--solid {
    width: 100%;
    padding: 1.1rem 2rem;
    font-size: 0.95rem;
    min-height: 52px;
    letter-spacing: 0.15em;
    margin-top: var(--space-sm) !important;
  }
}

/* ============================================================
   FOOTER — MOBILE
   ============================================================ */
@media (max-width: 768px) {
  .footer {
    padding: var(--space-md);
    border-top: 2px solid var(--color-gray);
  }

  .footer-content {
    flex-direction: column;
    gap: var(--space-xs);
    text-align: center;
    font-size: 0.7rem;
    letter-spacing: 0.12em;
  }
}

/* ============================================================
   SMALL PHONES — 380px and below (iPhone SE, Galaxy A series)
   ============================================================ */
@media (max-width: 380px) {
  .hero-title {
    font-size: clamp(2.2rem, 10.5vw, 3.5rem) !important;
  }

  .portfolio-card {
    height: 72vw !important;
  }

  .mobile-menu a {
    font-size: clamp(2rem, 9vw, 3rem);
  }

  .section--about .editorial-title,
  .section--services .editorial-title,
  .section--contact .editorial-title {
    font-size: clamp(2rem, 9vw, 3rem);
  }

  .service-item {
    font-size: 0.95rem;
  }

  .contact-input {
    font-size: 0.95rem;
  }

  .play-btn {
    width: 56px;
    height: 56px;
    font-size: 0.75rem;
  }
}

/* ============================================================
   TABLET — 769px to 1024px
   Desktop scroll still works, but tighten things up
   ============================================================ */
@media (min-width: 769px) and (max-width: 1024px) {
  .portfolio-card {
    width: 38vw;
    height: 60vh;
  }

  .editorial-grid {
    gap: var(--space-lg);
  }

  .contact-input {
    font-size: var(--fs-body);
  }

  .play-btn {
    width: 90px;
    height: 90px;
    font-size: 1rem;
  }
}

/* ============================================================
   LANDSCAPE MOBILE
   Adjust heights for cramped viewports
   ============================================================ */
@media (max-width: 768px) and (orientation: landscape) {
  .section--hero {
    min-height: 100vw !important;
  }

  .hero-content {
    height: auto;
    min-height: 100vw;
    padding-top: 60px;
  }

  .hero-title {
    font-size: clamp(1.8rem, 6vh, 3rem) !important;
  }

  .portfolio-card {
    height: 45vh !important;
  }

  .play-btn {
    width: 50px;
    height: 50px;
    font-size: 0.7rem;
  }
}

/* ============================================================
   MOBILE SECTION ACCENT DECORATORS
   Thin accent lines that appear between sections on mobile
   ============================================================ */
@media (max-width: 768px) {
  .section--hero {
    border-bottom: 3px solid var(--color-accent) !important;
  }

  /* Smooth overscroll */
  html {
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
  }

  /* Prevent horizontal overflow from any stray element */
  body {
    overflow-x: hidden;
  }
}
