/* COURT INDEX // EPISODE 3 // GLOBAL STYLES */
@import url('https://fonts.googleapis.com/css2?family=Anton&family=Rubik:wght@300;400;500;700&display=swap');

/* View Transitions for 3D Flipbook Page Turn Effect */
@media (prefers-reduced-motion: no-preference) {
  ::view-transition-old(root) {
    animation: 0.6s cubic-bezier(0.4, 0, 0.2, 1) both book-flip-out;
    transform-origin: left center;
    backface-visibility: hidden;
  }
  ::view-transition-new(root) {
    animation: 0.6s cubic-bezier(0.4, 0, 0.2, 1) both book-flip-in;
    transform-origin: left center;
    backface-visibility: hidden;
  }
}

@keyframes book-flip-out {
  from {
    transform: perspective(1500px) rotateY(0deg);
    opacity: 1;
  }
  to {
    transform: perspective(1500px) rotateY(-90deg);
    opacity: 0.3;
  }
}

@keyframes book-flip-in {
  from {
    transform: perspective(1500px) rotateY(90deg);
    opacity: 0.3;
  }
  to {
    transform: perspective(1500px) rotateY(0deg);
    opacity: 1;
  }
}

:root {
  /* Color Strategy: Committed - Black Drenched (OKLCH) */
  --bg-primary: oklch(6% 0.008 265);
  --bg-surface: oklch(10% 0.01 265);
  --bg-surface-raised: oklch(14% 0.015 265);
  --text-primary: oklch(92% 0.005 265);
  --text-muted: oklch(70% 0.01 265);
  
  /* Accents */
  --accent-cyan: oklch(72% 0.17 195);
  --accent-cyan-glow: oklch(72% 0.17 195 / 0.2);
  --accent-amber: oklch(68% 0.16 48);
  --accent-amber-glow: oklch(68% 0.16 48 / 0.2);
  --accent-silver: oklch(80% 0.02 265);
  --border-hairline: oklch(80% 0.02 265 / 0.15);
  
  /* Layout */
  --container-max-width: 1200px;
  --font-display: 'Anton', sans-serif;
  --font-body: 'Rubik', sans-serif;
  
  /* Transitions */
  --transition-smooth: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
  --transition-bounce: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.1);
}

/* Enable Intrinsic Size Height Transitions */
@supports (interpolate-size: allow-keywords) {
  :root {
    interpolate-size: allow-keywords;
  }
}

/* Base Styles */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background-color: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-weight: 400;
  line-height: 1.7;
  overflow-x: hidden;
  position: relative;
  min-height: 100vh;
}

/* Background Canvas */
.canvas-particle-background {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: -1;
  pointer-events: none;
}

/* Scrollbar styling */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: var(--bg-primary);
}
::-webkit-scrollbar-thumb {
  background: var(--bg-surface-raised);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--accent-cyan);
}

/* Typography & Headers */
h1, h2, h3, h4, h5 {
  font-family: var(--font-display);
  letter-spacing: 0.02em;
  line-height: 1.1;
}

h1 {
  font-size: clamp(2.5rem, 6.5vw, 6rem);
  text-transform: uppercase;
}

h2 {
  font-size: clamp(1.8rem, 4vw, 3.2rem);
  text-transform: uppercase;
  margin-bottom: 1.5rem;
}

h3 {
  font-size: 1.5rem;
  margin-bottom: 1rem;
}

p {
  max-width: 70ch;
  margin-bottom: 1.5rem;
  font-size: 1.05rem;
  font-weight: 300;
}

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

.highlight-cyan {
  color: var(--accent-cyan);
}

.highlight-amber {
  color: var(--accent-amber);
}

/* Layout Containers */
.wrapper {
  max-width: var(--container-max-width);
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

header {
  border-bottom: 1px solid var(--border-hairline);
  padding: 1.5rem 0;
  margin-bottom: 3rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: relative;
  z-index: 10;
}

.logo {
  font-family: var(--font-display);
  font-size: 1.8rem;
  text-decoration: none;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.logo span {
  color: var(--accent-cyan);
}

.nav-links {
  display: flex;
  gap: 1.5rem;
  list-style: none;
  align-items: center;
}

.nav-links a {
  text-decoration: none;
  color: var(--text-muted);
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  transition: var(--transition-smooth);
}

.nav-links a:hover, .nav-links a.active {
  color: var(--accent-cyan);
}

.btn-nav-primary {
  background: var(--bg-surface-raised);
  border: 1px solid var(--accent-cyan);
  padding: 0.5rem 1rem;
  border-radius: 6px;
  color: var(--accent-cyan) !important;
}

.btn-nav-primary:hover {
  background: var(--accent-cyan);
  color: var(--bg-primary) !important;
  box-shadow: 0 0 15px var(--accent-cyan-glow);
}

/* Hero Section */
.hero {
  text-align: center;
  padding: 4rem 0 6rem;
  position: relative;
  z-index: 10;
}

.hero-subtitle {
  font-family: var(--font-body);
  font-size: clamp(1rem, 2.5vw, 1.4rem);
  text-transform: uppercase;
  letter-spacing: 0.3em;
  color: var(--text-muted);
  margin-bottom: 1.5rem;
  display: block;
}

.hero-title-svg {
  width: 100%;
  max-width: 900px;
  height: auto;
  margin: 0 auto;
  display: block;
}

.hero-description {
  margin: 2.5rem auto 0;
  font-size: 1.2rem;
  color: var(--text-muted);
  max-width: 60ch;
}

/* Article / Content Blocks */
.content-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 4rem;
  margin-top: 4rem;
  position: relative;
  z-index: 10;
}

@media (min-width: 900px) {
  .content-grid {
    grid-template-columns: 2.2fr 1fr;
  }
}

.article-body {
  background: var(--bg-surface);
  border: 1px solid var(--border-hairline);
  padding: 2.5rem;
  border-radius: 8px;
}

.article-header {
  margin-bottom: 2rem;
}

.article-meta {
  display: flex;
  gap: 1.5rem;
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-bottom: 1rem;
  letter-spacing: 0.05em;
}

.article-body p {
  margin-bottom: 1.8rem;
  font-size: 1.08rem;
  color: oklch(85% 0.005 265);
}

.article-body strong {
  color: var(--text-primary);
  font-weight: 500;
}

.pullquote {
  border-left: 3px solid var(--accent-cyan);
  padding-left: 1.5rem;
  margin: 2.5rem 0;
  font-size: 1.25rem;
  font-style: italic;
  color: var(--text-primary);
  max-width: 60ch;
}

.pullquote span {
  display: block;
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-top: 0.5rem;
  font-family: var(--font-body);
  font-style: normal;
}

/* Magazine Cards Grid */
.magazine-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 2rem;
  margin-top: 3rem;
  position: relative;
  z-index: 10;
}

.magazine-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-hairline);
  border-radius: 8px;
  overflow: hidden;
  transition: var(--transition-smooth);
  display: flex;
  flex-direction: column;
  text-decoration: none;
  color: inherit;
}

.magazine-card:hover {
  transform: translateY(-5px);
  border-color: var(--accent-cyan);
  box-shadow: 0 10px 25px oklch(0% 0 0 / 0.5);
}

.card-header {
  padding: 1.5rem;
  border-bottom: 1px solid var(--border-hairline);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.card-badge {
  font-family: var(--font-body);
  font-size: 0.75rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 0.25rem 0.6rem;
  border-radius: 4px;
  background: var(--bg-surface-raised);
  color: var(--text-muted);
}

.magazine-card:hover .card-badge {
  color: var(--accent-cyan);
  background: var(--accent-cyan-glow);
}

.card-body {
  padding: 1.5rem;
  flex-grow: 1;
}

.card-title {
  font-size: 1.6rem;
  margin-bottom: 0.5rem;
  color: var(--text-primary);
}

.card-description {
  font-size: 0.95rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.card-footer {
  padding: 1.2rem 1.5rem;
  background: var(--bg-surface-raised);
  border-top: 1px solid var(--border-hairline);
  font-size: 0.85rem;
  font-weight: 500;
  text-transform: uppercase;
  color: var(--accent-cyan);
  letter-spacing: 0.05em;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.card-footer::after {
  content: '→';
  transition: var(--transition-smooth);
}

.magazine-card:hover .card-footer::after {
  transform: translateX(5px);
}

/* Visualizations / Charts Container */
.chart-container {
  background: var(--bg-surface);
  border: 1px solid var(--border-hairline);
  padding: 2rem;
  border-radius: 8px;
  margin-bottom: 3rem;
  position: relative;
  z-index: 10;
  width: 100%;
}

.chart-title {
  margin-bottom: 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.chart-controls {
  display: flex;
  gap: 0.5rem;
}

.chart-btn {
  background: var(--bg-surface-raised);
  border: 1px solid var(--border-hairline);
  color: var(--text-muted);
  padding: 0.4rem 0.8rem;
  border-radius: 4px;
  font-size: 0.85rem;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.chart-btn.active, .chart-btn:hover {
  background: var(--accent-cyan-glow);
  color: var(--accent-cyan);
  border-color: var(--accent-cyan);
}

/* Database Table Styles */
.table-controls {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-bottom: 1.5rem;
  position: relative;
  z-index: 10;
}

@media (min-width: 600px) {
  .table-controls {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
  }
}

.search-wrapper {
  position: relative;
  width: 100%;
  max-width: 350px;
}

.search-input {
  width: 100%;
  background: var(--bg-surface);
  border: 1px solid var(--border-hairline);
  padding: 0.6rem 1rem 0.6rem 2.5rem;
  border-radius: 6px;
  color: var(--text-primary);
  font-family: var(--font-body);
  transition: var(--transition-smooth);
}

.search-input:focus {
  outline: none;
  border-color: var(--accent-cyan);
  box-shadow: 0 0 10px var(--accent-cyan-glow);
}

.search-wrapper::before {
  content: '🔍';
  position: absolute;
  left: 0.8rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.9rem;
  opacity: 0.5;
}

.table-wrapper {
  background: var(--bg-surface);
  border: 1px solid var(--border-hairline);
  border-radius: 8px;
  overflow-x: auto;
  position: relative;
  z-index: 10;
  margin-bottom: 2rem;
}

table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.95rem;
}

th {
  background: var(--bg-surface-raised);
  font-family: var(--font-display);
  font-size: 1rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border-hairline);
  cursor: pointer;
  user-select: none;
  position: relative;
}

th:hover {
  color: var(--accent-cyan);
}

th.sort-asc::after {
  content: ' ▲';
  font-size: 0.7rem;
  color: var(--accent-cyan);
}

th.sort-desc::after {
  content: ' ▼';
  font-size: 0.7rem;
  color: var(--accent-cyan);
}

td {
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border-hairline);
  color: oklch(85% 0.005 265);
}

tr:last-child td {
  border-bottom: none;
}

tr:hover td {
  background: oklch(12% 0.015 265);
}

/* Database Specific styles */
.row-newly-tested {
  background: oklch(12% 0.02 195 / 0.3) !important;
}

.row-newly-tested td:first-child::before {
  content: '✦ ';
  color: var(--accent-cyan);
  font-weight: bold;
}

/* Badge Highlight Rules */
.badge-gold {
  color: var(--accent-amber);
  font-weight: 500;
}

.badge-cyan {
  color: var(--accent-cyan);
  font-weight: 500;
}

.badge-legend {
  color: oklch(62% 0.18 20);
  font-weight: 700;
  text-shadow: 0 0 8px oklch(62% 0.18 20 / 0.3);
}

.tier-bronze {
  color: oklch(65% 0.13 50);
  font-weight: 500;
}

.tier-silver {
  color: oklch(78% 0.02 265);
  font-weight: 500;
}

.tier-gold {
  color: var(--accent-amber);
  font-weight: 500;
}

.tier-hof {
  color: oklch(60% 0.25 310);
  font-weight: 600;
}

.tier-legend {
  color: oklch(62% 0.18 20);
  font-weight: 700;
  text-shadow: 0 0 8px oklch(62% 0.18 20 / 0.3);
}

/* Footers */
footer {
  border-top: 1px solid var(--border-hairline);
  padding: 3rem 0;
  margin-top: 6rem;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.9rem;
  position: relative;
  z-index: 10;
}

footer p {
  margin: 0 auto;
}

/* D3 Tooltip styling */
.d3-tooltip {
  position: absolute;
  text-align: left;
  padding: 0.8rem 1rem;
  font-family: var(--font-body);
  font-size: 0.85rem;
  background: var(--bg-surface-raised);
  border: 1px solid var(--accent-cyan);
  border-radius: 6px;
  pointer-events: none;
  z-index: 100;
  color: var(--text-primary);
  box-shadow: 0 10px 20px oklch(0% 0 0 / 0.5);
  line-height: 1.4;
}

.d3-tooltip h4 {
  font-family: var(--font-display);
  font-size: 1rem;
  margin-bottom: 0.3rem;
  color: var(--accent-cyan);
  text-transform: uppercase;
}

/* Interactive D3 styling elements */
.chart-axis text {
  font-family: var(--font-body);
  font-size: 0.75rem;
  fill: var(--text-muted);
}

.chart-axis path, .chart-axis line {
  stroke: var(--border-hairline);
}

.grid-line {
  stroke: var(--border-hairline);
  stroke-dasharray: 2, 2;
}

/* Accessibility settings */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-delay: 0s !important;
    animation-duration: 0s !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0s !important;
    scroll-behavior: auto !important;
  }
  
  .canvas-particle-background {
    display: none;
  }
}

/* Magazine Pagination styles */
.magazine-pagination {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 5rem 0 3rem;
  border-top: 1px solid var(--border-hairline);
  border-bottom: 1px solid var(--border-hairline);
  padding: 1.5rem 0;
  position: relative;
  z-index: 10;
}

.pag-btn {
  font-family: var(--font-display);
  font-size: 1.1rem;
  text-transform: uppercase;
  color: var(--text-muted);
  text-decoration: none;
  transition: var(--transition-smooth);
  letter-spacing: 0.05em;
}

.pag-btn:hover {
  color: var(--accent-cyan);
  text-shadow: 0 0 10px var(--accent-cyan-glow);
}

.pag-current {
  font-family: var(--font-body);
  font-size: 0.9rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}
