/* ==========================================================================
   yin Solutions — blog post layout
   Loaded after css/site.css on every page in /blogs/.

   Contents
   1. Post header (breadcrumb, title, meta line)
   2. Cover image
   3. Layout: sticky table of contents + reading column
   4. Article typography
   5. Article components (callout, card grid, steps, timeline, stats, FAQ)
   6. End of article: takeaways, author box, call to action
   7. Related posts
   ========================================================================== */


/* 1. Post header ---------------------------------------------------------- */
.post-head { padding-block: clamp(2.5rem, 7vw, 5rem) clamp(1.5rem, 4vw, 2.5rem); }
.post-head .wrap { max-width: 900px; }

.breadcrumb { display: flex; flex-wrap: wrap; gap: 0.4rem; list-style: none; padding: 0; color: var(--muted); font-size: var(--step--1); }
.breadcrumb li + li::before { content: "/"; margin-right: 0.4rem; color: var(--line-strong); }
.breadcrumb a { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; min-width: 44px; text-decoration: none; }
.breadcrumb a:hover { color: var(--link); text-decoration: underline; text-underline-offset: 0.2em; }

.post-topic-tag { margin-top: 1.75rem; color: var(--link); font-size: var(--step--1); font-weight: 600; }
.post-head h1 {
  margin-top: 0.6rem;
  font-size: clamp(2rem, 1.5rem + 2.4vw, 3.4rem);
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.08;
}
.post-lede { margin-top: 1.25rem; color: var(--muted); font-size: var(--step-1); line-height: 1.55; max-width: 44rem; }

.post-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1.5rem;
  margin-top: 1.75rem;
  color: var(--muted);
  font-size: var(--step--1);
}
.post-meta .by { display: inline-flex; align-items: center; gap: 0.55rem; color: var(--text); font-weight: 600; }
.post-meta .by img { width: 28px; height: 28px; }


/* 2. Cover image ---------------------------------------------------------- */
.post-cover { max-width: 1060px; margin-inline: auto; padding-inline: var(--gutter); }
.post-cover img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--surface);
}


/* 3. Layout --------------------------------------------------------------- */
.post-layout {
  display: grid;
  grid-template-columns: minmax(0, 15rem) minmax(0, 42rem);
  justify-content: center;
  gap: clamp(2rem, 5vw, 4.5rem);
  padding-block: clamp(2.5rem, 6vw, 4.5rem);
}

.post-toc { position: sticky; top: calc(var(--nav-h) + 1.5rem); align-self: start; font-size: 0.93rem; }
.post-toc h2 { font-family: var(--font-body); font-size: var(--step--1); font-weight: 600; color: var(--muted); letter-spacing: 0; }
.post-toc ol { margin-top: 0.85rem; list-style: none; padding: 0; border-left: 1px solid var(--line); }
.post-toc a {
  display: block;
  padding: 0.75rem 0 0.75rem 1rem;
  margin-left: -1px;
  border-left: 2px solid transparent;
  color: var(--muted);
  text-decoration: none;
  line-height: 1.35;
  transition: color 0.2s, border-color 0.2s;
}
.post-toc a:hover { color: var(--text); border-left-color: var(--link); }
.post-toc .toc-sub a { padding-left: 1.75rem; font-size: 0.9em; }

@media (max-width: 980px) {
  .post-layout { grid-template-columns: minmax(0, 42rem); }
  /* On smaller screens the contents list sits above the article, collapsed */
  .post-toc { position: static; padding: 1rem 1.25rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
}


/* 4. Article typography --------------------------------------------------- */
/* Reading column: ~68 characters per line, generous line height */
.article { font-size: clamp(1.05rem, 1rem + 0.25vw, 1.16rem); line-height: 1.75; color: #d6d5e3; }
.article > * + * { margin-top: 1.25em; }
.article h2 {
  margin-top: 2.6em;
  color: var(--text);
  font-size: var(--step-2);
  line-height: 1.2;
  scroll-margin-top: calc(var(--nav-h) + 1.5rem);
}
.article h3 { margin-top: 2em; color: var(--text); font-size: var(--step-1); line-height: 1.3; }
.article h2 + *, .article h3 + * { margin-top: 0.75em; }
.article > :first-child { margin-top: 0; }
.article strong { color: var(--text); font-weight: 650; }
.article a { color: var(--link); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 0.2em; }
.article a:hover { text-decoration-thickness: 2px; }
.article ul, .article ol { padding-left: 1.3em; }
.article li + li { margin-top: 0.5em; }
.article li::marker { color: var(--link); }
.article blockquote {
  padding-left: 1.25rem;
  border-left: 3px solid var(--action);
  color: var(--text);
  font-family: var(--font-display);
  font-size: var(--step-1);
  line-height: 1.45;
}
.article code {
  padding: 0.12em 0.4em;
  background: var(--surface-2);
  border-radius: 5px;
  font-size: 0.9em;
}
.article hr { border: 0; border-top: 1px solid var(--line); margin-block: 2.5em; }

.article table { width: 100%; border-collapse: collapse; font-size: 0.95em; }
.article th, .article td { padding: 0.7rem 0.8rem; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.article th { color: var(--text); font-weight: 650; }
.table-scroll { overflow-x: auto; }


/* 5. Article components --------------------------------------------------- */

/* Callout: a short highlighted note (definition, tip, legal note) */
.callout {
  padding: 1.25rem 1.4rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 3px solid var(--link);
  border-radius: var(--radius-s);
}
.callout > * + * { margin-top: 0.6em; }
.callout-title { color: var(--text); font-weight: 650; }
.callout--legal { border-left-color: #f0b86e; }

/* Small grid of related points (e.g. four apps, two pinning types) */
.card-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; padding: 0; list-style: none; }
.article .card-grid { padding-left: 0; }
.card-grid > * { padding: 1.1rem 1.2rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-s); font-size: 0.95em; line-height: 1.6; }
.card-grid > li + li { margin-top: 0; }
.card-grid h3, .card-grid .card-title { margin: 0 0 0.35rem; font-family: var(--font-display); font-size: 1.05rem; color: var(--text); font-weight: 650; }
@media (max-width: 600px) { .card-grid { grid-template-columns: 1fr; } }

/* Numbered steps — only for content that really is a sequence */
.steps { list-style: none; padding: 0; counter-reset: step; }
.article .steps { padding-left: 0; }
.steps > li { position: relative; padding-left: 2.75rem; counter-increment: step; }
.steps > li + li { margin-top: 1rem; }
.steps > li::before {
  content: counter(step);
  position: absolute;
  left: 0; top: 0.1em;
  display: grid;
  place-items: center;
  width: 1.85rem; height: 1.85rem;
  border-radius: 50%;
  background: var(--surface-2);
  border: 1px solid var(--line-strong);
  color: var(--link);
  font-family: var(--font-display);
  font-size: 0.9rem;
  font-weight: 700;
}

/* Timeline (dated events) */
.timeline { list-style: none; padding: 0; border-left: 2px solid var(--line-strong); }
.article .timeline { padding-left: 0; }
.timeline > li { position: relative; padding: 0 0 1.25rem 1.5rem; }
.timeline > li + li { margin-top: 0; }
.timeline > li::before {
  content: "";
  position: absolute;
  left: -7px; top: 0.55em;
  width: 12px; height: 12px;
  border-radius: 50%;
  background: var(--bg);
  border: 2px solid var(--link);
}
.timeline .when { display: block; color: var(--link); font-weight: 650; font-size: 0.92em; }

/* Big numbers inside an article */
.stat-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; list-style: none; padding: 0; }
.article .stat-row { padding-left: 0; }
.stat-row > li { border-top: 2px solid var(--action); padding-top: 0.75rem; }
.stat-row > li + li { margin-top: 0; }
.stat-row .num { display: block; font-family: var(--font-display); font-size: var(--step-3); font-weight: 700; color: var(--text); line-height: 1.1; }
.stat-row .label { display: block; margin-top: 0.3rem; color: var(--muted); font-size: 0.9em; line-height: 1.4; }
@media (max-width: 520px) { .stat-row { grid-template-columns: 1fr; } }

/* FAQ inside posts — native <details>, mirrors FAQPage structured data */
.post-faq { border-top: 1px solid var(--line); }
.post-faq details { border-bottom: 1px solid var(--line); }
.post-faq summary {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding-block: 1.05rem;
  cursor: pointer;
  list-style: none;
  color: var(--text);
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.35;
}
.post-faq summary::-webkit-details-marker { display: none; }
.post-faq summary h3 { font: inherit; margin: 0; color: inherit; }
.post-faq summary::after { content: "+"; color: var(--link); font-size: 1.3em; line-height: 1; transition: transform 0.25s var(--ease); }
.post-faq details[open] summary::after { transform: rotate(45deg); }
.post-faq details > div { padding-bottom: 1.1rem; }
.post-faq details[open] > div { animation: answer-in 0.35s var(--ease); }


/* 6. End of article ------------------------------------------------------- */
.takeaways { padding: 1.5rem 1.6rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.takeaways h2 { margin-top: 0; font-size: var(--step-1); }
.takeaways ul { margin-top: 0.85rem; }

.author-box {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid var(--line);
  font-size: 1rem;
  color: var(--muted);
}
.author-box img { width: 48px; height: 48px; flex: none; }
.author-box strong { display: block; color: var(--text); font-family: var(--font-display); font-size: 1.05rem; }

.post-cta {
  margin-top: 2.5rem;
  padding: clamp(1.5rem, 4vw, 2.25rem);
  background: linear-gradient(135deg, rgba(124, 58, 237, 0.16), rgba(124, 58, 237, 0.04));
  border: 1px solid rgba(196, 162, 255, 0.28);
  border-radius: var(--radius);
}
.post-cta h2 { font-size: var(--step-2); }
.post-cta p { margin-top: 0.6rem; color: var(--muted); }
.post-cta .btn { margin-top: 1.4rem; }


/* 7. Related posts -------------------------------------------------------- */
.related { border-top: 1px solid var(--line); }
.related h2 { font-size: var(--step-2); margin-bottom: 2rem; }


/* 8. Polish: same atmosphere as the other page headers -------------------- */
.post-head {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  background: radial-gradient(50rem 30rem at 85% 0%, rgba(124, 58, 237, 0.16), transparent 65%);
}
.post-head::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background-image:
    linear-gradient(rgba(236, 235, 244, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(236, 235, 244, 0.045) 1px, transparent 1px);
  background-size: 56px 56px;
  -webkit-mask-image: radial-gradient(ellipse 70% 80% at 70% 10%, #000 25%, transparent 75%);
          mask-image: radial-gradient(ellipse 70% 80% at 70% 10%, #000 25%, transparent 75%);
}
.post-head h1 {
  background: linear-gradient(180deg, #ffffff 0%, #d9d8e6 60%, #a9a8bd 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.post-cover img { box-shadow: 0 30px 80px -40px rgba(124, 58, 237, 0.45); }
.takeaways, .callout, .card-grid > *, .post-toc { background: linear-gradient(180deg, rgba(255, 255, 255, 0.045), rgba(255, 255, 255, 0.015)); }
.post-faq details summary { transition: color 0.25s; }
.post-faq details summary:hover { color: #ddc9ff; }
