/*
Purpose: professional browser workbench presentation for the Mullusi Playground route.
Governance scope: shared shell alignment, responsive simulator controls, and readable review records.
Dependencies: playground/index.html and assets/styles.css.
Invariants: the demo remains browser-only, canonical fields remain visible, and state meaning is not color-only.
*/

:root {
  --play-live: var(--accent);
  --play-awaiting: var(--accent-warm);
  --play-blocked: var(--danger);
  --play-surface: var(--bg-raise);
  --play-surface-soft: var(--bg-panel);
  --play-rule: var(--line-bright);
}

:root[data-theme="light"] {
  --play-live: #0a5f59;
  --play-awaiting: #864006;
  --play-blocked: #aa2449;
  --play-surface: #ffffff;
  --play-surface-soft: #edf2f7;
  --play-rule: #aab8c8;
}

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
}

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

#main:focus {
  outline: none;
}

.theme-toggle:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.theme-toggle[aria-pressed="true"] .theme-toggle-icon {
  background: linear-gradient(90deg, transparent 0 50%, currentColor 50% 100%);
}

main,
footer {
  position: relative;
  z-index: 2;
  width: min(1180px, calc(100% - 64px));
  margin: 0 auto;
}

main {
  padding: 52px 0 88px;
}

.playground-header {
  width: auto;
  margin: 0;
}

.eyebrow,
.demo-readout span,
.playground-start-row span,
.playground-flow,
.playground-state-grid span,
.playground-section-index,
.review-rail > li > span,
.result-topbar,
.result-summary span,
.review-record dt,
.trace,
.sim-banner {
  font-family: var(--mono);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--play-awaiting);
  font-size: 11px;
}

.eyebrow::before {
  width: 20px;
  height: 1px;
  background: var(--accent-deep);
  content: "";
}

h1,
h2,
h3 {
  color: var(--ink);
  font-family: var(--serif);
  font-weight: 400;
  letter-spacing: 0;
}

h1 {
  max-width: 12ch;
  margin: 16px 0 0;
  font-size: 64px;
  line-height: 0.99;
}

h2 {
  margin: 14px 0 0;
  font-size: 40px;
  line-height: 1.08;
}

p {
  color: var(--ink-soft);
}

.playground-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(340px, 0.85fr);
  gap: 64px;
  align-items: start;
}

.playground-hero-copy,
.demo-readout,
.review-guide-copy,
.sim-layout > div,
form,
.result {
  min-width: 0;
}

.demo-readout {
  border-top: 3px solid var(--play-live);
  background: var(--play-surface);
  box-shadow: var(--shadow);
}

.demo-readout > div {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px;
  align-items: center;
  min-height: 60px;
  border: 1px solid var(--line);
  border-top: 0;
  padding: 14px 18px;
}

.demo-readout span,
.playground-start-row span,
.playground-state-grid span,
.result-summary span {
  color: var(--ink-dim);
  font-size: 9px;
}

.demo-readout strong {
  color: var(--play-live);
  font-family: var(--mono);
  font-size: 11px;
  text-align: right;
}

.lede {
  max-width: 70ch;
  margin: 24px 0 0;
  font-size: 16px;
  line-height: 1.7;
}

.playground-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 28px;
}

.playground-actions a,
form button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  border: 1px solid var(--play-rule);
  background: transparent;
  color: var(--ink);
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.04em;
  padding: 9px 15px;
  text-align: center;
  text-decoration: none;
}

.playground-actions .primary,
form button {
  border-color: var(--play-live);
  background: var(--play-live);
  color: #050609;
  font-weight: 700;
}

.playground-actions a:hover {
  border-color: var(--play-live);
  color: var(--play-live);
}

.playground-actions .primary:hover {
  color: #050609;
}

.playground-start-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-top: 46px;
  border-top: 1px solid var(--play-rule);
  border-bottom: 1px solid var(--play-rule);
}

.playground-start-row > div {
  min-width: 0;
  padding: 17px 20px 18px 0;
}

.playground-start-row > div + div {
  border-left: 1px solid var(--line);
  padding-left: 20px;
}

.playground-start-row strong {
  display: block;
  margin-top: 5px;
  color: var(--ink);
  font-size: 13px;
  overflow-wrap: anywhere;
}

.playground-gate {
  margin-top: 48px;
  border-top: 3px solid var(--play-awaiting);
}

.playground-flow {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  border-right: 1px solid var(--line);
  background: var(--play-surface-soft);
  color: var(--ink-dim);
  font-size: 10px;
}

.playground-flow span,
.playground-flow strong {
  display: flex;
  align-items: center;
  min-height: 48px;
  border-bottom: 1px solid var(--line);
  border-left: 1px solid var(--line);
  padding: 10px 14px;
}

.playground-flow strong {
  color: var(--play-live);
}

.playground-state-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  border-right: 1px solid var(--line);
}

.playground-state-grid > div {
  min-width: 0;
  border-bottom: 1px solid var(--line);
  border-left: 1px solid var(--line);
  padding: 16px 14px;
}

.playground-state-grid strong {
  display: block;
  margin-top: 5px;
  color: var(--ink);
  font-size: 12px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.playground-gate > p {
  margin: 0;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  border-left: 1px solid var(--line);
  padding: 13px 16px;
  font-size: 12px;
}

.playground-canonical-note {
  color: var(--ink-dim);
  font-family: var(--mono);
  font-size: 10px !important;
}

.sim-banner {
  margin: 16px 0 0;
  border-left: 3px solid var(--play-awaiting);
  background: var(--play-surface-soft);
  color: var(--play-awaiting);
  font-size: 10px;
  line-height: 1.55;
  padding: 13px 16px;
}

.playground-section-index {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 54px 0 0;
  border-top: 1px solid var(--play-rule);
  border-bottom: 1px solid var(--play-rule);
  padding: 10px 0;
  font-size: 10px;
  overflow-x: auto;
}

.playground-section-index span {
  flex: 0 0 auto;
  color: var(--play-awaiting);
  padding-right: 8px;
}

.playground-section-index a {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  min-height: 44px;
  border: 1px solid var(--line);
  color: var(--ink-soft);
  padding: 8px 13px;
  text-decoration: none;
}

.playground-section-index a:hover {
  border-color: var(--play-live);
  color: var(--play-live);
}

.noscript-boundary {
  margin-top: 48px;
  border-left: 3px solid var(--play-blocked);
  background: var(--play-surface-soft);
  padding: 20px;
}

.review-guide {
  display: grid;
  grid-template-columns: minmax(260px, 0.72fr) minmax(0, 1.28fr);
  gap: 68px;
  align-items: start;
  padding: 88px 0;
}

.review-guide-copy {
  position: sticky;
  top: 110px;
}

.review-guide-copy h2 {
  max-width: 13ch;
}

.review-rail {
  margin: 0;
  padding: 0;
  list-style: none;
}

.review-rail li {
  display: grid;
  grid-template-columns: 42px minmax(140px, 0.38fr) minmax(0, 1fr);
  gap: 16px;
  align-items: baseline;
  border-top: 1px solid var(--play-rule);
  padding: 20px 0;
}

.review-rail li:last-child {
  border-bottom: 1px solid var(--play-rule);
}

.review-rail > li > span {
  color: var(--play-awaiting);
  font-size: 10px;
}

.review-rail strong {
  color: var(--ink);
  font-size: 14px;
}

.review-rail p {
  margin: 0;
  font-size: 13px;
  line-height: 1.6;
}

#simulator {
  scroll-margin-top: 92px;
  border-top: 1px solid var(--play-rule);
  padding-top: 72px;
}

.sim-layout {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(380px, 1.1fr);
  gap: 68px;
  align-items: start;
}

form {
  display: grid;
  gap: 15px;
  border-top: 3px solid var(--play-live);
  background: var(--play-surface);
  box-shadow: var(--shadow);
  padding: 24px;
}

form label {
  display: grid;
  gap: 7px;
  color: var(--ink-soft);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.04em;
}

select,
input[type="number"] {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--play-rule);
  border-radius: 0;
  background: var(--bg);
  color: var(--ink);
  font: 14px var(--sans);
  padding: 9px 12px;
}

.check {
  grid-template-columns: 22px minmax(0, 1fr);
  align-items: center;
  min-height: 44px;
  border-top: 1px solid var(--line);
  padding-top: 8px;
}

.check input {
  width: 18px;
  height: 18px;
  accent-color: var(--play-live);
}

form button {
  width: 100%;
  margin-top: 3px;
  cursor: pointer;
}

.no-js #sim-form,
.no-js .result {
  display: none !important;
}

.result {
  display: grid;
  gap: 22px;
  margin-top: 48px;
  border-top: 3px solid var(--play-live);
  background: var(--play-surface);
  box-shadow: var(--shadow);
  padding: 24px;
  scroll-margin-top: 92px;
}

.result[hidden] {
  display: none;
}

.result-console {
  border: 1px solid var(--play-rule);
  background: var(--bg);
}

.result-topbar {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--play-rule);
  color: var(--ink-dim);
  font-size: 10px;
  padding: 12px 14px;
}

.result-topbar strong {
  color: var(--play-awaiting);
}

.result-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.result-summary > div {
  min-width: 0;
  border-right: 1px solid var(--line);
  padding: 14px;
}

.result-summary > div:last-child {
  border-right: 0;
}

.result-summary strong {
  display: block;
  margin-top: 6px;
  color: var(--ink);
  font-family: var(--mono);
  font-size: 11px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.review-record {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin: 0;
  border-top: 1px solid var(--play-rule);
  border-left: 1px solid var(--play-rule);
}

.review-record > div {
  min-width: 0;
  border-right: 1px solid var(--play-rule);
  border-bottom: 1px solid var(--play-rule);
  padding: 15px;
}

.review-record dt {
  color: var(--ink-dim);
  font-size: 9px;
}

.review-record dd {
  margin: 6px 0 0;
  color: var(--ink);
  font-size: 13px;
  line-height: 1.55;
  overflow-wrap: anywhere;
}

pre {
  max-height: 420px;
  margin: 0;
  border: 1px solid var(--play-rule);
  background: var(--bg);
  color: var(--play-live);
  font: 11px/1.65 var(--mono);
  overflow: auto;
  padding: 16px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.trace-eyebrow {
  margin-bottom: 12px;
}

.trace {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  color: var(--ink-soft);
  font-size: 10px;
  line-height: 1.55;
  list-style: none;
  text-transform: none;
}

.trace li {
  border-left: 2px solid var(--play-live);
  background: var(--bg);
  padding: 10px 12px;
}

footer {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  border-top: 1px solid var(--play-rule);
  color: var(--ink-dim);
  font-family: var(--mono);
  font-size: 10px;
  padding: 24px 0 44px;
}

@media (max-width: 980px) {
  .playground-hero,
  .review-guide,
  .sim-layout {
    grid-template-columns: 1fr;
    gap: 36px;
  }

  .review-guide-copy {
    position: static;
  }

  .review-guide-copy h2 {
    max-width: 18ch;
  }

  .playground-state-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .sim-layout {
    grid-template-columns: minmax(0, 1fr) minmax(340px, 0.8fr);
  }
}

@media (max-width: 720px) {
  main,
  footer {
    width: min(100% - 32px, 1180px);
  }

  main {
    padding-top: 36px;
  }

  h1 {
    font-size: 42px;
    line-height: 1.02;
  }

  h2 {
    font-size: 32px;
  }

  .playground-hero,
  .sim-layout {
    grid-template-columns: 1fr;
  }

  .playground-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .playground-actions a {
    width: 100%;
  }

  .playground-start-row,
  .playground-flow,
  .playground-state-grid,
  .result-summary {
    grid-template-columns: 1fr;
  }

  .playground-start-row > div,
  .playground-start-row > div + div {
    border-left: 0;
    border-bottom: 1px solid var(--line);
    padding: 14px 0;
  }

  .playground-start-row > div:last-child {
    border-bottom: 0;
  }

  .playground-flow {
    border-top: 1px solid var(--line);
  }

  .playground-flow span,
  .playground-flow strong {
    min-height: 44px;
  }

  .playground-state-grid > div {
    min-height: 58px;
  }

  .playground-section-index {
    margin-right: -16px;
    margin-left: -16px;
    padding-right: 16px;
    padding-left: 16px;
  }

  .review-guide {
    padding: 68px 0;
  }

  .review-rail li {
    grid-template-columns: 36px minmax(0, 1fr);
    gap: 10px;
  }

  .review-rail p {
    grid-column: 2;
  }

  #simulator {
    padding-top: 56px;
  }

  form,
  .result {
    padding: 18px;
  }

  .result-summary > div {
    min-height: 62px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .result-summary > div:last-child {
    border-bottom: 0;
  }

  .review-record {
    grid-template-columns: 1fr;
  }

  footer {
    flex-direction: column;
  }
}

@media (max-width: 440px) {
  .demo-readout > div {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .demo-readout strong {
    text-align: left;
  }

  .result-topbar {
    flex-direction: column;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}
