/* GLOBAL THEME - Modern Dark */
:root {
  --bg-primary: #0a0a0a;
  --bg-secondary: #111111;
  --bg-card: #1a1a1a;
  --bg-header: #000000;
  --text-primary: #ffffff;
  --text-secondary: #b0b0b0;
  --text-muted: #888888;
  --accent-primary: #6366f1;
  --accent-secondary: #8b5cf6;
  --border-color: #2a2a2a;
  --border-hover: #404040;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  overflow-x: hidden;
}

/* Fixed Layout Container */
.layout-container {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* HEADER */
header {
  background: var(--bg-header);
  padding: 1rem 2rem;
  border-bottom: 1px solid var(--border-color);
  z-index: 100;
}

.header-content {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
  text-decoration: none;
}

.logo-glow {
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

nav {
  display: flex;
  gap: 2rem;
  align-items: center;
}

nav a {
  color: var(--text-secondary);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.95rem;
  transition: all 0.3s ease;
  position: relative;
  padding: 0.5rem 0;
}

nav a:hover {
  color: var(--text-primary);
}

nav a.active {
  color: var(--accent-primary);
}

nav a::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--accent-primary), var(--accent-secondary));
  transition: width 0.3s ease;
}

nav a:hover::after,
nav a.active::after {
  width: 100%;
}

/* MAIN CONTENT */
main {
  flex: 1;
  padding: 2rem;
}

.content-container {
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
}

/* HERO SECTION */
.hero {
  text-align: center;
  padding: 4rem 2rem;
  background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-primary) 100%);
  border-radius: 12px;
  margin-bottom: 3rem;
  border: 1px solid var(--border-color);
}

.hero h1 {
  font-size: 3rem;
  font-weight: 800;
  margin-bottom: 1rem;
  background: linear-gradient(135deg, var(--text-primary), var(--accent-primary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero p {
  font-size: 1.2rem;
  color: var(--text-secondary);
  max-width: 600px;
  margin: 0 auto;
  line-height: 1.6;
}

/* WRITEUP CONTAINERS */
.writeup-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
  gap: 1.5rem;
  margin-top: 2rem;
}

.writeup-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 1.5rem;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.writeup-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 2px;
  background: linear-gradient(90deg, var(--accent-primary), var(--accent-secondary));
  transition: left 0.3s ease;
}

.writeup-card:hover {
  border-color: var(--border-hover);
  transform: translateY(-4px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.writeup-card:hover::before {
  left: 0;
}

.writeup-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 1rem;
}

.writeup-title {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
  line-height: 1.4;
}

.writeup-badges {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.badge {
  padding: 0.25rem 0.75rem;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.badge-sherlock {
  background: linear-gradient(135deg, #8b5cf6, #6366f1);
  color: white;
}

.badge-difficulty {
  background: var(--border-color);
  color: var(--text-secondary);
}

.badge-very-easy {
  background: linear-gradient(135deg, #10b981, #059669);
  color: white;
}

.badge-easy {
  background: linear-gradient(135deg, #10b981, #059669);
  color: white;
}

.badge-intermediate {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: white;
}

.badge-hard {
  background: linear-gradient(135deg, #ef4444, #dc2626);
  color: white;
}

.writeup-description {
  color: var(--text-secondary);
  font-size: 0.95rem;
  margin-bottom: 1.5rem;
  line-height: 1.6;
}

.writeup-tags {
  display: flex;
  gap: 0.5rem;
  margin: 1rem 0;
  flex-wrap: wrap;
}

.tag {
  padding: 0.4rem 0.8rem;
  background: var(--border-color);
  color: var(--text-secondary);
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 500;
}

.tag-difficulty {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: white;
}

.writeup-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: auto;
  padding-top: 1rem;
  border-top: 1px solid var(--border-color);
}

.writeup-date {
  color: var(--text-muted);
  font-size: 0.85rem;
}

.read-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
  color: white;
  text-decoration: none;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.9rem;
  transition: all 0.3s ease;
  border: none;
  cursor: pointer;
}

.read-btn:hover {
  transform: translateX(4px);
  box-shadow: 0 5px 15px rgba(99, 102, 241, 0.3);
}

/* WRITEUP DETAIL PAGE */
.writeup-container {
  max-width: 900px;
  margin: 0 auto;
  padding: 2rem;
  background: var(--bg-card);
  border-radius: 12px;
  border: 1px solid var(--border-color);
}

.writeup-header-detail {
  margin-bottom: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border-color);
}

.writeup-header-detail h1 {
  font-size: 2.5rem;
  font-weight: 700;
  margin-bottom: 1rem;
  background: linear-gradient(135deg, var(--text-primary), var(--accent-primary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* CONTENT SECTIONS */
.content-section {
  margin: 2rem 0;
  padding: 1.5rem;
  background: var(--bg-secondary);
  border-radius: 8px;
  border-left: 4px solid var(--accent-primary);
}

.content-section h3 {
  color: var(--text-primary);
  margin-bottom: 1rem;
  font-size: 1.25rem;
}

.content-section h4 {
  color: var(--text-primary);
  margin: 1.5rem 0 0.5rem 0;
  font-size: 1.1rem;
}

.content-section p {
  color: var(--text-secondary);
  margin-bottom: 1rem;
  line-height: 1.7;
}

.content-section ul {
  color: var(--text-secondary);
  margin: 1rem 0;
  padding-left: 1.5rem;
}

.content-section li {
  margin-bottom: 0.5rem;
  line-height: 1.6;
}

/* CODE BLOCKS */
.code-block {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 1rem;
  margin: 1rem 0;
  overflow-x: auto;
  position: relative;
  font-family: 'Courier New', monospace;
  font-size: 0.9rem;
  line-height: 1.5;
  color: var(--text-secondary);
}

.copy-btn {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  background: var(--border-color);
  border: none;
  color: var(--text-secondary);
  padding: 0.25rem 0.75rem;
  border-radius: 4px;
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.3s ease;
}

.copy-btn:hover {
  background: var(--accent-primary);
  color: white;
}

/* FIGURES */
.figure {
  margin: 2rem 0;
  text-align: center;
}

.figure img {
  max-width: 100%;
  border-radius: 8px;
  border: 1px solid var(--border-color);
}

.figcaption {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-top: 0.5rem;
  font-style: italic;
}

/* SUPPORT SECTION */
.support {
  background: linear-gradient(135deg, var(--bg-secondary), var(--bg-card));
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 2rem;
  text-align: center;
  margin: 3rem 0;
}

.support h3 {
  color: var(--text-primary);
  margin-bottom: 1rem;
}

.support p {
  color: var(--text-secondary);
  margin-bottom: 1rem;
  line-height: 1.6;
}

.glitch-hover {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 1rem 2rem;
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
  color: white;
  text-decoration: none;
  border-radius: 8px;
  font-weight: 600;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.glitch-hover:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 25px rgba(99, 102, 241, 0.3);
}

/* QUICK LINKS */
.quick-links {
  margin: 3rem 0;
}

/* FOOTER */
footer {
  background: var(--bg-header);
  padding: 2rem;
  text-align: center;
  border-top: 1px solid var(--border-color);
  margin-top: auto;
}

footer a {
  color: var(--text-secondary);
  text-decoration: none;
  margin: 0 0.5rem;
  transition: color 0.3s ease;
}

footer a:hover {
  color: var(--accent-primary);
}

/* RESPONSIVE DESIGN */
@media (max-width: 768px) {
  .header-content {
    flex-direction: column;
    gap: 1rem;
  }
  
  nav {
    gap: 1rem;
  }
  
  .hero h1 {
    font-size: 2rem;
  }
  
  .hero p {
    font-size: 1rem;
  }
  
  .writeup-grid {
    grid-template-columns: 1fr;
  }
  
  .writeup-container {
    padding: 1rem;
    margin: 0;
  }
  
  main {
    padding: 1rem;
  }
  
  .writeup-header-detail h1 {
    font-size: 2rem;
  }
}

@media (max-width: 480px) {
  header {
    padding: 1rem;
  }
  
  .hero {
    padding: 2rem 1rem;
  }
  
  .hero h1 {
    font-size: 1.75rem;
  }
  
  .writeup-card {
    padding: 1rem;
  }
}

/* SCROLLBAR STYLING */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--border-hover);
}

/* UTILITY CLASSES */
.text-center {
  text-align: center;
}

.text-muted {
  color: var(--text-muted);
}

.mt-2 {
  margin-top: 2rem;
}

.mb-2 {
  margin-bottom: 2rem;
}

.hidden {
  display: none;
}

/* Difficulty badges in writeup detail pages */
.writeup-tags .badge-very-easy {
  background: linear-gradient(135deg, #10b981, #059669);
  color: white;
}

.writeup-tags .badge-intermediate {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: white;
}

.writeup-tags .badge-easy {
  background: linear-gradient(135deg, #10b981, #059669);
  color: white;
}

.writeup-tags .badge-hard {
  background: linear-gradient(135deg, #ef4444, #dc2626);
  color: white;
}

/* Difficulty tag colors using specific classes */
.tag-difficulty.very-easy {
  background: linear-gradient(135deg, #10b981, #059669);
  color: white;
}

.tag-difficulty.easy {
  background: linear-gradient(135deg, #10b981, #059669);
  color: white;
}

.tag-difficulty.intermediate {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: white;
}

.tag-difficulty.hard {
  background: linear-gradient(135deg, #ef4444, #dc2626);
  color: white;
}

.tag-difficulty.insane {
  background: linear-gradient(135deg, #7c3aed, #6d28d9);
  color: white;
}