/* ==========================================================================
   Projects accordion (home + proyectos). One panel open at a time: native radio
   inputs, CSS only. The open panel has a swipeable photo strip (dots synced in main.js).
   ========================================================================== */

.acc{display:flex;flex-direction:column;padding:0 14px;position:relative;--gap:4px;--closed:84px;--open:430px;--radius:14px}
/* each radio stays in the flow, zero-sized, just above its panel: clicking a label focuses it and
   the browser only scrolls to it if needed (stacked at the top, it threw the page back up) */
.acc>input{flex:none;width:0;height:0;margin:0;padding:0;border:0;opacity:0;appearance:none;pointer-events:none}
.acc>.panel+input{margin-top:var(--gap)}
.panel{position:relative;height:var(--closed);overflow:hidden;border-radius:var(--radius);background:#222;transition:height .5s var(--ease),transform .5s cubic-bezier(.25,1,.5,1)}
/* dragged past the first or last photo (main.js): the panel follows the mouse at once, then springs back */
.panel.pulled{transition:height .5s var(--ease)}
/* scroll-driven mode (main.js): a tall runway with a sticky frame (main.js sets its top, just below the header, and its
   height, the open project's); the list hangs out of it above and below, nothing is cut off. The heights follow the
   scroll, so no timed height animation (the rubber-band spring-back stays) */
.acc-run{position:relative}
.acc-pin{position:sticky;top:0}
.acc.scrubbed .panel{transition:transform .5s cubic-bezier(.25,1,.5,1)}
.acc.scrubbed .panel.pulled{transition:none}
.acc>input:checked+.panel{height:var(--open)}
.acc>input:focus-visible+.panel{outline:2px solid var(--red);outline-offset:2px}
/* the photo strip can get keyboard focus (to scroll it with the arrow keys): its own ring would be cut off by the panel,
   so the panel shows it, like for its radio */
.slides:focus-visible{outline:none}
.panel:has(>.slides:focus-visible){outline:2px solid var(--red);outline-offset:2px}
.slides{position:absolute;inset:0 0 -24px 0;display:flex;overflow:hidden;scroll-snap-type:x mandatory;scrollbar-width:none}
.slides::-webkit-scrollbar{display:none}
.acc>input:checked+.panel .slides{overflow-x:auto}
.slides img{flex:0 0 100%;width:100%;height:calc(100% - 24px);object-fit:cover;scroll-snap-align:center;transition:transform .6s}
/* only as dark as the white name under it needs (it was .6 at the bottom and .05 over the rest; lighter at the owner's ask) */
.shade{position:absolute;inset:0;pointer-events:none;background:linear-gradient(to top,rgba(0,0,0,.42),rgba(0,0,0,0) 60%)}
.bar{position:absolute;left:0;right:0;bottom:0;height:var(--closed);display:block;cursor:pointer}
.cap{position:absolute;left:16px;right:64px;bottom:14px;color:#fff;text-shadow:0 1px 10px rgba(0,0,0,.35);font-size:20px;font-weight:500;letter-spacing:-.01em;line-height:1.2}
.sub{display:block;font-size:13px;font-weight:400;opacity:0;max-height:0;transition:opacity .4s .1s,max-height .4s}
.acc>input:checked+.panel .sub{opacity:.9;max-height:24px}
.chev{position:absolute;right:12px;bottom:12px;width:44px;height:44px;border-radius:50%;display:flex;align-items:center;justify-content:center;color:var(--ink);transition:background .25s,color .25s}
.acc>input:checked+.panel .chev{--o:1} /* the strokes themselves are drawn in base.css */
/* Dots: --d = dot size, --on = the long dot's width. The current photo's slot (.on) is long. main.js lays the long
   white dot over it as its own element (b) that works like the nav pill: while a photo is slid it stretches toward
   the next dot, resisting (rubber band, at most up to it), and past 25% of the slide it glides there, front edge
   first, then contracts; the grey slots widen and narrow to match. Without JS the .on slot is simply white. */
.dots{position:absolute;top:16px;left:0;right:0;display:flex;justify-content:center;gap:6px;opacity:0;pointer-events:none;transition:opacity .4s .15s;--d:6px;--on:18px}
.dots i{display:block;width:var(--d);height:var(--d);background:rgba(255,255,255,.55);transition:width .3s cubic-bezier(.4,0,.2,1)}
.dots i.on{width:var(--on);background:#fff}
.dots:has(>b) i.on{background:rgba(255,255,255,.55)}
.dots b{position:absolute;left:0;top:0;width:max(0px,var(--r) - var(--l));height:var(--d);transform:translateX(var(--l));background:#fff;
  transition:--r .2s cubic-bezier(.25,1,.5,1),--l .3s cubic-bezier(.6,0,.3,1.3)}
.dots.to-left b{transition:--l .2s cubic-bezier(.25,1,.5,1),--r .3s cubic-bezier(.6,0,.3,1.3)}
.dots.elastic b{transition:--l .05s ease-out,--r .05s ease-out}
.more{position:absolute;top:10px;left:10px;z-index:2;height:36px;padding:0 14px;display:flex;align-items:center;gap:6px;border-radius:18px;font-size:13px;font-weight:500;text-decoration:none;opacity:0;pointer-events:none;transition:opacity .4s .15s,background .2s,color .2s,transform .2s}
.more .arrow{color:var(--red)}
.more .link-line{display:none} /* it rolls like the arrow links (.roll in base.css), but without their line */
.acc>input:checked+.panel .dots{opacity:1}
.acc>input:checked+.panel .more{opacity:1;pointer-events:auto}
.acc:not(:has(>input:checked)) .panel .more{display:none}
/* the click accordion (no JS, reduced motion): a closed project's "ver proyecto" is hidden once it has faded, so Tab
   skips it instead of landing on an invisible link. Following the scroll (.scrubbed) it stays reachable: when it gets
   the focus, main.js scrolls the page to its project, which opens it. */
.acc:not(.scrubbed)>input:not(:checked)+.panel .more{visibility:hidden;transition:opacity .4s .15s,visibility 0s .55s,background .2s,color .2s,transform .2s}
/* The autoplay's pause button (main.js adds one per project; shown on desktop only, where the autoplay runs): a glass
   square top right, as tall as "ver proyecto". Its icon is one eight-point shape: two 4px bars (pause), and when paused
   (.paused) the same points make a triangle (play), so the bars squeeze into its two halves. */
.pause{display:none}
.pause::before{content:"";width:12px;height:14px;background:currentColor;transition:clip-path .35s var(--ease),translate .35s var(--ease);
  clip-path:polygon(0 0,4px 0,4px 100%,calc(100% - 4px) 100%,calc(100% - 4px) 0,100% 0,100% 100%,0 100%)}
.acc.paused .pause::before{translate:1px 0;clip-path:polygon(0 0,50% 25%,50% 75%,50% 75%,50% 25%,100% 50%,100% 50%,0 100%)} /* 1px right: a triangle's weight sits left of its box's centre */
.acc>input:checked+.panel .pause{opacity:1;pointer-events:auto}

@media (min-width:768px){
  .acc{--gap:6px;padding:0;--closed:104px;--open:560px;--radius:18px}
  .cap{left:28px;right:90px;bottom:22px;font-size:28px;letter-spacing:-.02em}
  .sub{font-size:15px}
  .acc>input:checked+.panel .sub{max-height:22px}
  .chev{right:20px;bottom:20px;width:48px;height:48px;--chev:10px}
  .dots{top:22px;gap:7px;--d:7px;--on:22px}
  .more{top:16px;left:16px;height:40px;padding:0 16px;font-size:14px;border-radius:20px}
}
@media (min-width:1100px){
  .acc{--gap:8px;--closed:128px;--open:700px;--radius:22px}
  .cap{left:40px;right:120px;bottom:30px;font-size:44px;letter-spacing:-.03em}
  .sub{font-size:16px}
  .acc>input:checked+.panel .sub{max-height:24px}
  .chev{right:36px;bottom:36px;width:56px;height:56px;--chev:12px}
  .dots{top:30px;gap:8px;--d:8px;--on:26px}
  .more{top:24px;left:24px;height:44px;padding:0 20px;gap:8px;font-size:15px;border-radius:22px}
  .pause{position:absolute;top:24px;right:24px;z-index:2;width:44px;height:44px;padding:0;display:flex;align-items:center;justify-content:center;color:var(--ink);cursor:pointer;opacity:0;pointer-events:none;transition:opacity .4s .15s}
  /* Side rows (main.js adds them, and .sides when the margin beside the list, --side, is 200px or more): each project
     a row running behind its panel, a line across its middle, the name in the left margin and its type in the right
     one; the open project's black, the others grey. They replace the name on the photo. The panel lets them out
     sideways (clip-path, not overflow, which also hid the photo strip's scrollbar below it) */
  /* 4px above and below for the keyboard focus ring round the panel (2px, 2px out): clipped flush, it lost its top and bottom */
  .acc.sides .panel{overflow:visible;clip-path:inset(-4px calc(-1 * var(--side)))}
  /* a row between two lines, like the home's services list, centred on the panel's height (the owner's ask), so it
     follows it as it opens and closes. On hover the texts roll up like the arrow links (.roll, base.css) and both lines
     move: each margin has its own two (.side-m, as wide as the margin), each a strip three times as wide (line, gap,
     line) that slides two line-widths right, so the line runs out to the right while a new one draws in from the left
     (0.8s, the arrow links' line) */
  .acc.sides .side{position:absolute;top:calc(50% - 38px);left:calc(-1 * var(--side));right:calc(-1 * var(--side));height:76px;
    display:flex;justify-content:space-between;color:#6b6862;text-decoration:none;transition:color .3s}
  .side-m{position:relative;width:var(--side);padding:0 16px;display:flex;align-items:center;overflow:hidden;transition:background .3s}
  .acc.sides .side:hover .side-m{background:var(--band)} /* the grey band, like the home's services list (the owner's ask) */
  .side-m+.side-m{justify-content:flex-end}
  .side-m::before,.side-m::after{content:"";position:absolute;left:0;width:300%;height:1px;
    background:linear-gradient(to right,currentColor 33.333%,transparent 33.333% 66.667%,currentColor 66.667%);
    transform:translateX(-66.667%);transition:transform .8s var(--roll)}
  .side-m::before{top:0}
  .side-m::after{bottom:0}
  .acc.sides .side:hover .side-m::before,.acc.sides .side:hover .side-m::after{transform:none}
  .side-m:first-child{font-size:22px;font-weight:500;letter-spacing:-.02em}
  .side-m+.side-m{font-size:15px}
  .acc.sides>input:checked+.panel .side,.acc.sides .side:hover{color:var(--ink)}
  .acc.sides .cap{opacity:0} /* not visibility:hidden: it is its radio's label, and hidden text names nothing for screen readers */
  .acc.sides .shade{display:none} /* it only kept the white name readable: the photos show as they are (the owner's ask) */
}
@media (prefers-reduced-motion:reduce){.side-m::before,.side-m::after{transition:none}}
.side{display:none}
.acc.sides .side{display:flex}
@media (min-width:1100px) and (hover:hover){
  .acc>input:not(:checked)+.panel:hover{height:160px}
  .acc>input:not(:checked)+.panel:hover .slides img{transform:scale(1.05)}
}
/* Hovering a bar, its chevron slides through its glass square like the arrow of the arrow links (.roll in base.css; "ver
   proyecto" rolls like them too): out the way it points (˅ down, ˄ up) while a copy (::after) slides in from the other
   side, and back on leave. The one out of sight is also hidden (opacity, once it has left), so when the panel opens or
   closes and the directions swap, it doesn't cross the square on its way to the other side. */
@media (hover:hover){
  .panel .chev{overflow:hidden}
  .panel .chev::before{transition:--tilt .35s var(--ease),translate .4s cubic-bezier(.25,.46,.45,.94)}
  .panel .chev::after{display:block;opacity:0;translate:0 -100%;
    transition:--tilt .35s var(--ease),translate .4s cubic-bezier(.25,.46,.45,.94),opacity 0s .4s}
  .acc>input:checked+.panel .chev::after{translate:0 100%}
  .bar:hover .chev::before{opacity:0;translate:0 100%;
    transition:--tilt .35s var(--ease),translate .4s cubic-bezier(.25,.46,.45,.94),opacity 0s .4s}
  .acc>input:checked+.panel .bar:hover .chev::before{translate:0 -100%}
  .acc>input+.panel .bar:hover .chev::after{opacity:1;translate:none;transition:--tilt .35s var(--ease),translate .4s cubic-bezier(.25,.46,.45,.94)}
}
