/* ============================================================
   PRIMEPATH - THE OBSIDIAN STANDARD
   blog.css
   ============================================================ */

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--body);
  background: var(--ink);
  color: var(--white);
  overflow-x: clip;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
a { text-decoration: none; color: inherit; }
img { display: block; max-width: 100%; height: auto; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; border: none; background: transparent; }
:focus-visible { outline: 1px solid var(--champagne); outline-offset: 3px; }

/* ── DESIGN TOKENS are centralized in design-tokens.css ─────── */

/* Listing hero */
.blog-hero,
.post-hero {
  position: relative;
  overflow: hidden;
  min-height: 64svh;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 150px var(--pad) 86px;
  color: var(--white);
}
.blog-hero::before,
.post-hero::before {
  content: '';
  position: absolute;
  inset: -4%;
  background-image: url('https://images.unsplash.com/photo-1516738901171-8eb4fc13bd20?auto=format&fit=crop&w=2400&q=85');
  background-position: center;
  background-size: cover;
  filter: brightness(0.38) saturate(0.65);
  transform: scale(1.04);
}
.blog-hero::after,
.post-hero::after {
  content: '';
  position: absolute;
  inset: 0;
  background:
    linear-gradient(to right, rgba(34,34,34,0.96) 0%, rgba(34,34,34,0.62) 52%, rgba(34,34,34,0.16) 100%),
    linear-gradient(to top, rgba(34,34,34,0.98) 0%, rgba(34,34,34,0.00) 45%);
  z-index: 1;
}
.blog-hero h1,
.post-hero h1 {
  position: relative;
  z-index: 2;
  width: min(var(--max), 100%);
  margin: 0 auto;
  font-family: var(--display);
  font-size: clamp(68px, 10vw, 140px);
  font-weight: 300;
  line-height: 0.86;
  letter-spacing: -0.025em;
  color: var(--white);
}
.blog-hero p {
  position: relative;
  z-index: 2;
  width: min(var(--max), 100%);
  max-width: 560px;
  margin: 38px auto 0;
  margin-left: calc((100% - min(var(--max), 100%)) / 2);
  font-size: 14px;
  font-weight: 300;
  line-height: 1.9;
  color: var(--white-72);
}

/* Listing layout */
.blog-container,
.post-container {
  width: min(var(--max), calc(100% - var(--pad) * 2));
  margin: 0 auto;
  padding: 92px 0 120px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 64px;
}

.category-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 34px;
}
.category-tab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 12px 16px;
  background: var(--ink-1);
  border: 1px solid var(--white-08);
  border-radius: 3px;
  color: var(--white-50);
  font-size: 8px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  transition: background 0.3s var(--ease), color 0.3s var(--ease), border-color 0.3s var(--ease);
}
.category-tab:hover {
  background: var(--ink-2);
  color: var(--white-90);
}
.category-tab.active {
  background: var(--champagne);
  color: var(--ink);
}

.posts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 10px;
}
.post-card {
  display: flex;
  flex-direction: column;
  min-height: auto;
  background: var(--ink-1);
  border: 1px solid var(--white-08);
  border-radius: 3px;
  overflow: hidden;
  word-break: break-word;
  overflow-wrap: break-word;
  transition: background 0.35s var(--ease), border-color 0.35s var(--ease);
}
.post-card:hover {
  background: var(--ink-2);
  border-color: var(--champagne-dim);
}
.post-card-img {
  width: 100%;
  height: 260px;
  object-fit: cover;
  background: var(--ink-2);
  filter: brightness(0.70) saturate(0.68);
  transition: filter 0.65s var(--ease), transform 0.75s var(--ease);
}
.post-card:hover .post-card-img {
  filter: brightness(0.84) saturate(0.82);
  transform: scale(1.025);
}
.post-card-body {
  padding: 32px 30px 34px;
  display: flex;
  flex: 1;
  flex-direction: column;
}
.post-card-category,
.sidebar-title,
.post-card-meta,
.post-hero-meta,
.form-label {
  font-size: 7px;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}
.post-card-category,
.sidebar-title,
.form-label { color: var(--champagne); }
.post-card-title {
  margin-top: 18px;
  font-family: var(--display);
  font-size: clamp(24px, 2.8vw, 38px);
  font-weight: 300;
  line-height: 1.02;
  letter-spacing: -0.01em;
  color: var(--white);
  word-break: break-word;
}
.post-card-title a { color: inherit; transition: color 0.3s var(--ease); }
.post-card-title a:hover { color: var(--champagne-2); }
.post-card-excerpt {
  margin-top: 18px;
  font-size: 12px;
  font-weight: 300;
  line-height: 1.78;
  color: var(--white-40);
}
.post-card-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: auto;
  padding-top: 28px;
  color: var(--white-40);
}
.dot {
  width: 4px;
  height: 4px;
  background: var(--champagne);
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 18px;
  align-self: start;
  position: sticky;
  top: 96px;
}
.sidebar-section {
  background: var(--ink-1);
  border: 1px solid var(--line);
  padding: 26px 24px;
}
.sidebar-categories,
.sidebar-recent { list-style: none; }
.sidebar-categories li,
.sidebar-recent li {
  padding: 13px 0;
  border-bottom: 1px solid var(--line);
}
.sidebar-categories li:last-child,
.sidebar-recent li:last-child { border-bottom: 0; padding-bottom: 0; }
.sidebar-categories a,
.sidebar-recent a {
  color: var(--white-72);
  font-size: 12px;
  font-weight: 300;
  line-height: 1.55;
  transition: color 0.3s var(--ease);
}
.sidebar-categories a:hover,
.sidebar-recent a:hover,
.sidebar-categories a.active { color: var(--champagne-2); }
.sidebar-recent .date {
  margin-top: 6px;
  font-size: 9px;
  font-weight: 300;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--white-40);
}

.empty-state {
  padding: 54px 36px;
  background: var(--ink-1);
  border: 1px solid var(--line);
}
.empty-state h3 {
  font-family: var(--display);
  font-size: 42px;
  font-weight: 300;
  color: var(--white);
}
.empty-state p {
  margin-top: 10px;
  color: var(--white-40);
}

.pagination {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  margin-top: 34px;
  width: max-content;
  max-width: 100%;
}
.pagination a,
.pagination span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 42px;
  height: 42px;
  padding: 0 14px;
  background: var(--ink-1);
  border: 1px solid var(--white-08);
  border-radius: 3px;
  color: var(--white-50);
  font-size: 9px;
  font-weight: 500;
  letter-spacing: 0.10em;
  text-transform: uppercase;
}
.pagination a:hover { background: var(--ink-2); color: var(--white); }
.pagination span.active { background: var(--champagne); color: var(--ink); }

/* Article */
.post-hero {
  min-height: auto;
  padding-bottom: 74px;
}
.post-hero-featured {
  position: relative;
  z-index: 2;
  width: min(960px, 100%);
  max-height: 430px;
  margin: 0 auto 42px;
  overflow: hidden;
  border: 1px solid var(--line);
}
.post-hero-featured img {
  width: 100%;
  height: min(430px, 50vw);
  min-height: 280px;
  object-fit: cover;
  filter: brightness(0.72) saturate(0.68);
}
.post-hero h1 {
  max-width: 980px;
  text-align: center;
  font-size: clamp(54px, 7vw, 112px);
}
.post-hero-meta {
  position: relative;
  z-index: 2;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-top: 32px;
  color: var(--white-50);
}
.post-hero-meta a { color: var(--champagne); }
.post-hero-meta a:hover { color: var(--champagne-2); }

.post-content {
  max-width: 820px;
  font-size: 17px;
  font-weight: 300;
  line-height: 1.9;
  color: var(--white-72);
}
.post-content h1,
.post-content h2,
.post-content h3,
.post-content h4 {
  margin: 1.5em 0 0.5em;
  font-family: var(--display);
  font-weight: 300;
  line-height: 1.05;
  letter-spacing: -0.01em;
  color: var(--white);
}
.post-content h2 { font-size: clamp(38px, 4vw, 64px); }
.post-content h3 { font-size: clamp(30px, 3vw, 44px); }
.post-content p,
.post-content ul,
.post-content ol { margin-bottom: 1.1em; }
.post-content ul,
.post-content ol { padding-left: 1.25em; }
.post-content li { margin-bottom: 0.45em; }
.post-content a { color: var(--champagne-2); border-bottom: 1px solid var(--champagne-line); }
.post-content img {
  width: 100%;
  margin: 2em 0;
  border: 1px solid var(--line);
  filter: brightness(0.78) saturate(0.76);
}
.post-content blockquote {
  margin: 2em 0;
  padding: 28px 0 28px 30px;
  border-left: 1px solid var(--champagne);
  font-family: var(--display);
  font-size: clamp(28px, 3vw, 42px);
  font-style: italic;
  line-height: 1.2;
  color: var(--white);
}
.post-content code,
.post-content pre {
  background: var(--ink-2);
  border: 1px solid var(--line);
}
.post-content code { padding: 2px 6px; font-size: 0.9em; }
.post-content pre { padding: 18px; overflow-x: auto; margin: 1.4em 0; }

.post-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  max-width: 820px;
  margin-top: 42px;
  padding-top: 28px;
  border-top: 1px solid var(--line);
}
.post-tag {
  padding: 9px 12px;
  background: var(--ink-1);
  border: 1px solid var(--white-08);
  border-radius: 3px;
  color: var(--white-50);
  font-size: 8px;
  font-weight: 400;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  word-break: break-word;
}

.comments-section {
  max-width: 820px;
  margin-top: 56px;
  padding-top: 34px;
  border-top: 1px solid var(--line);
}
.comments-title,
.comment-form h3 {
  font-family: var(--display);
  font-size: clamp(34px, 4vw, 58px);
  font-weight: 300;
  line-height: 1;
  color: var(--white);
}
.comment-item {
  margin-top: 18px;
  padding: 24px;
  background: var(--ink-1);
  border: 1px solid var(--line);
}
.comment-author {
  font-size: 12px;
  color: var(--white-90);
}
.comment-date {
  margin-top: 5px;
  font-size: 8px;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  color: var(--white-40);
}
.comment-body {
  margin-top: 14px;
  font-size: 12px;
  font-weight: 300;
  line-height: 1.75;
  color: var(--white-50);
}
.comment-empty {
  margin-top: 18px;
  color: var(--white-40);
  font-size: 12px;
  font-weight: 300;
}
.comment-form { margin-top: 42px; }
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 22px;
}
.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: var(--ink-1);
  padding: 20px 22px;
  border: 1px solid var(--line);
}
.comment-form > form > .form-group { margin-top: 10px; }
.form-input {
  width: 100%;
  background: transparent;
  border: none;
  outline: none;
  color: var(--white);
  font-size: 13px;
  font-weight: 300;
}
textarea.form-input {
  min-height: 120px;
  resize: vertical;
}
.btn-submit {
  margin-top: 18px;
  padding: 16px 28px;
  background: var(--champagne);
  color: var(--ink);
  font-size: 9px;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  transition: background 0.3s var(--ease);
}
.btn-submit:hover { background: var(--champagne-2); }
.flash {
  margin-top: 18px;
  padding: 14px 18px;
  border-left: 2px solid;
  font-size: 11px;
  font-weight: 300;
}
.flash-success {
  border-color: #3a8a5c;
  background: rgba(58,138,92,0.08);
  color: rgba(140,220,170,0.9);
}
.flash-error {
  border-color: #9b3a3a;
  background: rgba(155,58,58,0.08);
  color: rgba(220,140,140,0.9);
}

.blog-404 {
  min-height: 100svh;
  display: grid;
  place-items: center;
  padding: var(--pad);
  text-align: center;
  background: var(--ink);
}
.blog-404 h1 {
  font-family: var(--display);
  font-size: clamp(80px, 15vw, 150px);
  font-weight: 300;
  line-height: 0.9;
}
.blog-404 p {
  margin: 18px auto 30px;
  color: var(--white-40);
}
.blog-404 a {
  display: inline-flex;
  padding: 14px 24px;
  border: 1px solid var(--champagne);
  color: var(--champagne);
}

@media (max-width: 1100px) {
  :root { --pad: 40px; }
  .blog-container,
  .post-container { grid-template-columns: 1fr; }
  .sidebar { position: static; }
}

@media (max-width: 760px) {
  :root { --pad: 28px; }
  .blog-hero,
  .post-hero { padding-top: 130px; padding-bottom: 64px; }
  .blog-hero h1,
  .post-hero h1 { font-size: clamp(52px, 16vw, 82px); }
  .blog-hero p { margin-left: auto; font-size: 13px; }
  .posts-grid,
  .form-row { grid-template-columns: 1fr; }
  .blog-container,
  .post-container {
    width: min(var(--max), calc(100% - var(--pad) * 2));
    padding: 70px 0 92px;
  }
  .post-card-img { height: 220px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}
