/* ── RELATED / DISCOVERY RAIL ──
   Loaded by _doctor.html and _category.html (after their page CSS). Turns the
   single-column .detail into a two-column "content + aside" grid on desktop, and
   styles the cross-link rail (other specialties/cities, peer doctors). On mobile
   the grid collapses to one column and the rail stacks BELOW the content — there
   is no side space on a phone, which is the dominant device here. Uses the design
   tokens from css/style.css (no hardcoded colours). */

/* ── Breadcrumb ──
   Defined here (not just in category.css) so the doctor page's up-link crumb is
   styled too — _doctor.html loads style.css + doctor.css + related.css, and
   doctor.css has no .crumbs rule. Identical to category.css's; on the category
   page (which loads both) the duplicate is harmless. */
.crumbs {
  font-size: 12px;
  color: var(--ink-mute);
  margin-bottom: 12px;
}
.crumbs a {
  color: var(--ink-soft);
  text-decoration: none;
}
.crumbs a:hover {
  color: var(--red);
}

/* ── Two-column layout (desktop) ──
   .detail keeps its own max-width/padding from doctor.css / category.css; we only
   override the inner display to a grid when .detail-grid is present. The content
   column is fluid; the rail is a fixed, comfortable reading width. */
.detail-grid {
  /* Widen the centred column to fit content + rail without feeling cramped. */
  max-width: 1100px;
}

@media (min-width: 960px) {
  .detail-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 300px;
    column-gap: 48px;
    align-items: start;
  }
  /* Explicit placement: content top-left, rail top-right, FAQ below content in
     the left column. (.faq-section lives outside .detail-main so it can sit above
     the rail on mobile — see the mobile rule below.) */
  .detail-grid > .detail-main {
    grid-column: 1;
    grid-row: 1;
  }
  .detail-grid > .rail {
    grid-column: 2;
    grid-row: 1 / span 2;
  }
  .detail-grid > .faq-section {
    grid-column: 1;
    grid-row: 2;
  }
  /* The rail sticks as you scroll the (usually taller) main column. */
  .detail-grid .rail {
    position: sticky;
    top: 88px; /* clears the sticky nav */
  }
}

/* Mobile: single column with the rail ABOVE the FAQ. .detail-grid becomes a flex
   column and we order its three direct children: content, then rail, then FAQ. */
@media (max-width: 959px) {
  .detail-grid {
    display: flex;
    flex-direction: column;
  }
  .detail-grid > .detail-main { order: 1; }
  .detail-grid > .rail { order: 2; }
  .detail-grid > .faq-section { order: 3; }
}

/* min-width:0 lets the main column shrink instead of overflowing the grid. */
.detail-main {
  min-width: 0;
}

/* ── Rail ── */
.rail {
  display: flex;
  flex-direction: column;
  gap: 28px;
}

/* On mobile the rail sits below the content with a clear separation. */
@media (max-width: 959px) {
  .rail {
    margin-top: 40px;
    padding-top: 32px;
    border-top: 1px solid var(--border);
  }
}

.rail-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.rail-heading {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  letter-spacing: -0.01em;
  margin-bottom: 4px;
}

/* ── Pill links (other specialties / other cities) ── */
.rail-pill {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 9px 12px;
  text-decoration: none;
  transition: border-color 0.15s, background 0.15s;
}
.rail-pill:hover {
  border-color: var(--red-mid);
  background: #fffafa;
}
.rail-pill-label {
  font-size: 13px;
  color: var(--ink-soft);
  line-height: 1.3;
}
.rail-pill:hover .rail-pill-label {
  color: var(--ink);
}
/* The doctor count — a small signal the link leads to real content. */
.rail-pill-count {
  flex-shrink: 0;
  font-size: 12px;
  font-weight: 600;
  color: var(--red-text);
  background: var(--red-light);
  border-radius: 999px;
  min-width: 22px;
  height: 22px;
  padding: 0 7px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* ── Peer-doctor rows in the rail ──
   Reuses .doctor-row / .doctor-list from doctor.css / category.css; we only tune
   spacing for the narrower rail context. */
.rail-doctor-list {
  gap: 6px;
}
.rail-doctor-list .doctor-row {
  padding: 10px 12px;
  gap: 10px;
}
/* "+N more … in the app" — an underlined text link so its clickability reads
   without a hover (always-on underline, not hover-only). */
.rail-more {
  margin-top: 10px;
  display: inline-block;
  font-size: 13px;
  font-weight: 600;
  color: var(--red-text);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.rail-more:hover {
  color: var(--red);
}

/* On mobile, render the two specialty/city pill groups side by side if they fit,
   so the related block doesn't push the footer too far down. Peer-doctor rows
   stay full-width (they're taller). */
@media (max-width: 959px) {
  .rail {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 28px 24px;
    align-items: start;
  }
  /* A peer-doctor group spans the full width even in the mobile grid. */
  .rail-group:has(.rail-doctor-list) {
    grid-column: 1 / -1;
  }
}

/* ── Overflow "peek + CTA" ──
   Below a capped doctor list (category) or doctor-card list (clinic). The next
   1-2 real doctor rows are rendered blurred behind a white gradient, with the app
   CTA overlaid — so it reads as "more real doctors continue here, see them in the
   app" rather than a flat button. Lives here (related.css is common to category +
   clinic pages). The peek rows are decorative (aria-hidden + non-interactive). */
.overflow {
  margin-top: 8px;
}

/* The peek and CTA stack in NORMAL FLOW (no absolute overlap), so the visible
   peek strip is independent of the CTA's height — it looks the same whether the
   button is one or two lines. */
.overflow--peek {
  display: flex;
  flex-direction: column;
}

/* A fixed-height strip showing the top of the next blurred row. Its OWN bottom
   edge is faded to transparent via mask-image, so it dissolves into the page —
   no separate white overlay that could cover the whole thing. */
.overflow-peek {
  display: flex;
  flex-direction: column;
  gap: 8px;
  /* one row's worth — just the name/fee line peeks through */
  height: 58px;
  overflow: hidden;
  /* light blur — the card shape stays recognizable, just clearly a teaser */
  filter: blur(2.5px);
  opacity: 0.9;
  pointer-events: none;
  user-select: none;
  margin-top: 8px;
  /* fade the strip's own lower half out to transparent */
  -webkit-mask-image: linear-gradient(to bottom, #000 0%, #000 45%, transparent 100%);
  mask-image: linear-gradient(to bottom, #000 0%, #000 45%, transparent 100%);
}
.overflow-peek .doctor-row {
  /* inert clone of a real row; cursor/hover suppressed */
  cursor: default;
  /* top-align so the name + fee (first line) sit at the top of the strip */
  align-items: flex-start;
}
.overflow-peek .doctor-row-fee {
  /* keep the fee on the name's line (rows centre it by default) */
  margin-top: 2px;
}

/* CTA wrapper in normal flow, pulled up so the button overlaps the faded tail of
   the peek strip — the card appears to continue behind the button. */
.overflow-fade {
  margin-top: -22px;
  display: flex;
  justify-content: center;
}

/* The CTA itself — brand-coloured, styled like the continuation of the list. */
.overflow-cta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 13px 16px;
  border: 1px solid var(--red-mid);
  border-radius: 12px;
  background: var(--red-light);
  color: var(--red-text);
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  transition: background 0.15s, border-color 0.15s;
}
.overflow-cta:hover {
  background: var(--red-mid);
  border-color: var(--red);
}
.overflow-cta svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}

/* ── FAQ ──
   Loaded here (related.css is the one stylesheet common to doctor, clinic and
   category pages) so the long-tail FAQ section is styled on all three. */
.faq-section {
  margin-top: 44px;
}
.faq-section > h2 {
  font-size: 19px;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 18px;
}
.faq-list {
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.faq-item {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px 18px;
}
.faq-q {
  font-size: 15px;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 6px;
}
.faq-a {
  font-size: 14px;
  color: var(--ink-soft);
  line-height: 1.6;
}
.faq-a a {
  color: var(--red-text);
  font-weight: 500;
  text-decoration: underline;
}
.faq-a a:hover {
  color: var(--red);
}
