/* Draw Your Monsters: a field of cutouts you pan, zoom and summon by theme.
   Visual language from the Draw Your Monsters design system: sage ground, one purple voice,
   Fraunces 900 for the lifted phrase, light Hanken Grotesk for everything else,
   square corners, hairline rules, no shadows or gradients. */
:root{
  /* design system tokens */
  --sage:#d2d5c0; --lavender:#e4dbe2; --paper:#ffffff;
  --purple:#573081; --graphite:#323232; --muted:#5e5e5e; --forest:#1c3c2f;
  --rule:var(--muted);
  --space-1:8px; --space-2:16px; --space-3:32px; --space-4:64px;
  --radius-none:0;
  --font-display:"Prospectus Pro M","Fraunces",Georgia,serif;
  --font-sans:"Helvetica Neue","Hanken Grotesk",Helvetica,Arial,sans-serif;
  --display-weight:900; --title-size:44px;
  --edge:48px;        /* left and right margin shared by the header, the field's controls and the theme bar */
  --edge-top:44px;    /* space above the title */

  /* roles used by this site */
  --ground:var(--sage); --surface:var(--paper); --voice:var(--purple); --ink:var(--graphite); --ink-2:var(--muted);
  --line:color-mix(in srgb,var(--graphite) 28%,transparent);
  --dim:.14;
  color-scheme:light;
}
*{box-sizing:border-box}
html,body{height:100%;margin:0}
body{
  background:var(--ground);color:var(--ink);font:300 15px/1.45 var(--font-sans);
  display:grid;grid-template-rows:auto minmax(0,1fr) auto;grid-template-columns:minmax(0,1fr);overflow:hidden;
  transition:background-color .5s,color .5s;
}
button,select,input{font:inherit;color:inherit}
button{cursor:pointer}
:focus-visible{outline:2px solid var(--voice);outline-offset:2px}
.sr{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0)}
[hidden]{display:none!important}
.em{font-family:var(--font-display);font-weight:var(--display-weight);font-style:normal}
.sep{margin:0 .4em;color:var(--ink-2)}

/* ---------- top bar ---------- */
.top{
  display:flex;flex-wrap:wrap;align-items:flex-end;justify-content:space-between;gap:10px 24px;
  padding:var(--edge-top) max(var(--edge),env(safe-area-inset-right)) 12px max(var(--edge),env(safe-area-inset-left));
  position:relative;z-index:5;
}
/* wide screens (most laptops too): the menu sits on the title's line, centred on it (narrower screens wrap the menu below) */
@media (min-width:1080px){
  .top{display:grid;grid-template-columns:minmax(0,1fr) auto;align-items:center;column-gap:24px;row-gap:0}
  .brand{display:contents}
  .brand h1{grid-column:1;grid-row:1;white-space:nowrap}
  .brand .tag{grid-column:1 / -1;grid-row:2}
  .controls{grid-column:2;grid-row:1;justify-content:flex-end}
}
.brand h1{font-family:var(--font-display);font-weight:var(--display-weight);font-size:var(--title-size);line-height:.92;letter-spacing:-.01em;margin:0;color:var(--voice)}
.brand h1 .home{color:inherit;text-decoration:none}   /* the title is the way back to the beginning */
.brand h1 .home:hover{text-decoration:underline;text-decoration-thickness:2px;text-underline-offset:6px}
.brand h1 .home:focus-visible{outline:2px solid var(--voice);outline-offset:4px}
.brand .tag{margin:6px 0 0;color:var(--ink);font-size:14px;max-width:48ch}
.controls{display:flex;flex-wrap:wrap;align-items:center;gap:8px}
.links{display:inline-flex;gap:2px;align-items:center;margin-left:-8px}   /* text links' own padding: keeps 'Begin again' on the title's left edge when the menu wraps */
.text-link{border:0;background:none;color:var(--voice);font-weight:400;font-size:14px;padding:6px 8px;text-decoration:none}
.text-link:hover{text-decoration:underline;text-underline-offset:3px}
.seg{display:inline-flex;border:1px solid var(--voice)}
.seg button{border:0;background:none;padding:6px 14px;font-weight:400;color:var(--voice)}
.seg button+button{border-left:1px solid var(--voice)}
.seg button[aria-selected="true"]{background:var(--voice);color:var(--ground)}
.sub{display:inline-flex;align-items:center;gap:6px;color:var(--ink);font-size:13px}
select,input[type=search]{
  background:var(--surface);border:1px solid var(--line);border-radius:var(--radius-none);padding:6px 10px;min-width:0;color:var(--ink);
}
input[type=search]{width:190px}
/* the view dropdown: a square, purple-outlined menu with a hairline arrow */
.viewpick{position:relative;display:inline-flex}
.viewpick select{
  appearance:none;-webkit-appearance:none;border:1px solid var(--voice);background:var(--voice);color:#fff;   /* solid purple so it's hard to miss */
  border-radius:var(--radius-none);padding:8px 40px 8px 14px;font:500 15px/1.3 var(--font-sans);min-width:230px;cursor:pointer;
}
.viewpick select:hover{background:color-mix(in srgb,var(--voice) 86%,#000)}
.viewpick select:focus-visible{outline:2px solid var(--voice);outline-offset:3px}
.viewpick::after{content:"";position:absolute;right:15px;top:50%;width:8px;height:8px;margin-top:-6px;border-right:2px solid #fff;border-bottom:2px solid #fff;transform:rotate(45deg);pointer-events:none}
.viewpick select option{color:var(--graphite);background:var(--paper)}
input[type=search]::placeholder{color:var(--ink-2)}
.icon{
  width:34px;height:34px;display:inline-grid;place-items:center;border-radius:var(--radius-none);
  border:1px solid var(--voice);background:transparent;color:var(--voice);font-size:18px;line-height:1;padding:0;
}
.icon:hover{background:color-mix(in srgb,var(--voice) 10%,transparent)}

/* ---------- stage ---------- */
#stage{position:relative;overflow:hidden;touch-action:none;cursor:grab;outline:none}
#stage.panning{cursor:grabbing}
#world{position:absolute;left:0;top:0;transform-origin:0 0;will-change:transform}
#world.glide{transition:transform 1s cubic-bezier(.25,.8,.25,1)}

.m{
  position:absolute;left:0;top:0;padding:0;border:0;background:none;cursor:pointer;
  will-change:transform;
  transition:transform 1.1s cubic-bezier(.3,.75,.2,1),opacity .7s;
}
.m .bob{width:100%;height:100%;animation:bob var(--bd,6s) ease-in-out var(--bl,0s) infinite alternate;transition:scale .25s}
.m img{display:block;width:100%;height:100%;pointer-events:none;user-select:none;-webkit-user-drag:none}
.m:hover .bob,.m:focus-visible .bob{scale:1.06}
.m.dim{opacity:var(--dim)}
.m.dim:hover{opacity:.6}
.m.quiet:not(.dim){opacity:.55}   /* a group set aside (less about the grab): softer, so the eye stays on the rest */
.m.quiet:not(.dim):hover{opacity:1}
.label.pile.quiet{font-weight:400;color:var(--ink-2)}
.m .name{
  position:absolute;left:50%;top:100%;transform:translate(-50%,6px);white-space:nowrap;
  font:500 16px/1.15 var(--font-sans);color:var(--ink);opacity:0;transition:opacity .2s;pointer-events:none;
  background:var(--surface);padding:3px 8px;
}
.m:hover .name,.m:focus-visible .name{opacity:1}
@keyframes bob{from{transform:translate(0,0) rotate(-1deg)}to{transform:translate(0,-6px) rotate(1deg)}}

/* theme names written on the field */
.label{
  position:absolute;left:0;top:0;transform-origin:50% 50%;pointer-events:none;
  font-family:var(--font-display);font-weight:var(--display-weight);color:var(--voice);white-space:nowrap;text-align:center;letter-spacing:-.01em;line-height:1;
  transition:opacity .6s, transform 1.1s cubic-bezier(.3,.75,.2,1);
}
.label small{display:block;margin-top:.35em;font:300 .3em/1.2 var(--font-sans);color:var(--ink);letter-spacing:.06em;text-transform:uppercase}
.label.region{opacity:.55}
/* pile headings: the same style as the neighborhood names in Swarm (sans, bold, black) */
.label.pile{font-family:var(--font-sans);font-weight:700;color:#000;letter-spacing:0;line-height:1.1}
.label.pile small{display:inline;margin:0 0 0 .4em;font:400 .8em/1 var(--font-sans);color:var(--ink);letter-spacing:0;text-transform:none}
.halo{display:none}
/* a sentence starter in the middle of a swarm: a light sans line, then the lifted phrase in the display serif */
.label.prompt{display:flex;flex-direction:column;align-items:center;gap:.12em;line-height:1.05}
.label.prompt .lead{font-family:var(--font-sans);font-weight:300;color:var(--voice);font-size:.62em;letter-spacing:0}
.label.prompt .em{font-family:var(--font-display);font-weight:var(--display-weight);color:var(--voice)}
/* the continuum under a line sort: Peril <-> Promise, a hairline with an arrowhead at each end */
.axis{position:absolute;left:0;top:0;display:flex;align-items:center;gap:.8em;pointer-events:none;white-space:nowrap;
  font-family:var(--font-sans);font-weight:700;color:#000;line-height:1;transition:opacity .6s}
.axis{color:var(--voice)}   /* the continuum, its arrowheads and its two words are purple */
.axis .w{font-family:var(--font-display);font-weight:var(--display-weight);font-size:1.45em;letter-spacing:-.01em}   /* Peril and Promise: the display serif, like "in charge now" */
.axis .line{flex:1;position:relative;height:var(--hair,1px);background:currentColor}
.axis .line::before,.axis .line::after{content:"";position:absolute;top:50%;width:.55em;height:.55em;border:solid currentColor;border-width:var(--hair,1px) var(--hair,1px) 0 0;translate:0 -50%}
.axis .line::before{left:0;rotate:-135deg;transform-origin:center;margin-left:.05em}
.axis .line::after{right:0;rotate:45deg;margin-right:.05em}
.axis.vert{flex-direction:column;gap:.6em}
.axis.vert .line{flex:1;width:var(--hair,1px);height:auto}
.axis.vert .line::before,.axis.vert .line::after{left:50%;right:auto;top:auto;translate:-50% 0;margin:0}
.axis.vert .line::before{top:.05em;rotate:-45deg}
.axis.vert .line::after{bottom:.05em;rotate:135deg}
/* a group name sitting on an upright continuum: a sage tag over the line */
.label.pile.onl{background:var(--ground);padding:.15em .4em}   /* the system has no gradients or glows; clusters are named, not tinted */

.zoom{position:absolute;right:max(var(--edge),env(safe-area-inset-right));bottom:16px;display:flex;flex-direction:column;gap:6px;z-index:3}
.zoom .icon{background:var(--ground)}
.status{
  position:absolute;left:50%;top:10px;transform:translateX(-50%);z-index:3;
  background:var(--surface);padding:4px 14px;
  font-size:13px;color:var(--ink);pointer-events:none;transition:opacity .4s;white-space:nowrap;
}
.status:empty{opacity:0}
.status b{font-weight:500}
.status .show-all{pointer-events:auto;margin-left:8px;border:0;background:none;padding:0;color:var(--voice);font-weight:400;text-decoration:underline;text-underline-offset:3px;cursor:pointer}

/* ---------- theme rail ---------- */
.rail{
  position:relative;z-index:4;border-top:1px solid var(--rule);background:var(--ground);
  padding:12px max(var(--edge),env(safe-area-inset-right)) max(12px,env(safe-area-inset-bottom)) max(var(--edge),env(safe-area-inset-left));
}
.rail-head{display:flex;align-items:baseline;gap:12px;margin-bottom:8px}
.rail-title{font-size:21px;line-height:1.3;color:var(--voice)}
.clear{border:0;background:none;color:var(--voice);font-weight:400;padding:2px 4px;text-decoration:underline;text-underline-offset:3px}
.chips{display:flex;flex-wrap:wrap;gap:6px}
.chip{
  display:inline-flex;align-items:center;gap:6px;border:1px solid var(--voice);background:transparent;color:var(--voice);
  border-radius:var(--radius-none);padding:4px 10px;font-size:13.5px;font-weight:400;white-space:nowrap;
}
.chip b{font-weight:300;opacity:.8;font-size:12px}
.chip:hover{background:color-mix(in srgb,var(--voice) 10%,transparent)}
.chip[aria-pressed="true"]{background:var(--voice);color:var(--ground)}
.def{margin:8px 0 0;min-height:1.45em;color:var(--ink);font-size:13.5px;font-style:italic}
.def strong{font-style:normal;font-weight:500}
@media (max-width:720px){
  :root{--edge:16px;--edge-top:18px}
  .rail .chips{flex-wrap:nowrap;overflow-x:auto;padding-bottom:4px;scrollbar-width:none}
  .brand h1{font-size:calc(var(--title-size) * .68)}
  .brand .tag{display:none}
  input[type=search]{width:120px;flex:1}
  .viewpick{flex:1}.viewpick select{min-width:0;width:100%}
  .controls{width:100%;flex-wrap:wrap}
  .seg button{padding:5px 10px}
  .def{font-size:12.5px}
  .links{order:3;width:100%;margin:-2px 0 0 -6px}
  .text-link{font-size:13px;padding:2px 6px}
}

/* ---------- focus: zooming into one monster ---------- */
/* No frame: the camera moves in, the focused monster holds still, the rest of the field falls back. */
#stage.magnified .m:not(.focused){opacity:.1}
#stage.magnified .m.focused{opacity:1}
/* the opening's slow zoom: the camera takes its time, the rest of the city fades gently, the notes wait until it lands */
#stage.slowzoom #world.glide{transition-duration:3.6s;transition-timing-function:cubic-bezier(.45,0,.2,1)}
#stage.slowzoom .m{transition:transform 1.1s cubic-bezier(.3,.75,.2,1),opacity 3s ease-in-out}
#stage.slowzoom .notes{animation-delay:3.1s}
#stage.magnified .label{opacity:.12}
#stage.magnified .status,#stage.magnified .m .name{opacity:0}
.m.focused .bob{animation-play-state:paused;scale:1}
/* when the field is alive, JavaScript drives the movement instead of the CSS bob */
#stage.alive .m .bob{animation:none;will-change:transform;transform-origin:50% 90%}   /* lean and bounce from the feet */

/* Neighborhood names: theme names that surface over the full view, linger, and fade */
.hood{
  position:absolute;left:0;top:0;z-index:2;border:0;padding:.12em .4em;cursor:pointer;
  background:color-mix(in srgb,var(--ground) 86%,transparent);color:#000;
  font-family:var(--font-sans);font-weight:700;letter-spacing:0;line-height:1.1;white-space:nowrap;
  opacity:0;translate:0 .25em;transition:opacity 1.6s ease,translate 1.6s ease;
}
.hood.on{opacity:1;translate:0 0}
.hood.plain{cursor:default}
.hood:not(.plain):hover{text-decoration:underline;text-decoration-thickness:1px;text-underline-offset:.15em}

/* Field notes, written straight onto the sage beside the monster. */
.notes{
  position:absolute;z-index:3;top:var(--space-3);bottom:var(--space-3);left:60%;width:420px;overflow:auto;
  padding:var(--space-2) var(--space-2) var(--space-3) var(--space-3);border-left:1px solid var(--rule);
  background:color-mix(in srgb,var(--ground) 94%,transparent);
  display:flex;flex-direction:column;gap:var(--space-2);animation:notesIn .6s .3s both cubic-bezier(.2,.8,.2,1);
  scrollbar-width:thin;
}
@keyframes notesIn{from{opacity:0;transform:translateX(16px)}}
.notes-bar{display:flex;gap:6px;align-items:center;flex-wrap:wrap}
.text-btn{border:1px solid var(--voice);background:transparent;color:var(--voice);border-radius:var(--radius-none);padding:6px 12px;font-size:13px}
.text-btn:hover{background:color-mix(in srgb,var(--voice) 10%,transparent)}
.notes .cid{margin:var(--space-1) 0 0;font-size:13px;color:var(--ink)}
.notes h2{font:500 34px/1.1 var(--font-sans);margin:0;color:var(--ink);text-wrap:balance;overflow-wrap:anywhere}
.notes h2.untitled{font-weight:300;color:var(--ink-2)}
.summary{margin:-8px 0 0;color:var(--voice);font-size:17px;line-height:1.35}
#cFields{display:flex;flex-direction:column;gap:var(--space-2)}
.field h3,.block h3{margin:0 0 4px;font-size:11.5px;letter-spacing:.08em;text-transform:uppercase;color:var(--ink);font-weight:500}
.field p{margin:0;font-size:16px;line-height:1.45;font-weight:400;overflow-wrap:anywhere}
.field.self p{font-size:20px;line-height:1.35;font-style:italic;font-weight:300;color:var(--voice)}
.unc{color:var(--ink-2);font-size:.85em}
.chips.small .chip{font-size:12.5px;padding:3px 9px}
/* a monster's group in each sort: the sort's name, then its group as a button */
.groups{display:grid;grid-template-columns:auto 1fr;gap:6px 12px;align-items:center}
.groups .grow{display:contents}
.groups .gsort{font-size:12.5px;color:var(--ink-2)}
.groups .chip{justify-self:start;font-size:12.5px;padding:3px 9px}
.dots{letter-spacing:1px;font-size:9px}
.kin{display:grid;grid-template-columns:repeat(auto-fill,minmax(78px,1fr));gap:6px}
.kin button{border:0;background:none;border-radius:var(--radius-none);padding:6px 4px;display:flex;flex-direction:column;align-items:center;gap:4px;min-width:0}
.kin button:hover{background:color-mix(in srgb,var(--voice) 10%,transparent)}
.kin img{width:100%;height:60px;object-fit:contain}
.kin span{font-size:12px;line-height:1.2;color:var(--ink);text-align:center;overflow:hidden;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical}
@media (max-width:819px){
  .notes{
    left:0!important;right:0;width:auto!important;top:56%;bottom:0;border-left:0;
    padding:var(--space-2) var(--space-2) var(--space-3);border-top:1px solid var(--rule);background:var(--ground);
    animation-name:notesUp;
  }
  @keyframes notesUp{from{opacity:0;transform:translateY(24px)}}
  .notes h2{font-size:28px}
}

/* ---------- the way in ---------- */
.intro{position:fixed;inset:0;z-index:40;display:grid;place-items:center;padding:24px;background:var(--ground);transition:background-color 1s ease}
.intro.open{background:transparent;pointer-events:none}   /* the swarm shows through as it arrives */
.intro-inner{display:flex;flex-direction:column;align-items:center;gap:14px;transition:opacity .9s ease}
.intro-line{margin:0;text-align:center;font-weight:300;font-size:clamp(28px,4.6vw,52px);line-height:1.15;color:var(--voice);text-wrap:balance;max-width:24ch;opacity:0;transform:translateY(10px);transition:opacity 1s ease,transform 1s cubic-bezier(.2,.8,.2,1)}
.intro-line.in{opacity:1;transform:none}
.intro-line .em{font-family:var(--font-display);font-weight:var(--display-weight)}
.intro.leave .intro-inner{opacity:0}
/* a few monsters float around the words (never over them), then fade as the swarm arrives */
.intro-drift{position:absolute;inset:0;pointer-events:none;overflow:hidden}
.intro-drift img{position:absolute;left:0;top:0;width:auto;opacity:0;transition:opacity 1.2s ease;will-change:transform}
.intro-drift img.in{opacity:1}
.intro.leave .intro-drift img{opacity:0;transition-duration:.7s}
.intro-inner{position:relative;z-index:1}
.intro-skip{position:absolute;right:max(var(--edge),env(safe-area-inset-right));bottom:20px;border:0;background:none;color:var(--voice);font:400 14px/1 var(--font-sans);padding:8px;cursor:pointer;pointer-events:auto}
.intro-skip:hover{text-decoration:underline;text-underline-offset:3px}
.intro.open .intro-skip{opacity:0;pointer-events:none}
#stage.arrive .m{transition:transform 2.6s cubic-bezier(.25,.7,.2,1),opacity .6s}   /* the monsters drift in from every side */
@media (prefers-reduced-motion:reduce){.intro-line{transform:none!important}}

/* ---------- entry ritual ---------- */
.ritual{
  position:fixed;inset:0;z-index:30;display:grid;place-items:center;padding:var(--space-3) 24px;
  background:color-mix(in srgb,var(--ground) 92%,transparent);
  transition:opacity .9s ease;
}
.ritual.leaving{opacity:0;pointer-events:none}
.ritual-inner{width:min(780px,100%);display:flex;flex-direction:column;gap:var(--space-3)}
.ritual .kicker{margin:0;font-size:13px;letter-spacing:.12em;text-transform:uppercase;color:var(--ink);font-weight:400}
.ritual .opening{margin:0;font-weight:300;font-size:clamp(34px,6vw,56px);line-height:1.12;color:var(--voice);text-wrap:balance}
.ritual .options{display:flex;flex-direction:column;gap:12px;list-style:none;margin:0;padding:0}
.ritual .opt{
  width:100%;text-align:left;border:1px solid transparent;background:var(--surface);border-radius:var(--radius-none);
  padding:16px 20px;font-size:clamp(18px,2.6vw,21px);line-height:1.3;font-weight:300;color:var(--ink);
  opacity:0;transform:translateY(10px);
  transition:opacity .6s ease,transform .6s cubic-bezier(.2,.8,.2,1),border-color .2s;
}
.ritual .opt.in{opacity:1;transform:translateY(0)}
.ritual .opt:hover,.ritual .opt:focus-visible{border-color:var(--voice);outline:none}
.ritual .opt::before{content:"\2026 ";color:var(--voice)}
.ritual .row{display:flex;flex-wrap:wrap;gap:8px 20px;align-items:center}
.ritual .row button{border:0;background:none;color:var(--voice);font-weight:400;padding:4px 0;text-decoration:underline;text-underline-offset:3px}

.noscript{padding:40px;text-align:center}
@media (prefers-reduced-motion:reduce){
  .m,.label,#world.glide,.ritual,.ritual .opt{transition:none}
  .m .bob{animation:none}
  .notes{animation:none}
  .hood{transition:none}
}
