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

html {
  scroll-behavior: smooth;
}

body {
  font-family: "Space Grotesk", sans-serif;
  background: #fafafa;
  color: #111;
  line-height: 1.6;
  font-size: 17px;
  padding-top: 96px;
}

/* Grid Background */
.grid-bg {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-image:
    linear-gradient(rgba(0, 0, 0, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 0, 0, 0.03) 1px, transparent 1px);
  background-size: 60px 60px;
  pointer-events: none;
  z-index: 0;
}

/* Site Header (for all pages except homepage) */
.site-header {
  padding: 32px 0;
  border-bottom: 1px solid #e0e0e0;
  background: rgba(250, 250, 250, 0.95);
  backdrop-filter: blur(10px);
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
}

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

.site-header .logo {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.5px;
  color: #111;
  text-decoration: none;
  transition: opacity 0.2s ease;
}

.site-header .logo:hover {
  opacity: 0.6;
}

.site-header nav {
  display: flex;
  gap: 24px;
}

.site-header nav a {
  color: #111;
  text-decoration: none;
  font-weight: 500;
  font-size: 0.9rem;
  padding-bottom: 2px;
  border-bottom: 2px solid transparent;
  transition: border-color 0.2s ease;
}

.site-header nav a:hover {
  border-bottom-color: #111;
}

.site-header nav a.active {
  color: #111;
  font-weight: 600;
  border-bottom: 2px solid #111;
}

/* Container */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
  position: relative;
  z-index: 1;
}

.container-narrow {
  max-width: 800px;
}

/* Buttons */
.btn {
  display: inline-block;
  padding: 14px 28px;
  border: 2px solid #111;
  background: #111;
  color: #fff;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 500;
  letter-spacing: 1px;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
  text-align: center;
}

.btn:hover {
  background: transparent;
  color: #111;
}

.btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.btn-secondary {
  background: transparent;
  color: #111;
}

.btn-secondary:hover {
  background: #f5f5f5;
}

.btn-small {
  padding: 8px 16px;
  font-size: 0.85rem;
}

/* Forms */
.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  font-weight: 500;
  margin-bottom: 8px;
  font-size: 0.9rem;
}

.form-group label span {
  color: #999;
  font-weight: 400;
  font-size: 0.85rem;
}

.form-group input,
.form-group textarea,
.form-group select {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid #ddd;
  background: #fafafa;
  font-family: inherit;
  font-size: 1rem;
  color: #111;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  outline: none;
  border-color: #111;
  background: #fff;
}

.form-group textarea {
  min-height: 100px;
  resize: vertical;
}

.form-group input[type="checkbox"] {
  width: auto;
  margin-right: 8px;
}

.form-group input[type="file"] {
  padding: 8px;
}

.checkbox-wrapper {
  display: flex;
  align-items: center;
}

/* Typography */
h1 {
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -1px;
}

h2 {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.5px;
}

h3 {
  font-size: 1.2rem;
  font-weight: 700;
}

/* Loading & Messages */
.loading {
  text-align: center;
  padding: 80px 24px;
  color: #999;
}

.empty-state {
  text-align: center;
  padding: 80px 24px;
  color: #999;
}

.error {
  text-align: center;
  padding: 80px 24px;
  color: #e44;
}

.message {
  padding: 16px 24px;
  margin-bottom: 24px;
  border-left: 3px solid #111;
  display: none;
}

.message.show {
  display: block;
}

.message.success {
  background: #d4edda;
  border-color: #28a745;
  color: #155724;
}

.message.error {
  background: #f8d7da;
  border-color: #dc3545;
  color: #721c24;
}

/* Cards */
.card {
  background: #fff;
  border: 1px solid #e0e0e0;
  padding: 32px;
}

/* Footer */
footer {
  padding: 60px 0;
  border-top: 1px solid #e0e0e0;
  text-align: center;
  color: #ccc;
  font-size: 0.8rem;
  margin-top: 80px;
}

/* Modal */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.modal.show {
  display: flex;
}

.modal-content {
  background: #fff;
  max-width: 600px;
  width: 100%;
  padding: 40px;
  border: 1px solid #e0e0e0;
  max-height: 90vh;
  overflow-y: auto;
}

.modal-header {
  margin-bottom: 32px;
}

.modal-header h2 {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.modal-header p {
  color: #666;
  font-size: 0.9rem;
}

.modal-actions {
  display: flex;
  gap: 12px;
  margin-top: 32px;
}

.modal-actions button {
  flex: 1;
}

/* Responsive */
@media (max-width: 768px) {
  h1 {
    font-size: 1.5rem;
  }
}

@media (max-width: 600px) {
  body {
    font-size: 16px;
  }

  .container {
    padding: 0 16px;
  }
}

/* Markdown content styles */
.article {
  padding-top: 40px;
}

.content p {
  margin-bottom: 24px;
  color: #333;
  font-size: 1.05rem;
  line-height: 1.8;
}

.content strong {
  color: #111;
  font-weight: 600;
}

.content em {
  font-style: italic;
  color: #666;
}

.content h2 {
  font-size: 1.8rem;
  margin: 48px 0 24px;
}

.content h3 {
  font-size: 1.4rem;
  margin: 40px 0 20px;
}

.content blockquote {
  background: #f9f9f9;
  border-left: 3px solid #111;
  padding: 24px 32px;
  margin: 32px 0;
  font-size: 1.1rem;
  font-weight: 500;
  line-height: 1.6;
}

.content blockquote p {
  margin-bottom: 0;
}

.content ul,
.content ol {
  margin: 24px 0;
  padding-left: 32px;
}

.content li {
  margin-bottom: 12px;
  color: #333;
  font-size: 1.05rem;
  line-height: 1.8;
}

.content code {
  background: #f5f5f5;
  padding: 2px 8px;
  font-family: "Courier New", monospace;
  font-size: 0.9em;
  border-radius: 3px;
}

.content pre {
  background: #f5f5f5;
  padding: 20px;
  margin: 24px 0;
  overflow-x: auto;
  border-left: 3px solid #ddd;
}

.content pre code {
  background: none;
  padding: 0;
}

.cta-section {
  margin: 80px 0;
  padding: 48px;
  background: #fff;
  border: 1px solid #e0e0e0;
  text-align: center;
}

.cta-section h3 {
  font-size: 1.5rem;
  margin-bottom: 16px;
}

.cta-section p {
  color: #666;
  margin-bottom: 32px;
  font-size: 1rem;
}

@media (max-width: 600px) {
  .article-header h1 {
    font-size: 1.8rem;
  }

  .content blockquote {
    padding: 20px;
    font-size: 1rem;
  }

  .cta-section {
    padding: 32px 24px;
  }
}