/* ==========================================================================
   Resources page (/resources). Every selector is prefixed .res / .res-.
   Uses the site tokens: warm paper, flat cards, 1px hairlines, 12px radius.
   ========================================================================== */
.res { padding-top: 28px; padding-bottom: 8px; min-width: 0; }
.res *, .res *::before, .res *::after { min-width: 0; }
.res-head { max-width: 780px; }
.res-h1 { font: 700 clamp(1.9rem, 5.4vw, 2.9rem)/1.05 var(--display); letter-spacing: -.03em; margin: 6px 0 12px; color: var(--ink); }
.res-lede { font-size: 1.05rem; line-height: 1.6; color: var(--ink); }
.res-credit { margin-top: 10px; font: 500 .78rem/1.55 var(--mono); color: var(--muted); padding: 10px 12px; border: 1px dashed var(--line-strong); border-radius: 10px; }
.res-jump { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 16px; }
.res-jump a { font: 600 .8rem/1 var(--mono); letter-spacing: .03em; color: var(--primary-ink); text-decoration: none; padding: 6px 0; border-bottom: 1px solid transparent; }
.res-jump a:hover { border-bottom-color: var(--primary); }

.res-sec { margin-top: 40px; scroll-margin-top: 76px; }
.res-sec[hidden] { display: none; }
.res-sec-head { display: grid; gap: 4px; margin-bottom: 14px; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.res-h2 { font: 700 clamp(1.35rem, 3.6vw, 1.7rem)/1.15 var(--display); letter-spacing: -.02em; color: var(--ink); }
.res-sec-sub { font-size: .92rem; color: var(--muted); line-height: 1.5; }
.res-k, .res-f-k, .res-col-k { font: 600 .7rem/1.3 var(--mono); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.res-empty { padding: 22px 18px; border: 1px dashed var(--line-strong); border-radius: 12px; color: var(--muted); font-size: .92rem; grid-column: 1 / -1; }

/* study paths */
.res-cols { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 250px), 1fr)); gap: 12px; }
.res-col { display: grid; gap: 8px; align-content: start; padding: 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--card); color: var(--ink); }
.res-col.is-open { border-color: var(--primary); }
.res-col-t { font: 650 1.08rem/1.25 var(--display); letter-spacing: -.01em; }
.res-col-b { font-size: .88rem; line-height: 1.5; color: var(--muted); }
.res-col .btn { justify-self: start; margin-top: 4px; }
.res-bar { height: 4px; border-radius: 4px; background: var(--bg2); overflow: hidden; }
.res-bar i { display: block; height: 100%; background: var(--primary); }
.res-path { margin-top: 14px; padding: 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--card); }
.res-path-h { font: 650 1.05rem/1.3 var(--display); margin-bottom: 8px; }
.res-steps { list-style: none; margin: 0; padding: 0; counter-reset: rs; display: grid; }
.res-steps li { counter-increment: rs; display: grid; grid-template-columns: 30px 28px minmax(0, 1fr); gap: 6px; align-items: start; padding: 12px 0; border-top: 1px solid var(--line); }
.res-steps li:first-child { border-top: 0; }
.res-steps li::before { content: counter(rs, decimal-leading-zero); font: 600 .78rem/1.9 var(--mono); color: var(--muted); }
.res-steps li.is-done .res-step-t a { text-decoration: line-through; color: var(--muted); }
.res-step-cb input { width: 18px; height: 18px; margin-top: 3px; accent-color: var(--primary); }
.res-step-m { display: grid; gap: 3px; }
.res-step-t { font-weight: 650; line-height: 1.35; overflow-wrap: anywhere; }
.res-step-t a { color: var(--ink); text-decoration-color: var(--line-strong); text-underline-offset: 3px; }
.res-step-ty { font: 500 .72rem/1 var(--mono); color: var(--muted); white-space: normal; }
.res-step-by { font-size: .82rem; color: var(--muted); }
.res-step-w { font-size: .9rem; line-height: 1.5; }
.res-step-more { font: 600 .74rem/1.4 var(--mono); color: var(--primary-ink); text-decoration: none; justify-self: start; }

/* filters */
.res-filters { margin-top: 40px; padding: 14px 16px 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--card); display: grid; gap: 6px; }
.res-search-row { display: flex; flex-wrap: wrap; gap: 8px 10px; align-items: center; margin-bottom: 4px; }
.res-search { flex: 1 1 220px; max-width: none; }
.res-count { font: 500 .78rem/1 var(--mono); color: var(--muted); margin-left: auto; }
.res-f-k { margin-top: 6px; }
.res-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.res-chips .chip { padding: .32em .8em; font-size: .84rem; }
@media (max-width: 720px) {
  .res-chips { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; -webkit-mask-image: linear-gradient(90deg, #000 88%, transparent); mask-image: linear-gradient(90deg, #000 88%, transparent); }
  .res-chips::-webkit-scrollbar { display: none; }
  .res-chips .chip { flex: none; }
  .res-count { margin-left: 0; }
}

/* shared card pieces */
.res-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; font: 500 .72rem/1.4 var(--mono); color: var(--muted); }
.res-badge { font: 600 .68rem/1 var(--mono); letter-spacing: .05em; text-transform: uppercase; color: var(--primary-ink); padding: 4px 7px; border: 1px solid color-mix(in srgb, var(--primary) 35%, var(--line)); border-radius: 6px; background: color-mix(in srgb, var(--primary) 7%, var(--card)); }
.res-title { font: 650 1.05rem/1.3 var(--display); letter-spacing: -.01em; overflow-wrap: anywhere; }
.res-title a { color: var(--ink); text-decoration: none; }
.res-title a:hover { text-decoration: underline; text-decoration-color: var(--primary); text-underline-offset: 3px; }
.res-by { font-size: .86rem; color: var(--muted); }
.res-by b, .res-by-link { color: var(--ink); font-weight: 650; }
.res-by-link { text-decoration: underline; text-decoration-color: var(--line-strong); text-underline-offset: 3px; }
.res-by-link:hover { text-decoration-color: var(--primary); }
.res-sum { font-size: .92rem; line-height: 1.55; color: var(--ink); }
.res-use { font-size: .9rem; line-height: 1.5; color: var(--ink); }
.res-use .res-k, .res-rel .res-k { margin-right: 6px; color: var(--primary-ink); }
.res-use a, .res-rel a { color: var(--primary-ink); text-underline-offset: 3px; }
.res-rel { font-size: .86rem; line-height: 1.6; }
.res-tags { display: flex; flex-wrap: wrap; gap: 4px; }
.res-tag { font: 500 .7rem/1 var(--mono); color: var(--muted); padding: 4px 6px; border-radius: 6px; background: var(--bg2); }
.res-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: auto; padding-top: 10px; border-top: 1px solid var(--line); }
.res-actions .btn { white-space: nowrap; }
.res-save { display: inline-flex; align-items: center; gap: 5px; border: 1px solid var(--line-strong); background: transparent; color: var(--muted); font: 600 .82rem/1 var(--body); cursor: pointer; padding: 7px 10px; border-radius: 8px; }
.res-save svg { width: 15px; height: 15px; }
.res-save[aria-pressed="true"] { color: var(--primary-ink); border-color: var(--primary); }
.res-save[aria-pressed="true"] path { fill: currentColor; }
.res-done { display: inline-flex; align-items: center; gap: 6px; font-size: .84rem; color: var(--muted); cursor: pointer; }
.res-done input { width: 16px; height: 16px; accent-color: var(--primary); }

/* library grid */
.res-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 330px), 1fr)); gap: 12px; }
.res-card { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 12px; background: var(--card); overflow: hidden; scroll-margin-top: 76px; }
.res-card:hover { border-color: var(--line-strong); }
.res-card.is-done { border-color: color-mix(in srgb, var(--primary) 45%, var(--line)); }
.res-card.is-done .res-title a { color: var(--muted); }
.res-body { display: flex; flex-direction: column; gap: 8px; padding: 14px 16px 14px; flex: 1; }

/* YouTube preview: fixed 16:9 box so swapping in the iframe causes no layout shift */
.res-media { border-bottom: 1px solid var(--line); }
.res-frame { position: relative; aspect-ratio: 16 / 9; background: var(--bg2); overflow: hidden; }
.res-frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; display: block; }
.res-play { position: absolute; inset: 0; display: block; width: 100%; height: 100%; padding: 0; border: 0; background: transparent; cursor: pointer; color: inherit; font: inherit; }
.res-play img { width: 100%; height: 100%; object-fit: cover; display: block; }
.res-play-ic { position: absolute; left: 50%; top: 50%; width: 56px; height: 56px; margin: -28px 0 0 -28px; display: grid; place-items: center; border-radius: 50%; background: rgba(12, 21, 17, .78); color: #fff; border: 1px solid rgba(255,255,255,.35); transition: transform .12s ease, background .12s ease; }
.res-play-ic svg { width: 24px; height: 24px; margin-left: 3px; }
.res-play:hover .res-play-ic, .res-play:focus-visible .res-play-ic { transform: scale(1.06); background: var(--primary); color: var(--on-primary); }
.res-play:focus-visible { outline: 2px solid var(--primary); outline-offset: -4px; }
.res-ph { position: absolute; inset: 0; display: grid; align-content: end; gap: 4px; padding: 14px 16px; text-align: left; color: var(--ink);
  background: repeating-linear-gradient(135deg, transparent 0 10px, color-mix(in srgb, var(--ink) 4%, transparent) 10px 11px), var(--bg2); }
.res-ph-k { font: 600 .68rem/1 var(--mono); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.res-ph-t { font: 650 1.05rem/1.2 var(--display); letter-spacing: -.01em; padding-right: 64px; }
.res-media-note { font: 500 .7rem/1.5 var(--mono); color: var(--muted); padding: 6px 16px 7px; overflow-wrap: anywhere; }
.res-media-note a { color: var(--primary-ink); }

/* podcasts */
.res-pods { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 330px), 1fr)); gap: 12px; }
.res-pod { display: flex; flex-direction: column; gap: 8px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--card); scroll-margin-top: 76px; }
.res-eps { display: grid; gap: 4px; padding: 10px 12px; border-radius: 10px; background: var(--bg2); }
.res-eps ol { margin: 0; padding-left: 1.2em; display: grid; gap: 8px; }
.res-eps li { font-size: .88rem; line-height: 1.45; overflow-wrap: anywhere; }
.res-eps li::marker { color: var(--primary); font-weight: 700; }
.res-eps a { font-weight: 650; color: var(--ink); text-underline-offset: 3px; text-decoration-color: var(--line-strong); }
.res-eps span { display: block; color: var(--muted); font-size: .84rem; margin-top: 2px; }

/* news */
.res-news-g + .res-news-g { margin-top: 18px; }
.res-news-gh { font: 600 .74rem/1.2 var(--mono); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin-bottom: 6px; }
.res-news { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 330px), 1fr)); gap: 0 18px; border-top: 1px solid var(--line); }
.res-news-i { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; align-items: start; padding: 12px 0; border-bottom: 1px solid var(--line); scroll-margin-top: 76px; }
.res-news-main { display: grid; gap: 3px; }
.res-news-h { font: 650 1rem/1.3 var(--display); overflow-wrap: anywhere; }
.res-news-h a { color: var(--ink); text-decoration: none; }
.res-news-h a:hover { text-decoration: underline; text-decoration-color: var(--primary); text-underline-offset: 3px; }
.res-news-by { font-size: .8rem; color: var(--muted); }
.res-news-i .res-sum, .res-news-i .res-use { font-size: .86rem; }
.res-acc { display: inline-block; vertical-align: 2px; margin-left: 4px; font: 600 .64rem/1 var(--mono); letter-spacing: .05em; text-transform: uppercase; padding: 3px 6px; border-radius: 6px; border: 1px solid var(--line-strong); color: var(--muted); }
.res-acc-free { color: var(--primary-ink); border-color: color-mix(in srgb, var(--primary) 40%, var(--line)); }
.res-acc-paywalled { color: var(--accent-ink, var(--ink)); border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); }

/* creators */
.res-creators { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr)); gap: 10px; }
.res-creators li { display: grid; gap: 4px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--card); font-size: .88rem; line-height: 1.5; color: var(--muted); }
.res-cr-n { font: 650 .98rem/1.3 var(--display); color: var(--ink); text-decoration: none; }
.res-cr-n:hover { text-decoration: underline; text-decoration-color: var(--primary); text-underline-offset: 3px; }

.res + .kb-note, .res .kb-note { padding-left: 0; padding-right: 0; margin-top: 32px; }
@media (prefers-reduced-motion: reduce) { .res-play-ic { transition: none; } }
