/* ================================================================
   Trunk Trick — Blog index · "Noir & Gold"
   Editorial post list + SPA article reader.
   ================================================================ */

html { font-size: 15px; }

/* ---- Blog header ---- */
.blog-header {
  text-align: left;
  padding: 4.5rem 0 3.5rem;
  transition: opacity 0.4s, max-height 0.5s, padding 0.5s;
  overflow: hidden;
  max-height: 420px;
}
.blog-header.hidden {
  opacity: 0; max-height: 0; padding: 0; margin: 0; pointer-events: none;
}

.blog-header .avatar {
  width: 56px; height: 56px;
  border-radius: 50%;
  border: 2px solid var(--ds-border-light);
  margin-bottom: 1.5rem;
  display: block;
  object-fit: cover;
  transition: border-color var(--duration-normal) var(--ease-spring), transform var(--duration-normal) var(--ease-spring);
}
.blog-header .avatar:hover { border-color: var(--ds-accent); transform: scale(1.04); }

.blog-header h1 {
  font-family: var(--font-display);
  font-size: 2.5rem;
  font-weight: 700;
  letter-spacing: -0.04em;
  color: var(--ds-text-primary);
  margin-bottom: 0.4rem;
}

.blog-header .subtitle {
  font-size: var(--text-sm);
  color: var(--ds-text-tertiary);
  letter-spacing: 0.02em;
}

.back-link {
  display: inline-flex; align-items: center; gap: 0.35rem;
  margin-top: 1.4rem;
  color: var(--ds-text-tertiary);
  text-decoration: none;
  font-size: var(--text-sm);
  transition: color var(--duration-fast) var(--ease-spring), gap var(--duration-fast) var(--ease-spring);
}
.back-link:hover { color: var(--ds-accent); gap: 0.5rem; }

/* ---- Post list ---- */
.posts-list {
  display: flex; flex-direction: column;
  gap: 0;
  transition: opacity 0.3s, max-height 0.5s;
}
.posts-list.hidden {
  opacity: 0; max-height: 0; overflow: hidden; pointer-events: none;
}

/* Featured (first) post — golden card */
.post-card-featured {
  display: block;
  text-decoration: none;
  color: inherit;
  background: linear-gradient(135deg, rgba(245,197,24,0.06), rgba(247,245,236,0.02));
  border: 1px solid rgba(245,197,24,0.16);
  border-radius: var(--radius-xl);
  padding: 2.25rem;
  margin-bottom: 3rem;
  cursor: pointer;
  box-shadow: 0 1px 0 var(--ds-edge-hi) inset;
  transition: all 0.5s var(--ease-spring);
  opacity: 0;
  transform: translateY(24px);
  filter: blur(4px);
}
.post-card-featured.visible {
  animation: cardBlurIn 0.7s var(--ease-out-quint) forwards;
}
.post-card-featured:hover {
  border-color: rgba(245,197,24,0.34);
  background: linear-gradient(135deg, rgba(245,197,24,0.09), rgba(247,245,236,0.03));
  transform: translateY(-3px);
  box-shadow: 0 0 0 1px rgba(245,197,24,0.08), 0 18px 52px rgba(0,0,0,0.5);
}
.post-card-featured:active {
  transform: scale(0.99);
  transition: transform 0.1s var(--ease-spring);
}
.post-card-featured .post-date {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--ds-accent);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 500;
  margin-bottom: 0.85rem;
}
.post-card-featured .post-title {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--ds-text-primary);
  margin-bottom: 0.8rem;
  line-height: 1.2;
}
.post-card-featured .post-excerpt {
  font-size: var(--text-base);
  color: var(--ds-text-secondary);
  line-height: 1.65;
  max-width: 62ch;
}
.post-card-featured .post-meta {
  display: flex; align-items: center; gap: 0.5rem;
  margin-top: 1.25rem;
  font-size: 0.8rem;
  color: var(--ds-accent);
  font-weight: 500;
}

/* Regular post row */
.post-card-row {
  display: grid;
  grid-template-columns: 1fr minmax(0, 2.5fr);
  gap: 1.5rem;
  padding: 1.2rem 0;
  border-top: 1px solid rgba(247,245,236,0.06);
  text-decoration: none;
  color: inherit;
  cursor: pointer;
  transition: all 0.35s var(--ease-spring);
  opacity: 0;
  transform: translateY(16px);
}
.post-card-row:last-child { border-bottom: 1px solid rgba(247,245,236,0.06); }
.post-card-row.visible { animation: cardIn 0.5s var(--ease-out-quint) forwards; }
.post-card-row:hover {
  background: rgba(247,245,236,0.025);
  padding-left: 0.8rem;
  border-top-color: rgba(245,197,24,0.14);
}
.post-card-row .post-date {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--ds-text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 500;
  padding-top: 0.18rem;
}
.post-card-row .post-info { min-width: 0; }
.post-card-row .post-title {
  font-family: var(--font-display);
  font-size: 0.98rem;
  font-weight: 500;
  letter-spacing: -0.01em;
  color: var(--ds-text-primary);
  margin-bottom: 0.22rem;
  line-height: 1.3;
}
.post-card-row:hover .post-title { color: var(--ds-accent); }
.post-card-row .post-excerpt {
  font-size: 0.83rem;
  color: var(--ds-text-tertiary);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

@keyframes cardIn {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes cardBlurIn {
  from { opacity: 0; transform: translateY(24px); filter: blur(4px); }
  to   { opacity: 1; transform: translateY(0); filter: blur(0); }
}

/* ---- Article (SPA) view ---- */
.article-view {
  display: none; opacity: 0;
  transform: translateY(24px);
  filter: blur(3px);
  transition: opacity 0.5s var(--ease-out-quint),
              transform 0.5s var(--ease-out-quint),
              filter 0.5s var(--ease-out-quint);
}
.article-view.animate-in { opacity: 1; transform: translateY(0); filter: blur(0); }
.article-view.active { display: block; }

.article-header { margin-bottom: 2rem; }
.article-header .article-date {
  font-family: var(--font-mono);
  font-size: 0.76rem;
  color: var(--ds-accent);
  letter-spacing: 0.08em;
  margin-bottom: 0.55rem;
  text-transform: uppercase;
}
.article-header h1 {
  font-family: var(--font-display);
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.15;
  color: var(--ds-text-primary);
}

.article-back-btn {
  display: inline-flex; align-items: center; gap: 0.35rem;
  color: var(--ds-accent); cursor: pointer;
  font-size: var(--text-sm); font-weight: 500;
  margin-bottom: 1.5rem;
  transition: opacity var(--duration-fast) var(--ease-spring);
}
.article-back-btn:hover { opacity: 0.75; }

/* Markdown body (SPA reader) — serif reading */
.markdown-body {
  max-width: 760px; margin: 0 auto;
  font-family: var(--font-serif);
  font-size: var(--text-base);
  line-height: 1.8;
  color: var(--ds-text-secondary);
}
.markdown-body h1 {
  font-family: var(--font-display);
  font-size: 1.3rem; font-weight: 600;
  letter-spacing: -0.02em; color: var(--ds-text-primary);
  margin-bottom: 0.6em;
}
.markdown-body h2 {
  font-family: var(--font-display);
  font-size: 1.18rem; font-weight: 600;
  letter-spacing: -0.01em; color: var(--ds-text-primary);
  margin-top: 2em; margin-bottom: 0.6em;
}
.markdown-body h3 {
  font-family: var(--font-display);
  font-size: 0.98rem; font-weight: 600;
  color: var(--ds-text-primary);
  margin-top: 1.5em; margin-bottom: 0.5em;
}
.markdown-body p { margin-bottom: 1em; line-height: 1.8; }
.markdown-body a { color: var(--ds-accent); text-decoration: underline; text-underline-offset: 3px; }
.markdown-body a:hover { color: var(--ds-accent-hover); }
.markdown-body pre {
  background: var(--ds-surface-elevated);
  border: 1px solid var(--ds-border);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  overflow-x: auto;
  margin: 1.5em 0;
  font-size: 0.85rem;
  line-height: 1.6;
}
.markdown-body pre code { background: none; padding: 0; color: inherit; font-size: inherit; }
.markdown-body code {
  background: var(--ds-accent-muted);
  color: var(--ds-accent);
  padding: 0.15em 0.45em;
  border-radius: 6px;
  font-size: 0.88em;
}
.markdown-body img {
  max-width: 100%; border-radius: var(--radius-md);
  margin: 1.2em auto; display: block;
}
.markdown-body blockquote {
  border-left: 2px solid var(--ds-accent);
  padding-left: 1rem;
  color: var(--ds-text-tertiary);
  margin: 1.2em 0;
}
.markdown-body ul, .markdown-body ol {
  padding-left: 1.5rem;
  margin-bottom: 1em;
  color: var(--ds-text-secondary);
}
.markdown-body li { margin-bottom: 0.3em; line-height: 1.65; }
.markdown-body table {
  width: 100%; border-collapse: collapse;
  margin: 1.5em 0; font-size: 0.9rem;
}
.markdown-body th, .markdown-body td {
  padding: 0.6rem 0.85rem;
  border: 1px solid var(--ds-border-subtle);
  text-align: left;
  color: var(--ds-text-secondary);
}
.markdown-body th {
  background: var(--ds-surface-elevated);
  font-weight: 600;
  color: var(--ds-text-primary);
}
.markdown-body td { background: var(--ds-surface-card); }
.markdown-body hr { border: none; border-top: 1px solid var(--ds-border-subtle); margin: 2em 0; }

mjx-container { overflow-x: auto; overflow-y: hidden; }

/* ---- Article nav ---- */
.article-nav {
  display: flex;
  justify-content: space-between;
  gap: 1.25rem;
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid var(--ds-border-subtle);
}
.article-nav .nav-btn {
  flex: 1;
  display: flex; align-items: center; gap: 0.75rem;
  padding: 1rem 1.25rem;
  border-radius: var(--radius-md);
  background: var(--ds-surface-card);
  border: 1px solid var(--ds-border-subtle);
  box-shadow: 0 1px 0 var(--ds-edge-hi) inset;
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-spring);
  text-decoration: none;
  color: var(--ds-text-primary);
}
.article-nav .nav-btn:hover {
  border-color: var(--ds-border);
  background: var(--ds-surface-hover);
}
.article-nav .nav-btn:active { transform: translateY(1px); }
.article-nav .nav-btn.next-only { margin-left: auto; max-width: 280px; }
.article-nav .nav-btn.prev-only { margin-right: auto; max-width: 280px; }
.article-nav .nav-label {
  font-family: var(--font-mono);
  font-size: 0.66rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--ds-text-tertiary);
  margin-bottom: 2px;
}
.article-nav .nav-title {
  font-family: var(--font-display);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--ds-text-primary);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  max-width: 200px;
}

/* ---- NProgress ---- */
#nprogress .bar { background: var(--ds-accent) !important; height: 2px !important; }
#nprogress .peg { box-shadow: 0 0 12px var(--ds-accent-glow), 0 0 6px var(--ds-accent) !important; }

/* ---- Background layer ---- */
.bg-layer {
  position: fixed; top: 0; left: 0; width: 100%; height: 100%;
  z-index: 0; pointer-events: none;
}
.bg-layer img {
  width: 100%; height: 100%; object-fit: cover;
  filter: brightness(0.28) saturate(0.55);
}
.bg-overlay {
  position: fixed; top: 0; left: 0; width: 100%; height: 100%;
  background: radial-gradient(ellipse at 50% 0%, rgba(245,197,24,0.05) 0%, transparent 40%),
              radial-gradient(ellipse at 50% 100%, rgba(0,0,0,0.75) 0%, transparent 70%);
  z-index: 1; pointer-events: none;
}

/* All content above background */
#tt-nav, .ds-container-narrow { position: relative; z-index: 10; }

/* ---- Responsive ---- */
@media (max-width: 640px) {
  html { font-size: 14px; }
  .post-card-featured { padding: 1.6rem; }
  .post-card-row { grid-template-columns: 1fr; gap: 0.15rem; padding: 1rem 0; }
  .post-card-row:hover { padding-left: 0; }
  .post-card-row .post-date { font-size: 0.7rem; }
  .article-nav { flex-direction: column; }
  .article-nav .nav-btn { max-width: none; }
}
