/* Prose — whitepaper-specific extensions */
.prose table {
    border-collapse: collapse;
    margin: 1lh auto;
    font-size: 0.75em;
}

.prose th,
.prose td {
    padding: 0.5rem 2rem .8rem 0rem;
    border-bottom: var(--border);
    text-align: left;
}

.prose th {
    font-weight: normal;
}

/* Descriptor value (e.g. MUSKY) in the Mercure Transcript face at all widths */
.prose tbody td:nth-child(2) {
    font-family: 'Mercure-Mono';
}

/* Smell descriptors in prose: set in Mercure Transcript instead of quotes */
.descriptor {
    font-family: 'Mercure-Mono';
}

/* Receptor–descriptor table → stacked entry list at the Explore breakpoint.

   The list starts as two columns, then collapses to one at the SR-code width. */
@media (max-width: 1110px) {
    .prose table {
        display: block;
        /* match the body paragraph width above */
        max-width: 65ch;
        text-align: left;
        font-size: 1em;

    }

    .prose thead {
        display: none;
    }

    .prose tbody {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 1lh 1lh;
    }

    .prose tbody tr {
        display: block;
        /* indent the whole entry, then pull the first line back out (below) */
        padding-left: 2lh;
    }

    .prose tbody td {
        display: inline;
        padding: 0;
        border: none;
    }

    /* First line (receptor · descriptor · …) hangs out to the left */
    .prose tbody td:nth-child(1) {
        margin-left: -2lh;
    }

    /* Line 1: receptor · descriptor · literature association */
    .prose tbody td:nth-child(1)::after,
    .prose tbody td:nth-child(3)::before {
        content: " · ";
    }

    .prose tbody td:nth-child(2) {
        text-transform: uppercase;
    }

    /* Line 2: citation on its own line */
    .prose tbody td:nth-child(4) {
        display: block;
    }

    /* Line 3: labelled r and p values */
    .prose tbody td:nth-child(5)::before {
        content: "r: ";
    }

    .prose tbody td:nth-child(6)::before {
        content: "p: ";
    }

    .prose tbody td:nth-child(6) {
        margin-left: 0.75em;
    }
}

@media (max-width: 668px) {
    .prose tbody {
        grid-template-columns: 1fr;
        gap: 0lh;
    }
}

/* ---------------------Hero stats */
.hero-stats {
    list-style-type: none;
    gap: 3rem;
    grid-template-columns: 1fr;
    /* font-style: italic; */
}

.hero-stat {
    padding-bottom: 1lh;
}

.hero-stat-number {
    /* font-family: 'Mercure-Mono'; */
    /* font-style: normal; */
}

.hero-stat-desc{
  font-style: italic;
  text-indent: 1lh;
}


/* ---------------------Standout */
.standout-border {
    padding: 0lh 2lh;
    padding-bottom: 1lh;
    max-width: 65ch;
    margin: 0 auto;

    & p {
        padding: 0lh;
        margin: 0;
    }
}

/* ---------------------Stage timeline */
.stage-timeline {
    margin: 1lh auto;
    display: flex;
    flex-direction: column;
    gap: 1lh;
}

.stage-timeline li {
    padding-left: 0.5rem;
}

/* ---------------------AUROC chart (HTML/CSS rebuild; old SVG kept in
   whitepaper/auroc-chart-old.svg). Real text = a true, consistent 0.75em. */
.auroc-chart-wrap {
    margin: 1lh 0;
}

.ac {
    --label-w: 6ch;
    font-family: 'Mercure-Mono';
    font-size: 0.75em;
    max-width: 65ch;
    margin: 0 auto;
}

/* legend */
.ac-legend {
    display: flex;
    gap: 2lh;
    margin-left: var(--label-w);
    margin-bottom: 1.5lh;
}

.ac-key {
    display: inline-flex;
    align-items: center;
    gap: 0.6ch;
}

/* plot + vertical gridlines over the track region */
.ac-plot {
    position: relative;
}

.ac-plot::before {
    content: "";
    position: absolute;
    inset: 0 0 0 var(--label-w);
    background: repeating-linear-gradient(to right, var(--text) 0 0.5px, transparent 0.5px 25%);
    border-right: 0.5px solid var(--text);
    pointer-events: none;
}

.ac-row {
    position: relative;
    display: grid;
    grid-template-columns: var(--label-w) 1fr;
    align-items: center;
    height: 2.8em;
}

.ac-name {
    white-space: nowrap;
}

.ac-track {
    position: relative;
    height: 100%;
}

/* baseline each marker sits on */
.ac-track::before {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    top: 50%;
    border-top: 0.5px solid var(--text);
}

/* markers */
.ac-dot {
    position: absolute;
    top: 50%;
    width: 9px;
    height: 9px;
    transform: translate(-50%, -50%);
}

.ac-vina {
    background: var(--text);
    border-radius: 50%;
}

.ac-boltz {
    background: var(--bg);
    border: 1px solid var(--text);
    border-radius: 50%;
}

.ac-sense1 {
    background: var(--bg);
    border: 1px solid var(--text);
}

/* legend markers sit inline, not positioned */
.ac-key .ac-dot {
    position: static;
    transform: none;
    flex: 0 0 auto;
}

/* value numbers above each marker */
.ac-num {
    position: absolute;
    bottom: calc(50% + 6px);
    transform: translateX(-50%);
    white-space: nowrap;
}

/* axis ticks */
.ac-axis {
    position: relative;
    margin-left: var(--label-w);
    margin-top: 0.4lh;
    height: 1.4em;
}

.ac-axis span {
    position: absolute;
    transform: translateX(-50%);
}

/* On small screens, close value numbers can't separate horizontally without
   drifting off their dots, so the clustered ones drop below the baseline
   (vertical stacking). Desktop keeps every number above the dots. */
@media (max-width: 520px) {
    .ac-row {
        height: 3.6em;
    }

    .ac-num--lo {
        bottom: auto;
        top: calc(50% + 6px);
    }
}

.date {
    font-family: 'Mercure-Mono';
    letter-spacing: 0.02em;
    text-transform: uppercase;
    font-size: .75em;
    margin-top: 0;
}

/* Current stage in the machine-olfaction progression */
.stage-current {
    border: var(--border);
    padding: 1lh;
    max-width: 88ch;
    margin: 1lh auto;
}

.stage-current h3 {
    margin-top: 0;
}

.prose h3 + p{
  margin-top: 0;
  padding-top: 0;
}

.stage-current > p:last-child {
    margin-bottom: 0;
}

/* Numbered stage headings (Progress of Machine Olfaction): the number hangs in
   the left gutter (no indent) while the heading text sits at the 2lh indent;
   the following paragraph's first line is indented 2lh to match. */
.stage-num {
    display: inline-block;
    width: 2lh;
    margin-left: -2lh;
    text-indent: 0;
}

.prose .stage-h + p {
    text-indent: 2lh;
}

/* Side-by-side SR Code comparison (rose oil vs. Rose Hypothetical) */
.sr-compare {
    display: flex;
    flex-wrap: wrap;
    gap: 2lh;
    justify-content: center;
    align-items: flex-start;
    margin: 1lh 0;
}

.sr-compare-item {
    margin: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* On mobile, stack the two cards full-width so each grid scales like the other
   SR codes (the shared .scent-grid mobile rules in receptor.css handle the rest). */
@media (max-width: 668px) {
    .sr-compare {
        flex-direction: column;
        flex-wrap: nowrap;
        align-items: stretch;
        gap: 1lh;
    }

    .sr-compare-item {
        width: 100%;
        /* center shrink-wraps children to min-content; stretch lets the grid
           fill the width so cells scale like the other SR codes. */
        align-items: stretch;
    }
}

/* Hide the renderer's default hover caption */
.sr-compare .viz-caption {
    display: none;
}

/* =====================================================================
   TEMPORARY: monochrome receptor grids + descriptors.
   The family colors are still in the markup/JS (inline styles + descriptors.json);
   these rules just override them. Delete this block to restore the colors.
   ===================================================================== */

/* Scent grid below "The Complexity of Smell" (olfaction panel).
   Each cell draws its own bottom+right border, and the grid draws top+left.
   This keeps every internal edge a single .5px line AND frames every row's
   own bottom — so a partial last row (386 cells in 20 cols) stays complete. */
.olf-grid {
    border-top: var(--border);
    border-left: var(--border);
}

.olf-grid .receptor-scale-cell {
    background: var(--bg) !important;
    border: 0;
    border-bottom: var(--border);
    border-right: var(--border);
}

.olf-grid .receptor-scale-cell[data-name]:hover {
    background: var(--text) !important;
}

/* "Explore the Receptor Code" interactive grid */
.xr-ye-inner {
    border-top: var(--border);
    border-left: var(--border);
}

.xr-ye-inner .grid-cell {
    background: var(--bg) !important;
    border: 0;
    border-bottom: var(--border);
    border-right: var(--border);
}

.xr-ye-inner .grid-cell:hover,
.xr-ye-inner .grid-cell.receptor-selected {
    background: var(--text) !important;
}

/* Odor descriptor labels in the Explore card */
.xr-descriptor-name {
    color: var(--text) !important;
}
/* ===================== end temporary monochrome ===================== */

/* Equal-height cards: Color vision ↔ Olfaction (the grid borders make the
   olfaction card a hair taller; stretch keeps both cards the same height). */
.receptor-scale-inner {
    align-items: stretch;
}

@media (max-width: 1150px) {
    .receptor-scale-inner {
        align-items: center;
    }
}

/* Explore card: match the receptor grid's height on its left, and pin the
   Perceptual Profile content to the top-left instead of spreading it.
   align-items:stretch equalizes the two cards (heights side-by-side, widths
   when stacked) so their borders line up. */
.xr-container {
    align-items: stretch;
}

.xr-panel {
    height: auto;
    text-align: left;
    overflow: auto;
}

/* The global h3 rule applies a 2lh text-indent + auto margins; reset it so the
   subtitle sits flush in the card's top-left corner. */
.xr-profile-subtitle {
    text-indent: 0;
    margin: 0 0 1lh 0;
    max-width: none;
}

/* Once the grid + panel no longer fit side-by-side, stack them and seam them
   into a single card (no gap, no border between them). */
@media (max-width: 1110px) {
    .xr-container {
        flex-direction: column;
        gap: 0;
    }

    .xr-grid-side {
        border-bottom: none;
    }

    .xr-panel {
        border-top: none;
    }

    .xr-profile-subtitle {
        font-size: 0.75em;
    }
}

/* At the SR-code breakpoint, fill the width with square cells and list the
   descriptors in a single column. */
@media (max-width: 668px) {
    .xr-container {
        width: 100%;
    }

    .xr-grid-wrap {
        width: 100%;
    }

    .xr-ye-inner {
        width: 100%;
    }

    .xr-ye-inner .grid-cell {
        width: auto;
        height: auto;
        aspect-ratio: 1;
    }

    .xr-panel {
        width: 100%;
    }

    .xr-descriptor-grid {
        grid-template-columns: 1fr;
    }
}

.references {
    font-size: 1em;
    text-align: left;
    margin: auto;
    columns: 2;
    max-width: 65ch;
    /* font-size: .75em; */

    p{
      font-size: .75em;
      margin: 0;
      padding-left: 2lh;
      text-indent: -2lh;
      break-inside: avoid;
    }

    @media (max-width: 668px) {
      columns: 1;
    }


}
