/* ============================================================
   PGX Framework — Core-Specific Styles
   Star SVG · Timeline · Bus Cards · Tooling · Quality
   Systems Table · System Details · Mermaid · Blueprints
   ============================================================ */

/* ===== ARCHITECTURE (Star SVG) ===== */
.arch-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 48px;
  align-items: center;
}

.arch-svg-wrap {
  display: flex; align-items: center; justify-content: center;
}

.arch-svg-wrap svg { max-width: 100%; height: auto; }

.arch-text h3 {
  font-size: 1.5rem; font-weight: 700;
  margin-bottom: 16px;
}

.arch-text p {
  color: var(--text-secondary);
  margin-bottom: 12px;
  line-height: 1.7;
}

.arch-exceptions {
  margin-top: 20px;
  padding: 16px;
  background: rgba(233, 69, 96, 0.08);
  border: 1px solid rgba(233, 69, 96, 0.2);
  border-radius: var(--radius-md);
  font-size: 0.85rem;
}

.arch-exceptions strong { color: var(--accent-pink); }

/* ===== INIT TIMELINE ===== */
.timeline {
  position: relative;
  max-width: 700px;
  margin: 0 auto;
}

.timeline::before {
  content: '';
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  top: 0; bottom: 0;
  width: 2px;
  background: var(--border-glass);
}

.timeline-step {
  position: relative;
  width: 50%;
  padding: 12px 30px;
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}

.timeline-step.visible {
  opacity: 1;
  transform: translateY(0);
}

.timeline-step:nth-child(odd) {
  left: 0; text-align: right; padding-right: 40px;
}

.timeline-step:nth-child(even) {
  left: 50%; text-align: left; padding-left: 40px;
}

.timeline-step .dot {
  position: absolute;
  top: 16px;
  width: 12px; height: 12px;
  border-radius: 50%;
  background: var(--step-color, var(--fw-primary));
  box-shadow: 0 0 10px color-mix(in srgb, var(--step-color, var(--fw-primary)) 50%, transparent);
}

.timeline-step:nth-child(odd) .dot { right: -6px; }
.timeline-step:nth-child(even) .dot { left: -6px; }

.timeline-step .order {
  font-size: 0.7rem; font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.timeline-step h4 {
  font-size: 0.95rem; font-weight: 700;
  color: var(--step-color, var(--fw-primary));
}

.timeline-step p {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

/* ===== BUS CARDS ===== */
.bus-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}

.bus-card {
  background: var(--bg-card);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-glass);
  border-top: 3px solid var(--bus-color, var(--fw-primary));
  border-radius: var(--radius-lg);
  padding: 28px 24px;
  transition: transform 0.3s, box-shadow 0.3s;
}

.bus-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 0 25px color-mix(in srgb, var(--bus-color, var(--fw-primary)) 25%, transparent);
}

.bus-card h4 {
  font-size: 1.1rem; font-weight: 700;
  margin-bottom: 4px;
}

.bus-card .bus-type {
  font-size: 0.75rem; font-weight: 600;
  color: var(--bus-color, var(--fw-primary));
  margin-bottom: 12px;
}

.bus-card p {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* ===== TOOLING GRID ===== */
.tooling-numbers {
  display: flex; gap: 32px; flex-wrap: wrap;
  margin-bottom: 40px;
}

.tooling-num { text-align: center; }

.tooling-num strong {
  display: block;
  font-size: 2rem; font-weight: 800;
  background: var(--fw-gradient);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
}

.tooling-num span {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.tool-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
}

.tool-card {
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  padding: 20px;
  transition: transform 0.3s, border-color 0.3s;
}

.tool-card:hover {
  transform: translateY(-3px);
  border-color: var(--fw-primary);
}

.tool-card h4 { font-size: 0.9rem; font-weight: 700; margin-bottom: 4px; }
.tool-card .tool-ver { font-size: 0.7rem; color: var(--text-muted); margin-bottom: 8px; }
.tool-card p { font-size: 0.8rem; color: var(--text-secondary); }

/* ===== QUALITY SECTION ===== */
.quality-grid {
  display: flex; flex-direction: column; gap: 32px;
}

.progress-wrap { max-width: 600px; }

.progress-label {
  display: flex; justify-content: space-between;
  font-size: 0.85rem; font-weight: 600;
  margin-bottom: 8px;
}

.progress-label span:last-child { color: var(--accent-green); }

.progress-bar {
  height: 10px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 99px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: var(--fw-gradient);
  border-radius: 99px;
  transition: width 1.5s ease;
}

.progress-fill.visible { width: 100%; }

/* Quality Expandable Rules */
.rule-card {
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  margin-bottom: 12px;
  overflow: hidden;
}

.rule-card-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px;
  cursor: pointer;
  transition: background 0.2s;
}

.rule-card-header:hover { background: rgba(255, 255, 255, 0.02); }

.rule-card-header h4 {
  font-size: 0.95rem; font-weight: 600;
  display: flex; align-items: center; gap: 10px;
}

.rule-card-header .rule-id {
  font-size: 0.7rem; font-weight: 700;
  color: var(--fw-primary);
  padding: 2px 8px;
  border-radius: 4px;
  background: color-mix(in srgb, var(--fw-primary) 10%, transparent);
}

.rule-card-header .arrow {
  font-size: 0.8rem;
  color: var(--text-muted);
  transition: transform 0.3s;
}

.rule-card.open .rule-card-header .arrow { transform: rotate(180deg); }

.rule-card-body {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.4s ease;
  padding: 0 20px;
}

.rule-card.open .rule-card-body {
  max-height: 500px;
  padding: 0 20px 20px;
}

.rule-card-body p {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.7;
}

/* ===== SYSTEMS TABLE (systems page) ===== */
.systems-table-wrap {
  overflow-x: auto;
  margin-bottom: 48px;
}

.systems-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.systems-table th {
  text-align: left;
  padding: 12px 16px;
  font-weight: 600;
  color: var(--fw-secondary);
  border-bottom: 2px solid var(--border-glass);
  white-space: nowrap;
}

.systems-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-glass);
  color: var(--text-secondary);
}

.systems-table tr:hover td {
  background: color-mix(in srgb, var(--fw-primary) 4%, transparent);
}

.systems-table .sys-name {
  font-weight: 700;
  color: var(--text-primary);
}

.sys-color-dot {
  display: inline-block;
  width: 10px; height: 10px;
  border-radius: 50%;
  margin-right: 8px;
  vertical-align: middle;
}

/* ===== SYSTEM DETAIL EXPAND ===== */
.system-detail {
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  margin-bottom: 16px;
  overflow: hidden;
}

.system-detail-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 24px;
  cursor: pointer;
  transition: background 0.2s;
}

.system-detail-header:hover { background: rgba(255, 255, 255, 0.02); }

.system-detail-header h3 {
  font-size: 1.1rem; font-weight: 700;
  display: flex; align-items: center; gap: 10px;
}

.system-detail-header .arrow {
  font-size: 0.8rem;
  color: var(--text-muted);
  transition: transform 0.3s;
}

.system-detail.open .system-detail-header .arrow {
  transform: rotate(180deg);
}

.system-detail-body {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.4s ease;
  padding: 0 24px;
}

.system-detail.open .system-detail-body {
  max-height: 800px;
  padding: 0 24px 24px;
}

.system-detail-body p {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-bottom: 12px;
  line-height: 1.7;
}

.system-detail-body code {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  background: rgba(0, 188, 212, 0.06);
  padding: 2px 6px;
  border-radius: 4px;
  color: var(--accent-cyan);
}

.system-detail-body pre {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  background: rgba(0, 0, 0, 0.3);
  padding: 16px;
  border-radius: var(--radius-sm);
  overflow-x: auto;
  margin-top: 8px;
  line-height: 1.6;
}

/* ===== MERMAID DIAGRAMS ===== */
.mermaid-wrap {
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  padding: 32px;
  margin-bottom: 32px;
  overflow-x: auto;
}

.mermaid-wrap h3 {
  font-size: 1.2rem; font-weight: 700;
  margin-bottom: 20px;
}

/* ===== BLUEPRINT SECTION ===== */
.bp-system-section {
  margin-bottom: 40px;
}

.bp-system-header {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-glass);
}

.bp-system-header h3 {
  font-size: 1.15rem; font-weight: 700;
}

.bp-system-header .bp-count {
  font-size: 0.75rem; font-weight: 600;
  padding: 3px 10px;
  border-radius: 99px;
  background: color-mix(in srgb, var(--fw-primary) 12%, transparent);
  color: var(--fw-primary);
}

.bp-node-list {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.bp-node {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 10px 14px;
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-sm);
  transition: border-color 0.2s;
}

.bp-node:hover { border-color: var(--border-hover); }

.bp-node-name {
  font-family: var(--font-mono);
  font-size: 0.8rem; font-weight: 500;
  color: var(--accent-cyan);
  white-space: nowrap;
}

.bp-node-desc {
  font-size: 0.78rem;
  color: var(--text-secondary);
  line-height: 1.4;
}

.bp-category-badge {
  font-size: 0.6rem; font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  white-space: nowrap;
  flex-shrink: 0;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 1024px) {
  .arch-grid { grid-template-columns: 1fr; }
  .tool-cards { grid-template-columns: repeat(2, 1fr); }
  .bp-node-list { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  .bus-grid { grid-template-columns: 1fr; }
  .tool-cards { grid-template-columns: repeat(2, 1fr); }

  .timeline-step,
  .timeline-step:nth-child(even) {
    width: 100%; left: 0;
    text-align: left;
    padding-left: 30px; padding-right: 0;
  }

  .timeline::before { left: 0; }

  .timeline-step .dot,
  .timeline-step:nth-child(odd) .dot,
  .timeline-step:nth-child(even) .dot {
    left: -6px; right: auto;
  }
}

@media (max-width: 480px) {
  .tool-cards { grid-template-columns: 1fr; }
}
