/* ==========================================================================
   Catalogue pages (downloads.html, products.html)
   Builds on home.css and prophet.css: <main class="home catalog">.
   Items are listed in order of popularity; js/catalog.js adds the
   category / search filter.
   ========================================================================== */

/* the filter hides items with the hidden attribute */
.catalog [hidden] {
  display: none !important;
}

/* in-page links land below the fixed header and the sticky filter bar */
html:root {
  scroll-padding-top: 150px;
}

@media (max-width: 991.98px) {
  html:root {
    scroll-padding-top: 140px;
  }
}

@media (max-width: 767.98px) {
  html:root {
    scroll-padding-top: 190px;
  }
}

/* ---------- compact hero ---------- */
.c-hero {
  padding: clamp(2.75rem, 5vw, 4rem) 0 clamp(2.5rem, 4vw, 3.25rem);
  text-align: center;
}

.c-hero .h-hero-copy {
  max-width: 50rem;
  margin-inline: auto;
}

.home .c-hero h1 {
  margin: 1rem 0 1rem !important;
  font-size: clamp(2.2rem, 4.6vw, 3.4rem) !important;
}

.c-hero .h-hero-lead {
  max-width: 40rem;
  margin-inline: auto;
  margin-bottom: 2.25rem !important;
}

/* top-5 shortcut tiles */
.c-top {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.75rem;
  max-width: 1060px;
  margin: 0 auto !important;
  text-align: left;
}

.c-top a,
.c-top a:visited {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.7rem;
  height: 100%;
  padding: 0.8rem 0.9rem;
  color: var(--ink);
  text-decoration: none;
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow-sm);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  transition: transform 0.25s var(--ease), box-shadow 0.25s var(--ease), border-color 0.25s ease;
}

.c-top a:hover {
  color: var(--ink);
  border-color: rgba(79, 70, 229, 0.3);
  box-shadow: var(--shadow-md);
  transform: translateY(-3px);
}

.c-top-ico {
  display: grid;
  flex-shrink: 0;
  place-items: center;
  width: 42px;
  height: 42px;
  font-size: 1.2rem;
  color: var(--tone);
  background: var(--tone-soft);
  border-radius: 13px;
}

/* a product's own app icon instead of a symbol */
.c-top-ico--img {
  padding: 3px;
  background: transparent;
}

.c-top-ico--img img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.c-top strong {
  display: block;
  font-family: var(--font-head);
  font-size: 0.88rem;
  font-weight: 600;
  line-height: 1.25;
}

.c-top small {
  display: block;
  font-size: 0.76rem;
  color: var(--muted);
}

.c-top-rank {
  position: absolute;
  top: -0.55rem;
  left: -0.4rem;
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  font-family: var(--font-head);
  font-size: 0.72rem;
  font-weight: 700;
  color: #fff;
  background: var(--grad);
  border-radius: 50%;
  box-shadow: 0 6px 12px -6px rgba(102, 126, 234, 0.9);
}

/* ---------- sticky filter bar ---------- */
.c-toolbar {
  position: sticky;
  top: 72px;
  z-index: 1020;
  background: rgba(255, 255, 255, 0.88);
  border-block: 1px solid var(--line);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  backdrop-filter: saturate(180%) blur(14px);
}

.c-toolbar-inner {
  display: flex;
  align-items: center;
  gap: 1rem;
  min-height: 62px;
}

.c-chips {
  display: flex;
  flex: 1;
  gap: 0.35rem;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
}

.c-chips::-webkit-scrollbar {
  display: none;
}

.c-chips button {
  display: inline-flex;
  flex-shrink: 0;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 0.85rem;
  font-family: var(--font-head);
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 999px;
  cursor: pointer;
  transition: color 0.2s ease, background-color 0.2s ease, border-color 0.2s ease;
}

.c-chips button:hover {
  color: var(--accent);
  background: rgba(79, 70, 229, 0.06);
}

.c-chips button[aria-pressed="true"] {
  color: #fff;
  background: var(--grad);
  box-shadow: 0 8px 18px -10px rgba(102, 126, 234, 0.9);
}

.c-chips button span {
  min-width: 1.4rem;
  padding: 0.05rem 0.4rem;
  font-size: 0.72rem;
  font-weight: 600;
  text-align: center;
  color: var(--muted);
  background: rgba(15, 23, 42, 0.06);
  border-radius: 999px;
}

.c-chips button[aria-pressed="true"] span {
  color: #fff;
  background: rgba(255, 255, 255, 0.22);
}

.c-chips button:focus-visible,
.c-search input:focus-visible {
  outline: 2px solid #667eea;
  outline-offset: 2px;
}

.c-search {
  position: relative;
  flex: 0 0 260px;
  margin: 0;
}

.c-search .bi {
  position: absolute;
  top: 50%;
  left: 0.95rem;
  font-size: 0.9rem;
  color: var(--muted);
  transform: translateY(-50%);
  pointer-events: none;
}

.c-search input {
  width: 100%;
  height: 42px;
  padding: 0 1rem 0 2.5rem;
  font-family: var(--font-body);
  font-size: 0.92rem;
  color: var(--ink);
  background: #fff;
  border: 1px solid rgba(15, 23, 42, 0.14);
  border-radius: 999px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.c-search input:focus {
  border-color: #667eea;
  box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.15);
  outline: none;
}

.c-status {
  min-height: 1.4rem;
  margin: 0 0 0.5rem !important;
  font-size: 0.88rem;
  color: var(--muted);
}

/* ---------- groups ---------- */
.c-list {
  padding: 2.25rem 0 clamp(3.5rem, 7vw, 5.5rem);
}

.c-group + .c-group {
  margin-top: 3.5rem;
}

.c-group-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.home .c-group-head h2 {
  font-size: clamp(1.4rem, 2.4vw, 1.75rem) !important;
  font-weight: 700 !important;
  line-height: 1.2 !important;
}

.c-group-head p {
  font-size: 0.92rem;
  color: var(--muted);
}

.c-stack {
  display: grid;
  gap: 1.5rem;
}

/* ---------- rank badge ---------- */
.c-rank {
  position: absolute;
  top: 1rem;
  left: 1rem;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.3rem 0.75rem 0.3rem 0.35rem;
  font-family: var(--font-head);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.92);
  border-radius: 999px;
  box-shadow: var(--shadow-sm);
}

.c-rank b {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  font-size: 0.75rem;
  font-weight: 700;
  color: #fff;
  background: var(--grad);
  border-radius: 50%;
}

.c-rank--solo {
  padding-right: 0.35rem;
}

/* ---------- feature card (top five) ---------- */
.c-item {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 0.42fr) minmax(0, 1fr);
  overflow: hidden;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 26px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.35s var(--ease), border-color 0.35s ease;
}

.c-item:hover {
  box-shadow: var(--shadow-md);
}

.c-item--first {
  border: 2px solid transparent;
  background:
    linear-gradient(#fff, #fff) padding-box,
    var(--grad-wide) border-box;
  box-shadow: 0 30px 60px -32px rgba(102, 126, 234, 0.75);
}

.c-media {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 300px;
  padding: 3.5rem 2rem 2rem;
  overflow: hidden;
  text-decoration: none;
  background: var(--media, var(--soft));
}

.c-media::before {
  content: "";
  position: absolute;
  width: 360px;
  height: 360px;
  top: -140px;
  right: -110px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.45);
}

.c-media img {
  position: relative;
  width: auto;
  max-width: 100%;
  max-height: 300px;
  transition: transform 0.6s var(--ease);
}

.c-item:hover .c-media img {
  transform: scale(1.04);
}

/* the first card is tall (buying options), so keep its picture near the title */
@media (min-width: 992px) {
  .c-item--first .c-media {
    align-items: flex-start;
    padding-top: 5.5rem;
  }
}

.c-body {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  min-width: 0;
  padding: 2rem 2.25rem 2.25rem;
}

.home .c-body h3 {
  font-size: clamp(1.3rem, 2vw, 1.55rem) !important;
  font-weight: 700 !important;
  line-height: 1.25 !important;
}

.c-body > p {
  font-size: 0.98rem;
  line-height: 1.65;
}

.c-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1rem;
}

/* long button labels wrap on narrow screens instead of overflowing */
.c-actions .h-btn {
  white-space: normal;
  text-align: left;
}

.c-highlight {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.75rem 1rem;
  font-size: 0.93rem;
  color: #166534;
  background: #ecfdf3;
  border: 1px solid #bbf7d0;
  border-radius: 14px;
}

.c-highlight .bi {
  font-size: 1.1rem;
  color: #16a34a;
}

.c-new {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.93rem;
}

.c-new b {
  flex-shrink: 0;
  padding: 0.12rem 0.5rem;
  font-family: var(--font-head);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #fff;
  background: #dc3545;
  border-radius: 6px;
}

.c-new-pill {
  margin-left: 0.25rem;
  padding: 0.12rem 0.5rem;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: var(--accent);
  background: #fff;
  border-radius: 999px;
}

.h-tag--green {
  color: #15803d;
  background: #e7f6ec;
}

/* expandable extras (older versions, dependencies, language files) */
.c-more {
  background: var(--soft);
  border: 1px solid var(--line);
  border-radius: 16px;
}

.c-more summary {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.85rem 1.1rem;
  font-family: var(--font-head);
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--ink);
  list-style: none;
  cursor: pointer;
}

.c-more summary::-webkit-details-marker {
  display: none;
}

.c-more summary > .bi {
  color: var(--accent);
}

.c-more summary::after {
  content: "\F282";
  margin-left: auto;
  font-family: bootstrap-icons;
  font-size: 0.8rem;
  color: var(--muted);
  transition: transform 0.25s ease;
}

.c-more[open] summary::after {
  transform: rotate(180deg);
}

.c-more summary:focus-visible {
  outline: 2px solid #667eea;
  outline-offset: -2px;
  border-radius: 16px;
}

.c-more-body {
  display: grid;
  gap: 1rem;
  padding: 0 1.1rem 1.1rem;
  font-size: 0.93rem;
}

.c-more-body .p-zips {
  margin: 0;
}

.c-more-body .p-zips a {
  background: #fff;
}

.home .c-more-body .p-note {
  margin-top: 0;
}

/* list of links inside an expandable */
.c-links {
  display: grid;
  gap: 0.45rem;
}

.c-links li {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.25rem 0.6rem;
}

.c-links a,
.c-links a:visited {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-weight: 500;
  color: var(--accent);
  text-decoration: none;
}

.c-links a:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.c-links span {
  font-size: 0.85rem;
  color: var(--muted);
}

/* language file table (Java edition) */
.c-table-wrap {
  overflow-x: auto;
  border-radius: 14px;
}

.c-table {
  width: 100%;
  overflow: hidden;
  font-size: 0.9rem;
  border-collapse: separate;
  border-spacing: 0;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
}

.c-table th,
.c-table td {
  padding: 0.55rem 0.85rem;
  text-align: left;
  border-bottom: 1px solid var(--line);
}

.c-table tr:last-child td {
  border-bottom: 0;
}

.c-table th {
  font-family: var(--font-head);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  background: var(--soft);
}

.c-table td:first-child {
  font-weight: 500;
  color: var(--ink);
}

.c-table a,
.c-table a:visited {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  color: var(--accent);
  text-decoration: none;
}

.c-table a:hover {
  text-decoration: underline;
}

.c-table .c-na {
  color: #cbd5e1;
}

/* small download buttons */
.c-files {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.c-file,
.c-file:visited {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 0.95rem;
  font-family: var(--font-head);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--ink);
  text-decoration: none;
  background: #fff;
  border: 1px solid rgba(15, 23, 42, 0.14);
  border-radius: 999px;
  transition: color 0.2s ease, border-color 0.2s ease, background-color 0.2s ease, transform 0.2s ease;
}

.c-file:hover {
  color: #fff;
  background: var(--accent);
  border-color: var(--accent);
  transform: translateY(-2px);
}

.c-file .bi {
  font-size: 0.95rem;
}

.c-file small {
  font-family: var(--font-body);
  font-size: 0.75rem;
  font-weight: 400;
  opacity: 0.75;
}

.c-file--primary,
.c-file--primary:visited {
  color: #fff;
  background: var(--grad);
  border-color: transparent;
  box-shadow: 0 10px 22px -12px rgba(102, 126, 234, 0.9);
}

.c-file--primary:hover {
  color: #fff;
  background: var(--grad);
}

/* ---------- compact download cards (#6 onwards) ---------- */
.c-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.25rem;
}

.c-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  padding: 1.5rem;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: var(--shadow-sm);
  transition: transform 0.3s var(--ease), box-shadow 0.3s var(--ease), border-color 0.3s ease;
}

.c-card:hover {
  border-color: rgba(79, 70, 229, 0.18);
  box-shadow: var(--shadow-md);
}

.c-card-head {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.c-thumb {
  display: grid;
  flex-shrink: 0;
  place-items: center;
  width: 76px;
  height: 76px;
  padding: 6px;
  overflow: hidden;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 18px;
}

.c-thumb img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 10px;
}

.c-num {
  display: block;
  margin-bottom: 0.2rem;
  font-family: var(--font-head);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.home .c-card h3 {
  font-size: 1.08rem !important;
  font-weight: 600 !important;
  line-height: 1.3 !important;
}

.c-card > p {
  font-size: 0.92rem;
  line-height: 1.6;
  color: var(--text);
}

.c-card .c-actions {
  margin-top: auto;
  padding-top: 0.25rem;
}

/* ---------- product cards (products.html, #6 onwards) ---------- */
.c-products {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1.25rem;
}

.c-pcard {
  position: relative;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: var(--shadow-sm);
  transition: transform 0.3s var(--ease), box-shadow 0.3s var(--ease);
}

.c-pcard:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
}

.c-pcard .c-media {
  min-height: 210px;
  padding: 3rem 1.5rem 1.5rem;
}

.c-pcard .c-media img {
  max-height: 160px;
  border-radius: 12px;
}

.c-pcard .c-rank {
  top: 0.85rem;
  left: 0.85rem;
}

.c-pcard-body {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 0.8rem;
  padding: 1.4rem 1.5rem 1.6rem;
}

.home .c-pcard h3 {
  font-size: 1.12rem !important;
  font-weight: 600 !important;
  line-height: 1.3 !important;
}

.c-pcard-body > p {
  font-size: 0.92rem;
  line-height: 1.6;
}

.c-pcard .c-actions {
  margin-top: auto;
  padding-top: 0.25rem;
}

.c-pcard .h-stores img {
  height: 38px;
}

/* logo-style images sit smaller in the feature panel */
.c-m-redink img {
  max-height: 220px;
}

.c-m-scribe img {
  max-height: 200px;
  border-radius: 28px;
}

.c-cta-section {
  padding-top: 0;
}

/* media backgrounds */
.c-m-windows { --media: linear-gradient(135deg, #eef2ff 0%, #f1f5f9 100%); }
.c-m-phone { --media: linear-gradient(135deg, #e0e7ff 0%, #ede4ff 55%, #fce7f3 100%); }
.c-m-village { --media: linear-gradient(135deg, #d9f3f6 0%, #e7f7ef 100%); }
.c-m-redink { --media: linear-gradient(135deg, #fdecea 0%, #fff4f2 100%); }
.c-m-scribe { --media: linear-gradient(135deg, #e9efff 0%, #f5f8ff 100%); }
.c-m-sun { --media: radial-gradient(circle at 50% 50%, #fff7e0 0%, #ffe8cc 55%, #fde2e4 100%); }
.c-m-soulmate { --media: linear-gradient(135deg, #fdf2f8 0%, #fff7ed 100%); }
/* legacy images have white backgrounds, so their panel is white too */
.c-m-plain { --media: #fff; border-bottom: 1px solid var(--line); }
.c-m-plain::before { display: none; }

/* tones for the shortcut tiles */
.c-t-windows { --tone: #4f46e5; --tone-soft: #eef0ff; }
.c-t-phone { --tone: #7c3aed; --tone-soft: #f3e8ff; }
.c-t-village { --tone: #0e8fa3; --tone-soft: #e3f6f8; }
.c-t-redink { --tone: #e5483a; --tone-soft: #fdecea; }
.c-t-scribe { --tone: #3b6cf6; --tone-soft: #e9efff; }

/* empty state */
.c-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.85rem;
  padding: 3rem 1rem;
  text-align: center;
  color: var(--muted);
  background: #fff;
  border: 1px dashed rgba(15, 23, 42, 0.18);
  border-radius: 22px;
}

.c-empty .bi {
  font-size: 2rem;
  color: #cbd5e1;
}

/* MySoulmate wordmark in a product card */
.c-pcard .h-soulmate-mark svg {
  width: 84px;
  height: auto;
  margin-bottom: 0.6rem;
}

.c-pcard .h-soulmate-name {
  font-size: 1.6rem;
}

.c-pcard .h-soulmate-tagline {
  font-size: 0.9rem;
}

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 1199.98px) {
  .c-top {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    max-width: 760px;
  }
}

@media (max-width: 991.98px) {
  .c-toolbar {
    top: 64px;
  }

  .c-item {
    grid-template-columns: 1fr;
  }

  .c-media {
    min-height: 260px;
  }

  .c-media img {
    max-height: 260px;
  }

  .c-products {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .c-search {
    flex-basis: 220px;
  }
}

@media (max-width: 767.98px) {
  .c-top {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .c-toolbar-inner {
    flex-direction: column-reverse;
    align-items: stretch;
    gap: 0.5rem;
    padding-block: 0.6rem;
  }

  .c-search {
    flex-basis: auto;
  }

  .c-grid,
  .c-products {
    grid-template-columns: 1fr;
  }

  .c-group-head {
    flex-direction: column;
    gap: 0.25rem;
  }
}

@media (max-width: 575.98px) {
  .c-top a {
    padding: 0.7rem;
  }

  .c-top-ico {
    width: 36px;
    height: 36px;
    font-size: 1rem;
  }

  .c-body {
    padding: 1.5rem 1.35rem 1.75rem;
  }

  .c-card {
    padding: 1.25rem;
  }

  .c-thumb {
    width: 64px;
    height: 64px;
  }

  .c-table th,
  .c-table td {
    padding: 0.5rem 0.6rem;
  }
}

/* ---------- downloads.html: reviews and FAQ (.p-review / .p-faq come from prophet.css) ---------- */
.d-reviews-more {
  margin-top: 1.75rem !important;
  text-align: center;
}

.catalog .p-faq-wrap a:not(.h-btn) {
  font-weight: 600;
  color: var(--accent);
  text-decoration: none;
}

.catalog .p-faq-wrap a:not(.h-btn):hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* three reviews in the two-column layout: the last one takes the full row */
@media (min-width: 768px) and (max-width: 991.98px) {
  .d-reviews .p-review:last-child:nth-child(odd) {
    grid-column: 1 / -1;
  }
}
