:root {
  --paper: #f3f1eb;
  --paper-deep: #e9e6de;
  --upsc-field: #ececea;
  --white: #fbfaf7;
  --ink: #171816;
  --muted: #656760;
  --rule: #cbc8bf;
  --signal: #214fd6;
  --signal-dark: #153aab;
  --night: #171a1d;
  --night-ink: #f1f0eb;
  --sans: 'Manrope', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --mono: 'DM Mono', ui-monospace, SFMono-Regular, Consolas, monospace;
  --frame: min(100% - 48px, 1180px);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  background: var(--paper);
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font: inherit;
}

img {
  display: block;
  max-width: 100%;
}

::selection {
  background: var(--signal);
  color: white;
}

:focus-visible {
  outline: 2px solid var(--signal);
  outline-offset: 4px;
}

.skip-link {
  position: fixed;
  top: 0.75rem;
  left: 0.75rem;
  z-index: 3000;
  padding: 0.55rem 0.75rem;
  background: var(--ink);
  color: white;
  font-family: var(--mono);
  font-size: 0.68rem;
  transform: translateY(-200%);
}

.skip-link:focus {
  transform: translateY(0);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  width: 100%;
  min-height: 58px;
  padding-inline: max(24px, calc((100vw - 1180px) / 2));
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--rule);
  background: rgba(243, 241, 235, 0.94);
  backdrop-filter: blur(14px);
}

.identity {
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.identity span {
  margin-left: 0.16rem;
  color: var(--signal);
}

.topbar nav {
  display: flex;
  gap: clamp(1rem, 2.5vw, 2rem);
  font-family: var(--mono);
  font-size: 0.63rem;
}

.topbar nav a,
.project__links a,
.primary-link,
.secondary-link {
  border-bottom: 1px solid transparent;
  transition: border-color 140ms ease, color 140ms ease;
}

.topbar nav a:hover,
.project__links a:hover,
.primary-link:hover,
.secondary-link:hover {
  border-color: currentColor;
  color: var(--signal-dark);
}

.hero {
  width: var(--frame);
  margin: 0 auto;
  padding: 48px 0 54px;
}

.hero__mast {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--ink);
}

.hero__kicker {
  display: grid;
  gap: 0.05rem;
  margin: 0;
  font-family: var(--mono);
  font-size: 0.59rem;
  letter-spacing: 0.055em;
  line-height: 1.5;
  text-transform: uppercase;
}

.hero__kicker span,
.hero__reference {
  color: var(--muted);
}

.hero__reference {
  font-family: var(--mono);
  font-size: 0.59rem;
}

.hero__body {
  display: grid;
  padding: 46px 0 54px;
  grid-template-columns: minmax(0, 1.35fr) minmax(290px, 0.65fr);
  gap: clamp(3rem, 8vw, 7rem);
}

.hero h1 {
  margin: 0 0 0.65rem;
  font-size: clamp(2.45rem, 4.7vw, 4.2rem);
  font-weight: 600;
  letter-spacing: -0.058em;
  line-height: 1;
}

.hero__role {
  max-width: 690px;
  margin: 0;
  color: #373934;
  font-size: clamp(1.2rem, 2.1vw, 1.7rem);
  font-weight: 400;
  letter-spacing: -0.035em;
  line-height: 1.36;
}

.hero__brief dl {
  margin: 0;
  border-top: 1px solid var(--rule);
}

.hero__brief dl div {
  display: grid;
  padding: 0.58rem 0;
  border-bottom: 1px solid var(--rule);
  grid-template-columns: 84px 1fr;
  gap: 0.8rem;
}

.hero__brief dt,
.hero__brief dd {
  margin: 0;
  font-size: 0.66rem;
}

.hero__brief dt {
  color: var(--muted);
  font-family: var(--mono);
  text-transform: uppercase;
}

.hero__brief dd a {
  border-bottom: 1px solid var(--rule);
}

.hero__brief dd a:hover {
  border-color: var(--signal);
  color: var(--signal-dark);
}

.hero__index {
  display: grid;
  border-block: 1px solid var(--ink);
  grid-template-columns: repeat(4, 1fr);
}

.hero__index a {
  display: grid;
  min-height: 84px;
  padding: 1rem 1.2rem;
  grid-template-columns: 28px 1fr;
  align-content: center;
  column-gap: 0.6rem;
  transition: background 140ms ease, color 140ms ease;
}

.hero__index a + a {
  border-left: 1px solid var(--rule);
}

.hero__index a:hover {
  background: var(--ink);
  color: white;
}

.hero__index span,
.hero__index small {
  font-family: var(--mono);
  font-size: 0.56rem;
}

.hero__index span {
  grid-row: 1 / 3;
  color: var(--signal);
}

.hero__index strong {
  font-size: 0.76rem;
  font-weight: 650;
}

.hero__index small {
  color: var(--muted);
}

.hero__index a:hover small {
  color: #b9bbb5;
}

.project,
.more-work,
.close {
  padding: 76px max(24px, calc((100vw - 1180px) / 2));
}

.project__header {
  display: grid;
  margin-bottom: 30px;
  align-items: end;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  gap: 1.2rem;
}

.project__number,
.project__type,
.fact-label {
  margin: 0;
  font-family: var(--mono);
  font-size: 0.57rem;
  font-weight: 500;
  letter-spacing: 0.065em;
  text-transform: uppercase;
}

.project__number {
  align-self: start;
  padding-top: 0.32rem;
  color: var(--signal);
}

.project__type {
  margin-bottom: 0.4rem;
  color: var(--muted);
}

.project h2,
.more-work h2,
.close h2 {
  margin: 0;
  font-size: clamp(1.95rem, 3.4vw, 2.8rem);
  font-weight: 600;
  letter-spacing: -0.05em;
  line-height: 1.06;
}

.project__links {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.8rem 1.2rem;
  padding-bottom: 0.22rem;
  font-family: var(--mono);
  font-size: 0.62rem;
}

.gallery {
  position: relative;
  border: 1px solid var(--rule);
  background: var(--white);
}

.gallery__toolbar {
  display: flex;
  min-height: 52px;
  padding-left: 1rem;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--rule);
}

.gallery__toolbar > div {
  display: flex;
  align-items: center;
  gap: 0.8rem;
}

.gallery__label,
.gallery__count,
.gallery__controls button {
  font-family: var(--mono);
  font-size: 0.54rem;
  text-transform: uppercase;
}

.gallery__label {
  font-weight: 500;
  letter-spacing: 0.06em;
}

.gallery__count {
  color: var(--muted);
}

.gallery__controls {
  align-self: stretch;
}

.gallery__controls button {
  min-width: 76px;
  border: 0;
  border-left: 1px solid var(--rule);
  padding: 0 0.85rem;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  transition: background 140ms ease, color 140ms ease;
}

.gallery__controls [data-carousel-toggle] {
  min-width: 64px;
  color: var(--signal-dark);
}

.gallery__controls button:hover {
  background: var(--ink);
  color: white;
}

.gallery__progress {
  height: 3px;
  overflow: hidden;
  background: var(--paper-deep);
}

.gallery__progress span {
  display: block;
  width: 100%;
  height: 100%;
  background: var(--signal);
  transform: scaleX(0);
  transform-origin: left;
}

.gallery.is-playing .gallery__progress span {
  animation: gallery-progress 6s linear forwards;
}

.gallery__track {
  display: flex;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-behavior: smooth;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
}

.gallery__track::-webkit-scrollbar {
  display: none;
}

.gallery__slide {
  flex: 0 0 100%;
  width: 100%;
  margin: 0;
  scroll-snap-align: start;
  scroll-snap-stop: always;
}

.gallery__media {
  display: block;
  min-width: 0;
  min-height: 0;
  width: 100%;
  height: auto;
  border: 0;
  margin: 0;
  padding: 0;
  overflow: hidden;
  background: #eef0f3;
  cursor: zoom-in;
}

.gallery__media img {
  width: 100%;
  aspect-ratio: 2200 / 1258;
  object-fit: cover;
}

.gallery figcaption {
  display: grid;
  min-height: 64px;
  padding: 0.9rem 1rem;
  align-items: baseline;
  border-top: 1px solid var(--rule);
  grid-template-columns: 150px 1fr;
  gap: 1rem;
}

.gallery figcaption strong {
  font-size: 0.69rem;
}

.gallery figcaption span {
  color: var(--muted);
  font-size: 0.66rem;
}

.gallery__thumbs {
  display: flex;
  overflow-x: auto;
  border-top: 1px solid var(--rule);
  background: var(--paper);
  scrollbar-width: thin;
}

.gallery__thumb {
  position: relative;
  flex: 1 0 128px;
  min-width: 0;
  border: 0;
  border-right: 1px solid var(--rule);
  padding: 8px;
  background: transparent;
  color: var(--muted);
  text-align: left;
  cursor: pointer;
  transition: background 140ms ease, color 140ms ease;
}

.gallery__thumb:last-child {
  border-right: 0;
}

.gallery__thumb::before {
  position: absolute;
  inset: 0 0 auto;
  height: 3px;
  background: var(--signal);
  content: '';
  opacity: 0;
}

.gallery__thumb:hover {
  background: var(--white);
  color: var(--ink);
}

.gallery__thumb[aria-current='true'] {
  background: var(--white);
  color: var(--ink);
}

.gallery__thumb[aria-current='true']::before {
  opacity: 1;
}

.gallery__thumb img {
  width: 100%;
  aspect-ratio: 16 / 9;
  border: 1px solid rgba(23, 24, 22, 0.1);
  background: #e5e7ea;
  object-fit: cover;
}

.gallery__thumb span {
  display: block;
  overflow: hidden;
  margin-top: 0.42rem;
  font-family: var(--mono);
  font-size: 0.49rem;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.gallery--rig {
  background: #ebe7df;
}

.gallery--rig .gallery__slide {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 250px;
}

.gallery--rig .gallery__media {
  position: relative;
  display: block;
  height: clamp(430px, 47vw, 560px);
  padding: 0;
  background: #ebe7df;
}

.gallery--rig .gallery__media img {
  position: absolute;
  inset: 1.25rem;
  width: calc(100% - 2.5rem);
  max-width: none;
  height: calc(100% - 2.5rem);
  max-height: none;
  aspect-ratio: auto;
  object-fit: contain;
}

.gallery--rig figcaption {
  display: flex;
  min-width: 0;
  padding: 2rem 1.4rem;
  align-items: flex-start;
  flex-direction: column;
  justify-content: flex-end;
  border-top: 0;
  border-left: 1px solid var(--rule);
  gap: 0.65rem;
}

.gallery--rig figcaption strong {
  font-size: 0.86rem;
}

.gallery--rig figcaption span {
  line-height: 1.65;
}

.gallery--rig .gallery__thumb img {
  background: #ebe7df;
  object-fit: contain;
}

@keyframes gallery-progress {
  from { transform: scaleX(0); }
  to { transform: scaleX(1); }
}

.generation-facts {
  display: grid;
  margin-top: 24px;
  padding: 2rem clamp(1.4rem, 3vw, 2.5rem);
  background: var(--night);
  color: var(--night-ink);
  grid-template-columns: minmax(180px, 0.55fr) minmax(0, 1.45fr);
  gap: clamp(2rem, 5vw, 5rem);
}

.fact-label {
  color: #9db3ff;
}

.generation-facts__intro h3 {
  max-width: 390px;
  margin: 1rem 0 0;
  font-size: clamp(1.15rem, 2vw, 1.45rem);
  font-weight: 500;
  letter-spacing: -0.035em;
  line-height: 1.35;
}

.generation-facts ol {
  margin: 0;
  padding: 0;
  list-style: none;
}

.generation-facts li {
  display: grid;
  padding: 0.92rem 0;
  border-top: 1px solid rgba(255, 255, 255, 0.13);
  grid-template-columns: 32px minmax(0, 1fr);
  gap: 0.6rem;
}

.generation-facts li > span {
  color: #9db3ff;
  font-family: var(--mono);
  font-size: 0.53rem;
}

.generation-facts li div {
  display: grid;
  grid-template-columns: minmax(125px, 0.38fr) minmax(0, 1fr);
  gap: 1rem;
}

.generation-facts strong {
  font-size: 0.72rem;
}

.generation-facts p {
  margin: 0;
  color: #aeb0ae;
  font-size: 0.65rem;
  line-height: 1.55;
}

.project__notes {
  display: grid;
  margin-top: 26px;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 3rem;
}

.project__notes > p {
  max-width: 80ch;
  margin: 0;
  color: #484a45;
  font-size: 0.76rem;
  line-height: 1.75;
}

.project__notes ul {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  align-self: start;
  justify-content: flex-end;
  gap: 0.34rem;
  margin: 0;
  padding: 0.2rem 0 0;
  list-style: none;
}

.project__notes li {
  padding: 0;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.53rem;
  line-height: 1.4;
  white-space: nowrap;
}

.project__notes li + li::before {
  margin-right: 0.34rem;
  color: var(--rule);
  content: '/';
}

.project--upsc {
  background: var(--upsc-field);
}

.project--cbmanager {
  border-top: 1px solid var(--rule);
  background: var(--white);
}

.project--rig {
  border-top: 1px solid var(--rule);
  background: var(--paper-deep);
}

.screenshot-button--wide {
  border: 1px solid #292b2d;
  background: #050505;
}

.screenshot-button--wide img {
  aspect-ratio: 2000 / 1272;
  object-fit: contain;
}

.project__notes--columns {
  grid-template-columns: 1fr 1fr auto;
}

.more-work {
  border-top: 1px solid var(--ink);
}

.more-work > header {
  margin-bottom: 30px;
}

.link-ledger {
  border-top: 1px solid var(--ink);
}

.link-ledger a {
  display: grid;
  align-items: center;
  padding: 1.05rem 0;
  border-bottom: 1px solid var(--rule);
  grid-template-columns: minmax(145px, 0.28fr) minmax(0, 1fr) 72px;
  gap: 1.4rem;
  transition: background 140ms ease, padding 140ms ease, color 140ms ease;
}

.link-ledger a:hover {
  padding-inline: 0.8rem;
  background: var(--paper-deep);
  color: var(--signal-dark);
}

.link-ledger span {
  font-size: 0.78rem;
  font-weight: 650;
}

.link-ledger p {
  margin: 0;
  color: #565852;
  font-size: 0.7rem;
}

.link-ledger i {
  justify-self: end;
  font-family: var(--mono);
  font-size: 0.54rem;
  font-style: normal;
}

.close {
  display: grid;
  border-top: 0;
  background: var(--signal);
  color: white;
  grid-template-columns: minmax(220px, 0.7fr) minmax(0, 1.3fr);
  gap: clamp(3rem, 8vw, 7rem);
}

.close .project__type {
  color: rgba(255, 255, 255, 0.7);
}

.close h2 {
  max-width: 520px;
  color: white;
  font-size: clamp(2.25rem, 4.2vw, 3.45rem);
}

.close__copy {
  max-width: 650px;
  align-self: end;
}

.close__copy > p {
  margin: 0;
  color: rgba(255, 255, 255, 0.86);
  font-size: 0.9rem;
  line-height: 1.8;
}

.close__copy > div {
  display: flex;
  flex-wrap: wrap;
  gap: 1.3rem;
  margin-top: 2rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(255, 255, 255, 0.35);
}

.close .primary-link,
.close .secondary-link {
  color: white;
}

.close .primary-link:hover,
.close .secondary-link:hover {
  border-color: white;
  color: white;
}

.primary-link,
.secondary-link {
  font-family: var(--mono);
  font-size: 0.61rem;
}

.primary-link {
  color: var(--signal-dark);
}

footer {
  display: flex;
  min-height: 76px;
  align-items: center;
  justify-content: space-between;
  padding: 1.2rem max(24px, calc((100vw - 1180px) / 2));
  border-top: 1px solid #303336;
  background: var(--night);
  color: #9a9c98;
  font-family: var(--mono);
  font-size: 0.53rem;
  text-transform: uppercase;
}

footer a {
  color: #9db3ff;
}

.lightbox {
  width: min(94vw, 1500px);
  max-width: none;
  height: min(92vh, 1000px);
  max-height: none;
  border: 0;
  margin: auto;
  padding: 2.8rem 1rem 1rem;
  background: #111315;
  color: white;
  box-shadow: 0 30px 100px rgba(0, 0, 0, 0.5);
}

.lightbox::backdrop {
  background: rgba(12, 14, 15, 0.9);
  backdrop-filter: blur(6px);
}

.lightbox img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.lightbox__close {
  position: absolute;
  top: 0.65rem;
  right: 1rem;
  border: 0;
  border-bottom: 1px solid currentColor;
  background: transparent;
  color: #9db3ff;
  font-family: var(--mono);
  font-size: 0.59rem;
  cursor: pointer;
}

@media (max-width: 900px) {
  .hero__body,
  .generation-facts,
  .close {
    grid-template-columns: 1fr;
  }

  .hero__body {
    gap: 2.2rem;
  }

  .hero__brief {
    max-width: 620px;
  }

  .project__notes--columns {
    grid-template-columns: 1fr 1fr;
  }

  .project__notes--columns ul {
    grid-column: 1 / -1;
    justify-content: flex-start;
  }

  .close {
    gap: 2rem;
  }
}

@media (max-width: 680px) {
  :root {
    --frame: min(100% - 32px, 1180px);
  }

  body {
    font-size: 14px;
  }

  .topbar {
    min-height: 54px;
    padding-inline: 16px;
  }

  .topbar nav {
    gap: 0.85rem;
    font-size: 0.56rem;
  }

  .topbar nav a:first-child {
    display: none;
  }

  .hero {
    padding: 30px 0 38px;
  }

  .hero__body {
    padding: 34px 0 38px;
  }

  .hero h1 {
    font-size: clamp(2.25rem, 12vw, 3.2rem);
  }

  .hero__role {
    font-size: 1.08rem;
  }

  .hero__index {
    grid-template-columns: 1fr;
  }

  .hero__index a {
    min-height: 68px;
  }

  .hero__index a + a {
    border-top: 1px solid var(--rule);
    border-left: 0;
  }

  .project,
  .more-work,
  .close {
    padding: 54px 16px;
  }

  .project__header {
    grid-template-columns: 30px 1fr;
  }

  .project__links {
    grid-column: 2;
    justify-content: flex-start;
    margin-top: 0.35rem;
  }

  .gallery__toolbar {
    padding-left: 0.7rem;
  }

  .gallery__label {
    display: none;
  }

  .gallery__controls button {
    min-width: 62px;
    padding-inline: 0.45rem;
  }

  .gallery figcaption {
    min-height: 78px;
    grid-template-columns: 1fr;
    gap: 0.18rem;
  }

  .gallery--rig .gallery__media {
    height: min(112vw, 520px);
  }

  .gallery--rig .gallery__media img {
    inset: 0.7rem;
    width: calc(100% - 1.4rem);
    height: calc(100% - 1.4rem);
  }

  .gallery--rig .gallery__slide {
    grid-template-columns: 1fr;
  }

  .gallery--rig figcaption {
    min-height: 78px;
    padding: 0.9rem 1rem;
    border-top: 1px solid var(--rule);
    border-left: 0;
    gap: 0.18rem;
  }

  .gallery__thumb {
    flex-basis: 116px;
  }

  .generation-facts li div {
    grid-template-columns: 1fr;
    gap: 0.18rem;
  }

  .project__notes,
  .project__notes--columns {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .project__notes ul,
  .project__notes--columns ul {
    grid-column: auto;
    justify-content: flex-start;
  }

  .link-ledger a {
    grid-template-columns: 1fr auto;
    gap: 0.4rem 1rem;
  }

  .link-ledger p {
    grid-column: 1 / -1;
  }

  footer {
    align-items: flex-start;
    flex-direction: column;
    justify-content: center;
    gap: 0.45rem;
  }

  .lightbox {
    width: 100vw;
    height: 100vh;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }

  .gallery.is-playing .gallery__progress span {
    animation: none;
  }
}
