/* ==========================================================================
   Polish pass: spacing rhythm, motion quality and touch feel.
   No change to the look or to any font size. Loaded last.
   ========================================================================== */

/* ---------- 1. One spacing rhythm ---------- */
:root {
  --sec: clamp(4rem, 6.4vw, 7rem);        /* vertical padding of every main section: 64px on phones, up to 112px */
  --head-gap: clamp(2.2rem, 4vw, 4.5rem); /* gap between a section's heading row and its content */
}
.services, .portfolio, .process, .track, .voices { padding-top: var(--sec); padding-bottom: var(--sec); }
.services__head, .voices__head { margin-bottom: var(--head-gap); }
.portfolio__list { margin-top: var(--head-gap); }
.process__grid { margin-top: var(--head-gap); }
/* the stats panel is a screen-sized moment, but it should not leave a large empty band underneath */
.track { min-height: clamp(34rem, 80svh, 58rem); }

/* ---------- 2. Motion that tracks your input 1:1 (no second layer of easing on scroll-driven fades) ---------- */
.about__text .w { transition: none; }
.row, .quote { transition: none; }

/* ---------- 3. Hover motion on the compositor (transform) instead of layout (padding) ---------- */
.pf { transition: color .3s; }
.pf:hover { padding-left: 0; }
.pf__n, .pf__t { transition: transform .5s var(--ease); }
.pf:hover .pf__n, .pf:hover .pf__t { transform: translateX(1.2rem); }

.menu__list a { transition: transform .8s var(--ease), opacity .8s var(--ease); }
.menu__list a:hover { padding-left: 0; }
.menu.is-open .menu__list a:hover { transform: translateX(1.2rem); transition-duration: .45s, .8s; }

.ft__col ul a { transition: color .2s, transform .35s var(--ease); }
.ft__col ul a:hover { padding-left: 0; transform: translateX(4px); }

/* ---------- 4. Immediate press feedback and no tap delay ---------- */
a, button, .pcard__btn, .chip { -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
.btn { transition: transform .25s var(--ease); }
.btn:active { transform: scale(.97); transition-duration: .1s; }
.nav__menu:active, .menu__foot button:active, .menu__wa:active, .rail-ctl button:active { transform: scale(.94); transition-duration: .1s; }
.pcard__btn { transition: transform .25s var(--ease); }
.pcard__btn:active { transform: scale(.985); transition-duration: .1s; }
.ft__c:active, .row:active, .pf:active { opacity: .7; }
.ft__c { transition-property: opacity, background; }

/* ---------- 5. No sticky hover on touch screens ---------- */
@media (hover: none) {
  .row:hover .row__t { transform: none; }
  .row:hover .row__tags li, .row:hover .row__tags li:hover { border-color: var(--line); background: transparent; color: inherit; }
  .pf:hover .pf__n, .pf:hover .pf__t { transform: none; }
  .portfolio__list:hover .pf:not(:hover) { color: inherit; }
  .pcard__btn:hover .pcard__img img, .step:hover figure img, .why__card:hover .why__img img { transform: none; }
  .pcard__btn:hover .pcard__view { opacity: 0; transform: translateY(8px); }
  .btn:hover b, .btn:hover i { transform: none; }
  .btn:hover .icon, .works__all:hover .circ { transform: none; }
  .ft__col ul a:hover { transform: none; color: inherit; }
  .ft__c:hover .ft__cv span { opacity: 1; transform: none; }
  .chip:hover { border-color: var(--line); }
  .chip.is-on:hover { border-color: var(--chip-bg); }
  .wa:hover { transform: none; }
  .nav__menu:hover span:first-child { width: 26px; }
}

/* ---------- 6. Reduced motion: the reveal animations that were not covered ---------- */
@media (prefers-reduced-motion: reduce) {
  .step, .process__grid .vl, .process__grid::before, .bar div { transition: none; }
  .process__grid.is-in .step { opacity: 1; transform: none; }
  .step { opacity: 1; transform: none; }
  .process__grid .vl { transform: none; }
  .bar div { transform: none; }
  .hui__bars button.is-on b { animation: none; transform: scaleX(1); }
  .pf__n, .pf__t, .ft__col ul a { transition: none; }
}

/* ---------- 7. Menu: round focus ring, theme-aware bar while open, tidy contact block ---------- */
.nav__menu:focus-visible, .theme-toggle:focus-visible { outline: 1px solid var(--nav-ink); outline-offset: 3px; border-radius: 999px; }
.nav__menu:focus:not(:focus-visible) { outline: none; }
/* the bar above the open menu always uses the theme colours (so the X is visible in dark and light) */
.nav.is-menu { --nav-ink: var(--ink); color: var(--ink); }
[data-theme="light"] .nav.is-menu .nav__logo img { filter: brightness(.25) sepia(.4); }
.menu__links { display: flex; flex-wrap: wrap; gap: .4rem 1.4rem; color: var(--muted); }
.menu__links a { transition: color .25s; }
.menu__links a:hover { color: var(--ink); }

@media (max-width: 900px) {
  /* links at the top, WhatsApp and contact anchored to the bottom, nothing floating in the middle */
  .menu { display: flex; flex-direction: column; justify-content: space-between; gap: 2rem; padding: calc(max(16px, env(safe-area-inset-top)) + 84px) var(--pad) max(28px, calc(env(safe-area-inset-bottom) + 18px)); overflow-y: auto; }
  .menu__list a { padding: .16em 0; }
  .menu__foot { display: grid; gap: 1.1rem; margin-top: 0; justify-items: stretch; }
  .menu__wa { justify-content: center; width: 100%; height: 56px; padding: 0 1.3rem; font-size: 1.05rem; }
  .menu__links { justify-content: space-between; font-size: 1rem; }
  .menu__foot button { justify-self: start; }
}

/* ---------- 8. iPhone / Safari: pinned sections ---------- */
/* overflow-x:hidden on the page breaks position:sticky in Safari (About, Portfolio and the closing section stop pinning).
   clip hides sideways overflow without making the page a scroll container. Nothing on the page overflows sideways anyway. */
html, body { overflow-x: clip; }
/* big blurred layers are expensive on phones, so blur them less */
@media (max-width: 700px) {
  .orb { filter: blur(22px); }
  .cone { filter: blur(14px); }
}

/* the JavaScript pinning fallback (only used when the browser's own sticky positioning fails) */
html.pin-js .about, html.pin-js .works, html.pin-js .cta { position: relative; }
html.pin-js .about__stick, html.pin-js .works__stick, html.pin-js .cta__stick { position: absolute; top: 0; left: 0; right: 0; width: 100%; }
html.pin-js .pj-fixed { position: fixed; top: 0; }
html.pin-js .pj-end { position: absolute; top: auto; bottom: 0; }

/* ---------- 9. Arrows are drawn, never characters (iPhones turn some arrow characters into emoji) ---------- */
.btn i .arr, .pf__a .arr { font-size: 1.1em; display: block; }
.ft__cv span .arr { display: block; }
.ft__cv span { display: inline-flex; align-items: center; }

/* "View full portfolio": original look (text + round arrow button); only the arrow size is set here */
.works__all .circ .arr { width: 1.35rem; height: 1.35rem; display: block; }

/* ---------- 10. Phones and tablets: clearer separation between the lower sections ---------- */
@media (max-width: 900px) {
  :root { --sec: clamp(6rem, 22vw, 8rem); --head-gap: clamp(2.6rem, 9vw, 3.6rem); }
  .portfolio, .process, .track, .voices { position: relative; }
  /* a short hairline, inset to the page margin, marks where each section starts */
  .portfolio::before, .process::before, .track::before, .voices::before { content: ""; position: absolute; top: 0; left: var(--pad); right: var(--pad); height: 1px; background: var(--line); }
  .track { min-height: 0; }
}

/* ---------- 11. Header on tablets and desktops: the same backdrop-on-scroll as phones, so it never sits on top of text ---------- */
@media (min-width: 901px) {
  .nav { transition: color .4s, transform .5s var(--ease), background .4s, backdrop-filter .4s; }
  .nav.is-bg { background: color-mix(in srgb, var(--bg) 82%, transparent); -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px); border-bottom: 1px solid var(--line); }
  .nav.is-media.is-bg { background: rgba(15, 15, 15, .66); border-bottom-color: rgba(243, 241, 236, .14); }
  .nav.is-hide { transform: translateY(-110%); }
  .nav.is-menu.is-bg { background: transparent; -webkit-backdrop-filter: none; backdrop-filter: none; border-bottom-color: transparent; }
}

/* ---------- 12. Very narrow screens (folded foldables, small phones) ---------- */
@media (max-width: 360px) {
  .ft__bar { grid-template-columns: 1fr; grid-template-areas: "social" "top" "copy"; }
  .ft__bar .social { flex-wrap: wrap; }
  .ft__bar .social a { width: 40px; height: 40px; }
  .ft__top { justify-self: start; }
}
@media (max-width: 700px) {
  .map { aspect-ratio: auto; min-height: 0; height: clamp(230px, 62vw, 340px); }
}

/* ---------- 13. Tablets and foldables: the track-record bars fill the row ---------- */
@media (min-width: 561px) and (max-width: 900px) {
  .bars { gap: 12px; }
  .bar { width: auto; flex: 1 1 0; min-width: 0; }
}

/* ---------- 14. Menu: sized by the screen's height as well as its width, so it fits short windows, big monitors and landscape phones ---------- */
.menu { overflow-y: auto; overscroll-behavior: contain; padding-top: clamp(84px, 13vh, 140px); padding-bottom: max(24px, calc(env(safe-area-inset-bottom) + 14px)); }
.menu__list a { font-size: clamp(1.7rem, min(7vw, 8.4vh), 7rem); }
@media (min-width: 901px) {
  .menu { display: flex; flex-direction: column; justify-content: flex-start; }
  .menu__list { margin-top: auto; }
  .menu__foot { margin-top: clamp(1rem, 3vh, 2.4rem); margin-bottom: auto; }
}
@media (max-width: 900px) {
  .menu__list a { font-size: clamp(1.7rem, min(11vw, 7.6vh), 3.6rem); }
}
@media (max-height: 520px) {
  .menu { padding-top: 72px; }
  .menu__list a { padding: .06em 0; }
  .menu__wa { height: 46px; }
}

/* ---------- 15. Performance: animations rest while their section is off-screen ---------- */
.orb.is-off i, .cone.is-off i, .hperson.is-off img { animation-play-state: paused; }
