/* Bit Twisted: "Workshop" design system.
   Dark blueprint grid, monospace labels, lime highlighter accent.
   No external loads: system font stacks only, every url() root-relative. */

:root {
  --bg: #101418;
  --grid: #1a2128;
  --text: #d7dde3;
  --muted: #8d9aa6;
  --accent: #b6f36b;
  --panel: #151b21;
  --panel-border: #26303a;
  --bench-border: #3a4652;

  --accent-hl: #b6f36b55;
  --accent-wash: #b6f36b1a;
  --accent-hover: #ccf895;
  --bench-bg: #101418cc;
  --sand: #e9dcc0;
  --blue: #7cc4ff;

  --mono: ui-monospace, "Cascadia Mono", Consolas, "SF Mono", SFMono-Regular, Menlo, "DejaVu Sans Mono", "Liberation Mono", monospace;
  --sans: system-ui, sans-serif;

  --cell: 22px;
  --gutter: clamp(16px, 4vw, 32px);
  --space: clamp(48px, 8vw, 88px);
  --radius: 2px;

  color-scheme: dark;
}

/* ---------- Base ---------- */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  background-color: var(--bg);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background-color: var(--bg);
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: var(--cell) var(--cell);
  color: var(--text);
  font-family: var(--sans);
  font-size: 1.0625rem;
  line-height: 1.6;
  overflow-wrap: break-word;
}

main {
  flex: 1 0 auto;
}

img,
picture,
video,
svg {
  display: block;
  max-width: 100%;
  height: auto;
}

h1,
h2,
h3,
h4 {
  font-family: var(--sans);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.02em;
  margin: 0 0 0.5em;
  text-wrap: balance;
}

h1 {
  font-size: clamp(2.25rem, 1.4rem + 4.2vw, 4.25rem);
  letter-spacing: -0.03em;
}

h2 {
  font-size: clamp(1.625rem, 1.2rem + 1.8vw, 2.375rem);
}

h3 {
  font-size: 1.25rem;
  letter-spacing: -0.01em;
}

p,
ul,
ol,
figure,
blockquote {
  margin: 0 0 1em;
}

a {
  color: var(--accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
}

a:hover {
  color: var(--accent-hover);
}

strong,
b {
  font-weight: 700;
}

code,
kbd,
samp {
  font-family: var(--mono);
  font-size: 0.9em;
}

::selection {
  background: var(--accent);
  color: var(--bg);
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

/* ---------- Layout ---------- */

.wrap {
  width: 100%;
  max-width: 1100px;
  margin-inline: auto;
  padding-inline: var(--gutter);
}

main > section,
main > .section {
  margin-block: var(--space);
}

/* ---------- Skip link ---------- */

.skip-link {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 10;
  padding: 0.6em 1em;
  background: var(--accent);
  color: var(--bg);
  font-family: var(--mono);
  font-size: 0.875rem;
  font-weight: 700;
  text-decoration: none;
  transform: translateY(calc(-100% - 24px));
}

.skip-link:focus,
.skip-link:focus-visible {
  transform: none;
  color: var(--bg);
}

/* ---------- Header ---------- */

.site-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 32px;
  padding-block: 22px;
  border-bottom: 1px dashed var(--bench-border);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--accent);
  font-family: var(--mono);
  font-size: 1rem;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}

.brand img {
  width: 32px;
  height: 32px;
  flex: none;
}

.brand:hover {
  color: var(--accent-hover);
}

.site-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 22px;
  font-family: var(--mono);
  font-size: 0.875rem;
}

.site-nav a {
  display: inline-block;
  padding-block: 6px;
  color: var(--muted);
  text-decoration: none;
}

.site-nav a:hover {
  color: var(--text);
}

.site-nav a[aria-current="page"] {
  color: var(--accent);
}

/* ---------- Footer ---------- */

.site-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 24px;
  margin-top: var(--space);
  padding-block: 28px 36px;
  border-top: 1px dashed var(--bench-border);
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.8125rem;
}

.site-footer p,
.site-footer ul {
  margin: 0;
}

.site-footer ul {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 20px;
  padding: 0;
  list-style: none;
}

.site-footer a {
  color: var(--muted);
}

.site-footer a:hover {
  color: var(--accent);
}

/* ---------- Type helpers ---------- */

.label {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.8125rem;
  line-height: 1.5;
  letter-spacing: 0.01em;
  overflow-wrap: anywhere;
}

.tag {
  color: var(--accent);
  font-family: var(--mono);
  font-size: 0.8125rem;
  line-height: 1.5;
  letter-spacing: 0.01em;
  overflow-wrap: anywhere;
}

.hl {
  background: linear-gradient(transparent 62%, var(--accent-hl) 62%);
  padding-inline: 0.06em;
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
}

.prose {
  max-width: 68ch;
}

.prose h2 {
  margin-top: 1.6em;
}

.prose h3 {
  margin-top: 1.4em;
}

.prose > :first-child,
.prose .label + h2,
.prose .label + h3,
.prose .tag + h2,
.prose .tag + h3 {
  margin-top: 0;
}

.prose li + li {
  margin-top: 0.35em;
}

.prose ul,
.prose ol {
  padding-left: 1.25em;
}

.prose ul li::marker {
  color: var(--accent);
}

/* ---------- Hero ---------- */

.hero {
  padding-block: clamp(48px, 9vw, 112px) 0;
}

main > .hero {
  margin: 0;
}

.hero h1 {
  max-width: 17ch;
  margin-bottom: 0.4em;
}

.hero p {
  max-width: 68ch;
  color: var(--muted);
  font-size: 1.125rem;
}

.hero .label,
.hero .tag {
  font-size: 0.875rem;
}

/* ---------- Bench: dashed feature panel ---------- */

.bench {
  display: grid;
  gap: clamp(18px, 3vw, 32px);
  align-items: center;
  padding: clamp(14px, 3vw, 28px);
  border: 1px dashed var(--bench-border);
  background: var(--bench-bg);
}

.bench img {
  width: 100%;
  border: 1px solid var(--panel-border);
  background: var(--panel);
}

.bench .bench-clip {
  display: block;
  width: 300px;
  max-width: 100%;
  height: auto;
  margin: 0 0 18px;
  background: var(--sand);
  image-rendering: pixelated;
}

.bench .shot-natural {
  width: auto;
  max-width: min(345px, 100%);
  margin-inline: auto;
}

.bench h2,
.bench h3 {
  margin: 0.2em 0 0.35em;
}

.bench p {
  color: var(--muted);
}

.bench > :last-child > :last-child {
  margin-bottom: 0;
}

@media (min-width: 760px) {
  .bench {
    grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  }

  .bench > :only-child,
  .bench > .gallery {
    grid-column: 1 / -1;
  }
}

/* ---------- Tiles ---------- */

.tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 1fr));
  gap: 16px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.tile {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 20px 22px;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  color: var(--text);
  text-decoration: none;
  transition: border-color 0.15s ease, transform 0.15s ease;
}

.tile h3,
.tile strong {
  margin: 0;
  font-family: var(--mono);
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0;
  color: var(--text);
}

.tile p,
.tile span {
  margin: 0;
  color: var(--muted);
  font-size: 0.9375rem;
}

@media (min-width: 601px) {
  .tile {
    min-height: 132px;
  }
}

a.tile::after {
  content: "\2192";
  content: "\2192" / "";
  margin-top: auto;
  padding-top: 10px;
  color: var(--accent);
  font-family: var(--mono);
}

a.tile:hover {
  color: var(--text);
  border-color: var(--accent);
  transform: translateY(-2px);
}

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0.55em 1.1em;
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  background: transparent;
  color: var(--accent);
  font-family: var(--mono);
  font-size: 0.875rem;
  font-weight: 700;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.btn:hover {
  background: var(--accent-wash);
  color: var(--accent-hover);
  border-color: var(--accent-hover);
}

.btn--solid {
  background: var(--accent);
  color: var(--bg);
}

.btn--solid:hover {
  background: var(--accent-hover);
  color: var(--bg);
}

.btn + .btn {
  margin-left: 10px;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 1.25em;
}

.actions .btn + .btn {
  margin-left: 0;
}

/* ---------- Proof strip ---------- */

.proof {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px 24px;
  padding-block: 18px;
  border-block: 1px dashed var(--bench-border);
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.8125rem;
  overflow-wrap: anywhere;
}

.proof > * {
  margin: 0;
}

/* ---------- Gallery ---------- */

.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(280px, 100%), 1fr));
  align-items: start;
  gap: 18px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.gallery figure {
  margin: 0;
  padding: 10px;
  background: var(--panel);
  border: 1px solid var(--panel-border);
}

.gallery img {
  width: 100%;
}

.gallery figcaption {
  padding: 10px 2px 2px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.8125rem;
  line-height: 1.5;
}

/* ---------- Stats (case-study results) ---------- */

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(200px, 100%), 1fr));
  gap: 16px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.stat {
  padding: 20px 22px;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  color: var(--muted);
  font-size: 0.9375rem;
}

.stats + .stats-source {
  margin-top: 16px;
}

.stat strong {
  display: block;
  margin-bottom: 4px;
  color: var(--accent);
  font-family: var(--mono);
  font-size: clamp(2rem, 1.5rem + 2vw, 2.75rem);
  line-height: 1.1;
}

/* ---------- Timeline (games list) ---------- */

.timeline {
  margin: 0;
  padding: 0 0 0 22px;
  list-style: none;
  border-left: 1px dashed var(--bench-border);
}

.timeline > li {
  position: relative;
}

.timeline > li + li {
  margin-top: 32px;
}

.timeline > li::before {
  content: "";
  position: absolute;
  top: 0.55em;
  left: -27px;
  width: 9px;
  height: 9px;
  background: var(--accent);
}

/* Read by screen readers, not shown. */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* ---------- Inbox demo (/ai/) ----------
   The base values are the finished still (every email tagged, leads
   first) for anything that does not run the animations. The loop always
   runs, also under reduced motion (owner's call): the site-wide reduce
   rule below skips the demo. Without @property it still loops, but the
   highlight, marks and tags snap instead of fading. */

@property --read {
  syntax: "<number>";
  inherits: true;
  initial-value: 0;
}

@property --mark {
  syntax: "<number>";
  inherits: true;
  initial-value: 1;
}

@property --done {
  syntax: "<number>";
  inherits: true;
  initial-value: 1;
}

.inbox-demo {
  --row-h: 3.375rem;
  --inbox-loop: 12s;
}

.inbox-demo,
.files-demo {
  display: grid;
  max-width: 40rem;
  margin: 0 0 32px;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
}

.inbox-demo__bar,
.files-demo__bar {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--panel-border);
}

.inbox-demo__status,
.files-demo__status {
  display: grid;
  text-align: right;
}

.inbox-demo__status > *,
.files-demo__status > * {
  grid-area: 1 / 1;
  opacity: 0;
}

.inbox-demo__status > :last-child,
.files-demo__status > :last-child {
  opacity: 1;
}

.inbox-demo__rows,
.files-demo__rows {
  grid-area: 2 / 1;
  margin: 0;
  padding: 0;
  list-style: none;
}

.inbox-demo__row {
  --read: 0;
  --done: 1;
  --mark: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-content: center;
  column-gap: 12px;
  height: var(--row-h);
  padding: 0 14px;
  border-bottom: 1px solid var(--panel-border);
  background-color: color-mix(in srgb, var(--accent) calc(var(--read) * 7%), var(--panel));
  box-shadow: inset calc(var(--read) * 3px) 0 0 var(--accent);
  transform: translateY(calc(var(--shift) * var(--row-h)));
}

/* Arrival order 1-6 -> sorted slot: leads 1, 3, 5 move up, enquiries down. */
.inbox-demo__row:nth-child(1) { --shift: 0; }
.inbox-demo__row:nth-child(2) { --shift: 2; }
.inbox-demo__row:nth-child(3) { --shift: -1; }
.inbox-demo__row:nth-child(4) { --shift: 1; }
.inbox-demo__row:nth-child(5) { --shift: -2; }
.inbox-demo__row:nth-child(6) { --shift: 0; }

.inbox-demo__from,
.inbox-demo__subj {
  grid-column: 1;
  font-size: 0.875rem;
}

.inbox-demo__from {
  overflow: hidden;
  font-weight: 600;
  line-height: 1.3;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.inbox-demo__subj {
  overflow: hidden;
  color: var(--muted);
  line-height: 1.4;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.inbox-demo mark {
  padding: 0 2px;
  color: color-mix(in srgb, var(--text) calc(var(--mark) * 100%), var(--muted));
  background: color-mix(in srgb, var(--accent) calc(var(--mark) * 18%), transparent);
}

.inbox-demo .is-enquiry mark {
  background: color-mix(in srgb, var(--blue) calc(var(--mark) * 16%), transparent);
}

.inbox-demo__row > .tag {
  grid-area: 1 / 2 / 3;
  align-self: center;
  padding: 2px 8px;
  border: 1px solid;
  font-size: 0.75rem;
  opacity: var(--done);
  transform: translateX(calc((1 - var(--done)) * 6px));
}

.tag--enquiry {
  color: var(--blue);
}

.inbox-demo__divider {
  position: relative;
  z-index: 1;
  grid-area: 2 / 1;
  align-self: start;
  height: 0;
  margin: calc(3 * var(--row-h) - 1px) 0 0;
  padding: 0 10px;
  border-top: 1px dashed var(--accent);
  text-align: right;
  pointer-events: none;
}

.inbox-demo__divider span {
  display: inline-block;
  padding: 0 6px;
  background: var(--panel);
  transform: translateY(-50%);
}

.inbox-demo figcaption,
.files-demo figcaption {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  grid-row: 3;
  padding: 10px 14px;
  border-top: 1px solid var(--panel-border);
  color: var(--muted);
  font-size: 0.875rem;
}

.inbox-demo__rows {
  animation: inbox-fade var(--inbox-loop) linear infinite;
}

.inbox-demo__divider {
  animation: inbox-divider var(--inbox-loop) linear infinite;
}

.inbox-demo__status > *,
.inbox-demo__row {
  animation: var(--inbox-loop) linear infinite;
}

.inbox-demo__status > :nth-child(1) { animation-name: inbox-status-1; }
.inbox-demo__status > :nth-child(2) { animation-name: inbox-status-2; }
.inbox-demo__status > :nth-child(3) { animation-name: inbox-status-3; }

.inbox-demo__row:nth-child(1) { animation-name: inbox-row-1, inbox-sort; }
.inbox-demo__row:nth-child(2) { animation-name: inbox-row-2, inbox-sort; }
.inbox-demo__row:nth-child(3) { animation-name: inbox-row-3, inbox-sort; }
.inbox-demo__row:nth-child(4) { animation-name: inbox-row-4, inbox-sort; }
.inbox-demo__row:nth-child(5) { animation-name: inbox-row-5, inbox-sort; }
.inbox-demo__row:nth-child(6) { animation-name: inbox-row-6, inbox-sort; }

/* Pause (WCAG 2.2.2): a plain checkbox, no script. */
.inbox-demo__pause,
.files-demo__pause {
  display: inline-flex;
  flex: none;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  cursor: pointer;
}

.inbox-demo__pause input,
.files-demo__pause input {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--accent);
  cursor: pointer;
}

.inbox-demo:has(.inbox-demo__pause :checked) * {
  animation-play-state: paused;
}

/* Paused inside the loop-boundary fade: keep the rows visible. !important
   beats the animation without restarting it, so resume stays in sync. */
.inbox-demo:has(.inbox-demo__pause :checked) .inbox-demo__rows {
  opacity: 1 !important;
}

/* 12 s loop: fade in, read rows one by one (0.9 s apart), sort at ~6.8 s,
   hold, fade out. Each row: highlight + marks on, then tag in. */
@keyframes inbox-row-1 {
  0%, 6.67% { --read: 0; --mark: 0; --done: 0; }
  9.17%, 13.33% { --read: 1; --mark: 1; --done: 0; }
  15%, 100% { --read: 0; --mark: 1; --done: 1; }
}

@keyframes inbox-row-2 {
  0%, 14.17% { --read: 0; --mark: 0; --done: 0; }
  16.67%, 20.83% { --read: 1; --mark: 1; --done: 0; }
  22.5%, 100% { --read: 0; --mark: 1; --done: 1; }
}

@keyframes inbox-row-3 {
  0%, 21.67% { --read: 0; --mark: 0; --done: 0; }
  24.17%, 28.33% { --read: 1; --mark: 1; --done: 0; }
  30%, 100% { --read: 0; --mark: 1; --done: 1; }
}

@keyframes inbox-row-4 {
  0%, 29.17% { --read: 0; --mark: 0; --done: 0; }
  31.67%, 35.83% { --read: 1; --mark: 1; --done: 0; }
  37.5%, 100% { --read: 0; --mark: 1; --done: 1; }
}

@keyframes inbox-row-5 {
  0%, 36.67% { --read: 0; --mark: 0; --done: 0; }
  39.17%, 43.33% { --read: 1; --mark: 1; --done: 0; }
  45%, 100% { --read: 0; --mark: 1; --done: 1; }
}

@keyframes inbox-row-6 {
  0%, 44.17% { --read: 0; --mark: 0; --done: 0; }
  46.67%, 50.83% { --read: 1; --mark: 1; --done: 0; }
  52.5%, 100% { --read: 0; --mark: 1; --done: 1; }
}

@keyframes inbox-sort {
  0%, 56.67% {
    transform: translateY(0);
    animation-timing-function: cubic-bezier(0.6, 0.05, 0.3, 1);
  }
  63.33%, 100% { transform: translateY(calc(var(--shift) * var(--row-h))); }
}

@keyframes inbox-fade {
  0% { opacity: 0; }
  4%, 93% { opacity: 1; }
  97%, 100% { opacity: 0; }
}

@keyframes inbox-divider {
  0%, 63.33% { opacity: 0; }
  66.67%, 93% { opacity: 1; }
  97%, 100% { opacity: 0; }
}

@keyframes inbox-status-1 {
  0%, 55.83% { opacity: 1; }
  56.67%, 100% { opacity: 0; }
}

@keyframes inbox-status-2 {
  0%, 55.83% { opacity: 0; }
  56.67%, 64.17% { opacity: 1; }
  65%, 100% { opacity: 0; }
}

@keyframes inbox-status-3 {
  0%, 64.17% { opacity: 0; }
  65%, 100% { opacity: 1; }
}

/* ---------- Files demo (/ai/) ----------
   A messy downloads folder: AI reads each file, renames it, tags its
   folder, then files it. Shares the inbox demo's frame, its read timing
   (inbox-row-N) and its status and fade keyframes. The base values are the
   finished still (renamed, filed, tags gone). Always loops, like the inbox. */

@property --sorted {
  syntax: "<number>";
  inherits: true;
  initial-value: 1;
}

.files-demo {
  --row-h: 2.75rem;
  --files-loop: 12s;
}

.files-demo__row {
  --read: 0;
  --done: 1;
  --sorted: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  column-gap: 12px;
  height: var(--row-h);
  padding: 0 14px;
  border-bottom: 1px solid var(--panel-border);
  font-size: 0.875rem;
  background-color: color-mix(in srgb, var(--accent) calc(var(--read) * 7%), var(--panel));
  box-shadow: inset calc(var(--read) * 3px) 0 0 var(--accent);
  transform: translateY(calc(var(--shift) * var(--row-h)));
}

/* Rows 1-3 are folders, 4-9 loose files. Sorted order:
   invoices/ 4 7 · receipts/ 6 9 · photos/ 5 8. */
.files-demo__row:nth-child(1) { --shift: 0; }
.files-demo__row:nth-child(2) { --shift: 2; }
.files-demo__row:nth-child(3) { --shift: 4; }
.files-demo__row:nth-child(4) { --shift: -2; }
.files-demo__row:nth-child(5) { --shift: 3; }
.files-demo__row:nth-child(6) { --shift: -1; }
.files-demo__row:nth-child(7) { --shift: -4; }
.files-demo__row:nth-child(8) { --shift: 1; }
.files-demo__row:nth-child(9) { --shift: -3; }

.files-demo__folder,
.files-demo__old,
.files-demo__new {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.files-demo__folder {
  color: var(--accent);
  font-weight: 600;
}

.files-demo__count,
.files-demo__name {
  display: grid;
  min-width: 0;
}

.files-demo__count > *,
.files-demo__name > * {
  grid-area: 1 / 1;
}

.files-demo__count {
  color: var(--muted);
  font-size: 0.75rem;
  text-align: right;
}

.files-demo__count > :first-child { opacity: calc(1 - var(--sorted)); }
.files-demo__count > :last-child { opacity: var(--sorted); }

/* Filed files sit indented under their folder. */
.files-demo__name {
  transform: translateX(calc(var(--sorted) * 1rem));
}

.files-demo__old {
  color: var(--muted);
  opacity: calc(1 - var(--done));
}

.files-demo__new {
  opacity: var(--done);
}

.files-demo__to {
  padding: 2px 8px;
  border: 1px solid;
  font-size: 0.75rem;
  opacity: calc(var(--done) * (1 - var(--sorted)));
  transform: translateX(calc((1 - var(--done)) * 6px));
}

.files-demo__to::before {
  content: "→ ";
  content: "→ " / "";
}

.files-demo__rows {
  animation: inbox-fade var(--files-loop) linear infinite;
}

.files-demo__status > *,
.files-demo__row {
  animation: var(--files-loop) linear infinite;
}

.files-demo__status > :nth-child(1) { animation-name: inbox-status-1; }
.files-demo__status > :nth-child(2) { animation-name: inbox-status-2; }
.files-demo__status > :nth-child(3) { animation-name: inbox-status-3; }

.files-demo__row:nth-child(1) { animation-name: files-sort; }
.files-demo__row:nth-child(2) { animation-name: files-sort; }
.files-demo__row:nth-child(3) { animation-name: files-sort; }
.files-demo__row:nth-child(4) { animation-name: inbox-row-1, files-sort; }
.files-demo__row:nth-child(5) { animation-name: inbox-row-2, files-sort; }
.files-demo__row:nth-child(6) { animation-name: inbox-row-3, files-sort; }
.files-demo__row:nth-child(7) { animation-name: inbox-row-4, files-sort; }
.files-demo__row:nth-child(8) { animation-name: inbox-row-5, files-sort; }
.files-demo__row:nth-child(9) { animation-name: inbox-row-6, files-sort; }

.files-demo:has(.files-demo__pause :checked) * {
  animation-play-state: paused;
}

.files-demo:has(.files-demo__pause :checked) .files-demo__rows {
  opacity: 1 !important;
}

@keyframes files-sort {
  0%, 56.67% {
    --sorted: 0;
    transform: translateY(0);
    animation-timing-function: cubic-bezier(0.6, 0.05, 0.3, 1);
  }
  63.33%, 100% {
    --sorted: 1;
    transform: translateY(calc(var(--shift) * var(--row-h)));
  }
}

/* ---------- Small screens ---------- */

@media (max-width: 600px) {
  .site-header {
    flex-direction: column;
    align-items: flex-start;
    padding-block: 16px 12px;
  }

  .site-nav {
    gap: 2px 16px;
  }

  .site-footer {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* ---------- Motion ---------- */

@media (prefers-reduced-motion: reduce) {
  *:not(.inbox-demo *):not(.files-demo *),
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition: none !important;
  }

  a.tile:hover {
    transform: none;
  }
}
