/* Shared collection components for Projects and AI. Load after section-shell.css. */
body.section-page .collection-header {
  display: flex; align-items: center; justify-content: space-between;
  gap: 24px; margin: 0 0 28px; padding: 0;
}
body.section-page .collection-title {
  display: flex; align-items: center; gap: 12px; margin: 0 0 8px;
  color: var(--shell-ink, #1d1d1f); font-size: 34px; font-weight: 700;
  line-height: 1.15; letter-spacing: -.035em;
}
.collection-title img { width: 28px; height: 28px; object-fit: contain; }
body.section-page .collection-copy { margin: 0; color: var(--shell-muted); font-size: 16px; line-height: 1.5; }
.collection-tabs {
  display: flex; flex-direction: row; align-items: center; flex: 0 0 auto;
  gap: 4px; max-width: 100%; margin-left: auto; padding: 4px;
  border: 1px solid var(--shell-line); border-radius: 12px; background: #fff;
}
.collection-tab {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 10px 16px; border: 0; border-radius: 8px;
  background: transparent; color: var(--shell-muted);
  font: 600 15px/1.35 -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  white-space: nowrap; cursor: pointer;
}
.collection-tab:hover { background: var(--shell-hover); color: var(--shell-ink, #1d1d1f); }
.collection-tab:is(.is-active, [aria-pressed="true"], [aria-selected="true"]) { background: var(--shell-active-bg); color: var(--shell-active); }
.collection-tab > img, .collection-tab .ai-local-icon, .projects-filter-emoji { width: 20px; height: 20px; flex: 0 0 20px; object-fit: contain; }
.projects-filter-emoji { display: inline-grid; place-items: center; font-size: 20px; line-height: 1; }
body.section-page :is(.collection-grid, .projects-grid.collection-grid) {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; margin: 0; padding: 0;
}
body.section-page .collection-grid--pair { grid-template-columns: repeat(2, minmax(0, 1fr)); }
body.section-page .collection-card {
  display: flex; flex-direction: column; min-width: 0; overflow: hidden;
  margin: 0; border: 1px solid var(--shell-line); border-radius: var(--shell-radius);
  background: #fff; box-shadow: 0 2px 6px rgb(20 30 50 / 3%);
}
body.section-page .collection-card:hover { border-color: #bdc7d5; box-shadow: 0 4px 14px rgb(20 30 50 / 6%); }
.collection-art {
  display: block; flex: 0 0 auto; height: 180px; padding: 10px;
  border-bottom: 1px solid var(--shell-line); background: #e8f1fa;
}
.collection-art img { display: block; width: 100%; height: 100%; object-fit: cover; border: 1px solid var(--shell-line); border-radius: 6px; }
.collection-art .ai-model-banner { object-fit: contain; }
.collection-body { display: flex; flex-direction: column; align-items: flex-start; flex: 1; min-width: 0; padding: 20px; }
.collection-card-title { margin: 0 0 8px; font-size: 20px; font-weight: 650; line-height: 1.3; color: var(--shell-ink, #1d1d1f); overflow-wrap: anywhere; }
.collection-description { margin: 0 0 16px; color: var(--shell-muted); font-size: 14px; line-height: 1.65; }
.collection-actions { margin-top: auto; padding-top: 4px; }
/* One action style for project repositories, demos, and AI model links. */
.collection-link {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; max-width: 100%; margin: 0; padding: 10px 12px;
  border: 1px solid #cbd2dc; border-radius: 8px;
  background: #fff; color: var(--shell-ink, #1d1d1f);
  font: 600 13px/1.35 -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  text-decoration: none; box-shadow: none;
}
.collection-link :is(img, svg) { display: block; width: 20px; height: 20px; flex: 0 0 20px; object-fit: contain; border-radius: 3px; }
.collection-link:hover { background: #f3f6fa; border-color: #a8b5c7; }
.collection-link--github img { filter: invert(1); }
.collection-actions--grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; width: 100%; padding-top: 8px; }
.collection-actions--grid > :only-child { grid-column: 1 / -1; }
body.section-page .project-thumb { background: #e8f1fa; }
body.section-page .project-meta { gap: 8px; margin: 2px 0 12px; }
body.section-page .project-meta .pill {
  min-height: 30px; padding: 0 9px 0 0; border: 1px solid var(--shell-line);
  border-radius: 6px; box-shadow: none; font-size: 13px; font-weight: 500;
}
body.section-page .project-meta .pill-icon { flex-basis: 30px; width: 30px; border-right: 1px solid var(--shell-line); }
body.section-page .project-meta .pill > span:not(.pill-icon) { padding-left: 8px; }
body.section-page .project-award {
  border: 1px solid #e8ce86; border-radius: 6px; box-shadow: none;
  background: #fff8df; color: #805b12; font-size: 12px; line-height: 1.45;
  font-weight: 600; margin-bottom: 12px;
}
body.section-page .project-award > img { width: 24px; height: 24px; flex-basis: 24px; }
@media (max-width: 1100px) {
  body.section-page :is(.collection-grid, .projects-grid.collection-grid) { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  body.section-page .collection-header { flex-direction: column; align-items: flex-start; gap: 20px; margin-bottom: 24px; }
  body.section-page .collection-title { font-size: 28px; }
  .collection-tabs { margin-left: 0; }
  .collection-tab { padding-inline: 10px; font-size: 14px; }
  body.section-page :is(.collection-grid, .projects-grid.collection-grid) { gap: 16px; }
}
@media (max-width: 640px) {
  body.section-page :is(.collection-grid, .projects-grid.collection-grid) { grid-template-columns: minmax(0, 1fr); }
  .collection-tabs { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); width: 100%; }
  .collection-tab { grid-column: span 2; min-width: 0; padding-inline: 8px; font-size: 13px; }
  .collection-tab[data-project-filter="all"], .collection-tab[data-project-filter="awards"] { grid-column: span 3; }
  .collection-body { padding: 18px; }
}
/* Keep model banner lettering visible in narrow project cards. */
body.section-page .project-card.has-ios .project-thumb > img { object-fit: contain; }
@media (max-width: 360px) {
  .collection-actions--grid .collection-link { padding-inline: 8px; font-size: 12px; gap: 6px; }
  .collection-actions--grid .collection-link :is(img, svg) { width: 18px; height: 18px; flex-basis: 18px; }
}

/* Square collection components share a crisp, dark frame. */
body:is(.projects-page, .ai-section-page) { --shell-radius: 0; }
body.section-page :is(.collection-card.project-card, .collection-card.ai-feature, .collection-card) {
  border: 2px solid #27292d; border-radius: 0; box-shadow: none;
}
body.section-page :is(.collection-card.project-card, .collection-card.ai-feature, .collection-card):hover { border-color: #27292d; box-shadow: none; }
.collection-tabs { border: 2px solid #27292d; border-radius: 0; }
.collection-tab { border: 2px solid transparent; border-radius: 0; }
.collection-link {
  border: 2px solid #aeb7c4; border-radius: 0; background: #f0f2f5; box-shadow: none;
}
.collection-link:hover { background: #e3e8ef; border-color: #7f8a99; }
.collection-link :is(img, svg) { border-radius: 0; }
.collection-art { border: 0; background: #e4e7eb; }
.collection-art img { border: 0; border-radius: 0; }
body.section-page .collection-card .project-thumb { border: 0; background: #e4e7eb; }
body.section-page .collection-card .project-thumb > img { border: 0; border-radius: 0; background: #e4e7eb; }
body.section-page .collection-card .project-meta .pill {
  border: 2px solid var(--tag-border, #aeb7c4); border-radius: 0; box-shadow: none;
}
.project-meta .python-tag { --tag-border: #9eb9d3; }
.project-meta .swift-tag { --tag-border: #d4ad92; }
.project-meta .typescript-tag { --tag-border: #9eb6d8; }
.project-meta .openai-tag { --tag-border: #aeb9aa; }
body.section-page .collection-card .project-meta .pill-icon { border: 0; }
body.section-page .collection-card .project-award { border: 2px solid #c8a34e; border-radius: 0; }

.collection-tab:is(.is-active, [aria-pressed="true"], [aria-selected="true"]) {
  border-color: #27292d; background: #eef0f3; color: var(--shell-ink, #1d1d1f);
}
@media (max-width: 640px) {
  .collection-tab { padding-inline: 4px; gap: 6px; }
}

/* A reusable six-panel preview inside the standard card image area. */
.collection-art--mosaic {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-template-rows: repeat(2, minmax(0, 1fr)); gap: 4px;
}
.collection-art--mosaic > a { display: block; min-width: 0; min-height: 0; overflow: hidden; }
.collection-art--mosaic img { object-fit: cover; }

/* Equal-width segments for longer labels such as app privacy policies. */
.collection-tabs--balanced > .collection-tab { flex: 1; white-space: normal; }
.collection-tab:focus-visible { outline: 3px solid var(--shell-active); outline-offset: 3px; }
@media (max-width: 760px) {
  .collection-tabs--balanced { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .collection-tabs--balanced > .collection-tab { grid-column: auto; gap: 6px; padding-inline: 6px; }
}

.collection-link:focus-visible { outline: 3px solid var(--shell-active, #0b57d0); outline-offset: 3px; }
