/* ==========================================================================
   Royalty Technology — Collections (projects, insights)
   ========================================================================== */

/* ---- Collection hero ----------------------------------------------------- */

.collection-hero {
  padding-block: var(--space-20) var(--space-16);
  color: var(--text-on-inverse);
  background: var(--ink-950);
}
.collection-hero h1 {
  max-width: 20ch;
  font-size: var(--fs-h1);
  font-weight: 700;
  letter-spacing: var(--tracking-display);
}
.collection-hero > .container > p:last-child {
  max-width: 62ch;
  margin-top: var(--space-5);
  color: var(--text-on-inverse-muted);
  font-size: var(--fs-lead);
  line-height: var(--lh-snug);
}

/* ---- Filter bar ---------------------------------------------------------- */

.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-bottom: var(--space-4);
}
.filter-bar button {
  min-height: 42px;
  padding-inline: var(--space-5);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  background: var(--surface);
  color: var(--text-muted);
  font-size: var(--fs-sm);
  font-weight: 500;
  white-space: nowrap;
  transition:
    color var(--dur-base) var(--ease-out),
    background-color var(--dur-base) var(--ease-out),
    border-color var(--dur-base) var(--ease-out);
}
.filter-bar button:hover { color: var(--text); border-color: var(--border-strong); }
.filter-bar button.is-active {
  color: var(--text-on-brand);
  background: var(--brand-strong);
  border-color: var(--brand-strong);
}

.filter-count {
  margin-bottom: var(--space-10);
  color: var(--text-subtle);
  font-size: var(--fs-xs);
}

.collection-empty {
  padding: var(--space-16) 0;
  color: var(--text-muted);
  text-align: center;
}
.collection-empty a { color: var(--brand-on-light); font-weight: 600; text-decoration: underline; }

/* ---- Project cards ------------------------------------------------------- */

.project-card-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-6);
}

.project-card {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  transition:
    border-color var(--dur-base) var(--ease-out),
    box-shadow var(--dur-base) var(--ease-out),
    transform var(--dur-base) var(--ease-out);
}
.project-card:hover {
  border-color: var(--brand-200);
  box-shadow: var(--shadow-md);
  transform: translateY(-3px);
}
.project-card[hidden] { display: none; }

.project-card__cover {
  position: relative;
  aspect-ratio: 16 / 10;
  background: var(--ink-900);
}
.project-card__cover img,
.project-card__cover .project-cover {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.project-card__status {
  position: absolute;
  top: var(--space-3);
  right: var(--space-3);
  padding: 5px 11px;
  border-radius: var(--radius-pill);
  background: rgba(3, 12, 20, .72);
  border: 1px solid var(--border-inverse-strong);
  color: var(--text-on-inverse-muted);
  font-size: var(--fs-label);
  font-weight: 500;
  backdrop-filter: blur(6px);
}

.project-card__body {
  display: flex;
  flex: 1;
  flex-direction: column;
  padding: var(--space-6);
}
.project-card__category {
  color: var(--brand-on-light);
  font-size: var(--fs-label);
  font-weight: 600;
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
}
.project-card h2 {
  margin: var(--space-3) 0;
  font-size: var(--fs-h3);
}
.project-card__body > p {
  margin-bottom: var(--space-5);
  color: var(--text-muted);
  font-size: var(--fs-sm);
  line-height: var(--lh-snug);
}
.project-card__tech {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: auto;
  padding: 0;
  list-style: none;
}
.project-card__tech li {
  padding: 4px 10px;
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  color: var(--text-subtle);
  font-size: var(--fs-label);
}

/* ---- Featured article ---------------------------------------------------- */

.featured-article {
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-md);
}
.featured-article__layout {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, .9fr);
  align-items: stretch;
}
.featured-article__media { background: var(--ink-900); }
.featured-article__media img,
.featured-article__media .project-cover {
  width: 100%;
  height: 100%;
  min-height: 320px;
  object-fit: cover;
}
.featured-article__body {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: var(--space-12);
}
.featured-article__body .pill { align-self: flex-start; margin-bottom: var(--space-5); }
.featured-article h2 {
  margin: var(--space-2) 0 var(--space-4);
  font-size: var(--fs-h2);
}
.featured-article__excerpt {
  color: var(--text-muted);
  font-size: var(--fs-lead);
  line-height: var(--lh-snug);
}
.article-byline {
  margin-top: var(--space-6);
  color: var(--text-subtle);
  font-size: var(--fs-xs);
}

.article-meta {
  color: var(--brand-on-light);
  font-size: var(--fs-label);
  font-weight: 600;
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
}

/* ---- Article grid -------------------------------------------------------- */

.article-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-6);
}
.article-card {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  transition: border-color var(--dur-base) var(--ease-out), box-shadow var(--dur-base) var(--ease-out), transform var(--dur-base) var(--ease-out);
}
.article-card:hover {
  border-color: var(--brand-200);
  box-shadow: var(--shadow-md);
  transform: translateY(-3px);
}
.article-card__cover { aspect-ratio: 16 / 9; background: var(--ink-900); }
.article-card__cover img,
.article-card__cover .project-cover { width: 100%; height: 100%; object-fit: cover; }

/* Illustrated covers: contain the artwork on a light tinted ground instead of
   cropping it like a photograph. */
.article-card__cover.is-art,
.featured-article__media.is-art {
  display: grid;
  place-items: center;
  background:
    radial-gradient(120% 100% at 50% 0%, rgba(52, 196, 14, .12), rgba(52, 196, 14, 0) 72%),
    var(--surface-subtle);
  border-bottom: 1px solid var(--border);
}
.article-card__cover.is-art img,
.featured-article__media.is-art img {
  width: min(76%, 300px);
  height: auto;
  min-height: 0;
  object-fit: contain;
  transition: transform var(--dur-slow) var(--ease-out);
}
.featured-article__media.is-art {
  border-bottom: 0;
  border-right: 1px solid var(--border);
  padding: var(--space-10);
}
.featured-article__media.is-art img { width: min(88%, 400px); }
.article-card:hover .article-card__cover.is-art img { transform: translateY(-5px) scale(1.03); }
.article-card__body { padding: var(--space-6); }
.article-card h3 {
  margin: var(--space-3) 0;
  font-size: var(--fs-h4);
}
.article-card__body > p {
  color: var(--text-muted);
  font-size: var(--fs-sm);
  line-height: var(--lh-snug);
}

/* ---- Collection CTA ------------------------------------------------------ */

.collection-cta {
  padding-block: var(--section-y-tight);
  color: var(--text-on-inverse);
  background: var(--ink-950);
}
.collection-cta__inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-8);
}
.collection-cta h2 {
  max-width: 22ch;
  font-size: var(--fs-h2);
}

/* ---- Portfolio entries from Royalty OS: linked cards and the project page ---- */
.project-card--link { position: relative; }
.project-card--link h2 a { color: inherit; text-decoration: none; }
.project-card--link h2 a::after { content: ""; position: absolute; inset: 0; border-radius: inherit; }
.project-card--link h2 a:focus-visible { outline: none; }
.project-card--link:focus-within { outline: 2px solid var(--brand); outline-offset: 3px; }
.project-card__meta { margin: calc(var(--space-2) * -1) 0 var(--space-3); color: var(--text-muted); font-size: var(--fs-small, .875rem); }

.work-detail { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: var(--space-8, 48px); align-items: start; }
.work-detail__gallery { display: grid; gap: var(--space-4); }
.work-detail__gallery figure { margin: 0; }
.work-detail__gallery img, .work-detail__cover .project-cover { display: block; width: 100%; height: auto; border-radius: var(--radius-lg, 16px); border: 1px solid var(--border); background: var(--ink-900); }
.work-detail__thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: var(--space-3); }
.work-detail__thumbs img { aspect-ratio: 4 / 3; object-fit: cover; }
.work-detail__story { margin-top: var(--space-6); }
.work-detail__story p { margin: 0 0 var(--space-4); color: var(--text-muted); line-height: 1.7; }
.work-detail__aside { position: sticky; top: calc(var(--header-h, 72px) + var(--space-4)); display: grid; gap: var(--space-5); padding: var(--space-6); border: 1px solid var(--border); border-radius: var(--radius-lg, 16px); background: var(--surface, #fff); }
.work-detail__facts { display: grid; gap: var(--space-3); margin: 0; }
.work-detail__facts dt { color: var(--text-muted); font-size: var(--fs-label); letter-spacing: var(--tracking-label); text-transform: uppercase; }
.work-detail__facts dd { margin: 2px 0 0; font-weight: 600; }
.work-detail__actions { display: grid; gap: var(--space-3); }
.work-detail__back { display: inline-flex; align-items: center; gap: var(--space-2); margin-bottom: var(--space-5); color: var(--text-muted); }
.work-detail__back svg { transform: scaleX(-1); }

@media (max-width: 900px) {
  .work-detail { grid-template-columns: minmax(0, 1fr); }
  .work-detail__aside { position: static; }
}
