/* ============================================================
   PANTHEON SKILL TOOLBOX — styles.css
   Design: dark navy-black, single blue accent, Inter + Space Grotesk
   ============================================================ */

/* ── Tokens ─────────────────────────────────────────────────── */
:root {
  --bg:          #050c1a;
  --bg2:         #07101f;
  --surface:     #0b1626;
  --surface2:    #0f1d30;
  --border:      rgba(255,255,255,0.07);
  --border-hi:   rgba(56,141,255,0.55);
  --accent:      #3b82f6;
  --accent2:     #60a5fa;
  --text:        #e8eef9;
  --text-sec:    #9aaec4;
  --text-muted:  #6b7e97;
  --success:     #34d399;
  --radius-lg:   18px;
  --radius-md:   12px;
  --radius-sm:   8px;
  --radius-pill: 999px;
  --shadow:      0 8px 32px rgba(0,0,0,0.45);
  --max-w:       1280px;
  --gap:         20px;
}

/* ── Reset ───────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: 'Inter', system-ui, sans-serif;
  background:
    radial-gradient(ellipse 80% 40% at 10% 0%, rgba(37,99,235,0.12) 0%, transparent 55%),
    radial-gradient(ellipse 60% 35% at 88% 8%, rgba(59,130,246,0.10) 0%, transparent 45%),
    linear-gradient(180deg, #040b18 0%, #06101e 60%, #030a15 100%);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* Subtle grid noise */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background-image:
    linear-gradient(rgba(148,163,184,0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(148,163,184,0.035) 1px, transparent 1px);
  background-size: 52px 52px;
  mask-image: linear-gradient(180deg, rgba(255,255,255,.18) 0%, transparent 75%);
}

/* ── Overflow containment ───────────────────────────────────── */
html, body {
  overflow-x: hidden;
  max-width: 100%;
}

/* ── Page shell ──────────────────────────────────────────────── */
.page-shell {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ── Top nav ─────────────────────────────────────────────────── */
.topnav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(4,9,20,0.88);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  overflow: hidden;
}

.topnav-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 clamp(16px, 4vw, 40px);
  height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: linear-gradient(135deg, rgba(59,130,246,0.25), rgba(96,165,250,0.12));
  border: 1px solid rgba(59,130,246,0.35);
  color: var(--accent2);
  font-size: 1.15rem;
  line-height: 1;
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1;
}

.brand-name {
  font-family: 'Space Grotesk', 'Inter', sans-serif;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--text);
}

.brand-sub {
  font-size: 0.65rem;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  margin-top: 3px;
}

.topnav-link {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-sec);
  text-decoration: none;
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border);
  transition: color 150ms, border-color 150ms;
}

.topnav-link:hover {
  color: var(--text);
  border-color: rgba(59,130,246,0.4);
}

/* ── Hero ────────────────────────────────────────────────────── */
.hero {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 48px clamp(16px, 4vw, 40px) 40px;
}

.hero-grid {
  display: grid;
  grid-template-columns: 1.45fr 0.55fr;
  gap: 32px;
  align-items: start;
}

.eyebrow-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 14px;
  border-radius: var(--radius-pill);
  border: 1px solid rgba(59,130,246,0.3);
  background: rgba(59,130,246,0.08);
  color: var(--accent2);
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  margin-bottom: 18px;
}

.hero-copy h1 {
  font-family: 'Space Grotesk', 'Inter', sans-serif;
  font-size: clamp(2rem, 4.5vw, 3.4rem);
  font-weight: 700;
  line-height: 1.08;
  letter-spacing: -0.02em;
  color: var(--text);
  margin-bottom: 18px;
}

.hero-blurb {
  font-size: 0.97rem;
  line-height: 1.72;
  color: var(--text-sec);
  max-width: min(56ch, 100%);
  overflow-wrap: break-word;
}

/* Hero stats panel */
.hero-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  padding-top: 6px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 18px 16px;
}

.stat-card--wide {
  grid-column: 1 / -1;
}

.stat-label {
  display: block;
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-muted);
  margin-bottom: 8px;
}

/* Coverage toggle should look like a label, not a link */
#coverage-toggle {
  color: var(--text-muted);
  text-decoration: none;
  cursor: default;
}

#coverage-toggle:hover,
#coverage-toggle:focus-visible {
  color: var(--text-muted);
  text-decoration: none;
  outline: none;
}

.stat-value {
  display: block;
  font-family: 'Space Grotesk', 'Inter', sans-serif;
  font-size: 2.1rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1;
}

.stat-value--sm {
  font-size: 0.78rem;
  font-weight: 500;
  line-height: 1.5;
  color: var(--text-sec);
}

/* ── Catalogue section ───────────────────────────────────────── */
.catalogue {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 clamp(16px, 4vw, 40px) 64px;
}

/* ── Filter bar ──────────────────────────────────────────────── */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
  flex-wrap: nowrap;
}

.filter-chips-wrap {
  /* scrollable on mobile */
  overflow-x: auto;
  flex: 1 1 auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
  min-width: 0;
}
.filter-chips-wrap::-webkit-scrollbar { display: none; }

.filter-chips {
  display: flex;
  gap: 8px;
  padding-bottom: 2px; /* avoid clip on scroll */
  white-space: nowrap;
}

.filter-chip {
  display: inline-flex;
  align-items: center;
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-sec);
  font-size: 0.79rem;
  font-weight: 500;
  cursor: pointer;
  transition: border-color 150ms, color 150ms, background 150ms;
  white-space: nowrap;
}

.filter-chip:hover,
.filter-chip:focus-visible {
  border-color: rgba(59,130,246,0.45);
  color: var(--text);
  outline: none;
}

.filter-chip.active {
  border-color: var(--accent);
  background: rgba(59,130,246,0.15);
  color: var(--accent2);
}

/* Search */
.search-wrap {
  flex: 0 0 auto;
  position: relative;
  display: flex;
  align-items: center;
  width: min(280px, 100%);
}

.search-icon {
  position: absolute;
  left: 12px;
  width: 16px;
  height: 16px;
  color: var(--text-muted);
  pointer-events: none;
}

#search-input {
  width: 100%;
  padding: 9px 14px 9px 36px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 0.82rem;
  font-family: inherit;
  outline: none;
  transition: border-color 150ms, box-shadow 150ms;
}

#search-input::placeholder {
  color: var(--text-muted);
}

#search-input:focus {
  border-color: rgba(59,130,246,0.5);
  box-shadow: 0 0 0 3px rgba(59,130,246,0.12);
}

/* ── Active filter / results bar ─────────────────────────────── */
.active-filter-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  background: rgba(59,130,246,0.07);
  border: 1px solid rgba(59,130,246,0.18);
}

.results-label {
  font-size: 0.8rem;
  color: var(--text-sec);
}

.text-button {
  background: transparent;
  border: 0;
  padding: 0;
  cursor: pointer;
  font: inherit;
  font-size: 0.8rem;
  color: var(--accent2);
  transition: color 150ms;
}
.text-button:hover { color: var(--text); }

/* ── Skill grid ──────────────────────────────────────────────── */
.skill-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--gap);
  align-items: start;
  min-width: 0;
  max-width: 100%;
}

/* ── Skill card ──────────────────────────────────────────────── */
.skill-card {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 20px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: linear-gradient(160deg, var(--surface) 0%, #09162a 100%);
  transition: border-color 180ms ease, transform 180ms ease, box-shadow 180ms ease;
  overflow: hidden;
  min-width: 0;
  width: 100%;
}

.skill-card--disabled {
  opacity: 0.45;
  filter: grayscale(0.6);
}

.skill-card--disabled .skill-name,
.skill-card--disabled .skill-description,
.skill-card--disabled .skill-category,
.skill-card--disabled .auth-badge,
.skill-card--disabled .chip {
  opacity: 0.7;
}

@media (prefers-reduced-motion: no-preference) {
  .skill-card:hover {
    border-color: rgba(59,130,246,0.5);
    transform: translateY(-3px);
    box-shadow: 0 12px 32px rgba(0,0,0,0.35), 0 0 0 1px rgba(59,130,246,0.15);
  }
  
  .skill-card--disabled:hover {
    transform: none;
    box-shadow: none;
    border-color: var(--border);
  }
}

.skill-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
  min-width: 0;
}

.skill-category {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.13em;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.auth-badge {
  flex: 0 1 140px;
  min-width: 0;
  display: block;
  max-width: 140px;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  border: 1px solid rgba(52,211,153,0.22);
  background: rgba(52,211,153,0.07);
  color: var(--success);
  font-size: 0.68rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.6;
}

.skill-name {
  font-family: 'Space Grotesk', 'Inter', sans-serif;
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.01em;
  line-height: 1.3;
  margin-bottom: 10px;
}

.skill-description {
  font-size: 0.82rem;
  line-height: 1.65;
  color: var(--text-sec);
  /* Clamp to 3 lines */
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 14px;
}

/* Operations chips */
.skill-ops {
  margin-bottom: 14px;
  min-width: 0;
  overflow: hidden;
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-width: 0;
}

.chip {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: var(--radius-pill);
  border: 1px solid rgba(59,130,246,0.18);
  background: rgba(59,130,246,0.08);
  color: #a5c4f5;
  font-size: 0.7rem;
  font-weight: 500;
  white-space: nowrap;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chip-more {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  font-size: 0.7rem;
  font-weight: 500;
}

/* ── Info icon & tooltip ───────────────────────────────────── */
.skill-card-badges {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.info-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: rgba(59,130,246,0.15);
  border: 1px solid rgba(59,130,246,0.3);
  color: var(--accent2);
  font-size: 0.75rem;
  font-weight: 700;
  cursor: help;
  transition: background 150ms, border-color 150ms;
  flex-shrink: 0;
}

.info-icon:hover {
  background: rgba(59,130,246,0.25);
  border-color: rgba(59,130,246,0.5);
}

.skill-tooltip {
  position: fixed;
  z-index: 1000;
  max-width: 320px;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  background: var(--surface2);
  border: 1px solid var(--border-hi);
  color: var(--text-sec);
  font-size: 0.82rem;
  line-height: 1.6;
  box-shadow: var(--shadow);
  pointer-events: none;
  white-space: pre-wrap;
  word-break: break-word;
}

.skill-tooltip::before {
  content: '';
  position: absolute;
  top: -5px;
  left: 50%;
  width: 10px;
  height: 10px;
  background: var(--surface2);
  border-left: 1px solid var(--border-hi);
  border-top: 1px solid var(--border-hi);
  transform: translateX(-50%) rotate(45deg);
}

/* Meta row */
.skill-meta {
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-width: 0;
  overflow: hidden;
}

.meta-item {
  font-size: 0.7rem;
  color: var(--text-muted);
  line-height: 1.4;
  min-width: 0;
  overflow-wrap: break-word;
  word-break: break-word;
}

.meta-item strong {
  color: var(--text-sec);
  font-weight: 600;
}

/* ── Empty state ─────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 64px 24px;
  color: var(--text-muted);
}

.empty-icon {
  font-size: 2.5rem;
  margin-bottom: 16px;
  color: var(--text-muted);
}

.empty-state h3 {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-sec);
  margin-bottom: 8px;
}

.empty-state p {
  font-size: 0.88rem;
}

/* ── Footer ──────────────────────────────────────────────────── */
.site-footer {
  margin-top: auto;
  padding: 24px clamp(16px, 4vw, 40px);
  border-top: 1px solid var(--border);
  text-align: center;
  font-size: 0.78rem;
  color: var(--text-muted);
  max-width: var(--max-w);
  margin-left: auto;
  margin-right: auto;
  width: 100%;
}

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

/* ── Responsive ──────────────────────────────────────────────── */
@media (max-width: 1024px) {
  .skill-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 600px) {
  /* Force single column earlier to prevent overflow issues */
  .skill-grid {
    grid-template-columns: 1fr !important;
  }

  .skill-card {
    max-width: 100%;
  }
}

@media (max-width: 720px) {
  /* Nav: hide secondary action to avoid clipping on narrow viewports */
  .topnav-link {
    display: none;
  }

  .hero-grid {
    grid-template-columns: 1fr;
  }

  .hero-stats {
    grid-template-columns: 1fr 1fr;
  }

  .filter-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .search-wrap {
    width: 100%;
  }

  #search-input {
    width: 100%;
  }
}

@media (max-width: 480px) {
  /* Nav: hide the browse link on very small screens to prevent overflow */
  .topnav-link {
    display: none;
  }

  /* Brand: allow shrinking to prevent overflow */
  .brand-lockup {
    min-width: 0;
    overflow: hidden;
  }

  .brand-text {
    min-width: 0;
    overflow: hidden;
  }

  .hero {
    padding-top: 28px;
    padding-bottom: 28px;
    padding-inline: 16px;
  }

  .hero-copy h1 {
    font-size: 1.9rem;
  }

  .hero-blurb {
    max-width: 100%;
    overflow-wrap: break-word;
    word-break: break-word;
  }

  .skill-grid {
    grid-template-columns: 1fr !important;
  }

  .hero-stats {
    grid-template-columns: 1fr 1fr;
  }

  .active-filter-bar {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }

  /* Category label: tighten letter-spacing on mobile */
  .skill-category {
    letter-spacing: 0.06em;
    font-size: 0.62rem;
  }

  /* Auth badge: hard cap on mobile, ensure text truncates via ellipsis */
  .auth-badge {
    max-width: 140px;
    font-size: 0.63rem;
    padding: 3px 7px;
  }

  /* Catalogue side padding */
  .catalogue {
    padding-inline: 12px;
  }

  /* Filter bar: stack chips above search on mobile */
  .filter-bar {
    padding: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .filter-chips-wrap {
    max-width: 100%;
  }

  .search-wrap {
    width: 100%;
    max-width: 100%;
  }

  /* Stat cards — ensure they don't overflow */
  .hero-stats {
    max-width: 100%;
    overflow: hidden;
  }

  .stat-card {
    min-width: 0;
    overflow: hidden;
  }

  .stat-value {
    font-size: 1.7rem;
  }
}
