/* ============================================================
   GitGud — Swiss / International Typographic Style
   Lexend · strict grid · restrained palette · flush-left
   ============================================================ */

:root {
  --bg:        #f4f3ee;   /* warm off-white paper */
  --bg-card:   #ffffff;
  --ink:       #0a0a0a;   /* near-black */
  --ink-2:     #45464a;
  --muted:     #76787d;
  --line:      #0a0a0a;   /* hairlines are black in Swiss style */
  --line-soft: #d9d8d2;
  --accent:    #ff3b30;   /* single red accent */
  --accent-ink:#ffffff;
  --good:      #1a7f37;
  --warn:      #9a6700;
  --bad:       #cf222e;

  --grade-s:#5e2ca5; --grade-a:#1a7f37; --grade-b:#0b62d6;
  --grade-c:#9a6700; --grade-d:#bc4c00; --grade-f:#cf222e;

  --maxw: 1120px;
  --gut: 28px;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Lexend", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-weight: 400;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: inherit; }
iconify-icon { display: inline-block; vertical-align: -0.125em; }

::selection { background: var(--accent); color: #fff; }

/* the [hidden] attribute must always win over component display rules */
[hidden] { display: none !important; }

/* ---- top bar ---- */
.topbar { border-bottom: 1.5px solid var(--line); background: var(--bg); position: sticky; top: 0; z-index: 50; }
.topbar-inner { max-width: var(--maxw); margin: 0 auto; padding: 14px var(--gut); display: flex; align-items: baseline; gap: 16px; }
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; }
.brand-mark { background: var(--ink); color: #fff; font-weight: 800; font-size: 14px; letter-spacing: -.02em; width: 28px; height: 28px; display: grid; place-items: center; }
.brand-name { font-weight: 700; font-size: 18px; letter-spacing: -.02em; }
.brand-sub { color: var(--muted); font-size: 13px; font-weight: 400; letter-spacing: .02em; text-transform: uppercase; margin-left: auto; }

/* ---- layout ---- */
.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 var(--gut) 80px; }

/* ---- masthead ---- */
.masthead { padding: 70px 0 56px; border-bottom: 1.5px solid var(--line); position: relative; }
.masthead-no { font-size: 13px; font-weight: 600; letter-spacing: .14em; color: var(--accent); margin-bottom: 22px; }
.masthead-title {
  font-size: clamp(40px, 8vw, 92px);
  font-weight: 800;
  letter-spacing: -.045em;
  line-height: .96;
  margin: 0 0 26px;
  max-width: 14ch;
}
.masthead-lead { font-size: clamp(15px, 2vw, 19px); color: var(--ink-2); max-width: 54ch; margin: 0 0 38px; line-height: 1.55; }

/* ---- search ---- */
.searchbar {
  display: flex; align-items: stretch;
  border: 1.5px solid var(--line);
  background: var(--bg-card);
  max-width: 560px;
}
.searchbar .at { display: grid; place-items: center; width: 50px; font-size: 22px; font-weight: 600; color: var(--muted); border-right: 1.5px solid var(--line-soft); }
#user { flex: 1; border: none; outline: none; background: none; font-family: inherit; font-size: 19px; font-weight: 500; padding: 16px 14px; color: var(--ink); min-width: 0; }
#user::placeholder { color: #b3b2ac; }
#go {
  border: none; cursor: pointer;
  background: var(--ink); color: #fff;
  font-family: inherit; font-size: 16px; font-weight: 600;
  padding: 0 26px; display: inline-flex; align-items: center; gap: 8px;
  transition: background .15s;
}
#go:hover { background: var(--accent); }
#go:disabled { opacity: .55; cursor: default; }

.examples { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin: 22px 0 0; }
.examples-label { font-size: 12px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); margin-right: 6px; }
.chip { font-family: inherit; cursor: pointer; background: none; border: 1.5px solid var(--line-soft); color: var(--ink-2); font-size: 13px; font-weight: 500; padding: 6px 12px; transition: border-color .15s, color .15s; }
.chip:hover { border-color: var(--ink); color: var(--ink); }

/* ---- loader / error ---- */
.loader { display: flex; align-items: center; gap: 14px; color: var(--muted); margin-top: 50px; font-size: 15px; font-weight: 500; }
.spin { width: 20px; height: 20px; border: 2.5px solid var(--line-soft); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.error { margin-top: 40px; padding: 20px 22px; border: 1.5px solid var(--bad); color: var(--bad); font-weight: 500; background: #fff; }

/* ============================================================
   Result — modular grid of "blocks"
   ============================================================ */
.result { margin-top: 0; }
.result[hidden] { display: none; }

.block { border-bottom: 1.5px solid var(--line); padding: 46px 0; }
.block:last-child { border-bottom: 0; }
.block-head { display: flex; align-items: baseline; gap: 14px; margin-bottom: 28px; }
.block-no { font-size: 12px; font-weight: 700; letter-spacing: .1em; color: var(--accent); flex-shrink: 0; min-width: 26px; }
.block-title { font-size: 22px; font-weight: 700; letter-spacing: -.02em; margin: 0; }
.block-note { margin-left: auto; font-size: 13px; color: var(--muted); }

/* ---- identity block ---- */
.identity { display: grid; grid-template-columns: 120px 1fr auto; gap: 28px; align-items: start; }
.identity-avatar { width: 120px; height: 120px; object-fit: cover; border: 1.5px solid var(--line); background: #fff; }
.identity-main h2 { font-size: clamp(28px, 4vw, 44px); font-weight: 800; letter-spacing: -.03em; line-height: 1.04; margin: 0; }
.identity-main h2 a { text-decoration: none; }
.identity-handle { color: var(--muted); font-size: 16px; font-weight: 500; margin-top: 4px; }
.identity-bio { font-size: 16px; color: var(--ink-2); margin: 14px 0 0; max-width: 52ch; line-height: 1.5; }
.identity-meta { display: flex; flex-wrap: wrap; gap: 6px 20px; margin-top: 16px; font-size: 14px; color: var(--ink-2); }
.identity-meta span { display: inline-flex; align-items: center; gap: 7px; }
.identity-meta a { color: var(--accent); text-decoration: none; }
.identity-meta a:hover { text-decoration: underline; }
.identity-meta iconify-icon { color: var(--muted); font-size: 16px; }
.hire { border: 1.5px solid var(--good); color: var(--good); font-size: 12px; font-weight: 600; padding: 1px 8px; }

/* grade + score panel */
.scorebox { text-align: right; border-left: 1.5px solid var(--line); padding-left: 28px; }
.scorebox .grade { font-size: 76px; font-weight: 900; letter-spacing: -.05em; line-height: .9; }
.scorebox .grade.g-S{color:var(--grade-s)} .scorebox .grade.g-A{color:var(--grade-a)} .scorebox .grade.g-B{color:var(--grade-b)} .scorebox .grade.g-C{color:var(--grade-c)} .scorebox .grade.g-D{color:var(--grade-d)} .scorebox .grade.g-F{color:var(--grade-f)}
.scorebox .num { font-size: 22px; font-weight: 700; margin-top: 4px; }
.scorebox .num small { color: var(--muted); font-weight: 500; }
.scorebox .pct { font-size: 13px; color: var(--accent); font-weight: 600; margin-top: 4px; letter-spacing: .02em; }
.verdict { font-size: clamp(18px, 2.4vw, 26px); font-weight: 600; letter-spacing: -.02em; line-height: 1.3; margin: 30px 0 0; max-width: 28ch; }
.archetype-line { margin-top: 18px; display: inline-flex; align-items: center; gap: 10px; border: 1.5px solid var(--line); padding: 8px 14px; font-weight: 600; }
.archetype-line iconify-icon { color: var(--accent); font-size: 20px; }
.archetype-line .ad { font-weight: 400; color: var(--muted); border-left: 1px solid var(--line-soft); padding-left: 10px; margin-left: 4px; }

/* ---- generic grids ---- */
.cols-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; }
.cols-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 28px; }

/* ---- stat table (Swiss numeric grid) ---- */
.statgrid { display: grid; grid-template-columns: repeat(4, 1fr); border-top: 1.5px solid var(--line); border-left: 1.5px solid var(--line); }
.statgrid .cell { border-right: 1.5px solid var(--line); border-bottom: 1.5px solid var(--line); padding: 18px 18px 16px; }
.statgrid .cell b { display: block; font-size: 32px; font-weight: 800; letter-spacing: -.03em; line-height: 1; }
.statgrid .cell span { display: block; margin-top: 8px; font-size: 12px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }

/* ---- score breakdown bars ---- */
.bars { display: flex; flex-direction: column; gap: 16px; }
.bar-row { display: grid; grid-template-columns: 110px 1fr 42px; align-items: center; gap: 16px; }
.bar-label { font-size: 14px; font-weight: 500; color: var(--ink-2); }
.bar-track { height: 10px; background: #e7e6e0; position: relative; }
.bar-fill { height: 100%; background: var(--ink); transition: width .8s cubic-bezier(.2,.8,.2,1); }
.bar-fill.hi { background: var(--good); }
.bar-fill.mid { background: var(--ink); }
.bar-fill.lo { background: var(--accent); }
.bar-val { font-size: 15px; font-weight: 700; text-align: right; font-variant-numeric: tabular-nums; }

/* ---- radar chart ---- */
.radar-wrap { display: flex; align-items: center; justify-content: center; }
.radar-wrap svg { width: 100%; max-width: 380px; height: auto; }
.radar-grid { fill: none; stroke: var(--line-soft); stroke-width: 1; }
.radar-axis { stroke: var(--line-soft); stroke-width: 1; }
.radar-shape { fill: rgba(255,59,48,.14); stroke: var(--accent); stroke-width: 2; }
.radar-dot { fill: var(--accent); }
.radar-label { font-size: 11px; font-weight: 600; fill: var(--ink-2); }

/* ---- language breakdown ---- */
.lang-bar { display: flex; height: 26px; border: 1.5px solid var(--line); overflow: hidden; }
.lang-seg { height: 100%; }
.lang-rows { margin-top: 18px; display: grid; grid-template-columns: 1fr 1fr; gap: 4px 32px; }
.lang-rows .lr { display: grid; grid-template-columns: 14px 1fr auto; align-items: center; gap: 10px; padding: 6px 0; border-bottom: 1px solid var(--line-soft); font-size: 14px; }
.lang-rows .lr i { width: 12px; height: 12px; }
.lang-rows .lr b { font-variant-numeric: tabular-nums; }

/* ---- donut ---- */
.donut-wrap { display: grid; grid-template-columns: auto 1fr; gap: 28px; align-items: center; }
.donut-wrap svg { width: 160px; height: 160px; }

/* ---- activity ---- */
/* activity timeframe selector */
.tf { margin-bottom: 30px; }
.tf-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 22px; }
.tf-chip { font-family: inherit; cursor: pointer; background: none; border: 1.5px solid var(--line-soft); color: var(--ink-2); font-size: 13px; font-weight: 500; padding: 7px 15px; transition: all .15s; }
.tf-chip:hover { border-color: var(--ink); color: var(--ink); }
.tf-chip.active { background: var(--ink); color: #fff; border-color: var(--ink); }
/* timeline bar chart (repos pushed over time) */
.tl-charts { margin-bottom: 22px; }
.tl-chart { display: flex; align-items: flex-end; gap: 3px; height: 140px; border-bottom: 1.5px solid var(--line); padding-bottom: 0; }
.tl-bar-wrap { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 6px; min-width: 0; }
.tl-bar { width: 100%; max-width: 30px; background: var(--ink); min-height: 2px; transition: height .5s ease; }
.tl-bar-wrap:hover .tl-bar { background: var(--accent); }
.tl-bar-wrap > span { font-size: 10px; font-weight: 600; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.tl-empty { height: 140px; display: flex; align-items: center; color: var(--muted); font-size: 14px; border-bottom: 1.5px solid var(--line-soft); }
.tf-note { font-size: 12.5px; color: var(--muted); margin: 14px 0 0; }

.tf-figs { display: grid; grid-template-columns: 1fr 1fr; border-top: 1.5px solid var(--line); border-left: 1.5px solid var(--line); }
.tf-fig { border-right: 1.5px solid var(--line); border-bottom: 1.5px solid var(--line); padding: 18px 20px; }
.tf-fig b { display: block; font-size: 40px; font-weight: 800; letter-spacing: -.03em; line-height: 1; }
.tf-fig > span { display: block; margin-top: 8px; font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.act-sub { display: flex; align-items: baseline; gap: 10px; font-size: 15px; font-weight: 700; margin: 0 0 18px; }
.act-sub span { font-size: 12px; font-weight: 500; color: var(--muted); text-transform: none; letter-spacing: 0; }

.act-cols { display: grid; grid-template-columns: 1.2fr 1fr; gap: 40px; }
.hist { display: flex; align-items: flex-end; gap: 8px; height: 120px; border-bottom: 1.5px solid var(--line); padding-bottom: 0; }
.hist .day { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 6px; }
.hist .day-bar { width: 100%; background: var(--ink); min-height: 3px; transition: height .6s ease; }
.hist .day:hover .day-bar { background: var(--accent); }
.hist .day span { font-size: 11px; font-weight: 600; color: var(--muted); }
.act-facts { display: flex; gap: 0; border-top: 1.5px solid var(--line); border-left: 1.5px solid var(--line); margin-top: 14px; }
.act-facts > div { flex: 1; border-right: 1.5px solid var(--line); border-bottom: 1.5px solid var(--line); padding: 12px 14px; }
.act-facts b { display: block; font-size: 22px; font-weight: 800; letter-spacing: -.02em; }
.act-facts span { font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.feed { list-style: none; margin: 0; padding: 0; }
.feed li { display: flex; align-items: center; gap: 8px; font-size: 14px; padding: 9px 0; border-bottom: 1px solid var(--line-soft); color: var(--muted); }
.feed-act { color: var(--ink); font-weight: 600; }
.feed a { color: var(--accent); text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.feed a:hover { text-decoration: underline; }
.feed-when { margin-left: auto; flex-shrink: 0; font-variant-numeric: tabular-nums; }
.evt-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.evt { font-size: 12px; font-weight: 500; border: 1.5px solid var(--line-soft); padding: 4px 10px; color: var(--ink-2); }
.evt b { font-weight: 700; }

/* ---- repos ---- */
.repos { border-top: 1.5px solid var(--line); }
.repo { display: grid; grid-template-columns: 1fr auto; gap: 6px 20px; padding: 18px 0; border-bottom: 1.5px solid var(--line-soft); text-decoration: none; align-items: start; }
.repo:hover .repo-name { color: var(--accent); }
.repo-name { font-size: 18px; font-weight: 700; letter-spacing: -.01em; transition: color .15s; }
.repo-desc { grid-column: 1; color: var(--ink-2); font-size: 14px; max-width: 60ch; }
.repo-metrics { grid-row: 1 / span 2; grid-column: 2; display: flex; gap: 18px; align-items: center; font-size: 14px; font-weight: 600; font-variant-numeric: tabular-nums; }
.repo-metrics .m { display: inline-flex; align-items: center; gap: 5px; color: var(--ink-2); }
.repo-metrics .m iconify-icon { color: var(--muted); }
.repo-lang { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); font-weight: 500; }
.repo-lang i { width: 10px; height: 10px; }

/* ---- topics / chips ---- */
.tags { display: flex; flex-wrap: wrap; gap: 8px; }
.tag { font-size: 13px; font-weight: 500; border: 1.5px solid var(--line-soft); padding: 5px 11px; color: var(--ink-2); }

/* ---- lists: highlights / roasts ---- */
.notelist { list-style: none; margin: 0; padding: 0; }
.notelist li { display: flex; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line-soft); font-size: 15px; line-height: 1.45; }
.notelist li::before { content: ""; flex-shrink: 0; width: 8px; height: 8px; margin-top: 7px; background: var(--ink); }
.notelist.good li::before { background: var(--good); }
.notelist.roast li::before { background: var(--accent); }

/* ---- README ---- */
.readme-frame { border: 1.5px solid var(--line); background: #fff; max-height: 560px; overflow: auto; }
.readme-body { padding: 28px 32px; font-size: 15px; line-height: 1.6; color: var(--ink-2); }
.readme-body img { max-width: 100%; height: auto; }
.readme-body h1, .readme-body h2 { font-weight: 800; letter-spacing: -.02em; color: var(--ink); border-bottom: 1px solid var(--line-soft); padding-bottom: 6px; }
.readme-body a { color: var(--accent); }
.readme-body pre { background: #f4f3ee; border: 1px solid var(--line-soft); padding: 12px; overflow-x: auto; }
.readme-body code { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 13px; }
.readme-body pre code { background: none; padding: 0; }
.readme-body :not(pre) > code { background: #ecebe4; padding: .15em .4em; border-radius: 3px; }
/* tables — GitHub returns standard <table> markup; give it real structure */
.readme-body table { border-collapse: collapse; margin: 14px 0; display: block; width: max-content; max-width: 100%; overflow: auto; font-size: 14px; }
.readme-body table th,
.readme-body table td { border: 1px solid var(--line-soft); padding: 7px 13px; text-align: left; vertical-align: top; }
.readme-body table th { background: #ecebe4; font-weight: 700; color: var(--ink); }
.readme-body table tr:nth-child(2n) td { background: #faf9f5; }
.readme-body table img { max-width: none; }
.readme-body ul, .readme-body ol { padding-left: 22px; }
.readme-body li { margin: 3px 0; }
.readme-body blockquote { margin: 12px 0; padding: 2px 16px; border-left: 3px solid var(--line-soft); color: var(--muted); }
.readme-body hr { border: none; border-top: 1px solid var(--line-soft); margin: 18px 0; }
.readme-body h1, .readme-body h2, .readme-body h3 { margin-top: 22px; }
.readme-toggle { margin-top: 14px; }

/* ============================================================
   Embed & Share studio
   ============================================================ */
.embed-col { padding-bottom: 40px; margin-bottom: 40px; border-bottom: 1.5px solid var(--line-soft); }
.studio h4, .embed-col h4, .share-col h4 { font-size: 13px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin: 0 0 16px; }

.preview-pane { border: 1.5px solid var(--line); background: #fff; padding: 30px; display: flex; align-items: center; justify-content: center; min-height: 110px; }
/* subtle checkerboard so badge edges read on any theme */
.preview-pane.badge-pane {
  background-color: #fbfaf6;
  background-image: linear-gradient(45deg,#eceae2 25%,transparent 25%),linear-gradient(-45deg,#eceae2 25%,transparent 25%),linear-gradient(45deg,transparent 75%,#eceae2 75%),linear-gradient(-45deg,transparent 75%,#eceae2 75%);
  background-size: 18px 18px; background-position: 0 0,0 9px,9px -9px,-9px 0;
}
.preview-pane.badge-pane img { height: 40px; width: auto; image-rendering: -webkit-optimize-contrast; }
/* neutral checkerboard so the white (light) card reads against the pane */
.preview-pane.share { padding: 0; overflow: hidden; border-width: 1.5px;
  background-color: #e9e8e2;
  background-image: linear-gradient(45deg,#deded6 25%,transparent 25%),linear-gradient(-45deg,#deded6 25%,transparent 25%),linear-gradient(45deg,transparent 75%,#deded6 75%),linear-gradient(-45deg,transparent 75%,#deded6 75%);
  background-size: 22px 22px; background-position: 0 0,0 11px,11px -11px,-11px 0; }
.preview-pane.share img { width: 100%; display: block; }

.opt-grid { display: flex; flex-wrap: wrap; gap: 28px; margin: 18px 0; }
.opt-set { display: flex; flex-direction: column; gap: 8px; }
.opt-cap { font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.opt-row { display: flex; flex-wrap: wrap; gap: 8px; }
.opt { font-family: inherit; cursor: pointer; background: none; border: 1.5px solid var(--line-soft); color: var(--ink-2); font-size: 13px; font-weight: 500; padding: 7px 13px; transition: all .15s; }
.opt:hover { border-color: var(--ink); }
.opt.active { background: var(--ink); color: #fff; border-color: var(--ink); }

.share-controls { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 20px; margin-top: 18px; }
.copy-row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 16px; }
.share-controls .copy-row { margin-top: 0; }
.copy-btn { font-family: inherit; cursor: pointer; display: inline-flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; border: 1.5px solid var(--line); background: var(--bg-card); color: var(--ink); padding: 10px 16px; transition: all .15s; }
.copy-btn:hover { background: var(--ink); color: #fff; }
.copy-btn.copied { background: var(--good); border-color: var(--good); color: #fff; }
.copy-btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.copy-btn.primary:hover { background: var(--ink); border-color: var(--ink); }

.code-out { margin-top: 14px; border: 1.5px solid var(--line-soft); background: #fff; padding: 12px 14px; overflow-x: auto; }
.code-out code { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12.5px; color: var(--ink-2); white-space: pre; }

/* ---- footer ---- */
.foot { border-top: 1.5px solid var(--line); }
.foot-inner { max-width: var(--maxw); margin: 0 auto; padding: 28px var(--gut); display: flex; justify-content: space-between; gap: 20px; flex-wrap: wrap; font-size: 13px; color: var(--muted); }
.foot-inner a { color: var(--ink); font-weight: 600; text-decoration: none; }
.foot-inner a:hover { color: var(--accent); }

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 820px) {
  .identity { grid-template-columns: 90px 1fr; }
  .identity-avatar { width: 90px; height: 90px; }
  .scorebox { grid-column: 1 / -1; grid-row: 2; text-align: left; border-left: 0; border-top: 1.5px solid var(--line); padding: 22px 0 0; padding-left: 0; display: flex; align-items: baseline; gap: 20px; }
  .scorebox .verdict, .scorebox .archetype-line { width: 100%; }
  .cols-2, .act-cols { grid-template-columns: 1fr; gap: 32px; }
  .statgrid { grid-template-columns: repeat(2, 1fr); }
  .lang-rows { grid-template-columns: 1fr; }
}
@media (max-width: 520px) {
  .masthead { padding: 48px 0 40px; }
  .searchbar { max-width: 100%; }
  .repo { grid-template-columns: 1fr; }
  .repo-metrics { grid-row: auto; grid-column: 1; }
  .act-facts { flex-wrap: wrap; }
}
