/* Shared by the SFWA NMPC and SFWA UKF guides. The site stylesheet supplies the
   reading measure, Lato, the colour themes, figures and their controls. */

.guide-location {
    margin: 0 auto 0.45rem;
    font-size: 0.85rem;
    color: var(--muted);
}

/* The chapter's route map: what the reader will do, and what they need first. */
.guide .roadmap {
    border-left: 3px solid var(--grid);
    margin-block: 1.75rem;
    padding: 0.1rem 0 0.1rem 1.1rem;
    font-size: 0.92rem;
}

.guide .roadmap h2 {
    margin: 0 0 0.5rem;
    font-size: 1rem;
    letter-spacing: 0;
}

.guide .roadmap ul {
    margin-bottom: 0.6rem;
}

.guide .roadmap li {
    margin-bottom: 0.3rem;
}

.guide .roadmap p {
    margin: 0;
    color: var(--ink-2);
}

/* Steps for the reader to carry out in the figure above. */
.guide .try {
    margin-block: 1.5rem 2rem;
    padding: 0.9rem 1.1rem 0.4rem;
    border-radius: 6px;
    background: var(--surface-2);
    font-size: 0.92rem;
}

.guide .try h3 {
    margin: 0 0 0.5rem;
    font-size: 1rem;
    letter-spacing: 0;
}

.guide .try ol {
    margin-bottom: 0.5rem;
}

.guide .try li {
    margin-bottom: 0.45rem;
}

/* Questions with an answer the reader opens after trying. */
.guide details {
    border-block: 1px solid var(--grid);
    padding: 0.7rem 0;
}

.guide details + details {
    border-top: 0;
}

.guide details summary {
    cursor: pointer;
    font-weight: 700;
}

.guide details.more summary {
    color: var(--link);
    font-weight: 400;
}

.guide details[open] summary {
    margin-bottom: 0.8rem;
}

.guide details > :last-child {
    margin-bottom: 0.3rem;
}

/* Code: commands, excerpts from the downloadable examples, and live examples. */
.guide pre {
    margin-block: 1.5rem;
    padding: 0.85rem 1rem;
    overflow: auto;
    border-left: 2px solid var(--axis);
    background: var(--surface-2);
    font-size: 0.8rem;
    line-height: 1.55;
    tab-size: 4;
}

.guide pre code {
    padding: 0;
    font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
    font-size: inherit;
    font-variant-ligatures: none;
    background: none;
}

.guide pre.output {
    border-left-color: var(--grid);
    color: var(--ink-2);
}

.guide :is(p, li, td, th, figcaption, summary) code {
    overflow-wrap: anywhere;
}

.guide .listing {
    margin-block: 1.5rem;
}

.guide .listing pre {
    margin-block: 0;
}

.guide .listing-file {
    margin: 0 0 0.3rem;
    font-size: 0.82rem;
    text-align: right;
}

.guide figure.fig pre {
    max-width: var(--text-width);
    margin: 0.3rem auto 0;
}

.sample-tools {
    max-width: var(--text-width);
    margin: 1rem auto 0;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 0.35rem 0.65rem;
    font-size: 0.84rem;
    color: var(--ink-2);
}

.sample-tools > :first-child {
    margin-right: auto;
}

pre code .token.keyword {
    color: color-mix(in srgb, var(--link) 78%, var(--body-2));
    font-weight: 700;
}

pre code :is(.token.function, .token.class-name, .token.builtin, .token.variable) { color: var(--blue); }
pre code :is(.token.string, .token.number, .token.boolean) { color: color-mix(in srgb, var(--green) 78%, var(--body-2)); }
pre code .token.comment { color: var(--ink); font-style: italic; }

/* A figure draws nothing until its script runs; its caption and code remain. */
.guide .fig-stage:empty {
    display: none;
}

.guide .fig-controls .ctl-readout {
    line-height: 1.45;
}

.guide table {
    width: 100%;
    margin-block: 1.5rem;
    border-collapse: collapse;
    font-size: 0.88rem;
    font-variant-numeric: tabular-nums;
}

.guide caption {
    margin-bottom: 0.4rem;
    text-align: left;
    font-weight: 700;
}

.guide :is(th, td) {
    padding: 0.45rem 0.45rem;
    border-bottom: 1px solid var(--grid);
    vertical-align: top;
    text-align: left;
    overflow-wrap: anywhere;
}

.guide tr > :first-child {
    padding-left: 0;
}

/* A column is never narrower than its heading, so short values such as "0.01" stay whole. */
@media (min-width: 601px) {
    .guide thead th {
        white-space: nowrap;
        overflow-wrap: normal;
    }
}

/* A table whose first column lists names from the code: the column is as wide as its names
   and never breaks inside one. On a phone, a row with two names puts them on two lines. */
.guide table.names tbody th {
    white-space: nowrap;
    overflow-wrap: normal;
    padding-right: 1.2rem;
}

.guide table.names tbody th code {
    white-space: nowrap;
    overflow-wrap: normal;
}

/* Where a cell lists more names than fit on a line, break between names or at a space within
   a long signature, never inside a word. */
.guide table.names.long tbody th,
.guide table.names.long tbody th code {
    white-space: normal;
}

.guide table.names.long tbody th {
    width: 42%;
}

@media (max-width: 600px) {
    /* A phone has no room for the longest names whole: keep the column to under half the
       table and let a long name break. */
    .guide table.names tbody th {
        white-space: normal;
        width: 42%;
        padding-right: 0.5rem;
    }

    .guide table.names tbody th code {
        white-space: normal;
        overflow-wrap: anywhere;
    }
}

.guide .sources {
    font-size: 0.92rem;
}

.guide-step {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 0.5rem 2rem;
    border-top: 1px solid var(--grid);
    margin-top: 3.5rem;
    padding-top: 1rem;
    font-size: 0.92rem;
}

.guide-step [rel="next"] {
    margin-left: auto;
}

.guide-contents {
    margin-top: 2.5rem;
}

.guide .guide-contents h2 {
    margin: 0 0 1rem;
    font-size: 1.35rem;
}

.guide-contents a[aria-current] {
    color: var(--ink);
    font-weight: 700;
}

.guide-contents li p {
    margin: 0.1rem 0 0.75rem;
    font-size: 0.88rem;
    color: var(--ink-2);
}

@media (max-width: 600px) {
    .guide table { font-size: 0.8rem; }
    .guide :is(th, td) { padding: 0.4rem 0.2rem; }
}
