/* Insights: /insights/, the four section pages, book notes (/insights/books/<slug>/) and
   memos (/insights/memos/<slug>/). Cards, grids, heroes and prose come from styles.css.
   Prefixes: ins- index and section pages, nt- book note, memo- memo. */

/* ---------- /insights/ ---------- */
.ins-section {
  padding: clamp(56px, 8vw, 96px) 0;
}
.ins-section .section-head {
  margin-bottom: clamp(28px, 4vw, 40px);
}
.ins-section .section-head .lead {
  margin: 0;
}
.ins-section .section-head > .link-arrow {
  white-space: nowrap;
}
.ins-follow .newsletter p {
  flex: 1 1 380px;
  max-width: 720px;
}
.ins-follow .newsletter small a {
  color: inherit;
}

/* ---------- Section pages ---------- */
.ins-list {
  padding-top: clamp(40px, 6vw, 64px);
}
/* Threads on X: compact cards (no art block) after the essays and notes */
.ins-threads {
  margin-top: clamp(40px, 6vw, 56px);
}
.ins-threads:first-child {
  margin-top: 0;
}
.ins-group-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font: 600 0.75rem/1.4 var(--font-sans);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 16px;
}
.ins-group-title svg {
  width: 14px;
  height: 14px;
  fill: currentColor;
}
.ins-others {
  margin-top: clamp(48px, 7vw, 72px);
  padding-top: 28px;
  border-top: 1px solid var(--line);
}
.ins-others-title {
  font: 600 0.75rem/1.4 var(--font-sans);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 14px;
}
.ins-others ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 12px;
}
.ins-others .link-arrow {
  margin-left: 8px;
  font-size: 0.92rem;
}

/* ---------- Book note ---------- */
.nt-hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 200px;
  gap: clamp(28px, 5vw, 64px);
  align-items: end;
}
.nt-hero h1 {
  font-size: clamp(2.2rem, 4.6vw, 3.4rem);
  margin-bottom: 0.3em;
}
/* "Title · by Author": a .sep-run (styles.css), so a wrapped "by Author" has no "·" in front */
.nt-source-line {
  row-gap: 2px;
  margin-top: 0;
  margin-right: 0;
  margin-bottom: 18px;
  font: 400 1.15rem/1.4 var(--font-serif);
}
.nt-source-line:empty {
  display: none;
}
.nt-source-line cite {
  color: var(--heading);
}
.nt-source-line .nt-by {
  color: var(--muted);
}
.nt-byline {
  margin: 16px 0 0;
}

/* A plain book cover drawn from the note's own data (partials/insight-card.njk bookCover; decorative):
   the short title, then the author and our small mark on one row (the mark in the cover's text colour,
   like the reversed logo). Sizes are in em, so the hero cover and the small one on a Books card only
   set font-size. The brand colours stay the same in both themes. */
.book-cover {
  --cover-bg: var(--banyan);
  --cover-ink: var(--ivory);
  --cover-muted: rgba(250, 246, 239, 0.8);
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 0.8em;
  aspect-ratio: 2 / 3;
  padding: 1.5em 1.1em 1.3em 1.9em;
  border-radius: 0.3em 0.8em 0.8em 0.3em;
  background: var(--cover-bg);
  color: var(--cover-ink);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.07), var(--shadow-lg);
  overflow: hidden;
}
/* The spine's crease */
.book-cover::before {
  content: "";
  position: absolute;
  left: 0.75em;
  top: 0;
  bottom: 0;
  width: 2px;
  background: rgba(0, 0, 0, 0.18);
}
.book-cover-title {
  font: 500 1.5em/1.18 var(--font-serif);
}
.book-cover-foot {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 0.6em;
}
.book-cover-by {
  min-width: 0;
  line-height: 1.3;
  color: var(--cover-muted);
}
.book-cover-mark {
  flex: none;
  width: 2em;
  height: 2em;
  fill: currentColor;
}
.book-cover-terracotta {
  --cover-bg: var(--terracotta-deep);
}
.book-cover-marigold {
  --cover-bg: var(--marigold);
  --cover-ink: var(--ink);
  --cover-muted: rgba(42, 38, 34, 0.78);
}
.book-cover-ink {
  --cover-bg: var(--ink);
}
/* In the note hero */
.nt-cover {
  font-size: 0.8rem;
}
/* On a Books card: the cover stands in the card's 16:9 media block (16:9 on phones too, where
   other covers are 2:1, so the book keeps room for its title) and scales with the card */
.insight-card-book {
  container-type: inline-size;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: var(--bg-alt);
}
.insight-card-book .book-cover {
  width: 30%;
  font-size: 0.56rem;
  font-size: 2.6cqi;
}

.nt-section {
  padding-top: clamp(40px, 6vw, 72px);
}
.nt-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: clamp(32px, 5vw, 64px);
  align-items: start;
}
.nt-main {
  max-width: 740px;
  min-width: 0;
}
.nt-main h2 {
  font-size: clamp(1.45rem, 2.4vw, 1.75rem);
}
.nt-takeaways {
  margin-bottom: 44px;
  padding: clamp(22px, 3vw, 32px);
  background: var(--surface);
  border: 1px solid var(--line);
  border-top: 3px solid var(--accent);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.nt-takeaways ol {
  list-style: none;
  counter-reset: take;
  margin: 18px 0 0;
  padding: 0;
}
.nt-takeaways li {
  counter-increment: take;
  position: relative;
  padding: 14px 0 14px 46px;
  border-top: 1px solid var(--line);
  font-size: 1.04rem;
  line-height: 1.55;
}
.nt-takeaways li::before {
  content: counter(take);
  position: absolute;
  left: 0;
  top: 12px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--bg-alt);
  color: var(--accent-text);
  display: grid;
  place-items: center;
  font: 500 0.88rem/1 var(--font-serif);
}
.nt-prose {
  margin-bottom: 44px;
}
.nt-prose > :first-child {
  margin-top: 0;
}
.nt-why {
  padding: clamp(24px, 3.5vw, 36px);
  border-radius: var(--radius);
  background: var(--panel);
  color: var(--on-panel);
}
.nt-why h2 {
  color: var(--on-panel);
  margin-bottom: 10px;
}
.nt-why p {
  margin: 0;
  color: var(--on-panel-muted);
  font-size: 1.04rem;
  line-height: 1.7;
}
.nt-further {
  margin-top: 40px;
}
.nt-further h2 {
  font-size: 1.3rem;
}
.nt-further ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 10px;
}
.nt-further .link-arrow {
  display: inline;
}
.nt-further .link-arrow::after {
  margin-left: 6px;
}
.nt-disclaimer {
  margin: 40px 0 0;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  font-size: 0.84rem;
  line-height: 1.6;
  color: var(--muted);
}

.nt-aside {
  position: sticky;
  top: calc(var(--header-h) + 24px);
  display: grid;
  gap: 16px;
  min-width: 0;
}
.nt-box {
  padding: 20px 22px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.nt-box p {
  margin: 0;
}
.nt-box-label {
  margin: 0 0 10px !important;
  font: 600 0.75rem/1.4 var(--font-sans);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}
.nt-source-detail {
  font-size: 0.92rem;
  color: var(--muted);
}
.nt-source-box .btn {
  margin-top: 16px;
}
.nt-share-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.nt-share [hidden] {
  display: none;
}
.nt-share-icons {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}
.icon-link {
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--line);
  color: var(--heading);
  transition: border-color 0.2s, background-color 0.2s;
}
.icon-link:hover {
  border-color: var(--heading);
  background: var(--bg-alt);
  color: var(--heading);
}
.icon-link svg {
  width: 16px;
  height: 16px;
  fill: currentColor;
}
.nt-related .section-head h2 {
  margin: 0;
}

/* ---------- Memo ---------- */
.memo-measure {
  max-width: calc(700px + 2 * var(--gutter));
}
.memo-hero h1 {
  font-size: clamp(2.3rem, 5vw, 3.4rem);
  margin-bottom: 0.4em;
}
.memo-byline {
  margin: 0;
  color: var(--muted);
}
.memo-body {
  padding-top: clamp(40px, 6vw, 64px);
}
.memo-body .prose h2 {
  font-size: clamp(1.45rem, 2.6vw, 1.75rem);
}
.memo-body .prose > :first-child {
  margin-top: 0;
}
.memo-body .prose blockquote p {
  margin: 0;
}
.memo-foot {
  margin-top: clamp(40px, 6vw, 56px);
  padding-top: 24px;
  border-top: 1px solid var(--line);
  color: var(--muted);
}
.memo-foot p {
  margin: 0 0 10px;
}
.memo-foot p:last-child {
  margin: 0;
}

/* ---------- Responsive ---------- */
@media (max-width: 1000px) {
  .nt-layout {
    grid-template-columns: 1fr;
  }
  .nt-main {
    max-width: none;
  }
  .nt-aside {
    position: static;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .nt-hero-grid {
    grid-template-columns: minmax(0, 1fr) 160px;
  }
  .nt-cover {
    font-size: 0.68rem;
  }
  /* Title above author (each line's separator is clipped) */
  .nt-source-line {
    flex-direction: column;
  }
}

/* Tablets: grid-3 has two columns, so a three-card teaser row (the hub, More from Books) shows two */
@media (min-width: 681px) and (max-width: 1000px) {
  .ins-section .card-list > li:nth-child(3),
  .nt-related .card-list > li:nth-child(3) {
    display: none;
  }
}

@media (max-width: 680px) {
  /* The title sits right below as the h1, so a long current-page crumb would only add a wrapped
     line: keep it for screen readers only (its separator goes with it) */
  .nt-hero .breadcrumbs li:last-child,
  .memo-hero .breadcrumbs li:last-child {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }
  .ins-section .section-head.split {
    gap: 12px;
  }
  .ins-others .link-arrow {
    margin-left: 0;
    flex-basis: 100%;
  }
  .nt-hero-grid {
    grid-template-columns: 1fr;
  }
  .nt-cover {
    display: none;
  }
  .nt-aside {
    grid-template-columns: 1fr;
  }
  .nt-takeaways li {
    padding-left: 40px;
  }
  .insight-card-media.insight-card-book {
    aspect-ratio: 16 / 9;
  }
}

@media print {
  .nt-share,
  .nt-related,
  .ins-follow,
  .ins-others {
    display: none !important;
  }
  .nt-layout {
    grid-template-columns: 1fr;
  }
}
