/* ============================================================
   Community browser
   Three views (registry → repo → workout) sharing one shell.
   Inherits typography + tokens from ../styles.css.
   ============================================================ */

.community-main {
  max-width: 1100px;
  margin: 0 auto;
  padding: var(--s-7) var(--s-5) var(--s-10);
}

/* ─── Breadcrumbs ─────────────────────────────────────────── */
.crumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 12px;
  color: var(--fg-3);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-bottom: var(--s-5);
  min-height: 16px;
}
.crumbs a {
  color: var(--fg-2);
  text-decoration: none;
  border-bottom: 1px dotted var(--line-3);
}
.crumbs a:hover { color: var(--brand-400); }
.crumbs span.sep { color: var(--fg-4); }

.view { animation: fade-in 200ms var(--ease-out); }
@keyframes fade-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.page-title {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(40px, 7vw, 72px);
  line-height: 1;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  margin: var(--s-2) 0 var(--s-4);
  color: var(--fg-1);
}

/* Page header row — title on the left, secondary action (Publish your own)
   on the right. Stacks on narrow screens so the title doesn't get squeezed. */
.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--s-4);
  flex-wrap: wrap;
}
.page-head > div { flex: 1 1 auto; min-width: 0; }
.head-action {
  flex: 0 0 auto;
  align-self: flex-end;
  margin-bottom: var(--s-4);
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--brand-400);
  text-decoration: none;
  padding: 8px 14px;
  border: 1px solid var(--line-3);
  border-radius: var(--r-pill);
  transition: border-color var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out);
}
.head-action:hover {
  color: var(--brand-300);
  border-color: var(--brand-400);
}
.head-action .arrow { display: inline-block; margin-left: 4px; }
.page-lead {
  font-size: 16px;
  color: var(--fg-2);
  max-width: 60ch;
  margin: 0 0 var(--s-7);
}

/* ─── Status / state blocks ───────────────────────────────── */
.status {
  border: 1px dashed var(--line-3);
  border-radius: var(--r-md);
  padding: var(--s-6);
  text-align: center;
  color: var(--fg-3);
  background: var(--bg-1);
}
.status.is-error {
  border-color: rgba(235,59,59,0.4);
  background: rgba(235,59,59,0.08);
  color: #f7a;
}
.status .status-action { margin-top: var(--s-3); }

/* ─── Repository grid ─────────────────────────────────────── */
.repo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--s-4);
}
.repo-card {
  background: var(--bg-1);
  border: 1px solid var(--line-2);
  border-radius: var(--r-md);
  padding: var(--s-5);
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
  text-decoration: none;
  color: inherit;
  transition: transform var(--dur-fast) var(--ease-out), border-color var(--dur-fast) var(--ease-out);
}
.repo-card:hover {
  transform: translateY(-2px);
  border-color: var(--line-3);
}
.repo-card h3 {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 24px;
  line-height: 1.1;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  margin: 0;
  color: var(--fg-1);
}
.repo-card p { margin: 0; color: var(--fg-2); font-size: 14px; line-height: 1.5; }
.repo-card .author { color: var(--fg-3); font-size: 12px; }
.repo-card .repo-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: auto;
}
.tag-chip {
  background: var(--bg-2);
  border: 1px solid var(--line-1);
  color: var(--fg-3);
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: var(--r-pill);
}

/* ─── Repo detail: meta line + workout grid ───────────────── */
.repo-meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-3);
  align-items: center;
  font-size: 13px;
  color: var(--fg-3);
  margin: 0 0 var(--s-7);
}
.repo-meta a { color: var(--brand-400); text-decoration: none; border-bottom: 1px dotted var(--line-3); }
.repo-meta a:hover { color: var(--brand-300); }

.workout-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: var(--s-4);
}
.workout-card {
  background: var(--bg-1);
  border: 1px solid var(--line-2);
  border-radius: var(--r-md);
  padding: var(--s-5);
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
  text-decoration: none;
  color: inherit;
  transition: transform var(--dur-fast) var(--ease-out), border-color var(--dur-fast) var(--ease-out);
}
.workout-card:hover {
  transform: translateY(-2px);
  border-color: var(--line-3);
}
.workout-card h3 {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 22px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  margin: 0;
  color: var(--fg-1);
  line-height: 1.1;
}
.workout-card .meta {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--fg-3);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin: 0;
}
.workout-bar {
  display: flex;
  height: 24px;
  border-radius: var(--r-pill);
  overflow: hidden;
  gap: 1px;
  background: var(--bg-0);
}
.workout-bar > div { height: 100%; }
.workout-card .workout-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

/* ─── Workout detail ──────────────────────────────────────── */
.workout-detail {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--s-6);
}
@media (min-width: 760px) {
  .workout-detail { grid-template-columns: 1.5fr 1fr; }
}
.detail-chart {
  background: var(--bg-1);
  border: 1px solid var(--line-2);
  border-radius: var(--r-md);
  padding: var(--s-5);
}
.detail-chart-bar {
  display: flex;
  align-items: flex-end;
  height: 220px;
  gap: 1px;
  background: var(--bg-0);
  border-radius: var(--r-sm);
  padding: 4px;
}
.detail-chart-bar > div { border-radius: 4px 4px 0 0; min-width: 2px; }
.detail-axis {
  display: flex;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--fg-3);
  margin-top: 6px;
}
.detail-stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--s-3);
  margin-top: var(--s-5);
}
.detail-stat {
  background: var(--bg-2);
  border: 1px solid var(--line-1);
  border-radius: var(--r-md);
  padding: var(--s-4);
}
.detail-stat .stat-label {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--fg-3);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.detail-stat .stat-value {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 28px;
  color: var(--fg-1);
  letter-spacing: 0.02em;
}

.detail-side {
  display: flex;
  flex-direction: column;
  gap: var(--s-4);
}
.detail-actions {
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
}
.detail-actions .btn { width: 100%; }
.detail-side h4 {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--fg-3);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin: var(--s-2) 0 0;
}

/* Step list — same vibe as the editor's segment rows. */
.detail-steps {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.detail-step {
  display: grid;
  grid-template-columns: 18px 1fr auto;
  align-items: center;
  gap: var(--s-3);
  background: var(--bg-1);
  border: 1px solid var(--line-1);
  border-radius: var(--r-sm);
  padding: 8px 12px;
  font-size: 13px;
  color: var(--fg-2);
}
.detail-step .step-rail {
  width: 4px;
  height: 22px;
  border-radius: 2px;
}
.detail-step .step-meta {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--fg-3);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
}

/* ─── Contribute CTA on the registry view ─────────────────── */
.contribute-cta {
  margin-top: var(--s-7);
  padding-top: var(--s-5);
  border-top: 1px solid var(--line-1);
  text-align: center;
  font-size: 14px;
  color: var(--fg-3);
}
.contribute-cta a {
  color: var(--brand-400);
  text-decoration: none;
  border-bottom: 1px dotted var(--line-3);
}
.contribute-cta a:hover { color: var(--brand-300); }

/* ─── Skeleton placeholder while fetching ─────────────────── */
.skeleton {
  background: linear-gradient(90deg, var(--bg-1) 0%, var(--bg-2) 50%, var(--bg-1) 100%);
  background-size: 200% 100%;
  animation: shimmer 1400ms linear infinite;
  border-radius: var(--r-sm);
}
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: -100% 0; } }
