/* A117 — Agent Control Stack pages: enterprise UI polish (R6 fixes) */

/* =============================================================
   1. Five-card grid layout (Codex R6 P1 #2)
   ============================================================= */

/* Desktop: 3-2 layout (three on top row, two centered on bottom) */
.agent-stack-grid--5 {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 1.75rem;
  margin-top: 2rem;
}
.agent-stack-grid--5 > .platform-card:nth-child(1) { grid-column: 1 / span 2; }
.agent-stack-grid--5 > .platform-card:nth-child(2) { grid-column: 3 / span 2; }
.agent-stack-grid--5 > .platform-card:nth-child(3) { grid-column: 5 / span 2; }
.agent-stack-grid--5 > .platform-card:nth-child(4) { grid-column: 2 / span 2; }
.agent-stack-grid--5 > .platform-card:nth-child(5) { grid-column: 4 / span 2; }

@media (max-width: 1024px) {
  .agent-stack-grid--5 {
    grid-template-columns: repeat(2, 1fr);
  }
  .agent-stack-grid--5 > .platform-card:nth-child(n) {
    grid-column: auto;
  }
  .agent-stack-grid--5 > .platform-card:nth-child(5) {
    grid-column: 1 / -1;
    max-width: 50%;
    margin: 0 auto;
  }
}

@media (max-width: 640px) {
  .agent-stack-grid--5 {
    grid-template-columns: 1fr;
    gap: 1.25rem;
  }
  .agent-stack-grid--5 > .platform-card:nth-child(n),
  .agent-stack-grid--5 > .platform-card:nth-child(5) {
    grid-column: auto;
    max-width: 100%;
    margin: 0;
  }
}

/* =============================================================
   2. Five-card color theming (matches platform.html pattern)
   ============================================================= */

.agent-stack-grid--5 .platform-card { --card-color: #60a5fa; transition: transform 0.3s, box-shadow 0.3s; }
.agent-stack-grid--5 .platform-card h3 { transition: color 0.3s; }

.agent-stack-grid--5 .platform-card:nth-child(1) { --card-color: #3b82f6; }
.agent-stack-grid--5 .platform-card:nth-child(1) .icon-box {
  background: linear-gradient(135deg, rgba(59,130,246,0.22), rgba(59,130,246,0.08)) !important;
  color: #60a5fa !important;
  box-shadow: 0 4px 16px rgba(59,130,246,0.18);
}
.agent-stack-grid--5 .platform-card:nth-child(1):hover h3 { color: #93c5fd !important; }

.agent-stack-grid--5 .platform-card:nth-child(2) { --card-color: #10b981; }
.agent-stack-grid--5 .platform-card:nth-child(2) .icon-box {
  background: linear-gradient(135deg, rgba(16,185,129,0.22), rgba(16,185,129,0.08)) !important;
  color: #34d399 !important;
  box-shadow: 0 4px 16px rgba(16,185,129,0.18);
}
.agent-stack-grid--5 .platform-card:nth-child(2):hover h3 { color: #6ee7b7 !important; }

.agent-stack-grid--5 .platform-card:nth-child(3) { --card-color: #06b6d4; }
.agent-stack-grid--5 .platform-card:nth-child(3) .icon-box {
  background: linear-gradient(135deg, rgba(6,182,212,0.22), rgba(6,182,212,0.08)) !important;
  color: #22d3ee !important;
  box-shadow: 0 4px 16px rgba(6,182,212,0.18);
}
.agent-stack-grid--5 .platform-card:nth-child(3):hover h3 { color: #67e8f9 !important; }

.agent-stack-grid--5 .platform-card:nth-child(4) { --card-color: #8b5cf6; }
.agent-stack-grid--5 .platform-card:nth-child(4) .icon-box {
  background: linear-gradient(135deg, rgba(139,92,246,0.22), rgba(139,92,246,0.08)) !important;
  color: #a78bfa !important;
  box-shadow: 0 4px 16px rgba(139,92,246,0.18);
}
.agent-stack-grid--5 .platform-card:nth-child(4):hover h3 { color: #c4b5fd !important; }

.agent-stack-grid--5 .platform-card:nth-child(5) { --card-color: #f59e0b; }
.agent-stack-grid--5 .platform-card:nth-child(5) .icon-box {
  background: linear-gradient(135deg, rgba(245,158,11,0.22), rgba(245,158,11,0.08)) !important;
  color: #fbbf24 !important;
  box-shadow: 0 4px 16px rgba(245,158,11,0.18);
}
.agent-stack-grid--5 .platform-card:nth-child(5):hover h3 { color: #fcd34d !important; }

.agent-stack-grid--5 .platform-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 16px 48px rgba(0,0,0,0.32), 0 0 0 1px var(--card-color, rgba(96,165,250,0.4));
}

.agent-stack-grid--5 .platform-card .label {
  color: var(--card-color);
  font-size: 0.78em;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 0.75rem;
}

/* =============================================================
   3. Mapping tables — glass-shell enterprise treatment (R6 P2 #5)
   ============================================================= */

.ts-mapping-table {
  background: linear-gradient(180deg, rgba(255,255,255,0.045), rgba(255,255,255,0.015));
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: 14px;
  padding: 0;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 12px 40px rgba(0,0,0,0.28), inset 0 1px 0 rgba(255,255,255,0.06);
  overflow: hidden;
  margin: 2rem 0;
}

.ts-mapping-table table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  background: transparent;
  font-size: 0.95em;
}

.ts-mapping-table thead th {
  background: linear-gradient(135deg, rgba(96,165,250,0.16), rgba(59,130,246,0.06));
  color: rgb(191,219,254);
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 0.78em;
  padding: 1.1rem 1.4rem;
  border-bottom: 2px solid rgba(96,165,250,0.32);
  text-align: left;
}

.ts-mapping-table tbody td {
  padding: 1.1rem 1.4rem;
  vertical-align: top;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  transition: background 0.25s ease, color 0.25s ease;
  line-height: 1.55;
}

.ts-mapping-table tbody tr:last-child td { border-bottom: none; }

.ts-mapping-table tbody tr:nth-child(even) td {
  background: rgba(255,255,255,0.018);
}

.ts-mapping-table tbody tr:hover td {
  background: rgba(96,165,250,0.07);
}

.ts-mapping-table tbody td:first-child {
  font-weight: 600;
  color: rgb(191,219,254);
  border-left: 3px solid transparent;
  transition: border-color 0.25s ease;
  white-space: nowrap;
}

.ts-mapping-table tbody tr:hover td:first-child {
  border-left-color: rgb(96,165,250);
  color: rgb(219,234,254);
}

/* =============================================================
   4. Comparison table — special treatment for /architecture.html
   ============================================================= */

.ts-comparison-table {
  /* Inherits .ts-mapping-table base, then overrides */
  margin: 2.5rem 0;
}

.ts-comparison-table table { font-size: 0.92em; }

.ts-comparison-table thead th:nth-child(2) {
  background: linear-gradient(135deg, rgba(148,163,184,0.14), rgba(100,116,139,0.06));
  color: rgb(203,213,225);
}
.ts-comparison-table thead th:nth-child(3) {
  background: linear-gradient(135deg, rgba(167,139,250,0.18), rgba(139,92,246,0.06));
  color: rgb(216,180,254);
}

.ts-comparison-table tbody td:nth-child(2) {
  color: rgba(203,213,225,0.78);
  font-style: italic;
}

.ts-comparison-table tbody td:nth-child(3) {
  color: rgb(233,213,255);
  font-weight: 500;
  border-left: 1px solid rgba(167,139,250,0.18);
}

.ts-comparison-table tbody tr:hover td:nth-child(3) {
  background: rgba(167,139,250,0.08);
}

/* =============================================================
   5. Callouts (panel-style for "How we run it" + footer notes)
   ============================================================= */

.ts-callout {
  background: linear-gradient(135deg, rgba(96,165,250,0.10), rgba(59,130,246,0.03));
  border-left: 3px solid var(--card-color, rgba(96,165,250,0.7));
  padding: 0.9rem 1.1rem;
  border-radius: 8px;
  margin-top: 1.1rem;
  font-size: 0.9em;
  line-height: 1.55;
  position: relative;
  transition: background 0.3s ease;
}

.ts-callout:before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 8px;
  pointer-events: none;
  background: linear-gradient(135deg, rgba(255,255,255,0.04), transparent);
}

.ts-callout strong {
  color: var(--card-color, rgb(147,197,253));
  font-weight: 600;
  letter-spacing: 0.02em;
}

/* =============================================================
   6. Bullets + tagline (updated)
   ============================================================= */

.ts-bullets {
  list-style: none;
  padding-left: 0;
  margin: 1.75rem 0;
}

.ts-bullets li {
  padding: 0.85rem 0 0.85rem 2rem;
  position: relative;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  transition: padding-left 0.25s ease, color 0.25s ease;
}

.ts-bullets li:before {
  content: "";
  position: absolute;
  left: 0.5rem;
  top: 50%;
  width: 0.75rem;
  height: 2px;
  background: linear-gradient(90deg, rgb(96,165,250), rgb(167,139,250));
  border-radius: 2px;
  transform: translateY(-50%);
  transition: width 0.25s ease;
}

.ts-bullets li:hover {
  padding-left: 2.25rem;
  color: rgba(255,255,255,0.95);
}

.ts-bullets li:hover:before {
  width: 1.25rem;
}

.ts-bullets li:last-child { border-bottom: none; }

.ts-bullets li strong {
  color: rgb(147,197,253);
  font-weight: 600;
  margin-right: 0.5rem;
}

.ts-tagline {
  font-size: 1.15em;
  font-weight: 500;
  text-align: center;
  margin: 2rem 0 1rem;
  background: linear-gradient(135deg, #60a5fa, #a78bfa);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  letter-spacing: 0.02em;
}

/* =============================================================
   7. CTA row + meta + eyebrow
   ============================================================= */

.ts-cta-row {
  margin-top: 1.75rem;
  display: flex;
  gap: 0.85rem;
  flex-wrap: wrap;
  justify-content: center;
}

.ts-meta {
  font-size: 0.9em;
  color: rgba(255,255,255,0.55);
  margin-top: 0.6rem;
}

.ts-eyebrow {
  display: inline-block;
  font-size: 0.78em;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgb(147,197,253);
  margin-bottom: 0.5rem;
  padding: 0.2rem 0.7rem;
  background: rgba(96,165,250,0.08);
  border: 1px solid rgba(96,165,250,0.18);
  border-radius: 999px;
}

/* =============================================================
   8. Long-form prose (blog post)
   ============================================================= */

.ts-prose {
  max-width: 760px;
  margin: 0 auto;
  line-height: 1.75;
  font-size: 1.05em;
  color: rgba(255,255,255,0.86);
}

.ts-prose p {
  margin-bottom: 1.4rem;
}

.ts-prose h2 {
  margin-top: 3rem;
  margin-bottom: 1.1rem;
  font-size: 1.7em;
  background: linear-gradient(135deg, #f3f4f6, #cbd5e1);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  letter-spacing: -0.01em;
  position: relative;
  padding-bottom: 0.7rem;
}

.ts-prose h2:after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  width: 3rem;
  height: 2px;
  background: linear-gradient(90deg, rgb(96,165,250), rgb(167,139,250));
  border-radius: 2px;
}

.ts-prose ul {
  padding-left: 1.5rem;
  margin-bottom: 1.4rem;
}

.ts-prose ul li {
  margin-bottom: 0.6rem;
}

.ts-prose em {
  color: rgba(167,139,250,0.85);
  font-style: italic;
}

.ts-prose a {
  color: rgb(96,165,250);
  text-decoration: underline;
  text-decoration-color: rgba(96,165,250,0.4);
  text-underline-offset: 3px;
  transition: text-decoration-color 0.2s;
}

.ts-prose a:hover {
  text-decoration-color: rgb(96,165,250);
}

/* =============================================================
   9. Stagger entrance animations
   ============================================================= */

.ts-stagger > * {
  opacity: 0;
  transform: translateY(12px);
  animation: ts-stagger-in 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.ts-stagger > *:nth-child(1) { animation-delay: 0.05s; }
.ts-stagger > *:nth-child(2) { animation-delay: 0.12s; }
.ts-stagger > *:nth-child(3) { animation-delay: 0.19s; }
.ts-stagger > *:nth-child(4) { animation-delay: 0.26s; }
.ts-stagger > *:nth-child(5) { animation-delay: 0.33s; }
.ts-stagger > *:nth-child(6) { animation-delay: 0.40s; }
.ts-stagger > *:nth-child(7) { animation-delay: 0.47s; }

@keyframes ts-stagger-in {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .ts-stagger > * {
    opacity: 1;
    transform: none;
    animation: none;
  }
}

/* =============================================================
   10. Section rhythm corrections
   ============================================================= */

.section-alt {
  background: linear-gradient(180deg, rgba(255,255,255,0.012), rgba(255,255,255,0.025));
  border-top: 1px solid rgba(255,255,255,0.04);
  border-bottom: 1px solid rgba(255,255,255,0.04);
}

/* Confine width on /architecture.html accordion section */
.accordion-item.glass.glass--card {
  margin-bottom: 0.8rem;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.accordion-item.glass.glass--card:hover {
  transform: translateX(4px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.2);
}

.accordion-item.glass.glass--card.open {
  border-color: rgba(96,165,250,0.32) !important;
  box-shadow: 0 8px 24px rgba(96,165,250,0.12);
}

/* =============================================================
   11. Mobile polish
   ============================================================= */

@media (max-width: 768px) {
  .ts-mapping-table { font-size: 0.88em; border-radius: 10px; }
  .ts-mapping-table thead th, .ts-mapping-table tbody td { padding: 0.85rem 0.95rem; }
  .ts-mapping-table tbody td:first-child { white-space: normal; }
  .ts-prose { font-size: 1em; }
  .ts-prose h2 { font-size: 1.5em; margin-top: 2.4rem; }
  .ts-bullets li { padding: 0.75rem 0 0.75rem 1.6rem; }
}

/* =============================================================
   12. Cross-references / related-cards section
   ============================================================= */

.ts-three-columns .ts-card {
  background: linear-gradient(180deg, rgba(255,255,255,0.04), rgba(255,255,255,0.015));
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 12px;
  padding: 1.4rem;
  transition: transform 0.3s, border-color 0.3s, box-shadow 0.3s;
}

.ts-three-columns .ts-card:hover {
  transform: translateY(-3px);
  border-color: rgba(96,165,250,0.32);
  box-shadow: 0 12px 32px rgba(0,0,0,0.22);
}

.ts-three-columns .ts-card h3 {
  margin-top: 0;
  margin-bottom: 0.5rem;
  font-size: 1.15em;
}

.ts-three-columns .ts-card h3 a {
  color: rgb(147,197,253);
  text-decoration: none;
  transition: color 0.25s;
}

.ts-three-columns .ts-card:hover h3 a {
  color: rgb(219,234,254);
}

.ts-three-columns .ts-card p {
  color: rgba(255,255,255,0.7);
  margin: 0;
  font-size: 0.95em;
  line-height: 1.55;
}

/* =============================================================
   13. Stat values bigger on Agent Stack hero
   ============================================================= */

main .hero .stats-row .stat-value {
  font-size: clamp(2.2rem, 4.5vw, 3.4rem);
  font-weight: 700;
  background: linear-gradient(135deg, #60a5fa, #a78bfa);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* =============================================================
   14. /platform.html — cross-page polish for 4-card grid
   ============================================================= */

.agent-stack-grid--4 {
  gap: 1.75rem;
  margin-top: 1.5rem;
}

.agent-stack-grid--4 .platform-card {
  transition: transform 0.3s, box-shadow 0.3s;
}

.agent-stack-grid--4 .platform-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 16px 48px rgba(0,0,0,0.32), 0 0 0 1px var(--card-color, rgba(96,165,250,0.4));
}

.agent-stack-grid--4 .platform-card .icon-box {
  box-shadow: 0 4px 16px var(--card-shadow, rgba(96,165,250,0.18));
}

/* Per-card glow color (matches existing nth-child color theme on /platform.html) */
.agent-stack-grid--4 .platform-card:nth-child(1) { --card-shadow: rgba(59,130,246,0.18); }
.agent-stack-grid--4 .platform-card:nth-child(2) { --card-shadow: rgba(16,185,129,0.18); }
.agent-stack-grid--4 .platform-card:nth-child(3) { --card-shadow: rgba(6,182,212,0.18); }
.agent-stack-grid--4 .platform-card:nth-child(4) { --card-shadow: rgba(139,92,246,0.18); }
