:root {
  --brown:   #683c06;
  --cream:   #edd9c0;
  --tan:     #e6a95e;
  --orange:  #e48c21;
  --blue:    #1d58b1;
  --yellow:  #fff460;
  --navy:    #0e2a47;
  --gray50:  #fafaf7;
  --gray100: #f1eee7;
  --gray300: #d6d2c7;
  --gray600: #6b6455;
  --gray900: #2a2a28;
  --red:     #b8432e;
  --green:   #2f7a3e;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: 'Montserrat', system-ui, -apple-system, sans-serif;
  color: var(--gray900);
  background: var(--gray50);
  line-height: 1.5;
}
code, pre, .mono { font-family: 'Fira Code', ui-monospace, monospace; }

.page { max-width: 1160px; margin: 0 auto; padding: 48px 32px 96px; }

header { border-bottom: 2px solid var(--brown); padding-bottom: 24px; margin-bottom: 40px; }
header .eyebrow {
  font-family: 'Fira Code', ui-monospace, monospace;
  font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--blue); margin-bottom: 8px;
}
h1 {
  font-family: 'Grandstander', 'Georgia', serif;
  font-weight: 700; font-size: 42px; line-height: 1.1;
  margin: 0 0 12px; color: var(--brown);
}
.question { font-size: 18px; color: var(--gray600); font-style: italic; margin: 0; }
.meta { display: flex; gap: 32px; flex-wrap: wrap; font-size: 12px; color: var(--gray600); margin-top: 16px; }
.meta strong { color: var(--gray900); font-weight: 600; }

section { margin-bottom: 56px; }
h2 {
  font-family: 'Grandstander', 'Georgia', serif;
  font-weight: 600; font-size: 26px; color: var(--brown);
  margin: 0 0 16px; display: flex; align-items: baseline; gap: 12px;
}
h2 .num { font-family: 'Fira Code', monospace; font-size: 16px; color: var(--blue); font-weight: 400; }
h3 {
  font-family: 'Grandstander', 'Georgia', serif;
  font-weight: 600; font-size: 18px; margin: 28px 0 10px; color: var(--navy);
}

.diagram-frame {
  background: white; border: 1px solid var(--gray300); border-radius: 12px;
  padding: 32px 16px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.04), 0 8px 24px rgba(104,60,6,0.04);
  overflow: auto;
}
.diagram-frame .mermaid { text-align: center; }

.key {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px; margin-top: 20px; font-size: 12px;
}
.key-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 12px; background: var(--gray100); border-radius: 8px;
  border: 1px solid var(--gray300);
}
.key-swatch { width: 18px; height: 18px; border-radius: 4px; flex-shrink: 0; border: 1px solid rgba(0,0,0,0.1); }

.callout {
  border-left: 4px solid var(--tan); background: #fff8ea;
  padding: 14px 18px; border-radius: 0 8px 8px 0; margin: 16px 0; font-size: 14px;
}
.callout strong { color: var(--brown); }
.callout.warn { border-left-color: var(--red); background: #fdecea; }
.callout.warn strong { color: var(--red); }
.callout.note { border-left-color: var(--blue); background: #eaf3ff; }
.callout.note strong { color: var(--blue); }
.callout.good { border-left-color: var(--green); background: #e8f6ec; }
.callout.good strong { color: var(--green); }

.sub-note { font-size: 14px; color: var(--gray600); margin: 4px 0 18px; max-width: 880px; }
.sub-note code { font-size: 12px; background: var(--gray100); padding: 2px 5px; border-radius: 3px; color: var(--navy); }

table {
  border-collapse: collapse; width: 100%; font-size: 13px; background: white;
  border-radius: 8px; overflow: hidden; box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}
th, td { padding: 10px 14px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--gray100); }
th {
  background: var(--cream); color: var(--brown); font-weight: 600;
  font-size: 12px; letter-spacing: 0.04em; text-transform: uppercase;
}
tr:last-child td { border-bottom: none; }
tr:hover td { background: #fdf6ea; }
td code, th code {
  font-size: 12px; background: var(--gray100); padding: 2px 6px; border-radius: 3px;
  color: var(--navy); word-break: break-all;
}

.env-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.env-card { padding: 16px; border-radius: 10px; border: 1px solid var(--gray300); }
.env-card.uat { background: #eaf3ff; border-color: #b4cfe8; }
.env-card.prod { background: #f5efe1; border-color: #d6c6a4; }
.env-card h4 {
  margin: 0 0 8px; font-family: 'Fira Code', monospace;
  font-size: 12px; letter-spacing: 0.1em; text-transform: uppercase;
}
.env-card.uat h4 { color: var(--blue); }
.env-card.prod h4 { color: var(--brown); }
.env-card p { margin: 0; font-size: 13px; }

ul.verify {
  list-style: none; padding: 0; margin: 0;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(360px, 1fr)); gap: 8px;
}
ul.verify li {
  padding: 10px 14px; background: white; border: 1px solid var(--gray100);
  border-left: 3px solid var(--blue); border-radius: 0 6px 6px 0; font-size: 12px;
}
ul.verify li strong { display: block; margin-bottom: 4px; color: var(--gray900); font-weight: 600; }
ul.verify li code { font-size: 11px; color: var(--navy); }

/* Status helpers (for tables) */
.yes { color: var(--green); font-weight: 600; }
.no { color: var(--red); font-weight: 600; }
.val { color: var(--brown); font-weight: 600; }
.nullv { color: var(--gray600); font-style: italic; }
.status-200 { color: var(--green); font-weight: 600; }
.status-202 { color: var(--blue); font-weight: 600; }
.status-4xx { color: var(--orange); font-weight: 600; }
.status-5xx { color: var(--red); font-weight: 600; }

footer {
  margin-top: 72px; padding-top: 24px; border-top: 1px solid var(--gray300);
  font-size: 12px; color: var(--gray600);
}
footer a { color: var(--blue); }

/* ===== User-journey primitives ===== */

/* Screen card — stylized wireframe representing a UI screen */
.screen {
  background: white;
  border: 1.5px solid var(--navy);
  border-radius: 10px;
  box-shadow: 0 4px 12px rgba(14, 42, 71, 0.08);
  padding: 0;
  min-width: 220px;
  max-width: 320px;
  font-family: 'Montserrat', system-ui, sans-serif;
  display: inline-flex;
  flex-direction: column;
  overflow: hidden;
}
.screen .screen-chrome {
  display: flex; align-items: center; gap: 6px;
  padding: 6px 10px;
  background: var(--navy);
  color: #c7d9e8;
  font-family: 'Fira Code', monospace;
  font-size: 10px;
  letter-spacing: 0.02em;
}
.screen .screen-chrome .dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: #c7d9e8;
  opacity: 0.6;
}
.screen .screen-chrome .url {
  flex: 1;
  background: #1e3c5a;
  color: #edd9c0;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 10px;
  text-align: center;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.screen .screen-body {
  padding: 12px 14px;
}
.screen h5 {
  margin: 0 0 8px;
  font-family: 'Grandstander', serif;
  font-size: 15px;
  color: var(--brown);
  font-weight: 600;
}
.screen ul {
  margin: 0;
  padding-left: 16px;
  font-size: 11.5px;
  line-height: 1.5;
  color: var(--gray900);
}
.screen ul li { margin-bottom: 2px; }
.screen .chip {
  display: inline-block; font-family: 'Fira Code', monospace;
  font-size: 10px; padding: 1px 6px; border-radius: 4px;
  background: var(--cream); color: var(--brown); font-weight: 600;
  margin: 0 2px;
}
.screen .chip.btn-primary { background: var(--yellow); color: #111; border: 1px solid var(--brown); }
.screen .chip.btn-secondary { background: white; color: var(--brown); border: 1px solid var(--brown); }
.screen .chip.input { background: var(--gray100); color: var(--gray900); border: 1px dashed var(--gray300); padding: 2px 10px; }
.screen .chip.link { background: transparent; color: var(--blue); text-decoration: underline; padding: 0; }
.screen .chip.toast { background: #e8f6ec; color: var(--green); border: 1px solid var(--green); }
.screen .chip.error { background: #fdecea; color: var(--red); border: 1px solid var(--red); }

.screen.modal {
  border-style: dashed;
  border-color: var(--brown);
  box-shadow: 0 6px 16px rgba(104, 60, 6, 0.14);
}
.screen.modal .screen-chrome {
  background: var(--brown);
  color: var(--cream);
}
.screen.modal .screen-chrome .url { background: #4a2d07; color: var(--cream); }

.screen.email {
  border-color: var(--tan);
  background: #fff8ea;
}
.screen.email .screen-chrome {
  background: var(--tan); color: white;
}
.screen.email .screen-chrome .url { background: #c8914d; color: white; }

/* Journey row — horizontal arrangement of screens + arrows */
.journey {
  display: flex; align-items: stretch; gap: 16px;
  padding: 24px 8px;
  overflow-x: auto;
  background: #fafaf7;
  border: 1px solid var(--gray300);
  border-radius: 12px;
}
.journey .arrow {
  align-self: center;
  min-width: 60px;
  text-align: center;
  position: relative;
  font-size: 11px;
  font-family: 'Fira Code', monospace;
  color: var(--gray600);
  padding: 0 4px;
}
.journey .arrow::before {
  content: "";
  display: block;
  height: 2px;
  background: var(--brown);
  position: absolute;
  top: 50%;
  left: 0; right: 0;
  z-index: 0;
}
.journey .arrow::after {
  content: "▶";
  color: var(--brown);
  position: absolute;
  right: -4px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 14px;
}
.journey .arrow .action {
  position: relative;
  background: #fafaf7;
  padding: 2px 8px;
  z-index: 1;
  display: inline-block;
  border: 1px solid var(--gray300);
  border-radius: 4px;
  color: var(--gray900);
  white-space: nowrap;
}

/* Journey column stack — for vertical flows */
.journey-stack {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 24px 0;
  background: #fafaf7;
  border: 1px solid var(--gray300);
  border-radius: 12px;
}
.journey-stack .arrow-v {
  font-size: 18px;
  color: var(--brown);
  font-family: 'Fira Code', monospace;
  position: relative;
  padding: 2px 10px;
  font-weight: 700;
}
.journey-stack .arrow-v .action {
  display: block;
  background: white;
  padding: 3px 10px;
  border: 1px solid var(--gray300);
  border-radius: 4px;
  color: var(--gray900);
  font-size: 11px;
  font-weight: 400;
  margin-bottom: 2px;
}

/* Actor avatar badge — used above journey to indicate who's doing it */
.actor-row {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 10px;
  font-size: 13px;
}
.actor-badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px;
  border-radius: 14px;
  font-family: 'Fira Code', monospace;
  font-size: 11px;
  font-weight: 600;
}
.actor-badge.parent { background: var(--cream); color: var(--brown); border: 1px solid var(--brown); }
.actor-badge.child  { background: #eaf3ff; color: var(--blue); border: 1px solid var(--blue); }
.actor-badge.anon   { background: var(--gray100); color: var(--gray600); border: 1px solid var(--gray300); }
.actor-badge .emo { font-size: 14px; }

/* Timeline — horizontal steps with numbered nodes */
.timeline {
  display: flex; align-items: stretch; gap: 0;
  counter-reset: step-counter;
}
.timeline .step {
  flex: 1;
  padding: 16px 12px;
  background: white;
  border-top: 4px solid var(--cream);
  border-left: 1px solid var(--gray100);
  position: relative;
  counter-increment: step-counter;
}
.timeline .step:first-child { border-left: none; border-radius: 10px 0 0 0; }
.timeline .step:last-child { border-radius: 0 10px 0 0; }
.timeline .step::before {
  content: counter(step-counter);
  position: absolute;
  top: -16px; left: 50%;
  transform: translateX(-50%);
  background: var(--brown); color: #fff460;
  width: 28px; height: 28px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-family: 'Fira Code', monospace;
  font-weight: 600;
  font-size: 13px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}
.timeline .step h5 {
  margin: 10px 0 6px;
  font-family: 'Grandstander', serif;
  font-size: 14px; color: var(--brown);
  text-align: center;
}
.timeline .step p {
  margin: 0; font-size: 11.5px; color: var(--gray600); text-align: center;
}
