/* ===========================================================================
   Prompt Library — Homepage redesign (Framer "Miraculous Motivation")
   Component primitives only (buttons, cards, tags, badges). Section layout
   CSS lands with the index.njk rewrite (Phase 3). Palette tokens (--rd-*)
   live in styles.css under :root and :root.dark-theme.
   All classes are namespaced .rd-* so interior pages are unaffected.
   =========================================================================== */

/* ---- Library Button ---------------------------------------------------- */
.rd-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: 999px;
  font-family: var(--font-sans);
  font-weight: 700;
  font-size: 0.95rem;
  line-height: 1;
  text-decoration: none;
  cursor: pointer;
  border: 1px solid transparent;
  transition: transform 0.15s ease, background-color 0.2s ease, border-color 0.2s ease;
}
.rd-btn:hover { transform: translateY(-1px); }
.rd-btn:focus-visible { outline: 2px solid var(--rd-accent); outline-offset: 2px; }
.rd-btn__arrow { transition: transform 0.15s ease; }
.rd-btn:hover .rd-btn__arrow { transform: translateX(2px); }

.rd-btn--filled {
  background-color: var(--rd-accent);
  color: var(--rd-on-accent);
}
.rd-btn--filled:hover { background-color: #d8431f; }

.rd-btn--outline {
  background-color: transparent;
  color: var(--rd-ink);
  border-color: var(--rd-border);
}
.rd-btn--outline:hover { border-color: var(--rd-accent); color: var(--rd-accent); }

/* ---- Cards (shared) ---------------------------------------------------- */
.rd-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 20px;
  border-radius: 18px;
  background-color: var(--rd-surface);
  border: 1px solid var(--rd-border);
  text-decoration: none;
  transition: transform 0.15s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}
.rd-card:hover {
  transform: translateY(-2px);
  border-color: var(--rd-accent);
  box-shadow: 0 8px 24px rgba(16, 35, 49, 0.10);
}
.rd-card:focus-visible { outline: 2px solid var(--rd-accent); outline-offset: 2px; }

.rd-card__title {
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: 1.15rem;
  color: var(--rd-ink);
  margin: 0;
}
.rd-card__desc {
  font-size: 0.95rem;
  line-height: 1.5;
  color: var(--rd-muted);
  margin: 0;
  flex: 1;
}
.rd-card__cta {
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--rd-accent);
}

/* ---- Resource card tags + status badge --------------------------------- */
.rd-card__tags {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}
.rd-tag,
.rd-badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: 0.01em;
}
.rd-tag {
  background-color: var(--rd-chip);
  color: var(--rd-chip-text);
}
.rd-badge {
  background-color: var(--rd-accent-soft);
  color: var(--rd-accent);
  text-transform: uppercase;
}

/* ---- Type card --------------------------------------------------------- */
.rd-card__type-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.rd-count {
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: 1.1rem;
  color: var(--rd-accent);
  background-color: var(--rd-accent-soft);
  min-width: 2rem;
  text-align: center;
  padding: 2px 10px;
  border-radius: 999px;
}

/* ===========================================================================
   Homepage sections (only rendered on body.rd-home / index.njk)
   =========================================================================== */
body.rd-home { background-color: var(--rd-bg); }
.rd-page {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 28px 40px;
  color: var(--rd-text);
  font-family: var(--font-sans);
}
.visually-hidden {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---- Eyebrow ---- */
.rd-eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 12px; border-radius: 999px;
  background-color: var(--rd-accent-soft); color: var(--rd-accent);
  font-weight: 700; font-size: 0.78rem; letter-spacing: 0.02em; text-transform: uppercase;
}
.rd-eyebrow--plain { background: transparent; padding: 0; }

/* ---- Top bar (full width) ---- */
.rd-topbar {
  display: flex; align-items: center; gap: 20px;
  width: 100%; padding: 16px clamp(20px, 4vw, 48px);
  background-color: var(--rd-nav-shell);
  border-bottom: 1px solid var(--rd-border);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
}
.rd-brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; }
.rd-brand__mark {
  width: 26px; height: 26px; border-radius: 8px; background-color: var(--rd-accent);
  color: #fff; display: inline-flex; align-items: center; justify-content: center;
  font-weight: 900; font-size: 0.95rem;
}
.rd-brand__name { font-weight: 800; color: var(--rd-ink); font-size: 1rem; }
/* push nav links + actions to the right edge */
.rd-topbar__links { display: flex; gap: 4px; margin-left: auto; }
.rd-topbar__links a {
  padding: 8px 12px; border-radius: 999px; text-decoration: none;
  color: var(--rd-text); font-weight: 600; font-size: 0.92rem;
}
.rd-topbar__links a:hover { color: var(--rd-ink); background-color: var(--rd-chip); }
.rd-topbar__actions { display: flex; align-items: center; gap: 8px; }
.rd-theme-toggle {
  background: transparent; border: none; cursor: pointer; color: var(--rd-muted);
  font-size: 1rem; padding: 8px; border-radius: 999px;
}
.rd-theme-toggle:hover { color: var(--rd-accent); }
/* Topbar search (shown on interior pages; suppressed on the homepage hero) */
.rd-topbar__search { position: relative; flex: 0 1 360px; }
.rd-topbar__search .search-form {
  display: flex; align-items: center; gap: 8px;
  background: var(--rd-chip); border: 1px solid var(--rd-border);
  border-radius: 999px; padding: 8px 14px;
}
.rd-topbar__search .search-input {
  flex: 1; min-width: 0; border: none; background: transparent; outline: none;
  color: var(--rd-ink); font-family: var(--font-sans); font-size: 0.9rem;
}
.rd-topbar__search .search-input::placeholder { color: var(--rd-muted); }
.rd-topbar__search .search-results { position: absolute; left: 0; right: 0; top: 48px; z-index: 30; }

/* ---- Hero ---- */
.rd-hero { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 18px; padding: 32px 0 36px; }
.rd-hero__title {
  font-family: var(--font-heading); font-weight: 800;
  font-size: clamp(2.2rem, 5vw, 3.4rem); line-height: 1.05;
  color: var(--rd-ink); max-width: 680px; margin: 0; text-wrap: balance;
}
.rd-hero__sub { font-size: 1.05rem; line-height: 1.55; color: var(--rd-muted); max-width: 640px; margin: 0; }

/* ---- Search panel ---- */
.rd-search {
  width: 100%; max-width: 840px; margin: 0 auto; align-self: center; position: relative;
  background-color: var(--rd-surface); border: 1px solid var(--rd-border);
  border-radius: 28px; padding: 16px; display: flex; flex-direction: column; gap: 16px;
}
.rd-searchbar {
  display: flex; align-items: center; gap: 12px; background-color: var(--rd-bg);
  border: 1px solid var(--rd-border); border-radius: 18px; padding: 14px 16px;
}
.rd-searchbar__icon { color: var(--rd-muted); }
.rd-searchbar__input {
  flex: 1; border: none; background: transparent; outline: none;
  font-family: var(--font-sans); font-size: 1rem; color: var(--rd-ink);
}
.rd-searchbar__input::placeholder { color: var(--rd-muted); }
.rd-searchbar__btn { white-space: nowrap; }
.rd-chips { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.rd-chip {
  border: none; cursor: pointer; padding: 8px 14px; border-radius: 999px;
  background-color: var(--rd-chip); color: var(--rd-chip-text);
  font-family: var(--font-sans); font-weight: 700; font-size: 0.85rem;
}
.rd-chip.is-active { background-color: var(--rd-accent); color: var(--rd-on-accent); }
.rd-chip:hover { filter: brightness(0.97); }
.rd-search .search-results { position: absolute; left: 16px; right: 16px; top: 80px; z-index: 20; }

/* ---- Stats ---- */
.rd-stats { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 20px; color: var(--rd-muted); font-size: 0.95rem; }
.rd-stats strong { color: var(--rd-ink); font-weight: 800; }

/* ---- Install callout ---- */
.rd-install { padding: 18px 0 40px; }
.rd-install__card {
  display: flex; flex-wrap: wrap; background-color: var(--rd-surface);
  border: 1px solid var(--rd-border); border-radius: 28px; overflow: clip;
}
.rd-install__copy { flex: 1 1 320px; padding: 34px; display: flex; flex-direction: column; gap: 12px; justify-content: center; }
.rd-install__title { font-weight: 800; font-size: 1.6rem; color: var(--rd-ink); margin: 0; }
.rd-install__desc { color: var(--rd-muted); margin: 0; line-height: 1.5; }
.rd-terminal {
  flex: 1 1 360px; background-color: var(--rd-terminal); color: var(--rd-terminal-text);
  padding: 28px; display: flex; flex-direction: column; gap: 14px; align-items: flex-start;
}
.rd-terminal__dots { display: flex; gap: 6px; }
.rd-dot { width: 10px; height: 10px; border-radius: 999px; display: inline-block; }
.rd-dot--r { background: var(--rd-dot-red); }
.rd-dot--y { background: var(--rd-dot-yellow); }
.rd-dot--g { background: var(--rd-dot-green); }
.rd-terminal__cmd {
  font-family: var(--font-mono); font-size: 0.9rem; line-height: 1.5;
  color: var(--rd-terminal-text); word-break: break-all;
  background: transparent; padding: 0; border-radius: 0;
}

/* ---- Section heads ---- */
.rd-section { padding: 48px 0; display: flex; flex-direction: column; gap: 26px; }
.rd-section__head--split { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; flex-wrap: wrap; }
.rd-section__head--center { text-align: center; max-width: 720px; margin: 0 auto; display: flex; flex-direction: column; gap: 10px; align-items: center; }
.rd-section__heading { display: flex; flex-direction: column; gap: 10px; max-width: 640px; align-items: flex-start; }
.rd-section__head--center .rd-section__title,
.rd-section__head--center .rd-section__lead { max-width: 640px; }
.rd-section__title { font-weight: 800; font-size: 1.9rem; color: var(--rd-ink); margin: 0; }
.rd-section__lead { color: var(--rd-muted); margin: 0; line-height: 1.5; }

/* ---- Grids ---- */
.rd-grid { display: grid; gap: 16px; }
.rd-grid--resources { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.rd-grid--types { grid-template-columns: repeat(auto-fill, minmax(198px, 1fr)); }

/* ---- Matrix ---- */
.rd-matrix { background-color: var(--rd-surface); border: 1px solid var(--rd-border); border-radius: 26px; overflow: clip; }
.rd-matrix__row { display: grid; grid-template-columns: 1.4fr repeat(5, 1fr); }
.rd-matrix__row--head { background-color: var(--rd-matrix-head); }
.rd-matrix__row + .rd-matrix__row { border-top: 1px solid var(--rd-border); }
.rd-matrix__cell { padding: 16px 18px; font-weight: 800; color: var(--rd-ink); font-size: 0.9rem; }
.rd-matrix__row--head .rd-matrix__cell { color: var(--rd-muted); font-weight: 700; }
.rd-matrix__cell--label { text-align: left; }
.rd-matrix__cell--label a { color: var(--rd-ink); text-decoration: none; font-weight: 800; }
.rd-matrix__cell--label a:hover { color: var(--rd-accent); }
.rd-matrix__cell a { color: var(--rd-ink); text-decoration: none; }
.rd-matrix__cell a:hover { color: var(--rd-accent); text-decoration: underline; }
.rd-matrix__dash { color: var(--rd-muted); opacity: 0.5; }

/* ---- CTA band ---- */
.rd-cta-wrap { padding: 48px 0 24px; }
.rd-cta {
  display: flex; justify-content: space-between; align-items: center; gap: 24px; flex-wrap: wrap;
  background-color: var(--rd-accent); color: #fff; border-radius: 30px; padding: 34px;
}
.rd-cta__title { font-weight: 800; font-size: 1.6rem; margin: 0; color: #fff; }
.rd-cta__desc { margin: 6px 0 0; max-width: 560px; color: rgba(255, 255, 255, 0.92); line-height: 1.5; }
.rd-cta__actions { display: flex; gap: 10px; flex-wrap: wrap; }
.rd-cta .rd-btn--filled,
.rd-cta .rd-btn--outline { background-color: #16242e; color: #fff; border-color: transparent; }
.rd-cta .rd-btn--filled:hover,
.rd-cta .rd-btn--outline:hover { background-color: #0b1822; color: #fff; border-color: transparent; }

/* ---- Footer ---- */
.rd-footer {
  display: flex; justify-content: space-between; align-items: center; gap: 16px;
  max-width: 1120px; margin: 0 auto; padding: 24px 28px 40px; color: var(--rd-muted);
  font-weight: 600; flex-wrap: wrap;
  background: transparent; border-top: none; text-align: left;
}
.rd-footer__links { display: flex; gap: 16px; }
.rd-footer__links a { color: var(--rd-ink); text-decoration: none; font-weight: 700; }
.rd-footer__links a:hover { color: var(--rd-accent); }

/* ---- Responsive ---- */
@media (max-width: 760px) {
  .rd-topbar__links { display: none; }
  .rd-searchbar { flex-wrap: wrap; }
  .rd-searchbar__btn { width: 100%; justify-content: center; }
  .rd-section__head--split { flex-direction: column; align-items: flex-start; }
  .rd-matrix { overflow-x: auto; }
  .rd-matrix__row { grid-template-columns: 1.4fr repeat(5, minmax(64px, 1fr)); min-width: 560px; }
  .rd-cta { flex-direction: column; align-items: flex-start; }
}

/* ---- Copy command button: right-aligned in terminal ---- */
.rd-terminal .rd-copy { align-self: flex-end; }

/* ---- Recently Added carousel (restored Swiper, themed to redesign) ---- */
.rd-home .recently-added-swiper { width: 100%; position: relative; padding: 4px 0 48px; }
.rd-home .swiper-slide { display: flex; justify-content: center; align-items: stretch; height: auto; transition: opacity 0.3s ease; }
.rd-home .recent-item {
  width: 100%; display: flex; flex-direction: column; gap: 8px;
  background-color: var(--rd-surface); border: 1px solid var(--rd-border);
  border-radius: 18px; padding: 20px;
}
.rd-home .recent-item h3 { font-size: 1.15rem; margin: 0; }
.rd-home .recent-item h3 a { color: var(--rd-ink); text-decoration: none; font-weight: 800; }
.rd-home .recent-item h3 a:hover { color: var(--rd-accent); }
.rd-home .recent-meta { display: flex; flex-wrap: wrap; gap: 6px; margin: 2px 0; }
.rd-home .recent-type,
.rd-home .recent-discipline,
.rd-home .recent-version {
  background: var(--rd-chip); color: var(--rd-chip-text);
  border-radius: 999px; padding: 4px 10px; font-size: 0.72rem; font-weight: 700;
}
.rd-home .recent-version { font-family: var(--font-mono); }
.rd-home .recent-updated {
  background-color: var(--rd-accent-soft); color: var(--rd-accent);
  border-radius: 999px; padding: 4px 10px; font-size: 0.72rem; font-weight: 700; text-transform: uppercase;
}
.rd-home .recent-desc { color: var(--rd-muted); font-size: 0.95rem; line-height: 1.5; margin: 0; }
.rd-home .swiper-pagination-bullet-active { background-color: var(--rd-accent); }
.rd-home .swiper-button-next,
.rd-home .swiper-button-prev { color: var(--rd-accent); --swiper-navigation-size: 26px; top: 45%; }
