/* ==========================================================================
   Resources: index (home/resources.html) and the seven guides
   (home/resources/*.html). Loaded after rlm.css. Uses the shared .r-* kit
   and adds only what the kit lacks. Prefix: .res-
   ========================================================================== */

/* ---------- index: guides as spec rows ---------- */
.res-index { padding-bottom: 96px; }
.res-list { list-style: none; margin: 0; padding: 0; border-top: 2px solid var(--r-ink); }
.res-item {
    position: relative;
    display: grid;
    grid-template-columns: 64px minmax(200px, 1fr) minmax(240px, 1.6fr) auto;
    gap: 8px 40px;
    align-items: baseline;
    padding: 32px 16px;
    border-bottom: 1px solid var(--r-line-strong);
    transition: background-color 0.15s ease;
}
.res-item:hover, .res-item:focus-within { background: var(--r-surface); }
.res-num { font: 600 14px/1 var(--r-body); letter-spacing: 0.08em; color: var(--r-muted); }
.res-item h2 { margin: 0; font: 700 28px/1.1 var(--r-display); letter-spacing: -0.02em; }
.res-title { color: var(--r-ink); text-decoration: none; }
.res-title::after { content: ""; position: absolute; inset: 0; }
.res-title:focus-visible { outline-offset: 2px; }
.res-item:hover .res-title { text-decoration: underline 4px var(--r-yellow); text-underline-offset: 6px; }
.res-item p { margin: 0; font-size: 18px; line-height: 1.6; color: var(--r-ink-2); }
.res-go { font-weight: 600; color: var(--r-blue); white-space: nowrap; }
.res-go::after { content: "\2192"; display: inline-block; margin-left: 8px; transition: transform 0.15s ease; }
.res-item:hover .res-go::after { transform: translateX(4px); }
.res-note-wrap { display: flex; align-items: flex-end; }

/* ---------- articles ---------- */
.res-body { padding-top: 8px; padding-bottom: 96px; justify-content: space-between; }
.res-body.r-article-layout { gap: 48px 72px; }
.res-body .r-article { flex: 3 1 560px; max-width: 64ch; counter-reset: res-h2; }
.res-body .r-article h2 { counter-increment: res-h2; scroll-margin-top: 110px; margin-top: 64px; }
.res-body .r-article h2:first-child { margin-top: 0; }
.res-body .r-article h2::before {
    content: counter(res-h2, decimal-leading-zero);
    display: block;
    margin-bottom: 10px;
    padding-top: 12px;
    width: 56px;
    border-top: 3px solid var(--r-yellow);
    font: 600 14px/1 var(--r-body);
    letter-spacing: 0.08em;
    color: var(--r-blue);
}
.res-body .r-article h3 { scroll-margin-top: 110px; }
.res-body .r-article p { margin: 0 0 1em; }
.res-body .r-article ul, .res-body .r-article ol { margin: 0 0 1.2em; }
.res-body .r-article strong { color: var(--r-ink); }
.res-body .r-article a { color: var(--r-blue); }
.res-body .r-article li::marker { color: var(--r-muted); }
.res-body .r-article ol li::marker { color: var(--r-blue); font-weight: 600; }

/* "In this guide" table of contents */
.res-body .r-article-aside { flex: 1 1 260px; max-width: 340px; max-height: calc(100vh - 140px); overflow-y: auto; }
.res-toc summary {
    cursor: pointer; list-style: none; display: flex; justify-content: space-between; align-items: center;
    min-height: 44px; font: 600 15px var(--r-body); color: var(--r-muted);
}
.res-toc summary::-webkit-details-marker { display: none; }
.res-toc summary::after { content: "+"; font: 400 24px var(--r-display); color: var(--r-blue); }
.res-toc[open] summary::after { content: "\2013"; }
.res-toc ol { list-style: none; margin: 0; padding: 0; counter-reset: res-toc; }
.res-toc li { counter-increment: res-toc; }
.res-toc li a {
    display: flex; gap: 12px; padding: 9px 0 9px 12px; border-top: 1px solid var(--r-line);
    color: var(--r-ink-2); text-decoration: none; font-size: 15px; line-height: 1.35;
    box-shadow: inset 3px 0 0 transparent;
}
.res-toc li a::before { content: counter(res-toc, decimal-leading-zero); flex: 0 0 22px; font-weight: 600; color: var(--r-muted); font-size: 13px; padding-top: 1px; }
.res-toc li a:hover { color: var(--r-blue); }
.res-toc li a[aria-current="location"] { color: var(--r-ink); font-weight: 600; box-shadow: inset 3px 0 0 var(--r-yellow); }

/* checklist */
.r-article .res-checklist { list-style: none; padding-left: 0; }
.res-checklist li { position: relative; padding-left: 34px; }
.res-checklist li::before {
    content: ""; position: absolute; left: 8px; top: 0.42em; width: 6px; height: 12px;
    border: solid var(--r-blue); border-width: 0 2.5px 2.5px 0; transform: rotate(45deg);
}

/* code */
.r-article pre {
    margin: 24px 0; padding: 18px 20px; overflow-x: auto; border-radius: 12px;
    background: var(--r-surface); border: 1px solid var(--r-line); color: var(--r-ink);
    font-size: 15px; line-height: 1.6;
}
.r-article pre code { font-family: ui-monospace, "SFMono-Regular", Consolas, monospace; }

/* comparison table (CMS guide) */
.res-table-wrap { overflow-x: auto; margin: 28px 0; background: var(--r-surface); border-radius: 14px; border: 1px solid var(--r-line); }
.res-table-wrap:focus-visible { outline: 3px solid var(--r-blue); outline-offset: 2px; }
.res-table { width: 100%; min-width: 560px; border-collapse: collapse; font-size: 16px; }
.res-table th, .res-table td { padding: 14px 18px; text-align: left; vertical-align: middle; color: var(--r-ink-2); }
.res-table thead th { font: 700 15px var(--r-body); color: var(--r-ink); border-bottom: 2px solid var(--r-ink); }
.res-table tbody tr + tr td { border-top: 1px solid var(--r-line); }
.res-table tbody td:first-child { font-weight: 600; color: var(--r-ink); }
.res-rate { display: inline-flex; gap: 5px; align-items: center; }
.res-rate i { width: 11px; height: 11px; border-radius: 50%; border: 1.5px solid var(--r-muted); }
.res-rate i.on { background: var(--r-blue); border-color: var(--r-blue); }

/* more guides */
.res-more ul { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 0 40px; }
.res-more li a {
    display: flex; justify-content: space-between; gap: 16px; align-items: center; min-height: 64px;
    border-top: 1px solid var(--r-line-strong); color: var(--r-ink); text-decoration: none; font: 600 19px var(--r-body);
}
.res-more li a::after { content: "\2192"; color: var(--r-blue); }
.res-more li a:hover { color: var(--r-blue); }
.res-more h2 { margin-bottom: 28px; }

/* closing call to action: a touch smaller than the kit default */
.res-end h2 { font-size: clamp(34px, 4.6vw, 56px); max-width: 14em; }
.res-end .r-btn-ghost-light { box-shadow: inset 0 0 0 1.5px #8B95A1; }

@media (max-width: 959px) {
    .res-body .r-article-aside { max-width: none; max-height: none; overflow: visible; flex-basis: 100%; }
    .res-body .r-article { flex-basis: 100%; }
}
@media (min-width: 960px) {
    .res-body .r-article { order: 1; }
    .res-body .r-article-aside { order: 2; }
}
@media (max-width: 899px) {
    .res-item { grid-template-columns: 1fr; gap: 10px; padding: 26px 0; }
    .res-item h2 { font-size: 26px; }
    .res-go { margin-top: 4px; }
}
@media (max-width: 720px) {
    .res-body { padding-bottom: 64px; }
    .res-body .r-article h2 { font-size: 27px; margin-top: 52px; }
    .res-body .r-article h3 { font-size: 21px; }
    .res-body .r-article p, .res-body .r-article li { font-size: 17px; }
    .res-index { padding-bottom: 64px; }
}
@media (prefers-reduced-motion: reduce) {
    .res-item, .res-go::after { transition: none; }
}
