/*
 * The getting-started guide.
 *
 * A third character after home.css and app.css: a manual, read once end to end and then
 * scanned. Denser than the landing page and more discursive than the application pages.
 *
 * Palette, type system, reset, .wrap, .masthead, .btn, .wordmark, .eyebrow, .rule and
 * .sr-only all come from tokens.css. Only what is specific to this page is below.
 *
 * No inline style attributes anywhere, here or in the template. The Content-Security-
 * Policy is "default-src 'none'" with 'self' for styles and no unsafe-inline, so a style
 * attribute would simply not apply and the rule would vanish without an error.
 */

.docs {
    --measure: 64ch;
}

/* Only this page has in-page anchors, so the scroll behaviour is declared here rather
   than in tokens.css. */
html {
    scroll-behavior: smooth;
    scroll-padding-top: 2rem;
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    * {
        transition: none !important;
        animation: none !important;
    }
}

/* Inline mono, for an identifier or a filename inside a sentence. */
.m {
    font-family: var(--mono);
    font-size: 0.88em;
}

.masthead nav a[aria-current] {
    color: var(--ink);
    border-bottom: 2px solid var(--promoter);
    padding-bottom: 2px;
}

/* Hero -------------------------------------------------------------------- */

.docs-hero {
    padding-block: clamp(2.75rem, 6vw, 4.5rem) clamp(1.5rem, 4vw, 2.5rem);
}

.docs-hero h1 {
    font-size: clamp(2.2rem, 1.1rem + 4.6vw, 4rem);
    max-width: 16ch;
    margin: 0 0 1.3rem;
}

.docs-hero h1 em {
    font-style: normal;
    color: var(--promoter);
}

.docs-lede {
    font-size: clamp(1.05rem, 1rem + 0.4vw, 1.24rem);
    max-width: 54ch;
}

/* Requirements strip ------------------------------------------------------ */

.reqs {
    display: grid;
    gap: 1px;
    margin-top: 2.4rem;
    background: var(--rule);
    border: 1px solid var(--rule);
    border-radius: 3px;
    overflow: hidden;
}

@media (min-width: 44rem) {
    .reqs {
        grid-template-columns: repeat(4, 1fr);
    }
}

.req {
    background: var(--card);
    padding: 1rem 1.1rem;
}

.req dt {
    font-family: var(--mono);
    font-size: 0.7rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--ink-soft);
}

.req dd {
    margin: 0.35rem 0 0;
    font-family: var(--display);
    font-weight: 700;
    font-size: 1.05rem;
    letter-spacing: -0.02em;
}

.note {
    margin: 0.9rem 0 0;
    font-family: var(--mono);
    font-size: 0.76rem;
    line-height: 1.7;
    color: var(--ink-soft);
}

/* Callout ----------------------------------------------------------------- */

.callout {
    margin-top: 2.4rem;
    padding: 1.4rem 1.5rem;
    background: var(--card);
    border: 1px solid var(--rule);
    border-left: 3px solid var(--promoter);
    border-radius: 3px;
}

.callout h3 {
    font-size: 1.15rem;
    margin: 0 0 0.5rem;
}

.callout p {
    margin: 0;
    max-width: 62ch;
    color: var(--ink-soft);
    font-size: 0.97rem;
}

.callout p + p {
    margin-top: 0.7rem;
}

.callout b {
    color: var(--ink);
    font-weight: 600;
}

/* Your values panel ------------------------------------------------------- */

.vars {
    margin-top: 2.6rem;
    padding: 1.4rem clamp(1.1rem, 3vw, 1.7rem) 1.6rem;
    background: var(--card);
    border: 1px solid var(--rule);
    border-radius: 3px;
}

.vars h2 {
    font-size: 1.2rem;
    margin: 0 0 0.4rem;
}

.vars > p {
    margin: 0 0 1.2rem;
    max-width: 64ch;
    font-size: 0.94rem;
    color: var(--ink-soft);
}

.vars-grid {
    display: grid;
    gap: 0.9rem;
}

@media (min-width: 48rem) {
    .vars-grid {
        grid-template-columns: 1fr 1fr;
    }
}

.vars label {
    display: block;
    margin-bottom: 0.35rem;
    font-family: var(--mono);
    font-size: 0.72rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--ink-soft);
}

.vars input {
    width: 100%;
    padding: 0.6em 0.7em;
    background: var(--paper);
    border: 1px solid var(--rule);
    border-radius: 2px;
    color: var(--ink);
    font-family: var(--mono);
    font-size: 0.84rem;
}

.vars input:focus {
    outline: 2px solid var(--promoter);
    outline-offset: 0;
    border-color: var(--promoter);
}

/* Sections ---------------------------------------------------------------- */

.docs-section {
    padding-block: clamp(2.75rem, 6vw, 4.5rem);
}

.docs-section h2 {
    font-size: clamp(1.7rem, 1.1rem + 2.2vw, 2.6rem);
    max-width: 22ch;
    margin: 0 0 1rem;
}

.docs-lede-narrow {
    max-width: var(--measure);
}

.part-head {
    display: flex;
    align-items: baseline;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

.part-head h2 {
    margin: 0;
}

.clock {
    padding: 0.25em 0.6em;
    border: 1px solid var(--promoter);
    border-radius: 2px;
    font-family: var(--mono);
    font-size: 0.74rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--promoter);
    white-space: nowrap;
}

/* Steps ------------------------------------------------------------------- */

.steps {
    margin-top: 2.4rem;
    counter-reset: step;
}

.step {
    display: grid;
    /* Also on the single-column fallback, or a wide <pre> stretches the implicit track
       and takes the whole page with it. */
    grid-template-columns: minmax(0, 1fr);
    gap: 0.9rem 1.9rem;
    padding-block: 1.9rem;
    border-top: 1px solid var(--rule);
    align-items: start;
}

.step:last-child {
    border-bottom: 1px solid var(--rule);
}

@media (min-width: 56rem) {
    .step {
        /* minmax(0, 1fr), not 1fr: a grid track defaults to min-width auto, so a wide
           unwrappable line inside a <pre> stretches the column instead of scrolling
           within it, and the block breaks out of the page. */
        grid-template-columns: 3.25rem 21rem minmax(0, 1fr);
    }
}

.step-n {
    counter-increment: step;
    padding-top: 0.25rem;
    font-family: var(--mono);
    font-size: 0.8rem;
    color: var(--ink-soft);
}

.step-n::before {
    content: counter(step, decimal-leading-zero);
}

.step h3 {
    font-size: 1.2rem;
    margin: 0 0 0.5rem;
}

.step-body p {
    margin: 0 0 0.7em;
    max-width: 46ch;
    color: var(--ink-soft);
    font-size: 0.97rem;
}

.step-body p:last-child {
    margin-bottom: 0;
}

.step-body b {
    color: var(--ink);
    font-weight: 600;
}

/* Code: dark is what you type, light is what the server answers ------------ */

.code {
    position: relative;
    margin: 0 0 1rem;
}

.code:last-child {
    margin-bottom: 0;
}

.code-spaced {
    margin-top: 1.4rem;
}

.code-label {
    display: block;
    margin: 0 0 0.4rem;
    font-family: var(--mono);
    font-size: 0.68rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--ink-soft);
}

.docs pre {
    margin: 0;
    padding: 1rem 3.4rem 1rem 1.05rem;
    border-radius: 3px;
    font-family: var(--mono);
    font-size: 0.79rem;
    line-height: 1.8;
    white-space: pre;
    overflow-x: auto;
}

pre.sh {
    background: var(--ink);
    color: #C9D6D6;
}

/* The value slots the panel above fills in. */
pre.sh .v {
    color: #6FD8B8;
}

pre.sh .cmt {
    color: #8098A0;
}

pre.json {
    background: var(--card);
    color: var(--ink-soft);
    border: 1px solid var(--rule);
}

pre.json b {
    color: var(--ink);
    font-weight: 500;
}

pre.json .g {
    color: var(--promoter);
}

/* Light by default, because the button overlays the dark shell block. It is a sibling of
   the <pre> rather than a child, so "color: inherit" would take --ink from the page and
   put a near-black button on a near-black background - invisible, and only visible as a
   mistake in a screenshot. .code-answer overrides it for the light JSON blocks. */
.copy {
    position: absolute;
    top: 0.55rem;
    right: 0.55rem;
    padding: 0.3em 0.5em;
    background: transparent;
    color: #C9D6D6;
    border: 1px solid currentColor;
    border-radius: 2px;
    opacity: 0.55;
    font-family: var(--mono);
    font-size: 0.65rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    cursor: pointer;
}

/* A labelled block pushes its <pre> down by the height of the label, and the button has
   to follow. Left at the top it sits on the page background instead of on the block -
   where a light button is simply not there. */
.code-label ~ .copy {
    top: 2.05rem;
}

.copy:hover {
    opacity: 1;
}

/* The JSON blocks are light, so the button goes dark on those. */
.code-answer .copy {
    color: var(--ink-soft);
}

/* Tables ------------------------------------------------------------------ */

.tbl {
    width: 100%;
    margin-top: 1.6rem;
    border-collapse: collapse;
    font-size: 0.92rem;
}

.tbl caption {
    padding-bottom: 0.8rem;
    text-align: left;
    font-family: var(--display);
    font-weight: 700;
    font-size: 1.15rem;
    letter-spacing: -0.02em;
}

.tbl th,
.tbl td {
    padding: 0.62rem 1rem 0.62rem 0;
    border-bottom: 1px solid var(--rule);
    text-align: left;
    vertical-align: top;
}

.tbl th {
    font-family: var(--mono);
    font-size: 0.7rem;
    font-weight: 500;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--ink-soft);
}

.tbl td:first-child {
    white-space: nowrap;
    font-family: var(--mono);
    font-size: 0.82rem;
}

.tbl-plain td:first-child {
    white-space: normal;
    font-family: var(--body);
    font-size: inherit;
}

.grid2 {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 2.6rem;
    margin-top: 2.4rem;
}

@media (min-width: 60rem) {
    .grid2 {
        /* minmax(0, ...) for the same reason as .step: these columns hold tables. */
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
        gap: 3.5rem;
    }
}

.aside p {
    max-width: 46ch;
    color: var(--ink-soft);
    font-size: 0.97rem;
}

.aside b {
    color: var(--ink);
    font-weight: 600;
}

/* The meter illustration -------------------------------------------------- */

.gauge {
    margin-top: 1rem;
    background: var(--card);
    border: 1px solid var(--rule);
    border-radius: 3px;
    overflow: hidden;
}

.gauge-row {
    display: grid;
    grid-template-columns: 6rem 1fr;
    gap: 0 1rem;
    align-items: center;
    padding: 0.6rem 0.9rem;
    border-top: 1px solid var(--rule);
    font-size: 0.88rem;
}

.gauge-row:first-child {
    border-top: 0;
}

.gauge-w {
    font-family: var(--mono);
    font-size: 0.74rem;
    color: var(--ink-soft);
}

.gauge-bar {
    position: relative;
    height: 6px;
    border-radius: 3px;
    background: var(--paper);
}

.gauge-bar i {
    position: absolute;
    inset: 0 auto 0 0;
    display: block;
    border-radius: 3px;
}

/* The same four steps the questionnaire uses; see .meter-step-N in app.css. */
.gauge-1 i { width: 12%;  background: var(--meter-red); }
.gauge-2 i { width: 42%;  background: var(--meter-amber); }
.gauge-3 i { width: 70%;  background: var(--meter-yellow); }
.gauge-4 i { width: 85%;  background: var(--meter-green); }
.gauge-5 i { width: 100%; background: var(--meter-green); }

/* Gotchas ----------------------------------------------------------------- */

.traps {
    background: var(--ink);
    color: var(--paper);
}

.traps h2 {
    color: #fff;
}

.traps .eyebrow {
    color: #8CA0A0;
}

.traps .docs-lede-narrow {
    color: #B9C7C7;
}

.trap-list {
    display: grid;
    gap: 0;
    margin: 2.4rem 0 0;
    padding: 0;
    list-style: none;
}

@media (min-width: 60rem) {
    .trap-list {
        grid-template-columns: 1fr 1fr;
        column-gap: 3.5rem;
    }
}

.trap {
    padding-block: 1.25rem;
    border-top: 1px solid rgba(255, 255, 255, 0.12);
}

.trap h3 {
    margin: 0 0 0.35rem;
    font-size: 1.02rem;
    letter-spacing: -0.015em;
    color: #fff;
}

.trap p {
    margin: 0;
    color: #B9C7C7;
    font-size: 0.93rem;
}

.trap b {
    color: #fff;
    font-weight: 600;
}

.trap code {
    font-family: var(--mono);
    font-size: 0.85em;
    color: #8FD9C2;
}

/* Close ------------------------------------------------------------------- */

.close-grid {
    display: grid;
    gap: 2rem;
    align-items: end;
}

@media (min-width: 52rem) {
    .close-grid {
        grid-template-columns: 1fr auto;
    }
}

.close-grid p {
    margin: 0;
    max-width: var(--measure);
}

.close-actions {
    display: flex;
    gap: 0.7rem;
    flex-wrap: wrap;
}

.docs footer {
    padding-block: 2.2rem 3rem;
    font-family: var(--mono);
    font-size: 0.75rem;
    color: var(--ink-soft);
}

.docs footer div {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
    justify-content: space-between;
}
