/* Color variables with light/dark mode support */
:root {
  color-scheme: light dark;
  --background: light-dark(white, #171717);
  --text: light-dark(#333333, #e8e8e8);
  --accent: light-dark(#4a8c00, #98FF46);
  --border: light-dark(#dddddd, #444444);
  --muted-text: light-dark(#666666, #cccccc);
  --post-date: #aaaaaa;
  --hover-bg: light-dark(#f5f5f5, #2a2a2a);
}

/* ========================================
   GLOBAL STYLES
   ======================================== */

/* Basic shared styles */
body {
  background-color: var(--background);
  color: var(--text);
  margin: 0;
  padding: 0;
}

/* Hide horizontal rules when CSS is loaded - they're only fallbacks for no-CSS */
hr {
  display: none;
}

* {
  word-wrap: break-word;
  overflow-wrap: break-word;
}

#theme-container {
  font-family: monospace;
  font-size: clamp(16px, 2.5vw, 18px);
  line-height: 1.6;
  margin: 0;
  padding: 20px;
  background-color: var(--background);
  color: var(--text);
  min-height: 100vh;
  width: 100%;
  box-sizing: border-box;
}

/* Content container for centered content */
#theme-container > * {
  max-width: 800px;
  margin-left: auto;
  margin-right: auto;
}

/* ========================================
   TYPOGRAPHY
   ======================================== */

/* Headings */
h1, h2, h3, h4 {
  margin-top: 25px;
  margin-bottom: 15px;
}

h1 { font-size: clamp(24px, 4vw, 32px); }
h2 { font-size: clamp(20px, 3.5vw, 26px); }
h3 { font-size: clamp(18px, 3vw, 22px); }
h4 {
  margin-top: 5px;
  font-size: clamp(16px, 2.5vw, 18px);
  color: var(--muted-text);
}

/* Links */
a {
  color: var(--accent);
  text-decoration: underline;
}

/* Lists */
ul, ol {
  padding-left: 20px;
}

ol li {
  margin-bottom: 10px;
  line-height: 1.5;
}

/* Code blocks */
pre {
  background-color: var(--hover-bg);
  padding: 15px;
  border: 1px solid var(--border);
  overflow-x: auto;
  margin: 20px 0;
}

code {
  font-family: monospace;
  font-size: clamp(12px, 1.8vw, 14px);
}

/* ========================================
   LAYOUT COMPONENTS
   ======================================== */

/* General layout */
section {
  margin-bottom: 40px;
}

/* Blog post images */
.image-container {
  margin: 20px 0;
  text-align: center;
}

.image-container img {
  max-width: 100%;
  height: auto;
  border: 1px solid var(--border);
}

.image-caption {
  font-size: clamp(12px, 1.5vw, 14px);
  color: var(--muted-text);
  margin-top: 5px;
  font-style: italic;
}

/* ========================================
   SPECIFIC COMPONENTS
   ======================================== */

/* Projects */
.project {
  padding: 20px;
  border-bottom: 1px solid var(--border);
}

.project:first-child {
  border-top: 1px solid var(--border);
}

.project h3 { 
  margin-top: 0;
  color: var(--accent);
}

/* Post styles */
.post-buttons {
  margin-top: 20px;
}

.post-button {
  display: block;
  margin-bottom: 15px;
  padding: 10px 15px;
  border: 1px solid var(--border);
  background-color: var(--background);
  text-decoration: none;
  color: var(--text);
}

.post-button:hover {
  background-color: var(--hover-bg);
}

.post-title {
  color: var(--accent);
  font-weight: bold;
  font-size: clamp(16px, 2.5vw, 18px);
}

.post-date {
  font-size: clamp(14px, 2vw, 16px);
  color: var(--post-date);
}

/* Secret dot */
#dot {
  margin-left: 8px;
}

#dot a {
  color: #292929;
  text-decoration: none;
  font-size: 9px;
}

/* RSS link styling */
.rss-link {
  font-size: 14px;
  color: var(--muted-text);
  text-decoration: none;
  margin-left: 8px;
  opacity: 0.7;
  transition: opacity 0.2s ease;
}

.rss-link:hover {
  opacity: 1;
  color: var(--accent);
}

/* ========================================
   THEME TOGGLE
   ======================================== */

.theme-toggle {
  display: none;
}

.theme-label {
  color: var(--accent);
  text-decoration: underline;
  cursor: pointer;
}

/* Theme toggle functionality */
.theme-toggle:checked + #theme-container {
  --background: light-dark(#171717, white);
  --text: light-dark(#e8e8e8, #333333);
  --accent: light-dark(#98FF46, #4a8c00);
  --border: light-dark(#444444, #dddddd);
  --muted-text: light-dark(#cccccc, #666666);
  --hover-bg: light-dark(#2a2a2a, #f5f5f5);
  
  background-color: var(--background);
  color: var(--text);
}

/* Toggle label text based on theme */
@media (prefers-color-scheme: light) {
  .theme-label::before {
    content: "Dark Mode";
  }
  
  .theme-toggle:checked + #theme-container .theme-label::before {
    content: "Light Mode";
  }
}

@media (prefers-color-scheme: dark) {
  .theme-label::before {
    content: "Light Mode";
  }
  
  .theme-toggle:checked + #theme-container .theme-label::before {
    content: "Dark Mode";
  }
}

/* ========================================
   RESPONSIVE DESIGN
   ======================================== */

@media (max-width: 600px) {
  #theme-container {
    padding: 10px 18px;
  }
  
  ol {
    padding-left: 25px;
  }
  
  ol li {
    margin-bottom: 15px;
    padding-right: 5px;
  }
}
