/* Shared interaction and scroll affordances for the public site. */

/* Readability baseline: keep the Forest Moss palette while raising the
   contrast of secondary copy and avoiding ultra-light text rendering. */
:root {
  --text-muted: #d5ddd0;
  --text-dim: #b2c0ad;
  --cream-dim: var(--text-muted);
  --cream-muted: var(--text-dim);
  --muted: #d5ddd0;
  --dim: #b2c0ad;
  --lichen-green: #b2d47a;
  --moss-bright: #c0df8d;
  --amber-pale: #e7c58a;
  --soft-daylight: #aac8e3;
}

html[data-theme="light"] {
  --text-muted: #253d5d;
  --text-dim: #3b5574;
  --cream-dim: var(--text-muted);
  --cream-muted: var(--text-dim);
  --muted: #34463b;
  --dim: #4b5e50;
  --lichen-green: #375f0d;
  --moss-bright: #375f0d;
  --moss-pale: #375f0d;
  --amber-pale: #76500f;
  --amber-bright: #68450c;
  --soft-daylight: #31577f;
  --taupe: #4d4a34;
}

body {
  font-weight: 400;
  line-height: 1.7;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: auto;
}

:where(p, li, dd) {
  text-wrap: pretty;
}

:where(.nav-links a, .mobile-menu a, .mob-drawer-panel a, .mob-drawer-panel .mob-nav-link) {
  font-size: 0.875rem !important;
}

:where(.section-lead, .pub-hero-lead, .svc-hero-lead) {
  max-width: 72ch !important;
  font-weight: 400 !important;
  line-height: 1.75 !important;
}

:where(
  .concept-body,
  .audience-tile p,
  .book-desc,
  .article-abstract,
  .other-desc,
  .opinion-excerpt,
  .press-topic,
  .cluster-items li,
  .radar-detail-text,
  .process-desc,
  .tcourse-desc,
  .proof-desc,
  .cred-item,
  .pstat-label,
  .publication-facts dd
) {
  font-size: 1rem !important;
  font-weight: 400 !important;
  line-height: 1.7 !important;
}

:where(.summary p, .hero-tagline, .hero-perspective) {
  font-weight: 400 !important;
}

:where(.book-title-translation, .book-coauthor, .book-publisher, .article-title-translation, .article-authors) {
  font-size: 0.875rem !important;
  line-height: 1.5 !important;
}

:where(.eyebrow, .hero-kicker, .book-year, .article-year, .article-journal) {
  font-size: 0.75rem !important;
}

:where(.book-title, .article-title, .other-title) {
  font-size: 1.08rem !important;
  line-height: 1.35 !important;
}

:where(.btn, .button, .book-link, .tile-link, .opinion-link, .press-link) {
  font-size: 0.75rem !important;
}

:where(a, button, summary, [role="button"]):focus-visible {
  outline: 3px solid var(--amber-pale, #f0d4a0) !important;
  outline-offset: 4px;
  border-radius: 4px;
}

:where(.nav-links a, .nav-cta, .lang-btn, .lang-option, .theme-btn, .theme-button, .language-link, .mobile-menu summary) {
  min-height: 42px;
}

.nav-links a {
  display: inline-flex;
  align-items: center;
  padding: 0.55rem 0.45rem;
  border: 1px solid transparent;
  border-radius: 4px;
}

.nav-links a:hover,
.nav-links a.active,
.nav-links a[aria-current="page"] {
  border-color: rgba(221, 184, 120, 0.28);
  background: rgba(221, 184, 120, 0.07);
}

:where(.btn, .button, .filter-btn, .int-filter-btn, .page-btn, .process-toggle) {
  min-height: 44px;
  border-radius: 4px !important;
}

:where(.hero-ctas, .cta-actions, .book-actions, .article-actions, .other-actions, .nav-actions) {
  gap: 0.75rem !important;
}

:where(.book-actions, .article-actions, .other-actions) {
  margin-top: 1.25rem;
}

:where(.book-title a, .article-title a, .other-title a, .concepts-more-link, .book-link, .tile-link, .opinion-link, .press-link, .modal-open-link) {
  text-decoration-line: underline;
  text-decoration-thickness: 1px;
  text-decoration-color: rgba(221, 184, 120, 0.36);
  text-underline-offset: 0.22em;
}

:where(.book-title a, .article-title a, .other-title a, .concepts-more-link, .book-link, .tile-link, .opinion-link, .press-link, .modal-open-link):hover {
  text-decoration-thickness: 2px;
  text-decoration-color: currentColor;
}

:where(.book-cover-wrap, .article-thumb-link, .substack-card, a.audience-tile) {
  border-radius: 4px;
}

:where(.book-cover-wrap, .article-thumb-link, .substack-card, a.audience-tile):hover {
  outline: 2px solid rgba(221, 184, 120, 0.55);
  outline-offset: 4px;
}

.eyebrow + :where(.section-title, h1, h2) {
  margin-top: 0.35rem;
}

:where(.section-title, .pub-section h2, .svc-section h2) + .section-lead {
  margin-top: 0.8rem;
}

/* Progress rail gives a persistent indication that more of the page remains. */
.reading-progress {
  position: fixed;
  top: 50%;
  right: 16px;
  z-index: 90;
  width: 3px;
  height: min(180px, 28vh);
  overflow: hidden;
  border-radius: 999px;
  background: rgba(199, 208, 192, 0.18);
  transform: translateY(-50%);
  pointer-events: none;
}

.reading-progress__bar {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(180deg, var(--amber-pale, #ddb878), var(--lichen-green, #95b65d));
  transform: scaleY(0);
  transform-origin: top;
}

/* Each principal section ends with an explicit continuation control. */
.scroll-continuation {
  position: relative;
  z-index: 3;
  display: flex;
  justify-content: center;
  width: 100%;
  margin: clamp(2rem, 5vw, 4rem) auto 0;
  padding-top: 1.25rem;
  border-top: 1px solid rgba(199, 208, 192, 0.13);
}

.scroll-continuation__button {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  min-height: 46px;
  padding: 0.72rem 1rem 0.72rem 1.15rem;
  border: 1px solid rgba(221, 184, 120, 0.38);
  border-radius: 999px;
  background: rgba(6, 9, 4, 0.45);
  color: var(--amber-pale, #f0d4a0);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.16);
  cursor: pointer;
  font: 500 0.68rem/1 var(--ff-mono, var(--mono, monospace));
  letter-spacing: 0.12em;
  text-transform: uppercase;
  transition: border-color 180ms ease, background 180ms ease, color 180ms ease, transform 180ms ease;
}

.scroll-continuation__button:hover {
  border-color: var(--amber-pale, #f0d4a0);
  background: rgba(221, 184, 120, 0.12);
  transform: translateY(2px);
}

.scroll-continuation__icon {
  display: grid;
  width: 26px;
  height: 26px;
  place-items: center;
  border: 1px solid currentColor;
  border-radius: 50%;
  font-size: 1rem;
  line-height: 1;
  animation: scrollCue 1.8s ease-in-out infinite;
}

/* Long-form section introductions may grow wider, while their individual
   lines remain comfortable to scan. */
.pub-biblio-intro {
  max-width: none !important;
  column-width: 32rem;
  column-gap: clamp(2rem, 5vw, 4rem);
  column-rule: 1px solid rgba(221, 184, 120, 0.2);
  font-size: 1rem !important;
  line-height: 1.78 !important;
}

:where(.article-abstract, .other-desc) {
  max-width: 78ch !important;
}

/* Books use the full content width. Covers remain visually prominent while
   descriptions receive a dedicated, readable column. */
.books-section .books-grid,
#solo-books-grid,
#compiled-books-grid,
#chapters-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  gap: clamp(1rem, 2.2vw, 1.75rem) !important;
  align-items: stretch;
}

.books-section .books-grid > .book-card {
  display: grid;
  grid-template-columns: minmax(140px, 38%) minmax(0, 1fr);
  gap: clamp(1.15rem, 2vw, 1.6rem);
  align-items: start;
  height: 100%;
  padding: clamp(1rem, 2vw, 1.35rem);
  border: 1px solid rgba(221, 184, 120, 0.2);
  border-top: 3px solid rgba(221, 184, 120, 0.58);
  border-radius: 5px;
  background: rgba(26, 34, 21, 0.78);
  box-shadow: 0 16px 38px rgba(0, 0, 0, 0.18);
}

.books-section .books-grid > .book-card:last-child:nth-child(odd) {
  grid-column: 1 / -1;
  grid-template-columns: minmax(180px, 240px) minmax(0, 1fr);
}

.books-section .books-grid .book-cover-wrap {
  align-self: start;
  width: 100%;
}

.books-section .books-grid .book-meta {
  min-width: 0;
  padding: 0;
}

html[data-theme="light"] .books-section .books-grid > .book-card {
  border-color: rgba(55, 91, 16, 0.28) !important;
  border-top-color: #76500f !important;
  background: #faf8f2 !important;
  box-shadow: 0 14px 34px rgba(26, 43, 69, 0.1);
}

html[data-theme="light"] .pub-biblio-intro {
  color: #253d5d !important;
  column-rule-color: rgba(55, 91, 16, 0.22);
}

/* Services: the light theme needs distinct surfaces, visible interaction
   states and stronger chart/table framing rather than one flat beige field. */
html[data-theme="light"] .svc-hero {
  background:
    radial-gradient(ellipse 55% 55% at 82% 12%, rgba(49, 87, 127, 0.13), transparent 70%),
    radial-gradient(ellipse 48% 52% at 12% 88%, rgba(55, 95, 13, 0.12), transparent 72%),
    #f7f4ec !important;
  border-bottom-color: rgba(26, 43, 69, 0.2) !important;
}

html[data-theme="light"] .svc-hero-lead {
  color: #253d5d !important;
  border-left-color: #76500f !important;
}

html[data-theme="light"] .hero-tag {
  border-color: rgba(55, 95, 13, 0.38) !important;
  background: #edf0e5 !important;
  color: #253d5d !important;
}

html[data-theme="light"] .section-nav {
  background: rgba(250, 248, 242, 0.97) !important;
  border-color: rgba(26, 43, 69, 0.2) !important;
  box-shadow: 0 8px 24px rgba(26, 43, 69, 0.07);
}

html[data-theme="light"] .snav-btn {
  color: #3b5574 !important;
}

html[data-theme="light"] .snav-btn:hover,
html[data-theme="light"] .snav-btn.active {
  color: #274e08 !important;
  border-bottom-color: #375f0d !important;
  background: rgba(55, 95, 13, 0.07) !important;
}

html[data-theme="light"] .clusters-section,
html[data-theme="light"] .process-section,
html[data-theme="light"] .training-section,
html[data-theme="light"] .carousel-section {
  background: #f2efe7 !important;
}

html[data-theme="light"] .radar-section,
html[data-theme="light"] .matrix-section,
html[data-theme="light"] .creds-section,
html[data-theme="light"] .proof-section {
  background: #e6e9de !important;
}

html[data-theme="light"] :where(.cluster-card, .tcourse, .cred-block, .pstat, .proof-item, .process-body) {
  background: #faf8f2 !important;
  border-color: rgba(26, 43, 69, 0.2) !important;
  color: #253d5d !important;
  box-shadow: 0 10px 26px rgba(26, 43, 69, 0.07);
}

html[data-theme="light"] :where(.cluster-card, .tcourse, .proof-item):hover,
html[data-theme="light"] .process-step:hover .process-body,
html[data-theme="light"] .process-step.open .process-body {
  background: #edf0e5 !important;
  border-color: rgba(55, 95, 13, 0.38) !important;
}

html[data-theme="light"] :where(
  .cluster-items li,
  .tcourse-desc,
  .tcourse-topic,
  .tcourse-fmt,
  .cred-item,
  .cred-item span,
  .pstat-label,
  .proof-desc,
  .proof-year,
  .radar-domain-label,
  .radar-detail-text,
  .process-desc,
  .matrix-domain,
  .level-label
) {
  color: #253d5d !important;
}

html[data-theme="light"] :where(.cluster-card h3, .tcourse h3, .pstat-num, .proof-desc strong, .process-title, .radar-detail-title) {
  color: #17283f !important;
}

html[data-theme="light"] .process-track::before {
  background: linear-gradient(180deg, #375f0d, rgba(55, 95, 13, 0.22)) !important;
}

html[data-theme="light"] .process-node {
  border-color: rgba(55, 95, 13, 0.48) !important;
  background: #faf8f2 !important;
  color: #274e08 !important;
}

html[data-theme="light"] .process-step:hover .process-node,
html[data-theme="light"] .process-step.open .process-node {
  border-color: #375f0d !important;
  background: #375f0d !important;
  color: #fff !important;
}

html[data-theme="light"] .process-tag {
  border-color: rgba(55, 95, 13, 0.3) !important;
  background: #e2e8d7 !important;
  color: #274e08 !important;
}

html[data-theme="light"] .matrix-scroll {
  padding: clamp(1rem, 2.5vw, 1.6rem);
  border: 1px solid rgba(26, 43, 69, 0.2);
  border-radius: 5px;
  background: #faf8f2;
  box-shadow: 0 10px 26px rgba(26, 43, 69, 0.07);
}

html[data-theme="light"] .matrix-table th {
  border-bottom-color: rgba(26, 43, 69, 0.28) !important;
  color: #3b5574 !important;
}

html[data-theme="light"] .matrix-table td {
  border-bottom-color: rgba(26, 43, 69, 0.14) !important;
}

html[data-theme="light"] .matrix-table tr:hover td {
  background: #e6ecd9 !important;
}

html[data-theme="light"] .matrix-skill {
  color: #17283f !important;
}

html[data-theme="light"] .level-bar {
  background: #cbd2c3 !important;
}

html[data-theme="light"] .radar-domain {
  border-bottom: 1px solid rgba(26, 43, 69, 0.12);
}

html[data-theme="light"] .radar-domain:hover,
html[data-theme="light"] .radar-domain.active {
  background: #faf8f2 !important;
}

html[data-theme="light"] .radar-domain[data-gap="critical"] .radar-domain-name { color: #8e2f24 !important; }
html[data-theme="light"] .radar-domain[data-gap="high"] .radar-domain-name { color: #76500f !important; }
html[data-theme="light"] .radar-domain[data-gap="moderate"] .radar-domain-name { color: #555020 !important; }
html[data-theme="light"] .radar-domain[data-gap="partial"] .radar-domain-name { color: #274e08 !important; }

html[data-theme="light"] .radar-domain-score {
  color: #17283f !important;
}

html[data-theme="light"] .carousel-track-wrap::before {
  background: linear-gradient(90deg, #f2efe7, transparent) !important;
}

html[data-theme="light"] .carousel-track-wrap::after {
  background: linear-gradient(270deg, #f2efe7, transparent) !important;
}

html[data-theme="light"] .carousel-slide,
html[data-theme="light"] .carousel-placeholder {
  border-color: rgba(26, 43, 69, 0.24) !important;
  background: #faf8f2 !important;
}

html[data-theme="light"] .carousel-placeholder-label {
  color: #3b5574 !important;
}

html[data-theme="light"] .carousel-btn {
  border-color: rgba(55, 95, 13, 0.42) !important;
  background: #faf8f2 !important;
  color: #274e08 !important;
}

html[data-theme="light"] .carousel-btn:hover {
  border-color: #375f0d !important;
  background: #e2e8d7 !important;
}

html[data-theme="light"] .carousel-dot {
  background: rgba(55, 95, 13, 0.35) !important;
}

html[data-theme="light"] .carousel-dot.active {
  background: #375f0d !important;
}

html[data-theme="light"] :where(.diag-modal, .contact-modal) {
  border-color: rgba(26, 43, 69, 0.25) !important;
  background: #faf8f2 !important;
  color: #17283f !important;
}

html[data-theme="light"] :where(.diag-input, .diag-select, .diag-textarea, .contact-input, .contact-select) {
  border-color: rgba(26, 43, 69, 0.32) !important;
  background-color: #fff !important;
  color: #17283f !important;
}

html[data-theme="light"] :where(.diag-label, .contact-label, .diag-modal-sub, .contact-lead) {
  color: #253d5d !important;
}

.scroll-continuation__button[data-direction="up"] .scroll-continuation__icon {
  animation-name: scrollCueUp;
}

@keyframes scrollCue {
  0%, 100% { transform: translateY(-2px); }
  50% { transform: translateY(3px); }
}

@keyframes scrollCueUp {
  0%, 100% { transform: translateY(2px); }
  50% { transform: translateY(-3px); }
}

html[data-theme="light"] .nav-links a:hover,
html[data-theme="light"] .nav-links a.active,
html[data-theme="light"] .nav-links a[aria-current="page"] {
  border-color: rgba(55, 91, 16, 0.25);
  background: rgba(55, 91, 16, 0.07);
}

html[data-theme="light"] .scroll-continuation {
  border-top-color: rgba(55, 91, 16, 0.16);
}

html[data-theme="light"] .scroll-continuation__button {
  border-color: rgba(55, 91, 16, 0.42);
  background: rgba(242, 239, 231, 0.86);
  color: #375b10;
  box-shadow: 0 8px 24px rgba(45, 66, 103, 0.10);
}

html[data-theme="light"] .scroll-continuation__button:hover {
  border-color: #375b10;
  background: #ffffff;
}

html[data-theme="light"] .reading-progress {
  background: rgba(55, 91, 16, 0.15);
}

@media (max-width: 720px) {
  .reading-progress { right: 6px; }
  .scroll-continuation { margin-top: 2.25rem; }
  .scroll-continuation__button { font-size: 0.62rem; }
}

@media (max-width: 900px) {
  .pub-biblio-intro {
    columns: 1;
  }

  .books-section .books-grid,
  #solo-books-grid,
  #compiled-books-grid,
  #chapters-grid {
    grid-template-columns: 1fr !important;
  }

  .books-section .books-grid > .book-card,
  .books-section .books-grid > .book-card:last-child:nth-child(odd) {
    grid-column: auto;
    grid-template-columns: minmax(150px, 220px) minmax(0, 1fr);
  }
}

@media (max-width: 600px) {
  .books-section .books-grid > .book-card,
  .books-section .books-grid > .book-card:last-child:nth-child(odd) {
    grid-template-columns: 1fr;
  }

  .books-section .books-grid .book-cover-wrap {
    max-width: 280px;
  }

  html[data-theme="light"] .matrix-scroll {
    padding: 0.85rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .scroll-continuation__icon { animation: none; }
  .scroll-continuation__button { transition: none; }
}
