/* Medical specialties. Scoped to .sp-page and .sp-home so the rest of the site is unchanged.
   Colours, type, and buttons come from the existing tokens and v2 button classes. */

.sp-page { color: var(--text); background: var(--bg); }
.sp-wrap { width: min(var(--container), calc(100% - var(--gutter) * 2)); margin: 0 auto; }
.sp-page h1, .sp-page h2, .sp-page h3 {
  font-family: var(--display-font);
  font-weight: var(--display-weight);
  letter-spacing: var(--display-tracking);
  line-height: var(--lh-tight);
  color: var(--text);
}
.sp-page h1 { font-size: clamp(32px, 4vw, 56px); margin: var(--space-4) 0 var(--space-5); }
.sp-page h2 { font-size: clamp(26px, 2.6vw, 40px); margin: 0 0 var(--space-4); }
.sp-page h3 { font-family: var(--font-sans); font-weight: 600; font-size: 18px; letter-spacing: 0; margin: 0 0 var(--space-2); }
.sp-page p, .sp-page li { font-size: var(--fs-body); line-height: var(--lh-body); }
.sp-lead { font-size: var(--fs-lead); max-width: 42rem; margin: 0 0 var(--space-5); }
.sp-kicker, .sp-label {
  font-family: var(--label-font);
  font-size: var(--fs-label);
  font-weight: var(--label-weight);
  letter-spacing: var(--label-tracking);
  text-transform: uppercase;
  color: var(--text-muted);
  margin: 0 0 var(--space-3);
}
.sp-brand { margin: var(--space-5) 0 0; color: var(--text-muted); font-size: var(--fs-small); }
.sp-actions { display: flex; flex-wrap: wrap; gap: var(--space-3); }
.sp-section { padding: var(--space-8) 0; border-top: var(--hairline-w) solid var(--hairline); }
.sp-crumbs { display: flex; flex-wrap: wrap; gap: var(--space-2); margin: 0; padding: var(--space-5) 0 0; list-style: none; font-size: var(--fs-small); color: var(--text-muted); }
.sp-crumbs a { color: inherit; }
.sp-crumbs li:not(:last-child)::after { content: "/"; margin-left: var(--space-2); }

.sp-hero { padding: var(--space-6) 0 var(--space-8); }
.sp-hero-grid { display: grid; grid-template-columns: 1.22fr 1fr; gap: var(--space-7); align-items: center; }
.sp-visual {
  min-height: 0;
  background: var(--surface-2);
  border: var(--hairline-w) solid var(--hairline);
  border-radius: var(--radius-card);
  padding: var(--space-5);
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}
.sp-visual header { display: flex; justify-content: space-between; gap: var(--space-3); align-items: baseline; }
.sp-visual header p { margin: 0; font-family: var(--font-mono); font-size: 12px; letter-spacing: 0.04em; text-transform: uppercase; color: var(--text-muted); }
.sp-note { margin: 0; font-size: var(--fs-small); color: var(--text-muted); }

.sp-metrics { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--space-3); }
.sp-metrics li { display: grid; grid-template-columns: 1fr auto; gap: 2px var(--space-4); padding-bottom: var(--space-3); border-bottom: var(--hairline-w) solid var(--hairline); }
.sp-metrics li span { grid-column: 1; color: var(--text-muted); font-size: var(--fs-small); }
.sp-metrics li strong { grid-column: 2; font-family: var(--stat-font); font-weight: var(--stat-weight); font-size: 22px; text-align: right; }
.sp-metrics li em { grid-column: 1 / -1; font-style: normal; font-size: 13px; color: var(--text-muted); }

.sp-rail-visual { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-3); margin: 0; padding: 0; list-style: none; }
.sp-rail-visual li { min-height: 92px; padding: var(--space-3); border: var(--hairline-w) solid var(--hairline); border-radius: var(--radius-card); background: var(--bg); display: flex; flex-direction: column; justify-content: space-between; }
.sp-rail-visual strong { font-family: var(--stat-font); font-weight: var(--stat-weight); font-size: 28px; }
.sp-rail-visual span { font-size: 13px; color: var(--text-muted); }

.sp-split { display: grid; grid-template-columns: 0.8fr 1.2fr; gap: var(--space-4); min-height: 360px; }
.sp-slides { display: flex; flex-direction: column; justify-content: center; gap: var(--space-3); }
.sp-slide { height: 54px; border: var(--hairline-w) solid var(--hairline); border-left: 4px solid var(--accent); border-radius: 4px; background: var(--bg); display: flex; align-items: center; padding: 0 var(--space-3); font-size: 13px; color: var(--text-muted); }
.sp-fields { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--space-3); }
.sp-fields li { display: grid; gap: 2px; padding-bottom: var(--space-3); border-bottom: var(--hairline-w) solid var(--hairline); }
.sp-fields span { font-size: 12px; letter-spacing: 0.04em; text-transform: uppercase; color: var(--text-muted); }
.sp-fields strong { font-size: 16px; font-weight: 600; }

.sp-cases { width: 100%; border-collapse: collapse; font-size: var(--fs-small); }
.sp-cases th { text-align: left; font-weight: 600; color: var(--text-muted); font-size: 12px; letter-spacing: 0.04em; text-transform: uppercase; padding: 0 0 var(--space-2); }
.sp-cases td { padding: var(--space-3) var(--space-3) var(--space-3) 0; border-top: var(--hairline-w) solid var(--hairline); vertical-align: top; }
.sp-cases td:last-child { text-align: right; font-family: var(--font-mono); font-size: 12px; }

.sp-directory { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: var(--space-4); }
.sp-card { display: flex; flex-direction: column; gap: var(--space-3); min-height: 100%; text-decoration: none; color: inherit; background: var(--surface-2); border: var(--hairline-w) solid var(--hairline); border-radius: var(--radius-card); padding: var(--space-5); }
.sp-card:hover { border-color: var(--text); }
.sp-card h2, .sp-card h3 { font-family: var(--font-sans); font-weight: 600; font-size: 22px; letter-spacing: 0; margin: 0; }
.sp-card p { margin: 0; color: var(--text-muted); font-size: var(--fs-small); }
.sp-card ul { margin: 0; padding-left: 1.1em; color: var(--text); font-size: var(--fs-small); }
.sp-card li { margin: 0 0 var(--space-2); }
.sp-card .v2-link { margin-top: auto; }
.sp-mark { width: 72px; height: 48px; display: block; }
.sp-mark path, .sp-mark circle, .sp-mark rect { fill: none; stroke: var(--accent); stroke-width: 1.5; }

[data-sp-flow] { display: grid; gap: var(--space-3); }
.sp-stage > button {
  width: 100%;
  min-height: 48px;
  padding: 12px var(--space-4);
  border: var(--hairline-w) solid var(--hairline);
  background: var(--surface-2);
  color: var(--text);
  border-radius: var(--radius-card);
  font: inherit;
  font-size: var(--fs-small);
  line-height: 1.35;
  text-align: left;
  cursor: pointer;
}
.sp-stage > button[aria-expanded="true"] { border-color: var(--text); background: var(--bg); }
.sp-stage > button:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; }
.sp-stage article { padding: var(--space-5); border: var(--hairline-w) solid var(--hairline); border-radius: var(--radius-card); background: var(--surface-2); }
.sp-stage article[hidden] { display: none !important; }
.sp-stage dl { display: grid; gap: var(--space-3); margin: var(--space-4) 0 0; }
.sp-stage dt { font-size: 12px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-muted); }
.sp-stage dd { margin: 0; }

.sp-topics { display: grid; gap: var(--space-7); }
.sp-topics article p { margin: 0 0 var(--space-3); max-width: 46rem; }

.sp-scroll-hint { display: none; margin: 0 0 var(--space-3); font-size: var(--fs-small); color: var(--text-muted); }
.sp-table-scroll { max-width: 100%; overflow-x: auto; }
.sp-codes { width: 100%; min-width: 640px; border-collapse: collapse; table-layout: fixed; }
.sp-codes caption {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.sp-codes th, .sp-codes td { text-align: left; padding: var(--space-3) var(--space-4) var(--space-3) 0; border-bottom: var(--hairline-w) solid var(--hairline); vertical-align: top; }
.sp-codes th { font-size: 12px; letter-spacing: 0.04em; text-transform: uppercase; color: var(--text-muted); font-weight: 600; }
.sp-codes th:nth-child(1) { width: 16%; }
.sp-codes th:nth-child(2), .sp-codes td:nth-child(2) { width: 38%; }
.sp-codes th:first-child { font-family: var(--label-font); }
.sp-codes th[scope="row"] { font-family: var(--font-mono); white-space: nowrap; }
.sp-caveat { margin-top: var(--space-4); padding: var(--space-4); border-left: 2px solid var(--accent); color: var(--text); font-size: var(--fs-small); }

.sp-streams { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-4); }
.sp-streams li { padding: var(--space-4); border: var(--hairline-w) solid var(--hairline); border-radius: var(--radius-card); background: var(--surface-2); }
.sp-streams a { font-weight: 600; color: var(--text); }
.sp-streams p { margin: var(--space-2) 0 0; font-size: var(--fs-small); color: var(--text-muted); }
.sp-all-streams { margin-top: var(--space-5); font-size: var(--fs-small); color: var(--text-muted); max-width: 46rem; }

.sp-faq { display: grid; gap: var(--space-5); }
.sp-faq h3 { font-size: 20px; }
.sp-faq p { margin: 0; max-width: 46rem; }

.sp-calc { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-5); align-items: start; }
.sp-calc form, .sp-calc-out { padding: var(--space-5); border: var(--hairline-w) solid var(--hairline); border-radius: var(--radius-card); background: var(--surface-2); }
.sp-calc label { display: block; font-size: var(--fs-small); font-weight: 600; margin: 0 0 var(--space-2); }
.sp-calc input { width: 100%; box-sizing: border-box; margin: 0 0 var(--space-4); padding: 12px 14px; border-radius: 4px; border: var(--hairline-w) solid var(--hairline); background: var(--bg); color: var(--text); font: inherit; }
.sp-calc-out p { margin: 0 0 var(--space-2); color: var(--text-muted); font-size: var(--fs-small); }
.sp-calc-out strong { display: block; font-family: var(--stat-font); font-weight: var(--stat-weight); font-size: 36px; color: var(--text); }

.sp-close { padding: var(--space-8) 0 var(--space-9); }
.sp-close p { max-width: 40rem; }
.sp-related { display: flex; flex-wrap: wrap; gap: var(--space-4); margin-top: var(--space-5); }
.sp-preview-banner { margin: 0; padding: var(--space-3) 0; font-size: var(--fs-small); color: var(--text-muted); }

.sp-home { padding-bottom: var(--space-8); }

/* Phone menu on specialty pages. Existing pages carry this in an inline style.
   Author display must not override the hidden attribute. */
.mob-menu .mob-sub { display: flex; flex-direction: column; gap: 3px; }
.mob-menu .mob-sub[hidden] { display: none !important; }
.mob-menu .mob-sub a { min-height: 44px; display: flex; align-items: center; }
.sp-home .sp-directory { margin-top: var(--space-5); }
.sp-home .v2-link { margin-top: var(--space-5); }

@media (min-width: 1024px) {
  .sp-page .sp-visual { min-height: 420px; }
  .sp-page .sp-feature {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-areas: "title media" "lead media" "more media";
    column-gap: var(--space-7);
    row-gap: var(--space-3);
    align-items: center;
  }
  .sp-page .sp-feature--flip { grid-template-areas: "media title" "media lead" "media more"; }
  .sp-page .sp-feature h2 { grid-area: title; margin-bottom: 0; }
  .sp-page .sp-feature-lead { grid-area: lead; }
  .sp-page .sp-feature-more { grid-area: more; }
  .sp-page .sp-feature .sp-photo { grid-area: media; }
  [data-sp-flow].is-ready {
    grid-template-columns: repeat(var(--sp-stages, 6), minmax(0, 1fr));
    align-items: stretch;
  }
  [data-sp-flow].is-ready .sp-stage { display: contents; }
  [data-sp-flow].is-ready .sp-stage > button { width: auto; order: 0; }
  [data-sp-flow].is-ready .sp-stage > article { grid-column: 1 / -1; order: 1; }
}
@media (min-width: 768px) and (max-width: 1023px) {
  [data-sp-flow].is-ready {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    align-items: stretch;
  }
  [data-sp-flow].is-ready .sp-stage { display: contents; }
  [data-sp-flow].is-ready .sp-stage > button { width: auto; order: 0; }
  [data-sp-flow].is-ready .sp-stage > article { grid-column: 1 / -1; order: 1; }
  .sp-page .sp-streams { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 1023px) {
  .sp-page .sp-hero-grid, .sp-page .sp-split, .sp-page .sp-calc { grid-template-columns: 1fr; }
  .sp-page .sp-wrap { width: min(var(--container), calc(100% - 40px)); }
  .sp-page .sp-feature { display: flex; flex-direction: column; gap: var(--space-4); }
}
@media (max-width: 767px) {
  .sp-page .sp-section { padding: var(--space-7) 0; }
  .sp-page .sp-topics { gap: var(--space-6); }
  .sp-page .sp-streams { grid-template-columns: 1fr; }
  .sp-page .sp-rail-visual { grid-template-columns: 1fr; }
  .sp-page .sp-actions { flex-direction: column; align-items: stretch; }
  .sp-page .sp-actions .v2-btn { width: 100%; height: auto; min-height: 48px; white-space: normal; }
  .sp-page .sp-scroll-hint { display: block; }
  .sp-page .sp-table-scroll { box-shadow: inset -18px 0 14px -16px color-mix(in srgb, var(--text) 35%, transparent); }
  .sp-page .sp-stage { border: var(--hairline-w) solid var(--hairline); border-radius: var(--radius-card); background: var(--surface-2); }
  .sp-page .sp-stage > button { border: 0; border-radius: 0; background: transparent; }
  .sp-page .sp-stage > button[aria-expanded="true"] { border-bottom: var(--hairline-w) solid var(--hairline); background: transparent; }
  .sp-page .sp-stage > article { border: 0; border-radius: 0; background: transparent; }
}

@media (prefers-reduced-motion: reduce) {
  .sp-page *, .sp-home * { animation: none !important; transition: none !important; }
}
html.v2[data-motion="paused"] .sp-page *,
html.v2[data-motion="paused"] .sp-home * { animation: none !important; transition: none !important; }

/* One content photograph size. It sits beside the copy from 1024px up and
   stacks under the opening paragraph below that. */
.sp-topics { gap: var(--space-8); }
.sp-topics > .sp-note { max-width: 40rem; }
.sp-photo { margin: 0; }
.sp-photo img {
  width: 100%;
  max-width: 100%;
  height: auto;
  display: block;
  object-fit: cover;
  object-position: center 30%;
  border: var(--hairline-w) solid var(--hairline);
  border-radius: var(--radius-media);
  background: var(--surface-2);
}
.sp-photo--content img { aspect-ratio: 16 / 10; }

.sp-page .sp-directory, .sp-home .sp-directory {
  grid-template-columns: 1fr 1fr;
  gap: var(--space-7);
  margin-top: var(--space-7);
}
.sp-card { overflow: hidden; padding: 0 0 var(--space-5); }
.sp-card-photo { display: block; width: 100%; height: auto; aspect-ratio: 16 / 9; object-fit: cover; background: var(--surface-2); }
.sp-card > :not(img) { margin-left: var(--space-5); margin-right: var(--space-5); }
.sp-card h2, .sp-card h3 { margin-top: var(--space-5); }

@media (max-width: 800px) {
  .sp-page .sp-directory, .sp-home .sp-directory { grid-template-columns: 1fr; }
}
