@layer components {
  /* ── HERO ── */
  .list-hero {
    margin-bottom: 32px;

    h1 {
      font-family: var(--font-heading), serif;
      font-size: 50px;
      font-weight: 300;
      font-style: italic;
      color: var(--color-on-primary);
      line-height: 1.05;
      margin-bottom: 6px;
      text-shadow: 0 2px 20px var(--shadow-blue-lg);
    }

    p {
      font-size: 13px;
      color: var(--color-muted);
      font-weight: 300;
      letter-spacing: 0.05em;
    }
  }

  /* ── RESULTS BAR ── */
  .results-bar {
    display: flex;
    align-items: center;
    margin-bottom: 14px;
  }

  .results-count {
    font-size: 13px;
    color: var(--color-muted);
    font-weight: 300;

    strong {
      color: var(--color-on-primary);
      font-weight: 500;
    }
  }

  /* ── FILTERS ── */
  .filters {
    background: var(--color-glass-overlay);
    border: 1px solid var(--color-outline);
    border-radius: 14px;
    padding: 18px 22px;
    margin-bottom: 22px;
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: flex-end;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);

    input[type="text"],
    select {
      border: 1px solid var(--color-glass-border);
      border-radius: 8px;
      padding: 8px 12px;
      font-size: 13px;
      color: var(--color-on-primary);
      background: var(--color-glass-surface);
      outline: none;
      transition: all 0.2s;
      width: 100%;

      &::placeholder {
        color: var(--color-placeholder);
      }

      &:focus {
        background: var(--color-glass-hover);
        border-color: var(--color-muted);
      }
    }

    select option {
      color: var(--color-on-surface);
      background: var(--color-surface);
    }
  }

  .filter-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
    flex: 1;
    min-width: 130px;

    &.filter-group--wide { flex: 2; min-width: 180px; }
  }

  .filter-label,
  .filter-group label {
    font-size: 10px;
    letter-spacing: 0.15em;
    color: var(--color-muted);
    text-transform: uppercase;
  }

  .filter-toggles {
    display: flex;
    flex-direction: column;
    gap: 5px;
  }

  .toggles-row {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
  }

  .toggle-pill {
    padding: 7px 11px;
    border-radius: 20px;
    border: 1px solid var(--color-glass-border);
    background: var(--color-glass-surface);
    font-size: 11px;
    color: var(--color-glass-text);
    cursor: pointer;
    transition: all 0.18s;
    display: flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
    user-select: none;

    &:hover {
      background: var(--color-glass-hover);
    }

    &:has(input:checked) {
      background: var(--color-surface-container);
      color: var(--color-on-surface-strong);
      border-color: var(--color-surface-container);
      font-weight: 500;
    }

    svg {
      width: 11px;
      height: 11px;
    }
  }

  /* ── COMPOSER CARDS ── */
  .cards-list {
    display: flex;
    flex-direction: column;
    gap: 14px;
  }

  .composer-card {
    background: var(--color-surface-container);
    border: 1px solid var(--color-card-border);
    border-radius: 16px;
    padding: 22px 36px 18px;
    cursor: pointer;
    transition: transform 0.18s, box-shadow 0.18s, background 0.18s;
    box-shadow: 0 4px 24px var(--shadow-blue-md);
    display: block;
    color: inherit;
    position: relative;

    &:hover {
      box-shadow: 0 10px 40px var(--shadow-blue-lg);
      background: var(--color-surface-hover);
    }
  }

  .card-overlay-link {
    position: absolute;
    inset: 0;
    z-index: 0;
    border-radius: inherit;
  }

  .card-grid {
    display: grid;
    grid-template-columns: 96px minmax(0, 1fr) max-content;
    gap: 24px;
    align-items: start;
  }

  .card-media {
    display: flex;
    align-items: flex-start;
    justify-content: center;
  }

  .card-avatar {
    width: 96px;
    height: 96px;
    border-radius: 50%;
    flex-shrink: 0;
    background: var(--color-avatar-bg);
    border: 1.5px solid var(--editor-border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-heading), serif;
    font-size: 28px;
    font-weight: 700;
    color: var(--color-on-surface-strong);
    overflow: hidden;
  }

  .card-photo {
    width: 100%;
    height: 100%;
    object-fit: cover;
  }

  .card-info {
    margin-bottom: 10px;
  }

  .card-name {
    font-family: var(--font-heading), serif;
    font-size: 26px;
    font-weight: 700;
    color: var(--color-on-surface);
    margin-bottom: 2px;
    line-height: 1.2;
  }

  .card-birth {
    font-size: 14px;
    color: var(--color-on-surface-variant);
    font-weight: 300;
  }

  .card-teaser {
    font-size: 14px;
    color: var(--color-on-surface-variant);
    line-height: 1.65;
    margin-bottom: 14px;
    box-sizing: border-box;
    width: 100%;

    strong {
      color: var(--color-on-surface-strong);
      font-weight: 500;
    }
  }

  .card-divider {
    height: 1px;
    background: var(--color-outline-variant);
    margin: 0 0 14px;
    box-sizing: border-box;
    width: 100%;
  }

  .card-stats {
    display: grid;
    grid-template-columns: repeat(2, max-content);
    justify-content: end;
    gap: 12px 16px;
    box-sizing: border-box;
    width: 100%;
    position: relative;
    z-index: 1;
  }

  @media (max-width: 720px) {
    .card-grid {
      grid-template-columns: 1fr;
    }

    .card-stats {
      padding-left: 0;
    }

    .card-teaser,
    .card-divider {
      padding-left: 0;
      margin-left: 0;
      width: 100%;
    }
  }

  /* ── STAT PILLS ── */
  .stat-pill {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 6px 14px 6px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 400;
    color: var(--color-on-surface);
    justify-content: flex-start;
    white-space: nowrap;

    .sicon {
      width: 36px;
      height: 36px;
      border-radius: 6px;
      display: flex;
      align-items: center;
      justify-content: center;
      flex-shrink: 0;

      svg { width: 20px; height: 20px; }
    }

    &.works { background: var(--stat-works-bg); }
    &.works .sicon { background: var(--stat-works-icon); }

    &.videos { background: var(--stat-videos-bg); }
    &.videos .sicon { background: var(--stat-videos-icon); }

    &.recordings { background: var(--stat-recordings-bg); }
    &.recordings .sicon { background: var(--stat-recordings-icon); }

    &.scores { background: var(--stat-scores-bg); }
    &.scores .sicon { background: var(--stat-scores-icon); }

    &.photos { background: var(--stat-photos-bg); }
    &.photos .sicon { background: var(--stat-photos-icon); }

    &.zero {
      opacity: 0.45;
      filter: grayscale(0.1);
    }
  }

  a.stat-pill {
    text-decoration: none;
    transition: opacity 0.15s, transform 0.15s;

    &:hover {
      opacity: 0.85;
      transform: translateY(-1px);
    }
  }

  /* ── NO RESULTS ── */
  .no-results {
    padding: 48px 20px;
    text-align: center;
    color: var(--color-muted);
    font-size: 16px;
    font-weight: 300;
    font-style: italic;
    font-family: var(--font-heading), serif;
    background: var(--color-glass-overlay);
    border-radius: 14px;
    border: 1px solid var(--color-outline);
  }

  /* ── BACK BUTTON ── */
  .back-btn {
    display: inline-block;
    font-size: 11px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--color-on-surface-variant);
    margin-bottom: 16px;
    transition: color 0.15s;

    &:hover { color: var(--color-on-surface); }
  }

  /* ── DETAIL CARD ── */
  .detail-card {
    background: var(--color-surface-container);
    border: 1px solid var(--color-card-border);
    border-radius: 18px;
    box-shadow: 0 6px 48px var(--shadow-blue-lg);
    overflow: hidden;
    margin-top: 10px;
  }

  .detail-head {
    padding: 16px 36px 26px;
    display: flex;
    align-items: flex-start;
    gap: 24px;
  }

  .detail-name {
    font-family: var(--font-heading), serif;
    font-size: 46px;
    font-weight: 300;
    font-style: italic;
    color: var(--color-heading);
    line-height: 1;
    margin-bottom: 10px;
  }

  .detail-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    font-size: 13px;
    color: var(--color-on-surface-variant);
    font-weight: 300;
    margin-bottom: 10px;
  }

  .detail-meta-item {
    display: flex;
    align-items: center;
    gap: 6px;

    svg {
      width: 13px;
      height: 13px;
      opacity: 0.55;
    }
  }

  .detail-badge {
    display: inline-block;
    background: var(--color-primary);
    color: var(--color-badge-text);
    font-size: 10px;
    letter-spacing: 0.15em;
    padding: 4px 12px;
    border-radius: 20px;
  }

  /* ── DETAIL STATS / TABS ── */
  .detail-stats {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    border-top: 1px solid var(--color-outline-variant);
  }

  .detail-stat {
    padding: 22px 12px 0;
    height: var(--detail-stat-height);
    box-sizing: border-box;
    text-align: center;
    border-right: 1px solid var(--color-outline-variant);
    transition: background 0.15s;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;

    border-bottom: 3px solid transparent;

    &:last-child { border-right: none; }
    &.zero { opacity: 0.45; filter: grayscale(0.1); }
    &.active { background: var(--editor-tint-subtle); }

    &.biography.active { border-bottom-color: var(--stat-biography-icon); }
    &.works.active { border-bottom-color: var(--stat-works-icon); }
    &.videos.active { border-bottom-color: var(--stat-videos-icon); }
    &.recordings.active { border-bottom-color: var(--stat-recordings-icon); }
    &.scores.active { border-bottom-color: var(--stat-scores-icon); }
    &.photos.active { border-bottom-color: var(--stat-photos-icon); }
  }

  button.detail-stat {
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    font: inherit;
    width: 100%;

    &:hover { background: var(--color-outline-variant); }
  }


  .detail-stat-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;

    svg { width: 18px; height: 18px; }
  }

  .biography-icon { background: var(--stat-biography-icon); }
  .works-icon { background: var(--stat-works-icon); }
  .videos-icon { background: var(--stat-videos-icon); }
  .recordings-icon { background: var(--stat-recordings-icon); }
  .scores-icon { background: var(--stat-scores-icon); }
  .photos-icon { background: var(--stat-photos-icon); }

  .detail-stat-num {
    font-family: var(--font-heading), serif;
    font-size: 34px;
    font-weight: 600;
    line-height: 1;
  }

  .detail-stat.zero .detail-stat-num { color: var(--stat-zero-num); }
  .detail-stat.works:not(.zero) .detail-stat-num { color: var(--stat-works-num); }
  .detail-stat.videos:not(.zero) .detail-stat-num { color: var(--stat-videos-num); }
  .detail-stat.recordings:not(.zero) .detail-stat-num { color: var(--stat-recordings-num); }
  .detail-stat.scores:not(.zero) .detail-stat-num { color: var(--stat-scores-num); }
  .detail-stat.photos:not(.zero) .detail-stat-num { color: var(--stat-photos-num); }

  .detail-stat-label {
    font-size: 10px;
    color: var(--color-on-surface-variant);
    letter-spacing: 0.1em;
    text-transform: uppercase;
    margin-top: var(--space-xs);
    margin-bottom: var(--space-xxs);
  }

  .tab-content {
    padding: 30px 36px 36px;
  }

  /* ── BIOGRAPHY ── */
  .detail-bio {
    padding: 30px 36px 36px;
  }

  .bio-label {
    font-size: 10px;
    letter-spacing: 0.2em;
    color: var(--color-on-surface-variant);
    text-transform: uppercase;
    margin-bottom: 18px;
    display: flex;
    align-items: center;
    gap: 12px;

    &::after {
      content: '';
      flex: 1;
      height: 1px;
      background: var(--color-outline-variant);
    }
  }

  .biography-text {
    font-family: var(--font-heading), serif;
    font-size: 18px;
    font-weight: 300;
    line-height: 1.85;
    color: var(--color-prose);

    &::after {
      content: "";
      display: block;
      clear: both;
    }

    p {
      margin-bottom: 1.2em;

      &:last-child {
        margin-bottom: 0;
      }
    }
  }

  .bio-photo {
    float: right;
    width: 260px;
    margin: 6px 0 18px 24px;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 10px 24px var(--shadow-blue-md);

    img {
      width: 100%;
      height: auto;
      display: block;
    }
  }

  @media (max-width: 720px) {
    .bio-photo {
      float: none;
      width: 100%;
      margin: 0 0 18px;
    }
  }

  /* ── TAB HEADINGS ── */
  .tab-heading {
    font-family: var(--font-heading), serif;
    font-size: 28px;
    font-weight: 300;
    font-style: italic;
    color: var(--color-heading);
    margin-bottom: var(--space-l);
  }

  /* ── VIDEOS TAB ── */
  .videos-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-xl);

    @media (max-width: 720px) {
      grid-template-columns: 1fr;
    }
  }

  .video-embed {
    position: relative;
    padding-bottom: 56.25%;
    height: 0;
    border-radius: 12px;
    overflow: hidden;
    background: var(--color-media-bg);

    iframe {
      position: absolute;
      inset: 0;
      width: 100%;
      height: 100%;
    }
  }

  .video-meta {
    margin-top: var(--space-s);
    text-align: center;
  }

  .video-title {
    font-family: var(--font-heading), serif;
    font-size: 20px;
    font-weight: 600;
    color: var(--color-on-surface);
    margin-bottom: var(--space-xxs);
  }

  .video-description {
    font-size: 14px;
    color: var(--color-on-surface-variant);
    line-height: 1.6;
  }

  /* ── PHOTOS TAB ── */
  .photos-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-l);

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

  .photo-card {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
  }

  .photo-frame {
    border-radius: 12px;
    overflow: hidden;
    background: var(--color-media-bg);

    img {
      width: 100%;
      height: auto;
      display: block;
    }
  }

  .photo-caption {
    padding: 0 var(--space-xs);
  }

  .photo-title {
    font-family: var(--font-heading), serif;
    font-size: 15px;
    font-weight: 400;
    font-style: italic;
    color: var(--color-heading);
  }

  .photo-description {
    font-size: 13px;
    color: var(--color-on-surface-variant);
    line-height: 1.5;
    margin-top: 2px;
  }

  /* ── SHARED RESOURCE GROUP ── */
  .resource-group {
    background: var(--color-glass-overlay);
    border: 1px solid var(--color-outline-variant);
    border-radius: 12px;
    overflow: hidden;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
  }

  .resource-group-header {
    padding: var(--space-s) var(--space-l);
    background: var(--color-glass-surface);
    border-bottom: 1px solid var(--color-outline-variant);
  }

  .resource-group-title {
    font-family: var(--font-heading), serif;
    font-size: 18px;
    font-weight: 400;
    font-style: italic;
    color: var(--color-heading);
  }

  /* ── WORKS TAB ── */
  .works-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-m);
  }

  .work-head {
    display: flex;
    align-items: center;
    gap: var(--space-s);
    flex-wrap: wrap;
  }

  .work-name {
    flex: 1;
  }

  .work-description {
    font-size: 14px;
    color: var(--color-on-surface-variant);
    line-height: 1.6;
    padding: var(--space-s) var(--space-l) var(--space-m);
  }

  .work-resources {
    display: flex;
    gap: var(--space-xs);
    margin-left: auto;
  }

  .work-expand-btn {
    background: none;
    border: 1px solid var(--color-outline-variant);
    border-radius: 50%;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--color-on-surface-variant);
    transition: background 0.15s, color 0.15s;
    flex-shrink: 0;

    svg {
      width: 12px;
      height: 12px;
      transition: transform 0.2s;
    }

    &:hover {
      background: var(--color-glass-hover);
      color: var(--color-on-primary);
    }

    &.expanded svg { transform: rotate(180deg); }
  }

  .work-inline-resources {
    border-top: 1px solid var(--color-outline-variant);
    padding: var(--space-m) var(--space-l);
    display: flex;
    flex-direction: column;
    gap: var(--space-m);
  }

  .work-inline-videos {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-m);

    @media (max-width: 720px) { grid-template-columns: 1fr; }
  }

  .work-inline-scores {
    border: 1px solid var(--color-outline-variant);
    border-radius: 8px;
    overflow: hidden;
  }

  .work-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    font-weight: 500;
    border-radius: 20px;
    padding: 4px 10px 4px 6px;
    color: var(--color-on-surface-variant);

    svg { width: 13px; height: 13px; }

    &.scores { background: var(--stat-scores-bg); }
    &.videos { background: var(--stat-videos-bg); }
  }

  /* ── RECORDINGS TAB ── */
  .recordings-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-l);
  }

  .recording-work {
    font-size: 12px;
    color: var(--color-muted);
    margin-top: 2px;
  }

  .recording-embed {
    iframe {
      display: block;
      width: 100%;
      height: 166px;
      border: none;
    }
  }

  .recording-description {
    padding: var(--space-s) var(--space-l);
    font-size: 13px;
    color: var(--color-on-surface-variant);
    line-height: 1.6;
    border-top: 1px solid var(--color-outline-variant);
  }

  /* ── SCORES TAB ── */
  .scores-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-m);
  }

  .scores-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-xs);
    padding: var(--space-xs);

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

  .score-row {
    display: flex;
    align-items: center;
    gap: var(--space-m);
    padding: var(--space-s) var(--space-m);
    text-decoration: none;
    color: inherit;
    transition: background 0.15s;
    border: 1px solid var(--color-outline-variant);
    border-radius: 8px;

    &:hover {
      background: var(--color-glass-hover);

      .score-open { opacity: 1; }
    }
  }

  .score-pdf-icon {
    flex-shrink: 0;
    width: 28px;
    height: 34px;
    color: var(--stat-scores-icon);

    svg { width: 100%; height: 100%; }
  }

  .score-name {
    flex: 1;
    font-size: 15px;
    color: var(--color-on-surface);
    font-weight: 400;
  }

  .score-open {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--color-muted);
    opacity: 0.5;
    transition: opacity 0.15s;
    white-space: nowrap;

    svg { width: 11px; height: 11px; }
  }
}
