/* themes/casper/assets/css/style.css */

/* ═══════════════════════════════════════════
   Specter Casper Theme — Typography-Driven Blog
   ═══════════════════════════════════════════ */

/* ── Custom Properties ── */
:root {
  /* Typography */
  --font-display: 'Cabinet Grotesk', sans-serif;
  --font-body: 'Source Serif 4', Georgia, serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;

  /* Type Scale (Major Third — 1.25) */
  --text-xs: 0.75rem;     /* 12px */
  --text-sm: 0.875rem;    /* 14px */
  --text-base: 1.125rem;  /* 18px */
  --text-lg: 1.25rem;     /* 20px */
  --text-xl: 1.5625rem;   /* 25px */
  --text-2xl: 1.953rem;   /* 31px */
  --text-3xl: 2.441rem;   /* 39px */
  --text-4xl: 3.052rem;   /* 49px */

  /* Colors — Warm Paper Foundation */
  --bg-primary: #FDFBF7;
  --bg-secondary: #F5F2EB;
  --bg-hero: #F0EDE5;
  --border: #E4DFD5;

  /* Ink Hierarchy */
  --text-primary: #1A1714;
  --text-body: #2C2825;
  --text-secondary: #6B6560;
  --text-tertiary: #9C9590;

  /* Accent */
  --accent: #2D5A27;
  --accent-hover: #3D7A35;
  --accent-underline: rgba(45, 90, 39, 0.2);
  --accent-subtle: #E8F0E6;

  /* Layout */
  --body-max-width: 720px;
  --container-max-width: 1100px;
  --body-line-height: 1.7;
  --body-letter-spacing: -0.01em;

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(26, 23, 20, 0.04);
  --shadow-md: 0 4px 12px rgba(26, 23, 20, 0.06);
  --shadow-lg: 0 12px 32px rgba(26, 23, 20, 0.08);
}

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

/* ── Base ── */
html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: var(--body-line-height);
  letter-spacing: var(--body-letter-spacing);
  color: var(--text-body);
  background-color: var(--bg-primary);
}

/* Paper grain texture */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.03;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='1'/%3E%3C/svg%3E");
  background-repeat: repeat;
  background-size: 256px 256px;
  z-index: 9999;
}

a {
  color: var(--accent);
  text-decoration-color: var(--accent-underline);
  text-underline-offset: 2px;
  text-decoration-thickness: 2px;
  transition: color 0.15s ease, text-decoration-color 0.15s ease;
}

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

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

/* ── Site Header ── */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background-color: var(--bg-primary);
  border-bottom: 1px solid var(--border);
  height: 64px;
}

.site-header-inner {
  max-width: var(--container-max-width);
  margin: 0 auto;
  padding: 0 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
}

.site-logo img {
  height: 32px;
  width: auto;
}

.site-title {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--text-primary);
  text-decoration: none;
  letter-spacing: -0.02em;
}

.site-title:hover {
  color: var(--text-primary);
}

.site-header-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Navigation */
.site-nav .nav-list {
  list-style: none;
  display: flex;
  gap: 24px;
}

.site-nav .nav-list a {
  font-family: var(--font-display);
  font-size: var(--text-sm);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-secondary);
  text-decoration: none;
  position: relative;
  padding: 4px 0;
}

.site-nav .nav-list a::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  right: 50%;
  height: 1.5px;
  background-color: var(--text-primary);
  transition: left 0.2s ease, right 0.2s ease;
}

.site-nav .nav-list a:hover {
  color: var(--text-primary);
}

.site-nav .nav-list a:hover::after {
  left: 0;
  right: 0;
}

.site-nav .nav-list .nav-current a {
  color: var(--text-primary);
}

.site-nav .nav-list .nav-current a::after {
  left: 0;
  right: 0;
}

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

.nav-toggle-bar {
  display: block;
  width: 22px;
  height: 2px;
  background-color: var(--text-primary);
  transition: transform 0.2s ease;
}

/* ── Hero Section ── */
.hero {
  background-color: var(--bg-hero);
  padding: 120px 48px;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.hero-cover {
  position: absolute;
  inset: 0;
  opacity: 0.2;
  object-fit: cover;
  width: 100%;
  height: 100%;
  filter: blur(1px);
}

.hero-content {
  position: relative;
  z-index: 1;
  max-width: var(--container-max-width);
  margin: 0 auto;
}

.hero-title {
  font-family: var(--font-display);
  font-size: var(--text-4xl);
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1.1;
  margin-bottom: 16px;
}

.hero-description {
  font-family: var(--font-body);
  font-style: italic;
  font-size: var(--text-lg);
  color: var(--text-secondary);
  max-width: 600px;
  margin: 0 auto;
}

/* ── Post Feed / Card Grid ── */
.post-feed {
  max-width: var(--container-max-width);
  margin: 0 auto;
  padding: 48px;
}

/* Featured first post — full width */
.post-card-featured {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 48px;
  margin-bottom: 48px;
  align-items: center;
}

.post-card-featured .post-card-image {
  border-radius: 8px;
  overflow: hidden;
  aspect-ratio: 16 / 10;
}

.post-card-featured .post-card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.post-card-featured .post-card-title {
  font-family: var(--font-display);
  font-size: var(--text-2xl);
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
  margin-bottom: 12px;
}

.post-card-featured .post-card-title a {
  color: inherit;
  text-decoration: none;
}

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

.post-card-featured .post-card-excerpt {
  font-family: var(--font-body);
  font-size: var(--text-base);
  color: var(--text-secondary);
  margin-bottom: 16px;
}

/* Post grid */
.post-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 32px;
}

.post-card {
  transition: transform 0.2s ease;
}

.post-card:hover {
  transform: translateY(-2px);
}

.post-card-image {
  border-radius: 8px;
  overflow: hidden;
  aspect-ratio: 16 / 10;
  margin-bottom: 16px;
}

.post-card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: filter 0.2s ease;
}

.post-card:hover .post-card-image img {
  filter: brightness(1.05);
}

.post-card-tag {
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
  margin-bottom: 8px;
  display: block;
  text-decoration: none;
}

.post-card-title {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.25;
  margin-bottom: 8px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.post-card-title a {
  color: inherit;
  text-decoration: none;
}

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

.post-card-excerpt {
  font-family: var(--font-body);
  font-size: var(--text-sm);
  color: var(--text-secondary);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 16px;
}

.post-card-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-body);
  font-size: var(--text-sm);
  color: var(--text-tertiary);
}

.post-card-meta .author-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  object-fit: cover;
}

.post-card-meta .separator {
  color: var(--text-tertiary);
}

/* ── Single Post ── */
.post-feature-image {
  width: 100%;
  max-height: 560px;
  overflow: hidden;
  position: relative;
}

.post-feature-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.post-feature-image::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 120px;
  background: linear-gradient(transparent, var(--bg-primary));
}

.post-header {
  max-width: var(--body-max-width);
  margin: 0 auto;
  padding: 48px 24px;
  text-align: center;
}

.post-header-tag {
  font-family: var(--font-display);
  font-size: var(--text-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
  text-decoration: none;
  display: inline-block;
  margin-bottom: 16px;
}

.post-header-title {
  font-family: var(--font-display);
  font-size: var(--text-4xl);
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1.15;
  margin-bottom: 24px;
}

.post-header-meta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: var(--text-sm);
  color: var(--text-secondary);
}

.post-header-meta .author-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
}

.post-header-meta a {
  font-family: var(--font-display);
  font-weight: 500;
  color: var(--text-primary);
  text-decoration: none;
}

.post-header-meta a:hover {
  color: var(--accent);
}

/* Post Content */
.post-content {
  max-width: var(--body-max-width);
  margin: 0 auto;
  padding: 0 24px 48px;
}

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

.post-content h2 {
  font-family: var(--font-display);
  font-size: var(--text-2xl);
  font-weight: 700;
  color: var(--text-primary);
  margin-top: 56px;
  margin-bottom: 16px;
  line-height: 1.25;
}

.post-content h3 {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: 700;
  color: var(--text-primary);
  margin-top: 48px;
  margin-bottom: 12px;
  line-height: 1.3;
}

.post-content blockquote {
  border-left: 3px solid var(--accent);
  padding-left: 24px;
  font-style: italic;
  color: var(--text-secondary);
  margin: 32px 0;
}

.post-content code {
  font-family: var(--font-mono);
  font-size: 0.9em;
  background-color: var(--bg-secondary);
  padding: 2px 6px;
  border-radius: 4px;
}

.post-content pre {
  background-color: var(--text-primary);
  color: var(--bg-secondary);
  padding: 24px;
  border-radius: 8px;
  overflow-x: auto;
  margin: 32px 0;
}

.post-content pre code {
  background: none;
  padding: 0;
  border-radius: 0;
  font-size: 0.875rem;
  line-height: 1.6;
}

.post-content img {
  max-width: 100%;
  border-radius: 8px;
  margin: 32px auto;
}

.post-content figcaption {
  font-size: var(--text-sm);
  color: var(--text-tertiary);
  font-style: italic;
  text-align: center;
  margin-top: 8px;
}

.post-content a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-color: var(--accent-underline);
  text-underline-offset: 2px;
  text-decoration-thickness: 2px;
}

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

.post-content hr {
  border: none;
  text-align: center;
  margin: 48px 0;
}

.post-content hr::before {
  content: '\00B7\00A0\00A0\00B7\00A0\00A0\00B7';
  color: var(--text-tertiary);
  font-size: var(--text-lg);
  letter-spacing: 0.2em;
}

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

.post-content li {
  margin-bottom: 8px;
}

/* Post Footer */
.post-footer {
  max-width: var(--body-max-width);
  margin: 0 auto;
  padding: 0 24px 48px;
}

.post-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 48px;
}

.post-tags a {
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  background-color: var(--bg-secondary);
  padding: 6px 14px;
  border-radius: 20px;
  text-decoration: none;
  transition: color 0.15s ease, background-color 0.15s ease;
}

.post-tags a:hover {
  color: var(--accent);
  background-color: var(--accent-subtle);
}

.post-divider {
  text-align: center;
  margin: 0 0 48px;
  color: var(--text-tertiary);
  font-size: var(--text-lg);
  letter-spacing: 0.2em;
}

.author-card {
  background-color: var(--bg-secondary);
  border-radius: 12px;
  padding: 32px;
  display: flex;
  gap: 24px;
  align-items: flex-start;
  margin-bottom: 48px;
}

.author-card-avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.author-card-name {
  font-family: var(--font-display);
  font-size: var(--text-base);
  font-weight: 700;
  margin-bottom: 4px;
}

.author-card-name a {
  color: var(--text-primary);
  text-decoration: none;
}

.author-card-name a:hover {
  color: var(--accent);
}

.author-card-bio {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  margin-bottom: 12px;
}

.author-card-social {
  display: flex;
  gap: 12px;
}

.author-card-social a {
  color: var(--text-tertiary);
  text-decoration: none;
}

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

/* Post Navigation (Next/Prev) */
.post-nav {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 32px;
  border-top: 1px solid var(--border);
  padding-top: 48px;
}

.post-nav-item {
  text-decoration: none;
}

.post-nav-item:last-child {
  text-align: right;
}

.post-nav-label {
  font-family: var(--font-display);
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-tertiary);
  margin-bottom: 8px;
  display: block;
}

.post-nav-title {
  font-family: var(--font-display);
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--text-primary);
}

.post-nav-item:hover .post-nav-title {
  color: var(--accent);
}

/* ── Page ── */
.page-header {
  max-width: var(--body-max-width);
  margin: 0 auto;
  padding: 64px 24px 32px;
  text-align: center;
}

.page-title {
  font-family: var(--font-display);
  font-size: var(--text-3xl);
  font-weight: 800;
  color: var(--text-primary);
}

.page-content {
  max-width: var(--body-max-width);
  margin: 0 auto;
  padding: 0 24px 64px;
}

/* ── Tag Archive ── */
.tag-header {
  background-color: var(--bg-secondary);
  padding: 64px 48px;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.tag-header-image {
  position: absolute;
  inset: 0;
  opacity: 0.1;
  object-fit: cover;
  width: 100%;
  height: 100%;
}

.tag-header-content {
  position: relative;
  z-index: 1;
}

.tag-header-name {
  font-family: var(--font-display);
  font-size: var(--text-3xl);
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 12px;
}

.tag-header-description {
  font-family: var(--font-body);
  font-size: var(--text-lg);
  color: var(--text-secondary);
  max-width: 600px;
  margin: 0 auto 12px;
}

.tag-header-count {
  font-size: var(--text-sm);
  color: var(--text-tertiary);
}

/* ── Author Archive ── */
.author-header {
  background-color: var(--bg-secondary);
  padding: 64px 48px;
  text-align: center;
}

.author-header-avatar {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  object-fit: cover;
  margin: 0 auto 16px;
}

.author-header-name {
  font-family: var(--font-display);
  font-size: var(--text-3xl);
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 12px;
}

.author-header-bio {
  font-family: var(--font-body);
  font-size: var(--text-base);
  color: var(--text-secondary);
  max-width: 540px;
  margin: 0 auto 16px;
}

.author-header-meta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  font-size: var(--text-sm);
  color: var(--text-tertiary);
  margin-bottom: 8px;
}

.author-header-meta a {
  color: var(--text-tertiary);
  text-decoration: none;
}

.author-header-meta a:hover {
  color: var(--accent);
}

.author-header-count {
  font-size: var(--text-sm);
  color: var(--text-tertiary);
}

/* ── Error Page ── */
.error-page {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 60vh;
  text-align: center;
  padding: 48px;
}

.error-code {
  font-family: var(--font-display);
  font-size: 120px;
  font-weight: 800;
  color: var(--text-tertiary);
  line-height: 1;
  margin-bottom: 16px;
}

.error-message {
  font-family: var(--font-body);
  font-size: var(--text-lg);
  color: var(--text-secondary);
  margin-bottom: 24px;
}

.error-link {
  font-family: var(--font-display);
  font-size: var(--text-base);
  font-weight: 500;
}

/* ── Pagination ── */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 24px;
  padding: 48px 0;
  font-family: var(--font-display);
  font-size: var(--text-sm);
}

.pagination a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
}

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

.pagination-info {
  color: var(--text-tertiary);
}

/* ── Site Footer ── */
.site-footer {
  background-color: var(--bg-secondary);
  padding: 64px 48px 32px;
}

.site-footer-inner {
  max-width: var(--container-max-width);
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 32px;
  align-items: start;
  margin-bottom: 48px;
}

.site-footer-title {
  font-family: var(--font-display);
  font-size: var(--text-base);
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.site-footer-description {
  font-family: var(--font-body);
  font-style: italic;
  font-size: var(--text-sm);
  color: var(--text-secondary);
}

.site-footer-nav ul {
  list-style: none;
  display: flex;
  gap: 24px;
}

.site-footer-nav a {
  font-family: var(--font-display);
  font-size: var(--text-sm);
  color: var(--text-secondary);
  text-decoration: none;
}

.site-footer-nav a:hover {
  color: var(--text-primary);
}

.site-footer-right {
  display: flex;
  gap: 16px;
  justify-content: flex-end;
}

.social-link {
  color: var(--text-tertiary);
  text-decoration: none;
  transition: color 0.15s ease;
}

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

.site-footer-bottom {
  max-width: var(--container-max-width);
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  font-size: var(--text-xs);
  color: var(--text-tertiary);
  border-top: 1px solid var(--border);
  padding-top: 24px;
}

.site-footer-powered a {
  color: var(--text-tertiary);
  text-decoration: none;
}

.site-footer-powered a:hover {
  color: var(--accent);
}

/* ═══════════════════════════════════════════
   Responsive Design
   ═══════════════════════════════════════════ */

/* Tablet */
@media (max-width: 1024px) {
  .site-header-inner {
    padding: 0 32px;
  }

  .hero {
    padding: 80px 32px;
  }

  .post-feed {
    padding: 32px;
  }

  .site-footer {
    padding: 48px 32px 24px;
  }

  .post-card-featured {
    gap: 32px;
  }
}

/* Mobile */
@media (max-width: 768px) {
  .site-header-inner {
    padding: 0 16px;
  }

  .nav-toggle {
    display: flex;
  }

  .site-nav {
    display: none;
    position: absolute;
    top: 64px;
    left: 0;
    right: 0;
    background-color: var(--bg-primary);
    border-bottom: 1px solid var(--border);
    padding: 16px;
    box-shadow: var(--shadow-md);
  }

  .site-nav.is-open {
    display: block;
  }

  .site-nav .nav-list {
    flex-direction: column;
    gap: 12px;
  }

  .hero {
    padding: 64px 16px;
  }

  .hero-title {
    font-size: var(--text-3xl);
  }

  .post-feed {
    padding: 24px 16px;
  }

  .post-card-featured {
    grid-template-columns: 1fr;
    gap: 24px;
  }

  .post-grid {
    grid-template-columns: 1fr;
  }

  .post-header-title {
    font-size: var(--text-3xl);
  }

  .post-header {
    padding: 32px 16px;
  }

  .post-content {
    padding: 0 16px 32px;
  }

  .post-footer {
    padding: 0 16px 32px;
  }

  .post-nav {
    grid-template-columns: 1fr;
    gap: 24px;
  }

  .post-nav-item:last-child {
    text-align: left;
  }

  .page-header {
    padding: 48px 16px 24px;
  }

  .page-content {
    padding: 0 16px 48px;
  }

  .tag-header {
    padding: 48px 16px;
  }

  .author-header {
    padding: 48px 16px;
  }

  .author-card {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }

  .site-footer {
    padding: 48px 16px 24px;
  }

  .site-footer-inner {
    grid-template-columns: 1fr;
    text-align: center;
    gap: 24px;
  }

  .site-footer-right {
    justify-content: center;
  }

  .site-footer-bottom {
    flex-direction: column;
    align-items: center;
    gap: 8px;
  }

  .error-code {
    font-size: 80px;
  }
}
