/* Import elegant serif fonts for blackbox theme */
@import url('https://fonts.googleapis.com/css2?family=Instrument+Serif:ital@0;1&family=EB+Garamond:ital,wght@0,400;0,500;0,600;0,700;1,400;1,500;1,600&family=Crimson+Pro:ital,wght@0,300;0,400;0,600;1,300;1,400&display=swap');

:root {
  /* Pure Black & White Palette */
  --pure-black: #000000;
  --pure-white: #ffffff;
  --off-white: #f8f8f8;
  --light-gray: #e8e8e8;
  --mid-gray: #666666;
  --dark-gray: #1a1a1a;
  
  /* Text colors */
  --text-primary: #ffffff;
  --text-secondary: #000000;
  --text-muted: #888888;
  --text-light: #cccccc;
  
  /* Neumorphic shadows */
  --shadow-neumorphic: 8px 8px 24px rgba(0, 0, 0, 0.25), -8px -8px 24px rgba(255, 255, 255, 0.05);
  --shadow-soft: 0 8px 24px rgba(0, 0, 0, 0.15);
  --shadow-hover: 0 12px 32px rgba(0, 0, 0, 0.2);
  --shadow-inset: inset 4px 4px 12px rgba(0, 0, 0, 0.3), inset -4px -4px 12px rgba(255, 255, 255, 0.05);
  
  /* Borders */
  --border-light: rgba(255, 255, 255, 0.15);
  --border-dark: rgba(0, 0, 0, 0.2);
  
  /* Backgrounds */
  --bg-primary: #000000;
  --bg-secondary: #0a0a0a;
  --bg-card: #1a1a1a;
  --bg-hover: #222222;
  
  /* Radius */
  --radius-sm: 16px;
  --radius: 20px;
  --radius-lg: 28px;
  --radius-pill: 999px;
}

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

body {
  font-family: 'EB Garamond', 'Crimson Pro', Georgia, serif;
  background: linear-gradient(135deg, #000000 0%, #0a0a0a 50%, #000000 100%);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.7;
  padding: 0 1.25rem 3rem;
  position: relative;
  overflow-x: hidden;
  font-size: 17px;
  animation: fadeIn 0.6s ease-out;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: radial-gradient(circle at 50% 50%, rgba(255, 255, 255, 0.03) 0%, transparent 50%);
  z-index: -1;
  pointer-events: none;
}

/* Remove matrix rain canvas */
.bg-animation,
#matrix-canvas {
  display: none;
}

/* Topbar */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.5rem 0.5rem 1rem;
  gap: 1rem;
  animation: slideDown 0.5s ease-out;
}

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

.brand-block {
  display: inline-flex;
  align-items: center;
  gap: 0.85rem;
  transition: transform 0.3s ease;
}

.brand-block:hover {
  transform: translateX(4px);
}

.logo-badge {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--bg-card);
  border: 2px solid var(--border-light);
  color: var(--text-primary);
  font-family: 'Instrument Serif', serif;
  font-weight: 700;
  font-size: 1.1rem;
  display: grid;
  place-items: center;
  box-shadow: var(--shadow-neumorphic);
  letter-spacing: 0.5px;
  transition: all 0.3s ease;
}

.logo-badge:hover {
  box-shadow: var(--shadow-hover);
  transform: scale(1.05);
}

.brand-text {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.brand-name {
  font-family: 'Instrument Serif', serif;
  font-size: 1.65rem;
  font-weight: 600;
  letter-spacing: 0.5px;
  font-style: italic;
}

.brand-sub {
  font-size: 0.95rem;
  color: var(--text-muted);
  font-style: italic;
  letter-spacing: 0.3px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.ghost-link,
.theme-toggle {
  border: 1.5px solid var(--border-light);
  background: var(--bg-card);
  color: var(--text-primary);
  padding: 0.65rem 1.2rem;
  border-radius: var(--radius-pill);
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: 'EB Garamond', serif;
  font-weight: 600;
  font-size: 1rem;
  text-decoration: none;
  box-shadow: var(--shadow-soft);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
  letter-spacing: 0.3px;
}

.ghost-link:hover,
.theme-toggle:hover {
  background: var(--bg-hover);
  border-color: var(--text-primary);
  transform: translateY(-2px) scale(1.02);
  box-shadow: var(--shadow-hover);
}

.ghost-link:active,
.theme-toggle:active {
  transform: translateY(0) scale(0.98);
  box-shadow: var(--shadow-inset);
}

/* Hero Section */
.hero {
  max-width: 1100px;
  margin: 2rem auto 2.5rem;
  text-align: center;
  padding: 2rem 1rem;
  animation: fadeInUp 0.7s ease-out 0.2s both;
}

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

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 3px;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 0.8rem;
  font-family: 'EB Garamond', serif;
  font-weight: 500;
}

.headline {
  font-family: 'Instrument Serif', serif;
  font-size: clamp(2.5rem, 5vw, 4rem);
  line-height: 1.15;
  margin: 0 0 1.2rem;
  letter-spacing: 0.5px;
  font-weight: 600;
  font-style: italic;
}

.tagline {
  color: var(--text-light);
  font-size: 1.1rem;
  margin: 0.6rem auto 2rem;
  max-width: 700px;
  font-style: italic;
  line-height: 1.6;
}

.track-buttons {
  display: flex;
  justify-content: center;
  gap: 1.2rem;
  flex-wrap: wrap;
  margin: 2rem 0 1rem;
}

.track-card {
  min-width: 200px;
  padding: 1.1rem 2rem;
  border-radius: var(--radius-lg);
  border: 2px solid var(--border-light);
  background: var(--bg-card);
  box-shadow: var(--shadow-neumorphic);
  color: var(--text-primary);
  font-family: 'Instrument Serif', serif;
  font-weight: 600;
  font-size: 1.15rem;
  letter-spacing: 0.5px;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.track-card::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  transform: translate(-50%, -50%);
  transition: width 0.6s, height 0.6s;
}

.track-card:hover::before {
  width: 300px;
  height: 300px;
}

.track-card:hover {
  transform: translateY(-3px) scale(1.02);
  box-shadow: var(--shadow-hover);
  border-color: var(--text-primary);
}

.track-card:active {
  transform: translateY(0) scale(0.98);
  box-shadow: var(--shadow-inset);
}

.track-card.active {
  background: var(--text-primary);
  color: var(--pure-black);
  border-color: var(--text-primary);
  box-shadow: 0 8px 32px rgba(255, 255, 255, 0.2);
}

/* Filters Panel */
.filters-panel {
  max-width: 1100px;
  margin: 0 auto 2rem;
  padding: 1.5rem 1.5rem;
  border-radius: var(--radius-lg);
  background: var(--bg-card);
  border: 2px solid var(--border-light);
  box-shadow: var(--shadow-neumorphic);
  display: none;
  animation: fadeInUp 0.6s ease-out 0.3s both;
}

.filters-header {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  margin-bottom: 1.2rem;
  flex-wrap: wrap;
}

.filters-header h2 {
  margin: 0;
  font-family: 'Instrument Serif', serif;
  font-size: 1.4rem;
  font-weight: 600;
  font-style: italic;
}

.filters-header p {
  margin: 0;
  color: var(--text-muted);
  font-size: 1rem;
  font-style: italic;
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.pill {
  width: 56px;
  height: 56px;
  border: 2px solid var(--border-light);
  background: var(--bg-secondary);
  color: var(--text-light);
  border-radius: var(--radius);
  cursor: pointer;
  font-family: 'Instrument Serif', serif;
  font-weight: 600;
  font-size: 1.1rem;
  display: grid;
  place-items: center;
  box-shadow: var(--shadow-soft);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
}

.pill:hover {
  transform: translateY(-3px) scale(1.05);
  box-shadow: var(--shadow-hover);
  border-color: var(--text-primary);
  background: var(--bg-hover);
}

.pill:active {
  transform: translateY(0) scale(0.95);
  box-shadow: var(--shadow-inset);
}

.pill.active {
  background: var(--text-primary);
  color: var(--pure-black);
  border-color: var(--text-primary);
  box-shadow: 0 8px 24px rgba(255, 255, 255, 0.25);
  transform: scale(1.05);
}

.pill.active::after {
  content: '✓';
  position: absolute;
  top: -8px;
  right: -8px;
  width: 20px;
  height: 20px;
  background: var(--text-primary);
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 0.7rem;
  color: var(--pure-black);
  box-shadow: 0 4px 12px rgba(255, 255, 255, 0.3);
}

/* Subjects Panel */
.subjects-panel {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 0.5rem;
  animation: fadeInUp 0.6s ease-out 0.4s both;
}

.subjects-header h3 {
  margin: 0 0 0.4rem;
  font-family: 'Instrument Serif', serif;
  font-size: 1.8rem;
  font-weight: 600;
  font-style: italic;
}

.subjects-header p {
  margin: 0 0 1.5rem;
  color: var(--text-muted);
  font-size: 1.05rem;
  font-style: italic;
}

.subject-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.2rem;
}

.subject-card {
  border-radius: var(--radius-lg);
  padding: 1.5rem 1.3rem;
  border: 2px solid var(--border-light);
  background: var(--bg-card);
  box-shadow: var(--shadow-neumorphic);
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  min-height: 190px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  animation: cardFadeIn 0.5s ease-out both;
}

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

.subject-card:nth-child(1) { animation-delay: 0.1s; }
.subject-card:nth-child(2) { animation-delay: 0.15s; }
.subject-card:nth-child(3) { animation-delay: 0.2s; }
.subject-card:nth-child(4) { animation-delay: 0.25s; }
.subject-card:nth-child(5) { animation-delay: 0.3s; }
.subject-card:nth-child(6) { animation-delay: 0.35s; }

.subject-card:hover {
  transform: translateY(-5px) scale(1.02);
  box-shadow: var(--shadow-hover);
  border-color: var(--text-primary);
}

.subject-card .code {
  font-family: 'EB Garamond', serif;
  letter-spacing: 1px;
  color: var(--text-muted);
  margin: 0;
  font-size: 0.9rem;
  text-transform: uppercase;
  font-weight: 600;
}

.subject-card h3 {
  margin: 0;
  font-family: 'Instrument Serif', serif;
  font-size: 1.3rem;
  line-height: 1.3;
  font-weight: 600;
  font-style: italic;
}

.subject-card .meta,
.subject-card .info {
  margin: 0;
  color: var(--text-light);
  font-size: 0.95rem;
  font-style: italic;
}

.subject-card .info {
  font-size: 0.9rem;
  line-height: 1.5;
}

.card-actions {
  margin-top: auto;
  padding-top: 0.5rem;
}

.ghost-btn {
  border: 2px solid var(--border-light);
  background: transparent;
  color: var(--text-primary);
  padding: 0.7rem 1.5rem;
  border-radius: var(--radius-pill);
  font-family: 'EB Garamond', serif;
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  width: 100%;
  position: relative;
  overflow: hidden;
}

.ghost-btn::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: var(--text-primary);
  transform: translate(-50%, -50%);
  transition: width 0.5s, height 0.5s;
}

.ghost-btn:hover::before {
  width: 300px;
  height: 300px;
}

.ghost-btn:hover {
  background: var(--text-primary);
  color: var(--pure-black);
  border-color: var(--text-primary);
  transform: scale(1.02);
}

.ghost-btn:active {
  transform: scale(0.98);
  box-shadow: var(--shadow-inset);
}

.empty-state {
  text-align: center;
  color: var(--text-muted);
  padding: 3rem 1rem;
  font-family: 'Instrument Serif', serif;
  font-size: 1.2rem;
  font-style: italic;
}

/* Footer */
.footer {
  max-width: 1100px;
  margin: 4rem auto 2rem;
  text-align: center;
  color: var(--text-muted);
  font-size: 1rem;
  padding: 2rem 1rem 1rem;
  border-top: 1px solid var(--border-light);
}

.footer-links {
  display: flex;
  justify-content: center;
  gap: 2rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.footer a {
  color: var(--text-light);
  text-decoration: none;
  font-family: 'EB Garamond', serif;
  font-weight: 600;
  font-size: 1.05rem;
  transition: all 0.3s ease;
  position: relative;
}

.footer a::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--text-primary);
  transition: width 0.3s ease;
}

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

.footer a:hover::after {
  width: 100%;
}

.footer-note {
  margin: 0;
  font-style: italic;
  letter-spacing: 0.5px;
}

/* Subject Page Specifics */
.page-shell {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1.5rem 0.5rem 3rem;
  animation: fadeInUp 0.6s ease-out;
}

.subject-title {
  font-family: 'Instrument Serif', serif;
  font-size: clamp(2.5rem, 5vw, 3.5rem);
  margin: 1rem 0 0.5rem;
  font-weight: 600;
  font-style: italic;
  line-height: 1.2;
}

.meta {
  color: var(--text-muted);
  font-size: 1.05rem;
  font-style: italic;
  margin-bottom: 2rem;
}

.section-card {
  margin-top: 1.5rem;
  padding: 1.8rem 1.5rem;
  border-radius: var(--radius-lg);
  background: var(--bg-card);
  border: 2px solid var(--border-light);
  box-shadow: var(--shadow-neumorphic);
  animation: cardFadeIn 0.5s ease-out both;
}

.section-card:nth-child(1) { animation-delay: 0.1s; }
.section-card:nth-child(2) { animation-delay: 0.2s; }
.section-card:nth-child(3) { animation-delay: 0.3s; }

.section-card h2,
.section-card h3 {
  margin-top: 0;
  margin-bottom: 1rem;
  font-family: 'Instrument Serif', serif;
  font-weight: 600;
  font-style: italic;
  font-size: 1.6rem;
}

.section-card h3 {
  font-size: 1.3rem;
}

.table {
  width: 100%;
  overflow-x: auto;
  margin-top: 1rem;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-family: 'EB Garamond', serif;
}

table thead {
  background: var(--bg-secondary);
  border-bottom: 2px solid var(--border-light);
}

table th {
  padding: 1rem 0.75rem;
  text-align: left;
  font-weight: 600;
  font-size: 1.05rem;
  color: var(--text-primary);
  letter-spacing: 0.5px;
}

table td {
  padding: 0.9rem 0.75rem;
  text-align: left;
  border-bottom: 1px solid var(--border-light);
  color: var(--text-light);
}

table tbody tr {
  transition: background 0.2s ease;
}

table tbody tr:hover {
  background: var(--bg-hover);
}

.resource-link {
  color: var(--text-primary);
  font-weight: 600;
  text-decoration: none;
  transition: all 0.2s ease;
  position: relative;
  padding-bottom: 2px;
}

.resource-link::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 0;
  height: 1px;
  background: var(--text-primary);
  transition: width 0.3s ease;
}

.resource-link:hover {
  color: var(--text-primary);
}

.resource-link:hover::after {
  width: 100%;
}

.info ul {
  padding-left: 1.5rem;
  line-height: 1.8;
}

.info ul li {
  margin-bottom: 0.5rem;
  color: var(--text-light);
}

/* PDF Preview Modal */
.pdf-preview-modal {
  display: none;
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.95);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(10px);
}

.pdf-preview-modal.show {
  display: flex;
  animation: fadeIn 0.3s ease-out;
}

.pdf-preview-container {
  width: 90%;
  height: 90%;
  background: var(--bg-card);
  border: 2px solid var(--border-light);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  animation: scaleIn 0.3s ease-out;
}

@keyframes scaleIn {
  from {
    transform: scale(0.9);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

.pdf-preview-header {
  padding: 1.2rem 1.5rem;
  border-bottom: 2px solid var(--border-light);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--bg-secondary);
}

.pdf-preview-header h3 {
  color: var(--text-primary);
  font-family: 'Instrument Serif', serif;
  font-size: 1.3rem;
  font-weight: 600;
  font-style: italic;
  margin: 0;
}

.pdf-close-btn {
  background: transparent;
  border: 2px solid var(--border-light);
  color: var(--text-primary);
  padding: 0.6rem 1.2rem;
  border-radius: var(--radius-pill);
  font-family: 'EB Garamond', serif;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
}

.pdf-close-btn:hover {
  background: var(--text-primary);
  color: var(--pure-black);
  border-color: var(--text-primary);
  transform: scale(1.05);
}

.pdf-viewer {
  flex: 1;
  background: var(--pure-black);
}

.pdf-viewer iframe {
  width: 100%;
  height: 100%;
  border: none;
}

/* Responsive Design */
@media (max-width: 768px) {
  body {
    font-size: 16px;
    padding: 0 1rem 2rem;
  }
  
  .topbar {
    flex-direction: column;
    align-items: flex-start;
    padding: 1rem 0.5rem;
  }
  
  .header-actions {
    align-self: flex-end;
    width: 100%;
    justify-content: flex-end;
  }
  
  .hero {
    padding: 1.5rem 0.5rem;
    margin: 1rem auto 1.5rem;
  }
  
  .headline {
    font-size: clamp(2rem, 8vw, 2.5rem);
  }
  
  .track-card {
    width: 100%;
    min-width: unset;
  }
  
  .filters-panel {
    padding: 1.2rem 1rem;
  }
  
  .pill {
    width: 52px;
    height: 52px;
    font-size: 1rem;
  }
  
  .subjects-panel {
    padding: 0 0.25rem;
  }
  
  .subject-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
  
  .subject-card {
    padding: 1.2rem 1rem;
  }
  
  .footer {
    margin: 3rem auto 1.5rem;
    padding: 1.5rem 0.5rem 0.5rem;
  }
  
  .footer-links {
    gap: 1.5rem;
  }
  
  .page-shell {
    padding: 1rem 0.5rem 2rem;
  }
  
  .section-card {
    padding: 1.2rem 1rem;
  }
  
  .pdf-preview-container {
    width: 95%;
    height: 95%;
  }
}

@media (max-width: 480px) {
  .brand-name {
    font-size: 1.4rem;
  }
  
  .logo-badge {
    width: 42px;
    height: 42px;
    font-size: 1rem;
  }
  
  .ghost-link,
  .theme-toggle {
    padding: 0.55rem 1rem;
    font-size: 0.95rem;
  }
  
  .filters-header {
    flex-direction: column;
    gap: 0.5rem;
  }
  
  .chip-row {
    gap: 0.6rem;
  }
  
  .pill {
    width: 48px;
    height: 48px;
  }
}

