/* ============================================================
   87Actual / Lab
   A museum wall, a graffiti tag, a map of builds.
   ============================================================ */

:root {
  --wall:      #ECEAE5;   /* gallery plaster */
  --wall-deep: #E2DFD8;
  --ink:       #141218;   /* near-black, slightly violet */
  --graphite:  #3E3B44;
  --steel:     #6E6A75;
  --dust:      #A6A2AC;
  --line:      rgba(20, 18, 24, 0.16);

  --purple:    #7B4FC4;   /* the tag */
  --cyan:      #22D3EE;   /* the signal */
  --magenta:   #FF2BB0;   /* the frame */

  --sans: "Inter", "Helvetica Neue", Arial, sans-serif;
  --mono: "JetBrains Mono", "IBM Plex Mono", ui-monospace, Menlo, Consolas, monospace;

  --panel-w: min(480px, 100vw);
  --ease: cubic-bezier(.2, .7, .1, 1);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--wall);
  color: var(--ink);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
}

/* Paper grain over everything */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 50;
  opacity: .38;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='240' height='240'><filter id='g'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0  0 0 0 0 0  0 0 0 0 0  0 0 0 0.5 0'/></filter><rect width='100%' height='100%' filter='url(%23g)'/></svg>");
}

.defs { position: absolute; }

/* ---------- The graffiti tag ---------- */
.tag {
  position: fixed;
  right: -2vw;
  bottom: -6vh;
  width: min(62vw, 760px);
  z-index: 0;
  pointer-events: none;
  transform: rotate(-7deg);
  opacity: .16;
}
.tag text {
  font-family: var(--sans);
  font-weight: 900;
  font-size: 400px;
  letter-spacing: -24px;
  fill: var(--purple);
}
.tag .outline {
  fill: none;
  stroke: var(--cyan);
  stroke-width: 6;
  opacity: .9;
}
.tag .drips rect { fill: var(--purple); }

/* ---------- Masthead ---------- */
.masthead {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 35;
  display: flex;
  align-items: baseline;
  gap: 24px;
  padding: 24px 32px;
  pointer-events: none;
}
.mark {
  pointer-events: auto;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  font-family: var(--mono);
  font-weight: 800;
  font-size: 15px;
  letter-spacing: .32em;
  color: var(--ink);
  text-decoration: none;
}
.meta {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .24em;
  color: var(--steel);
}
.meta .sep { color: var(--purple); }
#count { color: var(--ink); margin-left: 6px; }

.nav {
  margin-left: auto;
  pointer-events: auto;
  display: flex;
  align-items: baseline;
  gap: 10px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .24em;
  text-transform: uppercase;
}
.nav { transition: transform .55s var(--ease); }
body.panel-open .nav { transform: translateX(calc(-1 * var(--panel-w))); }
.nav .sep { color: var(--purple); }
.nav button {
  padding: 10px 2px;
  border: 0;
  background: none;
  color: var(--graphite);
  font: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
  cursor: pointer;
}
.nav button:hover,
.nav button[aria-current="true"] { color: var(--ink); text-decoration: underline; text-decoration-color: var(--cyan); text-underline-offset: 6px; }

/* ---------- The entrance ---------- */
.entrance {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(236, 234, 229, .55);
  transition: opacity .9s var(--ease);
}
.entrance[hidden] { display: none; }
.entrance.leaving { opacity: 0; pointer-events: none; }

body.entering #map { filter: blur(7px); opacity: .55; }
#map { transition: filter 1.1s var(--ease), opacity 1.1s var(--ease); }

.placard {
  width: min(620px, 100%);
  padding: 56px 56px 44px;
  text-align: center;
  background: rgba(242, 240, 236, .92);
  border: 2px solid var(--magenta);
  box-shadow: 0 0 0 6px rgba(255, 43, 176, .08), 0 30px 80px -40px rgba(20, 18, 24, .35);
}
.placard-kicker {
  margin: 0 0 28px;
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .4em;
  color: var(--ink);
}
.placard-kicker .sep { color: var(--purple); }

.welcome {
  margin: 0;
  display: grid;
  gap: 10px;
  font-size: clamp(19px, 2.2vw, 23px);
  font-weight: 300;
  line-height: 1.5;
  letter-spacing: .005em;
  color: var(--graphite);
  text-wrap: balance;
}
.welcome > span, .sig > span { display: block; }

/* Each word dissolves in from a soft blur; delays are set by the script */
.w {
  display: inline-block;
  opacity: 0;
  filter: blur(10px);
  transform: translateY(3px);
  animation: dissolve 1.5s cubic-bezier(.25, .6, .2, 1) forwards;
}
@keyframes dissolve {
  to { opacity: 1; filter: blur(0); transform: none; }
}

.sig {
  margin: 22px 0 0;
  text-align: right;
  font-size: clamp(18px, 2vw, 21px);
  font-weight: 300;
  font-style: italic;
  color: var(--graphite);
}

.signature {
  display: block;
  width: min(420px, 100%);
  margin: 26px auto 8px;
  overflow: visible;
  transform: rotate(-3deg);
  clip-path: inset(0 100% 0 0);
  animation: sign 1.6s cubic-bezier(.6, .1, .3, 1) 3.2s forwards;
}
.signature text {
  font-family: var(--sans);
  font-size: 40px;
  font-weight: 800;
  font-style: italic;
  letter-spacing: -.01em;
  fill: var(--cyan);
}

.enter {
  margin-top: 26px;
  padding: 14px 40px;
  border: 1px solid var(--ink);
  background: var(--ink);
  color: var(--wall);
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: .4em;
  text-transform: uppercase;
  cursor: pointer;
  opacity: 0;
  animation: rise .9s var(--ease) forwards;
  transition: background .3s, color .3s;
}
.enter:hover, .enter:focus-visible { background: var(--purple); border-color: var(--purple); }

@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes sign { to { clip-path: inset(0 0 0 0); } }

/* The tag gets sprayed on during the entrance */
body.entering .tag { animation: tagIn 2.2s var(--ease) .2s both; }
@keyframes tagIn {
  from { opacity: 0; clip-path: inset(0 100% 0 0); }
  to   { opacity: .16; clip-path: inset(0 0 0 0); }
}

/* ---------- About and contact pages in the panel ---------- */
.portrait {
  width: 120px;
  height: 120px;
  object-fit: cover;
  border-radius: 50%;
  filter: grayscale(.15) contrast(1.05);
  margin: 6px 0 22px;
  border: 3px solid var(--wall);
  box-shadow: 0 0 0 1px var(--line);
}
.statement { margin: 0 0 8px; display: grid; gap: 14px; }
.statement p { margin: 0; font-size: 19px; line-height: 1.45; font-weight: 400; }
.statement p.strong { font-weight: 700; }
.panel-sig { margin: 18px 0 0; }

.passage {
  margin: 34px 0 6px;
  padding: 22px 0 4px 24px;
  border-left: 3px solid var(--magenta);
}
.passage p {
  margin: 0;
  font-size: clamp(22px, 2.4vw, 27px);
  font-weight: 300;
  font-style: italic;
  line-height: 1.35;
  letter-spacing: -.01em;
  color: var(--ink);
  text-wrap: balance;
}
.passage p::before { content: "\201C"; }
.passage p::after  { content: "\201D"; }
.contact-list { margin: 0; padding: 0; list-style: none; }
.contact-list li {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 12px;
  padding: 16px 0;
  border-top: 1px solid var(--line);
  align-items: baseline;
}
.contact-list .k {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .24em;
  text-transform: uppercase;
  color: var(--steel);
}
.contact-list .v { font-size: 16px; overflow-wrap: anywhere; }
.contact-list a { color: var(--ink); text-decoration-color: var(--purple); text-underline-offset: 4px; }
.contact-list code { font-family: var(--mono); font-size: 13px; }

/* ---------- The map ---------- */
#map {
  position: fixed;
  inset: 0;
  z-index: 10;
}
#map svg { width: 100%; height: 100%; display: block; cursor: grab; }
#map svg:active { cursor: grabbing; }

/* Links */
.link {
  stroke: var(--line);
  stroke-width: 1;
  fill: none;
  transition: stroke .3s, opacity .3s;
}
.link.depends { stroke-dasharray: 2 5; }
.link.lit {
  stroke: var(--purple);
  stroke-width: 1.5;
  stroke-dasharray: 3 7;
  animation: flow 1.2s linear infinite;
}
@keyframes flow { to { stroke-dashoffset: -20; } }

/* Nodes */
.node { cursor: pointer; outline: none; }
.node .body { transition: r .35s var(--ease), fill .3s, stroke .3s; }
.node .halo { opacity: 0; transition: opacity .4s; }
.node .label {
  font-family: var(--mono);
  text-transform: uppercase;
  letter-spacing: .14em;
  fill: var(--steel);
  pointer-events: none;
  transition: fill .3s, opacity .3s;
}

.node.exhibit .body { fill: var(--graphite); }
.node.exhibit .label,
.node.future .label { font-size: 13px; fill: var(--graphite); }
.node.exhibit .num,
.node.future .num {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .08em;
  fill: var(--wall);
  pointer-events: none;
}

.node.future .body { fill: none; stroke: var(--graphite); stroke-width: 1.5; stroke-dasharray: 4 4; }
.node.future .num  { fill: var(--graphite); }

.node.concept .body { fill: var(--dust); }
.node.concept .label { font-size: 10px; fill: var(--dust); }

/* Hover / focus */
.node:hover .halo,
.node:focus-visible .halo { opacity: .35; }
.node:hover .label,
.node:focus-visible .label { fill: var(--ink); }
.node.concept:hover .body { fill: var(--steel); }

/* Selection */
.node.selected .halo { opacity: .6; }
.node.selected .body { stroke: var(--cyan); stroke-width: 2.5; }
.node.selected .label { fill: var(--ink); font-weight: 700; }
.node.near .label { fill: var(--ink); }
.node.near.concept .body { fill: var(--purple); }

/* Dim everything not connected to the selection */
.has-selection .node:not(.selected):not(.near) { opacity: .28; }
.has-selection .link:not(.lit) { opacity: .25; }

/* Background dust drifting like the reference */
.mote { fill: var(--dust); opacity: .12; }

/* ---------- Exhibit panel ---------- */
.panel {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  width: var(--panel-w);
  z-index: 30;
  display: flex;
  flex-direction: column;
  background: rgba(240, 238, 233, .94);
  backdrop-filter: blur(6px);
  border-left: 1px solid var(--line);
  transform: translateX(100%);
  transition: transform .55s var(--ease);
}
.panel.open { transform: translateX(0); }

.panel-scroll { flex: 1; overflow-y: auto; padding: 40px 40px 24px; }

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .22em;
  color: var(--steel);
  text-transform: uppercase;
}
.panel-head b { color: var(--ink); }
.close {
  width: 34px; height: 34px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}
.close:hover { border-color: var(--ink); }

.exhibit-no {
  margin: 28px 0 6px;
  font-family: var(--mono);
  font-weight: 800;
  font-size: 12px;
  letter-spacing: .3em;
  color: var(--purple);
}

.panel h2 {
  margin: 0 0 16px;
  font-size: clamp(34px, 4.4vw, 52px);
  line-height: .98;
  letter-spacing: -.03em;
  font-weight: 800;
}

/* Spray underline under the title */
.spray-line { display: block; width: 180px; height: 14px; margin: -4px 0 18px; }
.spray-line path { stroke: var(--cyan); stroke-width: 5; fill: none; stroke-linecap: round; }

.lede { font-size: 18px; line-height: 1.45; color: var(--graphite); margin: 0 0 22px; }

/* Military stamp for status */
.stamp {
  display: inline-block;
  padding: 6px 12px;
  border: 2px solid currentColor;
  font-family: var(--mono);
  font-weight: 800;
  font-size: 11px;
  letter-spacing: .3em;
  text-transform: uppercase;
  transform: rotate(-3deg);
  color: var(--purple);
  margin-bottom: 26px;
}
.stamp.in-progress { color: var(--cyan); filter: brightness(.7); }
.stamp.future { color: var(--steel); }

.section {
  padding: 18px 0;
  border-top: 1px solid var(--line);
}
.section h3 {
  margin: 0 0 8px;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .24em;
  color: var(--steel);
}
.section p { margin: 0; font-size: 15px; line-height: 1.6; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  font-family: var(--sans);
  font-size: 13px;
  padding: 5px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
  cursor: pointer;
}
.chip:hover { border-color: var(--purple); color: var(--purple); }
.chip.exhibit-chip { font-weight: 600; }

.panel-foot {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border-top: 1px solid var(--line);
}
.panel-foot button {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 18px 28px;
  border: 0;
  background: transparent;
  color: var(--ink);
  text-align: left;
  font-size: 14px;
  cursor: pointer;
}
.panel-foot button + button { border-left: 1px solid var(--line); text-align: right; }
.panel-foot small {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: .24em;
  color: var(--steel);
}
.panel-foot button:hover { background: rgba(123, 79, 196, .06); }

/* ---------- Legend ---------- */
.legend {
  position: fixed;
  left: 32px;
  bottom: 24px;
  z-index: 20;
  display: flex;
  gap: 20px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--steel);
}
.legend span { display: flex; align-items: center; gap: 8px; }
.legend .hint { color: var(--purple); }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.dot.exhibit { background: var(--graphite); }
.dot.future  { border: 1.5px dashed var(--graphite); }
.dot.concept { background: var(--dust); width: 7px; height: 7px; }

.fallback { position: relative; z-index: 60; padding: 40px; }

/* ---------- Small screens: panel becomes a bottom sheet ---------- */
@media (max-width: 720px) {
  .panel {
    top: auto; left: 0; right: 0;
    width: 100%;
    height: 78vh;
    border-left: 0;
    border-top: 1px solid var(--line);
    transform: translateY(100%);
  }
  .panel.open { transform: translateY(0); }
  .panel-scroll { padding: 24px 22px; }
  .legend { flex-wrap: wrap; gap: 12px; left: 20px; right: 20px; }
  .masthead { padding: 18px 20px; flex-wrap: wrap; gap: 8px 16px; }
  .meta { display: none; }
  body.panel-open .nav { transform: none; }
  .placard { padding: 40px 24px 32px; }
  .contact-list li { grid-template-columns: 1fr; gap: 4px; }
}

/* ---------- Respect reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
  .w, .enter { opacity: 1; filter: none; transform: none; }
  .signature { clip-path: none; }
}

/* Keyboard focus that fits the palette */
.nav button:focus-visible,
.mark:focus-visible,
.chip:focus-visible,
.close:focus-visible,
.panel-foot button:focus-visible { outline: 2px solid var(--purple); outline-offset: 4px; }
.nav button:focus:not(:focus-visible) { outline: none; }
