:root {
  --page-bg:
    radial-gradient(circle at 12% 18%, rgba(0, 122, 255, 0.18), transparent 28%),
    radial-gradient(circle at 88% 12%, rgba(90, 200, 250, 0.14), transparent 24%),
    radial-gradient(circle at 70% 78%, rgba(52, 199, 89, 0.10), transparent 22%),
    linear-gradient(180deg, #08111f 0%, #0b1422 40%, #09111d 100%);
  --page-text: #f5f7fb;
  --page-muted: rgba(235, 240, 248, 0.68);
  --link: #7dc3ff;

  --glass-bg: rgba(18, 28, 45, 0.48);
  --glass-surface: rgba(255, 255, 255, 0.07);
  --glass-border: rgba(255, 255, 255, 0.12);

  --card-text: #f7fbff;
  --card-muted: rgba(233, 239, 247, 0.7);
  --danger: #f87171;

  --shadow-lg: 0 30px 80px rgba(0, 0, 0, 0.38);

  color-scheme: dark;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI",
    "Noto Sans", Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

/* !important: must beat display rules such as .panel-years */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  min-height: 100%;
}

body {
  min-height: 100vh;
  background: var(--page-bg);
  color: var(--page-text);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

main {
  max-width: 980px;
  margin: 0 auto;
  padding: 40px 18px 56px;
}

a {
  color: var(--link);
  text-decoration: none;
}

a:hover { text-decoration: underline; }

/* Card */

.card {
  position: relative;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.03)),
    var(--glass-bg);
  color: var(--card-text);
  border: 1px solid var(--glass-border);
  border-radius: 30px;
  padding: 28px;
  display: grid;
  gap: 22px;
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(26px) saturate(150%);
  -webkit-backdrop-filter: blur(26px) saturate(150%);
}

.card::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at top left, rgba(255, 255, 255, 0.10), transparent 30%),
    radial-gradient(circle at bottom right, rgba(96, 165, 250, 0.08), transparent 26%);
  pointer-events: none;
}

.card::after {
  content: "";
  position: absolute;
  inset: 1px;
  border-radius: 29px;
  border-top: 1px solid rgba(255, 255, 255, 0.10);
  pointer-events: none;
}

.card[aria-busy="true"] { opacity: 0.72; }

.card-header {
  display: flex;
  gap: 18px;
  align-items: center;
  position: relative;
  z-index: 1;
}

.avatar {
  width: 88px;
  height: 88px;
  border-radius: 50%;
  flex-shrink: 0;
  border: 1px solid rgba(255, 255, 255, 0.18);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.18),
    0 8px 24px rgba(0, 0, 0, 0.24);
  background: var(--glass-surface);
}

.avatar-initials {
  display: grid;
  place-items: center;
  color: var(--card-text);
  font-size: 32px;
  font-weight: 700;
  background: linear-gradient(180deg, #4f8cff 0%, #2f6bd8 100%);
}

.identity { min-width: 0; }

.identity h1 {
  margin: 0;
  font-size: 34px;
  line-height: 1.08;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.login {
  display: inline-block;
  margin-top: 4px;
  color: var(--card-muted);
  font-size: 17px;
}

.bio {
  margin: 10px 0 0;
  color: rgba(248, 251, 255, 0.92);
  line-height: 1.45;
  font-size: 16px;
  max-width: 780px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.bio:empty { display: none; }

.meta {
  list-style: none;
  margin: 10px 0 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  color: var(--card-muted);
  font-size: 14px;
}

.meta a { color: inherit; }

/* Totals */

/* Flex, not a grid, so the remaining tiles fill the row when some are hidden */
.tiles {
  --tile-gap: 12px;
  position: relative;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  gap: var(--tile-gap);
}

.tile {
  flex: 1 1 0;
  min-width: 0;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.03));
  border: 1px solid var(--glass-border);
  border-radius: 20px;
  padding: 18px 18px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.10),
    0 10px 24px rgba(0, 0, 0, 0.12);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.tile-value {
  font-size: 34px;
  line-height: 1;
  font-weight: 750;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}

.tile-label {
  color: var(--card-muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

/* Panels */

.panel {
  position: relative;
  z-index: 1;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.045), rgba(255, 255, 255, 0.02));
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 20px;
  padding: 16px 16px 14px;
}

.panel h2 {
  margin: 0 0 12px;
  font-size: 12px;
  font-weight: 700;
  color: var(--card-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.lang-bar {
  display: flex;
  height: 12px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.06);
  gap: 2px;
}

.lang-bar span {
  display: block;
  height: 100%;
}

.lang-legend {
  list-style: none;
  margin: 14px 0 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 10px 18px;
  font-size: 14px;
}

.lang-legend li {
  display: flex;
  align-items: center;
  gap: 6px;
}

.lang-legend .dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.05);
}

.lang-legend .pct { color: var(--card-muted); }

/* Years */

.years {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  height: 150px;
}

.year {
  flex: 1;
  min-width: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

/* Bar heights are a percentage of this track, which excludes the labels */
.year-track {
  flex: 1;
  min-height: 0;
  width: 100%;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding-top: 20px;
}

.year-bar {
  position: relative;
  width: 100%;
  max-width: 44px;
  min-height: 4px;
  border-radius: 10px 10px 4px 4px;
  background: linear-gradient(180deg, #68f18e 0%, #42c75b 100%);
  box-shadow: 0 8px 20px rgba(66, 199, 91, 0.22);
}

.year.current .year-bar {
  background: linear-gradient(180deg, #7dc3ff 0%, #4f8cff 100%);
  box-shadow: 0 8px 20px rgba(79, 140, 255, 0.28);
}

.year-count {
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  margin-bottom: 6px;
  white-space: nowrap;
  font-size: 12px;
  color: var(--card-muted);
  font-variant-numeric: tabular-nums;
}

.year-label {
  font-size: 12px;
  color: var(--card-muted);
  white-space: nowrap;
}

.year.current .year-label { color: rgba(255, 255, 255, 0.92); }

/* Footer */

.card-footer {
  position: relative;
  z-index: 1;
  color: var(--card-muted);
  font-size: 12px;
}

/* Actions */

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  margin-top: 22px;
}

.button {
  font: inherit;
  font-size: 14px;
  padding: 10px 16px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.10);
  background: rgba(255, 255, 255, 0.06);
  color: var(--page-text);
  text-decoration: none;
  cursor: pointer;
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.button:hover {
  text-decoration: none;
  border-color: rgba(125, 195, 255, 0.4);
  background: rgba(255, 255, 255, 0.09);
}

.button-primary {
  color: #ffffff;
  font-weight: 600;
  border-color: rgba(125, 195, 255, 0.45);
  background: linear-gradient(180deg, rgba(79, 140, 255, 0.55), rgba(47, 107, 216, 0.55));
}

.button-primary:hover {
  border-color: rgba(125, 195, 255, 0.8);
  background: linear-gradient(180deg, rgba(79, 140, 255, 0.7), rgba(47, 107, 216, 0.7));
}

.button-quiet { color: var(--page-muted); }

.credit {
  text-align: center;
  color: var(--page-muted);
  font-size: 14px;
  margin-top: 28px;
}

.credit-cta {
  display: inline-block;
  margin-left: 6px;
  font-weight: 600;
}

.error { color: var(--danger); }

/* Responsive, scoped to body:not(.og) so ?og matches card.png in any window */

@media (max-width: 760px) {
  body:not(.og) .card {
    padding: 20px;
    border-radius: 24px;
  }

  body:not(.og) .card::after { border-radius: 23px; }

  body:not(.og) .card-header { align-items: flex-start; }

  body:not(.og) .avatar {
    width: 74px;
    height: 74px;
  }

  body:not(.og) .identity h1 { font-size: 28px; }

  body:not(.og) .bio { font-size: 15px; }

  body:not(.og) .tile { flex-basis: calc(50% - var(--tile-gap) / 2); }

  body:not(.og) .tile-value { font-size: 28px; }
}

@media (max-width: 640px) {
  body:not(.og) main { padding: 20px 14px 40px; }

  body:not(.og) .card-header {
    flex-direction: column;
    gap: 14px;
  }

  body:not(.og) .lang-legend {
    gap: 8px 14px;
    font-size: 13px;
  }

  body:not(.og) .year-count { display: none; }

  body:not(.og) .year-label { font-size: 10px; }

  body:not(.og) .ytd { display: none; }

  body:not(.og) .years {
    gap: 5px;
    height: 130px;
  }

  body:not(.og) .actions { gap: 8px; }

  body:not(.og) .button {
    width: 100%;
    text-align: center;
  }
}

/* Social preview image (?og) */

body.og {
  width: 1200px;
  height: 630px;
  min-height: 0;
}

body.og main {
  max-width: none;
  height: 100%;
  padding: 24px;
}

body.og .actions,
body.og .credit { display: none; }

body.og .card {
  height: 100%;
  padding: 30px 34px;
  gap: 22px;
  grid-template-columns: 1fr 1.25fr;
  grid-template-rows: auto auto 1fr;
  grid-template-areas:
    "header header"
    "tiles tiles"
    "languages years";
}

body.og .card-header { grid-area: header; }
body.og .tiles { grid-area: tiles; }
body.og .panel-languages { grid-area: languages; }

body.og .panel-years {
  grid-area: years;
  display: flex;
  flex-direction: column;
}

body.og .years {
  flex: 1;
  height: auto;
  min-height: 0;
}

/* LinkedIn and Facebook show it about 500px wide: large type only, small details left out */
body.og .card-footer,
body.og .bio,
body.og .meta,
body.og .year-count,
body.og .ytd,
body.og .lang-legend .pct,
body.og .lang-legend li:nth-child(n + 4) { display: none; }

body.og .card-header { gap: 26px; }
body.og .avatar { width: 116px; height: 116px; }
body.og .avatar-initials { font-size: 44px; }
body.og .identity h1 { font-size: 60px; }
body.og .login { font-size: 30px; margin-top: 6px; }

body.og .tile { padding: 16px 22px; gap: 8px; }
body.og .tile-value { font-size: 58px; }
body.og .tile-label { font-size: 17px; letter-spacing: 0.04em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

body.og .panel { padding: 20px 24px; }
body.og .panel h2 { font-size: 19px; margin-bottom: 16px; }
body.og .lang-bar { height: 22px; }
body.og .lang-legend { margin-top: 20px; gap: 12px 26px; font-size: 25px; }
body.og .lang-legend .dot { width: 18px; height: 18px; }
body.og .year-track { padding-top: 0; }
body.og .year-label { font-size: 18px; }

body.og .card:has(#panel-languages[hidden]) .panel-years,
body.og .card:has(#panel-years[hidden]) .panel-languages { grid-column: 1 / -1; }

/* 18+ years leave each column too narrow for labels */
body.og .years:has(.year:nth-child(18)) :is(.ytd, .year-count) { display: none; }
