/* ============================================================
   SAI.CSS — Scoped styles for /sai
   Inherits all tokens + primitives from style.css
   ============================================================ */

/* ----- Hero ----- */
.sai-hero {
  padding: 64px 0 48px;
  position: relative;
  overflow: hidden;
  border-bottom: 1px solid var(--rule);
}
.sai-hero-inner {
  position: relative;
  z-index: 1;
  max-width: 680px;
}
.sai-hero .crumbs {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--faint);
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.sai-hero .crumbs .sep { color: var(--faint) }
.sai-hero .crumbs .accent { color: var(--accent) }

.sai-h1 {
  font-family: var(--sans);
  font-weight: 600;
  font-size: clamp(2rem, 4.8vw, 3.6rem);
  line-height: 1.05;
  letter-spacing: -0.04em;
  margin: 0 0 20px;
  max-width: 16ch;
  text-wrap: balance;
}
.sai-h1 .soft  { color: var(--soft); font-weight: 500 }
.sai-h1 .accent { color: var(--accent) }

.sai-hero .lede {
  font-size: clamp(1rem, 1.2vw, 1.1rem);
  line-height: 1.6;
  color: var(--soft);
  max-width: 48ch;
  margin: 0 0 28px;
}
.sai-hero .lede strong { color: var(--ink); font-weight: 500 }

.sai-hero .ctas {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

/* ----- Quick Actions grid ----- */
.q-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

.q-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 20px;
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: 12px;
  color: var(--ink);
  transition: all .2s;
  position: relative;
  overflow: hidden;
  text-decoration: none;
}
.q-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  opacity: 0;
  transition: opacity .25s;
}
.q-card:hover { border-color: var(--rule-bold); background: var(--card-2) }
.q-card:hover::before { opacity: .6 }
.q-card:hover .q-ix { color: var(--accent) }

.q-ix {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--faint);
  letter-spacing: .04em;
  transition: color .15s;
}
.q-icon {
  width: 22px;
  height: 22px;
  color: var(--soft);
  flex-shrink: 0;
}
.q-card h3 {
  font-family: var(--sans);
  font-weight: 600;
  font-size: 18px;
  letter-spacing: -0.02em;
  margin: 0;
}
.q-sub {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--faint);
  margin-top: auto;
}

@media (max-width: 720px) {
  .q-grid { grid-template-columns: repeat(2, 1fr) }
}
@media (max-width: 420px) {
  .q-grid { grid-template-columns: 1fr }
}

/* ----- Ask Sai ----- */
.ask-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  align-items: start;
}

.chat-window {
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: 12px;
  overflow: hidden;
  position: sticky;
  top: 72px;
}
.chat-hd {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 16px;
  border-bottom: 1px solid var(--rule);
  background: var(--surface);
}
.chat-live {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--green);
}
.chat-live .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 3px color-mix(in oklab, var(--green) 20%, transparent);
  animation: ping 2s ease-out infinite;
}
.chat-body {
  padding: 20px;
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.7;
  color: var(--ink);
  min-height: 160px;
  white-space: pre-line;
  transition: color .15s;
}
.chat-placeholder {
  color: var(--faint);
  font-style: italic;
}

.faq-buttons {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.faq-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 12px 16px;
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: 8px;
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--soft);
  text-align: left;
  transition: all .15s;
  cursor: pointer;
}
.faq-btn::after {
  content: '→';
  color: var(--faint);
  transition: color .15s, transform .15s;
  flex-shrink: 0;
  margin-left: 8px;
}
.faq-btn:hover {
  border-color: var(--accent-border);
  color: var(--ink);
  background: var(--card-2);
}
.faq-btn:hover::after {
  color: var(--accent);
  transform: translateX(2px);
}
.faq-btn.active {
  border-color: var(--accent-border);
  color: var(--accent);
  background: var(--accent-soft);
}
.faq-btn.active::after {
  color: var(--accent);
}

@media (max-width: 760px) {
  .ask-layout { grid-template-columns: 1fr }
  .chat-window { position: static }
}

/* ----- Capabilities ----- */
.sai-caps {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0;
  border: 1px solid var(--rule);
  border-radius: 12px;
  overflow: hidden;
  background: var(--card);
}

/* Last row: 2 items centred — cols 1 and 2 of 3 */
.sai-cap {
  padding: 22px;
  border-right: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  transition: background .15s;
}
.sai-cap:hover { background: var(--card-2) }
.sai-cap:nth-child(3n) { border-right: 0 }
/* 5 items: last 2 have no bottom border */
.sai-cap:nth-child(4),
.sai-cap:nth-child(5) { border-bottom: 0 }
/* Item 5 — close its right border too */
.sai-cap:nth-child(5) { border-right: 0 }
/* Item 4 spans into col 1 of last row — needs right border back */
.sai-cap:nth-child(4) { border-right: 1px solid var(--rule) }

.sai-cap-hd {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--faint);
  letter-spacing: .04em;
}
.sai-cap h3 {
  font-family: var(--sans);
  font-weight: 500;
  font-size: 16px;
  line-height: 1.2;
  letter-spacing: -0.02em;
  margin: 0 0 8px;
}
.sai-cap p {
  color: var(--soft);
  font-size: 13px;
  line-height: 1.55;
  margin: 0 0 12px;
}
.cap-stack {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--soft);
}
.cap-stack span {
  padding: 2px 7px;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: 5px;
}

@media (max-width: 760px) {
  .sai-caps { grid-template-columns: 1fr 1fr }
  .sai-cap:nth-child(3n) { border-right: 1px solid var(--rule) }
  .sai-cap:nth-child(2n) { border-right: 0 }
  .sai-cap:nth-child(4),
  .sai-cap:nth-child(5) { border-bottom: 1px solid var(--rule) }
  .sai-cap:nth-child(5),
  .sai-cap:last-child  { border-bottom: 0 }
  .sai-cap:last-child  { border-right: 0 }
}
@media (max-width: 480px) {
  .sai-caps { grid-template-columns: 1fr }
  .sai-cap { border-right: 0 !important; border-bottom: 1px solid var(--rule) !important }
  .sai-cap:last-child { border-bottom: 0 !important }
}

/* ----- Portfolio block ----- */
.sai-portfolio {
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: 12px;
  padding: 28px 32px;
}

/* ----- Shared section spacing tweak ----- */
.sai-section { padding-top: 0 }
