/* NXT Agency: the projects page ("the table"). Loaded after styles.css, on projects.html only.
   Every project is a laptop and a phone set down on one surface, with its name and trade under it.
   Hover (or focus) picks one up: it straightens, comes forward, its screens scroll, and a card says what we
   built. Click and it travels into its case study, opened in place. table.js adds the travel, the drift with
   the pointer, the filters and the focus handling; hover, focus and #links work without it (see :target). */

.tb{position:relative;display:flex;flex-direction:column;min-height:100svh;padding-top:clamp(78px,9vh,96px)}
.tb__top{display:grid;grid-template-columns:auto minmax(0,1fr) auto;align-items:end;gap:10px clamp(20px,3vw,48px);width:100%;padding-bottom:clamp(18px,3vh,34px)}
.tb__title{margin:0;font:650 clamp(26px,2.8vw,50px)/1.02 var(--f-serif);letter-spacing:-.022em}
.tb__lede{margin:0;max-width:52ch;font-size:15px;line-height:1.5;color:var(--muted)}
.tb__filters{display:flex;flex-wrap:wrap;gap:8px}
.tb__f{min-height:44px;padding:0 15px;border-radius:999px;border:1.5px solid rgba(242,237,228,.24);background:none;color:var(--paper);font:600 14px/1 var(--f-sans);white-space:nowrap;cursor:pointer;transition:background-color .2s,border-color .2s,color .2s}
.tb__f i{margin-left:5px;font:500 11.5px/1 var(--f-mono);font-style:normal;opacity:.6}
.tb__f[aria-pressed="true"]{background:var(--signal);border-color:var(--signal);color:var(--ink)}
.tb__f[aria-pressed="true"] i{opacity:.75}
@media (hover:hover){.tb__f:not([aria-pressed="true"]):hover{border-color:var(--paper)}}

/* ---------- the table: four across, set down by hand (sizes, drops and angles repeat every eight) ---------- */
.tb__table{position:relative;display:grid;grid-template-columns:repeat(4,minmax(0,1fr));align-items:start;gap:clamp(22px,4vh,44px) clamp(18px,2.6vw,40px);width:100%;margin-top:0;margin-bottom:clamp(30px,6vh,70px);padding-block:0;list-style:none;outline:0}
.tb__item{position:relative;z-index:1;--r:0deg;--w:100%;--drop:0px;--dx:0%;width:var(--w);margin-top:var(--drop);left:var(--dx);rotate:var(--r);transition:rotate .5s var(--ease-out),scale .5s var(--ease-out),opacity .35s linear}
.tb__item:nth-child(8n+1){--r:-2.6deg;--w:114%;--dx:-2%;--drop:28px}
.tb__item:nth-child(8n+2){--r:1.8deg;--w:88%;--dx:7%;--drop:0px;justify-self:center}
.tb__item:nth-child(8n+3){--r:-1.2deg;--w:104%;--dx:-5%;--drop:44px}
.tb__item:nth-child(8n+4){--r:2.8deg;--w:92%;--dx:2%;--drop:6px;justify-self:end}
.tb__item:nth-child(8n+5){--r:2.2deg;--w:90%;--dx:-4%;--drop:40px;justify-self:end}
.tb__item:nth-child(8n+6){--r:-1.8deg;--w:110%;--dx:-4%;--drop:0px}
.tb__item:nth-child(8n+7){--r:1.3deg;--w:90%;--dx:5%;--drop:18px;justify-self:center}
.tb__item:nth-child(8n+8){--r:-2.9deg;--w:98%;--dx:-3%;--drop:46px}

.pc{position:relative;display:flex;flex-direction:column}
.pc__h{order:2;margin:0;font:inherit}
.pc__dev{order:1}
.pc__tag{display:grid;grid-template-columns:auto minmax(0,1fr);gap:2px 10px;align-items:baseline;padding:14px 4px 6px;color:var(--paper);text-decoration:none}
.pc__tag::after{content:"";position:absolute;inset:0;z-index:1}          /* the whole card opens it… */
.pc__dev .mock__screen{position:relative;z-index:2}                       /* …except the screens, which scroll */
.pc__n{font:500 11.5px/1 var(--f-mono);letter-spacing:.06em;color:var(--signal)}
.pc__name{font:650 clamp(17px,1.45vw,23px)/1.1 var(--f-serif);letter-spacing:-.015em;text-wrap:balance}
.pc__name em{font-style:normal;color:var(--signal)}
/* trade · town: the dot sits in the gap, so when the town drops to its own line the dot is clipped away, never left hanging */
.pc__kind .nw{position:relative}
.pc__kind .nw::before{content:"·";position:absolute;left:-.95em}
.pc__kind{display:flex;flex-wrap:wrap;column-gap:1.5em;overflow:hidden;grid-column:2;font:500 11.5px/1.35 var(--f-mono);letter-spacing:.05em;text-transform:uppercase;color:var(--muted)}
.pc__tag:focus-visible{outline:2px solid var(--signal);outline-offset:4px;border-radius:6px}

.tb .mock{--mb:9%;width:100%;margin:0;padding-bottom:var(--mb)}
.tb .mock__desk{width:86%}
.tb .mock__phone{width:24%}
.tb .mock__screen{background:#1d1b18}
.tb .mock__screen img{display:block;width:100%;height:auto;color:transparent;font-size:0}
.tb .browser{border-radius:9px;box-shadow:0 0 0 1px rgba(255,255,255,.1),0 22px 44px rgba(0,0,0,.42)}
.tb .phone{box-shadow:inset 0 0 0 1.5px rgba(255,255,255,.12),0 16px 32px rgba(0,0,0,.45)}
.tb .browser__bar span{font-size:10px}
.tb .mock__blank{aspect-ratio:1440/900}
.tb .phone__screen.mock__blank{aspect-ratio:390/844}

.pc__body{font-size:14px;line-height:1.5}
.pc__built{margin:0 0 8px;font:600 14px/1.35 var(--f-sans)}
.pc__built .tag{margin-left:6px}
.pc__what{margin:0;color:var(--paper)}
.pc__feats{margin:10px 0 0;font:500 11px/1.7 var(--f-mono);letter-spacing:.05em;text-transform:uppercase;color:var(--muted)}
.pc__feats>span:not([aria-hidden]){display:block}
.pc__feats>[aria-hidden]{display:none}
.nw,.tb__lede .on-hover,.tb__lede .on-touch{white-space:nowrap}
.pc__links{display:flex;flex-wrap:wrap;align-items:center;gap:10px 16px;margin:14px 0 0}
.pc__links .btn{position:relative;z-index:3;min-height:44px;padding:10px 16px;font-size:14px}
.pc__read{position:relative;z-index:3;display:inline-flex;align-items:center;gap:8px;min-height:44px;color:var(--paper);font:600 14px/1 var(--f-sans);text-decoration:underline;text-decoration-color:rgba(242,237,228,.35);text-underline-offset:5px}
.pc__read:hover{text-decoration-color:currentColor}
.pc__label{margin:0 0 8px;font:500 11.5px/1.4 var(--f-mono);letter-spacing:.06em;text-transform:uppercase;color:var(--muted)}
.pc__stats{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:12px;margin:0}
.pc__stats dt{font-size:12.5px;line-height:1.3;color:var(--muted)}
.pc__stats dd{margin:4px 0 0;font:700 18px/1.2 var(--f-sans);font-variant-numeric:tabular-nums;white-space:nowrap}
.pc__stats s{color:var(--muted);font-weight:500;text-decoration-thickness:1px}
.pc__stats b{color:var(--signal)}
.pc__note{margin:10px 0 0;font-size:13px;color:var(--muted)}
.pc__problem p{margin:0}
.pc__next{display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:12px 20px;margin:0}
.pc__nextlink{display:inline-flex;align-items:baseline;gap:10px;min-height:44px;color:var(--paper);font:650 clamp(18px,1.6vw,24px)/1.1 var(--f-serif);text-decoration:none}
.pc__nextlink span:first-child{font:500 11.5px/1 var(--f-mono);letter-spacing:.06em;text-transform:uppercase;color:var(--muted)}
.pc__nextlink:hover{color:var(--signal)}
.pc__close{display:none}
.pc__story{display:none}

/* ---------- big screens: the card beside a picked-up project ---------- */
@media (min-width:1101px){
  .pc__body{position:absolute;z-index:4;top:0;left:calc(100% + 12px);width:min(250px,92%);padding:14px 16px 16px;border-radius:12px;background:rgba(24,22,19,.96);box-shadow:0 0 0 1px rgba(242,237,228,.14),0 24px 50px rgba(0,0,0,.5);font-size:12.5px;opacity:0;visibility:hidden;translate:-10px 0;transition:opacity .2s linear,translate .35s var(--ease-out),visibility 0s .2s}
  .tb__item:nth-child(4n+3) .pc__body,.tb__item:nth-child(4n+4) .pc__body{left:auto;right:calc(100% + 12px);translate:10px 0}
  .pc__built{font-size:12.5px}
  .pc__feats{font-size:9.5px}
  .pc__links .btn{min-height:36px;padding:8px 13px;font-size:12.5px}
  .pc__read{min-height:36px;font-size:12.5px}
  /* picked up: by table.js (.is-up, after a beat so a sweep across the table doesn't set everything off), or by plain hover/focus without it */
  .tb__item.is-up,html:not(.tb-on) .tb__item:hover,html:not(.tb-on) .tb__item:focus-within{z-index:20;rotate:0deg;scale:1.22}
  .tb__item.is-up .pc__body,html:not(.tb-on) .tb__item:hover .pc__body,html:not(.tb-on) .tb__item:focus-within .pc__body{opacity:1;visibility:visible;translate:0 0;transition-delay:.08s,.08s,0s}
  .tb__item.is-up .browser{box-shadow:0 0 0 1px rgba(255,255,255,.18),0 44px 90px rgba(0,0,0,.62)}
  .tb__item.is-up .phone{box-shadow:inset 0 0 0 1.5px rgba(255,255,255,.18),0 30px 60px rgba(0,0,0,.6)}
  .tb__table.has-up .tb__item:not(.is-up){opacity:.26}
  .tb__table.has-up .tb__item.is-under{opacity:0}
  .tb .browser,.tb .phone{transition:box-shadow .4s var(--ease-out)}
}

/* a filter is on: the others stay on the table, pushed back */
.tb__item.is-off{opacity:.16;scale:.94;pointer-events:none}

/* ---------- set down on load: each one drops onto the table in turn (transform only, so the first paint has pictures) ---------- */
@keyframes tbDrop{from{translate:0 -46px;rotate:calc(var(--r) * 3.2);scale:.9}}
@media (prefers-reduced-motion:no-preference){
  .tb__item{animation:tbDrop .9s var(--ease-out) both}
  .tb__item:nth-child(2){animation-delay:60ms}.tb__item:nth-child(3){animation-delay:120ms}.tb__item:nth-child(4){animation-delay:180ms}
  .tb__item:nth-child(5){animation-delay:150ms}.tb__item:nth-child(6){animation-delay:210ms}.tb__item:nth-child(7){animation-delay:270ms}.tb__item:nth-child(n+8){animation-delay:330ms}
}

/* ---------- opened: the case study, in place. One project fills the window; the laptop travels there (table.js) ---------- */
.tb__item.is-open,html:not(.tb-on) .tb__item:target{position:fixed;z-index:90;inset:0;width:auto;margin:0;rotate:none;scale:none;translate:none;opacity:1;animation:none;overflow:auto;overscroll-behavior:contain;background:radial-gradient(90% 70% at 22% 62%,color-mix(in srgb,var(--tint,#b7a5f0) 13%,var(--ink)) 0,var(--ink) 70%)}
.tb__item.is-open .pc,html:not(.tb-on) .tb__item:target .pc{display:grid;grid-template-columns:minmax(0,1.2fr) minmax(300px,.8fr);grid-template-rows:auto auto 1fr;gap:0 clamp(28px,4vw,64px);align-content:start;min-height:100%;max-width:var(--wrap);margin:0 auto;padding:clamp(92px,11vh,120px) var(--gutter) 40px;translate:none!important}
.is-open .pc__close,html:not(.tb-on) .tb__item:target .pc__close{display:inline-flex;align-items:center;gap:8px;grid-column:2;justify-self:start;min-height:44px;margin-bottom:10px;color:var(--muted);font:600 14px/1 var(--f-sans);text-decoration:none;order:0}
.is-open .pc__close:hover,html:not(.tb-on) .tb__item:target .pc__close:hover{color:var(--paper)}
.is-open .pc__h,html:not(.tb-on) .tb__item:target .pc__h{grid-column:2;order:1}
.is-open .pc__dev,html:not(.tb-on) .tb__item:target .pc__dev{grid-column:1;grid-row:1 / span 3;align-self:center;order:0}
.tb__item.is-open .pc__body,html:not(.tb-on) .tb__item:target .pc__body{position:static;grid-column:2;order:2;width:auto;padding:0;border-radius:0;background:none;box-shadow:none;font-size:15px;opacity:1;visibility:visible;translate:none;transition:none}
.is-open .pc__tag,html:not(.tb-on) .tb__item:target .pc__tag{padding:0 0 14px;pointer-events:none}
.is-open .pc__tag::after,html:not(.tb-on) .tb__item:target .pc__tag::after{display:none}
.is-open .pc__name,html:not(.tb-on) .tb__item:target .pc__name{grid-column:1 / -1;font-size:clamp(30px,3.4vw,56px);line-height:1.02;letter-spacing:-.022em}
.is-open .pc__n,html:not(.tb-on) .tb__item:target .pc__n{grid-row:1}
.is-open .pc__kind,html:not(.tb-on) .tb__item:target .pc__kind{grid-column:2;grid-row:1}
.is-open .pc__built,html:not(.tb-on) .tb__item:target .pc__built{font-size:16px}
.is-open .pc__feats,html:not(.tb-on) .tb__item:target .pc__feats{display:flex;flex-wrap:wrap;gap:2px 16px;font-size:11.5px}
.is-open .pc__links .btn,html:not(.tb-on) .tb__item:target .pc__links .btn{min-height:46px;padding:13px 20px;font-size:15px}
.is-open .pc__read,html:not(.tb-on) .tb__item:target .pc__read{display:none}
.is-open .pc__story,html:not(.tb-on) .tb__item:target .pc__story{display:grid;gap:22px;margin-top:22px;padding-top:22px;border-top:1px solid var(--line)}
.is-open .pc__next,html:not(.tb-on) .tb__item:target .pc__next{padding-top:22px;border-top:1px solid var(--line)}
.is-open .mock,html:not(.tb-on) .tb__item:target .mock{width:min(100%,calc((100svh - 230px) * 1.55))}
.is-open .browser,html:not(.tb-on) .tb__item:target .browser{border-radius:12px;box-shadow:0 0 0 1px rgba(255,255,255,.14),0 50px 100px rgba(0,0,0,.55)}
.is-open .browser__bar span,html:not(.tb-on) .tb__item:target .browser__bar span{font-size:12px}
html.tb-open{overflow:hidden}
html.tb-open .footer{visibility:hidden}
/* the words arrive after the laptop lands */
@keyframes tbWords{from{opacity:0;translate:0 14px}}
@media (prefers-reduced-motion:no-preference){
  .tb__item.is-open .pc__close,.tb__item.is-open .pc__h,.tb__item.is-open .pc__peek>*,.tb__item.is-open .pc__story>*{animation:tbWords .6s var(--ease-out) both;animation-delay:calc(var(--k,0) * 60ms + 160ms)}
  .tb__item.is-open .pc__h{--k:1}.tb__item.is-open .pc__peek>:nth-child(1){--k:2}.tb__item.is-open .pc__peek>:nth-child(2){--k:3}.tb__item.is-open .pc__peek>:nth-child(3){--k:4}.tb__item.is-open .pc__peek>:nth-child(4){--k:5}
  .tb__item.is-open .pc__story>:nth-child(1){--k:6}.tb__item.is-open .pc__story>:nth-child(2){--k:7}.tb__item.is-open .pc__story>:nth-child(3){--k:8}
}
@keyframes tbFade{from{opacity:0}}
.tb__item.is-open.is-fading{animation:tbFade .25s linear both}

/* ---------- tablets and phones: no hover card; the table becomes a column you thumb through, and a tap opens one ---------- */
@media (max-width:1100px){
  .tb{min-height:0}
  .tb__top{grid-template-columns:minmax(0,1fr);align-items:start}
  .tb__table{grid-template-columns:repeat(2,minmax(0,1fr));gap:34px 26px}
  .tb__item,.tb__item:nth-child(n){--w:100%;--drop:0px;--dx:0%;justify-self:stretch}
  .tb__item:nth-child(2n){--drop:38px}
  .tb__item:not(.is-open) .pc__body{display:none}   /* shown again by nojs.css; hidden from the first paint so nothing jumps when the script arrives */
  .pc__body{padding:4px 4px 0}
  .tb__item.is-open .pc,html:not(.tb-on) .tb__item:target .pc{grid-template-columns:minmax(0,1fr);gap:0;padding-top:88px}
  .is-open .pc__close,html:not(.tb-on) .tb__item:target .pc__close,.is-open .pc__h,html:not(.tb-on) .tb__item:target .pc__h,.tb__item.is-open .pc__body,html:not(.tb-on) .tb__item:target .pc__body{grid-column:1}
  .is-open .pc__dev,html:not(.tb-on) .tb__item:target .pc__dev{grid-column:1;grid-row:auto;order:1;margin:6px 0 22px}
  .is-open .pc__h,html:not(.tb-on) .tb__item:target .pc__h{order:0}
  .is-open .pc__close,html:not(.tb-on) .tb__item:target .pc__close{order:-1}
  .is-open .mock,html:not(.tb-on) .tb__item:target .mock{width:min(100%,780px)}
}
@media (max-width:760px){
  .tb__table{grid-template-columns:minmax(0,1fr);gap:40px}
  .tb__item:nth-child(n){--drop:0px}
  .tb__item:nth-child(2n+1){--r:-1.6deg}
  .tb__item:nth-child(2n){--r:1.6deg}
  /* each one straightens as it reaches the middle of the screen, and its phone slides in beside it */
  html.tb-on .tb__item .mock__phone{translate:14px 10px;transition:translate .7s var(--ease-out)}
  html.tb-on .tb__item.is-in{rotate:0deg}
  html.tb-on .tb__item.is-in .mock__phone{translate:0 0}
  .pc__name{font-size:22px}
  .pc__tag{padding-top:12px}
  .tb__filters{margin-inline:calc(var(--gutter) * -1);padding:2px var(--gutter);overflow-x:auto;flex-wrap:nowrap;scrollbar-width:none}
  .tb__f{flex:none}
  .pc__stats{gap:8px}
  .pc__stats dd{font-size:16px}
  .is-open .pc__name,html:not(.tb-on) .tb__item:target .pc__name{font-size:clamp(28px,8vw,38px)}
}
/* on the table a sleeping screen is a picture: the tap opens the project, and the chip waits inside */
.tb__item:not(.is-open) .mock__tap{display:none}

@media (prefers-reduced-motion:reduce){
  .tb__item,.pc__body,.tb .browser,.tb .phone{transition:opacity .2s linear}
  html.tb-on .tb__item .mock__phone{translate:none;transition:none}
  .tb__item.is-up:not(.is-open),.tb__item.is-in:not(.is-open){rotate:var(--r);scale:1}
}
html{scrollbar-gutter:stable}   /* opening a project locks the page scroll: the bar keeps its place so nothing jumps sideways */
/* the same moving light as the homepage, fixed behind the whole table (bg.js) */
.tb .hero__bg{position:fixed;top:0;left:0;width:100%;height:100%;z-index:-1;-webkit-mask-image:none;mask-image:none}
body.pf{background:none}   /* html carries the same ink; the body would paint over the light */
/* laptops and monitors: the table is sized by the window height too, so all eight are on screen at once (short laptops) and it grows on big monitors */
@media (min-width:1101px){.tb__table{max-width:clamp(900px,calc((100svh - 150px) * 1.85),max(var(--wrap),165vh))}.tb__top{max-width:max(var(--wrap),165vh)}}
@media (min-width:1900px){.pc__body{width:min(310px,92%);font-size:14.5px}.pc__built{font-size:14.5px}.pc__feats{font-size:11px}.pc__links .btn,.pc__read{font-size:14px}}
@media (min-width:1101px) and (max-height:780px){.tb{padding-top:72px}.tb__top{padding-bottom:8px}.tb__table{row-gap:14px}.pc__tag{padding-top:8px}}
/* second row: the card hangs from the bottom of the project, so it never runs off the screen */
@media (min-width:1101px){.tb__item:nth-child(n+5):not(.is-open) .pc__body{top:auto;bottom:0}}
/* the address bar: a long name is cut, the "concept" label never is */
.tb .browser__bar span{display:flex;max-width:100%;white-space:nowrap}
.tb .browser__bar b{min-width:0;overflow:hidden;text-overflow:ellipsis;font-weight:inherit}
.tb .browser__bar em{flex:none;font-style:normal;white-space:pre}
/* 1001-1100px: the nav is hidden here and this page has no menu button, so the button stays */
@media (max-width:1100px){.pf .header__cta{display:inline-flex;margin-left:auto}.tb__item.is-open .pc__body{max-width:78ch}}
/* case study: the laptop page fades out at the bottom edge, so a cut line reads as 'there is more' */
.tb__item.is-open .mock__desk .mock__screen{-webkit-mask-image:linear-gradient(#000 calc(100% - 34px),transparent);mask-image:linear-gradient(#000 calc(100% - 34px),transparent)}
