:root {
  --bg: #070b10;
  --ink: #e7edf5;
  --muted: #93a0b4;
  --faint: #6d7c90;
  --line: rgba(214, 226, 240, 0.14);
  --blue: #1b96ff;
  --edge-hf: #7ed6df;
  --edge-data: #9ebcff;
  --edge-core: #d2c4f6;
  --edge-c360: #8fd0b4;
  --edge-int: #e2b07a;
  --edge-io: #c4b5fd;
  --edge-trust: #e6c7a1;
  --edge-gd: #e7a394;
  --edge-af: #8eb6ff;
  --edge-ux: #9ee7ff;
  --wash-hf: rgba(16, 78, 92, 0.72);
  --wash-data: rgba(22, 48, 112, 0.72);
  --wash-core: rgba(78, 58, 130, 0.62);
  --wash-c360: rgba(18, 78, 62, 0.72);
  --wash-int: rgba(92, 58, 28, 0.7);
  --wash-io: rgba(62, 42, 120, 0.72);
  --wash-trust: rgba(92, 68, 36, 0.72);
  --wash-gd: rgba(110, 48, 42, 0.72);
  --wash-af: rgba(28, 58, 112, 0.72);
  --wash-ux: rgba(18, 72, 96, 0.72);
  --sand: #e6c7a1;
  --panel: rgba(12, 17, 24, 0.78);
  color-scheme: dark;
  font-family: "Avenir Next", "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--ink);
}

body {
  min-height: 100%;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  background:
    radial-gradient(980px 520px at 42% 118%, rgba(27, 150, 255, 0.18), transparent 58%),
    radial-gradient(640px 380px at 78% -10%, rgba(126, 214, 223, 0.08), transparent 60%),
    var(--bg);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: radial-gradient(circle at 40% 88%, #000 0%, transparent 72%);
}

.top, .dock, .workspace { position: relative; z-index: 1; }

.top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  padding: 18px 28px 8px;
}

.sf-logo {
  height: 48px;
  width: auto;
  flex: none;
  display: block;
}

.gate {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  background: var(--bg);
}

.gate-card {
  width: min(360px, calc(100% - 48px));
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 12px;
  margin: 0;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--panel);
}

.gate-card h1 {
  margin: 4px 0 8px;
  font-size: 22px;
  font-weight: 600;
}

.gate-label {
  font-family: "SF Mono", ui-monospace, "Menlo", monospace;
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--faint);
}

.gate-card input {
  width: 100%;
  margin-top: -4px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.28);
  color: var(--ink);
  font: inherit;
}

.gate-error {
  margin: 0;
  color: #e7a394;
  font-size: 13px;
}

body[data-locked="1"] .top,
body[data-locked="1"] .workspace,
body[data-locked="1"] .dock {
  display: none;
}

body:not([data-locked="1"]) .gate {
  display: none;
}

.brand { display: flex; align-items: center; gap: 12px; }

.mark {
  width: 18px;
  display: flex;
  flex-direction: column-reverse;
  gap: 2px;
}

.mark i {
  display: block;
  height: 3px;
  border-radius: 2px;
  border: 1px solid rgba(231, 237, 245, 0.35);
}

.mark i.solid {
  background: var(--blue);
  border-color: var(--blue);
}

.brand-kicker, .kicker, .points-label, .counter, .hint, .idx, .tag, .mod-kicker {
  font-family: "SF Mono", ui-monospace, "Menlo", monospace;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.brand-kicker {
  margin: 0;
  color: var(--faint);
  font-size: 10px;
}

.brand-name {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
}

.top-meta { text-align: right; }

.layer-label {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
}

.counter {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 11px;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 400px;
  gap: 28px;
  padding: 8px 28px 12px;
  min-height: 0;
}

.stage {
  min-height: 0;
  overflow: auto;
  display: flex;
  flex-direction: column;
  padding-bottom: 8px;
}

.stack {
  width: min(920px, 100%);
  margin-top: auto;
  align-self: center;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  align-items: start;
}

.pair .plate { min-width: 0; }

.pair .modules { grid-template-columns: 1fr 1fr; }

.plate {
  border-radius: 14px;
  border: 1px dashed rgba(214, 226, 240, 0.22);
  background: rgba(255, 255, 255, 0.025);
  padding: 9px 14px;
}

.plate[data-kind="outline"] { opacity: 0.72; }

.plate[data-kind="specified"][data-state="sketch"] {
  border-color: rgba(143, 196, 214, 0.45);
}

.plate[data-state="built"] {
  border-style: solid;
  border-color: transparent;
  padding: 14px 14px 12px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.055), transparent 32%),
    linear-gradient(180deg, var(--wash), rgba(8, 12, 18, 0.92));
  box-shadow:
    inset 0 1px 0 var(--edge),
    0 18px 40px rgba(0, 0, 0, 0.28);
}

.plate[data-accent="hf"] {
  --edge: var(--edge-hf);
  --wash: var(--wash-hf);
}

.plate[data-accent="data"] {
  --edge: var(--edge-data);
  --wash: var(--wash-data);
}

.plate[data-accent="core"] {
  --edge: var(--edge-core);
  --wash: var(--wash-core);
}

.plate[data-accent="c360"] {
  --edge: var(--edge-c360);
  --wash: var(--wash-c360);
}

.plate[data-accent="int"] {
  --edge: var(--edge-int);
  --wash: var(--wash-int);
}

.plate[data-accent="io"] {
  --edge: var(--edge-io);
  --wash: var(--wash-io);
}

.plate[data-accent="trust"] {
  --edge: var(--edge-trust);
  --wash: var(--wash-trust);
}

.plate[data-accent="gd"] {
  --edge: var(--edge-gd);
  --wash: var(--wash-gd);
}

.plate[data-accent="af"] {
  --edge: var(--edge-af);
  --wash: var(--wash-af);
}

.plate[data-accent="ux"] {
  --edge: var(--edge-ux);
  --wash: var(--wash-ux);
}

.plate[data-state="built"]:not(.current) {
  padding: 10px 12px 10px;
}

.plate[data-state="built"]:not(.current) .modules {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.plate[data-state="built"]:not(.current) .module {
  width: auto;
  min-height: 0;
  padding: 5px 8px;
  opacity: 0.92;
}

.plate[data-state="built"]:not(.current) .mod-kicker,
.plate[data-state="built"]:not(.current) .detail,
.plate[data-state="built"]:not(.current) .glyph {
  display: none;
}

.plate[data-state="built"]:not(.current) .module strong {
  font-size: 12px;
  font-weight: 500;
}

.plate.rise { animation: rise 520ms cubic-bezier(0.16, 1, 0.3, 1); }

@keyframes rise {
  from { opacity: 0.35; transform: translateY(12px); }
  to { opacity: 1; transform: none; }
}

body[data-phase="outline"] .plate[data-kind="outline"] {
  opacity: 1;
  border-color: rgba(230, 199, 161, 0.45);
  background: rgba(230, 199, 161, 0.05);
}

.plate-head {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 12px;
  align-items: center;
}

.idx {
  color: var(--edge, var(--muted));
  font-size: 12px;
}

.plate[data-state="sketch"] .idx { color: var(--faint); }

.plate-head h2 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.plate-head p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.tag {
  font-size: 10px;
  color: var(--sand);
  border: 1px solid rgba(230, 199, 161, 0.4);
  border-radius: 999px;
  padding: 3px 8px;
}

.modules {
  display: none;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 12px;
}

.plate[data-state="built"] .modules { display: grid; }

.module {
  min-height: 64px;
  padding: 8px 10px 8px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(4, 8, 12, 0.28);
  opacity: 0.38;
  transition: opacity 240ms ease, background 240ms ease, box-shadow 240ms ease;
}

.module.on {
  opacity: 1;
  background: rgba(255, 255, 255, 0.05);
}

.module.hot {
  opacity: 1;
  background: rgba(255, 255, 255, 0.1);
  box-shadow: inset 0 0 0 1px var(--edge);
}

.module[data-tone="security"].hot {
  background: rgba(230, 199, 161, 0.09);
  box-shadow: inset 0 0 0 1px rgba(230, 199, 161, 0.75);
}

.mod-kicker {
  display: block;
  margin-bottom: 4px;
  color: var(--faint);
  font-size: 10px;
}

.module strong {
  display: block;
  font-size: 14px;
  font-weight: 600;
}

.module span.detail {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.glyph {
  display: flex;
  gap: 3px;
  margin-top: 8px;
}

.glyph i {
  width: 16px;
  height: 18px;
  border-radius: 2px;
  background: linear-gradient(180deg, var(--edge), transparent);
}

.narrative {
  min-height: 0;
  overflow: auto;
  padding: 18px 18px 16px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: var(--panel);
  backdrop-filter: blur(16px);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.kicker {
  margin: 0 0 8px;
  color: var(--blue);
  font-size: 11px;
}

h1 {
  margin: 0 0 12px;
  font-size: 30px;
  line-height: 1.15;
  font-weight: 600;
  letter-spacing: -0.02em;
}

#body {
  margin: 0;
  color: #d5deea;
  font-size: 16px;
  line-height: 1.5;
}

.callout {
  margin: 16px 0 0;
  padding: 12px 12px 12px 14px;
  border-left: 2px solid var(--sand);
  background: rgba(230, 199, 161, 0.07);
  color: #f3e6d4;
  font-size: 15px;
  line-height: 1.45;
}

.facts {
  width: 100%;
  margin: 16px 0 0;
  border-collapse: collapse;
  font-size: 13px;
  line-height: 1.35;
}

.facts caption {
  caption-side: top;
  margin: 0 0 8px;
  text-align: left;
  font-family: "SF Mono", ui-monospace, "Menlo", monospace;
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--faint);
}

.facts th,
.facts td {
  padding: 7px 8px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.facts thead th {
  color: var(--faint);
  font-size: 11px;
  font-weight: 600;
}

.facts tbody th {
  color: var(--ink);
  font-weight: 600;
  width: 38%;
}

.points-label {
  margin: 18px 0 8px;
  color: var(--faint);
  font-size: 10px;
}

#points {
  margin: 14px 0 0;
  padding: 0;
  list-style: none;
}

.points-label:not([hidden]) + #points { margin-top: 0; }

#points li {
  position: relative;
  margin: 0 0 8px;
  padding-left: 14px;
  color: #d5deea;
  font-size: 14.5px;
  line-height: 1.4;
}

#points li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.55em;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--blue);
}

.sources {
  margin-top: 18px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.4;
}

.sources summary {
  cursor: pointer;
  color: var(--faint);
  font-family: "SF Mono", ui-monospace, "Menlo", monospace;
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.sources ul {
  margin: 10px 0 0;
  padding: 0;
  list-style: none;
}

.sources li { margin: 0 0 8px; }

.sources a {
  color: #d5deea;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}

.sources .pub {
  color: var(--faint);
}

.dock {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas:
    "progress transport"
    "hint hint";
  gap: 8px 18px;
  align-items: center;
  padding: 8px 28px 16px;
}

.progress {
  grid-area: progress;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.tick {
  width: 10px;
  height: 8px;
  padding: 0;
  border: 0;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.12);
  cursor: pointer;
}

.tick[data-group="hyperforce"] { background: rgba(126, 214, 223, 0.28); }
.tick[data-group="guardian"] { background: rgba(231, 163, 148, 0.5); }
.tick[data-group="data"] { background: rgba(158, 188, 255, 0.28); }
.tick[data-group="core"] { background: rgba(210, 196, 246, 0.38); }
.tick[data-group="c360"] { background: rgba(143, 208, 180, 0.4); }
.tick[data-group="integration"] { background: rgba(226, 176, 122, 0.45); }
.tick[data-group="trust"] { background: rgba(230, 199, 161, 0.5); }
.tick[data-group="agentforce"] { background: rgba(142, 182, 255, 0.45); }
.tick[data-group="interop"] { background: rgba(196, 181, 253, 0.45); }
.tick[data-group="anywhere"] { background: rgba(158, 231, 255, 0.5); }
.tick[data-group="outline"] { background: rgba(230, 199, 161, 0.28); }

.tick[aria-current="step"] {
  background: var(--ink);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.4);
}

.tick.done { filter: brightness(1.35); }

body[data-nav="on"] .plate-head,
body[data-nav="on"] .module { cursor: pointer; }

body[data-nav="on"] .module:hover {
  background: rgba(255, 255, 255, 0.08);
}

body[data-nav="on"] .plate-head:focus-visible,
body[data-nav="on"] .module:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 2px;
}

.switch {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-right: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  user-select: none;
}

.switch input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
}

.switch-track {
  width: 36px;
  height: 20px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.16);
  position: relative;
  flex: none;
}

.switch-track::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #e7edf5;
  transition: transform 160ms ease;
}

.switch input:checked + .switch-track { background: var(--blue); }

.switch input:checked + .switch-track::after { transform: translateX(16px); }

.switch input:focus-visible + .switch-track {
  outline: 2px solid #fff;
  outline-offset: 2px;
}

.transport {
  grid-area: transport;
  display: flex;
  gap: 8px;
}

.btn {
  height: 44px;
  min-width: 108px;
  padding: 0 18px;
  border-radius: 999px;
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}

.btn:disabled {
  opacity: 0.35;
  cursor: default;
}

.btn.ghost {
  color: var(--ink);
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.18);
}

.btn.next {
  color: #041018;
  background: var(--blue);
  border: 0;
}

.btn:focus-visible, .tick:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 2px;
}

.hint {
  grid-area: hint;
  margin: 0;
  color: var(--faint);
  font-size: 10px;
  letter-spacing: 0.04em;
}

@media (max-width: 980px) {
  body { height: auto; min-height: 100%; }
  .workspace { grid-template-columns: 1fr; }
  .pair { grid-template-columns: 1fr; }
  .stage { overflow: visible; min-height: 420px; }
  .narrative { max-height: none; }
  h1 { font-size: 26px; }
}

@media (max-height: 860px) {
  .top { padding: 10px 22px 2px; }
  .workspace { gap: 16px; padding: 4px 22px 4px; }
  .dock { padding: 4px 22px 10px; }
  .plate { padding: 6px 12px; }
  .plate-head h2 { font-size: 14px; }
  .plate-head p { margin-top: 0; font-size: 12px; }
  .plate[data-state="built"].current { padding: 10px 12px 8px; }
  .module { min-height: 0; padding: 8px; }
  h1 { font-size: 24px; }
  #body { font-size: 15px; }
  .callout { margin-top: 10px; padding: 8px 10px; }
}

@media (prefers-reduced-motion: reduce) {
  .plate.rise, .module { animation: none; transition: none; }
}
