/* ── AutoPulse — Editorial Dark Magazine ──────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --ink:       #0e0e0e;
  --paper:     #f5f2eb;
  --cream:     #ede9e0;
  --warm:      #d4cec2;
  --accent:    #c8401a;
  --accent2:   #1a4fc8;
  --muted:     #7a7368;
  --border:    #d8d3c8;
  --serif:     'DM Serif Display', Georgia, serif;
  --sans:      'DM Sans', system-ui, sans-serif;
  --mono:      'JetBrains Mono', monospace;
}

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

body {
  font-family: var(--sans);
  background: var(--paper);
  color: var(--ink);
  line-height: 1.6;
  min-height: 100vh;
}

/* ── Header ─────────────────────────────────────────────────── */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--ink);
  color: #fff;
  border-bottom: 2px solid var(--accent);
}

.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
  height: 60px;
  display: flex;
  align-items: center;
  gap: 32px;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.brand-icon {
  font-size: 22px;
  color: var(--accent);
  line-height: 1;
}

.brand-name {
  font-family: var(--serif);
  font-size: 20px;
  color: #fff;
  letter-spacing: -0.01em;
}

.brand-tag {
  font-family: var(--mono);
  font-size: 9px;
  background: var(--accent);
  color: #fff;
  padding: 2px 6px;
  border-radius: 2px;
  letter-spacing: .05em;
  text-transform: uppercase;
}

.header-nav {
  display: flex;
  gap: 4px;
  flex: 1;
}

.nav-link {
  font-size: 13px;
  font-weight: 500;
  color: #aaa;
  text-decoration: none;
  padding: 6px 12px;
  border-radius: 4px;
  transition: color .15s, background .15s;
  white-space: nowrap;
}

.nav-link:hover, .nav-link.active {
  color: #fff;
  background: rgba(255,255,255,.08);
}

.back-link {
  font-size: 13px;
  color: #aaa;
  text-decoration: none;
  margin-left: auto;
  transition: color .15s;
}

.back-link:hover { color: #fff; }

.header-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
  flex-shrink: 0;
}

.live-dot {
  width: 7px; height: 7px;
  background: #22c55e;
  border-radius: 50%;
  animation: pulse-dot 2s ease-in-out infinite;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: .5; transform: scale(.8); }
}

.live-label {
  font-family: var(--mono);
  font-size: 10px;
  color: #22c55e;
  letter-spacing: .04em;
}

/* ── Ticker ─────────────────────────────────────────────────── */
.ticker-bar {
  background: var(--accent);
  color: #fff;
  height: 32px;
  display: flex;
  align-items: center;
  overflow: hidden;
}

.ticker-label {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: .1em;
  padding: 0 16px;
  background: rgba(0,0,0,.2);
  height: 100%;
  display: flex;
  align-items: center;
  flex-shrink: 0;
  white-space: nowrap;
}

.ticker-track {
  flex: 1;
  overflow: hidden;
  display: flex;
  align-items: center;
}

.ticker-inner {
  display: flex;
  animation: ticker-scroll 40s linear infinite;
  white-space: nowrap;
}

@keyframes ticker-scroll {
  0%   { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}

.ticker-item {
  font-size: 12px;
  font-weight: 500;
  padding: 0 32px;
  opacity: .9;
}

.ticker-sep {
  opacity: .4;
  padding: 0 8px;
}

/* ── Main Layout ─────────────────────────────────────────────── */
.main-layout {
  max-width: 1200px;
  margin: 0 auto;
  padding: 40px 24px 80px;
}

/* ── Featured ───────────────────────────────────────────────── */
.featured-section {
  margin-bottom: 48px;
}

.featured-card {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  border: 1.5px solid var(--ink);
  min-height: 380px;
  overflow: hidden;
  cursor: pointer;
  transition: box-shadow .2s;
}

.featured-card:hover {
  box-shadow: 6px 6px 0 var(--ink);
}

.featured-image {
  overflow: hidden;
  background: var(--cream);
  min-height: 380px;
}

.featured-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform .4s ease;
}

.featured-card:hover .featured-image img {
  transform: scale(1.03);
}

.featured-placeholder {
  width: 100%; height: 100%;
  background: linear-gradient(135deg, var(--ink) 0%, #2a2a2a 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 64px;
  color: rgba(255,255,255,.1);
}

.featured-content {
  padding: 40px 44px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background: var(--ink);
  color: #fff;
}

.featured-eyebrow {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}

.featured-label {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: .1em;
  color: var(--accent);
  text-transform: uppercase;
}

.featured-cat {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: .05em;
  color: #888;
  text-transform: uppercase;
}

.featured-title {
  font-family: var(--serif);
  font-size: clamp(24px, 3vw, 36px);
  line-height: 1.15;
  color: #fff;
  margin-bottom: 16px;
  flex: 1;
}

.featured-excerpt {
  font-size: 14px;
  color: #aaa;
  line-height: 1.6;
  margin-bottom: 28px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.featured-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.featured-date {
  font-family: var(--mono);
  font-size: 11px;
  color: #666;
}

.read-btn {
  font-size: 12px;
  font-weight: 500;
  color: var(--accent);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: gap .15s;
}

.read-btn:hover { gap: 10px; }

/* ── Section Divider ────────────────────────────────────────── */
.section-divider {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 32px;
}

.section-divider::before,
.section-divider::after {
  content: '';
  flex: 1;
  height: 1.5px;
  background: var(--ink);
}

.section-divider span {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--muted);
  white-space: nowrap;
}

/* ── Posts Grid ─────────────────────────────────────────────── */
.posts-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2px;
  margin-bottom: 48px;
}

.post-card {
  background: var(--cream);
  border: 1.5px solid transparent;
  display: flex;
  flex-direction: column;
  cursor: pointer;
  transition: border-color .15s, box-shadow .2s, transform .15s;
  text-decoration: none;
  color: inherit;
  overflow: hidden;
}

.post-card:hover {
  border-color: var(--ink);
  box-shadow: 4px 4px 0 var(--ink);
  transform: translate(-2px, -2px);
  z-index: 1;
  position: relative;
}

.card-image {
  aspect-ratio: 16/9;
  overflow: hidden;
  background: var(--warm);
}

.card-image img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
  transition: transform .3s;
}

.post-card:hover .card-image img {
  transform: scale(1.05);
}

.card-placeholder {
  width: 100%; height: 100%;
  background: var(--ink);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  color: rgba(255,255,255,.08);
}

.card-body {
  padding: 20px;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.card-category {
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 8px;
  display: block;
}

.card-title {
  font-family: var(--serif);
  font-size: 17px;
  line-height: 1.25;
  color: var(--ink);
  margin-bottom: 10px;
  flex: 1;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-excerpt {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 14px;
}

.card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid var(--border);
  padding-top: 12px;
  margin-top: auto;
}

.card-date {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--muted);
}

.card-source {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--accent2);
}

/* ── Pagination ─────────────────────────────────────────────── */
.pagination {
  display: flex;
  justify-content: center;
  gap: 8px;
}

.page-btn {
  width: 36px; height: 36px;
  border: 1.5px solid var(--ink);
  background: transparent;
  font-family: var(--mono);
  font-size: 12px;
  cursor: pointer;
  transition: background .15s, color .15s;
}

.page-btn:hover, .page-btn.active {
  background: var(--ink);
  color: #fff;
}

/* ── Skeleton / Loading ─────────────────────────────────────── */
.featured-skeleton {
  height: 380px;
  border: 1.5px solid var(--border);
  border-radius: 0;
}

.post-card-skeleton {
  height: 280px;
  background: var(--cream);
}

.pulse {
  animation: pulse-anim 1.5s ease-in-out infinite;
}

@keyframes pulse-anim {
  0%, 100% { opacity: 1; }
  50%       { opacity: .5; }
}

/* ── Empty State ────────────────────────────────────────────── */
.empty-state {
  grid-column: 1/-1;
  text-align: center;
  padding: 80px 20px;
}

.empty-icon { font-size: 48px; margin-bottom: 16px; opacity: .4; }
.empty-title { font-family: var(--serif); font-size: 24px; margin-bottom: 8px; }
.empty-desc { color: var(--muted); font-size: 14px; }

/* ── Post Page ──────────────────────────────────────────────── */
.post-main {
  max-width: 760px;
  margin: 0 auto;
  padding: 48px 24px 80px;
}

.post-skeleton {
  height: 600px;
}

.post-cover {
  width: calc(100% + 48px);
  margin: 0 -24px 48px;
  aspect-ratio: 16/7;
  overflow: hidden;
}

.post-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.post-meta-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.post-category {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--accent);
  border: 1px solid var(--accent);
  padding: 3px 8px;
}

.post-date {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
}

.post-source-link {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--accent2);
  text-decoration: none;
  margin-left: auto;
  opacity: .8;
  transition: opacity .15s;
}

.post-source-link:hover { opacity: 1; }

.post-title {
  font-family: var(--serif);
  font-size: clamp(28px, 5vw, 48px);
  line-height: 1.1;
  color: var(--ink);
  margin-bottom: 20px;
  letter-spacing: -.02em;
}

.post-excerpt-block {
  border-left: 3px solid var(--accent);
  padding: 12px 20px;
  background: var(--cream);
  margin-bottom: 40px;
}

.post-excerpt-block p {
  font-size: 16px;
  color: var(--muted);
  line-height: 1.6;
  font-style: italic;
}

/* ── Post Body (Markdown) ──────────────────────────────────── */
.post-body {
  font-size: 16px;
  line-height: 1.8;
  color: #1a1a1a;
}

.post-body h2 {
  font-family: var(--serif);
  font-size: 26px;
  line-height: 1.2;
  color: var(--ink);
  margin: 48px 0 16px;
  padding-top: 48px;
  border-top: 1.5px solid var(--border);
}

.post-body h3 {
  font-family: var(--serif);
  font-size: 20px;
  margin: 32px 0 12px;
}

.post-body p { margin-bottom: 20px; }

.post-body ul, .post-body ol {
  margin: 0 0 20px 28px;
}

.post-body li { margin-bottom: 6px; }

.post-body strong { font-weight: 500; color: var(--ink); }

.post-body a {
  color: var(--accent2);
  text-underline-offset: 3px;
}

.post-body code {
  font-family: var(--mono);
  font-size: 13px;
  background: var(--cream);
  border: 1px solid var(--border);
  padding: 1px 5px;
  border-radius: 2px;
}

.post-body pre {
  background: var(--ink);
  color: #e0e0e0;
  padding: 20px;
  overflow-x: auto;
  margin-bottom: 20px;
  font-family: var(--mono);
  font-size: 13px;
}

.post-body blockquote {
  border-left: 3px solid var(--accent);
  padding: 8px 20px;
  margin: 0 0 20px;
  background: var(--cream);
  font-style: italic;
  color: var(--muted);
}

/* ── Tags ───────────────────────────────────────────────────── */
.post-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 48px;
  padding-top: 32px;
  border-top: 1.5px solid var(--border);
}

.tag-pill {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: .06em;
  text-transform: uppercase;
  background: var(--cream);
  border: 1px solid var(--border);
  padding: 4px 10px;
  color: var(--muted);
}

/* ── Share bar ──────────────────────────────────────────────── */
.share-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 32px;
  padding: 20px;
  background: var(--cream);
  border: 1.5px solid var(--border);
}

.share-label {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
  flex-shrink: 0;
}

.share-url {
  flex: 1;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--border);
  padding: 6px 10px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.share-copy {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: .06em;
  background: var(--ink);
  color: #fff;
  border: none;
  padding: 8px 14px;
  cursor: pointer;
  transition: background .15s;
  white-space: nowrap;
}

.share-copy:hover { background: var(--accent); }

.ai-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 32px;
  padding: 8px 14px;
  background: var(--ink);
  color: #fff;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: .06em;
}

.ai-badge-dot {
  width: 6px; height: 6px;
  background: #22c55e;
  border-radius: 50%;
  animation: pulse-dot 2s ease-in-out infinite;
}

/* ── Footer ─────────────────────────────────────────────────── */
.site-footer {
  background: var(--ink);
  color: #aaa;
  padding: 40px 24px;
  margin-top: auto;
}

.footer-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 32px;
  flex-wrap: wrap;
}

.footer-desc {
  font-size: 12px;
  color: #666;
  margin-top: 8px;
  max-width: 480px;
  line-height: 1.6;
}

.footer-stack {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: flex-start;
}

.stack-pill {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: .06em;
  border: 1px solid #333;
  padding: 4px 10px;
  color: #666;
}

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 900px) {
  .posts-grid { grid-template-columns: repeat(2, 1fr); }
  .featured-card { grid-template-columns: 1fr; min-height: auto; }
  .featured-image { min-height: 220px; }
}

@media (max-width: 600px) {
  .posts-grid { grid-template-columns: 1fr; }
  .header-nav { display: none; }
  .featured-content { padding: 24px; }
  .featured-title { font-size: 22px; }
}
