/* ===== Design tokens (light = default) ===== */
:root {
  --bg: #e9eef5;
  --panel: #fff;
  --text: #0e1116;
  --muted: #526072;
  --link: #0b63ce;
  --link-visited: #6a4dd8;
  --accent: #1559b3;
  --border: #dde4ee;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
  --radius: 16px;
  --maxw: 1000px;
  --thumb-ar: 16/9;
  --thumb-h-m: 190px;
  --logo-h-m: 110px;
  --chip-bg: #fff;
}

/* System preference: dark when no user override */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --bg: #1a1d23;
    --panel: #252830;
    --text: #e6e9ef;
    --muted: #9ca3b4;
    --link: #6eb3f7;
    --link-visited: #b39ef7;
    --accent: #7eb8f7;
    --border: #3d424d;
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
    --chip-bg: #252830;
  }
}

/* User override: light */
html[data-theme="light"] {
  --bg: #e9eef5;
  --panel: #fff;
  --text: #0e1116;
  --muted: #526072;
  --link: #0b63ce;
  --link-visited: #6a4dd8;
  --accent: #1559b3;
  --border: #dde4ee;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
  --chip-bg: #fff;
}

/* User override: dark */
html[data-theme="dark"] {
  --bg: #1a1d23;
  --panel: #252830;
  --text: #e6e9ef;
  --muted: #9ca3b4;
  --link: #6eb3f7;
  --link-visited: #b39ef7;
  --accent: #7eb8f7;
  --border: #3d424d;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  --chip-bg: #252830;
}

/* ===== Reset / base ===== */
*,
*::before,
*::after {
  box-sizing: border-box;
}
html,
body {
  margin: 0;
  padding: 0;
}
body {
  font: 16px/1.6 system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, Noto Sans, sans-serif;
  color: var(--text);
  background:
    radial-gradient(1200px 600px at 10% -10%, rgba(21, 89, 179, 0.12), transparent 40%),
    radial-gradient(900px 600px at 110% 10%, rgba(124, 196, 255, 0.12), transparent 50%),
    var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}

html[data-theme="dark"] body {
  background:
    radial-gradient(1200px 600px at 10% -10%, rgba(80, 130, 200, 0.08), transparent 40%),
    radial-gradient(900px 600px at 110% 10%, rgba(60, 100, 160, 0.06), transparent 50%),
    var(--bg);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) body {
    background:
      radial-gradient(1200px 600px at 10% -10%, rgba(80, 130, 200, 0.08), transparent 40%),
      radial-gradient(900px 600px at 110% 10%, rgba(60, 100, 160, 0.06), transparent 50%),
      var(--bg);
  }
}
a {
  color: var(--link);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}
a:visited {
  color: var(--link-visited);
}
img {
  max-width: 100%;
  height: auto;
  border-radius: 12px;
  display: block;
}

/* ===== Layout ===== */
.container {
  max-width: var(--maxw);
  margin-inline: auto;
  padding: 24px;
}
header,
section,
footer {
  margin-block: 28px;
}
.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.pad {
  padding: 20px;
}
.grid {
  display: grid;
  gap: 16px;
}
.grid.cols-3 {
  grid-template-columns: repeat(3, 1fr);
}

/* ===== Header ===== */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.id {
  display: flex;
  align-items: center;
  gap: 16px;
  min-width: 0;
}
.avatar {
  width: 108px;
  aspect-ratio: 1;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--border);
  flex: 0 0 auto;
}
h1 {
  font-size: clamp(28px, 4vw, 40px);
  line-height: 1.1;
  margin: 0;
  letter-spacing: 0.3px;
}
.lead {
  color: var(--muted);
  margin: 6px 0 0;
}

.links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 12px;
  align-items: center;
}
.chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--chip-bg);
  cursor: pointer;
  white-space: nowrap;
  color: inherit;
}
.chip:hover {
  text-decoration: none;
}
.icon-chip {
  padding: 10px;
  min-width: 44px;
  min-height: 44px;
}
.icon-chip .icon {
  display: block;
  flex-shrink: 0;
}
.theme-toggle {
  border: 1px solid var(--border);
  background: var(--chip-bg);
  border-radius: 999px;
  width: 44px;
  height: 44px;
  padding: 0;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  line-height: 1;
  color: var(--text);
}
.theme-toggle:hover {
  opacity: 0.9;
}
.theme-toggle .icon-sun,
.theme-toggle .icon-moon {
  display: none;
}
html[data-theme="light"] .theme-toggle .icon-sun,
:root:not([data-theme]) .theme-toggle .icon-sun { display: inline-block; }
html[data-theme="dark"] .theme-toggle .icon-moon { display: inline-block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) .theme-toggle .icon-sun { display: none; }
  :root:not([data-theme]) .theme-toggle .icon-moon { display: inline-block; }
}

.hero-about {
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}
.hero-about .section-title {
  margin-top: 0;
}
.hero-about p {
  margin: 0;
}

/* ===== Sections ===== */
.section-title {
  font-size: 22px;
  margin: 0 0 10px;
}
.card {
  display: flex;
  gap: 16px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: linear-gradient(180deg, var(--panel), color-mix(in oklab, var(--panel), #000 6%));
  overflow: clip;
}
.card .thumb {
  width: 220px;
  max-width: 38%;
  object-fit: contain;
  height: auto;
  aspect-ratio: auto;
}
.card .thumb.logo {
  object-fit: contain;
  background: transparent;
  padding: 12px;
  width: 220px;
  max-height: 120px;
  border-right: 1px solid var(--border);
}
.card-body {
  padding: 16px;
}
.meta {
  color: var(--muted);
  font-size: 14px;
}
.title {
  font-weight: 600;
  font-size: 18px;
  margin: 2px 0 6px;
}
.badge {
  display: inline-block;
  font-size: 12px;
  padding: 2px 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--muted);
}

.affil {
  text-align: center;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--panel);
}
.affil img {
  max-height: 70px;
  object-fit: contain;
  background: transparent;
  margin-inline: auto;
}

footer {
  color: var(--muted);
  font-size: 14px;
  text-align: right;
}

.nowrap {
  white-space: nowrap;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

/* ===== Award highlight card ===== */
.card.card-award {
  background: linear-gradient(180deg, #e8f5e9, #c8e6c9) !important;
  border: 2px solid #66bb6a !important;
  box-shadow: 0 8px 24px rgba(56, 142, 60, 0.25) !important;
}
html[data-theme="dark"] .card.card-award {
  background: linear-gradient(180deg, #1e3320, #253d26) !important;
  border-color: #4a9c4e !important;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4) !important;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) .card.card-award {
    background: linear-gradient(180deg, #1e3320, #253d26) !important;
    border-color: #4a9c4e !important;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4) !important;
  }
}
.card.card-award .card-body {
  background-color: transparent !important;
}
.card.card-award .award-slab {
  display: inline-block;
  margin: 6px 0 10px 0;
  padding: 4px 10px;
  font-size: 0.85rem;
  font-weight: 600;
  color: #16a34a;
  background-color: #c8e6c9 !important;
  border-radius: 6px;
}
html[data-theme="dark"] .card.card-award .award-slab {
  color: #86ef86;
  background-color: rgba(74, 156, 78, 0.35) !important;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) .card.card-award .award-slab {
    color: #86ef86;
    background-color: rgba(74, 156, 78, 0.35) !important;
  }
}

/* ===== Mobile (fix header overlap) ===== */
@media (max-width: 880px) {
  .grid.cols-3 {
    grid-template-columns: 1fr;
  }
  .topbar {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }
  .id {
    align-items: flex-start;
  }
  .avatar {
    width: 88px;
  }
  .links {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
  }
  .links .icon-chip {
    width: auto;
  }
  .card {
    flex-direction: column;
  }
  .card .thumb {
    width: 100%;
    max-width: 100%;
    border-right: 0;
    border-bottom: 1px solid var(--border);
    aspect-ratio: var(--thumb-ar);
    max-height: var(--thumb-h-m);
  }
  .card .thumb.logo {
    aspect-ratio: auto;
    max-height: var(--logo-h-m);
    height: var(--logo-h-m);
    padding: 10px;
    object-fit: contain;
  }
}

@media print {
  .panel,
  .card,
  .affil {
    box-shadow: none;
  }
  a {
    color: inherit;
    text-decoration: underline;
  }
}
