/* ============================================================
   Network Shapes Repository – Main Stylesheet
   ============================================================ */

/* ---------- Custom Properties ---------- */
:root {
  --primary:        #d44500;
  --primary-dark:   #a83600;
  --primary-light:  #ff6b2b;
  --secondary:      #151e55;
  --secondary-light:#1f2e7a;
  --accent:         #ff9500;
  --bg:             #f0f2f8;
  --surface:        #ffffff;
  --surface-2:      #f7f8fc;
  --text:           #1a1a2e;
  --text-light:     #5a6282;
  --text-muted:     #9099b5;
  --border:         #e2e6f0;
  --border-light:   #eef0f7;
  --shadow-sm:      0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.05);
  --shadow:         0 4px 12px rgba(0,0,0,.08);
  --shadow-lg:      0 10px 30px rgba(0,0,0,.12);
  --radius:         14px;
  --radius-sm:      8px;
  --radius-xs:      5px;
  --transition:     .2s ease;
  --header-h:       130px;
}

/* ---------- Reset & Base ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  font-size: 15px;
}

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-dark); text-decoration: underline; }

/* ---------- Site Wrapper ---------- */
.site-wrapper {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px 60px;
}

/* ============================================================
   HEADER
   ============================================================ */
.site-header {
  background: linear-gradient(135deg, var(--secondary) 0%, var(--secondary-light) 50%, #2a3a8a 100%);
  padding: 0;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-lg);
}

.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
}

.header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 0 10px;
  gap: 16px;
}

.header-brand {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.header-brand .brand-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: -.3px;
  line-height: 1.2;
}

.header-brand .brand-sub {
  font-size: .78rem;
  color: rgba(255,255,255,.6);
  letter-spacing: .4px;
  text-transform: uppercase;
}

.header-logos {
  display: flex;
  align-items: center;
  gap: 12px;
}

.header-logos img {
  height: 44px;
  filter: brightness(0) invert(1);
  opacity: .85;
  transition: opacity var(--transition);
}

.header-logos img:hover { opacity: 1; }

/* Data Lab logo has a white background, so skip the invert filter */
.header-logos a:first-child img {
  filter: none;
  background: #fff;
  padding: 4px 8px;
  border-radius: 5px;
  opacity: .9;
}

/* Search bar in header */
.header-search-wrap {
  flex: 1;
  max-width: 420px;
}

.search-box {
  position: relative;
  width: 100%;
}

.search-box input {
  width: 100%;
  padding: 10px 16px 10px 42px;
  border-radius: 40px;
  border: 2px solid rgba(255,255,255,.18);
  background: rgba(255,255,255,.13);
  color: #fff;
  font-size: .9rem;
  outline: none;
  transition: border-color var(--transition), background var(--transition);
}

.search-box input::placeholder { color: rgba(255,255,255,.55); }

.search-box input:focus {
  border-color: var(--primary-light);
  background: rgba(255,255,255,.2);
}

.search-box .search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: rgba(255,255,255,.6);
  font-size: 1rem;
  pointer-events: none;
}

.search-count {
  font-size: .75rem;
  color: rgba(255,255,255,.55);
  text-align: right;
  margin-top: 4px;
  padding-right: 12px;
}

/* Top Nav */
.header-nav {
  display: flex;
  gap: 2px;
  padding-bottom: 0;
  border-top: 1px solid rgba(255,255,255,.1);
}

.header-nav a {
  color: rgba(255,255,255,.75);
  font-size: .87rem;
  font-weight: 500;
  padding: 10px 18px;
  border-radius: var(--radius-xs) var(--radius-xs) 0 0;
  transition: background var(--transition), color var(--transition);
  letter-spacing: .2px;
}

.header-nav a:hover { background: rgba(255,255,255,.1); color: #fff; text-decoration: none; }
.header-nav a.active { background: var(--primary); color: #fff; }

/* ============================================================
   HERO / STATS BANNER
   ============================================================ */
.hero-banner {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  border-radius: 0 0 var(--radius) var(--radius);
  padding: 36px 40px;
  margin-bottom: 32px;
  color: #fff;
}

.hero-description {
  font-size: .97rem;
  line-height: 1.7;
  color: rgba(255,255,255,.88);
  max-width: 740px;
  margin-bottom: 28px;
}

.hero-description a { color: rgba(255,255,255,.9); text-decoration: underline; }

.hero-stats {
  display: flex;
  gap: 28px;
  flex-wrap: wrap;
}

.stat-card {
  background: rgba(255,255,255,.15);
  border: 1px solid rgba(255,255,255,.2);
  border-radius: var(--radius-sm);
  padding: 14px 22px;
  min-width: 120px;
  text-align: center;
  backdrop-filter: blur(4px);
}

.stat-card .stat-number {
  font-size: 1.8rem;
  font-weight: 700;
  line-height: 1;
  color: #fff;
}

.stat-card .stat-label {
  font-size: .72rem;
  color: rgba(255,255,255,.7);
  text-transform: uppercase;
  letter-spacing: .5px;
  margin-top: 4px;
}

/* ============================================================
   LAYOUT – SIDEBAR + CONTENT
   ============================================================ */
.main-layout {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 24px;
  align-items: start;
}

/* ---------- Sidebar ---------- */
.category-sidebar {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  position: sticky;
  top: var(--header-h);
  overflow: hidden;
}

.sidebar-header {
  background: var(--secondary);
  padding: 14px 18px;
  font-size: .8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .8px;
  color: rgba(255,255,255,.85);
}

.category-list {
  list-style: none;
  padding: 8px 0;
}

.category-list li a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 18px;
  font-size: .85rem;
  color: var(--text-light);
  border-left: 3px solid transparent;
  transition: background var(--transition), color var(--transition), border-color var(--transition);
  cursor: pointer;
}

.category-list li a:hover,
.category-list li a.active {
  background: var(--surface-2);
  color: var(--primary);
  border-left-color: var(--primary);
  text-decoration: none;
}

.cat-badge {
  background: var(--border-light);
  color: var(--text-muted);
  font-size: .68rem;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 20px;
}

.category-list li a:hover .cat-badge,
.category-list li a.active .cat-badge {
  background: var(--primary-light);
  color: #fff;
}

/* Clear filter link */
.sidebar-clear {
  display: block;
  text-align: center;
  padding: 10px;
  font-size: .8rem;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
  transition: color var(--transition);
  cursor: pointer;
}

.sidebar-clear:hover { color: var(--primary); text-decoration: none; }

/* ---------- Main Content ---------- */
.content-area {
  min-width: 0;
}

/* Active filter chips */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
  flex-wrap: wrap;
  min-height: 32px;
}

.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--primary);
  color: #fff;
  font-size: .8rem;
  font-weight: 500;
  padding: 4px 12px;
  border-radius: 20px;
}

.filter-chip button {
  background: none;
  border: none;
  color: rgba(255,255,255,.8);
  cursor: pointer;
  padding: 0;
  font-size: .85rem;
  line-height: 1;
}

.filter-chip button:hover { color: #fff; }

/* ============================================================
   DATASET TABLE
   ============================================================ */
.table-card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  overflow: hidden;
}

.table-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}

.table-section-title {
  font-size: .95rem;
  font-weight: 600;
  color: var(--secondary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.table-section-title .cat-icon {
  width: 20px;
  height: 20px;
  background: var(--primary);
  border-radius: 4px;
  display: inline-block;
}

.sort-hint {
  font-size: .75rem;
  color: var(--text-muted);
}

.dataset-table {
  width: 100%;
  border-collapse: collapse;
}

.dataset-table thead th {
  background: var(--secondary);
  color: rgba(255,255,255,.9);
  padding: 12px 16px;
  text-align: left;
  font-size: .82rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .5px;
  cursor: pointer;
  user-select: none;
  transition: background var(--transition);
  white-space: nowrap;
}

.dataset-table thead th:hover { background: var(--secondary-light); }

.dataset-table thead th.sort-asc::after  { content: ' ↑'; color: var(--accent); }
.dataset-table thead th.sort-desc::after { content: ' ↓'; color: var(--accent); }

.dataset-table thead th:nth-child(2),
.dataset-table thead th:nth-child(3) { text-align: right; }

.dataset-table tbody tr {
  border-bottom: 1px solid var(--border-light);
  transition: background var(--transition);
}

.dataset-table tbody tr:last-child { border-bottom: none; }

.dataset-table tbody tr:hover { background: #fff8f5; }

.dataset-table tbody tr.hidden { display: none; }

.dataset-table td {
  padding: 11px 16px;
  font-size: .88rem;
  vertical-align: middle;
}

.dataset-table td:nth-child(2),
.dataset-table td:nth-child(3) { text-align: right; font-variant-numeric: tabular-nums; }

.dataset-table td a {
  color: var(--secondary);
  font-weight: 500;
  transition: color var(--transition);
}

.dataset-table td a:hover { color: var(--primary); text-decoration: none; }

.category-tag {
  display: inline-block;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-light);
  font-size: .7rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 12px;
  margin-left: 8px;
  text-transform: uppercase;
  letter-spacing: .3px;
}

/* Category section dividers inside the table */
.dataset-table .cat-separator td {
  background: var(--secondary);
  color: rgba(255,255,255,.85);
  font-size: .78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .8px;
  padding: 8px 16px;
  cursor: default;
}

/* No-results row */
.no-results-row td {
  text-align: center;
  padding: 48px 16px;
  color: var(--text-muted);
  font-size: .9rem;
}

/* ============================================================
   DATASET DETAIL PAGE
   ============================================================ */
.detail-header {
  margin-bottom: 24px;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: .85rem;
  color: var(--text-light);
  margin-bottom: 12px;
  transition: color var(--transition);
}

.back-link:hover { color: var(--primary); text-decoration: none; }

.detail-title {
  font-size: 1.7rem;
  font-weight: 700;
  color: var(--secondary);
}

.detail-layout {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 24px;
  align-items: start;
}

.stats-card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  overflow: hidden;
}

.stats-card-header {
  background: var(--secondary);
  padding: 12px 18px;
  color: rgba(255,255,255,.9);
  font-size: .82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .6px;
}

.stats-card table {
  width: 100%;
  border-collapse: collapse;
}

.stats-card table td {
  padding: 10px 18px;
  font-size: .88rem;
  border-bottom: 1px solid var(--border-light);
}

.stats-card table td:first-child {
  color: var(--text-light);
  font-weight: 500;
  width: 50%;
}

.stats-card table tr:last-child td { border-bottom: none; }

/* Embedding tabs */
.embedding-tabs {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  overflow: hidden;
}

.tab-buttons {
  display: flex;
  background: var(--secondary);
  gap: 0;
}

.tab-btn {
  padding: 13px 22px;
  border: none;
  background: transparent;
  color: rgba(255,255,255,.65);
  font-size: .88rem;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
  border-right: 1px solid rgba(255,255,255,.1);
}

.tab-btn:hover { background: rgba(255,255,255,.1); color: #fff; }
.tab-btn.active { background: var(--primary); color: #fff; }

.tab-panel { display: none; padding: 20px; }
.tab-panel.active { display: block; }

.shape-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.shape-grid-header {
  display: grid;
  grid-template-columns: 140px repeat(3, 1fr);
  background: var(--surface-2);
  border-bottom: 2px solid var(--border);
  font-size: .78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--text-light);
}

.shape-grid-header div, .shape-grid-row > div { padding: 10px 12px; }

.shape-grid-row {
  display: grid;
  grid-template-columns: 140px repeat(3, 1fr);
  border-bottom: 1px solid var(--border-light);
  align-items: center;
}

.shape-grid-row:last-child { border-bottom: none; }
.shape-grid-row:hover { background: var(--surface-2); }

.shape-label {
  font-size: .8rem;
  font-weight: 600;
  color: var(--text-light);
}

.shape-img-cell { padding: 6px; }

.shape-img-wrap {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-xs);
  background: #fafafa;
  border: 1px solid var(--border-light);
}

.shape-img-wrap img {
  width: 100%;
  display: block;
  transition: transform .3s ease;
  cursor: zoom-in;
}

.shape-img-wrap:hover img { transform: scale(1.06); }

.download-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-top: 6px;
  font-size: .75rem;
  color: var(--text-muted);
  transition: color var(--transition);
}

.download-link:hover { color: var(--primary); text-decoration: none; }

/* Image lightbox */
.lightbox-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.85);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  cursor: zoom-out;
}

.lightbox-overlay.open { display: flex; }

.lightbox-img {
  max-width: 90vw;
  max-height: 90vh;
  border-radius: var(--radius-sm);
  box-shadow: 0 25px 50px rgba(0,0,0,.5);
}

/* ============================================================
   CONTACT PAGE
   ============================================================ */
.team-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 24px;
  padding: 32px 0;
}

.team-card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  overflow: hidden;
  text-align: center;
  transition: box-shadow var(--transition), transform var(--transition);
}

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

.team-card img {
  width: 100%;
  height: 200px;
  object-fit: cover;
  object-position: top;
  display: block;
}

.team-card-body { padding: 18px; }

.team-name {
  font-size: 1rem;
  font-weight: 700;
  color: var(--secondary);
  margin-bottom: 4px;
}

.team-role {
  font-size: .8rem;
  color: var(--primary);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .4px;
  margin-bottom: 4px;
}

.team-affil {
  font-size: .8rem;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.team-links { display: flex; flex-direction: column; gap: 4px; }

.team-links a {
  font-size: .8rem;
  color: var(--text-light);
  transition: color var(--transition);
}

.team-links a:hover { color: var(--primary); }

/* ============================================================
   BACK-TO-TOP BUTTON
   ============================================================ */
#back-to-top {
  display: none;
  position: fixed;
  bottom: 30px;
  right: 30px;
  z-index: 200;
  width: 44px;
  height: 44px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 50%;
  font-size: 1.1rem;
  cursor: pointer;
  box-shadow: var(--shadow-lg);
  transition: background var(--transition), transform var(--transition);
  align-items: center;
  justify-content: center;
}

#back-to-top.visible { display: flex; }
#back-to-top:hover { background: var(--primary-dark); transform: translateY(-2px); }

/* ============================================================
   UTILITIES
   ============================================================ */
.badge {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 20px;
  font-size: .72rem;
  font-weight: 600;
}

.badge-orange { background: #fff1ea; color: var(--primary); border: 1px solid #ffd4bb; }
.badge-navy   { background: #eef0fa; color: var(--secondary); border: 1px solid #c8cef0; }
.badge-green  { background: #eafaf3; color: #1a7a52; border: 1px solid #b0e8cb; }

/* Code / GitHub link */
.github-banner {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 20px;
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 20px;
  font-size: .88rem;
}

.github-banner a { font-weight: 600; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 900px) {
  .main-layout { grid-template-columns: 1fr; }
  .category-sidebar { position: static; }
  .detail-layout { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .header-top { flex-wrap: wrap; }
  .header-search-wrap { order: 3; width: 100%; max-width: none; }
  .hero-banner { padding: 24px 20px; }
  .hero-stats { gap: 12px; }
  .stat-card { min-width: 90px; padding: 10px 14px; }
  .shape-grid-header,
  .shape-grid-row { grid-template-columns: 100px repeat(3, 1fr); }
}
