/*
  Architecture canvas — modular teaser diagram for /architecture-new.
  Keeps the seven-column frame; one example per module, the rest obscured.
*/

.arch-canvas-section {
  --arch-ink: var(--ink);
  --arch-bg: #fafaf7;
  --arch-card: #ffffff;
  --arch-line: #e4e4dc;
  --arch-muted: var(--muted);
  --arch-band: #d9c9b0;
  --arch-band-deep: #c3b091;
  --arch-obscured: #f0eee8;
  padding-block: clamp(2.5rem, 5vw, 4rem);
}

.arch-canvas-section > .wrap {
  max-width: min(100%, 1180px);
}

.arch-canvas-intro {
  max-width: 42rem;
  margin-bottom: clamp(1.5rem, 3vw, 2.25rem);
}

.arch-canvas-intro .eyebrow {
  color: var(--arch-band-deep);
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-size: 0.75rem;
}

.arch-canvas-kicker {
  margin: 0.35rem 0 0;
  font-size: clamp(0.95rem, 1.6vw, 1.05rem);
  color: var(--arch-muted);
  line-height: 1.55;
}

.arch-canvas {
  --arch-cols: 7;
  position: relative;
  display: grid;
  gap: 0.65rem;
  container-type: inline-size;
}

.arch-layers {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(var(--arch-cols), minmax(0, 1fr));
  grid-template-rows: auto auto;
  gap: 0.65rem;
  align-items: stretch;
}

.arch-layer {
  margin: 0;
  display: grid;
  grid-template-rows: subgrid;
  grid-row: span 2;
  gap: 0.65rem;
  align-content: stretch;
}

.arch-layer[data-span="1"] {
  grid-column: span 1;
}

.arch-layer[data-span="2"] {
  grid-column: span 2;
}

.arch-layer[data-span="3"] {
  grid-column: span 3;
}

.arch-group {
  margin: 0;
  padding: 0.85rem 0.85rem 0.9rem 1.75rem;
  background: var(--arch-ink);
  color: var(--arch-bg);
  border-radius: 2px;
  min-height: 100%;
  height: 100%;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  gap: 0.25rem;
  list-style: none;
}

.arch-group::-webkit-details-marker,
.arch-group::marker {
  display: none;
  content: "";
}

@supports not (grid-template-rows: subgrid) {
  .arch-layers {
    grid-template-rows: none;
    align-items: start;
  }

  .arch-layer {
    grid-template-rows: none;
    grid-row: auto;
  }

  .arch-group {
    min-height: 6.25rem;
    height: auto;
  }
}

.arch-group-label {
  font-size: clamp(1rem, 1.35vw, 1.2rem);
  font-weight: 800;
  letter-spacing: 0.01em;
  line-height: 1.15;
}

.arch-group-sub {
  margin: 0;
  font-size: 0.75rem;
  line-height: 1.4;
  opacity: 0.72;
  font-weight: 500;
}

.arch-layer-body {
  display: grid;
  gap: 0.65rem;
  align-items: stretch;
}

.arch-layer-cta {
  display: none;
}

.arch-layer[data-span="1"] .arch-layer-body {
  grid-template-columns: minmax(0, 1fr);
}

.arch-layer[data-span="2"] .arch-layer-body {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.arch-layer[data-span="3"] .arch-layer-body {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

/* Node field: edges behind cards, dots/stems in front (left gutter). */
.arch-module-nodes {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: visible;
  opacity: 0;
  transition: opacity 700ms var(--ease);
}

.arch-module-nodes--edges {
  z-index: 0;
}

.arch-module-nodes--nodes {
  z-index: 2;
}

.arch-module-nodes.is-visible {
  opacity: 1;
}

.arch-module-nodes__svg {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.arch-module-nodes__edge {
  fill: none;
  stroke: var(--ink, #1a1a1a);
  stroke-width: 1;
  stroke-linecap: square;
  opacity: 0.14;
  vector-effect: non-scaling-stroke;
}

.arch-module-nodes__edge--bridge {
  opacity: 0.22;
  stroke: color-mix(in srgb, var(--green-ink, #356647) 35%, var(--ink, #1a1a1a));
}

.arch-module-nodes__edge--major {
  opacity: 0.3;
  stroke-width: 1.25;
}

.arch-module-nodes__edge--drop {
  opacity: 0.18;
}

.arch-has-node {
  cursor: pointer;
}

.arch-module-nodes__hit {
  pointer-events: none;
  outline: none;
}

.arch-module-nodes__hit.is-alive .arch-module-nodes__halo {
  opacity: 0.72;
}

.arch-module-nodes__hit.is-alive .arch-module-nodes__halo--quiet {
  opacity: 0.42;
}

.arch-module-nodes__node {
  fill: var(--ink, #1a1a1a);
  opacity: 0.42;
  transition: opacity 220ms ease;
}

.arch-module-nodes__node--green {
  fill: var(--green, #beebcc);
  opacity: 1;
}

.arch-module-nodes__halo {
  fill: var(--green, #beebcc);
  opacity: 0.32;
  transition: opacity 220ms ease;
}

.arch-module-nodes__halo--quiet {
  fill: var(--ink, #1a1a1a);
  opacity: 0.12;
}

.arch-module-nodes__hit--major .arch-module-nodes__halo {
  opacity: 0.4;
}

@media (prefers-reduced-motion: reduce) {
  .arch-module-nodes__hit {
    transition: none;
  }
}

.arch-module {
  position: relative;
  z-index: 1;
  margin: 0;
  background: var(--arch-obscured);
  border: 1px solid var(--arch-line);
  border-radius: 2px;
  display: flex;
  flex-direction: column;
  min-height: 100%;
  /* Keep module chrome above the node layer's hit area, under the SVG. */
  isolation: isolate;
}

.arch-module--featured {
  border-width: 4px;
  border-color: var(--arch-ink);
  box-shadow: 0 0 0 1px var(--arch-ink);
}

.arch-module-head {
  display: flex;
  align-items: flex-start;
  min-height: 3.85rem;
  padding: 0.75rem 0.85rem 0.75rem 1.7rem;
  box-sizing: border-box;
  background: color-mix(in srgb, var(--paper) 55%, #fff);
  border-bottom: 1px solid var(--arch-line);
}

.arch-module-title {
  margin: 0;
  font-size: 0.875rem;
  font-weight: 800;
  line-height: 1.25;
  letter-spacing: -0.01em;
}

.arch-module-list {
  list-style: none;
  margin: 0;
  padding: 0;
  flex: 1;
  background: var(--arch-obscured);
}

.arch-teaser {
  --arch-teaser-h: 4.75rem;
  box-sizing: border-box;
  margin: 0;
  min-height: var(--arch-teaser-h);
  height: var(--arch-teaser-h);
  padding: 0.65rem 0.85rem 0.65rem 1.7rem;
  border-bottom: 1px solid var(--arch-line);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
}

.arch-teaser:last-child {
  border-bottom: 0;
}

.arch-teaser--example {
  background: var(--arch-card);
  gap: 0.2rem;
}

.arch-teaser-eg {
  display: block;
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  line-height: 1.2;
  color: var(--subtle);
}

.arch-teaser-label {
  display: block;
  font-size: 0.78rem;
  line-height: 1.35;
  font-weight: 500;
  color: var(--ink-soft);
}

.arch-teaser--obscured {
  --arch-bar: color-mix(in srgb, var(--subtle) 28%, transparent);
  background: var(--arch-obscured);
  gap: 0.4rem;
}

.arch-teaser--accent {
  background: color-mix(in srgb, var(--green, #beebcc) 62%, #fff);
}

.arch-teaser--accent.arch-teaser--obscured {
  --arch-bar: color-mix(in srgb, var(--green-ink, #356647) 22%, transparent);
}

.arch-teaser--obscured::before,
.arch-teaser--obscured-tall::after {
  content: "";
  display: block;
  width: 62%;
  height: 0.5rem;
  border-radius: 1px;
  background: var(--arch-bar);
  flex: 0 0 auto;
}

.arch-teaser--obscured-narrow::before {
  width: 42%;
}

.arch-teaser--obscured-wide::before {
  width: 78%;
}

.arch-teaser--obscured-tall::after {
  width: 48%;
}

.arch-teaser--obscured-tall.arch-teaser--obscured-wide::after {
  width: 70%;
}

.arch-teaser--obscured-tall.arch-teaser--obscured-narrow::after {
  width: 36%;
}

.arch-bands {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(var(--arch-cols), minmax(0, 1fr));
  gap: 0.65rem;
  margin-top: 0.15rem;
}

.arch-band {
  margin: 0;
  padding: 0.85rem 0.9rem;
  background: var(--arch-band);
  color: var(--arch-ink);
  border-radius: 2px;
}

.arch-band--narrative {
  grid-column: 2 / span 3;
}

.arch-band--product {
  grid-column: 5 / span 2;
}

.arch-band-title {
  margin: 0 0 0.3rem;
  font-size: 0.875rem;
  font-weight: 800;
  line-height: 1.25;
  letter-spacing: -0.01em;
}

.arch-band-copy {
  margin: 0;
  font-size: 0.72rem;
  line-height: 1.45;
  opacity: 0.85;
}

.arch-evidence {
  --arch-evidence-knockout: var(--arch-bg);
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(7.5rem, 10.5rem) minmax(0, 1fr);
  gap: 0;
  align-items: stretch;
  margin: 0;
  padding: 0;
  background: #1a1a1a;
  color: var(--arch-evidence-knockout);
  border-radius: 2px;
  overflow: hidden;
}

.arch-evidence-rail {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  padding: 1rem 0.35rem 1rem 1.05rem;
  background: transparent;
  color: inherit;
}

.arch-evidence-label {
  display: block;
  margin: 0;
  font-size: clamp(0.95rem, 1.6vw, 1.15rem);
  font-weight: 800;
  letter-spacing: 0.04em;
  line-height: 1.15;
  text-transform: uppercase;
  white-space: nowrap;
  color: inherit;
}

.arch-evidence-body {
  display: flex;
  align-items: center;
  padding: 1rem 1.15rem 1rem 0.65rem;
  background: transparent;
}

.arch-evidence-copy {
  margin: 0;
  font-size: 0.84rem;
  line-height: 1.55;
  max-width: 62ch;
  color: inherit;
  opacity: 0.92;
}

.arch-canvas-note {
  margin: 1.25rem 0 0;
  font-size: 0.875rem;
  color: var(--muted);
  max-width: 48ch;
}

/* Entrance motion */
.arch-layer,
.arch-module,
.arch-band,
.arch-evidence {
  opacity: 0;
  transform: translateY(12px);
  animation: arch-rise 700ms var(--ease) forwards;
}

.arch-layer:nth-child(1) { animation-delay: 40ms; }
.arch-layer:nth-child(2) { animation-delay: 90ms; }
.arch-layer:nth-child(3) { animation-delay: 140ms; }
.arch-layer:nth-child(4) { animation-delay: 190ms; }

.arch-module:nth-child(1) { animation-delay: 160ms; }
.arch-module:nth-child(2) { animation-delay: 200ms; }
.arch-module:nth-child(3) { animation-delay: 240ms; }
.arch-module:nth-child(4) { animation-delay: 280ms; }
.arch-module:nth-child(5) { animation-delay: 320ms; }
.arch-module:nth-child(6) { animation-delay: 360ms; }
.arch-module:nth-child(7) { animation-delay: 400ms; }

.arch-band--narrative { animation-delay: 460ms; }
.arch-band--product { animation-delay: 520ms; }
.arch-evidence { animation-delay: 580ms; }

@keyframes arch-rise {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .arch-layer,
  .arch-module,
  .arch-band,
  .arch-evidence {
    opacity: 1;
    transform: none;
    animation: none;
  }
}

/* Desktop: layers always expanded; summary is not interactive chrome */
@container (min-width: 921px) {
  .arch-layer > .arch-layer-body {
    display: grid;
  }

  .arch-group {
    pointer-events: none;
    cursor: default;
  }
}

@container (max-width: 920px) {
  .arch-canvas {
    --arch-cols: 1;
  }

  .arch-layers,
  .arch-bands {
    grid-template-columns: 1fr;
  }

  .arch-layers {
    grid-template-rows: none;
    gap: 0.75rem;
  }

  .arch-layer[data-span="1"],
  .arch-layer[data-span="2"],
  .arch-layer[data-span="3"],
  .arch-band--narrative,
  .arch-band--product,
  .arch-evidence {
    grid-column: 1 / -1;
  }

  .arch-layer {
    grid-template-rows: none;
    grid-row: auto;
    border: 1px solid var(--arch-line);
    border-radius: 2px;
    background: var(--arch-card);
    overflow: hidden;
    gap: 0;
  }

  .arch-group {
    min-height: 0;
    height: auto;
    padding: 0.95rem 2.75rem 0.95rem 1.1rem;
    border-radius: 0;
    cursor: pointer;
    position: relative;
    pointer-events: auto;
    background: #1a1a1a;
    color: var(--arch-bg);
  }

  .arch-group::after {
    content: "";
    position: absolute;
    right: 1.1rem;
    top: 50%;
    width: 0.55rem;
    height: 0.55rem;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: translateY(-65%) rotate(45deg);
    opacity: 0.75;
    transition: transform 180ms var(--ease);
  }

  .arch-layer[open] > .arch-group::after {
    transform: translateY(-20%) rotate(225deg);
  }

  .arch-layer[open] > .arch-group {
    border-bottom: 1px solid var(--arch-line);
  }

  .arch-layer-body {
    grid-template-columns: 1fr !important;
    gap: 0.55rem;
    padding: 0.65rem;
    background: var(--arch-card);
  }

  .arch-layer:not([open]) > .arch-layer-body {
    display: none;
  }

  .arch-module {
    border: 1px solid var(--arch-line);
  }

  .arch-layer-cta {
    display: flex;
    justify-content: stretch;
    padding: 0.15rem 0 0.25rem;
  }

  .arch-layer-cta .btn-knockout {
    width: 100%;
  }

  .arch-bands {
    margin-top: 0.35rem;
  }
}

@media (max-width: 1100px) and (min-width: 721px) {
  .arch-canvas-scroll {
    overflow-x: auto;
    overscroll-behavior-x: contain;
    padding-bottom: 0.5rem;
    margin-inline: calc(var(--pad) * -0.25);
    padding-inline: calc(var(--pad) * 0.25);
  }

  .arch-canvas-scroll .arch-canvas {
    min-width: 980px;
  }

  .arch-layers {
    min-width: 980px;
  }
}

@media (max-width: 720px) {
  .arch-evidence {
    grid-template-columns: 1fr;
  }

  .arch-evidence-rail {
    justify-content: flex-start;
    padding: 0.85rem 1rem;
  }
}
