/* "See what we build" + "Different worlds" as bento grids (work-bento.js adds .nl-bento and the tiles).
   The original carousel and world strips are hidden but stay in the page, so the tour state, the
   world study and its opening animation keep working. */

/* ---- hide the originals (kept in the DOM) ---- */
html:root body #selected-work.nl-bento .swb-experience,
html:root body #selected-work.nl-bento .swb > .swb-fx,
html:root body #selected-work.nl-bento .nwx-gate-art--study {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  overflow: hidden !important;
  clip-path: inset(50%) !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

/* ---- stack the two parts as rows ---- */
@media (min-width: 901px) {
  html:root body #selected-work.nl-bento .nwx-gate { display: block !important; grid-template-columns: none !important; }
  html:root body #selected-work.nl-bento .nwx-gate > * { width: 100% !important; max-width: none !important; }
  html:root body #selected-work.nl-bento .nwx-gate-doors {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 120px !important;
  }
  html:root body #selected-work.nl-bento .nwx-gate-doors > * {
    grid-column: 1 !important;
    grid-area: auto !important;
    position: relative !important;
    inset: auto !important;
    width: 100% !important;
    max-width: none !important;
    border: 0 !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
  }
  html:root body #selected-work.nl-bento .nwx-gate-door--work  { grid-row: 1 !important; display: block !important; }
  html:root body #selected-work.nl-bento .nwx-gate-door--study { grid-row: 2 !important; display: block !important; }
  html:root body #selected-work.nl-bento .nwx-gate-doors::before,
  html:root body #selected-work.nl-bento .nwx-gate-doors::after,
  html:root body #selected-work.nl-bento .nwx-gate-door--study::before,
  html:root body #selected-work.nl-bento .nwx-gate-door--study::after { display: none !important; }

  html:root body #selected-work.nl-bento .nl-worlds-heading {
    display: flex !important;
    flex-direction: row !important;
    align-items: flex-end !important;
    justify-content: flex-start !important;
    gap: 30px;
    text-align: left !important;
    margin-bottom: 30px !important;
  }
  html:root body #selected-work.nl-bento .nl-worlds-title-group { text-align: left !important; margin: 0 !important; }
  html:root body #selected-work.nl-bento .nl-worlds-deck { flex: 1 !important; text-align: left !important; margin: 0 0 10px 6px !important; }
  html:root body #selected-work.nl-bento .nwx-gate-copy--study { margin: 0 0 6px auto !important; }
}

/* ---- grids ---- */
html:root body #selected-work .nl-bento-sites,
html:root body #selected-work .nl-bento-worlds {
  display: grid;
  gap: 14px;
}
html:root body #selected-work .nl-bento-sites {
  grid-template-columns: repeat(12, 1fr);
  grid-template-rows: repeat(4, 150px);
  grid-template-areas:
    "s1 s1 s1 s1 s1 s1 s1 s2 s2 s2 s2 s2"
    "s1 s1 s1 s1 s1 s1 s1 s2 s2 s2 s2 s2"
    "s1 s1 s1 s1 s1 s1 s1 s3 s3 s3 s4 s4"
    "s1 s1 s1 s1 s1 s1 s1 s3 s3 s3 s4 s4";
  margin-bottom: 40px;
}
html:root body #selected-work .nl-site-1 { grid-area: s1; }
html:root body #selected-work .nl-site-2 { grid-area: s2; }
html:root body #selected-work .nl-site-3 { grid-area: s3; }
html:root body #selected-work .nl-site-4 { grid-area: s4; }

html:root body #selected-work .nl-bento-worlds {
  grid-template-columns: repeat(12, 1fr);
  grid-template-rows: repeat(2, 210px);
  grid-template-areas:
    "w1 w1 w1 w1 w1 w2 w2 w2 w3 w3 w3 w3"
    "w1 w1 w1 w1 w1 w4 w4 w4 w4 w5 w5 w5";
}
html:root body #selected-work .nl-world-1 { grid-area: w1; }
html:root body #selected-work .nl-world-2 { grid-area: w2; }
html:root body #selected-work .nl-world-3 { grid-area: w3; }
html:root body #selected-work .nl-world-4 { grid-area: w4; }
html:root body #selected-work .nl-world-5 { grid-area: w5; }

/* ---- tile ---- */
html:root body #selected-work .nl-tile {
  --accent: 112, 217, 236;
  position: relative;
  display: block;
  min-width: 0;
  overflow: hidden;
  padding: 0;
  margin: 0;
  border: 1px solid rgba(255, 255, 255, .08);
  border-radius: 18px;
  background: #0a0f19;
  color: #fff;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  isolation: isolate;
  transition: border-color .4s ease, box-shadow .5s ease, transform .5s cubic-bezier(.2, .7, .2, 1);
}
html:root body #selected-work .nl-tile--world { --accent: 236, 112, 178; font: inherit; }
html:root body #selected-work .nl-tile-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
  transform: scale(1.02);
  transition: transform 1.1s cubic-bezier(.2, .7, .2, 1), filter .6s ease;
  filter: brightness(.82);
}
html:root body #selected-work .nl-tile--world .nl-tile-img { object-position: center; filter: brightness(.7) saturate(.95); }
html:root body #selected-work .nl-tile-shade {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(5, 8, 15, .15) 0%, rgba(5, 8, 15, 0) 35%, rgba(5, 8, 15, .88) 100%);
  transition: background .5s ease;
}

/* top row: number + tag */
html:root body #selected-work .nl-tile-top {
  position: absolute;
  top: 16px;
  left: 18px;
  right: 18px;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 10px;
}
html:root body #selected-work .nl-tile-num {
  font: 600 11px/1 var(--mono, ui-monospace, monospace);
  letter-spacing: .18em;
  color: rgba(var(--accent), 1);
}
html:root body #selected-work .nl-tile-tag {
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(5, 8, 15, .7);
  border: 1px solid rgba(255, 255, 255, .14);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  font: 600 10.5px/1 var(--display, inherit);
  letter-spacing: .14em;
  text-transform: uppercase;
  color: #e3eaf3;
}

/* bottom text; the description slides in on hover */
html:root body #selected-work .nl-tile-body {
  position: absolute;
  left: 20px;
  right: 70px;
  bottom: 18px;
  z-index: 2;
  display: flex;
  flex-direction: column;
  gap: 5px;
}
html:root body #selected-work .nl-tile-host {
  font: 500 11px/1 var(--mono, ui-monospace, monospace);
  color: rgba(var(--accent), .9);
}
html:root body #selected-work .nl-tile-name {
  font: 700 clamp(18px, 1.6vw, 24px)/1.1 var(--display, inherit);
  letter-spacing: .01em;
  color: #fff;
}
html:root body #selected-work .nl-site-1 .nl-tile-name { font-size: clamp(24px, 2.4vw, 36px); }
html:root body #selected-work .nl-tile-line {
  max-width: 56ch;
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  font-size: 14px;
  line-height: 1.55;
  color: #c3cdda;
  transition: max-height .5s ease, opacity .4s ease;
}
html:root body #selected-work .nl-tile-meta {
  font: 600 10.5px/1.3 var(--display, inherit);
  letter-spacing: .14em;
  text-transform: uppercase;
  color: #94a1b3;
}
html:root body #selected-work .nl-tile--world .nl-tile-meta { font-size: 12px; letter-spacing: .08em; text-transform: none; color: #b7c2d1; }

html:root body #selected-work .nl-tile-go {
  position: absolute;
  right: 18px;
  bottom: 18px;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, .28);
  background: rgba(5, 8, 15, .45);
  font-size: 15px;
  transition: background .3s ease, color .3s ease, border-color .3s ease, transform .4s ease;
}

/* ---- hover / focus ---- */
html:root body #selected-work .nl-tile:hover,
html:root body #selected-work .nl-tile:focus-visible {
  border-color: rgba(var(--accent), .55);
  box-shadow: 0 26px 60px -30px rgba(var(--accent), .6);
  transform: translateY(-4px);
  outline: none;
}
html:root body #selected-work .nl-tile:hover .nl-tile-img,
html:root body #selected-work .nl-tile:focus-visible .nl-tile-img { transform: scale(1.07); filter: brightness(.95); }
html:root body #selected-work .nl-tile:hover .nl-tile-shade,
html:root body #selected-work .nl-tile:focus-visible .nl-tile-shade {
  background: linear-gradient(180deg, rgba(5, 8, 15, .1) 0%, rgba(5, 8, 15, .25) 40%, rgba(5, 8, 15, .94) 100%);
}
html:root body #selected-work .nl-tile:hover .nl-tile-line,
html:root body #selected-work .nl-tile:focus-visible .nl-tile-line { max-height: 6em; opacity: 1; }
html:root body #selected-work .nl-tile:hover .nl-tile-go,
html:root body #selected-work .nl-tile:focus-visible .nl-tile-go {
  background: rgba(var(--accent), 1);
  border-color: rgba(var(--accent), 1);
  color: #061018;
  transform: rotate(45deg);
}

/* ---- tablets and phones ---- */
@media (max-width: 900px) {
  html:root body #selected-work .nl-bento-sites,
  html:root body #selected-work .nl-bento-worlds {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: none;
    grid-auto-rows: 200px;
    grid-template-areas: none;
  }
  html:root body #selected-work .nl-bento-sites > *,
  html:root body #selected-work .nl-bento-worlds > * { grid-area: auto; }
  html:root body #selected-work .nl-site-1,
  html:root body #selected-work .nl-world-1 { grid-column: 1 / -1; grid-row: span 1; }
  html:root body #selected-work .nl-bento-worlds { margin-top: 18px; }
  html:root body #selected-work .nl-tile-line { display: none; }
}
@media (max-width: 560px) {
  html:root body #selected-work .nl-bento-sites,
  html:root body #selected-work .nl-bento-worlds { grid-template-columns: 1fr; grid-auto-rows: 210px; }
  html:root body #selected-work .nl-tile-body { right: 64px; }
}

@media (prefers-reduced-motion: reduce) {
  html:root body #selected-work .nl-tile,
  html:root body #selected-work .nl-tile-img,
  html:root body #selected-work .nl-tile-line,
  html:root body #selected-work .nl-tile-go { transition: none; }
}

/* narrow tiles: drop the host line, keep the platform to one line */
@media (min-width: 901px) {
  html:root body #selected-work .nl-site-3 .nl-tile-host,
  html:root body #selected-work .nl-site-4 .nl-tile-host { display: none; }
  html:root body #selected-work .nl-site-3 .nl-tile-meta,
  html:root body #selected-work .nl-site-4 .nl-tile-meta { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  html:root body #selected-work .nl-site-4 .nl-tile-name { font-size: clamp(17px, 1.4vw, 21px); }
}

/* ======================================================================
   Extra polish: aurora backdrop, staggered entrance, pointer light,
   3D tilt, a light running round the edge, big outlined numbers.
   ====================================================================== */
@property --nl-spin { syntax: '<angle>'; inherits: false; initial-value: 0deg; }

/* aurora behind both grids */
html:root body #selected-work.nl-bento .nl-bento-sites,
html:root body #selected-work.nl-bento .nl-bento-worlds { position: relative; }
html:root body #selected-work.nl-bento .nl-bento-sites::before,
html:root body #selected-work.nl-bento .nl-bento-worlds::before {
  content: '';
  position: absolute;
  inset: -12% -6%;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(40% 50% at 18% 30%, rgba(112, 217, 236, .14), transparent 70%),
    radial-gradient(35% 45% at 82% 70%, rgba(185, 57, 233, .14), transparent 70%);
  filter: blur(20px);
  animation: nl-aurora 14s ease-in-out infinite alternate;
}
html:root body #selected-work.nl-bento .nl-bento-worlds::before {
  background:
    radial-gradient(40% 50% at 80% 25%, rgba(236, 112, 178, .14), transparent 70%),
    radial-gradient(35% 45% at 15% 75%, rgba(112, 217, 236, .12), transparent 70%);
}
@keyframes nl-aurora { to { transform: translate3d(3%, -4%, 0) scale(1.06); } }

/* entrance */
html:root body #selected-work.nl-bento .nl-tile {
  --rx: 0deg;
  --ry: 0deg;
  --mx: 50%;
  --my: 50%;
  opacity: 0;
  transform: perspective(1200px) translateY(36px) scale(.97);
  transition:
    opacity .8s ease var(--d, 0ms),
    transform .9s cubic-bezier(.2, .7, .2, 1) var(--d, 0ms),
    border-color .4s ease, box-shadow .5s ease;
}
html:root body #selected-work.nl-bento .nl-tile.is-in {
  opacity: 1;
  transform: perspective(1200px) rotateX(var(--rx)) rotateY(var(--ry)) translateY(0) scale(1);
}
html:root body #selected-work.nl-bento .nl-tile.is-in:hover,
html:root body #selected-work.nl-bento .nl-tile.is-in:focus-visible {
  transform: perspective(1200px) rotateX(var(--rx)) rotateY(var(--ry)) translateY(-6px) scale(1.01);
  transition: opacity .8s ease, transform .35s cubic-bezier(.2, .7, .2, 1), border-color .4s ease, box-shadow .5s ease;
}

/* pointer light over the picture */
html:root body #selected-work.nl-bento .nl-tile::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background: radial-gradient(420px circle at var(--mx) var(--my), rgba(var(--accent), .22), transparent 60%);
  opacity: 0;
  transition: opacity .4s ease;
  mix-blend-mode: screen;
}
html:root body #selected-work.nl-bento .nl-tile:hover::after { opacity: 1; }

/* light running round the edge while hovered */
html:root body #selected-work.nl-bento .nl-tile-ring {
  position: absolute;
  inset: 0;
  z-index: 3;
  border-radius: inherit;
  padding: 1.5px;
  pointer-events: none;
  background: conic-gradient(from var(--nl-spin), transparent 0 70%, rgba(var(--accent), .9) 86%, #fff 92%, transparent 100%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  opacity: 0;
  transition: opacity .4s ease;
}
html:root body #selected-work.nl-bento .nl-tile:hover .nl-tile-ring,
html:root body #selected-work.nl-bento .nl-tile:focus-visible .nl-tile-ring {
  opacity: 1;
  animation: nl-ring-spin 2.8s linear infinite;
}
@keyframes nl-ring-spin { to { --nl-spin: 360deg; } }

/* big outlined number, top right */
html:root body #selected-work.nl-bento .nl-tile-big {
  position: absolute;
  top: 6px;
  right: 16px;
  z-index: 2;
  font: 800 clamp(48px, 6vw, 96px)/1 var(--display, inherit);
  letter-spacing: -.03em;
  color: transparent;
  -webkit-text-stroke: 1px rgba(255, 255, 255, .22);
  pointer-events: none;
  transition: -webkit-text-stroke-color .4s ease, transform .6s cubic-bezier(.2, .7, .2, 1);
}
html:root body #selected-work.nl-bento .nl-site-1 .nl-tile-big { font-size: clamp(80px, 10vw, 150px); }
html:root body #selected-work.nl-bento .nl-tile:hover .nl-tile-big {
  -webkit-text-stroke-color: rgba(var(--accent), .7);
  transform: translateY(-4px);
}

@media (prefers-reduced-motion: reduce) {
  html:root body #selected-work.nl-bento .nl-tile { opacity: 1; transform: none; transition: none; }
  html:root body #selected-work.nl-bento .nl-bento-sites::before,
  html:root body #selected-work.nl-bento .nl-bento-worlds::before,
  html:root body #selected-work.nl-bento .nl-tile:hover .nl-tile-ring { animation: none; }
}
