/* ============================================
   COMPONENTS — Cards, Code, Tables, Grids
   ============================================ */

/* --- Bento Card --- */
.card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition-fast), transform var(--transition-fast);
}

.card:hover {
  box-shadow: var(--shadow-md);
}

.card--accent {
  border-color: var(--accent-border);
  border-width: 2px;
}

.card--glass {
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border-color: var(--glass-border);
}

.card h3 {
  margin-bottom: 0.5rem;
}

.card p {
  margin-top: 0.25rem;
}

.card__icon {
  font-size: 1.5rem;
  margin-bottom: 0.75rem;
}

/* --- Grid layouts --- */
.grid {
  display: grid;
  gap: 16px;
  margin-top: 24px;
}

.grid--2 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.grid--3 { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.grid--4 { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.grid--2x2 { grid-template-columns: repeat(2, 1fr); }

@media (max-width: 640px) {
  .grid--2x2 { grid-template-columns: 1fr; }
}

/* --- Code block --- */
.code-block {
  background: var(--bg-code);
  border-radius: var(--radius-md);
  overflow: hidden;
  margin: 20px 0;
  box-shadow: var(--shadow-md);
}

.code-block__header {
  background: rgba(255, 255, 255, 0.06);
  padding: 8px 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.code-block__dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}
.code-block__dot--red { background: #FF5F56; }
.code-block__dot--yellow { background: #FFBD2E; }
.code-block__dot--green { background: #27C93F; }

.code-block__filename {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.7rem;
  color: rgba(255, 255, 255, 0.4);
  margin-left: auto;
}

.code-block pre {
  margin: 0;
  padding: 20px;
  overflow-x: auto;
  line-height: 1.6;
}

.code-block code {
  font-size: 0.875rem;
  background: none;
  border: none;
  padding: 0;
  color: var(--text-on-code);
}

.code-block--compact pre {
  padding: 14px 16px;
}

.code-block--compact code {
  font-size: 0.8rem;
  line-height: 1.45;
}

/* Code comment styling (accent) */
.code-block .hljs-comment {
  color: var(--accent) !important;
  font-style: normal;
}

/* --- Split view (two code blocks side-by-side) --- */
.split-view {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin: 20px 0;
}

.split-view__label {
  font-family: 'Rubik', sans-serif;
  font-size: 0.75rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 8px;
}

@media (max-width: 768px) {
  .split-view {
    grid-template-columns: 1fr;
  }
}

/* --- Table --- */
.table-wrapper {
  overflow-x: auto;
  margin: 20px 0;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

th {
  background: var(--bg-surface-2);
  font-family: 'Manrope', sans-serif;
  font-weight: 600;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-secondary);
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

td {
  padding: 10px 16px;
  border-bottom: 1px solid var(--border-light);
  color: var(--text-secondary);
}

tr:last-child td {
  border-bottom: none;
}

/* Highlighted column */
td.highlight, th.highlight {
  background: var(--accent-light);
}

/* Complexity color coding */
td.complexity-fast { color: var(--success); font-weight: 500; }
td.complexity-medium { color: var(--info); font-weight: 500; }
td.complexity-slow { color: var(--accent); font-weight: 500; }
td.complexity-bad { color: var(--error); font-weight: 500; }

/* --- Flow / Chain diagram --- */
.flow {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin: 20px 0;
  justify-content: center;
}

.flow__step {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 20px;
  font-size: 0.875rem;
  text-align: center;
  min-width: 120px;
  color: var(--text-secondary);
}

.flow__step--accent {
  border-color: var(--accent-border);
  background: var(--accent-light);
  color: var(--accent);
}

.flow__arrow {
  color: var(--text-muted);
  font-size: 1.25rem;
}

/* --- Roadmap (horizontal) --- */
.roadmap {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: center;
  margin: 24px 0;
}

.roadmap__item {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  text-align: center;
  min-width: 130px;
  flex: 1;
  max-width: 180px;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.roadmap__item--active {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
}

.roadmap__item--done {
  border-color: var(--success);
}

.roadmap__num {
  font-family: 'Manrope', sans-serif;
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--text-primary);
}

.roadmap__icon {
  font-size: 1.5rem;
  margin: 4px 0;
}

.roadmap__title {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-top: 4px;
}

.roadmap__time {
  font-size: 0.65rem;
  color: var(--text-muted);
  margin-top: 2px;
}

/* --- Note / callout --- */
.note {
  background: var(--info-light);
  border-left: 3px solid var(--info);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: 12px 16px;
  margin: 16px 0;
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.note--warning {
  background: var(--accent-light);
  border-left-color: var(--accent);
}

.note--danger {
  background: var(--error-light);
  border-left-color: var(--error);
}

.note--success {
  background: var(--success-light);
  border-left-color: var(--success);
}

.note--block-goal {
  background: rgba(34, 211, 238, 0.1);
  border-left-color: var(--accent);
  max-width: 880px;
}

.note--block-goal strong {
  color: var(--text-primary);
}

/* --- Checklist --- */
.checklist {
  list-style: none;
  padding: 0;
}

.checklist li {
  padding: 8px 0 8px 32px;
  position: relative;
  font-size: 1rem;
}

.checklist li::before {
  content: '\2713';
  position: absolute;
  left: 0;
  color: var(--accent);
  font-weight: 700;
}

/* --- File tree --- */
.file-tree {
  background: var(--bg-code);
  color: var(--text-on-code);
  border-radius: var(--radius-md);
  padding: 20px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.8rem;
  line-height: 1.8;
  overflow-x: auto;
  margin: 16px 0;
}

.file-tree .dir { color: #89B4FA; }
.file-tree .file { color: #CDD6F4; }
.file-tree .comment { color: var(--accent); }

/* --- Fragment animation (for sequential reveals) --- */
.fragment {
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.5s cubic-bezier(0.22, 1, 0.36, 1),
              transform 0.5s cubic-bezier(0.22, 1, 0.36, 1);
}

.fragment.visible {
  opacity: 1;
  transform: translateY(0);
}

/* --- Comparison side-by-side --- */
.comparison {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin: 20px 0;
}

.comparison__side {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px;
}

.comparison__side--good {
  border-color: var(--success);
  border-width: 2px;
}

.comparison__side--bad {
  border-color: var(--error);
  border-width: 2px;
}

.comparison__label {
  font-family: 'Rubik', sans-serif;
  font-size: 0.7rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 8px;
}

.comparison__label--good { color: var(--success); }
.comparison__label--bad { color: var(--error); }

@media (max-width: 768px) {
  .comparison {
    grid-template-columns: 1fr;
  }
}

/* --- Meme slide --- */
.meme-content {
  text-align: center;
  padding: 20px;
}

.meme-content .meme-emoji {
  font-size: 4rem;
  margin-bottom: 16px;
}

.meme-content .meme-text {
  font-size: 1.1rem;
  color: var(--text-secondary);
  max-width: 600px;
  margin: 0 auto;
  line-height: 1.6;
}

.meme-content .meme-caption {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 12px;
  font-style: italic;
}

.meme-content .meme-question {
  margin: 14px auto 0;
  max-width: 760px;
  text-align: left;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  font-size: 0.92rem;
  color: var(--text-secondary);
}

.meme-content .meme-question strong {
  color: var(--text-primary);
}

/* --- Big-O color indicators --- */
.bigo-o1 { color: var(--success); font-weight: 600; }
.bigo-logn { color: var(--info); font-weight: 600; }
.bigo-n { color: #3B82F6; font-weight: 600; }
.bigo-nlogn { color: var(--accent); font-weight: 600; }
.bigo-n2 { color: var(--error); font-weight: 600; }
.bigo-exp { color: #E11D48; font-weight: 600; }
