/* ==========================================================================
   Casagbic Blog — bespoke article + listing styles.
   Loaded after style.css (reuses its :root tokens and nav/footer/canvas).
   ========================================================================== */

:root {
  --blog-measure: 46rem;       /* readable content column */
  --blog-gap: clamp(2.5rem, 6vw, 4.5rem);
}

/* Keep the code-rain canvas quiet behind reading content */
#global-canvas { opacity: 0.5; }

/* Reading-progress bar */
.reading-bar {
  position: fixed;
  top: 0; left: 0;
  height: 3px; width: 0;
  background: linear-gradient(90deg, var(--orange), var(--purple));
  z-index: 1000;
  transition: width 0.1s linear;
}

/* ============================ Shared shell ============================ */
.blog-main {
  position: relative;
  z-index: 1;
  padding: clamp(7rem, 12vw, 9rem) 1.25rem var(--blog-gap);
}
.blog-wrap { max-width: var(--blog-measure); margin: 0 auto; }
.blog-wide { max-width: 72rem; margin: 0 auto; }

.eyebrow {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.72rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--orange);
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}
.eyebrow::before {
  content: '';
  width: 1.4rem; height: 1px;
  background: var(--orange);
  display: inline-block;
}

/* ============================ Article header ============================ */
.article__head { margin-bottom: clamp(2rem, 5vw, 3rem); }
.article__title {
  font-family: 'Syne', sans-serif;
  font-weight: 800;
  font-size: clamp(2rem, 5.5vw, 3.25rem);
  line-height: 1.08;
  letter-spacing: -0.02em;
  color: var(--white);
  margin: 1rem 0 1.25rem;
}
.article__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.8rem;
  color: var(--muted-light);
}
.article__meta .dot { color: var(--muted); }
.article__tags { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 1.25rem; }
.tag {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.7rem;
  letter-spacing: 0.04em;
  color: var(--muted-light);
  padding: 0.3rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: 100px;
  background: rgba(255,255,255,0.02);
}

/* ============================ Article body (prose) ============================ */
.prose { color: var(--muted-light); }
.prose > * + * { margin-top: 1.4rem; }

.prose .lead {
  font-size: clamp(1.15rem, 2.4vw, 1.4rem);
  line-height: 1.6;
  color: var(--white);
  font-weight: 400;
}

.prose p, .prose li {
  font-size: 1.075rem;
  line-height: 1.8;
}
.prose strong { color: var(--white); font-weight: 600; }
.prose em { color: var(--white); }

.prose a {
  color: var(--orange);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
  transition: color 0.15s ease;
}
.prose a:hover { color: #ff9d52; }

.prose h2 {
  font-family: 'Syne', sans-serif;
  font-weight: 700;
  font-size: clamp(1.5rem, 3.5vw, 2rem);
  line-height: 1.2;
  letter-spacing: -0.01em;
  color: var(--white);
  margin-top: clamp(2.75rem, 6vw, 3.75rem);
  padding-top: 0.75rem;
  position: relative;
}
.prose h2::before {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 2.5rem; height: 3px;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--orange), transparent);
}
.prose h3 {
  font-family: 'Syne', sans-serif;
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--white);
  margin-top: 2.25rem;
}

.prose ul, .prose ol { padding-left: 0; list-style: none; }
.prose ul > li { position: relative; padding-left: 1.6rem; }
.prose ul > li::before {
  content: '';
  position: absolute;
  left: 0; top: 0.72em;
  width: 7px; height: 7px;
  border-radius: 2px;
  background: var(--orange);
  transform: rotate(45deg);
}
.prose ol { counter-reset: li; }
.prose ol > li { position: relative; padding-left: 2.2rem; counter-increment: li; }
.prose ol > li::before {
  content: counter(li);
  position: absolute;
  left: 0; top: 0.15em;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.8rem;
  color: var(--orange);
  border: 1px solid var(--orange-border);
  border-radius: 6px;
  width: 1.5rem; height: 1.5rem;
  display: grid; place-items: center;
}

.prose blockquote {
  border-left: 3px solid var(--orange);
  background: var(--orange-dim);
  padding: 1rem 1.4rem;
  border-radius: 0 10px 10px 0;
  color: var(--white);
  font-style: italic;
}

.prose code {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.88em;
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--border);
  padding: 0.12em 0.4em;
  border-radius: 6px;
  color: #ffb27a;
}
.prose pre {
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1.25rem 1.4rem;
  overflow-x: auto;
}
.prose pre code {
  background: none; border: none; padding: 0; color: var(--white);
  font-size: 0.85rem; line-height: 1.7;
}

.prose img {
  max-width: 100%; height: auto;
  border-radius: 14px;
  border: 1px solid var(--border);
}

/* Tables (e.g. the checklist) */
.prose .table-wrap { overflow-x: auto; border-radius: 14px; border: 1px solid var(--border); }
.prose table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
  min-width: 32rem;
}
.prose thead th {
  background: var(--orange-dim);
  color: var(--white);
  font-family: 'Syne', sans-serif;
  text-align: left;
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--orange-border);
}
.prose tbody td { padding: 0.8rem 1rem; border-bottom: 1px solid var(--border); vertical-align: top; }
.prose tbody tr:nth-child(even) { background: rgba(255,255,255,0.015); }
.prose tbody tr:last-child td { border-bottom: none; }

/* ============================ Components ============================ */
.callout {
  display: flex;
  gap: 0.9rem;
  background: var(--orange-dim);
  border: 1px solid var(--orange-border);
  border-radius: 14px;
  padding: 1.1rem 1.25rem;
  color: var(--white);
}
.callout svg { flex-shrink: 0; color: var(--orange); margin-top: 2px; }
.callout p { margin: 0; font-size: 1rem; line-height: 1.65; }

.faq { margin-top: 1.25rem; display: grid; gap: 0.85rem; }
.faq__item {
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1.1rem 1.35rem;
  background: rgba(255,255,255,0.015);
}
.faq__q {
  font-family: 'Syne', sans-serif;
  font-weight: 700;
  color: var(--white);
  font-size: 1.05rem;
  margin: 0 0 0.5rem;
}
.faq__a { margin: 0; color: var(--muted-light); line-height: 1.7; }

/* CTA block */
.post-cta {
  margin-top: var(--blog-gap);
  text-align: center;
  background:
    radial-gradient(120% 120% at 50% 0%, var(--orange-dim), transparent 70%),
    var(--bg-alt);
  border: 1px solid var(--orange-border);
  border-radius: 20px;
  padding: clamp(2rem, 5vw, 3rem);
}
.post-cta h2 {
  font-family: 'Syne', sans-serif;
  font-weight: 800;
  font-size: clamp(1.4rem, 3.5vw, 2rem);
  color: var(--white);
  margin: 0 0 0.6rem;
}
.post-cta p { color: var(--muted-light); margin: 0 auto 1.5rem; max-width: 34rem; }

/* Related posts */
.related { margin-top: var(--blog-gap); }
.related__title {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.78rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted-light);
  margin-bottom: 1.25rem;
}
.related__grid { display: grid; gap: 1rem; grid-template-columns: 1fr; }
@media (min-width: 640px) { .related__grid { grid-template-columns: 1fr 1fr; } }

/* ============================ Listing ============================ */
.blog-hero { text-align: center; margin-bottom: clamp(2.5rem, 6vw, 4rem); }
.blog-hero h1 {
  font-family: 'Syne', sans-serif;
  font-weight: 800;
  font-size: clamp(2.25rem, 7vw, 4rem);
  line-height: 1.05;
  letter-spacing: -0.02em;
  color: var(--white);
  margin: 1rem 0 1rem;
}
.blog-hero p { color: var(--muted-light); font-size: 1.15rem; max-width: 36rem; margin: 0 auto; line-height: 1.6; }

.post-grid {
  display: grid;
  gap: 1.5rem;
  grid-template-columns: 1fr;
}
@media (min-width: 720px) { .post-grid { grid-template-columns: 1fr 1fr; } }

.post-card {
  display: flex;
  flex-direction: column;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 1.6rem 1.6rem 1.5rem;
  text-decoration: none;
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}
.post-card:hover {
  transform: translateY(-4px);
  border-color: var(--orange-border);
  box-shadow: 0 18px 50px rgba(0,0,0,0.45);
}
.post-card__eyebrow {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--orange);
}
.post-card__title {
  font-family: 'Syne', sans-serif;
  font-weight: 700;
  font-size: 1.3rem;
  line-height: 1.25;
  color: var(--white);
  margin: 0.7rem 0 0.6rem;
}
.post-card__excerpt { color: var(--muted-light); font-size: 0.98rem; line-height: 1.6; flex: 1; }
.post-card__meta {
  display: flex; align-items: center; gap: 0.5rem;
  margin-top: 1.25rem;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.75rem;
  color: var(--muted);
}
.post-card__more { color: var(--orange); font-weight: 600; margin-left: auto; }

/* Back link */
.back-link {
  display: inline-flex; align-items: center; gap: 0.45rem;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.8rem;
  color: var(--muted-light);
  text-decoration: none;
  margin-bottom: 1.5rem;
}
.back-link:hover { color: var(--orange); }

@media (prefers-reduced-motion: reduce) {
  #global-canvas { display: none; }
  .post-card { transition: none; }
}
