/* proxy.wiki: glossary index and glossary entries.
   Loaded after main.css on /glossary/ and on every glossary entry only.
   Every class here carries the pw-gl- prefix. Colours come from the main.css
   tokens, so light and dark themes follow automatically. */

/* The filter hides with the hidden attribute. A display value set below must
   never override it. */
.pw-gl-index [hidden] { display: none !important; }

/* ==========================================================================
   Entry page
   ========================================================================== */

/* .pw-article__head and .pw-wrap--prose are min(100%, 42rem) wide, so below
   42rem the entry ran edge to edge with no gutter (true of the live page
   before this file too). Keep at least 1.25rem each side. */
.pw-gl-head,
.pw-gl-body { width: min(100% - 2.5rem, 42rem); margin-inline: auto; }

.pw-gl-head h1 { margin-bottom: var(--pw-6); }
/* On a status-code entry the code is the large type; the name steps down. */
.pw-gl--status .pw-gl-head h1 { font-size: var(--pw-t-3xl); }

/* The definition is the page. It sits directly under the H1, larger than the
   body copy, on its own panel. */
.pw-gl-def {
  border: 1px solid var(--pw-rule);
  border-left: 3px solid var(--pw-accent);
  border-radius: var(--pw-radius-lg);
  background: var(--pw-surface-alt);
  padding: var(--pw-5) var(--pw-6);
}
.pw-gl-def__label {
  font-family: var(--pw-font-sans); font-size: var(--pw-t-xs); font-weight: 700;
  letter-spacing: .12em; text-transform: uppercase; color: var(--pw-muted);
  margin-bottom: var(--pw-2);
}
.pw-gl-def__text {
  font-family: var(--pw-font-serif); font-size: var(--pw-t-xl); line-height: 1.45;
  color: var(--pw-ink); font-weight: 450; text-wrap: pretty;
}

/* "Read the full guide": one link, full width, after the definition. */
.pw-gl-guide {
  position: relative;
  display: grid; gap: var(--pw-1);
  margin-top: var(--pw-5);
  padding: var(--pw-4) 3rem var(--pw-4) var(--pw-5);
  border: 1px solid var(--pw-rule-strong); border-radius: var(--pw-radius-lg);
  background: var(--pw-surface); color: var(--pw-ink); text-decoration: none;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.pw-gl-guide:hover { border-color: var(--pw-accent); box-shadow: var(--pw-shadow-sm); color: var(--pw-ink); }
.pw-gl-guide__k {
  font-family: var(--pw-font-sans); font-size: var(--pw-t-xs); font-weight: 700;
  letter-spacing: .1em; text-transform: uppercase; color: var(--pw-accent);
}
.pw-gl-guide__t { font-family: var(--pw-font-serif); font-size: var(--pw-t-lg); font-weight: 600; line-height: 1.3; }
.pw-gl-guide__x { font-family: var(--pw-font-sans); font-size: var(--pw-t-sm); color: var(--pw-muted); line-height: 1.5; }
.pw-gl-guide__go {
  position: absolute; right: var(--pw-5); top: 50%; transform: translateY(-50%);
  font-size: var(--pw-t-lg); color: var(--pw-accent); transition: transform .15s ease;
}
.pw-gl-guide:hover .pw-gl-guide__go { transform: translate(3px, -50%); }

.pw-gl-jump { margin-top: var(--pw-4); font-family: var(--pw-font-sans); font-size: var(--pw-t-base); font-weight: 600; }
.pw-gl-jump a { text-decoration: none; }
.pw-gl-jump a::before { content: "\2193\00a0"; }
.pw-gl-jump a:hover { text-decoration: underline; }

/* Status-code entries: the code is the identifier people search for. */
.pw-gl-code { display: flex; align-items: center; gap: var(--pw-5); margin-bottom: var(--pw-4); }
.pw-gl-code__num {
  font-family: var(--pw-font-mono); font-size: var(--pw-t-5xl); font-weight: 600;
  line-height: .9; letter-spacing: -0.04em; font-variant-numeric: tabular-nums;
  color: var(--pw-gl-code, var(--pw-ink));
}
.pw-gl-code__meta { display: grid; gap: 2px; font-family: var(--pw-font-sans); min-width: 0; }
.pw-gl-code__class {
  font-size: var(--pw-t-xs); font-weight: 700; letter-spacing: .1em; text-transform: uppercase;
  color: var(--pw-gl-code, var(--pw-muted));
}
.pw-gl-code__summary { font-size: var(--pw-t-sm); color: var(--pw-muted); line-height: 1.45; }
.pw-gl-code__summary a { color: var(--pw-muted); }
.pw-gl-code--1xx { --pw-gl-code: var(--pw-muted); }
.pw-gl-code--2xx { --pw-gl-code: var(--pw-good); }
.pw-gl-code--3xx { --pw-gl-code: var(--pw-info); }
.pw-gl-code--4xx { --pw-gl-code: var(--pw-warn); }
.pw-gl-code--5xx { --pw-gl-code: var(--pw-bad); }

/* The section the writer wrote on what to do when a proxy returns the code. */
.pw-prose .pw-gl-action {
  border: 1px solid var(--pw-rule); border-left: 3px solid var(--pw-accent);
  border-radius: var(--pw-radius-lg); background: var(--pw-accent-soft);
  padding: var(--pw-5) var(--pw-6);
}
.pw-prose .pw-gl-action > h2:first-child { margin-top: 0; padding-top: 0; border-top: 0; }
.pw-prose .pw-gl-action > * + * { margin-top: 1.1em; }

.pw-gl-after { margin-top: var(--pw-10); }
.pw-gl-after.pw-stack > * + * { margin-top: var(--pw-8); }

.pw-gl-subhead { font-size: var(--pw-t-xl); margin-bottom: var(--pw-4); }

.pw-gl-related__list,
.pw-gl-also__list { list-style: none; padding: 0; margin: 0; }
.pw-gl-related__list { display: flex; flex-wrap: wrap; gap: var(--pw-2); }

.pw-gl-also__list { display: grid; gap: var(--pw-2); font-family: var(--pw-font-sans); font-size: var(--pw-t-base); }
.pw-gl-also__list a { font-weight: 600; }
.pw-gl-also__in { color: var(--pw-muted); margin-left: .4em; }

.pw-gl-back { font-family: var(--pw-font-sans); font-size: var(--pw-t-sm); }
.pw-gl-back a { color: var(--pw-muted); }
.pw-gl-back a:hover { color: var(--pw-accent); }

/* ==========================================================================
   Index
   ========================================================================== */

.pw-gl-topics {
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--pw-2);
  margin-top: var(--pw-8);
}
.pw-gl-topics__k {
  font-family: var(--pw-font-sans); font-size: var(--pw-t-xs); font-weight: 700;
  letter-spacing: .12em; text-transform: uppercase; color: var(--pw-muted);
  margin-right: var(--pw-2);
}
.pw-gl-topics__n { font-family: var(--pw-font-mono); font-size: var(--pw-t-xs); font-weight: 500; opacity: .75; }

/* Filter box and letter strip. Sticky under the site header on wide screens;
   on a phone it scrolls away so it never takes a third of the screen. */
.pw-gl-tools {
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--pw-3) var(--pw-6);
  margin-top: var(--pw-6);
  padding-block: var(--pw-3);
  background: var(--pw-bg);
  border-bottom: 1px solid var(--pw-rule-strong);
}
.pw-gl-search { flex: 1 1 18rem; max-width: 24rem; display: flex; align-items: center; gap: var(--pw-3); }
.pw-gl-search__input { flex: 1 1 auto; min-width: 0; }
.pw-gl-count { font-family: var(--pw-font-mono); font-size: var(--pw-t-xs); color: var(--pw-faint); margin: 0; white-space: nowrap; }

.pw-gl-az { flex: 0 1 auto; margin-left: auto; }
.pw-gl-az ol {
  list-style: none; padding: 0; margin: 0;
  display: flex; flex-wrap: wrap; gap: 1px;
}
.pw-gl-az a,
.pw-gl-az__off {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 1.75rem; height: 2rem; padding: 0 .3rem;
  font-family: var(--pw-font-sans); font-size: var(--pw-t-sm); font-weight: 650;
  border-radius: var(--pw-radius-sm); text-decoration: none;
}
.pw-gl-az a { color: var(--pw-ink); }
.pw-gl-az a:hover { background: var(--pw-accent-soft); color: var(--pw-accent); }
.pw-gl-az__off,
.pw-gl-az a.is-off { color: var(--pw-rule-strong); pointer-events: none; }

/* Sticky under the site header on wide screens only. The letters stay on one
   line there; if the row is too narrow the whole strip drops below the box. */
@media (min-width: 901px) {
  .pw-gl-tools { position: sticky; top: var(--pw-header-h, 69px); z-index: 50; }
  .pw-gl-az ol { flex-wrap: nowrap; }
}
@media (max-width: 900px) {
  .pw-gl-search { max-width: none; flex-basis: 100%; }
  .pw-gl-az { margin-left: 0; }
}

.pw-gl-empty { margin-top: var(--pw-6); font-family: var(--pw-font-sans); color: var(--pw-muted); }

.pw-gl-groups { margin-top: var(--pw-6); }

.pw-gl-group {
  display: grid; gap: var(--pw-2) var(--pw-8);
  padding-block: var(--pw-6);
  border-bottom: 1px solid var(--pw-rule);
  /* main.css already clears the sticky header with scroll-padding-top on
     html, and scroll-margin adds to it. Repeating the header height here
     landed every letter jump about 85px too low. */
  scroll-margin-top: 0;
}
@media (min-width: 901px) {
  /* Add only the sticky filter row to that padding. Below about 1150px the
     letter strip wraps under the box and the row is two lines (116px, not
     72px), so it needs more. Measured in Chrome at 920, 1050, 1150, 1280. */
  .pw-gl-group { grid-template-columns: 5rem 1fr; scroll-margin-top: 7.5rem; }
  /* The letter strip stays in view here, so per-group "back" links are noise. */
  .pw-gl-group__top { display: none; }
}
@media (min-width: 1200px) {
  /* One-line filter row (72px). */
  .pw-gl-group { scroll-margin-top: 5rem; }
}
.pw-gl-group__letter {
  font-family: var(--pw-font-serif); font-size: var(--pw-t-3xl); font-weight: 600;
  line-height: 1; color: var(--pw-accent); margin: 0;
}

.pw-gl-list {
  margin: 0;
  display: grid; gap: var(--pw-5) var(--pw-8);
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 22rem), 1fr));
}
.pw-gl-entry { min-width: 0; }
.pw-gl-entry__term {
  font-family: var(--pw-font-serif); font-size: var(--pw-t-lg); font-weight: 600; line-height: 1.3;
  display: flex; align-items: baseline; flex-wrap: wrap; gap: var(--pw-2);
}
.pw-gl-entry__term a { color: var(--pw-ink); text-decoration: none; }
.pw-gl-entry__term a:hover { color: var(--pw-accent); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
.pw-gl-entry__def {
  margin: var(--pw-1) 0 0; font-size: var(--pw-t-base); line-height: 1.55;
  color: var(--pw-muted); max-width: 60ch; text-wrap: pretty;
}
.pw-gl-entry__code {
  font-family: var(--pw-font-mono); font-size: var(--pw-t-sm); font-weight: 600;
  font-variant-numeric: tabular-nums;
  padding: .05rem .4rem; border-radius: var(--pw-radius-sm);
  background: var(--pw-bg-sunken); color: var(--pw-ink-soft);
}

.pw-gl-group__top { margin: var(--pw-2) 0 0; font-family: var(--pw-font-sans); font-size: var(--pw-t-xs); }
.pw-gl-group__top a { color: var(--pw-faint); text-decoration: none; }
.pw-gl-group__top a:hover { color: var(--pw-accent); text-decoration: underline; }

/* The same terms grouped by topic: names only, so the page does not print
   every definition twice. */
.pw-gl-bytopic { margin-top: var(--pw-16); padding-top: var(--pw-6); border-top: 2px solid var(--pw-ink); }
.pw-gl-bytopic > h2 { font-size: var(--pw-t-2xl); margin-bottom: var(--pw-6); }
.pw-gl-bytopic__grid {
  display: grid; gap: var(--pw-8);
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 17rem), 1fr));
}
.pw-gl-topic__name { font-size: var(--pw-t-lg); display: flex; align-items: baseline; gap: var(--pw-2); margin-bottom: var(--pw-3); }
.pw-gl-topic__name a { color: var(--pw-ink); text-decoration: none; }
.pw-gl-topic__name a:hover { color: var(--pw-accent); text-decoration: underline; }
.pw-gl-topic__n { font-family: var(--pw-font-mono); font-size: var(--pw-t-xs); color: var(--pw-faint); font-weight: 500; }
.pw-gl-topic__list {
  list-style: none; padding: 0; margin: 0;
  display: flex; flex-wrap: wrap; gap: var(--pw-1) var(--pw-4);
  font-family: var(--pw-font-sans); font-size: var(--pw-t-sm);
}
.pw-gl-topic__list a { color: var(--pw-ink-soft); }
.pw-gl-topic__list a:hover { color: var(--pw-accent); }

.pw-gl-about { margin-top: var(--pw-12); }

@media print {
  .pw-gl-tools, .pw-gl-topics, .pw-gl-group__top, .pw-gl-bytopic { display: none; }
  .pw-gl-group { break-inside: avoid; }
}
