/* Final Thesis-only polish; load after thesis-composition.css.
   Hero compositions, measured header and footer safe-area reservation stay intact. */

/* Intrinsic summary height; a deliberate 24px transition into the body. */
body[data-view='thesis'] .thesis-dive summary {
  align-items: start;
  padding-block: 20px 12px;
}
body[data-view='thesis'] .thesis-dive-toggle {
  align-self: center;
}
body[data-view='thesis'] .thesis-dive-topic {
  margin-bottom: 8px;
  font-weight: 400;
}
body[data-view='thesis'] .thesis-dive-stat small {
  font-weight: 400;
}
body[data-view='thesis'] .thesis-dive-body {
  padding-top: 12px;
}
body[data-view='thesis'] .thesis-dive-standfirst {
  margin-bottom: 24px;
  line-height: 1.55;
}
body[data-view='thesis'] .thesis-dive-analysis p {
  line-height: 1.6;
}

/* Keep keyboard focus on the small toggle, not the multiline title or
   full-width summary. Native details interaction is unchanged. */
body[data-view='thesis'] .thesis-dive summary:focus {
  outline: none;
}
body[data-view='thesis'] .thesis-dive summary:focus-visible .thesis-dive-toggle {
  outline: 2px solid #e7bd7c;
  outline-offset: 4px;
}

/* Match the 1180px inner section alignment without changing generated copy
   or introducing a wrapper. The full-width background and rule remain. */
body[data-view='thesis'] .thesis-continuation {
  padding-block: 32px;
  padding-inline: max(var(--edge), calc((100% - 1180px) / 2));
}
body[data-view='thesis'] .thesis-continuation p {
  margin-bottom: 20px;
  line-height: 1.6;
}
body[data-view='thesis'] .thesis-continuation a {
  min-height: 44px;
  gap: 10px;
}
body[data-view='thesis'] .thesis-next-title {
  font-size: clamp(28px, 3vw, 38px);
  line-height: 1.16;
  letter-spacing: -.025em;
}
body[data-view='thesis'] .thesis-continuation a:focus-visible {
  outline: none;
}
body[data-view='thesis'] .thesis-continuation a:focus-visible .thesis-next-title {
  text-decoration: underline;
  text-decoration-color: #e7bd7c;
  text-decoration-thickness: 2px;
  text-underline-offset: 6px;
}

/* 44px controls plus the existing device safe area. Use an inset rule rather
   than a border that would consume one pixel of the control row. */
body[data-view='thesis'] .thesis-rail {
  border-top: 0;
  box-shadow: inset 0 1px #ffffff20;
  padding-inline: max(var(--edge), calc((100% - 1180px) / 2));
}
body[data-view='thesis'] .thesis-chapters {
  justify-content: flex-start;
  overscroll-behavior-x: contain;
}
body[data-view='thesis'] .thesis-rail a {
  font-size: 12px;
  font-weight: 400;
  line-height: 1.25;
  letter-spacing: 0;
  padding-inline: 4px;
}
body[data-view='thesis'] .thesis-rail a[aria-current] {
  text-decoration-thickness: 2px;
  text-underline-offset: 5px;
}

@media (max-width: 600px) {
  body[data-view='thesis'] .thesis-rail {
    padding-inline: max(8px, env(safe-area-inset-left, 0px)) max(8px, env(safe-area-inset-right, 0px));
    gap: 8px;
  }
  body[data-view='thesis'] .thesis-chapters {
    gap: 8px;
  }
  body[data-view='thesis'] .thesis-depths {
    gap: 0;
    flex-shrink: 0;
    box-shadow: inset 1px 0 #ffffff26;
  }
  body[data-view='thesis'] .thesis-depths a {
    padding-inline: 6px;
  }
}

@media (forced-colors: active) {
  body[data-view='thesis'] .thesis-continuation a:focus-visible .thesis-next-title {
    text-decoration-color: Highlight;
  }
  body[data-view='thesis'] .thesis-dive summary:focus-visible .thesis-dive-toggle {
    outline-color: Highlight;
  }
}

/* Compact section boundaries; retain intrinsic content and paragraph rhythm. */
body[data-view='thesis'] .thesis-process {
  padding-block: 24px;
}
body[data-view='thesis'] :is(.thesis-data, .thesis-dives, .thesis-continuation) {
  padding-block: 24px;
}
body[data-view='thesis'] .thesis-dive-body {
  padding-bottom: 24px;
}
body[data-view='thesis'] .thesis-dives-inner > .thesis-dive:last-child > .thesis-dive-body {
  padding-bottom: 0;
}
@media (max-width: 600px) {
  body[data-view='thesis'] :is(.thesis-process, .thesis-data, .thesis-dives, .thesis-continuation) {
    padding-block: 20px;
  }
  body[data-view='thesis'] .thesis-dive-body {
    padding-bottom: 20px;
  }
}

/* Small cool accents, not a new visual system. */
body[data-view='thesis'] {
  --thesis-accent: #65cfc5;
}
body[data-view='thesis'] .thesis-metric,
body[data-view='thesis'] .thesis-dive-stat > span {
  color: var(--thesis-accent);
}
body[data-view='thesis'] .thesis-rail a[aria-current] {
  color: var(--thesis-accent);
  text-decoration-color: currentColor;
}
body[data-view='thesis'] .thesis-rail::before {
  background: var(--thesis-accent);
}
body[data-view='thesis'] .thesis-process-step::before {
  border-color: var(--thesis-accent);
}
body[data-view='thesis'] .thesis-dive-sequence li::before {
  background: var(--thesis-accent);
}

@media (forced-colors: active) {
  body[data-view='thesis'] {
    --thesis-accent: CanvasText;
  }
  body[data-view='thesis'] .thesis-rail a[aria-current] {
    color: LinkText;
  }
  body[data-view='thesis'] .thesis-rail::before,
  body[data-view='thesis'] .thesis-dive-sequence li::before,
  body[data-view='thesis'] .thesis-dive-bar-track span {
    background: Highlight;
    forced-color-adjust: none;
  }
  body[data-view='thesis'] .thesis-chart :is(rect, circle) {
    fill: CanvasText;
  }
  body[data-view='thesis'] .thesis-chart path {
    stroke: CanvasText !important;
  }
  body[data-view='thesis'] .thesis-chart path:not([fill='none']) {
    fill: CanvasText;
  }
  body[data-view='thesis'] .thesis-chart text {
    fill: CanvasText;
  }
}

/* Chapter-local contents stays in article flow after the hero.
   Measured padding protects jump targets when labels wrap or text enlarges. */
body[data-view='thesis'] #main .thesis-scroll {
  scroll-padding-top: var(--contents-offset, 60px);
}
body[data-view='thesis'] #main .thesis-contents {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0 20px;
  padding: 4px var(--editorial-gutter);
  background: #080a0c;
  border-block: 1px solid #ffffff20;
}
body[data-view='thesis'] #main .thesis-contents :is(a, button) {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  min-width: 44px;
  max-width: 100%;
  margin: 0;
  padding: 4px 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #c9ccce;
  font: 400 13px/1.4 'Inter Tight', Arial, sans-serif;
  text-decoration: none;
  overflow-wrap: anywhere;
  cursor: pointer;
}
body[data-view='thesis'] #main .thesis-contents :is([aria-current], a:hover, button:hover) {
  color: var(--thesis-accent);
  text-decoration: underline;
  text-underline-offset: 6px;
}
body[data-view='thesis'] #main .thesis-contents :focus-visible {
  outline: 2px solid var(--thesis-accent);
  outline-offset: 2px;
}
html[data-theme='light'] body[data-view='thesis'] #main .thesis-contents {
  background: #fff;
  border-color: var(--line);
}
html[data-theme='light'] body[data-view='thesis'] #main .thesis-contents :is(a, button) {
  color: var(--text);
}
html[data-theme='light'] body[data-view='thesis'] #main .thesis-contents :is([aria-current], a:hover, button:hover) {
  color: var(--thesis-accent);
}
@media (forced-colors: active) {
  body[data-view='thesis'] #main .thesis-contents {
    background: Canvas;
    border-color: CanvasText;
  }
  body[data-view='thesis'] #main .thesis-contents :is(a, button) {
    color: LinkText;
  }
}
/* Final editorial measure pass.
   #main specificity beats the supplied composition selectors.
   Existing compact section boundaries remain intact. */
body[data-view='thesis'] #main .thesis-shell {
  --editorial-gutter: max(var(--edge), calc((100vw - 1180px) / 2));
  --editorial-measure: 720px;
  --editorial-title: clamp(38px, 3.35vw, 48px);
  --editorial-body: 18px;
}
body[data-view='thesis'] #main .thesis-hero.thesis-scene .thesis-hero-editorial {
  width: calc(100% - 2 * var(--editorial-gutter));
  max-width: 1180px;
  min-width: 0;
  margin-inline: auto;
}
body[data-view='thesis'] #main .thesis-hero.thesis-scene .thesis-heading {
  width: 100%;
  max-width: var(--editorial-measure);
  margin: 0;
  font-size: var(--editorial-title);
  font-weight: 300;
  line-height: 1.12;
  letter-spacing: -.032em;
  white-space: normal;
  word-break: normal;
  overflow-wrap: anywhere;
  hyphens: none;
  text-wrap: balance;
}
body[data-view='thesis'] #main .thesis-hero.thesis-scene .thesis-hero-editorial .thesis-paragraphs {
  width: 100%;
  max-width: var(--editorial-measure);
  margin-top: 18px;
  gap: 14px;
  font-size: var(--editorial-body);
  font-weight: 300;
  line-height: 1.6;
  overflow-wrap: anywhere;
  text-wrap: pretty;
}
/* Keep full-bleed backgrounds and the approved image/nav overlap. */
body[data-view='thesis'] #main .thesis-hero.thesis-scene :is(.thesis-process-nav, .thesis-hero-discovery) {
  padding-inline: var(--editorial-gutter);
  min-width: 0;
}
body[data-view='thesis'] #main .thesis-hero-discovery {
  column-gap: 24px;
  row-gap: 0;
}
body[data-view='thesis'] #main .thesis-process-labels button {
  min-width: 44px;
  min-height: 44px;
  padding-inline: 0 8px;
  font-size: 12px;
  line-height: 1.45;
  letter-spacing: 0;
}
body[data-view='thesis'] #main .thesis-process-labels button span:last-child {
  min-width: 0;
  overflow-wrap: anywhere;
}
body[data-view='thesis'] #main :is(.thesis-scroll-invitation, .thesis-dive-links button) {
  min-height: 44px;
  max-width: 100%;
  overflow-wrap: anywhere;
}
/* Shared downstream frame; block padding deliberately not reset. */
body[data-view='thesis'] #main :is(.thesis-process, .thesis-data, .thesis-dives, .thesis-continuation) {
  padding-inline: var(--editorial-gutter);
}
body[data-view='thesis'] #main .thesis-editorial {
  max-width: var(--editorial-measure);
}
body[data-view='thesis'] #main :is(.thesis-section-heading, .thesis-dive-title, .thesis-next-title) {
  max-width: 720px;
  font-size: clamp(28px, 2.5vw, 36px);
  font-weight: 300;
  line-height: 1.18;
  letter-spacing: -.025em;
  white-space: normal;
  overflow-wrap: anywhere;
  text-wrap: balance;
}
body[data-view='thesis'] #main .thesis-editorial .thesis-paragraphs {
  max-width: var(--editorial-measure);
  margin-top: 18px;
  gap: 14px;
  font-size: var(--editorial-body);
  font-weight: 300;
  line-height: 1.6;
  overflow-wrap: anywhere;
}
body[data-view='thesis'] #main :is(.thesis-process-note, .thesis-dive-standfirst, .thesis-dive-watch, .thesis-continuation p) {
  max-width: 720px;
  text-wrap: pretty;
  overflow-wrap: anywhere;
}
body[data-view='thesis'] #main .thesis-dive-standfirst {
  font-size: var(--editorial-body);
  font-weight: 300;
  line-height: 1.6;
}
body[data-view='thesis'] #main .thesis-dive-analysis p {
  max-width: 62ch;
  font-weight: 300;
  line-height: 1.6;
}
body[data-view='thesis'] #main :is(.thesis-process-step h3, .thesis-dive-analysis h4) {
  font-size: 20px;
  font-weight: 400;
  line-height: 1.3;
  text-wrap: balance;
}
/* Retain the wide 39/61 image composition. Fit typography to its dark field,
   rather than widening the field into the approved machine/worker region. */
@media (min-width: 1100px) {
  body[data-view='thesis'] #main .thesis-hero:is(.thesis-scene-economics, .thesis-scene-physical) .thesis-hero-editorial {
    width: 100%;
    max-width: none;
    margin-inline: 0;
    padding-inline: var(--editorial-gutter) 16px;
  }
  body[data-view='thesis'] #main .thesis-hero:is(.thesis-scene-economics, .thesis-scene-physical) .thesis-heading {
    font-size: clamp(36px, 2.8vw, 40px);
    line-height: 1.14;
    letter-spacing: -.025em;
  }
}
/* Existing medium compositions already put copy above their image stage. */
@media (min-width: 601px) and (max-width: 1099px) {
  body[data-view='thesis'] #main .thesis-shell {
    --editorial-title: clamp(38px, 4.3vw, 44px);
  }
  body[data-view='thesis'] #main .thesis-data-insight .thesis-data-inner {
    grid-template-columns: minmax(0, 1fr);
    gap: 28px;
  }
  body[data-view='thesis'] #main .thesis-dive-layout {
    grid-template-columns: minmax(0, 1fr);
    gap: 28px;
  }
  body[data-view='thesis'] #main .thesis-dive-layout > :first-child {
    grid-column: 1;
    grid-row: 1;
  }
  body[data-view='thesis'] #main .thesis-dive-layout > .thesis-dive-analysis {
    grid-column: 1;
    grid-row: 2;
  }
}
@media (max-width: 600px) {
  body[data-view='thesis'] #main .thesis-shell {
    --editorial-title: clamp(30px, 8.2vw, 36px);
    --editorial-body: 17px;
  }
  body[data-view='thesis'] #main .thesis-hero.thesis-scene .thesis-heading {
    line-height: 1.15;
    letter-spacing: -.025em;
  }
  body[data-view='thesis'] #main .thesis-hero.thesis-scene .thesis-hero-editorial .thesis-paragraphs {
    margin-top: 16px;
  }
  body[data-view='thesis'] #main .thesis-process-labels button {
    font-size: 11px;
    padding-inline: 0 4px;
    gap: 4px;
  }
  body[data-view='thesis'] #main :is(.thesis-section-heading, .thesis-dive-title, .thesis-next-title) {
    font-size: 28px;
    line-height: 1.2;
  }
}
/* Quiet heading marker for keyboard-visible focus only.
   Control, summary-toggle and rail focus treatments remain unchanged. */
body[data-view='thesis'] #main .thesis-shell :is(h1, h2, h3, h4):focus {
  outline: none;
  text-decoration-line: none;
}

/* Reading order: chapter argument, evidence, then optional research. */
body[data-view='thesis'] #main .thesis-chapter-marker {
  margin-bottom: 20px;
  letter-spacing: .1em;
}
body[data-view='thesis'] #main .thesis-hero-discovery {
  padding-block: 12px;
}
body[data-view='thesis'] #main .thesis-contents {
  column-gap: clamp(16px, 3vw, 36px);
}
body[data-view='thesis'] #main :is(.thesis-data, .thesis-dives, .thesis-continuation) {
  padding-block: clamp(40px, 5vw, 68px);
}
body[data-view='thesis'] #main .thesis-data-inner {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: clamp(36px, 5vw, 72px);
  align-items: start;
}
body[data-view='thesis'] #main .thesis-editorial .thesis-eyebrow {
  margin-bottom: 20px;
}
body[data-view='thesis'] #main .thesis-readout {
  gap: 12px 20px;
  margin-bottom: 28px;
}
body[data-view='thesis'] #main .thesis-dives-inner > .thesis-section-heading {
  margin-bottom: 16px;
}
body[data-view='thesis'] #main .thesis-depth-intro {
  max-width: 62ch;
  margin: 0 0 32px;
  color: var(--muted, #aeb7be);
  font-size: 17px;
  line-height: 1.6;
}
body[data-view='thesis'] #main .thesis-dive summary {
  padding-block: 24px;
}
body[data-view='thesis'] #main .thesis-dive summary .thesis-dive-title {
  max-width: 38ch;
  font-size: clamp(22px, 2.1vw, 28px);
  line-height: 1.25;
  text-wrap: pretty;
}
body[data-view='thesis'] #main .thesis-dive-topic {
  letter-spacing: .025em;
}
body[data-view='thesis'] #main .thesis-dive-body {
  padding-top: 8px;
  padding-bottom: 36px;
}
body[data-view='thesis'] #main .thesis-process-disclosure .thesis-process-note {
  margin-top: 0;
  font-size: var(--editorial-body);
}
body[data-view='thesis'] #main .thesis-process-steps {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 28px 36px;
  margin-top: 32px;
}
body[data-view='thesis'] #main .thesis-process-step {
  margin: 0;
  padding: 20px 0 0;
  border-left: 0;
  border-top: 1px solid var(--line, #ffffff26);
}
body[data-view='thesis'] #main .thesis-process-step::before {
  content: none;
}
body[data-view='thesis'] #main .thesis-process-step h4 {
  margin: 8px 0 0;
  color: inherit;
  font-size: 20px;
  font-weight: 400;
  line-height: 1.3;
}
body[data-view='thesis'] #main .thesis-process-step p {
  max-width: 38ch;
  font-size: 16px;
  line-height: 1.6;
}
@media (max-width: 1099px) {
  body[data-view='thesis'] #main .thesis-data-inner {
    grid-template-columns: minmax(0, 1fr);
    gap: 32px;
  }
}
@media (max-width: 600px) {
  body[data-view='thesis'] #main .thesis-contents {
    column-gap: 16px;
  }
  body[data-view='thesis'] #main .thesis-contents :is(a, button) {
    font-size: 12px;
  }
  body[data-view='thesis'] #main .thesis-process-steps {
    grid-template-columns: minmax(0, 1fr);
    gap: 24px;
  }
  body[data-view='thesis'] #main .thesis-dive-stat {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 4px 12px;
    font-size: 22px;
  }
  body[data-view='thesis'] #main .thesis-dive-stat small {
    flex: 1 1 160px;
    margin: 0;
  }
}
@media (max-width: 360px) {
  body[data-view='thesis'] #main .thesis-contents {
    column-gap: 10px;
  }
}
body[data-view='thesis'] #main .thesis-shell :is(h1, h2, h3, h4):focus-visible {
  position: relative;
}
body[data-view='thesis'] #main .thesis-shell :is(h1, h2, h3, h4):focus-visible::before {
  content: '';
  position: absolute;
  inset-block-start: .12em;
  inset-inline-start: -10px;
  inline-size: 0;
  block-size: 24px;
  border-inline-start: 2px solid var(--thesis-accent, #65cfc5);
  pointer-events: none;
}
@media (forced-colors: active) {
  body[data-view='thesis'] #main .thesis-shell :is(h1, h2, h3, h4):focus-visible::before {
    border-inline-start-color: Highlight;
    forced-color-adjust: auto;
  }
}
