/* ZYGOS — a scrolled journey: every act is a full-bleed plate, the data sits between them. */
:root {
  --ink: #0B0A09;
  --ink-2: #121010;
  --ink-3: #181514;
  --line: rgba(233, 224, 206, .09);
  --line-2: rgba(233, 224, 206, .17);
  --bone: #E9E0CE;
  --dim: #938A7D;
  --dim-2: #6A635B;
  --terra: #C8502D;
  --patina: #5E8F7D;
  --ochre: #E0A350;
  --mono: 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  --display: 'Inter', system-ui, -apple-system, sans-serif;
  --r: 14px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  background: var(--ink); color: var(--bone);
  font-family: var(--display); font-size: 15px; line-height: 1.65;
  overflow-x: hidden;
  background-image: radial-gradient(circle at 1px 1px, rgba(233, 224, 206, .04) 1px, transparent 0);
  background-size: 4px 4px;
}
a { color: inherit; }
button { font: inherit; color: inherit; cursor: pointer; background: none; border: none; }
h1, h2, h3, h4 { font-weight: 400; }
img { display: block; }
.wrap { width: min(1180px, 100% - 36px); margin-inline: auto; }
.mono { font-family: var(--mono); }
.num { font-variant-numeric: tabular-nums; font-family: var(--mono); }
.dim { color: var(--dim); }
.dim-2 { color: var(--dim-2); }

/* ------------------------------------------------------------- floating bar */
.topbar {
  position: fixed; inset: 12px 12px auto 12px; z-index: 60; height: 56px;
  display: flex; align-items: center; gap: 14px; padding: 0 10px 0 14px;
  border: 1px solid var(--line-2); border-radius: var(--r);
  background: rgba(14, 12, 11, .74); backdrop-filter: blur(16px) saturate(1.2);
}
.topbar .brand { display: flex; align-items: center; gap: 11px; text-decoration: none; }
.topbar .brand svg { width: 26px; height: 26px; }
.topbar .brand b { font-family: var(--mono); font-weight: 500; font-size: 15px; letter-spacing: .24em; }
.topbar nav { margin-left: auto; display: flex; align-items: center; gap: 4px; }
.topbar nav a {
  font-family: var(--mono); font-size: 12px; letter-spacing: .04em; color: var(--dim);
  text-decoration: none; padding: 8px 11px; border-radius: 9px;
}
.topbar nav a:hover { color: var(--bone); background: rgba(233, 224, 206, .06); }
.chip {
  font-family: var(--mono); font-size: 10.5px; letter-spacing: .16em; color: var(--ochre);
  border: 1px solid rgba(224, 163, 80, .35); border-radius: 9px; padding: 7px 11px;
  white-space: nowrap;
}

/* ------------------------------------------------------------------ scenes */
.scene { position: relative; min-height: 100svh; scroll-margin-top: 82px; display: grid; align-items: center; overflow: clip; }
.scene--short { min-height: 78svh; }
.scene-bg { position: absolute; inset: -10% 0; z-index: 0; }
.scene-bg img { width: 100%; height: 100%; object-fit: cover; will-change: transform; }
.scene-bg::after {
  content: ''; position: absolute; inset: 0;
  background:
    linear-gradient(180deg, rgba(11,10,9,.82) 0%, rgba(11,10,9,.3) 34%, rgba(11,10,9,.55) 72%, var(--ink) 100%),
    linear-gradient(90deg, rgba(11,10,9,.78) 0%, rgba(11,10,9,.1) 56%, rgba(11,10,9,.42) 100%);
}
.scene-in { position: relative; z-index: 2; width: min(1180px, 100% - 36px); margin-inline: auto; padding: 120px 0 72px; }

.kicker {
  font-family: var(--mono); font-size: 11px; letter-spacing: .34em; text-transform: uppercase;
  color: var(--terra);
}
.act {
  font-family: var(--mono); font-weight: 400; text-transform: lowercase; white-space: pre-line;
  font-size: clamp(31px, 5.9vw, 82px); line-height: 1.03; letter-spacing: -.032em;
  margin: 18px 0 0; max-width: 17ch;
}
.act .soft { color: var(--dim); }
.caret { display: inline-block; width: .52em; height: .92em; background: var(--terra); vertical-align: -.1em; margin-left: .06em; animation: blink 1.05s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.lede { color: var(--dim); font-size: 16px; line-height: 1.8; max-width: 52ch; margin-top: 24px; }
.lede b { color: var(--bone); font-weight: 400; }

.cue {
  position: absolute; left: 50%; bottom: 26px; transform: translateX(-50%); z-index: 3;
  font-family: var(--mono); font-size: 10.5px; letter-spacing: .3em; color: var(--dim-2);
  display: grid; justify-items: center; gap: 8px;
}
.cue i { width: 1px; height: 30px; background: linear-gradient(var(--dim-2), transparent); animation: drop 2.1s ease-in-out infinite; }
@keyframes drop { 0%, 100% { opacity: .25; transform: scaleY(.6); } 50% { opacity: 1; transform: scaleY(1); } }

/* reveal on scroll */
.rise { opacity: 0; transform: translateY(18px); transition: opacity .7s ease, transform .7s cubic-bezier(.2,.7,.3,1); }
.rise.in { opacity: 1; transform: none; }
.rise.d1 { transition-delay: .09s } .rise.d2 { transition-delay: .18s } .rise.d3 { transition-delay: .27s }

/* ------------------------------------------------------------------ sections */
.sec { position: relative; padding: 86px 0; scroll-margin-top: 82px; }
.sec-h { display: flex; align-items: baseline; gap: 30px; flex-wrap: wrap; margin-bottom: 32px; }
.sec-h h2 { font-family: var(--mono); font-size: clamp(25px, 3.4vw, 40px); letter-spacing: -.03em; text-transform: lowercase; }
.sec-h p { color: var(--dim); font-size: 14px; max-width: 58ch; }

/* the scattered mono marks that give a data field its texture */
.marks { position: absolute; inset: 0; pointer-events: none; overflow: hidden; z-index: 0; }
.marks span {
  position: absolute; font-family: var(--mono); font-size: 10.5px; letter-spacing: .1em;
  color: rgba(233, 224, 206, .13); white-space: nowrap;
}
.sec > .wrap { position: relative; z-index: 1; }

/* ------------------------------------------------------------------ panels */
.panel { background: var(--ink-2); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.panel-h {
  display: flex; align-items: center; gap: 12px; padding: 13px 17px; border-bottom: 1px solid var(--line);
  font-family: var(--mono); font-size: 11px; letter-spacing: .2em; color: var(--dim); text-transform: uppercase;
}
.panel-h .right { margin-left: auto; letter-spacing: .1em; }

.clockbar { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--r) var(--r) 0 0; overflow: hidden; }
.cell { background: var(--ink-2); padding: 15px 17px; }
.cell .k { font-family: var(--mono); font-size: 10px; letter-spacing: .2em; color: var(--dim-2); text-transform: uppercase; }
.cell .v { font-family: var(--mono); font-size: 22px; margin-top: 5px; letter-spacing: -.01em; }
.cell.alert .v { color: var(--ochre); }

.boardwrap { border: 1px solid var(--line); border-top: none; border-radius: 0 0 var(--r) var(--r); background: var(--ink-2); overflow: hidden; }
.board { display: grid; grid-template-columns: 1fr 236px 1fr; }
.side { padding: 10px 0 14px; }
.side h3 { font-family: var(--mono); font-size: 10px; letter-spacing: .24em; color: var(--dim-2); text-transform: uppercase; padding: 7px 17px 10px; display: flex; }
.side h3 span { margin-left: auto; }
.row { display: grid; grid-template-columns: 1fr 1fr 44px; gap: 8px; padding: 5px 17px; font-family: var(--mono); font-size: 12.5px; position: relative; }
.row .depth { position: absolute; inset: 0 auto 0 0; opacity: .14; }
.bids .row .depth { background: var(--patina); }
.asks .row .depth { background: var(--terra); inset: 0 0 0 auto; }
.row .p { position: relative; }
.bids .row .p { color: var(--patina); }
.asks .row .p { color: var(--terra); }
.row .q, .row .n { position: relative; color: var(--dim); text-align: right; }
.row.mine { box-shadow: inset 2px 0 0 var(--bone); }
.row.mine .n { color: var(--bone); }
.row.willfill .q { color: var(--bone); }
.empty { padding: 26px 17px; color: var(--dim-2); font-size: 12px; font-family: var(--mono); }

.mid { border-left: 1px solid var(--line); border-right: 1px solid var(--line); display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px 12px; text-align: center; gap: 4px; }
.mid .lab { font-family: var(--mono); font-size: 10px; letter-spacing: .24em; color: var(--dim-2); text-transform: uppercase; }
.mid .px { font-family: var(--mono); font-size: 27px; letter-spacing: -.01em; }
.mid .px.none { color: var(--dim-2); font-size: 17px; }
.mid .vol { font-family: var(--mono); font-size: 12px; color: var(--dim); }
.mid hr { width: 100%; border: none; border-top: 1px dashed var(--line-2); margin: 15px 0; }

.ticket { border-top: 1px solid var(--line); padding: 17px; display: grid; gap: 14px; grid-template-columns: 152px 1fr 1fr auto; align-items: end; }
.field { display: grid; gap: 7px; }
.field label { font-family: var(--mono); font-size: 10px; letter-spacing: .2em; color: var(--dim-2); text-transform: uppercase; }
.field input { background: var(--ink); border: 1px solid var(--line-2); border-radius: 9px; color: var(--bone); font-family: var(--mono); font-size: 13px; padding: 10px 11px; width: 100%; font-variant-numeric: tabular-nums; }
.field input:focus { outline: none; border-color: var(--dim-2); }
.seg { display: flex; border: 1px solid var(--line-2); border-radius: 9px; overflow: hidden; }
.seg button { flex: 1; padding: 10px 0; font-family: var(--mono); font-size: 11px; letter-spacing: .14em; color: var(--dim); }
.seg button[aria-pressed="true"] { background: var(--ink-3); color: var(--bone); }
.seg button.bid[aria-pressed="true"] { box-shadow: inset 0 -2px 0 var(--patina); }
.seg button.ask[aria-pressed="true"] { box-shadow: inset 0 -2px 0 var(--terra); }

.btn {
  border: 1px solid var(--line-2); border-radius: 9px; padding: 11px 20px;
  font-family: var(--mono); font-size: 11px; letter-spacing: .16em; text-transform: uppercase;
  white-space: nowrap; background: var(--ink-3); transition: border-color .15s, color .15s, background .15s;
}
.btn:hover:not(:disabled) { border-color: var(--bone); }
.btn:disabled { color: var(--dim-2); cursor: not-allowed; border-color: var(--line); background: var(--ink-2); }
.btn.go { border-color: rgba(200, 80, 45, .5); }
.btn.go:hover:not(:disabled) { border-color: var(--terra); background: #1d1512; }
.btn.ghost { background: none; }
.note { padding: 0 17px 17px; font-family: var(--mono); font-size: 11.5px; color: var(--dim-2); }

/* ------------------------------------------------------------------- charts */
.charts { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 16px; }
.plot { position: relative; padding: 14px 17px 4px; }
.plot svg { width: 100%; height: auto; }
.tip {
  position: absolute; top: 18px; pointer-events: none; z-index: 5;
  background: var(--ink); border: 1px solid var(--line-2); border-radius: 8px;
  padding: 8px 11px; font-family: var(--mono); font-size: 11.5px; line-height: 1.5;
  white-space: nowrap; display: grid; font-variant-numeric: tabular-nums;
}
.tip[hidden] { display: none; }
.tip b { font-weight: 400; color: var(--bone); }
.tip span { color: var(--dim); }

/* -------------------------------------------------------------------- cards */
.cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.cards.wide-last { grid-template-columns: 1fr 1fr 1.4fr; }
.card { background: var(--ink-2); border: 1px solid var(--line); border-radius: var(--r); padding: 22px; }
.card h4 { font-family: var(--mono); font-size: 17px; letter-spacing: -.02em; margin-bottom: 10px; text-transform: lowercase; }
.card p { color: var(--dim); font-size: 13.5px; line-height: 1.8; }
.card .big { font-family: var(--mono); font-size: 30px; color: var(--bone); letter-spacing: -.01em; }
.card .big small { font-size: 13px; color: var(--dim); letter-spacing: .1em; }

.tape { max-height: 320px; overflow: auto; }
.tline { display: grid; grid-template-columns: 46px 1fr auto auto; gap: 9px; padding: 9px 0; border-bottom: 1px solid var(--line); font-family: var(--mono); font-size: 12.5px; }
.tline:last-child { border-bottom: none; }
.tline .r { color: var(--dim-2); }
.tline .px { color: var(--bone); }
.tline .up { color: var(--patina); }
.tline .dn { color: var(--terra); }
.tline .f { color: var(--dim-2); text-align: right; font-size: 11.5px; white-space: nowrap; }

/* -------------------------------------------------------------------- rules */
.rules { display: grid; gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.rule-row { background: rgba(18, 16, 16, .86); display: grid; grid-template-columns: 52px 210px 1fr; gap: 18px; padding: 19px 22px; align-items: start; }
.rule-row .no { font-family: var(--mono); color: var(--terra); font-size: 12px; }
.rule-row .v { font-family: var(--mono); font-size: 15px; letter-spacing: -.01em; }
.rule-row .d { color: var(--dim); font-size: 13.5px; line-height: 1.8; }

/* ------------------------------------------------------------------- footer */
footer { border-top: 1px solid var(--line); padding: 56px 0 90px; }
.foot { display: grid; grid-template-columns: 1.6fr 1fr 1fr; gap: 34px; }
.foot h5 { font-family: var(--mono); font-size: 10.5px; letter-spacing: .26em; color: var(--dim-2); text-transform: uppercase; margin-bottom: 14px; }
.foot a { display: block; text-decoration: none; color: var(--dim); font-family: var(--mono); font-size: 13px; padding: 5px 0; }
.foot a:hover { color: var(--bone); }
.foot .mark { display: flex; align-items: center; gap: 13px; }
.foot .mark svg { width: 34px; height: 34px; }
.foot .mark b { font-family: var(--mono); font-weight: 500; font-size: 19px; letter-spacing: .24em; }
.legal { margin-top: 38px; color: var(--dim-2); font-size: 12px; max-width: 76ch; line-height: 1.85; }

.addr { display: grid; gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.addr div { background: var(--ink-2); display: grid; grid-template-columns: 180px 1fr; gap: 14px; padding: 12px 17px; font-family: var(--mono); font-size: 12.5px; }
.addr .k { color: var(--dim); letter-spacing: .14em; font-size: 11px; }
.addr .v { color: var(--dim-2); word-break: break-word; }

/* ---------------------------------------------------------------- bell dock */
.belldock {
  position: fixed; right: 14px; bottom: 14px; z-index: 55;
  display: flex; align-items: center; gap: 14px; padding: 11px 16px;
  border: 1px solid var(--line-2); border-radius: var(--r);
  background: rgba(14, 12, 11, .8); backdrop-filter: blur(16px);
  font-family: var(--mono); text-decoration: none;
  transform: translateY(26px); opacity: 0; pointer-events: none;
  transition: transform .4s cubic-bezier(.2,.7,.3,1), opacity .4s ease, border-color .15s;
}
.belldock.in { transform: none; opacity: 1; pointer-events: auto; }
.belldock:hover { border-color: var(--bone); }
.belldock .pulse { width: 7px; height: 7px; border-radius: 50%; background: var(--terra); animation: pulse 2s ease-in-out infinite; }
.belldock.hot .pulse { background: var(--ochre); }
@keyframes pulse { 0%, 100% { opacity: .35; } 50% { opacity: 1; } }
.belldock .k { font-size: 9.5px; letter-spacing: .22em; color: var(--dim-2); text-transform: uppercase; }
.belldock .v { font-size: 15px; font-variant-numeric: tabular-nums; }
.belldock .sep { width: 1px; height: 26px; background: var(--line-2); }

/* -------------------------------------------------------------- responsive */
@media (max-width: 1080px) {
  .charts { grid-template-columns: 1fr; }
  .cards, .cards.wide-last { grid-template-columns: 1fr 1fr; }
  .cards .card:last-child { grid-column: span 2; }
  .foot { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 860px) {
  .board { grid-template-columns: 1fr; }
  .side.asks { border-top: 1px solid var(--line); }
  .mid { border: none; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); order: -1; }
  .ticket { grid-template-columns: 1fr 1fr; }
  .rule-row { grid-template-columns: 34px 1fr; }
  .rule-row .d { grid-column: 2; }
}
@media (max-width: 680px) {
  body { font-size: 14px; }
  .topbar nav a { display: none; }
  .topbar nav a.keep { display: block; }
  .clockbar { grid-template-columns: 1fr 1fr; }
  .ticket { grid-template-columns: 1fr; }
  .cards, .cards.wide-last { grid-template-columns: 1fr; }
  .cards .card:last-child { grid-column: auto; }
  .foot { grid-template-columns: 1fr; }
  .addr div { grid-template-columns: 1fr; gap: 3px; }
  .tline { grid-template-columns: 40px 1fr auto; }
  .tline .f { display: none; }
  .belldock { left: 14px; right: 14px; justify-content: center; }
  .scene-in { padding: 104px 0 86px; }
  .marks { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
  .rise { opacity: 1; transform: none; }
}

/* ------------------------------------------------- the crossing, on screen */
/* The bell is the whole point of the protocol and the board used to show it by
   silently changing some numbers. Now the orders that fill fly into the fixing. */
.boardwrap { position: relative; }
.flight { position: absolute; inset: 0; z-index: 4; pointer-events: none; }
.flight i { position: absolute; display: block; border-radius: 3px; opacity: 0;
  box-shadow: 0 0 18px -2px currentColor; }
.crossline {
  position: absolute; left: 0; right: 0; top: 50%; height: 2px; z-index: 5;
  background: linear-gradient(90deg, transparent, var(--bone) 10%, var(--bone) 90%, transparent);
  transform: scaleX(0); opacity: 0; pointer-events: none;
  box-shadow: 0 0 26px rgba(233, 224, 206, .55);
}
.crossline { height: 3px; }
.crossline.go { animation: zy-cross 1.5s cubic-bezier(.16,.84,.26,1) forwards; }
@keyframes zy-cross {
  0%   { transform: scaleX(0);   opacity: 0; }
  12%  { opacity: 1; }
  44%  { transform: scaleX(1);   opacity: 1; }
  72%  { transform: scaleX(1);   opacity: 1; }
  100% { transform: scaleX(1);   opacity: 0; }
}

/* the sealed tail: one sweep across the board, then the sides go quiet */
.sweep { position: absolute; inset: 0; z-index: 3; pointer-events: none; opacity: 0; }
.sweep.go { animation: zy-sweep 1s ease-out forwards; }
@keyframes zy-sweep {
  0%   { opacity: 0; background: linear-gradient(90deg, transparent 0%, rgba(224,163,80,.26) 0%, transparent 2%); }
  10%  { opacity: 1; }
  100% { opacity: 0; background: linear-gradient(90deg, transparent 98%, rgba(224,163,80,.26) 100%, transparent 100%); }
}
.boardwrap.sealed .side { filter: saturate(.55); transition: filter .5s ease; }
.boardwrap .side { transition: filter .5s ease; }

/* the fixing itself */
.mid .px.flash { animation: zy-flash 1.25s cubic-bezier(.2,.8,.3,1); }
@keyframes zy-flash {
  0%   { transform: scale(1);    text-shadow: none; }
  18%  { transform: scale(1.26); text-shadow: 0 0 40px rgba(233,224,206,.75); }
  55%  { transform: scale(1.05); text-shadow: 0 0 18px rgba(233,224,206,.3); }
  100% { transform: scale(1);    text-shadow: none; }
}
.tline.fresh { animation: zy-fresh .7s cubic-bezier(.2,.8,.3,1); }
@keyframes zy-fresh {
  0%   { opacity: 0; transform: translateY(-9px); background: rgba(233,224,206,.1); }
  100% { opacity: 1; transform: none; background: transparent; }
}
@media (prefers-reduced-motion: reduce) {
  .crossline.go, .sweep.go, .mid .px.flash, .tline.fresh { animation: none; }
}
