/* ===================================================================
   Zol's Game World — resource page styles (KAN-627/628).

   THE single source of resource-content styling, referenced by BOTH
   containers: the in-app Resources view (a <link> in the root layout;
   colour tokens come from globals.css per the user's theme) AND the
   public static pages (rendered by backend/resources/public_render.py,
   which inlines the Midnight --zgw-* tokens since it has no theme system).

   Contains ONLY the .zgw-res rules — every colour resolves from --zgw-*
   tokens (no hex), and the type faces from --zgw-font-*. The container
   provides the tokens; this file is theme-agnostic.
   =================================================================== */

.zgw-res {
  --res-display: var(--zgw-font-display, system-ui, sans-serif);
  --res-body:    var(--zgw-font-body, Georgia, serif);
  --res-mono:    var(--zgw-font-mono, ui-monospace, monospace);

  max-width: 40rem;
  margin: 0 auto;
  padding: clamp(1.5rem, 5vw, 3rem) 1rem 4rem;
  color: var(--zgw-text);
  font-family: var(--res-body);
  font-size: 1.0625rem;
  line-height: 1.7;
}

.zgw-res p { margin: 0 0 1.25rem; }
.zgw-res p:last-child { margin-bottom: 0; }

/* ---------- Base prose (KAN-697 follow-up) ----------
   Hand-authored docs (How-To, Future, …) are plain semantic HTML — <h1>/<h2>/<h3>/<ul>/<li>/<strong>/
   <a>/… with no classes. The base .zgw-res previously styled only the container + <p>, so everything
   else fell back to ugly browser defaults, and every doc "needed the styling added by hand". These
   element rules give ANY plain fragment a good look automatically.

   They use :where(), so their specificity is ~zero: the opt-in .zgw-res__* masthead classes (the
   designed About page) and the .zgw-res--notes patch modifier ALWAYS win over them — so nothing that
   is styled with a class changes, and no existing page is affected. */
:where(.zgw-res) h1 {
  font-family: var(--res-display); font-weight: 800;
  font-size: clamp(1.7rem, 5.5vw, 2.4rem); line-height: 1.1; letter-spacing: -0.02em;
  color: var(--zgw-text-strong); text-wrap: balance; margin: 0 0 1.5rem;
}
:where(.zgw-res) h2 {
  font-family: var(--res-display); font-weight: 700;
  font-size: 1.45rem; line-height: 1.2; letter-spacing: -0.015em;
  color: var(--zgw-text-strong); text-wrap: balance; margin: 2.25rem 0 1rem;
}
:where(.zgw-res) h3 {
  font-family: var(--res-display); font-weight: 700;
  font-size: 1.15rem; line-height: 1.25; color: var(--zgw-text-strong);
  margin: 1.75rem 0 0.75rem;
}
:where(.zgw-res) ul,
:where(.zgw-res) ol { margin: 0 0 1.25rem; padding-left: 1.5rem; }
:where(.zgw-res) ul { list-style: disc; }
:where(.zgw-res) ol { list-style: decimal; }
:where(.zgw-res) li { margin: 0 0 0.6rem; }
:where(.zgw-res) li:last-child { margin-bottom: 0; }
:where(.zgw-res) ul li::marker { color: var(--zgw-accent); }
:where(.zgw-res) strong,
:where(.zgw-res) b { font-weight: 700; color: var(--zgw-text-strong); }
:where(.zgw-res) em { font-style: italic; }
:where(.zgw-res) a { color: var(--zgw-accent); text-decoration: underline; }
:where(.zgw-res) blockquote {
  margin: 0 0 1.5rem; padding-left: 1rem;
  border-left: 3px solid var(--zgw-border); color: var(--zgw-muted);
}
:where(.zgw-res) hr { border: none; border-top: 1px solid var(--zgw-border); margin: 2rem 0; }
:where(.zgw-res) code {
  font-family: var(--res-mono); font-size: 0.9em;
  background: var(--zgw-surface); border: 1px solid var(--zgw-border);
  border-radius: 0.3rem; padding: 0.1em 0.35em;
}

/* ---------- Patch Notes list (KAN-714) ----------
   A published patch note is a plain <h2> title + <p> + <ul><li> (auto-drafted from Jira), and the base
   .zgw-res styles only <p> + the opt-in .zgw-res__* classes — so a bare changelog list would fall back to
   browser defaults. These element rules are SCOPED to the `.zgw-res--notes` modifier (set on the patch
   article in BOTH the in-app ResourcesSection and the public index render), so the hand-authored
   About/How-To/Future docs — plain `.zgw-res` — are untouched. */

.zgw-res--notes h2 {
  font-family: var(--res-display);
  font-weight: 700;
  font-size: 1.35rem;
  line-height: 1.2;
  letter-spacing: -0.015em;
  color: var(--zgw-text-strong);
  text-wrap: balance;
  margin: 0 0 1.1rem;
}
.zgw-res--notes p  { margin: 0 0 1rem; }
.zgw-res--notes ul { list-style: disc; margin: 0; padding-left: 1.4rem; }
.zgw-res--notes li { margin: 0 0 0.7rem; }
.zgw-res--notes li:last-child { margin-bottom: 0; }
.zgw-res--notes ul li::marker { color: var(--zgw-accent); }
.zgw-res--notes strong,
.zgw-res--notes b  { font-weight: 700; color: var(--zgw-text-strong); }
.zgw-res--notes a  { color: var(--zgw-accent); text-decoration: underline; }
.zgw-res--notes em { color: var(--zgw-muted); }   /* the auto "needs wording" flags read as muted meta */

/* ---------- Masthead ---------- */

.zgw-res__kicker {
  font-family: var(--res-mono);
  font-size: 0.7rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--zgw-accent);
  margin: 0 0 1.25rem;
}

.zgw-res__title {
  font-family: var(--res-display);
  font-weight: 800;
  font-size: clamp(1.9rem, 6.5vw, 3rem);
  line-height: 1.05;
  letter-spacing: -0.02em;
  margin: 0 0 2rem;
  text-wrap: balance;
}

.zgw-res__brand {
  display: block;
  color: var(--zgw-muted);
  font-weight: 500;
  font-size: 0.42em;
  letter-spacing: 0.01em;
  line-height: 1.3;
  margin-bottom: 0.8rem;
}

/* ---------- Lede ---------- */

.zgw-res__lede {
  font-size: 1.15rem;
  line-height: 1.62;
}

.zgw-res__lede::first-letter {
  font-family: var(--res-display);
  font-weight: 800;
  float: left;
  font-size: 3.4em;
  line-height: 0.82;
  padding: 0.08em 0.12em 0 0;
  color: var(--zgw-accent);
}

/* ---------- Sections ---------- */

.zgw-res__section {
  margin-top: 3rem;
  padding-top: 3rem;
  border-top: 1px solid var(--zgw-border);
}

.zgw-res__section > h2 {
  font-family: var(--res-display);
  font-weight: 700;
  font-size: 1.45rem;
  line-height: 1.2;
  letter-spacing: -0.015em;
  margin: 0 0 1.25rem;
  text-wrap: balance;
}

/* ---------- whoami ---------- */

.zgw-res__cmd {
  font-family: var(--res-mono);
  font-size: 0.9rem;
  background: var(--zgw-surface);
  border: 1px solid var(--zgw-border);
  border-radius: 0.4rem;
  padding: 0.65rem 0.9rem;
  margin: 0 0 1.5rem;
}

.zgw-res__prompt {
  color: var(--zgw-accent);
  margin-right: 0.5rem;
  user-select: none;
}

.zgw-res__caret {
  display: inline-block;
  width: 0.55em;
  height: 1.05em;
  margin-left: 0.15em;
  background: var(--zgw-accent);
  transform: translateY(0.15em);
  animation: zgw-res-blink 1.15s steps(1) infinite;
}

@keyframes zgw-res-blink { 50% { opacity: 0; } }

.zgw-res__handle {
  font-family: var(--res-display);
  font-weight: 700;
  color: var(--zgw-accent);
  letter-spacing: -0.01em;
}

/* ---------- Pull line ---------- */

.zgw-res__pull {
  font-family: var(--res-display);
  font-weight: 700;
  font-size: clamp(1.35rem, 4.4vw, 1.85rem);
  line-height: 1.22;
  letter-spacing: -0.02em;
  color: var(--zgw-accent);
  text-wrap: balance;
  margin: 0 0 1.75rem;
  padding-left: 1.25rem;
  border-left: 3px solid var(--zgw-accent);
}

/* ---------- Emphasis ---------- */

.zgw-res__annual {
  border-bottom: 2px solid var(--zgw-accent);
  padding-bottom: 1px;
}

/* ---------- Motion ---------- */

@media (prefers-reduced-motion: reduce) {
  .zgw-res *,
  .zgw-res *::before,
  .zgw-res *::after {
    animation: none !important;
    transition: none !important;
  }
}
