/*
Theme Name: The Lifespan Brief
Theme URI: https://thelifespanbrief.com
Author: The Lifespan Brief
Description: A refined block theme for longevity science, medicine, technology, and investing journalism.
Version: 1.5.2
Requires at least: 6.4
Tested up to: 6.8
Requires PHP: 7.4
License: GNU General Public License v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: the-lifespan-brief
Tags: blog, news, block-patterns, full-site-editing, editor-style, featured-images, wide-blocks
*/

html { scroll-behavior: smooth; }
body { -webkit-font-smoothing: antialiased; }
a { text-underline-offset: .18em; }
.wp-site-blocks { overflow: hidden; }

.tlb-kicker,
.taxonomy-evidence_level a,
.taxonomy-post_tag a {
  font-family: var(--wp--preset--font-family--sans);
  font-size: .7rem;
  font-weight: 750;
  letter-spacing: .1em;
  line-height: 1;
  text-transform: uppercase;
}

.taxonomy-evidence_level,
.taxonomy-post_tag { display: flex; flex-wrap: wrap; gap: .4rem; }
.taxonomy-evidence_level .wp-block-post-terms__separator,
.taxonomy-post_tag .wp-block-post-terms__separator { display: none; }
.taxonomy-evidence_level a {
  background: var(--wp--preset--color--pale-teal);
  border-radius: 999px;
  color: var(--wp--preset--color--teal);
  padding: .48rem .68rem;
  text-decoration: none;
}

/* Evidence signal: color communicates confidence, not whether a result is positive. */
.taxonomy-evidence_level a[href*="/evidence/strong-evidence"] {
  background: #DDF2E7; color: #17623F; box-shadow: inset 0 0 0 1px #B7DFC9;
}
.taxonomy-evidence_level a[href*="/evidence/promising"] {
  background: #DCEFF3; color: #096778; box-shadow: inset 0 0 0 1px #B7DCE3;
}
.taxonomy-evidence_level a[href*="/evidence/early-research"] {
  background: #FFF0D3; color: #8A5700; box-shadow: inset 0 0 0 1px #EED59E;
}
.taxonomy-evidence_level a[href*="/evidence/expert-analysis"] {
  background: #ECE6F5; color: #5B3A78; box-shadow: inset 0 0 0 1px #D5C6E7;
}
.taxonomy-post_tag a {
  background: var(--wp--preset--color--mist);
  border-radius: 999px;
  color: var(--wp--preset--color--navy);
  padding: .48rem .68rem;
  text-decoration: none;
}

.tlb-card {
  height: 100%;
  transition: transform .22s ease, box-shadow .22s ease;
}
.tlb-card:hover { transform: translateY(-3px); box-shadow: 0 16px 36px rgba(9,31,47,.1); }
.tlb-card .wp-block-post-featured-image { overflow: hidden; }
.tlb-card .wp-block-post-featured-image img { transition: transform .35s ease; }
.tlb-card:hover .wp-block-post-featured-image img { transform: scale(1.025); }
.tlb-card .wp-block-post-title a { text-decoration: none; }

.tlb-section-label { display: flex; gap: 1rem; align-items: center; }
.tlb-section-label:after { background: var(--wp--preset--color--line); content: ""; height: 1px; flex: 1; }

.tlb-hero-image img { min-height: 470px; object-fit: cover; }
.tlb-story-image img { aspect-ratio: 16/10; object-fit: cover; }
.tlb-logo { letter-spacing: .115em; white-space: nowrap; }
.tlb-nav { font-size: .76rem; font-weight: 700; letter-spacing: .055em; text-transform: uppercase; }
.tlb-nav a { text-decoration: none; }
.tlb-nav a:hover { color: var(--wp--preset--color--teal); }
.tlb-header-actions { gap: .7rem !important; }
.tlb-theme-toggle {
  align-items: center;
  background: transparent;
  border: 1px solid var(--wp--preset--color--line);
  border-radius: 999px;
  color: var(--wp--preset--color--navy);
  cursor: pointer;
  display: inline-flex;
  flex: 0 0 auto;
  height: 2.35rem;
  justify-content: center;
  padding: 0;
  transition: background-color .2s ease, border-color .2s ease, color .2s ease, transform .2s ease;
  width: 2.35rem;
}
.tlb-theme-toggle:hover { background: var(--wp--preset--color--mist); color: var(--wp--preset--color--teal); transform: translateY(-1px); }
.tlb-theme-toggle:focus-visible { outline: 3px solid color-mix(in srgb, var(--wp--preset--color--teal) 35%, transparent); outline-offset: 2px; }
.tlb-theme-toggle__icon { font-size: 1.15rem; line-height: 1; transform: translateY(-.03em); }
.tlb-latest-list > li { border-bottom: 1px solid var(--wp--preset--color--line); padding-bottom: 1.15rem; }
.tlb-latest-list > li:last-child { border-bottom: 0; }

/* Homepage editorial franchises. These sit alongside, not in place of, topic categories. */
.tlb-formats-intro { margin-left: auto !important; margin-right: auto !important; text-align: center; }
.tlb-formats-intro > * { margin-left: auto !important; margin-right: auto !important; }
.tlb-format-grid { align-items: stretch !important; }
.tlb-format-grid > .wp-block-column { display: flex; }
.tlb-format-card {
  border-top: 5px solid var(--wp--preset--color--teal);
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  min-height: 100%;
  transition: transform .22s ease, box-shadow .22s ease;
}
.tlb-format-card--hype { border-top-color: var(--wp--preset--color--coral); }
.tlb-format-card--history { border-top-color: #8F79B8; }
.tlb-format-card:hover { box-shadow: 0 18px 44px rgba(0,0,0,.2); transform: translateY(-4px); }
.tlb-format-card h3 { margin-bottom: .85rem; margin-top: .45rem; }
.tlb-format-card h3 a { color: var(--wp--preset--color--navy); text-decoration: none; }
.tlb-format-card h3 a:hover { color: var(--wp--preset--color--teal); }
.tlb-format-number {
  color: var(--wp--preset--color--teal);
  font-family: var(--wp--preset--font-family--sans);
  font-size: .68rem;
  font-weight: 800;
  letter-spacing: .1em;
  margin: 0;
  text-transform: uppercase;
}
.tlb-format-card--hype .tlb-format-number { color: #B84737; }
.tlb-format-card--history .tlb-format-number { color: #6B5298; }
.tlb-format-example {
  border-top: 1px solid var(--wp--preset--color--line);
  color: var(--wp--preset--color--slate);
  font-size: .84rem;
  line-height: 1.5;
  margin-top: auto;
  padding-top: 1rem;
}
.tlb-format-link { font-family: var(--wp--preset--font-family--sans); font-size: .78rem; font-weight: 750; }
.tlb-format-link a { color: var(--wp--preset--color--teal); text-decoration: none; text-transform: uppercase; }
.tlb-format-link a:hover { text-decoration: underline; }

.tlb-newsletter input[type="email"] {
  background: #fff; border: 0; border-radius: 2px; box-sizing: border-box;
  color: var(--wp--preset--color--ink); min-height: 50px; padding: 0 1rem; width: 100%;
}
.tlb-newsletter button {
  background: var(--wp--preset--color--coral); border: 0; border-radius: 2px; color: #fff;
  cursor: pointer; font-weight: 750; min-height: 50px; padding: 0 1.2rem; text-transform: uppercase;
}

.single .wp-block-post-content > p,
.single .wp-block-post-content > ul,
.single .wp-block-post-content > ol,
.single .wp-block-post-content > blockquote { font-size: clamp(1.08rem, 1.7vw, 1.24rem); line-height: 1.78; }
.single .wp-block-post-content > p:first-of-type::first-letter {
  color: var(--wp--preset--color--teal); float: left; font-family: var(--wp--preset--font-family--serif);
  font-size: 4.5rem; font-weight: 700; line-height: .78; padding: .13em .12em 0 0;
}

/* Dark appearance. Explicit backgrounds are reset where the palette colour is also used as text. */
html[data-tlb-theme="dark"] body {
  --wp--preset--color--white: #0C151B;
  --wp--preset--color--ink: #E5EEEC;
  --wp--preset--color--navy: #D9F1EE;
  --wp--preset--color--teal: #62C8C0;
  --wp--preset--color--pale-teal: #163338;
  --wp--preset--color--slate: #A8B7BC;
  --wp--preset--color--mist: #14242C;
  --wp--preset--color--line: #30434B;
  background: #0C151B;
  color: #E5EEEC;
  color-scheme: dark;
}
html[data-tlb-theme="dark"] .has-navy-background-color { background-color: #07141D !important; }
html[data-tlb-theme="dark"] .has-navy-background-color,
html[data-tlb-theme="dark"] .has-navy-background-color h1,
html[data-tlb-theme="dark"] .has-navy-background-color h2,
html[data-tlb-theme="dark"] .has-navy-background-color h3,
html[data-tlb-theme="dark"] .has-navy-background-color a { color: #F3F7F6; }
html[data-tlb-theme="dark"] .has-white-background-color { background-color: #0C151B !important; }
html[data-tlb-theme="dark"] .has-mist-background-color { background-color: #14242C !important; }
html[data-tlb-theme="dark"] .wp-block-cover .wp-block-cover__inner-container,
html[data-tlb-theme="dark"] .wp-block-cover .wp-block-cover__inner-container h1,
html[data-tlb-theme="dark"] .wp-block-cover .wp-block-cover__inner-container h2,
html[data-tlb-theme="dark"] .wp-block-cover .wp-block-cover__inner-container h3,
html[data-tlb-theme="dark"] .wp-block-cover .wp-block-cover__inner-container p,
html[data-tlb-theme="dark"] .wp-block-cover .wp-block-cover__inner-container a {
  color: #F7FAF9 !important;
}
html[data-tlb-theme="dark"] footer.wp-block-template-part,
html[data-tlb-theme="dark"] footer.wp-block-template-part p,
html[data-tlb-theme="dark"] footer.wp-block-template-part h1,
html[data-tlb-theme="dark"] footer.wp-block-template-part h2,
html[data-tlb-theme="dark"] footer.wp-block-template-part h3,
html[data-tlb-theme="dark"] footer.wp-block-template-part h4,
html[data-tlb-theme="dark"] footer.wp-block-template-part h5,
html[data-tlb-theme="dark"] footer.wp-block-template-part h6,
html[data-tlb-theme="dark"] footer.wp-block-template-part a {
  color: #F3F7F6 !important;
}
html[data-tlb-theme="dark"] .tlb-card:hover { box-shadow: 0 16px 36px rgba(0,0,0,.32); }
html[data-tlb-theme="dark"] .tlb-format-card { background: #13232B !important; color: #E5EEEC !important; }
html[data-tlb-theme="dark"] .tlb-format-card h3 a { color: #F3F7F6; }
html[data-tlb-theme="dark"] .tlb-format-card--hype .tlb-format-number { color: #FF9888; }
html[data-tlb-theme="dark"] .tlb-format-card--history .tlb-format-number { color: #C3ADEB; }
html[data-tlb-theme="dark"] .tlb-newsletter input[type="email"] { background: #F5F7F6; color: #16262F; }
html[data-tlb-theme="dark"] img { opacity: .94; }
html[data-tlb-theme="dark"] .tlb-inline-figure figcaption { color: #A8B7BC; }

/* Magazine-style figures used inside long-form reporting. */
.tlb-inline-figure.alignleft { float: left; margin: .45rem 2rem 1.25rem 0; }
.tlb-inline-figure.alignright { float: right; margin: .45rem 0 1.25rem 2rem; }
.tlb-inline-figure img { display: block; width: 100%; height: auto; border-radius: 3px; }
.tlb-inline-figure figcaption { margin-top: .55rem; color: #53636B; font-size: .78rem; line-height: 1.45; }

/* Research Wire */
.tlb-research-wire {
  align-items: stretch; background: #F5FAF9; border-bottom: 1px solid var(--wp--preset--color--line);
  border-top: 1px solid var(--wp--preset--color--line); display: flex; min-height: 48px; overflow: hidden;
}
.tlb-wire-label {
  align-items: center; background: var(--wp--preset--color--teal); color: #fff; display: flex;
  flex: 0 0 auto; font-family: var(--wp--preset--font-family--sans); font-size: .74rem;
  font-weight: 800; letter-spacing: .1em; padding: 0 1.35rem; text-transform: uppercase; z-index: 2;
}
.tlb-wire-viewport { align-items: center; display: flex; min-width: 0; overflow: hidden; width: 100%; }
.tlb-wire-track {
  align-items: center; animation: tlb-wire-scroll 42s linear infinite; display: flex; min-width: max-content;
  will-change: transform;
}
.tlb-wire-viewport:hover .tlb-wire-track,
.tlb-wire-viewport:focus-within .tlb-wire-track { animation-play-state: paused; }
.tlb-wire-item {
  align-items: center; color: #16303E; display: inline-flex; font-family: var(--wp--preset--font-family--sans);
  font-size: .9rem; gap: .6rem; padding: .75rem 2rem; text-decoration: none; white-space: nowrap;
}
.tlb-wire-item:hover .tlb-wire-title { text-decoration: underline; text-underline-offset: 3px; }
.tlb-wire-date { color: #5C707A; font-size: .7rem; font-weight: 750; letter-spacing: .06em; text-transform: uppercase; }
.tlb-wire-dot { background: var(--wp--preset--color--teal); border-radius: 50%; height: 6px; width: 6px; }
@keyframes tlb-wire-scroll { from { transform: translateX(0); } to { transform: translateX(-50%); } }
html[data-tlb-theme="dark"] .tlb-research-wire { background: #102128; }
html[data-tlb-theme="dark"] .tlb-wire-item { color: #E5EEEC; }
html[data-tlb-theme="dark"] .tlb-wire-date { color: #A8B7BC; }

@media (max-width: 781px) {
  .tlb-header-row { gap: 1rem !important; }
  .tlb-logo { font-size: 1.35rem !important; }
  .tlb-hero-image img { min-height: 310px; }
  .tlb-latest { border-left: 0 !important; padding-left: 0 !important; }
  .tlb-newsletter-fields { flex-direction: column; }
  .tlb-header-actions { margin-left: auto; }
  .tlb-inline-figure.alignleft,
  .tlb-inline-figure.alignright {
    float: none;
    width: 100% !important;
    margin: 1.25rem 0 1.6rem;
  }
  .tlb-format-card { min-height: auto; }
}

@media (max-width: 500px) {
  .tlb-logo { font-size: 1.08rem !important; }
  .tlb-tagline { display: none; }
  .tlb-hero-title { font-size: 2.25rem !important; }
}

@media (prefers-reduced-motion: reduce) {
  .tlb-wire-track { animation: none; }
  .tlb-wire-viewport { overflow-x: auto; }
}
