/* Four editorial covers share the same proportions as a set of field manuals. */
.guide-library {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: clamp(14px, 2vw, 28px);
  align-items: stretch;
}
.guide-library > :not(.guide-card) { grid-column: 1 / -1; }
.guide-card {
  display: flex;
  flex-direction: column;
  min-width: 0;
  border-radius: 14px;
  color: var(--kx-ink);
  text-decoration: none;
}
.guide-card:focus-visible, .guide-article a:focus-visible {
  outline: 2px solid #ffb26b;
  outline-offset: 4px;
}
.guide-cover {
  --tone: #ed9d70;
  --deep: #42242a;
  position: relative;
  display: grid;
  place-items: center;
  isolation: isolate;
  overflow: hidden;
  aspect-ratio: 1.42;
  color: var(--tone);
  font-size: clamp(15px, 1.4vw, 20px);
  border-radius: 12px;
  background: radial-gradient(ellipse at 67% 0%, color-mix(in srgb, var(--tone) 34%, var(--deep)), transparent 72%), var(--deep);
  box-shadow: inset 0 0 0 1px #ffffff21, inset 0 1px #ffffff28;
}
.guide-cover::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  opacity: .42;
  background-image: radial-gradient(#ffffff45 .7px, transparent .9px);
  background-size: 6px 6px;
  mask-image: linear-gradient(135deg, transparent, black);
}
.guide-cover[data-cover=steps] { --tone: #b3a6ff; --deep: #29253e; }
.guide-cover[data-cover=layers] { --tone: #7cd8ce; --deep: #163635; }
.guide-cover[data-cover=console] { --tone: #83bfff; --deep: #192f48; }
.guide-symbol {
  display: grid;
  position: relative;
  width: 6em;
  height: 5em;
  place-items: center;
  filter: drop-shadow(0 .48em .4em #0006);
}
.guide-symbol i { display: block; position: absolute; }
[data-cover=compass] .guide-symbol {
  width: 5em;
  height: 5em;
  border: .12em solid currentColor;
  border-radius: 50%;
  background: repeating-conic-gradient(from -1deg, #ffe7d7aa 0deg 1.5deg, transparent 1.5deg 15deg);
  box-shadow: inset 0 0 0 .2em var(--deep), .12em .17em #290f12;
  transform: rotate(-14deg);
}
[data-cover=compass] i:first-child { inset: .47em; border-radius: 50%; background: var(--deep); border: 1px solid #ffffff38; }
[data-cover=compass] i:nth-child(2) { width: 1.35em; height: 3.7em; background: linear-gradient(115deg,#fff0da 45%,var(--tone) 46% 57%,#b33616); clip-path: polygon(50% 0,100% 50%,50% 100%,0 50%); transform: rotate(45deg); }
[data-cover=compass] i:last-child { width: .35em; height: .35em; border-radius: 50%; background: #ffe2ce; }
[data-cover=steps] i, [data-cover=layers] i, [data-cover=book] i {
  width: 3.5em; height: 2.6em;
  border-radius: .25em;
  border: 1px solid color-mix(in srgb, var(--tone) 72%, white);
  background: linear-gradient(140deg, var(--tone), color-mix(in srgb, var(--tone) 20%, var(--deep)));
  box-shadow: .12em .22em var(--deep), .16em .26em currentColor;
  transform: rotate(-32deg) skewX(15deg);
}
[data-cover=steps] i { width: 2.2em; height: 2.15em; }
[data-cover=steps] i:first-child { translate: -1.7em 1.05em; }
[data-cover=steps] i:last-child { translate: 1.7em -1.05em; }
[data-cover=layers] i:first-child, [data-cover=book] i:first-child { translate: 0 1em; }
[data-cover=layers] i:last-child, [data-cover=book] i:last-child { translate: 0 -1em; }
[data-cover=layers] i:last-child::after, [data-cover=book] i:last-child::after {
  content: ""; position: absolute; inset: 25% 18%;
  background: repeating-linear-gradient(transparent 0 24%, #17423e99 24% 33%);
}
[data-cover=console] .guide-symbol {
  width: 5.8em; height: 4.1em; border: .1em solid currentColor; border-radius: .45em;
  background: linear-gradient(140deg,#294768,#122331); box-shadow: .12em .2em #0a182b;
  transform: perspective(9em) rotateY(-17deg) rotateZ(-7deg);
}
[data-cover=console] i:first-child { inset: 0 0 auto; height: .8em; border-bottom: 1px solid #83bfff80; background: radial-gradient(circle at .45em 50%,currentColor .09em,transparent .11em); }
[data-cover=console] i:nth-child(2) { width: .75em; height: .75em; left: 22%; top: 46%; border: solid currentColor; border-width: .18em .18em 0 0; transform: rotate(45deg); }
[data-cover=console] i:last-child { width: 1.15em; height: .17em; left: 48%; top: 68%; background: currentColor; }
.guide-caption { position: relative; padding: 16px 26px 12px 1px; }
.guide-caption h3 { margin: 0; font: 540 clamp(16px, 1.4vw, 20px)/1.55 var(--kx-font); text-wrap: pretty; }
.guide-caption p { color: var(--kx-muted); font: var(--kx-body); }
.guide-arrow { position: absolute; right: 2px; top: 17px; color: #a7a7af; font: 18px/1.5 var(--kx-font); }
body[data-page=field-guide] { --muted: var(--kx-muted); --text: var(--kx-ink); --border: var(--kx-border); --accent: #ffb775; }
.guide-mast { display: grid; justify-items: center; text-align: center; gap: clamp(18px, 3vw, 32px); padding: clamp(30px, 6vw, 80px) 0; border-bottom: 1px solid var(--kx-border); }
.guide-mast > div { max-width: 52rem; }
.guide-mast p { font: var(--kx-lead); color: var(--kx-muted); margin: 12px auto 0; }
.guide-mast .guide-cover { width: min(100%, 42rem); height: clamp(100px, 12vw, 150px); aspect-ratio: auto; }
.guide-series { font: var(--kx-control); color: var(--kx-muted); }
.guide-series::before { content: "←"; margin-inline-end: .55em; }
.guide-mast h1 { margin: 18px 0 0; font: 550 clamp(30px, 4vw, 54px)/1.22 var(--kx-font); letter-spacing: -.03em; text-wrap: balance; }
.guide-reading { margin-top: clamp(26px, 5vw, 66px); display: flex; gap: clamp(32px, 7vw, 96px); align-items: start; }
.guide-contents { position: sticky; top: 30px; flex: 0 0 21%; font: var(--kx-control); }
.guide-contents strong { font-weight: 600; }
.guide-contents ol { list-style: none; padding: 0 0 0 14px; margin: 14px 0; border-inline-start: 1px solid var(--kx-border); }
.guide-contents a { display: block; color: var(--kx-muted); padding: 7px 0; }
.guide-contents a:hover, .guide-series:hover { color: white; }
.guide-reading .rich-body { min-width: 0; width: 100%; max-width: 44rem; line-height: 1.95; color: #ceced2; font-size: 17px; }
.guide-reading h2 { color: var(--kx-ink); font: 550 clamp(22px, 2vw, 29px)/1.45 var(--kx-font); scroll-margin: 32px; }
.guide-reading .rich-body > :first-child { margin-top: 0; }
@media (max-width: 960px) { .guide-library { grid-template-columns: repeat(2,minmax(0,1fr)); } }
@media (max-width: 640px) {
  .guide-library { grid-template-columns: minmax(0,1fr); gap: 0; }
  .guide-card { display: grid; grid-template-columns: min(28%,118px) minmax(0,1fr); gap: 16px; align-items: center; padding: 15px 0; border-top: 1px solid var(--kx-border); border-radius: 0; }
  .guide-cover { font-size: clamp(10px, 2.8vw, 13px); border-radius: 9px; }
  .guide-caption { padding: 0 18px 0 0; }
  .guide-arrow { inset: 0 0 auto auto; font-size: 15px; }
  .guide-mast .guide-cover { font-size: 14px; }
  .guide-reading { display: block; }
  .guide-contents { position: static; margin-bottom: 32px; }
}
@media (prefers-reduced-motion: no-preference) {
  .guide-symbol, .guide-arrow { transition: translate 240ms ease, scale 320ms ease; }
  .guide-card:is(:hover,:focus-visible) .guide-symbol { translate: 0 -3px; scale: 1.07; }
  .guide-card:is(:hover,:focus-visible) .guide-arrow { translate: 3px 0; color: white; }
  @supports (animation-timeline: view()) {
    .guide-card { animation: guide-arrive linear both; animation-timeline: view(); animation-range: entry 0% entry 85%; }
    @keyframes guide-arrive { from { transform: translateY(10px); opacity: .76; } to { transform: none; opacity: 1; } }
  }
}

/* Source-backed examples sit alongside the method they illustrate. */
.guide-example { margin: 1.35rem 0 2rem; padding: 1rem 1.2rem; border-inline-start: 2px solid #b4815e; background: var(--kx-panel); border-radius: 0 8px 8px 0; }
.guide-example p { margin: 0; }
.guide-example p + p { margin-top: .65em; }
.guide-example strong { color: var(--kx-ink); font-size: .91em; margin-inline-end: .4em; }
.guide-example .guide-citation { color: var(--kx-muted); font: var(--kx-meta); line-height: 1.7; overflow-wrap: anywhere; }
.guide-citation time { white-space: nowrap; }
@media (prefers-reduced-motion: no-preference) {
  .guide-example { transition: border-color 180ms ease; }
  .guide-example:is(:hover,:focus-within) { border-color: #ffb775; }
}

.guide-case-list { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; margin: 0 0 clamp(24px,4vw,44px); }
.guide-case-link { position: relative; display: block; min-width: 0; border: 1px solid var(--kx-border); border-radius: 12px; padding: 18px 38px 20px 20px; color: var(--kx-ink); background: var(--kx-panel); box-shadow: var(--kx-edge); text-decoration: none; }
.guide-case-link .case-byline { color: var(--kx-muted); font: var(--kx-meta); }
.guide-case-link h3 { margin: 7px 0 0; font: var(--kx-title); overflow-wrap: anywhere; }
.guide-case-link .guide-arrow { right: 14px; top: 18px; }
.guide-case-link:focus-visible { outline: 2px solid #ffb775; outline-offset: 3px; }
.guide-reading .guide-example { margin-inline: 0; scroll-margin-top: 32px; }
.guide-example h3 { margin: 0 0 .6em; font: var(--kx-title); color: var(--kx-ink); }
.guide-example p:last-child { color: var(--kx-muted); font: var(--kx-meta); }
@media(max-width: 700px) { .guide-case-list { grid-template-columns: 1fr; } }
@media(prefers-reduced-motion: no-preference) {
  .guide-case-link { transition: transform 200ms ease, border-color 200ms ease; }
  .guide-case-link:is(:hover,:focus-visible) { transform: translateY(-2px); border-color: #ffffff40; }
}
