:root {
  --bg: #0a0e17;
  --bg-alt: #0e1422;
  --surface: #131a2a;
  --surface-2: #1a2336;
  --border: #243049;
  --text: #e6ecf5;
  --text-dim: #9fb0c9;
  --text-mute: #6b7a96;
  --brand: #38bdf8;
  --brand-2: #34d399;
  --accent: #c084fc;
  --warn: #fbbf24;
  --radius: 14px;
  --radius-sm: 9px;
  --maxw: 1160px;
  --shadow: 0 18px 50px -20px rgba(0, 0, 0, 0.7);
  --font: "Segoe UI", Aptos, Calibri, -apple-system, BlinkMacSystemFont, sans-serif;
  --mono: Consolas, "Courier New", Courier, monospace;
}

[data-theme="light"] {
  --bg: #f6f8fc;
  --bg-alt: #eef2f9;
  --surface: #ffffff;
  --surface-2: #f1f5fb;
  --border: #d7e0ee;
  --text: #0f1b2d;
  --text-dim: #41526b;
  --text-mute: #6b7a96;
  --shadow: 0 18px 50px -24px rgba(20, 40, 80, 0.25);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; scroll-padding-top: 76px; }

body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4 { line-height: 1.15; letter-spacing: -0.02em; margin: 0; }
a { color: inherit; text-decoration: none; }
code { font-family: var(--mono); font-size: 0.88em; background: var(--surface-2); padding: 0.1em 0.4em; border-radius: 5px; color: var(--brand); }

.skip-link {
  position: absolute; left: -999px; top: 0; z-index: 100;
  background: var(--brand); color: #00131f; padding: 0.6rem 1rem; border-radius: 0 0 8px 0; font-weight: 600;
}
.skip-link:focus { left: 0; }

/* ---------- Header / Nav ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 96%, transparent);
  border-bottom: 1px solid var(--border);
}
.nav {
  max-width: var(--maxw); margin: 0 auto; padding: 0.85rem 1.5rem;
  display: flex; align-items: center; justify-content: space-between; gap: 1.5rem;
}
.brand { display: flex; align-items: center; gap: 0.6rem; font-weight: 800; letter-spacing: -0.02em; color: var(--text); flex: 0 0 auto; }
.brand-mark { display: grid; place-items: center; width: 32px; height: 32px; }
.brand-mark img { display: block; width: 32px; height: 32px; object-fit: contain; }
.brand-text { font-size: 1.02rem; white-space: nowrap; }
.nav-links {
  position: fixed; z-index: 70; top: 0; right: 0; width: min(360px, calc(100vw - 3rem)); height: 100dvh;
  list-style: none; display: flex; flex-direction: column; gap: 0; margin: 0; padding: 5.5rem 1.5rem 2rem;
  background: var(--bg); border-left: 1px solid var(--border); box-shadow: -24px 0 60px rgba(0, 0, 0, 0.35);
  transform: translateX(100%); visibility: hidden; transition: transform 0.24s ease, visibility 0s linear 0.24s;
  overflow-y: auto; font-size: 1rem; font-weight: 500;
}
.nav-links.is-open { transform: none; visibility: visible; transition-delay: 0s; }
.nav-links li { width: 100%; }
.nav-links a { display: flex; align-items: center; min-height: 52px; padding: 0.65rem 0.25rem; color: var(--text-dim); border-bottom: 1px solid var(--border); transition: color 0.15s, border-color 0.15s; }
.nav-links a:hover, .nav-links a:focus-visible { color: var(--text); border-color: var(--brand); }
.drawer-label { margin-bottom: 0.7rem; color: var(--brand); font: 600 0.72rem var(--mono); text-transform: uppercase; }
.nav-cta {
  justify-content: center; margin-top: 1rem; min-height: 46px !important; padding: 0.65rem 0.9rem !important;
  background: linear-gradient(135deg, var(--brand), var(--brand-2)); border: 0 !important;
  color: #00131f !important; border-radius: 8px; font-weight: 600;
}
.nav-toggle { display: flex; position: relative; z-index: 75; width: 42px; height: 42px; align-items: center; justify-content: center; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; cursor: pointer; flex-direction: column; gap: 5px; padding: 0; margin-left: auto; }
.nav-toggle:hover { border-color: var(--brand); }
.nav-toggle span { width: 24px; height: 2px; background: var(--text); border-radius: 2px; transition: 0.25s; }
.nav-toggle[aria-expanded="true"] { position: fixed; top: 0.7rem; right: 1rem; }
.nav-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }
.nav-backdrop { position: fixed; z-index: 60; inset: 0; background: rgba(3, 7, 18, 0.68); opacity: 0; visibility: hidden; transition: opacity 0.24s ease, visibility 0s linear 0.24s; }
.nav-backdrop.is-open { opacity: 1; visibility: visible; }
body.nav-drawer-open { overflow: hidden; }

/* ---------- Hero ---------- */
.hero { position: relative; overflow: hidden; padding: 5.5rem 1.5rem 4.5rem; }
.hero-bg {
  position: absolute; inset: 0; z-index: 0;
  background:
    radial-gradient(60% 50% at 20% 0%, rgba(56, 189, 248, 0.16), transparent 70%),
    radial-gradient(50% 50% at 90% 20%, rgba(52, 211, 153, 0.12), transparent 70%),
    radial-gradient(40% 60% at 60% 100%, rgba(192, 132, 252, 0.10), transparent 70%);
}
.hero-bg::after {
  content: ""; position: absolute; inset: 0;
  background-image: linear-gradient(var(--border) 1px, transparent 1px), linear-gradient(90deg, var(--border) 1px, transparent 1px);
  background-size: 46px 46px; opacity: 0.18;
  mask-image: radial-gradient(70% 70% at 50% 30%, #000, transparent 80%);
}
.hero-inner { position: relative; z-index: 1; max-width: var(--maxw); margin: 0 auto; }
.eyebrow { color: var(--brand); font-weight: 600; font-size: 0.82rem; letter-spacing: 0.06em; text-transform: uppercase; margin: 0 0 1rem; }
.hero h1 { font-size: clamp(2.2rem, 5.5vw, 4rem); font-weight: 800; max-width: 16ch; }
.grad { background: linear-gradient(120deg, var(--brand), var(--brand-2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.lede { font-size: clamp(1.02rem, 1.6vw, 1.2rem); color: var(--text-dim); max-width: 62ch; margin: 1.4rem 0 2rem; }
.hero-cta { display: flex; gap: 0.85rem; flex-wrap: wrap; }

.btn { display: inline-flex; align-items: center; gap: 0.5rem; padding: 0.8rem 1.4rem; border-radius: 10px; font-weight: 600; font-size: 0.96rem; cursor: pointer; border: 1px solid transparent; transition: transform 0.12s, box-shadow 0.2s, background 0.2s; }
.btn:hover { transform: translateY(-2px); }
.btn-primary { background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: #00131f; box-shadow: 0 10px 28px -10px rgba(56, 189, 248, 0.55); }
.btn-ghost { background: var(--surface); border-color: var(--border); color: var(--text); }

.hero-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; margin: 3.2rem 0 0; }
.hero-stats div { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.2rem 1.3rem; }
.hero-stats dt { font-size: 1.8rem; font-weight: 800; letter-spacing: -0.03em; background: linear-gradient(120deg, var(--brand), var(--brand-2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero-stats dd { margin: 0.3rem 0 0; color: var(--text-dim); font-size: 0.86rem; }

/* ---------- Sections ---------- */
.section { max-width: var(--maxw); margin: 0 auto; padding: 5rem 1.5rem; }
.section-alt { background: var(--bg-alt); max-width: none; }
.section-alt > * { max-width: var(--maxw); margin-left: auto; margin-right: auto; }
.section-head { margin-bottom: 2.8rem; }
.kicker { color: var(--brand-2); font-weight: 600; font-size: 0.8rem; letter-spacing: 0.08em; text-transform: uppercase; }
.section-head h2 { font-size: clamp(1.7rem, 3.4vw, 2.6rem); margin: 0.6rem 0 0; max-width: 22ch; }
.section-sub { color: var(--text-dim); max-width: 64ch; margin: 0.9rem 0 0; }

/* ---------- Scenario ---------- */
.scenario-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 2rem; align-items: start; }
.scenario-copy p { color: var(--text-dim); margin: 0 0 1.1rem; font-size: 1.02rem; }
.scenario-copy strong, .scenario-copy em { color: var(--text); font-style: normal; }
.scenario-copy em { color: var(--brand); }
.pain-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.6rem; box-shadow: var(--shadow); }
.pain-card h3 { font-size: 1.05rem; margin-bottom: 1rem; }
.pain-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.8rem; }
.pain-list li { display: flex; gap: 0.8rem; align-items: baseline; color: var(--text-dim); font-size: 0.92rem; }
.pain-list span { font-family: var(--mono); color: var(--warn); font-weight: 600; font-size: 0.8rem; }

.legacy-target { display: grid; grid-template-columns: 1fr auto 1fr; gap: 1.4rem; align-items: center; margin-top: 2.6rem; }
.lt-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.5rem; }
.lt-card header { display: flex; align-items: center; gap: 0.6rem; font-weight: 700; margin-bottom: 1rem; }
.lt-card .dot { width: 10px; height: 10px; border-radius: 50%; }
.lt-card.legacy .dot { background: var(--warn); }
.lt-card.target .dot { background: var(--brand-2); }
.lt-card.target { border-color: color-mix(in srgb, var(--brand-2) 40%, var(--border)); }
.lt-card ul { margin: 0; padding-left: 1.1rem; color: var(--text-dim); font-size: 0.9rem; display: flex; flex-direction: column; gap: 0.55rem; }
.lt-arrow { font-size: 2rem; color: var(--brand); text-align: center; }

/* ---------- Architecture ---------- */
.diagram-wrap { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.5rem; overflow-x: auto; box-shadow: var(--shadow); }
.architecture-view-head { margin: 3rem auto 1rem; }
.architecture-view-head span { color: var(--brand); font: 600 0.72rem var(--mono); text-transform: uppercase; }
.architecture-view-head h3 { margin-top: 0.35rem; font-size: 1.22rem; }
.architecture-view-head p { max-width: 72ch; margin: 0.45rem 0 0; color: var(--text-dim); font-size: 0.9rem; }
.azure-architecture { min-width: 900px; margin: 0; }
.traffic-sources, .ingress-services { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.2rem; max-width: 660px; margin: 0 auto; }
.external-node, .azure-node { min-width: 0; }
.external-node { display: grid; grid-template-columns: 52px 1fr; column-gap: 0.85rem; align-items: center; padding: 0.85rem 1rem; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2); }
.external-node strong, .external-node small { grid-column: 2; }
.external-node small, .azure-node small { color: var(--text-dim); line-height: 1.35; }
.external-icon { grid-row: 1 / 3; display: grid; place-items: center; width: 52px; height: 52px; border: 1px solid var(--border); border-radius: 50%; color: var(--brand); font-family: var(--mono); font-size: 0.68rem; font-weight: 700; }
.flow-connector { display: grid; place-items: center; height: 58px; position: relative; color: var(--text-mute); font: 0.72rem var(--mono); }
.flow-connector::before { content: ""; position: absolute; top: 8px; bottom: 8px; width: 2px; background: var(--brand); }
.flow-connector::after { content: ""; position: absolute; bottom: 5px; border: 6px solid transparent; border-top-color: var(--brand); }
.flow-connector span { position: relative; z-index: 1; background: var(--surface); padding: 0 0.6rem; }
.azure-node { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.25rem; min-height: 112px; padding: 0.9rem; text-align: center; border: 1px solid color-mix(in srgb, var(--brand) 35%, var(--border)); border-radius: var(--radius-sm); background: color-mix(in srgb, var(--brand) 5%, var(--surface-2)); transition: border-color 0.15s, transform 0.15s; }
.azure-node:hover { border-color: var(--brand); transform: translateY(-2px); }
.azure-node:focus-visible { outline: 3px solid color-mix(in srgb, var(--brand) 60%, transparent); outline-offset: 3px; }
.service-mark { display: block; width: 44px; height: 44px; object-fit: contain; margin-bottom: 0.2rem; }
.azure-node strong { font-size: 0.88rem; line-height: 1.25; }
.azure-node small { display: block; font-size: 0.72rem; }
.regional-routes { display: grid; grid-template-columns: 1fr 1fr; max-width: 760px; height: 70px; margin: 0 auto; color: var(--text-mute); font: 0.7rem var(--mono); }
.regional-routes span { display: grid; place-items: end center; position: relative; padding-bottom: 8px; }
.regional-routes span::before { content: ""; position: absolute; top: 8px; bottom: 22px; width: 2px; background: var(--brand-2); }
.regional-routes span::after { content: ""; position: absolute; bottom: 17px; border: 6px solid transparent; border-top-color: var(--brand-2); }
.regional-routes span:last-child::before { background: repeating-linear-gradient(to bottom, var(--text-mute) 0 5px, transparent 5px 9px); }
.regional-routes span:last-child::after { border-top-color: var(--text-mute); }
.region-grid { display: grid; grid-template-columns: minmax(0, 1fr) 76px minmax(0, 1fr); align-items: stretch; gap: 0; }
.region { border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; background: var(--bg-alt); }
.region-primary { border-color: color-mix(in srgb, var(--brand-2) 45%, var(--border)); }
.region > header { display: flex; align-items: center; gap: 0.7rem; padding: 0.7rem 0.9rem; border-bottom: 1px solid var(--border); background: var(--surface-2); }
.region > header span { padding: 0.15rem 0.45rem; border-radius: 4px; background: var(--brand-2); color: #04251a; font: 700 0.65rem var(--mono); text-transform: uppercase; }
.region-passive > header span { background: var(--text-mute); color: var(--bg); }
.region > header strong { font-size: 0.9rem; }
.region-services { padding: 1rem; }
.azure-node-featured { min-height: 128px; }
.workload-list { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.5rem; margin: 0.75rem 0; }
.workload-list span { min-width: 0; padding: 0.55rem 0.35rem; text-align: center; border: 1px solid var(--border); border-radius: 6px; background: var(--surface); }
.workload-list code { display: block; overflow-wrap: anywhere; }
.workload-list small { display: block; margin-top: 0.25rem; color: var(--text-mute); font-size: 0.65rem; }
.standby-note { display: grid; place-items: center; min-height: 61px; margin: 0.75rem 0; border: 1px dashed var(--border); border-radius: 6px; color: var(--text-mute); font: 0.72rem var(--mono); }
.region-dependencies { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.65rem; }
.azure-node-compact { min-height: 105px; padding: 0.7rem; }
.azure-node-compact .service-mark { width: 36px; height: 36px; }
.replication-path { display: grid; place-items: end center; position: relative; overflow: hidden; padding-bottom: 3.5rem; color: var(--text-mute); font: 0.64rem var(--mono); text-align: center; }
.replication-path::before { content: ""; position: absolute; top: 74%; left: 7px; right: 7px; border-top: 2px dashed var(--warn); }
.replication-path::after { content: ""; position: absolute; top: calc(74% - 5px); right: 0; border: 6px solid transparent; border-left-color: var(--warn); }
.replication-path span { position: relative; z-index: 1; background: var(--surface); padding: 0.25rem; }
.shared-services { display: grid; grid-template-columns: auto repeat(3, minmax(0, 1fr)); gap: 0.75rem; align-items: center; margin-top: 1rem; padding: 1rem; border: 1px dashed var(--border); border-radius: var(--radius-sm); }
.shared-label { color: var(--text-mute); font: 0.7rem var(--mono); text-transform: uppercase; writing-mode: vertical-rl; transform: rotate(180deg); }
.azure-node-horizontal { min-height: 78px; flex-direction: row; justify-content: flex-start; gap: 0.75rem; text-align: left; }
.azure-node-horizontal .service-mark { flex: 0 0 auto; margin: 0; }
.azure-node-horizontal span { min-width: 0; }
.azure-architecture figcaption { margin-top: 1rem; color: var(--text-mute); font-size: 0.75rem; text-align: center; }
.azure-architecture figcaption a { color: var(--brand); text-decoration: underline; text-underline-offset: 3px; }
.active-route { display: grid; grid-template-columns: repeat(2, 1fr); height: 70px; color: var(--text-mute); font: 0.7rem var(--mono); }
.active-route span { display: grid; place-items: end center; position: relative; padding-bottom: 8px; }
.active-route span::before { content: ""; position: absolute; top: 8px; bottom: 22px; width: 2px; background: var(--brand-2); }
.active-route span::after { content: ""; position: absolute; bottom: 17px; border: 6px solid transparent; border-top-color: var(--brand-2); }
.active-region-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.region-active { border-color: color-mix(in srgb, var(--brand-2) 55%, var(--border)); }
.region-active > header span { background: var(--brand-2); }
.active-ingress { min-height: 76px; margin-bottom: 0.7rem; }
.partition-owner { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; margin: 0.7rem 0; padding: 0.55rem 0.7rem; border: 1px solid color-mix(in srgb, var(--warn) 45%, var(--border)); border-radius: 6px; background: color-mix(in srgb, var(--warn) 7%, var(--surface)); font-size: 0.72rem; }
.partition-owner strong { color: var(--warn); }
.partition-owner span { color: var(--text-dim); font-family: var(--mono); }
.active-data-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.6rem; }
.replica-node { border-style: dashed; }
.cross-region-replication { display: grid; grid-template-columns: 1fr auto 1fr; gap: 0.8rem; align-items: center; margin: 1rem 0; color: var(--text-mute); font: 0.67rem var(--mono); text-align: center; }
.cross-region-replication::before, .cross-region-replication::after { content: ""; display: none; }
.cross-region-replication strong { color: var(--warn); font-size: 0.7rem; }
.cross-region-replication span { padding: 0.4rem 0.7rem; border-top: 2px dashed var(--warn); border-bottom: 2px dashed var(--warn); }
.consistency-guardrail { min-height: 78px; display: flex; flex-direction: column; justify-content: center; padding: 0.75rem 0.9rem; border: 1px solid color-mix(in srgb, var(--warn) 40%, var(--border)); border-radius: var(--radius-sm); background: color-mix(in srgb, var(--warn) 6%, var(--surface-2)); }
.consistency-guardrail strong { font-size: 0.82rem; }
.consistency-guardrail small { margin-top: 0.2rem; color: var(--text-dim); font-size: 0.7rem; line-height: 1.35; }
.moves { margin-top: 3rem; }
.moves h3 { font-size: 1.25rem; margin-bottom: 1.4rem; }
.moves-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.1rem; }
.move { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 1.3rem; transition: border-color 0.2s, transform 0.15s; }
.move:hover { border-color: color-mix(in srgb, var(--brand) 45%, var(--border)); transform: translateY(-3px); }
.move h4 { font-size: 1rem; margin-bottom: 0.55rem; color: var(--text); }
.move p { color: var(--text-dim); font-size: 0.9rem; margin: 0; }
.architecture-references { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(280px, 0.8fr); gap: 2rem; align-items: start; margin-top: 1.5rem; padding: 1.4rem 0; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.reference-label { display: block; margin-bottom: 0.4rem; color: var(--brand-2); font: 0.7rem var(--mono); text-transform: uppercase; }
.architecture-references h4 { margin-bottom: 0.55rem; font-size: 1rem; }
.architecture-references p { max-width: 68ch; margin: 0; color: var(--text-dim); font-size: 0.88rem; }
.reference-links { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.55rem 1rem; }
.reference-links a { display: flex; justify-content: space-between; gap: 0.75rem; padding: 0.45rem 0; color: var(--text); border-bottom: 1px solid var(--border); font-size: 0.8rem; font-weight: 600; }
.reference-links a:hover { color: var(--brand); border-color: var(--brand); }
.reference-links span { color: var(--brand); }

/* ---------- Modules ---------- */
.module-filter { display: flex; gap: 0.6rem; flex-wrap: wrap; margin-bottom: 1.8rem; }
.chip { background: var(--surface); border: 1px solid var(--border); color: var(--text-dim); padding: 0.5rem 1.05rem; border-radius: 999px; font-weight: 500; font-size: 0.88rem; cursor: pointer; transition: 0.18s; font-family: inherit; }
.chip:hover { color: var(--text); border-color: var(--brand); }
.chip.is-active { background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: #00131f; border-color: transparent; font-weight: 600; }

.modules-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.2rem; }
.module-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1.5rem; display: flex; flex-direction: column; position: relative; overflow: hidden;
  transition: transform 0.18s, border-color 0.2s, box-shadow 0.2s;
}
.module-card::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 3px; background: var(--card-accent, var(--brand)); opacity: 0.9; }
.module-card:hover { transform: translateY(-4px); border-color: color-mix(in srgb, var(--card-accent) 45%, var(--border)); box-shadow: var(--shadow); }
.module-top { display: flex; align-items: center; justify-content: flex-start; gap: 0.85rem; margin-bottom: 0.9rem; padding-right: 3.6rem; }
.module-num { font-family: var(--mono); font-size: 1.6rem; font-weight: 700; color: var(--card-accent, var(--brand)); }
.module-time { font-size: 0.76rem; color: var(--text-mute); background: var(--surface-2); padding: 0.25rem 0.6rem; border-radius: 999px; white-space: nowrap; }
.module-card h3 { font-size: 1.08rem; margin-bottom: 0.55rem; }
.module-card p { color: var(--text-dim); font-size: 0.9rem; margin: 0 0 1rem; flex: 1; }
.module-tags { display: flex; gap: 0.4rem; flex-wrap: wrap; }
.module-tag { font-size: 0.72rem; color: var(--text-mute); border: 1px solid var(--border); border-radius: 6px; padding: 0.18rem 0.5rem; }
.module-card.is-hidden { display: none; }
.module-level { position: absolute; top: 1.25rem; right: 1.25rem; }
.module-level .pill { font-size: 0.72rem; padding: 0.16rem 0.5rem; line-height: 1.25; white-space: nowrap; }

/* ---------- SLO table ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.slo-table { width: 100%; border-collapse: collapse; min-width: 640px; }
.slo-table th, .slo-table td { text-align: left; padding: 1rem 1.2rem; border-bottom: 1px solid var(--border); font-size: 0.92rem; }
.slo-table th { background: var(--surface-2); font-weight: 600; color: var(--text); font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.04em; }
.slo-table tbody tr:last-child td { border-bottom: 0; }
.slo-table td { color: var(--text-dim); }
.slo-table td:first-child { color: var(--text); font-weight: 500; }
.pill { display: inline-block; background: color-mix(in srgb, var(--brand-2) 18%, transparent); color: var(--brand-2); border: 1px solid color-mix(in srgb, var(--brand-2) 40%, transparent); padding: 0.2rem 0.6rem; border-radius: 999px; font-family: var(--mono); font-size: 0.82rem; font-weight: 500; }
.success-criteria { margin: 2.5rem auto 0; padding: 1.6rem 1.8rem; background: var(--surface); border: 1px solid var(--border); border-left: 4px solid var(--brand); border-radius: 0 var(--radius) var(--radius) 0; }
.success-criteria h3 { margin-bottom: 0.8rem; font-size: 1rem; }
.success-criteria ul { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.65rem 2rem; margin: 0; padding-left: 1.2rem; color: var(--text-dim); font-size: 0.9rem; }

/* ---------- Delivery ---------- */
.delivery-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.2rem; }
.delivery-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.7rem; position: relative; }
.delivery-card.featured { border-color: color-mix(in srgb, var(--brand) 50%, var(--border)); box-shadow: var(--shadow); }
.delivery-card .tag { position: absolute; top: -0.7rem; right: 1.3rem; background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: #00131f; font-size: 0.72rem; font-weight: 700; padding: 0.25rem 0.7rem; border-radius: 999px; }
.delivery-card h3 { font-size: 1.15rem; margin-bottom: 0.5rem; }
.delivery-meta { color: var(--brand); font-size: 0.82rem; font-weight: 500; margin: 0 0 0.8rem; font-family: var(--mono); }
.delivery-card p:last-child { color: var(--text-dim); font-size: 0.92rem; margin: 0; }

.roles { margin-top: 3rem; }
.roles h3 { font-size: 1.25rem; margin-bottom: 1.4rem; }
.roles-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1.1rem; }
.role { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 1.3rem; }
.role h4 { font-size: 0.98rem; margin-bottom: 0.5rem; color: var(--brand-2); }
.role p { color: var(--text-dim); font-size: 0.88rem; margin: 0; }

/* ---------- CTA band ---------- */
.cta-band { text-align: center; }
.cta-band h2 { font-size: clamp(1.6rem, 3vw, 2.4rem); }
.cta-band p { color: var(--text-dim); max-width: 56ch; margin: 1rem auto 2rem; }
.cta-band .hero-cta { justify-content: center; }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--border); background: var(--bg-alt); }
.footer-inner { max-width: var(--maxw); margin: 0 auto; padding: 2.5rem 1.5rem; display: flex; flex-wrap: wrap; align-items: center; gap: 1rem; }
.footer-brand { font-weight: 700; margin: 0; }
.footer-note { color: var(--text-mute); font-size: 0.82rem; margin: 0; flex: 1; min-width: 280px; }
.theme-toggle { background: var(--surface); border: 1px solid var(--border); color: var(--text); padding: 0.5rem 0.9rem; border-radius: 8px; cursor: pointer; font-family: inherit; font-size: 0.85rem; display: inline-flex; align-items: center; gap: 0.4rem; }
.theme-toggle:hover { border-color: var(--brand); }

/* ---------- Reveal animation ---------- */
.reveal { opacity: 0; transform: translateY(22px); transition: opacity 0.6s ease, transform 0.6s ease; }
.reveal.is-visible { opacity: 1; transform: none; }

/* ---------- Responsive ---------- */
@media (max-width: 920px) {
  .hero-stats { grid-template-columns: repeat(2, 1fr); }
  .scenario-grid { grid-template-columns: 1fr; }
  .legacy-target { grid-template-columns: 1fr; }
  .lt-arrow { transform: rotate(90deg); }
  .moves-grid { grid-template-columns: repeat(2, 1fr); }
  .architecture-references { grid-template-columns: 1fr; gap: 1.2rem; }
  .modules-grid { grid-template-columns: repeat(2, 1fr); }
  .delivery-grid { grid-template-columns: 1fr; }
  .roles-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
  .hero { padding: 3.5rem 1.25rem 3rem; }
  .hero-stats { grid-template-columns: 1fr 1fr; gap: 0.75rem; }
  .moves-grid, .modules-grid, .roles-grid { grid-template-columns: 1fr; }
  .reference-links { grid-template-columns: 1fr; }
  .section { padding: 3.5rem 1.25rem; }
  .success-criteria { padding: 1.3rem 1.4rem; }
  .success-criteria ul { grid-template-columns: 1fr; }
  .lab-layout { padding: 1rem 1rem 3rem; }
  .to-top { bottom: 1rem; right: 1rem; }
}
@media (max-width: 400px) {
  .hero-stats { grid-template-columns: 1fr; }
  .nav { padding: 0.75rem 1.1rem; }
  .brand-text { font-size: 0.94rem; }
}
@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; }
  .reveal { opacity: 1; transform: none; transition: none; }
  .btn:hover, .move:hover, .module-card:hover { transform: none; }
}

/* ===================== LAB PAGE ===================== */
.lab-body { background: var(--bg); }
.lab-layout {
  max-width: 1280px; margin: 0 auto; padding: 1.5rem 1.5rem 4rem;
  display: grid; grid-template-columns: 290px 1fr; gap: 2rem; align-items: start;
}

/* Sidebar */
.lab-sidebar {
  position: sticky; top: 84px; align-self: start;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1.1rem; display: flex; flex-direction: column; gap: 1.1rem;
  max-height: calc(100vh - 104px); overflow-y: auto;
}
.lab-mode-label { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.09em; color: var(--text-mute); font-weight: 600; }
.seg-toggle { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; margin-top: 0.4rem; background: var(--bg-alt); border: 1px solid var(--border); border-radius: 10px; padding: 4px; }
.seg-btn { border: 0; background: transparent; color: var(--text-dim); font-weight: 600; font-size: 0.82rem; padding: 0.5rem 0.4rem; border-radius: 7px; cursor: pointer; transition: 0.15s; font-family: var(--font); }
.seg-btn.is-active { background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: #00131f; }

.lab-progress-top { display: flex; justify-content: space-between; align-items: center; font-size: 0.82rem; color: var(--text-dim); font-weight: 600; margin-bottom: 0.4rem; }
.link-btn { background: none; border: 0; color: var(--brand); font-size: 0.78rem; cursor: pointer; font-weight: 600; }
.progress-track { height: 8px; background: var(--bg-alt); border-radius: 99px; overflow: hidden; border: 1px solid var(--border); }
.progress-fill { height: 100%; width: 0%; background: linear-gradient(90deg, var(--brand), var(--brand-2)); transition: width 0.3s ease; }

.score-panel { background: var(--bg-alt); border: 1px solid var(--border); border-radius: 10px; padding: 0.8rem; }
.score-topline, .score-level-row { display: flex; align-items: baseline; justify-content: space-between; gap: 0.75rem; }
.score-kicker { color: var(--text-mute); font-size: 0.68rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; }
.score-points { color: var(--brand-2); font-family: var(--mono); font-size: 0.76rem; white-space: nowrap; }
.score-points strong { font-size: 1.2rem; }
.score-level-row { margin-top: 0.45rem; }
.score-level { color: var(--text); font-size: 0.9rem; font-weight: 700; }
.score-next { color: var(--text-mute); font-size: 0.68rem; text-align: right; }
.level-track { height: 5px; margin-top: 0.45rem; overflow: hidden; background: var(--surface); border-radius: 99px; }
.level-fill { width: 0; height: 100%; background: var(--warn); transition: width 0.35s ease; }
.score-rules { margin: 0.6rem 0; color: var(--text-mute); font-size: 0.68rem; line-height: 1.4; }
.score-rules strong { color: var(--text-dim); }
.achievement-list { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.achievement { display: inline-flex; align-items: center; gap: 0.25rem; min-height: 24px; padding: 0.15rem 0.4rem; border: 1px solid var(--border); border-radius: 6px; color: var(--text-mute); font-size: 0.65rem; font-weight: 600; }
.achievement.unlocked { border-color: var(--warn); color: var(--warn); background: var(--surface); }

.lab-toc { display: flex; flex-direction: column; gap: 2px; }
.toc-link { display: flex; justify-content: space-between; align-items: center; gap: 0.5rem; padding: 0.55rem 0.6rem; border-radius: 8px; font-size: 0.85rem; color: var(--text-dim); border-left: 2px solid transparent; transition: 0.15s; }
.toc-link:hover { background: var(--surface-2); color: var(--text); }
.toc-link.active { background: var(--surface-2); color: var(--text); border-left-color: var(--brand); }
.toc-name { font-weight: 500; }
.toc-count { font-size: 0.72rem; font-family: var(--mono); color: var(--text-mute); background: var(--bg-alt); padding: 0.1rem 0.4rem; border-radius: 6px; }
.toc-count.complete { color: var(--brand-2); border: 1px solid color-mix(in srgb, var(--brand-2) 40%, transparent); }
.lab-hint { font-size: 0.76rem; color: var(--text-mute); line-height: 1.5; margin: 0; }

/* Head */
.lab-head { margin-bottom: 1.8rem; }
.lab-head h1 { font-size: clamp(1.7rem, 4vw, 2.4rem); margin: 0.5rem 0 0.7rem; }
.lab-intro { color: var(--text-dim); max-width: 70ch; }
.lab-legend { margin-top: 1rem; padding: 0.7rem 1rem; border-radius: 10px; background: color-mix(in srgb, var(--accent) 12%, transparent); border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent); color: var(--text); font-size: 0.86rem; }

/* Phase */
.phase { margin-bottom: 2.6rem; scroll-margin-top: 84px; }
.phase-head { padding-bottom: 0.9rem; margin-bottom: 1.1rem; border-bottom: 1px solid var(--border); }
.phase-head h2 { font-size: 1.5rem; }
.phase-head p { color: var(--text-dim); margin: 0.4rem 0 0; }
.phase-success { display: inline-block; margin-top: 0.6rem; font-size: 0.82rem; font-weight: 600; color: var(--brand-2); }
.phase-bonus { display: inline-block; margin: 0.6rem 0 0 0.7rem; padding: 0.12rem 0.4rem; border: 1px solid var(--warn); border-radius: 6px; color: var(--warn); font: 600 0.68rem var(--mono); }
.module-group { margin-bottom: 1.1rem; }

/* Trainer block (instructor-led only) */
.trainer-block { display: none; }
body.mode-instructor .trainer-block {
  display: block; background: color-mix(in srgb, var(--warn) 10%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--warn) 38%, transparent);
  border-radius: var(--radius-sm); padding: 0.9rem 1.1rem; margin-bottom: 0.9rem;
}
.trainer-tag { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.08em; font-weight: 700; color: var(--warn); margin-bottom: 0.4rem; }
.trainer-block p { margin: 0.3rem 0; font-size: 0.88rem; color: var(--text-dim); }
.trainer-block strong { color: var(--text); }

/* Activity */
.activity { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); margin-bottom: 0.7rem; overflow: hidden; transition: border-color 0.2s; }
.activity.is-done { border-color: color-mix(in srgb, var(--brand-2) 45%, transparent); }
.activity-head { display: flex; align-items: center; gap: 0.6rem; padding: 0.3rem 0.8rem 0.3rem 0.9rem; }
.act-check { position: relative; display: inline-grid; place-items: center; cursor: pointer; }
.act-check input { position: absolute; opacity: 0; cursor: pointer; width: 22px; height: 22px; }
.checkmark { width: 22px; height: 22px; border-radius: 6px; border: 2px solid var(--border); background: var(--bg-alt); display: grid; place-items: center; transition: 0.15s; }
.act-check input:checked + .checkmark { background: var(--brand-2); border-color: var(--brand-2); }
.act-check input:checked + .checkmark::after { content: "✓"; color: #00131f; font-size: 0.8rem; font-weight: 800; }
.activity-title { flex: 1; display: flex; align-items: center; gap: 0.7rem; background: none; border: 0; cursor: pointer; text-align: left; padding: 0.6rem 0; color: var(--text); font-family: var(--font); }
.act-id { font-family: var(--mono); font-size: 0.74rem; color: var(--brand); background: var(--bg-alt); padding: 0.15rem 0.45rem; border-radius: 6px; flex-shrink: 0; }
.act-name { font-weight: 600; font-size: 0.96rem; flex: 1; }
.activity.is-done .act-name { color: var(--text-dim); }
.act-points { color: var(--brand-2); font: 600 0.68rem var(--mono); white-space: nowrap; }
.act-time { font-size: 0.76rem; color: var(--text-mute); font-family: var(--mono); flex-shrink: 0; }
.act-caret { color: var(--text-mute); flex-shrink: 0; }

.activity-body { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; padding: 0.3rem 1rem 1.2rem; border-top: 1px solid var(--border); }
.ab-col h4 { font-size: 0.84rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text); margin-bottom: 0.5rem; }
.ab-col h4 .muted { text-transform: none; letter-spacing: 0; font-weight: 400; color: var(--text-mute); font-size: 0.78rem; }
.ab-col ul, .ab-col ol { margin: 0; padding-left: 1.2rem; color: var(--text-dim); font-size: 0.9rem; }
.ab-col li { margin-bottom: 0.35rem; }
.ab-do { grid-column: 1 / -1; }
.ab-precheck { background: var(--bg-alt); border-radius: 9px; padding: 0.8rem 0.9rem; }
.ab-postcheck { background: color-mix(in srgb, var(--brand-2) 7%, var(--bg-alt)); border-radius: 9px; padding: 0.8rem 0.9rem; }
.ab-valid { grid-column: 1 / -1; border-left: 3px solid var(--brand); background: color-mix(in srgb, var(--brand) 8%, transparent); border-radius: 0 9px 9px 0; padding: 0.7rem 0.9rem; }
.valid-line { margin: 0; font-size: 0.9rem; color: var(--text); }
pre.cmd { background: #0a0e17; border: 1px solid var(--border); border-radius: 8px; padding: 0.8rem 1rem; overflow-x: auto; margin: 0.7rem 0 0; }
pre.cmd code { background: none; color: #cfe7ff; padding: 0; font-size: 0.82rem; line-height: 1.55; }
.activity-link { display: inline-block; margin-top: 0.8rem; padding: 0.55rem 1.1rem; background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: #00131f; border-radius: 8px; font-weight: 600; font-size: 0.88rem; }

.lab-footer-cta { text-align: center; padding: 2.5rem 1.5rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); margin-top: 1rem; }
.lab-footer-cta h2 { font-size: 1.5rem; }
.lab-footer-cta p { color: var(--text-dim); margin: 0.5rem 0 1.3rem; }
.lab-footer-cta .hero-cta { justify-content: center; }

.reset-dialog { width: min(440px, calc(100vw - 2rem)); padding: 0; color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.reset-dialog::backdrop { background: var(--bg); }
.reset-dialog form { padding: 1.5rem; }
.dialog-icon { display: grid; place-items: center; width: 38px; height: 38px; margin-bottom: 1rem; border-radius: 50%; color: var(--warn); background: var(--surface-2); font-size: 1.25rem; }
.reset-dialog h2 { font-size: 1.25rem; }
.reset-dialog p { margin: 0.7rem 0 1.4rem; color: var(--text-dim); font-size: 0.9rem; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 0.6rem; }
.btn-danger { color: var(--bg); background: var(--warn); }
.score-toast { position: fixed; z-index: 90; left: 50%; bottom: 1.5rem; min-width: 240px; padding: 0.75rem 1rem; transform: translate(-50%, 24px); opacity: 0; pointer-events: none; color: var(--text); background: var(--surface); border: 1px solid var(--brand-2); border-radius: 9px; box-shadow: var(--shadow); text-align: center; font-size: 0.84rem; font-weight: 700; transition: opacity 0.2s, transform 0.2s; }
.score-toast.show { opacity: 1; transform: translate(-50%, 0); }

.to-top { position: fixed; bottom: 1.5rem; right: 1.5rem; width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--border); background: var(--surface); color: var(--text); font-size: 1.1rem; cursor: pointer; opacity: 0; pointer-events: none; transition: 0.2s; z-index: 40; }
.to-top.show { opacity: 1; pointer-events: auto; }

@media (max-width: 980px) {
  .lab-layout { grid-template-columns: 1fr; }
  .lab-sidebar { position: static; max-height: none; flex-direction: column; }
  .activity-body { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .act-points { display: none; }
  .dialog-actions { flex-direction: column-reverse; }
  .dialog-actions .btn { justify-content: center; }
}

/* overflow containment for grid/flex children */
.lab-layout > * { min-width: 0; }
.activity-body > * { min-width: 0; }
.activity-title { min-width: 0; }
.act-name { min-width: 0; overflow-wrap: anywhere; }
pre.cmd { max-width: 100%; }
.toc-link { min-width: 0; }
.toc-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
