/* Shared shell for AZ-900 illustrated boards (scoped under site master layout) */
:root {
  --ink: #1a2332;
  --muted: #5a6a7a;
  --line: #2f6fed;
  --accent: #0d9488;
  --warn: #c45c26;
  --board: #f7f9fc;
  --grid: rgba(47, 111, 237, 0.07);
  --sidebar: #f1f5f9;
  --sidebar-w: 280px;
}
.illustrated-shell,
.illustrated-shell * { box-sizing: border-box; }
.illustrated-shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  grid-template-rows: minmax(0, 1fr);
  min-height: calc(100vh - 12rem);
  font-family: "Segoe UI", "Helvetica Neue", sans-serif;
  color: var(--ink);
  background: #e8eef5;
  margin: 0;
}
/* Embedded in Classic lesson-layout — Classic path-tree is the only left nav */
.illustrated-shell--embedded {
  grid-template-columns: 1fr;
  min-height: calc(100vh - 14rem);
  border: 1px solid #d5dde8;
  border-radius: 10px;
  overflow: hidden;
  background: #eef2f7;
}
.illustrated-shell--embedded .toc { display: none !important; }
.illustrated-shell .toc {
  background: var(--sidebar);
  border-right: 1px solid #d5dde8;
  padding: 1rem 0.85rem 1.5rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.toc-brand {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--accent);
  padding: 0 0.5rem 0.65rem;
  border-bottom: 1px solid #d5dde8;
  margin-bottom: 0.5rem;
  line-height: 1.35;
}
.toc-brand a {
  color: inherit;
  text-decoration: none;
}
.toc-brand a:hover { text-decoration: underline; }
.toc-module {
  margin-top: 0.65rem;
}
.toc-module-title {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--ink);
  padding: 0.35rem 0.5rem;
  line-height: 1.3;
}
.toc-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}
.toc-list a {
  display: block;
  font-size: 0.82rem;
  line-height: 1.35;
  color: var(--muted);
  text-decoration: none;
  padding: 0.4rem 0.55rem 0.4rem 0.85rem;
  border-radius: 6px;
  border-left: 3px solid transparent;
}
.toc-list a:hover {
  background: #fff;
  color: var(--ink);
}
.toc-list a.is-current {
  background: #fff;
  color: var(--line);
  font-weight: 650;
  border-left-color: var(--line);
}
.toc-sections {
  list-style: none;
  margin: 0.15rem 0 0.35rem 0.55rem;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  border-left: 2px solid #d5dde8;
  padding-left: 0.45rem;
}
.toc-section {
  appearance: none;
  width: 100%;
  text-align: left;
  border: none;
  background: transparent;
  font: inherit;
  font-size: 0.76rem;
  line-height: 1.3;
  color: var(--muted);
  padding: 0.32rem 0.45rem;
  border-radius: 5px;
  cursor: pointer;
  border-left: 3px solid transparent;
}
.toc-section:hover {
  background: #fff;
  color: var(--ink);
}
.toc-section.is-reading {
  background: #dbeafe;
  color: #1e40af;
  font-weight: 700;
  border-left-color: var(--line);
  box-shadow: inset 0 0 0 1px #93c5fd;
}
.app {
  display: grid;
  grid-template-rows: auto 1fr auto;
  min-width: 0;
  min-height: 100%;
  background:
    radial-gradient(1200px 600px at 10% -10%, #dbeafe 0%, transparent 55%),
    radial-gradient(900px 500px at 100% 0%, #ccfbf1 0%, transparent 50%),
    #eef2f7;
}
header.top {
  padding: 0.85rem 1.25rem 0.45rem;
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  flex-wrap: wrap;
}
header.top h1 {
  font-size: clamp(1.1rem, 2.2vw, 1.45rem);
  font-weight: 700;
  letter-spacing: -0.02em;
}
header.top .by {
  color: var(--muted);
  font-size: 0.85rem;
}
.stage {
  margin: 0.4rem 1.15rem 0.75rem;
  background: var(--board);
  border: 1px solid #d5dde8;
  border-radius: 4px;
  position: relative;
  overflow: hidden;
  min-height: 0;
  display: grid;
  grid-template-rows: 1fr auto;
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 28px 28px;
}
.scene {
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  height: 100%;
  width: 100%;
  animation: fadeIn 0.45s ease;
}
.scene.is-active { display: flex; }
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}
.scene svg {
  display: block;
  width: min(920px, 96%);
  height: auto;
  max-height: min(52vh, 480px);
  margin-left: auto;
  margin-right: auto;
}
/* All teaching diagram wrappers — dead-center in the stage */
.scene > [class$="-wrap"],
.srm-wrap, .pol-wrap, .svc-wrap, .ha-wrap, .gov-wrap,
.wic-wrap, .cm-wrap, .cb-wrap, .mg-wrap, .rp-wrap, .m0-wrap {
  display: flex !important;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  margin-left: auto;
  margin-right: auto;
  text-align: center;
}
.scene > [class$="-wrap"] > svg,
.srm-wrap > svg, .pol-wrap > svg, .svc-wrap > svg,
.ha-wrap > svg, .gov-wrap > svg, .wic-wrap > svg,
.cm-wrap > svg, .cb-wrap > svg, .mg-wrap > svg,
.rp-wrap > svg, .m0-wrap > svg {
  display: block;
  margin-left: auto;
  margin-right: auto;
}
.caption {
  padding: 0.85rem 1.25rem 1.1rem;
  border-top: 1px solid #e2e8f0;
  background: rgba(255,255,255,0.72);
  transition: background 0.25s ease, box-shadow 0.25s ease;
}
.caption.is-reading {
  background: #eff6ff;
  box-shadow: inset 4px 0 0 var(--line);
}
.caption .label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
  font-weight: 650;
  margin-bottom: 0.25rem;
}
.caption.is-reading .label {
  color: var(--line);
}
.caption p {
  font-size: clamp(0.95rem, 1.6vw, 1.12rem);
  line-height: 1.45;
  max-width: 52rem;
}
footer.controls {
  padding: 0 1.15rem 1.15rem;
  display: flex;
  gap: 0.65rem;
  align-items: center;
  flex-wrap: wrap;
}
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
button, a.nav-btn {
  appearance: none;
  border: 1px solid #c5d0de;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-weight: 600;
  font-size: 0.9rem;
  padding: 0.5rem 0.9rem;
  border-radius: 6px;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}
button.primary {
  background: var(--line);
  border-color: var(--line);
  color: #fff;
}
a.nav-btn.is-disabled {
  opacity: 0.4;
  pointer-events: none;
}
.progress {
  flex: 1;
  min-width: 120px;
  height: 6px;
  background: #d8e0ea;
  border-radius: 99px;
  overflow: hidden;
}
.progress > i {
  display: block;
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--line), var(--accent));
  border-radius: inherit;
}
.time {
  font-variant-numeric: tabular-nums;
  color: var(--muted);
  font-size: 0.85rem;
  min-width: 5.5rem;
}
.hint { color: var(--muted); font-size: 0.85rem; }
.draw {
  fill: none;
  stroke: var(--line);
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 800;
  stroke-dashoffset: 800;
}
.scene.is-active .draw { animation: drawStroke 1.1s ease forwards; }
@keyframes drawStroke { to { stroke-dashoffset: 0; } }
.pop { opacity: 0; transform: scale(0.92); }
.scene.is-active .pop { animation: popIn 0.5s ease forwards; }
.scene.is-active .pop.d1 { animation-delay: 0.15s; }
.scene.is-active .pop.d2 { animation-delay: 0.35s; }
.scene.is-active .pop.d3 { animation-delay: 0.55s; }
.scene.is-active .pop.d4 { animation-delay: 0.75s; }
.scene.is-active .pop.d5 { animation-delay: 0.95s; }
@keyframes popIn { to { opacity: 1; transform: none; } }
.pulse { transform-origin: center; }
.scene.is-active .pulse { animation: pulse 2.2s ease-in-out infinite; }
@keyframes pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.04); opacity: 0.85; }
}
.float { transform-origin: center; }
.scene.is-active .float { animation: floaty 3s ease-in-out infinite; }
@keyframes floaty {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}
.grow-bar { transform-origin: bottom; transform: scaleY(0.2); }
.scene.is-active .grow-bar { animation: growBar 1.2s ease forwards; }
.scene.is-active .grow-bar.g2 { animation-delay: 0.2s; }
.scene.is-active .grow-bar.g3 { animation-delay: 0.4s; }
@keyframes growBar { to { transform: scaleY(1); } }

/* Index page */
.index-main { padding: 1.5rem 1.75rem 2rem; overflow-y: auto; }
.index-main h1 { font-size: clamp(1.35rem, 2.8vw, 1.85rem); margin-bottom: 0.35rem; }
.index-main .sub { color: var(--muted); margin-bottom: 1.25rem; max-width: 44rem; line-height: 1.45; }
.index-main .sub a { color: var(--line); }
.index-main h2 {
  font-size: 0.85rem;
  margin: 1.35rem 0 0.65rem;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.grid {
  display: grid;
  gap: 0.85rem;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}
a.card {
  display: block;
  background: #fff;
  border: 1px solid #d5dde8;
  border-radius: 8px;
  padding: 1rem 1.1rem;
  text-decoration: none;
  color: inherit;
}
a.card:hover { border-color: var(--line); }
a.card .n {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
a.card h3 { font-size: 1.02rem; margin: 0.3rem 0; }
a.card p { font-size: 0.86rem; color: var(--muted); line-height: 1.4; }

@media (max-width: 860px) {
  .illustrated-shell {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
  }
  .illustrated-shell .toc {
    max-height: 220px;
    border-right: none;
    border-bottom: 1px solid #d5dde8;
  }
}
