:root {
  --paper: #f5f1e8;
  --paper-line: #ddd3bd;
  --ink: #26241f;
  --ink-soft: #6f6a5c;
  --accent: #9c7a3f;
  --accent-deep: #6e5527;
  --rule: #b6473f;
  --teal: #1e6e72;
  --card: #fdfbf6;
  /* approx. 1.5 wordmark grid-squares of breathing room below the banner —
     tune this one value if it looks off in preview */
  --space-below-wordmark: 4rem;
}

/* ---- page width & sidebar layout ---- */
@media (min-width: 992px) {
  #quarto-content.page-columns {
    display: grid !important;
    grid-template-columns: minmax(0, 760px) 280px !important;
    column-gap: 3rem !important;
    justify-content: center !important;
    max-width: 1300px !important;
    margin: 0 auto !important;
    padding: 0 2rem !important;
  }
  main.content { grid-column: 1 !important; }
  .site-sidebar {
    grid-column: 2 !important;
    grid-row: 1 !important;
    align-self: start !important;
    position: sticky !important;
    top: 2rem !important;
  }
}
@media (max-width: 991.98px) {
  #quarto-content.page-columns {
    display: block !important;
    max-width: 760px !important;
    margin: 0 auto !important;
    padding: 0 1.5rem !important;
  }
  .site-sidebar {
    margin-top: 2.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--paper-line);
  }
}


/* ---- sidebar contents ---- */
.site-sidebar { font-size: 0.9rem; }
.site-sidebar .sidebar-block { margin-bottom: 1.8rem; }
.site-sidebar h4 {
  font-family: "Cormorant Garamond", serif;
  font-size: 1.05rem;
  color: var(--accent-deep);
  margin: 0 0 0.5rem;
}
.site-sidebar .friend-links ul { list-style: none; padding: 0; margin: 0; }
.site-sidebar .friend-links li { margin-bottom: 0.35rem; }
.site-sidebar .analytics-note {
  font-size: 0.8rem;
  color: var(--ink-soft);
  background: var(--card);
  border: 1px solid var(--paper-line);
  border-radius: 4px;
  padding: 0.6rem 0.8rem;
}
.site-sidebar .analytics-note span { display: block; margin-bottom: 0.3rem; font-weight: 600; color: var(--ink); }
.site-sidebar .analytics-note p { margin: 0; }
.site-sidebar .site-footer {
  font-size: 0.78rem;
  color: var(--ink-soft);
  border-top: 1px solid var(--paper-line);
  padding-top: 0.8rem;
  margin-top: 0;
}

/* ---- wordmark banner, every page ---- */
.wordmark-banner {
  width: 100%;
  height: 130px;
  background: var(--paper);
  border-bottom: 1px solid var(--paper-line);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  margin-bottom: var(--space-below-wordmark) !important;
}
.wordmark-banner-img {
  height: 100%;
  width: 100%;
  object-fit: contain;
  display: block;
}
@media (max-width: 600px) {
  .wordmark-banner { height: 84px; }
}

/* ---- hero / mission ---- */
.mission-statement {
  font-family: "Cormorant Garamond", serif;
  font-style: italic;
  font-size: 1.7rem;
  line-height: 1.4;
  color: var(--ink);
  max-width: 46rem;
  margin: 1.2rem 0 1.3rem;
}

/* ---- activity teaser cards ---- */
.activity-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.2rem;
  margin: 0.4rem 0 1.2rem;
}
@media (max-width: 700px) { .activity-grid { grid-template-columns: 1fr; } }

.activity-card {
  background: var(--card);
  border: 1px solid var(--paper-line);
  border-radius: 6px;
  padding: 1.3rem 1.4rem;
  position: relative;
  transition: border-color 0.15s ease;
}
.activity-card:hover { border-color: var(--accent-deep); }
.activity-card h3 {
  font-family: "Cormorant Garamond", serif;
  margin: 0 0 0.5rem;
}
.activity-card h3 a {
  color: var(--accent-deep);
  text-decoration: none;
}
/* stretched-link: makes the whole card clickable without wrapping
   block-level content in <a>, which trips up Pandoc's HTML parsing */
.activity-card h3 a::after {
  content: "";
  position: absolute;
  inset: 0;
}
.activity-card p {
  margin: 0;
  font-size: 0.95rem;
  color: var(--ink-soft);
}

/* ---- credential line ---- */
.credential-line {
  font-size: 0.95rem;
  color: var(--ink-soft);
  border-left: 3px solid var(--accent-deep);
  padding-left: 0.9rem;
  margin: 1.6rem 0;
}
.credential-line a { color: var(--accent-deep); }

/* ---- friend links ---- */
.friend-links ul { list-style: none; padding: 0; margin: 0; }
.friend-links li { margin-bottom: 0.4rem; }
.friend-links a { color: var(--teal); }

/* ---- footer / trade licence ---- */
.site-footer {
  margin-top: 3rem;
  padding-top: 1.2rem;
  border-top: 1px solid var(--paper-line);
  font-size: 0.85rem;
  color: var(--ink-soft);
}

/* ---- analytics note ---- */
.analytics-note {
  font-size: 0.85rem;
  color: var(--ink-soft);
  background: var(--card);
  border: 1px solid var(--paper-line);
  border-radius: 4px;
  padding: 0.7rem 0.9rem;
  margin: 1.2rem 0;
}

/* ---- activity × domain-expertise matrix ---- */
.matrix-wrap { overflow: visible; }
/* narrow screens: the table scrolls sideways, so open preview tooltips downwards for the top rows */
@media (max-width: 800px) {
  .matrix-wrap { overflow-x: auto; }
  .matrix-table tbody tr:nth-child(-n+2) .matrix-dot .tooltip-text { bottom: auto; top: 130%; }
}
.matrix-table {
  width: 100%;
  min-width: 720px;
  table-layout: fixed;
  border-collapse: collapse;
  margin: 1.6rem 0 1rem;
  font-size: 0.92rem;
}
.matrix-table th, .matrix-table td {
  border: 1px solid var(--paper-line);
  padding: 0.55rem 0.7rem;
  text-align: center;
}
.matrix-table th { background: var(--card); font-weight: 600; font-size: 0.8rem; line-height: 1.25; padding: 0.55rem 0.3rem; hyphens: manual; overflow-wrap: normal; }
.matrix-table th:first-child, .matrix-table td:first-child { width: 14%; }
.matrix-table td:first-child, .matrix-table th:first-child {
  text-align: left;
  font-weight: 600;
  background: var(--card);
}

.matrix-dot {
  font-size: 1.1rem;
  text-decoration: none;
  cursor: pointer;
}
.matrix-dot.filled {
  color: var(--accent-deep);
  font-weight: 700;
}
.matrix-dot.filled:hover {
  text-decoration: underline;
  color: var(--rule);
}
.matrix-dot { position: relative; }
.matrix-dot.open {
  color: var(--ink-soft);
}
.matrix-dot .tooltip-text {
  visibility: hidden;
  opacity: 0;
  position: absolute;
  bottom: 130%;
  left: 50%;
  transform: translateX(-50%);
  background: var(--ink);
  color: var(--paper);
  font-family: "Inter", sans-serif;
  font-size: 0.78rem;
  font-weight: 400;
  padding: 0.45rem 0.65rem;
  border-radius: 4px;
  white-space: normal;
  width: 15rem;
  text-align: left;
  transition: opacity 0.15s ease;
  z-index: 10;
}
.matrix-table td:nth-last-child(-n+2) .matrix-dot .tooltip-text { left: auto; right: 0; transform: none; }
.matrix-dot:hover .tooltip-text,
.matrix-dot:focus .tooltip-text,
.matrix-dot:focus-within .tooltip-text {
  visibility: visible;
  opacity: 1;
}
/* rich teaser tooltips (theme pages) */
.matrix-dot .tooltip-text strong {
  display: block;
  font-weight: 600;
  margin-bottom: 0.2rem;
}
.matrix-dot .tooltip-text em {
  display: block;
  font-style: normal;
  color: #e3c98f;
  margin-top: 0.35rem;
}
.matrix-legend {
  font-size: 0.85rem;
  color: var(--ink-soft);
  margin: 0.6rem 0 1.6rem;
}

/* ---- theme pages (one per matrix intersection) ---- */
.theme-back { margin: 0 0 0.4rem; font-size: 0.9rem; }
.theme-back a, .theme-others a, .theme-cta a { color: var(--teal); }
.theme-kicker {
  font-size: 0.8rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin: 0 0 0.2rem;
}
.theme-figure {
  background: var(--card);
  border: 1px solid var(--paper-line);
  border-radius: 6px;
  padding: 0.8rem;
  margin: 1.4rem 0;
}
.theme-figure img { display: block; width: 100%; height: auto; margin: 0 auto; }
.theme-figure a { cursor: zoom-in; }
.theme-figure figcaption {
  font-size: 0.85rem;
  color: var(--ink-soft);
  margin-top: 0.6rem;
}
.theme-cta { margin: 1.6rem 0; }
.theme-others {
  margin-top: 2.4rem;
  padding-top: 1rem;
  border-top: 1px solid var(--paper-line);
  font-size: 0.92rem;
}
.theme-others h4 {
  font-family: "Cormorant Garamond", serif;
  font-size: 1.05rem;
  color: var(--accent-deep);
  margin: 0 0 0.4rem;
}
.theme-others ul { list-style: none; padding: 0; margin: 0; }
.theme-others li { margin-bottom: 0.3rem; }

/* ---- v3 additions ---- */

/* matrix: plain-language sub-headings and image previews in tooltips */
.matrix-table th .col-sub {
  display: block;
  font-weight: 400;
  font-size: 0.7rem;
  color: var(--ink-soft);
  margin-top: 0.2rem;
}
.matrix-dot .tooltip-text .tip-thumb {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 3px;
  margin-bottom: 0.45rem;
}

/* home page: bio and book block */
.home-subline { font-size: 1.05rem; color: var(--ink-soft); max-width: 46rem; margin: 0 0 1.4rem; }
.home-bio {
  display: flex;
  gap: 1.4rem;
  align-items: flex-start;
  background: var(--card);
  border: 1px solid var(--paper-line);
  border-radius: 6px;
  padding: 1.2rem 1.4rem;
  margin: 0 0 1.6rem;
}
.home-bio p { margin: 0 0 0.6rem; }
.home-bio .home-links { margin: 0; font-size: 0.92rem; }
.home-bio a, .book-feature a { color: var(--teal); }
.headshot-slot {
  position: relative;
  width: 120px;
  height: 120px;
  flex: 0 0 auto;
  border-radius: 50%;
  border: 1px solid var(--paper-line);
  background: var(--card);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  font-family: 'Cormorant Garamond', serif;
  font-size: 2.2rem;
  color: var(--ink-soft);
}
.headshot-slot img.home-headshot {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.book-feature {
  display: flex;
  gap: 1.4rem;
  align-items: flex-start;
  margin: 1rem 0 1.6rem;
}
.book-feature h2, .book-feature h3 { margin: 0 0 0.2rem; font-family: "Cormorant Garamond", serif; }
.book-feature p { margin: 0 0 0.6rem; }
.book-cover {
  width: 150px;
  height: auto;
  flex: 0 0 auto;
  box-shadow: 0 2px 8px rgba(38, 36, 31, 0.25);
}
.book-sub { color: var(--ink-soft); font-style: italic; }
.book-isbn { font-size: 0.85rem; color: var(--ink-soft); }
@media (max-width: 600px) {
  .home-bio, .book-feature { flex-direction: column; }
}

/* work-with-me: option cards use the activity-card look, links inside the text */
.option-grid { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 800px) { .option-grid { grid-template-columns: 1fr; } }

/* the site title in the navbar duplicates the 'Dataphysics' menu item (same page): hide the larger brand */
.navbar-brand-container, .navbar .navbar-title { display: none !important; }
