/* Anatomy page. Desktop (1100px and up): list left, organization in the middle, card right,
   the organization drawn on the wall behind both. Narrower: sticky strip of ways, organization,
   card below. Positions inside .floor are floor units; anatomy.js sets the camera. */

/* ---------- intro ---------- */
/* The drawing runs up behind the intro on desktop; the intro stays on top. */
.page-anatomy main > .wrap { position: relative; z-index: 2; }
.anatomy { position: relative; z-index: 1; }
.intro.row { flex-direction: row; align-items: flex-end; justify-content: space-between; gap: 24px 64px; padding-block: 0 18px; }
.intro.row .lead { width: 460px; flex-shrink: 0; margin-bottom: 8px; }
.h1 .block { display: block; }

/* ---------- the drawing ---------- */
.stage { overflow: hidden; }
.floor { position: absolute; left: 0; top: 0; width: 1090px; height: 600px; transform-origin: 0 0; transition: transform 1100ms cubic-bezier(0.4, 0, 0.2, 1); --u: 1; --z: 1; }
.layer { position: absolute; left: 0; top: 0; width: 1px; height: 1px; overflow: visible; }
#links { transition: opacity 600ms; }
#links.hide { opacity: 0; transition: none; }

.ln { fill: none; stroke-linecap: round; stroke-width: calc(2.3px * var(--u)); transition: opacity 500ms; }
.dash { fill: none; stroke: var(--pencil2); stroke-width: calc(2px * var(--u)); stroke-dasharray: calc(6px * var(--u)) calc(5px * var(--u)); transition: opacity 500ms; }
.amb { fill: var(--pencil2); }
/* Links to the outside world: the dashes flow along the line, impulses run through it. */
.dash.ext-link { stroke: var(--pencil); animation: march 1.1s linear infinite; }
.impulse { fill: var(--pencil); stroke: var(--paper); stroke-width: calc(1.2px * var(--u)); }
@keyframes march { to { stroke-dashoffset: calc(-22px * var(--u)); } }
.wire { fill: none; stroke: var(--red); stroke-linecap: round; stroke-width: calc(3px * var(--u)); animation: grow 500ms 350ms ease-out forwards; }
.head { fill: none; stroke: var(--red); stroke-width: calc(3px * var(--u)); stroke-linecap: round; stroke-linejoin: round; opacity: 0; animation: fadein 250ms 800ms ease-out forwards; }
.pulse { fill: var(--red); stroke: var(--paper); stroke-width: calc(2px * var(--u)); }
@keyframes grow { to { stroke-dashoffset: 0; } }
@keyframes fadein { to { opacity: 1; } }

/* people */
.node { position: absolute; transform: translate(-50%, -50%) scale(var(--k, 1)); color: var(--ink);
  transition: left 900ms cubic-bezier(0.4, 0, 0.2, 1), top 900ms cubic-bezier(0.4, 0, 0.2, 1), transform 450ms cubic-bezier(0.2, 0, 0, 1), color 350ms, opacity 500ms; }
.node.lit { color: var(--red); }
.node .pw { position: absolute; inset: -8%; filter: drop-shadow(1px 3px 3px rgba(31, 29, 29, 0.22)); }
.node .pn { position: absolute; inset: 0; background: var(--pink); transform-origin: 50% 0; transition: background-color 350ms; animation: lift 3s ease-in-out infinite; }
.node.lit .pn { background: var(--pink-lit); }
.node.up .pn { animation-name: lift2; }
.node.dim .pn { animation-play-state: paused; }
/* Dimmed = the look of 26% opacity, but as solid colors, so the paper stays opaque. */
.node.dim { color: #c3c2bf; }
.node.dim .pn { background: #fef3f1; }
.node.dim .pw { filter: drop-shadow(1px 2px 2px rgba(31, 29, 29, 0.07)); }
.node.dim .lab { color: #c3c2bf; }
.pn.ear { clip-path: polygon(0 0, 100% 0, 100% 76%, 76% 100%, 0 100%); }
.pn.ear::after { content: ""; position: absolute; right: 0; bottom: 0; width: 24%; height: 24%; background: linear-gradient(135deg, rgba(31, 29, 29, 0.24) 0%, rgba(31, 29, 29, 0.08) 50%, rgba(31, 29, 29, 0) 50%); }
.pn.torn { clip-path: polygon(0 5%, 11% 0, 23% 6%, 36% 1%, 50% 7%, 64% 1%, 79% 5%, 100% 0, 100% 100%, 0 100%); }
.pn.torn2 { clip-path: polygon(0 0, 100% 0, 100% 100%, 62% 100%, 55% 93%, 47% 100%, 0 100%); }
@keyframes lift { 0%, 100% { transform: perspective(260px) rotateX(0deg); } 50% { transform: perspective(260px) rotateX(7deg); } }
@keyframes lift2 { 0%, 100% { transform: perspective(260px) rotateX(2deg); } 50% { transform: perspective(260px) rotateX(20deg); } }
.node .face { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; transition: stroke 350ms; }
/* The circle is drawn over the note and wide enough to go around its corners (the note itself is 116% with shadow). */
/* Size and place are set in anatomy.js. max-width: none undoes the shared "svg { max-width: 100% }",
   which squeezed the circle to the width of the note. */
.node .ring { position: absolute; max-width: none; overflow: visible; transform: rotate(-20deg); pointer-events: none; }
.layer { max-width: none; }
.node .ring path { fill: none; stroke: var(--red); stroke-width: 2.6; stroke-linecap: round; stroke-dasharray: 330; stroke-dashoffset: 330; animation: draw 700ms 300ms ease-out forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }
.node .lab { position: absolute; left: 50%; top: 112%; transform: translateX(-50%); white-space: nowrap; font: 700 calc(11px * var(--u) / var(--k, 1))/1.15 var(--f-head); letter-spacing: 0.05em; color: var(--ink); }
.node .lab.start { left: -10%; transform: none; }
.node.kick { animation: kick 650ms ease-out; }
@keyframes kick { 0% { filter: brightness(1); } 12% { filter: brightness(1.25); translate: 0 -3px; } 30% { translate: 2px 0; } 50% { translate: -2px 0; } 100% { filter: brightness(1); translate: 0 0; } }

/* papers taped to the wall */
.ext { position: absolute; transform: translate(-50%, -50%) rotate(var(--r, 0deg)) scale(var(--k, 1));
  min-width: calc(84px * var(--u)); padding: calc(9px * var(--u)) calc(10px * var(--u)); text-align: center;
  background: var(--white); border: 1px solid var(--rule); box-shadow: 1px 2px 3px rgba(31, 29, 29, 0.16);
  font: 700 calc(12px * var(--u))/1.1 var(--f-head); letter-spacing: 0.04em; white-space: nowrap; transition: opacity 500ms; }
.ext.soft { color: var(--pencil); }
.ext.dim { color: #cfccc6; border-color: #eeebe4; box-shadow: 1px 2px 3px rgba(31, 29, 29, 0.05); }
.ext.dim::before { opacity: 0.35; }
.ext::before { content: ""; position: absolute; left: 50%; top: calc(-6px * var(--u)); width: calc(32px * var(--u)); height: calc(12px * var(--u)); margin-left: calc(-16px * var(--u)); background: var(--tape); transform: rotate(-4deg); }

/* title and workshop notes on the wall */
.otitle { font: 700 27px/30px var(--f-head); }
.otitle::after { content: ""; display: block; height: 4px; margin-top: 2px; border-radius: 4px; background: var(--ink); width: 92%; }
.otitle.in-floor { position: absolute; left: 430px; top: -66px; transform: rotate(-2deg); white-space: nowrap; transition: opacity 500ms; }
.otitle.on-phone { display: none; }
.residue > * { position: absolute; }
.res { display: flex; align-items: center; justify-content: center; text-align: center; padding: 10px 8px; background: var(--sticky); box-shadow: 1px 3px 4px rgba(31, 29, 29, 0.18); border-radius: 2px 2px 12px 2px / 2px 2px 5px 2px; }
.res span { display: block; }
.res.r1 { left: -165px; top: 70px; width: 104px; height: 92px; transform: rotate(-5deg); font: 27px/23px var(--f-messy); color: var(--blue); }
.res.r1 span { transform: rotate(-4deg); }
.res.r2 { left: -160px; top: 430px; width: 100px; height: 86px; transform: rotate(4deg); background: var(--pink); font: 700 25px/24px var(--f-note); }
.res.r2 span { transform: rotate(3deg); border-bottom: 2px solid var(--ink); border-radius: 0 0 40px 10px / 0 0 6px 3px; }
.res.r3 { left: 1140px; top: 230px; width: 108px; height: 96px; transform: rotate(6deg); font: 500 21px/21px var(--f-note); }
.res.r3 span { transform: rotate(-2deg); }
.res.r4 { left: 70px; top: 588px; width: 104px; height: 84px; transform: rotate(-4deg); font: 500 22px/21px var(--f-note); color: var(--blue); }
.res.r4 span { transform: rotate(2deg); }
.res.r5 { left: 398px; top: 598px; width: 100px; height: 80px; transform: rotate(3deg); background: var(--pink); font: 30px/25px var(--f-messy); }
.res.r5 span { transform: rotate(-5deg); }
.res-text.r6 { left: 1120px; top: 40px; transform: rotate(3deg); font: 28px/27px var(--f-messy); }
.res-text.r6 u { text-decoration: none; border-bottom: 2px solid var(--ink); }
.res-text.r6 .tick { color: var(--red); }
.res-text.r7 { left: 858px; top: 604px; transform: rotate(-3deg); font: 500 22px/22px var(--f-note); color: var(--pencil); }
.res-text.r7 .dots { display: flex; gap: 5px; margin-top: 4px; }
.res-text.r7 i { width: 11px; height: 11px; border-radius: 50%; background: var(--ink); }
.res-text.r7 i.red { background: var(--red); }
.res-text.r8 { left: 1150px; top: 420px; transform: rotate(8deg); font: 700 64px/64px var(--f-head); color: var(--pencil2); }
/* Workshop leftovers are background, never in focus: always faded and desaturated, more so when
   part of the company is selected. */
.residue { opacity: 0.5; filter: saturate(0.45); transition: opacity 500ms; }
.anatomy.partial .residue { opacity: 0.32; }
.anatomy.partial .otitle.in-floor { opacity: 0.55; }

/* ---------- things that hold paper to the wall ---------- */
/* Magnet: a glossy disc. --mc sets the color. */
.magnet { position: absolute; z-index: 2; left: 50%; top: -9px; width: 22px; height: 22px; margin-left: -11px; border-radius: 50%;
  background: radial-gradient(circle at 34% 30%, rgba(255, 255, 255, 0.7) 0 16%, rgba(255, 255, 255, 0) 32%), var(--mc, var(--red));
  box-shadow: 1px 3px 3px rgba(31, 29, 29, 0.35), inset -2px -3px 4px rgba(0, 0, 0, 0.25); }
.magnet.ink { --mc: #2b2a2a; }
.magnet.blue { --mc: #2f6fd0; }
.magnet.yellow { --mc: #f2b632; }
.magnet.big { width: 28px; height: 28px; margin-left: -14px; top: -12px; }
/* Push pin: a round head and its shadow, as if the needle goes into the wall. */
.pin { position: absolute; z-index: 2; left: 50%; top: -6px; width: 14px; height: 14px; margin-left: -7px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #ffb3ad 0 18%, var(--pc, var(--red)) 46%, #7d1714 100%);
  box-shadow: 3px 4px 2px rgba(31, 29, 29, 0.28); }
.pin.blue { --pc: #2f6fd0; }
.pin.green { --pc: #3d9a5a; }
.pin.yellow { --pc: #e9a81f; }
.pin.left { left: 18%; } .pin.right { left: 82%; }

/* Stickers */
.sticker { position: absolute; z-index: 2; border-radius: 50%; box-shadow: 1px 2px 2px rgba(31, 29, 29, 0.2); }
.sticker.star { width: 30px; height: 30px; background: var(--gold); clip-path: polygon(50% 0, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%); box-shadow: none; }
.sticker.smile { width: 34px; height: 34px; background: var(--sticky); border: 2px solid var(--ink); }
.sticker.smile::before { content: ""; position: absolute; left: 9px; top: 9px; width: 4px; height: 5px; border-radius: 50%; background: var(--ink); box-shadow: 9px 0 0 var(--ink); }
.sticker.smile::after { content: ""; position: absolute; left: 8px; top: 15px; width: 14px; height: 7px; border: 2px solid var(--ink); border-top: 0; border-radius: 0 0 12px 12px; }
.dot { display: inline-block; width: 12px; height: 12px; border-radius: 50%; background: var(--ink); box-shadow: 0 1px 1px rgba(31, 29, 29, 0.25); }
.dot.r { background: var(--red); }
.dot.g { background: #3d9a5a; }
.dot.y { background: var(--gold); }

/* Paper held by a pin, a magnet or tape: notes on the wall */
.res .magnet, .res .pin { pointer-events: none; }

/* Dot voting sheet */
.vote { left: 600px; top: 690px; width: 230px; padding: 22px 18px 16px; background: var(--white); border: 1px solid var(--rule);
  box-shadow: 2px 4px 6px rgba(31, 29, 29, 0.13); transform: rotate(-2deg); font: 500 20px/1.1 var(--f-note); }
.vote b { display: block; margin-bottom: 8px; font: 700 15px/1.2 var(--f-head); letter-spacing: 0.04em; }
.vote ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.vote li { display: flex; align-items: center; gap: 4px; border-bottom: 1px dashed var(--rule); padding-bottom: 4px; }
.vote li span:first-child { flex: 1; }
.vote .dot { width: 13px; height: 13px; }
.vote .sticker.star { right: -12px; bottom: -10px; transform: rotate(14deg); }

/* Masking tape label */
.washi { left: 240px; top: 800px; padding: 5px 14px; background: rgba(222, 206, 160, 0.85); transform: rotate(-3deg);
  font: 700 13px/1.2 var(--f-head); letter-spacing: 0.12em; color: var(--pencil);
  clip-path: polygon(0 8%, 3% 0, 97% 4%, 100% 0, 99% 92%, 96% 100%, 2% 96%, 0 100%); }

/* Handwriting and marker on the wall */
.res-text.r9 { left: 196px; top: 700px; transform: rotate(-4deg); font: 30px/28px var(--f-messy); color: var(--blue); }
.res-arrow { left: 270px; top: 610px; width: 130px; height: 100px; overflow: visible; max-width: none; }
.res-arrow path { fill: none; stroke: var(--blue); stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.res-text.r10 { left: 925px; top: 700px; padding: 6px 16px 8px; transform: rotate(5deg); font: 700 28px/1 var(--f-note); color: var(--red);
  border: 2.5px solid var(--red); border-radius: 52% 48% 55% 45% / 46% 54% 44% 56%; }
.res-text.r11 { left: 870px; top: 800px; transform: rotate(-2deg); font: 500 22px/22px var(--f-note); color: var(--pencil); }
.sticker.r12 { left: 1250px; top: 10px; transform: rotate(-12deg); }
.res-dots { left: 512px; top: 604px; display: flex; gap: 4px; transform: rotate(-8deg); }
.res-dots .dot { width: 11px; height: 11px; }

.res-text .dots { display: flex; gap: 5px; margin-top: 4px; }

/* Papers on the wall held by a pin or a magnet instead of tape (class set from anatomy-data.js) */
.ext.fix-pin::before { width: calc(13px * var(--u)); height: calc(13px * var(--u)); margin-left: calc(-6.5px * var(--u)); top: calc(-6px * var(--u)); border-radius: 50%; transform: none;
  background: radial-gradient(circle at 35% 30%, #ffb3ad 0 18%, var(--red) 46%, #7d1714 100%); box-shadow: calc(3px * var(--u)) calc(4px * var(--u)) 2px rgba(31, 29, 29, 0.28); }
.ext.fix-magnet::before { width: calc(20px * var(--u)); height: calc(20px * var(--u)); margin-left: calc(-10px * var(--u)); top: calc(-10px * var(--u)); border-radius: 50%; transform: none;
  background: radial-gradient(circle at 34% 30%, rgba(255, 255, 255, 0.7) 0 16%, rgba(255, 255, 255, 0) 32%), #2b2a2a;
  box-shadow: 1px 3px 3px rgba(31, 29, 29, 0.35), inset -2px -3px 4px rgba(0, 0, 0, 0.25); }
.ext.fix-magnet.blue::before { background: radial-gradient(circle at 34% 30%, rgba(255, 255, 255, 0.7) 0 16%, rgba(255, 255, 255, 0) 32%), #2f6fd0; }

/* Phone: one note held by a magnet beside the title */
.phone-note { display: none; }

/* ---------- ways of working ---------- */
.ways-tag {
  align-self: flex-start; margin: 0 0 8px 10px; padding: 3px 12px;
  font: 700 15px/20px var(--f-head); letter-spacing: 0.08em;
  border: 2px solid var(--ink); background: var(--white); border-radius: var(--r-tag);
}
.ways-list { display: flex; flex-direction: column; align-items: flex-start; }
.grp { display: flex; flex-direction: column; align-items: flex-start; }
.grp-t {
  margin: 12px 0 3px 12px; padding: 0 4px 1px 0;
  font: 700 16px/22px var(--f-head); letter-spacing: 0.07em; text-transform: uppercase;
  border-bottom: 3px solid var(--red); border-radius: var(--r-mark);
}
.grp-b { display: flex; flex-direction: column; align-items: flex-start; }
.way {
  all: unset; cursor: pointer; box-sizing: border-box; margin-left: 14px; min-height: 44px;
  display: flex; align-items: center; gap: 8px; padding: 6px 14px 6px 12px;
  font: 20px/1.2 var(--f-body); border-radius: var(--r-pill); transition: background-color 0.25s;
}
.way[aria-pressed="true"] { background: var(--hl); }
.way:hover .n { background: var(--red); }
.way:focus-visible { outline: 3px solid var(--red); outline-offset: 2px; }
.way .n {
  flex-shrink: 0; width: 26px; height: 26px; border-radius: 52% 48% 55% 45% / 46% 54% 44% 56%;
  background: var(--ink); color: var(--white); display: inline-flex; align-items: center; justify-content: center;
  font: 700 16px/1 var(--f-head); transition: background-color 0.2s;
}

/* ---------- card ---------- */
.card {
  background: var(--white); border: 2.5px solid var(--ink); border-radius: var(--r-hand);
  box-shadow: 6px 7px 0 rgba(31, 29, 29, 0.14); padding: 24px 26px;
  display: flex; flex-direction: column; gap: 10px;
}
.card .shape { font: 700 15px/20px var(--f-head); letter-spacing: 0.08em; color: var(--red); }
.card h2 { font-size: 29px; line-height: 34px; }
.card .sub { font: 21px/26px var(--f-head); color: var(--red); margin-top: 2px; }
.card .blk { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; }
.card .tag { font: 700 15px/20px var(--f-head); letter-spacing: 0.08em; padding: 1px 10px; border: 2px solid var(--ink); background: var(--white); border-radius: var(--r-tag); }
.card p { font-size: 18px; line-height: 23px; }
.card .btn { align-self: flex-start; margin-top: 4px; }
.card .contact-line { font-size: 16px; }

/* ---------- desktop ---------- */
@media (min-width: 1100px) {
  .anatomy { position: relative; height: 700px; }
  .stage { position: absolute; left: 0; right: 0; top: -130px; bottom: 0;
    -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 12%, #000 90%, transparent 100%);
    mask-image: linear-gradient(to bottom, transparent 0, #000 12%, #000 90%, transparent 100%); }
  .anat-ui { position: relative; height: 100%; padding: 0; pointer-events: none; }
  .anat-ui > * { pointer-events: auto; }
  .ways { position: absolute; left: 0; top: 0; width: 400px; padding: 12px 0 24px max(var(--gutter), env(safe-area-inset-left, 0px));
    display: flex; flex-direction: column; align-items: flex-start; }
  /* The pale band behind the list runs to the left edge of the screen (not just the content edge)
     and fades out over its last 120px, so nothing on the wall gets cut by a hard edge. */
  .ways::before { content: ""; position: absolute; z-index: -1; top: 0; bottom: 0; right: 0; left: -100vw;
    background: linear-gradient(to right, rgba(253, 252, 248, 0.97) 0, rgba(253, 252, 248, 0.9) calc(100% - 120px), rgba(253, 252, 248, 0) 100%); }
  .ways { isolation: isolate; }
  .anatomy { overflow-x: clip; } /* clip only sideways: the drawing still runs up behind the intro */
  .card { position: absolute; right: max(var(--gutter), env(safe-area-inset-right, 0px)); top: 8px; width: 350px; }
}

/* ---------- phone and tablet ---------- */
@media (max-width: 1099px) {
  .intro.row { flex-direction: column; align-items: flex-start; gap: 12px; padding-block: 20px 8px; }
  .intro.row .lead { width: auto; margin: 0; }
  .anatomy { display: flex; flex-direction: column; padding-bottom: 40px; }
  .anat-ui { display: contents; }
  .residue, .otitle.in-floor { display: none; }

  .ways { order: 1; position: sticky; top: env(safe-area-inset-top, 0px); z-index: 5; background: var(--paper);
    margin-top: 14px; padding: 8px 0; border-bottom: 1px solid var(--rule); }
  .ways-tag { display: none; }
  .ways-list { flex-direction: row; align-items: flex-end; gap: 6px; overflow-x: auto; scroll-snap-type: x proximity; scrollbar-width: none;
    padding: 2px max(16px, env(safe-area-inset-right, 0px)) 4px max(16px, env(safe-area-inset-left, 0px)); }
  .ways-list::-webkit-scrollbar { display: none; }
  .grp { flex: none; gap: 3px; }
  .grp + .grp { padding-left: 8px; border-left: 1.5px dashed var(--rule); }
  .grp-t { margin: 0 0 0 6px; padding: 0; border: 0; font-size: 11px; line-height: 14px; color: var(--pencil); white-space: nowrap; }
  .grp-b { flex-direction: row; gap: 4px; }
  .way { margin: 0; flex: none; scroll-snap-align: center; min-height: 40px; padding: 4px 12px 4px 6px; font-size: 16px; white-space: nowrap; }
  .way .n { width: 24px; height: 24px; font-size: 14px; }

  .otitle.on-phone { order: 2; display: inline-block; align-self: flex-start; margin: 16px 0 0 max(16px, env(safe-area-inset-left, 0px)); font-size: 22px; line-height: 24px; transform: rotate(-2deg); }
  .otitle.on-phone::after { height: 3px; margin-top: 3px; }
  .phone-note { order: 2; display: flex; align-items: center; justify-content: center; position: relative; z-index: 3;
    align-self: flex-end; width: 84px; height: 64px; margin: -44px max(20px, env(safe-area-inset-right, 0px)) -24px 0;
    background: var(--pink); box-shadow: 1px 3px 4px rgba(31, 29, 29, 0.18); border-radius: 2px 2px 10px 2px / 2px 2px 5px 2px;
    transform: rotate(4deg); font: 24px/20px var(--f-messy); text-align: center; opacity: 0.7; filter: saturate(0.5); }
  .phone-note span { transform: rotate(-4deg); }
  .stage { order: 3; position: relative; height: clamp(330px, 104vw, 520px);
    -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 7%, #000 92%, transparent 100%);
    mask-image: linear-gradient(to bottom, transparent 0, #000 7%, #000 92%, transparent 100%); }
  .card { order: 4; margin: 10px max(16px, env(safe-area-inset-right, 0px)) 0 max(16px, env(safe-area-inset-left, 0px));
    max-width: 640px; padding: 20px 20px 22px; gap: 12px; box-shadow: 5px 6px 0 rgba(31, 29, 29, 0.14); }
  .card h2 { font-size: 26px; line-height: 30px; }
  .card .sub { font-size: 19px; line-height: 23px; }
  .card p { font-size: 17px; line-height: 23px; }
  .card .tag { font-size: 13px; padding: 1px 9px; }
}
@media (min-width: 700px) and (max-width: 1099px) {
  .card { align-self: center; width: calc(100% - 32px); }
}
