/* =========================================================================
 * data-pages.css — shared styling for the build-time {% datagrid %} component
 * (Music grid, Movies/Reads tabs, Talks list), the Portfolio category tabs, and
 * the homepage hero + per-entry affiliation logos. Single source of truth,
 * injected via theme inject.head. Reuses Butterfly CSS variables (with
 * fallbacks) so it tracks light/dark mode.
 * ========================================================================= */

/* ----------------------------------------------------------------- datagrid */
.datagrid {
  margin: 1.2rem 0 2rem;
}

/* --- controls (year select / category tabs) --- */
.dg-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem 1rem;
  margin-bottom: 1.2rem;
}

.dg-total {
  font-size: 0.82rem;
  color: var(--text-highlight-color, #1f2d3d);
  opacity: 0.65;
}

.dg-tabs {
  gap: 0.6rem;
}

/* multi-select category checkboxes (Music) */
.dg-multi {
  gap: 0.5rem 0.9rem;
}

.dg-check {
  display: inline-flex;
  align-items: center;
  gap: 0.3em;
  padding: 0.25rem 0.7rem;
  font-size: 0.9rem;
  color: var(--font-color, #4c4948);
  background: var(--card-bg, #fff);
  border: 1px solid rgba(128, 128, 128, 0.3);
  border-radius: 999px;
  cursor: pointer;
  user-select: none;
}

.dg-check input {
  cursor: pointer;
  margin: 0;
}

.dg-tab {
  display: inline-flex;
  align-items: center;
  gap: 0.45em;
  padding: 0.4rem 0.95rem;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--font-color, #4c4948);
  background: var(--card-bg, #fff);
  border: 1px solid rgba(128, 128, 128, 0.3);
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.dg-tab:hover {
  transform: translateY(-1px);
}

.dg-tab.is-active {
  color: #fff;
  background: var(--btn-bg, #49b1f5);
  border-color: transparent;
}

.dg-count {
  font-size: 0.78em;
  padding: 0.05em 0.5em;
  border-radius: 999px;
  background: rgba(128, 128, 128, 0.18);
}

.dg-tab.is-active .dg-count {
  background: rgba(255, 255, 255, 0.28);
}

/* --- grid --- */
.dg-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(165px, 1fr));
  gap: 1.1rem;
}

.dg-card {
  display: flex;
  flex-direction: column;
  align-self: start;
  overflow: hidden;
  background: var(--card-bg, #fff);
  border-radius: 12px;
  box-shadow: var(--card-box-shadow, 0 4px 12px -2px rgba(0, 0, 0, 0.1));
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.dg-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--card-hover-box-shadow, 0 8px 20px -4px rgba(0, 0, 0, 0.18));
}

.dg-card[hidden] {
  display: none;
}

/* --- media (cover / poster) --- */
.dg-media {
  display: block;
  position: relative;
  aspect-ratio: var(--media-aspect, 2 / 3);
  background: rgba(128, 128, 128, 0.12);
  overflow: hidden;
}

.dg-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.4s ease;
}

.dg-card:hover .dg-img {
  transform: scale(1.04);
}

/* placeholder shown when a row has no cover image yet */
.dg-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.4rem;
  opacity: 0.35;
}

/* --- body --- */
.dg-body {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 0.7rem 0.8rem 0.85rem;
}

.dg-title {
  margin: 0;
  font-size: 0.98rem;
  font-weight: 700;
  line-height: 1.3;
  color: var(--text-highlight-color, #1f2d3d);
}

.dg-title a {
  color: inherit;
  text-decoration: none;
}

.dg-title a:hover {
  color: var(--btn-bg, #49b1f5);
}

.dg-badge {
  align-self: flex-start;
  font-size: 0.72rem;
  padding: 0.1em 0.6em;
  border-radius: 6px;
  color: var(--text-highlight-color, #1f2d3d);
  background: rgba(128, 128, 128, 0.14);
}

.dg-metas {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.dg-meta {
  font-size: 0.8rem;
  line-height: 1.35;
  color: var(--font-color, #4c4948);
  opacity: 0.85;
}

.dg-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.15rem;
}

.dg-links a {
  font-size: 0.74rem;
  font-weight: 600;
  padding: 0.12em 0.55em;
  border-radius: 6px;
  text-decoration: none;
  color: var(--font-color, #4c4948);
  border: 1px solid rgba(128, 128, 128, 0.3);
  transition: all 0.18s ease;
}

.dg-links a:hover {
  color: #fff;
  background: var(--btn-bg, #49b1f5);
  border-color: transparent;
}

.dg-comment {
  margin: 0.2rem 0 0;
  font-size: 0.8rem;
  line-height: 1.45;
  color: var(--font-color, #4c4948);
  opacity: 0.78;
}

/* --- responsive --- */
@media (max-width: 768px) {
  .dg-grid {
    grid-template-columns: repeat(auto-fill, minmax(135px, 1fr));
    gap: 0.8rem;
  }
  .dg-title { font-size: 0.9rem; }
  .dg-meta, .dg-comment { font-size: 0.76rem; }
}

@media (max-width: 480px) {
  .dg-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* --- print --- */
@media print {
  .dg-controls { display: none; }
  .dg-card { break-inside: avoid; box-shadow: none; border: 1px solid #ddd; }
  .dg-card[hidden] { display: flex !important; }
}

/* ----------------------------------------------------- homepage (index.md) */
.home-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(200px, 260px);
  gap: 1.5rem;
  align-items: center;
  margin: 0 0 1.5rem;
}

.home-hero__content { min-width: 0; }

.home-hero__signature {
  display: block;
  height: 52px;
  width: auto;
  /* !important beats Butterfly's `#article-container img { margin: 0 auto }` */
  margin: 0.2rem 0 0.4rem 0 !important;
}

.home-hero__meta {
  margin-top: 0.35rem;
  color: var(--card-meta);
}

.home-hero__pronounce {
  margin-left: 0.5rem;
  padding: 0.2rem 0.6rem;
  border: 1px solid var(--dark-grey);
  border-radius: 999px;
  background: var(--btn-bg);
  color: var(--btn-color);
  cursor: pointer;
  font-size: 0.95rem;
}

.home-hero__pronounce:hover { background: var(--btn-hover-color); }

.home-hero__pronounce:focus-visible {
  outline: 2px solid var(--text-highlight-color);
  outline-offset: 2px;
}

.home-hero__contact {
  margin-top: 0.75rem;
  line-height: 1.6;
  color: var(--font-color);
}

.home-hero__media { justify-self: end; }

.home-hero__media img {
  display: block;
  width: 100%;
  height: auto;
  background: transparent;
}

@media (max-width: 900px) {
  .home-hero { grid-template-columns: 1fr; }
  .home-hero__media { order: -1; max-width: 220px; }
}

/* Experience / Education: single text column; each entry carries its own
 * affiliation logo(s) inline on the right, in full color. */
.row { margin-bottom: 1rem; }
.left { min-width: 0; }

/* Contain each entry's floated logo chips within its own list item, so they
 * always right-align to that entry no matter how few text lines it has
 * (without this, a short entry's logos overflow down into the next entry).
 * A clearfix keeps the float in-flow per entry while preserving list bullets. */
.left li::after { content: ""; display: block; clear: both; }

/* inline per-entry affiliation logos — each logo sits in a uniform framed
 * "chip" so disparate sizes/shapes (square seals, wide wordmarks) read as one
 * tidy, coordinated set; entries may have zero, one, or several. */
.cv-logos {
  float: right;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  max-width: 56%;
  margin: 0.1rem 0 0.5rem 0.5rem;
}

.cv-logo {
  box-sizing: border-box;
  /* !important beats Butterfly's `#article-container img` height/max-width */
  height: 45px !important;            /* uniform chip height for every logo */
  width: 200px !important;
  max-width: 120px !important;
  object-fit: contain;
  padding: 1px 1px;
  background: #fff;        /* keeps every logo legible, incl. dark mode */
  border: 1px solid rgba(128, 128, 128, 0.22);
  border-radius: 8px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

/* inline award/achievement logos (Honors list) — uniform optical height, color */
.award-logo {
  float: right;
  height: 42px;
  width: auto;
  max-width: 120px;
  object-fit: contain;
  margin: 0 0 0.3rem 0.6rem;
  border-radius: 0 !important;
}

@media (max-width: 600px) {
  .cv-logos { max-width: 50%; gap: 0.3rem; }
  .cv-logo { height: 27px; max-width: 86px; }
  .award-logo { height: 32px; max-width: 90px; }
}

/* ----------------------------------------------------------- talks (list) */
.talks { margin: 1.2rem 0 2rem; }

.talks-year { margin-bottom: 1.2rem; }

.talks-year__label {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--btn-bg, #49b1f5);
  margin: 1rem 0 0.6rem;
  padding-bottom: 0.2rem;
  border-bottom: 1px solid rgba(128, 128, 128, 0.2);
}

.talks-list { list-style: none; margin: 0; padding: 0; }

.talk {
  padding: 0.55rem 0;
  border-bottom: 1px dashed rgba(128, 128, 128, 0.18);
}

.talk__title { font-weight: 600; color: var(--text-highlight-color, #1f2d3d); }
.talk__title a { color: inherit; text-decoration: none; }
.talk__title a:hover { color: var(--btn-bg, #49b1f5); }

.talk__venue {
  font-size: 0.82rem;
  color: var(--font-color, #4c4948);
  opacity: 0.82;
  margin-top: 0.15rem;
}

.talk__type {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 600;
  color: #fff;
  background: var(--btn-bg, #49b1f5);
  border-radius: 4px;
  padding: 0 0.45em;
  margin-right: 0.3em;
}

.talk__links { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.3rem; }

.talk__links a {
  font-size: 0.74rem;
  font-weight: 600;
  padding: 0.1em 0.55em;
  border-radius: 6px;
  text-decoration: none;
  color: var(--font-color, #4c4948);
  border: 1px solid rgba(128, 128, 128, 0.3);
  transition: all 0.18s ease;
}

.talk__links a:hover { color: #fff; background: var(--btn-bg, #49b1f5); border-color: transparent; }

/* ----------------------------------------------------- portfolio video embed */
.video-wrap {
  margin: 0.8rem 0 1.4rem;
}

.video-wrap video {
  display: block;
  width: 100%;
  max-width: 760px;
  height: auto;
  background: #000;
  border-radius: 10px;
  box-shadow: var(--card-box-shadow, 0 4px 12px -2px rgba(0, 0, 0, 0.15));
}

/* ------------------------------------------ portfolio: category tabs */
.tabs-box { margin: 1.2rem 0 1.5rem; }
.tab-panel[hidden] { display: none; }
.tab-empty { color: var(--font-color, #4c4948); opacity: 0.7; padding: 1.2rem 0; }

/* ------------------------------------------ talks: count + numbering */
.talks-total {
  font-size: 0.9rem;
  color: var(--text-highlight-color, #1f2d3d);
  opacity: 0.75;
  margin: 0 0 0.8rem;
}
.talk { display: flex; gap: 0.7rem; }
.talk__num {
  flex: 0 0 auto;
  min-width: 1.9em;
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  color: var(--btn-bg, #49b1f5);
  opacity: 0.85;
}
.talk__body { flex: 1 1 auto; min-width: 0; }

/* ------------------------------------------ homepage: talks preview */
.talks--preview .talks-list { margin-top: 0.2rem; }
.talks-more {
  display: inline-block;
  margin-top: 0.6rem;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--btn-bg, #49b1f5);
}
