/* Works page: glassmorphism on a black scene.
   Colour plan, roughly 50 / 30 / 10:
   50%  black  #000000  page background and the scene behind the glass
   30%  white  #ffffff  frosted glass tint, text, borders and highlights
   10%  blue   #2C3480  light beam, orbs, tag chips, buttons and the hover glow
   Blue is too dark to read as text on black (about 1.9:1), so it is only used as a fill, a glow or a border.
   Text on blue is white (about 11:1). */
@property --spin { syntax: '<angle>'; inherits: false; initial-value: 0deg; }

:root {
  --black: #000000;
  --white: #ffffff;
  --blue: #2C3480;
  --text-soft: rgba(255,255,255,.76);
  --line: rgba(255,255,255,.14);
  --glass: linear-gradient(145deg, rgba(255,255,255,.17), rgba(255,255,255,.05) 55%, rgba(255,255,255,.10));
  --glass-line: rgba(255,255,255,.22);
  --ease: cubic-bezier(.2,.7,.2,1);
  color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
body {
  margin: 0; min-height: 100%;
  background: var(--black); color: var(--white);
  font: 15px/1.6 'Inter', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
a { color: inherit; }
a:focus-visible, button:focus-visible { outline: 2px solid var(--white); outline-offset: 3px; box-shadow: 0 0 0 5px var(--blue); }

/* ---------- Scene: a measuring beam over a drifting grid, with three soft orbs for the glass to frost ---------- */
.bg { position: fixed; inset: 0; z-index: 0; overflow: hidden; pointer-events: none; }
.bg i { position: absolute; display: block; }
.grid {
  inset: -56px 0 0 0;
  background-image: linear-gradient(var(--line) 1px, transparent 1px), linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 56px 56px;
  -webkit-mask-image: radial-gradient(ellipse 90% 75% at 60% 35%, #000 15%, transparent 78%);
          mask-image: radial-gradient(ellipse 90% 75% at 60% 35%, #000 15%, transparent 78%);
  animation: drift 7s linear infinite;
}
.beam {
  width: 160vmax; height: 160vmax; left: calc(70% - 80vmax); top: calc(-20% - 60vmax);
  background: conic-gradient(from 0deg at 50% 50%, transparent 0deg, transparent 300deg, rgba(44,52,128,0) 306deg, rgba(44,52,128,.95) 340deg, rgba(44,52,128,0) 360deg);
  -webkit-mask-image: radial-gradient(circle at 50% 50%, #000 0, #000 28%, transparent 50%);
          mask-image: radial-gradient(circle at 50% 50%, #000 0, #000 28%, transparent 50%);
  filter: blur(20px);
  animation: sweep 28s ease-in-out infinite alternate;
  will-change: transform;
}
.orb { border-radius: 50%; filter: blur(8px); will-change: transform; }
.o1 { width: 52vmax; height: 52vmax; left: -16vmax; top: 34%; background: radial-gradient(circle at 40% 40%, rgba(44,52,128,.85), rgba(44,52,128,0) 68%); animation: roam1 26s ease-in-out infinite alternate; }
.o2 { width: 44vmax; height: 44vmax; right: -14vmax; top: 6%; background: radial-gradient(circle at 50% 50%, rgba(44,52,128,.7), rgba(44,52,128,0) 68%); animation: roam2 31s ease-in-out infinite alternate; }
.o3 { width: 26vmax; height: 26vmax; left: 38%; top: 62%; background: radial-gradient(circle at 50% 50%, rgba(255,255,255,.16), rgba(255,255,255,0) 68%); animation: roam3 24s ease-in-out infinite alternate; }
@keyframes drift  { to { transform: translateY(56px); } }
@keyframes sweep  { from { transform: rotate(-38deg); } to { transform: rotate(38deg); } }
@keyframes roam1  { to { transform: translate(14vmax, -10vmax) scale(1.12); } }
@keyframes roam2  { to { transform: translate(-12vmax, 14vmax) scale(.9); } }
@keyframes roam3  { to { transform: translate(-18vmax, -12vmax) scale(1.2); } }

/* ---------- Layout ---------- */
.page, .foot { position: relative; z-index: 1; width: 100%; max-width: 1120px; margin-inline: auto; padding-inline: 20px; }
.top {
  position: sticky; top: calc(12px + env(safe-area-inset-top, 0px)); z-index: 5;
  width: min(1120px, calc(100% - 32px)); margin: calc(12px + env(safe-area-inset-top, 0px)) auto 0;
  display: flex; justify-content: space-between; align-items: center; gap: 16px;
  padding: 11px 22px; border-radius: 99px;
  background: var(--glass); border: 1px solid var(--glass-line);
  -webkit-backdrop-filter: blur(18px) saturate(150%); backdrop-filter: blur(18px) saturate(150%);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.28), 0 14px 30px -18px rgba(0,0,0,.9);
}
.top a { text-decoration: none; font-size: 14px; font-weight: 500; }
.top nav { display: flex; gap: 22px; }
.top nav a { color: var(--text-soft); transition: color .2s; }
.top nav a:hover, .back:hover { color: var(--white); }
.page { padding-top: clamp(36px, 7vw, 76px); padding-bottom: 80px; }

.label { margin: 0 0 14px; font: 500 11px/1.5 'IBM Plex Mono', monospace; letter-spacing: .16em; text-transform: uppercase; color: var(--text-soft); }
.label::before { content: ""; display: inline-block; width: 22px; height: 8px; background: var(--blue); margin-right: 10px; vertical-align: 1px; }
h1 { margin: 0 0 14px; font-size: clamp(34px, 5.4vw, 56px); line-height: 1.05; letter-spacing: -.03em; font-weight: 600; text-wrap: balance; }
.lede { margin: 0; max-width: 520px; color: var(--text-soft); font-size: 16px; }
.bar { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 14px; margin: 36px 0 28px; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; min-width: 0; }
.filters button {
  font: inherit; font-size: 13px; color: var(--text-soft); cursor: pointer;
  background: rgba(255,255,255,.07); border: 1px solid var(--glass-line); border-radius: 99px; padding: 7px 15px;
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  transition: background .25s, color .25s, border-color .25s, transform .25s var(--ease);
}
.filters button:hover { color: var(--white); border-color: rgba(255,255,255,.5); transform: translateY(-2px); }
.filters button[aria-pressed="true"] { background: var(--blue); border-color: rgba(255,255,255,.35); color: var(--white); }
.count { margin: 0; font: 500 12px/1 'IBM Plex Mono', monospace; letter-spacing: .1em; text-transform: uppercase; color: var(--text-soft); }
.empty { color: var(--text-soft); }

/* ---------- Glass cards ---------- */
.grid-works { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr)); gap: 26px; }
.work {
  position: relative; isolation: isolate; display: flex; flex-direction: column; min-width: 0;
  padding: 10px; border-radius: 22px; color: var(--white); text-decoration: none;
  background: var(--glass); border: 1px solid var(--glass-line);
  -webkit-backdrop-filter: blur(16px) saturate(150%); backdrop-filter: blur(16px) saturate(150%);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.3), inset 0 -1px 0 rgba(255,255,255,.05), 0 26px 50px -26px rgba(0,0,0,.95);
  transform: perspective(900px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)) translateY(var(--lift, 0px));
  transition:
    transform .3s ease-out, box-shadow .45s var(--ease), border-color .45s,
    opacity .9s var(--ease) var(--d, 0ms), filter .9s var(--ease) var(--d, 0ms),
    scale .9s var(--ease) var(--d, 0ms), translate .9s var(--ease) var(--d, 0ms);
}
/* Scroll reveal: blur in, rise and settle. Classes are added by works.js. */
.work.pre:not(.in) { opacity: 0; filter: blur(12px); scale: .94; translate: 0 34px; }
.work.in { animation: bob 7s ease-in-out calc(1.4s + var(--d, 0ms)) infinite alternate; }
.work.in:nth-child(even) { animation-duration: 8.4s; }
.work.in:nth-child(3n) { animation-duration: 9.6s; }
@keyframes bob { from { translate: 0 0; } to { translate: 0 -6px; } }

.work:hover, .work:focus-visible {
  --lift: -6px; animation-play-state: paused; border-color: rgba(255,255,255,.4);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.45), 0 0 0 1px rgba(44,52,128,.9), 0 30px 60px -20px rgba(44,52,128,.95), 0 0 70px -10px rgba(44,52,128,.9);
}
/* Edge light: a bright arc travels around the border on hover */
.work::before {
  content: ""; position: absolute; inset: -1px; border-radius: inherit; padding: 1px; pointer-events: none; z-index: 2;
  background: conic-gradient(from var(--spin), transparent 0 58%, rgba(255,255,255,.95) 76%, #2C3480 88%, transparent 96%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor;
          mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
  opacity: 0; transition: opacity .4s; animation: spin 3.2s linear infinite;
}
/* Sheen: a soft highlight that follows the pointer */
.work::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; z-index: 1;
  background: radial-gradient(360px circle at var(--mx, 50%) var(--my, 0%), rgba(255,255,255,.2), transparent 45%);
  opacity: 0; transition: opacity .4s;
}
.work:hover::before, .work:focus-visible::before, .work:hover::after, .work:focus-visible::after { opacity: 1; }
@keyframes spin { to { --spin: 360deg; } }

.thumb { position: relative; aspect-ratio: 1.91 / 1; border-radius: 14px; overflow: hidden; background: #07070d; border: 1px solid var(--line); }
.thumb .ph {
  position: absolute; inset: 0; display: grid; place-items: center;
  font: 600 64px/1 'Inter', sans-serif; color: rgba(255,255,255,.92);
  background: linear-gradient(135deg, transparent 0 55%, rgba(44,52,128,.9) 55% 100%), linear-gradient(var(--line) 1px, transparent 1px) 0 0 / 100% 28px, #000;
}
.thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity .6s, transform .8s var(--ease); }
.thumb img.on { opacity: 1; }
.work:hover .thumb img, .work:focus-visible .thumb img { transform: scale(1.07); }
/* Scan: a light bar sweeps across the thumbnail each time you hover */
.thumb::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(105deg, transparent 38%, rgba(255,255,255,.34) 50%, transparent 62%);
  transform: translateX(-130%);
}
.work:hover .thumb::after, .work:focus-visible .thumb::after { transform: translateX(130%); transition: transform 1s var(--ease); }
.status {
  position: absolute; left: 10px; top: 10px; font: 500 10.5px/1 'IBM Plex Mono', monospace; letter-spacing: .12em; text-transform: uppercase;
  color: var(--white); background: rgba(44,52,128,.92); border: 1px solid rgba(255,255,255,.28); border-radius: 99px; padding: 6px 10px 6px 8px;
}
.status::before { content: ""; display: inline-block; width: 6px; height: 6px; margin-right: 6px; border-radius: 50%; background: var(--white); animation: pulse 1.8s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .25; transform: scale(.7); } }

.body { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; padding: 14px 8px 6px; flex: 1; min-width: 0; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tags span {
  font: 500 10.5px/1 'IBM Plex Mono', monospace; letter-spacing: .08em; text-transform: uppercase; color: var(--white);
  background: rgba(44,52,128,.9); border: 1px solid rgba(255,255,255,.22); border-radius: 99px; padding: 5px 9px;
  transition: transform .4s var(--ease), background .3s;
}
.work:hover .tags span, .work:focus-visible .tags span { transform: translateY(-2px); }
.work:hover .tags span:nth-child(2) { transition-delay: .05s; }
.work:hover .tags span:nth-child(3) { transition-delay: .1s; }
.t {
  margin: 0; font-size: 19px; line-height: 1.3; letter-spacing: -.01em; font-weight: 600; overflow-wrap: anywhere;
  background: linear-gradient(var(--white), var(--white)) 0 100% / 0 2px no-repeat; padding-bottom: 2px;
  transition: background-size .55s var(--ease);
}
.work:hover .t, .work:focus-visible .t { background-size: 100% 2px; }
.d { align-self: stretch; margin: 0; color: var(--text-soft); font-size: 14.5px; line-height: 1.55; display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.d.loading { color: transparent; border-radius: 6px; min-height: 3.1em; background: linear-gradient(90deg, rgba(255,255,255,.06) 25%, rgba(255,255,255,.16) 50%, rgba(255,255,255,.06) 75%) 0 0 / 200% 100%; animation: shimmer 1.4s linear infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }
.foot-row { align-self: stretch; margin-top: auto; padding-top: 12px; display: flex; justify-content: space-between; align-items: center; gap: 12px; border-top: 1px solid var(--line); }
.host { font: 500 11.5px/1.2 'IBM Plex Mono', monospace; color: var(--text-soft); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.go {
  flex: none; display: inline-flex; gap: 6px; align-items: center; font-size: 13px; font-weight: 500; color: var(--white);
  background: var(--blue); border: 1px solid rgba(255,255,255,.3); border-radius: 99px; padding: 7px 14px;
  transition: background .3s, color .3s, padding .35s var(--ease);
}
.go b { font-weight: 500; display: inline-block; transition: transform .35s var(--ease); }
.work:hover .go, .work:focus-visible .go { background: var(--white); color: var(--black); padding-inline: 17px; }
.work:hover .go b, .work:focus-visible .go b { transform: translate(3px, -3px) rotate(8deg); }

.foot { display: flex; flex-wrap: wrap; gap: 8px 28px; padding-block: 28px calc(40px + env(safe-area-inset-bottom, 0px)); border-top: 1px solid var(--line); font-size: 14px; color: var(--text-soft); }
.foot a { text-decoration: none; color: var(--white); }
.foot a:hover { text-decoration: underline; text-underline-offset: 4px; }

@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .work, .top { background: rgba(22,22,36,.94); }
}
@media (hover: none) { .work:active { scale: .985; } }
@media (max-width: 560px) {
  .grid-works { gap: 20px; }
  .bar { margin-top: 28px; }
  .top { padding: 10px 18px; }
}
@media (prefers-reduced-motion: reduce) {
  .grid, .beam, .orb, .work, .work::before, .status::before, .d.loading { animation: none !important; }
  .work, .thumb img, .go b, .tags span, .t { transition: none !important; }
  .work.pre:not(.in) { opacity: 1; filter: none; scale: 1; translate: none; }
  .beam { transform: rotate(8deg); }
}
