/*
 * NEXONOMY · ARCHITECTURE STACK
 * One reusable dark, interactive diagram of the locked 5-layer use-case view
 * (Ingestion → Context & Knowledge → Reasoning Orchestration → Multi-Agent
 * Evaluation → Learning Loop). Click a layer to read what it does.
 *
 * Deliberately spare. The five layers are the whole story: one icon, one name,
 * one plain line each; open a layer for one short paragraph and the line that
 * says what it writes to the Record. Concrete nouns live in the prose, not in
 * walls of tags. Voice is ours (owned verbs, lead the decision layer, concede
 * the verifiable questions, learning loop kept local per D-025 / D-034).
 *
 * Shared across platform.html and the use-case pages. Import after
 * components.css and product.css; page modules extend, never diverge.
 *
 * No-JS / no `.js` root class → every layer is shown open (content is never
 * hidden without JS). The accordion collapse engages only under `.js`.
 */


/* ─── THE FRAME ──────────────────────────────────────────────────────────── */

.archstack {
  border: 1px solid rgba(140,101,247,0.28);
  border-radius: 16px;
  overflow: hidden;
  background:
    radial-gradient(92% 78% at 16% 0%, #15131d 0%, var(--color-surface-0) 70%);
  box-shadow:
    0 40px 80px -32px rgba(0,0,0,0.80),
    0 8px 24px -12px rgba(0,0,0,0.60);
}


/* ─── THE PIPE: RECORD SPINE + THE FIVE LAYERS ───────────────────────────── */

.archstack__pipe { display: flex; }

/* the Decision Record spine threading down the left of every layer */
.archstack__spine {
  position: relative;
  flex-shrink: 0;
  width: 54px;
  border-right: 1px solid var(--color-border);
  background: rgba(140,101,247,0.04);
  display: flex;
  align-items: center;
  justify-content: center;
}
.archstack__spine::before {
  content: '';
  position: absolute;
  left: 50%; top: 20px; bottom: 20px;
  width: 2px;
  background: var(--color-accent);
  transform: translateX(-50%);
}
.archstack__spine span {
  position: relative;
  z-index: 1;
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--color-accent);
  background: var(--color-surface-0);
  padding: 12px 0;
}

.archstack__layers { flex: 1; min-width: 0; }


/* ─── ONE LAYER ──────────────────────────────────────────────────────────── */

.archlayer { border-bottom: 1px solid var(--color-border); }
.archlayer:last-child { border-bottom: none; }
.archlayer__h { margin: 0; }

/* the clickable header — a real button, so keyboard + focus come for free */
.archlayer__head {
  width: 100%;
  display: grid;
  grid-template-columns: 42px 1fr 20px;
  align-items: center;
  gap: 18px;
  padding: 22px 24px;
  background: none;
  border: none;
  text-align: left;
  cursor: pointer;
  color: inherit;
  font: inherit;
  transition: background var(--duration-fast) var(--ease-out);
}
.archlayer__head:hover { background: rgba(255,255,255,0.015); }
.archlayer__head:focus-visible { outline: 2px solid var(--color-accent); outline-offset: -2px; }

.archlayer__icon {
  width: 40px; height: 40px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: rgba(140,101,247,0.08);
  border: 1px solid rgba(140,101,247,0.18);
  color: var(--color-text-muted);
  transition: color var(--duration-fast) var(--ease-out),
              background var(--duration-fast) var(--ease-out),
              border-color var(--duration-fast) var(--ease-out);
}
.archlayer__icon .icon { width: 20px; height: 20px; }

.archlayer__lede { display: flex; flex-direction: column; min-width: 0; }
.archlayer__num {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  color: var(--color-text-muted);
}
.archlayer__name {
  font-family: var(--font-display);
  font-size: 19px;
  letter-spacing: -0.4px;
  font-weight: var(--weight-medium);
  color: var(--color-text-primary);
  margin: 3px 0 2px;
}
.archlayer__verb { font-size: 13.5px; line-height: 19px; color: var(--color-text-secondary); }

.archlayer__chev {
  width: 18px; height: 18px;
  color: var(--color-text-muted);
  transition: transform var(--duration-base) var(--ease-out),
              color var(--duration-fast) var(--ease-out);
}

/* open state: accent the icon + rotate the chevron */
.archlayer--open > .archlayer__h .archlayer__head { background: rgba(140,101,247,0.05); }
.archlayer--open .archlayer__icon {
  color: var(--color-accent);
  background: rgba(140,101,247,0.13);
  border-color: rgba(140,101,247,0.30);
}
.archlayer--open .archlayer__chev { transform: rotate(180deg); color: var(--color-accent); }


/* ─── THE EXPANDING BODY ─────────────────────────────────────────────────── */

/* grid-rows 1fr→0fr gives a smooth height collapse with no reserved space */
.archlayer__body {
  display: grid;
  grid-template-rows: 1fr;
  transition: grid-template-rows var(--duration-base) var(--ease-out);
}
.archlayer__inner {
  overflow: hidden;
  min-height: 0;
  opacity: 1;
  transition: opacity var(--duration-base) var(--ease-out);
}
/* collapse engages only under JS, so no-JS shows every layer open */
.js .archlayer:not(.archlayer--open) > .archlayer__body { grid-template-rows: 0fr; }
.js .archlayer:not(.archlayer--open) .archlayer__inner { opacity: 0; }

.archlayer__pad { padding: 0 24px 24px 84px; }

.archlayer__lead {
  font-size: 15px;
  line-height: 23px;
  color: var(--color-text-secondary);
  max-width: 64ch;
}
.archlayer__lead b { color: var(--color-text-primary); font-weight: var(--weight-medium); }

/* the one line that says what this layer writes to the Record */
.archlayer__adds {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-top: 14px;
  font-size: 13px;
  color: var(--color-text-muted);
}
.archlayer__adds::before {
  content: '';
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--color-accent);
  flex: none;
}


/* ─── THE FOUNDATION BAND (your models, swappable — the only base band) ───── */

.archstack__foundation {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px 16px;
  padding: 18px 24px;
  border-top: 1px solid var(--color-border);
  background: rgba(140,101,247,0.05);
}
.archstack__foundation-title {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: var(--weight-medium);
  letter-spacing: -0.2px;
  color: var(--color-text-primary);
}
.archstack__foundation-models {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.01em;
  color: var(--color-text-dim);
}
.archstack__foundation-note {
  flex-basis: 100%;
  font-size: 13px;
  line-height: 19px;
  color: var(--color-text-muted);
  max-width: 70ch;
}


/* ─── BELOW THE FRAME: ONE GOVERNANCE LINE + THE PAYOFF ───────────────────── */

.arch-caption {
  margin-top: 20px;
  font-size: 14px;
  line-height: 21px;
  color: var(--color-text-muted);
  text-align: center;
}
.arch-caption b { color: var(--color-text-secondary); font-weight: var(--weight-medium); }

.arch-outcomes {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px 14px;
  margin-top: 22px;
}
.arch-outcome {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 11px 18px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-pill);
  background: var(--color-surface-1);
  font-size: 14px;
  color: var(--color-text-secondary);
}
.arch-outcome::before {
  content: '';
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--color-accent);
  flex: none;
}


/* ─── RESPONSIVE ─────────────────────────────────────────────────────────── */

@media (max-width: 900px) {
  .archstack__spine { width: 34px; }
  .archstack__spine span { font-size: 8px; letter-spacing: 0.10em; }
  .archlayer__head { grid-template-columns: 36px 1fr 18px; gap: 13px; padding: 18px 16px; }
  .archlayer__icon { width: 36px; height: 36px; }
  .archlayer__title { font-size: 17px; }
  .archlayer__pad { padding: 0 16px 18px 16px; }
  .archstack__foundation { padding: 16px; }
  .arch-outcomes { justify-content: flex-start; }
}
