/* =================================
   Web Directory - Public CSS
   Black and white design system
   ================================= */

/* CSS Custom Properties */
:root {
    --white: #FFFFFF;
    --black: #000000;
    --grey-light: #F5F5F5;
    --grey: #AAAAAA;
    --grey-dark: #666666;
    --grey-darker: #333333;
    /* Link Colors - Only colors on the site */
    --primary: #1E40AF; /* Blue for links */
    --primary-hover: #1E3A8A; /* Darker blue for hover */
    /* Backgrounds - Black and white only */
    --bg-primary: #FFFFFF; /* Main background - white */
    --bg-secondary: #F5F5F5; /* Secondary background - light grey */
    --bg-accent: #000000; /* Accent background - black */
    --bg-card: #FFFFFF; /* White cards */
    --bg-card-hover: #F9F9F9; /* Slight grey on hover */
    /* Text colors - Black and white only */
    --text-primary: #000000; /* Main text - black */
    --text-secondary: #333333; /* Secondary text - dark grey */
    --text-light: #FFFFFF; /* Light text for dark backgrounds */
    --text-muted: #666666; /* Muted text - medium grey */
    /* Status Colors - keeping minimal for functionality */
    --success: #22c55e;
    --warning: #f59e0b;
    --error: #ef4444;
    --info: #1E40AF;
    /* Typography */
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-size-xs: 0.75rem;
    --font-size-sm: 0.875rem;
    --font-size-base: 1rem;
    --font-size-lg: 1.125rem;
    --font-size-xl: 1.25rem;
    --font-size-2xl: 1.5rem;
    --font-size-3xl: 1.875rem;
    --font-size-4xl: 2.25rem;
    --font-size-5xl: 3rem;
    /* Line Heights */
    --leading-tight: 1.25;
    --leading-normal: 1.5;
    --leading-relaxed: 1.625;
    /* Spacing Scale */
    --space-1: 0.25rem;
    --space-2: 0.5rem;
    --space-3: 0.75rem;
    --space-4: 1rem;
    --space-5: 1.25rem;
    --space-6: 1.5rem;
    --space-8: 2rem;
    --space-10: 2.5rem;
    --space-12: 3rem;
    --space-16: 4rem;
    --space-20: 5rem;
    --space-24: 6rem;
    /* Border Radius */
    --radius-sm: 0.25rem;
    --radius: 0.5rem;
    --radius-md: 0.75rem;
    --radius-lg: 1rem;
    --radius-xl: 1.5rem;
    /* Shadows - Solid grey for comic book effect */
    --shadow-sm: 2px 2px 0 #A9A9A9;
    --shadow: 4px 4px 0 #A9A9A9;
    --shadow-md: 6px 6px 0 #A9A9A9;
    --shadow-lg: 8px 8px 0 #A9A9A9;
    --shadow-xl: 10px 10px 0 #A9A9A9;
    /* Container Max Widths */
    --container-sm: 640px;
    --container-md: 768px;
    --container-lg: 1024px;
    --container-xl: 1280px;
    --container-2xl: 1536px;
    /* Transitions */
    --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-fast: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Reset and Base Styles */
*, *::before, *::after {
  box-sizing: border-box;
}

* {
  margin: 0;
}

html {
  height: 100%;
  scroll-behavior: smooth;
}

body {
  height: 100%;
  line-height: var(--leading-normal);
  font-family: var(--font-family);
  font-size: var(--font-size-base);
  color: var(--text-primary);
  background: var(--bg-primary);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img, picture, video, canvas, svg {
  display: block;
  max-width: 100%;
}

input, button, textarea, select {
  font: inherit;
}

p, h1, h2, h3, h4, h5, h6 {
  overflow-wrap: break-word;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
  font-weight: 600;
  line-height: var(--leading-tight);
  color: var(--text-secondary);
}

h1 {
  font-size: var(--font-size-3xl);
  margin-bottom: var(--space-6);
}

h2 {
  font-size: var(--font-size-2xl);
  margin-bottom: var(--space-5);
}

h3 {
  font-size: var(--font-size-xl);
  margin-bottom: var(--space-4);
}

h4 {
  font-size: var(--font-size-lg);
  margin-bottom: var(--space-3);
}

p {
  margin-bottom: var(--space-4);
  color: var(--text-primary);
  line-height: var(--leading-relaxed);
}

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

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

/* Container */
.container {
  width: 100%;
  margin-left: auto;
  margin-right: auto;
  padding-left: var(--space-4);
  padding-right: var(--space-4);
}

@media (min-width: 640px) {
  .container {
    max-width: var(--container-sm);
    padding-left: var(--space-6);
    padding-right: var(--space-6);
  }
}

@media (min-width: 768px) {
  .container {
    max-width: var(--container-md);
  }
}

@media (min-width: 1024px) {
  .container {
    max-width: var(--container-lg);
    padding-left: var(--space-8);
    padding-right: var(--space-8);
  }
}

@media (min-width: 1280px) {
  .container {
    max-width: var(--container-xl);
  }
}

/* Header */
.site-header {
  background: var(--white);
  border-bottom: 2px solid var(--grey-dark);
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(10px);
}

.header-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4) 0;
}

.site-logo {
  font-size: var(--font-size-xl);
  font-weight: 700;
  color: var(--text-primary);
  text-decoration: none;
}

.site-logo:hover {
  color: var(--text-secondary);
}

.site-nav {
  display: flex;
  align-items: center;
  gap: var(--space-8);
}

.nav-link {
  font-weight: 500;
  color: var(--text-secondary);
  transition: var(--transition-fast);
  position: relative;
}

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

.nav-link.active::after {
  content: '';
  position: absolute;
  bottom: -0.5rem;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--primary);
  border-radius: var(--radius-sm);
}

/* Submit Link - make it blue to stand out */
.nav-link[href*="Submit"] {
  color: var(--primary);
  font-weight: 600;
}

.nav-link[href*="Submit"]:hover {
  color: var(--primary-hover);
}

/* Hero Section */
.hero {
  background: var(--bg-secondary);
  padding: var(--space-16) 0;
  text-align: center;
  margin-bottom: var(--space-12);
  box-shadow: var(--shadow-lg);
}

.hero-content {
  max-width: 800px;
  margin: 0 auto;
}

.hero h1 {
  font-size: var(--font-size-4xl);
  margin-bottom: var(--space-6);
  color: var(--text-secondary);
}

.hero p {
  font-size: var(--font-size-lg);
  color: var(--text-primary);
  margin-bottom: var(--space-8);
}

.hero-stats {
  display: flex;
  justify-content: center;
  gap: var(--space-8);
  margin-top: var(--space-8);
  flex-wrap: wrap;
}

.stat {
  text-align: center;
}

.stat-number {
  display: block;
  font-size: var(--font-size-3xl);
  font-weight: 700;
  color: var(--primary);
  margin-bottom: var(--space-1);
}

.stat-label {
  font-size: var(--font-size-sm);
  color: var(--text-muted);
  font-weight: 500;
}

/* Search Bar */
.search-bar {
  max-width: 600px;
  margin: 0 auto var(--space-8);
  position: relative;
}

.search-input {
  width: 100%;
  padding: var(--space-4) var(--space-6);
  border: 2px solid var(--grey);
  border-radius: var(--radius-lg);
  font-size: var(--font-size-lg);
  transition: var(--transition);
  background: var(--bg-card);
  box-shadow: var(--shadow-md);
  color: var(--text-primary);
}

.search-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(30, 64, 175, 0.2), var(--shadow-lg);
  background: var(--bg-card);
}

.search-button {
  position: absolute;
  right: var(--space-2);
  top: 50%;
  transform: translateY(-50%);
  background: var(--bg-accent);
  color: var(--text-light);
  border: none;
  padding: var(--space-3) var(--space-5);
  border-radius: var(--radius);
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  box-shadow: var(--shadow-sm);
}

.search-button:hover {
  background: var(--grey-darker);
  box-shadow: var(--shadow-md);
  transform: translateY(-50%) translateY(-1px);
}

/* Categories Section */
.categories-section {
  margin-top: var(--space-16);
  margin-bottom: var(--space-16);
}

.section-header {
  text-align: center;
  margin-bottom: var(--space-10);
}

.section-title {
  font-size: var(--font-size-3xl);
  margin-bottom: var(--space-4);
}

.section-subtitle {
  font-size: var(--font-size-lg);
  color: var(--text-primary);
}

/* Category Grid */
.category-grid {
  display: grid;
  gap: var(--space-6);
  grid-template-columns: 1fr;
}

@media (min-width: 640px) {
  .category-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1024px) {
  .category-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-8);
  }
}

/* Category Card */
.category-card {
  background: var(--bg-card);
  border: 4px solid var(--black);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  transition: var(--transition);
  text-decoration: none;
  color: inherit;
  box-shadow: var(--shadow-md);
  display: flex;
  align-items: flex-start;
  gap: var(--space-4);
}

.category-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
  border-color: var(--primary);
  background: var(--bg-card-hover);
}

.category-icon {
  width: 48px;
  height: 48px;
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--font-size-xl);
  color: var(--text-secondary);
  flex-shrink: 0;
  box-shadow: var(--shadow-sm);
}

.category-info {
  flex: 1;
  min-width: 0;
}

.category-name {
  font-size: var(--font-size-lg);
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: var(--space-2);
}

.category-count {
  font-size: var(--font-size-sm);
  color: var(--primary);
  font-weight: 600;
  margin-bottom: var(--space-2);
}

.category-description {
  font-size: var(--font-size-sm);
  color: var(--text-primary);
  line-height: var(--leading-relaxed);
}

/* Inactive Category Styles */
.category-card-inactive {
  border-color: var(--grey-dark);
  background: var(--grey-light);
  cursor: default;
}

.category-card-inactive:hover {
  transform: none;
  box-shadow: var(--shadow-md);
  border-color: var(--grey-dark);
  background: var(--grey-light);
}

.category-icon-inactive {
  background: var(--grey-dark);
  color: var(--grey);
}

.category-name-inactive {
  color: var(--grey-dark);
}

.category-count-inactive {
  color: var(--grey-dark);
  font-weight: 500;
}

.category-description-inactive {
  color: var(--grey-dark);
  font-style: italic;
}

/* Page Header */
.page-header {
  margin-bottom: var(--space-8);
  padding-bottom: var(--space-6);
  border-bottom: 1px solid var(--secondary);
}

.page-title {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}

.page-title i {
  color: var(--primary);
}

.page-description {
  font-size: var(--font-size-lg);
  color: var(--text-primary);
  margin-bottom: var(--space-4);
}

/* Breadcrumb */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-4);
  font-size: var(--font-size-sm);
  color: var(--text-muted);
}

.breadcrumb a {
  color: var(--text-muted);
  text-decoration: none;
}

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

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

/* Sort Controls */
.sort-controls {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  margin-bottom: var(--space-8);
  flex-wrap: wrap;
}

.sort-label {
  font-weight: 500;
  color: var(--text-secondary);
}

.sort-buttons {
  display: flex;
  gap: var(--space-2);
  flex-wrap: wrap;
}

.sort-button {
  padding: var(--space-2) var(--space-4);
  border: 1px solid var(--grey);
  background: var(--bg-card);
  color: var(--text-primary);
  text-decoration: none;
  font-size: var(--font-size-sm);
  font-weight: 500;
  border-radius: var(--radius);
  transition: var(--transition);
  box-shadow: var(--shadow-sm);
}

.sort-button:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--bg-card-hover);
  box-shadow: var(--shadow-md);
}

.sort-button.active {
  background: var(--bg-accent);
  border-color: var(--bg-accent);
  color: var(--text-light);
  box-shadow: var(--shadow-md);
}

/* Link Grid */
.link-grid {
  display: grid;
  gap: var(--space-6);
  margin-bottom: var(--space-12);
}

/* Link Card */
.link-card {
  background: var(--bg-card);
  border: 4px solid var(--black);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  transition: var(--transition);
  box-shadow: var(--shadow-md);
  display: flex;
  gap: var(--space-4);
}

.link-card:hover {
  box-shadow: var(--shadow-lg);
  border-color: var(--primary);
  transform: translateY(-1px);
  background: var(--bg-card-hover);
}

.link-thumbnail {
  width: 80px;
  height: 80px;
  border-radius: var(--radius-md);
  object-fit: cover;
  flex-shrink: 0;
  background: var(--bg-secondary);
  box-shadow: var(--shadow-sm);
}

.link-thumbnail-placeholder {
  width: 80px;
  height: 80px;
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--font-size-xl);
  color: var(--text-secondary);
  flex-shrink: 0;
  box-shadow: var(--shadow-sm);
}

.link-content {
  flex: 1;
  min-width: 0;
}

.featured-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  background: var(--bg-accent);
  color: var(--text-light);
  font-size: var(--font-size-xs);
  font-weight: 600;
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-sm);
  margin-bottom: var(--space-2);
  box-shadow: var(--shadow-sm);
}

.link-title {
  font-size: var(--font-size-lg);
  font-weight: 600;
  margin-bottom: var(--space-2);
}

.link-title a {
  color: var(--text-secondary);
  text-decoration: none;
}

.link-title a:hover {
  color: var(--primary);
}

.link-description {
  font-size: var(--font-size-sm);
  color: var(--text-primary);
  line-height: var(--leading-relaxed);
  margin-bottom: var(--space-3);
}

.link-meta {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  font-size: var(--font-size-xs);
  color: var(--text-muted);
  flex-wrap: wrap;
}

.link-meta i {
  margin-right: var(--space-1);
}

/* Forms */
.form-container {
  max-width: 600px;
  margin: 0 auto;
}

.form-group {
  margin-bottom: var(--space-6);
}

.form-label {
  display: block;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: var(--space-2);
}

.form-control {
  width: 100%;
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--grey);
  border-radius: var(--radius);
  font-size: var(--font-size-base);
  transition: var(--transition);
  background: var(--bg-card);
  color: var(--text-primary);
  box-shadow: var(--shadow-sm);
}

.form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(30, 64, 175, 0.2), var(--shadow-md);
  background: var(--bg-card);
}

.form-control-lg {
  padding: var(--space-4) var(--space-5);
  font-size: var(--font-size-lg);
}

textarea.form-control {
  resize: vertical;
  min-height: 120px;
}

.form-text {
  font-size: var(--font-size-sm);
  color: var(--text-muted);
  margin-top: var(--space-1);
}

.form-error {
  font-size: var(--font-size-sm);
  color: var(--error);
  margin-top: var(--space-1);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-6);
  border: 1px solid transparent;
  border-radius: var(--radius);
  font-size: var(--font-size-base);
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
}

.btn-primary {
  background: var(--bg-accent);
  color: var(--white);
  border-color: var(--bg-accent);
  box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
  background: var(--grey-darker);
  border-color: var(--grey-darker);
  color: var(--white);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--bg-card);
  color: var(--text-primary);
  border-color: var(--grey);
  box-shadow: var(--shadow-sm);
}

.btn-secondary:hover {
  background: var(--bg-card-hover);
  border-color: var(--primary);
  color: var(--text-secondary);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.btn-lg {
  padding: var(--space-4) var(--space-8);
  font-size: var(--font-size-lg);
}

.btn-sm {
  padding: var(--space-2) var(--space-4);
  font-size: var(--font-size-sm);
}

/* Alerts */
.alert {
  padding: var(--space-4) var(--space-5);
  border-radius: var(--radius);
  margin-bottom: var(--space-6);
  border: 1px solid;
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
}

.alert-success {
  background: #f0fdf4;
  color: #15803d;
  border-color: #bbf7d0;
}

.alert-error {
  background: #fef2f2;
  color: #dc2626;
  border-color: #fecaca;
}

.alert-info {
  background: #eff6ff;
  color: #1d4ed8;
  border-color: #bfdbfe;
}

.alert-warning {
  background: #fffbeb;
  color: #d97706;
  border-color: #fed7aa;
}

/* Pagination */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: var(--space-2);
  margin: var(--space-12) 0;
  flex-wrap: wrap;
}

.page-link {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-2) var(--space-4);
  border: 1px solid var(--grey);
  background: var(--bg-card);
  color: var(--text-primary);
  text-decoration: none;
  font-size: var(--font-size-sm);
  font-weight: 500;
  border-radius: var(--radius);
  transition: var(--transition);
  box-shadow: var(--shadow-sm);
}

.page-link:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--bg-card-hover);
  box-shadow: var(--shadow-md);
}

.page-link.active {
  background: var(--bg-accent);
  border-color: var(--bg-accent);
  color: var(--text-light);
  box-shadow: var(--shadow-md);
}

/* Footer */
.site-footer {
  background: var(--grey-light);
  color: var(--text-primary);
  padding: var(--space-12) 0;
  margin-top: var(--space-16);
  text-align: center;
  border-top: 2px solid var(--grey-dark);
}

.footer-content {
  color: var(--text-primary);
  opacity: 0.8;
  font-size: var(--font-size-sm);
}

/* Guidelines Box */
.guidelines {
  background: var(--bg-secondary);
  border: 1px solid var(--grey);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  margin-bottom: var(--space-8);
  box-shadow: var(--shadow-md);
}

.guidelines h3 {
  color: var(--text-secondary);
  margin-bottom: var(--space-4);
}

.guidelines ul {
  margin: 0;
  padding-left: var(--space-5);
}

.guidelines li {
  margin-bottom: var(--space-2);
  color: var(--text-primary);
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .hero h1 {
    font-size: var(--font-size-3xl);
  }
  
  .hero-stats {
    gap: var(--space-6);
  }
  
  .site-nav {
    gap: var(--space-4);
  }
  
  .nav-link {
    font-size: var(--font-size-sm);
  }
  
  .link-card {
    flex-direction: column;
    text-align: center;
  }
  
  .link-thumbnail,
  .link-thumbnail-placeholder {
    width: 100%;
    height: 120px;
    align-self: center;
  }
  
  .link-meta {
    justify-content: center;
  }
  
  .sort-controls {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-3);
  }
  
  .pagination {
    gap: var(--space-1);
  }
  
  .page-link {
    padding: var(--space-2) var(--space-3);
    font-size: var(--font-size-xs);
  }
  
  .hero {
    padding: var(--space-12) 0;
  }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
  :root {
    /* Invert black and white for dark mode - comic book style */
    --white: #000000;                /* Black becomes white */
    --black: #FFFFFF;                /* White becomes black */
    --bg-primary: #000000;           /* Black background */
    --bg-secondary: #1A1A1A;         /* Dark grey background */
    --bg-card: #1A1A1A;              /* Dark grey cards */
    --bg-card-hover: #2A2A2A;        /* Lighter grey on hover */
    --bg-accent: #FFFFFF;            /* White accent */
    --text-primary: #FFFFFF;         /* White text */
    --text-secondary: #CCCCCC;       /* Light grey for headings */
    --text-light: #000000;           /* Black text for light backgrounds */
    --text-muted: #999999;           /* Muted light text */
    --grey-light: #2A2A2A;           /* Darker light grey */
    --grey-dark: #999999;            /* Lighter dark grey */
    --grey-darker: #CCCCCC;          /* Much lighter for buttons */
    /* Dark mode comic book shadows */
    --shadow-sm: 2px 2px 0 #555555;
    --shadow: 4px 4px 0 #555555;
    --shadow-md: 6px 6px 0 #555555;
    --shadow-lg: 8px 8px 0 #555555;
    --shadow-xl: 10px 10px 0 #555555;
  }
}

/* Utilities */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Focus styles for accessibility */
*:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}