/* ─── Inner page layouts ────────────────────────────────────────────────── */

/* ══ SIDEBAR LAYOUT ══ */
.inner-layout {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: var(--space-8);
  align-items: start;
}

.inner-layout > aside {
  position: sticky;
  top: calc(64px + var(--space-6));
  /* Cap to the visible viewport so tall menus (many subsections) don't run off
     screen — the title stays pinned and the item list scrolls internally.
     display:flex here is required: a bare max-height on a block child doesn't
     let percentage heights below resolve, but flex children can shrink via
     min-height:0 regardless of the parent's height being "auto". */
  max-height: calc(100vh - 64px - var(--space-6) * 2);
  display: flex;
  flex-direction: column;
}

/* ── Section sidebar nav ── */
.section-nav {
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.section-nav__title {
  flex-shrink: 0;
  background: var(--color-primary);
  color: #fff;
  font-family: var(--font-narrow);
  font-size: var(--text-sm);
  font-weight: var(--font-bold);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wider);
  padding: var(--space-4) var(--space-5);
}

.section-nav__list {
  list-style: none;
  padding: var(--space-2) 0;
  min-height: 0;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--color-border) transparent;
}

.section-nav__list::-webkit-scrollbar {
  width: 6px;
}

.section-nav__list::-webkit-scrollbar-thumb {
  background: var(--color-border);
  border-radius: var(--radius-pill);
}

.section-nav__list li a {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-5);
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  text-decoration: none;
  border-left: 3px solid transparent;
  transition: all 150ms ease;
}

.section-nav__list li a:hover {
  background: var(--color-primary-subtle);
  color: var(--color-primary);
  text-decoration: none;
  border-left-color: var(--color-primary-subtle);
}

.section-nav__list li a.active {
  background: var(--color-primary-subtle);
  color: var(--color-primary);
  font-weight: var(--font-bold);
  border-left-color: var(--color-primary);
}

.section-nav__list li a .lucide {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
  opacity: 0.6;
}

/* ── Main content area ── */
.inner-content {
  min-width: 0;
}

.inner-content h2 {
  font-family: var(--font-narrow);
  font-size: var(--text-xl);
  font-weight: var(--font-bold);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
  color: var(--color-text-primary);
  margin-top: var(--space-10);
  margin-bottom: var(--space-5);
  padding-bottom: var(--space-3);
  border-bottom: 2px solid var(--color-border);
}

.inner-content h2:first-child {
  margin-top: 0;
}

.inner-content h3 {
  font-size: var(--text-lg);
  font-weight: var(--font-bold);
  margin-top: var(--space-6);
  margin-bottom: var(--space-3);
}

.inner-content p {
  color: var(--color-text-secondary);
  line-height: var(--leading-relaxed);
}

/* ══ INFO TABLE ══ */
.info-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
  margin-bottom: var(--space-8);
}

.info-table th,
.info-table td {
  padding: var(--space-3) var(--space-5);
  text-align: left;
  border-bottom: 1px solid var(--color-border);
  vertical-align: top;
}

.info-table th {
  background: var(--color-bg);
  color: var(--color-text-muted);
  font-weight: var(--font-regular);
  white-space: nowrap;
  width: 280px;
}

.info-table td {
  color: var(--color-text-primary);
  line-height: var(--leading-relaxed);
}

.info-table tr:last-child th,
.info-table tr:last-child td {
  border-bottom: none;
}

.info-table a {
  color: var(--color-primary);
}

/* ══ STAFF CARDS ══ */
.staff-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: var(--space-5);
  margin-bottom: var(--space-8);
}

.staff-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 200ms ease, transform 200ms ease;
}

.staff-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.staff-card__photo {
  aspect-ratio: 3/4;
  background: linear-gradient(135deg, var(--color-blue-50) 0%, var(--color-blue-100) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-blue-300);
  overflow: hidden;
}

.staff-card__photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.staff-card__photo .lucide {
  width: 48px;
  height: 48px;
  opacity: 0.4;
}

.staff-card__body {
  padding: var(--space-4);
}

.staff-card__name {
  font-weight: var(--font-bold);
  font-size: var(--text-sm);
  color: var(--color-text-primary);
  margin-bottom: var(--space-1);
  line-height: var(--leading-snug);
}

.staff-card__role {
  font-size: var(--text-xs);
  color: var(--color-primary);
  font-weight: var(--font-bold);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: var(--space-2);
}

.staff-card__detail {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  line-height: var(--leading-relaxed);
}

/* ══ MEDALS / ACHIEVEMENTS ══ */
.year-group {
  margin-bottom: var(--space-8);
}

.year-group__header {
  background: var(--color-primary);
  color: #fff;
  font-family: var(--font-narrow);
  font-size: var(--text-lg);
  font-weight: var(--font-bold);
  padding: var(--space-3) var(--space-5);
  border-radius: var(--radius-md) var(--radius-md) 0 0;
}

.year-group__body {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-top: none;
  border-radius: 0 0 var(--radius-md) var(--radius-md);
  padding: var(--space-4) var(--space-5);
}

.medal-list {
  list-style: none;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.medal-list li {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-pill);
  font-size: var(--text-sm);
}

.medal-list li .lucide {
  width: 14px;
  height: 14px;
  color: var(--color-warning, #c47d10);
  flex-shrink: 0;
}

/* ══ TABLE OVERFLOW ══ */
/* Tables scroll horizontally on narrow screens instead of overflowing the page */
main table {
  display: block;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  max-width: 100%;
}

/* ══ RESPONSIVE ══ */
@media (max-width: 900px) {
  .inner-layout {
    grid-template-columns: 1fr;
  }

  .inner-layout > aside {
    position: static;
    order: 2;
    max-height: none;
  }

  .section-nav__list {
    overflow-y: visible;
  }

  .inner-layout > div,
  .inner-layout > .inner-content {
    order: 1;
  }
}

@media (max-width: 640px) {
  .info-table th,
  .info-table td {
    padding: var(--space-2) var(--space-3);
  }

  .info-table th {
    white-space: normal;
    width: 40%;
  }
}
