/**
 * Mobile-only styles for 8PAWS theme (iOS home screen)
 * Loaded conditionally via media="(max-width: 599px)"
 * Extracted from front-page.php inline <style> for performance.
 */

@media (max-width: 599px) {

  html,
  body {
    background: #000000 !important;
    box-shadow: none !important;
  }

  #mac,
  .mac-glow,
  .m-bk,
  .m-dock {
    display: none !important;
  }

  #ios {
    background: #000000 !important;
    overflow: hidden;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 100vh;
    height: 100svh;
    height: 100dvh;
    z-index: 1000;
    font-family: 'Rubik', -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Helvetica Neue', Arial, sans-serif !important;
    box-shadow: none !important;
    border: none !important;
  }

  .nav-overlay {
    z-index: 1001 !important;
  }

  .nav-drawer {
    z-index: 1002 !important;
  }

  .ios-home {
    width: 100%;
    height: 100%;
    position: relative;
    background: #000000 !important;
    background-image: none !important;
    box-shadow: none !important;
  }

  .ios-home::before,
  .ios-home::after {
    display: none !important;
  }

  /* ─── Header: PIXEN logo + hamburger ─── */
  .p-header {
    position: absolute;
    top: max(3vh, env(safe-area-inset-top, 22px));
    left: 5vw;
    right: 5vw;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 30;
  }

  .p-logo-img {
    width: 168px !important;
    height: auto !important;
    margin: 0 !important;
    filter: none !important;
    display: block !important;
  }

  .p-header svg {
    width: 22px !important;
    height: 16px !important;
    stroke-width: 2 !important;
    color: #ffffff !important;
  }

  /* ─── Title block ─── */
  .p-title-sec {
    position: absolute;
    top: 13vh;
    top: 13dvh;
    left: 0;
    right: 0;
    width: 100%;
    text-align: center;
    z-index: 20;
    display: flex;
    flex-direction: column;
    align-items: center;
    pointer-events: none;
  }

  .p-title {
    color: #f6be00 !important;
    font-size: 16px !important;
    font-weight: 600 !important;
    margin: 0 !important;
    letter-spacing: 0.9px !important;
    line-height: 1.15 !important;
    font-family: 'Rubik', Arial, 'Helvetica Neue', Helvetica, sans-serif !important;
    text-shadow: none !important;
    white-space: nowrap !important;
    font-style: normal !important;
  }

  .p-subtitle {
    color: #FFFFFF !important;
    font-size: 8.5px !important;
    font-weight: 400 !important;
    margin: 5px 0 0 0 !important;
    letter-spacing: 0.3px !important;
    font-family: 'Rubik', Arial, 'Helvetica Neue', Helvetica, sans-serif !important;
    font-style: normal !important;
  }

  /* ─── Character ─── */
  .p-char-wrap {
    position: absolute;
    bottom: 25vh;
    bottom: 25dvh;
    left: 53%;
    transform: translateX(-50%);
    height: 50vh;
    height: 50dvh;
    z-index: 10;
    display: flex;
    justify-content: center;
    align-items: flex-end;
    pointer-events: none;
    content-visibility: auto;
    contain-intrinsic-size: 0 50dvh;
  }

  .p-char-img {
    height: 100% !important;
    width: 122% !important;
    max-width: 90vw !important;
    object-fit: contain !important;
    /* Sticker outline — same SVG filter as desktop (.m-hero img) so the
       die-cut look is identical across breakpoints. One GPU pass — no
       per-frame compositing cost. */
    filter:
      url(#sticker-outline) drop-shadow(0 12px 18px rgba(0, 0, 0, 0.35));
  }

  /* ─── Folder boxes ─── */
  .p-fd-box {
    position: absolute;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 20;
    cursor: pointer;
    width: 76px !important;
    transition: transform 0.2s ease;
    filter: drop-shadow(0 5px 9px rgba(0, 0, 0, 0.45));
  }

  .p-fd-img {
    width: 100% !important;
    height: auto !important;
    display: block !important;
  }

  .p-fd-pink {
    filter: url(#c-folder-about) !important;
  }

  .p-fd-blue {
    filter: url(#c-folder-services) !important;
  }

  .p-fd-orange {
    filter: url(#c-folder-portfolio) !important;
  }

  .p-fd-green {
    filter: url(#c-folder-contact) !important;
  }

  .p-fd-box .fd-text {
    position: absolute;
    color: #ffffff !important;
    font-weight: 700 !important;
    font-size: 9.5px !important;
    letter-spacing: 0px !important;
    top: 56% !important;
    left: 50% !important;
    white-space: nowrap;
    overflow: hidden;
    transform: translate(-50%, -50%) !important;
    pointer-events: none !important;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.45) !important;
    font-family: 'Rubik', Arial, 'Helvetica Neue', Helvetica, sans-serif !important;
  }

  .p-fd-tl {
    top: 29vh;
    top: 29dvh;
    left: 6vw;
  }

  .p-fd-tl:active {
    transform: rotate(-8deg) scale(0.93);
  }

  .p-fd-tr {
    top: 27vh;
    top: 27dvh;
    right: 6vw;
  }

  .p-fd-tr:active {
    transform: rotate(7deg) scale(0.93);
  }

  .p-fd-bl {
    top: 57vh;
    top: 57dvh;
    left: 5vw;
  }

  .p-fd-bl:active {
    transform: rotate(-5deg) scale(0.93);
  }

  .p-fd-br {
    top: 53vh;
    top: 53dvh;
    right: 5vw;
  }

  .p-fd-br:active {
    transform: rotate(5deg) scale(0.93);
  }

  /* ─── CTA pill button ─── */
  .p-cta-btn {
    position: absolute;
    bottom: 15.5vh;
    bottom: max(15.5dvh, calc(env(safe-area-inset-bottom, 0px) + 70px));
    left: 50%;
    transform: translateX(-50%);
    background: #f6be00 !important;
    color: #ffffff !important;
    border: none !important;
    padding: 6px 19px !important;
    border-radius: 100px !important;
    font-weight: 700 !important;
    font-size: 12px !important;
    letter-spacing: 0.5px !important;
    z-index: 25;
    white-space: nowrap !important;
    box-shadow: 0 5px 16px rgba(246, 190, 23, 0.28) !important;
    cursor: pointer;
    text-transform: uppercase !important;
    font-family: 'Rubik', Arial, 'Helvetica Neue', Helvetica, sans-serif !important;
    /* Lock the button to the English-text width so the Arabic version (even
       if shorter) renders at the exact same pill size. 20ch tracks the
       font-size, so this rule scales correctly across breakpoints. */
    min-width: 20ch !important;
    text-align: center !important;
  }

  /* ═══════════════════════════════════════════════════
     RADICAL MOBILE PERFORMANCE OVERRIDES
     ═══════════════════════════════════════════════════ */

  /* ─── 1. Kill 300ms tap delay everywhere ─── */
  *,
  *::before,
  *::after {
    touch-action: manipulation;
  }

  /* ─── 2. Remove blur from home dim state ─── */
  .ios-home.dim {
    filter: none !important;
    transform: scale(.92);
    opacity: .4;
    transition: transform .25s ease-out, opacity .25s ease-out !important;
  }

  /* ─── 3. Remove ALL filter transitions (filter is GPU-heavy) ─── */
  .ios-home {
    transition: transform .25s ease-out, opacity .25s ease-out !important;
  }

  /* ─── 4. Kill ALL backdrop-filter blurs on mobile ─── */
  .nav-drawer,
  .nav-overlay,
  .search-overlay,
  .m-bar,
  .ios-screen-bar,
  .co-box,
  .co-box-b,
  [class*="overlay"],
  [class*="modal"] {
    -webkit-backdrop-filter: none !important;
    backdrop-filter: none !important;
  }

  /* ─── 5. Force GPU layer on popup screens ─── */
  .ios-screen {
    will-change: transform, opacity;
    contain: layout style;
    transform: translateZ(0);
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
  }

  /* ─── 6. Disable smooth scroll in popups ─── */
  .ios-screen-body {
    scroll-behavior: auto !important;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-y: contain;
  }

  /* ─── 7. Remove grain overlay ─── */
  #grain {
    display: none !important;
  }

  /* ─── 8. Kill desktop-only elements completely ─── */
  #mac,
  .mac-glow,
  .m-bk,
  .m-dock,
  .tf-cursor,
  .m-orb-system,
  .m-centerpiece,
  .tf-nav,
  .tf-corner-bl,
  .tf-corner-br {
    display: none !important;
    visibility: hidden !important;
  }

  /* ─── 9. Kill infinite floatChar animation ─── */
  .i-char img,
  .p-char-img {
    animation: none !important;
  }

  /* ─── 10. Reduce drop-shadows on character in main.css ─── */
  .i-char img {
    filter: drop-shadow(0 0 4px rgba(78, 48, 114, 0.6)) !important;
  }

  /* ─── 11. Remove expensive box-shadows from interactive elements ─── */
  .p-fd-box {
    filter: none !important;
    box-shadow: none !important;
  }

  .p-fd-img {
    filter: none !important;
  }

  /* Re-apply folder color filters without drop-shadow */
  .p-fd-pink {
    filter: url(#c-folder-about) !important;
  }

  .p-fd-blue {
    filter: url(#c-folder-services) !important;
  }

  .p-fd-orange {
    filter: url(#c-folder-portfolio) !important;
  }

  .p-fd-green {
    filter: url(#c-folder-contact) !important;
  }

  /* ─── 12. Simplify ALL transitions on mobile ─── */
  .p-fd-box {
    transition: transform .15s ease-out !important;
  }

  .p-cta-btn {
    transition: transform .1s ease-out !important;
    box-shadow: none !important;
  }

  .p-soc-icon {
    transition: transform .1s ease-out !important;
    box-shadow: none !important;
  }

  /* ─── 13. CSS Containment on main sections ─── */
  #ios {
    contain: layout style;
  }

  .ios-home {
    contain: layout style paint;
  }

  /* ─── 14. Reduce nav drawer complexity ─── */
  .nav-drawer {
    transition: transform .25s ease-out !important;
    box-shadow: none !important;
  }

  .nav-overlay {
    transition: opacity .2s ease-out !important;
  }

  /* ─── 15. Remove transition on all 'transition: all' elements ─── */
  .btn-p,
  .ua,
  .faq-q,
  .svc-tab,
  .co-tab {
    transition: background .15s ease-out, color .15s ease-out !important;
  }

  /* ─── 16. Ultra-fast reveal animations — opacity only, no transform ─── */
  .rv,
  .rv-fade,
  .rv-snpl,
  .rv-zoom {
    transform: none !important;
    transition: opacity .25s ease-out !important;
  }

  .rv.vis,
  .rv-fade.vis,
  .rv-snpl.vis,
  .rv-zoom.vis {
    opacity: 1;
    transform: none !important;
  }

  /* ─── 17. Kill ALL infinite CSS animations ─── */
  .mac-env,
  .mac-glow,
  .m-hero,
  .m-hero img,
  .i-char,
  .i-char img,
  .m-fd,
  .m-orb-system,
  [class*="float"],
  [class*="pulse"],
  .stage-seg.active,
  .notif-dot {
    animation: none !important;
  }
}

.p-cta-btn:active {
  transform: translateX(-50%) scale(0.95);
}

/* ─── Social bar ─── */
.p-soc-bar {
  position: absolute;
  bottom: 11vh;
  bottom: max(11dvh, calc(env(safe-area-inset-bottom, 0px) + 25px));
  left: 0;
  right: 0;
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  z-index: 25;
}

.p-soc-icon {
  color: #0f0f0f !important;
  background: #000 !important;
  width: 25px !important;
  height: 25px !important;
  border-radius: 50% !important;
  display: flex !important;
  justify-content: center !important;
  align-items: center !important;
  font-size: 11px !important;
  text-decoration: none !important;
  transition: transform 0.2s ease !important;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.35) !important;
}

.p-soc-icon:active {
  transform: scale(0.9) !important;
}

/* ═══ MOBILE MEDIA QUERIES ═══ */

/* ─── Very small phones (≤380px) ─── */
@media (max-width: 380px) {
  .p-header {
    top: max(2dvh, env(safe-area-inset-top, 14px)) !important;
  }

  .p-header svg {
    width: 16px !important;
    height: 12px !important;
  }

  .p-logo-img {
    width: 110px !important;
  }

  .p-title-sec {
    top: 11dvh !important;
  }

  .p-title {
    font-size: 14px !important;
    font-weight: 800 !important;
    letter-spacing: 0 !important;
  }

  .p-subtitle {
    font-size: 8px !important;
    letter-spacing: 0.2px !important;
    margin-top: 4px !important;
  }

  .p-char-wrap {
    top: 21dvh !important;
    bottom: auto !important;
    height: 57dvh !important;
    overflow: visible !important;
    align-items: flex-start !important;
  }

  .p-char-wrap picture {
    height: 100% !important;
    display: flex !important;
    justify-content: center !important;
  }

  .p-char-img {
    height: 100% !important;
    width: auto !important;
    max-width: 58vw !important;
    object-fit: contain !important;
  }

  .p-fd-box {
    width: 64px !important;
  }

  .p-fd-box .fd-text {
    font-size: 8.5px !important;
    font-weight: 800 !important;
    top: 60% !important;
  }

  .p-fd-tl {
    top: 25dvh !important;
    left: 5vw !important;
  }

  .p-fd-tr {
    top: 23dvh !important;
    right: 5vw !important;
  }

  .p-fd-bl {
    top: 52dvh !important;
    left: 5vw !important;
  }

  .p-fd-br {
    top: 50dvh !important;
    right: 5vw !important;
  }

  .p-cta-btn {
    bottom: calc(env(safe-area-inset-bottom, 0px) + 9dvh) !important;
    font-size: 10px !important;
    padding: 7px 15px !important;
    box-shadow: none !important;
  }

  .p-soc-bar {
    bottom: calc(env(safe-area-inset-bottom, 0px) + 3.5dvh) !important;
    gap: 8px !important;
  }

  .p-soc-icon {
    width: 21px !important;
    height: 21px !important;
    font-size: 10px !important;
    background: #000 !important;
    color: #000000 !important;
    border: none !important;
    box-shadow: none !important;
  }
}

/* ─── iPhone 16 Pro / 15 Pro / 14 Pro (385–419px) ─── */
@media (min-width: 385px) and (max-width: 419px) {
  .p-header {
    top: max(2.5dvh, env(safe-area-inset-top, 18px)) !important;
  }

  .p-header svg {
    width: 18px !important;
    height: 14px !important;
  }

  .p-char-wrap {
    top: 20dvh !important;
    bottom: auto !important;
    height: 63dvh !important;
    overflow: visible !important;
    align-items: flex-start !important;
  }

  .p-char-wrap picture {
    height: 100% !important;
    display: flex !important;
    justify-content: center !important;
  }

  .p-char-img {
    height: 100% !important;
    width: auto !important;
    max-width: 55vw !important;
    object-fit: contain !important;
  }

  .p-title-sec {
    top: 12dvh !important;
  }

  .p-title {
    font-size: 17px !important;
    font-weight: 800 !important;
    letter-spacing: 0 !important;
  }

  .p-subtitle {
    font-size: 9.5px !important;
    letter-spacing: 0.2px !important;
    margin-top: 5px !important;
  }

  .p-fd-box {
    width: 76px !important;
  }

  .p-fd-box .fd-text {
    font-size: 10.5px !important;
    font-weight: 800 !important;
    top: 60% !important;
  }

  .p-logo-img {
    width: 140px !important;
  }

  .p-fd-tl {
    top: 27dvh !important;
    left: 7vw !important;
  }

  .p-fd-tr {
    top: 25dvh !important;
    right: 7vw !important;
  }

  .p-fd-bl {
    top: 54dvh !important;
    left: 7vw !important;
  }

  .p-fd-br {
    top: 53dvh !important;
    right: 2.5vw !important;
  }

  .p-cta-btn {
    bottom: calc(env(safe-area-inset-bottom, 0px) + 9dvh) !important;
    font-size: 11px !important;
    padding: 9px 18px !important;
    box-shadow: none !important;
  }

  .p-soc-bar {
    bottom: calc(env(safe-area-inset-bottom, 0px) + 3.5dvh) !important;
    gap: 10px !important;
  }

  .p-soc-icon {
    width: 24px !important;
    height: 24px !important;
    font-size: 13px !important;
    background: #000 !important;
    color: #000000 !important;
    border: none !important;
    box-shadow: none !important;
  }
}

/* ─── iPhone Pro Max / large phones (420–479px) ─── */
@media (min-width: 420px) and (max-width: 479px) {
  .p-header {
    top: max(2.5dvh, env(safe-area-inset-top, 20px)) !important;
  }

  .p-header svg {
    width: 20px !important;
    height: 15px !important;
  }

  .p-logo-img {
    width: 155px !important;
  }

  .p-title-sec {
    top: 12dvh !important;
  }

  .p-title {
    font-size: 19px !important;
    font-weight: 800 !important;
    letter-spacing: 0 !important;
  }

  .p-subtitle {
    font-size: 10.5px !important;
    letter-spacing: 0.2px !important;
    margin-top: 5px !important;
  }

  .p-char-wrap {
    top: 23dvh !important;
    bottom: auto !important;
    height: 59dvh !important;
    overflow: visible !important;
    align-items: flex-start !important;
  }

  .p-char-wrap picture {
    height: 100% !important;
    display: flex !important;
    justify-content: center !important;
  }

  .p-char-img {
    height: 100% !important;
    width: auto !important;
    max-width: 52vw !important;
    object-fit: contain !important;
  }

  .p-fd-box {
    width: 84px !important;
  }

  .p-fd-box .fd-text {
    font-size: 11.5px !important;
    font-weight: 800 !important;
    top: 60% !important;
    white-space: nowrap;
    overflow: hidden;
  }

  .p-fd-tl {
    top: 27dvh !important;
    left: 7vw !important;
  }

  .p-fd-tr {
    top: 25dvh !important;
    right: 7vw !important;
  }

  .p-fd-bl {
    top: 54dvh !important;
    left: 7vw !important;
  }

  .p-fd-br {
    top: 52dvh !important;
    right: 7vw !important;
  }

  .p-cta-btn {
    bottom: calc(env(safe-area-inset-bottom, 0px) + 9dvh) !important;
    font-size: 12px !important;
    padding: 9px 20px !important;
    box-shadow: none !important;
  }

  .p-soc-bar {
    bottom: calc(env(safe-area-inset-bottom, 0px) + 3.5dvh) !important;
    gap: 11px !important;
  }

  .p-soc-icon {
    width: 26px !important;
    height: 26px !important;
    font-size: 13px !important;
    background: #000 !important;
    color: #000000 !important;
    border: none !important;
    box-shadow: none !important;
  }
}

/* ─── Small tablets / very large phones (480–599px) ─── */
@media (min-width: 480px) and (max-width: 599px) {
  .p-header {
    top: max(2.5dvh, env(safe-area-inset-top, 22px)) !important;
  }

  .p-header svg {
    width: 22px !important;
    height: 16px !important;
  }

  .p-logo-img {
    width: 170px !important;
  }

  .p-title-sec {
    top: 12dvh !important;
  }

  .p-title {
    font-size: 22px !important;
    font-weight: 800 !important;
    letter-spacing: 0 !important;
  }

  .p-subtitle {
    font-size: 12px !important;
    letter-spacing: 0.3px !important;
    margin-top: 6px !important;
  }

  .p-char-wrap {
    top: 22dvh !important;
    bottom: auto !important;
    height: 60dvh !important;
    overflow: visible !important;
    align-items: flex-start !important;
  }

  .p-char-wrap picture {
    height: 100% !important;
    display: flex !important;
    justify-content: center !important;
  }

  .p-char-img {
    height: 100% !important;
    width: auto !important;
    max-width: 45vw !important;
    object-fit: contain !important;
  }

  .p-fd-box {
    width: 92px !important;
  }

  .p-fd-box .fd-text {
    font-size: 12.5px !important;
    font-weight: 800 !important;
    top: 60% !important;
    white-space: nowrap;
    overflow: hidden;
  }

  .p-fd-tl {
    top: 27dvh !important;
    left: 8vw !important;
  }

  .p-fd-tr {
    top: 25dvh !important;
    right: 8vw !important;
  }

  .p-fd-bl {
    top: 54dvh !important;
    left: 8vw !important;
  }

  .p-fd-br {
    top: 52dvh !important;
    right: 8vw !important;
  }

  .p-cta-btn {
    bottom: calc(env(safe-area-inset-bottom, 0px) + 9dvh) !important;
    font-size: 13px !important;
    padding: 10px 22px !important;
    box-shadow: none !important;
  }

  .p-soc-bar {
    bottom: calc(env(safe-area-inset-bottom, 0px) + 3.5dvh) !important;
    gap: 13px !important;
  }

  .p-soc-icon {
    width: 28px !important;
    height: 28px !important;
    font-size: 14px !important;
    background: #000 !important;
    color: #000000 !important;
    border: none !important;
    box-shadow: none !important;
  }
}