:root { --bg: #12172b; }
html, body {
  margin: 0; height: 100%; overflow: hidden; background: var(--bg);
  touch-action: none; -ms-touch-action: none;
  overscroll-behavior: none;
  -webkit-user-select: none; user-select: none;
  -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%;
  font-family: "museo-sans", "Museo Sans", -apple-system, BlinkMacSystemFont, "Helvetica Neue", "Segoe UI", Roboto, Arial, sans-serif;
  cursor: default;
}
#stage { position: fixed; inset: 0; touch-action: none; }
#frame { position: absolute; overflow: hidden; touch-action: none; }
#world { position: absolute; left: 0; top: 0; transform-origin: 0 0; will-change: transform; }
.cell { position: absolute; }
.fill {
  position: absolute; inset: 0; transform-origin: 50% 50%;
  display: flex; align-items: center; justify-content: center; overflow: hidden;
}
.label {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  line-height: 1; text-align: center;
}
.icon {
  font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", "Segoe UI Symbol", sans-serif;
  line-height: 1; font-weight: 400; letter-spacing: 0; font-style: normal;
}
.icon { flex: none; }
.icon img { width: 100%; height: 100%; object-fit: contain; display: block; pointer-events: none; -webkit-user-drag: none; }
/* mid-backer: blank tag or post-it behind the icon (content layer, above the trail); icon centred on its face */
.icon.has-backer { position: relative; }
.icon.bare img { filter: drop-shadow(0 0 var(--shb, 3px) rgba(0, 0, 0, 0.3)); }   /* v37: no mid-back = static soft shadow, same look as the backers' */
.icon.has-backer img { position: absolute; }
.icon.has-backer .backer { inset: 0; }
.icon.bk-tag .ico { left: 17%; width: 66%; top: 30%; height: 54%; }
.icon.bk-postit .ico { left: 15%; width: 70%; top: 16%; height: 68%; }
.icon.bk-saw .ico { left: 23%; width: 54%; top: 22%; height: 54%; }
.fill .bgi { position: absolute; inset: 0; pointer-events: none; }
.fill.tex .bgi::before { content: ""; position: absolute; inset: var(--tex-in, 0px); transform: var(--tex-tf, none); background-image: var(--tex); background-position: var(--tex-pos, center); background-size: var(--tex-size, cover); background-repeat: var(--tex-rep, repeat); opacity: var(--tex-op, 0.32); pointer-events: none; }
.label { position: relative; z-index: 1; }
.fill.fg { background: none; }   /* content layer: art and text only, painted above the trail */
.num { margin-top: 0.3em; font-weight: 700; letter-spacing: -0.01em; white-space: nowrap; }
.k-id .num { font-family: "museo-slab", "Museo Slab", Georgia, serif; margin-top: 0.45em; }
.k-id .icon, .k-foot .icon { flex: none; }
.name { font-weight: 500; opacity: 0.85; margin-top: 0.5em; max-width: 80%; line-height: 1.3; }
.k-id .name { max-width: 72%; }
.k-foot .num { font-weight: 600; }
.open { margin-top: 0.55em; font-weight: 700; white-space: nowrap; }
.open.pill { padding: 0.45em 0.95em; border-radius: 999px; border: 1.5px solid currentColor; letter-spacing: 0.02em; }
.fallback { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
svg.arc { position: absolute; left: 0; top: 0; overflow: visible; pointer-events: none; transform-origin: 0 0; }
svg.arc path { fill: none; stroke-linecap: round; }
svg.arc path.hint {  /* only present when CFG.trailHint is true */
  stroke-width: 3; stroke-dasharray: 1.4 7.4; stroke-linecap: round; opacity: 0;
  transition: opacity 600ms ease; animation: phi-dots 1.1s linear infinite;
}
@keyframes phi-dots { from { stroke-dashoffset: 0; } to { stroke-dashoffset: -8.8; } }
@media (prefers-reduced-motion: reduce) { svg.arc path.hint { animation: none; transition: none; } }

/* cinemagraph squares: video fills the square under the trail */
.fill video.cine { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; pointer-events: none; background: transparent; }
/* pencil scans: the paper is baked out to transparency (v29), so no blend mode is needed on the note */
.icon.bk-postit .ico[src*="buck-sketch"] { left: 7%; width: 86%; top: 6%; height: 88%; }   /* tight-cropped buck fills the note */
/* hang tags sway from the hole (top centre); the swing angle is the `rotate` property set in app.js */
.icon.swing { transform-origin: 50% 11%; }               /* tag-*-rc: hole at y 6.8 of 63.2 */
.icon.swing.bk-tag { transform-origin: 50% 12.7%; }      /* tag backers: hole at y 6.8 in a -2..67 box */
/* squares outside the frame: kept in the DOM (no reflow) but not painted */
.cell.off { visibility: hidden; }

/* v29: while the spiral moves, each on-screen square's fill and background get their own compositor layer,
   so the per-frame scale / counter-rotation is composited instead of repainting the whole world (about 55%
   less main-thread work in a headless profile). Dropped at rest so everything re-rasterises sharp. */
#world.mv .cell:not(.off) .fill, #world.mv .cell:not(.off) .bgi { will-change: transform; }

/* ---------- v30: birch cut edge (zigzag on all four sides; overlay in the square's own fill colour) ---------- */
.fill .zz { position: absolute; inset: 0; pointer-events: none; background-size: 100% 100%; background-repeat: no-repeat; }

/* ---------- v30: title cards (live HTML, sized to the square with container units) ---------- */
.tc { position: absolute; inset: 0; container-type: size; display: flex; align-items: center; justify-content: center; pointer-events: none; cursor: default; }
.tc .face {
  pointer-events: auto; box-sizing: border-box; position: relative; display: flex; flex-direction: column; align-items: flex-start; justify-content: center;
  width: 84cqw; max-height: 84cqh; padding: 7cqw 7cqw 6cqw; text-decoration: none; color: #1D233D; cursor: default;
  font-family: "museo-sans", "Museo Sans", -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif; font-weight: 700; line-height: 1.2; text-align: left;
  -webkit-user-select: none; user-select: none; -webkit-tap-highlight-color: transparent;
  transition: transform 160ms ease, box-shadow 160ms ease, background-color 160ms ease;
}
.tc a.face { cursor: pointer; }
.tc .t { display: block; font-family: "museo-slab", "Museo Slab", Georgia, serif; font-weight: 700; font-size: 11cqw; line-height: 1.05; letter-spacing: -0.01em; color: #1c4e9e; }
.tc .d { display: block; margin-top: 3cqw; font-size: 5.2cqw; font-weight: 700; color: #54656f; }
/* rstew.art's embossed label-maker tape */
.tc .tape {
  display: inline-block; margin-top: 4.5cqw; padding: 1.4cqw 2.6cqw; border-radius: 2px;
  font-family: "Courier New", Courier, monospace; font-weight: 700; font-size: 4.4cqw; letter-spacing: 0.2em; text-transform: uppercase; white-space: nowrap;
  color: rgba(255,255,255,.95); text-shadow: 0 -1px 0 rgba(0,0,0,.35), 0 1px 0 rgba(255,255,255,.4);
  background: linear-gradient(180deg, rgba(255,255,255,.14), rgba(255,255,255,0) 30%, rgba(0,0,0,0) 70%, rgba(0,0,0,.16)), #a8452a;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.18), inset 0 -1px 0 rgba(0,0,0,.25), 0 1px 2px rgba(0,0,0,.3);
  transform: rotate(-1.5deg);
}
/* (a) name: white business card */
.tc-name .face { background: #fff; border-radius: 1.4cqw; transform: rotate(-2deg); box-shadow: 0 1.4cqw 3cqw rgba(0,0,0,.34), 0 .3cqw .6cqw rgba(0,0,0,.2); border-top: 1.6cqw solid #F47C3E; }
.tc-name .t { font-size: 12cqw; }
/* (b) get in touch: post-it with the site's orange pill */
.tc-contact .face { background: #fff; transform: rotate(1.6deg); box-shadow: 0 1.4cqw 3cqw rgba(0,0,0,.32); }
.tc-contact .t { color: #1D233D; font-size: 12.5cqw; }
.tc-contact .pill { display: inline-block; margin-top: 4.5cqw; padding: 1.8cqw 3.6cqw; border-radius: 999px; background: #F47C3E; color: #1D233D; font-size: 5.2cqw; font-weight: 700; white-space: nowrap; box-shadow: 0 .5cqw 1cqw rgba(0,0,0,.25); }
/* (c) portfolio: hang tag (navy; white on a navy square) */
.tc-portfolio .face { background: #1D233D; border-radius: 3cqw; padding-top: 13cqw; transform: rotate(-1.2deg); box-shadow: 0 1.4cqw 3cqw rgba(0,0,0,.35); border: .9cqw solid #A5C2D9; }
.tc-portfolio .t { color: #fff; }
.tc-portfolio .d { color: #A5C2D9; }
.tc-portfolio .hole { position: absolute; top: 4.5cqw; left: 50%; width: 5cqw; height: 5cqw; margin-left: -2.5cqw; border-radius: 50%; background: #eaeaea; box-shadow: inset 0 .5cqw .8cqw rgba(0,0,0,.45); }
.tc-portfolio.on-N .face { background: #fff; border-color: #fff; }
.tc-portfolio.on-N .t { color: #1c4e9e; } .tc-portfolio.on-N .d { color: #54656f; }
/* (d) tagline: painted sign, museo-slab with a sign-painter's drop shade */
.tc-tagline .face { background: #1D233D; border-radius: 1cqw; align-items: center; text-align: center; padding: 8cqw 6cqw; box-shadow: inset 0 0 0 1.2cqw #1D233D, inset 0 0 0 1.8cqw #F47C3E, 0 1.4cqw 3cqw rgba(0,0,0,.35); }
.tc-tagline .t { color: #fff; font-size: 9.4cqw; text-transform: uppercase; letter-spacing: 0.02em; text-shadow: .5cqw .6cqw 0 #F47C3E; }
.tc-tagline .d { color: #A5C2D9; }
.tc-tagline.on-N .face { background: #F47C3E; box-shadow: inset 0 0 0 1.2cqw #F47C3E, inset 0 0 0 1.8cqw #1D233D, 0 1.4cqw 3cqw rgba(0,0,0,.35); }
.tc-tagline.on-N .t { color: #1D233D; text-shadow: .5cqw .6cqw 0 #fff; } .tc-tagline.on-N .d { color: #1D233D; }
/* hover and keyboard focus on the links */
a.face:hover { transform: rotate(0deg) translateY(-1.5cqw); box-shadow: 0 2.6cqw 4.5cqw rgba(0,0,0,.4); }
.tc-contact a.face:hover .pill { background: #ff8c50; }
.tc-portfolio a.face:hover { background: #1c4e9e; } .tc-portfolio.on-N a.face:hover { background: #eaeaea; }
a.face:focus { outline: none; }
a.face:focus-visible { outline: 3px solid #F47C3E; outline-offset: 3px; box-shadow: 0 0 0 3px #fff, 0 0 0 9px #1D233D; transform: rotate(0deg); }
/* small squares: title (and tape) only; very small: title only */
@container (max-width: 175px) {
  .tc .d, .tc .pill { display: none; }
  .tc .t { font-size: 15cqw; }
  .tc-tagline .t { font-size: 9.4cqw; }
}
@container (max-width: 70px) { .tc .tape { display: none; } .tc .face { padding: 6cqw; } }
@media (prefers-reduced-motion: reduce) { .tc .face { transition: none; } a.face:hover { transform: none; } }
/* while moving, the counter-rotated cards get their own layer, so their shadows are not repainted every frame */
#world.mv .cell:not(.off) .tc { will-change: transform; }

/* ---------- v31: the one title card, Ryan's business card on a post-it (rstew.art post-it backer art) ---------- */
.tc-biz .face {
  width: 97cqw; height: 97cqw; max-height: none; padding: 9.5cqw 9.5cqw 8.5cqw 10.5cqw;   /* v38: note art is 92% opaque, so ~89% of the square */ justify-content: center;
  background: url("art/backer/postit-sq-cream.webp?v=38") center / 100% 100% no-repeat; box-shadow: none; border-radius: 0;
  transform: rotate(-1.6deg);
}
.tc-biz .tape { order: -1; margin: 0 0 3cqw; font-size: 3.4cqw; letter-spacing: .16em; padding: 1.2cqw 2.4cqw; }
.tc-biz .t { font-size: 11cqw; color: #1c4e9e; }
.tc-biz .d { margin-top: 2cqw; font-size: 4.8cqw; color: #54656f; }
.tc-biz .lks { display: flex; flex-direction: column; align-items: flex-start; gap: 2cqw; margin-top: 4cqw; }
.tc-biz .lk {
  pointer-events: auto; cursor: pointer; display: inline-block; text-decoration: none; white-space: nowrap;
  font: 700 5.2cqw/1.1 "museo-sans", "Museo Sans", -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;
  padding: 1.8cqw 3.8cqw; border-radius: 999px; box-shadow: 0 .5cqw 1cqw rgba(0,0,0,.22);
  transition: transform 140ms ease, background-color 140ms ease, box-shadow 140ms ease;
}
.tc-biz .lk-port { background: #1D233D; color: #fff; }
.tc-biz .lk-mail { background: #F47C3E; color: #1D233D; }
.tc-biz .lk:hover { transform: translateY(-.6cqw); box-shadow: 0 1.2cqw 2cqw rgba(0,0,0,.3); }
.tc-biz .lk-port:hover { background: #1c4e9e; }
.tc-biz .lk-mail:hover { background: #ff8c50; }
.tc-biz .lk:focus { outline: none; }
.tc-biz .lk:focus-visible { outline: 3px solid #1c4e9e; outline-offset: 2px; box-shadow: 0 0 0 2px #fff; }
@container (max-width: 175px) {
  .tc-biz .tape, .tc-biz .d { display: none; }
  .tc-biz .t { font-size: 14cqw; }
  .tc-biz .lk { font-size: 7cqw; }
}
@container (max-width: 90px) { .tc-biz .lks { display: none; } }
@media (prefers-reduced-motion: reduce) { .tc-biz .lk { transition: none; } .tc-biz .lk:hover { transform: none; } }

/* v32 soft cog: the saw backer turns slowly clockwise around the blade's true centre (50%, 49.01% of the
   viewBox, measured), transform only on its own layer; paused (keeping its angle) outside slots 1-2 */
.icon.bk-saw .backer { transform-origin: 50% 49.01%; animation: cog-turn 26s linear infinite paused; }
.icon.bk-saw.cog .backer { animation-play-state: running; will-change: transform; }
@keyframes cog-turn { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .icon.bk-saw .backer { animation: none; } }
