/* ===================================================================
   Scholarship at SCOTUS — Main Stylesheet
   Design system ported from nunn.law blog
   =================================================================== */

:root {
  --bg-dark: #000;
  --bg-navy: #0c111f;
  --text-gradient-start: #00e5ff;
  --text-gradient-end: #ff8c42;
  --cyan: #00e5ff;
  --orange: #ff8c42;
  --cyan-dim: rgba(0, 229, 255, 0.25);
  --cyan-glow: rgba(0, 229, 255, 0.4);
  --orange-dim: rgba(255, 140, 66, 0.05);
  --panel-bg: linear-gradient(135deg, rgba(0, 229, 255, 0.1), rgba(255, 140, 66, 0.05));
  --panel-border: 1px solid rgba(0, 229, 255, 0.25);
  --text-primary: #ffffff;
  --text-secondary: #e6f2ff;
  --text-muted: #6c757d;
  --font-serif: 'Cormorant Garamond', 'EB Garamond', serif;
  --font-sans: 'Poppins', sans-serif;
  --radius: 12px;
  --transition: all 0.3s ease;

  /* Category colors — matching nunn.law */
  --color-articles: rgba(76, 175, 80, 0.75);
  --color-notes: rgba(255, 193, 7, 0.75);
  --color-comments: rgba(171, 71, 188, 0.75);
  --color-books: rgba(239, 83, 80, 0.75);
  --color-other: rgba(92, 107, 192, 0.75);
}

/* ======================== 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 {
  background: var(--bg-dark);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-weight: 400;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

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

a:hover {
  color: var(--orange);
}

/* ======================== ANIMATIONS ======================== */

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ======================== HEADER ======================== */

.site-header {
  position: relative;
  text-align: center;
  z-index: 1000;
  width: 60%;
  max-width: 800px;
  line-height: 1.4;
  margin: 0 auto;
  padding: 14px 0 6px 0;
}

.header-link {
  text-decoration: none;
  color: inherit;
}

.site-title {
  display: inline-block;
  font-family: var(--font-serif);
  font-variant: small-caps;
  font-size: clamp(1.1rem, 4.5vw, 2.3rem);
  color: var(--text-primary);
  font-weight: 400;
  white-space: nowrap;
}

.site-subtitle {
  font-family: var(--font-serif);
  font-size: 0.82rem;
  color: rgba(255, 255, 255, 0.77);
  font-weight: 400;
  margin-top: -8px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.site-update-notice {
  font-family: var(--font-serif);
  font-size: 0.78rem;
  font-weight: 700;
  color: #ff4444;
  margin-top: -2px;
  white-space: nowrap;
}

/* ======================== HAMBURGER ======================== */

/* Hamburger is the rightmost control; home sits to its left (matches nunn.law / blog). */
.hamburger-menu {
  display: block;
  position: fixed;
  top: 12px;
  right: 12px;
  z-index: 1100;
}

.home-btn-fixed {
  position: fixed;
  top: 12px;
  right: 60px; /* 12px inset + 40px btn + ~8px gap */
  z-index: 1100;
}

.menu-toggle-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(12, 17, 31, 0.7);
  backdrop-filter: blur(5px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
  color: #e6f2ff;
  cursor: pointer;
  font-size: 1.1rem;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.menu-toggle-btn:hover {
  background: linear-gradient(135deg, #001e3c, #00398f);
  border-color: rgba(0, 198, 255, 0.7);
  transform: translateY(-2px);
  box-shadow: 0 4px 15px rgba(0, 198, 255, 0.3);
  color: #ffffff;
}

/* ======================== NAVIGATION SLIDE MENU ======================== */

.slide-menu {
  position: fixed;
  top: 0;
  right: -280px;
  width: 280px;
  height: 100vh;
  background: linear-gradient(135deg, rgba(12, 17, 31, 0.85), rgba(0, 0, 0, 0.88));
  backdrop-filter: blur(15px);
  z-index: 2000;
  transition: right 0.4s cubic-bezier(0.25, 1, 0.5, 1);
  box-shadow: -5px 0 15px rgba(0, 0, 0, 0.3);
  display: flex;
  flex-direction: column;
  border-left: 1px solid rgba(255, 255, 255, 0.1);
  overflow-y: auto;
}

.slide-menu::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, rgba(0, 229, 255, 0.03), rgba(255, 140, 66, 0.03));
  pointer-events: none;
}

.slide-menu.open {
  right: 0;
}

.slide-menu-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px;
}

.slide-menu .sidebar-logo {
  font-family: 'Merriweather', serif;
  font-size: 1.2rem;
  font-weight: 400;
  letter-spacing: 0.05em;
  text-transform: lowercase;
  color: #ffffff;
  margin: 0;
  padding-left: 10px;
}

.close-menu-btn {
  width: 28px;
  height: 28px;
  border-radius: 0;
  background: transparent;
  border: none;
  color: rgba(255, 255, 255, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s ease;
  margin-right: 5px;
}

.close-menu-btn:hover {
  color: #ffffff;
}

.close-menu-btn i {
  font-size: 1rem;
  transition: transform 0.3s ease;
}

.close-menu-btn:hover i {
  transform: rotate(90deg);
}

.slide-menu-content {
  display: flex;
  flex-direction: column;
  padding: 10px 12px;
  gap: 0;
  position: relative;
  z-index: 10;
}

.slide-menu .home-links-list {
  list-style: none;
  padding-left: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.slide-menu .home-links-list .link-item {
  border-radius: 12px;
  overflow: hidden;
  transition: transform 0.2s ease;
  width: 100%;
}

.slide-menu .home-links-list .link-item:hover {
  transform: translateY(-1px);
}

.slide-menu .home-links-list .link-item a {
  display: flex;
  align-items: center;
  border-radius: 12px;
  border: 1px solid rgba(0, 229, 255, 0.25);
  width: 100%;
  height: 38px;
  background: linear-gradient(135deg, rgba(0, 229, 255, 0.1), rgba(255, 140, 66, 0.05));
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  text-decoration: none;
  color: rgba(255, 255, 255, 0.9);
  transition: all 0.3s ease;
  backdrop-filter: blur(10px);
  box-sizing: border-box;
  padding: 0 12px;
  gap: 8px;
  font-size: 0.92rem;
  font-family: 'Cormorant Garamond', 'EB Garamond', serif;
}

.slide-menu .home-links-list .link-item a:hover {
  text-decoration: none;
  border-color: rgba(0, 229, 255, 0.5);
  color: #ffffff;
}

.slide-menu .home-links-list .link-item a i {
  width: 18px;
  text-align: center;
  color: rgba(0, 229, 255, 0.7);
  font-size: 0.85rem;
}

.slide-menu .home-links-list .link-item a .social-logo {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  color: rgba(0, 229, 255, 0.7);
}

/* ======================== FILTER TOGGLE (MOBILE) ======================== */

.filter-toggle-fixed {
  display: none;
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 1100;
}

.filter-toggle-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(12, 17, 31, 0.7);
  backdrop-filter: blur(5px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
  color: #e6f2ff;
  cursor: pointer;
  font-size: 1.1rem;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.filter-toggle-btn:hover {
  background: linear-gradient(135deg, #001e3c, #00398f);
  border-color: rgba(0, 198, 255, 0.7);
  transform: translateY(-2px);
  box-shadow: 0 4px 15px rgba(0, 198, 255, 0.3);
  color: #ffffff;
}

/* ======================== SLIDE MENU OVERLAY (MOBILE) ======================== */

.slide-menu-overlay {
  display: none;
}

/* ======================== CONTAINER ======================== */

.container {
  width: 90%;
  max-width: 90%;
  margin: 0 auto;
  flex: 1;
  padding: 0 0 10px 0;
}

.main-view-container {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 125px);
  width: 100%;
  background-color: var(--bg-navy);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 4px 15px rgb(255, 255, 255);
  border: 3px solid var(--cyan);
}

.content-wrapper {
  display: flex;
  flex: 1;
  overflow: hidden;
}

/* ======================== SIDEBAR ======================== */

.sidebar {
  flex: 0 0 300px;
  background-color: rgba(12, 17, 31, 0.7);
  border-right: 1px solid rgba(255, 255, 255, 0.1);
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.sidebar-header {
  padding: 18px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  flex-shrink: 0;
}

.brand-block {
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.brand-logo {
  width: 100%;
  max-width: 220px;
  height: auto;
  border-radius: 6px;
  transition: var(--transition);
}

.brand-logo:hover {
  opacity: 0.85;
}

.filters-scroll-container {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
}

/* ======================== FILTER PANEL ======================== */

.sidebar-panel {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.filter-label {
  font-family: var(--font-serif);
  font-size: 0.9rem;
  color: var(--text-secondary);
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 6px;
}

.filter-label i {
  font-size: 0.8rem;
  color: var(--cyan);
  opacity: 0.7;
  width: 16px;
  text-align: center;
}

.filter-input {
  width: 100%;
  height: 36px;
  border-radius: 10px;
  border: var(--panel-border);
  background: rgba(12, 17, 31, 0.7);
  color: var(--text-secondary);
  padding: 0 12px;
  font-family: var(--font-serif);
  font-size: 0.82rem;
  transition: var(--transition);
  outline: none;
}

.filter-input::placeholder {
  color: rgba(230, 242, 255, 0.35);
}

.filter-input:focus {
  border-color: rgba(0, 229, 255, 0.5);
  box-shadow: 0 0 8px rgba(0, 229, 255, 0.15);
}

/* Section toggles */
.section-toggles {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.section-btn {
  flex: 1 1 calc(50% - 5px);
  min-width: 0;
  padding: 5px 8px;
  border-radius: 8px;
  border: var(--panel-border);
  background: var(--panel-bg);
  color: var(--text-secondary);
  font-family: var(--font-serif);
  font-size: 0.82rem;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  gap: 5px;
  backdrop-filter: blur(10px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.section-btn:hover {
  border-color: rgba(0, 229, 255, 0.5);
  color: var(--text-primary);
  transform: translateY(-1px);
}

.section-btn.active {
  border-color: rgba(0, 229, 255, 0.6);
  background: rgba(0, 229, 255, 0.15);
  color: var(--text-primary);
  box-shadow: 0 0 10px rgba(0, 229, 255, 0.15);
}

.color-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.dot-all { background: var(--cyan); }
.dot-articles { background: var(--color-articles); }
.dot-notes { background: var(--color-notes); }
.dot-comments { background: var(--color-comments); }
.dot-books { background: var(--color-books); }
.dot-other { background: var(--color-other); }

/* Range sliders */
.range-display {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--font-serif);
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.range-separator {
  color: var(--text-muted);
  font-size: 0.75rem;
}

.dual-range {
  position: relative;
  height: 30px;
  display: flex;
  align-items: center;
}

.range-input {
  position: absolute;
  width: 100%;
  height: 4px;
  -webkit-appearance: none;
  appearance: none;
  background: transparent;
  pointer-events: none;
  outline: none;
}

.range-input::-webkit-slider-runnable-track {
  height: 4px;
  border-radius: 2px;
  background: rgba(0, 229, 255, 0.15);
}

.range-input::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--cyan);
  border: 2px solid var(--bg-navy);
  cursor: pointer;
  pointer-events: all;
  margin-top: -6px;
  box-shadow: 0 0 6px var(--cyan-glow);
  transition: var(--transition);
}

.range-input::-webkit-slider-thumb:hover {
  transform: scale(1.2);
  box-shadow: 0 0 12px var(--cyan-glow);
}

.range-input::-moz-range-track {
  height: 4px;
  border-radius: 2px;
  background: rgba(0, 229, 255, 0.15);
}

.range-input::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--cyan);
  border: 2px solid var(--bg-navy);
  cursor: pointer;
  pointer-events: all;
  box-shadow: 0 0 6px var(--cyan-glow);
}

/* Filter actions */
.filter-actions {
  display: flex;
  gap: 8px;
  margin-top: 4px;
}

.action-btn {
  flex: 1;
  padding: 8px 12px;
  border-radius: 10px;
  font-family: var(--font-serif);
  font-size: 0.9rem;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.reset-btn {
  background: rgba(255, 255, 255, 0.05);
  border: var(--panel-border);
  color: var(--text-secondary);
}

.reset-btn:hover {
  background: rgba(0, 229, 255, 0.15);
  border-color: rgba(0, 229, 255, 0.5);
  color: var(--text-primary);
}

/* Result count */
.result-count {
  text-align: center;
  font-family: var(--font-serif);
  font-size: 0.82rem;
  color: var(--text-muted);
  padding-top: 6px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

/* ======================== MAIN CONTENT ======================== */

.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg-navy);
}

/* Sort bar */
.sort-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  flex-shrink: 0;
  flex-wrap: wrap;
}

.sort-label {
  font-family: var(--font-serif);
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-right: 4px;
}

/* Sort toggle (2-button mode switcher) */
.sort-toggle {
  display: flex;
  gap: 0;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  overflow: hidden;
}

.sort-mode-btn {
  padding: 5px 14px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-family: var(--font-serif);
  font-size: 0.82rem;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}

.sort-mode-btn:first-child {
  border-right: 1px solid rgba(255, 255, 255, 0.1);
}

.sort-mode-btn:hover {
  color: var(--text-secondary);
  background: rgba(0, 229, 255, 0.04);
}

.sort-mode-btn.active {
  color: var(--text-primary);
  background: rgba(0, 229, 255, 0.12);
}

.sort-mode-btn i {
  font-size: 0.72rem;
  opacity: 0.7;
}

.sort-mode-btn.active i {
  opacity: 1;
  color: var(--cyan);
}

/* Active filters bar */
.active-filters-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(0, 229, 255, 0.03);
  flex-shrink: 0;
  flex-wrap: wrap;
  animation: filterBarSlide 0.2s ease-out;
}

@keyframes filterBarSlide {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}

.active-filters-label {
  font-family: var(--font-serif);
  font-size: 0.75rem;
  color: var(--text-muted);
  white-space: nowrap;
  flex-shrink: 0;
}

.active-filters-label i {
  font-size: 0.65rem;
  margin-right: 3px;
  opacity: 0.7;
}

.active-filters-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  flex: 1;
  min-width: 0;
}

.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 10px;
  font-family: var(--font-serif);
  font-size: 0.7rem;
  font-weight: 500;
  white-space: nowrap;
  border: 1px solid rgba(0, 229, 255, 0.25);
  background: rgba(0, 229, 255, 0.08);
  color: var(--cyan);
  cursor: default;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.filter-chip-value {
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
}

.filter-chip-dismiss {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-muted);
  font-size: 0.55rem;
  cursor: pointer;
  padding: 0;
  flex-shrink: 0;
  transition: var(--transition);
}

.filter-chip-dismiss:hover {
  background: rgba(255, 82, 82, 0.3);
  color: #ff5252;
}

.active-filters-reset {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 6px;
  border: 1px solid rgba(255, 82, 82, 0.25);
  background: rgba(255, 82, 82, 0.08);
  color: #ff5252;
  font-family: var(--font-serif);
  font-size: 0.7rem;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  margin-left: auto;
  transition: var(--transition);
}

.active-filters-reset:hover {
  background: rgba(255, 82, 82, 0.18);
  border-color: rgba(255, 82, 82, 0.4);
}

.active-filters-reset i {
  font-size: 0.6rem;
}

/* Leaderboard rank column (Most Cited mode) */
.citation-rank-col {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  flex-shrink: 0;
  padding: 0 4px;
}

.rank-badge {
  font-family: var(--font-serif);
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--cyan);
  min-width: 32px;
  text-align: center;
  line-height: 1;
}

.rank-badge.rank-tied {
  color: var(--orange);
}

/* Instance columns (Most Recent mode — case + date/justice buttons) */
.citation-instance-cols {
  display: flex;
  flex-direction: column;
  justify-content: center;
  width: 140px;
  flex-shrink: 0;
  padding: 1px 4px;
  border-right: 1px solid rgba(255, 255, 255, 0.06);
  gap: 1px;
}

/* Top row: case name button (full width) */
.instance-row-top {
  display: flex;
}

/* Bottom row: date + justice buttons (split width) */
.instance-row-bottom {
  display: flex;
  gap: 2px;
}

/* Shared button base for all instance buttons */
.instance-btn {
  font-family: var(--font-serif);
  font-size: 0.6rem;
  border-radius: 3px;
  padding: 0 5px;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: center;
  line-height: 1.15;
}

/* Case name button — full width, top row */
.instance-case-btn {
  flex: 1;
  min-width: 0;
  background: rgba(255, 140, 66, 0.1);
  border: 1px solid rgba(255, 140, 66, 0.2);
  color: var(--text-secondary);
  text-align: center;
}

.instance-case-btn:hover {
  background: rgba(255, 140, 66, 0.2);
  border-color: rgba(255, 140, 66, 0.45);
  color: var(--text-primary);
}

/* Date button — half width, bottom row */
.instance-date-btn {
  flex: 1;
  background: rgba(0, 229, 255, 0.08);
  border: 1px solid rgba(0, 229, 255, 0.15);
  color: var(--cyan);
  font-weight: 500;
}

.instance-date-btn:hover {
  background: rgba(0, 229, 255, 0.15);
  border-color: rgba(0, 229, 255, 0.35);
}

/* Justice button — half width, bottom row, color-coded by opinion type */
.instance-justice-btn {
  flex: 1;
  font-weight: 500;
  border: 1px solid transparent;
}

.instance-justice-btn:hover {
  filter: brightness(1.3);
}

/* Opinion type color coding */
.instance-justice-btn.op-majority {
  background: rgba(76, 175, 80, 0.2);
  border-color: rgba(76, 175, 80, 0.35);
  color: #81c784;
}

.instance-justice-btn.op-concurrence {
  background: rgba(255, 193, 7, 0.15);
  border-color: rgba(255, 193, 7, 0.3);
  color: #ffd54f;
}

.instance-justice-btn.op-dissent {
  background: rgba(239, 83, 80, 0.18);
  border-color: rgba(239, 83, 80, 0.35);
  color: #ef9a9a;
}

.instance-justice-btn.op-plurality {
  background: rgba(92, 107, 192, 0.18);
  border-color: rgba(92, 107, 192, 0.35);
  color: #9fa8da;
}

.instance-justice-btn.op-other {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.12);
  color: var(--text-muted);
}

/* Sort bar spacer pushes badge legend to the right */
.sort-bar-spacer {
  flex: 1;
}

/* Citations list */
.citations-list {
  flex: 1;
  overflow-y: auto;
  padding: 10px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* Citation card */
.citation-card {
  display: flex;
  align-items: stretch;
  border-radius: var(--radius);
  border: var(--panel-border);
  background: linear-gradient(135deg, rgba(0, 229, 255, 0.1), rgba(255, 140, 66, 0.05));
  background-color: var(--bg-navy);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  backdrop-filter: blur(10px);
  transition: border-color 0.3s ease, box-shadow 0.3s ease, transform 0.3s ease;
  cursor: pointer;
  animation: fadeIn 0.15s ease;
  min-height: 30px;
  flex-shrink: 0;
  position: relative;
  z-index: 1;
}

.citation-card.expanded {
  z-index: 2;
  border-color: rgba(0, 229, 255, 0.5);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4);
}

.citation-card:hover {
  border-color: rgba(0, 229, 255, 0.5);
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
}

.citation-color-bar {
  width: 4px;
  flex-shrink: 0;
  border-radius: var(--radius) 0 0 var(--radius);
}

.bar-articles { background: var(--color-articles); }
.bar-notes { background: var(--color-notes); }
.bar-comments { background: var(--color-comments); }
.bar-books { background: var(--color-books); }
.bar-other { background: var(--color-other); }

.citation-body {
  flex: 1;
  padding: 3px 10px;
  display: flex;
  flex-direction: column;
  gap: 0;
  min-width: 0;
  justify-content: center;
}

.citation-row-top {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.citation-bluebook {
  font-family: var(--font-serif);
  font-size: 0.95rem;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
  min-width: 0;
  line-height: 1.3;
}

.citation-bluebook em {
  font-style: italic;
  color: var(--text-primary);
  font-size: inherit;
  line-height: inherit;
}

/* Bluebook small caps for book authors & titles */
.citation-bluebook .sc {
  font-variant: small-caps;
  text-transform: lowercase;
  color: var(--text-primary);
  letter-spacing: 0.02em;
  font-size: 1.08rem;
  line-height: inherit;
}

.citation-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  min-width: 120px;
  justify-content: flex-end;
}

.citation-badge {
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 0.78rem;
  font-family: var(--font-serif);
  font-weight: 600;
  white-space: nowrap;
  min-width: 52px;
  text-align: center;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.badge-cited {
  background: rgba(0, 229, 255, 0.15);
  color: var(--cyan);
  border: 1px solid rgba(0, 229, 255, 0.3);
}

.badge-cases {
  background: rgba(255, 140, 66, 0.12);
  color: var(--orange);
  border: 1px solid rgba(255, 140, 66, 0.25);
}

.badge-year {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-muted);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

/* (citation-row-sub removed — Bluebook citation line replaces it) */

/* Expanded details */
.citation-expanded {
  display: none;
  padding: 12px 14px 14px 14px;
  border-top: 1px solid rgba(0, 229, 255, 0.15);
  margin-top: 6px;
  animation: fadeIn 0.2s ease;
}

.citation-card.expanded .citation-expanded {
  display: block;
}

.expanded-label {
  font-family: var(--font-serif);
  font-size: 0.8rem;
  color: var(--cyan);
  margin-bottom: 4px;
  font-weight: 500;
}

.expanded-full-cite {
  font-family: var(--font-sans);
  font-size: 0.78rem;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 12px;
  word-break: break-word;
}

/* Editions section */
.expanded-editions-label {
  font-family: var(--font-serif);
  font-size: 0.8rem;
  color: var(--cyan);
  margin-bottom: 8px;
  font-weight: 500;
}

.editions-list {
  margin-bottom: 12px;
}

.edition-item {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 4px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

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

.edition-year {
  font-family: var(--font-sans);
  font-size: 0.72rem;
  color: var(--cyan);
  min-width: 36px;
  flex-shrink: 0;
  font-weight: 500;
}

.edition-cite {
  font-family: var(--font-sans);
  font-size: 0.76rem;
  color: var(--text-secondary);
  line-height: 1.45;
  word-break: break-word;
}

.expanded-cases-label {
  font-family: var(--font-serif);
  font-size: 0.8rem;
  color: var(--orange);
  margin-bottom: 6px;
  font-weight: 500;
}

.case-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.case-pill {
  padding: 3px 10px;
  border-radius: 20px;
  background: rgba(255, 140, 66, 0.1);
  border: 1px solid rgba(255, 140, 66, 0.2);
  color: var(--text-secondary);
  font-size: 0.72rem;
  font-family: var(--font-sans);
  cursor: pointer;
  transition: var(--transition);
}

.case-pill:hover {
  background: rgba(255, 140, 66, 0.2);
  border-color: rgba(255, 140, 66, 0.5);
  color: var(--text-primary);
}

.justice-pill {
  background: rgba(0, 229, 255, 0.1);
  border-color: rgba(0, 229, 255, 0.2);
}

.justice-pill:hover {
  background: rgba(0, 229, 255, 0.2);
  border-color: rgba(0, 229, 255, 0.5);
}

.opinion-type-pill {
  background: rgba(160, 120, 255, 0.1);
  border-color: rgba(160, 120, 255, 0.2);
}

.opinion-type-pill:hover {
  background: rgba(160, 120, 255, 0.2);
  border-color: rgba(160, 120, 255, 0.5);
}

/* Select dropdown (opinion type filter) */
.filter-select {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='rgba(230,242,255,0.5)' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 30px;
  cursor: pointer;
}

/* ======================== PAGINATION ======================== */

.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 10px 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  flex-shrink: 0;
}

.page-btn {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: transparent;
  color: var(--text-muted);
  font-family: var(--font-serif);
  font-size: 0.85rem;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
}

.page-btn:hover {
  border-color: var(--cyan-dim);
  color: var(--text-secondary);
}

.page-btn.active {
  background: rgba(0, 229, 255, 0.12);
  border-color: rgba(0, 229, 255, 0.4);
  color: var(--text-primary);
}

.page-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.page-ellipsis {
  color: var(--text-muted);
  font-size: 0.8rem;
  padding: 0 4px;
}

/* ======================== FOOTER ======================== */

.footer {
  text-align: center;
  padding: 8px 16px;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.footer a {
  color: var(--text-muted);
}

.footer a:hover {
  color: var(--cyan);
}

.footer-compact {
  display: none;
}

/* ======================== VIEW NAV ======================== */

.view-nav {
  display: flex;
  align-items: center;
  gap: 0;
  padding: 0;
  border-bottom: 2px solid rgba(255, 255, 255, 0.08);
  flex-shrink: 0;
  background: rgba(0, 0, 0, 0.25);
}

.view-nav-btn {
  flex: 1;
  padding: 10px 20px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-family: var(--font-serif);
  font-variant: small-caps;
  font-size: 1.05rem;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  position: relative;
  letter-spacing: 0.03em;
}

.view-nav-btn:hover {
  color: var(--text-secondary);
  background: rgba(0, 229, 255, 0.04);
}

.view-nav-btn.active {
  color: var(--text-primary);
  background: rgba(0, 229, 255, 0.06);
}

.view-nav-btn.active::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 15%;
  width: 70%;
  height: 2px;
  background: linear-gradient(90deg, var(--cyan), var(--orange));
  border-radius: 1px;
}

.view-nav-btn i {
  font-size: 0.85rem;
  opacity: 0.8;
}

/* View panels */
.view-panel {
  display: none;
  flex: 1;
  overflow: hidden;
  flex-direction: column;
}

.view-panel.active {
  display: flex;
}

/* ======================== INSIGHTS VIEW ======================== */

.insights-container {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Chart section */
.insights-chart-section {
  flex-shrink: 0;
}

.chart-card {
  width: 100%;
}

.chart-wrapper {
  position: relative;
  height: 280px;
  padding: 10px 10px 0 10px;
}

.chart-wrapper-clickable {
  border-radius: calc(var(--radius) - 4px);
  cursor: zoom-in;
  transition: background 0.18s ease, box-shadow 0.18s ease;
}

.chart-wrapper-clickable:hover,
.chart-wrapper-clickable:focus-visible {
  background: rgba(255, 255, 255, 0.025);
  box-shadow: inset 0 0 0 1px rgba(0, 229, 255, 0.12);
  outline: none;
}

.chart-wrapper-clickable canvas {
  cursor: zoom-in;
}

.chart-click-hint {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  margin: 0 12px 12px;
  color: var(--text-muted);
  font-family: var(--font-sans);
  font-size: 0.68rem;
}

.chart-click-hint i {
  color: var(--cyan);
  font-size: 0.64rem;
}

/* Spotlight section */
.insights-spotlight {
  background: linear-gradient(135deg, rgba(0, 229, 255, 0.06), rgba(255, 140, 66, 0.03));
  border: 1px solid rgba(0, 229, 255, 0.2);
  border-radius: var(--radius);
  overflow: hidden;
  flex-shrink: 0;
}

.spotlight-tabs {
  display: flex;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  overflow-x: auto;
}

.spotlight-tab {
  flex: 1;
  padding: 10px 12px;
  border: none;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--text-muted);
  font-family: var(--font-sans);
  font-size: 0.76rem;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.spotlight-tab:hover {
  color: var(--text-secondary);
  background: rgba(0, 229, 255, 0.04);
}

.spotlight-tab.active {
  color: var(--text-primary);
  border-bottom-color: var(--cyan);
  background: rgba(0, 229, 255, 0.06);
}

.spotlight-tab i {
  font-size: 0.72rem;
  opacity: 0.7;
}

.spotlight-tab.active i {
  color: var(--cyan);
  opacity: 1;
}

.spotlight-badge {
  font-size: 0.6rem;
  padding: 1px 5px;
  border-radius: 4px;
  background: rgba(76, 175, 80, 0.15);
  border: 1px solid rgba(76, 175, 80, 0.3);
  color: rgba(76, 175, 80, 0.9);
  font-weight: 600;
  letter-spacing: 0.02em;
}

/* Spotlight category filter */
.spotlight-categories {
  display: flex;
  justify-content: center;
  gap: 4px;
  padding: 8px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(0, 0, 0, 0.1);
}

.spotlight-category-btn {
  padding: 4px 12px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: transparent;
  color: var(--text-muted);
  font-family: var(--font-sans);
  font-size: 0.72rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
}

.spotlight-category-btn:hover {
  border-color: rgba(0, 229, 255, 0.3);
  color: var(--text-secondary);
}

.spotlight-category-btn.active {
  background: rgba(0, 229, 255, 0.12);
  border-color: rgba(0, 229, 255, 0.4);
  color: var(--text-primary);
}

.spotlight-categories-spacer {
  flex: 1;
}

.spotlight-categories .spotlight-time-btn {
  padding: 4px 10px;
  font-size: 0.72rem;
}

.spotlight-panel {
  padding: 0;
}

.spotlight-header {
  display: flex;
  justify-content: flex-end;
  padding: 8px 14px 0 14px;
}

.spotlight-list {
  max-height: 440px;
}

/* Spotlight filter controls */
.spotlight-filters {
  padding: 10px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(0, 0, 0, 0.1);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.spotlight-filters-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.spotlight-select {
  flex: 1;
  min-width: 130px;
  padding: 6px 28px 6px 10px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-secondary);
  font-family: var(--font-sans);
  font-size: 0.72rem;
  cursor: pointer;
  transition: var(--transition);
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='rgba(255,255,255,0.5)'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
}

.spotlight-select:hover,
.spotlight-select:focus {
  border-color: rgba(0, 229, 255, 0.4);
  outline: none;
}

.spotlight-select option {
  background: #0c111f;
  color: var(--text-secondary);
}

.spotlight-sliders-row {
  display: flex;
  gap: 16px;
}

.spotlight-slider-group {
  flex: 1;
  min-width: 160px;
}

.spotlight-slider-label {
  display: flex;
  align-items: center;
  gap: 5px;
  font-family: var(--font-sans);
  font-size: 0.68rem;
  color: var(--text-muted);
  margin-bottom: 3px;
  font-weight: 500;
}

.spotlight-slider-label i {
  color: var(--cyan);
  font-size: 0.62rem;
  opacity: 0.7;
}

.spotlight-range-display {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: var(--font-serif);
  font-size: 0.72rem;
  color: var(--cyan);
  font-weight: 600;
  margin-bottom: 2px;
}

.spotlight-range-display .range-separator {
  color: var(--text-muted);
  font-size: 0.62rem;
}

.spotlight-dual-range {
  position: relative;
  height: 20px;
}

/* Top lists grid */
.insights-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

/* Insights card */
.insights-card {
  background: linear-gradient(135deg, rgba(0, 229, 255, 0.06), rgba(255, 140, 66, 0.03));
  border: 1px solid rgba(0, 229, 255, 0.2);
  border-radius: var(--radius);
  overflow: hidden;
  transition: var(--transition);
}

.insights-card:hover {
  border-color: rgba(0, 229, 255, 0.4);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.insights-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  padding: 12px 14px 8px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  gap: 8px;
}

.insights-card-header h3 {
  font-family: var(--font-serif);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 6px;
}

.insights-card-header h3 i {
  color: var(--cyan);
  font-size: 0.75rem;
  opacity: 0.7;
}

.active-badge {
  display: inline-block;
  background: linear-gradient(135deg, rgba(0, 200, 83, 0.25), rgba(0, 229, 255, 0.15));
  color: #4cdf91;
  font-family: var(--font-sans);
  font-size: 0.6rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  padding: 2px 7px;
  border-radius: 4px;
  border: 1px solid rgba(0, 200, 83, 0.3);
  text-transform: uppercase;
  white-space: nowrap;
  vertical-align: middle;
  margin-left: 2px;
}

/* Time filter buttons */
.time-filter {
  display: flex;
  gap: 3px;
  flex-shrink: 0;
}

.time-btn {
  padding: 2px 8px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: transparent;
  color: var(--text-muted);
  font-family: var(--font-sans);
  font-size: 0.68rem;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
}

.time-btn:hover {
  border-color: rgba(0, 229, 255, 0.3);
  color: var(--text-secondary);
}

.time-btn.active {
  background: rgba(0, 229, 255, 0.12);
  border-color: rgba(0, 229, 255, 0.4);
  color: var(--text-primary);
}

/* Top list */
.top-list {
  list-style: none;
  padding: 8px 14px 12px 14px;
  margin: 0;
  counter-reset: top-item;
  max-height: 340px;
  overflow-y: auto;
}

.top-list li {
  counter-increment: top-item;
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 5px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  font-family: var(--font-sans);
  font-size: 0.78rem;
  color: var(--text-secondary);
  line-height: 1.4;
}

.top-list li:last-child {
  border-bottom: none;
}

.top-list li::before {
  content: counter(top-item) ".";
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 0.82rem;
  color: var(--cyan);
  min-width: 22px;
  flex-shrink: 0;
  opacity: 0.8;
}

.top-list-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.top-list-count {
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: 0.78rem;
  color: var(--orange);
  flex-shrink: 0;
  min-width: 30px;
  text-align: right;
}

/* Full-width insight card */
.insights-card-full {
  grid-column: 1 / -1;
}

/* Chart controls wrapper */
.chart-controls {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
  flex-shrink: 0;
}

.chart-average-toggle {
  margin-left: 2px;
}

/* Chart toggle buttons */
.chart-toggle {
  display: flex;
  gap: 3px;
  flex-shrink: 0;
}

.chart-toggle-btn {
  padding: 2px 10px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: transparent;
  color: var(--text-muted);
  font-family: var(--font-sans);
  font-size: 0.68rem;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
}

.chart-toggle-btn:hover {
  border-color: rgba(0, 229, 255, 0.3);
  color: var(--text-secondary);
}

.chart-toggle-btn.active {
  background: rgba(0, 229, 255, 0.12);
  border-color: rgba(0, 229, 255, 0.4);
  color: var(--text-primary);
}

/* By-justice card controls */
.byjustice-controls {
  display: flex;
  gap: 6px;
  padding: 8px 14px 4px;
}

.byjustice-controls select {
  flex: 1;
  padding: 5px 8px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-secondary);
  font-family: var(--font-sans);
  font-size: 0.72rem;
  cursor: pointer;
  transition: var(--transition);
}

.byjustice-controls select:hover,
.byjustice-controls select:focus {
  border-color: rgba(0, 229, 255, 0.4);
  outline: none;
}

/* Clickable top list items */
.top-list li {
  cursor: pointer;
  transition: background 0.15s ease;
  border-radius: 4px;
  padding: 5px 4px;
}

.top-list li:hover {
  background: rgba(0, 229, 255, 0.08);
}

/* ======================== SCROLLBAR ======================== */

::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(0, 229, 255, 0.2);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 229, 255, 0.35);
}

/* ======================== RESPONSIVE ======================== */

/* Close button for mobile sidebar — hidden on desktop */
.close-mobile-sidebar-btn {
  display: none;
}

/* 1200px breakpoint removed — default is 2-column grid */

@media (max-width: 992px) {
  .sidebar {
    flex: 0 0 260px;
  }

  .container {
    max-width: 95%;
  }
}

@media (max-width: 768px) {

  /* ── No-scroll viewport ── */
  body {
    height: 100vh;
    height: 100dvh;
    min-height: 0;
    overflow: hidden;
  }

  body.menu-open {
    overflow: hidden;
  }

  /* ── Header ── */
  .site-header {
    width: 100%;
    padding: 8px 44px 4px 44px;
    flex-shrink: 0;
  }

  .site-subtitle {
    font-size: 0.75rem;
    margin-top: -4px;
    overflow: visible;
    text-overflow: clip;
  }

  .subtitle-url {
    display: none;
  }

  .site-update-notice {
    font-size: 0.68rem;
    margin-top: -2px;
  }

  /* ── Hamburger + Home + Filter buttons ── */
  .hamburger-menu {
    top: 6px;
    right: 8px;
  }

  .menu-toggle-btn {
    width: 32px;
    height: 32px;
    font-size: 0.9rem;
  }

  .filter-toggle-fixed {
    display: block;
    top: 6px;
    left: 8px;
  }

  .filter-toggle-btn {
    width: 32px;
    height: 32px;
    font-size: 0.9rem;
    border-radius: 50%;
  }

  .home-btn-fixed {
    top: 6px !important;
    right: 48px !important; /* 8px + 32px btn + 8px gap — hamburger stays outer-right */
  }

  .home-btn-fixed a {
    width: 32px !important;
    height: 32px !important;
    font-size: 0.9rem !important;
    border-radius: 50% !important;
  }

  /* ── Sidebar → mobile slide-out overlay ── */
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 300px;
    max-width: 85vw;
    height: 100vh;
    height: 100dvh;
    z-index: 2000;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    background: rgba(12, 17, 31, 0.98);
    backdrop-filter: blur(15px);
    border-right: 1px solid var(--cyan-dim);
    flex: none;
  }

  .sidebar.mobile-open {
    transform: translateX(0);
  }

  .close-mobile-sidebar-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    position: absolute;
    top: 12px;
    right: 12px;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 6px 10px;
    z-index: 10;
  }

  .close-mobile-sidebar-btn:hover {
    color: var(--text-primary);
  }

  .slide-menu-overlay {
    display: none;
  }

  .slide-menu-overlay.active {
    display: block;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.55);
    z-index: 1999;
    backdrop-filter: blur(2px);
  }

  /* ── Main container ── */
  .main-view-container {
    height: auto;
    flex: 1;
    min-height: 0;
  }

  .container {
    max-width: 100%;
    width: 96%;
    display: flex;
    flex-direction: column;
    min-height: 0;
    padding-bottom: 0;
  }

  /* ── View nav tabs ── */
  .view-nav-btn {
    font-size: 0.9rem;
    padding: 10px 14px;
  }

  /* ── Sort bar ── */
  .sort-bar {
    padding: 8px 10px;
    gap: 4px;
  }

  .sort-label {
    font-size: 0.78rem;
  }

  .sort-mode-btn {
    font-size: 0.75rem;
    padding: 4px 10px;
  }

  /* Hide the badge legend on mobile — it's already shown on each card */
  .sort-bar .citation-badge {
    display: none;
  }

  .sort-bar-spacer {
    display: none;
  }

  /* ── Citation cards — Database tab ── */
  .citations-list {
    padding: 6px 8px;
    gap: 5px;
  }

  .citation-card {
    flex-direction: column;
  }

  .citation-rank-col {
    width: auto;
    padding: 4px 10px 0;
    justify-content: flex-start;
    flex-direction: row;
    gap: 6px;
  }

  .rank-badge {
    font-size: 0.78rem;
    min-width: auto;
  }

  .rank-badge::before {
    content: "#";
  }

  .citation-color-bar {
    width: 100%;
    height: 3px;
    border-radius: var(--radius) var(--radius) 0 0;
  }

  .citation-body {
    padding: 6px 10px 8px;
  }

  .citation-row-top {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }

  .citation-bluebook {
    font-size: 0.82rem;
    white-space: normal;
    line-height: 1.4;
  }

  .citation-meta {
    width: 100%;
    justify-content: flex-start;
    gap: 8px;
    min-width: 0;
  }

  .citation-badge {
    font-size: 0.72rem;
  }

  /* ── Instance columns (Most Recent mode) ── */
  .citation-instance-cols {
    width: 100%;
    flex-direction: row;
    padding: 5px 10px;
    gap: 4px;
    border-right: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  }

  .instance-row-top {
    flex: 1;
  }

  .instance-row-bottom {
    flex: 1;
  }

  .instance-btn {
    font-size: 0.65rem;
    padding: 2px 6px;
  }

  /* ── Pagination — touch-friendly ── */
  .pagination {
    padding: 10px 8px;
    gap: 4px;
  }

  .page-btn {
    width: 38px;
    height: 38px;
    min-width: 38px;
    font-size: 0.82rem;
  }

  /* ── Insights tab ── */
  .insights-container {
    padding: 10px;
    gap: 14px;
  }

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

  .insights-card-header {
    flex-direction: column;
    gap: 6px;
    padding: 10px 12px 8px;
  }

  .insights-card-header h3 {
    white-space: normal;
    font-size: 0.8rem;
    line-height: 1.3;
  }

  .time-filter {
    align-self: flex-start;
  }

  /* ── Chart ── */
  .chart-wrapper {
    height: 200px;
    padding: 6px 6px 0;
  }

  .chart-controls {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }

  .chart-click-hint {
    display: none;
  }

  /* Hide the entire trend chart section and its modal on mobile */
  .insights-chart-section,
  #trend-chart-modal {
    display: none !important;
  }

  /* ── Spotlight ── */
  .spotlight-tab {
    font-size: 0.7rem;
    padding: 8px 10px;
  }

  .spotlight-filters {
    padding: 8px 10px;
    width: 100%;
    box-sizing: border-box;
  }

  .spotlight-filters-row {
    flex-direction: column;
    gap: 6px;
    width: 100%;
  }

  .spotlight-select {
    min-width: 100%;
    width: 100%;
    box-sizing: border-box;
  }

  .spotlight-sliders-row {
    flex-direction: column;
    gap: 8px;
  }

  .spotlight-slider-group {
    min-width: 100%;
  }

  /* ── Footer ── */
  .footer {
    padding: 6px 12px;
    line-height: 1.4;
    flex-shrink: 0;
  }

  .footer-full {
    display: none;
  }

  .footer-compact {
    display: inline;
  }
}

@media (max-width: 480px) {
  .site-header {
    padding: 6px 42px 4px 42px;
  }

  .site-subtitle {
    font-size: 0.65rem;
  }

  .site-update-notice {
    font-size: 0.6rem;
  }

  .view-nav-btn {
    font-size: 0.8rem;
    padding: 8px 10px;
  }

  .sort-mode-btn {
    font-size: 0.72rem;
    padding: 3px 8px;
  }

  .sort-mode-btn i {
    display: none;
  }

  .citation-bluebook {
    font-size: 0.78rem;
  }

  .citation-meta {
    gap: 4px;
  }

  .instance-btn {
    font-size: 0.6rem;
    padding: 1px 4px;
  }

  .page-btn {
    width: 34px;
    height: 34px;
    min-width: 34px;
    font-size: 0.78rem;
  }

  .chart-wrapper {
    height: 180px;
  }

  .insights-card-header h3 {
    font-size: 0.75rem;
  }
}

/* ======================== ABOUT MODAL ======================== */

.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 5000;
}

.modal.active {
  display: block;
}

.modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
}

.modal-content {
  position: relative;
  width: 90%;
  max-width: 900px;
  max-height: 85vh;
  margin: 5vh auto;
  background: rgba(0, 0, 30, 0.95);
  border: 1px solid rgba(0, 229, 255, 0.25);
  border-radius: var(--radius);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6), 0 0 30px rgba(0, 229, 255, 0.1);
  overflow: hidden;
  animation: fadeIn 0.25s ease;
}

.close-modal-btn {
  position: absolute;
  top: 14px;
  right: 14px;
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.6);
  font-size: 1.2rem;
  cursor: pointer;
  z-index: 10;
  transition: var(--transition);
  padding: 4px 8px;
}

.close-modal-btn:hover {
  color: #fff;
}

.chart-modal-content {
  width: min(96vw, 1180px);
  max-width: 1180px;
  max-height: 92vh;
  padding: 28px 24px 24px;
  background: linear-gradient(135deg, rgba(0, 229, 255, 0.06), rgba(255, 140, 66, 0.03));
  background-color: var(--bg-navy);
  border-color: rgba(0, 229, 255, 0.2);
  font-family: var(--font-serif);
}

.chart-modal-header {
  margin-bottom: 14px;
  padding-right: 36px;
}

.chart-modal-header h2 {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  color: #fff;
  font-family: var(--font-serif);
  font-size: clamp(1.25rem, 2vw, 1.7rem);
  font-weight: 600;
}

.chart-modal-header h2 i {
  color: var(--cyan);
}

.chart-modal-subtitle {
  margin: 8px 0 0;
  color: var(--text-muted);
  font-family: var(--font-serif);
  font-size: 0.82rem;
}

.chart-modal-wrapper {
  position: relative;
  height: min(68vh, 720px);
  min-height: 380px;
  padding: 8px 6px 0;
}

.chart-modal-wrapper canvas {
  cursor: default;
}

.about-container {
  display: flex;
  max-width: 900px;
  margin: 0 auto;
  padding: 30px;
  overflow: hidden;
  align-items: stretch;
  max-height: 80vh;
}

.about-sidebar {
  width: 240px;
  flex-shrink: 0;
  padding-right: 30px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.profile-image {
  width: 160px;
  height: 160px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid rgba(255, 255, 255, 0.2);
  margin-bottom: 16px;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

.about-heading {
  font-family: var(--font-sans);
  font-weight: 700;
  color: #fff;
  margin-bottom: 10px;
  text-align: center;
  font-size: 1rem;
}

.about-sidebar .about-text {
  text-align: center;
}

.about-text {
  font-family: 'Cormorant Garamond', 'EB Garamond', serif;
  font-size: 14px;
  line-height: 1.6;
  color: rgba(255, 255, 255, 0.9);
  margin-bottom: 15px;
}

.about-text a {
  color: var(--cyan);
}

.about-text a:hover {
  color: var(--orange);
}

.about-text em {
  color: rgba(255, 255, 255, 0.95);
}

.about-content {
  flex: 1;
  overflow-y: auto;
  padding: 0 10px 0 20px;
  border-left: 1px solid rgba(255, 255, 255, 0.1);
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.3) transparent;
}

.about-content::-webkit-scrollbar {
  width: 6px;
}

.about-content::-webkit-scrollbar-track {
  background: transparent;
}

.about-content::-webkit-scrollbar-thumb {
  background-color: rgba(255, 255, 255, 0.3);
  border-radius: 3px;
}

.about-subheading {
  font-family: var(--font-sans);
  font-weight: 600;
  color: var(--cyan);
  margin: 10px 0 10px;
  font-size: 18px;
}

.tab-navigation {
  display: flex;
  margin-bottom: 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.tab-button {
  background: transparent;
  border: none;
  color: rgba(255, 255, 255, 0.7);
  padding: 10px 15px;
  font-family: var(--font-sans);
  font-size: 14px;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
}

.tab-button:hover {
  color: rgba(255, 255, 255, 0.95);
}

.tab-button.active {
  color: var(--cyan);
}

.tab-button.active::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 0;
  width: 100%;
  height: 2px;
  background: var(--cyan);
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

.support-button {
  display: inline-flex;
  align-items: center;
  color: white;
  border: none;
  border-radius: 20px;
  padding: 10px 20px;
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
  margin-top: 12px;
}

.support-button:hover {
  transform: translateY(-2px);
  color: white;
}

.support-button i {
  margin-right: 8px;
  font-size: 16px;
}

.cv-button {
  background: linear-gradient(135deg, #003366, #0066cc);
  box-shadow: 0 4px 10px rgba(0, 102, 204, 0.3);
}

.cv-button:hover {
  box-shadow: 0 6px 15px rgba(0, 102, 204, 0.4);
}

.cv-download {
  margin-top: 25px;
  padding: 15px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 8px;
  text-align: center;
}

/* Modal responsive */
@media (max-width: 768px) {
  .about-container {
    flex-direction: column;
    padding: 16px;
    max-height: none;
  }

  .about-sidebar {
    width: 100%;
    padding-right: 0;
    padding-bottom: 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    margin-bottom: 12px;
  }

  .profile-image {
    width: 90px;
    height: 90px;
  }

  .about-content {
    border-left: none;
    padding: 0;
    max-height: 50vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .modal-content {
    width: 95%;
    max-width: none;
    max-height: 90vh;
    margin: 3vh auto;
  }

  .chart-modal-content {
    width: 98vw;
    padding: 16px 10px 10px;
  }

  .chart-modal-header {
    margin-bottom: 8px;
    padding-right: 30px;
  }

  .chart-modal-header h2 {
    font-size: 1rem;
  }

  .chart-modal-subtitle {
    font-size: 0.72rem;
  }

  .chart-modal-wrapper {
    height: 52vh;
    min-height: 260px;
    padding: 4px 0 0;
  }

  .tab-navigation {
    justify-content: center;
  }

  .tab-button {
    font-size: 13px;
    padding: 8px 12px;
  }
}

/* ======================== LOADING STATE ======================== */

.loading-spinner {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 200px;
  color: var(--text-muted);
  font-family: var(--font-serif);
  font-size: 1rem;
}

/* ======================== EMPTY STATE ======================== */

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 200px;
  color: var(--text-muted);
  font-family: var(--font-serif);
  gap: 8px;
}

.empty-state i {
  font-size: 2rem;
  opacity: 0.4;
}

.empty-state span {
  font-size: 0.95rem;
}
