/* Week 09: readable data-literacy diagrams and task-first lab navigation. */

html.week-09-page {
  scroll-behavior: auto;
}

body.week-09.teaching-document .skip-link {
  transition: none;
}

body.week-09.teaching-document .article h2[id], body.week-09.teaching-document .article h3[id] {
  scroll-margin-top: 86px;
}

/* Keep frequent navigation immediate and make the current section visible. */
body.week-09.teaching-document .lesson-toc > summary {
  display: none;
}

body.week-09.teaching-document .toc-links {
  display: grid;
  gap: 2px;
}

body.week-09.teaching-document .toc a[aria-current="location"] {
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-weight: 720;
  box-shadow: inset 3px 0 0 var(--accent);
}

/* Concept checks are disclosures, not equal-weight callout cards. */
body.week-09.teaching-document details.callout-question {
  margin: 18px 0 28px;
  padding: 0;
  border: 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
}

body.week-09.teaching-document details.callout-question > summary {
  margin: 0;
  padding: 15px 44px 15px 0;
  color: var(--ink-strong);
}

body.week-09.teaching-document details.callout-question > .details-motion-content {
  padding: 0 36px 16px 0;
}

body.week-09.teaching-document details.callout-question > .details-motion-content p {
  color: var(--muted);
  font-size: 13.5px;
  line-height: 1.75;
}

/* Semantic replacement for the raster observation diagram. */
body.week-09.teaching-document .observation-flow-diagram {
  color: var(--ink);
}

body.week-09.teaching-document ol.observation-flow {
  margin: 0;
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  overflow: hidden;
  list-style: none;
}

body.week-09.teaching-document .observation-flow > li {
  min-width: 0;
  margin: 0;
  padding: 17px;
  border-left: 1px solid var(--line);
  background: var(--paper);
}

body.week-09.teaching-document .observation-flow > li:first-child {
  border-left: 0;
}

body.week-09.teaching-document .diagram-step {
  display: block;
  margin-bottom: 8px;
  color: var(--accent-ink);
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 650;
}

body.week-09.teaching-document .observation-flow strong {
  display: block;
  min-height: 3.2em;
  color: var(--ink-strong);
  font-size: 14px;
  line-height: 1.55;
}

body.week-09.teaching-document .observation-flow p {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

body.week-09.teaching-document .diagram-record {
  margin: 13px 0 0;
  display: grid;
  gap: 6px;
}

body.week-09.teaching-document .diagram-record div {
  display: grid;
  grid-template-columns: minmax(58px, 0.8fr) minmax(0, 1fr);
  gap: 7px;
}

body.week-09.teaching-document .diagram-record dt,
body.week-09.teaching-document .diagram-record dd {
  margin: 0;
  font-size: 11px;
  line-height: 1.45;
}

body.week-09.teaching-document .diagram-record dt {
  color: var(--quiet);
}

body.week-09.teaching-document .diagram-record dd {
  color: var(--ink-strong);
  font-weight: 650;
}

body.week-09.teaching-document .diagram-mini-row {
  margin-top: 13px;
  border: 1px solid var(--line-strong);
  display: grid;
  grid-template-columns: 0.55fr 1fr 0.65fr;
  background: var(--surface);
}

body.week-09.teaching-document .diagram-mini-row span {
  padding: 8px 6px;
  border-left: 1px solid var(--line);
  color: var(--ink-strong);
  font-family: var(--mono);
  font-size: 9.5px;
  text-align: center;
}

body.week-09.teaching-document .diagram-mini-row span:first-child {
  border-left: 0;
}

body.week-09.teaching-document p.diagram-equation {
  margin: 14px 0 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
  color: var(--accent-ink);
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 650;
}

body.week-09.teaching-document .diagram-equation span[aria-hidden="true"] {
  color: var(--quiet);
}

/* Semantic DataFrame diagram. The table scrolls instead of shrinking text. */
body.week-09.teaching-document .dataframe-anatomy-diagram {
  min-width: 0;
}

body.week-09.teaching-document .anatomy-legend {
  margin: 0 0 13px;
  display: flex;
  flex-wrap: wrap;
  gap: 7px 14px;
}

body.week-09.teaching-document .anatomy-legend span {
  color: var(--muted);
  font-size: 11px;
}

body.week-09.teaching-document .anatomy-legend strong {
  color: var(--accent-ink);
}

body.week-09.teaching-document .anatomy-table-scroll {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  background: var(--paper);
  overscroll-behavior-inline: contain;
}

body.week-09.teaching-document .dataframe-anatomy-diagram table {
  min-width: 700px;
  margin: 0;
  border: 0;
  border-collapse: collapse;
  font-family: var(--mono);
  font-size: 12px;
}

body.week-09.teaching-document .dataframe-anatomy-diagram th,
body.week-09.teaching-document .dataframe-anatomy-diagram td {
  padding: 12px 13px;
  border: 0;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: var(--paper);
  color: var(--ink);
  white-space: nowrap;
}

body.week-09.teaching-document .dataframe-anatomy-diagram thead th {
  background: var(--surface-strong);
  color: var(--ink-strong);
}

body.week-09.teaching-document .dataframe-anatomy-diagram .index-cell {
  background: color-mix(in srgb, var(--surface) 72%, var(--paper));
  color: var(--accent-strong);
  font-weight: 700;
}

body.week-09.teaching-document .dataframe-anatomy-diagram .focus-row > * {
  box-shadow: inset 0 2px 0 var(--accent), inset 0 -2px 0 var(--accent);
}

body.week-09.teaching-document .dataframe-anatomy-diagram .focus-column {
  background: var(--accent-soft);
}

body.week-09.teaching-document .dataframe-anatomy-diagram .missing-cell {
  color: var(--error-ink);
  font-weight: 750;
  text-decoration: underline;
  text-decoration-style: dotted;
  text-underline-offset: 4px;
}

body.week-09.teaching-document ul.dtype-map {
  margin: 12px 0 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  list-style: none;
}

body.week-09.teaching-document .dtype-map li {
  min-width: 0;
  margin: 0;
  padding: 10px;
  border-top: 2px solid var(--accent);
  background: var(--paper);
}

body.week-09.teaching-document .dtype-map code {
  display: block;
  overflow-wrap: anywhere;
}

body.week-09.teaching-document .dtype-map span {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 10.5px;
}

/* A structural visual for the two official art cases. */
body.week-09.teaching-document .case-lens-visual {
  margin: 22px 0 30px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  overflow: hidden;
  background: var(--paper);
}

body.week-09.teaching-document .case-lens-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

body.week-09.teaching-document .case-lens-grid section {
  min-width: 0;
  padding: 22px;
}

body.week-09.teaching-document .case-lens-grid section + section {
  border-left: 1px solid var(--line);
  background: var(--surface);
}

body.week-09.teaching-document .case-lens-grid span {
  color: var(--accent-ink);
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 650;
}

body.week-09.teaching-document .case-lens-grid strong {
  display: block;
  margin: 8px 0 11px;
  color: var(--ink-strong);
  font-size: 17px;
}

body.week-09.teaching-document .case-lens-grid ol {
  margin: 0;
  padding-left: 20px;
}

body.week-09.teaching-document .case-lens-grid li {
  color: var(--muted);
  font-size: 12.5px;
}

body.week-09.teaching-document .case-lens-visual figcaption {
  margin: 0;
  padding: 13px 22px;
  border-top: 1px solid var(--line);
  background: var(--paper);
  text-align: left;
}

/* The example is the real HTML output, not a shrunken screenshot. */
body.week-09.teaching-document .reading-card-preview {
  width: 100%;
  min-height: 720px;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  display: block;
  background: var(--paper);
}

body.week-09.teaching-document p.visual-actions {
  margin: 12px 0 0;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 12.5px;
}

/* Put the first lab action above explanatory material. */
body.week-09.teaching-document .quick-start {
  margin: 0 0 30px;
  padding: 22px;
  border: 1px solid var(--line-strong);
  border-left: 5px solid var(--accent);
  border-radius: 6px;
  background: var(--surface);
}

body.week-09.teaching-document .quick-start-kicker {
  color: var(--accent-strong);
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 700;
}

body.week-09.teaching-document .quick-start h2 {
  margin: 7px 0 9px;
  padding: 0;
  border: 0;
  display: block;
  font-size: 22px;
  counter-increment: none;
}

body.week-09.teaching-document .quick-start h2::before {
  content: none;
}

body.week-09.teaching-document .quick-start p {
  max-width: 65ch;
  color: var(--muted);
}

body.week-09.teaching-document .quick-start-actions {
  margin-top: 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
}

body.week-09.teaching-document .quick-start-actions a {
  min-height: 42px;
  padding: 10px 13px;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--paper);
  color: var(--ink-strong);
  font-size: 12.5px;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
  transition: transform 120ms var(--ease-out);
}

body.week-09.teaching-document .quick-start-actions a:first-child {
  border-color: var(--accent-strong);
  background: var(--accent-strong);
  color: var(--paper);
}

body.week-09.teaching-document .quick-start-actions a:active {
  transform: scale(0.98);
}

@media (hover: hover) and (pointer: fine) {
  body.week-09.teaching-document .quick-start-actions a:hover {
    border-color: var(--accent-ink);
    text-decoration: none;
  }
}

@media (max-width: 980px) {
  body.week-09.teaching-document .lesson-toc {
    max-height: none;
    padding: 0;
    overflow: visible;
  }

  body.week-09.teaching-document .lesson-toc > summary {
    min-height: 48px;
    margin: 0;
    padding: 14px 44px 14px 16px;
    display: block;
    color: var(--accent-ink);
  }

  body.week-09.teaching-document .lesson-toc > .details-motion-content,
  body.week-09.teaching-document .lesson-toc > .toc-links {
    max-height: min(54vh, 320px);
    padding: 0 8px 9px;
    overflow: auto;
  }

  body.week-09.teaching-document .lesson-toc .toc-links {
    padding-top: 3px;
  }
}

@media (max-width: 760px) {
  body.week-09.teaching-document .observation-flow,
  body.week-09.teaching-document .case-lens-grid,
  body.week-09.teaching-document .dtype-map {
    grid-template-columns: 1fr;
  }

  body.week-09.teaching-document .observation-flow > li,
  body.week-09.teaching-document .observation-flow > li:first-child {
    border-top: 1px solid var(--line);
    border-left: 0;
  }

  body.week-09.teaching-document .observation-flow > li:first-child {
    border-top: 0;
  }

  body.week-09.teaching-document .observation-flow strong {
    min-height: 0;
  }

  body.week-09.teaching-document .case-lens-grid section + section {
    border-top: 1px solid var(--line);
    border-left: 0;
  }

  body.week-09.teaching-document .reading-card-preview {
    min-height: 650px;
  }

  body.week-09.teaching-document .quick-start-actions {
    display: grid;
  }

  body.week-09.teaching-document .quick-start-actions a {
    width: 100%;
  }

  body.week-09.teaching-document details.callout-question > .details-motion-content {
    padding-right: 0;
  }
}

@media (hover: none), (pointer: coarse) {
  body.week-09.teaching-document .toc a[aria-current="location"]:not(:active):hover {
    background: var(--accent-soft) !important;
    color: var(--accent-strong) !important;
  }
}

@media (prefers-color-scheme: dark) {
  body.week-09.teaching-document .observation-flow > li,
  body.week-09.teaching-document .diagram-mini-row,
  body.week-09.teaching-document .dataframe-anatomy-diagram th,
  body.week-09.teaching-document .dataframe-anatomy-diagram td,
  body.week-09.teaching-document .dtype-map li,
  body.week-09.teaching-document .case-lens-visual,
  body.week-09.teaching-document .case-lens-visual figcaption,
  body.week-09.teaching-document .reading-card-preview {
    background: var(--paper);
  }

  body.week-09.teaching-document .dataframe-anatomy-diagram .index-cell,
  body.week-09.teaching-document .case-lens-grid section + section {
    background: var(--surface);
  }
}

@media print {
  html.week-09-page {
    scroll-behavior: auto;
  }

  body.week-09.teaching-document .quick-start-actions,
  body.week-09.teaching-document .visual-actions,
  body.week-09.teaching-document .reading-card-preview {
    display: none !important;
  }

  body.week-09.teaching-document details:not([open]) > .details-motion-content,
  body.week-09.teaching-document details[open] > .details-motion-content {
    display: block !important;
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
  }

  body.week-09.teaching-document details.callout-question > summary::after {
    display: none;
  }

  body.week-09.teaching-document .lesson-visual,
  body.week-09.teaching-document .case-lens-visual,
  body.week-09.teaching-document .quick-start {
    break-inside: avoid;
  }
}
