/*
 * Blog layer for www.neurowithmrb.com/blog/
 *
 * Loaded after /assets/css/styles.css, the homepage stylesheet, so the blog
 * shares its header, footer, colours, buttons and cards. Only what the
 * homepage has no equivalent for lives here: post cards, the article page and
 * the search box.
 */

:root {
  --blog-link: #a16207;   /* gold that reads on white (the homepage .pill colour) */
  --blog-measure: 680px; /* about 75 characters a line */
}

html { scroll-padding-top: 96px; } /* the header is sticky */

.skip-link {
  position: absolute;
  left: 16px;
  top: -100px;
  z-index: 1100;
  background: #fff;
  color: var(--text);
  padding: 10px 14px;
  border-radius: 10px;
  font-weight: 700;
}
.skip-link:focus { top: 12px; }

.site-nav a.is-active { color: var(--gold); }

a:focus-visible,
button:focus-visible,
input:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 3px;
}

/* --- Dark band at the top of every blog page, as the homepage hero ------- */

.blog-hero {
  background: linear-gradient(135deg, #000, #18181b 55%, #27272a 100%);
  color: #fff;
  padding: 64px 0 72px;
}
.blog-hero h1 {
  margin: 0;
  max-width: 880px;
  font-size: clamp(36px, 5vw, 56px);
  line-height: 1.08;
}
.blog-hero h1 span { color: var(--gold); }
.blog-hero .lead { max-width: 760px; }

.blog-search { margin-top: 28px; max-width: 520px; }
.blog-search label {
  display: block;
  margin-bottom: 8px;
  color: #d4d4d8;
  font-size: 13px;
  font-weight: 700;
}
.blog-search input {
  width: 100%;
  padding: 14px 16px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  font: inherit;
  font-size: 16px;
}
.blog-search input::placeholder { color: #a1a1aa; }
.blog-status { min-height: 1.4em; margin: 10px 0 0; color: #a1a1aa; font-size: 13px; }

/* --- Post cards ------------------------------------------------------------- */

.post-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 22px;
}
.post-card {
  position: relative;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: var(--shadow);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.post-card:hover { transform: translateY(-3px); box-shadow: 0 18px 40px rgba(0, 0, 0, 0.12); }
.post-card-media { aspect-ratio: 16 / 9; background: #f4f4f5; }
.post-card-media img { width: 100%; height: 100%; object-fit: cover; }
.post-card-body {
  display: flex;
  flex: 1;
  flex-direction: column;
  align-items: flex-start;
  padding: 22px 24px 24px;
}
.post-card h3 { margin: 14px 0 10px; font-size: 21px; line-height: 1.3; }
.post-card h3 a { text-decoration: none; }
/* One link per card, on the title, stretched over the whole card. */
.post-card h3 a::after { content: ""; position: absolute; inset: 0; border-radius: 22px; }
.post-card h3 a:focus-visible { outline: none; }
.post-card:focus-within { outline: 3px solid var(--gold); outline-offset: 3px; }
.post-card p { margin: 0 0 18px; color: var(--muted); font-size: 15px; }
.post-card .read-more { margin-top: auto; color: var(--blog-link); font-size: 14px; font-weight: 700; }

/* The newest post, wide, at the top of /blog/. */
.post-card.is-featured { display: grid; grid-template-columns: 1.1fr 0.9fr; margin-bottom: 28px; }
.post-card.is-featured .post-card-media { aspect-ratio: auto; min-height: 320px; }
.post-card.is-featured .post-card-body { justify-content: center; padding: 36px 40px; }
.post-card.is-featured h3 { font-size: clamp(26px, 3vw, 34px); line-height: 1.18; }
.post-card.is-featured p { font-size: 16px; }

.blog-empty {
  padding: 32px;
  border: 1px dashed #d4d4d8;
  border-radius: 22px;
  color: var(--muted);
}

/* Page links under the grid. */
.pagination {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 8px;
  margin-top: 44px;
}
.pagination a,
.pagination span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  height: 44px;
  padding: 0 14px;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 700;
  text-decoration: none;
}
.pagination a { border: 1px solid var(--line); background: #fff; color: var(--text); }
.pagination a:hover { border-color: var(--gold); background: var(--gold-soft); }
.pagination [aria-current] { background: var(--gold); color: #111827; }
.pagination .is-disabled { border: 1px solid var(--line); color: var(--muted-light); }
.pagination .page-gap { min-width: 0; padding: 0 4px; color: var(--muted); }

/* --- Article page ------------------------------------------------------------- */

.article-hero { padding: 40px 0 128px; }
.article-hero h1 { font-size: clamp(34px, 4.6vw, 52px); }
.article-hero .lead { margin-top: 18px; }

.breadcrumb { margin: 0 0 26px; font-size: 14px; }
.breadcrumb ol { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; padding: 0; list-style: none; }
.breadcrumb li { color: #a1a1aa; }
.breadcrumb li + li::before { content: "›"; margin-right: 8px; color: #71717a; }
.breadcrumb a { color: #d4d4d8; text-decoration: none; }
.breadcrumb a:hover { color: var(--gold); }

.article-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 14px;
  margin-top: 22px;
  color: #a1a1aa;
  font-size: 14px;
}
/* The homepage .pill is made for white; on the dark band it needs lighter gold. */
.article-meta .pill {
  border: 1px solid rgba(250, 204, 21, 0.4);
  background: rgba(250, 204, 21, 0.12);
  color: #fde047;
  font-size: 12px;
}

.article-cover {
  overflow: hidden;
  margin-top: -96px;
  border-radius: var(--radius-xl);
  background: #18181b;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.28);
  aspect-ratio: 16 / 9;
  max-height: 560px;
  width: 100%;
}
.article-cover img { width: 100%; height: 100%; object-fit: cover; }

.article-layout {
  display: grid;
  grid-template-columns: minmax(0, var(--blog-measure)) 300px;
  justify-content: space-between;
  align-items: start;
  gap: 56px;
  padding: 52px 0 76px;
}

.article-body { color: #27272a; font-size: 18px; line-height: 1.8; }
/* The opening paragraph, a touch larger, leads into the article. */
.article-body > p:first-of-type { color: var(--text); font-size: 20px; line-height: 1.7; }
/* Even line breaks in headings, so no word is left alone on a line. */
.blog-hero h1,
.article-body h2,
.article-body h3,
.article-aside h2,
.post-card h3 { text-wrap: balance; }
.article-body > :first-child { margin-top: 0; }
.article-body h2 {
  margin: 46px 0 12px;
  color: var(--text);
  font-size: clamp(25px, 3vw, 31px);
  line-height: 1.22;
}
.article-body h3 { margin: 32px 0 8px; color: var(--text); font-size: 22px; line-height: 1.3; }
.article-body p { margin: 0 0 20px; }
.article-body a { color: var(--blog-link); text-decoration: underline; text-underline-offset: 3px; }
.article-body a:hover { text-decoration-thickness: 2px; }
.article-body ul,
.article-body ol { margin: 0 0 22px; padding-left: 24px; }
.article-body li { margin: 8px 0; }
.article-body li::marker { color: #ca8a04; }
.article-body blockquote {
  margin: 28px 0;
  padding: 18px 22px;
  border-left: 4px solid var(--gold);
  border-radius: 0 14px 14px 0;
  background: var(--gold-soft);
  color: var(--text);
}
.article-body blockquote p:last-child { margin-bottom: 0; }
.article-body img { height: auto; margin: 28px 0; border-radius: 18px; }
.article-body .table-wrap { overflow-x: auto; margin: 28px 0; border: 1px solid var(--line); border-radius: 14px; }
.article-body table { width: 100%; min-width: 520px; margin: 0 !important; font-size: 16px; line-height: 1.5; }
.article-body th { background: #fafafa; }
.article-body pre {
  overflow: auto;
  padding: 16px;
  border-radius: 14px;
  background: var(--dark-2);
  color: #f4f4f5;
  font-size: 15px;
}
.article-body hr { margin: 40px 0; border: 0; border-top: 1px solid var(--line); }

.article-note {
  margin: 36px 0 0;
  padding: 16px 20px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--card);
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
}

/* The sidebar: contents list and contact card, kept in view while reading. */
.article-side {
  position: sticky;
  top: 96px;
  display: grid;
  gap: 20px;
}

.toc {
  padding: 22px 24px 18px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: #fff;
  box-shadow: var(--shadow);
}
.toc-title {
  margin: 0 0 12px;
  color: var(--blog-link);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}
.toc ol {
  /* A long list scrolls inside the card, so the contact card below stays in view. */
  max-height: max(160px, calc(100vh - 520px));
  overflow-y: auto;
  margin: 0;
  padding: 0;
  list-style: none;
  border-left: 2px solid var(--line);
  scrollbar-width: thin;
}
.toc a {
  display: block;
  margin-left: -2px;
  padding: 7px 0 7px 14px;
  border-left: 2px solid transparent;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.4;
  text-decoration: none;
}
.toc a:hover { color: var(--text); }
.toc a[aria-current="true"] { border-left-color: var(--gold); color: var(--text); font-weight: 700; }

/* On smaller screens the contents list opens from a box at the top of the article. */
.article-body .toc-inline {
  display: none;
  margin: 0 0 28px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--card);
}
.article-body .toc-inline summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 18px;
  color: var(--text);
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  list-style: none;
}
.article-body .toc-inline summary::-webkit-details-marker { display: none; }
.article-body .toc-inline summary::after { content: "+"; color: var(--blog-link); font-size: 22px; line-height: 1; }
.article-body .toc-inline[open] summary::after { content: "–"; }
.article-body .toc-inline ol { margin: 0; padding: 0 18px 14px 38px; font-size: 15px; line-height: 1.5; }
.article-body .toc-inline li { margin: 6px 0; }
.article-body .toc-inline a { color: var(--text); text-decoration: none; }

.article-aside {
  padding: 26px;
  border: 1px solid rgba(250, 204, 21, 0.35);
  border-radius: 22px;
  background: var(--dark-2);
  color: #fff;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.18);
}
.article-aside h2 { margin: 0 0 10px; font-size: 22px; line-height: 1.3; }
.article-aside p { margin: 0 0 20px; color: #d4d4d8; font-size: 15px; }
.article-aside .btn { display: block; text-align: center; }
.article-aside .aside-phone {
  display: block;
  margin-top: 14px;
  color: #d4d4d8;
  font-size: 14px;
  text-align: center;
  text-decoration: none;
}
.article-aside .aside-phone:hover { color: var(--gold); }

/* --- Call to action band -------------------------------------------------------- */

.blog-cta { padding: 72px 0; }
.blog-cta-inner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 28px; }
.blog-cta h2 { margin: 0 0 10px; font-size: clamp(28px, 3.4vw, 40px); line-height: 1.15; }
.blog-cta p { max-width: 640px; margin: 0; color: #d4d4d8; }
.blog-cta .action-row { margin-top: 0; }

/* --- Smaller screens ----------------------------------------------------------- */

@media (max-width: 1024px) {
  .post-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .article-layout { grid-template-columns: minmax(0, 1fr); gap: 36px; }
  .article-side { position: static; max-width: var(--blog-measure); }
  .article-side .toc { display: none; }
  .article-body .toc-inline { display: block; }
}

@media (max-width: 760px) {
  .blog-hero { padding: 44px 0 52px; }
  .article-hero { padding: 32px 0 96px; }
  .breadcrumb li[aria-current] { display: none; } /* the title follows right below */
  .article-cover { margin-top: -72px; border-radius: var(--radius-lg); }
  .post-grid { grid-template-columns: 1fr; }
  .post-card.is-featured { grid-template-columns: 1fr; }
  .post-card.is-featured .post-card-media { aspect-ratio: 16 / 9; min-height: 0; }
  .post-card.is-featured .post-card-body { padding: 22px 24px 24px; }
  .article-body { font-size: 17px; }
  .article-body > p:first-of-type { font-size: 18px; }
  .blog-cta { padding: 56px 0; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .post-card { transition: none; }
  .post-card:hover { transform: none; }
}

@media print {
  .site-header, .site-footer, .article-aside, .blog-cta, .related-posts, .breadcrumb { display: none; }
  .blog-hero { background: none; color: #000; padding: 0 0 16px; }
  .article-cover { margin-top: 0; box-shadow: none; }
  .article-layout { display: block; padding: 0; }
}
