/* ==========================================================
   Amerwebsite — phone & tablet tuning (loaded last)
   ========================================================== */

.menu-cta, .swipe-dots { display: none; }
.strip li.clone { display: none; }
.swipe-track { display: contents; }
@keyframes chipLoop { to { transform: translateX(-50%); } }

/* ---------- Menu (tablet + phone): smooth dropdown card ---------- */
@media (max-width: 860px) {
  .nav-links,
  .nav.open .nav-links {
    display: flex; flex-direction: column; gap: 2px;
    position: absolute; top: 72px; left: 12px; right: 12px;
    padding: 10px; background: var(--surface);
    border: 1px solid var(--line); border-radius: 22px; box-shadow: var(--shadow-lg);
    opacity: 0; visibility: hidden; transform: translateY(-8px) scale(.98); transform-origin: top center;
    transition: opacity .22s ease, transform .35s var(--smooth), visibility 0s .35s;
  }
  .nav.open .nav-links { opacity: 1; visibility: visible; transform: none; transition-delay: 0s; }
  .nav-links a,
  .nav.open .nav-links a {
    padding: 14px 16px; font-size: 17px; font-weight: 600; color: var(--ink);
    border: 0; border-radius: 14px;
  }
  .nav.open .nav-links a:hover, .nav.open .nav-links a:active { background: var(--soft); }
  .nav-links a.active,
  .nav.open .nav-links a.active { background: var(--ink); color: #fff; }
  .nav-links .menu-cta {
    display: flex; align-items: center; justify-content: center; gap: 8px; margin-top: 8px;
    background: var(--ink); color: #fff !important; height: 52px; border-radius: 999px !important;
  }
  .nav-links .menu-cta svg { width: 18px; height: 18px; }
  .nav.open { background: var(--bg); }
}

/* ---------- Phone ---------- */
@media (max-width: 680px) {
  .hide-phone { display: none !important; }

  .section { padding: 64px 0; }
  .section-head { margin-bottom: 28px; }
  .h2 { font-size: 30px; }
  .lead { font-size: 16px; }

  /* Hero */
  .hero { padding: 108px 0 44px; }
  .hero h1 { font-size: 40px; }
  .hero .lead { font-size: 16.5px; margin-top: 16px; }
  .hero-actions { margin-top: 26px; }
  .hero-actions .btn { flex: 1 1 auto; }
  .hero-meta { gap: 14px 18px; margin-top: 28px; }
  .hero-meta div { font-size: 13px; }
  .hero-grid { gap: 36px; }
  .show-tabs { margin-top: 16px; }

  /* Industry chips → one swipeable line */
  .strip { padding-top: 8px; }
  .strip-inner { padding-top: 24px; gap: 14px; flex-direction: column; align-items: flex-start; }
  .chip-loop {
    width: calc(100% + 36px); margin: 0 -18px; overflow: hidden; padding: 6px 0 10px;
    -webkit-mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
            mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
  }
  .strip .chip-loop ul {
    flex-wrap: nowrap; width: max-content; gap: 10px; padding-left: 10px;
    animation: chipLoop 24s linear infinite;
  }
  .strip .chip-loop:active ul { animation-play-state: paused; }
  .strip li { flex: none; }
  .strip li.clone { display: inline-flex; }
  /* border glow keeps running on the moving row; the copies follow the same timing */
  .strip li:nth-child(7)::before  { animation-delay: 0s, 0s; }   .strip li:nth-child(7)::after,  .strip li:nth-child(7) svg  { animation-delay: 0s; }
  .strip li:nth-child(8)::before  { animation-delay: 0s, 1.5s; } .strip li:nth-child(8)::after,  .strip li:nth-child(8) svg  { animation-delay: 1.5s; }
  .strip li:nth-child(9)::before  { animation-delay: 0s, 3s; }   .strip li:nth-child(9)::after,  .strip li:nth-child(9) svg  { animation-delay: 3s; }
  .strip li:nth-child(10)::before { animation-delay: 0s, 4.5s; } .strip li:nth-child(10)::after, .strip li:nth-child(10) svg { animation-delay: 4.5s; }
  .strip li:nth-child(11)::before { animation-delay: 0s, 6s; }   .strip li:nth-child(11)::after, .strip li:nth-child(11) svg { animation-delay: 6s; }
  .strip li:nth-child(12)::before { animation-delay: 0s, 7.5s; } .strip li:nth-child(12)::after, .strip li:nth-child(12) svg { animation-delay: 7.5s; }
  .chip-loop { padding: 10px 0 14px; }

  /* How it works → hidden on phone */
  #process { display: none; }

  /* Services + Work → swipe carousels (track moved by JS with a GPU transform) */
  .services-grid,
  .work-grid {
    display: block; overflow: hidden;
    margin: 0 -18px; padding: 10px 18px 26px;
    touch-action: pan-y;            /* up/down = page scroll, sideways = carousel */
    user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
  }
  .swipe-track {
    display: flex; gap: 14px; will-change: transform;
    transform: translate3d(0, 0, 0); backface-visibility: hidden;
  }
  .swipe-track > .card,
  .swipe-track > .work { flex: 0 0 84%; min-width: 0; }
  .services-grid img, .work-grid img { -webkit-user-drag: none; pointer-events: none; }
  .services-grid .card:last-child { grid-column: auto; }
  .card { padding: 24px; }
  .services-grid .card:not(.featured) {
    position: relative; isolation: isolate; border-color: transparent;
    box-shadow: 0 0 0 1px rgba(47,91,255,.10), 0 10px 28px rgba(47,91,255,.14);
  }
  .services-grid .card:not(.featured)::before {
    content: ""; position: absolute; inset: -1px; border-radius: inherit; padding: 2px; z-index: 2; pointer-events: none;
    background: conic-gradient(from var(--cang), rgba(47,91,255,.15) 0 30%, #2f5bff 62%, #9be22d 82%, rgba(47,91,255,.15) 100%);
    -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
    -webkit-mask-composite: xor;
            mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
    animation: chipSpin 3.2s linear infinite;
  }
  .services-grid .card:nth-child(3)::before { animation-delay: -1.6s; }
  .card-icon { margin-bottom: 20px; }
  .card ul { margin-top: 18px; padding-top: 18px; gap: 10px; }
  .work .work-art, .work.wide .work-art { aspect-ratio: 16 / 11; padding: 20px; }
  .card:hover, .work:hover { transform: none; }

  .swipe-dots { display: flex; align-items: center; justify-content: center; gap: 14px; margin-top: 8px; }
  .sw-marks { display: flex; align-items: center; gap: 4px; }
  .sw-dot {
    width: 22px; height: 22px; padding: 0; border: 0; background: none; cursor: pointer;
    display: grid; place-items: center;
  }
  .sw-dot::before {
    content: ""; width: 7px; height: 7px; border-radius: 999px; background: #d3d5da;
    transition: width .35s var(--smooth), background .3s;
  }
  .sw-dot.on::before { width: 22px; background: var(--ink); }
  .sw-btn {
    width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface);
    display: grid; place-items: center; cursor: pointer; color: var(--ink);
    transition: opacity .25s, background .2s;
  }
  .sw-btn svg { width: 16px; height: 16px; }
  .sw-prev svg { transform: rotate(180deg); }
  .sw-btn:active { background: var(--soft); }
  .sw-btn:disabled { opacity: .3; }

  /* About / Our story → hidden on phone (Our team stays) */
  #about { display: none; }
  #team { padding-top: 8px !important; }
  /* About: logo circle card hidden on phone */
  .about-visual { display: none; }
  .signoff { flex-direction: column; align-items: flex-start; gap: 10px; }
  .signoff b { font-size: 15px; line-height: 1.35; }
  .signoff small { margin-top: 2px; }
  .about-chip { display: none; }
  .about-grid { gap: 32px; }
  .about-visual { aspect-ratio: auto; height: 250px; border-radius: 26px; }
  .orbit { width: 220px; margin-top: -18px; }
  .about-caption { bottom: 16px; font-size: 13px; }
  .core .logo-mark, .core::before, .core::after { width: 58px; height: 58px; border-radius: 18px; }
  .planet { width: 38px; height: 38px; margin: -19px 0 0 -19px; border-radius: 12px; }
  .planet svg { width: 17px; height: 17px; }
  .story p { font-size: 15.5px; }
  .values { gap: 10px; margin-top: 24px; }
  .value { padding: 14px 16px; }
  .v-ic { width: 38px; height: 38px; }

  /* Why us → compact 2 × 2 */
  .why { gap: 28px; }
  .why-list { grid-template-columns: 1fr 1fr; gap: 10px; }
  .why-item { padding: 16px; }
  .why-item svg { margin-bottom: 10px; width: 22px; height: 22px; }
  .why-item h4 { font-size: 15px; }
  .why-item p { font-size: 13px; }

  /* FAQ */
  .faq summary { font-size: 16px; padding: 18px 0; }
  .faq .ans { padding: 0 0 18px; font-size: 15px; }

  /* Contact */
  .contact-wrap { gap: 28px; }
  .contact-points { margin-top: 24px; gap: 12px; }

  /* Footer: link columns side by side, small watermark behind the text */
  .footer { padding-top: 72px; }
  .footer-top { gap: 30px; padding-bottom: 30px; }
  .footer-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
  .footer-bottom { flex-direction: column-reverse; align-items: flex-start; gap: 16px; }
  .footer-watermark {
    display: block; width: 300px; height: 180px; bottom: auto; top: 140px; opacity: .05;
  }

  /* Projects page */
  .p-filters { flex-wrap: nowrap; overflow-x: auto; margin: 28px -18px 0; padding: 4px 18px 8px; scrollbar-width: none; }
  .p-filters::-webkit-scrollbar { display: none; }
  .p-filter { flex: none; }
}

/* ---------- Phone: smaller hero chips so the animation behind stays visible ---------- */
@media (max-width: 680px) {
  .show .float {
    padding: 5px 10px 5px 5px; border-radius: 10px; font-size: 11px; line-height: 1.25;
    box-shadow: 0 4px 14px rgba(15,17,21,.10);
  }
  .show .fi { gap: 6px; }
  .show .float .ic { width: 22px; height: 22px; border-radius: 7px; }
  .show .float .ic svg { width: 12px; height: 12px; }
  .show .float small { display: none; }        /* one short line only */
  .show .float-1 { left: -4px; bottom: 74px; }
  .show .float-2 { right: -4px; top: 52px; }
}


/* ==========================================================
   Phone performance: keep the look, use only effects phones run smoothly
   (no per-frame repaints: no animated gradients / custom-property spins /
    blur filters; only transform + opacity animations remain)
   ========================================================== */
@media (max-width: 680px), (hover: none) and (pointer: coarse) {
  /* glass-blur menu bar → solid */
  .nav.scrolled { -webkit-backdrop-filter: none; backdrop-filter: none; background: rgba(250,250,248,.97); }

  /* headline word: static gradient, no blur in the word change */
  .rotator span, .rotator span.in, .rotator span.out { animation-name: none; background-position: 0 center; }
  .rotator span.out { animation: wordOutLite .3s ease forwards; }
  .rotator span.in  { animation: wordInLite .4s ease both; }

  /* big drifting background blob → still */
  .hero::before { animation: none; }
  .pill i::after { animation: none; }

  /* featured service card: still gradient border instead of a spinning one */
  .card.featured::before { animation: none; --ang: 210deg; }
  .card.featured .card-icon { animation: none; box-shadow: 0 0 0 6px rgba(200,244,90,.12); }

  /* other service cards: still gradient border + soft glow */
  .services-grid .card:not(.featured)::before { animation: none; --cang: 200deg; }

  /* industry chips: border glow passes chip to chip by fading (cheap), no spinning */
  .strip li::before { animation: chipGlow 9s ease-in-out infinite; --cang: 200deg; }
  .strip li:nth-child(1)::before, .strip li:nth-child(7)::before  { animation-delay: 0s; }
  .strip li:nth-child(2)::before, .strip li:nth-child(8)::before  { animation-delay: 1.5s; }
  .strip li:nth-child(3)::before, .strip li:nth-child(9)::before  { animation-delay: 3s; }
  .strip li:nth-child(4)::before, .strip li:nth-child(10)::before { animation-delay: 4.5s; }
  .strip li:nth-child(5)::before, .strip li:nth-child(11)::before { animation-delay: 6s; }
  .strip li:nth-child(6)::before, .strip li:nth-child(12)::before { animation-delay: 7.5s; }

  /* team photos: still gradient ring */
  .avatar::before { animation: none; opacity: .55; --tang: 200deg; }

  /* lighter shadows (cheaper to draw while scrolling) */
  .card, .work, .member, .why-item, .value { box-shadow: none; }
  .services-grid .card:not(.featured) { box-shadow: 0 0 0 1px rgba(47,91,255,.12), 0 6px 16px rgba(47,91,255,.10); }
}
@keyframes wordOutLite { to { opacity: 0; transform: translateY(-35%); } }
@keyframes wordInLite  { from { opacity: 0; transform: translateY(35%); } }
