/* ========================================================================
   TTTAS Knowledge Hub — reading system
   Mirrors drmichaelyates.co.uk reading pattern with TTTAS typography and
   colour system (Source Sans 3 + Source Serif 4 italic accent, cream +
   deep navy). One unit of content per URL: hero → shell (eyebrow, title,
   lede) → prose → questions → video → related → CTA.
   ======================================================================== */

:root {
  --hub-paper: #F5F0E7;      /* cream background */
  --hub-cream: #F5F0E7;
  --hub-ink: #17365D;         /* deep navy - primary text and headings */
  --hub-text: #1c2a45;        /* body text, very slight lift from pure ink */
  --hub-text-muted: #5a6a85;  /* muted text for lede, byline, meta */
  --hub-rule: #d9d0be;        /* warm rule/separator */
  --hub-accent: #17365D;      /* accent lines, link underlines */
  --hub-accent-deep: #0d2140; /* deeper navy for eyebrow / emphasis */
  --hub-slate: #17365D;       /* link colour */
  --hub-hover: #A84B2F;       /* warm terracotta for hover only */
}

/* ---------- Hero ---------- */
/* Sized to match the MYPL editorial standard — tall enough to be atmospheric,
   short enough that the reader isn't scrolling past a poster. */
.hub-hero {
  position: relative;
  width: 100%;
  height: clamp(220px, 26vw, 320px);
  overflow: hidden;
  background: var(--hub-ink);
}
.hub-hero img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 40%;
  display: block;
}
.hub-hero.no-image {
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #17365D 0%, #0d2140 100%);
  color: var(--hub-cream);
  font-family: 'Source Serif 4', Georgia, serif;
  font-style: italic;
  font-weight: 500;
  font-size: clamp(1.4rem, 2.4vw, 2rem);
  letter-spacing: 0.01em;
  text-align: center;
  padding: 0 2rem;
}

/* ---------- Shell (eyebrow, title, lede) ---------- */
.hub-shell {
  background: var(--hub-paper);
  color: var(--hub-ink);
  padding: 5.5rem 0 4rem;
  border-bottom: 1px solid var(--hub-rule);
}
.hub-shell-inner {
  max-width: 880px;
  margin: 0 auto;
  padding: 0 2.5rem;
}
.hub-eyebrow {
  font-family: 'Source Sans 3', system-ui, sans-serif;
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  color: var(--hub-accent-deep);
  margin-bottom: 1.2rem;
  font-weight: 600;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: 0.8rem;
}
.hub-eyebrow::before {
  content: '';
  width: 28px;
  height: 1px;
  background: var(--hub-accent);
}
.hub-eyebrow a {
  color: inherit;
  text-decoration: none;
  border-bottom: 1px solid currentColor;
  padding-bottom: 1px;
}
.hub-title {
  font-family: 'Source Sans 3', system-ui, sans-serif;
  font-size: clamp(2.2rem, 4.4vw, 3.4rem);
  font-weight: 600;
  color: var(--hub-ink);
  letter-spacing: -0.02em;
  line-height: 1.08;
  margin: 0;
}
.hub-title em {
  font-family: 'Source Serif 4', Georgia, serif;
  font-style: italic;
  color: var(--hub-accent-deep);
  font-weight: 500;
}
.hub-lede {
  font-family: 'Source Sans 3', system-ui, sans-serif;
  font-size: 1.18rem;
  line-height: 1.65;
  color: var(--hub-text-muted);
  max-width: 740px;
  margin: 1.6rem 0 0;
  font-weight: 400;
}
.hub-byline {
  margin: 1.6rem 0 0.4rem;
  display: flex;
  align-items: center;
  gap: 0.85rem;
}
.hub-byline img {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  object-fit: cover;
  display: block;
  flex-shrink: 0;
}
.hub-byline figcaption {
  font-family: 'Source Sans 3', system-ui, sans-serif;
  font-size: 0.85rem;
  color: var(--hub-text-muted);
  line-height: 1.3;
}
.hub-byline figcaption strong {
  display: block;
  color: var(--hub-ink);
  font-weight: 600;
  font-size: 0.95rem;
}

/* ---------- Body (prose + optional TOC) ---------- */
.hub-body {
  max-width: 880px;
  margin: 0 auto;
  padding: 4.5rem 2.5rem 3rem;
  background: var(--hub-cream);
}
.hub-toc {
  margin: 0 0 3rem;
  padding: 1.6rem 1.8rem;
  border: 1px solid var(--hub-rule);
  background: rgba(23, 54, 93, 0.03);
  border-radius: 2px;
}
.hub-toc-title {
  font-family: 'Source Sans 3', system-ui, sans-serif;
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--hub-accent-deep);
  font-weight: 700;
  margin: 0 0 0.9rem;
}
.hub-toc ul { list-style: none; padding: 0; margin: 0; }
.hub-toc li {
  padding: 0.35rem 0;
  font-family: 'Source Sans 3', system-ui, sans-serif;
  font-size: 0.98rem;
  line-height: 1.4;
}
.hub-toc a { color: var(--hub-ink); text-decoration: none; border-bottom: 1px dotted var(--hub-rule); padding-bottom: 1px; }
.hub-toc a:hover { border-bottom-color: var(--hub-hover); color: var(--hub-hover); }

/* ---------- Prose ---------- */
.hub-prose {
  font-family: 'Source Sans 3', system-ui, sans-serif;
  font-size: 1.06rem;
  line-height: 1.78;
  color: var(--hub-text);
}
.hub-prose p { margin: 0 0 1.4rem; }
.hub-prose p:last-child { margin-bottom: 0; }
.hub-prose > p:first-of-type::first-line {
  /* subtle lift on the opening line - optional editorial touch */
}
.hub-prose h2 {
  font-family: 'Source Sans 3', system-ui, sans-serif;
  font-size: 1.55rem;
  font-weight: 600;
  color: var(--hub-ink);
  margin: 3rem 0 1.2rem;
  letter-spacing: -0.015em;
  line-height: 1.2;
}
.hub-prose h2::after {
  content: '';
  display: block;
  width: 32px;
  height: 1px;
  background: var(--hub-accent);
  margin-top: 0.65rem;
}
.hub-prose h3 {
  font-family: 'Source Sans 3', system-ui, sans-serif;
  font-size: 1.32rem;
  font-weight: 600;
  color: var(--hub-ink);
  margin: 2.4rem 0 0.9rem;
  letter-spacing: -0.01em;
  line-height: 1.25;
  scroll-margin-top: 5rem;
}
.hub-prose h4 {
  font-family: 'Source Sans 3', system-ui, sans-serif;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--hub-accent-deep);
  margin: 2.2rem 0 0.8rem;
}
.hub-prose ul { padding-left: 0; margin: 0 0 1.4rem; list-style: none; }
.hub-prose ul li {
  padding: 0.55rem 0 0.55rem 1.8rem;
  position: relative;
  font-size: 1.02rem;
  line-height: 1.6;
  border-bottom: 1px dotted var(--hub-rule);
}
.hub-prose ul li:last-child { border-bottom: none; }
.hub-prose ul li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 1.05rem;
  width: 10px;
  height: 1px;
  background: var(--hub-accent);
}
.hub-prose em {
  font-family: 'Source Serif 4', Georgia, serif;
  font-style: italic;
  color: inherit;
}
.hub-prose strong { font-weight: 600; color: var(--hub-ink); }
.hub-prose a {
  color: var(--hub-slate);
  text-decoration: none;
  border-bottom: 1px solid var(--hub-accent);
  padding-bottom: 1px;
  transition: color 0.15s ease, border-bottom-color 0.15s ease;
}
.hub-prose a:hover { color: var(--hub-hover); border-bottom-color: var(--hub-hover); }

/* Inline images and figures inside prose — sized to sit inside the reading
   column, never wider than it, with an editorial caption below. */
.hub-prose figure {
  margin: 2.4rem 0;
}
.hub-prose figure img,
.hub-prose > img {
  display: block;
  width: 100%;
  height: auto;
  max-height: 480px;
  object-fit: cover;
  border-radius: 2px;
}
.hub-prose figure figcaption {
  font-family: 'Source Sans 3', system-ui, sans-serif;
  font-size: 0.86rem;
  color: var(--hub-text-muted);
  margin-top: 0.65rem;
  font-style: italic;
}

/* Pull quote — matches MYPL editorial voice.
   Also supports plain <blockquote> and <blockquote class="pull-quote"> markup. */
.hub-quote,
.hub-prose blockquote,
.hub-prose blockquote.pull-quote {
  margin: 2.4rem 0;
  padding: 0.4rem 0 0.4rem 1.6rem;
  border-left: 3px solid var(--hub-accent);
  background: transparent;
  font-family: 'Source Serif 4', Georgia, serif;
  font-style: italic;
  font-weight: 500;
  font-size: 1.55rem;
  line-height: 1.4;
  color: var(--hub-ink);
}
.hub-prose blockquote p { margin: 0 0 0.6rem; }
.hub-prose blockquote p:last-child { margin-bottom: 0; }

/* Legacy hub-quote panel form (kept for existing markup) */
.hub-quote.hub-quote--panel {
  padding: 1.8rem 2rem 1.8rem 2.2rem;
  background: rgba(23, 54, 93, 0.03);
  font-size: 1.24rem;
  line-height: 1.5;
}
.hub-quote p { margin: 0 0 0.4rem; }
.hub-quote p:last-child { margin-bottom: 0; }
.hub-quote .attr {
  font-family: 'Source Sans 3', system-ui, sans-serif;
  font-style: normal;
  font-weight: 400;
  font-size: 0.98rem;
  color: var(--hub-text-muted);
  margin-top: 0.4rem;
}

/* ---------- Questions men often ask (accordion) ---------- */
.hub-faq {
  background: var(--hub-paper);
  border-top: 1px solid var(--hub-rule);
  padding: 4.5rem 0 5rem;
}
.hub-faq-inner {
  max-width: 880px;
  margin: 0 auto;
  padding: 0 2.5rem;
}
.hub-faq-heading {
  font-family: 'Source Sans 3', system-ui, sans-serif;
  font-size: 1.55rem;
  font-weight: 600;
  color: var(--hub-ink);
  margin: 0;
  letter-spacing: -0.015em;
  line-height: 1.2;
}
.hub-faq-heading em {
  font-family: 'Source Serif 4', Georgia, serif;
  font-style: italic;
  color: var(--hub-accent-deep);
  font-weight: 500;
}
.hub-faq-rule {
  border: none;
  border-top: 1px solid var(--hub-rule);
  margin: 1.4rem 0 2rem;
}
.hub-faq-list {
  display: flex;
  flex-direction: column;
}
.hub-faq-item {
  border-top: 1px solid var(--hub-rule);
}
.hub-faq-item:last-child { border-bottom: 1px solid var(--hub-rule); }
.hub-faq-item > summary {
  list-style: none;
  cursor: pointer;
  padding: 1.4rem 0;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1.4rem;
  font-family: 'Source Sans 3', system-ui, sans-serif;
  font-size: 1.08rem;
  font-weight: 500;
  color: var(--hub-ink);
  line-height: 1.4;
  transition: color 0.15s ease;
}
.hub-faq-item > summary::-webkit-details-marker { display: none; }
.hub-faq-item > summary:hover { color: var(--hub-hover); }
.hub-faq-item .faq-q { flex: 1; }
.hub-faq-item .faq-icon {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  position: relative;
  margin-top: 0.35rem;
}
.hub-faq-item .faq-icon::before,
.hub-faq-item .faq-icon::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  background: var(--hub-accent);
  transition: transform 0.2s ease;
}
.hub-faq-item .faq-icon::before {
  width: 12px;
  height: 1px;
  transform: translate(-50%, -50%);
}
.hub-faq-item .faq-icon::after {
  width: 1px;
  height: 12px;
  transform: translate(-50%, -50%);
}
.hub-faq-item[open] .faq-icon::after { transform: translate(-50%, -50%) scaleY(0); }
.hub-faq-a {
  padding: 0 0 1.6rem;
  font-family: 'Source Sans 3', system-ui, sans-serif;
  font-size: 1.02rem;
  line-height: 1.7;
  color: var(--hub-text);
  max-width: 720px;
}
.hub-faq-a p { margin: 0 0 0.9rem; }
.hub-faq-a p:last-child { margin-bottom: 0; }
.hub-faq-a em { font-family: 'Source Serif 4', Georgia, serif; font-style: italic; }

/* ---------- Video block ---------- */
.hub-video {
  background: var(--hub-cream);
  padding: 4.5rem 0 4rem;
  border-top: 1px solid var(--hub-rule);
}
.hub-video-inner {
  max-width: 880px;
  margin: 0 auto;
  padding: 0 2.5rem;
}
.hub-video-heading {
  font-family: 'Source Sans 3', system-ui, sans-serif;
  font-size: 1.55rem;
  font-weight: 600;
  color: var(--hub-ink);
  margin: 0 0 0.6rem;
  letter-spacing: -0.015em;
}
.hub-video-heading em {
  font-family: 'Source Serif 4', Georgia, serif;
  font-style: italic;
  color: var(--hub-accent-deep);
  font-weight: 500;
}
.hub-video-sub {
  font-family: 'Source Sans 3', system-ui, sans-serif;
  font-size: 1rem;
  color: var(--hub-text-muted);
  margin: 0 0 1.6rem;
  max-width: 640px;
}
.hub-video-frame {
  position: relative;
  aspect-ratio: 16 / 9;
  background: var(--hub-ink);
  border: 1px solid var(--hub-rule);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--hub-cream);
  font-family: 'Source Serif 4', Georgia, serif;
  font-style: italic;
  font-size: 1.1rem;
}
.hub-video-frame iframe,
.hub-video-frame video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: none;
}

/* ---------- Related reading ---------- */
.hub-related {
  background: var(--hub-paper);
  padding: 4.5rem 0 4rem;
  border-top: 1px solid var(--hub-rule);
}
.hub-related-inner {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 2.5rem;
}
.hub-related-heading {
  font-family: 'Source Sans 3', system-ui, sans-serif;
  font-size: 0.78rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--hub-accent-deep);
  font-weight: 700;
  margin: 0 0 2rem;
}
.hub-related-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.6rem;
}
/* Two-by-two grid for sections with four cards (For partners) */
@media (min-width: 900px) {
  .hub-related-grid--pairs { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.hub-related-card {
  background: var(--hub-cream);
  border: 1px solid var(--hub-rule);
  padding: 1.6rem 1.6rem 1.8rem;
  text-decoration: none;
  color: var(--hub-ink);
  transition: transform 0.2s ease, border-color 0.2s ease;
  display: block;
}
.hub-related-card:hover {
  transform: translateY(-2px);
  border-color: var(--hub-hover);
}
.hub-related-card .kicker {
  font-family: 'Source Sans 3', system-ui, sans-serif;
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--hub-text-muted);
  font-weight: 600;
  margin-bottom: 0.6rem;
}
.hub-related-card h3 {
  font-family: 'Source Sans 3', system-ui, sans-serif;
  font-size: 1.14rem;
  font-weight: 600;
  color: var(--hub-ink);
  margin: 0 0 0.5rem;
  line-height: 1.3;
  letter-spacing: -0.01em;
}
.hub-related-card h3 em {
  font-family: 'Source Serif 4', Georgia, serif;
  font-style: italic;
  font-weight: 500;
}
.hub-related-card p {
  font-family: 'Source Sans 3', system-ui, sans-serif;
  font-size: 0.94rem;
  line-height: 1.5;
  color: var(--hub-text-muted);
  margin: 0;
}

/* ---------- Final CTA ---------- */
.hub-cta {
  background: var(--hub-ink);
  color: var(--hub-cream);
  padding: 5rem 0 5rem;
  text-align: center;
}
.hub-cta-inner {
  max-width: 760px;
  margin: 0 auto;
  padding: 0 2.5rem;
}
.hub-cta h2 {
  font-family: 'Source Sans 3', system-ui, sans-serif;
  font-size: clamp(1.4rem, 2.6vw, 1.9rem);
  font-weight: 500;
  color: var(--hub-cream);
  margin: 0 0 1.2rem;
  line-height: 1.3;
  letter-spacing: -0.01em;
}
.hub-cta h2 em {
  font-family: 'Source Serif 4', Georgia, serif;
  font-style: italic;
  font-weight: 500;
  color: #f5c9a3; /* warm terracotta accent on dark */
}
.hub-cta p {
  font-family: 'Source Sans 3', system-ui, sans-serif;
  font-size: 1.02rem;
  line-height: 1.65;
  color: rgba(245, 240, 231, 0.85);
  margin: 0 0 2rem;
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
}
.hub-cta-btn {
  display: inline-block;
  padding: 0.95rem 2.4rem;
  font-family: 'Source Sans 3', system-ui, sans-serif;
  font-size: 1rem;
  font-weight: 600;
  color: var(--hub-ink);
  background: var(--hub-cream);
  border: 1px solid var(--hub-cream);
  text-decoration: none;
  letter-spacing: 0.01em;
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}
.hub-cta-btn:hover {
  background: transparent;
  color: var(--hub-cream);
  border-color: var(--hub-cream);
}

/* ---------- Responsive ---------- */
@media (max-width: 768px) {
  .hub-shell { padding: 3.5rem 0 3rem; }
  .hub-shell-inner { padding: 0 1.6rem; }
  .hub-body { padding: 3rem 1.6rem 2rem; }
  .hub-faq { padding: 3rem 0 3.5rem; }
  .hub-faq-inner { padding: 0 1.6rem; }
  .hub-video { padding: 3rem 0 3rem; }
  .hub-video-inner { padding: 0 1.6rem; }
  .hub-related { padding: 3rem 0 3rem; }
  .hub-related-inner { padding: 0 1.6rem; }
  .hub-cta { padding: 3.5rem 0 3.5rem; }
  .hub-cta-inner { padding: 0 1.6rem; }
  .hub-toc { padding: 1.2rem 1.3rem; }
  .hub-prose { font-size: 1.02rem; line-height: 1.72; }
  .hub-prose h2 { font-size: 1.36rem; margin-top: 2.4rem; }
  .hub-prose h3 { font-size: 1.18rem; margin-top: 2rem; }
  .hub-quote { padding: 1.4rem 1.4rem 1.4rem 1.5rem; font-size: 1.14rem; }
  .hub-faq-item > summary { font-size: 1.02rem; padding: 1.2rem 0; }
  .hub-faq-a { font-size: 0.98rem; }
}

/* Respect reduced motion */
@media (prefers-reduced-motion: reduce) {
  .hub-faq-item .faq-icon::before,
  .hub-faq-item .faq-icon::after,
  .hub-related-card,
  .hub-cta-btn,
  .hub-prose a { transition: none; }
}


/* Per-image object-position overrides to prevent cropping heads/necks */
.hub-hero img[src*="hero-loneliness.jpg"] { object-position: center 62% !important; }

/* Clinical essays (4 Oct 2026): publication date and "On this page" contents list */
.essay-date { margin-top: 0.75rem; font-size: 0.9rem; color: var(--hub-muted, #5a6478); }
.essay-toc { margin: 0 0 2.25rem; padding: 1.25rem 1.5rem; border: 1px solid var(--hub-rule, #d9d2c3); border-radius: 4px; background: rgba(255,255,255,0.5); }
.essay-toc-title { margin: 0 0 0.6rem !important; font-family: 'Source Sans 3', sans-serif; font-size: 0.78rem !important; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; color: var(--hub-ink, #17365D); }
.essay-toc ol { margin: 0; padding-left: 1.25rem; }
.essay-toc li { margin: 0.35rem 0; font-size: 0.98rem; line-height: 1.45; }
.essay-toc a { color: var(--hub-ink, #17365D); text-decoration: none; border-bottom: 1px solid transparent; }
.essay-toc a:hover, .essay-toc a:focus { border-bottom-color: currentColor; }
.hub-prose h2[id] { scroll-margin-top: 1.5rem; }
