/* ==========================================================================
   Longevity guide (/longevity-guide/, Lumart 16 Nov): "Live 100 Healthy
   Years". Same frame as What we test: a sticky contents menu on the left
   (tick + bold on the chapter you're reading), the chapters on the right.
   Phones: the menu becomes a sticky row of chapter tabs under the header.
   ========================================================================== */

.lg {
  background: var(--bg);
  /* No hero above this page, so the top clears the floating header pill. */
  padding: clamp(140px, 17vh, 180px) 0 clamp(64px, 10vh, 120px);
}
.lg__inner {
  width: min(1240px, 92vw); margin: 0 auto;
  display: grid;
  grid-template-columns: clamp(220px, 22vw, 268px) minmax(0, 1fr);
  gap: clamp(36px, 5vw, 80px);
  align-items: start;
}

/* ── sticky contents ── */
.lg__aside {
  position: sticky; top: 104px;
  max-height: calc(100vh - 128px);
  overflow-y: auto; overscroll-behavior: contain;
  padding-right: 6px;
  scrollbar-width: thin; scrollbar-color: rgba(12,12,13,0.22) transparent;
}
.lg__aside::-webkit-scrollbar { width: 5px; }
.lg__aside::-webkit-scrollbar-thumb { background: rgba(12,12,13,0.18); border-radius: 4px; }
.lg__aside-t {
  font-family: var(--sans); font-size: 17px; font-weight: 600; letter-spacing: -0.01em;
  color: var(--ink); margin: 0 0 10px; padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}
.lg-nav { display: flex; flex-direction: column; gap: 1px; }
.lg-nav__item {
  display: flex; align-items: baseline; gap: 10px;
  padding: 7px 2px 7px 0;
  font-family: var(--sans); font-size: 14.5px; font-weight: 500; line-height: 1.35;
  color: var(--ink-faint); text-decoration: none;
  transition: color 0.18s ease;
}
.lg-nav__item:hover { color: var(--ink-soft); }
.lg-nav__tick {
  width: 14px; height: 1.5px; background: currentColor; flex: none; align-self: center;
  opacity: 0; transform: scaleX(0.3); transform-origin: left;
  transition: opacity 0.22s ease, transform 0.22s ease;
}
.lg-nav__num { font-family: var(--mono); font-size: 11.5px; color: var(--ink-faint); flex: none; }
.lg-nav__item.is-active { color: var(--ink); font-weight: 600; }
.lg-nav__item.is-active .lg-nav__tick { opacity: 1; transform: none; color: var(--accent); }

/* ── reading column ── */
.lg__main { min-width: 0; max-width: 760px; }
.lg__kicker {
  font-family: var(--mono); font-size: 12.5px; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--ink-soft); margin: 0 0 16px;
}
.lg__title {
  font-family: var(--sans); font-weight: 600; letter-spacing: -0.03em;
  font-size: clamp(38px, 5vw, 64px); line-height: 1.0; color: var(--ink); margin: 0;
}
.lg__lead {
  margin: clamp(20px, 2.6vh, 30px) 0 0; max-width: 60ch;
  font-size: clamp(16px, 1.25vw, 19px); line-height: 1.6; color: var(--ink); text-wrap: pretty;
}
.lg__lead--soft { margin-top: 14px; color: var(--ink-soft); }

.lg-ch {
  scroll-margin-top: 104px;
  padding-top: clamp(48px, 7vh, 80px);
  margin-top: clamp(40px, 6vh, 72px);
  border-top: 1px solid var(--line);
  font-family: var(--sans); color: var(--ink-soft);
  font-size: clamp(16px, 1.15vw, 17.5px); line-height: 1.7;
}
.lg__head + .lg-ch { margin-top: clamp(44px, 6vh, 72px); }
.lg-ch__head { display: flex; align-items: baseline; gap: 16px; margin-bottom: 10px; }
.lg-ch__num { font-family: var(--mono); font-size: 13px; letter-spacing: 0.08em; color: var(--accent); margin: 0; flex: none; }
.lg-ch__title {
  font-family: var(--sans); font-weight: 600; letter-spacing: -0.025em;
  font-size: clamp(28px, 3vw, 40px); line-height: 1.1; color: var(--ink); margin: 0;
}
.lg-ch__tag {
  font-size: clamp(19px, 1.6vw, 23px); line-height: 1.4; font-weight: 500; letter-spacing: -0.01em;
  color: var(--ink); margin: 0 0 28px; text-wrap: balance;
}
.lg-ch p { margin: 0 0 1.1em; text-wrap: pretty; }
.lg-ch strong { color: var(--ink); font-weight: 600; }
.lg-ch h3 {
  font-family: var(--sans); font-weight: 600; font-size: clamp(19px, 1.5vw, 22px); letter-spacing: -0.015em;
  line-height: 1.3; color: var(--ink); margin: 2em 0 0.6em;
}
.lg-ch a { color: var(--ink); text-decoration: underline; text-decoration-color: var(--line); text-underline-offset: 3px; }
.lg-ch a:hover { text-decoration-color: currentColor; }
.lg-cite { font-size: 0.72em; line-height: 0; margin-left: 1px; color: var(--ink-faint); }
.lg-ch .lg-cite a { color: inherit; text-decoration: none; }
.lg-ch .lg-cite a:hover { color: var(--accent); }

/* In short */
.lg-short {
  margin: 0 0 30px; padding: 20px 24px; border-radius: 16px;
  background: #f3f2ef; color: var(--ink);
}
.lg-short p { margin: 0; }
.lg-short .lg-short__k {
  font-family: var(--mono); font-size: 12px; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--accent); margin: 0 0 8px;
}

/* Go deeper */
.lg-deeper {
  margin: 2em 0; padding: 4px 0 4px 22px;
  border-left: 2px solid var(--accent);
}
.lg-deeper__t {
  font-family: var(--sans); font-size: 18px; font-weight: 600; color: var(--ink); line-height: 1.35;
  margin: 0 0 10px;
}
.lg-deeper__t span {
  display: block; font-family: var(--mono); font-size: 11.5px; font-weight: 500; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--ink-faint); margin-bottom: 4px;
}
.lg-deeper p:last-child { margin-bottom: 0; }

/* Start here */
.lg-start {
  margin: 2.2em 0 0; padding: 22px 24px 18px; border-radius: 16px;
  border: 1px solid var(--line); background: #fff;
}
.lg-start__t {
  display: flex; align-items: center; gap: 10px;
  font-family: var(--mono); font-size: 12.5px; font-weight: 500; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--ink); margin: 0 0 12px;
}
.lg-start__t::before { content: ""; width: 10px; height: 10px; background: var(--accent); flex: none; }
.lg-start ul { list-style: none; margin: 0; padding: 0; }
.lg-start li {
  position: relative; padding: 10px 0 10px 30px; color: var(--ink);
  border-top: 1px solid var(--line);
}
.lg-start li:first-child { border-top: 0; }
.lg-start li::before {
  content: ""; position: absolute; left: 2px; top: 15px; width: 16px; height: 16px; border-radius: 50%;
  border: 1.5px solid var(--accent);
}

/* Tables */
.lg-table { margin: 1.4em 0 1.8em; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.lg-table table { width: 100%; border-collapse: collapse; font-size: 0.93em; line-height: 1.5; }
.lg-table th, .lg-table td { text-align: left; vertical-align: top; padding: 12px 14px 12px 0; border-top: 1px solid var(--line); }
.lg-table thead th {
  font-family: var(--mono); font-size: 11.5px; font-weight: 500; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--ink-faint); border-top: 0; padding-bottom: 10px;
}
.lg-table tbody th { font-weight: 600; color: var(--ink); min-width: 9em; }
.lg-table tbody td { color: var(--ink-soft); }

.lg-cta { margin: 1.6em 0 0; }
.lg-ch .lg-cta a { text-decoration: none; color: #fff; }

/* References */
.lg-refs { margin: 1em 0 0; padding-left: 2.2em; font-size: 14px; line-height: 1.6; color: var(--ink-soft); }
.lg-refs li { margin: 0 0 12px; padding-left: 4px; scroll-margin-top: 120px; overflow-wrap: anywhere; }
.lg-refs li:target { color: var(--ink); background: #f3f2ef; border-radius: 6px; }

/* ── Phones: chapter tabs stick under the header (like What we test) ── */
@media (max-width: 880px) {
  .lg { padding: 112px 0 clamp(56px, 9svh, 88px); }
  .lg__inner { display: flex; flex-direction: column; align-items: stretch; gap: 0; width: calc(100% - 44px); }
  .lg__main, .lg__aside { display: contents; }
  .lg__head { order: 1; }
  .lg__title { font-size: clamp(36px, 10vw, 46px); }
  .lg__lead { font-size: 17px; line-height: 1.55; margin-top: 16px; max-width: none; }
  .lg__aside-t { display: none; }
  .lg-nav {
    order: 3; position: sticky; top: var(--lg-top, 64px); z-index: 6;
    flex-direction: row; gap: 24px;
    margin: 26px -22px 0; padding: 4px 22px 0;
    background: var(--bg); border-bottom: 1px solid var(--line);
    overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch;
  }
  .lg-nav::-webkit-scrollbar { display: none; }
  .lg-nav__item {
    flex: none; white-space: nowrap; min-height: 48px; align-items: center; gap: 6px;
    padding: 0; font-size: 15px; color: var(--ink-soft);
    border-bottom: 2px solid transparent; margin-bottom: -1px;
  }
  .lg-nav__tick { display: none; }
  .lg-nav__item.is-active { color: var(--ink); border-bottom-color: var(--accent); }
  .lg-ch { order: 4; scroll-margin-top: calc(var(--lg-top, 64px) + 64px); font-size: 16.5px; line-height: 1.65; }
  .lg__head + .lg-ch, .lg-ch:first-of-type { margin-top: 0; border-top: 0; padding-top: 32px; }
  .lg-ch__head { gap: 12px; }
  .lg-short, .lg-start { padding: 18px 18px 14px; border-radius: 14px; }
  .lg-table { margin-left: -22px; margin-right: -22px; padding: 0 22px; }
  .lg-table table { min-width: 520px; }
  .lg-refs { padding-left: 1.8em; font-size: 13.5px; }
}

/* Small phones: table rows become small cards, each value under its column name. */
@media (max-width: 600px) {
  .lg-table { margin-left: 0; margin-right: 0; padding: 0; overflow: visible; }
  .lg-table table { min-width: 0; }
  .lg-table thead { display: none; }
  .lg-table tr { display: block; padding: 14px 0; border-top: 1px solid var(--line); }
  .lg-table tbody th, .lg-table td { display: block; border: 0; padding: 0; }
  .lg-table tbody th { margin-bottom: 6px; font-size: 16px; }
  .lg-table td + td { margin-top: 10px; }
  .lg-table td::before {
    content: attr(data-label); display: block; margin-bottom: 2px;
    font-family: var(--mono); font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-faint);
  }
  .lg-table tr:has(td:only-of-type) td::before { display: none; }
}

/* With the hero above (Lumart, 16 Nov), the normal What we test spacing. */
.phero ~ .lg { padding-top: clamp(48px, 7vh, 96px); }
@media (max-width: 880px) {
  .phero ~ .lg { padding-top: clamp(40px, 7svh, 64px); }
}
