/*
 * AI-Assisted Software Engineering (Article 23) — page-scoped visuals
 * Loaded only on the AIE page (template index.php, after in-practice.css).
 * All selectors scoped under .scelaris-service-page .aie- — zero effect elsewhere.
 * Design language: navy/cyan palette, orange #f28c28 as functional accent only.
 */

/* ============ 1. PROCESS VISUAL (HTML/CSS flow, 2 rows + feedback loop) ===== */

.aie-process {
  max-width: 860px;
  margin: 1.6rem auto 0.4rem;
  font-size: 0.86rem;
}
.aie-process-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.6rem;
}
/* connector chevrons between chips (desktop) */
.aie-chip {
  position: relative;
  background: var(--body-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.65rem 0.75rem;
  min-height: 84px;
}
.aie-chip .aie-step {
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--sc-slate, #6b7280);
  display: block;
  margin-bottom: 0.2rem;
}
.aie-chip .aie-name {
  font-weight: 600;
  color: var(--sc-navy, #12324f);
  line-height: 1.25;
  display: block;
}
.aie-chip.human {
  border-color: var(--sc-navy, #12324f);
  background: rgba(18, 50, 79, 0.04);
}
.aie-chip .aie-who {
  display: block;
  margin-top: 0.3rem;
  font-size: 0.72rem;
  color: var(--sc-slate, #6b7280);
}
/* human-driven chips get a small navy dot marker; machine-driven a cyan one */
.aie-chip.human::before,
.aie-chip.ai::before {
  content: "";
  position: absolute;
  top: 0.75rem; right: 0.75rem;
  width: 8px; height: 8px;
  border-radius: 50%;
}
.aie-chip.human::before { background: var(--sc-navy, #12324f); }
.aie-chip.ai::before { background: var(--sc-cyan, #1fc6d5); }

/* row connector arrows (desktop, between chips) */
.aie-chip:not(:last-child)::after {
  content: "";
  position: absolute;
  top: 50%;
  right: -0.52rem;
  width: 0.42rem; height: 0.42rem;
  border-top: 2px solid var(--sc-slate, #6b7280);
  border-right: 2px solid var(--sc-slate, #6b7280);
  transform: translateY(-50%) rotate(45deg);
  opacity: 0.55;
}
/* row break connector: end of row 1 down to start of row 2 */
.aie-process-rowbreak {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 0.35rem 0.5rem 0.35rem 0;
}
.aie-process-rowbreak .aie-breakline {
  flex: 1;
  height: 2px;
  background: var(--border);
  opacity: 0.7;
}
.aie-process-rowbreak .aie-breakarrow {
  width: 0.42rem; height: 0.42rem;
  border-top: 2px solid var(--sc-slate, #6b7280);
  border-right: 2px solid var(--sc-slate, #6b7280);
  transform: rotate(135deg);
  opacity: 0.55;
}

/* FEEDBACK LOOP: refine → backlog */
.aie-feedback {
  margin: 0.7rem auto 0;
  max-width: 640px;
  text-align: center;
  font-size: 0.78rem;
  color: var(--sc-slate, #6b7280);
}
.aie-feedback-line {
  display: block;
  margin: 0.15rem auto 0.25rem;
  width: 66%;
  height: 0;
  border-bottom: 2px dashed var(--sc-orange, #f28c28);
  opacity: 0.75;
}
.aie-feedback .aie-up {
  width: 0.42rem; height: 0.42rem;
  display: inline-block;
  border-left: 2px solid var(--sc-orange, #f28c28);
  border-top: 2px solid var(--sc-orange, #f28c28);
  transform: rotate(45deg);
  margin-right: 0.35rem;
  vertical-align: middle;
}
.aie-feedback strong { color: var(--sc-orange, #f28c28); font-weight: 600; }

/* row 2 (return path) reads right-to-left: visual cue = reversed chevrons handled
   by .aie-chip.left:not(:last-child)::after variant */
.aie-process-row.backrow .aie-chip:not(:first-child)::before-left { display: none; }
.aie-process-row.backrow .aie-chip:not(:last-child)::after {
  transform: translateY(-50%) rotate(225deg);
  right: auto;
  left: -0.52rem;
}

/* ============ 2. ENGINEERING GATES (5 equal pillars) ===================== */

.aie-gates {
  max-width: 860px;
  margin: 1.4rem auto;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0.6rem;
}
.aie-gate {
  position: relative;
  background: var(--body-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.8rem 0.7rem 0.75rem;
  min-height: 118px;
}
.aie-gate .aie-gatenum {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.5rem; height: 1.5rem;
  border-radius: 50%;
  background: var(--sc-navy, #12324f);
  color: #fff;
  font-size: 0.8rem;
  font-weight: 700;
  margin-bottom: 0.45rem;
}
.aie-gate .aie-gatename {
  display: block;
  font-weight: 600;
  color: var(--sc-navy, #12324f);
  font-size: 0.88rem;
  line-height: 1.25;
  margin-bottom: 0.25rem;
}
.aie-gate .aie-gatedesc {
  display: block;
  font-size: 0.74rem;
  color: var(--sc-slate, #6b7280);
  line-height: 1.35;
}
/* gate-to-gate connector: equal chevron, no hierarchy */
.aie-gate:not(:last-child)::after {
  content: "";
  position: absolute;
  top: 50%;
  right: -0.5rem;
  width: 0.4rem; height: 0.4rem;
  border-top: 2px solid var(--sc-slate, #6b7280);
  border-right: 2px solid var(--sc-slate, #6b7280);
  transform: translateY(-50%) rotate(45deg);
  opacity: 0.55;
}
.aie-gates-caption {
  max-width: 860px;
  margin: 0.4rem auto 0;
  font-size: 0.78rem;
  color: var(--sc-slate, #6b7280);
}

/* ============ MOBILE (<= 768px): vertical flows ========================= */

@media (max-width: 768px) {
  .aie-process-row {
    grid-template-columns: 1fr;
    gap: 0.5rem;
  }
  .aie-chip { min-height: 0; }
  /* vertical connector: downward chevron on the right side of chip */
  .aie-chip:not(:last-child)::after {
    top: auto; bottom: -0.48rem; right: 1.2rem;
    transform: rotate(135deg);
    width: 0.42rem; height: 0.42rem;
  }
  .aie-process-row.backrow .aie-chip:not(:last-child)::after {
    left: auto;
    transform: rotate(135deg);
  }
  .aie-process-rowbreak { display: none; }
  .aie-feedback-line { width: 88%; }
  .aie-gates { grid-template-columns: 1fr; gap: 0.5rem; }
  .aie-gate { min-height: 0; }
  .aie-gate:not(:last-child)::after {
    top: auto; bottom: -0.48rem; right: 1.2rem;
    transform: rotate(135deg);
  }
}

/* ============ PRINT / reduced motion: static-safe (no JS involved) ====== */
@media (prefers-reduced-motion: reduce) {
  .aie-process, .aie-gates { scroll-behavior: auto; }
}

/* ============ 3. HERO VISUAL (Article 23) ================================ */

.aie-hero {
  max-width: 860px;
  margin: 1.6rem auto 0.4rem;
}
.aie-hero picture img {
  display: block;
  width: 100%;
  max-width: 860px;
  height: auto;
  border-radius: 4px;
}
.aie-hero figcaption {
  font-size: 0.85rem;
  color: var(--sc-slate, #6b7280);
  margin-top: 0.5rem;
}

/* ============ mobile (<= 768px): full image, slightly tighter margins ==== */
@media (max-width: 768px) {
  .aie-hero { margin: 1.1rem auto 0.2rem; }
  /* image keeps aspect & full composition (no crop); only margins shrink */
  .aie-hero picture img { width: 100%; }
}

/* ============ 4. EXECUTIVE BRIEF download block (Article 23) ============== */
/* v2: recognizable downloadable resource, compact, subordinate to the hero. */

.aie-brief {
  max-width: 860px;
  margin: 1rem auto 1.4rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.8rem 1.4rem;
  border: 1px solid var(--border);
  border-left: 3px solid var(--sc-orange, #f28c28);
  border-radius: 4px;
  padding: 0.9rem 1.1rem;
  background: #f4f7fa;
}
.aie-brief .aie-brief-text {
  flex: 1 1 18rem;
  min-width: 0;
}
.aie-brief .aie-brief-kicker {
  display: block;
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--sc-slate, #6b7280);
  margin-bottom: 0.15rem;
}
.aie-brief .aie-brief-title {
  display: block;
  font-size: 1.04rem;
  font-weight: 700;
  color: var(--sc-navy, #12324f);
  line-height: 1.25;
  margin-bottom: 0.2rem;
}
.aie-brief .aie-brief-desc {
  display: block;
  font-size: 0.82rem;
  color: var(--sc-slate, #6b7280);
  line-height: 1.4;
}

/* Compact download action on the right */
.aie-brief .aie-brief-btn {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--sc-navy, #12324f);
  text-decoration: none;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.45rem 0.85rem;
  background: var(--body-bg);
  white-space: nowrap;
  transition: border-color 120ms ease, color 120ms ease;
}
.aie-brief .aie-brief-btn:hover {
  border-color: var(--sc-orange, #f28c28);
  color: var(--sc-orange, #f28c28);
}
.aie-brief .aie-brief-btn .aie-brief-arrow {
  font-weight: 600;
}

@media (max-width: 768px) {
  .aie-brief {
    margin: 0.8rem auto 0.9rem;
    padding: 0.75rem 0.8rem;
    gap: 0.6rem;
  }
  /* stack text above action, action full-width for a clean tap target */
  .aie-brief .aie-brief-btn {
    flex: 1 1 100%;
    justify-content: center;
  }
}