/* Speciality page (single-speciality.php → template-parts/speciality/*)
   1. Hero  2. At a glance  3. Layout + rail (On this page, Consult)  4. Article  4b. Article images  5. Signs
   6. Urgent box  7. Reviewed-by card  8. Other sections (reviews, related)  9. Mobile */

/* ---------- 1. Hero (template-parts/speciality/hero.php) ---------- */
.spec-hero { --gold: color-mix(in srgb, var(--brand-accent) 78%, white); padding-bottom: calc(clamp(48px, 7vw, 96px) + 64px); }
.spec-hero-grid { display: grid; grid-template-columns: minmax(0, 1.08fr) minmax(0, .92fr); gap: clamp(40px, 6vw, 96px); align-items: center; }
.spec-hero .crumbs { margin-bottom: 28px; }
.spec-eyebrow { display: flex; align-items: center; gap: 14px; color: var(--gold); font-size: .8rem; font-weight: 600; letter-spacing: .16em; text-transform: uppercase; margin-bottom: 18px; }
.spec-eyebrow::before { content: ""; width: 36px; height: 1px; background: currentColor; flex: none; }
.spec-hero .page-title { max-width: 15ch; font-size: clamp(calc(var(--fs-ph1-m) * 1px), calc(var(--fs-ph1-m) * 1px + (var(--fs-ph1) - var(--fs-ph1-m)) * var(--fl)), calc(var(--fs-ph1) * .84px)); }
.spec-hero .lede { max-width: 54ch; line-height: 1.65; }
.spec-points { list-style: none; margin: 36px 0 0; padding: 24px 0 0; border-top: 1px solid var(--navy-line); display: flex; flex-wrap: wrap; gap: 14px 28px; }
.spec-points li { display: flex; align-items: center; gap: 10px; color: var(--on-navy-muted); font-size: .95rem; line-height: 1.35; }
.spec-points i { flex: none; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; border: 1px solid color-mix(in srgb, var(--gold) 45%, transparent); color: var(--gold); }
.spec-points .icon { width: 16px; height: 16px; }

.spec-figure { position: relative; margin: 0; isolation: isolate; }
.spec-figure::before { content: ""; position: absolute; inset: 0; transform: translate(18px, 18px); border: 1px solid color-mix(in srgb, var(--gold) 40%, transparent); border-radius: var(--r-lg); z-index: -1; }
.spec-figure::after { content: ""; position: absolute; inset: -12% -8%; background: radial-gradient(closest-side, color-mix(in srgb, var(--gold) 22%, transparent), transparent); z-index: -2; opacity: .6; }
.spec-frame { padding: 10px; border-radius: var(--r-lg); background: color-mix(in srgb, var(--on-navy) 7%, transparent); border: 1px solid color-mix(in srgb, var(--gold) 50%, transparent); box-shadow: 0 40px 80px -40px rgba(0, 0, 0, .6); }
.spec-frame img { width: 100%; height: auto; border-radius: calc(var(--r-lg) - 10px); }
.spec-figure.is-ph .media { aspect-ratio: 4 / 3; border-radius: calc(var(--r-lg) - 10px); }
.spec-badge { position: absolute; left: -22px; bottom: 28px; display: flex; align-items: center; gap: 12px; padding: 10px 20px 10px 10px; border-radius: 999px; background: color-mix(in srgb, var(--brand-on-dark) 96%, transparent); color: var(--brand-primary); box-shadow: 0 24px 48px -20px rgba(0, 0, 0, .55); font-size: .92rem; line-height: 1.25; }
.spec-badge i { flex: none; width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; background: var(--brand-primary); color: color-mix(in srgb, var(--brand-accent) 78%, white); }
.spec-badge .icon { width: 18px; height: 18px; }
.spec-badge small { display: block; font-size: .68rem; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; opacity: .7; }
.spec-badge b { font-weight: 700; }

/* Shared small label */
.spec-kicker { display: flex; align-items: center; gap: 10px; font-size: .74rem; font-weight: 600; letter-spacing: .16em; text-transform: uppercase; color: var(--accent-text); margin: 0 0 10px; }
.spec-kicker::before { content: ""; width: 22px; height: 1px; background: currentColor; }

/* ---------- 2. At a glance – Conditions we see (overlaps the hero) ---------- */
.spec-glance { position: relative; z-index: 2; margin-top: -72px; }
.glance-card { position: relative; display: grid; grid-template-columns: minmax(220px, .62fr) minmax(0, 1.6fr); gap: clamp(24px, 4vw, 56px); align-items: center; background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg); padding: clamp(24px, 3.4vw, 44px); box-shadow: 0 34px 70px -40px rgba(4, 20, 36, .45); }
.glance-card::before { content: ""; position: absolute; top: -1px; left: clamp(24px, 3.4vw, 44px); width: 64px; height: 2px; background: var(--accent); }
.glance-head h2 { font-size: clamp(1.6rem, 2.6vw, 2.2rem); }
.glance-note { margin-top: 12px; color: var(--muted); font-size: .95rem; }
.glance-note a { color: var(--accent-text); font-weight: 600; text-underline-offset: 3px; }
.glance-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; }
.glance-list li { display: flex; align-items: center; gap: 10px; min-height: 48px; padding: 10px 14px; border-radius: 14px; border: 1px solid var(--line); background: color-mix(in srgb, var(--tint) 40%, transparent); color: var(--ink); font-weight: 500; font-size: .98rem; line-height: 1.3; }
.glance-list .icon { width: 18px; height: 18px; color: var(--accent-text); }

/* ---------- 3. Layout + sticky rail ---------- */
.spec-main { padding: clamp(56px, 7vw, 96px) 0 clamp(56px, 8vw, 110px); }
.spec-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: clamp(40px, 6vw, 96px); align-items: start; }
.spec-article { grid-column: 1; grid-row: 1; min-width: 0; }
.spec-rail { grid-column: 2; grid-row: 1; position: sticky; top: calc(var(--header-h) + var(--admin-bar) + 24px); max-height: calc(100vh - var(--header-h) - var(--admin-bar) - 48px); overflow-y: auto; overscroll-behavior: contain; scrollbar-width: none; display: grid; gap: 16px; padding: 4px; margin: -4px; }
.spec-rail::-webkit-scrollbar { display: none; }

/* On this page */
.spec-toc { position: relative; overflow: hidden; background: var(--card); border: 1px solid var(--line); border-radius: var(--r-md); padding: 20px 20px 18px; }
.spec-toc summary { list-style: none; display: flex; align-items: baseline; justify-content: space-between; gap: 12px; cursor: default; }
.spec-toc summary::-webkit-details-marker { display: none; }
.toc-h { font-family: var(--font-head); font-weight: var(--heading-weight); color: var(--ink); font-size: 1.08rem; letter-spacing: -.01em; }
.toc-count { font-size: .78rem; color: var(--muted); }
.spec-toc ol { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 2px; }
.spec-toc li { margin: 0; }
.spec-toc a { display: grid; grid-template-columns: 26px 1fr; gap: 8px; align-items: baseline; padding: 8px 10px; margin: 0 -10px; border-radius: 10px; color: var(--muted); text-decoration: none; font-size: .93rem; line-height: 1.35; transition: background .25s, color .25s, box-shadow .25s; }
.spec-toc .n { font-size: .74rem; font-weight: 600; color: var(--accent-text); font-variant-numeric: tabular-nums; }
.spec-toc a:hover { color: var(--ink); background: color-mix(in srgb, var(--tint) 45%, transparent); }
.spec-toc a.is-active { color: var(--ink); font-weight: 600; background: color-mix(in srgb, var(--tint) 65%, transparent); box-shadow: inset 2px 0 0 var(--accent); }
.toc-bar { position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: var(--line); }
.toc-bar i { display: block; height: 100%; width: calc(var(--p, 0) * 100%); background: var(--accent); }

/* Consult card (always navy) */
.spec-consult { position: relative; overflow: hidden; isolation: isolate; display: grid; gap: 12px; padding: 26px; border-radius: var(--r-md); background: var(--navy); color: var(--on-navy); border: 1px solid var(--navy-line); }
.spec-consult::before { content: ""; position: absolute; width: 260px; height: 260px; right: -130px; bottom: -150px; border-radius: 50%; border: 1px solid color-mix(in srgb, var(--brand-accent) 40%, transparent); box-shadow: 0 0 0 28px color-mix(in srgb, var(--brand-on-dark) 3%, transparent), 0 0 0 29px color-mix(in srgb, var(--brand-accent) 22%, transparent); z-index: -1; }
.spec-consult .spec-kicker { color: color-mix(in srgb, var(--brand-accent) 78%, white); margin: 0; }
.consult-h { color: var(--on-navy); font-size: 1.55rem; }
.spec-consult p { color: var(--on-navy-muted); font-size: .96rem; margin-bottom: 6px; }
.spec-consult .btn-solid { background: var(--cream); color: var(--brand-primary); }
.spec-consult .btn-line { color: var(--cream); border-color: color-mix(in srgb, var(--cream) 45%, transparent); }
.spec-consult .btn-line:hover { background: color-mix(in srgb, var(--cream) 10%, transparent); color: var(--cream); border-color: var(--cream); }

/* ---------- 4. Article (detailed content) ---------- */
.spec-article { font-size: 1.08rem; line-height: 1.75; color: var(--text); }
.spec-intro { font-size: clamp(1.14rem, 1.5vw, 1.28rem); line-height: 1.7; color: var(--ink); }
.spec-intro > * + * { margin-top: 1em; }
.spec-intro > p:first-of-type::first-letter { float: left; font-family: var(--font-head); font-weight: 700; font-size: 4.1em; line-height: .84; margin: .05em .12em 0 0; color: var(--accent-text); }
.spec-intro::after { content: ""; display: block; clear: both; width: 64px; height: 2px; background: var(--accent); margin-top: 40px; }

.spec-sec, .spec-extra { margin-top: clamp(48px, 6vw, 72px); }
.spec-sec + .spec-sec:not(.callout-warn), .spec-sec + .spec-extra { border-top: 1px solid var(--line); padding-top: clamp(40px, 5vw, 56px); }
.sec-head { display: grid; gap: 12px; }
.sec-no { display: inline-flex; align-items: center; gap: 12px; font-size: .8rem; font-weight: 600; letter-spacing: .14em; color: var(--accent-text); font-variant-numeric: tabular-nums; }
.sec-no::after { content: ""; width: 40px; height: 1px; background: currentColor; opacity: .6; }
.spec-sec h2 { font-size: clamp(1.7rem, 3vw, 2.4rem); line-height: 1.08; }
.sec-body { margin-top: 20px; }
.sec-body > * + * { margin-top: 1em; }
.sec-body p, .sec-body li { max-width: 68ch; }
.sec-body h3 { font-size: clamp(1.2rem, 2vw, 1.4rem); margin-top: 1.6em; }
.sec-body a { color: var(--accent-text); text-underline-offset: 3px; }
.sec-body strong { color: var(--ink); }
.sec-body ul { list-style: none; padding: 0; }
.sec-body ul li { position: relative; padding-left: 28px; }
.sec-body ul li + li, .sec-body ol li + li { margin-top: .55em; }
.sec-body ul li::before { content: ""; position: absolute; left: 4px; top: .68em; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 18%, transparent); }
.sec-body ol { padding-left: 1.4em; }
.sec-body ol li::marker { color: var(--accent-text); font-weight: 600; }
.sec-body blockquote { border-left: 3px solid var(--accent); padding: 4px 0 4px 20px; color: var(--ink); font-size: 1.12em; }
.sec-body img { border-radius: 18px; }
.sec-body figure { margin: 1.6em 0; }
.sec-body figcaption { font-size: .9rem; color: var(--muted); margin-top: 8px; }

/* ---------- 4b. Article images (Introduction + every section → “Image” box) ----------
   .is-full / .is-medium = width · .fit-auto = whole image (no crop) · .fit-16x9 … = cropped shape
   .focus-top / -bottom = which part stays visible when cropped */
.spec-fig { position: relative; margin: 28px 0; }
.spec-intro + .spec-fig, .spec-fig + .spec-intro { margin-top: 36px; }
.spec-article > .spec-fig:first-child { margin-top: 0; margin-bottom: 40px; }
.sec-head + .spec-fig { margin-top: 24px; }
.spec-fig + .sec-body { margin-top: 26px; }
.spec-fig.is-medium { max-width: min(560px, 76%); margin-inline: auto; }
.spec-fig-in { position: relative; overflow: hidden; border-radius: 22px; background: var(--bg-2); border: 1px solid var(--line); box-shadow: 0 30px 60px -38px rgba(4, 20, 36, .5); }
.spec-fig-in::after { content: ""; position: absolute; inset: 8px; border-radius: 16px; border: 1px solid color-mix(in srgb, var(--accent) 38%, transparent); pointer-events: none; }
.spec-fig-in img { display: block; width: 100%; }
/* Adapt to image: whole picture, frame takes the image's own shape (no height limit).
   Small photos are not stretched beyond their real width (--iw) – they stay sharp. */
.spec-fig.fit-auto { display: flex; flex-direction: column; }
.spec-fig.fit-auto .spec-fig-in { width: fit-content; max-width: 100%; }
.spec-fig.fit-auto.is-medium .spec-fig-in, .spec-fig.fit-auto.is-medium figcaption { align-self: center; }
.spec-fig.fit-auto img { width: auto; max-width: min(100%, var(--iw, 100%)); height: auto; }
/* Fixed shapes: cropped to fill */
.spec-fig:not(.fit-auto) .spec-fig-in { aspect-ratio: var(--ratio, 16 / 9); }
.spec-fig:not(.fit-auto) img { height: 100%; object-fit: cover; object-position: 50% var(--fy, 50%); }
.fit-16x9 { --ratio: 16 / 9; } .fit-3x2 { --ratio: 3 / 2; } .fit-4x3 { --ratio: 4 / 3; } .fit-1x1 { --ratio: 1 / 1; } .fit-21x9 { --ratio: 21 / 9; }
.focus-top { --fy: 18%; } .focus-bottom { --fy: 85%; }
.spec-fig figcaption { display: flex; gap: 10px; align-items: baseline; margin-top: 12px; font-size: .9rem; line-height: 1.5; color: var(--muted); }
.spec-fig figcaption::before { content: ""; flex: none; width: 18px; height: 1px; background: var(--accent); transform: translateY(-4px); }
.spec-fig.is-medium figcaption { justify-content: center; }
.callout-warn .spec-fig-in { box-shadow: none; }
@media (max-width: 600px) {
	.spec-fig.is-medium { max-width: 100%; }
	.spec-fig-in { border-radius: 16px; }
	.spec-fig-in::after { inset: 6px; border-radius: 11px; }
	.fit-21x9 { --ratio: 16 / 9; } /* banner too thin on a phone */
}

/* Page width (sirf Introduction image): article + rail ke upar, poori page chaudai – sabse clear */
.spec-wide-fig { margin-bottom: clamp(44px, 5.5vw, 72px); }
.spec-wide-fig .spec-fig { margin: 0; }
.spec-fig.is-page.fit-auto .spec-fig-in { margin-inline: auto; }
.spec-fig.is-page.fit-auto figcaption { align-self: center; }

/* Zoom: image par click = full screen original (core.js → imgZoom) */
a.spec-fig-in { display: block; color: inherit; cursor: zoom-in; }
.spec-fig.fit-auto a.spec-fig-in { display: block; }
.zoom-ic { position: absolute; right: 16px; bottom: 16px; z-index: 1; width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: color-mix(in srgb, var(--brand-primary) 82%, transparent); color: var(--brand-on-dark); box-shadow: 0 8px 20px -8px rgba(0, 0, 0, .5); opacity: .85; transition: opacity .25s, transform .25s; }
.zoom-ic svg { width: 18px; height: 18px; }
a.spec-fig-in:hover .zoom-ic, a.spec-fig-in:focus-visible .zoom-ic { opacity: 1; transform: scale(1.06); }
.img-zoom { border: 0; padding: 0; margin: 0; width: 100vw; height: 100dvh; max-width: none; max-height: none; background: transparent; color: #fff; }
.img-zoom::backdrop { background: rgba(4, 14, 26, .94); }
.img-zoom[open] { display: grid; place-items: center; overflow: auto; overscroll-behavior: contain; }
.img-zoom img { max-width: 96vw; max-height: 92dvh; width: auto; height: auto; border-radius: 10px; cursor: zoom-in; }
.img-zoom.is-actual { place-items: start; }
.img-zoom.is-actual img { max-width: none; max-height: none; margin: auto; cursor: zoom-out; border-radius: 0; }
.img-zoom .zoom-x { position: fixed; top: max(14px, env(safe-area-inset-top)); right: 14px; width: 46px; height: 46px; border-radius: 50%; border: 1px solid rgba(255, 255, 255, .35); background: rgba(10, 53, 88, .85); color: #fff; font-size: 26px; line-height: 1; cursor: pointer; display: grid; place-items: center; }
.img-zoom .zoom-tip { position: fixed; left: 50%; bottom: max(14px, env(safe-area-inset-bottom)); transform: translateX(-50%); font-size: .82rem; color: rgba(255, 255, 255, .75); background: rgba(10, 53, 88, .8); padding: 6px 14px; border-radius: 99px; white-space: nowrap; pointer-events: none; }
@media (hover: none) { .img-zoom .zoom-tip { display: none; } }

/* ---------- 5. Common signs (checklist) ---------- */
.sign-list { list-style: none; margin: 22px 0 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.sign-list li { display: flex; align-items: flex-start; gap: 12px; padding: 16px 18px; background: var(--card); border: 1px solid var(--line); border-radius: 16px; color: var(--ink); font-weight: 500; line-height: 1.45; }
.sign-list i { flex: none; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: color-mix(in srgb, var(--accent) 18%, transparent); color: var(--accent-text); }
.sign-list .icon { width: 14px; height: 14px; }
.sign-note { margin-top: 14px; font-size: .9rem; color: var(--muted); }

/* ---------- 6. “When to see a doctor urgently” ---------- */
.callout-warn { --warn: #B83A26; background: color-mix(in srgb, var(--warn) 7%, var(--card)); border: 1px solid color-mix(in srgb, var(--warn) 32%, transparent); border-left: 5px solid var(--warn); border-radius: var(--r-md); padding: clamp(22px, 3vw, 34px); }
@media (prefers-color-scheme: dark) { :root:not(.no-dark) .callout-warn { --warn: #E27762; } }
.callout-warn .sec-head { grid-template-columns: auto 1fr; align-items: center; gap: 14px; }
.callout-warn .sec-no { width: 42px; height: 42px; border-radius: 50%; justify-content: center; background: color-mix(in srgb, var(--warn) 14%, transparent); color: var(--warn); }
.callout-warn .sec-no::after { display: none; }
.callout-warn .sec-no .icon { width: 20px; height: 20px; }
.callout-warn h2 { font-size: clamp(1.35rem, 2.4vw, 1.75rem); }
.callout-warn .sec-body ul li::before { background: var(--warn); box-shadow: 0 0 0 4px color-mix(in srgb, var(--warn) 18%, transparent); }

/* ---------- 7. Reviewed by (doctor card) ---------- */
.reviewed { position: relative; margin-top: clamp(56px, 7vw, 80px); display: grid; grid-template-columns: 64px minmax(0, 1fr) auto; gap: 18px; align-items: center; padding: 22px 24px; background: var(--card); border: 1px solid var(--line); border-radius: var(--r-md); line-height: 1.4; }
.reviewed::before { content: ""; position: absolute; top: -1px; left: 24px; width: 48px; height: 2px; background: var(--accent); }
.rev-av { width: 64px; height: 64px; border-radius: 50%; overflow: hidden; display: grid; place-items: center; background: var(--brand-primary); color: var(--brand-on-dark); font-family: var(--font-head); font-weight: 700; font-size: 1.4rem; box-shadow: 0 0 0 3px var(--card), 0 0 0 4px var(--accent); }
.rev-av img { width: 100%; height: 100%; object-fit: cover; }
.rev-who small { display: block; font-size: .7rem; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--accent-text); margin-bottom: 2px; }
.rev-who b { display: block; color: var(--ink); font-size: 1.12rem; }
.rev-who span { display: block; color: var(--muted); font-size: .9rem; }
.rev-link .icon { width: 18px; height: 18px; }

/* Tables written in the editor */
.spec-article table { width: 100%; border-collapse: collapse; font-size: .98rem; }
.spec-article th, .spec-article td { border: 1px solid var(--line); padding: 10px 12px; text-align: left; vertical-align: top; }
.spec-article th { background: var(--bg-2); color: var(--ink); }

/* ---------- 8. Other sections on this page ---------- */
.related h2, .reviews-plain h2 { font-size: clamp(1.8rem, 3.4vw, 2.6rem); }
.related h2 { margin-bottom: 36px; }

/* ---------- 9. Tablet / mobile ---------- */
@media (max-width: 960px) {
	.spec-hero-grid { grid-template-columns: 1fr; gap: 48px; }
	.spec-figure { max-width: 560px; margin-right: 18px; }
	.spec-badge { left: 12px; bottom: 14px; }
	.glance-card { grid-template-columns: 1fr; }

	/* Rail opens up: On this page (folded) above the article, Consult below it */
	.spec-layout { grid-template-columns: minmax(0, 1fr); gap: 0; }
	.spec-rail { display: contents; }
	.spec-toc { order: 0; margin-bottom: 40px; padding: 0; }
	.spec-toc summary { cursor: pointer; padding: 16px 20px; min-height: 56px; align-items: center; }
	.spec-toc summary::after { content: ""; width: 9px; height: 9px; border-right: 2px solid var(--ink); border-bottom: 2px solid var(--ink); transform: translateY(-3px) rotate(45deg); transition: transform .3s; margin-left: 4px; }
	.spec-toc details[open] summary::after { transform: translateY(2px) rotate(-135deg); }
	.toc-count { margin-left: auto; }
	.spec-toc ol { margin: 0; padding: 0 20px 18px; }
	.spec-toc a { min-height: 44px; align-items: center; }
	.spec-article { grid-column: 1; grid-row: auto; order: 1; }
	.spec-consult { order: 2; margin-top: 56px; }
}
@media (max-width: 600px) {
	.spec-hero { padding-bottom: calc(clamp(48px, 7vw, 96px) + 56px); }
	.spec-points { flex-direction: column; gap: 12px; margin-top: 28px; }
	.spec-figure::before { transform: translate(12px, 12px); }
	.spec-figure { margin-right: 12px; }
	.spec-glance { margin-top: -48px; }
	.glance-list { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
	.glance-list li { padding: 10px 12px; font-size: .92rem; gap: 8px; }
	.sign-list { grid-template-columns: 1fr; }
	.spec-intro > p:first-of-type::first-letter { font-size: 3.4em; }
	.reviewed { grid-template-columns: 56px minmax(0, 1fr); }
	.rev-av { width: 56px; height: 56px; }
	.rev-link { grid-column: 1 / -1; }
	.spec-article table { display: block; overflow-x: auto; }
}

/* Short laptop screens: keep the whole rail visible */
@media (min-width: 961px) and (max-height: 860px) {
	.spec-toc { padding: 16px 18px 14px; }
	.spec-toc ol { margin-top: 8px; gap: 0; }
	.spec-toc a { padding-block: 6px; font-size: .9rem; }
	.spec-consult { padding: 20px 22px; gap: 10px; }
	.spec-consult .spec-kicker, .spec-consult p { display: none; }
	.consult-h { font-size: 1.3rem; }
}
