/* ============================================
   BLOG — matches marcuskrautwurst cv-site style
   ============================================ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: #0A0A0B;
  color: #faefc3;
  line-height: 1.6;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}
a { color: #faefc3; text-decoration: none; transition: color .2s; }
a:hover { color: #f4c97e; }
img { max-width: 100%; display: block; }
button { cursor: pointer; border: none; background: none; color: inherit; font: inherit; }

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

/* --- NAV --- */
.top-nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 1000;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 2rem;
  height: 48px;
  background: rgba(10,10,11,0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.nav-logo img { width: 28px; height: 28px; display: block; }
.nav-links {
  display: flex; list-style: none; gap: 2rem;
}
.nav-links a {
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(250,239,195,0.6);
  transition: color .2s;
}
.nav-links a:hover, .nav-active { color: #f4c97e !important; }

/* --- LAYOUT --- */
.blog-main {
  max-width: 860px;
  margin: 0 auto;
  padding: 88px 2rem 4rem;
}

.blog-container {
  width: 100%;
}

/* --- SECTION LINE (matches main site) --- */
.section-line {
  height: 2px;
  background: linear-gradient(90deg, #f4c97e 0%, rgba(244,201,126,0.1) 60%, transparent 100%);
  margin: 1rem 0 2rem;
}

/* --- BLOG INDEX --- */
.blog-header {
  margin-bottom: 2rem;
}
.blog-title {
  font-family: 'Anton', sans-serif;
  font-size: clamp(2.5rem, 6vw, 4rem);
  letter-spacing: 0.04em;
  color: #faefc3;
  margin-bottom: 0;
}
.blog-subtitle {
  color: rgba(250,239,195,0.45);
  font-size: 0.85rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 2rem;
}

/* --- CARD GRID --- */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem;
  margin-top: 0.5rem;
}

.post-card {
  display: flex;
  flex-direction: column;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 4px;
  overflow: hidden;
  color: #faefc3;
  transition: border-color .2s, transform .2s;
  text-decoration: none;
}
.post-card:hover {
  border-color: rgba(244,201,126,0.4);
  transform: translateY(-3px);
  color: #faefc3;
}

.card-thumb {
  position: relative;
  aspect-ratio: 16 / 9;
  background: #111;
  overflow: hidden;
  flex-shrink: 0;
}
.card-thumb img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
  transition: transform .3s;
  margin: 0;
  border: none;
}
.post-card:hover .card-thumb img {
  transform: scale(1.04);
}
.card-thumb-overlay {
  position: absolute; inset: 0;
  background: linear-gradient(to bottom, transparent 50%, rgba(10,10,11,0.6) 100%);
}
.card-thumb-placeholder {
  width: 100%; height: 100%;
  background: repeating-linear-gradient(
    45deg,
    rgba(255,255,255,0.02),
    rgba(255,255,255,0.02) 10px,
    transparent 10px,
    transparent 20px
  );
}

.card-body {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  padding: 1rem 1.1rem 1.2rem;
  flex: 1;
}
.card-date {
  font-size: 0.72rem;
  font-family: 'JetBrains Mono', monospace;
  color: rgba(250,239,195,0.3);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.card-title {
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.3;
  color: #faefc3;
  transition: color .2s;
}
.post-card:hover .card-title { color: #f4c97e; }
.card-excerpt {
  font-size: 0.82rem;
  color: rgba(250,239,195,0.45);
  line-height: 1.5;
  margin-top: 0.2rem;
  /* clamp to 3 lines */
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* --- BLOG POST --- */
.blog-post { max-width: 720px; }

.post-header { margin-bottom: 2.5rem; }

.back-link {
  display: inline-block;
  font-size: 0.78rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(250,239,195,0.4);
  margin-bottom: 1.5rem;
  transition: color .2s;
}
.back-link:hover { color: #f4c97e; }

.post-title {
  font-family: 'Anton', sans-serif;
  font-size: clamp(1.8rem, 4vw, 3rem);
  letter-spacing: 0.03em;
  line-height: 1.15;
  color: #faefc3;
  margin-bottom: 0.75rem;
}

.post-meta {
  font-size: 0.78rem;
  font-family: 'JetBrains Mono', monospace;
  color: rgba(250,239,195,0.35);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 1rem;
}

/* --- POST CONTENT --- */
.post-content {
  font-size: 1rem;
  line-height: 1.8;
  color: rgba(250,239,195,0.88);
}
.post-content p { margin: 1em 0; }
.post-content h2 {
  font-family: 'Anton', sans-serif;
  font-size: 1.5rem;
  letter-spacing: 0.04em;
  color: #faefc3;
  margin: 2em 0 0.6em;
}
.post-content h3 {
  font-weight: 600;
  font-size: 1.1rem;
  color: #faefc3;
  margin: 1.5em 0 0.5em;
}
.post-content img {
  max-width: 100%; height: auto;
  display: block; margin: 1.5em 0;
  border: 1px solid rgba(255,255,255,0.08);
}
.post-content pre {
  margin: 1.5em 0;
  border-radius: 4px;
  overflow-x: auto;
  font-size: 0.85rem;
  border: 1px solid rgba(255,255,255,0.08);
}
.post-content pre code.hljs {
  border-radius: 4px;
  font-family: 'JetBrains Mono', Consolas, monospace;
  font-size: 0.85rem;
  line-height: 1.6;
  padding: 1.25em;
}
.post-content code:not(.hljs) {
  font-family: 'JetBrains Mono', Consolas, monospace;
  font-size: 0.88em;
  background: rgba(244,201,126,0.08);
  color: #f4c97e;
  padding: 0.1em 0.35em;
  border-radius: 3px;
}
.post-content blockquote {
  border-left: 3px solid #f4c97e;
  margin: 1.5em 0;
  padding-left: 1.25em;
  color: rgba(250,239,195,0.6);
  font-style: italic;
}
.post-content a { color: #f4c97e; }
.post-content a:hover { text-decoration: underline; }
.post-content iframe {
  max-width: 100%; margin: 1.5em 0;
  border: 1px solid rgba(255,255,255,0.08);
}
.post-content table {
  width: 100%; border-collapse: collapse; margin: 1.5em 0;
  font-size: 0.9rem;
}
.post-content td, .post-content th {
  border: 1px solid rgba(255,255,255,0.1);
  padding: 0.5em 0.75em;
  text-align: left;
}
.post-content th {
  background: rgba(255,255,255,0.04);
  font-weight: 600;
}
/* Blogger legacy div-based layout cleanup */
.post-content div { max-width: 100%; }
.post-content .separator { margin: 0.5em 0; }

/* --- COMMENTS --- */
.comments { margin-top: 3.5rem; max-width: 720px; }
.comments-title {
  font-family: 'Anton', sans-serif;
  font-size: 1.5rem;
  letter-spacing: 0.04em;
  color: #faefc3;
  margin-bottom: 0;
}
.comment {
  padding: 1.25rem 0;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.comment-meta {
  display: flex; gap: 1rem; align-items: baseline;
  margin-bottom: 0.5rem;
}
.comment-author {
  font-size: 0.85rem;
  font-weight: 600;
  color: #f4c97e;
}
.comment-date {
  font-size: 0.75rem;
  font-family: 'JetBrains Mono', monospace;
  color: rgba(250,239,195,0.3);
}
.comment-content {
  font-size: 0.92rem;
  color: rgba(250,239,195,0.75);
  line-height: 1.7;
}

/* --- COMMENT FORM --- */
.comment-form-wrap { margin-top: 2.5rem; }
.comment-form-title {
  font-family: 'Anton', sans-serif;
  font-size: 1.2rem;
  letter-spacing: 0.04em;
  color: #faefc3;
  margin-bottom: 0;
}
.comment-form {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  margin-top: 1.25rem;
  max-width: 600px;
}
.comment-label {
  font-size: 0.78rem;
  font-family: 'JetBrains Mono', monospace;
  letter-spacing: 0.08em;
  color: rgba(250,239,195,0.45);
  text-transform: uppercase;
}
.comment-input,
.comment-textarea {
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 6px;
  color: #faefc3;
  font-family: 'Inter', sans-serif;
  font-size: 0.92rem;
  padding: 0.65rem 0.85rem;
  width: 100%;
  box-sizing: border-box;
  transition: border-color 0.2s;
  resize: vertical;
}
.comment-input:focus,
.comment-textarea:focus {
  outline: none;
  border-color: rgba(244,201,126,0.5);
}
.comment-submit {
  align-self: flex-start;
  margin-top: 0.4rem;
  background: #f4c97e;
  color: #0a0a0a;
  border: none;
  border-radius: 6px;
  font-family: 'Anton', sans-serif;
  font-size: 0.9rem;
  letter-spacing: 0.06em;
  padding: 0.6rem 1.4rem;
  cursor: pointer;
  transition: opacity 0.2s;
}
.comment-submit:hover { opacity: 0.85; }

/* --- ADMIN --- */
.admin-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  margin-top: 1rem;
}
.admin-table th, .admin-table td {
  text-align: left;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.admin-table th {
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(250,239,195,0.35);
  font-weight: 500;
}
.admin-table td a:hover { color: #f4c97e; }
.admin-date {
  white-space: nowrap;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.78rem;
  color: rgba(250,239,195,0.35);
}
.admin-actions { display: flex; gap: 0.5rem; }

/* --- BUTTONS --- */
.btn {
  display: inline-block;
  padding: 0.4rem 0.9rem;
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 3px;
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  background: transparent;
  color: rgba(250,239,195,0.7);
  transition: border-color .2s, color .2s;
}
.btn:hover { border-color: #f4c97e; color: #f4c97e; }
.btn-primary {
  background: #f4c97e;
  color: #0A0A0B;
  border-color: #f4c97e;
  font-weight: 600;
}
.btn-primary:hover { background: #f7d898; border-color: #f7d898; color: #0A0A0B; }
.btn-danger { border-color: rgba(220,53,69,0.5); color: rgba(220,53,69,0.8); }
.btn-danger:hover { border-color: #dc3545; color: #dc3545; }
.btn-small { padding: 0.25rem 0.6rem; font-size: 0.72rem; }

/* --- POST FORM --- */
.post-form { display: flex; flex-direction: column; gap: 1.5rem; margin-top: 1.5rem; max-width: 860px; }
.form-field { display: flex; flex-direction: column; gap: 0.4rem; }
.form-field label {
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(250,239,195,0.4);
}
.form-field input[type=text],
.form-field input[type=datetime-local] {
  padding: 0.6rem 0.85rem;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 3px;
  font-size: 1rem;
  color: #faefc3;
  font-family: 'Inter', sans-serif;
  max-width: 480px;
  transition: border-color .2s;
}
.form-field input:focus {
  outline: none;
  border-color: #f4c97e;
}
.form-field textarea {
  padding: 0.6rem 0.85rem;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 3px;
  font-size: 0.85rem;
  font-family: 'JetBrains Mono', Consolas, monospace;
  color: rgba(250,239,195,0.85);
  resize: vertical;
  transition: border-color .2s;
}
.form-field textarea:focus {
  outline: none;
  border-color: #f4c97e;
}
.form-actions { display: flex; gap: 1rem; align-items: center; flex-wrap: wrap; }

/* --- FOOTER --- */
.site-footer {
  text-align: center;
  padding: 2rem;
  color: rgba(250,239,195,0.2);
  font-size: 0.8rem;
  border-top: 1px solid rgba(255,255,255,0.06);
  margin-top: 4rem;
}

/* --- RESPONSIVE --- */
@media (max-width: 640px) {
  .blog-main { padding: 72px 1.25rem 3rem; }
  .post-date { display: none; }
  .admin-date { display: none; }
  .top-nav { padding: 0 1.25rem; }
  .nav-links { gap: 1rem; }
  .nav-links a { font-size: 0.7rem; }
}

/* --- INFINITE SCROLL SPINNER --- */
.load-spinner {
  display: none;
  width: 32px; height: 32px;
  margin: 1.5rem auto 2rem;
  border: 3px solid rgba(244,201,126,0.15);
  border-top-color: #f4c97e;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
.load-spinner.active { display: block; }
@keyframes spin {
  to { transform: rotate(360deg); }
}
