/*
 * Components, group B: the specification bar, the guide's tables (risk matrix, crosswalk, Sherpa camps) and
 * status cells, the journey stepper, incident cards, the Azure service catalog, the hands-on callout, next steps,
 * seen in production, diagrams, the footer, and the feedback form. Every color and size comes from tokens.css.
 *
 * Portions adapted from Sherpa, the MCP Security Summit Workshop (https://github.com/Azure-Samples/sherpa):
 * the camp progress card behind the journey stepper, and the layout of the feedback widget and the footer.
 *
 * MIT License
 *
 * Copyright (c) 2026 Azure Samples
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in all
 * copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 * SOFTWARE.
 */

/* ---------------------------------------------------------------- Specification bar */

/* The specification bar above the header, with a dismiss button at its end. Its inner wrappers mirror header.html so
   its edges match the header at every width, including 3xl fixed containers. The gradient fills the inner wrapper's
   content box, whose left edge is the text's and whose right edge is the dismiss button's at every width and layout
   (from 1600px the fixed container pads the wrapper), so its stops track both: navy to indigo under the text, orchid
   just past its end, then light pink that is solid from the dismiss button's left edge, so the button's icon and focus
   ring sit on the same pink at every width. The bar's own two halves fill the wrapper's padding and the gutters with
   the gradient's end colors. Each width range below moves the stops with the items it shows; tests/e2e/test_chrome.py
   measures every glyph against the pixels behind it. */
.g-announce {
  --g-specbar-via-at: 28rem;
  --g-specbar-orchid-at: 46rem;
  color: var(--guide-specbar-fg);
  background: linear-gradient(90deg, var(--guide-specbar-from) 50%, var(--guide-specbar-to) 50%);
}

.g-announce[hidden] {
  display: none;
}

.g-announce__inner {
  --g-specbar-pink-at: calc(100% - 1.5rem);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: linear-gradient(
      90deg,
      var(--guide-specbar-from) 0,
      var(--guide-specbar-via) var(--g-specbar-via-at),
      var(--guide-specbar-orchid) var(--g-specbar-orchid-at),
      var(--guide-specbar-to) var(--g-specbar-pink-at)
    )
    content-box no-repeat;
}

/* The orchid eases into the pink through four mixed stops, so the slope of the run steps down to the flat pink and the
   pink end has no edge. Mixed colors would move the whole gradient into Oklab, so it keeps the sRGB of the stops above;
   a browser without gradient color spaces keeps the straight run. */
@supports (background-image: linear-gradient(in srgb, red, blue)) {
  .g-announce__inner {
    --g-specbar-run: calc(var(--g-specbar-pink-at) - var(--g-specbar-orchid-at));
    background-image: linear-gradient(
      90deg in srgb,
      var(--guide-specbar-from) 0,
      var(--guide-specbar-via) var(--g-specbar-via-at),
      var(--guide-specbar-orchid) var(--g-specbar-orchid-at),
      color-mix(in srgb, var(--guide-specbar-to) 11%, var(--guide-specbar-orchid))
        calc(var(--g-specbar-orchid-at) + var(--g-specbar-run) * 0.2),
      color-mix(in srgb, var(--guide-specbar-to) 33%, var(--guide-specbar-orchid))
        calc(var(--g-specbar-orchid-at) + var(--g-specbar-run) * 0.4),
      color-mix(in srgb, var(--guide-specbar-to) 67%, var(--guide-specbar-orchid))
        calc(var(--g-specbar-orchid-at) + var(--g-specbar-run) * 0.6),
      color-mix(in srgb, var(--guide-specbar-to) 89%, var(--guide-specbar-orchid))
        calc(var(--g-specbar-orchid-at) + var(--g-specbar-run) * 0.8),
      var(--guide-specbar-to) var(--g-specbar-pink-at)
    );
  }
}

.g-announce__inner > .g-specbar {
  flex: 1;
  min-width: 0;
}

/* Each item draws its own leading separator, and the bar is shifted left by one separator width and clipped there,
   so a separator that starts a line is never visible. */
.g-specbar {
  margin: 0.125rem auto 0.125rem -1.625rem;
  color: var(--guide-specbar-fg);
  font-size: var(--g-text-xs);
  line-height: 1.5;
  clip-path: inset(-0.25rem -0.375rem -0.25rem 1.625rem);
}

.g-specbar > * {
  display: inline-block;
}

.g-specbar > ::before {
  content: "·";
  display: inline-block;
  width: 1.625rem;
  color: color-mix(in srgb, var(--guide-specbar-fg) 90%, transparent);
  text-align: center;
}

/* What's new sits inside its own item, so the item's separator stays outside the link's focus ring. Inline padding,
   taken back by a negative margin, gives the ring room around the words without moving them. */
.g-announce .g-specbar__link {
  display: inline-block;
  margin-inline: -0.375rem;
  padding: 0.25rem 0.375rem;
  color: var(--guide-specbar-fg);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 0.2em;
}

.g-announce .g-specbar__link:focus-visible {
  outline-offset: -2px !important;
}

/* The dismiss button sits on the pink end, so its icon and focus ring take the navy ink. Its ring stays inside the
   button, and with it inside the bar, so no part of it lands on the header. */
.g-announce__dismiss {
  --guide-focus: var(--guide-specbar-ink);
  display: inline-flex;
  padding: 0.25rem;
  color: var(--guide-specbar-ink);
  border: 0;
  background: none;
  cursor: pointer;
}

.g-announce__dismiss:focus-visible {
  outline-offset: -2px !important;
}

.g-announce__dismiss svg {
  width: 1rem;
  height: 1rem;
  fill: currentColor;
}

/* The bar keeps to one line. Below 864px it leaves out "Aligned with" and the review date, on phones the edition
   too, and on compact phones (under 384px) the word "specification", so the version, the link, and the orchid to pink
   blend before the dismiss button fit down to 320px. */
@media screen and (max-width: 53.984375em) {
  .g-announce {
    --g-specbar-via-at: 19rem;
    --g-specbar-orchid-at: 31rem;
  }

  .g-specbar > .g-specbar__item--reviewed,
  .g-specbar__lead {
    display: none;
  }
}

@media screen and (max-width: 39.984375em) {
  .g-announce {
    --g-specbar-via-at: 10rem;
    --g-specbar-orchid-at: 17rem;
  }

  .g-specbar > .g-specbar__item--edition {
    display: none;
  }
}

@media screen and (max-width: 23.984375em) {
  .g-announce {
    --g-specbar-via-at: 7rem;
    --g-specbar-orchid-at: 12.5rem;
  }

  .g-specbar__word {
    display: none;
  }
}

/* ---------------------------------------------------------------- Guide tables and status cells */

/* The guide's tables (risk matrix, crosswalk, Sherpa camps) are shadcn's data table: a Markdown table's plain
   header row and row rules, as on Sherpa, inside a rounded border. They are transparent so the scroll cue painted
   by their scrolling wrapper shows through the rows. */
.typography .g-table {
  width: 100%;
  font-size: var(--g-text-sm);
  line-height: 1.5;
  border: 1px solid var(--guide-border);
  border-radius: var(--g-radius-lg);
  border-collapse: separate;
  border-spacing: 0;
  overflow: hidden;
  background: transparent;
}

.typography table.g-table :is(th, td) {
  padding: 0.625rem;
  text-align: left;
  white-space: normal;
  border-top: 1px solid var(--guide-border);
}

/* Body cells hold sentences and lists, so they align to the top; a header label stays in the middle of its row, as
   shadcn draws it. */
.typography table.g-table tbody :is(th, td) {
  vertical-align: top;
}

.typography table.g-table thead th {
  color: var(--guide-fg);
  font-weight: 500;
  border-top: 0;
}

@media (hover: hover) and (pointer: fine) {
  .typography table.g-table tbody tr:hover {
    background: color-mix(in srgb, var(--guide-surface-2) 70%, transparent);
    box-shadow: none;
  }
}

.typography .g-table th[scope="row"] {
  font-weight: 500;
}

.typography .g-table :is(ul, p) {
  margin: 0;
}

.typography .g-table ul {
  padding: 0;
  list-style: none;
}

.typography .g-table ul li {
  margin: 0 0 0.25rem;
}

.typography .g-table td > p + p {
  margin-top: 0.5rem;
}

/* The OWASP reference tables fit the column from a 768px tablet up, 710px wide there, and scroll at a readable
   width in a narrower one, where the scroll cue marks the cut edge. */
.g-table-wrap {
  container: g-table / inline-size;
}

.typography .g-table--crosswalk td:last-child {
  color: var(--guide-muted);
}

.typography .g-table--crosswalk th[scope="row"] {
  width: 10.625rem;
}

@container g-table (width < 44rem) {
  .typography .g-table--matrix {
    min-width: 50rem;
  }

  .typography .g-table--crosswalk {
    min-width: 55rem;
  }
}

/* The matrix needs 44.8rem with 10px cells, so in a column of 44 to 45rem its cells take 8px and it needs 43.6rem. */
@container g-table (44rem <= width < 45rem) {
  .typography table.g-table--matrix :is(th, td) {
    padding-inline: 0.5rem;
  }
}

/* On a phone the columns cut off at the right hold the longest cells: the services and camps of the matrix, the
   framework ids and the rationale of the crosswalk. They get room for their chips and lists, so the rows they set
   stay short beside the columns on screen. */
@container g-table (max-width: 30rem) {
  .typography .g-table--matrix td:is(:nth-child(3), :nth-child(5)) {
    min-width: 16rem;
  }

  .typography .g-table--crosswalk td {
    min-width: 12rem;
  }

  .typography .g-table--crosswalk td:last-child {
    min-width: 20rem;
  }
}

.typography .g-table--camps {
  min-width: 42.5rem;
}

/* ---------------------------------------------------------------- Journey stepper */

/* Sherpa's camp progress card: every step sits on a segment of one progress bar, filled through the current
   step, and the step count is the card's pill. Below 40rem of column the steps take two rows of three and the
   pill moves under them. */
.typography .g-journey {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.75rem 1rem;
  margin: 1.5rem 0;
  padding: 0.75rem 0.875rem;
  border: 1px solid var(--guide-card-border);
  border-radius: var(--g-radius-card);
  background: var(--guide-card-surface);
  box-shadow: var(--guide-card-shadow);
}

/* Without a step count, as on the home page and the adoption overview, the steps take the whole card. */
.typography .g-journey:not(:has(> .g-journey__bar)) {
  grid-template-columns: minmax(0, 1fr);
}

.typography .g-journey > ol {
  display: grid;
  grid-auto-columns: minmax(0, 1fr);
  grid-auto-flow: column;
  gap: 0.75rem 0.375rem;
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: g-step;
}

.typography .g-journey__step {
  --g-segment: color-mix(in srgb, var(--guide-accent) 20%, transparent);
  margin: 0;
  counter-increment: g-step;
}

.typography :is(.g-journey__step--done, .g-journey__step--current) {
  --g-segment: var(--guide-accent);
}

.typography .g-journey__step > a {
  position: relative;
  display: flex;
  align-items: baseline;
  gap: 0.375rem;
  padding-top: 0.875rem;
  color: var(--guide-muted);
  font-size: var(--g-text-sm);
  font-weight: 500;
  line-height: 1.3;
}

.typography .g-journey__step > a::before {
  content: counter(g-step, decimal-leading-zero);
  color: var(--guide-muted);
  font-family: var(--g-font-mono);
  font-size: var(--g-text-xs);
  font-weight: 500;
}

.typography .g-journey__step > a::after {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 0.35rem;
  border-radius: var(--g-radius-pill);
  background: var(--g-segment);
}

.typography .g-journey__step > a:focus-visible {
  color: var(--guide-fg);
}

.typography .g-journey__step:not(.g-journey__step--done, .g-journey__step--current) > a:focus-visible {
  --g-segment: color-mix(in srgb, var(--guide-accent) 50%, transparent);
}

@media (hover: hover) and (pointer: fine) {
  .typography .g-journey__step > a:hover {
    color: var(--guide-fg);
  }

  .typography .g-journey__step:not(.g-journey__step--done, .g-journey__step--current) > a:hover {
    --g-segment: color-mix(in srgb, var(--guide-accent) 50%, transparent);
  }
}

.typography .g-journey__step--done > a {
  color: var(--guide-fg);
}

.typography .g-journey__step--current > a {
  color: var(--guide-accent);
  font-weight: 700;
}

.typography .g-journey__step--current > a::before {
  color: var(--guide-accent);
}

/* The bar is the accessible progress value; the segments draw it, so it shows the count as text. */
.typography .g-journey__bar {
  padding: 0.25rem 0.5rem;
  color: var(--guide-muted);
  font-size: var(--g-text-xs);
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
  border: 1px solid var(--guide-border);
  border-radius: var(--g-radius-pill);
}

.typography .g-journey__bar::after {
  content: "Step " attr(aria-valuenow) " of " attr(aria-valuemax);
}

@container g-content (width < 40rem) {
  .typography .g-journey {
    grid-template-columns: minmax(0, 1fr);
  }

  .typography .g-journey > ol {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    grid-auto-flow: row;
  }

  .typography .g-journey__bar {
    justify-self: start;
  }
}

/* ---------------------------------------------------------------- Incident cards */

/* shadcn's card: a rounded border on the card surface, which the dark scheme sinks a little toward the page as it
   does the home page's cards. */
.typography .g-incident {
  margin: 1.25rem 0;
  padding: 1.25rem 1.375rem 1.125rem;
  border: 1px solid var(--guide-card-border);
  border-radius: var(--g-radius-lg);
  background: var(--guide-card-surface);
  box-shadow: var(--guide-card-shadow);
}

.typography .g-incident--research {
  border-style: dashed;
  border-color: var(--guide-border-strong);
}

.typography .g-incident__title {
  margin: 0;
  padding: 0;
  border: 0;
  font-size: var(--g-text-lg);
  font-weight: 650;
}

/* The meta line flows as text, so each separator stays with the item after it. */
.typography .g-incident__meta {
  margin: 0.5rem 0;
  color: var(--guide-muted);
  font-size: var(--g-text-sm);
  line-height: 1.6;
}

.typography .g-incident__meta time {
  font-family: var(--g-font-mono);
  font-size: var(--g-text-xs);
}

/* The risks a card maps to sit on a row of their own under the meta line, at the meta line's size, so the chips
   match the service catalog's. */
.typography ul.g-incident__risks {
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
  margin-top: 0;
  margin-bottom: 0.875rem;
  font-size: var(--g-text-sm);
}

.typography .g-incident > p:not(.g-incident__meta) {
  margin: 0.5rem 0;
  font-size: 0.9375rem;
}

/* The Azure mitigations list one capability to an item, keeping shadcn's list indent so the bullets sit inside the
   card's text. */
.typography .g-incident__controls {
  font-size: var(--g-text-sm);
  line-height: 1.6;
}

.typography .g-incident__controls > p {
  margin: 0.75rem 0 0;
}

.typography .g-incident__controls > ul {
  margin-block: 0.25rem 0;
}

.typography .g-incident__controls > ul > li {
  margin: 0.25rem 0 0;
}

.typography .g-incident__label {
  color: var(--guide-muted);
  font-weight: 550;
}

.typography ul.g-incident__sources {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.25rem;
  margin: 0.875rem 0 0;
  padding: 0.75rem 0 0;
  font-size: var(--g-text-sm);
  list-style: none;
  border-top: 1px solid var(--guide-border);
}

.typography .g-incident__sources > li {
  margin: 0;
}

/* ---------------------------------------------------------------- Azure service catalog */

/* One card per service on the incident card recipe. Each capability is a row: its name and caveat on the
   left and, once the card is wide enough, its status badge on the right, so the badges line up down the
   card. The catalog is where readers check statuses, so its badges keep the checked date. */
.typography .g-service {
  container: g-service / inline-size;
  margin: 1rem 0;
  padding: 1.25rem 1.375rem 1.125rem;
  border: 1px solid var(--guide-card-border);
  border-radius: var(--g-radius-lg);
  background: var(--guide-card-surface);
  box-shadow: var(--guide-card-shadow);
}

.typography .g-service__title {
  margin: 0;
  font-size: var(--g-text-lg);
  font-weight: 650;
}

.typography .g-service__meta {
  margin: 0.25rem 0 0;
  color: var(--guide-muted);
  font-size: var(--g-text-sm);
}

/* Where the guide covers the service: the risks on a row after the label, then the guide's pages on a line of their
   own. */
.typography .g-service__pages {
  margin: 0.75rem 0 0;
  color: var(--guide-muted);
  font-size: var(--g-text-sm);
  line-height: 1.75;
}

.typography .g-service__pages > p {
  margin: 0;
}

.typography .g-service__pages > p + p {
  margin-top: 0.375rem;
}

.typography .g-service__pages > .g-service__risks {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.375rem 0.5rem;
}

.typography ul.g-service__capabilities {
  margin: 1rem 0 0;
  padding: 0;
  list-style: none;
}

.typography ul.g-service__capabilities > li {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  justify-items: start;
  align-items: baseline;
  gap: 0.375rem 1.5rem;
  margin: 0;
  padding: 0.75rem 0;
  border-top: 1px solid var(--guide-border);
}

.typography ul.g-service__capabilities > li:last-child {
  padding-bottom: 0;
}

.typography .g-service__note {
  color: var(--guide-muted);
  font-size: var(--g-text-sm);
  line-height: 1.5;
  opacity: 1;
}

@container g-service (min-width: 37.5rem) {
  .typography ul.g-service__capabilities > li {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .typography .g-service__capabilities .g-badge {
    grid-area: 1 / 2;
    justify-self: end;
  }

  .typography .g-service__note {
    grid-column: 1;
  }
}

/* ---------------------------------------------------------------- Hands-on callout (Sherpa) */

/* An admonition in Sherpa's teal: the tip's edge, radius, padding, and bold title over the Sherpa tint, with a solid
   edge as Sherpa's callouts have. A risk it does not cover is neutral. */
.typography .g-handson {
  margin: 1.5rem 0;
  padding: 0.75rem 1rem;
  font-size: var(--g-text-sm);
  border: 1px solid color-mix(in srgb, var(--g-adm-tip) var(--g-adm-edge), var(--guide-bg));
  border-radius: var(--g-radius-lg);
  background: color-mix(in srgb, var(--guide-sherpa) 9%, var(--guide-bg));
}

.typography .g-handson--none {
  border-color: var(--guide-border);
  background: var(--guide-surface-2);
}

.typography .g-handson__title {
  margin: 0 0 0.45rem;
  font-weight: 700;
}

.typography .g-handson__title a {
  color: var(--guide-sherpa-ink);
}

.typography .g-handson__title a::after {
  content: "";
  display: inline-block;
  width: 0.8em;
  height: 0.8em;
  margin-left: 0.3em;
  vertical-align: -0.05em;
  background-color: currentColor;
  -webkit-mask: var(--g-icon-external) center / contain no-repeat;
  mask: var(--g-icon-external) center / contain no-repeat;
}

.typography .g-handson > p:not(.g-handson__title) {
  margin: 0;
  color: var(--guide-muted);
}

.typography .g-handson > ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0.625rem 0 0;
  padding: 0;
  list-style: none;
}

.typography .g-handson > ul > li {
  margin: 0;
}

/* ---------------------------------------------------------------- Next steps */

/* A risk page's next steps are two quiet rows: its related risks as chips, and its ids in the OWASP crosswalk. Each
   label links the whole table its row comes from, the risk matrix or the crosswalk. Both read alike, as muted labels
   that take the text color and an underline under a fine pointer or keyboard focus, so the chips and the ids stay the
   links that stand out. On a touch screen they keep a faint underline instead. Each label sits over its row on a phone
   and beside it from 480px. The pager under the page is the way on. */
.typography .g-next {
  margin: 1rem 0 0;
  font-size: var(--g-text-sm);
}

.typography .g-next > dl {
  display: grid;
  gap: 0.875rem;
  margin: 0;
}

.typography .g-next__row {
  display: grid;
  gap: 0.375rem;
}

@media screen and (min-width: 30rem) {
  .typography .g-next > dl {
    grid-template-columns: max-content minmax(0, 1fr);
    align-items: baseline;
    gap: 0.75rem 1.25rem;
  }

  .typography .g-next__row {
    display: contents;
  }
}

.typography .g-next dt {
  margin: 0;
  color: var(--guide-muted);
  font-weight: 500;
}

.typography .g-next dt > a {
  color: inherit;
  text-decoration-line: none;
  transition: color 150ms ease;
}

.typography .g-next dt > a:focus-visible {
  color: var(--guide-fg);
  text-decoration-line: underline;
}

@media (hover: hover) and (pointer: fine) {
  .typography .g-next dt > a:hover {
    color: var(--guide-fg);
    text-decoration-line: underline;
  }
}

/* Without a fine pointer that can hover, a reader never sees that underline, so the labels keep a faint one. */
@media not all and (hover: hover) and (pointer: fine) {
  .typography .g-next dt > a {
    text-decoration-line: underline;
    text-decoration-color: color-mix(in srgb, currentColor 45%, transparent);
    text-underline-offset: 0.2em;
  }
}

.typography .g-next dd {
  margin: 0;
}

.typography ul.g-next__risks {
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.typography .g-next__risks > li {
  margin: 0;
}

.typography .g-next__risks .g-chip {
  gap: 0.35em;
}

/* ---------------------------------------------------------------- Pager */

/* The pager under the page (overrides/templates/bottom_navigation.html). The previous page is a quiet link, muted
   text after an arrow, whose title wraps beside the arrow. Inline padding, taken back by a negative margin, gives its
   focus ring room around the arrow, which stays on the column's edge. It presses in on a tap like the card. */
.g-pager__previous {
  display: inline-flex;
  align-items: flex-start;
  gap: 0.5rem;
  justify-self: start;
  min-height: 1.5rem;
  margin-inline: -0.375rem;
  padding: 0.25rem 0.375rem;
  color: var(--guide-muted);
  font-size: var(--g-text-sm);
  font-weight: 500;
  line-height: 1.45;
  text-decoration: none;
  border-radius: var(--g-radius-sm);
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  transition: color 150ms ease, transform 150ms cubic-bezier(0.23, 1, 0.32, 1);
}

.g-pager__previous svg {
  flex: none;
  width: 1rem;
  height: 1rem;
  margin-top: 0.125rem;
}

.g-pager__previous:focus-visible {
  color: var(--guide-fg);
}

.g-pager__previous:active {
  color: var(--guide-fg);
  transform: scale(0.985);
}

/* The next page is the one card at the end of a page: a label, the title, and the page's summary in full as the
   reason to read on, with an arrow at the right. It presses in on a tap, as the guide's other cards do. */
.g-pager__next {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.125rem 1rem;
  padding: 0.875rem 1rem 0.9375rem 1.125rem;
  color: var(--guide-fg);
  text-decoration: none;
  border: 1px solid var(--guide-card-border);
  border-radius: var(--g-radius-lg);
  background: var(--guide-card-surface);
  box-shadow: var(--guide-card-shadow);
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  transition: border-color 150ms ease, transform 150ms cubic-bezier(0.23, 1, 0.32, 1);
}

.g-pager__next > span {
  grid-column: 1;
  min-width: 0;
}

.g-pager__label {
  color: var(--guide-muted);
  font-size: var(--g-text-xs);
  font-weight: 500;
  line-height: 1.5;
}

/* The colon after the label is for screen readers, which read the card as "Next: <title>". It stays inline, so it
   adds no space to that name, at no size. */
.g-pager__colon {
  font-size: 0;
}

.g-pager__title {
  font-size: var(--g-text-base);
  font-weight: 600;
  line-height: 1.4;
  text-wrap: pretty;
}

.g-pager__reason {
  margin-top: 0.25rem;
  color: var(--guide-muted);
  font-size: var(--g-text-sm);
  line-height: 1.5;
  text-wrap: pretty;
}

/* A date in the reason stays on one line (the template wraps each date in a time element). */
.g-pager__reason time {
  white-space: nowrap;
}

.g-pager__next svg {
  grid-column: 2;
  grid-row: 1 / span 3;
  align-self: center;
  width: 1.125rem;
  height: 1.125rem;
  color: var(--guide-muted);
  transition: color 150ms ease;
}

.g-pager__next:focus-visible {
  border-color: color-mix(in srgb, var(--dg-accent) 24%, var(--guide-border-strong));
}

.g-pager__next:focus-visible svg {
  color: var(--guide-accent);
}

.g-pager__next:active {
  transform: scale(0.985);
}

@media (hover: hover) and (pointer: fine) {
  .g-pager__previous:hover {
    color: var(--guide-fg);
  }

  .g-pager__next:hover {
    border-color: color-mix(in srgb, var(--dg-accent) 24%, var(--guide-border-strong));
  }

  .g-pager__next:hover svg {
    color: var(--guide-accent);
  }
}

@media (prefers-reduced-motion: reduce) {
  .g-pager__previous,
  .g-pager__next,
  .g-pager__next svg {
    transition: none;
  }

  .g-pager__previous:active,
  .g-pager__next:active {
    transform: none;
  }
}

/* ---------------------------------------------------------------- Seen in production (inside the attack card) */

.typography .g-seen {
  position: relative;
  margin: 1.25rem 0 1.25rem;
  padding: 0.875rem 0 0 1.875rem;
  font-size: var(--g-text-sm);
  line-height: 1.55;
  border-top: 1px dashed color-mix(in srgb, var(--guide-risk) 45%, var(--guide-border));
}

.typography .g-seen::before {
  content: "";
  position: absolute;
  top: 1.0625rem;
  left: 0;
  width: 1.25rem;
  height: 1.25rem;
  background-color: var(--guide-risk);
  -webkit-mask: var(--g-icon-seen) center / contain no-repeat;
  mask: var(--g-icon-seen) center / contain no-repeat;
}

/* ---------------------------------------------------------------- Diagrams */

.typography .g-diagram {
  container: g-figure / inline-size;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1rem;
  width: auto;
  max-width: none;
  margin: 2rem 0;
  padding: 0.75rem 0 0.5rem;
  text-align: left;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.typography .g-diagram__caption {
  flex: 1 0 100%;
  min-width: 0;
  max-width: none;
  margin: 0 0 0.75rem;
  color: var(--guide-fg);
  font-size: var(--g-text-sm);
  font-style: normal;
  font-weight: 600;
  text-align: left;
}

.typography .g-diagram__art {
  flex: 1 0 100%;
  min-width: 0;
  margin-bottom: 0.5rem;
}

.typography .g-diagram__art svg {
  display: block;
  max-width: 100%;
  height: auto;
  margin-inline: auto;
}

.typography .g-diagram__art--narrow {
  display: none;
}

.typography details.g-diagram__desc {
  margin: 0 auto 0 0;
  padding: 0;
  font-size: var(--g-text-sm);
  border: 0;
  background: none;
  box-shadow: none;
  overflow: visible;
}

.typography details.g-diagram__desc[open] {
  flex: 1 0 100%;
  min-width: 0;
  margin-right: 0;
}

.typography details.g-diagram__desc > summary {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  margin: 0;
  padding: 0.3125rem 0.625rem 0.3125rem 0.375rem;
  color: var(--guide-muted);
  font-weight: 550;
  border-radius: var(--g-radius-sm);
  background: none;
  cursor: pointer;
}

@media (hover: hover) and (pointer: fine) {
  .typography details.g-diagram__desc > summary:hover {
    color: var(--guide-fg);
    background: var(--guide-surface);
  }
}

/* The chevron before the summary is the guide's own; shadcn draws its chevron after a summary, at the end of a
   collapsible card. */
.typography details.g-diagram__desc > summary::before {
  content: "";
  flex: none;
  width: 1.125rem;
  height: 1.125rem;
  background-color: currentColor;
  -webkit-mask: var(--g-icon-chevron) center / contain no-repeat;
  mask: var(--g-icon-chevron) center / contain no-repeat;
  transition: transform 0.25s;
}

.typography details.g-diagram__desc[open] > summary::before {
  transform: rotate(90deg);
}

.typography details.g-diagram__desc > summary::after {
  display: none;
}

.typography details.g-diagram__desc > p {
  margin: 0.625rem 0 0.5rem;
  color: var(--guide-muted);
  line-height: 1.6;
}

.typography .g-diagram__open {
  display: inline-flex;
  align-items: center;
  min-height: 1.75rem;
  margin: 0;
  padding-block: 0.1875rem;
  color: var(--guide-muted);
  font-size: var(--g-text-sm);
}

.typography .g-diagram__open::after {
  content: "";
  flex: none;
  display: inline-block;
  width: 0.8em;
  height: 0.8em;
  margin-left: 0.3em;
  background-color: currentColor;
  -webkit-mask: var(--g-icon-external) center / contain no-repeat;
  mask: var(--g-icon-external) center / contain no-repeat;
}

/* The figure switches to the narrow SVG below 43.75rem (700px) of drawing width. With 13.5-unit smallest text,
   wide layouts up to 829 units keep 11.4px or more above 700px. Measured in Chromium, where the root's stable
   scrollbar gutter takes 10px, a 768px tablet gives the drawing 710px of width (11.7px on an 819-unit drawing) and a
   desktop gives it the 760px page column (12.5px). */
@container g-figure (max-width: 43.75rem) {
  .typography .g-diagram__art--wide {
    display: none;
  }

  .typography .g-diagram__art--narrow {
    display: block;
  }
}

/* Wide layouts from 900 units switch at 52.5rem (840px), where 13.5-unit text holds 11.4px up to 994 units
   (floor(840 * 13.5 / 11.4)). Diagram tests reject wide widths of 878 to 899 and of 995 or more. */
@container g-figure (max-width: 52.5rem) {
  .typography .g-diagram__art--wide:has(> svg:is([width^="9"], [width^="10"], [width^="11"], [width^="12"])) {
    display: none;
  }

  .typography .g-diagram__art--wide:has(> svg:is([width^="9"], [width^="10"], [width^="11"], [width^="12"])) + .g-diagram__art--narrow {
    display: block;
  }
}

/* Wide layouts of 830 to 879 units switch at 46.3rem, where an 877-unit layout's 13.5-unit text reaches 11.4px.
   On a tablet their figure bleeds into the page padding while the column is narrower (below). */
@container g-figure (max-width: 46.3rem) {
  .typography .g-diagram__art--wide:has(> svg:is([width^="83"], [width^="84"], [width^="85"], [width^="86"], [width^="87"])) {
    display: none;
  }

  .typography .g-diagram__art--wide:has(> svg:is([width^="83"], [width^="84"], [width^="85"], [width^="86"], [width^="87"])) + .g-diagram__art--narrow {
    display: block;
  }
}

/* On a tablet the figure keeps to the text column, where every drawing up to 829 units holds the 11.4px floor. A
   drawing of 830 to 879 units needs 46.3rem. While the column is narrower, at the low end of the 768px and 1024px
   layouts, that figure alone bleeds 1rem into the page padding so it keeps its wide drawing (11.42px at 768px), and
   its caption, text description, and full-size link stay in the text column. */
@media screen and (min-width: 48rem) and (max-width: 79.984375rem) {
  @container g-content (width < 46.3rem) {
    .typography .g-diagram:has(> .g-diagram__art--wide > svg:is([width^="83"], [width^="84"], [width^="85"], [width^="86"], [width^="87"])) {
      --g-bleed: 1rem;
      margin-inline: -1rem;
    }

    .typography .g-diagram > details.g-diagram__desc {
      margin-left: var(--g-bleed, 0);
    }

    .typography .g-diagram > :is(.g-diagram__caption, details.g-diagram__desc[open], .g-diagram__open) {
      margin-inline: var(--g-bleed, 0);
    }

    .typography .g-diagram > :is(.g-diagram__caption, details.g-diagram__desc[open]) {
      flex-basis: calc(100% - 2 * var(--g-bleed, 0rem));
    }
  }
}

/* On a phone the figure is a band between two rules. The rules, caption, and links stay in the text column, as
   Sherpa keeps its code blocks, tables, and rules. The drawing alone runs into the article's 1rem side padding. Only
   a figure placed directly in the column has that padding beside it, so only its drawing bleeds. The narrow layout's
   15-unit text needs 336px of its 360px to reach the 14px floor for diagram text on a phone. A phone's scrollbar
   takes no room, so at 360px the drawing gets 344px (14.3px text), and from 376px up it keeps its 360px (15px).
   Desktop Chromium reserves a 10px scrollbar gutter, so there a 390px window gives the drawing 360px and a 360px
   window gives it 334px. The caption and the open text description fill their own line, so their flex basis gives
   back their two 1rem margins; without that they run 2rem past the text column and the page scrolls sideways. */
@media screen and (max-width: 29.984375em) {
  .typography .g-diagram {
    margin-inline: -1rem;
    padding: 0.75rem 0 0.5rem;
    border-width: 0;
    border-radius: 0;
  }

  .typography > .g-diagram > .g-diagram__art {
    flex: 0 0 100%;
    margin-inline: 0;
  }

  .typography details.g-diagram__desc {
    margin-left: 1rem;
  }

  .typography .g-diagram__caption,
  .typography details.g-diagram__desc[open],
  .typography .g-diagram__open {
    margin-inline: 1rem;
  }

  .typography .g-diagram__caption,
  .typography details.g-diagram__desc[open] {
    flex-basis: calc(100% - 2rem);
  }
}

/* ---------------------------------------------------------------- Contributors */

/* The home page credits each author with the GitHub mark inside the link to their profile, as the old site did. The
   mark is the header's, drawn as a mask so it takes the link's color in both schemes. */
.typography a.g-github::before {
  --g-github: url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 438.549 438.549"><path d="M409.132 114.573c-19.608-33.596-46.205-60.194-79.798-79.8-33.598-19.607-70.277-29.408-110.063-29.408-39.781 0-76.472 9.804-110.063 29.408-33.596 19.605-60.192 46.204-79.8 79.8C9.803 148.168 0 184.854 0 224.63c0 47.78 13.94 90.745 41.827 128.906 27.884 38.164 63.906 64.572 108.063 79.227 5.14.954 8.945.283 11.419-1.996 2.475-2.282 3.711-5.14 3.711-8.562 0-.571-.049-5.708-.144-15.417a2549.81 2549.81 0 01-.144-25.406l-6.567 1.136c-4.187.767-9.469 1.092-15.846 1-6.374-.089-12.991-.757-19.842-1.999-6.854-1.231-13.229-4.086-19.13-8.559-5.898-4.473-10.085-10.328-12.56-17.556l-2.855-6.57c-1.903-4.374-4.899-9.233-8.992-14.559-4.093-5.331-8.232-8.945-12.419-10.848l-1.999-1.431c-1.332-.951-2.568-2.098-3.711-3.429-1.142-1.331-1.997-2.663-2.568-3.997-.572-1.335-.098-2.43 1.427-3.289 1.525-.859 4.281-1.276 8.28-1.276l5.708.853c3.807.763 8.516 3.042 14.133 6.851 5.614 3.806 10.229 8.754 13.846 14.842 4.38 7.806 9.657 13.754 15.846 17.847 6.184 4.093 12.419 6.136 18.699 6.136 6.28 0 11.704-.476 16.274-1.423 4.565-.952 8.848-2.383 12.847-4.285 1.713-12.758 6.377-22.559 13.988-29.41-10.848-1.14-20.601-2.857-29.264-5.14-8.658-2.286-17.605-5.996-26.835-11.14-9.235-5.137-16.896-11.516-22.985-19.126-6.09-7.614-11.088-17.61-14.987-29.979-3.901-12.374-5.852-26.648-5.852-42.826 0-23.035 7.52-42.637 22.557-58.817-7.044-17.318-6.379-36.732 1.997-58.24 5.52-1.715 13.706-.428 24.554 3.853 10.85 4.283 18.794 7.952 23.84 10.994 5.046 3.041 9.089 5.618 12.135 7.708 17.705-4.947 35.976-7.421 54.818-7.421s37.117 2.474 54.823 7.421l10.849-6.849c7.419-4.57 16.18-8.758 26.262-12.565 10.088-3.805 17.802-4.853 23.134-3.138 8.562 21.509 9.325 40.922 2.279 58.24 15.036 16.18 22.559 35.787 22.559 58.817 0 16.178-1.958 30.497-5.853 42.966-3.9 12.471-8.941 22.457-15.125 29.979-6.191 7.521-13.901 13.85-23.131 18.986-9.232 5.14-18.182 8.85-26.84 11.136-8.662 2.286-18.415 4.004-29.263 5.146 9.894 8.562 14.842 22.077 14.842 40.539v60.237c0 3.422 1.19 6.279 3.572 8.562 2.379 2.279 6.136 2.95 11.276 1.995 44.163-14.653 80.185-41.062 108.068-79.226 27.88-38.161 41.825-81.126 41.825-128.906-.01-39.771-9.818-76.454-29.414-110.049z"/></svg>');
  content: "";
  display: inline-block;
  width: 1em;
  height: 1em;
  margin-right: 0.375em;
  vertical-align: -0.125em;
  background-color: currentColor;
  -webkit-mask: var(--g-github) center / contain no-repeat;
  mask: var(--g-github) center / contain no-repeat;
}

@media (forced-colors: active) {
  .typography a.g-github::before {
    forced-color-adjust: none;
    background-color: LinkText;
  }
}

/* ---------------------------------------------------------------- Footer */

/* Sherpa's footer: muted lines centered, with no rule above them. The text takes the footer template's sizes, 12px
   on a phone and 14px from 640px. */
.g-footer__inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  padding-block: 0.75rem;
  line-height: 1.5;
}

.g-footer__inner > .g-footer__credit {
  margin: 0;
  color: var(--guide-muted);
}

.g-footer a {
  color: var(--guide-muted);
}

.g-footer a:focus-visible {
  color: var(--guide-fg);
}

@media (hover: hover) and (pointer: fine) {
  .g-footer a:hover {
    color: var(--guide-fg);
  }
}

.g-footer-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.5rem 1.25rem;
  margin: 0;
  padding: 0;
}

.g-footer-links :is(a, .g-footer-links__cookies) {
  display: inline-flex;
  align-items: center;
  min-height: 1.5rem;
  padding-block: 0.25rem;
  color: var(--guide-muted);
  font: inherit;
  text-decoration: underline;
  text-decoration-color: color-mix(in srgb, currentColor 40%, transparent);
  text-underline-offset: 0.2em;
}

.g-footer-links :is(a, .g-footer-links__cookies):focus-visible {
  color: var(--guide-fg);
}

@media (hover: hover) and (pointer: fine) {
  .g-footer-links :is(a, .g-footer-links__cookies):hover {
    color: var(--guide-fg);
  }
}

.g-footer-links__cookies {
  padding-inline: 0;
  border: 0;
  background: none;
  cursor: pointer;
}

/* guide.js toggles these with the hidden attribute; the display rules above must not undo it. */
.g-footer-links .g-footer-links__cookies[hidden],
.g-feedback[hidden],
.g-feedback__button[hidden],
.g-feedback__thanks[hidden] {
  display: none;
}

/* Feedback widget: one compact line under a rule, the question and then two small votes. */
.g-feedback {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.375rem;
  margin: 0;
  padding-top: 1rem;
  border-top: 1px solid var(--guide-border);
}

.g-feedback__title {
  margin: 0 0.5rem 0 0;
  color: var(--guide-muted);
  font-size: var(--g-text-sm);
  font-weight: 500;
}

/* The vote buttons are shadcn outline buttons (overrides/partials/feedback.html), cut down to a 30px row that
   keeps a 44px-wide target. */
.g-feedback__button {
  min-width: 2.75rem;
  height: 1.875rem;
  padding-inline: 0.75rem;
  font-size: var(--g-text-sm);
  cursor: pointer;
}

.g-feedback__thanks {
  flex-basis: 100%;
  margin: 0;
  color: var(--guide-muted);
  font-size: var(--g-text-sm);
}

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

@media (prefers-reduced-motion: no-preference) {
  .typography .g-journey__step > a,
  .typography .g-journey__step > a::after,
  .g-feedback__button {
    transition: color 0.15s ease, background-color 0.15s ease, border-color 0.15s ease;
  }
}
