/* ==========================================================================
   LUMBEN page kit — shared by the treatment guide (.td-page, .tl-page) and the
   dentist profile (.dp-page)
   templates/treatments/treatments_list.html, treatment_detail.html,
   templates/dentists/dentist_detail.html

   Page-agnostic parts only: design tokens, focus ring, buttons, pills,
   breadcrumb, the dark hero shell, the two-column layout + sticky sidebar,
   quick-fact chips, related/dentist cards and reduced motion. Load it BEFORE
   the page stylesheet (treatments.css, dentist_profile.css), which builds on it.

   Sits inside the arctit theme (light body, dark hero). Headings are Lovelo,
   all other text Outfit (lovelo.css). Sizes are in px because the theme sets
   html { font-size: 15px }.
   ========================================================================== */

.td-page,
.tl-page,
.dp-page {
  --td-ink: #101828;          /* body text on white   17.9:1 */
  --td-ink-2: #475467;        /* secondary text       7.6:1  */
  --td-navy: #001c3e;         /* brand                         */
  --td-accent: #155e97;       /* links / accents      6.9:1  */
  --td-accent-bright: #4bb0e8;
  --td-accent-soft: #eaf4fb;
  --td-bg: #f4f6f9;
  --td-surface: #ffffff;
  --td-line: #e4e9f0;
  --td-good: #146c43;         /* 6.2:1 */
  --td-good-soft: #eaf6ef;
  --td-caution: #a4430a;      /* 5.9:1 */
  --td-caution-soft: #fdf2e8;
  --td-radius: 16px;
  --td-radius-sm: 12px;
  --td-nav-offset: 92px;      /* fixed navbar height + breathing room */
  --td-shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 8px 24px rgba(16, 24, 40, .06);
  --td-ease: cubic-bezier(.2, .7, .2, 1);
}

html:has(body.td-page),
html:has(body.dp-page) { scroll-behavior: smooth; }
/* The theme gives both html and body overflow-x:hidden, which makes <body> its own
   (never-scrolling) scroll container and silently disables position:sticky.
   `clip` hides horizontal overflow without creating a scroll container. */
body.td-page,
body.dp-page { overflow: visible; overflow-x: clip; }

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap; border: 0;
}

.td-icon { flex-shrink: 0; display: inline-block; vertical-align: middle; }

/* Shared focus ring (the theme sets a { outline: 0 }) */
.td-page a:focus-visible,
.td-page button:focus-visible,
.td-page summary:focus-visible,
.td-page [tabindex]:focus-visible,
.tl-page a:focus-visible,
.tl-page button:focus-visible,
.tl-page input:focus-visible,
.dp-page a:focus-visible,
.dp-page button:focus-visible,
.dp-page summary:focus-visible,
.dp-page input:focus-visible,
.dp-page [tabindex]:focus-visible {
  outline: 3px solid var(--td-accent-bright);
  outline-offset: 3px;
  border-radius: 6px;
}

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.td-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 48px; padding: 12px 22px;
  border-radius: 999px; border: 1px solid transparent;
  font-size: 13px; letter-spacing: .08em; text-transform: uppercase; line-height: 1.2;
  text-decoration: none; cursor: pointer;
  transition: background-color .2s var(--td-ease), color .2s var(--td-ease), transform .2s var(--td-ease);
}
.td-btn:hover { text-decoration: none; transform: translateY(-1px); }
.td-btn--primary { background: var(--td-navy); color: #fff; }
.td-btn--primary:hover { background: #0a2d5c; color: #fff; }
.td-btn--light { background: #fff; color: var(--td-navy); }
.td-btn--light:hover { background: var(--td-accent-soft); color: var(--td-navy); }
.td-btn--block { width: 100%; }

/* ==========================================================================
   Hero shell
   ========================================================================== */
.td-hero {
  display: flex; align-items: flex-end;
  min-height: clamp(460px, 74vh, 720px);
  padding: 120px 0 48px;
  background: linear-gradient(135deg, #04101f 0%, #0b2544 100%);
  color: #fff;
}
.td-hero__media { position: absolute; inset: 0; }
.td-hero__img { width: 100%; height: 100%; object-fit: cover; display: block; }
/* Darkest where the text sits: ≥ .74 alpha behind the title keeps white text above 7:1
   even over a pure-white pixel. */
.td-hero__scrim {
  position: absolute; inset: 0;
  background:
    linear-gradient(180deg, rgba(2, 12, 26, .55) 0%, rgba(2, 12, 26, .74) 45%, rgba(2, 12, 26, .93) 100%),
    linear-gradient(90deg, rgba(2, 12, 26, .45) 0%, rgba(2, 12, 26, 0) 70%);
}
.td-hero .container { width: 100%; }
.td-hero__content { max-width: 820px; }

.td-breadcrumb {
  display: flex; flex-wrap: wrap; align-items: center; gap: 4px 0;
  list-style: none; margin: 0 0 18px; padding: 0;
  font-size: 12px; letter-spacing: .12em; text-transform: uppercase;
}
.td-breadcrumb li { display: inline-flex; align-items: center; color: rgba(255, 255, 255, .88); }
.td-breadcrumb li + li::before { content: "›"; margin: 0 10px; color: rgba(255, 255, 255, .6); }
.td-breadcrumb a {
  color: #fff; text-decoration: underline; text-underline-offset: 4px;
  text-decoration-color: rgba(255, 255, 255, .45);
  display: inline-flex; align-items: center; min-height: 44px;
}
.td-breadcrumb a:hover { text-decoration-color: #fff; color: #fff; }

.td-hero__eyebrow {
  margin: 0 0 10px; color: #a8dcfa;  /* ≥5:1 on the scrim even over a white pixel */
  font-size: 12px; letter-spacing: .16em; text-transform: uppercase;
}
.td-hero .td-hero__title {
  margin: 0; color: #fff;
  font-size: clamp(32px, 5.4vw, 64px); line-height: 1.05; letter-spacing: .01em;
  text-wrap: balance;
  text-shadow: 0 2px 24px rgba(0, 0, 0, .35);
}
.td-hero__subtitle {
  margin: 16px 0 0; max-width: 60ch;
  color: rgba(255, 255, 255, .92);
  font-size: clamp(14px, 1.6vw, 18px); letter-spacing: .04em; line-height: 1.5;
}
.td-hero__meta {
  display: flex; flex-wrap: wrap; gap: 10px;
  list-style: none; margin: 24px 0 0; padding: 0;
}
.td-pill {
  display: inline-flex; align-items: center; gap: 8px;
  min-height: 36px; padding: 8px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .12); border: 1px solid rgba(255, 255, 255, .24);
  color: #fff; font-size: 12px; letter-spacing: .08em; text-transform: uppercase;
  backdrop-filter: blur(6px);
}
.td-pill .td-icon { width: 16px; height: 16px; color: var(--td-accent-bright); }

/* ==========================================================================
   Layout
   ========================================================================== */
.td-wrapper { background: var(--td-bg); }

.td-layout {
  display: grid; grid-template-columns: minmax(0, 1fr);
  gap: 40px;
  padding: 28px 0 72px;
}
@media (min-width: 992px) {
  .td-layout {
    grid-template-columns: minmax(0, 1fr) 300px;
    gap: 56px; align-items: start;
    padding-top: 56px;
  }
}
@media (min-width: 1200px) {
  .td-layout { grid-template-columns: minmax(0, 1fr) 320px; gap: 72px; }
}

/* Mobile quick-fact chips (hidden ≥992px, where the sidebar shows them) */
.td-chips-wrap { padding-top: 16px; }
.td-chips {
  display: flex; gap: 8px;
  list-style: none; margin: 0 -15px; padding: 4px 15px 8px;
  overflow-x: auto; scroll-snap-type: x proximity; scroll-padding-inline: 15px;
  -webkit-overflow-scrolling: touch; scrollbar-width: none;
}
.td-chips::-webkit-scrollbar { display: none; }
.td-chip {
  flex: 0 0 auto; scroll-snap-align: start;
  display: flex; flex-direction: column; gap: 4px;
  max-width: 240px; padding: 10px 14px;
  background: var(--td-surface); border: 1px solid var(--td-line); border-radius: var(--td-radius-sm);
}
.td-chip__label { color: var(--td-ink-2); font-size: 10px; letter-spacing: .12em; text-transform: uppercase; }
.td-chip__value { color: var(--td-navy); font-size: 13px; letter-spacing: .03em; line-height: 1.3; }
@media (min-width: 992px) { .td-chips-wrap { display: none; } }

/* ── Sidebar ─────────────────────────────────────────────────────────────── */
.td-sidebar { display: none; }
@media (min-width: 992px) {
  .td-sidebar { display: block; align-self: stretch; }
  .td-sticky { position: sticky; top: var(--td-nav-offset); }
}

/* ── Related treatments + dentists ───────────────────────────────────────── */
.td-related, .td-dentists { padding: 56px 0; border-top: 1px solid var(--td-line); background: var(--td-surface); }
.td-dentists { background: var(--td-bg); }
.td-related__title { margin: 0 0 24px; color: var(--td-navy); font-size: clamp(20px, 2.4vw, 26px); letter-spacing: .02em; }
.td-dentists__list {
  display: grid; gap: 12px; list-style: none; margin: 0; padding: 0;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr));
}
.td-dentist {
  display: flex; align-items: center; gap: 12px; min-height: 64px; padding: 12px 16px;
  background: var(--td-surface); border: 1px solid var(--td-line); border-radius: var(--td-radius-sm);
  color: inherit; text-decoration: none;
  transition: border-color .15s, box-shadow .15s;
}
.td-dentist:hover { border-color: #c9d4e2; box-shadow: var(--td-shadow); text-decoration: none; }
.td-dentist__img { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; flex-shrink: 0; }
.td-dentist__img--initial { display: flex; align-items: center; justify-content: center; background: var(--td-accent-soft); color: var(--td-navy); }
.td-dentist__name { display: block; color: var(--td-navy); font-size: 15px; font-weight: 600; }
.td-dentist__city { display: block; color: var(--td-ink-2); font-size: 13px; }

/* ── Treatment cards (list grid + "Related treatments") ─────────────────── */
.tl-grid {
  display: grid; gap: 20px;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr));
}

.tl-card {
  position: relative; display: flex; flex-direction: column;
  background: var(--td-surface); border: 1px solid var(--td-line); border-radius: 18px;
  overflow: hidden;
  transition: transform .2s var(--td-ease), box-shadow .2s var(--td-ease), border-color .2s;
}
.tl-card:hover { transform: translateY(-3px); box-shadow: 0 16px 40px rgba(16, 24, 40, .10); border-color: #d0d8e3; }
/* One ring around the whole card when its link has keyboard focus */
.tl-card:has(.tl-card__link:focus-visible) { outline: 3px solid var(--td-accent-bright); outline-offset: 3px; }
.tl-card[hidden] { display: none; }

.tl-card__media { position: relative; aspect-ratio: 16 / 10; background: #e9eef4; overflow: hidden; }
.tl-card__media img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .5s var(--td-ease); }
.tl-card:hover .tl-card__media img { transform: scale(1.03); }
.tl-card__placeholder { display: flex; align-items: center; justify-content: center; height: 100%; color: #98a2b3; }
.tl-card__placeholder .td-icon { width: 44px; height: 44px; }

.tl-card__body { display: flex; flex-direction: column; gap: 10px; flex: 1; padding: 20px 20px 18px; }
.tl-card__title { margin: 0; font-size: 18px; line-height: 1.25; letter-spacing: .02em; }
.tl-card__link { color: var(--td-navy); text-decoration: none; }
.tl-card__link:hover { color: var(--td-navy); text-decoration: none; }
/* Stretch the single link over the whole card */
.tl-card__link::after { content: ""; position: absolute; inset: 0; z-index: 1; }
.tl-page .tl-card .tl-card__link:focus-visible,
.td-page .tl-card .tl-card__link:focus-visible,
.dp-page .tl-card .tl-card__link:focus-visible { outline: none; text-decoration: none; }

.tl-card__excerpt {
  margin: 0; color: var(--td-ink-2); font-size: 16px; line-height: 1.55;
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden;
}
.tl-card__chips { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; margin: 2px 0 0; padding: 0; }
.tl-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 10px; border-radius: 999px;
  background: var(--td-bg); color: var(--td-ink);
  font-size: 11px; letter-spacing: .06em; text-transform: uppercase; line-height: 1.3;
}
.tl-chip .td-icon { width: 14px; height: 14px; color: var(--td-accent); }
.tl-chip__label { color: var(--td-ink-2); }
.tl-card__more {
  display: inline-flex; align-items: center; gap: 8px; margin-top: auto; padding-top: 12px;
  border-top: 1px solid var(--td-line);
  color: var(--td-accent); font-size: 12px; letter-spacing: .1em; text-transform: uppercase;
}
.tl-card__more .td-icon { width: 16px; height: 16px; transition: transform .2s var(--td-ease); }
.tl-card:hover .tl-card__more .td-icon { transform: translateX(4px); }

/* ==========================================================================
   Reduced motion
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
  html:has(body.td-page),
  html:has(body.dp-page) { scroll-behavior: auto; }
  .td-page *, .td-page *::before, .td-page *::after,
  .tl-page *, .tl-page *::before, .tl-page *::after,
  .dp-page *, .dp-page *::before, .dp-page *::after {
    transition-duration: .01ms !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
  }
  .tl-card:hover, .td-btn:hover { transform: none; }
  .tl-card:hover .tl-card__media img { transform: none; }
}
