/* ==========================================================================
   Long-form resource pages
   Shared by: help center, printing guide, coloring techniques, community.
   Layout: graph-paper hero (.jg-paper from base.css), a numbered page index,
   then open sections: heading in a narrow left column (sticky on wide screens),
   content in a wide right column, hairline rules between sections.
   ========================================================================== */

.lf-page {
    --lf-measure: 68ch;
    --lf-gap: clamp(2rem, 5vw, 4.5rem);
    color: var(--text-primary);
    padding-bottom: clamp(3rem, 8vw, 6rem);
}

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

.lf-hero {
    padding: clamp(3.5rem, 10vw, 7.5rem) 0 clamp(2.5rem, 6vw, 4.5rem);
}

.lf-hero__inner {
    max-width: 62rem;
}

.lf-hero h1 {
    font-size: clamp(2.75rem, 7vw, 5rem);
    line-height: 0.98;
    letter-spacing: -0.035em;
    font-weight: 700;
    margin: 0 0 1.5rem;
    color: var(--text-primary);
}

.lf-hero__lede {
    max-width: 52ch;
    font-size: clamp(1.1rem, 1.8vw, 1.35rem);
    line-height: 1.55;
    color: var(--text-secondary);
    margin: 0;
}

/* ---------- Page index (replaces a boxed table of contents) ---------- */

.lf-toc {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 0.5rem var(--lf-gap);
    padding: 1.5rem 0;
    border-bottom: 1px solid var(--border-light);
    font-size: 0.9375rem;
}

.lf-toc__title {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--text-muted);
    margin: 0;
    padding-top: 0.3rem;
}

.lf-toc ol {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem 1.5rem;
    counter-reset: lf-toc;
}

.lf-toc li {
    counter-increment: lf-toc;
}

.lf-toc a {
    display: inline-block;
    padding: 0.3rem 0;
    color: var(--text-primary);
    font-weight: 500;
}

.lf-toc a::before {
    content: counter(lf-toc, decimal-leading-zero);
    margin-right: 0.45rem;
    color: var(--text-muted);
    font-weight: 400;
    font-variant-numeric: tabular-nums;
}

.lf-toc a:hover {
    color: var(--brand-primary);
}

/* ---------- Sections: heading in a narrow column, content in a wide one ---------- */

.lf-article {
    min-width: 0;
    font-size: 1.0625rem;
    line-height: 1.7;
}

.lf-section {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 1.25rem var(--lf-gap);
    padding: clamp(2.5rem, 6vw, 4.5rem) 0;
    border-bottom: 1px solid var(--border-light);
}

.lf-section__body {
    min-width: 0;
    max-width: var(--lf-measure);
}

@media (min-width: 1024px) {
    .lf-toc,
    .lf-section {
        grid-template-columns: minmax(0, 4fr) minmax(0, 8fr);
    }

    .lf-section > h2 {
        position: sticky;
        top: calc(var(--header-height) + 1.5rem);
        align-self: start;
    }
}

.lf-article p,
.lf-article li,
.lf-article dd {
    color: var(--text-secondary);
}

.lf-article strong {
    color: var(--text-primary);
    font-weight: 600;
}

.lf-article a:not(.lf-btn) {
    color: var(--brand-primary);
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 0.18em;
}

.lf-article a:not(.lf-btn):hover {
    text-decoration-thickness: 2px;
}

.lf-article [id] {
    scroll-margin-top: calc(var(--header-height) + 1.25rem);
}

.lf-article h2 {
    font-size: clamp(1.75rem, 3.4vw, 2.75rem);
    line-height: 1.05;
    letter-spacing: -0.025em;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

.lf-article h3 {
    font-size: 1.25rem;
    line-height: 1.3;
    letter-spacing: -0.01em;
    font-weight: 600;
    color: var(--text-primary);
    margin: 2.25rem 0 0.5rem;
}

.lf-article h4 {
    font-size: 1rem;
    line-height: 1.4;
    font-weight: 600;
    color: var(--text-primary);
    margin: 1.25rem 0 0.5rem;
}

.lf-section__body > :first-child {
    margin-top: 0;
}

.lf-article p {
    margin: 0 0 1rem;
}

.lf-article ul,
.lf-article ol {
    margin: 0 0 1.25rem;
    padding-left: 1.4rem;
}

.lf-article li + li {
    margin-top: 0.35rem;
}

.lf-article li::marker {
    color: var(--text-muted);
}

.lf-article ol > li::marker {
    font-weight: 600;
}

.lf-intro {
    font-size: 1.1875rem;
    line-height: 1.6;
    color: var(--text-primary) !important;
}

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

.lf-table-wrap {
    overflow-x: auto;
    margin: 0.5rem 0 1.75rem;
    border-top: 1px solid var(--text-primary);
}

.lf-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9688rem;
    line-height: 1.5;
}

.lf-table caption {
    caption-side: top;
    text-align: left;
    padding: 0.75rem 0;
    color: var(--text-muted);
    font-size: 0.875rem;
    border-bottom: 1px solid var(--border-light);
}

.lf-table th,
.lf-table td {
    text-align: left;
    vertical-align: top;
    padding: 0.85rem 1.25rem 0.85rem 0;
    border-bottom: 1px solid var(--border-light);
}

.lf-table thead th {
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--text-muted);
    white-space: nowrap;
}

.lf-table tbody th {
    font-weight: 600;
    color: var(--text-primary);
}

.lf-table td {
    color: var(--text-secondary);
}

.lf-table tbody th {
    min-width: 7.5rem;
}

/* Three-column tables become labelled rows on narrow screens */
@media (max-width: 639px) {
    .lf-table--stack thead {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip: rect(0 0 0 0);
        white-space: nowrap;
    }

    .lf-table--stack,
    .lf-table--stack tbody,
    .lf-table--stack tr,
    .lf-table--stack th,
    .lf-table--stack td {
        display: block;
    }

    .lf-table--stack tr {
        padding: 0.75rem 0;
        border-bottom: 1px solid var(--border-light);
    }

    .lf-table--stack tr:last-child {
        border-bottom: 0;
    }

    .lf-table--stack th,
    .lf-table--stack td {
        border-bottom: 0;
        padding: 0.15rem 0;
    }

    .lf-table--stack td[data-label]::before {
        content: attr(data-label) ': ';
        font-weight: 600;
        color: var(--text-primary);
    }
}

/* ---------- Notes, lists, definition rows ---------- */

.lf-note {
    margin: 1.75rem 0;
    padding: 1.1rem 0;
    border-top: 1px solid var(--border-light);
    border-bottom: 1px solid var(--border-light);
}

.lf-note p {
    font-size: 1.125rem;
    line-height: 1.55;
    color: var(--text-primary) !important;
    margin: 0;
}

.lf-split {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 0.5rem 2rem;
}

@media (min-width: 640px) {
    .lf-split {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

.lf-split h3,
.lf-split h4 {
    margin-top: 0.75rem;
}

.lf-checklist,
.lf-crosslist {
    list-style: none;
    padding-left: 0 !important;
}

.lf-checklist li,
.lf-crosslist li {
    position: relative;
    padding-left: 1.6rem;
}

.lf-checklist li::before,
.lf-crosslist li::before {
    position: absolute;
    left: 0;
    top: 0;
    font-weight: 700;
}

.lf-checklist li::before {
    content: '\2713';
    color: var(--success-text);
}

.lf-crosslist li::before {
    content: '\2715';
    color: var(--error-text);
}

.lf-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    list-style: none;
    padding-left: 0 !important;
}

.lf-tags li {
    margin: 0 !important;
}

.lf-tags {
    gap: 0.5rem 2rem !important;
}

.lf-tags code {
    font-family: inherit;
    font-size: clamp(1.5rem, 3vw, 2.25rem);
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text-primary);
    background: none;
    padding: 0;
}

/* Small level marker used on the techniques page */
.lf-level {
    display: inline-block;
    margin-left: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    letter-spacing: 0;
    vertical-align: 0.1em;
    color: var(--text-muted);
}

.lf-level::before {
    content: '';
    display: inline-block;
    width: 0.5rem;
    height: 0.5rem;
    margin-right: 0.4rem;
    border-radius: 50%;
    vertical-align: 0.05em;
    background: currentColor;
}

.lf-level--beginner::before {
    background: var(--brand-secondary-strong);
}

.lf-level--intermediate::before {
    background: var(--brand-primary);
}

.lf-level--advanced::before {
    background: var(--brand-highlight-strong);
}

.lf-tip {
    font-size: 0.9688rem;
}

/* Platform list on the community page */
.lf-links {
    list-style: none;
    padding-left: 0 !important;
    border-top: 1px solid var(--text-primary);
}

.lf-links li {
    margin: 0 !important;
    padding: 1.1rem 0;
    border-bottom: 1px solid var(--border-light);
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 0.15rem 1.5rem;
}

@media (min-width: 640px) {
    .lf-links li {
        grid-template-columns: 10rem minmax(0, 1fr);
        align-items: baseline;
    }
}

.lf-links i {
    display: none;
}

.lf-links a {
    font-size: 1.25rem;
    font-weight: 600;
    letter-spacing: -0.01em;
}

.lf-links span {
    display: block;
    font-size: 0.9688rem;
}

/* ---------- Closing "where next" block ---------- */

.lf-next {
    border-bottom: 0;
}

.lf-next p {
    font-size: 1.1875rem;
    color: var(--text-primary) !important;
    margin: 0 0 1.25rem;
}

.lf-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.lf-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    min-height: 44px;
    padding: 0.6rem 1.15rem;
    border-radius: var(--border-radius-sm);
    border: 1px solid var(--brand-primary-strong);
    background: var(--brand-primary-strong);
    color: var(--btn-primary-text);
    font-weight: 600;
    font-size: 0.9688rem;
    line-height: 1.2;
    text-decoration: none;
    transition: border-color 0.15s ease;
}

.lf-btn:hover {
    color: var(--btn-primary-text);
    text-decoration: underline;
    text-underline-offset: 0.18em;
}

.lf-btn--quiet {
    background: transparent;
    color: var(--brand-primary);
    border-color: var(--border-medium);
}

.lf-btn--quiet:hover {
    color: var(--brand-primary);
    border-color: var(--brand-primary);
    text-decoration: none;
}

.lf-page a:focus-visible,
.lf-btn:focus-visible {
    outline: 2px solid var(--brand-primary);
    outline-offset: 2px;
    border-radius: 4px;
}

@media (prefers-reduced-motion: reduce) {
    .lf-btn {
        transition: none;
    }
}

@media print {
    .lf-toc,
    .lf-next {
        display: none;
    }

    .lf-section {
        display: block;
    }
}

/* Help center topics: tone tiles instead of a numbered list */
.lf-toc ol.lf-topics {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.75rem;
}

.lf-toc .lf-topic {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
    height: 100%;
    padding: 1.1rem 1.2rem;
    font-family: var(--font-display);
    font-size: 1.0625rem;
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: -0.015em;
    color: var(--text-primary);
    background: var(--tone);
    border-radius: 20px;
    transition: transform 0.3s cubic-bezier(0.22, 1, 0.36, 1);
}

.lf-toc .lf-topic::before {
    content: none;
}

.lf-toc .lf-topic i {
    display: grid;
    place-items: center;
    width: 2.4rem;
    height: 2.4rem;
    font-size: 1rem;
    color: var(--tone-ink);
    background: color-mix(in srgb, var(--bg-card) 70%, transparent);
    border-radius: 12px;
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.lf-toc .lf-topic:hover {
    color: var(--text-primary);
    text-decoration: none;
    transform: translateY(-3px);
}

.lf-toc .lf-topic:hover i {
    transform: rotate(-8deg) scale(1.08);
}

.lf-toc:has(.lf-topics) {
    grid-template-columns: minmax(0, 1fr);
    padding: 2rem 0;
}

.lf-hero.jg-stage h1 {
    font-family: var(--font-display);
    font-weight: 800;
    letter-spacing: -0.05em;
}

.lf-section h2 {
    font-family: var(--font-display);
    font-weight: 800;
    letter-spacing: -0.035em;
}

@media (max-width: 900px) {
    .lf-toc ol.lf-topics {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (prefers-reduced-motion: reduce) {
    .lf-toc .lf-topic,
    .lf-toc .lf-topic i {
        transition: none;
    }
}
