/* Writeup Specific Styles */
:root {
  --code-bg: #282c34;
  --inline-code-bg: rgba(0, 170, 0, 0.1);
  --section-spacing: 3rem;
}

body {
  padding-top: 0;
  background-color: var(--bg-color);
}

/* Header */
.writeup-header {
  background-color: var(--panel-color);
  padding: 1.5rem 0;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 2rem;
}

.writeup-nav {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 2rem;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-color);
  margin-bottom: 1rem;
  font-family: 'JetBrains Mono', monospace;
  transition: transform 0.2s;
}

.back-link:hover {
  transform: translateX(-5px);
}

.writeup-title {
  font-size: 2.5rem;
  margin-bottom: 1rem;
  color: #fff;
}

.light-theme .writeup-title {
  color: #333;
}

.writeup-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 0.5rem;
}

.writeup-badge {
  padding: 0.25rem 0.75rem;
  border-radius: 0.25rem;
  font-size: 0.8rem;
  font-weight: 600;
}

.writeup-badge.web {
  background-color: #2563eb;
  color: #fff;
}

.writeup-badge.crypto {
  background-color: #7c3aed;
  color: #fff;
}

.writeup-badge.binary {
  background-color: #db2777;
  color: #fff;
}

.writeup-badge.forensics {
  background-color: #059669;
  color: #fff;
}

.writeup-date, .writeup-difficulty {
  font-size: 0.9rem;
  color: #aaa;
  display: flex;
  align-items: center;
  font-family: 'JetBrains Mono', monospace;
}

.light-theme .writeup-date,
.light-theme .writeup-difficulty {
  color: #666;
}

.writeup-date::before {
  content: '\f073';
  font-family: 'Font Awesome 5 Free';
  margin-right: 0.5rem;
  color: var(--text-color);
}

.writeup-difficulty::before {
  content: '\f3fd';
  font-family: 'Font Awesome 5 Free';
  font-weight: 900;
  margin-right: 0.5rem;
  color: var(--text-color);
}

/* Main Content */
.writeup-container {
  max-width: 1200px;
  margin: 0 auto 4rem;
  padding: 0 2rem;
  display: grid;
  grid-template-columns: 250px 1fr;
  gap: 2rem;
}

/* Sidebar */
.writeup-sidebar {
  position: sticky;
  top: 2rem;
  height: fit-content;
}

.writeup-toc, .writeup-tools {
  background-color: var(--panel-color);
  border-radius: 0.5rem;
  padding: 1.5rem;
  margin-bottom: 2rem;
  border: 1px solid var(--border-color);
}

.writeup-toc h3, .writeup-tools h3 {
  margin-bottom: 1rem;
  color: var(--text-color);
  font-size: 1.1rem;
}

.toc-list, .tools-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.toc-list li, .tools-list li {
  margin-bottom: 0.75rem;
}

.toc-list a {
  color: #ccc;
  text-decoration: none;
  transition: color 0.2s, transform 0.2s;
  display: inline-block;
}

.light-theme .toc-list a {
  color: #666;
}

.toc-list a:hover {
  color: var(--text-color);
  transform: translateX(5px);
}

.tools-list li {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: #ccc;
}

.light-theme .tools-list li {
  color: #666;
}

.tools-list li i {
  color: var(--text-color);
}

/* Content */
.writeup-content {
  background-color: var(--panel-color);
  border-radius: 0.5rem;
  padding: 2rem;
  border: 1px solid var(--border-color);
}

.writeup-content section {
  margin-bottom: var(--section-spacing);
}

.writeup-content h2 {
  font-size: 1.75rem;
  margin-bottom: 1.5rem;
  color: var(--text-color);
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border-color);
}

.writeup-content h3 {
  font-size: 1.3rem;
  margin: 1.5rem 0 1rem;
  color: #fff;
}

.light-theme .writeup-content h3 {
  color: #333;
}

.writeup-content p {
  margin-bottom: 1rem;
  line-height: 1.7;
}

.writeup-content ul, .writeup-content ol {
  margin: 1rem 0 1.5rem 1.5rem;
}

.writeup-content li {
  margin-bottom: 0.5rem;
}

.image-container {
  margin: 2rem 0;
  text-align: center;
}

.writeup-image {
  max-width: 100%;
  border-radius: 0.5rem;
  border: 1px solid var(--border-color);
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

figcaption {
  margin-top: 0.75rem;
  font-size: 0.9rem;
  color: #aaa;
  font-style: italic;
}

.light-theme figcaption {
  color: #666;
}

/* Code Blocks */
pre {
  margin: 1.5rem 0;
  border-radius: 0.5rem;
  background-color: var(--code-bg);
  overflow: auto;
}

code {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.9rem;
}

pre code {
  display: block;
  padding: 1rem;
  line-height: 1.5;
}

p code {
  background-color: var(--inline-code-bg);
  padding: 0.2rem 0.4rem;
  border-radius: 0.25rem;
  color: var(--text-color);
}

/* Challenge Info */
.challenge-info {
  background-color: rgba(0, 0, 0, 0.2);
  border-radius: 0.5rem;
  padding: 1.5rem;
  margin: 1.5rem 0;
  border: 1px solid var(--border-color);
}

.light-theme .challenge-info {
  background-color: rgba(0, 0, 0, 0.05);
}

.challenge-details {
  display: flex;
  gap: 2rem;
  margin-top: 1rem;
}

.challenge-detail {
  display: flex;
  flex-direction: column;
}

.detail-label {
  font-size: 0.8rem;
  text-transform: uppercase;
  color: #aaa;
  margin-bottom: 0.25rem;
}

.light-theme .detail-label {
  color: #666;
}

.detail-value {
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--text-color);
  font-family: 'JetBrains Mono', monospace;
}

/* Flag */
.flag-container {
  background-color: rgba(0, 170, 0, 0.1);
  border: 1px solid var(--text-color);
  border-radius: 0.5rem;
  padding: 1rem;
  text-align: center;
  margin: 1.5rem 0;
}

.flag-container code {
  font-size: 1.1rem;
  color: var(--text-color);
  font-weight: 700;
}

/* Resources */
.resources {
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px dashed var(--border-color);
}

.resources ul {
  list-style-type: square;
}

.resources a {
  color: var(--text-color);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.resources a:hover {
  color: var(--accent-color);
}

/* Footer */
.writeup-footer {
  background-color: var(--panel-color);
  padding: 2rem 0;
  border-top: 1px solid var(--border-color);
  margin-top: 2rem;
}

.footer-content {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 2rem;
}

.footer-nav {
  display: flex;
  justify-content: space-between;
  margin-bottom: 1.5rem;
}

.footer-nav a {
  color: var(--text-color);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transition: transform 0.2s;
}

.prev-writeup:hover {
  transform: translateX(-5px);
}

.next-writeup:hover {
  transform: translateX(5px);
}

.all-writeups:hover {
  transform: translateY(-3px);
}

.footer-info {
  text-align: center;
  font-size: 0.9rem;
  color: #777;
}

/* Responsive */
@media screen and (max-width: 900px) {
  .writeup-container {
    grid-template-columns: 1fr;
  }
  
  .writeup-sidebar {
    position: static;
    margin-bottom: 2rem;
  }
}

@media screen and (max-width: 600px) {
  .writeup-nav, 
  .writeup-container,
  .footer-content {
    padding: 0 1rem;
  }
  
  .challenge-details {
    flex-direction: column;
    gap: 1rem;
  }
  
  .footer-nav {
    flex-direction: column;
    gap: 1rem;
    align-items: center;
  }
}