/* ==========================================================================
   Dork In a Tent - Clean Editorial Theme
   ========================================================================== */

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

:root {
  --bg: #fafaf8;
  --surface: #ffffff;
  --surface-alt: #f3f2ee;
  --border: #e4e2dc;
  --border-light: #eeece6;
  --text: #1a1a1a;
  --text-secondary: #4a4a4a;
  --text-muted: #8a8a8a;
  --accent: #c0392b;
  --accent-hover: #a93226;
  --accent-light: rgba(192, 57, 43, 0.06);
  --font-heading: 'Playfair Display', Georgia, 'Times New Roman', serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'SF Mono', monospace;
  --max-width: 720px;
  --wide-width: 900px;
  --header-height: 72px;
}

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

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
}

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

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

img {
  max-width: 100%;
  height: auto;
}

::selection {
  background: rgba(192, 57, 43, 0.12);
  color: var(--text);
}

.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(250, 250, 248, 0.95);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-light);
  height: var(--header-height);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--header-height);
  max-width: var(--wide-width);
  margin: 0 auto;
  padding: 0 1.5rem;
}

.site-logo {
  text-decoration: none;
}

.logo-text {
  font-family: var(--font-heading);
  font-size: 1.375rem;
  font-weight: 900;
  color: var(--text);
  letter-spacing: -0.01em;
}

.site-nav {
  display: flex;
  gap: 2rem;
  align-items: center;
}

.nav-link {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-muted);
  letter-spacing: 0.03em;
  transition: color 0.15s ease;
  position: relative;
}

.nav-link:hover {
  color: var(--text);
}

.nav-link.active {
  color: var(--text);
}

.nav-link.active::after {
  content: '';
  position: absolute;
  bottom: -6px;
  left: 0;
  right: 0;
  height: 1.5px;
  background: var(--accent);
}

/* Mobile nav toggle */
.nav-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
  flex-direction: column;
  gap: 5px;
}

.nav-toggle span {
  display: block;
  width: 22px;
  height: 1.5px;
  background: var(--text);
  transition: transform 0.3s, opacity 0.3s;
  border-radius: 1px;
}

.nav-toggle.open span:nth-child(1) {
  transform: rotate(45deg) translate(4.5px, 4.5px);
}

.nav-toggle.open span:nth-child(2) {
  opacity: 0;
}

.nav-toggle.open span:nth-child(3) {
  transform: rotate(-45deg) translate(4.5px, -4.5px);
}

@media (max-width: 768px) {
  .nav-toggle {
    display: flex;
  }

  .site-nav {
    display: none;
    position: absolute;
    top: var(--header-height);
    left: 0;
    right: 0;
    background: var(--surface);
    border-bottom: 1px solid var(--border-light);
    flex-direction: column;
    padding: 1.25rem 1.5rem;
    gap: 0.75rem;
    box-shadow: 0 8px 24px rgba(0,0,0,0.06);
  }

  .site-nav.open {
    display: flex;
  }
}

/* ---------- Main ---------- */
.site-main {
  padding: 3.5rem 0 5rem;
  min-height: calc(100vh - var(--header-height) - 80px);
}

/* ---------- Posts List (Home) ---------- */
.posts-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.post-preview {
  padding: 2.25rem 0;
  border-bottom: 1px solid var(--border-light);
  transition: background 0.15s ease;
}

.post-preview:first-child {
  padding-top: 0;
}

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

.post-preview-image img {
  width: 100%;
  aspect-ratio: 2/1;
  object-fit: cover;
  display: block;
  border-radius: 4px;
  margin-bottom: 1.25rem;
}

.post-preview-content {
  padding: 0;
}

.post-preview-date {
  font-size: 0.8125rem;
  color: var(--text-muted);
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 400;
}

.post-preview-title {
  font-family: var(--font-heading);
  font-size: 1.625rem;
  font-weight: 700;
  line-height: 1.3;
  margin-bottom: 0.5rem;
  letter-spacing: -0.01em;
}

.post-preview-title a {
  color: var(--text);
  transition: color 0.15s ease;
}

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

.post-preview-categories {
  margin-bottom: 0.5rem;
}

.category-tag {
  display: inline-block;
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
  margin-right: 0.75rem;
}

.post-preview-excerpt {
  color: var(--text-secondary);
  font-size: 0.9375rem;
  line-height: 1.65;
  margin-bottom: 0.75rem;
}

.read-more {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--accent);
  letter-spacing: 0.01em;
}

.read-more:hover {
  color: var(--accent-hover);
  text-decoration: underline;
}

/* Pagination */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 2rem;
  margin-top: 2.5rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border-light);
}

.pagination-link {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--accent);
  transition: color 0.15s ease;
}

.pagination-link:hover {
  color: var(--accent-hover);
  text-decoration: underline;
}

.pagination-info {
  font-size: 0.8125rem;
  color: var(--text-muted);
}

/* ---------- Single Post ---------- */
.post-header {
  margin-bottom: 2.5rem;
}

.post-title {
  font-family: var(--font-heading);
  font-size: 2.75rem;
  font-weight: 900;
  line-height: 1.15;
  color: var(--text);
  margin-bottom: 1rem;
  letter-spacing: -0.02em;
}

.post-date {
  font-size: 0.875rem;
  color: var(--text-muted);
  display: block;
  margin-bottom: 0.5rem;
}

.post-categories {
  margin-top: 0.5rem;
}

.post-featured-image {
  margin-bottom: 2.5rem;
}

.post-featured-image img {
  width: 100%;
  border-radius: 4px;
}

.post-content {
  font-size: 1.0625rem;
  line-height: 1.85;
  color: var(--text-secondary);
}

.post-content h2 {
  font-family: var(--font-heading);
  font-size: 1.75rem;
  font-weight: 700;
  margin-top: 3rem;
  margin-bottom: 1rem;
  color: var(--text);
  letter-spacing: -0.01em;
}

.post-content h3 {
  font-family: var(--font-heading);
  font-size: 1.375rem;
  font-weight: 700;
  margin-top: 2.25rem;
  margin-bottom: 0.75rem;
  color: var(--text);
}

.post-content p {
  margin-bottom: 1.5rem;
}

.post-content ul,
.post-content ol {
  margin-bottom: 1.5rem;
  padding-left: 1.25rem;
}

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

.post-content li::marker {
  color: var(--text-muted);
}

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

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

.post-content img {
  display: block;
  margin: 2rem auto;
  border-radius: 4px;
}

.post-content a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-color: rgba(192, 57, 43, 0.3);
  text-underline-offset: 2px;
  transition: text-decoration-color 0.15s ease;
}

.post-content a:hover {
  text-decoration-color: var(--accent);
}

/* Code blocks */
.post-content code {
  font-family: var(--font-mono);
  font-size: 0.85em;
  background: var(--surface-alt);
  color: var(--text);
  padding: 0.15em 0.4em;
  border-radius: 3px;
}

.post-content pre {
  background: var(--surface-alt);
  border-radius: 6px;
  padding: 1.25rem 1.5rem;
  overflow-x: auto;
  margin: 2rem 0;
  line-height: 1.55;
  border: 1px solid var(--border-light);
}

.post-content pre code {
  background: none;
  padding: 0;
  font-size: 0.8125rem;
  color: var(--text);
}

/* Post footer / tags */
.post-footer {
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border-light);
}

.post-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.post-tag {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-muted);
  background: var(--surface-alt);
  padding: 0.3em 0.75em;
  border-radius: 3px;
}

/* ---------- Page ---------- */
.page-header {
  margin-bottom: 2.5rem;
}

.page-title {
  font-family: var(--font-heading);
  font-size: 2.75rem;
  font-weight: 900;
  color: var(--text);
  letter-spacing: -0.02em;
}

.page-content {
  font-size: 1.0625rem;
  line-height: 1.85;
  color: var(--text-secondary);
}

.page-content p {
  margin-bottom: 1.5rem;
}

.page-content ul,
.page-content ol {
  margin-bottom: 1.5rem;
  padding-left: 1.25rem;
}

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

.page-content a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-color: rgba(192, 57, 43, 0.3);
  text-underline-offset: 2px;
}

.page-content a:hover {
  text-decoration-color: var(--accent);
}

.page-content img {
  display: block;
  margin: 2rem auto;
  border-radius: 4px;
}

/* ---------- Footer ---------- */
.site-footer {
  padding: 2.5rem 0;
  border-top: 1px solid var(--border-light);
  text-align: center;
}

.site-footer p {
  font-size: 0.8125rem;
  color: var(--text-muted);
  font-weight: 400;
}

/* ---------- Responsive ---------- */
@media (max-width: 640px) {
  .post-title,
  .page-title {
    font-size: 2rem;
  }

  .post-preview-title {
    font-size: 1.375rem;
  }

  .post-content,
  .page-content {
    font-size: 1rem;
  }

  .site-main {
    padding: 2rem 0 3rem;
  }

  .header-inner {
    padding: 0 1rem;
  }
}
