/* The Index / system.css
 * v0.1 — 2026-11-03
 * Values measured from shahimim.com's own CSS (see design-system/REFERENCE-SPEC.md).
 * If a doc disagrees with this file, fix both in the same change.
 */

/* ---- Light ------------------------------------------------------------- */
:root {
  --font-sans: "Geist", -apple-system, BlinkMacSystemFont, "SF Pro Text",
               system-ui, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;

  /* Surfaces and ink */
  --ground:          #FFFFFF;
  --ground-tile:     #F5F5F5;
  --line:            #E5E5E5;
  --hairline-strong: color-mix(in srgb, #1A1917 18%, transparent);
  --ink:             #171717;
  --ink-soft:        #645D53;
  --ink-muted:       #737373;
  --body:            #374151;

  /* The only accent. Status and record numbers, never decoration. */
  --marker:      #E8341C;
  --marker-text: #C53727;
  --on-marker:   #FFFFFF;

  /* Link highlight tints. The ink never changes; only the background. */
  --hl-org:   #D7E7FC;
  --hl-mine:  #FCE5C9;
  --hl-live:  #B1EFDE;
  --hl-claim: #F8D3DA;

  /* Radius ladder, the whole thing */
  --radius-ticket: 4px;
  --radius-pill:   6px;
  --radius-media: 10px;
  --radius-panel: 12px;
  --radius-tile:  16px;
  --radius-card:  22px;
  --radius-full: 999px;

  /* Space */
  --s-1: 4px;  --s-2: 8px;  --s-3: 12px; --s-4: 16px;
  --s-5: 20px; --s-6: 32px; --s-7: 48px; --s-8: 64px; --s-9: 96px;

  /* Columns */
  --col-reading: 560px;
  --tile:        274px;

  /* Controls */
  --control-sm: 28px;
  --icon-sm:    14px;

  /* Motion */
  --dur-link:   150ms;
  --dur-hover:  240ms;
  --dur-toggle: 320ms;
  --dur-slow:   420ms;
  --dur-theme:  240ms;
  --ease-expo:  cubic-bezier(.16, 1, .3, 1);
  --ease-glide: cubic-bezier(.22, 1, .36, 1);

  /* Focus */
  --focus: var(--marker);
  --focus-ring: 2px;
  --focus-offset: 2px;

  --shadow-ticket: 0 1px 2px rgba(0, 0, 0, .08);

  color-scheme: light;
}

/* ---- Dark ---------------------------------------------------------------
 * Contrast record (ratios against --ground #0C0C0D):
 *   ink       #F2F1ED  17.1  PASS any text
 *   body      #B9B7B1  10.6  PASS body
 *   ink-soft  #9A948A   7.4  PASS body + UI
 *   ink-muted #8E8D88   6.9  PASS body + UI
 *   marker    #F97316   7.8  PASS body + UI
 *   line      #252527   1.4  non-text, hairlines only
 * Light ratios live in design-system/tokens.css. Re-measure on any change.
 * ---------------------------------------------------------------------- */
:root[data-theme="dark"] {
  --ground:          #0C0C0D;
  --ground-tile:     #161617;
  --line:            #252527;
  --hairline-strong: color-mix(in srgb, #F2F1ED 18%, transparent);
  --ink:             #F2F1ED;
  --ink-soft:        #9A948A;
  --ink-muted:       #8E8D88;
  --body:            #B9B7B1;

  --marker:      #F97316;
  --marker-text: #F97316;
  --on-marker:   #0C0C0D;

  --hl-org:   #3E4650;
  --hl-mine:  #504539;
  --hl-live:  #0A4536;
  --hl-claim: #4C1D28;

  color-scheme: dark;
}

/* No-JS fallback. The switch sets data-theme explicitly, so this only
   applies before or without scripts. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --ground:          #0C0C0D;
    --ground-tile:     #161617;
    --line:            #252527;
    --hairline-strong: color-mix(in srgb, #F2F1ED 18%, transparent);
    --ink:             #F2F1ED;
    --ink-soft:        #9A948A;
    --ink-muted:       #8E8D88;
    --body:            #B9B7B1;

    --marker:      #F97316;
    --marker-text: #F97316;
    --on-marker:   #0C0C0D;

    --hl-org:   #3E4650;
    --hl-mine:  #504539;
    --hl-live:  #0A4536;
    --hl-claim: #4C1D28;

    color-scheme: dark;
}
}

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

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

body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 24px;
  font-synthesis-weight: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  transition: background-color var(--dur-theme) ease,
              color var(--dur-theme) ease;
}

/* Theme crossfades background and colour only. Never transforms, or the
   whole page appears to breathe. */
.tile, .seg, .sep, .pill, .ticket, .avatar, .key {
  transition-property: background-color, color, border-color, box-shadow, transform, opacity;
  transition-duration: var(--dur-theme);
  transition-timing-function: ease;
}

time, .meta, .key, .record__no { font-variant-numeric: tabular-nums; }

:focus-visible { outline: var(--focus-ring) solid var(--focus); outline-offset: var(--focus-offset); }

.visually-hidden {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0;
}

/* ---- Metadata ----------------------------------------------------------- */
.meta {
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 16px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--ink-muted);
}

/* ---- Highlighted inline link -------------------------------------------
 * Not a flat fill: a gradient that leaves the top tenth of the line clear,
 * so the tint sits under the text like a highlighter stroke.
 */
.hl {
  color: var(--ink);
  background: linear-gradient(transparent 10%, var(--hl-org) 10%);
  padding: 0 2.25px;
  text-decoration: none;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
}
/* No underline on hover. The cursor says where the link goes instead, which
   is the one place a label can appear without moving a line of text. The tint
   deepens a little so there is still a change for anyone without the cursor. */
.hl:hover { background-position-y: 1px; filter: saturate(1.25) brightness(.97); }
.hl:focus-visible { text-decoration: underline; text-underline-offset: .22em; }
.hl--org   { background: linear-gradient(transparent 10%, var(--hl-org) 10%); }
.hl--mine  { background: linear-gradient(transparent 10%, var(--hl-mine) 10%); }
.hl--live  { background: linear-gradient(transparent 10%, var(--hl-live) 10%); }
.hl--claim { background: linear-gradient(transparent 10%, var(--hl-claim) 10%); }

/* ---- Avatar / 60 square at radius 15 ------------------------------------ */
.hello-wrap { display: flex; align-items: center; gap: 12px; min-width: 0; }

/* A quiet line, in the muted mono the rest of the metadata uses. It answers
   the tap and then gets out of the way. */
.hello {
  text-transform: none;
  letter-spacing: .02em;
  color: var(--ink-faint, var(--ink-muted));
  opacity: 0;
  transform: translateX(-4px);
  transition: opacity var(--dur-hover) ease, transform var(--dur-hover) var(--ease-glide);
  pointer-events: none;
  white-space: nowrap;
}
.hello[data-on="true"] { opacity: .75; transform: none; }

.avatar {
  position: relative;
  display: inline-grid;
  place-items: center;
  flex-shrink: 0;
  width: 60px; height: 60px;
  overflow: hidden;
  border: 0;
  border-radius: 15px;
  background: var(--ground-tile);
  color: var(--ink-soft);
  font-family: var(--font-mono);
  font-size: 15px;
  letter-spacing: .02em;
  line-height: 1;
  text-transform: uppercase;
  padding: 0;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
}
.avatar img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.avatar-fallback { position: relative; z-index: -1; }

/* The wiggle is the whole response to a tap: a small shake, once. */
.avatar[data-wiggle="true"] { animation: avatar-wiggle 620ms var(--ease-glide); }
@keyframes avatar-wiggle {
  0%   { transform: rotate(0) scale(1); }
  18%  { transform: rotate(-5deg) scale(1.04); }
  38%  { transform: rotate(4deg)  scale(1.04); }
  58%  { transform: rotate(-3deg) scale(1.02); }
  78%  { transform: rotate(2deg)  scale(1.01); }
  100% { transform: rotate(0) scale(1); }
}

/* ---- The theme switch ---------------------------------------------------
 * A two-segment radiogroup, not a sliding switch. The thumb is driven by
 * --i on the track, so the transform is the only thing that animates.
 */
.seg {
  --n: 2;
  --i: 0;
  position: relative;
  display: inline-grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  height: var(--control-sm);
  padding: 2px;
  border-radius: var(--radius-full);
  background: color-mix(in srgb, var(--ink) 6%, transparent);
  vertical-align: middle;
}
.seg-thumb {
  position: absolute;
  top: 2px; bottom: 2px; left: 2px;
  width: calc((100% - 4px) / var(--n));
  border-radius: var(--radius-full);
  background: var(--ground);
  box-shadow: 0 1px 2px rgba(0, 0, 0, .08),
              inset 0 0 0 .5px var(--hairline-strong);
  transform: translateX(calc(var(--i) * 100%));
  transition: transform var(--dur-toggle) var(--ease-expo),
              background-color var(--dur-theme) ease;
}
.seg button {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: calc(var(--control-sm) - 4px);
  padding: 0;
  border: 0;
  border-radius: var(--radius-full);
  background: none;
  color: var(--ink-soft);
  font-family: inherit;
  cursor: pointer;
  transition: color var(--dur-link) ease;
}
.seg button svg { width: var(--icon-sm); height: var(--icon-sm); }
.seg button:hover,
.seg button[aria-checked="true"] { color: var(--ink); }
/* A 28px control is a small target. Extend the hit area without moving it. */
.seg button::before { content: ""; position: absolute; inset: -10px -2px; }
.seg button:first-of-type::before { left: -10px; }
.seg button:last-of-type::before  { right: -10px; }
.seg button:focus-visible { outline: var(--focus-ring) solid var(--focus); outline-offset: var(--focus-offset); }

/* ---- Separator / 3px dash, 6px gap -------------------------------------- */
.sep {
  height: 1px;
  border: 0;
  margin: 0;
  background: repeating-linear-gradient(90deg,
              var(--line) 0 3px, transparent 3px 9px);
}

/* ---- Tile --------------------------------------------------------------- */
.tile {
  position: relative;
  display: block;
  isolation: isolate;
  width: 100%;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-tile);
  background: var(--ground-tile);
  color: var(--ink);
  font: inherit;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  transition: border-color var(--dur-hover) ease, scale .12s var(--ease-glide);
}
.tile:hover { border-color: color-mix(in srgb, var(--ink) 30%, transparent); }
.tile:active { scale: .99; }
.tile--wide { aspect-ratio: auto; height: 188px; grid-column: 1 / -1; }

.tile-media {
  position: absolute;
  inset: 0;
  isolation: isolate;
  pointer-events: none;
  transition: transform var(--dur-hover) cubic-bezier(.22, .8, .2, 1);
}
.tile-media img { width: 100%; height: 100%; object-fit: cover; display: block; }
.tile:hover .tile-media { transform: scale(1.015); }

/* Selected work reel: frames stack and crossfade, one project at a time. */
.reel { position: absolute; inset: 0; display: block; }
.reel-frame {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; display: block;
  opacity: 0; transition: opacity .7s ease;
  /* Each film is 16:9 in a square tile. --z zooms it in as far as it can go
     without its content ever reaching past the tile's sides (measured across
     every frame), so nothing is cut off. */
  transform: scale(var(--z, 1));
}
.reel-frame.is-on { opacity: 1; }

/* Title sits top-left on a plain tile, and in a white pill on an image one. */
.tile-title {
  position: absolute;
  z-index: 2;
  top: 16px; left: 16px;
  font-size: 13px;
  line-height: 20px;
  color: var(--ink-soft);
}
.tile--image .tile-title {
  top: auto; bottom: 10px; left: 10px;
  max-width: calc(100% - 48px);
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  background: var(--ground);
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tile-key {
  position: absolute;
  z-index: 3;
  right: 12px; bottom: 12px;
  min-width: 22px;
  padding: 2px 6px;
  border-radius: 6px;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 18px;
  color: var(--ink-soft);
  background: color-mix(in srgb, var(--ground) 88%, transparent);
  border: 1px solid var(--line);
  backdrop-filter: blur(4px);
  transition: color var(--dur-hover) ease;
}
.tile:hover .tile-key { color: var(--ink); }

/* The keychip: invisible at rest, centred on hover. */
.keychip {
  position: absolute;
  z-index: 2;
  left: 50%; top: 50%;
  translate: -50% -50%;
  display: inline-flex;
  align-items: center;
  height: 20px;
  padding: 0 6px;
  border-radius: var(--radius-ticket);
  background: var(--marker-text);
  color: var(--on-marker);
  font-family: var(--font-mono);
  font-size: 10px;
  line-height: 15px;
  letter-spacing: .12em;
  text-transform: uppercase;
  white-space: nowrap;
  box-shadow: var(--shadow-ticket);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--dur-link) ease;
}
.tile:hover .keychip,
.tile:focus-visible .keychip { opacity: 1; }

/* A coarse pointer has no hover, so neither affordance is reachable. */
@media (hover: none) and (pointer: coarse) {
  .keychip, .tile-key { display: none; }
}

/* ---- Ticket / the fanned cards in the garden stack ---------------------- */
.ticket {
  border: 1px solid var(--line);
  border-radius: var(--radius-ticket);
  background: var(--ground);
  box-shadow: var(--shadow-ticket);
  padding: 8px 8px 10px;
}
.ticket-body { display: flex; flex-direction: column; gap: 6px; padding: 12px; }
.ticket-line {
  display: flex; align-items: baseline; justify-content: space-between; gap: 12px;
  font-family: var(--font-mono);
  font-size: 8px; line-height: 12px; letter-spacing: .32px;
  color: var(--ink-muted);
}
.ticket-line b {
  font-size: 9px; line-height: 13.5px; font-weight: 500; letter-spacing: .32px;
  color: var(--marker-text);
}
.ticket-title {
  margin: 0;
  font-size: 13px; line-height: 15.6px; font-weight: 500; letter-spacing: -.13px;
}
.ticket-gloss { margin: 0; font-size: 10px; line-height: 13.5px; color: var(--ink-muted); }

/* ---- Reduced motion ----------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 1ms !important;
    scroll-behavior: auto !important;
  }
  .tile:hover .tile-media { transform: none; }
  .tile:active { scale: none; }
}

/* ---- The cut --------------------------------------------------------------
 * The separator between the bio and the grid is a drag target. Dragging along
 * it cuts it open and expands the rest of the bio. Measured from the
 * reference: a 44px tall strip, a 1px dashed rule, a travelling 96px window of
 * darker ink that follows the pointer, and a background-coloured bar that
 * erases the line behind the cut.
 */
.cut {
  position: relative;
  height: 44px;
  overflow: hidden;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}
.cut > * {
  position: absolute;
  left: 0; right: 0;
  top: 50%;
}

/* 1 / the rule at rest */
.cut-rule {
  height: 1px;
  background-image: repeating-linear-gradient(90deg,
                    var(--line) 0 3px, transparent 3px 9px);
}

/* 2 / the hint. Two sweeps shortly after load, then never again. */
.cut-shimmer {
  height: 1px;
  opacity: 0;
  background-image: repeating-linear-gradient(90deg,
                    var(--ink) 0 3px, transparent 3px 9px);
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 50%, transparent);
          mask-image: linear-gradient(90deg, transparent, #000 50%, transparent);
  -webkit-mask-size: 36% 100%;  mask-size: 36% 100%;
  -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat;
  animation: cut-shimmer 7s cubic-bezier(.45, 0, .25, 1) 1.2s infinite both;
}
/* A sweep, then six seconds of nothing, forever. The control is invisible at
   rest, so a single pass at load is a hint most people are not looking at. */
@keyframes cut-shimmer {
  0%   { -webkit-mask-position: -60% 0; mask-position: -60% 0; opacity: 0; }
  3%   { opacity: .55; }
  24%  { -webkit-mask-position: 160% 0; mask-position: 160% 0; opacity: .55; }
  27%  { -webkit-mask-position: 160% 0; mask-position: 160% 0; opacity: 0; }
  100% { -webkit-mask-position: -60% 0; mask-position: -60% 0; opacity: 0; }
}
/* Once the pointer is on it, or it has been used, the hint has done its job. */
.cut[data-hover="true"] .cut-shimmer,
.cut[data-cutting="true"] .cut-shimmer,
.cut[aria-expanded="true"] .cut-shimmer { animation-play-state: paused; opacity: 0; }

/* 3 / darker ink in a 96px window that tracks the pointer */
.cut-ink {
  height: 1px;
  opacity: 0;
  background-image: repeating-linear-gradient(90deg,
                    var(--ink) 0 3px, transparent 3px 9px);
  -webkit-mask-image: linear-gradient(90deg, transparent calc(var(--x, -200px) - 96px),
                      #000 var(--x, -200px), transparent calc(var(--x, -200px) + 96px));
          mask-image: linear-gradient(90deg, transparent calc(var(--x, -200px) - 96px),
                      #000 var(--x, -200px), transparent calc(var(--x, -200px) + 96px));
  transition: opacity var(--dur-link) ease;
}
.cut[data-hover="true"] .cut-ink { opacity: 1; }

/* 4 / the cut itself, erasing the rule behind the blades */
.cut-gap {
  height: 5px;
  transform-origin: left center;
  transform: translateY(-2px) scaleX(var(--p, 0));
  background: var(--ground);
  pointer-events: none;
}

/* 5 / the blades, parked at the cut head */
.cut-blades {
  left: 0; right: auto;
  width: 18px; height: 18px;
  margin-top: -9px;
  color: var(--ink);
  translate: calc(var(--px, 0px) - 9px) 0;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--dur-link) ease;
}
.cut[data-cutting="true"] .cut-blades { opacity: 1; }
/* Without the custom cursor (touch, or after the first Tab) the blades are
   the only affordance left, so they come back on hover. */
html:not([data-cursor="on"]) .cut[data-hover="true"] .cut-blades { opacity: 1; }
.cut-blades svg { width: 100%; height: 100%; display: block; }

.cut:focus-visible { outline: var(--focus-ring) solid var(--focus); outline-offset: var(--focus-offset); }

/* ---- Stitching the cut back ------------------------------------------------
 * A cut that cannot be undone is a one-way door on a page that is otherwise
 * all reversible. It only exists once there is something to undo.
 */
.stitch {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-top: var(--s-5);
  padding: 4px 10px 4px 8px;
  border: 1px dashed var(--line);
  border-radius: var(--radius-full);
  background: none;
  color: var(--ink-muted);
  font-family: var(--font-mono);
  font-size: 10px;
  line-height: 15px;
  letter-spacing: .12em;
  text-transform: uppercase;
  cursor: pointer;
  transition: color var(--dur-link) ease, border-color var(--dur-link) ease;
}
.stitch svg { width: 13px; height: 13px; }
.stitch:hover { color: var(--ink); border-color: var(--hairline-strong); }
.stitch[hidden] { display: none; }

/* The rest of the bio. Opens from nothing without a hard-coded height. */
.bio-more {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows var(--dur-slow, 420ms) var(--ease-expo),
              opacity var(--dur-hover) ease;
  opacity: 0;
}
.bio-more > div { overflow: hidden; }
.bio-more[data-open="true"] { grid-template-rows: 1fr; opacity: 1; }

/* ---- The cursor -----------------------------------------------------------
 * Three modes, one element:
 *   block    a 14px square of marker colour, the default
 *   text     a low 14x2 bar, the shape of a space, so words stay readable
 *   cut      a pair of scissors, over the one thing on the page that is cut
 * It also presses: pointerdown scales the mark down, so a click is felt in
 * the cursor as well as in the tile. Pointer-fine devices only.
 */
.cursor {
  position: fixed;
  transform: translate3d(-100px, -100px, 0);
  z-index: 60;
  top: 0; left: 0;
  display: none;
  width: 14px; height: 14px;
  color: var(--marker);
  pointer-events: none;
  will-change: transform;
}
.cursor-pip,
.cursor-scissor {
  position: absolute;
  left: 50%; top: 50%;
  translate: -50% -50%;
  transition: width .14s var(--ease-glide), height .14s var(--ease-glide),
              opacity .12s ease, scale .12s var(--ease-glide),
              border-radius .14s var(--ease-glide);
}
.cursor-pip {
  width: 14px; height: 14px;
  background: currentColor;
}
.cursor-scissor {
  width: 20px; height: 20px;
  opacity: 0;
  scale: .6;
}
.cursor-scissor svg,
.cursor-scissor { display: block; }

/* text / the square stands up into a caret, the shape of a space in a line
   of type rather than a block sitting on top of one */
.cursor[data-mode="text"] .cursor-pip {
  width: 2px; height: 18px;
  border-radius: 1px;
}

/* link / the square shrinks and the destination is typed in beside it */
.cursor[data-mode="link"] .cursor-pip { width: 8px; height: 8px; }
.cursor-label {
  position: absolute;
  left: 50%; top: 50%;
  translate: 12px 10px;
  padding: 5px 8px;
  border-radius: 6px;
  font-family: var(--font-sans);
  font-size: 12px;
  line-height: 14px;
  font-weight: 500;
  letter-spacing: -.01em;
  color: var(--ground);
  background: var(--ink);
  box-shadow: 0 4px 14px rgba(0, 0, 0, .18);
  white-space: nowrap;
  opacity: 0;
  transition: opacity var(--dur-link) ease;
}
.cursor-label:empty { padding: 0; box-shadow: none; }
.cursor[data-mode="link"] .cursor-label { opacity: 1; }

/* cut / the square hands over to the blades */
.cursor[data-mode="cut"] .cursor-pip { opacity: 0; scale: .2; }
.cursor[data-mode="cut"] .cursor-scissor { opacity: 1; scale: 1; }

/* press / everything shrinks towards the point being clicked */
.cursor[data-press="true"] .cursor-pip,
.cursor[data-press="true"] .cursor-scissor { scale: .55; }
.cursor[data-mode="link"][data-press="true"] .cursor-label { scale: .94; }
.cursor[data-mode="cut"][data-press="true"] .cursor-scissor { scale: .8; }

.cursor[data-hidden="true"] { opacity: 0; }

@media (hover: hover) and (pointer: fine) {
  html[data-cursor="on"] .cursor { display: block; }
  html[data-cursor="on"] body,
  html[data-cursor="on"] body * { cursor: none; }
  /* Text entry keeps a real caret; a block of colour is not an I-beam. */
  html[data-cursor="on"] :is(input, textarea, [contenteditable]) { cursor: auto; }
}

/* ---- The boot sequence ----------------------------------------------------
 * On load the page is laid out as dashed guides first: the column edges, a
 * rule at every content baseline, and an outline around every block. They are
 * measured from the real elements by app.js, so they land exactly where the
 * content is about to be. Then the guides retract and the page arrives.
 *
 * If the script never runs, data-boot is never set and none of this applies,
 * so the page is visible from the first paint either way.
 */
html[data-boot="run"] .page { opacity: 0; }
html[data-boot="in"] .page {
  animation: boot-page 560ms var(--ease-expo) both;
}
@keyframes boot-page {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: none; }
}

.boot {
  --guide: color-mix(in srgb, var(--ink) 26%, transparent);
  position: fixed;
  inset: 0;
  z-index: 80;
  pointer-events: none;
  contain: strict;
}
.boot[data-done="true"] { opacity: 0; transition: opacity 320ms ease; }

/* the two column edges, drawn top to bottom */
.boot-v {
  position: absolute;
  top: 0; bottom: 0;
  width: 1px;
  background: repeating-linear-gradient(180deg, var(--guide) 0 3px, transparent 3px 9px);
  transform: scaleY(0);
  transform-origin: 50% 0;
  animation: boot-v 420ms var(--ease-expo) var(--d, 0ms) both;
}
@keyframes boot-v { to { transform: scaleY(1); } }

/* a full-bleed rule at each content baseline, drawn outwards from the column */
.boot-h {
  position: absolute;
  left: 0; right: 0;
  height: 1px;
  background: repeating-linear-gradient(90deg, var(--guide) 0 3px, transparent 3px 9px);
  transform: scaleX(0);
  transform-origin: 50% 50%;
  animation: boot-h 360ms var(--ease-expo) var(--d, 0ms) both;
}
@keyframes boot-h { to { transform: scaleX(1); } }

/* the outline of a block that is about to hold something */
.boot-box {
  position: absolute;
  border: 1px dashed var(--guide);
  border-radius: var(--r, 4px);
  opacity: 0;
  animation: boot-box 300ms ease var(--d, 0ms) both;
}
@keyframes boot-box { to { opacity: 1; } }

/* the mark, parked where the cursor will be */
.boot-pip {
  position: absolute;
  width: 14px; height: 14px;
  background: var(--marker);
  opacity: 0;
  animation: boot-pip 300ms ease var(--d, 0ms) both;
}
@keyframes boot-pip { to { opacity: 1; } }

/* ---- Theme change: a circle opening from the switch -----------------------
 * The new theme is painted into an expanding circle centred on the button
 * that was pressed. View Transitions does the compositing; the radius and the
 * origin are set in script. Browsers without it get the plain crossfade.
 */
::view-transition-old(root),
::view-transition-new(root) {
  animation: none;
  mix-blend-mode: normal;
}
::view-transition-old(root) { z-index: 1; }
::view-transition-new(root) { z-index: 2; }
/* The body's own colour crossfade would blur the circle's edge. */
html[data-vt="1"] body,
html[data-vt="1"] .tile,
html[data-vt="1"] .seg,
html[data-vt="1"] .sep { transition: none !important; }

@media (prefers-reduced-motion: reduce) {
  .cut-shimmer { animation: none; opacity: 0; }
  .cursor-pip, .cursor-scissor, .cursor-label { transition: none; }
  .avatar[data-wiggle="true"] { animation: none; }
  .boot { display: none; }
  html[data-boot="run"] .page,
  html[data-boot="in"] .page { opacity: 1; animation: none; }
  ::view-transition-old(root), ::view-transition-new(root) { animation: none; }
}

/* ---- Back button: one grey pill on every inner page --------------------- */
.btn-back {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 7px 13px 7px 10px; border-radius: 10px;
  font: 500 13px/1 var(--font-sans); letter-spacing: -.005em; text-transform: none;
  color: var(--ink); text-decoration: none;
  background: color-mix(in srgb, var(--ink) 6%, var(--ground));
  transition: background-color .2s ease;
}
.btn-back svg { width: 15px; height: 15px; flex: none; transition: transform .25s cubic-bezier(.16, 1, .3, 1); }
.btn-back:hover { background: color-mix(in srgb, var(--ink) 10%, var(--ground)); color: var(--ink); text-decoration: none; }
.btn-back:hover svg { transform: translateX(-2px); }
.btn-back:focus-visible { outline: 2px solid var(--marker); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { .btn-back, .btn-back svg { transition: none; } }
