/* ═════════════════════════════════════════════════════════════════════════
   Callidus
   Act I is deliberately restrained: institutional, dense, expensive. The
   corruption in Act II reads as a violation only because this is calm.
   ═════════════════════════════════════════════════════════════════════════ */

:root {
  --bg:      #05070a;
  --bg-alt:  #080b10;
  --panel:   #0b0f15;
  --line:    #171d26;
  --line-2:  #222b36;
  --ink:     #e6ecf2;
  --ink-2:   #9aa8b8;
  --ink-3:   #5f6f80;
  --ink-4:   #3a4654;
  --accent:  #c8a04a;      /* brass, not neon, not tech-startup blue */
  --alert:   #ff3b30;
  --ok:      #3ddc84;

  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;

  --w: 1180px;
  --pad: clamp(1.15rem, 4.5vw, 3.5rem);
}

*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; background: var(--bg); }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.62;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -0.022em; line-height: 1.12; }
p { margin: 0; }
a { color: inherit; text-decoration: none; }
code { font-family: var(--mono); font-size: .9em; }

.skip {
  position: absolute; left: -9999px; top: 0;
  background: var(--accent); color: #000;
  padding: .6rem 1rem; z-index: 999; font-weight: 600;
}
.skip:focus { left: 0; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

/* ── masthead ─────────────────────────────────────────────────────────── */
.masthead {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(5, 7, 10, .82);
  backdrop-filter: blur(14px) saturate(1.2);
  border-bottom: 1px solid var(--line);
}

.mast-in {
  max-width: var(--w);
  margin: 0 auto;
  padding: 0 var(--pad);
  height: 62px;
  display: flex;
  align-items: center;
  gap: 2.4rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: .6rem;
  font-weight: 700;
  font-size: .82rem;
  letter-spacing: .2em;
}

.brand-mark {
  width: 19px; height: 19px;
  fill: none; stroke: var(--accent);
  stroke-width: 1.6; stroke-linejoin: round; stroke-linecap: round;
}

.mast-nav {
  display: flex;
  gap: 1.9rem;
  font-size: .82rem;
  color: var(--ink-2);
  margin-left: .5rem;
}
.mast-nav a { transition: color .15s; }
.mast-nav a:hover { color: var(--ink); }

.mast-meta {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 1rem;
  font-family: var(--mono);
  font-size: .7rem;
  letter-spacing: .06em;
  color: var(--ink-3);
}

.stat { display: inline-flex; align-items: center; gap: .45rem; color: var(--ink-2); }
.dot {
  width: 5px; height: 5px;
  background: var(--ok);
  border-radius: 50%;
  box-shadow: 0 0 6px var(--ok);
  animation: breathe 3s ease-in-out infinite;
}
@keyframes breathe { 0%,100% { opacity: 1 } 50% { opacity: .4 } }

.sep { width: 1px; height: 12px; background: var(--line-2); }

@media (max-width: 820px) {
  .mast-nav { display: none; }
  .tz { display: none; }
}

/* ── hero ─────────────────────────────────────────────────────────────── */
.hero {
  max-width: var(--w);
  margin: 0 auto;
  padding: clamp(3rem, 8vw, 6.5rem) var(--pad) clamp(3rem, 7vw, 5.5rem);
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(0, .85fr);
  gap: clamp(2rem, 5vw, 4.5rem);
  align-items: start;
}

@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; }
}

.eyebrow {
  font-family: var(--mono);
  font-size: .72rem;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 1.6rem;
}

.hero h1 {
  font-size: clamp(1.9rem, 4.4vw, 3.5rem);
  letter-spacing: -.035em;
  line-height: 1.06;
  margin-bottom: 1.6rem;
}

.hero h1 .ln { display: block; }
.hero h1 .dim { color: var(--ink-3); }

.deck {
  color: var(--ink-2);
  font-size: clamp(.98rem, 1.3vw, 1.08rem);
  max-width: 56ch;
  margin-bottom: 2.2rem;
}

.hero-actions { display: flex; flex-wrap: wrap; gap: .8rem; }

.btn {
  display: inline-flex;
  align-items: center;
  padding: .72rem 1.35rem;
  font-size: .84rem;
  font-weight: 500;
  letter-spacing: .01em;
  border: 1px solid var(--line-2);
  transition: background .15s, border-color .15s, color .15s;
}

.btn.primary { background: var(--accent); color: #0a0804; border-color: var(--accent); font-weight: 600; }
.btn.primary:hover { background: #d8b05c; border-color: #d8b05c; }
.btn.ghost { color: var(--ink-2); }
.btn.ghost:hover { color: var(--ink); border-color: var(--ink-4); }

/* the aside reads as a printed fact sheet */
.hero-aside {
  border-left: 1px solid var(--line);
  padding-left: clamp(1.2rem, 3vw, 2rem);
}

@media (max-width: 900px) {
  .hero-aside { border-left: 0; border-top: 1px solid var(--line); padding-left: 0; padding-top: 1.6rem; }
}

.statblock { display: grid; gap: 0; }

.statrow {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  padding: .62rem 0;
  border-bottom: 1px solid var(--line);
  font-size: .82rem;
}
.statrow:first-child { border-top: 1px solid var(--line); }
.statrow span { color: var(--ink-3); }
.statrow b { font-family: var(--mono); font-size: .88rem; color: var(--ink); font-weight: 500; }

.fine {
  font-size: .72rem;
  color: var(--ink-4);
  margin-top: 1rem;
  line-height: 1.5;
}

/* ── bands ────────────────────────────────────────────────────────────── */
.band { border-top: 1px solid var(--line); }
.band.alt { background: var(--bg-alt); }

.band-in {
  max-width: var(--w);
  margin: 0 auto;
  padding: clamp(3rem, 7vw, 5.5rem) var(--pad);
}
.band-in.narrow { max-width: 820px; }

.band h2 {
  font-size: clamp(1.45rem, 2.8vw, 2.1rem);
  margin-bottom: 2.2rem;
  letter-spacing: -.03em;
}

/* capability cards: four up, dense, bordered, no shadows */
.cap-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 0;
  border-top: 1px solid var(--line);
}

.cap {
  padding: 1.7rem 1.6rem 1.9rem 0;
  border-bottom: 1px solid var(--line);
  border-right: 1px solid var(--line);
  padding-left: 1.6rem;
}
.cap:first-child { padding-left: 0; }
.cap:nth-child(4n) { border-right: 0; }

@media (max-width: 640px) {
  .cap { border-right: 0; padding-left: 0; }
}

.cap h3 { font-size: .98rem; margin-bottom: .75rem; }
.cap p { color: var(--ink-2); font-size: .89rem; line-height: 1.65; }

/* phases */
.phases {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 0;
  border-top: 1px solid var(--line);
}

.phase {
  padding: 1.7rem 1.6rem 1.9rem 0;
  border-bottom: 1px solid var(--line);
  border-right: 1px solid var(--line);
  padding-left: 1.6rem;
}
.phase:first-child { padding-left: 0; }
.phase:last-child { border-right: 0; }

@media (max-width: 640px) {
  .phase { border-right: 0; padding-left: 0; }
}

.ph-n {
  display: block;
  font-family: var(--mono);
  font-size: .7rem;
  letter-spacing: .14em;
  color: var(--accent);
  margin-bottom: .7rem;
}
.phase h3 { font-size: .96rem; margin-bottom: .6rem; }
.phase p { color: var(--ink-2); font-size: .87rem; line-height: 1.62; }

/* clearance */
.prose { color: var(--ink-2); font-size: 1rem; max-width: 62ch; margin-bottom: 2rem; }

.facts {
  display: grid;
  gap: 0;
  margin: 0;
  border-top: 1px solid var(--line);
  max-width: 620px;
}
.facts > div {
  display: flex;
  justify-content: space-between;
  gap: 1.5rem;
  padding: .7rem 0;
  border-bottom: 1px solid var(--line);
  font-size: .84rem;
}
.facts dt { color: var(--ink-3); }
.facts dd { margin: 0; color: var(--ink); font-family: var(--mono); font-size: .8rem; }

/* the invitation */
.invite { background: linear-gradient(180deg, var(--bg), #0a0507); }
.invite h2 { font-size: clamp(1.5rem, 3.2vw, 2.3rem); margin-bottom: 1.2rem; }
.cue {
  font-family: var(--mono);
  font-size: .78rem;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--alert);
  margin-top: 2.2rem;
  animation: cue 2.4s ease-in-out infinite;
}
@keyframes cue { 0%,100% { opacity: .45 } 50% { opacity: 1 } }

/* ── footer ───────────────────────────────────────────────────────────── */
.foot { border-top: 1px solid var(--line); }
.foot-in {
  max-width: var(--w);
  margin: 0 auto;
  padding: 1.5rem var(--pad);
  display: flex;
  align-items: center;
  gap: 1.2rem;
  font-size: .74rem;
  color: var(--ink-4);
}
.foot-brand { letter-spacing: .2em; font-weight: 700; color: var(--ink-3); font-size: .7rem; }
.foot-note { color: var(--ink-4); }
.foot-yr { margin-left: auto; font-family: var(--mono); }
@media (max-width: 640px) { .foot-note { display: none; } }

/* ═════════════════════════════════════════════════════════════════════════
   Act III: the shell. Full viewport, black, monospace only.
   ═════════════════════════════════════════════════════════════════════════ */
.breach {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: #030507;
  display: flex;
  font-family: var(--mono);
  color: #cfdae6;
  opacity: 0;
  transition: opacity .5s;
}
.breach[hidden] { display: none; }
.breach.on { opacity: 1; }

.breach-in {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: clamp(.8rem, 2vw, 1.6rem);
  gap: .9rem;
}

.breach-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: .72rem;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--alert);
  border-bottom: 1px solid #1b232d;
  padding-bottom: .7rem;
}
.bh-r { color: #5f7284; letter-spacing: .1em; }

.breach-body {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  gap: 1.2rem;
}

@media (max-width: 760px) {
  .breach-body { grid-template-columns: 1fr; }
  .breach-side { display: none; }
}

.breach-side { font-size: .74rem; color: #5f7284; }
.bs-title {
  font-size: .8rem;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: #cfdae6;
  margin-bottom: 1rem;
}
.bs-facts { margin: 0; display: grid; gap: .45rem; }
.bs-facts > div { display: flex; justify-content: space-between; gap: 1rem; border-bottom: 1px solid #131a23; padding-bottom: .35rem; }
.bs-facts dt { color: #3f4e5e; }
.bs-facts dd { margin: 0; color: #8fa3b6; }
.bs-note { margin-top: 1.2rem; font-size: .7rem; line-height: 1.6; color: #3f4e5e; }
.bs-note code { color: var(--accent); }

.breach-term {
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
}

.term-screen {
  flex: 1;
  margin: 0;
  overflow-y: auto;
  font-family: var(--mono);
  font-size: clamp(.72rem, 1.15vw, .84rem);
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
  color: #cfdae6;
  scrollbar-width: thin;
}

.term-screen .t-dim { color: #4a5b6d; }
.term-screen .t-ok { color: var(--ok); }
.term-screen .t-warn { color: var(--accent); }
.term-screen .t-bad { color: var(--alert); }

.term-form {
  display: flex;
  align-items: center;
  gap: .6rem;
  border-top: 1px solid #1b232d;
  padding-top: .7rem;
}
.term-ps1 { color: var(--ok); font-size: .84rem; white-space: nowrap; }
.term-key {
  flex: 1;
  min-width: 0;
  background: transparent;
  border: 0;
  outline: none;
  color: #cfdae6;
  font: inherit;
  font-size: .84rem;
  caret-color: var(--ok);
}

/* ═════════════════════════════════════════════════════════════════════════
   Act II: corruption. Classes are applied by assets/act.js as depth rises.
   Everything here is visual; no content is destroyed, because the reveal
   has to be able to put the page back.
   ═════════════════════════════════════════════════════════════════════════ */

/* level 1: unease */
body.lv1 .masthead { border-bottom-color: #2a1d10; }
body.lv1 .stat .dot { background: var(--alert); box-shadow: 0 0 8px var(--alert); }
body.lv1 .tz { color: var(--accent); }

/* level 2: something is moving in the copy */
body.lv2 .ls .gl { color: var(--alert); opacity: .85; }

/* level 3: the grid slips */
body.lv3 .band-in,
body.lv3 .hero {
  animation: drift 9s steps(1, end) infinite;
}
@keyframes drift {
  0%, 84%, 100% { transform: translateX(0); }
  85% { transform: translateX(-2px); }
  87% { transform: translateX(3px); }
  89% { transform: translateX(-1px); }
}

/* level 4: chromatic split on headings */
body.lv4 h1, body.lv4 h2 {
  text-shadow: 1.4px 0 rgba(255,59,48,.55), -1.4px 0 rgba(61,220,132,.4);
}

/* level 5: redaction bars over the copy */
.redact {
  position: relative;
  color: transparent !important;
  transition: color .2s;
}
.redact::after {
  content: "";
  position: absolute;
  inset: .1em -.1em .14em -.1em;
  background: #cfdae6;
  transform-origin: left;
  animation: blk .35s ease-out both;
}
@keyframes blk { from { transform: scaleX(0) } to { transform: scaleX(1) } }

/* level 6: scanlines and vignette */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 90;
  pointer-events: none;
  opacity: 0;
  transition: opacity .8s;
}
.overlay.on { opacity: 1; }
.overlay::before {
  content: "";
  position: absolute; inset: 0;
  background: repeating-linear-gradient(180deg, rgba(0,0,0,.32) 0 1px, transparent 1px 3px);
}
.overlay::after {
  content: "";
  position: absolute; inset: 0;
  background: radial-gradient(ellipse at center, transparent 45%, rgba(0,0,0,.72) 100%);
}

/* level 7: the false cursor that is not yours */
.ghost-cursor {
  position: fixed;
  z-index: 150;
  width: 12px; height: 18px;
  pointer-events: none;
  background: #fff;
  clip-path: polygon(0 0, 0 100%, 4px 76%, 7px 100%, 9px 96%, 6px 72%, 12px 72%);
  filter: drop-shadow(0 0 3px rgba(255,59,48,.9));
  transition: transform 1.1s cubic-bezier(.4,0,.2,1);
  opacity: 0;
}
.ghost-cursor.on { opacity: .92; }

/* level 8: the page is failing */
body.lv8 .band, body.lv8 .hero, body.lv8 .masthead {
  filter: saturate(.55) contrast(1.15);
}

/* the crash frame */
.crash {
  position: fixed;
  inset: 0;
  z-index: 190;
  background: #030507;
  font-family: var(--mono);
  font-size: .8rem;
  line-height: 1.65;
  color: #cfdae6;
  padding: clamp(1rem, 4vw, 3rem);
  overflow: hidden;
  display: none;
}
.crash.on { display: block; }
.crash .c-bad { color: var(--alert); }
.crash .c-dim { color: #4a5b6d; }

@media (prefers-reduced-motion: reduce) {
  .dot, .cue, .phase, .band-in, .hero { animation: none !important; }
  html { scroll-behavior: auto; }
}
