/**
 * MB Enterprise — Ember Loom
 * Suite design tokens + homepage presentation desk
 * Cool mist canvas · charcoal ink · ember accent · chapter-index nav
 */
@import url("https://fonts.googleapis.com/css2?family=Outfit:wght@500;600;700;800&family=Karla:wght@400;500;600;700&display=swap");

:root {
  --em-canvas: #eef1f6;
  --em-surface: #ffffff;
  --em-ink: #10141c;
  --em-mute: #3f4754;
  --em-line: rgba(16, 20, 28, 0.1);
  --em-ember: #e85d04;
  --em-ember-deep: #c24b00;
  --em-pool: #1b6ca8;
  --em-pool-soft: rgba(27, 108, 168, 0.12);
  --em-ember-soft: rgba(232, 93, 4, 0.12);
  --em-radius: 10px;
  --em-radius-lg: 16px;
  --em-display: "Outfit", system-ui, sans-serif;
  --em-body: "Karla", system-ui, sans-serif;
  --em-ease: cubic-bezier(0.22, 1, 0.36, 1);
  --em-shadow: 0 14px 40px rgba(16, 20, 28, 0.08);
  --em-chapter-w: 15.5rem;
  --em-max: 1120px;
}

*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body.em-home {
  margin: 0;
  min-height: 100vh;
  font-family: var(--em-body);
  color: var(--em-ink);
  background:
    radial-gradient(900px 480px at 12% -8%, rgba(232, 93, 4, 0.09), transparent 55%),
    radial-gradient(720px 420px at 100% 18%, rgba(27, 108, 168, 0.1), transparent 50%),
    linear-gradient(180deg, #f4f6fa 0%, var(--em-canvas) 42%, #e8ecf3 100%);
  -webkit-font-smoothing: antialiased;
}

body.em-home.has-kb-nav { padding-bottom: 0 !important; }
body.em-home .kb-keybed,
body.em-home .ob-dock { display: none !important; }

/* Shared canopy/orbit is the site navbar — hide the home chapter rail / mobile chapter drawer */
body.has-ob-canopy.em-home .em-desk {
  grid-template-columns: 1fr;
}
body.has-ob-canopy.em-home .em-chapters,
body.has-ob-canopy.em-home .em-chapters-toggle,
body.has-ob-canopy.em-home .em-chapter-drawer {
  display: none !important;
}
body.has-ob-canopy.em-home:not(.has-mb-orbit) .em-stage {
  max-width: none;
  padding-top: clamp(1rem, 2.5vw, 1.75rem);
}
body.has-ob-canopy.has-mb-orbit.em-home .em-stage {
  padding-top: clamp(1rem, 2.5vw, 1.75rem);
}

body.em-home a { color: inherit; text-decoration: none; }
body.em-home img {
  max-width: 100%;
  height: auto;
  display: block;
  background: #e4e8ef;
}
body.em-home button { font: inherit; }

.visually-hidden {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); border: 0;
}

.em-desk {
  position: relative;
  display: grid;
  grid-template-columns: var(--em-chapter-w) minmax(0, 1fr);
  min-height: 100vh;
}

.em-grain {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: 0.035;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ── Chapter index nav (non-traditional) ─────────────────────── */

.em-chapters {
  position: sticky;
  top: 0;
  z-index: 20;
  align-self: start;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: 1.35rem 1rem 1.5rem;
  border-right: 1px solid var(--em-line);
  background: linear-gradient(180deg, #f7f8fb 0%, var(--em-canvas) 100%);
}

.em-chapters-brand {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  transition: transform 0.35s var(--em-ease);
}
.em-chapters-brand:hover { transform: translateX(3px); }

.em-mark {
  display: grid;
  place-items: center;
  width: 2.5rem;
  height: 2.5rem;
  flex-shrink: 0;
  font-family: var(--em-display);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: #fff;
  background: var(--em-ink);
  border-radius: 8px;
  transition: background 0.3s var(--em-ease), color 0.3s;
}
.em-chapters-brand:hover .em-mark {
  background: var(--em-ember);
}

.em-chapters-word {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
  min-width: 0;
}
.em-chapters-word strong {
  font-family: var(--em-display);
  font-size: 0.92rem;
  font-weight: 700;
}
.em-chapters-word em {
  font-style: normal;
  font-size: 0.72rem;
  color: var(--em-mute);
}

.em-chapters-label {
  margin: 0.5rem 0 0;
  font-size: 0.68rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--em-mute);
}

.em-chapter-list {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  flex: 1;
  overflow-y: auto;
}

.em-chapter {
  position: relative;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 0.65rem;
  align-items: center;
  padding: 0.7rem 0.55rem;
  border-radius: var(--em-radius);
  transition: background 0.3s var(--em-ease), transform 0.3s var(--em-ease);
}
.em-chapter::before {
  content: "";
  position: absolute;
  left: 0;
  top: 20%;
  bottom: 20%;
  width: 3px;
  border-radius: 3px;
  background: var(--em-ember);
  transform: scaleY(0);
  transition: transform 0.35s var(--em-ease);
}
.em-chapter:hover,
.em-chapter.is-live {
  background: var(--em-surface);
  box-shadow: var(--em-shadow);
  transform: translateX(4px);
}
.em-chapter:hover::before,
.em-chapter.is-live::before { transform: scaleY(1); }

.em-chapter-n {
  font-family: var(--em-display);
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--em-ember);
  min-width: 1.5rem;
}
.em-chapter-body {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}
.em-chapter-body strong {
  font-family: var(--em-display);
  font-size: 0.95rem;
  font-weight: 700;
}
.em-chapter-body em {
  font-style: normal;
  font-size: 0.72rem;
  color: var(--em-mute);
}
.em-chapter-arrow {
  width: 0.45rem;
  height: 0.45rem;
  border-right: 2px solid var(--em-mute);
  border-bottom: 2px solid var(--em-mute);
  transform: rotate(-45deg);
  opacity: 0;
  transition: opacity 0.3s, transform 0.3s var(--em-ease);
}
.em-chapter:hover .em-chapter-arrow {
  opacity: 1;
  transform: rotate(-45deg) translate(2px, 2px);
}

.em-chapters-tools {
  display: grid;
  gap: 0.4rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--em-line);
}
.em-tool {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.65rem 0.75rem;
  border-radius: var(--em-radius);
  border: 1px solid var(--em-line);
  background: var(--em-surface);
  font-size: 0.88rem;
  font-weight: 600;
  transition: border-color 0.25s, background 0.25s, color 0.25s;
}
.em-tool:hover {
  border-color: var(--em-ink);
  background: var(--em-ink);
  color: #fff;
}
.em-tool i {
  font-style: normal;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.15rem 0.4rem;
  border-radius: 6px;
  background: var(--em-ember);
  color: #fff;
}

.em-chapters-toggle {
  display: none;
  position: fixed;
  top: 0.85rem;
  left: 0.85rem;
  z-index: 40;
  align-items: center;
  flex-direction: row;
  gap: 0.55rem;
  padding: 0.6rem 0.95rem;
  border: 1px solid var(--em-line);
  border-radius: var(--em-radius);
  background: var(--em-surface);
  color: var(--em-ink);
  box-shadow: var(--em-shadow);
  cursor: pointer;
  font-family: var(--em-display);
  font-weight: 700;
  font-size: 0.85rem;
}
.em-chapters-toggle-bars {
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: 1rem;
}
.em-chapters-toggle span,
.em-chapters-toggle-bars span {
  display: block;
  width: 1rem;
  height: 2px;
  background: var(--em-ink);
  border-radius: 2px;
}
.em-chapters-toggle span + span { margin-top: 0; }

.em-chapter-drawer {
  position: fixed;
  inset: 3.75rem 0.85rem auto;
  z-index: 39;
  display: grid;
  gap: 0.25rem;
  padding: 0.85rem;
  border-radius: var(--em-radius-lg);
  border: 1px solid var(--em-line);
  background: var(--em-surface);
  color: var(--em-ink);
  box-shadow: var(--em-shadow);
}
.em-chapter-drawer[hidden] { display: none !important; }
.em-chapter-drawer a {
  display: flex;
  gap: 0.65rem;
  padding: 0.7rem 0.75rem;
  border-radius: var(--em-radius);
  font-weight: 600;
  color: var(--em-ink);
}
.em-chapter-drawer a:hover { background: var(--em-ember-soft); color: var(--em-ink); }
.em-chapter-drawer b { color: var(--em-ember); font-family: var(--em-display); }

/* ── Stage / dashboard ───────────────────────────────────────── */

.em-stage {
  position: relative;
  z-index: 1;
  padding: clamp(1.25rem, 3vw, 2rem) clamp(1rem, 3vw, 2rem) 3rem;
  min-width: 0;
  max-width: calc(var(--em-max) + 4rem);
}

.em-mast {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: clamp(1.25rem, 3vw, 2rem);
  align-items: stretch;
  margin-bottom: 1.75rem;
  animation: emFadeUp 0.7s var(--em-ease) both;
}

@keyframes emFadeUp {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: none; }
}

.em-kicker {
  margin: 0 0 0.45rem;
  font-size: 0.72rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--em-pool);
  font-weight: 600;
}

.em-brand {
  margin: 0 0 0.75rem;
  font-family: var(--em-display);
  font-size: clamp(2.4rem, 6vw, 4.2rem);
  font-weight: 800;
  line-height: 0.95;
  letter-spacing: -0.03em;
}

.em-lede {
  margin: 0 0 1.35rem;
  max-width: 34rem;
  font-size: 1.05rem;
  line-height: 1.55;
  color: var(--em-mute);
}

.em-actions { display: flex; flex-wrap: wrap; gap: 0.65rem; }

.em-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.8rem 1.35rem;
  border-radius: var(--em-radius);
  font-family: var(--em-display);
  font-weight: 700;
  font-size: 0.92rem;
  border: 1.5px solid transparent;
  color: var(--em-ink);
  background: var(--em-surface);
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.3s var(--em-ease), background 0.25s, color 0.25s, box-shadow 0.3s, border-color 0.25s;
}
.em-btn--ember {
  background: var(--em-ember);
  color: #ffffff;
  box-shadow: 0 8px 24px rgba(232, 93, 4, 0.28);
}
.em-btn--ember:hover,
.em-btn--ember:focus-visible {
  background: var(--em-ember-deep);
  color: #ffffff;
  transform: translateY(-3px);
  box-shadow: 0 12px 28px rgba(232, 93, 4, 0.35);
}
.em-btn--ghost {
  background: #ffffff;
  border-color: var(--em-line);
  color: var(--em-ink);
}
.em-btn--ghost:hover,
.em-btn--ghost:focus-visible {
  border-color: var(--em-ink);
  color: var(--em-ink);
  background: #ffffff;
  transform: translateY(-3px);
}
.em-btn--sm {
  padding: 0.5rem 0.9rem;
  font-size: 0.82rem;
}
.em-btn:disabled,
.em-btn.is-disabled,
.em-btn[aria-disabled="true"] {
  background: #dfe3ea !important;
  color: #4a5360 !important;
  border-color: #c5cad3 !important;
  box-shadow: none !important;
  cursor: not-allowed;
  transform: none !important;
  opacity: 1;
}

/* Dark-panel ghost buttons (white label on charcoal) */
.em-acc-id .em-btn--ghost,
.em-shop-foot .em-btn--ghost,
.em-help-card .em-btn--ghost,
.em-ord-gate-aside .em-btn--ghost,
[class*="em-"][class*="-aside"] .em-btn--ghost,
.em-foot .em-btn--ghost {
  background: transparent;
  border-color: rgba(255, 255, 255, 0.45);
  color: #ffffff;
}
.em-acc-id .em-btn--ghost:hover,
.em-shop-foot .em-btn--ghost:hover,
.em-help-card .em-btn--ghost:hover,
.em-ord-gate-aside .em-btn--ghost:hover,
.em-foot .em-btn--ghost:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: #ffffff;
  color: #ffffff;
}

/* Form readability */
input::placeholder,
textarea::placeholder,
select::placeholder {
  color: #5a6472;
  opacity: 1;
}
input,
textarea,
select {
  color: var(--em-ink);
}
label,
.em-kicker {
  color: inherit;
}

.em-hero-plate {
  position: relative;
  display: block;
  border-radius: var(--em-radius-lg);
  overflow: hidden;
  background: var(--em-ink);
  color: #fff;
  box-shadow: var(--em-shadow);
  transition: transform 0.45s var(--em-ease), box-shadow 0.45s;
  min-height: clamp(280px, 42vw, 420px);
  isolation: isolate;
}
.em-hero-plate:hover {
  transform: translateY(-6px) rotate(-0.4deg);
  box-shadow: 0 22px 50px rgba(16, 20, 28, 0.18);
}
.em-hero-plate-media {
  position: absolute;
  inset: 0;
  z-index: 0;
  background:
    linear-gradient(145deg, #1a2230, #10141c);
}
.em-hero-plate-media img {
  width: 100%;
  height: 100%;
  max-width: none;
  object-fit: cover;
  object-position: center;
  transition: transform 0.6s var(--em-ease);
}
.em-hero-plate:hover .em-hero-plate-media img { transform: scale(1.05); }
.em-hero-plate-meta {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1;
  display: grid;
  gap: 0.25rem;
  padding: 3.5rem 1.25rem 1.25rem;
  background: linear-gradient(180deg, rgba(16, 20, 28, 0) 0%, rgba(16, 20, 28, 0.72) 42%, rgba(16, 20, 28, 0.96) 100%);
  margin-top: 0;
}
.em-hero-plate-meta span {
  font-size: 0.68rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #ffb088;
  font-weight: 700;
}
.em-hero-plate-meta strong {
  font-family: var(--em-display);
  font-size: 1.15rem;
  color: #ffffff;
}
.em-hero-plate-meta em {
  font-style: normal;
  color: #ffb088;
  font-weight: 700;
}

/* Metrics */
.em-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.75rem;
  margin-bottom: 2rem;
}
.em-metric {
  padding: 1rem 1.1rem;
  border-radius: var(--em-radius);
  background: var(--em-surface);
  border: 1px solid var(--em-line);
  display: grid;
  gap: 0.15rem;
  opacity: 0;
  animation: emFadeUp 0.6s var(--em-ease) calc(0.08s * var(--em-i, 0) + 0.15s) forwards;
  transition: transform 0.3s var(--em-ease), border-color 0.3s;
}
.em-metric:hover {
  transform: translateY(-4px);
  border-color: var(--em-ember);
}
.em-metric span {
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--em-mute);
}
.em-metric strong {
  font-family: var(--em-display);
  font-size: 1.55rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}
.em-metric em {
  font-style: normal;
  font-size: 0.78rem;
  color: var(--em-pool);
}

.em-sec-head {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 1rem;
  margin-bottom: 1rem;
}
.em-sec-head h2 {
  margin: 0;
  font-family: var(--em-display);
  font-size: clamp(1.45rem, 2.5vw, 1.85rem);
  font-weight: 700;
}
.em-textlink {
  font-weight: 700;
  color: var(--em-pool);
  transition: color 0.2s, transform 0.2s;
}
.em-textlink:hover {
  color: var(--em-ember);
  transform: translateX(3px);
}

.em-board { margin-bottom: 2.25rem; }
.em-board-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.75rem;
}
.em-pin {
  position: relative;
  display: grid;
  gap: 0.65rem;
  padding: 0.75rem;
  border-radius: var(--em-radius-lg);
  background: var(--em-surface);
  border: 1px solid var(--em-line);
  transition: transform 0.35s var(--em-ease), box-shadow 0.35s, border-color 0.35s;
  opacity: 0;
  animation: emFadeUp 0.55s var(--em-ease) calc(0.07s * var(--em-i, 0)) forwards;
}
.em-pin:hover {
  transform: translateY(-5px);
  box-shadow: var(--em-shadow);
  border-color: rgba(232, 93, 4, 0.35);
}
.em-pin-idx {
  position: absolute;
  top: 0.9rem;
  left: 0.9rem;
  z-index: 1;
  font-family: var(--em-display);
  font-size: 0.72rem;
  font-weight: 800;
  padding: 0.25rem 0.4rem;
  border-radius: 6px;
  background: var(--em-ink);
  color: #fff;
}
.em-pin img {
  width: 100%;
  aspect-ratio: 1;
  height: auto;
  object-fit: cover;
  object-position: center;
  border-radius: 8px;
  background: #e4e8ef;
}
.em-pin strong {
  display: block;
  font-family: var(--em-display);
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1.25;
}
.em-pin em {
  font-style: normal;
  font-weight: 700;
  color: var(--em-ember);
}

.em-corridors { margin-bottom: 2.25rem; }
.em-corridor-track {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem;
}
.em-corridor {
  position: relative;
  overflow: hidden;
  min-height: 180px;
  padding: 1.1rem;
  border-radius: var(--em-radius-lg);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 0.2rem;
  border: 1px solid var(--em-line);
  transition: transform 0.35s var(--em-ease), box-shadow 0.35s;
  opacity: 0;
  animation: emFadeUp 0.55s var(--em-ease) calc(0.06s * var(--em-i, 0)) forwards;
}
.em-corridor img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  object-fit: cover;
  object-position: center;
  opacity: 0.62;
  transition: opacity 0.4s, transform 0.5s var(--em-ease);
}
.em-corridor::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  background: linear-gradient(180deg, rgba(255,255,255,0.15) 0%, rgba(255,255,255,0.88) 62%, rgba(255,255,255,0.97) 100%);
  pointer-events: none;
}
.em-corridor:hover {
  transform: translateY(-4px);
  box-shadow: var(--em-shadow);
}
.em-corridor:hover img {
  opacity: 0.82;
  transform: scale(1.05);
}
.em-corridor--ember { background: linear-gradient(155deg, #fff7f2, #fff); }
.em-corridor--pool { background: linear-gradient(155deg, #f0f7fc, #fff); }
.em-corridor--ink { background: linear-gradient(155deg, #f2f3f5, #fff); }
.em-corridor-code,
.em-corridor strong,
.em-corridor em { position: relative; z-index: 1; }
.em-corridor-code {
  font-family: var(--em-display);
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  color: var(--em-ember);
}
.em-corridor--pool .em-corridor-code { color: var(--em-pool); }
.em-corridor strong {
  font-family: var(--em-display);
  font-size: 1rem;
  font-weight: 700;
}
.em-corridor em {
  font-style: normal;
  font-size: 0.85rem;
  color: var(--em-mute);
}

.em-pulse { margin-bottom: 2.5rem; }
.em-pulse-row {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(160px, 1fr);
  gap: 0.75rem;
  overflow-x: auto;
  padding-bottom: 0.5rem;
  scroll-snap-type: x mandatory;
  scrollbar-width: thin;
  scrollbar-color: rgba(232, 93, 4, 0.45) transparent;
}
.em-pulse-card {
  scroll-snap-align: start;
  padding: 0.65rem;
  border-radius: var(--em-radius);
  background: var(--em-surface);
  border: 1px solid var(--em-line);
  transition: transform 0.3s var(--em-ease), border-color 0.3s;
}
.em-pulse-card:hover {
  transform: translateY(-4px) scale(1.01);
  border-color: var(--em-pool);
}
.em-pulse-card img {
  width: 100%;
  aspect-ratio: 1;
  height: auto;
  object-fit: cover;
  object-position: center;
  border-radius: 8px;
  margin-bottom: 0.55rem;
  background: #e4e8ef;
}
.em-pulse-card strong {
  display: block;
  font-size: 0.88rem;
  font-family: var(--em-display);
  font-weight: 700;
  margin-bottom: 0.15rem;
}
.em-pulse-card em {
  font-style: normal;
  color: var(--em-ember);
  font-weight: 700;
  font-size: 0.88rem;
}

.em-home-foot {
  display: grid;
  gap: 1rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--em-line);
}
.em-home-foot-brand {
  display: flex;
  gap: 0.85rem;
  align-items: flex-start;
  max-width: 36rem;
}
.em-home-foot-brand strong {
  display: block;
  font-family: var(--em-display);
  font-size: 1.05rem;
}
.em-home-foot-brand p {
  margin: 0.3rem 0 0;
  color: var(--em-mute);
  font-size: 0.9rem;
}
.em-home-foot nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem 1.15rem;
}
.em-home-foot nav a {
  color: var(--em-mute);
  font-weight: 600;
  position: relative;
}
.em-home-foot nav a::after {
  content: "";
  position: absolute;
  left: 0;
  right: 100%;
  bottom: -2px;
  height: 2px;
  background: var(--em-ember);
  transition: right 0.3s var(--em-ease);
}
.em-home-foot nav a:hover { color: var(--em-ink); }
.em-home-foot nav a:hover::after { right: 0; }
.em-home-copy {
  margin: 0;
  font-size: 0.82rem;
  color: var(--em-mute);
}

/* Rise helper when JS adds .is-in */
[data-em-rise].is-in { opacity: 1; }

@media (max-width: 980px) {
  .em-desk { grid-template-columns: 1fr; }
  .em-chapters { display: none; }
  .em-chapters-toggle { display: inline-flex; }
  .em-stage { padding-top: 4.25rem; max-width: none; }
  .em-mast { grid-template-columns: 1fr; }
  .em-hero-plate { min-height: 280px; }
  .em-metrics { grid-template-columns: repeat(2, 1fr); }
  .em-board-grid { grid-template-columns: repeat(2, 1fr); }
  .em-corridor-track { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 560px) {
  .em-board-grid,
  .em-corridor-track { grid-template-columns: 1fr; }
  .em-metrics { grid-template-columns: 1fr 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
  .em-metric, .em-pin, .em-corridor { opacity: 1; }
}

/* ═══ Shared Ember canopy chrome (light desk — replaces Obsidian shell) ═══ */
body.em-shared {
  margin: 0;
  min-height: 100vh;
  font-family: var(--em-body);
  color: var(--em-ink);
  background: var(--em-canvas);
  -webkit-font-smoothing: antialiased;
}
.em-shell { min-height: 100vh; display: flex; flex-direction: column; }
.em-bare-main { min-height: 100vh; display: block; }
.em-main--flush {
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 0;
}
/* Shared canopy is the primary nav — hide duplicate page brand marks */
.has-ob-canopy .em-acc-brand { display: none; }
.has-ob-canopy .em-shop-top,
.has-ob-canopy .em-cart-top,
.has-ob-canopy .em-acc-top,
.has-ob-canopy .em-ab-top,
.has-ob-canopy .em-cat-top,
.has-ob-canopy .em-ct-top,
.has-ob-canopy .em-pd-top,
.has-ob-canopy .em-help-top,
.has-ob-canopy .em-track-top,
.has-ob-canopy .em-ord-top,
.has-ob-canopy .em-chk-top,
.has-ob-canopy .em-st-top,
.has-ob-canopy .em-ok-top {
  gap: 0.75rem;
}
.em-skip {
  position: absolute; left: -999px; top: 0; background: var(--em-ember); color: #fff;
  padding: 0.5rem 0.85rem; z-index: 100; border-radius: 0 0 8px 0;
}
.em-skip:focus { left: 0; }
.em-stage-wrap { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.em-main {
  flex: 1;
  width: min(100% - 1.5rem, var(--em-max));
  margin-inline: auto;
  padding: clamp(1.25rem, 3vw, 2rem) 0 2.5rem;
}

/* ═══ Ember Loom warp rail — site navbar (distinct from shared canopy) ═══ */
.em-rail {
  position: sticky;
  top: 0;
  z-index: 50;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.97) 0%, rgba(244,246,250,0.94) 100%);
  border-bottom: 1px solid var(--em-line);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  color: var(--em-ink);
  transition: box-shadow 0.35s var(--em-ease), border-color 0.35s var(--em-ease);
}
.em-rail.is-scrolled {
  border-bottom-color: rgba(232, 93, 4, 0.28);
  box-shadow: 0 10px 28px rgba(16, 20, 28, 0.06);
}
.em-rail-thread {
  height: 3px;
  background: linear-gradient(90deg, var(--em-ember) 0%, var(--em-pool) 55%, transparent 100%);
  transform-origin: left center;
  animation: emRailThread 1.1s var(--em-ease) both;
}
@keyframes emRailThread {
  from { transform: scaleX(0.15); opacity: 0.4; }
  to { transform: scaleX(1); opacity: 1; }
}
.em-rail-inner {
  display: grid;
  grid-template-columns: minmax(0, auto) minmax(0, 1fr) minmax(0, auto);
  align-items: center;
  gap: 1rem 1.5rem;
  width: min(100% - 1.5rem, 1200px);
  margin-inline: auto;
  padding: 0.85rem 0;
}
.em-rail-brand {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  color: inherit;
  text-decoration: none;
  min-width: 0;
}
.em-rail-sig {
  display: grid;
  place-items: center;
  width: 2.65rem;
  height: 2.65rem;
  flex-shrink: 0;
  font-family: var(--em-display);
  font-weight: 800;
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  color: #fff;
  background: var(--em-ink);
  clip-path: polygon(12% 0, 100% 0, 88% 100%, 0 100%);
  transition: background 0.3s var(--em-ease), transform 0.3s var(--em-ease);
}
.em-rail-brand:hover .em-rail-sig {
  background: var(--em-ember);
  transform: translateX(2px);
}
.em-rail-name {
  display: flex;
  flex-direction: column;
  line-height: 1.12;
  min-width: 0;
}
.em-rail-name strong {
  font-family: var(--em-display);
  font-size: clamp(1.05rem, 2vw, 1.35rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--em-ink);
}
.em-rail-name em {
  font-style: normal;
  font-size: 0.72rem;
  color: var(--em-mute);
  letter-spacing: 0.04em;
}
.em-rail-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.15rem 0.35rem;
}
.em-rail-link {
  display: inline-flex;
  align-items: baseline;
  gap: 0.35rem;
  padding: 0.45rem 0.7rem;
  color: var(--em-mute);
  text-decoration: none;
  border-radius: 999px;
  transition: color 0.25s, background 0.25s, transform 0.25s var(--em-ease);
}
.em-rail-link:hover {
  color: var(--em-ink);
  background: rgba(232, 93, 4, 0.08);
  transform: translateY(-1px);
}
.em-rail-link.is-live {
  color: var(--em-ink);
  background: var(--em-surface);
  box-shadow: inset 0 0 0 1px rgba(232, 93, 4, 0.35);
}
.em-rail-num {
  font-family: var(--em-display);
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--em-ember);
  letter-spacing: 0.04em;
}
.em-rail-label {
  font-size: 0.92rem;
  font-weight: 650;
}
.em-rail-tools {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.55rem;
}
.em-rail-seek input {
  width: min(168px, 22vw);
  padding: 0.55rem 0.85rem;
  border: 0;
  border-bottom: 2px solid var(--em-line);
  border-radius: 0;
  background: transparent;
  color: var(--em-ink);
  outline: none;
  font: inherit;
  transition: border-color 0.25s;
}
.em-rail-seek input::placeholder { color: #5a6472; opacity: 1; }
.em-rail-seek input:focus { border-bottom-color: var(--em-ember); }
.em-rail-action {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--em-ink);
  text-decoration: none;
  padding: 0.45rem 0.2rem;
  border-bottom: 2px solid transparent;
  transition: border-color 0.25s, color 0.25s;
}
.em-rail-action:hover { border-bottom-color: var(--em-pool); color: var(--em-pool); }
.em-rail-cart {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.5rem 0.9rem;
  font-size: 0.88rem;
  font-weight: 700;
  color: #fff;
  text-decoration: none;
  background: var(--em-ink);
  clip-path: polygon(8% 0, 100% 0, 92% 100%, 0 100%);
  transition: background 0.25s var(--em-ease), transform 0.25s var(--em-ease);
}
.em-rail-cart:hover { background: var(--em-ember); transform: translateY(-1px); }
.em-rail-cart b {
  font-size: 0.72rem;
  font-weight: 800;
  min-width: 1.15rem;
  height: 1.15rem;
  padding: 0 0.28rem;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: var(--em-ember);
  color: #fff;
}
.em-rail-menu {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 2.5rem;
  height: 2.5rem;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
}
.em-rail-menu span {
  display: block;
  height: 2px;
  margin-inline: 0.45rem;
  background: var(--em-ink);
  border-radius: 2px;
  transition: transform 0.3s var(--em-ease), opacity 0.3s;
}
.em-rail-menu[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.em-rail-menu[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.em-rail-menu[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }
.em-rail-drawer {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 60;
  width: min(20rem, calc(100vw - 2rem));
  height: 100vh;
  padding: 5.5rem 1.15rem 1.5rem;
  background:
    linear-gradient(180deg, #fff 0%, #f4f6fa 100%);
  border-left: 1px solid var(--em-line);
  box-shadow: -18px 0 48px rgba(16, 20, 28, 0.12);
  transform: translateX(0);
  animation: emRailDrawerIn 0.35s var(--em-ease) both;
}
.em-rail-drawer[hidden] { display: none !important; }
@keyframes emRailDrawerIn {
  from { transform: translateX(1.25rem); opacity: 0.4; }
  to { transform: translateX(0); opacity: 1; }
}
.em-rail-drawer-kicker {
  margin: 0 0 0.85rem;
  font-size: 0.68rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--em-mute);
}
.em-rail-drawer nav {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}
.em-rail-drawer a {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.85rem 0.75rem;
  color: var(--em-ink);
  text-decoration: none;
  font-weight: 700;
  font-family: var(--em-display);
  border-radius: 10px;
  transition: background 0.25s, transform 0.25s var(--em-ease);
}
.em-rail-drawer a:hover {
  background: rgba(232, 93, 4, 0.08);
  transform: translateX(3px);
}
.em-rail-drawer b {
  min-width: 1.5rem;
  color: var(--em-ember);
  font-size: 0.82rem;
}
@media (max-width: 980px) {
  .em-rail-inner { grid-template-columns: 1fr auto; }
  .em-rail-nav, .em-rail-seek, .em-rail-action { display: none; }
  .em-rail-menu { display: flex; }
}
@media (min-width: 981px) {
  .em-rail-menu { display: none !important; }
  .em-rail-drawer { display: none !important; }
}
@media (prefers-reduced-motion: reduce) {
  .em-rail-thread, .em-rail-drawer { animation: none; }
}

/* Legacy canopy aliases kept inert so old sheets do not fight the rail */
.ob-canopy, .em-canopy { display: none !important; }
.ob-drawer { display: none !important; }
.ob-skip {
  /* no-op placeholder */
}
