/*
 * Components, group A: the risk page banner, the home hero, risk cards and path cards, chips, hover cards, status
 * badges, capabilities, and the coverage legend. Every color and size comes from tokens.css.
 *
 * Portions adapted from Sherpa, the MCP Security Summit Workshop (https://github.com/Azure-Samples/sherpa):
 * the page banner and icon tile, and the hero and route cards.
 *
 * 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.
 */

/* ---------------------------------------------------------------- Page banner */

/* Sherpa's camp banner: a deep gradient card with the section pill, the page title, and the summary beside an icon
   tile. The risk pages add a meta row under a rule: coverage, the OWASP id, other names, services, and the
   specification version. */
.typography .g-banner {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas:
    "eyebrow icon"
    "title icon"
    "summary icon"
    "meta meta";
  align-items: center;
  column-gap: 2.5rem;
  clear: both;
  margin: 0 0 2rem;
  padding: 2rem 2.25rem;
  overflow: hidden;
  color: var(--guide-banner-fg);
  border-radius: var(--g-radius-lg);
  background: linear-gradient(135deg, var(--guide-banner-from) 0%, color-mix(in srgb, var(--guide-banner-from) 45%, var(--guide-banner-to)) 55%, var(--guide-banner-to) 100%);
  isolation: isolate;
}

/* A faint grid in the top right corner; generic geometry, no illustration. */
.typography .g-banner::before {
  content: "";
  position: absolute;
  inset: 0 0 0 45%;
  z-index: -1;
  background-image:
    linear-gradient(to right, rgb(255 255 255 / 0.07) 1px, transparent 1px),
    linear-gradient(to bottom, rgb(255 255 255 / 0.07) 1px, transparent 1px);
  background-size: 1.5rem 1.5rem;
  -webkit-mask-image: radial-gradient(ellipse 70% 90% at 85% 20%, #000 20%, transparent 75%);
  mask-image: radial-gradient(ellipse 70% 90% at 85% 20%, #000 20%, transparent 75%);
}

.typography .g-banner__eyebrow {
  grid-area: eyebrow;
  justify-self: start;
  margin: 0 0 0.75rem;
  padding: 0.1875rem 0.8125rem;
  color: rgb(255 255 255 / 0.92);
  font-size: var(--g-text-xs);
  font-weight: 700;
  line-height: 1.5;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  border: 1px solid rgb(255 255 255 / 0.4);
  border-radius: var(--g-radius-pill);
}

.typography .g-banner > h1 {
  grid-area: title;
  margin: 0;
  color: var(--guide-banner-fg);
  font-size: var(--g-text-3xl);
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: -0.025em;
}

.typography .g-banner > h1 .headerlink {
  color: rgb(255 255 255 / 0.75);
}

.typography .g-banner__summary {
  grid-area: summary;
  max-width: 47.5rem;
  margin: 0.625rem 0 0;
  color: rgb(255 255 255 / 0.86);
  font-size: var(--g-text-base);
  line-height: 1.6;
}

.typography ul.g-banner__meta {
  grid-area: meta;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5625rem 0.625rem;
  margin: 1.5rem 0 0;
  padding: 1.25rem 0 0;
  color: rgb(255 255 255 / 0.86);
  font-size: var(--g-text-sm);
  list-style: none;
  border-top: 1px solid rgb(255 255 255 / 0.16);
}

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

.typography .g-banner__meta > li:nth-child(2) {
  font-family: var(--g-font-mono);
  font-size: var(--g-text-xs);
}

.typography .g-banner__icon {
  grid-area: icon;
  display: grid;
  place-items: center;
  width: 7.5rem;
  height: 7.5rem;
  color: rgb(255 255 255 / 0.9);
  border: 1px solid rgb(255 255 255 / 0.18);
  border-radius: 1.5rem;
  background: rgb(255 255 255 / 0.08);
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 0.12), 0 12px 30px -12px rgb(0 0 0 / 0.5);
}

.typography .g-banner__icon svg {
  width: 3.75rem;
  height: 3.75rem;
  fill: currentColor;
}

/* Chips and badges on the dark banner. */
.typography .g-banner .g-chip {
  color: #ffffff;
  border-color: rgb(255 255 255 / 0.32);
  background: rgb(255 255 255 / 0.08);
}

.typography .g-banner a.g-chip:focus-visible {
  color: #ffffff;
  border-color: rgb(255 255 255 / 0.8);
  background: rgb(255 255 255 / 0.16);
}

@media (hover: hover) and (pointer: fine) {
  .typography .g-banner a.g-chip:hover {
    color: #ffffff;
    border-color: rgb(255 255 255 / 0.8);
    background: rgb(255 255 255 / 0.16);
  }
}

.typography .g-banner .g-badge {
  color: #ffffff;
}

.typography .g-banner .g-badge__label {
  border-color: rgb(255 255 255 / 0.6);
  background: rgb(255 255 255 / 0.12);
}

.typography .g-banner .g-badge__label::before {
  background: var(--g-badge-on-dark);
}

@media screen and (max-width: 44.984375em) {
  .typography .g-banner {
    grid-template-areas:
      "eyebrow icon"
      "title title"
      "summary summary"
      "meta meta";
    column-gap: 1.25rem;
    padding: 1.625rem 1.375rem 1.5rem;
  }

  .typography .g-banner > h1 {
    margin-top: 0.25rem;
    font-size: 1.625rem;
  }

  .typography .g-banner__eyebrow {
    align-self: center;
    margin: 0;
  }

  .typography .g-banner__icon {
    width: 3.25rem;
    height: 3.25rem;
    border-radius: 0.875rem;
  }

  .typography .g-banner__icon svg {
    width: 1.75rem;
    height: 1.75rem;
  }

  .typography ul.g-banner__meta {
    margin-top: 1.25rem;
    padding-top: 1rem;
  }

  /* The first three services and a count; the risk page's Azure solution section lists them all. The
     specification version repeats the bar above the header. */
  .typography .g-banner__meta > :is(.g-banner__extra, .g-banner__spec) {
    display: none;
  }

  .typography .g-banner__meta > li.g-banner__more {
    display: list-item;
  }
}

/* Keep the eyebrow pill on one line beside the icon tile down to 320px phones. */
@media screen and (max-width: 23.984375em) {
  .typography .g-banner {
    column-gap: 0.75rem;
    padding: 1.375rem 1.125rem 1.25rem;
  }

  .typography .g-banner__eyebrow {
    padding: 0.1875rem 0.625rem;
    letter-spacing: 0.06em;
  }

  .typography .g-banner__icon {
    width: 2.75rem;
    height: 2.75rem;
    border-radius: 0.75rem;
  }

  .typography .g-banner__icon svg {
    width: 1.5rem;
    height: 1.5rem;
  }
}

.typography .g-banner__meta > .g-banner__more {
  display: none;
}

.typography .g-banner .g-chip--more {
  color: rgb(255 255 255 / 0.86);
  border-color: transparent;
  background: none;
}

/* ---------------------------------------------------------------- Chips */

/* A chip names a risk, an Azure service, or a Sherpa camp inside a component: a card, a table, the banner, or
   the related-pages list. Running text names them as plain links instead, as Sherpa does. Text never drops under
   12px. */
.typography .g-chip {
  display: inline;
  padding: 0.12em 0.5em;
  color: var(--guide-fg);
  font-size: max(0.85em, var(--g-text-xs));
  font-weight: 500;
  line-height: 1.45;
  vertical-align: baseline;
  border: 1px solid var(--guide-border);
  border-radius: var(--g-radius-sm);
  background: var(--guide-surface);
}

/* A long chip breaks between words, never inside an id or a label word. */
.typography .g-chip {
  word-break: normal;
  overflow-wrap: break-word;
}

.typography .g-chip__id {
  white-space: nowrap;
}

/* A risk or camp chip keeps one box that wraps inside its border: a row header, a risk or camp in a cell, a camp
   in the hands-on card, and the risks of an incident or a service. A service name stays whole everywhere. Every
   interactive chip keeps at least a 24px target height. */
.typography a.g-chip {
  display: inline-flex;
  align-items: baseline;
  min-height: 1.5rem;
  padding-block: 0.15rem;
}

.typography th[scope="row"] .g-chip,
.typography td :is(.g-chip--camp, .g-chip--risk),
.typography .g-handson .g-chip,
.typography :is(.g-incident__risks, .g-service__risks) .g-chip {
  display: inline-flex;
  align-items: baseline;
  gap: 0.35em;
  max-width: 100%;
  padding-block: 0.15rem;
}

.typography td > .g-chip {
  margin-block: 0.125rem;
}

.typography :is(th[scope="row"], .g-incident__risks, .g-service__risks) .g-chip__label {
  min-width: 0;
}

.typography .g-chip--service {
  white-space: nowrap;
}

/* The count of services the banner leaves out reads as a note on the list, not as one more service. */
.typography .g-chip--more {
  padding-inline: 0.15em;
  color: var(--guide-muted);
  font-weight: 550;
  font-variant-numeric: tabular-nums;
  border-color: transparent;
  background: none;
}

.typography a.g-chip:focus-visible {
  color: var(--guide-fg);
  border-color: color-mix(in srgb, var(--guide-accent) 60%, var(--guide-border));
  background: var(--guide-accent-surface);
}

@media (hover: hover) and (pointer: fine) {
  .typography a.g-chip:hover {
    color: var(--guide-fg);
    border-color: color-mix(in srgb, var(--guide-accent) 60%, var(--guide-border));
    background: var(--guide-accent-surface);
  }
}

.typography .g-chip__id {
  color: var(--guide-risk);
  font-family: var(--g-font-mono);
  font-size: max(0.92em, var(--g-text-xs));
  font-weight: 650;
}

.typography .g-chip--camp::before {
  content: "";
  display: inline-block;
  width: 0.5em;
  height: 0.5em;
  margin-right: 0.4em;
  vertical-align: 0.05em;
  border-radius: 50%;
  background: var(--guide-sherpa);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--guide-sherpa-ink) 70%, transparent);
}

/* In a chip that wraps, the dot stays beside the first line. */
.typography th[scope="row"] .g-chip--camp::before,
.typography td .g-chip--camp::before,
.typography .g-handson .g-chip--camp::before {
  flex: none;
  align-self: flex-start;
  margin-top: calc((1.45em - 0.5em) / 2);
  margin-right: 0;
}

.typography .g-chip--camp {
  border-color: color-mix(in srgb, var(--guide-sherpa-ink) 45%, var(--guide-border));
}

.typography a.g-chip--camp:focus-visible {
  border-color: var(--guide-sherpa-ink);
  background: color-mix(in srgb, var(--guide-sherpa) 16%, var(--guide-bg));
}

@media (hover: hover) and (pointer: fine) {
  .typography a.g-chip--camp:hover {
    border-color: var(--guide-sherpa-ink);
    background: color-mix(in srgb, var(--guide-sherpa) 16%, var(--guide-bg));
  }
}

/* ---------------------------------------------------------------- Hover cards */

/* A hover card is shadcn's Hover Card on a native popover: a button that reads as part of its sentence, then the card
   it opens, which hooks/guide_lib/decorate.py and badge.html put right after it. guide.js opens the card on hover and
   keyboard focus; a click or tap opens it natively, and Escape or a tap outside closes it. In the top layer the card
   is never clipped by a scrolling table. This section comes before the badges, whose pill restyles its trigger. */
.typography .g-hovercard__trigger {
  all: unset;
  cursor: help;
  -webkit-tap-highlight-color: transparent;
}

/* A card trigger, its card, and the punctuation after it are one run, so a ")" or "," never starts a line: a term's
   from hovercard.html, a status badge's from decorate.py. */
.typography .g-hovercard__run {
  white-space: nowrap;
}

/* A term or a Markdown trigger is text with a dotted underline, as an abbreviation was; it turns solid while its card
   is open. */
.typography .g-hovercard__trigger:not(.g-badge__label) {
  white-space: normal;
  text-decoration: underline dotted color-mix(in srgb, var(--guide-muted) 70%, var(--guide-bg));
  text-decoration-thickness: from-font;
  text-underline-offset: 0.2em;
}

.typography .g-hovercard__trigger:not(.g-badge__label):has(+ .g-hovercard:popover-open) {
  text-decoration-line: underline;
  text-decoration-style: solid;
  text-decoration-color: currentColor;
}

/* shadcn draws every button in an article as a primary button, with hover and focus rules that weigh 0,3,2; these
   match that weight and come later, so a trigger keeps its own colors and gets the guide's focus ring. */
article .typography button.g-hovercard__trigger:is(:hover, :focus-visible) {
  background-color: transparent;
  box-shadow: none;
}

article .typography button.g-hovercard__trigger:focus-visible {
  outline: 2px solid var(--guide-focus);
  outline-offset: 2px;
  border-radius: var(--g-radius-sm);
}

@media (hover: hover) and (pointer: fine) {
  article .typography button.g-hovercard__trigger:not(.g-badge__label):hover {
    text-decoration-color: currentColor;
  }
}

/* The card takes the theme's popover surface, radius, padding, small type, and shadow. Its border keeps 3:1 against
   the page, so the card's edge shows over the text under it. */
.typography .g-hovercard[popover] {
  width: max-content;
  min-width: 9.375rem;
  max-width: min(21.875rem, calc(100vw - 1rem));
  margin: auto;
  padding: 0.625rem;
  overflow: visible;
  color: var(--popover-foreground);
  font: 400 var(--g-text-sm) / 1.43 var(--g-font-sans);
  font-style: normal;
  letter-spacing: normal;
  text-align: left;
  white-space: normal;
  border: 1px solid color-mix(in srgb, var(--guide-muted) var(--guide-hovercard-edge), var(--popover));
  border-radius: var(--radius-lg);
  background: var(--popover);
  box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
}

/* The theme's enter animation: the card grows from 95% at its trigger's side and rises 5% into place in 150ms, on a
   strong ease-out. A card that a key or a warm hover opens (data-instant, from guide.js) shows at once. */
.typography .g-hovercard:popover-open {
  --tw-enter-scale: 0.95;
  --tw-enter-translate-y: 5%;
  transform-origin: top center;
  animation: enter 0.15s cubic-bezier(0.23, 1, 0.32, 1);
}

.typography .g-hovercard[data-above] {
  transform-origin: bottom center;
}

@media (prefers-reduced-motion: reduce) {
  .typography .g-hovercard:popover-open {
    animation: none;
  }
}

.typography .g-hovercard:popover-open[data-instant] {
  animation: none;
}

/* The card opens under its trigger, centered on it where it fits and pushed in from a screen edge where it does not;
   with no room below it opens above. Without anchor positioning, guide.js places it the same way. */
@supports (position-area: bottom) {
  .typography .g-hovercard[popover] {
    inset: auto;
    margin: 0.375rem 0.5rem;
    position-area: bottom span-all;
    justify-self: anchor-center;
    position-try-fallbacks: flip-block;
  }
}

.typography .g-hovercard :is(.g-hovercard__meta, .g-hovercard__note) {
  display: block;
}

.typography .g-hovercard time {
  font-variant-numeric: tabular-nums;
}

.typography .g-hovercard__note {
  margin-top: 0.375rem;
}

/* ---------------------------------------------------------------- Badges */

/* A badge is a status or coverage label in a pill. A status badge is the trigger of a hover card that holds the day
   the status was checked, its source, and the capability's note. A badge is one unbreakable run of text, so
   punctuation around it stays on its line. */
.typography .g-badge {
  --g-badge: var(--guide-status-unverified);
  --g-badge-on-dark: #c9d1d9;
  display: inline;
  color: var(--g-badge);
  font-size: var(--g-text-xs);
  font-weight: 650;
  line-height: 1.5;
  letter-spacing: 0.01em;
  white-space: nowrap;
  vertical-align: 0.08em;
}

.typography .g-badge__label {
  padding: 0.12em 0.5em 0.12em 0.45em;
  border: 1px solid var(--g-badge);
  border-radius: var(--g-radius-sm);
  background: color-mix(in srgb, var(--g-badge) 10%, var(--guide-bg));
}

.typography .g-badge__label::before {
  content: "";
  display: inline-block;
  width: 0.45em;
  height: 0.45em;
  margin-right: 0.4em;
  vertical-align: 0.1em;
  border-radius: 50%;
  background: currentColor;
}

.typography .g-badge--full { --g-badge: var(--guide-cov-full); --g-badge-on-dark: #56d364; }
.typography .g-badge--partial { --g-badge: var(--guide-cov-partial); --g-badge-on-dark: #e3b341; }
.typography .g-badge--new { --g-badge: var(--guide-cov-new); --g-badge-on-dark: #d2a8ff; }
.typography .g-badge--ga { --g-badge: var(--guide-status-ga); --g-badge-on-dark: #56d364; }
.typography .g-badge--preview { --g-badge: var(--guide-status-preview); --g-badge-on-dark: #a5d6ff; }
.typography .g-badge--unverified { --g-badge: var(--guide-status-unverified); }
.typography .g-badge--unavailable { --g-badge: var(--guide-status-unavailable); --g-badge-on-dark: #e4e4e7; }

.typography .g-badge--unverified > .g-badge__label {
  border-style: dashed;
}

.typography .g-badge--unverified > .g-badge__label::before {
  background: none;
  box-shadow: inset 0 0 0 1.5px currentColor;
}

/* A documented absence is a settled fact: solid ink and a dash, where an open question is a dashed, paler
   badge with an empty ring. The label carries the meaning; color and shape only repeat it. */
.typography .g-badge--unavailable > .g-badge__label::before {
  width: 0.6em;
  height: max(1.5px, 0.15em);
  vertical-align: 0.25em;
  border-radius: 1px;
}

/* In running text, as in a capability, a badge is a soft tint without an outline, so the sentence reads as words
   rather than a row of boxes. */
.typography :is(.g-cap, p, li, :is(.g-cap, p, li) > .g-hovercard__run) > .g-badge:not(:is(.g-banner, .g-service__capabilities) .g-badge) > .g-badge__label {
  border-color: transparent;
}

/* A status badge's pill keeps its colors under shadcn's button rules, and its tint deepens while a fine pointer rests
   on it or its card is open. */
article .typography button.g-badge__label:is(:hover, :focus-visible) {
  border-color: var(--g-badge);
  background-color: color-mix(in srgb, var(--g-badge) 10%, var(--guide-bg));
}

@media (hover: hover) and (pointer: fine) {
  article .typography button.g-badge__label:hover {
    background-color: color-mix(in srgb, var(--g-badge) 18%, var(--guide-bg));
  }
}

.typography .g-badge__label:has(+ .g-hovercard:popover-open) {
  background-color: color-mix(in srgb, var(--g-badge) 18%, var(--guide-bg));
}

/* A badge whose card holds a caveat marks it with a small i inside its pill, as a separate info button did. The glyph
   is decoration, and the card is the badge's description. */
.typography .g-badge__label:has(+ .g-hovercard .g-hovercard__note)::after {
  content: "i" / "";
  display: inline-grid;
  place-items: center;
  width: 1.05em;
  height: 1.05em;
  margin-left: 0.4em;
  font: 700 0.8em / 1 var(--g-font-sans);
  vertical-align: 0.1em;
  border: 1.25px solid currentColor;
  border-radius: 50%;
}

@media (prefers-reduced-motion: no-preference) {
  .typography button.g-badge__label {
    transition: background-color 0.15s ease;
  }
}

/* ---------------------------------------------------------------- Capability */

/* A capability reads as a phrase: its service as a quiet label, its name as the link, then its status. */
.typography .g-cap {
  display: inline;
}

.typography .g-cap__service {
  color: var(--guide-muted);
  font-weight: 600;
  text-decoration: none;
}

.typography .g-cap__service:focus-visible {
  color: var(--guide-fg);
  text-decoration: underline;
}

@media (hover: hover) and (pointer: fine) {
  .typography .g-cap__service:hover {
    color: var(--guide-fg);
    text-decoration: underline;
  }
}

.typography .g-cap__name {
  font-weight: 500;
}

/* ---------------------------------------------------------------- Coverage legend */

/* A card like the risk and path cards: each coverage badge beside its definition. */
.typography dl:has(> dt > .g-badge) {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: 0.75rem 1.25rem;
  margin: 1.5rem 0;
  padding: 1.25rem 1.375rem;
  border: 1px solid var(--guide-card-border);
  border-radius: var(--g-radius-card);
  background: var(--guide-card-surface);
  box-shadow: var(--guide-card-shadow);
}

.typography dl:has(> dt > .g-badge) > dt {
  margin: 0;
}

.typography dl:has(> dt > .g-badge) > dd {
  margin: 0;
  color: var(--guide-muted);
  font-size: var(--g-text-sm);
}

/* On a phone each definition goes under its badge, at the card's full width. */
@container g-content (max-width: 30rem) {
  .typography dl:has(> dt > .g-badge) {
    grid-template-columns: minmax(0, 1fr);
    row-gap: 0.375rem;
  }

  .typography dl:has(> dt > .g-badge) > dd:not(:last-child) {
    margin-bottom: 0.625rem;
  }
}

/* ---------------------------------------------------------------- Home cards: path cards and risk cards */

/* One card family for the reader paths and the risks, after the skill cards on aiforui.dev: a 12px card that frames a
   recessed screen 6px inside its border, the item's icon lit on the screen, then a title and one muted line. The
   screen is a pale dot grid in the light scheme and a dark scanline panel in the dark one (tokens.css), and it is one
   height at each width: 72px from a 52rem column, 56px below it. The title's link stretches over the card. A fine
   pointer's hover, like the keyboard focus, strengthens the border and turns up the screen's glow; a press scales the
   card a little; nothing lifts. */
.typography :is(ul.g-risk-grid, ul.g-path-grid) {
  --g-card-inset: 0.375rem;
  --g-card-ease: cubic-bezier(0.23, 1, 0.32, 1);
  --g-screen: 3.5rem;
  --g-screen-icon: 1.375rem;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0.625rem;
  margin: 1.25rem 0 1.5rem;
  padding: 0;
  list-style: none;
}

@container g-content (width < 20rem) {
  .typography :is(ul.g-risk-grid, ul.g-path-grid) {
    --g-screen: 2.75rem;
    --g-screen-icon: 1.125rem;
  }
}

@container g-content (min-width: 52rem) {
  .typography :is(ul.g-risk-grid, ul.g-path-grid) {
    --g-screen: 4.5rem;
    --g-screen-icon: 1.75rem;
  }
}

/* Paths: one column on a phone, two from 30rem, and four from 52rem, so they fill one row on a wide screen. */
@container g-content (min-width: 30rem) {
  .typography ul.g-path-grid {
    --g-screen: 4.5rem;
    --g-screen-icon: 1.75rem;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem;
  }
}

@container g-content (min-width: 52rem) {
  .typography ul.g-path-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

/* Risks: two columns while each card's text column keeps 240px. Beside the text a card takes 2px of border, the 6px
   inset on each side, the 56px screen, a 12px gap, and 10px of text padding: 92px. 2 x (92 + 240) and the 12px grid
   gap make 676px. */
@container g-content (min-width: 42.25rem) {
  .typography ul.g-risk-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem;
  }
}

.typography :is(.g-risk-card, .g-path-card) {
  position: relative;
  margin: 0;
  border: 1px solid var(--guide-card-border);
  border-radius: var(--g-radius-lg);
  background: var(--guide-card-surface);
  box-shadow: var(--guide-card-shadow);
  transition: transform 150ms var(--g-card-ease);
}

/* The hover and focus border, faded in over the card's own, taking a little of the indigo in both schemes. */
.typography :is(.g-risk-card, .g-path-card)::before {
  content: "";
  position: absolute;
  inset: -1px;
  border: 1px solid color-mix(in srgb, var(--dg-accent) 24%, var(--guide-border-strong));
  border-radius: inherit;
  opacity: 0;
  pointer-events: none;
  transition: opacity 150ms ease;
}

.typography :is(.g-risk-card, .g-path-card):active {
  transform: scale(0.985);
}

.typography :is(.g-risk-card, .g-path-card):has(:focus-visible)::before,
.typography :is(.g-risk-card, .g-path-card):has(:focus-visible) :is(.g-risk-card__screen, .g-path-card__screen)::before {
  opacity: 1;
}

/* Touch screens keep a hover after a tap, so only a fine pointer that hovers gets one. */
@media (hover: hover) and (pointer: fine) {
  .typography :is(.g-risk-card, .g-path-card):hover::before,
  .typography :is(.g-risk-card, .g-path-card):hover :is(.g-risk-card__screen, .g-path-card__screen)::before {
    opacity: 1;
  }
}

/* The screen. Its corners are concentric with the card's: 12px less the 1px border and the 6px inset. It isolates its
   layers, so the link stretched over the card stays on top of its icon. */
.typography :is(.g-risk-card__screen, .g-path-card__screen) {
  position: relative;
  isolation: isolate;
  display: grid;
  place-items: center;
  width: var(--g-screen);
  height: var(--g-screen);
  overflow: hidden;
  border-radius: calc(var(--g-radius-lg) - 1px - var(--g-card-inset));
  background:
    radial-gradient(circle, var(--guide-screen-dot) 1px, transparent 1px) center / 7px 7px,
    linear-gradient(var(--guide-screen-lit), var(--guide-screen-shade)) var(--guide-screen-surface);
  box-shadow:
    inset 0 0 0 1px var(--guide-screen-rim),
    inset 0 1px 2px var(--guide-screen-rim);
}

/* The glow behind the icon: low at rest, full while the card is hovered or focused. */
.typography :is(.g-risk-card__screen, .g-path-card__screen)::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: radial-gradient(circle, var(--guide-screen-glow), transparent 72%);
  opacity: 0.2;
  pointer-events: none;
  transition: opacity 150ms ease;
}

/* The screen's edge falls off, and in the dark scheme scanlines cross it. */
.typography :is(.g-risk-card__screen, .g-path-card__screen)::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background:
    radial-gradient(ellipse 84% 84%, transparent 50%, var(--guide-screen-vignette)),
    repeating-linear-gradient(var(--guide-screen-scanline) 0 1px, transparent 1px 3px);
  pointer-events: none;
}

.typography :is(.g-risk-card__screen, .g-path-card__screen) > svg {
  position: relative;
  z-index: 1;
  width: var(--g-screen-icon);
  height: var(--g-screen-icon);
  color: var(--dg-accent);
  fill: currentColor;
  filter: drop-shadow(0 1px 4px color-mix(in srgb, var(--dg-accent) 18%, transparent));
}

/* The dark scheme's screen is lit from the middle with the icon glowing. Paper keeps the light scheme's. */
@media screen {
  .dark .typography :is(.g-risk-card__screen, .g-path-card__screen) {
    background: radial-gradient(ellipse 90% 85% at 50% 42%, var(--guide-screen-lit), var(--guide-screen-surface) 64%, var(--guide-screen-shade));
    box-shadow:
      inset 0 0 0 1px var(--guide-screen-rim),
      inset 0 1px 0 var(--guide-screen-rim),
      inset 0 0 18px rgb(0 0 0 / 0.68);
  }

  .dark .typography :is(.g-risk-card__screen, .g-path-card__screen) > svg {
    filter:
      drop-shadow(0 0 3px color-mix(in srgb, var(--dg-accent) 45%, transparent))
      drop-shadow(0 0 10px color-mix(in srgb, var(--dg-accent) 22%, transparent));
  }
}

/* The title's link covers the card, out to its border, and draws the focus ring 2px outside it. */
.typography :is(.g-risk-card__link, .g-path-card__link) {
  color: inherit;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.typography :is(.g-risk-card__link, .g-path-card__link)::after {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: var(--g-radius-lg);
}

.typography :is(.g-risk-card__link, .g-path-card__link):focus-visible {
  outline: none !important;
}

.typography :is(.g-risk-card__link, .g-path-card__link):focus-visible::after {
  outline: var(--g-focus-width) solid var(--guide-focus);
  outline-offset: 2px;
}

.typography :is(.g-risk-card__body, .g-path-card__body) {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  min-width: 0;
}

.typography :is(.g-risk-card__title, .g-path-card__title) {
  margin: 0;
  color: var(--guide-fg);
  font-size: 0.9375rem;
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: -0.015em;
  overflow-wrap: anywhere;
  text-box: trim-start cap alphabetic;
  text-wrap: balance;
}

.typography :is(.g-risk-card__summary, .g-path-card__question) {
  margin: 0;
  color: var(--guide-muted);
  font-size: 0.8125rem;
  line-height: 1.44;
  overflow-wrap: anywhere;
  text-wrap: balance;
}

/* A path card on a phone is a row: the screen, then the role and its question, the title level with the screen's
   top. From 30rem it stands as a card, the screen across its top. Its text sits 16px inside the border either way. */
.typography .g-path-card {
  display: grid;
  grid-template-columns: var(--g-screen) minmax(0, 1fr);
  align-items: start;
  column-gap: 0.75rem;
  padding: var(--g-card-inset);
}

.typography .g-path-card__body {
  gap: 0.1875rem;
  padding: 0 0.625rem 0.375rem 0;
}

@container g-content (min-width: 30rem) {
  .typography .g-path-card {
    display: flex;
    flex-direction: column;
  }

  .typography .g-path-card__screen {
    width: 100%;
  }

  .typography .g-path-card__body {
    flex: 1 1 auto;
    gap: 0.25rem;
    padding: 0.625rem;
  }
}

/* A risk card puts the screen beside the title and summary, and closes with a footer across both: the risk's id under
   the screen's edge and its coverage at the right, under a hairline. The footer keeps to the card's foot, so the
   footers of a row line up. */
.typography .g-risk-card {
  display: grid;
  grid-template-columns: var(--g-screen) minmax(0, 1fr);
  grid-template-rows: 1fr auto;
  gap: var(--g-card-inset) 0.75rem;
  padding: var(--g-card-inset) var(--g-card-inset) 0;
}

.typography .g-risk-card__screen {
  align-self: start;
}

.typography .g-risk-card__body {
  padding: 0 0.625rem 0.375rem 0;
}

.typography .g-risk-card__foot {
  display: flex;
  grid-column: 1 / -1;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.4375rem 0.5625rem 0.5rem;
  font-size: var(--g-text-xs);
  line-height: 1.25;
  border-top: 1px solid color-mix(in srgb, var(--guide-border) 55%, transparent);
}

.typography .g-risk-card__id {
  color: var(--guide-muted);
  font-family: var(--g-font-mono);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

.typography .g-risk-card__coverage {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  color: var(--guide-muted);
  font-weight: 500;
  white-space: nowrap;
}

.typography .g-risk-card__coverage::before {
  content: "";
  flex: none;
  width: 0.375rem;
  height: 0.375rem;
  border-radius: 50%;
  background: color-mix(in srgb, var(--g-cov) 76%, var(--guide-muted));
}

.typography .g-risk-card--full { --g-cov: var(--guide-cov-full); }
.typography .g-risk-card--partial { --g-cov: var(--guide-cov-partial); }
.typography .g-risk-card--new { --g-cov: var(--guide-cov-new); }

@media (prefers-reduced-motion: reduce) {
  .typography :is(.g-risk-card, .g-path-card) {
    transition: none;
  }

  .typography :is(.g-risk-card, .g-path-card):active {
    transform: none;
  }
}

@media (forced-colors: active) {
  .typography :is(.g-risk-card__screen, .g-path-card__screen) {
    border: 1px solid CanvasText;
  }

  .typography :is(.g-risk-card__screen, .g-path-card__screen) > svg {
    color: CanvasText;
    fill: currentColor;
  }

  .typography .g-risk-card__coverage::before {
    forced-color-adjust: none;
    background: CanvasText;
  }
}

/* ---------------------------------------------------------------- Hero (home) */

/* Sherpa's hero card: the title, the promise, and two buttons on the deep gradient, beside a picture where the column
   has room for it. The picture is the official Microsoft Azure logo on a porcelain tile, drawn by ::after in its own
   grid column, so the text never runs under it. Nothing moves. */
.typography .g-hero {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas:
    "title"
    "promise"
    "actions";
  align-content: center;
  column-gap: 2.5rem;
  clear: both;
  margin: 0 0 2rem;
  padding: 2.5rem;
  overflow: hidden;
  color: var(--guide-banner-fg);
  border-radius: var(--g-radius-lg);
  background:
    radial-gradient(ellipse 45% 70% at 88% 45%, rgb(140 158 255 / 0.32), transparent 70%),
    linear-gradient(135deg, var(--guide-banner-from) 0%, color-mix(in srgb, var(--guide-banner-from) 40%, var(--guide-banner-to)) 50%, var(--guide-banner-to) 100%);
  isolation: isolate;
}

.typography .g-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background-image:
    linear-gradient(to right, rgb(255 255 255 / 0.07) 1px, transparent 1px),
    linear-gradient(to bottom, rgb(255 255 255 / 0.07) 1px, transparent 1px);
  background-size: 1.75rem 1.75rem;
  -webkit-mask-image: radial-gradient(ellipse 55% 85% at 92% 10%, #000 15%, transparent 72%);
  mask-image: radial-gradient(ellipse 55% 85% at 92% 10%, #000 15%, transparent 72%);
}

.typography .g-hero::after {
  content: "";
  display: none;
  grid-area: art;
  align-self: center;
  z-index: -1;
  width: 8.5rem;
  height: 8.5rem;
  margin-right: 1rem;
  border: 0;
  border-radius: 1.75rem;
  background:
    url("../../assets/images/azure.svg") 50% calc(50% - 2px) / 4.5rem no-repeat,
    linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
  box-shadow: 0 18px 40px -16px rgb(0 0 0 / 0.55), 0 0 0 1.75rem rgb(140 158 255 / 0.06), 0 0 0 3.5rem rgb(140 158 255 / 0.04);
}

.typography .g-hero__title {
  grid-area: title;
  margin: 0 0 0.75rem;
  color: var(--guide-banner-fg);
  font-size: var(--g-text-4xl);
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.03em;
}

.typography .g-hero__promise {
  grid-area: promise;
  max-width: 36rem;
  margin: 0 0 1.5rem;
  color: rgb(255 255 255 / 0.86);
  font-size: var(--g-text-lg);
  line-height: 1.6;
}

.typography .g-hero__actions {
  grid-area: actions;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

/* Sherpa's hero buttons: a white one and an outlined one on the gradient. shadcn's button rules reach 0,3,2 through
   an :is() list, so these name the element and both classes. */
.typography .g-hero__actions > a.button:is(.primary, .outline) {
  height: auto;
  min-height: 2.25rem;
  padding: 0.5rem 1rem;
  font-size: 0.9rem;
  line-height: 1.2;
  border: 1px solid #ffffff;
  border-radius: var(--g-radius);
  box-shadow: none;
}

.typography .g-hero__actions > a.button.primary {
  color: var(--guide-banner-from);
  background: #ffffff;
}

.typography .g-hero__actions > a.button.outline {
  color: #ffffff;
  background: transparent;
}

.typography .g-hero__actions > a.button.primary:focus-visible {
  color: var(--guide-banner-from);
  background: rgb(255 255 255 / 0.9);
}

.typography .g-hero__actions > a.button.outline:focus-visible {
  color: #ffffff;
  background: rgb(255 255 255 / 0.1);
}

@media (hover: hover) and (pointer: fine) {
  .typography .g-hero__actions > a.button.primary:hover {
    color: var(--guide-banner-from);
    background: rgb(255 255 255 / 0.9);
  }

  .typography .g-hero__actions > a.button.outline:hover {
    color: #ffffff;
    background: rgb(255 255 255 / 0.1);
  }
}

/* extra_head.html preloads the tile's logo from 55.625em, the viewport width where this query starts to match, so the
   logo never pops in after its tile. test_layout.py checks that the two agree. */
@container g-content (min-width: 52rem) {
  .typography .g-hero {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      "title art"
      "promise art"
      "actions art";
  }

  .typography .g-hero::after {
    display: block;
  }
}

@media screen and (max-width: 44.984375em) {
  .typography .g-hero {
    padding: 2.25rem 1.375rem 1.75rem;
  }

  .typography .g-hero__title {
    font-size: 1.8rem;
  }

  .typography .g-hero__promise {
    font-size: var(--g-text-base);
  }
}

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

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