/* ============================================================
   Meeskond (#page-team): a portrait card per person, one section
   per department, in Minu konto's material. Colours come from the
   theme tokens (--adm-*), so light and dark both work.
   ============================================================ */
/* Wide enough for four 300px cards in a row */
#page-team .dashboard-container { max-width: 1320px; }
#page-team .topbar .back-link { left: 0; }
#page-team .user-icon-btn { right: 0; }
#page-team h2, #page-team h3 { text-transform: none; letter-spacing: -0.01em; }

.team { margin-top: 16px; padding-bottom: 48px; }

/* --- Sections --- */
/* A heading over a full-width rule marks where each department starts */
.team-section + .team-section { margin-top: 44px; }
.team-h {
  display: flex; align-items: baseline; justify-content: center; gap: 8px;
  margin: 0 0 20px; padding-bottom: 12px; border-bottom: 1px solid var(--stroke);
  color: var(--text); font-size: 18px; font-weight: 700; letter-spacing: -0.015em; line-height: 1.25;
}

.team-grid {
  list-style: none; margin: 0; padding: 0;
  display: flex; flex-wrap: wrap; justify-content: center; gap: 16px;
}

/* --- Card --- */
.team-card {
  flex: 0 0 300px; min-width: 0;
  display: flex; flex-direction: column; align-items: center;
  padding: 22px 14px 14px; border-radius: 18px;
  background: var(--adm-card); border: 1px solid var(--adm-card-line);
  box-shadow: 0 8px 24px var(--adm-shadow);
}
.team-skeleton { flex: 0 0 300px; height: 330px; border-radius: 18px; }
/* Loading: a heading bar and its line hold the place of the first section */
.team-skeleton-h { display: flex; justify-content: center; margin: 0 0 20px; padding-bottom: 12px; border-bottom: 1px solid var(--stroke); }
.team-skeleton-h::before { content: ""; width: 96px; height: 22px; border-radius: 6px; background: var(--adm-fill); }

.team-avatar {
  width: 96px; height: 96px; border-radius: 50%; overflow: hidden;
  display: inline-flex; align-items: center; justify-content: center;
  background: color-mix(in srgb, var(--accent) 20%, transparent); color: var(--accent);
  font-size: 32px; font-weight: 700; letter-spacing: -0.01em;
  box-shadow: 0 6px 18px var(--adm-shadow);
}
.team-avatar img { width: 100%; height: 100%; object-fit: cover; }

.team-name {
  display: flex; align-items: center; justify-content: center; gap: 6px; max-width: 100%;
  margin: 14px 0 0; color: var(--text);
  font-size: 17px; font-weight: 600; letter-spacing: -0.015em; line-height: 1.25; text-align: center;
}
.team-me { flex: none; font-size: 11px; padding: 1px 7px; letter-spacing: 0; }
.team-job { margin: 3px 0 0; color: var(--accent); font-size: 13.5px; font-weight: 500; text-align: center; }

/* --- Info: a small grouped list inside the card --- */
.team-info {
  list-style: none; align-self: stretch;
  margin: 16px 0 0; padding: 0; border-radius: 12px; overflow: hidden;
  background: var(--adm-fill);
}
.team-info-row { display: flex; align-items: center; gap: 2px; min-height: 40px; padding: 0 4px 0 0; }
.team-info-row + .team-info-row { border-top: 1px solid var(--adm-sep); }
.team-info-row > .material-icons-outlined,
.team-link .material-icons-outlined { flex: none; font-size: 17px; color: var(--muted); }

.team-bday { gap: 8px; padding: 0 12px; color: var(--text); font-size: 13.5px; }
.team-bday-date { flex: 1; }
.team-bday-soon { color: var(--muted); font-size: 12.5px; }
.team-bday.is-today { color: var(--accent); font-weight: 600; }
.team-bday.is-today > .material-icons-outlined, .team-bday.is-today .team-bday-soon { color: var(--accent); }

.team-link {
  flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px;
  align-self: stretch; padding: 0 8px 0 12px;
  color: var(--text); font-size: 13.5px; text-decoration: none; font-variant-numeric: tabular-nums;
  transition: color 150ms ease;
}
.team-link-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.team-link:hover { color: var(--accent); text-decoration: none; }
.team-link:hover .material-icons-outlined { color: var(--accent); }
.team-link:focus-visible, .team-copy:focus-visible, .team-retry:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; border-radius: 8px; }

.team-copy {
  flex: none; width: 32px; height: 32px; padding: 0; border: 0; border-radius: 8px;
  display: inline-flex; align-items: center; justify-content: center;
  background: transparent; color: var(--muted); cursor: pointer;
  opacity: 0.8; transition: opacity 150ms ease, background-color 150ms ease, color 150ms ease, transform 100ms ease-out;
}
.team-copy .material-icons-outlined { font-size: 15px; }
.team-card:hover .team-copy, .team-copy:focus-visible { opacity: 1; }
.team-copy:hover { background: var(--adm-fill-hover); color: var(--accent); }
/* After copying, the icon is a tick for a moment */
.team-copy.is-done { opacity: 1; color: var(--accent); }
/* Pressed state lands on pointer-down, instantly */
.team-copy:active { transform: scale(0.92); transition-duration: 0ms; }
.team-link:active { opacity: 0.7; transition-duration: 0ms; }

/* --- Empty and error --- */
.team-empty { max-width: 520px; margin: 24px auto 0; flex-wrap: wrap; }
.team-retry {
  height: 32px; padding: 0 14px; border: 0; border-radius: 999px;
  background: var(--adm-fill); color: var(--text); font: 600 13px var(--font-sans); cursor: pointer;
  transition: background-color 150ms ease, transform 100ms ease-out;
}
.team-retry:hover { background: var(--adm-fill-hover); }
.team-retry:active { transform: scale(0.96); transition-duration: 0ms; }

/* --- Phones: one card per row, the header fits on one line --- */
@media (max-width: 640px) {
  #page-team .dashboard-container { width: 100%; padding: 16px 16px 24px; }
  #page-team .topbar { padding-inline: 52px; min-height: 44px; }
  #page-team .topbar .brand { gap: 10px; }
  #page-team .logo-wrap { width: 34px; height: 34px; }
  #page-team .brand-name { font-size: 20px; white-space: nowrap; }
  #page-team .topbar .back-link { padding: 10px; }
  #page-team .topbar .back-link span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .team-section + .team-section { margin-top: 32px; }
  .team-h { font-size: 17px; margin-bottom: 16px; }
  .team-grid { gap: 12px; }
  .team-card, .team-skeleton { flex: 1 1 100%; max-width: 400px; }
  .team-card { padding: 18px 12px 12px; }
  .team-avatar { width: 80px; height: 80px; font-size: 27px; }
  .team-name { margin-top: 12px; }
  .team-info-row { min-height: 44px; }
}

/* --- Accessibility settings --- */
/* Touch: full-size tap targets (44px, the rows are as tall) */
@media (hover: none) {
  .team-copy { opacity: 1; width: 44px; height: 44px; }
  .team-info-row { min-height: 44px; padding-right: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .team-link, .team-copy, .team-retry { transition: none; }
  .team-copy:active, .team-retry:active { transform: none; }
  #page-team .acc-skeleton { animation: none; }
}
@media (prefers-contrast: more) {
  .team-card { border-color: color-mix(in srgb, var(--text) 40%, transparent); }
  .team-h { border-bottom-color: color-mix(in srgb, var(--text) 40%, transparent); }
  .team-info { border: 1px solid color-mix(in srgb, var(--text) 30%, transparent); }
  .team-bday-soon, .team-info-row > .material-icons-outlined, .team-link .material-icons-outlined { color: var(--text); }
  .team-copy { opacity: 1; }
}
