/* 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 */
  --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;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  /* Dark steel-blue, 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), so a
     blue here makes those regions blend with the shader instead of showing black
     bands. Tune this hex if it reads too dark/bright against the shader. */
  background-color: #0f2a40;
  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 blue so the chin never
   falls back to transparent/black where the WebGL doesn't paint. */
#bvl-bgcanvas { background-color: #0f2a40; }

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); }

/* --- 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; }

/* --- 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); } }
@media (max-width: 540px) { .tile-grid { grid-template-columns: 1fr; } }

.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: 100%;
  margin: 10px auto 0;
  max-width: 64ch;
  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; }
}
