@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:ital,wght@0,400;0,600;1,400&family=JetBrains+Mono:wght@400;700&family=Inter:wght@300;400;500&display=swap');

:root {
  --bg: #0A0A0A;
  --text-main: #EDEDED;
  --text-muted: #999999;
  --border: 1px solid #1f1f1f;
  --border-light: 1px solid #2a2a2a;
  
  --font-serif: 'Playfair Display', serif;
  --font-mono: 'JetBrains Mono', monospace;
  --font-sans: 'Inter', sans-serif;
  
  --accent-open: #4ade80;
  --accent-closed: #60a5fa;
  --accent-merged: #c084fc;
  --success-color: #4ade80;
  --danger-color: #f87171;
}

* { box-sizing: border-box; }

body {
  background-color: var(--bg);
  color: var(--text-main);
  font-family: var(--font-sans);
  margin: 0; padding: 0;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  max-width: 100vw;
}

/* Base resets */
h1, h2, h3 { margin: 0; }
a { color: inherit; text-decoration: none; }

.editorial-layout {
  display: flex;
  min-height: 100vh;
  max-width: 1600px;
  margin: 0 auto;
}

/* --- Sidebar --- */
.editorial-sidebar {
  width: 380px;
  padding: 3rem 2.5rem;
  border-right: var(--border);
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 2.5rem;
  flex-shrink: 0;
}

/* Profile */
.profile-avatar {
  width: 90px; height: 90px;
  border-radius: 50%;
  object-fit: cover;
  margin-bottom: 2rem;
  opacity: 0.9;
}
.editorial-profile h1 {
  font-family: var(--font-serif);
  font-size: 3.8rem;
  font-weight: 400;
  line-height: 1.1;
  margin: 0 0 1rem 0;
  letter-spacing: -1px;
}
.editorial-profile p {
  color: var(--text-muted);
  font-size: 1.1rem;
  font-weight: 300;
  margin: 0;
  line-height: 1.7;
}
.profile-stats {
  display: flex; flex-direction: column; gap: 1rem; margin-top: 2rem;
}
.editorial-profile-link {
  display: flex; align-items: center; gap: 0.8rem;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  transition: color 0.3s ease;
}
.editorial-profile-link:hover {
  color: var(--text-main);
}
.editorial-profile-link svg, .editorial-profile-link i {
  width: 18px; height: 18px;
  color: var(--text-main);
}

/* Controls */
.editorial-controls {
  display: flex; flex-direction: column; gap: 1.5rem;
}
.search-box { position: relative; }
.search-box input {
  width: 100%;
  background: transparent;
  border: none;
  border-bottom: var(--border);
  padding: 0.8rem 0;
  color: var(--text-main);
  font-family: var(--font-serif);
  font-size: 1.4rem;
  outline: none;
  transition: border-color 0.3s;
}
.search-box input::placeholder { color: #333; font-style: italic; }
.search-box input:focus { border-bottom-color: var(--text-main); }
.search-shortcut {
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-muted);
  pointer-events: none;
}
.filter-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; width: 100%; }
.editorial-btn {
  appearance: none; -webkit-appearance: none;
  background: transparent;
  border: 1px solid #333;
  color: var(--text-main);
  padding: 0.6rem 0.8rem;
  font-family: var(--font-sans);
  font-size: 0.75rem;
  font-style: normal;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  cursor: pointer;
  border-radius: 30px;
  transition: all 0.3s ease;
  width: 100%;
  text-align: center;
}
.editorial-btn:hover {
  border-color: var(--text-main);
  background: rgba(255, 255, 255, 0.05);
}

/* Custom Dropdown Styles */
.custom-dropdown-wrapper { position: relative; user-select: none; flex: 1; min-width: 0; }
.custom-dropdown-trigger {
  display: flex; justify-content: space-between; align-items: center; gap: 0.5rem;
  border: 1px solid #333;
  color: var(--text-main);
  padding: 0.6rem 0.8rem;
  font-family: var(--font-sans);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  cursor: pointer;
  border-radius: 30px;
  transition: all 0.3s ease;
  white-space: nowrap;
  width: 100%;
}
.custom-dropdown-trigger:hover, .custom-dropdown-wrapper.open .custom-dropdown-trigger {
  border-color: var(--text-main);
  background: rgba(255, 255, 255, 0.05);
}
.custom-dropdown-trigger svg { width: 14px; height: 14px; transition: transform 0.2s; }
.custom-dropdown-wrapper.open .custom-dropdown-trigger svg { transform: rotate(180deg); }

.custom-dropdown-list {
  position: absolute;
  top: 100%; left: 0; right: 0;
  margin-top: 0.5rem;
  background: #111;
  border: 1px solid #333;
  border-radius: 12px;
  overflow: hidden;
  opacity: 0; pointer-events: none;
  transform: translateY(-10px);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 200;
  box-shadow: 0 10px 30px rgba(0,0,0,0.5);
}
.custom-dropdown-wrapper.open .custom-dropdown-list {
  opacity: 1; pointer-events: auto; transform: translateY(0);
}
.custom-dropdown-item {
  padding: 0.8rem 1rem;
  font-family: var(--font-sans);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s;
  border-bottom: 1px solid #1a1a1a;
}
.custom-dropdown-item:last-child { border-bottom: none; }
.custom-dropdown-item:hover {
  background: #1a1a1a;
  color: var(--text-main);
  padding-left: 1.5rem;
}

.controls-toggle-btn { display: none; }

/* Language Analytics */
.analytics-card {
  padding: 1.5rem 0;
  border-bottom: var(--border);
  margin-bottom: 1.5rem;
}
.analytics-title {
  font-family: var(--font-serif);
  font-size: 1.5rem;
  font-weight: 400;
  margin: 0 0 1.2rem 0;
  color: var(--text-main);
}
.lang-bar {
  display: flex; height: 2px;
  margin-bottom: 1.5rem;
  background: transparent;
}
.lang-segment {
  border-right: 2px solid var(--bg);
}
.lang-segment:last-child {
  border-right: none;
}
.lang-legend {
  display: flex; flex-direction: column; gap: 0.6rem;
}
.lang-legend-item {
  display: flex; align-items: center; gap: 0.8rem;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}
.lang-name { color: var(--text-main); font-weight: 500; }
.lang-pct { margin-left: auto; color: var(--text-muted); }

/* --- Main Content --- */
.editorial-content {
  flex-grow: 1;
  padding: 3rem 4rem;
  min-width: 0;
}
.editorial-heading {
  font-family: var(--font-serif);
  font-size: 2.2rem;
  font-weight: 400;
  margin: 0 0 1.5rem 0;
  color: var(--text-main);
  border-bottom: var(--border);
  padding-bottom: 1rem;
}

/* Standouts */
.standout-grid { display: flex; gap: 2rem; flex-wrap: wrap; margin-bottom: 2rem; }
.org-card {
  display: flex; align-items: center; gap: 1.2rem;
  opacity: 0.7; transition: opacity 0.3s;
  cursor: pointer;
  min-width: 200px;
}
.org-card:hover { opacity: 1; }
.org-avatar { width: 44px; height: 44px; border-radius: 6px; }
.org-info h4 { font-family: var(--font-mono); font-weight: 500; font-size: 0.9rem; margin: 0; text-transform: uppercase; letter-spacing: 1px; color: var(--text-main); }
.org-count { color: var(--text-muted); font-size: 0.8rem; font-family: var(--font-mono); font-weight: 500; }

/* Repositories Accordion */
details.repo-folder {
  border-bottom: var(--border);
  margin-bottom: 0;
}
summary {
  padding: 1.5rem 0;
  font-family: var(--font-sans);
  font-size: 1.3rem;
  font-weight: 300;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 1.2rem;
  list-style: none;
  transition: padding-left 0.4s cubic-bezier(0.16, 1, 0.3, 1), color 0.3s;
  color: #CCCCCC;
}
@media (hover: hover) {
  summary:hover {
    padding-left: 1.5rem;
    color: var(--text-main);
  }
}
summary::-webkit-details-marker { display: none; }
.repo-name { font-weight: 500; letter-spacing: -0.5px; }

/* GitHub Originals Preserved */
.lucide-icon { width: 20px; height: 20px; flex-shrink: 0; opacity: 0.8; }
.index-org-avatar { width: 24px; height: 24px; border-radius: 4px; flex-shrink: 0; }
.repo-badges { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-left: auto; }
.lang-badge {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: 500;
  text-transform: uppercase;
  color: #9A9A9A;
  border: 1px solid #444;
  padding: 0.2rem 0.6rem;
  border-radius: 20px;
  display: flex; align-items: center; gap: 6px;
  letter-spacing: 0.5px;
}
.lang-dot { width: 8px; height: 8px; border-radius: 2px; }

/* Tables */
.repo-content {
  padding: 1rem 0 2.5rem 0;
  overflow-x: auto;
}
.repo-section { margin-bottom: 2rem; }
.repo-section h3 {
  font-family: var(--font-serif);
  font-size: 1.2rem;
  font-weight: 400;
  font-style: italic;
  color: var(--text-muted);
  margin-bottom: 1rem;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
  table-layout: fixed;
}
.data-table th:nth-child(1) { width: 120px; }
.data-table th:nth-child(2) { width: 50%; }
.data-table th:nth-child(3) { width: auto; }
.data-table th:nth-child(4) { width: auto; }

.data-table th {
  text-align: left;
  padding: 1rem 0;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #999;
  border-bottom: var(--border-light);
  font-weight: 600;
}
.data-table td {
  padding: 1.2rem 0;
  border-bottom: 1px solid #141414;
  vertical-align: top;
  color: var(--text-muted);
  transition: color 0.3s;
}
.data-table tr:hover td {
  color: var(--text-main);
}
.data-table td a {
  color: var(--text-main);
  text-decoration: underline;
  text-decoration-color: #333;
  text-underline-offset: 4px;
  transition: text-decoration-color 0.3s;
}
.data-table tr:hover td a {
  text-decoration-color: var(--text-main);
}

/* Utilities */
.private-summary {
  padding: 1.5rem 0;
  border-bottom: var(--border);
  display: flex; gap: 2rem; align-items: center;
  margin-bottom: 1.5rem;
}
.private-icon { font-size: 2rem; color: var(--text-muted); }
.private-details h3 { font-family: var(--font-serif); font-size: 1.5rem; font-weight: 400; margin-bottom: 0.5rem; }
.private-details p { color: var(--text-muted); font-size: 0.9rem; margin-bottom: 1.5rem; }
.private-stats { display: flex; flex-direction: column; gap: 0.8rem; }
.private-stats-row { display: flex; gap: 0.8rem; flex-wrap: wrap; }
.stat-badge {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  padding: 0.4rem 1rem;
  border: 1px solid #333;
  border-radius: 4px;
}
.stat-add { color: var(--success-color); }
.stat-del { color: var(--danger-color); }

.linked-pr { 
  margin-top: 0.8rem; 
  padding-left: 1rem; 
  border-left: 1px solid #333; 
  font-family: var(--font-sans);
  font-size: 0.85rem;
}

/* GitHub specific colors overrides for text to stay readable */
.text-open { color: var(--accent-open); }
.text-merged { color: var(--accent-merged); }
.text-closed { color: var(--accent-closed); }
.empty-msg, .empty-state-msg { color: #555; font-style: italic; padding: 2rem 0; }

.editorial-loading {
  font-family: var(--font-serif);
  font-size: 1.5rem;
  font-style: italic;
  color: var(--text-muted);
  animation: pulse 2s infinite ease-in-out;
}
@keyframes pulse { 0%, 100% { opacity: 0.5; } 50% { opacity: 1; } }

/* Modals */
.modal-overlay {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(10, 10, 10, 0.95);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000;
  opacity: 0; pointer-events: none;
  transition: opacity 0.4s ease;
}
.modal-overlay.show { opacity: 1; pointer-events: auto; }
.modal-content {
  background: #0A0A0A;
  border: var(--border);
  width: 90%; max-width: 650px;
  max-height: 85vh; overflow-y: auto;
  padding: 3rem;
}
.modal-header { display: flex; justify-content: space-between; align-items: center; border-bottom: var(--border); padding-bottom: 1.5rem; margin-bottom: 2rem; }
.modal-header h2 { font-family: var(--font-serif); font-weight: 400; font-size: 2.5rem; }
.modal-close-btn { background: transparent; color: var(--text-muted); border: none; font-size: 2rem; cursor: pointer; font-weight: 300; transition: color 0.3s; }
.modal-close-btn:hover { color: var(--text-main); }

/* Timeline Modal Styles */
.timeline { display: flex; flex-direction: column; gap: 2rem; }
.timeline-item { display: flex; gap: 1.5rem; }
.timeline-date { font-family: var(--font-mono); color: var(--text-muted); font-size: 0.8rem; text-transform: uppercase; letter-spacing: 1px; min-width: 80px; padding-top: 0.2rem; }
.timeline-dot { width: 1px; background: #333; position: relative; margin: 0 1rem; }
.timeline-dot::before { content: ''; position: absolute; left: -4px; top: 0; width: 9px; height: 9px; background: #fff; border-radius: 50%; }
.timeline-content { flex: 1; padding-bottom: 2rem; }
.timeline-repo { margin-bottom: 1rem; }
.timeline-repo-link { font-family: var(--font-sans); font-size: 1.2rem; font-weight: 500; display: flex; align-items: center; gap: 0.8rem; }
.timeline-desc { background: #111; padding: 1.5rem; border: var(--border-light); }
.timeline-issue-row, .timeline-pr-row { margin-bottom: 0.5rem; display: flex; align-items: baseline; gap: 0.8rem; }
.timeline-label { font-family: var(--font-mono); font-size: 0.7rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 1px; }
.timeline-issue-title, .timeline-pr-title { font-size: 0.95rem; line-height: 1.4; color: var(--text-main); }
.timeline-issue-num, .timeline-pr-num { color: var(--text-muted); font-family: var(--font-mono); font-size: 0.8rem; }
.timeline-footer { display: flex; justify-content: space-between; align-items: center; margin-top: 1.5rem; padding-top: 1.5rem; border-top: var(--border-light); }
.timeline-badge { display: flex; align-items: center; gap: 0.5rem; font-family: var(--font-mono); font-size: 0.75rem; text-transform: uppercase; }
.timeline-badge.merged { color: var(--accent-merged); }
.timeline-metrics { display: flex; gap: 1rem; font-family: var(--font-mono); font-size: 0.8rem; }
.impact-add { color: var(--success-color); }
.impact-del { color: var(--danger-color); }

/* Custom Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #333; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #555; }

/* Mobile */
@media (max-width: 1024px) {
  .editorial-layout { flex-direction: column; }
  .editorial-sidebar { width: 100%; height: auto; position: static; padding: 3rem 2rem; border-right: none; border-bottom: var(--border); }
  .editorial-content { padding: 3rem 2rem; }
  
  .data-table thead { display: none; }
  .data-table, .data-table tbody, .data-table tr, .data-table td { display: block; width: 100%; }
  .data-table tr { margin-bottom: 2rem; border-bottom: var(--border); padding-bottom: 1rem; }
  .data-table td { border-bottom: none; padding: 0.5rem 0; }
  .data-table td::before { content: attr(data-label); display: block; font-family: var(--font-mono); font-size: 0.65rem; color: #555; text-transform: uppercase; margin-bottom: 0.2rem; }
  
  /* Mobile Modal Fixes */
  .modal-content { padding: 1.5rem; width: 95%; }
  .modal-header h2 { font-size: 1.8rem; }
  .timeline-item { flex-direction: column; gap: 0.5rem; position: relative; padding-left: 1.2rem; border-left: 1px solid #333; margin-bottom: 2.5rem; }
  .timeline-dot { display: none; }
  .timeline-item::before { content: ''; position: absolute; left: -5px; top: 0; width: 9px; height: 9px; background: #fff; border-radius: 50%; }
  .timeline-date { padding-top: 0; min-width: auto; font-weight: bold; color: var(--text-main); margin-bottom: 0.5rem; }
  .timeline-content { padding-bottom: 1rem; }
  .timeline-desc { padding: 1rem; }
  .timeline-footer { flex-direction: column; align-items: flex-start; gap: 1rem; }
  .timeline-issue-row, .timeline-pr-row { flex-direction: column; align-items: flex-start; gap: 0.2rem; word-break: break-word; }
  
  /* Mobile Private Contributions & Overflow Prevention */
  .private-summary { flex-direction: column; align-items: flex-start; gap: 1rem; }
  .private-icon { display: none; }
  .custom-dropdown-trigger { padding: 0.6rem 0.5rem; font-size: 0.65rem; }
  .editorial-profile h1 { word-break: break-word; font-size: 2.8rem; }
  .standout-grid { gap: 1rem; }
  .org-card { min-width: 150px; }
}
