/**
 * TFH Pages — shared styles for hero, readings, toolkit shortcodes.
 * Scope: .tfh-pages (shortcode wrapper). Design tokens on :root for reuse.
 */

.tfh-pages,
.tfh-pages *,
.tfh-pages *::before,
.tfh-pages *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --tfh-bg:        #ffffff;
  --tfh-bg-subtle: #f7f9f9;
  --tfh-bg-card:   #fafcfc;
  --tfh-ink:       #1a2e35;
  --tfh-ink-mid:   #3d5560;
  --tfh-ink-muted: #7a9199;
  --tfh-teal:      #1d7a6b;
  --tfh-teal-dark: #145c50;
  --tfh-teal-lt:   #e8f5f2;
  --tfh-navy:      #1e3a4f;
  --tfh-rule:      #dde8e6;
  --tfh-sans:      'DM Sans', sans-serif;
  --tfh-mono:      'DM Mono', monospace;
}

/* Hide theme page title when TFH shortcode is used (body gets .tfh-pages-active) */
body.tfh-pages-active .wp-block-post-title,
body.tfh-pages-active h1.wp-block-post-title,
body.tfh-pages-active .entry-header .entry-title,
body.tfh-pages-active .entry-header h1,
body.tfh-pages-active .page-header .entry-title,
body.tfh-pages-active .page-header h1:first-child,
body.tfh-pages-active .post-title,
body.tfh-pages-active .entry-title {
  display: none !important;
}

/* Remove leftover spacing from theme/Elementor title wrappers on TFH pages */
body.tfh-pages-active .entry-header,
body.tfh-pages-active .elementor-page-title,
body.tfh-pages-active .elementor-widget-theme-post-title,
body.tfh-pages-active .page-title {
  display: none !important;
  margin: 0 !important;
  padding: 0 !important;
}

/* Keep content start position consistent across TFH pages */
body.tfh-pages-active .entry-content,
body.tfh-pages-active .post-content,
body.tfh-pages-active .elementor-widget-theme-post-content {
  margin-top: 0 !important;
  padding-top: 0 !important;
}

/* Break out of theme content width so layout matches full-page hero.html */
.tfh-pages {
  --tfh-page-start: 5rem;
  width: 100%;
  max-width: 100%;
  margin-left: 0;
  margin-right: 0;
  margin-top: 0 !important;
  box-sizing: border-box;
  padding-top: var(--tfh-page-start);
  background: var(--tfh-bg);
  color: var(--tfh-ink);
  font-family: var(--tfh-sans);
  -webkit-font-smoothing: antialiased;
}

/* ── Page header (readings, toolkit, optional hero variant) ─── */
.tfh-pages .page-header {
  text-align: center;
  padding: 0 2rem 2.5rem;
  border-bottom: 1px solid var(--tfh-rule);
  animation: tfh-fadeUp 0.5s ease both;
}

.tfh-pages .page-eyebrow {
  font-family: var(--tfh-mono);
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--tfh-teal);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-bottom: 0.9rem;
}

.tfh-pages .page-headline {
  font-size: clamp(2rem, 4vw, 3rem);
  font-weight: 700;
  color: var(--tfh-navy);
  letter-spacing: -0.02em;
  margin-bottom: 0.9rem;
}

.tfh-pages .page-sub {
  font-size: 0.95rem;
  font-weight: 300;
  color: var(--tfh-ink-muted);
  max-width: 48ch;
  margin: 0 auto 1.5rem;
  line-height: 1.7;
}

.tfh-pages .medium-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--tfh-teal);
  text-decoration: none;
  border-bottom: 1px solid var(--tfh-teal-lt);
  padding-bottom: 1px;
  transition: border-color 0.2s;
}
.tfh-pages .medium-link:hover { border-color: var(--tfh-teal); }

/* ── Hero (home) ───────────────────────────────────────────── */
.tfh-pages .hero {
  text-align: center;
  padding: 0 2rem 2rem;
  animation: tfh-fadeUp 0.6s 0.1s ease both;
}

.tfh-pages .hero-eyebrow {
  font-family: var(--tfh-mono);
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--tfh-teal);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-bottom: 0.9rem;
}

.tfh-pages .hero-headline {
  font-family: var(--tfh-sans);
  font-size: clamp(1.1rem, 2vw, 1.4rem);
  font-weight: 300;
  color: var(--tfh-ink-muted);
  letter-spacing: 0.01em;
  line-height: 1.4;
  font-style: italic;
  margin-bottom: 1.5rem;
}

.tfh-pages .hero-welcome {
  font-size: 0.95rem;
  color: var(--tfh-ink-muted);
  margin-bottom: 0.4rem;
}

.tfh-pages .hero-sub {
  font-size: 1rem;
  color: var(--tfh-ink-mid);
  font-weight: 300;
  line-height: 1.7;
  max-width: 52ch;
  margin: 0 auto;
}
.tfh-pages .hero-sub strong {
  font-weight: 600;
  color: var(--tfh-navy);
}

/* ── Trust strip ───────────────────────────────────────────── */
.tfh-pages .trust-strip {
  background: var(--tfh-bg-subtle);
  border-top: 1px solid var(--tfh-rule);
  border-bottom: 1px solid var(--tfh-rule);
  padding: 1.25rem 5rem;
  margin-top: 2.5rem;
  display: flex;
  justify-content: center;
  gap: 4rem;
  animation: tfh-fadeUp 0.6s 0.3s ease both;
}

.tfh-pages .trust-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.82rem;
  color: var(--tfh-ink-mid);
}

.tfh-pages .trust-icon {
  width: 16px;
  height: 16px;
  stroke: var(--tfh-teal);
  fill: none;
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}

/* ── Cards (hero) ──────────────────────────────────────────── */
.tfh-pages .cards-section {
  padding: 3rem 5rem 5rem;
  animation: tfh-fadeUp 0.6s 0.25s ease both;
}

.tfh-pages .cards-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
  max-width: 1100px;
  margin: 0 auto;
}

.tfh-pages .card {
  border: 1.5px solid var(--tfh-rule);
  padding: 2.25rem 2rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  text-decoration: none;
  background: var(--tfh-bg);
  color: inherit;
  transition: border-color 0.22s, box-shadow 0.22s, transform 0.22s;
  position: relative;
}

.tfh-pages .card:hover {
  border-color: var(--tfh-teal);
  box-shadow: 0 8px 32px rgba(29, 122, 107, 0.10);
  transform: translateY(-3px);
}

.tfh-pages .card::before {
  content: '';
  position: absolute;
  top: -1.5px; left: -1.5px; right: -1.5px;
  height: 3px;
  background: var(--tfh-teal);
  transform: scaleX(0);
  transition: transform 0.25s ease;
  transform-origin: left;
}
.tfh-pages .card:hover::before { transform: scaleX(1); }

.tfh-pages .card-badge {
  position: absolute;
  top: 1rem;
  right: 1rem;
  font-family: var(--tfh-mono);
  font-size: 0.62rem;
  font-weight: 500;
  color: var(--tfh-teal);
  background: var(--tfh-teal-lt);
  border: 1px solid var(--tfh-teal);
  padding: 0.15rem 0.5rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.tfh-pages .card-icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--tfh-teal-lt);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1.4rem;
  transition: background 0.22s;
}
.tfh-pages .card:hover .card-icon { background: var(--tfh-teal); }

.tfh-pages .card-icon svg {
  width: 24px;
  height: 24px;
  stroke: var(--tfh-teal);
  fill: none;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: stroke 0.22s;
}
.tfh-pages .card:hover .card-icon svg { stroke: #fff; }

.tfh-pages .card-title {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--tfh-navy);
  margin-bottom: 0.6rem;
  letter-spacing: -0.01em;
}

.tfh-pages .card-desc {
  font-size: 0.85rem;
  font-weight: 300;
  color: var(--tfh-ink-muted);
  line-height: 1.65;
}

.tfh-pages .card-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin-top: 1.5rem;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--tfh-teal);
  transition: gap 0.2s;
}
.tfh-pages .card:hover .card-link { gap: 0.6rem; }

/* ── Section label ─────────────────────────────────────────── */
.tfh-pages .section-label {
  font-family: var(--tfh-mono);
  font-size: 0.68rem;
  font-weight: 500;
  color: var(--tfh-ink-muted);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-bottom: 1.5rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--tfh-rule);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.tfh-pages .section-label a {
  color: var(--tfh-teal);
  text-decoration: none;
  font-size: 0.68rem;
  letter-spacing: 0.08em;
}
.tfh-pages .section-label a:hover { text-decoration: underline; }

/* ── Readings: loading & error ─────────────────────────────── */
.tfh-pages .loading-state {
  text-align: center;
  padding: 4rem 2rem;
  color: var(--tfh-ink-muted);
}

.tfh-pages .loading-spinner {
  width: 28px;
  height: 28px;
  border: 2px solid var(--tfh-rule);
  border-top-color: var(--tfh-teal);
  border-radius: 50%;
  animation: tfh-spin 0.8s linear infinite;
  margin: 0 auto 1rem;
}

.tfh-pages .loading-text {
  font-family: var(--tfh-mono);
  font-size: 0.75rem;
  letter-spacing: 0.06em;
}

.tfh-pages .error-state {
  display: none;
  text-align: center;
  padding: 3rem 2rem;
  border: 1px solid var(--tfh-rule);
  background: var(--tfh-bg-subtle);
}

.tfh-pages .error-icon { font-size: 1.5rem; margin-bottom: 0.75rem; }

.tfh-pages .error-text {
  font-size: 0.9rem;
  color: var(--tfh-ink-muted);
  margin-bottom: 1.25rem;
  line-height: 1.6;
}

.tfh-pages .btn-medium {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--tfh-teal);
  color: #fff;
  font-size: 0.85rem;
  font-weight: 500;
  padding: 0.75rem 1.5rem;
  text-decoration: none;
  transition: background 0.2s;
}
.tfh-pages .btn-medium:hover { background: var(--tfh-navy); }

/* ── Readings: articles grid ────────────────────────────────── */
.tfh-pages .readings-section {
  padding: 3.5rem 5rem 5rem;
  max-width: 1100px;
  margin: 0 auto;
  animation: tfh-fadeUp 0.5s 0.15s ease both;
}

.tfh-pages .articles-grid {
  display: none;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
}

.tfh-pages .article-card {
  border: 1.5px solid var(--tfh-rule);
  background: var(--tfh-bg-card);
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
  transition: border-color 0.2s, box-shadow 0.2s, transform 0.2s;
  position: relative;
  overflow: hidden;
}

.tfh-pages .article-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--tfh-teal);
  transform: scaleX(0);
  transition: transform 0.25s ease;
  transform-origin: left;
}

.tfh-pages .article-card:hover {
  border-color: var(--tfh-teal);
  box-shadow: 0 6px 24px rgba(29, 122, 107, 0.09);
  transform: translateY(-2px);
}
.tfh-pages .article-card:hover::before { transform: scaleX(1); }

.tfh-pages .article-thumb {
  width: 100%;
  aspect-ratio: 16/9;
  object-fit: cover;
  background: var(--tfh-teal-lt);
  display: block;
}

.tfh-pages .article-thumb-placeholder {
  width: 100%;
  aspect-ratio: 16/9;
  background: var(--tfh-teal-lt);
  display: flex;
  align-items: center;
  justify-content: center;
}

.tfh-pages .article-thumb-placeholder svg {
  width: 32px;
  height: 32px;
  stroke: var(--tfh-teal);
  fill: none;
  stroke-width: 1.5;
  opacity: 0.5;
}

.tfh-pages .article-body {
  padding: 1.4rem 1.5rem 1.6rem;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.tfh-pages .article-date {
  font-family: var(--tfh-mono);
  font-size: 0.65rem;
  color: var(--tfh-ink-muted);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 0.6rem;
}

.tfh-pages .article-title {
  font-size: 0.98rem;
  font-weight: 600;
  color: var(--tfh-navy);
  line-height: 1.45;
  margin-bottom: 0.65rem;
  letter-spacing: -0.01em;
}

.tfh-pages .article-excerpt {
  font-size: 0.82rem;
  font-weight: 300;
  color: var(--tfh-ink-muted);
  line-height: 1.65;
  flex: 1;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.tfh-pages .article-cta {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  margin-top: 1.1rem;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--tfh-teal);
  transition: gap 0.2s;
}
.tfh-pages .article-card:hover .article-cta { gap: 0.55rem; }

.tfh-pages .article-card { animation: tfh-cardIn 0.4s ease both; }
.tfh-pages .article-card:nth-child(2) { animation-delay: 0.07s; }
.tfh-pages .article-card:nth-child(3) { animation-delay: 0.14s; }
.tfh-pages .article-card:nth-child(4) { animation-delay: 0.21s; }
.tfh-pages .article-card:nth-child(5) { animation-delay: 0.28s; }
.tfh-pages .article-card:nth-child(6) { animation-delay: 0.35s; }

/* ── Toolkit: calc list ───────────────────────────────────────── */
.tfh-pages .toolkit-section {
  padding: 3.5rem 5rem 5rem;
  max-width: 1100px;
  margin: 0 auto;
  animation: tfh-fadeUp 0.5s 0.15s ease both;
}

.tfh-pages .calc-list {
  display: flex;
  flex-direction: column;
  gap: 1px;
  background: var(--tfh-rule);
  border: 1px solid var(--tfh-rule);
}

.tfh-pages .calc-row {
  display: grid;
  grid-template-columns: 56px 1fr auto;
  align-items: center;
  gap: 1.5rem;
  padding: 1.75rem 2rem;
  background: var(--tfh-bg);
  text-decoration: none;
  color: inherit;
  transition: background 0.18s;
  position: relative;
}

.tfh-pages .calc-row::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--tfh-teal);
  transform: scaleY(0);
  transition: transform 0.2s ease;
}
.tfh-pages .calc-row:hover { background: var(--tfh-teal-lt); }
.tfh-pages .calc-row:hover::before { transform: scaleY(1); }

.tfh-pages .calc-icon {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--tfh-teal-lt);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.18s;
}
.tfh-pages .calc-row:hover .calc-icon { background: var(--tfh-teal); }

.tfh-pages .calc-icon svg {
  width: 22px;
  height: 22px;
  stroke: var(--tfh-teal);
  fill: none;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: stroke 0.18s;
}
.tfh-pages .calc-row:hover .calc-icon svg { stroke: #fff; }

.tfh-pages .calc-name {
  font-size: 1rem;
  font-weight: 600;
  color: var(--tfh-navy);
  margin-bottom: 0.3rem;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.tfh-pages .badge {
  font-family: var(--tfh-mono);
  font-size: 0.58rem;
  font-weight: 500;
  color: var(--tfh-teal);
  background: var(--tfh-teal-lt);
  border: 1px solid var(--tfh-teal);
  padding: 0.1rem 0.45rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border-radius: 2px;
}

.tfh-pages .calc-desc {
  font-size: 0.83rem;
  font-weight: 300;
  color: var(--tfh-ink-muted);
  line-height: 1.6;
}

.tfh-pages .calc-features {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.6rem;
  flex-wrap: wrap;
}

.tfh-pages .feature-tag {
  font-family: var(--tfh-mono);
  font-size: 0.62rem;
  color: var(--tfh-ink-muted);
  background: var(--tfh-bg-subtle);
  border: 1px solid var(--tfh-rule);
  padding: 0.15rem 0.5rem;
  letter-spacing: 0.04em;
}

.tfh-pages .calc-arrow {
  font-size: 1.1rem;
  color: var(--tfh-ink-muted);
  transition: transform 0.2s, color 0.2s;
  flex-shrink: 0;
}
.tfh-pages .calc-row:hover .calc-arrow {
  transform: translateX(5px);
  color: var(--tfh-teal);
}

.tfh-pages .calc-row.disabled {
  opacity: 0.5;
  pointer-events: none;
}
.tfh-pages .calc-row.disabled .badge {
  color: var(--tfh-ink-muted);
  background: transparent;
  border-color: var(--tfh-rule);
}

/* ── Animations ─────────────────────────────────────────────── */
@keyframes tfh-fadeUp {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes tfh-spin {
  to { transform: rotate(360deg); }
}

@keyframes tfh-cardIn {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Responsive (900px) ──────────────────────────────────────── */
@media (max-width: 900px) {
  .tfh-pages { --tfh-page-start: 3rem; }
  .tfh-pages .hero { padding: 0 1.5rem 1.5rem; }
  .tfh-pages .trust-strip { padding: 1.1rem 1.5rem; gap: 1.25rem; flex-wrap: wrap; }
  .tfh-pages .cards-section { padding: 2rem 1.5rem 3rem; }
  .tfh-pages .cards-grid { grid-template-columns: 1fr; gap: 1rem; }

  .tfh-pages .page-header { padding: 0 1.5rem 2rem; }
  .tfh-pages .readings-section { padding: 2.5rem 1.5rem 3.5rem; }
  .tfh-pages .articles-grid { grid-template-columns: 1fr; }

  .tfh-pages .toolkit-section { padding: 2.5rem 1.5rem 3.5rem; }
  .tfh-pages .calc-row { grid-template-columns: 44px 1fr auto; gap: 1rem; padding: 1.4rem 1.25rem; }
}

@media (min-width: 601px) and (max-width: 900px) {
  .tfh-pages .articles-grid { grid-template-columns: repeat(2, 1fr); }
}
