@import url("design-system/respellion-tokens.css");

/* Brand display font — used for the { r } mark itself. */
@font-face {
  font-family: "BallPill";
  src: url("fonts/BallPill-light.otf") format("opentype");
  font-weight: 300;
  font-style: normal;
  font-display: block;
}

/* ─── Page shell ─────────────────────────────────────────── */
html, body {
  margin: 0; min-height: 100%;
  background: var(--teal-900);
  font-family: var(--font-sans);
  color: var(--cream);
  -webkit-font-smoothing: antialiased;
}
* { box-sizing: border-box; }

#root { min-height: 100vh; }

.page {
  max-width: var(--max);
  margin: 0 auto;
  padding: var(--s-8) var(--s-7) var(--s-9);
  display: flex; flex-direction: column; gap: var(--s-8);
}

/* tints used throughout the dark surface */
:root {
  --ink-cream:      var(--cream);
  --ink-muted:      rgba(236,233,233,0.62);
  --ink-subtle:     rgba(236,233,233,0.32);
  --border-soft:    rgba(236,233,233,0.10);
  --border-softer:  rgba(236,233,233,0.06);
  --surface-deep:   #122F36;     /* between teal and teal-900 */
  --surface-card:   #163841;
  --tint-purple:    rgba(92,29,216,0.10);
}

/* ─── Header ─────────────────────────────────────────────── */
.hdr { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--s-7); flex-wrap: wrap; }
.hdr-eyebrow {
  font: 500 var(--t-label)/1 var(--font-mono);
  letter-spacing: var(--label-ls);
  text-transform: uppercase;
  color: var(--peri);
  margin-bottom: var(--s-4);
}
.hdr h1 {
  font: 700 var(--t-h2)/1.02 var(--font-sans);
  letter-spacing: -0.015em;
  max-width: 820px;
  color: var(--ink-cream);
}
.hdr h1 em {
  font-style: normal;
  font-family: var(--font-mono);
  font-weight: 500;
  color: var(--peri);
}
.hdr-lede {
  font-size: var(--t-lead);
  color: var(--ink-muted);
  margin-top: var(--s-5);
  max-width: 620px;
  line-height: 1.55;
}
.hdr-lede b { color: var(--ink-cream); font-weight: 500; }
.hdr-lede code {
  font-family: var(--font-mono);
  background: rgba(236,233,233,0.08);
  color: var(--ink-cream);
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 0.85em;
}

.hdr-meta {
  font: 500 var(--t-label)/1.7 var(--font-mono);
  letter-spacing: var(--label-ls);
  text-transform: uppercase;
  color: var(--ink-subtle);
}
.hdr-meta span { color: var(--ink-cream); text-transform: none; letter-spacing: 0.02em; }
.hdr-meta i {
  display: inline-block; width: 6px; height: 6px; border-radius: 999px;
  background: var(--sage); margin-right: 6px; vertical-align: middle;
  animation: pulseDot 1.8s ease-in-out infinite;
  box-shadow: 0 0 10px rgba(205,216,187,0.6);
}
@keyframes pulseDot { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }

/* ─── Section header ─────────────────────────────────────── */
.sec-h {
  display: flex; align-items: baseline; gap: var(--s-5);
  border-bottom: 1px solid var(--border-soft);
  padding-bottom: var(--s-4);
}
.sec-num {
  font: 500 var(--t-label)/1 var(--font-mono);
  letter-spacing: var(--label-ls);
  text-transform: uppercase;
  color: var(--peri);
}
.sec-h h2 {
  font: 700 var(--t-h3)/1.1 var(--font-sans);
  letter-spacing: -0.005em;
  color: var(--ink-cream);
}
.sec-h .sub {
  font-size: var(--t-small);
  color: var(--ink-muted);
  margin-left: auto;
}

/* ─── Hero (big mark) ────────────────────────────────────── */
.hero {
  display: grid; grid-template-columns: 1fr 1fr; gap: var(--s-6);
  align-items: stretch;
}
.hero-card {
  background: var(--surface-deep);
  border: 1px solid var(--border-soft);
  border-radius: var(--r-lg);
  padding: var(--s-7);
  display: flex; flex-direction: column; justify-content: space-between;
  min-height: 460px;
  position: relative;
  overflow: hidden;
}
.hero-card.light {
  background: var(--cream);
  color: var(--teal-900);
  border-color: rgba(0,0,0,0.05);
}
.hero-card .grid-bg {
  position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(236,233,233,0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(236,233,233,0.04) 1px, transparent 1px);
  background-size: 32px 32px;
  pointer-events: none;
}
.hero-card.light .grid-bg {
  background-image:
    linear-gradient(rgba(31,85,96,0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(31,85,96,0.06) 1px, transparent 1px);
}

/* Organic blob on the hero for personality (responsible rebellion: structure + curve) */
.hero-card .blob {
  position: absolute;
  width: 180px; height: 180px;
  background: var(--purple);
  opacity: 0.22;
  border-radius: var(--r-org);
  filter: blur(2px);
  top: -40px; right: -50px;
  pointer-events: none;
}
.hero-card.light .blob { background: var(--sage); opacity: 0.6; }
.hero-card .blob.b2 {
  width: 120px; height: 120px;
  background: var(--peri);
  border-radius: var(--r-org2);
  top: auto; bottom: -30px; right: auto; left: -30px;
  opacity: 0.18;
}
.hero-card.light .blob.b2 { background: var(--peri); opacity: 0.5; }

.hero-mark { display: grid; place-items: center; flex: 1; position: relative; z-index: 1; }
.hero-tag {
  font: 500 var(--t-label)/1 var(--font-mono);
  letter-spacing: var(--label-ls);
  text-transform: uppercase;
  color: var(--ink-subtle);
  display: flex; justify-content: space-between;
  position: relative; z-index: 1;
}
.hero-card.light .hero-tag { color: rgba(31,85,96,0.55); }
.hero-tag b { color: var(--ink-cream); font-weight: 500; text-transform: none; letter-spacing: 0.02em; }
.hero-card.light .hero-tag b { color: var(--teal-900); }

/* ─── State row ──────────────────────────────────────────── */
.state-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--s-5); }
.state-card {
  background: var(--surface-deep);
  border: 1px solid var(--border-soft);
  border-radius: var(--r-md);
  padding: var(--s-6);
  display: flex; flex-direction: column; align-items: center; gap: var(--s-4);
  position: relative;
  overflow: hidden;
}
.state-card .stage {
  width: 140px; height: 140px;
  display: grid; place-items: center;
  background: var(--teal-900);
  border-radius: var(--r-sm);
  border: 1px solid var(--border-softer);
}
.state-name {
  font: 500 var(--t-label)/1 var(--font-mono);
  letter-spacing: var(--label-ls);
  text-transform: uppercase;
  color: var(--peri);
}
.state-desc {
  font-size: var(--t-small);
  color: var(--ink-muted);
  text-align: center;
  line-height: 1.55;
}

/* ─── Size scale ─────────────────────────────────────────── */
.scale-card {
  background: var(--surface-deep);
  border: 1px solid var(--border-soft);
  border-radius: var(--r-md);
  padding: var(--s-7);
}
.scale-row {
  display: flex; align-items: flex-end; gap: var(--s-7); justify-content: center; flex-wrap: wrap;
}
.scale-item { display: flex; flex-direction: column; align-items: center; gap: var(--s-3); }
.scale-item .stage { display: grid; place-items: center; }
.scale-item .px {
  font: 500 var(--t-label)/1 var(--font-mono);
  letter-spacing: var(--label-ls);
  text-transform: uppercase;
  color: var(--ink-subtle);
}

/* ─── Anatomy ─────────────────────────────────────────────── */
.anatomy-card {
  background: var(--surface-deep);
  border: 1px solid var(--border-soft);
  border-radius: var(--r-md);
  padding: var(--s-7);
  display: grid; grid-template-columns: 1fr 1.1fr; gap: var(--s-7);
  align-items: center;
  position: relative;
  overflow: hidden;
}
.anatomy-card .blob {
  position: absolute;
  width: 280px; height: 280px;
  background: var(--purple);
  opacity: 0.14;
  border-radius: var(--r-org);
  filter: blur(8px);
  top: -80px; left: -80px;
  pointer-events: none;
}
.anatomy-stage { display: grid; place-items: center; position: relative; z-index: 1; }
.anatomy-list { display: flex; flex-direction: column; gap: var(--s-5); position: relative; z-index: 1; }
.anatomy-item { display: flex; gap: var(--s-4); }
.anatomy-num {
  font: 500 var(--t-label)/1 var(--font-mono);
  letter-spacing: var(--label-ls);
  text-transform: uppercase;
  color: var(--peri);
  flex-shrink: 0; width: 32px;
  padding-top: 2px;
}
.anatomy-text b {
  display: block; color: var(--ink-cream);
  font: 600 var(--t-body)/1.3 var(--font-sans);
  margin-bottom: 4px;
}
.anatomy-text { font-size: var(--t-small); color: var(--ink-muted); line-height: 1.55; }

/* ─── Intranet mockup ────────────────────────────────────── */
.intra-card {
  background: var(--cream);
  border-radius: var(--r-md);
  border: 1px solid rgba(0,0,0,0.04);
  overflow: hidden;
  min-height: 520px;
  position: relative;
}
.intra-top {
  height: 60px;
  background: var(--paper);
  border-bottom: 1px solid rgba(31,85,96,0.08);
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--s-5);
  padding: 0 var(--s-6);
}
.intra-logo {
  font-family: "BallPill", var(--font-mono);
  font-size: 32px; font-weight: 300;
  color: var(--teal-900);
  letter-spacing: -0.04em;
  display: flex; align-items: center; gap: 0;
  flex-shrink: 0;
}
.intra-logo .brace { color: var(--purple); }
.intra-logo .r { color: var(--teal); }
.intra-logo .nm {
  font-family: var(--font-sans); font-weight: 600;
  font-size: 16px; letter-spacing: -0.005em;
  margin-left: 12px; color: var(--teal-900);
  align-self: center;
}
.intra-nav {
  display: flex; gap: var(--s-4);
  font: 500 13px/1 var(--font-sans);
  color: rgba(60,58,58,0.62);
  flex-shrink: 0;
}
.intra-nav span.active { color: var(--teal-900); }

.intra-body {
  padding: var(--s-6) var(--s-7);
  display: grid; grid-template-columns: 2fr 1fr; gap: var(--s-6);
}
.intra-h {
  font: 700 22px/1.1 var(--font-sans);
  color: var(--teal);
  margin-bottom: 4px;
  letter-spacing: -0.01em;
}
.intra-sub { font-size: 14px; color: rgba(60,58,58,0.6); margin-bottom: var(--s-5); }

.intra-tile {
  background: var(--paper);
  border: 1px solid rgba(31,85,96,0.06);
  border-radius: var(--r-sm);
  padding: var(--s-4) var(--s-5);
  margin-bottom: var(--s-3);
}
.intra-tile-h { font: 600 15px/1.3 var(--font-sans); color: var(--teal-900); margin-bottom: 4px; }
.intra-tile-meta {
  font: 500 var(--t-label)/1 var(--font-mono);
  letter-spacing: var(--label-ls);
  text-transform: uppercase;
  color: rgba(60,58,58,0.5);
}
.intra-tile-line { height: 6px; background: rgba(31,85,96,0.10); border-radius: 4px; margin-top: var(--s-3); }
.intra-tile-line.w60 { width: 60%; margin-top: 6px; }
.intra-tile-line.w80 { width: 80%; }

.intra-side { display: flex; flex-direction: column; gap: var(--s-2); }
.intra-side-h {
  font: 500 var(--t-label)/1 var(--font-mono);
  letter-spacing: var(--label-ls);
  text-transform: uppercase;
  color: rgba(60,58,58,0.45);
  margin-bottom: 4px;
}
.intra-pill {
  background: var(--paper);
  border: 1px solid rgba(31,85,96,0.06);
  border-radius: var(--r-pill);
  padding: 10px 16px;
  font: 500 13px/1 var(--font-sans);
  color: var(--ink);
  display: flex; align-items: center; gap: 8px;
}
.intra-pill i { width: 6px; height: 6px; border-radius: 999px; background: var(--sage); }

/* The chat bubble FAB */
.bubble-trigger {
  position: absolute;
  right: var(--s-6); bottom: var(--s-6);
  width: 64px; height: 64px;
  border-radius: var(--r-pill);
  background: var(--teal-900);
  display: grid; place-items: center;
  box-shadow: var(--shadow-pill);
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  border: 2px solid var(--cream);
}
.bubble-trigger:hover { transform: translateY(-2px); }
.bubble-trigger.open {
  right: var(--s-6); bottom: 400px;
  width: 48px; height: 48px;
}

.bubble-window {
  position: absolute;
  right: var(--s-6); bottom: var(--s-6);
  width: 360px; height: 380px;
  background: var(--paper);
  border-radius: var(--r-md);
  border: 1px solid rgba(31,85,96,0.06);
  box-shadow: var(--shadow-pill);
  display: flex; flex-direction: column;
  overflow: hidden;
}
.bubble-hd {
  background: var(--teal-900);
  color: var(--cream);
  padding: var(--s-4) var(--s-5);
  display: flex; align-items: center; gap: var(--s-3);
}
.bubble-hd .av {
  width: 40px; height: 40px; border-radius: var(--r-pill);
  background: var(--teal);
  display: grid; place-items: center;
}
.bubble-hd-text { display: flex; flex-direction: column; gap: 2px; }
.bubble-hd-name { font: 600 14px/1 var(--font-sans); }
.bubble-hd-status {
  font: 500 var(--t-label)/1 var(--font-mono);
  letter-spacing: var(--label-ls);
  text-transform: uppercase;
  color: rgba(236,233,233,0.55);
  display: flex; align-items: center; gap: 6px;
}
.bubble-hd-status i { width: 5px; height: 5px; border-radius: 999px; background: var(--sage); }
.bubble-hd-x {
  margin-left: auto; color: rgba(236,233,233,0.6);
  font-size: 22px; line-height: 1; cursor: pointer;
}

.bubble-body {
  flex: 1; padding: var(--s-4);
  background: var(--cream);
  display: flex; flex-direction: column; gap: var(--s-3);
  overflow: hidden;
}
.msg { display: flex; gap: var(--s-2); align-items: flex-end; }
.msg .av-sm {
  width: 26px; height: 26px; border-radius: var(--r-pill);
  background: var(--teal-900);
  display: grid; place-items: center;
  flex-shrink: 0;
}
.msg .bub {
  background: var(--paper);
  border-radius: 16px 16px 16px 4px;
  padding: 10px 14px;
  font: 400 14px/1.45 var(--font-sans);
  color: var(--ink);
  max-width: 230px;
  border: 1px solid rgba(31,85,96,0.06);
}
.msg.me { justify-content: flex-end; }
.msg.me .bub {
  background: var(--teal);
  color: var(--cream);
  border: none;
  border-radius: 16px 16px 4px 16px;
}

.bubble-input {
  padding: var(--s-3) var(--s-4);
  background: var(--paper);
  border-top: 1px solid rgba(31,85,96,0.06);
  display: flex; align-items: center; gap: var(--s-2);
}
.bubble-input input {
  flex: 1;
  background: var(--cream);
  border: none; outline: none;
  border-radius: var(--r-pill);
  padding: 10px 14px;
  font: 400 14px/1 var(--font-sans);
  color: var(--ink);
}
.bubble-input input::placeholder { color: rgba(60,58,58,0.4); }
.bubble-input button {
  background: var(--purple);
  color: var(--cream);
  border: none;
  border-radius: var(--r-pill);
  padding: 10px 18px;
  font: 600 13px/1 var(--font-sans);
  cursor: pointer;
  transition: background 0.15s ease;
}
.bubble-input button:hover { background: var(--purple-700); }

/* ─── Names ──────────────────────────────────────────────── */
.names {
  background: var(--surface-deep);
  border: 1px solid var(--border-soft);
  border-radius: var(--r-md);
  padding: var(--s-7);
  position: relative;
  overflow: hidden;
}
.names .blob {
  position: absolute;
  width: 200px; height: 200px;
  background: var(--purple);
  opacity: 0.16;
  border-radius: var(--r-org2);
  filter: blur(4px);
  bottom: -60px; right: -40px;
  pointer-events: none;
}
.names-lede {
  font-size: var(--t-small);
  color: var(--ink-muted);
  line-height: 1.6;
  max-width: 640px;
  position: relative; z-index: 1;
}
.names-grid {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--s-3);
  margin-top: var(--s-5);
  position: relative; z-index: 1;
}
.name-card {
  background: rgba(236,233,233,0.04);
  border: 1px solid var(--border-soft);
  border-radius: var(--r-sm);
  padding: var(--s-4) var(--s-5);
  display: flex; flex-direction: column; gap: 6px;
}
.name-card.picked {
  border-color: var(--peri);
  background: rgba(175,192,255,0.08);
}
.name-card .nm {
  font: 600 22px/1.1 var(--font-sans);
  color: var(--ink-cream);
  letter-spacing: -0.01em;
}
.name-card .nm em {
  font-style: normal;
  color: var(--peri);
  font-family: var(--font-mono);
  font-weight: 500;
}
.name-card.picked .nm em { color: var(--peri); }
.name-card .ds { font-size: 12px; color: var(--ink-muted); line-height: 1.5; }
.name-card .picked-tag {
  position: absolute; top: 10px; right: 10px;
  font: 500 9px/1 var(--font-mono);
  letter-spacing: var(--label-ls);
  text-transform: uppercase;
  color: var(--peri);
}
.name-card { position: relative; }

/* ─── Palette card ───────────────────────────────────────── */
.palette-card {
  background: var(--surface-deep);
  border: 1px solid var(--border-soft);
  border-radius: var(--r-md);
  padding: var(--s-7);
}
.palette-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: var(--s-3); }
.swatch {
  border-radius: var(--r-sm);
  padding: var(--s-4);
  min-height: 140px;
  display: flex; flex-direction: column; justify-content: space-between;
  font-family: var(--font-mono);
}
.swatch .nm { font-size: 12px; font-weight: 500; letter-spacing: 0.04em; }
.swatch .hex { font-size: 11px; letter-spacing: 0.05em; opacity: 0.7; }

/* ─── Footnote ──────────────────────────────────────────── */
.footnote {
  font-size: var(--t-small); color: var(--ink-muted); line-height: 1.6;
  text-align: center; padding-top: var(--s-5);
  max-width: 640px; margin: 0 auto;
}
.footnote code {
  background: rgba(236,233,233,0.06); color: var(--ink-cream);
  padding: 2px 8px; border-radius: 6px;
  font: 500 12px/1 var(--font-mono);
}
.footnote b { color: var(--ink-cream); font-weight: 500; }

/* ─── Mark-specific animations ───────────────────────────── */
@keyframes caretBlink { 0%, 49% { opacity: 1; } 50%, 100% { opacity: 0; } }
.caret { animation: caretBlink 1s steps(1, end) infinite; }

@keyframes dotBounce { 0%, 80%, 100% { transform: translateY(0); opacity: 0.4; } 40% { transform: translateY(-4px); opacity: 1; } }
.dot { animation: dotBounce 1.2s ease-in-out infinite; transform-origin: center; }
.dot:nth-child(2) { animation-delay: 0.15s; }
.dot:nth-child(3) { animation-delay: 0.3s; }

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-2px); }
  40%, 80% { transform: translateX(2px); }
}
.shake { animation: shake 0.5s ease-in-out; }
