/* gitmyhub — product styles. Imported AFTER brand.css so brand-kit vars apply.
   Phase 1: hero + search + 404. Phase 2 adds featured tiles. Phase 4 adds profile
   page styles (header + tile grid + chips + org-members row). */

:root {
  --accent: var(--bvl-bit);
  /* Bit-blue tonal scale for tiles/chips/hover surfaces (static fallbacks —
     the @supports block below derives them from --accent so the owner's accent
     AND theme packs compose correctly) */
  --accent-12: rgb(31 184 255 / 0.12);
  --accent-24: rgb(31 184 255 / 0.24);
  --accent-soft: #BFE9FF;
  --surface: rgb(255 255 255 / 0.04);
  --surface-hi: rgb(255 255 255 / 0.08);
  --border: rgb(255 255 255 / 0.10);
  --border-hi: rgb(255 255 255 / 0.18);
  --muted: rgb(245 245 244 / 0.66);
  --max-w: 1120px;
  --gap: 16px;
  --radius: 14px;
  /* Page background drives the iOS chin tint (rule ios-safari-chin-tint) — theme
     packs override --page-bg-base; data-bg modifiers recompute --page-bg. */
  --page-bg-base: #0f2a40;
  --page-bg: var(--page-bg-base);
}

@supports (color: color-mix(in srgb, red 12%, transparent)) {
  :root {
    --accent-12: color-mix(in srgb, var(--accent) 12%, transparent);
    --accent-24: color-mix(in srgb, var(--accent) 24%, transparent);
    --accent-soft: color-mix(in srgb, var(--accent) 45%, #fff);
  }
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  /* Dark steel-blue by default (NOT the generic near-black --bvl-bg). On iOS
     Safari the status bar + bottom chin/safe-area are tinted from
     background-color — Safari does NOT sample the WebGL canvas there (see rule
     ios-safari-chin-tint). Theme packs retint via --page-bg-base. */
  background-color: var(--page-bg);
  color: var(--bvl-fg);
  font-family: var(--bvl-font-sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* Safari samples a fixed element's background-color before body/html when
   tinting the iOS chin — give the shader canvas the same tone so the chin never
   falls back to transparent/black where the WebGL doesn't paint. */
#bvl-bgcanvas { background-color: var(--page-bg); }

body {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding:
    max(env(safe-area-inset-top), 24px)
    max(env(safe-area-inset-right), 24px)
    max(env(safe-area-inset-bottom), 24px)
    max(env(safe-area-inset-left), 24px);
}

a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color 200ms ease, color 200ms ease;
}
a:hover, a:focus-visible { border-bottom-color: var(--accent); }
a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 2px; }

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

/* HERO (root) */
.hero {
  position: relative;
  z-index: 1;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 24px;
  text-align: center;
  max-width: var(--max-w);
  margin: 0 auto;
  width: 100%;
  padding: 48px 0;
}

.wordmark {
  font-family: var(--bvl-font-wm);
  font-weight: 700;
  font-size: clamp(56px, 11vw, 128px);
  /* >1 so the gradient (background-clip:text) box covers Fraunces' descenders —
     at line-height:1 the box is exactly 1em and the 'g' descender falls below it,
     rendering transparent = a cropped 'g' on iOS Safari. */
  line-height: 1.2;
  padding-bottom: 0.04em;
  letter-spacing: -0.02em;
  margin: 0;
  background: linear-gradient(180deg, var(--bvl-fg) 0%, var(--accent-soft) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
/* The "my" in gitmyhub: italic + the brand accent, with a slow, soft breathing
   glow — noticeable but understated (it doesn't scream). text-fill-color overrides
   the parent's clipped-gradient transparency so "my" shows solid Bit-blue. The
   keyframe is gated by the prefers-reduced-motion blanket rule in brand.css. */
.wordmark .wm-my {
  font-style: italic;
  -webkit-text-fill-color: var(--bvl-bit);
  color: var(--bvl-bit);
  padding: 0 0.02em; /* breathing room so the italic lean doesn't kiss the 'h' */
  animation: wmMyBreathe 3.6s ease-in-out infinite;
}
@keyframes wmMyBreathe {
  0%, 100% { opacity: 0.8; text-shadow: 0 0 0 rgb(31 184 255 / 0); }
  50%      { opacity: 1; text-shadow: 0 0 16px rgb(31 184 255 / 0.4); }
}

.tagline {
  font-size: clamp(17px, 2.2vw, 22px);
  color: var(--muted);
  margin: 0;
  max-width: 36ch;
}

/* SEARCH */
.search {
  display: flex;
  align-items: stretch;
  width: min(440px, 100%);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  overflow: hidden;
  transition: border-color 200ms ease, background 200ms ease;
}
.search:focus-within {
  border-color: var(--accent);
  background: var(--surface-hi);
}
.search input {
  flex: 1;
  background: transparent;
  border: 0;
  color: var(--bvl-fg);
  font: inherit;
  font-size: 17px;
  padding: 14px 20px;
  outline: none;
  min-width: 0;
}
.search input::placeholder { color: rgb(245 245 244 / 0.42); }
.search button {
  background: var(--accent);
  color: var(--bvl-bg);
  border: 0;
  font: inherit;
  font-weight: 700;
  font-size: 18px;
  width: 56px;
  cursor: pointer;
  transition: filter 200ms ease;
}
.search button:hover { filter: brightness(1.1); }
.search button:focus-visible { outline: 2px solid var(--accent-soft); outline-offset: -4px; }

.examples {
  font-size: 14px;
  color: var(--muted);
  margin: 0;
}

.kbd {
  font-family: var(--bvl-font-mono);
  font-size: 0.92em;
  padding: 2px 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--bvl-fg);
}

/* FEATURED CREATORS row */
.featured {
  width: 100%;
  margin: 28px 0 0;
}
.featured-h {
  font-family: var(--bvl-font-sans);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgb(245 245 244 / 0.42);
  margin: 0 0 16px;
  text-align: center;
}
.featured-grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  gap: 16px;
  align-items: start;
  justify-items: center;
  /* Cross-fade for the 5s rotation (discrete toggle, NOT per-frame — a CSS
     transition is correct here). gitmyhub.js adds .swapping to fade out, swaps
     the 8 tiles, then removes it to fade in. Under prefers-reduced-motion the
     blanket rule in brand.css zeroes this, and the JS skips rotation anyway. */
  transition: opacity 360ms ease;
}
.featured-grid.swapping { opacity: 0; }
.ftile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  border-bottom: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  transition: transform 220ms ease, color 220ms ease;
  padding: 6px;
  border-radius: 12px;
}
.ftile img {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--surface);
  border: 2px solid var(--border);
  transition: border-color 220ms ease, transform 220ms ease, box-shadow 220ms ease;
  display: block;
  object-fit: cover;
}
.ftile:hover {
  color: var(--bvl-fg);
  transform: translateY(-2px);
}
.ftile:hover img {
  border-color: var(--accent);
  box-shadow: 0 6px 20px -8px var(--accent-24);
}
.ftile:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.ftile span {
  max-width: 88px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 880px) {
  .featured-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 18px; }
}
@media (max-width: 480px) {
  .featured-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
  .ftile img { width: 56px; height: 56px; }
  .ftile span { font-size: 11px; max-width: 72px; }
  /* One-pager fit: trim the hero's vertical padding/gaps + featured/footer
     spacing so the landing fits one mobile screen without a stray scroll.
     SAFE: .hero is flex:1 + justify-content:center, so this padding is invisible
     when the page already fits (flex centering dominates) — it only removes the
     extra height that was forcing the overflow. */
  .hero { padding: 10px 0; gap: 10px; }
  .featured { margin-top: 6px; }
  .featured-h { margin-bottom: 8px; }
  .site-foot { padding-top: 8px; }
  /* Compact disclaimer on mobile so it doesn't reintroduce the one-pager scroll
     (it added ~50px when first shipped at 11px/3-lines — confirmed on device). */
  .foot-disclaimer { font-size: 10px; line-height: 1.4; margin-top: 6px; }
  /* The URL-swap hint is desktop-only: on mobile the search box already conveys
     the action, and dropping it reclaims ~50px so the landing stays one screen
     even with Safari's toolbars shown (15 Pro device content was 817px — too
     tall; measured via headless CDP 2026-05-29). */
  .examples { display: none; }
}

.dot { opacity: 0.4; }

/* ============================================================
 * PROFILE PAGE (Phase 4)
 * ============================================================ */

body.profile-page {
  display: block;
  padding-top: 0;
}

/* --- top nav --- */
.topnav {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 18px 0 26px;
}
.topnav-brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--bvl-fg);
  font-family: var(--bvl-font-wm);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.01em;
  border-bottom: 0;
}
.topnav-brand img { display: block; }
.topnav-search {
  display: flex;
  align-items: stretch;
  width: min(280px, 60vw);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  overflow: hidden;
  transition: border-color 200ms ease;
}
.topnav-search:focus-within { border-color: var(--accent); }
.topnav-search input {
  flex: 1;
  background: transparent;
  border: 0;
  color: var(--bvl-fg);
  font: inherit;
  font-size: 14px;
  padding: 8px 14px;
  outline: none;
  min-width: 0;
}
.topnav-search input::placeholder { color: rgb(245 245 244 / 0.42); }
.topnav-search button {
  background: transparent;
  color: var(--accent);
  border: 0;
  font: inherit;
  font-weight: 700;
  font-size: 16px;
  width: 40px;
  cursor: pointer;
}
.topnav-search button:hover { background: var(--accent-12); }

/* The shared account badge (auth-badge.js) is injected position:fixed at
   top:12px right:12px — on profile pages that overlaps the top-right username
   search. Nudge it below the top-nav. The calc() tracks the safe-area inset the
   same way the body padding + topnav do, so it clears the search on desktop AND
   touch (taller input) AND notched iOS. !important beats the badge's inline top. */
body.profile-page #gsh-auth-badge {
  top: calc(max(env(safe-area-inset-top), 24px) + 72px) !important;
}

/* --- profile main container --- */
.profile {
  position: relative;
  z-index: 1;
  max-width: var(--max-w);
  margin: 0 auto;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 36px;
}

/* --- profile header --- */
.phead {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 24px;
  align-items: start;
  padding: 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  backdrop-filter: blur(8px);
}
.phead-avatar {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: var(--surface-hi);
  border: 2px solid var(--border-hi);
  display: block;
  object-fit: cover;
}
.phead-meta { min-width: 0; }
.phead-name {
  font-family: var(--bvl-font-wm);
  font-weight: 700;
  font-size: clamp(28px, 4.4vw, 40px);
  line-height: 1.1;
  letter-spacing: -0.02em;
  margin: 0 0 6px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.phead-orgtag {
  font-family: var(--bvl-font-mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.15em;
  color: var(--accent);
  background: var(--accent-12);
  padding: 3px 8px;
  border-radius: 6px;
}
.phead-handle {
  font-size: 15px;
  color: var(--muted);
  margin: 0 0 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}
.phead-handle a {
  color: var(--accent);
  border-bottom: 0;
}
.phead-handle a:hover { text-decoration: underline; text-underline-offset: 3px; }
.phead-sep { opacity: 0.4; }
.phead-loc, .phead-blog { color: var(--muted); }
.phead-blog { border-bottom: 1px dashed rgb(255 255 255 / 0.18); }
.phead-bio {
  font-size: 15px;
  line-height: 1.5;
  color: var(--bvl-fg);
  margin: 0 0 14px;
  max-width: 64ch;
}
.phead-stats {
  list-style: none;
  display: flex;
  gap: 22px;
  padding: 0;
  margin: 0 0 12px;
  font-size: 14px;
  color: var(--muted);
  flex-wrap: wrap;
}
.phead-stats strong {
  color: var(--bvl-fg);
  font-weight: 700;
  margin-right: 4px;
}

.lang-chips {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0;
  margin: 0;
}
.lang-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--bvl-fg);
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 4px 10px;
  border-radius: 999px;
}
.lang-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--accent);
  display: inline-block;
}
.lang-pct { color: var(--muted); }

@media (max-width: 640px) {
  .phead { grid-template-columns: 1fr; padding: 18px; }
  .phead-avatar { width: 88px; height: 88px; }
}

/* --- README --- */
.readme {
  padding: 20px 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.readme-excerpt {
  margin: 0;
  font-size: 15px;
  line-height: 1.6;
  color: var(--bvl-fg);
}
.readme-expand, .readme-collapse {
  background: transparent;
  border: 0;
  color: var(--accent);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
}
.readme-expand:hover, .readme-collapse:hover {
  background: var(--accent-12);
}
.readme-full {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  font-size: 14px;
  line-height: 1.6;
  color: var(--bvl-fg);
}
.readme-full h1, .readme-full h2, .readme-full h3 {
  font-family: var(--bvl-font-sans);
  margin: 24px 0 8px;
  font-weight: 700;
  color: var(--bvl-fg);
}
.readme-full h1 { font-size: 22px; }
.readme-full h2 { font-size: 18px; }
.readme-full h3 { font-size: 16px; }
.readme-full p { margin: 10px 0; }
.readme-full a { color: var(--accent); }
.readme-full code {
  font-family: var(--bvl-font-mono);
  font-size: 0.92em;
  background: rgb(255 255 255 / 0.06);
  padding: 2px 6px;
  border-radius: 4px;
}
.readme-full pre {
  background: rgb(0 0 0 / 0.5);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 14px;
  overflow-x: auto;
}
.readme-full pre code {
  background: transparent;
  padding: 0;
  font-size: 12.5px;
  line-height: 1.5;
}
.readme-full ul { padding-left: 20px; }
.readme-full li { margin: 4px 0; }
.readme-collapse-wrap { text-align: right; margin: 16px 0 0; }

/* --- contributions: per-month carousel (default) + one-year bird's-eye toggle --- */
.contrib {
  padding: 20px 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.contrib-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.contrib-head {
  font-family: var(--bvl-font-sans);
  font-size: 16px;
  font-weight: 700;
  margin: 0;
  color: var(--bvl-fg);
}
.contrib-toggle {
  display: inline-flex;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 2px;
  flex: 0 0 auto;
}
.ct-btn {
  background: transparent;
  border: 0;
  color: var(--muted);
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  padding: 5px 14px;
  border-radius: 999px;
  cursor: pointer;
  transition: background 160ms ease, color 160ms ease;
}
.ct-btn.is-on { background: var(--accent-12); color: var(--accent); }
.contrib-streaks {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 6px 0 14px;
  font-size: 13px;
  color: var(--muted);
}
.contrib-streak { display: inline-flex; align-items: center; gap: 5px; }
.contrib-fire { font-size: 12px; }
/* Scroll affordance — a subtle pulsing "‹ swipe through months ›" cue (month view only).
   gitmyhub.js hides it on the first user touch/scroll. Chevrons gently slide outward. */
.contrib-scrollcue {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 0 0 10px;
  font-size: 13px;           /* match the streaks line above */
  font-weight: 700;          /* bold */
  letter-spacing: 0.04em;
  color: var(--bvl-fg);      /* white */
  transition: opacity 320ms ease;
}
.contrib-scrollcue.hide { opacity: 0; pointer-events: none; }
.contrib-scrollcue .cue-l, .contrib-scrollcue .cue-r {
  color: var(--accent);
  font-size: 17px;
  font-weight: 700;
  display: inline-block;
}
.contrib-scrollcue .cue-l { animation: cueL 1.5s ease-in-out infinite; }
.contrib-scrollcue .cue-r { animation: cueR 1.5s ease-in-out infinite; }
@keyframes cueL { 0%,100% { transform: translateX(0); opacity: 0.45; } 50% { transform: translateX(-4px); opacity: 1; } }
@keyframes cueR { 0%,100% { transform: translateX(0); opacity: 0.45; } 50% { transform: translateX(4px); opacity: 1; } }

/* ===== default: per-month horizontal carousel (snap one month at a time) ===== */
.contrib-months-wrap {
  display: flex;
  gap: 16px;
  overflow-x: auto;
  /* mandatory snap → you can only rest ON a month, never between two. Combined with
     one-month-per-view below this guarantees the resting view shows exactly ONE whole
     month and NEVER a partial/cropped neighbour (the bug a peek kept reintroducing). */
  scroll-snap-type: x mandatory;
  scrollbar-width: thin;
  -webkit-overflow-scrolling: touch;
  padding: 4px 2px 12px;
  /* Cap the scroll window so ONE month doesn't balloon on a wide desktop card
     (a full-card month = ~150px cells). On mobile the card is narrower than this,
     so the carousel just uses the available width. */
  max-width: 460px;
}
.contrib-months-wrap > .mc {
  /* ONE month = the FULL scroll window (no peek). At every snap position exactly one
     complete month shows; zero cropped days at any width. Discoverability comes from
     the animated nudge + the "swipe through months" cue, not a peek. */
  flex: 0 0 100%;
  scroll-snap-align: start;
}
.mc { min-width: 0; }
.mc-title {
  font-family: var(--bvl-font-sans);
  font-size: 15px;
  font-weight: 700;
  color: var(--bvl-fg);
  margin: 0 0 8px 2px;
}
.mc-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}
.mc-wd { font-size: 11px; line-height: 16px; text-align: center; color: var(--muted); }
.mc-pad { aspect-ratio: 1; }
.mc-out {
  /* day outside the tracked year — faint number, no box, no interaction */
  aspect-ratio: 1;
  box-sizing: border-box;
  display: flex;
  align-items: flex-start;
  justify-content: flex-start;
  padding: 3px 0 0 4px;
  font-size: 12px;
  color: rgb(245 245 244 / 0.22);
}
.contrib-cell {
  /* tracked day — light box, black day-of-month, tinted by activity level */
  aspect-ratio: 1;
  box-sizing: border-box;
  border-radius: 5px;
  display: flex;
  align-items: flex-start;
  justify-content: flex-start;
  padding: 3px 0 0 4px;
  font-size: 13px;
  font-weight: 600;
  color: #000;
  background: #eef2f5;
  cursor: pointer;
  transition: transform 140ms cubic-bezier(.2,.8,.3,1.4);
  transform-origin: center;
}
.contrib-cell[data-level="0"] { background: #eef2f5; }
.contrib-cell[data-level="1"] { background: #c7e8fb; }
.contrib-cell[data-level="2"] { background: #8fd3f7; }
.contrib-cell[data-level="3"] { background: #56c2f4; }
.contrib-cell[data-level="4"] { background: #1FB8FF; }
/* Magnifier — hover (desktop) / .mag tap (gitmyhub.js) zooms a day. Gentle in the
   carousel (cells already large); strong in year view (tiny cells). Discrete state
   change (NOT a per-frame rAF write) so the CSS transition is correct, won't strobe. */
.contrib-cell:hover,
.contrib-cell.mag {
  transform: scale(1.5);
  z-index: 5;
  box-shadow: 0 6px 16px rgb(0 0 0 / 0.4);
}

/* ===== one-year bird's-eye: every month at once, small (no horizontal scroll) ===== */
.contrib-months-wrap.view-year {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(168px, 1fr));
  gap: 20px 16px;
  overflow: visible;
  scroll-snap-type: none;
  padding: 4px 0 0;
  max-width: none; /* the carousel cap is for the per-month strip only; year grid spans the card */
}
.view-year > .mc { flex: none; }
.view-year .mc-title { font-size: 12px; margin-bottom: 6px; }
.view-year .mc-grid { gap: 3px; }
.view-year .mc-wd { font-size: 9px; line-height: 14px; }
.view-year .mc-out { padding: 2px 0 0 3px; font-size: 9px; }
.view-year .contrib-cell { border-radius: 4px; padding: 2px 0 0 3px; font-size: 9px; }
.view-year .contrib-cell:hover,
.view-year .contrib-cell.mag { transform: scale(2.8); box-shadow: 0 6px 18px rgb(0 0 0 / 0.45); }

.contrib-legend {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  margin: 14px 0 0;
  font-size: 11px;
  color: var(--muted);
}
.contrib-swatch { width: 14px; height: 14px; border-radius: 3px; display: inline-block; }
.contrib-swatch[data-level="0"] { background: #eef2f5; }
.contrib-swatch[data-level="1"] { background: #c7e8fb; }
.contrib-swatch[data-level="2"] { background: #8fd3f7; }
.contrib-swatch[data-level="3"] { background: #56c2f4; }
.contrib-swatch[data-level="4"] { background: #1FB8FF; }
@media (max-width: 540px) {
  .contrib { padding: 16px; }
  /* .mc stays flex 0 0 100% (one full month per view) — no peek, no crop. */
  .contrib-months-wrap.view-year { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 16px 12px; }
}
@media (prefers-reduced-motion: reduce) {
  .contrib-cell { transition: none; }
  .ct-btn { transition: none; }
  .contrib-scrollcue .cue-l, .contrib-scrollcue .cue-r { animation: none; }
}

/* --- claim & curate: rendered overlay elements --- */
.phead-claimed {
  font-family: var(--bvl-font-mono);
  font-size: 11px; font-weight: 600; letter-spacing: 0.08em;
  color: var(--accent); background: var(--accent-12);
  padding: 3px 8px; border-radius: 6px; vertical-align: middle; white-space: nowrap;
}
.phead-links { list-style: none; display: flex; flex-wrap: wrap; gap: 8px; padding: 0; margin: 12px 0 0; }
.phead-links a {
  font-size: 13px; color: var(--accent); background: var(--surface);
  border: 1px solid var(--border); border-radius: 999px; padding: 4px 12px; border-bottom: 0;
  transition: border-color 200ms ease;
}
.phead-links a:hover { border-color: var(--accent); }
.about { padding: 18px 24px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.about-text { margin: 0; font-size: 15px; line-height: 1.6; color: var(--bvl-fg); }

/* --- claim & curate: inline editor --- */
.gmh-edit-bar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 0 0 16px; }
.gmh-editbtn {
  background: var(--accent); color: var(--bvl-bg); border: 0; font: inherit; font-weight: 700;
  font-size: 13px; padding: 8px 18px; border-radius: 999px; cursor: pointer;
  transition: filter 200ms ease;
}
.gmh-editbtn:hover { filter: brightness(1.08); }
.gmh-editbtn.secondary { background: var(--surface); color: var(--bvl-fg); border: 1px solid var(--border); }
.gmh-save-msg { font-size: 13px; color: var(--muted); }
.gmh-editing [data-edit][contenteditable="true"] {
  outline: 1px dashed var(--accent); outline-offset: 3px; border-radius: 4px;
  display: inline-block; min-width: 80px; padding: 1px 4px;
}
.gmh-editing .about-text { white-space: pre-wrap; }
.gmh-accent-row { display: inline-flex; align-items: center; gap: 8px; }
.gmh-accent-row input[type="color"] { width: 28px; height: 28px; border: 1px solid var(--border-hi); border-radius: 8px; background: none; cursor: pointer; padding: 0; }
.gmh-link-edit { margin: 10px 0 0; }
.gmh-link-row { display: flex; gap: 6px; margin: 6px 0; }
.gmh-link-row input { background: var(--surface); border: 1px solid var(--border); color: var(--bvl-fg); border-radius: 8px; padding: 6px 10px; font: inherit; font-size: 13px; min-width: 0; }
.gmh-link-row input.label { width: 34%; }
.gmh-link-row input.url { flex: 1; }
.gmh-mini { background: var(--surface); border: 1px solid var(--border); color: var(--muted); border-radius: 8px; padding: 5px 11px; font: inherit; font-size: 12px; cursor: pointer; }
.gmh-mini:hover { color: var(--bvl-fg); border-color: var(--border-hi); }
.tile.gmh-feature { outline: 2px solid var(--accent); outline-offset: -1px; }
.tile.gmh-hidden-mark { opacity: 0.4; }
.gmh-tile-tools { position: absolute; top: 6px; right: 6px; display: flex; gap: 4px; z-index: 4; }
.gmh-tile-tools button {
  font-size: 11px; line-height: 1; padding: 4px 8px; border-radius: 6px;
  border: 1px solid var(--border-hi); background: rgb(0 0 0 / 0.62); color: var(--bvl-fg); cursor: pointer;
}
.gmh-tile-tools button.on { background: var(--accent); color: var(--bvl-bg); border-color: var(--accent); }
.gmh-repos-edit { margin: 14px 0 0; }
.gmh-repos-h { font-size: 12px; color: var(--muted); margin: 0 0 8px; }
.gmh-repos-list { display: flex; flex-direction: column; gap: 6px; max-height: 260px; overflow-y: auto; padding-right: 4px; }
.gmh-repo-row { display: flex; align-items: center; gap: 8px; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 6px 10px; }
.gmh-repo-row.is-hidden { opacity: 0.5; }
.gmh-repo-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; color: var(--bvl-fg); }
.gmh-repo-btn { flex: 0 0 auto; background: var(--surface-hi); border: 1px solid var(--border); color: var(--muted); border-radius: 999px; padding: 3px 11px; font: inherit; font-size: 12px; cursor: pointer; }
.gmh-repo-btn:hover { border-color: var(--border-hi); color: var(--bvl-fg); }
.gmh-repo-btn.feat.on { background: var(--accent-12); border-color: var(--accent); color: var(--accent); }
.gmh-repo-btn.hide.on { background: rgb(255 80 80 / 0.14); border-color: rgb(255 120 120 / 0.5); color: #ffb4b4; }

/* --- org members row --- */
.org-members-h {
  font-family: var(--bvl-font-sans);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 12px;
}
.org-members-row {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  gap: 18px;
  overflow-x: auto;
  scrollbar-width: thin;
  scroll-snap-type: x proximity;
  padding-bottom: 6px;
  -webkit-overflow-scrolling: touch;
}
.org-members-row li { scroll-snap-align: start; flex: 0 0 auto; }
.org-members-row a {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  border-bottom: 0;
  font-size: 12px;
  transition: color 200ms ease, transform 200ms ease;
}
.org-members-row a:hover { color: var(--bvl-fg); transform: translateY(-2px); }
.org-members-row img {
  width: 48px; height: 48px;
  border-radius: 50%;
  border: 2px solid var(--border);
  display: block;
  background: var(--surface);
  object-fit: cover;
  transition: border-color 200ms ease;
}
.org-members-row a:hover img { border-color: var(--accent); }
.org-members-row span { max-width: 72px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* --- repos section bar + chips --- */
.repos-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 16px;
}
.repos-h {
  font-family: var(--bvl-font-sans);
  font-size: 18px;
  font-weight: 700;
  margin: 0;
}
.repos-count { color: var(--muted); font-weight: 400; }
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 6px 12px;
  border-radius: 999px;
  cursor: pointer;
  user-select: none;
  transition: border-color 200ms ease, color 200ms ease, background 200ms ease;
}
.chip:hover { color: var(--bvl-fg); border-color: var(--border-hi); }
.chip input[type=checkbox] {
  accent-color: var(--accent);
  margin: 0;
}
.chip:has(input:checked) {
  color: var(--bvl-fg);
  border-color: var(--accent);
  background: var(--accent-12);
}
.chip-select {
  padding: 4px 10px 4px 12px;
}
.chip-select select {
  background: transparent;
  color: var(--bvl-fg);
  border: 0;
  font: inherit;
  font-size: 13px;
  outline: none;
  padding: 2px 4px;
  cursor: pointer;
  appearance: none;
  padding-right: 18px;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%),
                    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 8px) calc(50% - 1px), calc(100% - 4px) calc(50% - 1px);
  background-size: 4px 4px, 4px 4px;
  background-repeat: no-repeat;
}

/* --- tile grid --- */
.tile-grid {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--gap);
}
@media (max-width: 880px) { .tile-grid { grid-template-columns: repeat(2, 1fr); } }
/* Mobile: keep TWO columns (compact rectangle tiles), not 1-per-row. Trim the
   tile padding/min-height + clamp the description to 2 lines so two tiles sit
   neatly side-by-side as tidy landscape rectangles on a ~375px screen. */
@media (max-width: 540px) {
  .tile-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .tile-link { padding: 11px 12px 12px; min-height: 96px; gap: 6px; }
  .tile-name { font-size: 13.5px; }
  .tile-desc { font-size: 12px; line-height: 1.4; -webkit-line-clamp: 2; }
  .tile-bot { gap: 10px; font-size: 11px; }
}

.tile {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color 200ms ease, transform 200ms ease, background 200ms ease;
}
.tile:hover {
  border-color: var(--accent);
  background: var(--surface-hi);
  transform: translateY(-2px);
}
.tile-link {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 16px 18px 18px;
  text-decoration: none;
  border-bottom: 0;
  color: var(--bvl-fg);
  height: 100%;
  min-height: 130px;
}
.tile-top {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.tile-name {
  font-family: var(--bvl-font-sans);
  font-weight: 700;
  font-size: 15px;
  color: var(--bvl-fg);
  word-break: break-word;
}
.tile-pin {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--accent);
  background: var(--accent-12);
  padding: 2px 7px;
  border-radius: 999px;
}
.tile-fork, .tile-arch {
  font-size: 12px;
  color: var(--muted);
  background: var(--surface-hi);
  padding: 2px 6px;
  border-radius: 6px;
}
.tile-desc {
  font-size: 13.5px;
  line-height: 1.45;
  color: var(--muted);
  margin: 0;
  flex: 1;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.tile-desc-empty { font-style: italic; opacity: 0.55; }
.tile-bot {
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 12px;
  color: var(--muted);
  flex-wrap: wrap;
}
.tile-lang { display: inline-flex; align-items: center; gap: 6px; }
.tile-stars, .tile-updated { display: inline-flex; align-items: center; gap: 4px; }
.tile-cta {
  position: absolute;
  top: 14px;
  right: 14px;
  font-size: 11px;
  font-weight: 600;
  color: var(--accent);
  opacity: 0;
  transition: opacity 200ms ease;
  pointer-events: none;
}
.tile:hover .tile-cta { opacity: 1; }
.tile-empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 60px 20px;
  color: var(--muted);
}
.empty-msg {
  text-align: center;
  padding: 30px;
  color: var(--muted);
  font-size: 14px;
}

/* FOOTER */
.site-foot {
  position: relative;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  align-items: center;
  padding: 32px 0 0;
  font-size: 13px;
  color: var(--muted);
}
.site-foot a { color: var(--muted); }
.site-foot a:hover { color: var(--bvl-fg); }
/* Trademark + non-affiliation + public-data disclaimer. flex-basis:100% forces
   it onto its own line below the footer row (matches the portfolio convention
   on explaingit/youasktube). Kept compact so it doesn't reintroduce the mobile
   one-pager scroll. */
.foot-disclaimer {
  /* flex-basis + width + max-width all 100% so it always drops to its own line
     below the BitVibe row. (max-width:64ch previously clamped the flex base, so
     it fit on the row → BitVibe-left / disclaimer-right misalignment.) */
  flex-basis: 100%;
  width: 100%;
  max-width: 100%;
  margin: 10px 0 0;
  padding: 0 16px;
  font-size: 11px;
  line-height: 1.5;
  color: var(--muted);
  opacity: 0.6;
  text-align: center;
}

/* Tap targets — iOS HIG min 44pt */
@media (pointer: coarse) {
  .search button { width: 60px; }
  .search input { padding: 16px 20px; }
  /* Filter/sort chips + nav controls + README toggles need a ≥44px touch target */
  .chip { min-height: 44px; padding: 8px 14px; }
  .chip-select { min-height: 44px; }
  .topnav-search input { padding: 12px 14px; }
  .topnav-search button { width: 44px; }
  .readme-expand, .readme-collapse { display: inline-block; padding: 8px 12px; }
}

/* Very narrow screens (small phones): stack the repos bar so the chips get a
   full-width row and wrap cleanly instead of crowding the heading. */
@media (max-width: 380px) {
  .repos-bar { flex-direction: column; align-items: stretch; }
  .chips { width: 100%; }
  .lang-chips { gap: 5px; }
}

/* ── Tile teasers (explaingit summary_short under the GitHub description) ── */

.tile-teaser {
  font-size: 12.5px;
  line-height: 1.45;
  color: var(--bvl-fg);
  opacity: 0.82;
  margin: 0;
  padding-left: 9px;
  border-left: 2px solid var(--accent-24);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
@media (max-width: 540px) {
  .tile-teaser { display: none; } /* compact 2-up tiles: description only */
}

/* ── Repo page (/{user}/{repo}) ─────────────────────────────────────────── */

.rpage {
  width: 100%;
  max-width: 760px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 22px;
  padding-bottom: 28px;
}
.rpage-back a {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--bvl-fg);
  border-bottom: 0;
  font-weight: 600;
  font-size: 14px;
}
.rpage-back img { border-radius: 50%; border: 1px solid var(--border-hi); }
.rpage-back a:hover span { color: var(--accent); }
.rpage-head { display: flex; flex-direction: column; gap: 10px; }
.rpage-title {
  font-family: var(--bvl-font-serif);
  font-weight: 700;
  font-size: clamp(28px, 6vw, 40px);
  letter-spacing: -0.02em;
  margin: 0;
  word-break: break-word;
}
.rpage-facts {
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 13px;
  color: var(--muted);
  flex-wrap: wrap;
}
.rpage-desc { margin: 0; font-size: 15px; color: var(--muted); line-height: 1.55; }
.rpage-tldr {
  margin: 0;
  padding: 16px 20px;
  background: var(--accent-12);
  border: 1px solid var(--accent-24);
  border-radius: var(--radius);
  font-size: 15.5px;
  line-height: 1.55;
  font-weight: 500;
}
.rpage-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.rpage-chip {
  font-size: 12px;
  font-weight: 600;
  color: var(--bvl-fg);
  background: var(--surface-hi);
  border: 1px solid var(--border);
  padding: 4px 10px;
  border-radius: 999px;
}
.rpage-chip-meta { color: var(--muted); font-weight: 500; }
.rpage-body {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px 24px;
  font-size: 15px;
  line-height: 1.65;
}
.rpage-body p { margin: 12px 0; }
.rpage-body p:first-child { margin-top: 0; }
.rpage-body p:last-child { margin-bottom: 0; }
.rpage-body code {
  background: var(--surface-hi);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 1px 5px;
  font-size: 13px;
}
.rpage-body ul { padding-left: 20px; }
.rpage-body li { margin: 4px 0; }
.rpage-h2 {
  font-family: var(--bvl-font-serif);
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: 0 0 10px;
}
.rpage-uses ul { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.rpage-uses li {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 14px;
  line-height: 1.5;
  color: var(--muted);
}
.rpage-absent {
  background: var(--surface);
  border: 1px dashed var(--border-hi);
  border-radius: var(--radius);
  padding: 20px 22px;
  color: var(--muted);
  font-size: 14.5px;
}
.rpage-absent p { margin: 0; }
.rpage-links { display: flex; gap: 12px; flex-wrap: wrap; }
.rpage-btn {
  display: inline-flex;
  align-items: center;
  padding: 10px 18px;
  border-radius: 999px;
  border: 1px solid var(--border-hi);
  color: var(--bvl-fg);
  font-size: 14px;
  font-weight: 600;
  transition: border-color 200ms ease, background 200ms ease;
}
.rpage-btn:hover { border-color: var(--accent); background: var(--surface-hi); }
.rpage-btn-primary { background: var(--accent); border-color: var(--accent); color: #07131c; }
.rpage-btn-primary:hover { background: var(--accent); opacity: 0.92; }

/* ── Theme packs (Pro) — token sets keyed off html[data-theme] ─────────────
   Server emits the attrs ONLY for pro pages (templates.js resolveTheme); the
   default (no attr) is byte-identical to the shipped midnight look. Every pack
   sets --page-bg-base = the iOS-chin tone (rule ios-safari-chin-tint). */

html[data-theme="ink"] {
  --page-bg-base: #000000;
  --surface: rgb(255 255 255 / 0.03);
  --surface-hi: rgb(255 255 255 / 0.06);
  --border: rgb(255 255 255 / 0.12);
  --border-hi: rgb(255 255 255 / 0.22);
}

html[data-theme="slate"] {
  --page-bg-base: #16202b;
  --accent: #7fa3c0; /* desaturated steel default; owner accent (inline) overrides */
  --surface: rgb(255 255 255 / 0.05);
  --surface-hi: rgb(255 255 255 / 0.09);
}

html[data-theme="paper"] {
  --page-bg-base: #EFE9DF;
  --bvl-fg: #1d1a16;
  --accent: #0b6fa8; /* darker blue for light-bg contrast; owner accent overrides */
  --surface: rgb(0 0 0 / 0.04);
  --surface-hi: rgb(0 0 0 / 0.07);
  --border: rgb(0 0 0 / 0.14);
  --border-hi: rgb(0 0 0 / 0.26);
  --muted: rgb(29 26 22 / 0.64);
}
html[data-theme="paper"] .rpage-btn-primary { color: #fff; }
html[data-theme="paper"] .phead-blog { border-bottom-color: rgb(0 0 0 / 0.22); }
html[data-theme="paper"] .contrib-cell,
html[data-theme="paper"] .contrib-swatch { box-shadow: inset 0 0 0 1px rgb(0 0 0 / 0.10); }
@supports (color: color-mix(in srgb, red 45%, #fff)) {
  html[data-theme="paper"] { --accent-soft: color-mix(in srgb, var(--accent) 60%, #1d1a16); }
}

html[data-theme="terminal"] {
  --page-bg-base: #0c2620;
  --accent: #2be07f; /* terminal green default; owner accent overrides */
}

/* Background depth modifiers (Pro, html[data-bg]) */
html[data-bg="deeper"] { --page-bg: color-mix(in srgb, var(--page-bg-base) 55%, #000); }
html[data-theme="paper"][data-bg="deeper"] { --page-bg: color-mix(in srgb, var(--page-bg-base) 86%, #8a7a60); }
html[data-bg="tinted"] { --page-bg: color-mix(in srgb, var(--page-bg-base) 86%, var(--accent)); }

/* Surface tint modifier (Pro, html[data-surface]) */
html[data-surface="tinted"] {
  --surface: color-mix(in srgb, var(--accent) 8%, transparent);
  --surface-hi: color-mix(in srgb, var(--accent) 14%, transparent);
}

/* Display-font modifiers (Pro, html[data-font]) */
html[data-font="serif"] .phead-name,
html[data-font="serif"] .repos-h,
html[data-font="serif"] .contrib-head,
html[data-font="serif"] .rpage-title,
html[data-font="serif"] .rpage-h2 { font-family: var(--bvl-font-serif, Georgia, serif); }
html[data-font="mono"] .tile-name,
html[data-font="mono"] .phead-handle,
html[data-font="mono"] .rpage-title { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }

/* ── Editor: theme panel (Pro; visible-but-locked for free claimed owners) ── */

.gmh-theme-panel {
  margin-top: 14px;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.gmh-theme-panel.locked { opacity: 0.75; }
.gmh-pro-pill {
  display: inline-block;
  margin-left: 8px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--accent);
  background: var(--accent-12);
  border: 1px solid var(--accent-24);
  padding: 2px 8px;
  border-radius: 999px;
  vertical-align: middle;
}
.gmh-pack-row { display: flex; gap: 8px; flex-wrap: wrap; }
.gmh-pack {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font: inherit;
  font-size: 12.5px;
  color: var(--bvl-fg);
  background: var(--surface-hi);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 5px 12px 5px 7px;
  cursor: pointer;
}
.gmh-pack:disabled { cursor: not-allowed; }
.gmh-pack.on { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.gmh-pack-dot {
  width: 16px; height: 16px;
  border-radius: 50%;
  border: 1px solid var(--border-hi);
  display: inline-block;
}
.gmh-theme-row { display: flex; gap: 8px; flex-wrap: wrap; }
.gmh-theme-sel {
  font: inherit;
  font-size: 12.5px;
  color: var(--bvl-fg);
  background: var(--surface-hi);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 8px;
}
.gmh-og-input {
  flex: 1;
  min-width: 220px;
  font: inherit;
  font-size: 13px;
  color: var(--bvl-fg);
  background: var(--surface-hi);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 7px 10px;
}
.gmh-og-input::placeholder { color: var(--muted); }
.gmh-brand-row {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--bvl-fg);
  cursor: pointer;
}
.gmh-pro-note { margin: 0; font-size: 12px; color: var(--muted); }
.gmh-pro-note a { color: var(--accent); }
