/* Card edges and background dots share one responsive spacing unit. */
:root { --matrix-step: 24px; --page-inset: 96px; }
body { isolation: isolate; }
.dot-matrix { position: fixed; inset: 0; width: 100%; height: 100%; z-index: -1; pointer-events: none; }
.page { width: min(1296px, calc(100% - var(--page-inset)), var(--aligned-page-width, 1296px)); }
.work-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-template-areas: "ami citizen citizen" "batch citizen citizen" "astrid unfurl operations";
  grid-template-rows: minmax(384px, auto) minmax(384px, auto) minmax(384px, auto);
  gap: var(--matrix-step);
}
.work-grid > .ami-tile { grid-area: ami; }
.work-grid > .batch-tile { grid-area: batch; }
.work-grid > .citizen-tile { grid-area: citizen; min-height: 0; }
.work-grid > .operations-tile { grid-area: operations; }

.work-grid > .astrid-tile { grid-area: astrid; }
.work-grid > .unfurl-tile { grid-area: unfurl; display: flex; flex-direction: column; padding: 25px; }
.unfurl-tile .tile-top { gap: 8px; }
.unfurl-status { white-space: nowrap; flex-shrink: 0; }
.unfurl-content { flex: 1; min-height: 0; flex-direction: column; align-items: flex-start; gap: 12px; padding: 20px 0 0; }
.unfurl-art { align-self: center; width: 180px; height: 155px; }
@media (min-width:701px) {
  .sketch-tile { grid-template-columns: minmax(0, 1fr) minmax(0, 240px); gap: 32px; }
  .sketch-tile .pixel-grid, .sketch-tile .sketch-actions { max-width: none; }
}
.system-tile { margin-top: var(--matrix-step); }
.operations-tile { display: flex; flex-direction: column; }
.operations-tile .stream { flex: 1; width: 100%; max-width: none; min-height: 105px; max-height: 150px; margin-block: auto; margin-inline: 0; }
.operations-tile .ops-bottom { margin-top: auto; }
.work-grid > .tile, .system-tile, .canvas-section {
  transform: perspective(1000px) translateZ(0) rotateX(0) rotateY(0);
  transform-origin: 50% 50%;
  transition: transform .4s var(--ease), box-shadow .4s var(--ease);
}
.work-grid > .tile.is-elevated, .system-tile.is-elevated, .canvas-section.is-elevated {
  transform: perspective(1000px) translateZ(36px) rotateX(var(--tile-rx, 0deg)) rotateY(var(--tile-ry, 0deg));
  box-shadow: 0 28px 64px #0006, 0 10px 22px #0003, inset 0 1px 0 #ffffff0c;
  z-index: 20;
  will-change: transform;
}
html[data-theme=light] .tile.is-elevated { box-shadow: 0 28px 64px #23335a29, 0 10px 22px #23335a14, inset 0 1px 0 #ffffffb3; }

/* Stable hover areas prevent raised media from jumping out from under the pointer. */
.ami-gallery { --shot-height: 214px; --shot-gap: 62px; transform: none; min-height: 265px; }
.work-grid .ami-gallery .ami-shot {
  position: absolute; left: 50%; top: 50%; width: calc(var(--shot-height) * 221 / 480); height: var(--shot-height);
  transform: translate(calc(-50% + var(--shot-x, 0px)), -50%);
  z-index: 3; cursor: pointer;
}
.ami-shot:first-child { --shot-x: calc(-1 * var(--shot-gap)); --shot-rotation: -8deg; z-index: 1 !important; }
.ami-shot:nth-child(3) { --shot-x: var(--shot-gap); --shot-rotation: 8deg; z-index: 2 !important; }
.work-grid .ami-gallery .ami-shot img {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain;
  transform: rotate(var(--shot-rotation, 0deg)); transform-origin: 50% 75%;
  transition: transform .45s var(--ease), box-shadow .45s var(--ease);
  pointer-events: none; user-select: none;
}
.work-grid .ami-tile.is-elevated .ami-gallery .ami-shot img { transform: translateY(-10px) rotate(var(--shot-rotation, 0deg)) scale(1.48); box-shadow: 0 26px 42px #0004; }
.work-grid .ami-gallery .ami-shot.is-front { z-index: 30 !important; }
.work-grid .ami-tile .ami-gallery .ami-shot.is-front img { transform: translateY(-10px) rotate(0deg) scale(1.68); box-shadow: 0 34px 54px #0005, 0 7px 12px #0002; }
.ami-tile.is-elevated .tile-top, .batch-tile.is-elevated .tile-top { opacity: 0; }
.ami-tile .tile-top, .batch-tile .tile-top { transition: opacity .18s ease; }
.batch-preview { transform: none; min-height: 265px; }
.work-grid .batch-open .play-badge { width: auto; height: auto; border: 0; display: inline-flex; gap: 4px; }
.work-grid .batch-open .tile-top > span:first-child { max-width: none; }
.batch-video-hit { display: block; height: 236px; aspect-ratio: 9 / 16; position: relative; pointer-events: auto; }
.work-grid .batch-video-hit video { height: 100%; width: 100%; transform: rotate(3deg); pointer-events: none; transform-origin: 50% 82%; transition: transform .45s var(--ease), box-shadow .45s var(--ease); }
.work-grid .batch-tile.is-elevated .batch-video-hit video { transform: translateY(-10px) rotate(2deg) scale(1.38); box-shadow: 0 26px 42px #0004; }
.work-grid .batch-tile .batch-video-hit.is-front video { transform: translateY(-10px) rotate(-2deg) scale(1.52); box-shadow: 0 34px 54px #0005, 0 7px 12px #0002; }
.batch-preview, .ami-gallery { z-index: 5; }
.ami-tile, .batch-tile { overflow: visible; }

@media (max-width:1150px) { :root { --page-inset: 64px; } }
@media (max-width:999px) and (min-width:701px) {
  .work-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-areas: "ami batch" "citizen citizen" "astrid unfurl" "operations operations";
    grid-template-rows: minmax(384px, auto) minmax(624px, auto) minmax(336px, auto) minmax(336px, auto);
  }
}
@media (max-width:760px) {
  :root { --matrix-step: 16px; --page-inset: 36px; }
  .ami-gallery { --shot-height: 210px; --shot-gap: 60px; }
  .work-grid > .ami-tile > a, .work-grid .batch-open { padding: 23px 25px; min-height: 0; }
  .batch-video-hit { height: 260px; }
  .sketch-tile { padding: 24px 20px; }
}
@media (max-width:700px) {
  .marker-hit { r: 46; }
  .work-grid {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "ami" "batch" "citizen" "astrid" "unfurl" "operations";
    grid-template-rows: minmax(384px, auto) minmax(384px, auto) minmax(640px, auto) minmax(352px, auto) minmax(352px, auto) minmax(352px, auto);
  }
  .ami-gallery { --shot-height: 220px; --shot-gap: 62px; min-height: 270px; }
  .batch-preview { min-height: 285px; }
}
@media (max-width:370px) {
  .ami-gallery { --shot-height: 200px; --shot-gap: 53px; }
  .work-grid { grid-template-rows: minmax(368px, auto) minmax(384px, auto) minmax(640px, auto) minmax(352px, auto) minmax(352px, auto) minmax(352px, auto); }
  .work-grid > .ami-tile > a, .work-grid .batch-open { padding-inline: 20px; }
}
@media (hover:none), (pointer:coarse) {
  .ami-tile, .batch-tile { overflow: hidden; }
}
@media (prefers-reduced-motion:reduce) {
  .work-grid > .tile, .system-tile, .canvas-section, .work-grid .ami-shot img, .work-grid .batch-video-hit video { transform: none !important; will-change: auto !important; }
}
html[data-motion=off] :is(.work-grid > .tile, .system-tile, .canvas-section) { transform: none; will-change: auto; }

.canvas-section { margin-top: var(--matrix-step); min-height: 360px; }
.closing-copy .about-button { position: static; display: inline-flex; align-items: center; min-height: 44px; margin: 0; padding: 10px 18px; border-radius: 999px; }
.citizen-card-hit { position: absolute; inset: 0; z-index: 0; width: 100%; height: 100%; background: transparent; border-radius: inherit; }
.citizen-card-hit:focus-visible { outline-offset: -6px; }
.citizen-title, .citizen-surface > .art-caption { pointer-events: none; }
.citizen-title .citizen-open { pointer-events: auto; }
@media(max-width:370px) { .canvas-section { min-height: 512px; } }

/* The final desktop row shares the three product-grid columns. */
.site-extras { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--matrix-step); margin-top: var(--matrix-step); align-items: stretch; }
.site-extras > .tile { margin: 0; }
.site-extras > .canvas-section { grid-column: auto; }
.site-extras > .system-tile { grid-column: span 2; }
.site-extras .system-open { height: 100%; gap: 24px; }
.site-extras .system-art { padding-right: 0; gap: 24px; }
.site-extras .system-copy { min-width: 0; }
@media(min-width:1000px) {
  .site-extras .canvas-section { grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: 16px; min-height: 384px; padding: 25px; }
}
@media(min-width:1000px) and (max-width:1150px) {
  .site-extras .canvas-section { grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); }
  .site-extras .palette { gap: 2px; }
  .site-extras .palette button { width: 17px; height: 17px; border-width: 2px; }
  .site-extras .sketch-actions { gap: 6px; padding-inline: 4px; }
}
@media(max-width:999px) {
  .site-extras { grid-template-columns: minmax(0, 1fr); }
  .site-extras > .system-tile { grid-column: auto; }
}
