/* EventStorming pages (/eventstorming/…) and the landing page's EventStorming section.
   Loaded after main.css (+ eng.css on the generated pages). No inline styles anywhere: geometry is CSS, colour is here.
   The sticky colours follow the official EventStorming notation (A. Brandolini; ddd-crew glossary and cheat sheet):
   orange event, blue command, small yellow actor, big pale yellow aggregate, lilac policy, green read model,
   wide pink external system, neon-pink hot spot, dark green opportunity.
   Every sticky also carries its type as a word, so colour is never the only cue. */

:root {
  --es-event: #ffa94d;   --es-event-ink: #3d1d00;   --es-event-edge: #d97706;
  --es-command: #7cc4f7; --es-command-ink: #06263f; --es-command-edge: #2b87cf;
  --es-actor: #ffd84a;   --es-actor-ink: #3a2d00;   --es-actor-edge: #cfa500;
  --es-agg: #fff3b0;     --es-agg-ink: #473b00;     --es-agg-edge: #d2bb2c;
  --es-policy: #cdb4f0;  --es-policy-ink: #2a1450;  --es-policy-edge: #9a73d6;
  --es-read: #a8e6a1;    --es-read-ink: #0e3a10;    --es-read-edge: #4fb446;
  --es-system: #f9b8d2;  --es-system-ink: #5a0a2e;  --es-system-edge: #dd7aa5;
  --es-hot: #ff5caa;     --es-hot-ink: #26000f;     --es-hot-edge: #c70068;
  --es-opp: #186a3a;     --es-opp-ink: #ffffff;     --es-opp-edge: #0c4a27;
  --es-paper: #fffdf6;
}

/* ---------- the sticky note ---------- */
.st {
  position: relative; display: block; margin: 0; padding: 0.5rem 0.6rem 0.5rem;
  background: var(--st-bg); color: var(--st-ink); border: 1px solid var(--st-edge); border-radius: 3px;
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.06), 0 7px 10px -7px rgba(11, 29, 45, 0.45);
  background-image: linear-gradient(180deg, rgba(255, 255, 255, 0.32), rgba(255, 255, 255, 0) 45%);
  font: 600 0.84rem/1.28 var(--f-display); overflow-wrap: anywhere; text-decoration: none;
}
a.st:hover { box-shadow: 0 1px 0 rgba(0, 0, 0, 0.06), 0 10px 14px -8px rgba(11, 29, 45, 0.6); transform: translateY(-1px); }
a.st:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; }
.st__k { display: block; margin-bottom: 0.28rem; font: 650 0.58rem/1 var(--f-mono); letter-spacing: 0.1em; text-transform: uppercase; opacity: 0.8; }
.st__t { display: block; }
.st__t--code { font: 600 0.77rem/1.3 var(--f-mono); letter-spacing: -0.01em; }
.st__sub { display: block; margin-top: 0.3rem; font: 500 0.68rem/1.25 var(--f-mono); opacity: 0.78; overflow-wrap: anywhere; }
.st--event   { --st-bg: var(--es-event);   --st-ink: var(--es-event-ink);   --st-edge: var(--es-event-edge); }
.st--command { --st-bg: var(--es-command); --st-ink: var(--es-command-ink); --st-edge: var(--es-command-edge); }
.st--actor   { --st-bg: var(--es-actor);   --st-ink: var(--es-actor-ink);   --st-edge: var(--es-actor-edge); padding: 0.4rem 0.55rem; font-size: 0.8rem; border-radius: 2px; }
.st--agg     { --st-bg: var(--es-agg);     --st-ink: var(--es-agg-ink);     --st-edge: var(--es-agg-edge); padding: 0.75rem 0.7rem 0.9rem; min-height: 4.6rem; }
.st--policy  { --st-bg: var(--es-policy);  --st-ink: var(--es-policy-ink);  --st-edge: var(--es-policy-edge); padding: 0.6rem 0.65rem 0.65rem; font-weight: 560; }
.st--read    { --st-bg: var(--es-read);    --st-ink: var(--es-read-ink);    --st-edge: var(--es-read-edge); }
.st--system  { --st-bg: var(--es-system);  --st-ink: var(--es-system-ink);  --st-edge: var(--es-system-edge); }
.st--hot     { --st-bg: var(--es-hot);     --st-ink: var(--es-hot-ink);     --st-edge: var(--es-hot-edge); transform: rotate(-1.4deg); font-weight: 620; }
.st--opp     { --st-bg: var(--es-opp);     --st-ink: var(--es-opp-ink);     --st-edge: var(--es-opp-edge); background-image: linear-gradient(180deg, rgba(255, 255, 255, 0.14), rgba(255, 255, 255, 0) 45%); }
.st--in { border-style: dashed; }
.st--pivot { border-width: 2px; border-color: var(--ink); box-shadow: 0 0 0 3px color-mix(in srgb, var(--es-event) 45%, transparent), 0 8px 12px -8px rgba(11, 29, 45, 0.55); }
.st--sm { font-size: 0.76rem; padding: 0.38rem 0.5rem; }
.st--sm .st__k { margin-bottom: 0.2rem; }
.st--opp .st__k, .st--opp .st__sub { opacity: 1; }

/* ---------- legend ---------- */
.legend--es { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1.25rem 1.5rem; }
.lg { display: grid; grid-template-columns: 9.5rem minmax(0, 1fr); gap: 0.35rem 0.9rem; align-items: start; }
.lg dt { margin: 0; }
.lg dd { margin: 0; font-size: 0.93rem; color: #2c4356; }
.lg dd b { display: block; font-size: 0.98rem; color: var(--ink); }
.lg dd i { display: block; margin-top: 0.3rem; font: 500 0.74rem/1.35 var(--f-mono); color: var(--muted); font-style: normal; }
@media (max-width: 1040px) { .legend--es { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 680px) { .legend--es { grid-template-columns: 1fr; } .lg { grid-template-columns: 8.5rem minmax(0, 1fr); } }
.legend--mini { display: flex; flex-wrap: wrap; gap: 0.5rem 0.7rem; align-items: center; margin: 0 0 1.25rem; }
.legend--mini .st { padding: 0.28rem 0.5rem; font: 650 0.64rem/1.1 var(--f-mono); letter-spacing: 0.06em; text-transform: uppercase; }
.legend--mini .st--hot { transform: none; }
.legend--mini .st { min-height: 0; }
.es .ehero .meta { margin-bottom: 1.6rem; }

/* ---------- the home section ---------- */
.es-home { background: var(--es-paper); position: relative; }
.es-home::before { content: ""; position: absolute; inset: 0; background: repeating-linear-gradient(180deg, transparent 0 31px, rgba(20, 68, 108, 0.05) 31px 32px); pointer-events: none; }
.es-home > .wrap { position: relative; }
.es-home .sec-lede strong { color: var(--ink); }
.es-steps { margin: 0 0 2.25rem; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1.25rem; counter-reset: ess; }
.es-steps li { counter-increment: ess; padding-top: 0.2rem; font-size: 0.98rem; color: #2c4356; }
.es-steps li::before { content: counter(ess); display: inline-grid; place-items: center; width: 1.7rem; height: 1.7rem; margin-bottom: 0.4rem; border-radius: 99px; background: var(--ink); color: #fff; font: 700 0.8rem var(--f-mono); }
.es-steps b { display: block; font-size: 1.04rem; color: var(--ink); margin-bottom: 0.15rem; }
@media (max-width: 860px) { .es-steps { grid-template-columns: 1fr; } }
.es-demo { margin: 0 0 2.25rem; }
.es-demo h3 { font-size: 1.05rem; font-weight: 680; margin-bottom: 0.7rem; }
.es-home .engband { border-top-color: var(--line-strong); }
.es-home .engband > div + div { border-left-color: var(--line); }
.es-home .engband dt { color: var(--muted); }
.es-home .engband dd { color: var(--navy); }
.es-home .caveat { border-color: var(--line-strong); color: #2c4356; background: #fff; }
.es-home .caveat strong { color: var(--ink); }
.es-home .caveat a { color: var(--blue); }

/* ---------- the board: one row = one small story ---------- */
.board { display: grid; gap: 1.1rem; margin: 0; padding: 0; list-style: none; }
.brow { padding: 1rem 1.1rem 1.1rem; background: var(--es-paper); border: 1px solid var(--line-strong); border-radius: 12px; box-shadow: 0 1px 0 rgba(255, 255, 255, 0.8) inset; }
.brow--demo { background: #fff; }
.brow__head--demo { grid-template-columns: minmax(0, 1fr); }
.brow__head--demo p { grid-column: 1; }
.brow__head { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 0.1rem 0.8rem; align-items: baseline; margin-bottom: 0.9rem; }
.brow__n { grid-row: span 2; align-self: start; display: grid; place-items: center; min-width: 1.9rem; height: 1.9rem; border-radius: 99px; background: var(--ink); color: #fff; font: 700 0.8rem var(--f-mono); }
.brow__head h3, .brow__head h4 { margin: 0; font-size: 1.1rem; font-weight: 690; letter-spacing: -0.01em; }
.brow__head p { margin: 0; color: #2c4356; font-size: 0.97rem; max-width: 62rem; }
.bgrid { display: grid; grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.15fr) minmax(0, 1fr) minmax(0, 0.95fr) minmax(0, 1.3fr) minmax(0, 1.45fr); gap: 0.9rem 1.5rem; align-items: start; }
.bcell { position: relative; display: flex; flex-direction: column; gap: 0.5rem; min-width: 0; }
.bcell--go::after { content: ""; position: absolute; top: 1.35rem; right: -1.15rem; width: 0; height: 0; border-left: 0.5rem solid var(--line-strong); border-top: 0.32rem solid transparent; border-bottom: 0.32rem solid transparent; }
.bhead { display: grid; grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.15fr) minmax(0, 1fr) minmax(0, 0.95fr) minmax(0, 1.3fr) minmax(0, 1.45fr); gap: 0 1.5rem; margin: 0 0 0.6rem; padding: 0 1.1rem; font: 600 0.7rem/1.25 var(--f-mono); letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); }
.bhead span { display: block; padding-bottom: 0.4rem; border-bottom: 2px solid var(--line-strong); }
.bhead small { display: block; margin-top: 0.15rem; font: 500 0.66rem/1.2 var(--f-mono); text-transform: none; letter-spacing: 0; }
.pair { display: flex; flex-direction: column; gap: 0.25rem; }
.pair .st--policy { margin-left: 0.7rem; }
.brow__src { margin: 0.8rem 0 0; color: var(--muted); font: 500 0.72rem/1.5 var(--f-mono); }
.brow__src a { color: var(--muted); }
@media (max-width: 1180px) {
  .bhead { display: none; }
  .bgrid { grid-template-columns: 1fr; gap: 0.55rem; }
  .bcell:empty { display: none; }
  .bcell { max-width: 30rem; }
  .bcell--go::after { top: auto; bottom: -0.55rem; right: auto; left: 1.2rem; border: 0; border-top: 0.45rem solid var(--line-strong); border-left: 0.32rem solid transparent; border-right: 0.32rem solid transparent; }
}

.pivot { display: flex; flex-wrap: wrap; align-items: stretch; gap: 0.6rem 2rem; margin: 0 0 1.5rem; padding: 0; list-style: none; }
.pivot li { position: relative; }
.pivot li + li::before { content: ""; position: absolute; left: -1.45rem; top: 50%; width: 0; height: 0; border-left: 0.55rem solid var(--ink); border-top: 0.36rem solid transparent; border-bottom: 0.36rem solid transparent; transform: translateY(-50%); }
.pivot li + li::after { content: ""; position: absolute; left: -1.9rem; top: 50%; width: 1.4rem; height: 2px; background: var(--ink); transform: translateY(-50%); z-index: -1; }
.pivot .st { padding: 0.65rem 0.8rem; }
@media (max-width: 700px) {
  .pivot { flex-direction: column; align-items: flex-start; gap: 1.5rem; }
  .pivot li + li::before { left: 1.4rem; top: -1.15rem; transform: none; border: 0; border-top: 0.6rem solid var(--ink); border-left: 0.38rem solid transparent; border-right: 0.38rem solid transparent; }
  .pivot li + li::after { left: calc(1.4rem + 0.38rem - 1px); top: -1.4rem; width: 2px; height: 0.4rem; transform: none; }
}
.ctxnear { display: flex; flex-wrap: wrap; gap: 0.4rem 0.5rem; margin: 0 0 0.35rem; }
.ctxnear a { display: inline-flex; align-items: center; min-height: 36px; padding: 0.25rem 0.6rem; border-radius: 4px; background: var(--es-system); color: var(--es-system-ink); border: 1px solid var(--es-system-edge); font: 600 0.72rem var(--f-mono); text-decoration: none; }
.ctxnear a:hover { background: #fff; }
.nearh { margin: 1rem 0 0.4rem; font: 600 0.74rem var(--f-mono); letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }

.hots { display: grid; grid-template-columns: repeat(auto-fill, minmax(17rem, 1fr)); gap: 1.4rem 1.25rem; margin: 0; padding: 0; list-style: none; }
.hots .st { padding: 0.8rem 0.85rem; }
.hots .hots__src { margin: 0.55rem 0 0; font: 500 0.7rem/1.4 var(--f-mono); color: var(--muted); overflow-wrap: anywhere; }
.hots .hots__src a { color: var(--muted); }
.mnote { max-width: 52rem; margin: 0; padding: 0.9rem 1.1rem; border-left: 4px solid var(--amber); background: #fff; border-radius: 0 8px 8px 0; color: #24394b; font-size: 0.97rem; }

/* ---------- the big picture: one long paper roll, left to right ---------- */
.bp { position: relative; margin: 0 0 1rem; border: 1px solid var(--line-strong); border-radius: 14px; background:
  repeating-linear-gradient(180deg, transparent 0 31px, rgba(20, 68, 108, 0.045) 31px 32px), var(--es-paper); overflow-x: auto; overscroll-behavior-x: contain; }
.bp:focus-visible { outline-offset: 2px; }
.bp__track { display: flex; min-width: max-content; margin: 0; padding: 0; list-style: none; }
.bph { flex: none; width: 19rem; padding: 1rem 1rem 1.25rem; border-right: 2px dashed var(--line-strong); }
.bph:last-child { border-right: 0; }
.bph__n { display: inline-block; font: 650 0.7rem/1 var(--f-mono); letter-spacing: 0.1em; text-transform: uppercase; color: var(--deep); }
.bph h3 { margin: 0.35rem 0 0.4rem; font-size: 1.18rem; line-height: 1.15; letter-spacing: -0.015em; }
.bph__plain { margin: 0 0 0.9rem; font-size: 0.9rem; line-height: 1.45; color: #2c4356; min-height: 5.6rem; }
.bph__lane { margin: 0.9rem 0 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 0.45rem; }
.bph__lane--row { flex-direction: row; flex-wrap: wrap; }
.bph__lane--row > li { flex: 0 1 auto; max-width: 100%; }
.bph__h { margin: 1rem 0 0.4rem; font: 650 0.62rem/1 var(--f-mono); letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.bph ol.bph__lane { position: relative; gap: 0.7rem; }
.bph ol.bph__lane > li + li::before { content: ""; position: absolute; left: 1.1rem; margin-top: -0.7rem; width: 2px; height: 0.7rem; background: var(--ink); opacity: 0.35; }
.bph .st__ctx { display: block; margin-top: 0.3rem; font: 500 0.64rem/1.2 var(--f-mono); opacity: 0.8; }
.bph .chips { display: flex; flex-wrap: wrap; gap: 0.3rem; margin: 0; padding: 0; list-style: none; }
.bph .chips a { display: inline-flex; align-items: center; min-height: 32px; padding: 0.15rem 0.5rem; border-radius: 4px; border: 1px solid var(--line-strong); background: #fff; color: var(--ink); font: 600 0.66rem var(--f-mono); text-decoration: none; }
.bph .chips a:hover { border-color: var(--ink); }
.bp__hint { margin: 0 0 0.6rem; font: 500 0.78rem var(--f-mono); color: var(--muted); }
.bp__ribbon { display: flex; flex-wrap: wrap; gap: 0.3rem; margin: 0 0 1rem; padding: 0; list-style: none; }
.bp__ribbon a { display: inline-flex; align-items: center; gap: 0.45rem; min-height: 44px; padding: 0.35rem 0.8rem; border-radius: 99px; border: 1px solid var(--line-strong); background: #fff; font-weight: 600; font-size: 0.86rem; text-decoration: none; }
.bp__ribbon a:hover { border-color: var(--ink); }
.bp__ribbon b { display: grid; place-items: center; width: 1.45rem; height: 1.45rem; border-radius: 99px; background: var(--ink); color: #fff; font: 700 0.7rem var(--f-mono); }
@media (max-width: 900px) {
  .bp { overflow: visible; border: 0; background: none; }
  .bp__track { display: block; min-width: 0; }
  .bph { width: auto; border-right: 0; border-bottom: 2px dashed var(--line-strong); padding-inline: 0; }
  .bph__plain { min-height: 0; }
  .bp__hint { display: none; }
}

/* ---------- index of boards ---------- */
.ctxgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(18.5rem, 1fr)); gap: 0.9rem; margin: 0 0 2rem; padding: 0; list-style: none; }
.ctxcard { display: flex; flex-direction: column; height: 100%; padding: 0.95rem 1rem 0.9rem; background: #fff; border: 1px solid var(--line-strong); border-radius: 10px; text-decoration: none; color: var(--ink); }
.ctxcard:hover { border-color: var(--ink); box-shadow: 0 10px 20px -14px rgba(11, 29, 45, 0.6); }
.ctxcard b { font: 650 0.92rem var(--f-mono); letter-spacing: -0.01em; overflow-wrap: anywhere; }
.ctxcard span { margin-top: 0.35rem; color: #2c4356; font-size: 0.92rem; line-height: 1.4; flex: 1; }
.ctxcard small { margin-top: 0.7rem; font: 500 0.7rem var(--f-mono); color: var(--muted); }
.ctxcard i { display: inline-block; margin-left: 0.4rem; padding: 0.05rem 0.4rem; border-radius: 4px; background: color-mix(in srgb, var(--blue) 10%, #fff); color: var(--navy); font: 600 0.62rem var(--f-mono); font-style: normal; letter-spacing: 0.04em; text-transform: uppercase; vertical-align: 0.1em; }
.progh { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.4rem 1rem; margin: 2rem 0 0.8rem; }
.progh h3 { margin: 0; }
.progh p { margin: 0; color: var(--muted); font-size: 0.93rem; }

.lvl { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; margin: 0 0 1.5rem; padding: 0; list-style: none; }
.lvl li { padding: 1rem 1.1rem; background: #fff; border: 1px solid var(--line-strong); border-radius: 10px; font-size: 0.95rem; color: #2c4356; }
.lvl li b { display: block; margin-bottom: 0.15rem; font-size: 1.04rem; color: var(--ink); }
.lvl li em { display: block; margin-top: 0.4rem; font: 500 0.78rem var(--f-mono); font-style: normal; color: var(--muted); }
.lvl li.is-here { border: 2px solid var(--ink); }
@media (max-width: 860px) { .lvl { grid-template-columns: 1fr; } }
.how { max-width: 62rem; display: grid; gap: 0.5rem; margin: 1.25rem 0 1.25rem; padding: 0 0 0 1.4rem; color: #2c4356; list-style: disc; }
ol.how { list-style: decimal; }
.how li::marker { color: var(--deep); font-weight: 700; }
.srcs { max-width: 52rem; margin: 0; padding-left: 1.1rem; color: #2c4356; font-size: 0.95rem; }
.srcs li { margin-bottom: 0.3rem; }

@media (prefers-reduced-motion: reduce) { a.st:hover { transform: none; } }
@media print { .st { box-shadow: none; } .bp { overflow: visible; } .bp__track { flex-wrap: wrap; } }
