/* =============================================================================
 * صُنّاع الأثر: past presidents and vice presidents, one card per academic
 * year (year → leadership team → booklet). Builds on team.css and draws its
 * cards, surfaces and controls the way the Leaders page does; loaded only by
 * pages/impact_makers.html.
 * ========================================================================== */

.athar-page {
  --athar-year-w: 11.5rem;
  --athar-booklet-w: 22rem;
  --athar-photo: clamp(7.25rem, 4.5rem + 7vw, 11.25rem);
  --athar-team-pad: clamp(1.5rem, 1rem + 1.5vw, 2.25rem);
  /* dividers inside a card, on the card tint */
  --athar-rule: rgba(8, 76, 54, 0.12);
}

/* ---- Timeline: the Leaders presidency section's surface (padding from .gov-section) ---- */
.athar-timeline {
  background: #fbfdfc;
}

.athar-terms {
  position: relative;
  display: grid;
  gap: 2rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.athar-term {
  scroll-margin-top: calc(var(--header-height, 84px) + 1rem);
}

/* The Leaders board card: flat tint, a start-edge accent, the same chamfered corners. */
.athar-card {
  position: relative;
  display: grid;
  grid-template-columns: var(--athar-year-w) minmax(0, 1fr) var(--athar-booklet-w);
  background: var(--gov-card-bg);
  border-inline-start: 4px solid var(--gov-green);
  border-radius: 4px;
  clip-path: polygon(0% 0%,
      calc(100% - 24px) 0%,
      100% 24px,
      100% 100%,
      24px 100%,
      0% calc(100% - 24px));
  overflow: hidden;
}

/* One spine through the year column: the terms read as a single succession. */
@media (min-width: 1024px) {
  .athar-terms::before {
    content: "";
    position: absolute;
    inset-block: 1.5rem;
    /* centred on the year column, past the card's 4px accent */
    inset-inline-start: calc(var(--athar-year-w) / 2 + 3px);
    width: 2px;
    background: var(--gov-border);
  }
}

/* ---- Year: the anchor of each card ---- */
.athar-card__year {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  padding: 1.5rem 1rem;
  border-inline-end: 1px solid var(--athar-rule);
  text-align: center;
}

.athar-year {
  margin: 0;
  font-size: clamp(1.6rem, 1.3rem + 0.9vw, 2.1rem);
  font-weight: 700;
  line-height: 1.05;
  color: var(--gov-green);
  font-variant-numeric: tabular-nums;
}

.athar-year > span {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
}

/* The dash is kept for screen readers and drawn as a short gold rule. */
.athar-year__sep {
  display: block;
  width: 1.5rem;
  height: 2px;
  margin: 0.45rem 0;
  overflow: hidden;
  color: transparent;
  background: var(--gov-gold);
}

/* Secondary, in the Leaders muted text colour. */
.athar-hijri {
  margin: 0;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--gov-muted);
}

/* ---- Leadership team: president and vice president ---- */
.athar-team {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(0.75rem, 0.25rem + 2vw, 2.5rem);
  align-items: stretch;
  padding: var(--athar-team-pad) clamp(0.75rem, 0.25rem + 1.5vw, 2rem);
}

.athar-leader {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 0;
  text-align: center;
}

/* Flat-top hexagon portraits, as in the club booklets. */
.athar-leader__frame {
  width: var(--athar-photo);
  aspect-ratio: 2 / 1.732;
  min-height: 0;
  overflow: hidden;
  padding: 3px;
  background: var(--gov-green);
  clip-path: polygon(25% 0, 75% 0, 100% 50%, 75% 100%, 25% 100%, 0 50%);
}

.athar-leader--president .athar-leader__frame {
  background: var(--gov-gold);
}

.athar-leader__photo {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 30%;
  background: var(--gov-card-bg);
  clip-path: polygon(25% 0, 75% 0, 100% 50%, 75% 100%, 25% 100%, 0 50%);
}

.athar-leader__name {
  margin: 0.95rem 0 0.25rem;
  font-size: clamp(1.1rem, 1rem + 0.35vw, 1.3rem);
  font-weight: 700;
  line-height: 1.3;
  color: #0c2b20;
  overflow-wrap: anywhere;
}

.athar-leader__role {
  margin: 0 0 0.8rem;
  font-size: 0.9rem;
  font-weight: 600;
  line-height: 1.45;
  color: var(--gov-green);
  overflow-wrap: anywhere;
}

/* Same foot for both leaders, however their names and roles wrap. */
.athar-leader__linkedin {
  margin-top: auto;
}

/* ---- Booklet ---- */
.athar-booklet {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: clamp(1.25rem, 1rem + 0.8vw, 1.75rem);
  border-inline-start: 1px solid var(--athar-rule);
}

/* The Leaders photo box's tone. */
.athar-booklet__cover {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 9.5rem;
  padding: 0.75rem;
  border-radius: 4px;
  background: #dfe7e3;
  overflow: hidden;
}

.athar-booklet__cover img {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 100%;
  box-shadow: 0 6px 14px -8px rgba(8, 76, 54, 0.35);
  transition: transform 0.3s ease;
}

.athar-booklet__cover:hover img {
  transform: translateY(-3px);
}

.athar-booklet__cover--pending {
  color: #7b8e85;
}

.athar-booklet__title {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.4;
  color: var(--gov-text);
}

.athar-booklet__meta {
  margin: 0.2rem 0 0;
  font-size: 0.85rem;
  line-height: 1.5;
  color: var(--gov-muted);
}

.athar-booklet__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.9rem;
}

.athar-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  min-height: 2.5rem;
  padding: 0.45rem 1rem;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--gov-green);
  font-size: 0.9rem;
  font-weight: 700;
  line-height: 1.2;
  white-space: nowrap;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.athar-btn svg {
  flex: none;
}

/* The Leaders page's LinkedIn control, at button size. */
.athar-btn--primary {
  background: rgba(8, 76, 54, 0.05);
  border-color: rgba(8, 76, 54, 0.16);
  box-shadow: 0 1px 3px rgba(8, 76, 54, 0.04);
}

.athar-btn--primary:hover,
.athar-btn--primary:focus-visible {
  background: var(--gov-green);
  border-color: var(--gov-green);
  color: #ffffff;
  transform: translateY(-1px);
}

.athar-btn--ghost {
  background: transparent;
  border-color: rgba(8, 76, 54, 0.16);
  font-weight: 600;
}

.athar-btn--ghost:hover,
.athar-btn--ghost:focus-visible {
  background: var(--gov-green);
  border-color: var(--gov-green);
  color: #ffffff;
}

.athar-btn--sm {
  min-height: 2.25rem;
  padding: 0.35rem 0.85rem;
  font-size: 0.85rem;
}

/* ---- Viewer ---- */
html.athar-viewer-open {
  overflow: hidden;
}

.athar-viewer {
  margin: auto;
  width: min(1200px, 94vw);
  height: min(900px, 92vh);
  max-width: none;
  max-height: none;
  padding: 0;
  border: 0;
  border-radius: 8px;
  overflow: hidden;
  background: #ffffff;
  box-shadow: 0 30px 80px -20px rgba(4, 27, 17, 0.55);
}

.athar-viewer:not([open]) {
  display: none;
}

.athar-viewer[open] {
  display: flex;
  flex-direction: column;
}

.athar-viewer::backdrop {
  background: rgba(4, 27, 17, 0.7);
}

.athar-viewer__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--gov-border);
  background: #fbfdfc;
}

.athar-viewer__title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--gov-text);
}

.athar-viewer__actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.athar-viewer__close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--gov-text);
  cursor: pointer;
}

.athar-viewer__close:hover {
  background: var(--gov-card-bg);
}

.athar-viewer__frame {
  flex: 1;
  min-height: 0;
  background: #525659;
}

.athar-viewer__frame iframe {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
}

/* ---- Tablet: the year becomes the card's header band ---- */
@media (max-width: 1023px) {
  .athar-card {
    grid-template-columns: minmax(0, 1fr) var(--athar-booklet-w);
  }

  .athar-card__year {
    grid-column: 1 / -1;
    flex-direction: row;
    justify-content: space-between;
    padding: 0.85rem clamp(1rem, 0.5rem + 2vw, 1.5rem);
    border-inline-end: 0;
    border-bottom: 1px solid var(--athar-rule);
  }

  .athar-year > span {
    flex-direction: row;
  }

  .athar-year__sep {
    width: auto;
    height: auto;
    margin: 0 0.15em;
    color: inherit;
    background: none;
  }
}

/* ---- Phones: team side by side; the booklet's cover and title in a row,
 * its actions one even row across the card ---- */
@media (max-width: 699px) {
  .athar-terms {
    gap: 1.5rem;
  }

  .athar-card {
    grid-template-columns: minmax(0, 1fr);
  }

  .athar-booklet {
    display: grid;
    grid-template-columns: 4.5rem minmax(0, 1fr);
    align-items: center;
    column-gap: 0.9rem;
    row-gap: 0.2rem;
    border-inline-start: 0;
    border-top: 1px solid var(--athar-rule);
  }

  .athar-booklet__body {
    display: contents;
  }

  .athar-booklet__cover {
    grid-row: span 2;
    height: 6rem;
    padding: 0.4rem;
  }

  .athar-booklet__title {
    align-self: end;
  }

  .athar-booklet__meta {
    align-self: start;
    margin: 0;
  }

  .athar-booklet__actions {
    grid-column: 1 / -1;
    margin-top: 0.75rem;
  }

  .athar-leader__role {
    font-size: 0.8125rem;
  }

  /* Split the row evenly; each takes the full width once two no longer fit side by side. */
  .athar-btn {
    flex: 1 1 8.5rem;
    padding-inline: 0.8rem;
  }
}
