/* Alumni of Alliance: colors taken from the ACG logo (slate ink, gray-blue, gray squares). */
:root {
  --bg: #f4f5f6;
  --surface: #ffffff;
  --ink: #32373c;
  --text: #3d4349;
  --muted: #6b7580;
  --line: #dde1e5;
  --accent: #3e5a78;
  --accent-ink: #ffffff;
  --accent-soft: #e6ecf2;
  --brand-blue: #7f8fa6;
  --danger: #a33a32;
  --focus: #2f6fb0;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(20, 30, 40, .06), 0 2px 8px rgba(20, 30, 40, .05);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #15181b;
    --surface: #1e2226;
    --ink: #eef1f3;
    --text: #d7dce0;
    --muted: #9aa4ad;
    --line: #333a40;
    --accent: #8fb0d3;
    --accent-ink: #12161a;
    --accent-soft: #263240;
    --brand-blue: #9fb0c6;
    --danger: #e0857c;
    --focus: #8fc1f0;
    --shadow: none;
    color-scheme: dark;
  }
  .brand img, .auth-logo { background: #f4f5f6; border-radius: 6px; padding: 4px 6px; }
}

* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--text); font: 17px/1.5 var(--font);
  min-height: 100vh; display: flex; flex-direction: column;
}
main { flex: 1; width: 100%; max-width: 1100px; margin: 0 auto; padding: 24px 16px 48px; outline: none; }
h1 { color: var(--ink); font-size: 1.6rem; line-height: 1.2; margin: 0 0 .5rem; }
a { color: var(--accent); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.muted { color: var(--muted); }
.small { font-size: .9rem; }
.loading { color: var(--muted); padding: 40px 0; text-align: center; }

/* ── Top bar ── */
.topbar {
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px 20px;
  padding: 10px 16px; background: var(--surface); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 10;
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.brand img { height: 40px; width: auto; display: block; }
.brand-sub {
  color: var(--brand-blue); font-weight: 600; letter-spacing: .08em; text-transform: uppercase; font-size: .8rem;
  border-left: 1px solid var(--line); padding-left: 10px;
}
.topnav { display: flex; align-items: center; gap: 4px 18px; flex-wrap: wrap; }
.topnav a, .linklike {
  color: var(--text); text-decoration: none; font: inherit; font-size: .95rem; background: none; border: 0;
  padding: 6px 0; cursor: pointer; border-bottom: 2px solid transparent;
}
.topnav a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--accent); font-weight: 600; }
.topnav a:hover, .linklike:hover { color: var(--accent); }

/* ── Forms and buttons ── */
.stack { display: flex; flex-direction: column; gap: 14px; }
label { display: block; font-weight: 600; color: var(--ink); font-size: .95rem; }
label > input, label > textarea, label > select { display: block; margin-top: 4px; }
.opt { font-weight: 400; color: var(--muted); font-size: .85rem; }
input, textarea, select {
  font: inherit; font-weight: 400; color: var(--text); background: var(--surface);
  border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; width: 100%;
}
textarea { resize: vertical; }
input:focus, textarea:focus, select:focus { border-color: var(--accent); outline: 2px solid var(--accent-soft); }
input[readonly] { background: var(--bg); color: var(--muted); }
label.check { display: flex; align-items: center; gap: 10px; font-weight: 500; }
label.check > input { margin-top: 0; }
label.check input { width: 20px; height: 20px; }
.row2, .row3 { display: grid; gap: 14px; }
.row2 { grid-template-columns: 1fr 1fr; }
.row3 { grid-template-columns: 1fr 1fr 1fr; }
.hint { margin: -8px 0 0; font-size: .88rem; color: var(--muted); }
.error { color: var(--danger); margin: 0; font-weight: 600; }
.buttons { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
button, .button {
  font: inherit; font-weight: 600; font-size: .95rem; border-radius: 8px; padding: 10px 18px; cursor: pointer;
  border: 1px solid var(--accent); background: var(--surface); color: var(--accent);
  text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px;
}
button.primary { background: var(--accent); color: var(--accent-ink); }
button.primary:hover { filter: brightness(1.08); }
.button.ghost { border-color: transparent; }
button.danger { border-color: var(--danger); color: var(--danger); margin-left: auto; }
button:disabled { opacity: .6; cursor: wait; }

/* ── Sign-in ── */
.auth {
  max-width: 420px; margin: 6vh auto 0; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 32px 28px; box-shadow: var(--shadow);
}
.auth-logo { width: 220px; height: auto; display: block; margin-bottom: 18px; }
.auth h1 { font-size: 1.4rem; }

/* ── Directory ── */
.dir-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.dir-head h1 { margin: 0; }
.count { color: var(--muted); font-weight: 400; font-size: 1rem; }
.filters { display: flex; flex-direction: column; gap: 10px; margin-bottom: 18px; }
.filters input[type="search"] { font-size: 1.05rem; padding: 12px 14px; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { min-height: 36px; padding: 6px 14px; border-radius: 999px; border-color: var(--line); color: var(--text); font-weight: 500; }
.chip[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.grid { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
  display: flex; flex-direction: column;
}
.card-open {
  display: flex; gap: 12px; align-items: flex-start; text-align: left; width: 100%; border: 0; background: none;
  color: inherit; padding: 14px 14px 8px; font-weight: 400; border-radius: var(--radius) var(--radius) 0 0;
  justify-content: flex-start; min-height: 0;
}
.card-open:hover .name { color: var(--accent); text-decoration: underline; }
.card-text { display: flex; flex-direction: column; min-width: 0; }
.name { color: var(--ink); font-weight: 700; font-size: 1.05rem; }
.role { color: var(--muted); font-size: .92rem; overflow-wrap: anywhere; }
.tags { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 4px; }
.tag { font-size: .75rem; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); }
.tag.plain { background: var(--bg); color: var(--muted); }
.avatar {
  flex: none; width: 44px; height: 44px; border-radius: 50%; background: var(--accent-soft); color: var(--accent);
  display: grid; place-items: center; font-weight: 700; font-size: .95rem;
}
.avatar.big { width: 72px; height: 72px; font-size: 1.4rem; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; padding: 0 14px 14px 70px; }
.actions a {
  font-size: .85rem; font-weight: 600; padding: 5px 10px; border: 1px solid var(--line); border-radius: 6px;
  text-decoration: none; color: var(--accent); min-height: 34px; display: inline-flex; align-items: center;
}
.actions a:hover { border-color: var(--accent); }
.empty { text-align: center; padding: 30px 0; }

/* ── Profile and editor ── */
.back { display: inline-block; margin-bottom: 14px; text-decoration: none; font-weight: 600; }
.profile, .editor { max-width: 760px; }
.profile-head { display: flex; gap: 18px; align-items: center; margin-bottom: 14px; }
.profile-head p { margin: 2px 0; }
.actions.wide { padding: 0; margin-bottom: 18px; }
.actions.wide a { font-size: .95rem; padding: 8px 14px; min-height: 44px; }
.details { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0 0 18px; }
.details dt { color: var(--muted); font-weight: 600; }
.details dd { margin: 0; overflow-wrap: anywhere; }
.about { white-space: pre-wrap; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.about:empty { display: none; }
.editor form { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; }

.footer { text-align: center; color: var(--muted); font-size: .85rem; padding: 18px 16px 28px; }
[hidden] { display: none !important; }

@media (max-width: 640px) {
  body { font-size: 16px; }
  .brand img { height: 32px; }
  .row2, .row3 { grid-template-columns: 1fr; }
  .grid { grid-template-columns: 1fr; }
  .auth { margin-top: 2vh; padding: 24px 18px; }
  .details { grid-template-columns: 1fr; gap: 2px; }
  .details dd { margin-bottom: 8px; }
  button.danger { margin-left: 0; }
}
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; transition: none !important; } }
.role:empty { display: none; }
.tags:empty { display: none; }
