/*
 * components.css — Reusable UI components
 * Minecraft Master Guide
 * Components: page-hero, topic-cards, callouts, steps,
 *             tables, badges, bars, timeline, enchants,
 *             checklist, quick-ref, section controls, search results
 */

/* ════════════════════════════════════════
   PAGE HERO
════════════════════════════════════════ */
.page-hero {
  margin-bottom: 28px;
  padding-bottom: 20px;
  border-bottom: 2px solid var(--border-2);
}
.page-hero-eyebrow {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}
.eyebrow-tag {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  padding: 2px 9px;
  border-radius: 20px;
  font-family: var(--font-mono);
}
.eyebrow-verified  { background: var(--green-muted); color: var(--green); border: 1px solid rgba(45,106,32,0.2); }
.eyebrow-difficulty { background: var(--amber-muted); color: var(--amber); border: 1px solid rgba(217,119,6,0.2); }

.page-hero h1 {
  font-size: clamp(1.4rem, 3vw, 1.9rem);
  font-weight: 800;
  color: var(--ink);
  line-height: 1.2;
  letter-spacing: -0.3px;
}
.page-hero p {
  margin-top: 8px;
  font-size: 0.95rem;
  color: var(--ink-2);
  max-width: 600px;
}

/* ════════════════════════════════════════
   TOPIC CARDS (accordion)
   Nielsen H4: Consistent card pattern throughout
════════════════════════════════════════ */
.topics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}

.topic-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition), border-color var(--transition), transform var(--transition);
}
.topic-card:hover {
  box-shadow: var(--shadow);
  border-color: #c4d4bb;
  transform: translateY(-1px);
}

.card-trigger {
  width: 100%;
  background: none;
  border: none;
  padding: 16px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  text-align: left;
  min-height: 44px; /* WCAG touch target */
}
.card-trigger:focus-visible {
  outline: 2px solid var(--green);
  outline-offset: -2px;
}

/* Difficulty tags — full text labels, not colour-only (WCAG 1.4.1) */
.card-difficulty {
  flex-shrink: 0;
  padding: 3px 8px;
  border-radius: 5px;
  font-size: 0.65rem;
  font-weight: 700;
  font-family: var(--font-mono);
  letter-spacing: 0.3px;
  text-transform: uppercase;
  white-space: nowrap;
  align-self: center;
}
.diff-common  { background: var(--red-muted);    color: #7f1d1d; border: 1px solid rgba(192,57,43,0.2); }
.diff-medium  { background: var(--amber-muted);  color: #78350f; border: 1px solid rgba(217,119,6,0.2); }
.diff-hard    { background: var(--purple-muted); color: #3b0764; border: 1px solid rgba(91,33,182,0.2); }
.diff-nether  { background: #fff0ee;             color: #7f1d1d; border: 1px solid rgba(185,28,28,0.2); }
.diff-end     { background: var(--purple-muted); color: #3b0764; border: 1px solid rgba(91,33,182,0.2); }
.diff-verified{ background: var(--green-muted);  color: #14532d; border: 1px solid rgba(45,106,32,0.2); }

.card-info    { flex: 1; min-width: 0; }
.card-title-text {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.3;
  display: block;
}
.card-subtitle {
  font-size: 0.75rem;
  color: var(--ink-3);
  margin-top: 2px;
  display: block;
}

/* Nielsen H1: Clear expand/collapse chevron */
.card-chevron {
  flex-shrink: 0;
  width: 24px; height: 24px;
  border-radius: 50%;
  background: var(--bg);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.75rem;
  color: var(--ink-3);
  transition: transform var(--transition), background var(--transition);
}
.topic-card.open .card-chevron {
  transform: rotate(180deg);
  background: var(--green-muted);
  color: var(--green);
}

.card-body {
  display: none;
  padding: 0 18px 16px;
  border-top: 1px solid var(--border-2);
}
.topic-card.open .card-body { display: block; }

/* Section expand/collapse control */
.section-controls {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  margin-bottom: 12px;
}
.btn-expand {
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 5px 12px;
  font-size: 0.75rem;
  color: var(--ink-3);
  cursor: pointer;
  font-family: var(--font-body);
  transition: all var(--transition);
  display: flex; align-items: center; gap: 5px;
}
.btn-expand:hover { border-color: var(--green); color: var(--green); background: var(--green-muted); }
.btn-expand:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; }
.btn-ghost {
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 5px 12px;
  font-size: 0.75rem;
  color: var(--ink-3);
  cursor: pointer;
  font-family: var(--font-body);
  transition: all var(--transition);
}
.btn-ghost:hover { border-color: var(--green); color: var(--green); background: var(--green-muted); }

/* ════════════════════════════════════════
   CALLOUT BOXES
════════════════════════════════════════ */
.callout {
  display: flex;
  gap: 10px;
  padding: 11px 14px;
  border-radius: var(--radius);
  margin: 12px 0;
  font-size: 0.875rem;
  line-height: 1.5;
}
.callout-icon { font-size: 1rem; flex-shrink: 0; margin-top: 1px; }
.callout-warn     { background: var(--red-muted);    border: 1px solid rgba(192,57,43,0.2);  color: #7f1d1d; }
.callout-tip      { background: var(--green-muted);  border: 1px solid rgba(45,106,32,0.2);  color: #14532d; }
.callout-verified { background: var(--diamond-muted);border: 1px solid rgba(8,145,178,0.2);  color: #0c4a6e; }
.callout-fix      { background: var(--amber-muted);  border: 1px solid rgba(217,119,6,0.2);  color: #78350f; }

/* ════════════════════════════════════════
   STEP LIST
════════════════════════════════════════ */
.steps {
  list-style: none;
  padding: 12px 0 0;
}
.steps li {
  display: flex;
  gap: 12px;
  padding: 8px 0;
  font-size: 0.9rem;
  color: var(--ink-2);
  border-bottom: 1px solid var(--border-2);
}
.steps li:last-child { border-bottom: none; }
.step-num {
  flex-shrink: 0;
  width: 22px; height: 22px;
  background: var(--green);
  color: #fff;
  border-radius: 50%;
  font-size: 0.65rem;
  font-weight: 700;
  font-family: var(--font-mono);
  display: flex; align-items: center; justify-content: center;
  margin-top: 2px;
}
.steps li strong { color: var(--ink); font-weight: 700; }

/* ════════════════════════════════════════
   DATA TABLE
════════════════════════════════════════ */
.data-table-wrap {
  overflow-x: auto;
  margin: 12px 0;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}
table { width: 100%; border-collapse: collapse; font-size: 0.85rem; background: var(--bg-card); }
thead th {
  background: #f0ede6;
  color: var(--ink-2);
  padding: 9px 14px;
  text-align: left;
  font-weight: 700;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-family: var(--font-mono);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
tbody td   { padding: 9px 14px; border-bottom: 1px solid var(--border-2); color: var(--ink-2); vertical-align: middle; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: #faf9f6; }

/* ════════════════════════════════════════
   INLINE BADGES
════════════════════════════════════════ */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 7px;
  border-radius: 4px;
  font-size: 0.65rem;
  font-weight: 700;
  font-family: var(--font-mono);
  letter-spacing: 0.3px;
  vertical-align: middle;
  margin-left: 4px;
}
.b-green  { background: var(--green-muted);  color: var(--green);  border: 1px solid rgba(45,106,32,0.25); }
.b-red    { background: var(--red-muted);    color: var(--red);    border: 1px solid rgba(192,57,43,0.2); }
.b-gold   { background: var(--gold-muted);   color: var(--gold);   border: 1px solid rgba(176,128,32,0.25); }
.b-purple { background: var(--purple-muted); color: var(--purple); border: 1px solid rgba(91,33,182,0.2); }
.b-diamond{ background: var(--diamond-muted);color: var(--diamond);border: 1px solid rgba(8,145,178,0.2); }
.b-amber  { background: var(--amber-muted);  color: var(--amber);  border: 1px solid rgba(217,119,6,0.2); }

/* ════════════════════════════════════════
   PROGRESS BARS
════════════════════════════════════════ */
.bar-group { margin: 14px 0; }
.bar-row   { margin: 6px 0; }
.bar-meta  { display: flex; justify-content: space-between; font-size: 0.78rem; color: var(--ink-3); margin-bottom: 3px; }
.bar-track { height: 8px; background: var(--bg); border: 1px solid var(--border); border-radius: 4px; overflow: hidden; }
.bar-fill  { height: 100%; border-radius: 4px; transition: width 1.2s cubic-bezier(0.17,0.67,0.35,1); }
.bf-green  { background: linear-gradient(90deg, #3d7a1a, var(--green-light)); }
.bf-gold   { background: linear-gradient(90deg, #92600a, var(--gold)); }
.bf-red    { background: linear-gradient(90deg, #7f1d1d, #ef4444); }
.bf-purple { background: linear-gradient(90deg, #3b0764, #8b5cf6); }
.bf-diamond{ background: linear-gradient(90deg, #0e7490, var(--diamond)); }

/* ════════════════════════════════════════
   PROGRESSION TIMELINE
════════════════════════════════════════ */
.timeline {
  position: relative;
  padding-left: 32px;
  margin: 16px 0;
}
.timeline::before {
  content: '';
  position: absolute;
  left: 9px; top: 8px; bottom: 8px;
  width: 2px;
  background: linear-gradient(180deg, var(--green), var(--purple));
  border-radius: 1px;
}
.tl-item { position: relative; margin-bottom: 20px; }
.tl-item:last-child { margin-bottom: 0; }
.tl-marker {
  position: absolute;
  left: -27px; top: 3px;
  width: 16px; height: 16px;
  border-radius: 50%;
  border: 2px solid currentColor;
  background: var(--bg);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.5rem;
  font-weight: 700;
  font-family: var(--font-mono);
}
.tl-ov .tl-marker, .tl-ov h4 { color: var(--green); }
.tl-ne .tl-marker, .tl-ne h4 { color: var(--amber); }
.tl-en .tl-marker, .tl-en h4 { color: var(--purple); }
.tl-item h4 { font-size: 0.82rem; font-weight: 700; margin-bottom: 3px; font-family: var(--font-mono); }
.tl-item p  { font-size: 0.875rem; color: var(--ink-2); }

/* ════════════════════════════════════════
   ENCHANTMENT GRID
════════════════════════════════════════ */
.ench-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 10px;
  margin: 12px 0;
}
.ench-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.ench-card:hover { border-color: #a5b4fc; box-shadow: var(--shadow-sm); }
.ench-name {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--purple);
  margin-bottom: 5px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.ench-desc { font-size: 0.825rem; color: var(--ink-2); line-height: 1.45; }
.ench-note { font-size: 0.75rem; color: var(--ink-3); margin-top: 5px; }
.ench-note.warn-note { color: var(--amber); }

/* ════════════════════════════════════════
   INTERACTIVE CHECKLIST
   Nielsen H3: User control — persist + reset
════════════════════════════════════════ */
.checklist { list-style: none; margin: 12px 0; }
.checklist li {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 9px 0;
  font-size: 0.875rem;
  color: var(--ink-2);
  border-bottom: 1px solid var(--border-2);
  cursor: pointer;
  transition: color var(--transition);
  user-select: none;
}
.checklist li:last-child { border-bottom: none; }
.checklist li .chk-box {
  flex-shrink: 0;
  width: 18px; height: 18px;
  border: 2px solid var(--border);
  border-radius: 4px;
  background: var(--bg-card);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.65rem;
  color: transparent;
  transition: all var(--transition);
  margin-top: 1px;
}
.checklist li.checked .chk-box { background: var(--green); border-color: var(--green); color: #fff; }
.checklist li.checked .chk-text { color: var(--ink-3); text-decoration: line-through; }
.checklist-actions { display: flex; justify-content: flex-end; margin-top: 8px; }

/* ════════════════════════════════════════
   QUICK REFERENCE CARDS
   Nielsen H6: Recognition over recall
════════════════════════════════════════ */
.qr-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}
.qr-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  box-shadow: var(--shadow-sm);
}
.qr-card h3 {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-2);
  display: flex;
  align-items: center;
  gap: 7px;
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.qr-card ul { list-style: none; }
.qr-card ul li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 5px 0;
  font-size: 0.82rem;
  border-bottom: 1px solid var(--border-2);
  gap: 8px;
}
.qr-card ul li:last-child { border-bottom: none; }
.qr-card ul li .qr-key { color: var(--ink-2); flex: 1; }
.qr-card ul li .qr-val { color: var(--green); font-weight: 700; font-family: var(--font-mono); font-size: 0.78rem; white-space: nowrap; }
.qr-card ul li .qr-val.bad { color: var(--red); }

/* ════════════════════════════════════════
   SECTION DIVIDER
════════════════════════════════════════ */
.sec-divider {
  margin: 28px 0 20px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.sec-divider h2 {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--ink-3);
  font-family: var(--font-mono);
  white-space: nowrap;
}
.sec-divider hr { flex: 1; border: none; border-top: 1px solid var(--border-2); }

/* ════════════════════════════════════════
   SEARCH RESULTS
════════════════════════════════════════ */
.search-results { display: none; padding: 20px 32px; }
.search-results.active { display: block; }
.search-result-item {
  padding: 14px 0;
  border-bottom: 1px solid var(--border-2);
  cursor: pointer;
}
.search-result-item:hover .sr-title { color: var(--green); }
.sr-section { font-size: 0.7rem; color: var(--ink-3); font-family: var(--font-mono); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 2px; }
.sr-title   { font-size: 0.92rem; font-weight: 600; color: var(--ink); transition: color var(--transition); }
.no-results { text-align: center; padding: 32px; color: var(--ink-3); font-size: 0.9rem; }

/* ════════════════════════════════════════
   BACK TO TOP BUTTON
   Nielsen H3: User control & freedom
════════════════════════════════════════ */
.back-to-top {
  position: fixed;
  bottom: 24px; right: 24px;
  width: 42px; height: 42px;
  background: var(--bg-header);
  color: #fff;
  border: none;
  border-radius: 50%;
  font-size: 1.1rem;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition), transform var(--transition);
  z-index: 90;
  box-shadow: 0 2px 10px rgba(0,0,0,0.25);
}
.back-to-top.visible { opacity: 1; pointer-events: auto; }
.back-to-top:hover { transform: translateY(-2px); }
.back-to-top:focus-visible { outline: 2px solid var(--green-light); outline-offset: 2px; }

/* ════════════════════════════════════════
   RESPONSIVE COMPONENT ADJUSTMENTS
════════════════════════════════════════ */
@media (max-width: 768px) {
  .content-section { padding: 20px 16px 80px; }
  .topics-grid     { grid-template-columns: 1fr; }
  .qr-grid         { grid-template-columns: 1fr 1fr; }
  .ench-grid       { grid-template-columns: 1fr; }
  .back-to-top     { bottom: 16px; right: 16px; }
  .section-controls{ justify-content: flex-start; }
}
@media (max-width: 480px) {
  .qr-grid { grid-template-columns: 1fr; }
}
