/* ==========================================================================
   Các đợt vinh danh (duyệt 14/11): tầng 1 = các đợt dạng tab,
   tầng 2 = nhóm thành tích trong đợt (nút nhỏ) + tìm tên; bên dưới là thẻ học sinh.
   ========================================================================== */
.board__title { font-size: var(--t-3xl); }
.board__intro { margin-top: 8px; color: var(--ink-soft); }

/* ---------- Tầng 1: các đợt ---------- */
.periods {
  display: flex;
  gap: 4px;
  margin-top: 22px;
  border-bottom: 1px solid var(--line-gold);
  overflow-x: auto;
  scrollbar-width: none;
}
.periods::-webkit-scrollbar { display: none; }

.period {
  flex: none;
  display: grid;
  gap: 2px;
  margin-bottom: -1px;
  padding: 12px 18px 14px;
  border: 0;
  border-bottom: 3px solid transparent;
  background: none;
  color: var(--ink-soft);
  text-align: left;
}
.period__title {
  font-family: var(--f-display);
  font-size: var(--t-lg);
  font-weight: 600;
  white-space: nowrap;
}
.period__sub { font-size: .8rem; }
.period:hover { color: var(--ink); }
.period[aria-selected="true"] { color: var(--gold-deep); border-bottom-color: var(--brand); }
.period[aria-selected="true"] .period__title { color: var(--ink); }
.period:focus-visible { outline-offset: -2px; }

.period__badge {
  display: inline-block;
  margin-left: 6px;
  padding: 0 8px;
  border-radius: 999px;
  background: var(--brand-deep);
  color: #fff;
  font: 600 .7rem/1.7 var(--f-body);
  vertical-align: 3px;
}

/* ---------- Tầng 2: nhóm thành tích trong đợt + tìm tên ---------- */
.subbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  margin: 18px 0 6px;
}

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  min-height: 32px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--card);
  font-size: .85rem;
  font-weight: 500;
  color: var(--ink-soft);
}
.chip:hover { border-color: var(--brand); color: var(--ink); }
.chip[aria-pressed="true"] {
  background: var(--gold-tint);
  border-color: var(--brand);
  color: var(--gold-deep);
  font-weight: 600;
}

.search { display: block; width: min(280px, 100%); }
.search__input {
  width: 100%;
  height: 40px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--card);
}
.search__input:focus { border-color: var(--brand); outline: none; box-shadow: 0 0 0 3px rgba(247, 99, 0, .16); }

.board__count { min-height: 1.6em; margin-bottom: 18px; font-size: .85rem; color: var(--ink-soft); }

/* ---------- Thẻ học sinh: ảnh tròn kiểu huy chương (phương án 2B đã duyệt) ---------- */
.cards {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: clamp(14px, 2vw, 24px);
}

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 32px 14px 20px;
  background: var(--card);
  border-top: 4px solid var(--brand);
  border-radius: var(--radius-m);
  box-shadow: 0 0 0 1px rgba(43, 26, 16, .07);
  text-align: center;
  transition: box-shadow .2s ease, transform .2s ease;
}
.card:hover,
.card:focus-within {
  transform: translateY(-2px);
  box-shadow: 0 0 0 1px var(--line-gold), 0 14px 34px rgba(247, 99, 0, .14);
}

/* Huy chương: viền cam–vàng, khe trắng, ảnh tròn */
.card__media {
  position: relative;
  width: min(150px, 78%);
  aspect-ratio: 1 / 1;
  margin-bottom: 14px;
  padding: 4px;
  border-radius: 50%;
  background: conic-gradient(from 200deg, #ffc35c, var(--brand), #ffb84d, var(--brand), #ffc35c);
}
.card__media > img {   /* chỉ ảnh học sinh, không áp vào vương miện */
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 1 / 1;   /* luôn tròn, bất kể ảnh gốc dọc hay ngang */
  border: 4px solid #fff;
  border-radius: 50%;
  object-fit: cover;
  background: #fff;
}

/* Chữ lồng khi chưa có ảnh */
.card__monogram {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: linear-gradient(160deg, #ffb84d, var(--brand));
  color: #fff;
  font-family: var(--f-display);
  font-size: clamp(2.2rem, 5vw, 3.2rem);
  font-weight: 600;
}
.card__media .card__monogram { inset: 4px; border: 4px solid #fff; border-radius: 50%; }

/* Vương miện (phương án B4 đã duyệt): lớp phủ trùm ảnh, xoay quanh tâm ảnh một góc --crown-tilt.
   Vương miện đặt ở đỉnh lớp phủ → đường từ tâm ảnh luôn vuông góc với vành vương miện,
   vành dưới cong theo khung tròn và đè lên viền (z-index cao hơn ảnh). */
.card__crown-orbit {
  --crown-tilt: 32deg;
  position: absolute;
  inset: 0;
  z-index: 3;
  transform: rotate(var(--crown-tilt));
  pointer-events: none;
}
.card__crown {
  position: absolute;
  left: 50%;
  top: 0;
  width: 28%;
  height: auto;
  transform: translate(-50%, -84%);
  filter: drop-shadow(0 1px 2px rgba(150, 50, 0, .35));
}

.card__body { display: grid; justify-items: center; gap: 6px; }

.card__name { font-size: var(--t-lg); font-weight: 600; line-height: 1.3; }

/* Nút phủ cả thẻ (cả thẻ bấm được, vẫn đúng chuẩn truy cập) */
.card__link {
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  color: inherit;
  text-align: center;
}
.card__link::after { content: ""; position: absolute; inset: 0; z-index: 2; }
.card__link:focus-visible { outline: none; }
.card:has(.card__link:focus-visible) { outline: 2px solid var(--brand-deep); outline-offset: 3px; }

.card__meta { font-size: var(--t-sm); color: var(--ink-soft); }

.card__tags { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin-top: 2px; }
.tag {
  padding: 2px 10px;
  border-radius: 999px;
  background: var(--gold-tint);
  box-shadow: inset 0 0 0 1px var(--line-gold);
  color: var(--gold-deep);
  font-size: .78rem;
  font-weight: 600;
}

.board__empty {
  padding: 40px 16px;
  text-align: center;
  color: var(--ink-soft);
  border: 1px dashed var(--line);
  border-radius: var(--radius-m);
}

@media (max-width: 1000px) {
  .cards { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .card { padding: 26px 10px 16px; }
  .card__media { width: min(116px, 82%); }
  .card__name { font-size: var(--t-md); }
  .search { width: 100%; }
  .period { padding: 10px 14px 12px; }
}
