@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;600;700&family=Inter:wght@300;400;500;600;700&display=swap');

:root {
  --bg-primary: #0d1117;
  --bg-secondary: #161b22;
  --bg-tertiary: #1c2128;
  --bg-card: #1c2128;
  --border-color: #30363d;
  --border-accent: #58a6ff;
  --text-primary: #e6edf3;
  --text-secondary: #8b949e;
  --text-muted: #6e7681;
  --accent-blue: #58a6ff;
  --accent-green: #3fb950;
  --accent-orange: #d29922;
  --accent-red: #f85149;
  --accent-purple: #bc8cff;
  --accent-cyan: #39d353;
  --link-color: #58a6ff;
  --code-bg: #0d1117;
  --code-border: #30363d;
  --header-bg: #010409;
  --shadow: 0 3px 6px rgba(0, 0, 0, 0.4);
  --radius: 8px;
}

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.7;
  font-size: 16px;
  min-height: 100vh;
}

/* Header */
.site-header {
  background: var(--header-bg);
  border-bottom: 1px solid var(--border-color);
  padding: 1rem 0;
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(12px);
}

.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
}

.site-title {
  font-family: 'JetBrains Mono', monospace;
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--accent-green);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.site-title:hover {
  color: var(--accent-cyan);
}

.site-title .logo-icon {
  font-size: 1.5rem;
}

.header-logo {
  height: 32px;
  width: auto;
  vertical-align: middle;
}

/* Hero logo */
.hero-logo {
  width: 220px;
  height: auto;
  margin-bottom: 1.5rem;
  filter: drop-shadow(0 0 20px rgba(63, 185, 80, 0.3));
}

/* Navigation */
.site-nav {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.site-nav a {
  color: var(--text-secondary);
  text-decoration: none;
  padding: 0.4rem 0.8rem;
  border-radius: var(--radius);
  font-size: 0.9rem;
  font-weight: 500;
  transition: all 0.2s ease;
  border: 1px solid transparent;
}

.site-nav a:hover,
.site-nav a.active {
  color: var(--text-primary);
  background: var(--bg-secondary);
  border-color: var(--border-color);
}

/* Container */
.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 2rem;
}

/* Main content */
.content {
  padding: 3rem 0;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
  color: var(--text-primary);
  font-weight: 600;
  margin-top: 2rem;
  margin-bottom: 1rem;
  line-height: 1.3;
}

h1 {
  font-size: 2.2rem;
  font-family: 'JetBrains Mono', monospace;
  color: var(--accent-green);
  border-bottom: 2px solid var(--border-color);
  padding-bottom: 0.5rem;
}

h2 {
  font-size: 1.6rem;
  color: var(--accent-blue);
}

h3 {
  font-size: 1.3rem;
  color: var(--text-primary);
}

p {
  margin-bottom: 1rem;
  color: var(--text-secondary);
}

a {
  color: var(--link-color);
  text-decoration: none;
  transition: color 0.2s ease;
}

a:hover {
  color: var(--accent-cyan);
  text-decoration: underline;
}

/* Lists */
ul, ol {
  margin-bottom: 1rem;
  padding-left: 1.5rem;
  color: var(--text-secondary);
}

li {
  margin-bottom: 0.4rem;
}

li code {
  color: var(--accent-orange);
}

/* Code */
code {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.88em;
  background: var(--code-bg);
  border: 1px solid var(--code-border);
  padding: 0.15em 0.4em;
  border-radius: 4px;
  color: var(--accent-orange);
}

pre {
  background: var(--code-bg);
  border: 1px solid var(--code-border);
  border-radius: var(--radius);
  padding: 1.2rem;
  overflow-x: auto;
  margin: 1.5rem 0;
  position: relative;
}

pre code {
  background: none;
  border: none;
  padding: 0;
  font-size: 0.85rem;
  color: var(--text-primary);
  line-height: 1.6;
}

/* Blockquote */
blockquote {
  border-left: 4px solid var(--accent-blue);
  padding: 1rem 1.5rem;
  margin: 1.5rem 0;
  background: var(--bg-secondary);
  border-radius: 0 var(--radius) var(--radius) 0;
  color: var(--text-secondary);
}

blockquote p:last-child {
  margin-bottom: 0;
}

/* Tables */
table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5rem 0;
  font-size: 0.9rem;
}

th, td {
  padding: 0.75rem 1rem;
  text-align: left;
  border: 1px solid var(--border-color);
}

th {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  font-weight: 600;
}

td {
  color: var(--text-secondary);
}

tr:hover td {
  background: var(--bg-secondary);
}

/* Cards */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.5rem;
  margin: 2rem 0;
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 1.5rem;
  transition: all 0.3s ease;
  text-decoration: none;
  display: block;
}

.card:hover {
  border-color: var(--accent-blue);
  transform: translateY(-2px);
  box-shadow: var(--shadow);
  text-decoration: none;
}

.card-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
  font-family: 'JetBrains Mono', monospace;
}

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

.card-meta {
  display: flex;
  gap: 0.75rem;
  margin-top: 1rem;
  flex-wrap: wrap;
}

/* Badges */
.badge {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.badge-easy {
  background: rgba(63, 185, 80, 0.15);
  color: var(--accent-green);
  border: 1px solid rgba(63, 185, 80, 0.3);
}

.badge-medium {
  background: rgba(210, 153, 34, 0.15);
  color: var(--accent-orange);
  border: 1px solid rgba(210, 153, 34, 0.3);
}

.badge-hard {
  background: rgba(248, 81, 73, 0.15);
  color: var(--accent-red);
  border: 1px solid rgba(248, 81, 73, 0.3);
}

.badge-category {
  background: rgba(88, 166, 255, 0.15);
  color: var(--accent-blue);
  border: 1px solid rgba(88, 166, 255, 0.3);
}

/* Challenge/Solution page styles */
.page-header {
  margin-bottom: 2rem;
}

.page-header .meta {
  display: flex;
  gap: 1rem;
  margin-top: 0.75rem;
  flex-wrap: wrap;
  align-items: center;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-bottom: 1.5rem;
  padding: 0.4rem 0.8rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  transition: all 0.2s ease;
}

.back-link:hover {
  color: var(--text-primary);
  border-color: var(--accent-blue);
  text-decoration: none;
}

.solution-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(63, 185, 80, 0.1);
  border: 1px solid rgba(63, 185, 80, 0.3);
  color: var(--accent-green);
  padding: 0.6rem 1.2rem;
  border-radius: var(--radius);
  font-weight: 600;
  margin-top: 2rem;
  transition: all 0.2s ease;
}

.solution-link:hover {
  background: rgba(63, 185, 80, 0.2);
  border-color: var(--accent-green);
  text-decoration: none;
}

/* Hero section */
.hero {
  text-align: center;
  padding: 4rem 0 3rem;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 3rem;
}

.hero h1 {
  font-size: 2.8rem;
  border: none;
  margin-bottom: 1rem;
  color: var(--accent-green);
}

.hero .subtitle {
  font-size: 1.2rem;
  color: var(--text-secondary);
  max-width: 700px;
  margin: 0 auto 2rem;
}

.hero .stats {
  display: flex;
  justify-content: center;
  gap: 2rem;
  flex-wrap: wrap;
  margin-top: 2rem;
}

.stat {
  text-align: center;
}

.stat-number {
  font-size: 2rem;
  font-weight: 700;
  font-family: 'JetBrains Mono', monospace;
  color: var(--accent-cyan);
}

.stat-label {
  font-size: 0.85rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* Category sections */
.category-section {
  margin-bottom: 3rem;
}

.category-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border-color);
}

.category-icon {
  font-size: 1.5rem;
}

/* Footer */
.site-footer {
  border-top: 1px solid var(--border-color);
  padding: 2rem 0;
  margin-top: 4rem;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.85rem;
}

.site-footer a {
  color: var(--accent-blue);
}

/* Content images (responsive, constrained) */
.content img {
  max-width: min(100%, 600px);
  height: auto;
  display: block;
  margin: 1.5rem auto;
  border-radius: var(--radius);
}

/* Horizontal rule */
hr {
  border: none;
  border-top: 1px solid var(--border-color);
  margin: 2rem 0;
}

/* Strong/Bold */
strong {
  color: var(--text-primary);
  font-weight: 600;
}

/* Responsive */
@media (max-width: 768px) {
  .container {
    padding: 0 1rem;
  }

  .hero h1 {
    font-size: 2rem;
  }

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

  .site-header .container {
    flex-direction: column;
    align-items: flex-start;
  }

  h1 {
    font-size: 1.8rem;
  }

  pre {
    padding: 0.8rem;
  }
}

/* Syntax highlighting (Rouge - GitHub dark) */
.highlight .c, .highlight .cm, .highlight .c1, .highlight .cs { color: #8b949e; font-style: italic; }
.highlight .k, .highlight .kd, .highlight .kn, .highlight .kp, .highlight .kr, .highlight .kt { color: #ff7b72; }
.highlight .s, .highlight .sb, .highlight .sc, .highlight .sd, .highlight .s2, .highlight .sh, .highlight .sx, .highlight .s1 { color: #a5d6ff; }
.highlight .n, .highlight .na, .highlight .nb, .highlight .nc, .highlight .nd, .highlight .ni, .highlight .ne, .highlight .nf { color: #d2a8ff; }
.highlight .no, .highlight .nv, .highlight .vc, .highlight .vg, .highlight .vi { color: #ffa657; }
.highlight .m, .highlight .mf, .highlight .mh, .highlight .mi, .highlight .mo { color: #79c0ff; }
.highlight .o, .highlight .ow { color: #ff7b72; }
.highlight .p { color: #e6edf3; }
.highlight .gi { color: #aff5b4; background: rgba(46, 160, 67, 0.15); }
.highlight .gd { color: #ffdcd7; background: rgba(248, 81, 73, 0.15); }
