/* offhand insights: blog index and articles.
   Loads after ../styles.css and reuses its tokens, header, footer and buttons.
   Same rules as the main site: one typeface, one accent, sentence case,
   hierarchy from size and weight, thin rules, no uppercase labels. */

/* ---------- Shared ---------- */

.crumb {
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
  min-height: 40px;
  padding: 0 16px 0 14px;
  border: 1px solid var(--rule);
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.9375rem;
  text-decoration: none;
  transition: border-color .2s ease, background-color .2s ease;
}
.crumb:hover { border-color: var(--ink); background: var(--paper-2); }
.crumb .arrow { transition: transform .25s var(--ease); }
.crumb:hover .arrow { transform: translateX(-3px); }

.meta-line {
  color: var(--muted);
  font-size: 1rem;
  letter-spacing: -0.005em;
}

/* ---------- Blog index ---------- */

.ins-intro {
  padding-top: clamp(48px, 7vw, 112px);
  padding-bottom: clamp(40px, 5vw, 72px);
}
.ins-intro__title {
  font-weight: 800;
  font-variation-settings: "opsz" 96;
  font-size: clamp(3.75rem, 11vw, 10rem);
  line-height: 0.86;
  letter-spacing: -0.055em;
  margin-left: -0.04em;
}
.ins-intro__lede {
  margin-top: clamp(28px, 3.5vw, 44px);
  padding-top: 24px;
  border-top: 1px solid var(--ink);
  font-weight: 600;
  font-variation-settings: "opsz" 48;
  font-size: clamp(1.375rem, 1.4vw + 0.9rem, 2.125rem);
  line-height: 1.14;
  letter-spacing: -0.03em;
  max-width: 30ch;
  text-wrap: balance;
}

.cards {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(48px, 5vw, 72px) clamp(28px, 3vw, 44px);
  padding-bottom: var(--space);
}
.card { min-width: 0; }
.card__link {
  display: block;
  text-decoration: none;
  color: inherit;
}
.card__img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 1200 / 630;
  border-radius: 18px;
  border: 1px solid var(--rule);
  background: var(--paper-2);
  transition: transform .45s var(--ease), border-color .25s ease;
}
.card__link:hover .card__img { transform: translateY(-4px); border-color: var(--ink); }
.card__title {
  margin-top: 22px;
  font-weight: 700;
  font-variation-settings: "opsz" 60;
  font-size: clamp(1.5rem, 1.1vw + 1.05rem, 2.125rem);
  line-height: 1.06;
  letter-spacing: -0.035em;
  text-wrap: balance;
}
.card__title span {
  background-image: linear-gradient(var(--accent), var(--accent));
  background-repeat: no-repeat;
  background-position: 0 100%;
  background-size: 0 2px;
  transition: background-size .3s var(--ease);
}
.card__link:hover .card__title span { background-size: 100% 2px; }
.card__text { margin-top: 12px; color: var(--ink-2); max-width: 46ch; }
.card .meta-line { margin-top: 12px; }

.card--lead { grid-column: 1 / -1; }
.card--lead .card__link {
  display: grid;
  grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
  gap: 24px 48px;
  align-items: center;
}
.card--lead .card__title {
  margin-top: 0;
  font-size: clamp(2rem, 2.6vw + 1rem, 3.5rem);
  line-height: 1;
  letter-spacing: -0.045em;
}
.card--lead .card__text { font-size: clamp(1.0625rem, .4vw + .95rem, 1.25rem); }
.card--flip .card__link { grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); }
.card--flip .card__img { order: 2; }

/* ---------- Article ---------- */

.post-head {
  display: grid;
  grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
  gap: 32px 56px;
  align-items: end;
  padding-top: clamp(32px, 5vw, 80px);
  padding-bottom: clamp(36px, 4.5vw, 64px);
}
.post-head__text { min-width: 0; }
.post-head__img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 1200 / 630;
  border-radius: 18px;
  border: 1px solid var(--rule);
  background: var(--paper-2);
}
.post-title {
  margin-top: clamp(24px, 3vw, 40px);
  font-weight: 800;
  font-variation-settings: "opsz" 96;
  font-size: clamp(2.5rem, 5.4vw, 5.5rem);
  line-height: 0.94;
  letter-spacing: -0.05em;
  margin-left: -0.03em;
  max-width: 17ch;
  text-wrap: balance;
}
.post-lede {
  margin-top: clamp(24px, 3vw, 36px);
  font-weight: 600;
  font-variation-settings: "opsz" 40;
  font-size: clamp(1.25rem, 0.9vw + 1rem, 1.75rem);
  line-height: 1.25;
  letter-spacing: -0.02em;
  max-width: 40ch;
  color: var(--ink-2);
  text-wrap: pretty;
}
.post-head .meta-line { margin-top: 20px; }

.post-grid {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 3fr) minmax(0, 9fr);
  gap: 32px 56px;
  padding-top: 40px;
  padding-bottom: clamp(56px, 7vw, 96px);
}
.post-grid::before {
  content: "";
  position: absolute;
  top: 0;
  left: var(--gutter);
  right: var(--gutter);
  border-top: 1px solid var(--rule);
}

/* On this page */
.toc {
  position: sticky;
  top: calc(var(--top-h) + 20px);
  align-self: start;
  max-height: calc(100vh - var(--top-h) - 40px);
  overflow: auto;
  padding-bottom: 8px;
}
.toc summary {
  list-style: none;
  cursor: default;
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: -0.01em;
  padding-bottom: 12px;
}
.toc summary::-webkit-details-marker { display: none; }
.toc ol { border-top: 1px solid var(--rule); }
.toc li { border-bottom: 1px solid var(--rule); }
.toc a {
  display: block;
  padding: 9px 0;
  font-size: 0.9375rem;
  line-height: 1.3;
  color: var(--muted);
  text-decoration: none;
  transition: color .2s ease;
}
.toc a:hover,
.toc a[aria-current="true"] { color: var(--ink); }
.toc a[aria-current="true"] { box-shadow: inset 2px 0 0 var(--accent); padding-left: 12px; }

/* Article text */
.prose { min-width: 0; max-width: 46rem; }
.prose > * + * { margin-top: 1.15em; }
.prose p,
.prose li {
  font-size: clamp(1.0625rem, 0.35vw + 0.98rem, 1.1875rem);
  line-height: 1.62;
  color: var(--ink);
}
.prose h2 {
  margin-top: clamp(2.4em, 5vw, 3.2em);
  font-weight: 700;
  font-variation-settings: "opsz" 60;
  font-size: clamp(1.625rem, 1.3vw + 1.1rem, 2.375rem);
  line-height: 1.08;
  letter-spacing: -0.035em;
  text-wrap: balance;
  scroll-margin-top: calc(var(--top-h) + 20px);
}
.prose h2:first-child { margin-top: 0; }
.prose h3 {
  margin-top: 1.9em;
  font-weight: 700;
  font-variation-settings: "opsz" 36;
  font-size: clamp(1.1875rem, 0.5vw + 1.05rem, 1.4375rem);
  line-height: 1.2;
  letter-spacing: -0.02em;
  scroll-margin-top: calc(var(--top-h) + 20px);
}
.prose h2 + *,
.prose h3 + * { margin-top: 0.7em; }
.prose strong { font-weight: 700; }
.prose em { font-style: italic; }
.prose a {
  text-decoration: underline;
  text-decoration-thickness: 1.5px;
  text-underline-offset: 4px;
  text-decoration-color: var(--muted);
  transition: text-decoration-color .2s ease;
}
.prose a:hover { text-decoration-color: var(--accent); }
.prose a.btn { text-decoration: none; }
.prose .fig a { text-decoration: none; }

.prose ul,
.prose ol { padding-left: 1.3em; }
.prose ul { list-style: disc; }
.prose ol { list-style: decimal; }
.prose li + li { margin-top: 0.45em; }
.prose li::marker { color: var(--accent); font-weight: 700; }

.prose blockquote {
  border-left: 2px solid var(--accent);
  padding: 2px 0 2px 22px;
}
.prose blockquote p {
  font-weight: 600;
  font-size: clamp(1.25rem, 0.7vw + 1.05rem, 1.625rem);
  line-height: 1.3;
  letter-spacing: -0.02em;
}

.prose code {
  font-family: inherit;
  font-weight: 600;
  background: var(--paper-2);
  border-radius: 6px;
  padding: 0.05em 0.35em;
}

/* Figures */
.fig {
  margin-top: 2em;
  margin-bottom: 0.4em;
}
.fig a { display: block; }
.fig img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 16px;
  border: 1px solid var(--rule);
  background: var(--paper-2);
}
.fig--ad { max-width: 440px; }
.fig--pair {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

/* The short version */
.short {
  background: var(--paper-2);
  border-radius: 20px;
  padding: clamp(22px, 2.6vw, 32px) clamp(22px, 2.8vw, 36px);
}
.prose .short h2 {
  margin-top: 0;
  font-size: clamp(1.25rem, 0.6vw + 1.05rem, 1.5rem);
  letter-spacing: -0.025em;
}
.short ul { margin-top: 0.8em; }

/* Tables */
.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-top: 2px solid var(--ink);
}
.prose table {
  width: 100%;
  border-collapse: collapse;
  font-size: 1rem;
  line-height: 1.4;
}
.prose th,
.prose td {
  text-align: left;
  vertical-align: top;
  padding: 12px 16px 12px 0;
  border-bottom: 1px solid var(--rule);
}
.prose th { font-weight: 700; white-space: nowrap; }
.prose td:last-child,
.prose th:last-child { padding-right: 0; }

/* Formula lines (metric definitions) */
.formula {
  background: var(--paper-2);
  border-radius: 14px;
  padding: 14px 20px;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.formulas {
  background: var(--paper-2);
  border-radius: 16px;
  padding: 6px 22px;
}
.prose .formulas p {
  padding: 13px 0;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.4;
}
.prose .formulas p + p { margin-top: 0; border-top: 1px solid var(--rule); }

/* Checklist (audit) */
.check-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 24px;
  align-items: center;
}
.checklist { list-style: none; padding: 0; border-top: 1px solid var(--rule); }
.prose .checklist { padding-left: 0; list-style: none; }
.checklist li { border-bottom: 1px solid var(--rule); margin: 0; }
.prose .checklist li + li { margin-top: 0; }
.checklist label {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  gap: 14px;
  padding: 16px 0;
  cursor: pointer;
}
.checklist input {
  appearance: none;
  -webkit-appearance: none;
  width: 24px;
  height: 24px;
  margin: 3px 0 0;
  border: 1.5px solid var(--ink);
  border-radius: 6px;
  background: var(--paper);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: background-color .15s ease, border-color .15s ease;
}
.checklist input::after {
  content: "";
  width: 11px;
  height: 6px;
  border-left: 2.5px solid var(--paper);
  border-bottom: 2.5px solid var(--paper);
  transform: translateY(-1px) rotate(-45deg);
  opacity: 0;
}
.checklist input:checked { background: var(--ink); }
.checklist input:checked::after { opacity: 1; }
.checklist input:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.checklist .ck-text { display: block; }
.checklist .ck-text strong { display: block; font-weight: 700; letter-spacing: -0.01em; }
.checklist .ck-text span { display: block; margin-top: 4px; color: var(--ink-2); }
.checklist input:checked + .ck-text strong { text-decoration: line-through; text-decoration-color: var(--accent); text-decoration-thickness: 2px; }

/* End-of-article review CTA */
.post-cta {
  margin-top: clamp(56px, 7vw, 88px);
  background: var(--ink);
  color: var(--paper);
  border-radius: 22px;
  padding: clamp(28px, 4vw, 52px);
}
.post-cta :focus-visible { outline-color: var(--accent-bright); }
.prose .post-cta h2 {
  margin-top: 0;
  color: var(--paper);
  font-size: clamp(1.875rem, 2.4vw + 1rem, 3rem);
  line-height: 1;
  letter-spacing: -0.045em;
  max-width: 16ch;
}
.prose .post-cta p { color: var(--muted-dark); max-width: 40ch; }
.post-cta .cta { margin-top: 28px; }

/* Keep reading */
.related {
  position: relative;
  padding-top: 36px;
  padding-bottom: var(--space);
}
.related::before {
  content: "";
  position: absolute;
  top: 0;
  left: var(--gutter);
  right: var(--gutter);
  border-top: 1px solid var(--rule);
}
.related__head { margin-bottom: clamp(28px, 3.5vw, 48px); }
.related .cards { grid-template-columns: repeat(3, minmax(0, 1fr)); padding-bottom: 0; }
.related .card__title { font-size: clamp(1.25rem, 0.8vw + 1rem, 1.625rem); }

/* ---------- Responsive ---------- */

@media (max-width: 1080px) {
  .related .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .related .card:nth-child(3) { display: none; }
}

@media (max-width: 900px) {
  .post-head { grid-template-columns: minmax(0, 1fr); }
  .post-head__img { max-width: 620px; }
  .post-grid { grid-template-columns: minmax(0, 1fr); gap: 24px; padding-top: 28px; }
  .toc {
    position: static;
    max-height: none;
    overflow: visible;
    background: var(--paper-2);
    border-radius: 16px;
    padding: 0 18px;
  }
  .toc summary {
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 52px;
    padding: 0;
  }
  .toc summary::after {
    content: "";
    width: 9px;
    height: 9px;
    border-right: 2px solid var(--ink);
    border-bottom: 2px solid var(--ink);
    transform: translateY(-3px) rotate(45deg);
    transition: transform .25s var(--ease);
  }
  .toc[open] summary::after { transform: translateY(2px) rotate(-135deg); }
  .toc ol { margin-bottom: 14px; }
  .toc a[aria-current="true"] { box-shadow: none; padding-left: 0; }
  .card--lead .card__link,
  .card--flip .card__link { grid-template-columns: minmax(0, 1fr); }
  .card--flip .card__img { order: 0; }
}

@media (max-width: 600px) {
  .cards { grid-template-columns: minmax(0, 1fr); }
  .related .cards { grid-template-columns: minmax(0, 1fr); }
  .related .card:nth-child(3) { display: block; }
  .fig--pair { grid-template-columns: minmax(0, 1fr); }
  .fig--ad { max-width: none; }
  .fig img { border-radius: 12px; }
  .post-cta .cta .btn { width: 100%; }
  .prose th, .prose td { padding-right: 12px; }
}

/* ---------- Print (the audit checklist prints cleanly) ---------- */

@page { margin: 14mm; }

@media print {
  .top, .foot, .toc, .related, .post-cta, .skip, .crumb, .check-tools .btn, .no-print,
  .post-head__img, .fig { display: none !important; }
  .post-head { display: block; }
  .js body { padding-top: 0; }
  body { background: #fff; font-size: 11pt; }
  .post-head { padding: 0 0 12pt; }
  .post-title { font-size: 28pt; max-width: none; }
  .post-lede { font-size: 13pt; }
  .post-grid { display: block; padding: 0; }
  .post-grid::before { display: none; }
  .prose { max-width: none; }
  .prose h2 { break-after: avoid; margin-top: 18pt; font-size: 16pt; }
  .prose p, .prose li { font-size: 10pt; line-height: 1.4; }
  .prose > * + * { margin-top: 0.8em; }
  .checklist label { padding: 6pt 0; gap: 8pt; grid-template-columns: 16pt minmax(0, 1fr); }
  .checklist input { width: 13pt; height: 13pt; border-radius: 3pt; margin-top: 1pt; }
  .checklist .ck-text span { margin-top: 1pt; }
  .short { padding: 10pt 14pt; }
  .checklist li { break-inside: avoid; }
  .checklist input { border-color: #121211; }
  .fig { break-inside: avoid; }
  a { text-decoration: none !important; }
}
