/* Silos: six walled cells, one per person and their AI, then one shared library. */

[data-diagram="silos"] { height: 420px; }
@media (max-width: 1023px) { [data-diagram="silos"] { height: 600px; } }
@media (max-width: 599px) { [data-diagram="silos"] { height: 640px; } }

.dg-silos {
  height: 100%;
  display: flex;
  flex-direction: column;
  gap: 14px;
  color: var(--ink);
  font-family: var(--font-do);
  font-size: 14px;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
}
.dg-silos *, .dg-silos *::before, .dg-silos *::after { box-sizing: border-box; }

/* The two-state toggle */
.dg-silos-controls {
  display: flex;
  align-self: flex-start;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-control);
  background: var(--paper);
}
.dg-silos-btn {
  min-height: 44px;
  margin: 0;
  padding: 0 16px;
  border: 0;
  border-radius: calc(var(--radius-control) - 1px);
  background: transparent;
  color: var(--ink);
  font: 500 15px/1 var(--font-do);
  cursor: pointer;
}
.dg-silos-btn:hover { background: var(--bar); }
.dg-silos-btn[aria-pressed="true"] { background: var(--ink); color: var(--paper); cursor: default; }
.dg-silos-btn:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }

/* The picture */
.dg-silos-stage {
  position: relative;
  isolation: isolate;
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.dg-silos-grid {
  flex: 1 0 auto;
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
}

/* A cell: walls drawn as separate layers so they can open */
.dg-silos-cell {
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: 9px 10px 10px;
}
.dg-silos-wall { position: absolute; inset: 0; pointer-events: none; }
.dg-silos-wall-solid { border: 1.6px solid var(--ink); border-bottom: 0; }
.dg-silos-wall-dash { border: 1.2px dashed var(--line-strong); border-bottom: 0; opacity: 0; }
.dg-silos-floor {
  position: absolute;
  bottom: 0;
  width: 50%;
  height: 1.6px;
  background: var(--ink);
  pointer-events: none;
}
.dg-silos-floor-l { left: 0; transform-origin: 0 50%; }
.dg-silos-floor-r { right: 0; transform-origin: 100% 50%; }

.dg-silos-head { font-size: 14px; line-height: 19px; font-weight: 500; }
.dg-silos-ai { color: var(--ink-soft); font-weight: 400; white-space: nowrap; }

.dg-silos-body { flex: 1 1 auto; display: grid; margin-top: 8px; min-width: 0; }
.dg-silos-now, .dg-silos-then {
  grid-area: 1 / 1;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
  min-width: 0;
}
.dg-silos-then { justify-content: flex-end; }

.dg-silos-chip {
  position: relative;
  z-index: 4;
  display: inline-block;
  max-width: 100%;
  padding: 4px 8px;
  border-radius: var(--radius-control);
  background: var(--bar);
  font-size: 14px;
  line-height: 19px;
  font-weight: 500;
}
.dg-silos-chip--hl { background: var(--highlight); }
.dg-silos-mon { margin-top: auto; }
.dg-silos-note { font-size: 13px; line-height: 17px; color: var(--ink-soft); }
.dg-silos-say { font-family: var(--font-say); font-size: 16px; line-height: 21px; }
.dg-silos-tag {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  max-width: 100%;
  opacity: 0;
}

/* Under the cells: the duplicate marker */
.dg-silos-gap { position: relative; flex: 0 0 56px; }
.dg-silos-dup {
  position: absolute;
  top: 16px;
  left: 0;
  white-space: nowrap;
  font-size: 14px;
  line-height: 19px;
  font-weight: 500;
}

/* The shared library */
.dg-silos-band {
  position: relative;
  z-index: 2;
  flex: 0 0 auto;
  padding: 10px 0 9px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-panel);
  background: var(--bar);
  opacity: 0;
}
.dg-silos-shelf { display: flex; justify-content: space-between; }
.dg-silos-item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  min-width: 0;
  padding: 0 10px;
}
.dg-silos-item .dg-silos-chip {
  padding: 3px 7px;
  border: 1px solid var(--line-strong);
  background: var(--paper);
  opacity: 0;
}
.dg-silos-item .dg-silos-chip--hl { border-color: var(--highlight); background: var(--highlight); }
.dg-silos-by { color: var(--ink-soft); font-weight: 400; white-space: nowrap; }
.dg-silos-chip--hl .dg-silos-by { color: var(--ink); }
.dg-silos-sub { opacity: 0; }
.dg-silos-label {
  margin-top: 8px;
  padding: 0 10px;
  font-size: 13px;
  line-height: 17px;
  font-weight: 600;
}

.dg-silos-zone { display: grid; flex: 0 0 auto; }
.dg-silos-zone > * { grid-area: 1 / 1; }
.dg-silos-cap-now, .dg-silos-cap-with { margin: 0; font-size: 15px; line-height: 22px; }
.dg-silos-cap-now { align-self: start; }
.dg-silos-cap-with { flex: 0 0 auto; margin-top: 12px; opacity: 0; }

.dg-silos-svg {
  position: absolute;
  inset: 0;
  z-index: 3;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
}
.dg-silos-brk { fill: none; stroke: var(--ink); stroke-width: 1.2; stroke-linecap: round; }
.dg-silos-link { fill: none; stroke: var(--ink-soft); stroke-width: 1.2; stroke-linecap: round; opacity: 0; }

/* Fixed "with Kortum" frame, used without GSAP or with reduced motion */
.dg-silos--with .dg-silos-wall-solid,
.dg-silos--with .dg-silos-now > *,
.dg-silos--with .dg-silos-dup,
.dg-silos--with .dg-silos-brk,
.dg-silos--with .dg-silos-cap-now { opacity: 0; }
.dg-silos--with .dg-silos-wall-dash,
.dg-silos--with .dg-silos-band,
.dg-silos--with .dg-silos-item .dg-silos-chip,
.dg-silos--with .dg-silos-sub,
.dg-silos--with .dg-silos-tag,
.dg-silos--with .dg-silos-link,
.dg-silos--with .dg-silos-cap-with { opacity: 1; }
.dg-silos--with .dg-silos-floor { transform: scaleX(0); }

/* Tablet: two rows of three, the library below */
@media (max-width: 1023px) {
  .dg-silos-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .dg-silos-gap { flex-basis: 52px; }
  .dg-silos-shelf { flex-wrap: wrap; justify-content: flex-start; gap: 8px 0; }
  .dg-silos-item { max-width: 50%; }
}
@media (min-width: 600px) and (max-width: 1023px) {
  .dg-silos-item[data-k="script"] { order: 1; }
  .dg-silos-item[data-k="monday"] { order: 2; }
  .dg-silos-item[data-k="invoice"] { order: 3; }
  .dg-silos-item[data-k="vpn"] { order: 4; }
}

/* Phone: two columns, three rows */
@media (max-width: 599px) {
  .dg-silos { gap: 12px; }
  .dg-silos-btn { padding: 0 14px; }
  .dg-silos-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .dg-silos-cell { padding: 8px 8px 9px; }
  .dg-silos-head { font-size: 13px; line-height: 18px; }
  .dg-silos-body { margin-top: 6px; }
  .dg-silos-chip { font-size: 13px; line-height: 17px; padding: 4px 7px; }
  .dg-silos-item .dg-silos-chip { padding: 3px 6px; }
  .dg-silos-say { font-size: 15px; line-height: 19px; }
  .dg-silos-gap { flex-basis: 30px; }
  .dg-silos-cap-now { margin-top: 10px; }
  .dg-silos-dup { font-size: 13px; line-height: 17px; }
  .dg-silos-shelf { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 0; }
  .dg-silos-item { max-width: none; padding: 0 8px; }
  .dg-silos-item[data-k="monday"] { order: 1; }
  .dg-silos-item[data-k="invoice"] { order: 2; }
  .dg-silos-item[data-k="script"] { order: 3; }
  .dg-silos-item[data-k="vpn"] { order: 4; }
  .dg-silos-label { margin-top: 6px; padding: 0 8px; }
  .dg-silos-cap-now, .dg-silos-cap-with { font-size: 14px; line-height: 20px; }
  .dg-silos-cap-with { margin-top: 10px; }
}
