/* ─────────────────────────────────────────────────────────────────────────────
   Global Trend Analysis — Ghost Theme
   ───────────────────────────────────────────────────────────────────────────── */

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

:root {
  --ink:        #0a0e14;
  --ink-soft:   #3a4250;
  --ink-muted:  #7a8494;
  --paper:      #f4f1eb;
  --paper-warm: #ede9e0;
  --accent:     #d4440c;
  --accent-dim: #e8896a;
  --wire:       #c8c2b6;
  --mono:       'DM Mono', monospace;
  --display:    'Syne', sans-serif;
  --body:       'DM Sans', sans-serif;
}

html { scroll-behavior: smooth; }

body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--body);
  font-size: 16px;
  line-height: 1.6;
  overflow-x: hidden;
}

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

/* ── NAV ──────────────────────────────────────────────────────────────────── */
.site-nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 3rem;
  background: rgba(244,241,235,0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--wire);
}
.nav-logo {
  font-family: var(--display);
  font-weight: 800;
  font-size: 1.1rem;
  letter-spacing: -0.02em;
  color: var(--ink);
  text-decoration: none;
}
.nav-logo span { color: var(--accent); }
.nav-links {
  display: flex;
  gap: 2.5rem;
  list-style: none;
}
.nav-links a {
  font-family: var(--mono);
  font-size: 0.75rem;
  font-weight: 400;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-soft);
  text-decoration: none;
  transition: color 0.2s;
}
.nav-links a:hover,
.nav-links a.active { color: var(--accent); }
.nav-cta {
  font-family: var(--mono);
  font-size: 0.75rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--paper);
  background: var(--ink);
  border: none;
  padding: 0.6rem 1.4rem;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.2s;
}
.nav-cta:hover { background: var(--accent); }
.nav-burger { display: none; }

/* ── HERO ─────────────────────────────────────────────────────────────────── */
.hero {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr 1fr;
  padding-top: 80px;
  position: relative;
  overflow: hidden;
}
.hero-bg-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(var(--wire) 1px, transparent 1px),
    linear-gradient(90deg, var(--wire) 1px, transparent 1px);
  background-size: 48px 48px;
  opacity: 0.35;
  pointer-events: none;
}
.hero-left {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 6rem 4rem 10rem 3rem;
  position: relative;
  z-index: 1;
}
.hero-tag {
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 2rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.hero-tag::before {
  content: '';
  display: inline-block;
  width: 28px; height: 1px;
  background: var(--accent);
}
h1 {
  font-family: var(--display);
  font-size: clamp(3rem, 5vw, 5.5rem);
  font-weight: 800;
  line-height: 0.95;
  letter-spacing: -0.04em;
  color: var(--ink);
  margin-bottom: 2rem;
}
h1 em { font-style: normal; color: var(--accent); }
.hero-sub {
  font-size: 1.1rem;
  font-weight: 300;
  color: var(--ink-soft);
  max-width: 440px;
  line-height: 1.7;
  margin-bottom: 3rem;
}
.hero-actions { display: flex; gap: 1rem; align-items: center; }
.hero-right {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6rem 3rem 10rem;
  position: relative;
  z-index: 1;
}
.hero-slideshow {
  position: relative;
  width: 100%;
  max-width: 500px;
  aspect-ratio: 480 / 420;
  border: 1px solid var(--wire);
  overflow: hidden;
}
.hero-slide {
  position: absolute;
  inset: 0;
  display: block;
  opacity: 0;
  pointer-events: none;
  transition: opacity 1.2s ease;
}
.hero-slide.is-active {
  opacity: 1;
  pointer-events: auto;
  z-index: 1;
}
.hero-slide img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.4s ease;
}
.hero-slide:hover img { transform: scale(1.03); }
.hero-stats {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  display: flex;
  border-top: 1px solid var(--wire);
  z-index: 1;
  background: var(--paper);
}
.stat {
  flex: 1;
  padding: 1.5rem 2rem;
  border-right: 1px solid var(--wire);
}
.stat:last-child { border-right: none; }
.stat-num {
  font-family: var(--display);
  font-size: 2.2rem;
  font-weight: 800;
  color: var(--ink);
  letter-spacing: -0.04em;
  line-height: 1;
}
.stat-num span { color: var(--accent); }
.stat-label {
  font-family: var(--mono);
  font-size: 0.65rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-muted);
  margin-top: 0.35rem;
}

/* ── BUTTONS ──────────────────────────────────────────────────────────────── */
.btn-primary {
  font-family: var(--mono);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--paper);
  background: var(--ink);
  border: 2px solid var(--ink);
  padding: 0.9rem 2rem;
  text-decoration: none;
  transition: all 0.2s;
  display: inline-block;
}
.btn-primary:hover { background: var(--accent); border-color: var(--accent); color: var(--paper); }
.btn-ghost {
  font-family: var(--mono);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink);
  background: transparent;
  border: 2px solid var(--wire);
  padding: 0.9rem 2rem;
  text-decoration: none;
  transition: all 0.2s;
  display: inline-block;
}
.btn-ghost:hover { border-color: var(--ink); color: var(--ink); }

/* ── SECTION SHARED ───────────────────────────────────────────────────────── */
section { position: relative; }
.section-inner { max-width: 1200px; margin: 0 auto; padding: 0 3rem; }
.section-header {
  display: flex;
  align-items: baseline;
  gap: 2rem;
  margin-bottom: 4rem;
  padding-top: 6rem;
}
.section-num {
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  color: var(--accent);
  white-space: nowrap;
}
h2 {
  font-family: var(--display);
  font-size: clamp(2rem, 3vw, 3rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--ink);
  line-height: 1.05;
}

/* ── SERVICES ─────────────────────────────────────────────────────────────── */
.services-section { background: var(--ink); padding-bottom: 6rem; }
.services-section .section-num { color: var(--accent-dim); }
.services-section h2 { color: var(--paper); }
.services-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border: 1px solid rgba(255,255,255,0.1);
}
.service-card {
  padding: 2.5rem;
  border-right: 1px solid rgba(255,255,255,0.1);
  border-bottom: 1px solid rgba(255,255,255,0.1);
  transition: background 0.3s;
  position: relative;
  overflow: hidden;
}
.service-card:nth-child(3n) { border-right: none; }
.service-card:hover { background: rgba(255,255,255,0.04); }
.service-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 3px; height: 0;
  background: var(--accent);
  transition: height 0.3s;
}
.service-card:hover::before { height: 100%; }
.service-icon {
  font-family: var(--mono);
  font-size: 0.65rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent-dim);
  margin-bottom: 1.5rem;
}
.service-title {
  font-family: var(--display);
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--paper);
  margin-bottom: 1rem;
  letter-spacing: -0.02em;
}
.service-desc { font-size: 0.9rem; color: rgba(244,241,235,0.55); line-height: 1.7; }
.service-tags { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 1.5rem; }
.tag {
  font-family: var(--mono);
  font-size: 0.65rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(244,241,235,0.4);
  border: 1px solid rgba(244,241,235,0.15);
  padding: 0.25rem 0.6rem;
}

/* ── POST GRID ────────────────────────────────────────────────────────────── */
.work-section { background: var(--paper); padding-bottom: 6rem; }
.post-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2px;
}
.post-card {
  background: var(--paper-warm);
  border: 1px solid var(--wire);
  transition: border-color 0.2s;
  display: flex;
  flex-direction: column;
}
.post-card:hover { border-color: var(--ink); }
.post-card-image img { width: 100%; height: 200px; object-fit: cover; }
.post-card-body { padding: 2rem; display: flex; flex-direction: column; flex: 1; }
.post-card-meta {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
}
.post-tag {
  font-family: var(--mono);
  font-size: 0.65rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  border: 1px solid var(--accent);
  padding: 0.2rem 0.5rem;
  text-decoration: none;
}
.post-date, .post-reading-time {
  font-family: var(--mono);
  font-size: 0.65rem;
  letter-spacing: 0.06em;
  color: var(--ink-muted);
}
.post-card-title {
  font-family: var(--display);
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 0.75rem;
  line-height: 1.2;
}
.post-card-title a { text-decoration: none; color: var(--ink); }
.post-card-title a:hover { color: var(--accent); }
.post-card-excerpt { font-size: 0.9rem; color: var(--ink-soft); line-height: 1.6; flex: 1; }
.post-read-more {
  font-family: var(--mono);
  font-size: 0.75rem;
  letter-spacing: 0.06em;
  color: var(--accent);
  text-decoration: none;
  margin-top: 1.5rem;
  display: inline-block;
  transition: letter-spacing 0.2s;
}
.post-read-more:hover { letter-spacing: 0.1em; }
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2rem;
  padding-top: 3rem;
}
.pagination-info {
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--ink-muted);
}

/* ── PROCESS ──────────────────────────────────────────────────────────────── */
.process-section { background: var(--paper-warm); padding-bottom: 6rem; border-top: 1px solid var(--wire); }
.process-steps {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border: 1px solid var(--wire);
}
.process-step {
  padding: 2.5rem;
  border-right: 1px solid var(--wire);
}
.process-step:last-child { border-right: none; }
.step-num {
  font-family: var(--mono);
  font-size: 2.5rem;
  font-weight: 300;
  color: var(--wire);
  line-height: 1;
  margin-bottom: 1.5rem;
}
.step-name {
  font-family: var(--display);
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--ink);
  margin-bottom: 0.75rem;
}
.step-desc { font-size: 0.88rem; color: var(--ink-muted); line-height: 1.65; }

/* ── SINGLE POST ──────────────────────────────────────────────────────────── */
.post-full, .page-full { padding-top: 80px; }
.post-header {
  background: var(--ink);
  padding: 5rem 0 4rem;
}
.post-header-inner {
  max-width: 800px;
  margin: 0 auto;
  padding: 0 3rem;
}
.post-header-meta {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.post-title {
  font-family: var(--display);
  font-size: clamp(2rem, 4vw, 3.5rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--paper);
  line-height: 1.05;
  margin-bottom: 1rem;
}
.post-excerpt {
  font-size: 1.1rem;
  color: rgba(244,241,235,0.6);
  line-height: 1.7;
  max-width: 640px;
}
.post-feature-image {
  max-height: 500px;
  overflow: hidden;
}
.post-feature-image img { width: 100%; height: 100%; object-fit: cover; }
.post-content {
  max-width: 800px;
  margin: 0 auto;
  padding: 4rem 3rem;
}
.post-content h2 {
  font-family: var(--display);
  font-size: 1.8rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 3rem 0 1rem;
  color: var(--ink);
}
.post-content h3 {
  font-family: var(--display);
  font-size: 1.3rem;
  font-weight: 700;
  margin: 2rem 0 0.75rem;
  color: var(--ink);
}
.post-content p { margin-bottom: 1.5rem; color: var(--ink-soft); line-height: 1.8; }
.post-content ul, .post-content ol { margin: 0 0 1.5rem 1.5rem; color: var(--ink-soft); }
.post-content li { margin-bottom: 0.5rem; line-height: 1.7; }
.post-content code {
  font-family: var(--mono);
  font-size: 0.875em;
  background: var(--paper-warm);
  border: 1px solid var(--wire);
  padding: 0.15em 0.4em;
  border-radius: 2px;
}
.post-content pre {
  background: var(--ink);
  color: var(--paper);
  padding: 1.5rem;
  overflow-x: auto;
  margin: 1.5rem 0;
  border-left: 3px solid var(--accent);
}
.post-content pre code {
  background: none;
  border: none;
  padding: 0;
  color: inherit;
  font-size: 0.875rem;
}
.post-content blockquote {
  border-left: 3px solid var(--accent);
  padding: 1rem 1.5rem;
  margin: 2rem 0;
  background: var(--paper-warm);
  color: var(--ink-soft);
  font-style: italic;
}
.post-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 2rem 0;
  font-size: 0.9rem;
}
.post-content th {
  background: var(--ink);
  color: var(--paper);
  padding: 0.75rem 1rem;
  text-align: left;
  font-family: var(--mono);
  font-size: 0.75rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.post-content td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--wire);
  color: var(--ink-soft);
}
.post-content tr:hover td { background: var(--paper-warm); }
.post-footer { border-top: 1px solid var(--wire); padding: 3rem 0; }
.post-footer-inner {
  max-width: 800px;
  margin: 0 auto;
  padding: 0 3rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.post-footer-tags { display: flex; gap: 0.5rem; flex-wrap: wrap; }

/* ── TAG ARCHIVE ──────────────────────────────────────────────────────────── */
.tag-archive { padding-top: 80px; }
.archive-header {
  background: var(--ink);
  padding: 5rem 0 4rem;
  position: relative;
  overflow: hidden;
}
.archive-header.has-image {
  min-height: 360px;
  display: flex;
  align-items: flex-end;
  padding: 4rem 0 3rem;
}
.archive-header-image {
  position: absolute;
  inset: 0;
  z-index: 0;
}
.archive-header-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.archive-header-image::after {
  content: '';
  position: absolute;
  inset: 0;
  /* Keeps the white heading legible over any photo — darkest at the
     bottom where the text sits, lighter toward the top so the image
     still reads. */
  background: linear-gradient(180deg, rgba(10,14,20,0.25) 0%, rgba(10,14,20,0.92) 100%);
}
.archive-header .section-inner {
  position: relative;
  z-index: 1;
  width: 100%;
}
.archive-header h1 {
  font-family: var(--display);
  font-size: clamp(2rem, 4vw, 3.5rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--paper);
  margin-top: 0.5rem;
}
.archive-desc { color: rgba(244,241,235,0.6); margin-top: 1rem; }
.tag-archive .section-inner { padding-top: 4rem; padding-bottom: 6rem; }
.archive-subhead {
  font-family: var(--mono);
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin: 0 0 2rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--wire);
}
.post-grid + .archive-subhead { margin-top: 5rem; }

/* ── RELATED POSTS ────────────────────────────────────────────────────────── */
.related-posts {
  padding-bottom: 6rem;
  border-top: 1px solid var(--wire);
}
.related-posts .post-grid { grid-template-columns: repeat(3, 1fr); }

/* ── CONTACT ──────────────────────────────────────────────────────────────── */
.contact-section {
  background: var(--ink);
  padding: 6rem 0;
}
.contact-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 3rem;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6rem;
  align-items: start;
}
.contact-left .section-num { color: rgba(244,241,235,0.4); display: block; margin-bottom: 1rem; }
.contact-left h2 { color: var(--paper); margin-bottom: 1.5rem; }
.contact-left p { font-size: 1rem; color: rgba(244,241,235,0.6); line-height: 1.8; margin-bottom: 2rem; }
.contact-info { display: flex; flex-direction: column; gap: 1rem; }
.cinfo { display: flex; gap: 1rem; align-items: baseline; }
.cinfo-label {
  font-family: var(--mono);
  font-size: 0.65rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(244,241,235,0.35);
  min-width: 70px;
}
.cinfo-val {
  font-family: var(--mono);
  font-size: 0.85rem;
  color: var(--paper);
  text-decoration: none;
  transition: color 0.2s;
}
.cinfo-val:hover { color: var(--accent-dim); }
.contact-form { display: flex; flex-direction: column; gap: 1rem; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.form-group { display: flex; flex-direction: column; gap: 0.4rem; }
.form-group label {
  font-family: var(--mono);
  font-size: 0.65rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(244,241,235,0.4);
}
.form-group input,
.form-group textarea,
.form-group select {
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.15);
  color: var(--paper);
  padding: 0.75rem 1rem;
  font-family: var(--body);
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.2s;
  width: 100%;
}
.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus { border-color: var(--accent-dim); }
.form-group textarea { resize: vertical; min-height: 120px; }
.form-group select { appearance: none; cursor: pointer; }
.form-group select option { background: var(--ink); }
.form-submit {
  font-family: var(--mono);
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink);
  background: var(--paper);
  border: none;
  padding: 1rem 2rem;
  cursor: pointer;
  transition: background 0.2s;
  text-align: left;
}
.form-submit:hover { background: var(--accent-dim); }

/* ── FOOTER ───────────────────────────────────────────────────────────────── */
.site-footer {
  background: var(--ink);
  border-top: 1px solid rgba(255,255,255,0.08);
  padding: 2rem 3rem;
}
.footer-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.footer-logo {
  font-family: var(--display);
  font-weight: 800;
  font-size: 0.95rem;
  color: var(--paper);
  letter-spacing: -0.02em;
}
.footer-logo span { color: var(--accent); }
.footer-copy {
  font-family: var(--mono);
  font-size: 0.65rem;
  letter-spacing: 0.06em;
  color: rgba(244,241,235,0.3);
}
.footer-links { display: flex; gap: 2rem; list-style: none; }
.footer-links a {
  font-family: var(--mono);
  font-size: 0.65rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(244,241,235,0.4);
  text-decoration: none;
  transition: color 0.2s;
}
.footer-links a:hover { color: var(--paper); }

/* ── GHOST CARD ASSETS ────────────────────────────────────────────────────── */
.kg-width-wide { margin: 2rem -4rem; }
.kg-width-full { margin: 2rem -3rem; }
.kg-image-card img { width: 100%; }
.kg-gallery-container { display: grid; grid-template-columns: repeat(2, 1fr); gap: 4px; margin: 2rem 0; }
.kg-gallery-image img { width: 100%; height: 260px; object-fit: cover; }
.kg-bookmark-card {
  border: 1px solid var(--wire);
  padding: 1.5rem;
  margin: 2rem 0;
  text-decoration: none;
  display: block;
  transition: border-color 0.2s;
}
.kg-bookmark-card:hover { border-color: var(--ink); }
.kg-bookmark-title { font-weight: 600; color: var(--ink); margin-bottom: 0.5rem; }
.kg-bookmark-description { font-size: 0.9rem; color: var(--ink-muted); }
.kg-callout-card {
  display: flex;
  gap: 1rem;
  padding: 1.5rem;
  background: var(--paper-warm);
  border-left: 3px solid var(--accent);
  margin: 2rem 0;
}
.kg-callout-emoji { font-size: 1.5rem; }
.kg-toggle-card { border: 1px solid var(--wire); margin: 1rem 0; }
.kg-toggle-heading { padding: 1rem 1.5rem; font-weight: 600; cursor: pointer; }
.kg-toggle-content { padding: 0 1.5rem 1rem; }

/* ── RESPONSIVE ───────────────────────────────────────────────────────────── */
@media (max-width: 1024px) {
  .services-grid { grid-template-columns: repeat(2, 1fr); }
  .service-card:nth-child(3n) { border-right: 1px solid rgba(255,255,255,0.1); }
  .service-card:nth-child(2n) { border-right: none; }
  .post-grid { grid-template-columns: repeat(2, 1fr); }
  .process-steps { grid-template-columns: repeat(2, 1fr); }
  .process-step:nth-child(2) { border-right: none; }
}

@media (max-width: 768px) {
  .site-nav { padding: 1rem 1.5rem; }
  .nav-links, .nav-cta { display: none; }
  .nav-burger {
    display: flex;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
  }
  .nav-burger span {
    display: block;
    width: 24px; height: 2px;
    background: var(--ink);
    transition: all 0.3s;
  }
  .hero {
    grid-template-columns: 1fr;
    min-height: auto;
    height: auto;
  }
  .hero-right { display: none; }
  .hero-left { padding: 4rem 1.5rem 2rem; }
  .hero-stats {
    position: static;
    display: grid;
    grid-template-columns: 1fr 1fr;
  }
  .hero-stats .stat { border-bottom: 1px solid var(--wire); }
  .hero-stats .stat:nth-child(odd) { border-right: 1px solid var(--wire); }
  .hero-stats .stat:last-child { border-right: none; }
  .archive-header.has-image { min-height: 240px; }
  .stat { padding: 1rem 1.5rem; }
  .services-grid { grid-template-columns: 1fr; }
  .service-card:nth-child(n) { border-right: none; }
  .post-grid { grid-template-columns: 1fr; }
  .process-steps { grid-template-columns: 1fr; }
  .process-step { border-right: none; border-bottom: 1px solid var(--wire); }
  .contact-inner { grid-template-columns: 1fr; gap: 3rem; }
  .form-row { grid-template-columns: 1fr; }
  .footer-inner { flex-direction: column; gap: 1.5rem; text-align: center; }
  .footer-links { flex-wrap: wrap; justify-content: center; }
  .section-inner { padding: 0 1.5rem; }
  .section-header { flex-direction: column; gap: 0.5rem; }
  .post-header-inner { padding: 0 1.5rem; }
  .post-content { padding: 3rem 1.5rem; }
  .post-footer-inner { padding: 0 1.5rem; flex-direction: column; gap: 1rem; }
  .kg-width-wide, .kg-width-full { margin: 2rem 0; }
  .related-posts .post-grid { grid-template-columns: 1fr; }
}

/* ── STUDIES SIDEBAR LAYOUT ───────────────────────────────────────────────── */
.studies-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  min-height: 100vh;
  padding-top: 80px;
}

/* Sidebar */
.studies-sidebar {
  background: var(--ink);
  border-right: 1px solid rgba(255,255,255,0.08);
  position: sticky;
  top: 80px;
  height: calc(100vh - 80px);
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.1) transparent;
}
.studies-sidebar::-webkit-scrollbar { width: 4px; }
.studies-sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); }

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.5rem;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  position: sticky;
  top: 0;
  background: var(--ink);
  z-index: 1;
}
.sidebar-title {
  font-family: var(--mono);
  font-size: 0.65rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent-dim);
}
.sidebar-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--paper);
  cursor: pointer;
  font-size: 1rem;
}

/* Nav sections */
.sidebar-nav { padding: 1rem 0; }
.nav-section { border-bottom: 1px solid rgba(255,255,255,0.05); }
.nav-section-toggle {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  padding: 0.85rem 1.5rem;
  background: none;
  border: none;
  color: rgba(244,241,235,0.7);
  cursor: pointer;
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-align: left;
  transition: color 0.2s, background 0.2s;
}
.nav-section-toggle:hover { color: var(--paper); background: rgba(255,255,255,0.04); }
.nav-section-icon {
  font-size: 0.75rem;
  color: var(--accent);
  min-width: 16px;
}
.nav-chevron {
  margin-left: auto;
  transition: transform 0.2s;
  font-size: 0.6rem;
  color: rgba(244,241,235,0.3);
}
.nav-section-toggle.collapsed .nav-chevron { transform: rotate(-90deg); }

.nav-section-items {
  list-style: none;
  overflow: hidden;
  max-height: 1000px;
  transition: max-height 0.3s ease;
}
.nav-section-items.collapsed { max-height: 0; }
.nav-section-items li a {
  display: block;
  padding: 0.5rem 1.5rem 0.5rem 3rem;
  font-family: var(--body);
  font-size: 0.85rem;
  color: rgba(244,241,235,0.5);
  text-decoration: none;
  transition: color 0.2s, background 0.2s;
  border-left: 2px solid transparent;
}
.nav-section-items li a:hover {
  color: var(--paper);
  background: rgba(255,255,255,0.03);
  border-left-color: var(--accent);
}
.nav-section-items li a.active {
  color: var(--paper);
  border-left-color: var(--accent);
  background: rgba(212,68,12,0.08);
}
.nav-subgroup-label {
  padding: 0.6rem 1.5rem 0.25rem 3rem;
  font-family: var(--mono);
  font-size: 0.6rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(244,241,235,0.2);
}

/* Studies content area */
.studies-content {
  background: var(--paper);
  min-height: calc(100vh - 80px);
  overflow-x: hidden;
  min-width: 0;
}
.studies-post-header {
  background: var(--ink);
  padding: 3rem 4rem;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.studies-post-title {
  font-family: var(--display);
  font-size: clamp(1.4rem, 5vw, 2.5rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--paper);
  line-height: 1.1;
  margin-bottom: 0.75rem;
  word-break: break-word;
}
.studies-post-excerpt {
  font-size: 1rem;
  color: rgba(244,241,235,0.6);
  line-height: 1.7;
  max-width: 640px;
  margin-bottom: 1rem;
}
.studies-post-meta {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}
.studies-post-content {
  padding: 3rem 4rem;
  max-width: 1100px;
  overflow-x: hidden;
  font-size: 1.25rem;  /* ~17px — easier to read on desktop */
}
.studies-post-content h2 {
  font-family: var(--display);
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 3rem 0 1rem;
  color: var(--ink);
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--wire);
}
.studies-post-content h3 {
  font-family: var(--display);
  font-size: 1.2rem;
  font-weight: 700;
  margin: 2rem 0 0.75rem;
  color: var(--ink);
}
.studies-post-content h4 {
  font-family: var(--mono);
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 1.5rem 0 0.5rem;
}
.studies-post-content p {
  margin-bottom: 1.25rem;
  color: var(--ink-soft);
  line-height: 1.8;
}
.studies-post-content ul,
.studies-post-content ol {
  margin: 0 0 1.5rem 1.5rem;
  color: var(--ink-soft);
}
.studies-post-content li { margin-bottom: 0.4rem; line-height: 1.7; }
.studies-post-content code {
  font-family: var(--mono);
  font-size: 0.875em;
  background: var(--paper-warm);
  border: 1px solid var(--wire);
  padding: 0.15em 0.4em;
  border-radius: 2px;
  color: var(--accent);
}
.studies-post-content pre {
  background: var(--ink);
  color: var(--paper);
  padding: 1.5rem;
  overflow-x: auto;
  max-width: 100%;
  margin: 1.5rem 0;
  border-left: 3px solid var(--accent);
  font-family: var(--mono);
  font-size: 0.85rem;
  line-height: 1.6;
  -webkit-overflow-scrolling: touch;
}
.studies-post-content pre code {
  background: none;
  border: none;
  padding: 0;
  color: inherit;
}
.studies-post-content blockquote {
  border-left: 3px solid var(--accent);
  padding: 1rem 1.5rem;
  margin: 2rem 0;
  background: var(--paper-warm);
  color: var(--ink-soft);
}
/* Table scroll wrapper — injected by JS around every table */
.studies-post-content .table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 2rem 0;
  max-width: 100%;
  /* Fade hint on right edge so mobile users know to swipe */
  position: relative;
}
.studies-post-content .table-scroll::after {
  content: '';
  position: absolute;
  top: 0; right: 0; bottom: 0;
  width: 2rem;
  background: linear-gradient(to right, transparent, var(--paper));
  pointer-events: none;
  transition: opacity 0.2s;
}
/* Hide the fade once the user has scrolled to the end (JS removes .has-overflow) */
.studies-post-content .table-scroll.scrolled-end::after { opacity: 0; }
/* Don't show the fade if the table fits without scrolling */
.studies-post-content .table-scroll.no-overflow::after { display: none; }
.studies-post-content .table-scroll table {
  margin: 0;
}
.studies-post-content table {
  border-collapse: collapse;
  font-size: 0.9rem;
  min-width: 100%;
  /* do NOT set width:100% — let the scroll wrapper handle sizing */
}
/* Ghost kg-table-card figure */
.studies-post-content figure.kg-table-card {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  max-width: 100%;
  margin: 2rem 0;
}
.studies-post-content th {
  background: var(--ink);
  color: var(--paper);
  padding: 0.65rem 1rem;
  text-align: left;
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
}
.studies-post-content td {
  padding: 0.65rem 1rem;
  border-bottom: 1px solid var(--wire);
  color: var(--ink-soft);
  vertical-align: top;
}
.studies-post-content tr:hover td { background: var(--paper-warm); }
.studies-post-footer {
  padding: 2rem 4rem;
  border-top: 1px solid var(--wire);
}

/* Active page highlight — JS sets this */
.sidebar-nav a[href*="{{slug}}"] { 
  color: var(--paper) !important;
  border-left-color: var(--accent) !important;
  background: rgba(212,68,12,0.08) !important;
}

/* Responsive sidebar */
@media (max-width: 1024px) {
  .studies-layout { grid-template-columns: 240px 1fr; }
  .studies-post-content { padding: 2rem; }
  .studies-post-header { padding: 2rem; }
}
/* Mobile sidebar open button — hidden on desktop */
.studies-mobile-open { display: none; }
.studies-content-wrap { display: contents; }
.studies-sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(10,14,20,0.55);
  z-index: 49;
}
.studies-sidebar-overlay.active { display: block; }

@media (max-width: 768px) {
  .studies-layout {
    grid-template-columns: 1fr;
    width: 100%;
    overflow-x: hidden;
  }
  .studies-content-wrap {
    display: flex;
    flex-direction: column;
    min-width: 0;
    width: 100%;
    overflow-x: hidden;
  }

  /* Slide-in sidebar */
  .studies-sidebar {
    position: fixed;
    top: 80px; left: 0; bottom: 0;
    width: 280px;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    z-index: 50;
  }
  .studies-sidebar.open { transform: translateX(0); }

  /* Close (✕) button inside sidebar header */
  .sidebar-toggle { display: block; }

  /* Open button bar above content */
  .studies-mobile-open {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    background: var(--ink);
    color: var(--paper);
    border: none;
    padding: 0.75rem 1.5rem;
    font-family: var(--mono);
    font-size: 0.65rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    cursor: pointer;
    width: 100%;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    text-align: left;
  }
  .studies-post-content {
    padding: 1.5rem;
    max-width: 100%;
    overflow-x: hidden;
  }
  .studies-post-header { padding: 1.5rem; }
  .studies-post-footer { padding: 1.5rem; }
}/* ── POSTS PAGE ───────────────────────────────────────────────────────────────
   Add these rules to the bottom of assets/css/main.css
   ──────────────────────────────────────────────────────────────────────────── */

.posts-page { padding-top: 80px; }

.posts-page-header {
  background: var(--ink);
  padding: 5rem 0 4rem;
}
.posts-page-header .section-num {
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent-dim);
  display: block;
  margin-bottom: 1rem;
}
.posts-page-header h1 {
  color: var(--paper);
  margin-bottom: 1rem;
}
.posts-page-sub {
  font-size: 1rem;
  color: rgba(244,241,235,0.55);
  line-height: 1.7;
  max-width: 480px;
}

.posts-page-body {
  padding: 4rem 0 6rem;
  background: var(--paper);
}

@media (max-width: 768px) {
  .posts-page-header { padding: 3rem 0 2.5rem; }
}
