/* ==========================================================================
   study/resources/style.css — 学习资源导航 (2026-10-13a)
   Layer 3 of 3. Loads after tokens.css + frame.css; page layout only, all
   colors / type / spacing / motion come from tokens.css variables. Sharp
   corners everywhere (radius 0), hairline dividers, catalogue numbering
   01-22 continuous across sections. No JS on this page: fully static.

   Contents:
     1. Light chrome (back-link bar)
     2. Hero (kicker / giant title / lede / data note)
     3. TOC strip
     4. Sections (sec-head row + catalogue list)
     5. Entry row (num / name / desc / meta: stars, badge, tags)
     6. Badges (可改写 orange slab / 仅外链 ink stroke)
     7. Footer ink slab (thanks + cross-link)
   ========================================================================== */

/* ---- 1. Light chrome ------------------------------------------------------ */
.res-top {
  border-bottom: 1px solid var(--border-color);
}

.res-top-in {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  padding-block: var(--space-4);
}

.res-back a {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  letter-spacing: 0.08em;
  text-decoration: none;
}

.res-back a:hover {
  text-decoration: underline;
  text-decoration-thickness: 1px;
}

.res-top-meta {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  letter-spacing: 0.12em;
  color: var(--text-faint);
  white-space: nowrap;
}

@media (max-width: 479px) {
  .res-top-meta {
    display: none; /* 375px 级别只留返回链，防挤压 */
  }
}

/* ---- 2. Hero ---------------------------------------------------------------- */
.res-hero {
  padding-top: var(--space-12);
}

.res-kicker {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  letter-spacing: 0.12em;
  color: var(--text-dim);
}

/* The one spot of signal color: a small accent square leads the kicker. */
.res-kicker::before {
  content: "";
  display: inline-block;
  width: 0.5em;
  height: 0.5em;
  margin-right: var(--space-2);
  background: var(--accent);
}

.res-title {
  margin-top: var(--space-4);
  font-family: var(--font-display);
  font-weight: 900;
  font-size: clamp(2.75rem, 1.5rem + 6vw, 5.5rem); /* 44 -> 88px, 360->1140 */
  line-height: 1.02;
  letter-spacing: 0.01em;
  text-wrap: balance;
  color: var(--text);
}

.res-lede {
  margin-top: var(--space-4);
  max-width: 36em;
  font-size: var(--text-md);
  line-height: var(--leading-body);
  color: var(--text);
}

.res-note {
  margin-top: var(--space-4);
  max-width: 46em;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  line-height: var(--leading-mono);
  color: var(--text-dim);
}

/* ---- 3. TOC strip ------------------------------------------------------------ */
.res-toc {
  margin-top: var(--space-8);
  border-block: 1px solid var(--border-color);
}

.res-toc-list {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2) var(--space-6);
  margin: 0;
  padding: var(--space-3) 0;
  list-style: none;
}

.res-toc-list a {
  display: inline-flex;
  align-items: baseline;
  gap: var(--space-2);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  letter-spacing: 0.08em;
  text-decoration: none;
  color: var(--text);
}

.res-toc-list a:hover {
  color: var(--accent-dim);
  text-decoration: underline;
  text-decoration-thickness: 1px;
}

.res-toc-count {
  color: var(--text-faint);
}

.res-toc-count::before {
  content: "×";
  margin-right: 1px;
}

/* ---- 4. Sections --------------------------------------------------------------- */
.res-sec {
  margin-top: var(--space-section);
}

.res-sec-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-4);
}

.res-sec-count {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  letter-spacing: 0.12em;
  color: var(--text-dim);
  white-space: nowrap;
}

/* ---- 5. Entry rows: the catalogue ---------------------------------------------- */
.res-list {
  margin-top: var(--space-6);
  padding: 0;
  list-style: none;
  border-bottom: 1px solid var(--border-color);
}

.res-item {
  display: grid;
  grid-template-areas:
    "num"
    "main"
    "meta";
  gap: var(--space-3);
  padding-block: var(--space-6);
  border-top: 1px solid var(--border-color);
}

.res-item-num {
  grid-area: num;
}

.res-item-main {
  grid-area: main;
}

.res-item-meta {
  grid-area: meta;
}

.res-item-name {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: clamp(1.25rem, 1.1rem + 0.8vw, 1.75rem); /* 20 -> 28px */
  line-height: var(--leading-tight);
  overflow-wrap: anywhere; /* 长仓库名在窄屏也不断版 */
}

.res-item-name a {
  text-decoration-thickness: 1px;
}

.res-ext {
  color: var(--accent-dim);
  font-family: var(--font-mono);
  font-weight: 400;
}

.res-item-desc {
  margin-top: var(--space-2);
  max-width: 62ch;
  color: var(--text-dim);
}

.res-item-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2) var(--space-3);
}

.res-stars {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  letter-spacing: 0.04em;
  color: var(--text);
  white-space: nowrap;
}

/* Desktop: number | main | meta columns, one line per entry. */
@media (min-width: 880px) {
  .res-item {
    grid-template-columns: 4rem minmax(0, 1fr) 15rem;
    grid-template-areas:
      "num main meta"
      "num main meta";
    column-gap: var(--space-8);
  }

  .res-item-num {
    padding-top: 0.35em; /* 与 Archivo Black 首行大写齐平 */
  }

  .res-item-meta {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-2);
  }
}

/* ---- 6. Badges --------------------------------------------------------------------
   可改写: permissive license (MIT / Apache-2.0...) — orange slab, white ink.
   仅外链: no license / non-commercial — transparent, ink stroke. Radius 0. */
.badge {
  display: inline-block;
  padding: var(--space-1) var(--space-3);
  border: 1px solid transparent;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.08em;
  line-height: var(--leading-mono);
  white-space: nowrap;
}

.badge--rewritable {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-accent);
}

.badge--linkonly {
  border-color: var(--border-strong);
  color: var(--text);
}

.res-tags {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  letter-spacing: 0.04em;
  color: var(--text-dim);
}

/* ---- 7. Footer: ink slab ------------------------------------------------------ */
.res-footer {
  margin-top: var(--space-section);
  background: var(--border-strong);
  color: var(--bg);
}

.res-footer-in {
  display: grid;
  gap: var(--space-6);
  padding-block: var(--space-12);
}

.res-footer-thanks {
  max-width: 36em;
  font-size: var(--text-md);
  line-height: var(--leading-body);
  color: var(--bg);
}

.res-footer-cta {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: var(--space-2) var(--space-3);
  font-family: var(--font-mono);
  font-size: var(--text-base);
  color: var(--bg);
}

.res-footer-label {
  font-size: var(--text-xs);
  letter-spacing: 0.12em;
  color: var(--accent);
}

.res-footer-cta a {
  color: var(--bg);
  text-decoration-thickness: 1px;
}

/* 橙红在墨底上是站点页脚的惯用反白信号；下划线同步加粗。 */
.res-footer-cta a:hover {
  color: var(--accent);
  text-decoration-thickness: 2px;
}
