/* =====================================================
   MH Theme — Phase 151N Internal Page Design Completion
   Scope: public internal pages only.
   Purpose: bring fallback/internal templates closer to the approved homepage
   rhythm without touching hero visuals, global buttons, admin UI, or the
   locked glass-card rule.
   ===================================================== */

:where(
  .mht-about-page,
  .mht-work-page,
  .mht-thinking-page,
  .mht-resources-page,
  .mht-post-single,
  .mht-project-single,
  .mht-search-page,
  .mht-archive-page,
  .mht-index-page,
  .mht-empty-page
) {
  overflow-x: clip;
}

/* Shared public section rhythm for pages that sit under the reusable page hero. */
.mht-work-page .mht-work-page__grid-section,
.mht-thinking-page .mht-thinking-page__grid-section,
.mht-resources-page .mht-resources,
.mht-query-list {
  padding-block-start: clamp(42px, 5.8vw, 86px);
}

.mht-work-page .mht-page-cta,
.mht-thinking-page .mht-page-cta,
.mht-resources-page .mht-page-cta,
.mht-search-page .mht-page-cta,
.mht-archive-page .mht-page-cta,
.mht-index-page .mht-page-cta,
.mht-post-single .mht-post-single__nav,
.mht-project-single .mht-project-single__nav {
  margin-block-start: clamp(10px, 2vw, 28px);
}

/* About: keep the founder-led page readable and balanced on smaller screens. */
.mht-about-page .mht-about-note__body,
.mht-about-page .mht-about-story__body,
.mht-about-page .mht-about-beliefs__item-body,
.mht-about-page .mht-about-fit__list li {
  text-wrap: pretty;
}

@media (max-width: 760px) {
  .mht-about-page .mht-about-hero__actions,
  .mht-about-page .mht-about-story__actions {
    align-items: stretch;
  }

  .mht-about-page .mht-about-hero__actions .mht-u-btn,
  .mht-about-page .mht-about-story__actions .mht-u-btn {
    width: 100%;
    justify-content: center;
  }

  .mht-about-page .mht-about-beliefs__item,
  .mht-about-page .mht-about-fit__col,
  .mht-about-page .mht-about-story__card {
    border-radius: clamp(20px, 7vw, 28px);
  }
}

/* Work / Thinking / Resources: archive controls should feel like editorial tools, not cramped filters. */
.mht-thinking-page .mht-thinking-page__filters,
.mht-resources-page .mht-resources__filters {
  margin-block: clamp(12px, 2vw, 22px) clamp(22px, 3vw, 38px);
}

.mht-thinking-page .mht-thinking-page__grid,
.mht-work-page .mht-work-page__wall,
.mht-resources-page .mht-resources__grid,
.mht-query-list__grid {
  align-items: stretch;
}

.mht-thinking-page .mht-thinking-card,
.mht-post-single .mht-thinking-card,
.mht-resources-page .mht-resources__card,
.mht-query-card__link {
  min-height: 100%;
}

/* Project/story pages: improve readable rhythm without changing the case-study architecture. */
.mht-project-case__block-inner,
.mht-project-case__editor-inner,
.mht-post-single .mht-post-single__body-inner {
  max-width: min(var(--site-max, 1180px), calc(100vw - (var(--site-gutter, 24px) * 2)));
}

.mht-project-case__block-body,
.mht-project-case__editor-inner,
.mht-post-single .mht-post-single__content {
  text-wrap: pretty;
}

.mht-project-case__block-body :where(p, ul, ol),
.mht-project-case__editor-inner :where(p, ul, ol),
.mht-post-single .mht-post-single__content :where(p, ul, ol) {
  max-width: 72ch;
}

.mht-project-case__snapshot-grid,
.mht-project-case__quote,
.mht-post-engage,
.mht-post-single .mht-post-single__related-grid,
.mht-project-single .mht-project-single__cover,
.mht-post-single .mht-post-single__cover {
  border-color: rgba(197, 166, 211, .14);
}

.mht-project-single .mht-project-single__cover.has-placeholder,
.mht-post-single .mht-post-single__cover.has-placeholder {
  background:
    radial-gradient(circle at 18% 18%, rgba(183, 140, 255, .22), transparent 34%),
    radial-gradient(circle at 82% 78%, rgba(197, 166, 211, .14), transparent 42%),
    linear-gradient(135deg, rgba(27, 22, 32, .96), rgba(20, 16, 23, .98) 56%, rgba(47, 31, 58, .86));
}

.mht-project-single .mht-project-single__cover-placeholder::after,
.mht-post-single .mht-post-single__cover-placeholder::after {
  content: "MH";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: rgba(246, 242, 247, .22);
  font-family: var(--font-display, "Migra", Georgia, serif);
  font-size: clamp(3rem, 10vw, 8rem);
  letter-spacing: -.08em;
}

/* Search / archive / fallback routes: finish the 151M query-list pattern. */
.mht-query-list__grid {
  align-items: stretch;
}

.mht-query-card__link {
  height: 100%;
}

.mht-query-card__body {
  justify-content: flex-start;
}

.mht-query-card__excerpt {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

@media (max-width: 620px) {
  .mht-query-list {
    padding-block-start: clamp(34px, 9vw, 54px);
  }

  .mht-query-card__media {
    min-height: auto;
    aspect-ratio: 16 / 10;
  }

  .mht-query-card__body {
    padding: clamp(20px, 6vw, 28px);
  }
}

/* 404 / no-results: keep actions calm and useful on narrow screens. */
.mht-empty__actions,
.mht-query-list__empty .mht-actions,
.mht-no-results .mht-actions {
  flex-wrap: wrap;
}

@media (max-width: 560px) {
  .mht-empty__actions .mht-u-btn,
  .mht-query-list__empty .mht-u-btn,
  .mht-no-results .mht-u-btn,
  .mht-thinking-page__empty-card .mht-u-btn,
  .mht-work-page__empty-card .mht-u-btn {
    width: 100%;
    justify-content: center;
  }
}

/* Light mode completion: prevent dark-only surfaces on internal missing-media and case-study blocks. */
html[data-mht-theme-effective="light"] .mht-project-case__snapshot-grid,
html[data-mht-theme="light"] .mht-project-case__snapshot-grid,
html[data-mht-theme-effective="light"] .mht-project-case__quote,
html[data-mht-theme="light"] .mht-project-case__quote,
html[data-mht-theme-effective="light"] .mht-post-engage,
html[data-mht-theme="light"] .mht-post-engage {
  border-color: rgba(76, 52, 93, .14);
  background:
    radial-gradient(circle at 96% 0%, rgba(230, 216, 255, .42), transparent 48%),
    rgba(255, 255, 255, .62);
  box-shadow: 0 18px 52px rgba(47, 31, 58, .06);
}

html[data-mht-theme-effective="light"] .mht-project-case__snapshot-row,
html[data-mht-theme="light"] .mht-project-case__snapshot-row {
  border-color: rgba(76, 52, 93, .10);
}

html[data-mht-theme-effective="light"] .mht-project-case__snapshot-row dt,
html[data-mht-theme="light"] .mht-project-case__snapshot-row dt,
html[data-mht-theme-effective="light"] .mht-project-case__quote-cite,
html[data-mht-theme="light"] .mht-project-case__quote-cite {
  color: rgba(47, 31, 58, .58);
}

html[data-mht-theme-effective="light"] .mht-project-case__snapshot-row dd,
html[data-mht-theme="light"] .mht-project-case__snapshot-row dd,
html[data-mht-theme-effective="light"] .mht-project-case__section-heading,
html[data-mht-theme="light"] .mht-project-case__section-heading,
html[data-mht-theme-effective="light"] .mht-project-case__quote-text,
html[data-mht-theme="light"] .mht-project-case__quote-text {
  color: #2F1F3A;
}

html[data-mht-theme-effective="light"] .mht-project-case__block-body,
html[data-mht-theme="light"] .mht-project-case__block-body,
html[data-mht-theme-effective="light"] .mht-project-case__editor-inner :where(p, ul, ol),
html[data-mht-theme="light"] .mht-project-case__editor-inner :where(p, ul, ol) {
  color: rgba(47, 31, 58, .74);
}

html[data-mht-theme-effective="light"] .mht-project-single .mht-project-single__cover.has-placeholder,
html[data-mht-theme="light"] .mht-project-single .mht-project-single__cover.has-placeholder,
html[data-mht-theme-effective="light"] .mht-post-single .mht-post-single__cover.has-placeholder,
html[data-mht-theme="light"] .mht-post-single .mht-post-single__cover.has-placeholder {
  border-color: rgba(76, 52, 93, .14);
  background:
    radial-gradient(circle at 20% 18%, rgba(183, 140, 255, .18), transparent 36%),
    radial-gradient(circle at 82% 80%, rgba(142, 99, 163, .10), transparent 40%),
    linear-gradient(135deg, rgba(251, 248, 253, .98), rgba(246, 242, 247, .96) 52%, rgba(230, 216, 255, .64));
  box-shadow: 0 24px 64px rgba(47, 31, 58, .10);
}

html[data-mht-theme-effective="light"] .mht-project-single .mht-project-single__cover-placeholder::after,
html[data-mht-theme="light"] .mht-project-single .mht-project-single__cover-placeholder::after,
html[data-mht-theme-effective="light"] .mht-post-single .mht-post-single__cover-placeholder::after,
html[data-mht-theme="light"] .mht-post-single .mht-post-single__cover-placeholder::after {
  color: rgba(76, 52, 93, .22);
}

html[data-mht-theme-effective="light"] .mht-project-gallery__figure,
html[data-mht-theme="light"] .mht-project-gallery__figure {
  border-color: rgba(76, 52, 93, .12);
  box-shadow: 0 18px 48px rgba(47, 31, 58, .08);
}

@media (max-width: 820px) {
  .mht-project-case__block,
  .mht-project-case__editor,
  .mht-project-case__gallery,
  .mht-project-case__testimonial,
  .mht-post-single .mht-post-single__cover-section,
  .mht-project-single .mht-project-single__cover-section {
    padding-block-start: clamp(28px, 8vw, 48px);
  }

  .mht-project-single .mht-project-single__nav-inner,
  .mht-post-single .mht-post-single__nav-inner {
    align-items: stretch;
  }

  .mht-project-single .mht-project-single__nav-inner .mht-u-btn,
  .mht-post-single .mht-post-single__nav-inner .mht-u-btn {
    width: 100%;
    justify-content: center;
  }
}
