/* ============================================================
   Estudio Malacara — WEB layer (mobile / tablet portrait)
   Loaded AFTER shell.css on the website clone only. Desktop (>820px) is untouched:
   the 16:9 stage + cqw/cqh layout stays exactly as in the deck. Below 820px the stage
   stops being a scaled 16:9 canvas and becomes a real portrait page that reflows.
   Convention: one block per slide template, scoped by the template's own class.
   ============================================================ */
@media (max-width:820px){

  /* no "rotate your phone" gate on the website */
  .rotate-hint{display:none!important}

  /* stage = the viewport, not a letterboxed 16:9 box. cqw = vw, cqh = svh inside it. */
  .stage{aspect-ratio:auto;width:100vw;height:100svh}

  /* ---------- header rail: 3 items, real tap-size type ---------- */
  .rail{top:max(env(safe-area-inset-top,0px),18px);height:auto;left:20px;right:20px;
    height:14px;font-size:11px;letter-spacing:-.01em}
  .rail .ri{position:relative;left:auto!important;right:auto!important}
  .rail .ri-mark{position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);width:22px}

  /* ---------- pillnav: keep "01 / 101" on one line ---------- */
  .pillnav{width:max-content;max-width:calc(100vw - 24px)}
  .pillnav .count{white-space:nowrap}

  /* ---------- COVER ---------- */
  /* wordmark hugs the header; city list sits 28px under it; dog is centred in the space left
     between the list and the pillnav */
  .cover{--wm-top:60px;--wm-h:calc((100vw - 32px) * .205);--meta-h:88px;
    --dw:min(62vw,360px,calc((100svh - 330px) / 1.571));
    --free-top:calc(var(--wm-top) + var(--wm-h) + 28px + var(--meta-h));--free-bot:calc(100svh - 92px)}
  .cover .cv-wm{left:16px;width:calc(100vw - 32px);top:var(--wm-top)}
  .cover .cv-meta{left:20px;top:calc(var(--wm-top) + var(--wm-h) + 28px);height:auto;
    font-size:15px;line-height:1.2;justify-content:flex-start}
  .cover .cv-dog{right:auto;bottom:auto;width:var(--dw);left:calc(50% - var(--dw) / 2);
    top:calc((var(--free-top) + var(--free-bot)) / 2 - var(--dw) * .7855)}

  /* ---------- THIS WE ARE / THIS WE DO ----------
     Absolute cqw layout → normal column flow: pill, headline, copy; dog is a fixed-height
     figure anchored bottom-right under the text (never covers it). */
  .diag .stage{display:flex;flex-direction:column;align-items:flex-start;
    padding:68px 20px calc(92px + 30svh);overflow:hidden}
  .diag .dg-pill,.diag .dg-head,.diag .dg-copy{position:static;width:auto}
  .diag .dg-pill{order:-1;margin-top:18px;font-size:12px;padding:5px 12px}
  .diag .dg-head{margin-top:16px;font-size:clamp(22px,7.6vw,34px);line-height:.95}
  .diag .dg-copy{margin-top:20px;font-size:15px;line-height:1.38}
  .diag .dg-copy .em{margin-top:12px}
  .diag .dg-dog,.diag.inv .dg-dog{right:4vw;bottom:92px;height:30svh;width:auto}

  /* ---------- CLIENTS: logo wall ----------
     8 logos per row is unreadable at phone width. Stage becomes a vertical scroller, the wall a
     3-column grid (many more rows), logos scaled up ~2.3x keeping each logo's own tuned
     height ratio (zoom, so the per-logo cqh rules above still apply proportionally). */
  .clients .stage{display:block;overflow-y:auto;overflow-x:hidden;overscroll-behavior:contain;
    -webkit-overflow-scrolling:touch;scrollbar-width:none}
  .clients .stage::-webkit-scrollbar{display:none}
  .cx-head{position:static;margin:76px 20px 0;font-size:clamp(20px,6.4vw,28px)}
  .cx-body{position:static;display:block;padding:28px 12px calc(110px + env(safe-area-inset-bottom,0px))}
  .cx-tag{font-size:12px;padding:5px 12px}
  .cx-tag--active{margin:0 8px 14px}
  .cx-tag--past{margin:44px 8px 14px}
  .cx-grid{display:grid;grid-template-columns:repeat(3,1fr);gap:0;width:100%}
  .cx-grid--active,.cx-grid--past{row-gap:0}
  .cx-row-break{display:none}
  .cx-item{flex:none;height:84px;padding:8px;border-radius:10px}
  .cx-logo{zoom:1.7;max-width:100%}
  .cx-item img{max-width:94%}
  /* logos that read too heavy next to their neighbours at the shared zoom — ~25% smaller */
  .cx-item:has(img[alt="ILSB"]) .cx-logo,
  .cx-item:has(img[alt="MG"]) .cx-logo,
  .cx-item:has(img[alt="Hyundai"]) .cx-logo,
  .cx-item:has(img[alt="Happy Planet"]) .cx-logo,
  .cx-item:has(img[alt="Niu Sushi"]) .cx-logo{zoom:1.28}
  /* wide marks are width-capped by their cell, so they need a lower zoom to actually shrink */
  .cx-item:has(img[alt="Clap"]) .cx-logo,
  .cx-item:has(img[alt="GÜD"]) .cx-logo{zoom:.85}
  .cx-item:has(img[alt="Brugal"]) .cx-logo{zoom:.95}

  /* ---------- THE MALACARA METHOD ----------
     Same shape as the diag slides above (eyebrow, headline, copy, dog), so it reflows the same
     way: absolute cqw layout becomes a column, and the dog stops being a full-height figure
     that lands on top of the headline — at 375px it was covering the title outright. */
  .method .stage{display:flex;flex-direction:column;align-items:flex-start;
    padding:68px 20px calc(92px + 30svh);overflow:hidden}
  .method .mt-eyebrow,.method .mt-title,.method .mt-copy{position:static;width:auto}
  .method .mt-eyebrow{margin-top:18px;font-size:12px;padding:5px 12px}
  .method .mt-title{margin-top:16px;font-size:clamp(26px,8.4vw,38px);line-height:.95;width:100%}
  .method .mt-copy{margin-top:18px;font-size:15px;line-height:1.4;width:100%}
  .method .mt-dog{right:4vw;bottom:92px;height:30svh;width:auto}

  /* ---------- FOUR STEPS ----------
     Four cards side by side give ~75px each on a phone, which put the body copy at about 4px.
     One per row instead, and the stage scrolls — which the engine already understands, so a
     swipe past the end still steps to the next page. */
  .steps .stage{display:block;overflow-y:auto;overscroll-behavior-y:contain;
    -webkit-overflow-scrolling:touch;padding:72px 20px calc(104px + env(safe-area-inset-bottom,0px))}
  .steps .st-head{position:static;text-align:left;margin:6px 0 20px;
    font-size:clamp(23px,7.2vw,31px);line-height:1.02}
  .steps .st-grid{position:static;display:grid;grid-template-columns:1fr;gap:14px;
    height:auto;inset:auto}
  .steps .st-card{border-radius:14px;padding:18px 16px 0}
  .steps .st-card .n{font-size:12px}
  .steps .st-card h4{font-size:20px;margin:9px 0 9px}
  .steps .st-card p{font-size:14px;line-height:1.42}
  .steps .st-hand{height:150px;margin-top:16px}

  /* ---------- OUR RECIPE ----------
     The fork and spoon are a desktop frame: they flank the grid, which is why it is pinned to
     the middle 50% (left/right 25cqw) — on a phone that left the four cards about 75px wide.
     Full width instead, two up, and the utensils step aside; they are ornament, and keeping
     them would mean keeping the squeeze that made the copy unreadable. */
  .recipe .stage{display:block;overflow-y:auto;overscroll-behavior-y:contain;
    -webkit-overflow-scrolling:touch;padding:72px 20px calc(104px + env(safe-area-inset-bottom,0px))}
  .recipe .rc-fork,.recipe .rc-spoon{display:none}
  .recipe .rc-head{position:static;text-align:left;margin:6px 0 20px;
    font-size:clamp(25px,7.8vw,33px);line-height:1.02}
  .recipe .rc-grid{position:static;inset:auto;height:auto;
    display:grid;grid-template-columns:repeat(2,1fr);gap:10px}
  .recipe .rc-card{border-radius:12px;padding:14px 13px;min-height:152px}
  .recipe .rc-card .arw{width:16px;height:16px;stroke-width:2.4}
  .recipe .rc-card p{font-size:14px;line-height:1.22}
  /* centred, like the desktop row — left-aligned they hung off nothing, since the grid above
     is full-bleed and the rows wrap ragged */
  .recipe .rc-pills{position:static;inset:auto;margin-top:22px;
    justify-content:center;gap:6px;padding:0}
  .recipe .rc-pill{font-size:11px;padding:6px 11px;border-width:1px}

  /* ---------- WANT MORE (annex teaser) ----------
     Its desktop sizes are in cqw against the 16:9 stage; on the phone the stage is the viewport,
     so .wm-label would compute to about 3px. Restated in px, two up, and the body scrolls on its
     own — which the engine already understands, so a swipe past its edge still steps the page. */
  /* head and body were both absolutely placed, so once the headline wrapped to two lines it
     ran straight into the grid and cropped the first row. Column flow instead — the stage
     scrolls, which the engine already handles, so a swipe past the end still steps the page. */
  .wantmore .stage{display:block;overflow-y:auto;overscroll-behavior-y:contain;
    -webkit-overflow-scrolling:touch;padding:72px 20px calc(104px + env(safe-area-inset-bottom,0px))}
  .wantmore .wm-head{position:static;inset:auto;margin:4px 0 22px;
    font-size:clamp(34px,10.4vw,44px);line-height:.96}
  .wantmore .wm-body{position:static;inset:auto;display:block;overflow:visible}
  .wantmore .wm-grid{grid-template-columns:repeat(2,1fr);column-gap:10px;row-gap:20px}
  .wantmore .wm-item .wm-thumb{border-radius:10px}
  /* 11px was unreadable; at 13px the longer names wrap to two lines, which is fine — the row
     gap absorbs it and every label stays left-aligned to its own thumbnail */
  .wantmore .wm-item .wm-label{font-size:13px;line-height:1.22;margin-top:9px;letter-spacing:-.01em;
    /* reserve both lines whether or not this name needs them: the label sits inside the grid
       item, so a one-line label made its tile shorter and the next row started at a different
       height on each side */
    min-height:calc(13px * 1.22 * 2)}

  /* ---------- CATEGORY COVER TITLE ----------
     Each title is two spans in two weights, sized inline per page (3.4–6cqw) so it fits on ONE
     line at desktop. On a phone cqw is vw, so 3.4cqw lands at about 13px — hence the tiny
     covers. Stack the two halves and let them grow; the inline size has to be overridden with
     !important since it sits on the element itself. */
  .casetitle .ct-title{left:20px;right:20px;top:46svh}
  /* sized per page via --mt, the same way desktop sizes each one inline: these names differ
     enormously in length in Druk Wide ("Organizations" is more than twice "Auto"), so a single
     clamp either overflows the long ones or leaves the short ones small. Each --mt is the size
     that makes that title fill the 20px-inset column, measured per page. */
  .casetitle .ct-title .w1,.casetitle .ct-title .w2{
    display:block;margin-left:0;line-height:.9;
    font-size:min(var(--mt,8.6vw),52px)!important}
  /* the Spanish names are different lengths in the same face — "Organizaciones" overruns where
     "Organizations" fit, "Bebidas Alcohólicas" leaves room where "Alcoholic Beverages" did not —
     so each title carries a measurement per language rather than one shared guess */
  html[lang^="es"] .casetitle .ct-title .w1,
  html[lang^="es"] .casetitle .ct-title .w2{
    font-size:min(var(--mt-es,var(--mt,8.6vw)),52px)!important}
  /* …except Restaurants and Automotive, whose two spans are halves of ONE word (Restau|rants,
     Auto|motive). Breaking those would read as RESTAU / RANTS, so they stay on one line — they
     are short enough to grow anyway. */
  .casetitle .ct-title[data-inline] .w1,
  .casetitle .ct-title[data-inline] .w2{display:inline}

  /* ---------- CASE COVER (logo + service pills) ---------- */
  /* height is fixed (and per-brand) while max-width caps the box, so a wide wordmark gets its
     width clipped with no give in height — La Nación came out 46% squashed, Volvo 44%, Sephora
     40%. object-fit:contain makes the cap letterbox instead of distort, so each mark keeps its
     real proportions at the largest size that fits. Desktop never hits the cap and is unchanged. */
  .casetitle .ct-logo img{max-width:72vw;object-fit:contain}
  .casetitle .ct-pills{gap:8px;padding:0 20px}
  .casetitle .ct-pill{border-width:1px;padding:8px 14px;font-size:12px}

  /* ---------- CASE GALLERY panels ----------
     The mockbox (bg texture) keeps filling the panel; the .cgrid on top stops being stretched
     to the portrait viewport and becomes the slide's own 16:9 composition, full width and
     vertically centred, so every inline left/top/width/height % still lands where it did. */
  .panel .mockbox .cgrid{inset:auto;left:0;top:46%;transform:translateY(-50%);
    width:100%;height:auto;aspect-ratio:16/9}
  /* a lone video/image (single cell) has no collage to preserve: let it use the full width */
  .panel .mockbox .cgrid:has(> :only-child) > *{left:0!important;top:0!important;
    width:100%!important;height:100%!important}

  /* description card: bottom sheet above the pillnav instead of a floating side box */
  .panel .mock-desc{left:12px;right:12px;bottom:calc(max(2.4vh,env(safe-area-inset-bottom,0px)) + 76px);
    width:auto;max-height:34svh;padding:14px 16px;border-radius:16px 16px 12px 16px}
  .panel .mock-desc .idx{font-size:11px;margin-bottom:6px}
  .panel .mock-desc h3{font-size:18px;margin-bottom:6px}
  .panel .mock-desc p{font-size:13px;line-height:1.4}
  .panel .mock-desc.collapsed{left:auto;width:40px;max-height:40px;padding:0}
  .panel .mock-desc.collapsed.force-open{left:12px;width:auto;max-height:34svh;padding:14px 16px}
}


/* ============================================================
   WEB NAVIGATION (all sizes)
   ============================================================ */

/* pillnav = just the hamburger (slide stepping stays on keys / scroll / swipe) */
.pillnav .nav-arrow,.pillnav .home,.pillnav .count{display:none}
.pillnav{padding:5px}
.pillnav button[data-act="menu"]{width:44px;height:44px}

/* the gallery rail sits inside .grail-stage, which is pointer-events:none so it never eats
   clicks meant for the slide underneath. The monogram already re-enabled itself; these links
   did not, so inside a case page the whole header was dead. Re-enable them the same way. */
.grail-stage .rail a.ri{pointer-events:auto}

/* header rail labels are real links (STUDIO / WORK / CLIENTS / CONTACT) in the original slots and type */
.rail a.ri{color:inherit;text-decoration:none;cursor:pointer;opacity:.8;transition:opacity .2s}
/* same hover as the Gastón Porte Design header: a 1px line drawn left→right through the label
   (top:.58em) in .4s, opacity .8 → 1 */
.rail a.ri::after{content:'';position:absolute;left:0;top:.58em;width:100%;height:1px;
  background:currentColor;transform:scaleX(0);transform-origin:left center;
  transition:transform .4s cubic-bezier(.65,0,.35,1)}
.rail a.ri:hover{opacity:1}
.rail a.ri:hover::after{transform:scaleX(1)}

/* header links: two groups, one each side of the monogram, spaced EVENLY — the invisible
   ghost (::before/::after, monogram-wide) makes the monogram count as a third item, so the
   gap STUDIO↔WORK equals WORK↔monogram, and CLIENTS↔CONTACT equals monogram↔CLIENTS */
.rail{--mk:1.85cqw}
.rail .rg{position:absolute;top:0;display:flex;justify-content:space-between}
.rail .rg-l::after,.rail .rg-r::before{content:'';flex:none;width:var(--mk)}
.rail .rg-l{left:2.08cqw;right:calc(50% - var(--mk) / 2)}
.rail .rg-r{left:calc(50% - var(--mk) / 2);right:2.08cqw}
.rail .rg .ri{position:relative;left:auto;right:auto}

/* menu overlay: same header (links, type, hover) on the light bg. The bar has EQUAL air above and
   below the row (--band = 2·pad + row), and thumbnails feather out beneath it. */
.menu{--band:72px;--bg:#EFEFEF;padding-top:calc(var(--band) + 20px)}
.menu-rail{position:fixed;top:0;left:0;right:0;height:calc(var(--band) + 44px);z-index:2;pointer-events:none;
  display:flex;justify-content:center}
.menu-rail::before{content:'';position:absolute;inset:0;
  background:linear-gradient(to bottom,var(--bg) 0,var(--bg) var(--band),rgba(239,239,239,0) 100%)}
.menu-rail .stage{position:relative;aspect-ratio:auto;height:var(--band);pointer-events:none}
.menu-rail .rail{top:calc((var(--band) - 14px) / 2);height:14px}
.menu-rail .rail .ri-mark{top:50%;transform:translate(-50%,-50%)}
.menu-rail .rail a.ri,.menu-rail .ri-mark{pointer-events:auto}

/* contact (closing page) */
.cl-contact{position:absolute;left:2.08cqw;right:2.08cqw;top:47cqh;z-index:5;
  display:flex;justify-content:space-between;align-items:baseline;
  font-size:1.6cqw;letter-spacing:-.04em;line-height:1.18;color:var(--white);
  font-family:"Helvetica Neue",Helvetica,Arial,sans-serif;font-weight:400}
.cl-contact a{color:inherit;text-decoration:none}
.cl-contact a:hover{text-decoration:underline;text-underline-offset:.2em}
.cl-social{display:flex;gap:1.6cqw}
.cl-foot{position:absolute;left:2.08cqw;right:2.08cqw;bottom:2cqh;z-index:5;
  display:flex;justify-content:space-between;align-items:flex-end;
  font-size:.76cqw;line-height:1.5;font-weight:500;letter-spacing:-.03em;color:#E7E4DC}

/* work index */
.work .stage{overflow-y:auto;overflow-x:hidden;overscroll-behavior:contain;scrollbar-width:none}
.work .stage::-webkit-scrollbar{display:none}
.wk-head{margin:14cqh 8.25cqw 0;text-align:center;font-family:var(--druk);font-weight:700;
  font-size:3.6cqw;line-height:.92;letter-spacing:-.01em;color:var(--ink)}
.wk-head[data-reveal="lines"] .ln{margin-inline:auto}
.wk-body{padding:6cqh 8.25cqw 14cqh}
.wk-tag{margin-bottom:2.4cqh}
.wk-grid{display:grid;grid-template-columns:repeat(4,1fr);gap:3.2cqh 2cqw;margin-bottom:8cqh}
.wk-card{display:block;color:var(--ink);text-decoration:none}
.wk-img{display:block;aspect-ratio:16/9;overflow:hidden;background:#111;border-radius:10px}
.wk-img img{display:block;width:100%;height:100%;object-fit:cover;transition:transform .6s var(--ease)}
.wk-card:hover .wk-img img{transform:scale(1.04)}
.wk-name{display:block;margin-top:1cqh;font-size:1.05cqw;font-weight:700;letter-spacing:-.02em}

@media (max-width:820px){
  .menu{--band:58px}
  .menu-rail .stage{width:100vw}
  .pillnav{padding:4px}

  /* closing / contact: stacked, centred */
  .closing .stage{display:block}
  .closing .cl-head{top:17svh;font-size:clamp(34px,13vw,60px)}
  .cl-contact{left:20px;right:20px;top:calc(17svh + 13vw + 24px);flex-direction:column;align-items:center;
    gap:12px;font-size:20px}
  .cl-social{gap:22px;font-size:15px}
  .closing .cl-dog{left:50%;translate:none;transform:translateX(-50%);width:min(78vw,420px);bottom:calc(14svh + 6vw)}
  .closing .cl-wm{left:16px;width:calc(100vw - 32px);bottom:calc(92px + 8px)}
  .cl-foot{bottom:max(2.4vh,env(safe-area-inset-bottom,0px));left:16px;right:16px;
    font-size:10px;line-height:1.35}
  .cl-foot span{max-width:calc(50% - 44px)}
  .cl-foot span:last-child{text-align:right}

  /* work index: 2 columns */
  .wk-head{margin:76px 20px 0;font-size:clamp(20px,6.4vw,28px)}
  .wk-body{padding:26px 16px calc(110px + env(safe-area-inset-bottom,0px))}
  .wk-tag{font-size:12px;padding:5px 12px;margin-bottom:14px}
  .wk-grid{grid-template-columns:repeat(2,1fr);gap:20px 12px;margin-bottom:34px}
  .wk-name{margin-top:7px;font-size:13px}
}

/* gallery header sits over full-bleed photography with bright patches (wet-road highlight, skies):
   the nav links must stay legible, so a stronger local shadow — type, size and position unchanged */
.grail.rail--onblack .ri{text-shadow:0 0 7px rgba(0,0,0,.85),0 1px 3px rgba(0,0,0,.7)}


/* phone header groups — declared LAST so they win over the desktop group rules above */
@media (max-width:820px){
  .rail{--mk:22px}
  .rail .rg-l{left:0;right:calc(50% - 11px)}
  .rail .rg-r{left:calc(50% - 11px);right:0}
}


/* ============================================================
   MOBILE — STACKED PROJECT FEED
   The block above adapts a case gallery by keeping one panel per screen: the .cgrid becomes a
   full-width 16:9 strip centred in a tall portrait viewport, with the description as a bottom
   sheet. That leaves the work small, floating in dead space, and still navigated sideways. This
   block replaces that on every project page: the track stops being a filmstrip and becomes one
   scrolling column — each image at the FULL width of the STUDIO…CONTACT rail (inset 20px, so the
   media lines up with the rail's two ends), flat black around it, caption underneath.
   Reaching the end moves on to the next project by itself: the track is a real scrollable
   element, so shell.js's existing scrollParent() hook yields to native scrolling and only steps
   at the edge, where secGo() falls through to navigateTo(next page). No engine rewrite.
   Scoped to .slide[data-gallery] rather than an opt-in attribute, so any case page added later
   inherits it. Desktop (>820px) is untouched — the whole block is inside the mobile query.
   ============================================================ */
@media (max-width:820px){
  .slide[data-gallery]{--mgut:20px}

  /* the gallery track becomes the scroll column */
  .slide[data-gallery] .track{
    position:absolute;inset:0;display:block;width:100%;height:100%;
    transform:none!important;will-change:auto;
    overflow-y:auto;overflow-x:hidden;-webkit-overflow-scrolling:touch;
    overscroll-behavior-y:contain;background:var(--black);
    padding:calc(max(env(safe-area-inset-top,0px),18px) + 34px) 0 22vh}
  /* panels carry their own ground colour for the deck (g-white on light-themed work); in one
     black column that would punch white blocks through the page, so the column owns the ground */
  .slide[data-gallery] .panel{
    position:relative;flex:none;width:100%;height:auto;display:block;
    overflow:visible;padding:0 var(--mgut) 7vh;place-items:initial;background:transparent}

  /* media — full column width on black. The bg texture is a desktop device (it exists to float
     the clip inside a scene); at column width it would only shrink the real work, so it goes. */
  .slide[data-gallery] .panel .mockbox{position:relative;inset:auto;width:100%;height:auto;
    overflow:visible;background:transparent;transform:none!important;opacity:1}
  .slide[data-gallery] .panel .mockbox>img.bgtex{display:none}
  .slide[data-gallery] .panel .mockbox>img:not(.bgtex){position:relative;inset:auto;
    width:100%;height:auto;object-fit:contain;transform:none!important;translate:none!important}

  /* beats the per-panel 16:9 centring above: in the column the grid is in flow, and each cell's
     aspect comes from --ar, which shell.js derives from the cell's own inline width/height % */
  .slide[data-gallery] .panel .mockbox .cgrid{position:relative!important;inset:auto!important;
    left:auto!important;top:auto!important;transform:none!important;
    width:100%!important;height:auto!important;aspect-ratio:auto!important;
    display:grid;grid-template-columns:1fr;gap:8px}
  .slide[data-gallery] .panel .mockbox .cgrid[data-cols="2"]{grid-template-columns:repeat(2,1fr)}
  .slide[data-gallery] .panel .mockbox .cgrid[data-cols="3"]{grid-template-columns:repeat(3,1fr);gap:6px}
  /* collage cells all take the grid's one shape and crop to fill it, so every row lines up and
     no cell is letterboxed against its neighbour (see mstackPrep() in shell.js for how that
     shape is picked). A single-cell grid is excluded and keeps object-fit:contain below. */
  .slide[data-gallery] .panel .mockbox .cgrid[data-collage]>video,
  .slide[data-gallery] .panel .mockbox .cgrid[data-collage]>img,
  .slide[data-gallery] .panel .mockbox .cgrid[data-collage]>.vid-wrap{
    aspect-ratio:var(--cell-ar,1)!important;object-fit:cover!important}
  .slide[data-gallery] .panel .mockbox .cgrid[data-collage]>.vid-wrap>video{
    object-fit:cover!important}
  .slide[data-gallery] .panel .mockbox .cgrid>video,
  .slide[data-gallery] .panel .mockbox .cgrid>img,
  .slide[data-gallery] .panel .mockbox .cgrid>.vid-wrap,
  .slide[data-gallery] .panel .mockbox .cgrid:has(> :only-child)>*{
    position:relative!important;left:auto!important;top:auto!important;
    width:100%!important;height:auto!important;object-fit:contain;background:#000;
    aspect-ratio:var(--ar,16/9)}
  /* a cgrid-contain cell is artwork with real alpha — it must keep its transparent ground */
  .slide[data-gallery] .panel .mockbox .cgrid>img.cgrid-contain{background:transparent}
  .slide[data-gallery] .panel .mockbox .cgrid>.vid-wrap>video{
    position:absolute!important;inset:0!important;width:100%!important;height:100%!important;
    object-fit:contain}

  /* caption: the mint card exists on desktop only because it floats OVER the media and would
     otherwise cover it — hence the lime box and its collapse-to-a-pill. Nothing overlaps in a
     column, so that device retires and the caption becomes plain type on black. Lime survives
     on the index number. */
  .slide[data-gallery] .panel>.stage{position:relative;width:100%;height:auto;
    aspect-ratio:auto;container-type:normal;overflow:visible;display:block}
  .slide[data-gallery] .panel .mock-desc,
  .slide[data-gallery] .panel .mock-desc.collapsed,
  .slide[data-gallery] .panel .mock-desc.collapsed.force-open{
    position:relative;left:auto;right:auto;bottom:auto;top:auto;
    width:100%!important;max-height:none!important;padding:13px 0 0!important;
    background:none!important;box-shadow:none!important;border:0;border-radius:0!important;
    color:var(--cream);backdrop-filter:none;display:block;transition:none;overflow:visible;
    aspect-ratio:auto}
  .slide[data-gallery] .panel .mock-desc .idx{font-size:10px;letter-spacing:.08em;opacity:1;
    color:var(--lime);margin-bottom:7px!important;display:block;text-align:left!important}
  .slide[data-gallery] .panel .mock-desc h3{font-size:19px;line-height:1.14;letter-spacing:-.02em;
    color:var(--cream);margin-bottom:7px!important;opacity:1!important;max-height:none!important}
  .slide[data-gallery] .panel .mock-desc p{font-size:13.5px;line-height:1.5;color:var(--cream);
    opacity:.68!important;max-height:none!important}

  /* rail pinned over the feed; it already sits at left/right:20px, which IS the column the media
     aligns to. Its groups are absolutely placed in cqw against the 16:9 stage container, which
     the feed no longer has — so they collapse and CONTACT runs off the edge. Lay them out as a
     flex row across that same column, monogram centred. */
  .slide[data-gallery] .grail-stage{position:fixed;left:0;right:0;top:0;
    width:100%;height:auto;aspect-ratio:auto;container-type:normal;overflow:visible;z-index:22;
    background:linear-gradient(180deg,var(--black) 58%,transparent)}
  .slide[data-gallery] .grail{position:relative;top:auto;left:auto;right:auto;
    height:auto;display:flex;align-items:center;justify-content:space-between;
    padding:max(env(safe-area-inset-top,0px),18px) var(--mgut) 14px}
  .slide[data-gallery] .grail .rg{position:relative;left:auto;right:auto;
    top:auto;display:flex;gap:18px;align-items:center}
  .slide[data-gallery] .grail .rg-l::after,
  .slide[data-gallery] .grail .rg-r::before{display:none}
  .slide[data-gallery] .grail .ri-mark{position:absolute;left:50%;top:50%;
    transform:translate(-50%,-50%);width:20px;height:auto}
}


/* ============================================================
   MOBILE MENU — brand marks instead of slide thumbnails
   The thumbnail matrix renders each slide as it looks on a wide screen; on a phone the
   destination is the stacked feed, so those cards no longer look like where they lead. Swap
   the whole grid for the projects themselves. Desktop keeps the thumbnails untouched.
   ============================================================ */
.menu-projects{display:none}

@media (max-width:820px){
  .menu #menuList{display:none}
  .menu .menu-projects{display:grid;grid-template-columns:repeat(2,1fr);gap:10px}
  .mp-item{position:relative;display:flex;align-items:center;justify-content:center;
    aspect-ratio:16/10;padding:14px;border:0;border-radius:12px;cursor:pointer;
    background:var(--black);overflow:hidden;
    box-shadow:0 8px 16px -2px rgba(0,0,0,.28)}
  .mp-item img{max-width:74%;max-height:48%;width:auto;height:auto;object-fit:contain}
  /* categories have no mark of their own, so the name stands in — set the way their own
     title-card cover sets it, which is what makes the tile read as that page */
  /* sized to carry the same weight in the tile as a logo does (the marks sit at ~74% width),
     so a category never reads as the lesser option next to a brand */
  .mp-name{font-family:var(--drukx);font-weight:800;text-transform:uppercase;
    font-size:clamp(17px,5.2vw,22px);line-height:1.02;letter-spacing:.012em;color:var(--cream);
    text-align:center;padding:0 8px}
}


/* ============================================================
   LANGUAGE TOGGLE — lives in the pillnav
   The pillnav is the only chrome visible on every page at both breakpoints, and on a phone it
   carries just the hamburger, so there is room beside it and it sits in thumb reach. The rail
   was the other candidate and could not take it: at 375px its four labels already end flush
   with the right edge, zero slack.
   ============================================================ */
/* width:auto is the fix, not a tweak: .pillnav button declares a fixed width:38px for the icon
   buttons, and without overriding it the label (41px of "EN/ES") spilled 13px past its own box
   and over the hamburger — so only the middle of the text was actually clickable and the two
   controls read as one smudge. Auto width plus real padding gives the control its own hit area. */
.pillnav .lang-btn{display:flex;align-items:center;justify-content:center;gap:7px;
  width:auto!important;flex:0 0 auto;border:0;cursor:pointer;
  background:none;color:var(--cream);font-family:var(--font);font-weight:700;
  font-size:11px;letter-spacing:.02em;padding:0 10px;height:38px;border-radius:100px;
  transition:opacity .2s var(--ease),background .2s var(--ease)}
.pillnav .lang-btn i{font-style:normal;opacity:.35;margin:0}
/* the inactive half dims, so the control states which language you are in AND what tapping does */
.pillnav .lang-btn span{opacity:.38;transition:opacity .2s var(--ease)}
.pillnav .lang-btn[data-lang="en"] span[data-l="en"],
.pillnav .lang-btn[data-lang="es"] span[data-l="es"]{opacity:1}
.pillnav .lang-btn:hover span{opacity:.72}
.pillnav .lang-btn:hover span[data-l]{}
.pillnav .lang-btn[data-lang="en"]:hover span[data-l="en"],
.pillnav .lang-btn[data-lang="es"]:hover span[data-l="es"]{opacity:1}

/* the rhythm has to read as considered: the slash needs room to breathe inside the label, and
   the step out to the hamburger should be a few times that, not fourteen. It was 3px inside
   against 43px out — the label looked shoved against the left of the pill. */
.pillnav{gap:6px}

@media (max-width:820px){
  /* web.css hides the arrows, the wordmark and the counter here, so the pill holds the toggle
     and the hamburger only — the toggle gets a 44px tap target, the usual minimum on touch */
  .pillnav{gap:8px}
  .pillnav .lang-btn{font-size:12.5px;height:44px;padding:0 11px;gap:8px}
}

/* ============================================================
   2026-11 · Institutional layer + accessibility
   ============================================================ */

/* visually hidden but readable by screen readers and crawlers (site index nav) */
.sr-only{position:absolute!important;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;
  clip:rect(0 0 0 0);clip-path:inset(50%);white-space:nowrap;border:0}

/* keyboard focus: visible, on-brand, only for keyboard users */
:focus-visible{outline:2px solid var(--lime);outline-offset:3px;border-radius:4px}
.g-cream :focus-visible,.menu :focus-visible{outline-color:var(--ink)}

/* pages outside the deck (studio, work): no global counter, no step arrows */
.mc-offdeck .pillnav .count,.mc-offdeck .pillnav .nav-arrow{display:none}

@media (prefers-reduced-motion:reduce){.slide{transition:none!important}}

/* ---------- STUDIO (scroll page, same system as /work) ---------- */
.studio .stage{overflow-y:auto;overflow-x:hidden;overscroll-behavior:contain;scrollbar-width:none}
.studio .stage::-webkit-scrollbar{display:none}
.su-wrap{padding:15cqh 8.25cqw 16cqh;color:var(--ink)}
.su-hero{display:grid;grid-template-columns:minmax(0,1fr) 24cqw;gap:5cqw;align-items:end}
.su-title{margin:2.6cqh 0 3.4cqh;font-family:var(--druk);font-weight:700;font-size:4.3cqw;line-height:.95;letter-spacing:-.01em}
.su-lead p{max-width:50cqw;margin:0 0 1.6cqh;font-size:1.2cqw;line-height:1.5;letter-spacing:-.01em}
.su-lead .su-em{font-weight:700}
.su-dog{position:relative;width:100%}
.su-dog video,.su-dog img{display:block;width:100%;height:100%;object-fit:contain}

.su-sec{margin-top:15cqh}
.su-h2{margin:0 0 5cqh;font-family:var(--druk);font-weight:700;font-size:3cqw;line-height:1;letter-spacing:-.01em}

.su-cards{display:grid;grid-template-columns:repeat(3,1fr);gap:1.8cqw}
.su-card{border-radius:1.7cqw;padding:3.4cqh 1.8cqw 4.2cqh;transform:rotate(var(--rot,0deg));
  transition:transform .45s var(--ease)}
.su-card:hover{transform:translateY(-1.2cqh) rotate(var(--rot,0deg))}
.su-card.lime{background:var(--lime);color:var(--ink)}
.su-card.dark{background:#0e1c38;color:var(--cream)}
.su-card .n{font-weight:700;font-size:1cqw;letter-spacing:.02em;opacity:.6}
.su-card h3{margin:2.2cqh 0 1.4cqh;font-family:var(--druk);font-weight:700;font-size:2cqw;line-height:1}
.su-card p{margin:0;font-size:1.1cqw;line-height:1.45}

.su-caps{display:grid;grid-template-columns:repeat(4,1fr);gap:2.4cqw}
.su-cap{border-top:2px solid var(--ink);padding-top:2.4cqh}
.su-cap h3{margin:0 0 1.8cqh;font-family:var(--druk);font-weight:700;font-size:1.5cqw;line-height:1.05}
.su-svc{margin:0 0 2cqh;font-size:1.05cqw;line-height:1.55}
.su-seen{margin:0;font-size:.9cqw;line-height:1.6;color:#5b5c57}
.su-seen a{color:var(--ink);font-weight:700;text-decoration:underline;text-underline-offset:.2em;text-decoration-thickness:1px}
.su-seen a:hover{text-decoration-thickness:2px}

.su-team{display:grid;grid-template-columns:repeat(4,1fr);gap:1.8cqw}
.su-person{display:flex;flex-direction:column;justify-content:flex-end;gap:1.2cqh;min-height:22cqh;
  padding:3cqh 1.6cqw;border-radius:1.4cqw;background:var(--ink);color:var(--cream)}
.su-name{font-family:var(--druk);font-weight:700;font-size:1.55cqw;line-height:1.05;color:var(--lime)}
.su-role{font-size:1cqw;line-height:1.4;opacity:.85}

.su-cities{display:grid;grid-template-columns:repeat(3,1fr);gap:2.4cqw}
.su-city{position:relative;display:flex;flex-direction:column;gap:1.4cqh;border-top:2px solid var(--ink);padding-top:2.4cqh}
.su-hq{position:absolute;right:0;top:2.2cqh;font-size:.85cqw;padding:.4cqh .8cqw}
.su-cname{font-family:var(--druk);font-weight:700;font-size:2.4cqw;line-height:1}
.su-time{font-size:1cqw;color:#5b5c57}
.su-time b{color:var(--ink);font-variant-numeric:tabular-nums;margin-left:.3em}

.su-cta{text-align:center;padding-bottom:4cqh}
.su-cta .su-h2{font-size:4.2cqw;margin-bottom:1.6cqh}
.su-cta-sub{margin:0 0 4.4cqh;font-size:1.4cqw}
.su-btns{display:flex;justify-content:center;gap:1.2cqw}
.su-btn{display:inline-block;padding:1.8cqh 2.4cqw;border-radius:100px;background:var(--ink);color:var(--cream);
  font-weight:700;font-size:1.15cqw;letter-spacing:-.01em;text-decoration:none;transition:transform .3s var(--ease)}
.su-btn.lime{background:var(--lime);color:var(--ink)}
.su-btn:hover{transform:translateY(-3px)}
.su-mail{margin:3.6cqh 0 0;font-size:1cqw}
.su-mail a{color:var(--ink)}

@media (max-width:820px){
  .su-wrap{padding:84px 18px calc(120px + env(safe-area-inset-bottom,0px))}
  .su-lead .stamp{font-size:12px;padding:5px 12px}
  .su-hero{grid-template-columns:1fr;gap:28px}
  .su-title{font-size:clamp(28px,9vw,44px);margin:16px 0 22px}
  .su-lead p{max-width:none;font-size:16px;margin-bottom:12px}
  .su-dog{width:min(58vw,300px);justify-self:end;margin-top:-8px}
  .su-sec{margin-top:72px}
  .su-h2{font-size:clamp(24px,7.4vw,34px);margin-bottom:24px}
  .su-cards,.su-caps,.su-team,.su-cities{grid-template-columns:1fr;gap:14px}
  .su-caps,.su-cities{gap:28px}
  .su-card{border-radius:18px;padding:22px 20px 26px}
  .su-card .n{font-size:12px}
  .su-card h3{font-size:24px;margin:14px 0 10px}
  .su-card p{font-size:15px}
  .su-cap{padding-top:16px}
  .su-cap h3{font-size:20px;margin-bottom:10px}
  .su-svc{font-size:15px;margin-bottom:10px}
  .su-seen{font-size:13px}
  .su-team{grid-template-columns:1fr 1fr;gap:12px}
  .su-person{min-height:130px;padding:18px 14px;border-radius:14px;gap:8px}
  .su-name{font-size:17px}
  .su-role{font-size:12.5px}
  .su-city{padding-top:16px;gap:8px}
  .su-hq{top:14px;font-size:11px;padding:4px 10px}
  .su-cname{font-size:clamp(26px,8vw,36px)}
  .su-time{font-size:13px}
  .su-cta .su-h2{font-size:clamp(30px,10vw,46px)}
  .su-cta-sub{font-size:17px;margin-bottom:24px}
  .su-btns{flex-direction:column;align-items:stretch;gap:10px;max-width:340px;margin:0 auto}
  .su-btn{font-size:16px;padding:15px 22px}
  .su-mail{font-size:14px;margin-top:22px}
}

@media (max-width:820px){
  /* contact links: wrap instead of breaking a label in two; 24px+ tap targets */
  .cl-social{flex-wrap:wrap;justify-content:center;row-gap:4px}
  .cl-social a{white-space:nowrap;display:inline-block;padding:7px 0}
  .su-seen a{display:inline-block;padding:5px 0}
}

/* studio · how we work: three cards, same as the /work index */
.su-how{grid-template-columns:repeat(3,1fr);margin-bottom:0}
.su-how .wk-name{font-size:1.15cqw}
@media (max-width:820px){.su-how{grid-template-columns:1fr 1fr}.su-how .wk-name{font-size:13px}}

/* ---------- 2026-11-04 mobile QA: the header rail no longer runs under the MC mark ----------
   The ghost slot that keeps the even spacing was sized for desktop (1.85cqw ≈ 7px on a phone)
   while the mark is 22–25px there, so CLIENTS / PROYECTOS slid under it. The slot is now the
   mark plus air, the type is a touch tighter, and the case-gallery header (.grail) uses the same
   geometry so the words don't jump between a case cover and its gallery. */
@media (max-width:820px){
  .rail{--mk:36px}
  .rail .rg-l{left:0;right:calc(50% - var(--mk) / 2)}
  .rail .rg-r{left:calc(50% - var(--mk) / 2);right:0}
  .slide[data-gallery] .grail{padding-left:20px;padding-right:20px}
  .slide[data-gallery] .grail .rg{flex:1;justify-content:space-between;gap:0}
  .slide[data-gallery] .grail .rg-l{padding-right:calc(var(--mk) / 2)}
  .slide[data-gallery] .grail .rg-r{padding-left:calc(var(--mk) / 2)}
  .slide[data-gallery] .grail .rg-l::after,
  .slide[data-gallery] .grail .rg-r::before{display:block;content:'';flex:none;width:var(--mk)}
}
@media (max-width:480px){
  html .rail a.ri,html .rail .ri{font-size:10.5px;letter-spacing:.03em;font-stretch:100%}
  .rail{left:14px;right:14px}
  .slide[data-gallery] .grail{padding-left:14px;padding-right:14px}
}
@media (max-width:340px){ html .rail a.ri,html .rail .ri{font-size:9.5px;letter-spacing:.01em} }
/* bigger tap area for the rail links on touch screens, without moving them */
@media (hover:none){ .rail a.ri{padding:14px 0;margin:-14px 0} }

/* ---------- 2026-11-04 mobile QA: Spanish headlines have longer single words ("CREATIVIDAD,",
   "OBSESIONADOS") that didn't fit a 360px phone and dragged the whole column off screen. The grid
   column may now shrink, and in Spanish the size is capped so the longest word always fits. ---------- */
@media (max-width:820px){
  .su-hero{grid-template-columns:minmax(0,1fr)}
  .su-hero>*{min-width:0}
  html[lang^="es"] .su-title{font-size:min(clamp(28px,9vw,44px),calc((100vw - 40px) / 11.2))}
  html[lang^="es"] .diag .dg-head{font-size:min(clamp(22px,7.6vw,34px),calc((100vw - 44px) / 13))}
}

/* ---------- 2026-11-04 mobile QA: the contact footer (cities · ©) sat under the pill nav and could
   never be read. It now sits just above the pill; the wordmark and the dog move up with it. ---------- */
@media (max-width:820px){
  .cl-foot{bottom:calc(max(12px,env(safe-area-inset-bottom,0px)) + 60px)}
  .closing .cl-wm{bottom:118px}
  .closing .cl-dog{bottom:calc(14svh + 6vw + 18px)}
}
@media (max-width:820px){ .cl-social a{min-height:44px;display:inline-flex;align-items:center} }
