/* ═══════════════════════════════════════════════════════════════════════════
   GitHub Explorer — Main Stylesheet
   ═══════════════════════════════════════════════════════════════════════════
   Design philosophy:
   - Clean, editorial, with a subtle technical edge.
   - Not "AI default" (no forced dark mode, no generic purple + cream, no
     excessive cards/pills).
   - Typography-driven hierarchy. Generous whitespace.
   - Motion is intentional and minimal (2–3 transitions).
   - Mobile-first responsive.
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Variables ─────────────────────────────────────────────────────────── */

:root {
  /* Palette — cool neutrals with a teal accent */
  --gh-bg:        #f6f8fa;
  --gh-surface:   #ffffff;
  --gh-line:      #e1e4e8;
  --gh-line-subtle: #eef1f4;
  --gh-text:      #1b1f23;
  --gh-text-secondary: #586069;
  --gh-text-tertiary: #8b959e;
  --gh-accent:    #0969da;
  --gh-accent-hover: #0550ae;
  --gh-teal:      #0d9488;
  --gh-teal-light:#e6fffa;
  --gh-green:     #1a7f37;
  --gh-orange:    #d4760a;
  --gh-red:       #cf222e;
  --gh-purple:    #8250df;
  --gh-pink:      #c9510c;

  /* Typography */
  --gh-font: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
  --gh-mono: 'JetBrains Mono', 'SF Mono', SFMono-Regular, Consolas, monospace;

  /* Spacing */
  --gh-gap-sm: 8px;
  --gh-gap: 16px;
  --gh-gap-lg: 24px;
  --gh-gap-xl: 40px;
  --gh-gap-2xl: 64px;

  /* Radii */
  --gh-radius: 8px;
  --gh-radius-sm: 6px;
  --gh-radius-lg: 12px;

  /* Shadows */
  --gh-shadow-sm: 0 1px 2px rgba(27,31,35,0.06);
  --gh-shadow: 0 1px 3px rgba(27,31,35,0.08), 0 1px 2px rgba(27,31,35,0.04);
  --gh-shadow-lg: 0 4px 12px rgba(27,31,35,0.08);

  /* Transitions */
  --gh-transition: 0.15s ease;

  /* Language colors (used in detail/language pages) */
  --gh-python: #3572A5;
  --gh-javascript: #f1e05a;
  --gh-typescript: #3178c6;
  --gh-go: #00ADD8;
  --gh-rust: #dea584;
  --gh-java: #b07219;
  --gh-kotlin: #A97BFF;
  --gh-ruby: #701516;
  --gh-c: #555555;
  --gh-cplusplus: #f34b7d;
  --gh-swift: #F05138;
}

/* ── Reset & Base ──────────────────────────────────────────────────────── */

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--gh-font);
  color: var(--gh-text);
  background: var(--gh-bg);
  line-height: 1.6;
  min-height: 100vh;
  position: relative;
}

a {
  color: var(--gh-accent);
  text-decoration: none;
  transition: color var(--gh-transition);
}

a:hover {
  color: var(--gh-accent-hover);
  text-decoration: underline;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

/* ── Background pattern ────────────────────────────────────────────────── */

.gh-bg-pattern {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(ellipse at 20% 0%, rgba(9,105,218,0.03) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 100%, rgba(13,148,136,0.03) 0%, transparent 50%),
    linear-gradient(180deg, transparent 0%, var(--gh-bg) 100%);
  pointer-events: none;
}

/* ── Navigation ────────────────────────────────────────────────────────── */

.gh-nav {
  background: var(--gh-surface);
  border-bottom: 1px solid var(--gh-line);
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(8px);
  background: rgba(255,255,255,0.92);
}

.gh-nav-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--gh-gap-lg);
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.gh-logo {
  display: flex;
  align-items: center;
  gap: var(--gh-gap-sm);
  text-decoration: none;
  color: var(--gh-text);
}

.gh-logo:hover {
  text-decoration: none;
  color: var(--gh-text);
}

.gh-logo-icon {
  font-size: 28px;
  line-height: 1;
  color: var(--gh-teal);
  font-weight: 300;
}

.gh-logo-text {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.gh-nav-links {
  display: flex;
  gap: var(--gh-gap-lg);
}

.gh-nav-links a {
  font-size: 14px;
  font-weight: 500;
  color: var(--gh-text-secondary);
  text-decoration: none;
  transition: color var(--gh-transition);
  padding: 4px 0;
  border-bottom: 2px solid transparent;
}

.gh-nav-links a:hover {
  color: var(--gh-accent);
  text-decoration: none;
  border-bottom-color: var(--gh-accent);
}

.gh-nav-auth {
  font-family: var(--gh-font);
  font-size: 13px;
  font-weight: 600;
  color: var(--gh-text-secondary);
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--gh-radius-sm);
  padding: 6px 12px;
  cursor: pointer;
  transition: color var(--gh-transition), background var(--gh-transition), border-color var(--gh-transition);
}

.gh-nav-auth:hover {
  color: var(--gh-accent);
  background: var(--gh-teal-light);
}

.gh-nav-auth-primary {
  color: #fff;
  background: var(--gh-accent);
  border-color: var(--gh-accent);
}

.gh-nav-auth-primary:hover {
  color: #fff;
  background: var(--gh-accent-hover);
}

/* ── Main ──────────────────────────────────────────────────────────────── */

.gh-main {
  max-width: 1200px;
  margin: 0 auto;
  padding: var(--gh-gap-xl) var(--gh-gap-lg) var(--gh-gap-2xl);
}

/* ── Hero ──────────────────────────────────────────────────────────────── */

.gh-hero {
  text-align: center;
  padding: var(--gh-gap-2xl) 0 var(--gh-gap-xl);
  position: relative;
}

.gh-hero-content {
  max-width: 680px;
  margin: 0 auto;
}

.gh-hero-emblem {
  display: inline-block;
  font-size: 48px;
  line-height: 1;
  color: var(--gh-teal);
  opacity: 0.8;
  margin-bottom: var(--gh-gap-sm);
  font-weight: 200;
}

.gh-hero-title {
  font-size: clamp(2rem, 5vw, 3rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.15;
  margin-bottom: var(--gh-gap);
  color: var(--gh-text);
}

.gh-hero-sub {
  font-size: 1.125rem;
  color: var(--gh-text-secondary);
  line-height: 1.6;
  margin-bottom: var(--gh-gap-xl);
}

.gh-hero-search {
  margin-bottom: var(--gh-gap-lg);
}

.gh-hero-search-row {
  display: flex;
  gap: var(--gh-gap-sm);
  max-width: 520px;
  margin: 0 auto;
}

.gh-input-hero {
  flex: 1;
  font-size: 1rem;
  padding: 12px 16px;
  border: 2px solid var(--gh-line);
  border-radius: var(--gh-radius-lg);
  transition: border-color var(--gh-transition), box-shadow var(--gh-transition);
  font-family: var(--gh-font);
}

.gh-input-hero:focus {
  outline: none;
  border-color: var(--gh-accent);
  box-shadow: 0 0 0 4px rgba(9,105,218,0.12);
}

.gh-btn-hero {
  padding: 12px 24px;
  font-size: 1rem;
  white-space: nowrap;
}

.gh-hero-langs {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--gh-gap-sm);
  align-items: center;
}

.gh-hero-langs-label {
  font-size: 13px;
  color: var(--gh-text-tertiary);
  font-weight: 500;
}

.gh-lang-chip {
  font-size: 12px;
  font-weight: 500;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--gh-surface);
  border: 1px solid var(--gh-line);
  color: var(--gh-text-secondary);
  text-decoration: none;
  transition: all var(--gh-transition);
}

.gh-lang-chip:hover {
  background: var(--gh-teal-light);
  border-color: var(--gh-teal);
  color: var(--gh-teal);
  text-decoration: none;
}

/* ── Sections ──────────────────────────────────────────────────────────── */

.gh-section {
  margin-bottom: var(--gh-gap-2xl);
}

.gh-section-alt {
  padding-top: var(--gh-gap-xl);
  border-top: 1px solid var(--gh-line);
}

.gh-section-header {
  margin-bottom: var(--gh-gap-lg);
}

.gh-section-title {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--gh-text);
  margin-bottom: 4px;
}

.gh-section-desc {
  font-size: 14px;
  color: var(--gh-text-secondary);
}

/* ── Card Grid (Trending) ──────────────────────────────────────────────── */

.gh-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--gh-gap);
}

.gh-card {
  background: var(--gh-surface);
  border: 1px solid var(--gh-line);
  border-radius: var(--gh-radius-lg);
  padding: 0;
  overflow: hidden;
  transition: box-shadow var(--gh-transition), transform var(--gh-transition);
  display: flex;
  flex-direction: column;
  gap: 0;
}

.gh-card:hover {
  box-shadow: var(--gh-shadow-lg);
  transform: translateY(-2px);
}

.gh-card-large {
  grid-column: 1 / -1;
}

.gh-card-thumb {
  display: block;
  aspect-ratio: 2 / 1;
  background: linear-gradient(135deg, #e8eef5 0%, #dce8f0 50%, #e6fffa 100%);
  overflow: hidden;
  border-bottom: 1px solid var(--gh-line);
}

.gh-card-thumb-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.35s ease;
}

.gh-card:hover .gh-card-thumb-img {
  transform: scale(1.03);
}

.gh-card-large .gh-card-thumb {
  aspect-ratio: 2.4 / 1;
}

.gh-card-header,
.gh-card-desc,
.gh-card-meta,
.gh-card-link {
  margin-left: var(--gh-gap);
  margin-right: var(--gh-gap);
}

.gh-card-header {
  display: flex;
  align-items: center;
  gap: var(--gh-gap-sm);
  margin-top: var(--gh-gap);
}

.gh-card-avatar {
  border-radius: 50%;
  flex-shrink: 0;
}

.gh-card-header-info {
  min-width: 0;
  flex: 1;
}

.gh-card-name {
  font-weight: 600;
  font-size: 14px;
  color: var(--gh-accent);
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-decoration: none;
}

.gh-card-name:hover {
  text-decoration: underline;
}

.gh-card-owner {
  font-size: 12px;
  color: var(--gh-text-tertiary);
}

.gh-card-desc {
  font-size: 13px;
  color: var(--gh-text-secondary);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-top: var(--gh-gap-sm);
}

.gh-card-meta {
  display: flex;
  gap: var(--gh-gap);
  align-items: center;
  font-size: 12px;
  color: var(--gh-text-tertiary);
  margin-top: var(--gh-gap-sm);
  margin-bottom: var(--gh-gap-sm);
}

.gh-card-lang,
.gh-rank-lang,
.gh-table-lang {
  font-size: 12px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--gh-line-subtle);
  color: var(--gh-text-secondary);
  font-weight: 500;
}

.gh-card-stars,
.gh-card-forks {
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.gh-card-link {
  font-size: 12px;
  font-weight: 500;
  color: var(--gh-text-tertiary);
  align-self: flex-end;
  text-decoration: none;
  transition: color var(--gh-transition);
  margin-bottom: var(--gh-gap);
}

.gh-card-link:hover {
  color: var(--gh-accent);
  text-decoration: underline;
}

/* ── Ranking List ──────────────────────────────────────────────────────── */

.gh-ranking {
  display: flex;
  flex-direction: column;
}

.gh-rank-item {
  display: flex;
  align-items: center;
  gap: var(--gh-gap);
  padding: var(--gh-gap) 0;
  border-bottom: 1px solid var(--gh-line-subtle);
}

.gh-rank-thumb {
  flex-shrink: 0;
  width: 96px;
  height: 52px;
  border-radius: var(--gh-radius-sm);
  overflow: hidden;
  border: 1px solid var(--gh-line);
  background: linear-gradient(135deg, #e8eef5, #e6fffa);
  display: none;
}

@media (min-width: 640px) {
  .gh-rank-thumb {
    display: block;
  }
}

.gh-rank-thumb-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.3s ease;
}

.gh-rank-item:hover .gh-rank-thumb-img {
  transform: scale(1.05);
}

.gh-rank-item:hover {
  background: var(--gh-surface);
}

.gh-rank-item:last-child {
  border-bottom: none;
}

.gh-rank-num {
  font-size: 14px;
  font-weight: 600;
  color: var(--gh-text-tertiary);
  min-width: 28px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.gh-rank-avatar,
.gh-table-avatar {
  border-radius: 50%;
  flex-shrink: 0;
}

.gh-rank-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.gh-rank-name {
  font-weight: 600;
  font-size: 14px;
  color: var(--gh-accent);
  text-decoration: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.gh-rank-name:hover {
  text-decoration: underline;
}

.gh-rank-desc {
  font-size: 12px;
  color: var(--gh-text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.gh-rank-metrics {
  display: flex;
  align-items: center;
  gap: var(--gh-gap);
  font-size: 12px;
  color: var(--gh-text-tertiary);
  flex-shrink: 0;
}

.gh-rank-stars {
  color: var(--gh-orange);
  font-weight: 500;
}

.gh-rank-forks {
  color: var(--gh-text-tertiary);
}

/* ── Search Form ───────────────────────────────────────────────────────── */

.gh-search-form {
  margin-bottom: var(--gh-gap-lg);
}

.gh-search-row {
  display: flex;
  gap: var(--gh-gap-sm);
  flex-wrap: wrap;
}

.gh-input {
  font-family: var(--gh-font);
  font-size: 14px;
  padding: 10px 14px;
  border: 1px solid var(--gh-line);
  border-radius: var(--gh-radius);
  background: var(--gh-surface);
  color: var(--gh-text);
  transition: border-color var(--gh-transition), box-shadow var(--gh-transition);
}

.gh-input:focus {
  outline: none;
  border-color: var(--gh-accent);
  box-shadow: 0 0 0 4px rgba(9,105,218,0.12);
}

.gh-input-search {
  flex: 1;
  min-width: 200px;
}

.gh-select {
  font-family: var(--gh-font);
  font-size: 14px;
  padding: 10px 14px;
  border: 1px solid var(--gh-line);
  border-radius: var(--gh-radius);
  background: var(--gh-surface);
  color: var(--gh-text);
  cursor: pointer;
  transition: border-color var(--gh-transition);
}

.gh-select:focus {
  outline: none;
  border-color: var(--gh-accent);
}

.gh-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--gh-font);
  font-size: 14px;
  font-weight: 600;
  padding: 10px 20px;
  border: 1px solid var(--gh-line);
  border-radius: var(--gh-radius);
  background: var(--gh-surface);
  color: var(--gh-text);
  cursor: pointer;
  transition: all var(--gh-transition);
  text-decoration: none;
  white-space: nowrap;
}

.gh-btn:hover {
  text-decoration: none;
  background: var(--gh-line-subtle);
}

.gh-btn-primary {
  background: var(--gh-accent);
  color: #ffffff;
  border-color: var(--gh-accent);
}

.gh-btn-primary:hover {
  background: var(--gh-accent-hover);
  border-color: var(--gh-accent-hover);
  color: #ffffff;
}

.gh-btn-secondary {
  background: transparent;
  border-color: var(--gh-line);
  color: var(--gh-text-secondary);
}

.gh-btn-secondary:hover {
  background: var(--gh-line-subtle);
  color: var(--gh-text);
}

.gh-btn-external {
  gap: var(--gh-gap-sm);
}

/* ── Table ─────────────────────────────────────────────────────────────── */

.gh-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.gh-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.gh-table thead {
  border-bottom: 2px solid var(--gh-line);
}

.gh-table th {
  text-align: left;
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--gh-text-tertiary);
  padding: var(--gh-gap-sm) var(--gh-gap-sm);
  white-space: nowrap;
}

.gh-table td {
  padding: var(--gh-gap-sm);
  border-bottom: 1px solid var(--gh-line-subtle);
  vertical-align: middle;
}

.gh-table-repo {
  display: flex;
  align-items: center;
  gap: var(--gh-gap-sm);
  min-width: 0;
}

.gh-table-repo-info {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.gh-table-repo-name {
  font-weight: 600;
  font-size: 14px;
  color: var(--gh-accent);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.gh-table-repo-desc {
  font-size: 12px;
  color: var(--gh-text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.gh-table-stars,
.gh-table-forks {
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.gh-table tbody tr {
  transition: background var(--gh-transition);
}

.gh-table tbody tr:hover {
  background: var(--gh-surface);
}

.gh-table-num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.gh-table-avatar-cell {
  width: 32px;
}

.gh-table-name-cell {
  min-width: 200px;
}

.gh-table-name {
  font-weight: 600;
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.gh-table-desc {
  display: block;
  font-size: 12px;
  color: var(--gh-text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 320px;
}

.gh-table-date {
  font-size: 12px;
  color: var(--gh-text-tertiary);
  white-space: nowrap;
}

/* ── Detail Page ───────────────────────────────────────────────────────── */

.gh-detail-header {
  margin-bottom: var(--gh-gap-xl);
}

.gh-detail-owner {
  display: flex;
  align-items: center;
  gap: var(--gh-gap);
  margin-bottom: var(--gh-gap);
}

.gh-detail-avatar {
  border-radius: 50%;
}

.gh-detail-owner-login {
  font-size: 14px;
  font-weight: 500;
  color: var(--gh-text-secondary);
}

.gh-detail-title {
  font-size: clamp(1.5rem, 3vw, 2rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: var(--gh-gap-sm);
}

.gh-detail-desc {
  font-size: 1rem;
  color: var(--gh-text-secondary);
  line-height: 1.6;
  max-width: 640px;
}

.gh-detail-metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: var(--gh-gap);
  margin-bottom: var(--gh-gap-lg);
}

.gh-metric-card {
  background: var(--gh-surface);
  border: 1px solid var(--gh-line);
  border-radius: var(--gh-radius);
  padding: var(--gh-gap);
  text-align: center;
  transition: box-shadow var(--gh-transition);
}

.gh-metric-card:hover {
  box-shadow: var(--gh-shadow);
}

.gh-metric-icon {
  display: block;
  font-size: 20px;
  margin-bottom: 4px;
  color: var(--gh-text-tertiary);
}

.gh-metric-value {
  display: block;
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--gh-text);
}

.gh-metric-label {
  display: block;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--gh-text-tertiary);
  margin-top: 2px;
}

.gh-detail-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--gh-gap-sm);
  margin-bottom: var(--gh-gap-lg);
}

.gh-badge {
  display: inline-block;
  font-size: 12px;
  font-weight: 500;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--gh-teal-light);
  color: var(--gh-teal);
}

.gh-badge-lang {
  background: var(--gh-line-subtle);
  color: var(--gh-text-secondary);
}

.gh-detail-topics {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  width: 100%;
  margin-top: 4px;
}

.gh-topic {
  display: inline-block;
  font-size: 11px;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--gh-accent);
  color: #ffffff;
  opacity: 0.85;
}

.gh-detail-updated,
.gh-detail-created {
  font-size: 13px;
  color: var(--gh-text-tertiary);
  width: 100%;
  margin-top: 4px;
}

.gh-detail-updated time,
.gh-detail-created time {
  color: var(--gh-text-secondary);
}

.gh-detail-actions {
  display: flex;
  gap: var(--gh-gap);
  margin-bottom: var(--gh-gap-xl);
}

.gh-detail-readme {
  background: var(--gh-surface);
  border: 1px solid var(--gh-line);
  border-radius: var(--gh-radius-lg);
  padding: var(--gh-gap-lg);
  margin-top: var(--gh-gap-xl);
}

.gh-detail-readme-title {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: var(--gh-gap);
  color: var(--gh-text);
}

.gh-detail-readme-content {
  font-family: var(--gh-mono);
  font-size: 13px;
  line-height: 1.6;
  color: var(--gh-text-secondary);
  max-height: 400px;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

.gh-detail-readme-content pre {
  font-family: inherit;
  white-space: pre-wrap;
}

/* ── Language dot ──────────────────────────────────────────────────────── */

.gh-lang-dot {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--lang-color, var(--gh-text-tertiary));
  vertical-align: middle;
  margin-right: 4px;
}

/* ── Alerts ────────────────────────────────────────────────────────────── */

.gh-alert {
  padding: var(--gh-gap);
  border: 1px solid;
  border-radius: var(--gh-radius);
  margin-bottom: var(--gh-gap-lg);
  font-size: 14px;
}

.gh-alert-warning {
  background: #fff8e7;
  border-color: #ffe5b4;
  color: #7a5d00;
}

.gh-alert-info {
  background: #f0f6ff;
  border-color: #c8e1ff;
  color: #0550ae;
}

.gh-alert-error {
  background: #ffebe9;
  border-color: #ffc1c0;
  color: #8b1a1a;
}

.gh-alert-sub {
  font-size: 12px;
  margin-top: 4px;
  opacity: 0.8;
}

/* ── Empty state ───────────────────────────────────────────────────────── */

.gh-empty {
  text-align: center;
  padding: var(--gh-gap-2xl) var(--gh-gap-lg);
  color: var(--gh-text-secondary);
}

.gh-empty-sub {
  font-size: 14px;
  color: var(--gh-text-tertiary);
  margin-top: var(--gh-gap-sm);
}

.gh-loading {
  text-align: center;
  padding: var(--gh-gap-lg);
  color: var(--gh-text-tertiary);
  font-size: 14px;
}

.gh-muted {
  color: var(--gh-text-tertiary);
  font-size: 14px;
  font-style: italic;
}

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

.gh-footer {
  border-top: 1px solid var(--gh-line);
  background: var(--gh-surface);
  margin-top: auto;
}

.gh-footer-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: var(--gh-gap-lg);
  text-align: center;
  font-size: 12px;
  color: var(--gh-text-tertiary);
  line-height: 1.8;
}

.gh-footer-auth {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--gh-gap);
  margin: var(--gh-gap-lg) auto;
  max-width: 920px;
  text-align: left;
}

@media (min-width: 768px) {
  .gh-footer-auth {
    grid-template-columns: 1fr 1fr;
  }
}

.gh-auth-form {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: var(--gh-gap);
  border: 1px solid var(--gh-line);
  border-radius: var(--gh-radius);
  background: var(--gh-bg);
}

.gh-auth-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--gh-text);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-right: 4px;
}

.gh-auth-input {
  flex: 1;
  min-width: 140px;
  font-family: var(--gh-font);
  font-size: 14px;
  padding: 8px 12px;
  border: 1px solid var(--gh-line);
  border-radius: var(--gh-radius-sm);
  background: var(--gh-surface);
  color: var(--gh-text);
}

.gh-auth-input:focus {
  outline: 2px solid rgba(9, 105, 218, 0.25);
  border-color: var(--gh-accent);
}

.gh-btn-sm {
  padding: 8px 14px;
  font-size: 13px;
}

.gh-flash {
  max-width: 1200px;
  margin: var(--gh-gap) auto 0;
  padding: 0 var(--gh-gap-lg);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.gh-flash-item {
  padding: 10px 14px;
  border-radius: var(--gh-radius-sm);
  font-size: 14px;
  border: 1px solid var(--gh-line);
  background: var(--gh-surface);
}

.gh-flash-success {
  border-color: #b7ebc6;
  background: #f0fff4;
  color: var(--gh-green);
}

.gh-flash-error,
.gh-flash-warning {
  border-color: #ffd8a8;
  background: #fff8f0;
  color: var(--gh-orange);
}

.gh-flash-info {
  border-color: #c8d9f0;
  background: #f0f6ff;
  color: var(--gh-accent);
}

.gh-auth-overlay {
  position: fixed;
  inset: 0;
  background: rgba(27, 31, 35, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: var(--gh-gap);
}

.gh-auth-overlay[hidden] {
  display: none;
}

.gh-auth-modal {
  position: relative;
  width: min(420px, 100%);
  background: var(--gh-surface);
  border-radius: var(--gh-radius-lg);
  border: 1px solid var(--gh-line);
  box-shadow: var(--gh-shadow-lg);
  padding: var(--gh-gap-lg);
}

.gh-auth-close {
  position: absolute;
  top: 10px;
  right: 12px;
  border: none;
  background: transparent;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  color: var(--gh-text-tertiary);
}

.gh-auth-title {
  font-size: 22px;
  margin-bottom: 6px;
}

.gh-auth-desc {
  color: var(--gh-text-secondary);
  font-size: 14px;
  margin-bottom: var(--gh-gap);
}

.gh-auth-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: var(--gh-gap);
}

.gh-auth-field label {
  font-size: 12px;
  font-weight: 600;
  color: var(--gh-text-secondary);
}

.gh-detail-preview {
  margin-bottom: var(--gh-gap-lg);
  border-radius: var(--gh-radius-lg);
  overflow: hidden;
  border: 1px solid var(--gh-line);
  background: linear-gradient(135deg, #e8eef5, #e6fffa);
  aspect-ratio: 2 / 1;
}

.gh-detail-preview-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.gh-table-thumb {
  flex-shrink: 0;
  width: 72px;
  height: 40px;
  border-radius: 4px;
  overflow: hidden;
  border: 1px solid var(--gh-line);
  display: none;
}

@media (min-width: 768px) {
  .gh-table-thumb {
    display: block;
  }
}

.gh-table-thumb-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.gh-footer-source a {
  color: var(--gh-text-tertiary);
  text-decoration: underline;
}

.gh-footer-source a:hover {
  color: var(--gh-accent);
}

.gh-footer-rate {
  margin-top: 4px;
  font-size: 11px;
}

.gh-footer-meta {
  margin-top: 4px;
  font-size: 11px;
}

/* ── Responsive ────────────────────────────────────────────────────────── */

@media (max-width: 768px) {
  .gh-hero {
    padding: var(--gh-gap-xl) 0 var(--gh-gap-lg);
  }

  .gh-hero-search-row {
    flex-direction: column;
  }

  .gh-search-row {
    flex-direction: column;
  }

  .gh-card-grid {
    grid-template-columns: 1fr;
  }

  .gh-rank-item {
    flex-wrap: wrap;
    gap: var(--gh-gap-sm);
  }

  .gh-rank-num {
    display: none;
  }

  .gh-rank-metrics {
    width: 100%;
    justify-content: flex-start;
    padding-left: 40px;
  }

  .gh-detail-metrics {
    grid-template-columns: repeat(2, 1fr);
  }

  .gh-detail-actions {
    flex-direction: column;
  }

  .gh-table th:nth-child(5),
  .gh-table td:nth-child(5),
  .gh-table th:nth-child(6),
  .gh-table td:nth-child(6) {
    display: none;
  }

  .gh-nav-links {
    gap: var(--gh-gap);
  }
}

@media (max-width: 480px) {
  .gh-main {
    padding-left: var(--gh-gap);
    padding-right: var(--gh-gap);
  }

  .gh-hero-title {
    font-size: 1.75rem;
  }

  .gh-hero-sub {
    font-size: 1rem;
  }

  .gh-table th:nth-child(4),
  .gh-table td:nth-child(4) {
    display: none;
  }
}
