/**
 * Enhanced Microblog Styles
 * With tags, categories, archive pages, and individual posts
 */

:root {
  --primary: #3b82f6;
  --primary-dark: #2563eb;
  --success: #10b981;
  --error: #ef4444;
  --warning: #f59e0b;
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --gray-600: #4b5563;
  --gray-700: #374151;
  --gray-900: #111827;
  --radius: 8px;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  line-height: 1.6;
  color: var(--gray-900);
  background: var(--gray-50);
  padding: 20px;
}

/* Screen reader only - hides text visually but keeps for accessibility */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

.container {
  max-width: 700px;
  margin: 0 auto;
  background: white;
  padding: 40px;
  border-radius: var(--radius);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* Header */
header {
  margin-bottom: 40px;
  padding-bottom: 30px;
  border-bottom: 2px solid var(--gray-100);
  text-align: center;
}

/* Site Logo */
.site-logo {
  margin-bottom: 20px;
}

.site-logo img {
  height: auto;
  display: inline-block;
}

header h1 {
  font-size: 2.5rem;
  margin-bottom: 10px;
  color: var(--gray-900);
}

header h1 a {
  color: inherit;
  text-decoration: none;
}

header h1 a:hover {
  color: var(--primary);
}

.tagline {
  color: var(--gray-600);
  font-size: 1.1rem;
  margin-bottom: 20px;
}

/* Navigation */
nav {
  margin-top: 20px;
  display: flex;
  gap: 15px;
  justify-content: center;
  flex-wrap: wrap;
}

nav a {
  display: inline-block;
  text-decoration: none;
  color: var(--gray-700);
  transition: color 0.2s;
  font-weight: 500;
}

nav a:hover {
  color: var(--primary);
}

/* Buttons */
.btn-primary {
  background: var(--primary);
  color: white !important;
  padding: 10px 20px;
  border: none;
  border-radius: var(--radius);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
  transition: background 0.2s;
}

.btn-primary:hover {
  background: var(--primary-dark);
}

.btn-primary:disabled {
  background: var(--gray-300);
  cursor: not-allowed;
}

.btn-secondary {
  background: var(--gray-200);
  color: var(--gray-700);
  padding: 12px 24px;
  border: none;
  border-radius: var(--radius);
  font-size: 1rem;
  cursor: pointer;
  transition: background 0.2s;
}

.btn-secondary:hover {
  background: var(--gray-300);
}

/* Form */
.form-group {
  margin-bottom: 24px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

label {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
  color: var(--gray-700);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.char-count {
  font-size: 0.875rem;
  font-weight: 400;
  color: var(--gray-500);
}

input[type="text"],
textarea,
input[type="file"] {
  width: 100%;
  padding: 12px;
  border: 2px solid var(--gray-200);
  border-radius: var(--radius);
  font-size: 1rem;
  font-family: inherit;
  transition: border-color 0.2s;
}

input[type="text"]:focus,
textarea:focus,
input[type="file"]:focus {
  outline: none;
  border-color: var(--primary);
}

textarea {
  resize: vertical;
  min-height: 150px;
}

small {
  display: block;
  margin-top: 4px;
  font-size: 0.875rem;
  color: var(--gray-500);
}

.image-preview {
  margin-top: 12px;
  position: relative;
}

.image-preview img {
  max-width: 100%;
  border-radius: var(--radius);
  border: 2px solid var(--gray-200);
}

.remove-image {
  position: absolute;
  top: 10px;
  right: 10px;
  background: var(--error);
  color: white;
  border: none;
  padding: 8px 12px;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 600;
}

.form-actions {
  display: flex;
  gap: 12px;
  margin-top: 24px;
}

/* Messages */
.message {
  padding: 12px 16px;
  border-radius: var(--radius);
  margin-top: 20px;
  font-weight: 500;
}

.message-success {
  background: #d1fae5;
  color: #065f46;
  border: 2px solid var(--success);
}

.message-error {
  background: #fee2e2;
  color: #991b1b;
  border: 2px solid var(--error);
}

/* Posts */
.posts {
  margin-top: 30px;
}

.post {
  border-bottom: 1px solid var(--gray-200);
  padding: 30px 0;
}

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

.post-header {
  margin-bottom: 16px;
}

.post-title {
  font-size: 1.75rem;
  margin-bottom: 8px;
  line-height: 1.3;
}

.post-title a {
  color: var(--gray-900);
  text-decoration: none;
  transition: color 0.2s;
}

.post-title a:hover {
  color: var(--primary);
}

.post-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 0.9rem;
  color: var(--gray-600);
}

.meta-separator {
  color: var(--gray-400);
}

.post-tags {
  margin-top: 8px;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.tag {
  display: inline-block;
  padding: 4px 10px;
  background: var(--gray-100);
  color: var(--gray-700);
  border-radius: 4px;
  font-size: 0.85rem;
  text-decoration: none;
  transition: background 0.2s;
}

.tag:hover {
  background: var(--gray-200);
}

.category-badge {
  display: inline-block;
  padding: 4px 10px;
  background: var(--primary);
  color: white;
  border-radius: 4px;
  font-size: 0.85rem;
  text-decoration: none;
  transition: background 0.2s;
  font-weight: 500;
}

.category-badge:hover {
  background: var(--primary-dark);
}

.post-content {
  color: var(--gray-900);
  font-size: 1.05rem;
  line-height: 1.8;
}

.post-content img {
  max-width: 100%;
  border-radius: var(--radius);
  margin: 20px 0;
}

.post-content p {
  margin-bottom: 16px;
}

.post-content a {
  color: var(--primary);
  text-decoration: none;
}

.post-content a:hover {
  text-decoration: underline;
}

.post-content code {
  background: var(--gray-100);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: 'Monaco', 'Courier New', monospace;
  font-size: 0.9em;
}

.read-more {
  margin-top: 12px !important;
  font-weight: 600;
}

.read-more a {
  color: var(--primary);
  text-decoration: none;
}

.read-more a:hover {
  text-decoration: underline;
}

/* Single Post Page */
.post-single {
  padding: 20px 0;
}

.post-single .post-title {
  font-size: 2.5rem;
  margin-bottom: 12px;
}

.post-single .post-meta {
  font-size: 1rem;
  margin-bottom: 16px;
}

.post-navigation {
  margin-top: 40px;
  padding-top: 30px;
  border-top: 1px solid var(--gray-200);
}

.post-navigation a {
  color: var(--primary);
  text-decoration: none;
  font-weight: 600;
}

.post-navigation a:hover {
  text-decoration: underline;
}

/* Archive Pages */
.archive-header {
  margin-bottom: 30px;
  padding-bottom: 20px;
  border-bottom: 2px solid var(--gray-100);
}

.archive-header h2 {
  font-size: 2rem;
  margin-bottom: 8px;
  color: var(--gray-900);
}

.archive-header p {
  color: var(--gray-600);
  font-size: 1.05rem;
}

/* Taxonomy Lists (Categories & Tags Index) */
.taxonomy-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 16px;
  margin-top: 30px;
}

.taxonomy-item {
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  transition: all 0.2s;
}

.taxonomy-item:hover {
  border-color: var(--primary);
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.1);
}

.taxonomy-link {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px;
  text-decoration: none;
  color: var(--gray-900);
}

.taxonomy-name {
  font-weight: 600;
  font-size: 1.1rem;
}

.taxonomy-count {
  font-size: 0.9rem;
  color: var(--gray-500);
  background: var(--gray-100);
  padding: 4px 10px;
  border-radius: 4px;
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--gray-600);
}

.empty-state p {
  font-size: 1.1rem;
}

.empty-state a {
  color: var(--primary);
  text-decoration: none;
  font-weight: 600;
}

.empty-state a:hover {
  text-decoration: underline;
}

/* Info Box */
.info-box {
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 20px;
  margin: 30px 0;
}

.info-box h3 {
  margin-bottom: 12px;
  color: var(--gray-900);
}

.info-box ul {
  margin-left: 20px;
  color: var(--gray-700);
}

.info-box ul li {
  margin-bottom: 8px;
}

.info-box strong {
  color: var(--gray-900);
}

/* Footer */
footer {
  margin-top: 60px;
  padding-top: 30px;
  border-top: 2px solid var(--gray-100);
  text-align: center;
  color: var(--gray-600);
  font-size: 0.9rem;
}

footer a {
  color: var(--primary);
  text-decoration: none;
}

footer a:hover {
  text-decoration: underline;
}

footer p {
  margin-bottom: 8px;
}

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

  header h1 {
    font-size: 2rem;
  }

  .post-single .post-title {
    font-size: 1.75rem;
  }

  .form-row {
    grid-template-columns: 1fr;
  }

  .form-actions {
    flex-direction: column;
  }

  .form-actions button {
    width: 100%;
  }

  .taxonomy-list {
    grid-template-columns: 1fr;
  }

  nav {
    gap: 10px;
  }
}

/* Print Styles */
@media print {
  body {
    background: white;
    padding: 0;
  }

  .container {
    box-shadow: none;
    max-width: 100%;
  }

  nav, .post-navigation, footer, .info-box {
    display: none;
  }
}
