/* cream-components.css — additional component classes
 * Complementary to cream.css — DO NOT modify cream.css
 * Tone kem aesthetic, mobile-first, print-friendly.
 */

/* ============================================
   TIMELINE
   ============================================ */
.timeline {
  position: relative;
  padding-left: 28px;
  margin: 16px 0;
}
.timeline::before {
  content: '';
  position: absolute;
  left: 7px;
  top: 6px;
  bottom: 6px;
  width: 2px;
  background: var(--border);
}
.timeline-item {
  position: relative;
  margin-bottom: 20px;
}
.timeline-item:last-child { margin-bottom: 0; }
.timeline-item::before {
  content: '';
  position: absolute;
  left: -24px;
  top: 7px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--accent-soft);
  border: 2px solid var(--accent);
}
.timeline-item .tl-time {
  font-size: 12px;
  color: var(--text-dim);
  font-family: var(--font-mono);
  margin-bottom: 2px;
}
.timeline-item .tl-title {
  font-weight: 700;
  font-size: 15px;
  color: var(--text);
}
.timeline-item .tl-body {
  font-size: 14px;
  color: var(--text-soft);
  margin-top: 4px;
}

/* ============================================
   METRIC — large number display
   ============================================ */
.metric {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  text-align: center;
  min-width: 140px;
}
.metric .value {
  display: block;
  font-size: 36px;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: -1px;
  line-height: 1.1;
  font-family: var(--font-mono);
}
.metric .label {
  display: block;
  font-size: 12px;
  color: var(--text-soft);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 6px;
  font-weight: 600;
}
.metric .delta {
  display: inline-block;
  font-size: 12px;
  font-weight: 700;
  margin-top: 6px;
  padding: 2px 8px;
  border-radius: 100px;
}
.metric .delta.up   { background: rgba(122,155,118,0.15); color: var(--success); }
.metric .delta.down { background: rgba(199,93,93,0.15);   color: var(--danger); }
.metric .delta.neutral { background: rgba(58,58,58,0.06); color: var(--text-soft); }

/* ============================================
   KPI GRID — grid of metric cards
   ============================================ */
.kpi-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  margin: 16px 0;
}

/* ============================================
   FLOATING TABLE OF CONTENTS
   ============================================ */
.toc-floating {
  position: fixed;
  right: 20px;
  top: 50%;
  transform: translateY(-50%);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  font-size: 12px;
  max-width: 200px;
  z-index: 100;
  box-shadow: 0 4px 16px rgba(0,0,0,0.06);
}
.toc-floating strong {
  display: block;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-dim);
  margin-bottom: 8px;
}
.toc-floating ul {
  list-style: none;
  padding: 0;
  margin: 0;
}
.toc-floating li { margin-bottom: 6px; }
.toc-floating a {
  color: var(--text-soft);
  font-weight: 500;
}
.toc-floating a:hover { color: var(--accent); }

/* ============================================
   DIFF — code/file change highlights
   ============================================ */
/* diff container */
.diff { }

/* diff rows */
.diff-row {
  font-family: var(--font-mono);
  font-size: 13px;
  padding: 3px 8px;
  border-radius: 4px;
  margin-bottom: 2px;
}
.diff-row.insert {
  background: rgba(122,155,118,0.12);
  color: var(--success);
}
.diff-row.insert::before { content: '+ '; }
.diff-row.delete {
  background: rgba(199,93,93,0.12);
  color: var(--danger);
  text-decoration: line-through;
}
.diff-row.delete::before { content: '- '; }
.diff-row.context {
  color: var(--text-dim);
}
.diff-row.context::before { content: '  '; }

/* ============================================
   ALERT — colored callouts
   ============================================ */
.alert {
  border-radius: var(--radius);
  padding: 14px 18px;
  margin: 12px 0;
  font-size: 14px;
  border-left: 4px solid;
}
.alert.info    { background: rgba(107,142,170,0.1);  border-color: var(--info);    color: #3d607a; }
.alert.warning { background: rgba(212,146,91,0.1);   border-color: var(--warning); color: #7a4a1a; }
.alert.success { background: rgba(122,155,118,0.1);  border-color: var(--success); color: #3a5e38; }
.alert.danger  { background: rgba(199,93,93,0.1);    border-color: var(--danger);  color: #7a2a2a; }
.alert-title {
  font-weight: 700;
  margin-bottom: 4px;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

/* ============================================
   TAG — small inline tag
   ============================================ */
.tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  background: var(--bg-card-2);
  color: var(--text-soft);
  border: 1px solid var(--border-soft);
  text-transform: uppercase;
  letter-spacing: 0.3px;
  min-height: 22px;
  line-height: 18px;
}

/* ============================================
   BACK TO TOP — floating button
   ============================================ */
.back-to-top {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 44px;
  height: 44px;
  background: var(--accent);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 700;
  text-decoration: none;
  box-shadow: 0 4px 12px rgba(201,166,97,0.4);
  z-index: 200;
  transition: opacity 0.15s, transform 0.15s;
}
.back-to-top:hover {
  opacity: 0.9;
  transform: translateY(-2px);
  text-decoration: none;
}

/* ============================================
   MOBILE RESPONSIVE
   ============================================ */
@media (max-width: 767px) {
  .metric .value { font-size: 28px; }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .toc-floating { display: none; }
}

@media (min-width: 768px) {
  .metric .value { font-size: 44px; }
  .kpi-grid { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
}

/* ============================================
   PRINT
   ============================================ */
@media print {
  .toc-floating,
  .back-to-top { display: none !important; }
  .timeline::before { background: #ccc; }
  .timeline-item::before {
    background: #ddd;
    border-color: #999;
  }
  .metric { border-color: #ccc; }
  .alert { border-color: #999; }
}
