/* Resources: article chrome: hero, meta, figure, contents rail, reading progress. Scoped to .resources-page.
   Loads after resources.css, so these rules win by order. Everything here is
   keyed to article-only elements (.res-hero, .res-contents, .res-progress,
   .res-top) and leaves the index page alone. */

/* ---- Hero --------------------------------------------------------------- */
.resources-page .res-hero { padding: clamp(60px, 8vw, 96px) 0 clamp(14px, 2.4vw, 28px); }
.resources-page .res-hero .res-article { max-width: 920px; text-align: center; }

.resources-page .res-hero .tool-breadcrumb {
  justify-content: center;
  margin-bottom: clamp(22px, 3vw, 30px);
  font-weight: 600;
}
.resources-page .res-hero .tool-breadcrumb a { padding-block: 4px; }
.resources-page .res-hero .tool-breadcrumb a:focus-visible {
  outline: 2px solid var(--focus-ring, #00437c);
  outline-offset: 3px;
  border-radius: 4px;
}

.resources-page .res-hero .res-topic {
  gap: 9px;
  padding: 7px 14px 7px 12px;
  border: 1px solid color-mix(in srgb, var(--blue) 24%, var(--surface, #fff));
  border-radius: 999px;
  background: color-mix(in srgb, var(--blue) 8%, var(--surface, #fff));
  font-size: 11.5px;
  letter-spacing: .13em;
  line-height: 1.2;
}

.resources-page .res-hero h1 {
  max-width: 21ch;
  margin: 20px auto 18px;
  font-size: clamp(34px, 5.4vw, 60px);
  text-wrap: balance;
}

.resources-page .res-hero .lede {
  max-width: 56ch;
  margin: 0 auto;
  font-size: clamp(17px, 1.7vw, 20px);
  text-wrap: balance;
}

/* Meta: a row of quiet chips with small stroke icons. */
.resources-page .res-hero .res-meta {
  justify-content: center;
  gap: 8px 10px;
  margin: 26px 0 0;
}
.res-meta-item {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 34px;
  padding: 0 14px 0 11px;
  border: 1px solid var(--atm-card-line, var(--line));
  border-radius: 999px;
  background: color-mix(in srgb, var(--surface, #fff) 78%, transparent);
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
  line-height: 1;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.res-meta-icon { flex: none; width: 16px; height: 16px; color: var(--blue-ink, #005a9e); }

/* The workspace figure sits in a soft frame with a faint glow behind it. */
.resources-page .res-hero .res-workspace {
  position: relative;
  max-width: 880px;
  margin: clamp(30px, 4.4vw, 46px) auto 0;
  padding: clamp(6px, 1vw, 10px);
  border: 1px solid var(--atm-card-line, var(--line));
  border-radius: clamp(16px, 2.2vw, 26px);
  background: linear-gradient(180deg,
    color-mix(in srgb, var(--surface, #fff) 86%, transparent),
    color-mix(in srgb, var(--surface-2, #f0f4f9) 70%, transparent));
  box-shadow:
    0 1px 0 rgba(255, 255, 255, .7) inset,
    0 2px 6px rgba(15, 23, 42, .05),
    0 36px 70px -34px color-mix(in srgb, var(--blue) 42%, transparent);
}
.resources-page .res-hero .res-workspace::before {
  content: "";
  position: absolute;
  inset: 10% 8% -6%;
  z-index: -1;
  border-radius: 50%;
  background: radial-gradient(closest-side, color-mix(in srgb, var(--blue) 20%, transparent), transparent);
  filter: blur(34px);
  pointer-events: none;
}
.resources-page .res-hero .res-workspace-shot {
  border-radius: clamp(11px, 1.6vw, 18px);
  box-shadow: 0 1px 2px rgba(15, 23, 42, .08);
}
.resources-page .res-hero .res-workspace figcaption {
  margin: 12px 8px 4px;
  text-align: center;
  font-size: 12px;
  text-wrap: balance;
}
html[data-site-theme="dark"] .resources-page .res-hero .res-workspace {
  border-color: rgba(124, 192, 255, .2);
  background: linear-gradient(180deg, rgba(255, 255, 255, .06), rgba(255, 255, 255, .02));
  box-shadow:
    0 1px 0 rgba(230, 237, 245, .08) inset,
    0 40px 80px -36px rgba(0, 0, 0, .8);
}
html[data-site-theme="dark"] .resources-page .res-hero .res-workspace::before {
  background: radial-gradient(closest-side, color-mix(in srgb, var(--blue) 30%, transparent), transparent);
}
html[data-site-theme="dark"] .resources-page .res-hero .res-workspace-shot {
  box-shadow: 0 1px 2px rgba(0, 0, 0, .5);
}
html[data-site-theme="dark"] .res-meta-item {
  background: rgba(255, 255, 255, .04);
}
html[data-site-theme="dark"] .resources-page .res-hero .res-topic {
  border-color: rgba(124, 192, 255, .3);
  background: rgba(124, 192, 255, .1);
}

/* ---- Contents rail ------------------------------------------------------- */
.resources-page .res-contents {
  display: block;
  padding: 0;
  border-radius: 18px;
  box-shadow: var(--atm-card-shadow, none);
}
.res-contents-details > summary {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 18px 20px 8px;
  list-style: none;
  cursor: default;
}
.res-contents-details > summary::-webkit-details-marker { display: none; }
.res-contents-title {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--quiet, var(--muted));
}
.res-contents-count,
.res-contents-chevron { display: none; }

.resources-page .res-contents-list {
  --res-fill: 0px;
  position: relative;
  display: grid;
  gap: 2px;
  margin: 0;
  padding: 4px 14px 16px 24px;
  list-style: none;
}
/* The track runs behind the dots; the fill reaches down to the section you are in. */
.resources-page .res-contents-list::before,
.resources-page .res-contents-list::after {
  content: "";
  box-sizing: border-box;
  position: absolute;
  left: 24px;
  top: 0;
  bottom: 0;
  width: 2px;
  border-radius: 2px;
  -webkit-mask-image: linear-gradient(180deg, transparent, #000 14px, #000 calc(100% - 14px), transparent);
  mask-image: linear-gradient(180deg, transparent, #000 14px, #000 calc(100% - 14px), transparent);
}
.resources-page .res-contents-list::before { background: var(--line-strong-soft, color-mix(in srgb, var(--ink) 14%, transparent)); }
.resources-page .res-contents-list::after {
  bottom: auto;
  height: var(--res-fill);
  background: var(--blue);
  transition: height .28s ease;
}
.resources-page .res-contents-list li { position: relative; margin: 0; }
.resources-page .res-contents .res-contents-list a {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  margin: 0;
  padding: 8px 12px 8px 22px;
  border-radius: 10px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.4;
  text-decoration: none;
  transition: background-color .18s ease, color .18s ease;
}
.res-contents-num {
  flex: none;
  min-width: 1.7em;
  color: var(--quiet, var(--muted));
  font-size: 11px;
  font-weight: 750;
  letter-spacing: .04em;
  font-variant-numeric: tabular-nums;
  transition: color .18s ease;
}
.res-contents-label { min-width: 0; text-wrap: pretty; }
/* A dot per section sits on the track. */
.res-contents-list a::before {
  content: "";
  box-sizing: border-box;
  position: absolute;
  left: -4.5px;
  top: 50%;
  width: 11px;
  height: 11px;
  margin-top: -5.5px;
  border: 2px solid color-mix(in srgb, var(--ink) 22%, var(--surface, #fff));
  border-radius: 50%;
  background: var(--surface, #fff);
  transition: border-color .2s ease, background-color .2s ease, box-shadow .2s ease;
}
.res-contents-list a.is-passed::before { border-color: var(--blue); background: var(--blue); }
.res-contents-list a.is-active::before {
  border-color: var(--blue);
  background: var(--surface, #fff);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--blue) 20%, transparent);
}
.resources-page .res-contents .res-contents-list a:is(:hover, :focus-visible) {
  color: var(--blue-ink, #005a9e);
  background: color-mix(in srgb, var(--blue, #0067c0) 8%, var(--surface, #fff));
}
.resources-page .res-contents .res-contents-list a.is-active {
  color: var(--ink);
  font-weight: 750;
  background: color-mix(in srgb, var(--blue, #0067c0) 10%, var(--surface, #fff));
}
.res-contents-list a.is-active .res-contents-num { color: var(--blue-ink, #005a9e); }
.resources-page .res-contents .res-contents-list a:focus-visible,
.res-contents-details > summary:focus-visible {
  outline: 2px solid var(--focus-ring, #00437c);
  outline-offset: 2px;
  border-radius: 10px;
}
html[data-site-theme="dark"] .resources-page .res-contents .res-contents-list a:is(:hover, :focus-visible),
html[data-site-theme="dark"] .resources-page .res-contents .res-contents-list a.is-active {
  background: rgba(124, 192, 255, .12);
}
html[data-site-theme="dark"] .res-contents-list a::before {
  border-color: rgba(230, 237, 245, .3);
  background: var(--surface, #0f1722);
}
html[data-site-theme="dark"] .res-contents-list a.is-passed::before { border-color: var(--blue); background: var(--blue); }
html[data-site-theme="dark"] .res-contents-list a.is-active::before { border-color: var(--blue); background: var(--surface, #0f1722); }
html[data-site-theme="dark"] .resources-page .res-contents-list::before { background: rgba(230, 237, 245, .16); }

/* ---- Narrow screens: the rail folds shut -------------------------------- */
@media (max-width: 980px) {
  .res-contents-details > summary {
    min-height: 56px;
    padding: 12px 16px 12px 18px;
    cursor: pointer;
  }
  .res-contents-title { color: var(--ink); letter-spacing: .1em; }
  .res-contents-count {
    display: inline;
    margin-left: auto;
    color: var(--muted);
    font-size: 13px;
    font-weight: 600;
  }
  .res-contents-chevron {
    display: block;
    flex: none;
    color: var(--blue-ink, #005a9e);
    transition: transform .22s ease;
  }
  .res-contents-details[open] > summary .res-contents-chevron { transform: rotate(180deg); }
  .resources-page .res-contents-list { padding: 2px 10px 14px 20px; }
  .resources-page .res-contents-list::before,
  .resources-page .res-contents-list::after { left: 20px; }
}

/* ---- Reading aids -------------------------------------------------------- */
.res-progress {
  position: fixed;
  inset: 0 0 auto;
  z-index: 60;
  height: 3px;
  pointer-events: none;
  opacity: 0;
  transition: opacity .2s ease;
}
.res-progress.is-on { opacity: 1; }
.res-progress > span {
  display: block;
  height: 100%;
  border-radius: 0 3px 3px 0;
  background: linear-gradient(90deg, var(--blue), color-mix(in srgb, var(--blue) 55%, #7cc0ff));
  transform-origin: 0 50%;
  transform: scaleX(var(--res-progress, 0));
}

.res-top {
  position: fixed;
  right: max(16px, env(safe-area-inset-right));
  bottom: max(18px, env(safe-area-inset-bottom));
  z-index: 40;
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  padding: 0;
  border: 1px solid var(--atm-card-line, var(--line));
  border-radius: 50%;
  background: var(--surface, #fff);
  color: var(--blue-ink, #005a9e);
  box-shadow: 0 10px 28px -10px rgba(15, 23, 42, .35), 0 1px 3px rgba(15, 23, 42, .1);
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  transition: opacity .22s ease, transform .22s ease, visibility 0s linear .22s, border-color .18s ease, background-color .18s ease;
}
.res-top.is-visible {
  opacity: 1;
  visibility: visible;
  transform: none;
  transition-delay: 0s;
}
.res-top:hover {
  border-color: var(--line-strong);
  background: color-mix(in srgb, var(--blue) 8%, var(--surface, #fff));
}
.res-top:focus-visible {
  outline: 2px solid var(--focus-ring, #00437c);
  outline-offset: 3px;
}
html[data-site-theme="dark"] .res-top {
  border-color: rgba(124, 192, 255, .3);
  box-shadow: 0 12px 30px -10px rgba(0, 0, 0, .8);
}

/* ---- Small screens -------------------------------------------------------- */
@media (max-width: 560px) {
  .resources-page .res-hero { padding-top: 56px; }
  .resources-page .res-hero .res-meta { margin-top: 22px; }
  .res-meta-item { min-height: 32px; padding: 0 12px 0 10px; font-size: 12.5px; }
  .resources-page .res-hero .res-workspace { border-radius: 14px; padding: 5px; }
  .resources-page .res-hero .res-workspace figcaption { margin: 10px 6px 3px; }
}

@media (prefers-reduced-motion: reduce) {
  .res-progress,
  .res-top,
  .res-contents-chevron,
  .res-contents-list::after,
  .res-contents-list a,
  .res-contents-list a::before,
  .res-contents-num { transition: none; }
}
@media print {
  .res-progress, .res-top { display: none; }
}
