:root {
  /* Palette pulled from the OpenSSF horizontal logo SVG. */
  --navy: #0c3455;
  --navy-soft: #1c4e7a;
  --blue: #6897b8;
  --pale: #a2c9d2;
  --gold: #f9c37a;
  --gold-soft: #fde6ad;

  --bg: #f6f8fb;
  --surface: #ffffff;
  --border: #e2e8f0;
  --fg: #0c3455;
  --muted: #5b7388;
  --accent: var(--navy);
  --accent-soft: #eaf1f7;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { min-height: 100%; }
body {
  font: 16px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--fg);
  -webkit-font-smoothing: antialiased;
  /* Sticky-footer pattern: body is a vertical flex column with min-height
     equal to the viewport, and <main> below absorbs the spare space, so
     the footer always sits at the bottom even when content is short. */
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}
footer { flex-shrink: 0; }
a { color: var(--navy-soft); text-decoration: none; }
a:hover { text-decoration: underline; }

main {
  flex: 1 0 auto;
  width: 100%;
  max-width: 960px;
  margin: 0 auto;
  padding: 1.25rem 1.25rem 1.5rem;
  display: flex;
  flex-direction: column;
}

/* Brand header inside the card frame. */
.card-brand {
  text-align: center;
  margin-bottom: 1.1rem;
  padding-bottom: 0.95rem;
  border-bottom: 1px solid var(--border);
}
.card-brand-logo {
  max-width: 220px;
  width: 100%;
  height: auto;
  display: block;
  margin: 0 auto 0.55rem;
}
.card-brand-title {
  margin: 0;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.18em;
}

/* ── Index page: search-as-hero ─────────────────────────────────────────── */

.hero {
  text-align: center;
  padding: 3rem 1rem 1.5rem;
}
.hero-logo {
  max-width: 360px;
  width: 100%;
  height: auto;
  margin-bottom: 1.75rem;
}
.hero h1 {
  font-size: 2.6rem;
  letter-spacing: -0.02em;
  margin: 0 0 0.6rem;
  color: var(--navy);
  font-weight: 700;
}
.hero .lede {
  color: var(--muted);
  margin: 0 0 2rem;
  font-size: 1.1rem;
}

.search-wrapper {
  position: relative;
  max-width: 540px;
  margin: 0 auto;
}
.search {
  width: 100%;
  padding: 0.95rem 1.25rem 0.95rem 3rem;
  background: var(--surface);
  color: var(--fg);
  border: 1px solid var(--border);
  border-radius: 14px;
  font-size: 1.05rem;
  box-shadow: 0 4px 14px rgba(12, 52, 85, 0.06);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.search::placeholder { color: var(--muted); }
.search:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 4px 18px rgba(104, 151, 184, 0.25);
}
.search-icon {
  position: absolute;
  left: 1.05rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  pointer-events: none;
}

.suggestions {
  position: absolute;
  top: calc(100% + 8px);
  left: 0; right: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 10px 28px rgba(12, 52, 85, 0.12);
  list-style: none;
  margin: 0; padding: 0.4rem 0;
  max-height: 360px;
  overflow-y: auto;
  z-index: 5;
  text-align: left;
}
.suggestions[hidden] { display: none; }
.suggestion {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.55rem 1rem;
  color: var(--fg);
  cursor: pointer;
}
.suggestion:hover, .suggestion[aria-selected="true"] {
  background: var(--accent-soft);
  text-decoration: none;
}
.suggestion-avatar {
  width: 28px; height: 28px;
  border-radius: 50%;
  flex-shrink: 0;
  background: var(--accent-soft);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: var(--navy);
  font-size: 0.8rem;
  border: 1px solid var(--border);
  object-fit: cover;
}
.suggestion-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
}
.suggestion-name { font-weight: 600; line-height: 1.2; }
.suggestion-login { color: var(--muted); font-size: 0.85rem; line-height: 1.2; }
.suggestion-meta { color: var(--muted); font-size: 0.8rem; margin-left: auto; flex-shrink: 0; }

.empty-suggestions {
  padding: 0.85rem 1.25rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.hero-stats {
  margin-top: 2.5rem;
  color: var(--muted);
  font-size: 0.95rem;
}
.hero-stats strong { color: var(--navy); font-weight: 600; }

/* ── Contributor page ───────────────────────────────────────────────────── */

.card {
  /* Two-layer background: solid surface inside the padding box, gradient
     in the border box, so the 5px transparent border reveals the
     OpenSSF-palette gradient as the card frame. */
  background:
    linear-gradient(var(--surface), var(--surface)) padding-box,
    linear-gradient(135deg, var(--navy) 0%, var(--blue) 50%, var(--gold) 100%) border-box;
  border: 5px solid transparent;
  border-radius: 20px;
  padding: 1.5rem 1.75rem 1.25rem;
  max-width: 640px;
  width: 100%;
  margin: auto;          /* centers in both axes inside flex column main */
  box-shadow:
    0 0 0 4px rgba(104, 151, 184, 0.14),
    0 12px 30px rgba(12, 52, 85, 0.16);
  position: relative;
  overflow: hidden;
}
.card::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 8px;
  background: linear-gradient(90deg, var(--navy), var(--blue), var(--gold));
}
.card-header { display: flex; gap: 1.25rem; align-items: center; margin-bottom: 1.1rem; }
.avatar-link { line-height: 0; }
.avatar {
  width: 96px; height: 96px;
  border-radius: 50%;
  border: 3px solid var(--surface);
  box-shadow: 0 0 0 2px var(--blue);
  transition: box-shadow 0.15s;
}
.avatar-link:hover .avatar { box-shadow: 0 0 0 3px var(--navy); }
.identity { min-width: 0; flex: 1; }
.identity h1 {
  margin: 0 0 0.25rem;
  font-size: 1.9rem;
  letter-spacing: -0.015em;
  color: var(--navy);
  line-height: 1.15;
}
.identity h1 a { color: var(--navy); }
.login { margin: 0 0 0.7rem; color: var(--muted); font-size: 1.05rem; }
.bio { margin: 0.5rem 0 0; color: var(--muted); font-size: 1rem; }

.contrib-badges {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.contrib-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.4rem 0.85rem;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--navy);
  font-size: 1.05rem;
  font-weight: 600;
}
.contrib-badge svg { flex-shrink: 0; width: 18px; height: 18px; }
.contrib-badge-count { line-height: 1; }

/* Hero contribution line — the visual centerpiece. Big numbers flow as
   prose with the surrounding words muted, so the eye lands on the
   counts. Left-aligned so it lines up with the avatar/name section above
   and the section titles below. */
.subtitle {
  color: var(--muted);
  font-size: 1.35rem;
  font-weight: 400;
  line-height: 1.3;
  margin: 0 0 1.2rem;
  padding: 0 0 1.1rem;
  border-bottom: 1px solid var(--border);
  letter-spacing: -0.005em;
}
.subtitle strong {
  color: var(--navy);
  font-weight: 700;
  font-size: 1.85rem;
  letter-spacing: -0.015em;
  font-variant-numeric: tabular-nums;
  margin-right: 0.1em;
}

@media (min-width: 720px) {
  .subtitle { font-size: 1.55rem; }
  .subtitle strong { font-size: 2.15rem; }
}

.card-section { margin-bottom: 0.85rem; }
.card-section .section-title { margin: 0 0 0.4rem; }

/* First contribution card */
.first-contrib {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 0.85rem;
  background: var(--accent-soft);
  border: 1px solid transparent;
  border-radius: 10px;
  color: var(--navy);
  transition: border-color 0.15s, background 0.15s;
}
.first-contrib:hover {
  border-color: var(--blue);
  background: var(--surface);
  text-decoration: none;
}
.first-contrib-icon {
  color: var(--navy);
  flex-shrink: 0;
}
.first-contrib-body { min-width: 0; }
.first-contrib-repo { font-weight: 700; color: var(--navy); font-size: 1.05rem; }
.first-contrib-date { color: var(--muted); font-size: 0.9rem; margin-top: 0.2rem; }

/* Pill row used for years / projects / repositories */
.badge-list {
  list-style: none; padding: 0; margin: 0;
  display: flex; flex-wrap: wrap; gap: 0.4rem;
}
/* Single-line collapse mode: pills wrap naturally so JS can read which
   ones land on line 2+ via getBoundingClientRect().top, then it hides
   them and adds a "+N more" chip. max-height clips the visual overflow
   so the user only sees one row until they click +N. Once expanded,
   data-expanded=1 lifts the cap. The 2.6em fits one row of pills (pill
   font 0.95rem * 1.55 line-height + 0.4rem * 2 padding + 2px border). */
.badge-list[data-collapsible="true"] {
  max-height: 2.6em;
  overflow: hidden;
}
.badge-list[data-collapsible="true"] > .pill {
  flex-shrink: 0;
}
.badge-list[data-collapsible="true"][data-expanded="1"] {
  max-height: none;
  overflow: visible;
}
.pill-more {
  cursor: pointer;
  background: var(--navy);
  color: var(--surface);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  user-select: none;
  flex-shrink: 0;
}
.pill-more:hover { background: var(--navy-soft); }
.pill-more:focus { outline: 2px solid var(--blue); outline-offset: 2px; }
.pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0.85rem;
  border-radius: 999px;
  background: var(--accent-soft);
  border: 1px solid transparent;
  color: var(--navy);
  font-size: 0.95rem;
  transition: border-color 0.15s, background 0.15s;
}
/* The .pill rule above has the same specificity as the UA's
   `[hidden] { display: none }` and wins by being later — without this
   override, JS-hidden pills still occupy layout space, which pushed the
   "+N more" chip past the container edge and made it invisible. */
.pill[hidden] { display: none; }
.pill a { color: inherit; }
.pill:hover { border-color: var(--blue); background: var(--surface); }
.pill-year {
  background: var(--gold-soft);
  color: var(--navy);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.pill-count {
  font-size: 0.72rem;
  color: var(--muted);
  background: var(--surface);
  padding: 0 0.4rem;
  border-radius: 999px;
  border: 1px solid var(--border);
}

/* Stat tiles are no longer used on the contributor page (replaced by inline
   badges + section-based layout matching CNCF). Kept here for any future
   uses. */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
  margin: 0 0 1rem;
}
.stat-grid-4 { grid-template-columns: repeat(4, 1fr); }
.stat {
  background: var(--accent-soft);
  border-radius: 12px;
  padding: 1rem 0.75rem;
  text-align: center;
}
.stat-total {
  background: var(--navy);
  color: var(--surface);
}
.stat-total .stat-value { color: var(--surface); }
.stat-total .stat-label { color: var(--pale); }
.stat-value { font-size: 1.7rem; font-weight: 700; color: var(--navy); letter-spacing: -0.01em; }
.stat-of { font-size: 0.85rem; color: var(--muted); font-weight: 400; margin-left: 0.1em; }
.stat-label {
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-top: 0.15rem;
}
.rank-line {
  margin: 0 0 1.5rem;
  color: var(--muted);
  font-size: 0.9rem;
  text-align: center;
}
.rank-line strong { color: var(--navy); font-weight: 700; }

.section-title {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin: 0 0 0.75rem;
  font-weight: 600;
}

.project-list {
  list-style: none; padding: 0; margin: 0 0 1.75rem;
  display: flex; flex-wrap: wrap; gap: 0.45rem;
}
.project {
  display: inline-flex;
  align-items: center;
  padding: 0.4rem 0.85rem;
  background: var(--accent-soft);
  border: 1px solid transparent;
  border-radius: 999px;
  font-size: 0.88rem;
  color: var(--navy);
  transition: border-color 0.15s, background 0.15s;
}
.project a { color: inherit; }
.project:hover { border-color: var(--blue); background: var(--surface); }

.meta {
  color: var(--muted);
  font-size: 0.85rem;
  margin: 0 0 1.5rem;
}

/* ── Share strip ────────────────────────────────────────────────────────── */

.share {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
  align-items: center;
  justify-content: center;
  padding-top: 1rem;
  margin-top: 1rem;
  border-top: 1px solid var(--border);
}
.share-trigger-wrap { position: relative; }
.share-trigger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  min-width: 170px;
  padding: 0.75rem 1.5rem;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--navy);
  border: 1px solid transparent;
  font-size: 1.05rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.share-trigger:hover, .share-trigger[aria-expanded="true"] {
  background: var(--navy);
  color: var(--surface);
  border-color: var(--navy);
}
.share-trigger svg { display: block; }

/* Inline replacement for the trigger button — no floating overlay, no
   blocked content. The popup is a single horizontal pill of icons that
   appears in the trigger's place when activated. */
.share-popup {
  display: none;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 0.7rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  box-shadow: 0 4px 14px rgba(12, 52, 85, 0.1);
}
.share-trigger-wrap.open .share-trigger { display: none; }
.share-trigger-wrap.open .share-popup { display: inline-flex; }

.share-popup .share-btn {
  width: 34px; height: 34px;
}
.share-popup .share-btn svg { width: 14px; height: 14px; }

.share-btn-close {
  background: transparent !important;
  color: var(--muted) !important;
  border: none !important;
}
.share-btn-close:hover {
  background: var(--accent-soft) !important;
  color: var(--navy) !important;
}

/* Copy-link visual feedback: swap the copy icon for a check briefly
   instead of a tooltip element. */
.share-icon-copied { display: none; }
[data-share="copy"].copied .share-icon-copy { display: none; }
[data-share="copy"].copied .share-icon-copied { display: inline-block; }
[data-share="copy"].copied {
  background: var(--gold-soft) !important;
  color: var(--navy) !important;
}

/* Embed dialog — modal that surfaces ready-to-paste snippets users can
   drop into their README or personal site. */
.embed-dialog[hidden] { display: none; }
.embed-dialog {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
}
.embed-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(12, 52, 85, 0.55);
  backdrop-filter: blur(2px);
}
.embed-dialog-panel {
  position: relative;
  background: var(--surface);
  border-radius: 16px;
  border: 2px solid var(--navy);
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 1.5rem 1.5rem 1.25rem;
  box-shadow: 0 18px 48px rgba(12, 52, 85, 0.3);
}
.embed-dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.4rem;
}
.embed-dialog-head h3 {
  margin: 0;
  font-size: 1.15rem;
  color: var(--navy);
}
.embed-dialog-close {
  width: 32px; height: 32px;
  border-radius: 50%;
  border: none;
  background: var(--accent-soft);
  color: var(--navy);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.embed-dialog-close:hover { background: var(--navy); color: var(--surface); }
.embed-dialog-lede {
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.5;
  margin: 0 0 1rem;
}
.embed-preview {
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 1.1rem;
  background: var(--accent-soft);
  border: 1px solid var(--border);
}
.embed-preview img {
  display: block;
  width: 100%;
  height: auto;
}
.embed-snippet-group { margin-bottom: 0.85rem; }
.embed-snippet-label {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.4rem;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 700;
  color: var(--navy);
}
.embed-snippet-hint {
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
  color: var(--muted);
}
.embed-snippet {
  display: flex;
  align-items: stretch;
  background: var(--accent-soft);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}
.embed-snippet code {
  flex: 1;
  padding: 0.7rem 0.85rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.82rem;
  color: var(--navy);
  white-space: nowrap;
  overflow-x: auto;
  background: transparent;
  line-height: 1.4;
}
.embed-copy {
  border: none;
  border-left: 1px solid var(--border);
  background: var(--surface);
  color: var(--navy);
  padding: 0 1rem;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s, color 0.15s;
}
.embed-copy:hover { background: var(--navy); color: var(--surface); }
.embed-copy.copied {
  background: var(--gold-soft);
  color: var(--navy);
}

.get-yours {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  min-width: 170px;
  padding: 0.75rem 1.5rem;
  border-radius: 999px;
  background: var(--navy);
  color: var(--surface);
  font-size: 1.05rem;
  font-weight: 600;
}
.get-yours:hover { background: var(--navy-soft); color: var(--surface); text-decoration: none; }
.get-yours svg { width: 16px; height: 16px; }
.thanks {
  margin: 0.85rem 0 0;
  text-align: center;
  color: var(--muted);
  font-size: 0.85rem;
  font-style: italic;
}
.share-label {
  font-size: 0.8rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-right: 0.4rem;
}
.share-btn {
  width: 38px; height: 38px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-soft);
  color: var(--navy);
  border: 1px solid transparent;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.share-btn:hover {
  background: var(--navy);
  color: var(--surface);
  border-color: var(--navy);
  text-decoration: none;
}
.share-btn svg { width: 16px; height: 16px; fill: currentColor; }
.share-tooltip {
  font-size: 0.8rem;
  color: var(--muted);
  margin-left: 0.25rem;
  opacity: 0;
  transition: opacity 0.15s;
}
.share-tooltip.visible { opacity: 1; color: var(--navy); }

/* ── Footer ─────────────────────────────────────────────────────────────── */

footer {
  border-top: 1px solid var(--border);
  background: var(--surface);
  padding: 1rem 1.25rem;
  margin-top: 1.5rem;
  text-align: center;
  color: var(--muted);
  font-size: 0.8rem;
}
footer a { color: var(--muted); text-decoration: underline; }

@media (max-width: 600px) {
  .site-header { padding: 0.75rem 1rem; }
  .brand img { height: 30px; }
  main { padding: 2rem 1rem 3rem; }
  .hero h1 { font-size: 2rem; }
  .hero-logo { max-width: 260px; }
  .card { padding: 1.5rem; }
  .card-header { flex-direction: column; text-align: center; gap: 0.85rem; }
  .stat-grid, .stat-grid-4 { grid-template-columns: 1fr 1fr; gap: 0.4rem; }
  .stat { padding: 0.75rem 0.5rem; }
  .stat-value { font-size: 1.3rem; }
}
