/* ============================================
   KoffeeAndKode - Main Stylesheet
   ============================================ */

:root {
  /* Light theme colors */
  --bg-color: #ffffff;
  --text-color: #333333;
  --text-secondary: #666666;
  --border-color: #e0e0e0;
  --code-bg: #f5f5f5;
  --code-border: #e0e0e0;
  --link-color: #0066cc;
  --link-hover: #0052a3;
  --header-bg: #ffffff;
  --header-border: #e0e0e0;
  --footer-bg: #f8f8f8;
  --tag-bg: #e8e8e8;
  --tag-text: #555555;
  --accent-color: #0066cc;
  --shadow: rgba(0, 0, 0, 0.1);
}

[data-theme="dark"] {
  /* Dark theme colors */
  --bg-color: #1a1a1a;
  --text-color: #e0e0e0;
  --text-secondary: #b0b0b0;
  --border-color: #333333;
  --code-bg: #2a2a2a;
  --code-border: #404040;
  --link-color: #4da6ff;
  --link-hover: #66b3ff;
  --header-bg: #1a1a1a;
  --header-border: #333333;
  --footer-bg: #151515;
  --tag-bg: #2a2a2a;
  --tag-text: #b0b0b0;
  --accent-color: #4da6ff;
  --shadow: rgba(0, 0, 0, 0.3);
}

/* Reset and Base Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
    'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
    sans-serif;
  line-height: 1.6;
  color: var(--text-color);
  background-color: var(--bg-color);
  transition: background-color 0.3s ease, color 0.3s ease;
}

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

h1 { font-size: 2.5rem; }
h2 { font-size: 2rem; }
h3 { font-size: 1.5rem; }
h4 { font-size: 1.25rem; }

p {
  margin-bottom: 1rem;
}

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

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

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

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

[data-theme="dark"] .site-header {
  background-color: rgba(26, 26, 26, 0.9);
}

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

.site-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-color);
  text-decoration: none;
}

.site-title:hover {
  text-decoration: none;
}

/* Navigation */
.site-nav {
  position: relative;
}

.nav-toggle {
  display: none;
}

.nav-toggle-label {
  display: none;
  flex-direction: column;
  cursor: pointer;
  padding: 0.5rem;
}

.nav-toggle-label span {
  width: 25px;
  height: 3px;
  background-color: var(--text-color);
  margin: 3px 0;
  transition: 0.3s;
}

.nav-menu {
  display: flex;
  list-style: none;
  gap: 2rem;
  align-items: center;
}

.nav-menu a {
  color: var(--text-color);
  font-weight: 500;
  padding: 0.5rem 0;
}

.nav-menu a:hover,
.nav-menu a.active {
  color: var(--accent-color);
  text-decoration: none;
}

/* Theme Toggle */
.theme-toggle {
  background: none;
  border: 1px solid var(--border-color);
  border-radius: 50%;
  width: 40px;
  height: 40px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  transition: all 0.2s ease;
  margin-left: 1rem;
}

.theme-toggle:hover {
  background-color: var(--code-bg);
  border-color: var(--accent-color);
}

/* Main Content */
.main-content {
  min-height: calc(100vh - 200px);
  padding: 2rem 0;
}

/* Hero Section */
.hero {
  text-align: center;
  padding: 3rem 0;
  margin-bottom: 3rem;
}

.hero .site-title {
  font-size: 3rem;
  margin-bottom: 1rem;
}

.site-description {
  font-size: 1.25rem;
  color: var(--text-secondary);
  max-width: 600px;
  margin: 0 auto;
}

/* Content Grid */
.content-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3rem;
  margin-top: 2rem;
}

@media (max-width: 768px) {
  .content-grid {
    grid-template-columns: 1fr;
  }
}

/* About & Resources Page */
.about,
.resources-page {
  max-width: 720px;
  margin: 0 auto;
  padding: 1rem 0 2rem;
}

.about-header,
.resources-header {
  margin-bottom: 2.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border-color);
}

.about-header h1,
.resources-header h1 {
  font-size: 2.25rem;
  margin-bottom: 0.75rem;
}

.about-tagline,
.resources-tagline {
  font-size: 1.15rem;
  color: var(--text-secondary);
  line-height: 1.5;
  margin: 0;
}

.about-section,
.resource-section {
  margin-bottom: 2.5rem;
}

.about-section h2,
.resource-section h2 {
  font-size: 1.4rem;
  margin-bottom: 0.85rem;
  letter-spacing: -0.01em;
}

.about-section p,
.resource-section p {
  font-size: 1.05rem;
  line-height: 1.7;
  margin-bottom: 0.85rem;
}

.about-section ul,
.resource-section ul {
  margin: 0 0 0.5rem 1.25rem;
  padding: 0;
}

.about-section li,
.resource-section li {
  margin-bottom: 0.6rem;
  line-height: 1.65;
}

.about-section li ul,
.resource-section li ul {
  margin-top: 0.5rem;
  margin-bottom: 0.25rem;
}

.about-section li ul li,
.resource-section li ul li {
  margin-bottom: 0.35rem;
  font-size: 0.98rem;
}

.recommendation {
  margin: 0;
  padding: 1.25rem 1.5rem;
  border-left: 3px solid var(--accent-color);
  background: var(--code-bg);
  border-radius: 0 4px 4px 0;
}

.recommendation p {
  font-size: 1rem;
  line-height: 1.65;
  margin-bottom: 0.85rem;
  color: var(--text-color);
}

.recommendation p:last-of-type {
  margin-bottom: 1rem;
}

.recommendation-attr {
  font-size: 0.95rem;
  color: var(--text-secondary);
  border: 0;
  padding: 0;
  margin: 0;
}

.recommendation-meta {
  display: block;
  margin-top: 0.25rem;
  font-size: 0.85rem;
  opacity: 0.8;
}

.about-links {
  margin-top: 2.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border-color);
  color: var(--text-secondary);
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.about-links .sep {
  color: var(--text-secondary);
  opacity: 0.5;
}

/* Post Styles */
.post {
  max-width: 800px;
  margin: 0 auto;
}

.post-header {
  margin-bottom: 2rem;
  padding-bottom: 1rem;
  border-bottom: 2px solid var(--border-color);
}

.post-title {
  font-size: 2.5rem;
  margin-bottom: 1rem;
}

.post-meta {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-bottom: 1rem;
}

.post-content {
  font-size: 1.1rem;
  line-height: 1.8;
}

.post-content h2 {
  margin-top: 2rem;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border-color);
}

.post-content h3 {
  margin-top: 1.5rem;
}

.post-content ul,
.post-content ol {
  margin-left: 2rem;
  margin-bottom: 1rem;
}

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

.post-content blockquote {
  border-left: 4px solid var(--accent-color);
  padding-left: 1rem;
  margin: 1.5rem 0;
  color: var(--text-secondary);
  font-style: italic;
}

.post-content img {
  max-width: 100%;
  height: auto;
  border-radius: 4px;
  margin: 1.5rem 0;
}

/* Code Blocks */
.post-content pre {
  background-color: var(--code-bg);
  border: 1px solid var(--code-border);
  border-radius: 6px;
  padding: 1rem;
  overflow-x: auto;
  margin: 1.5rem 0;
  position: relative;
}

.post-content pre code {
  font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', 'Consolas', monospace;
  font-size: 0.9rem;
  line-height: 1.5;
}

.post-content code {
  background-color: var(--code-bg);
  border: 1px solid var(--code-border);
  border-radius: 3px;
  padding: 0.2rem 0.4rem;
  font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', 'Consolas', monospace;
  font-size: 0.9em;
}

/* Copy Button for Code Blocks */
.post-content pre {
  position: relative;
}

.copy-button {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  background-color: var(--accent-color);
  color: white;
  border: none;
  border-radius: 4px;
  padding: 0.4rem 0.8rem;
  font-size: 0.8rem;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.post-content pre:hover .copy-button {
  opacity: 1;
}

.copy-button:hover {
  background-color: var(--link-hover);
}

/* Tags */
.post-tags,
.tag {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1rem;
}

.tag {
  background-color: var(--tag-bg);
  color: var(--tag-text);
  padding: 0.3rem 0.8rem;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 500;
}

/* Post Navigation */
.post-navigation {
  display: flex;
  justify-content: space-between;
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border-color);
}

.post-nav-link {
  display: flex;
  flex-direction: column;
  max-width: 45%;
  padding: 1rem;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  transition: all 0.2s ease;
}

.post-nav-link:hover {
  border-color: var(--accent-color);
  background-color: var(--code-bg);
  text-decoration: none;
}

.post-nav-link.prev {
  text-align: left;
}

.post-nav-link.next {
  text-align: right;
  margin-left: auto;
}

.nav-label {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
}

.nav-title {
  font-weight: 600;
  color: var(--text-color);
}

/* Post List */
.post-list,
.prototype-list {
  list-style: none;
}

.post-item,
.prototype-item {
  margin-bottom: 2rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--border-color);
}

.post-item:last-child,
.prototype-item:last-child {
  border-bottom: none;
}

.post-link,
.prototype-link {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--text-color);
}

.post-link:hover,
.prototype-link:hover {
  color: var(--accent-color);
}

.post-excerpt,
.prototype-excerpt {
  color: var(--text-secondary);
  margin: 0.5rem 0;
}

.view-all {
  display: inline-block;
  margin-top: 1rem;
  font-weight: 600;
  color: var(--accent-color);
}

/* Prototype Styles */
.prototype-header {
  margin-bottom: 2rem;
  padding-bottom: 1rem;
  border-bottom: 2px solid var(--border-color);
}

.tech-stack {
  margin: 1rem 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.tech-badge {
  background-color: var(--tag-bg);
  color: var(--tag-text);
  padding: 0.4rem 0.9rem;
  border-radius: 4px;
  font-size: 0.85rem;
  font-weight: 500;
}

.github-link {
  display: inline-block;
  margin-top: 1rem;
  color: var(--accent-color);
  font-weight: 600;
}

.back-link {
  display: inline-block;
  margin-top: 2rem;
  color: var(--accent-color);
}

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

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

.social-links {
  display: flex;
  gap: 1.5rem;
}

.social-links a {
  color: var(--text-secondary);
  font-weight: 500;
}

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

/* Responsive Design */
@media (max-width: 768px) {
  .nav-toggle-label {
    display: flex;
  }

  .nav-menu {
    position: absolute;
    top: 100%;
    right: 0;
    flex-direction: column;
    background-color: var(--header-bg);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 1rem;
    min-width: 200px;
    box-shadow: 0 4px 6px var(--shadow);
    display: none;
    gap: 0.5rem;
  }

  .nav-toggle:checked ~ .nav-menu {
    display: flex;
  }

  .hero .site-title {
    font-size: 2rem;
  }

  .post-title {
    font-size: 2rem;
  }

  .post-navigation {
    flex-direction: column;
  }

  .post-nav-link {
    max-width: 100%;
    margin-bottom: 1rem;
  }

  .footer-content {
    flex-direction: column;
    text-align: center;
  }
}

/* Print Styles */
@media print {
  .site-header,
  .site-footer,
  .theme-toggle,
  .post-navigation {
    display: none;
  }
}

