/**
 * Component Styles
 * Reusable component patterns
 * Namespace: nim-
 */

@import url('../components/header.css');
@import url('../components/footer.css');
@import url('../components/forms.css');


/* ==========================================
   BUTTON SYSTEM
   Hierarchy: Primary (Blue) > Secondary (Grey) > Tertiary (Minimal)
   Variants: Filled, Outline, Ghost
   ========================================== */

/* ==========================================
   BASE BUTTON
   ========================================== */
.nim-btn {
  /* Layout */
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-8px);

  /* Spacing */
  padding: var(--space-12px) var(--space-24px);

  /* Typography */
  font-family: var(--font-primary);
  font-size: var(--text-base);
  font-weight: var(--font-semibold);
  line-height: var(--leading-tight);
  text-align: center;
  text-decoration: none;

  /* Visual */
  border: 1px solid transparent;
  border-radius: 0;
  cursor: pointer;

  /* Transitions */
  transition: all var(--transition-base);
}

.nim-btn:disabled {
  cursor: not-allowed;
  opacity: 0.5;
  pointer-events: none;
}

/* Looks disabled but stays focusable and clickable, so a click can lead to
   the field that needs fixing (static/js/utils/formReady.js). */
.nim-btn[aria-disabled="true"] {
  cursor: not-allowed;
  opacity: 0.5;
}

.nim-btn-filled[aria-disabled="true"]:hover,
.nim-btn-filled[aria-disabled="true"]:active {
  background-color: var(--btn-color);
  border-color: var(--btn-color);
}

/* ==========================================
   HIERARCHY LEVELS (Color definitions only)
   ========================================== */

/* Primary - Blue (Main actions) */
.nim-btn-primary {
  --btn-color: var(--blue-550);
  --btn-color-raise: var(--blue-400);
  --btn-color-hover: var(--blue-500);
  --btn-color-active: var(--blue-900);
  --btn-color-light: var(--blue-100);
  --btn-color-lighter: var(--blue-250);
}

/* Secondary - Grey (Supporting actions) */
.nim-btn-secondary {
  --btn-color: var(--grey-550);
  --btn-color-raise: var(--grey-400);
  --btn-color-hover: var(--grey-700);
  --btn-color-active: var(--grey-900);
  --btn-color-light: var(--grey-100);
  --btn-color-lighter: var(--grey-250);
}

/* Danger - Red (Destructive confirmations). --red-700 rather than the
   --red-550 fill step: white on 550 is under 4.5:1. */
.nim-btn-danger {
  --btn-color: var(--red-700);
  --btn-color-raise: var(--red-550);
  --btn-color-hover: var(--red-900);
  --btn-color-active: var(--red-900);
  --btn-color-light: var(--red-100);
  --btn-color-lighter: var(--red-250);
}

/* Tertiary - Light Grey (Minimal actions) */
.nim-btn-tertiary {
  --btn-color: var(--grey-550);
  --btn-color-raise: var(--grey-400);
  --btn-color-hover: var(--grey-700);
  --btn-color-active: var(--grey-900);
  --btn-color-light: var(--grey-100);
  --btn-color-lighter: var(--grey-250);
}

/* Deep Primary - committed actions.

   Same hue as .nim-btn-primary, one step darker at the resting face. Reach for
   it where the button IS the page's purpose — the login submit, the header's
   Create Account — so it reads as heavier than a primary button sitting among
   other primary buttons.

   --btn-color-raise is --blue-500 rather than the --blue-400 primary uses: the
   lit edge has to stay lighter than the face in both resting (--blue-700, 35%)
   and hover (--blue-550, 42%) states, and 48% clears both while staying subtle
   against the darker resting face. */
.nim-btn-primary-deep {
  --btn-color: var(--blue-700);
  --btn-color-raise: var(--blue-500);
  --btn-color-hover: var(--blue-550);
  --btn-color-active: var(--blue-900);
  --btn-color-light: var(--blue-100);
  --btn-color-lighter: var(--blue-250);
}

/* Accent - Orange (Special CTAs) */
.nim-btn-accent {
  --btn-color: var(--orange-550);
  --btn-color-raise: var(--orange-400);
  --btn-color-hover: var(--orange-700);
  --btn-color-active: var(--orange-900);
  --btn-color-light: var(--orange-100);
  --btn-color-lighter: var(--orange-200);
}

/* ==========================================
   VARIANTS (Work with any hierarchy level)
   ========================================== */

/* Filled Variant */
.nim-btn-filled {
  background-color: var(--btn-color);
  color: white;
  border-color: var(--btn-color);
}

.nim-btn-filled:hover:not(:disabled) {
  background-color: var(--btn-color-hover);
  border-color: var(--btn-color-hover);
}

.nim-btn-filled:active:not(:disabled) {
  background-color: var(--btn-color-active);
  border-color: var(--btn-color-active);
}

/* Outline Variant */
.nim-btn-outline {
  background-color: transparent;
  color: var(--btn-color);
  border-color: var(--btn-color);
}

.nim-btn-outline:hover:not(:disabled) {
  background-color: var(--btn-color-light);
  color: var(--btn-color);
  border-color: var(--btn-color);
}

.nim-btn-outline:active:not(:disabled) {
  background-color: var(--btn-color-lighter);
  color: var(--btn-color);
  border-color: var(--btn-color);
}

/* Ghost Variant */
.nim-btn-ghost {
  background-color: transparent;
  color: var(--btn-color);
  border-color: transparent;
}

.nim-btn-ghost:hover:not(:disabled) {
  background-color: var(--btn-color-light);
  color: var(--btn-color-hover);
}

.nim-btn-ghost:active:not(:disabled) {
  background-color: var(--btn-color-lighter);
  color: var(--btn-color-active);
}

/* Softened corners. .nim-btn is square by default; this is the opt-in for
   surfaces we are gradually moving off that, so the drift stays a deliberate
   choice per page rather than a hardcoded radius at each call site. */
.nim-btn-rounded {
  border-radius: var(--radius-sm);
}

/* Compact sizing - mirrors .product-watchlist-add so the two sit side by side */
.nim-btn-compact {
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  width: 100%;
  padding: var(--space-8px) var(--space-16px);
  font-size: var(--text-base);
  font-weight: var(--font-medium);
  border-radius: 6px;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.2s ease-in-out;
}

.nim-btn-compact i {
  font-size: 1em;
}

/* ==========================================
   SPECIAL BUTTON: ACCENT FLAT (CTA Hero)
   ========================================== */
.nim-btn-accent-flat {
  /* Base styles */
  background-color: var(--orange-550);
  color: white;
  border: none;
  border-radius: 0;

  /* Spacing */
  padding: var(--space-12px) var(--space-32px);
  padding-right: var(--space-64px);

  /* Typography */
  font-size: var(--text-base);
  font-weight: var(--font-medium);
  letter-spacing: var(--tracking-wider);
  text-decoration: none;

  /* Layout */
  display: inline-block;
  position: relative;
  cursor: pointer;

  /* Transitions */
  transition: all var(--transition-base);
}

.nim-btn-accent-flat::after {
  content: '→';
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  width: var(--space-48px);

  background-color: var(--orange-250);

  display: flex;
  align-items: center;
  justify-content: center;

  font-size: var(--text-lg);
  font-weight: var(--font-semibold);

  transition: all var(--transition-base);
}

.nim-btn-accent-flat:hover:not(:disabled) {
  background-color: var(--orange-550);
  transform: translateY(2px);
}

.nim-btn-accent-flat:hover:not(:disabled)::after {
  background-color: var(--orange-550);
}

.nim-btn-accent-flat:active:not(:disabled) {
  background-color: var(--orange-700);
  transform: translateY(4px);
}

.nim-btn-accent-flat:active:not(:disabled)::after {
  background-color: var(--orange-700);
}

.nim-btn-accent-flat:focus-visible {
  outline: 2px solid var(--orange-550);
  outline-offset: 2px;
}

/* ==========================================
   SIZE VARIANTS
   ========================================== */
/* ==========================================
   RAISED VARIANT

   Emulates a single light source above the page, so a filled button reads as
   sitting proud of its surface rather than being a coloured rectangle.

   Three parts, and each is doing specific work:

   1. TOP EDGE ONLY. Flat top and bottom edges cannot both be visible at once —
      people look slightly down at a screen, so the top edge is the one in view.
      An inset shadow with a +1px vertical offset lights that edge and nothing
      else. There is deliberately no bottom highlight.

   2. A HAND-PICKED LIGHTER COLOUR, --btn-color-raise, one step up each
      hierarchy's own scale. NOT color-mix with white: mixing toward white
      desaturates, so a lit blue edge drifts grey and stops looking like the
      same material catching light. Our scale gains saturation as it lightens
      (blue-550 is 78%, blue-400 is 85%), which is what picking by hand gives.

   3. A SHORT, SHARP DROP SHADOW. The button blocks light from the strip of
      page directly beneath it. 2px of blur, not 10 — this is the hard-edged
      shadow under a wall outlet, not a glow. Offset down only.

   The three states are one continuous motion downward: resting (raised),
   hover (sinking - 1px down, shadow tightens), active (flat on the surface -
   lit edge and cast shadow gone, shadow falls inward). */
.nim-btn-raised {
  transform: translateY(0);
  box-shadow:
    inset 0 1px 0 var(--btn-color-raise),
    0 1px 2px color-mix(in srgb, var(--grey-900) 28%, transparent);
}

/* Hover SINKS rather than lifts. The button drops 1px toward the page and its
   cast shadow tightens from 2px of blur to 1px — a shorter shadow reads as a
   smaller gap between object and surface, which is what actually happens when
   something is pushed down. Hover is the start of the press, not a separate
   "floating" state. */
.nim-btn-raised:hover:not(:disabled) {
  transform: translateY(1px);
  box-shadow:
    inset 0 1px 0 var(--btn-color-raise),
    0 1px 1px color-mix(in srgb, var(--grey-900) 22%, transparent);
}

/* Fully pressed: the button reaches the surface, so there is no gap left to
   cast a shadow into and no top edge left to catch light. Both go, replaced by
   a shadow falling INTO the element from above. */
.nim-btn-raised:active:not(:disabled) {
  transform: translateY(1px);
  box-shadow: inset 0 2px 3px color-mix(in srgb, var(--grey-900) 32%, transparent);
}

.nim-btn-raised:disabled {
  box-shadow: none;
}

/* The same slab, lit for a dark surface.

   .nim-btn-raised is built for a button sitting on the light page, and two of
   its three cues depend on that. The cast shadow is 28% of --grey-900: over a
   near-black fill there is nothing left for it to darken, so it disappears and
   takes the sense of a gap with it. The lit top edge survives, but one step up
   the scale is a small step when the fill beside it is already bright.

   So the cues are re-tuned rather than turned up. The lit edge goes two steps
   up (--btn-color-lighter) to stay visible against the fill. A dark inner edge
   along the bottom gives the slab a thickness that the page version gets for
   free from its contrast with the page. The cast shadow goes near-opaque and
   gains a pixel of offset, because on a dark ground a shadow only reads once it
   is darker than the surface it falls on.

   The three states are the same continuous motion downward. */
.nim-btn-raised-on-dark {
  transform: translateY(0);
  box-shadow:
    inset 0 1px 0 var(--btn-color-lighter),
    inset 0 -1px 0 color-mix(in srgb, var(--grey-900) 32%, transparent),
    0 2px 4px color-mix(in srgb, var(--grey-900) 65%, transparent);
}

.nim-btn-raised-on-dark:hover:not(:disabled) {
  transform: translateY(1px);
  box-shadow:
    inset 0 1px 0 var(--btn-color-lighter),
    inset 0 -1px 0 color-mix(in srgb, var(--grey-900) 32%, transparent),
    0 1px 2px color-mix(in srgb, var(--grey-900) 55%, transparent);
}

.nim-btn-raised-on-dark:active:not(:disabled) {
  transform: translateY(2px);
  box-shadow: inset 0 2px 4px color-mix(in srgb, var(--grey-900) 50%, transparent);
}

.nim-btn-raised-on-dark:disabled {
  box-shadow: none;
}

.nim-btn-sm {
  padding: var(--space-8px) var(--space-16px);
  font-size: var(--text-sm);
    line-height: var(--leading-caption);

}

.nim-btn-lg {
  padding: var(--space-16px) var(--space-32px);
  font-size: var(--text-lg);
}

.nim-btn-icon {
  padding: var(--space-12px);
  aspect-ratio: 1;
}

/* ==========================================
   RADIUS VARIANT
   ========================================== */

/* The base .nim-btn is square by design; this opts a button into the same
   6px radius as .form-control/.form-select so the two sit flush together
   in a toolbar (see the library filter toolbar). */
.nim-btn-rounded {
  border-radius: var(--radius-base);
}

/* Common button combinations */
.nim-btn-ghost-sm {
  /* Extends base */
  background-color: transparent;
  color: var(--grey-700);
  border-color: transparent;
    padding: var(--space-8px) var(--space-16px);
    line-height: var(--leading-caption);
    font-weight: var(--font-normal);




  font-size: var(--text-sm);
}

.nim-btn-ghost-sm:hover:not(:disabled) {
  background-color: var(--blue-100);
  color: var(--blue-550);
}

.nim-btn-ghost-sm.active {
  color: var(--blue-700);
  font-weight: var(--font-medium);
}

/* A button that reads as an inline text link: card actions such as "Edit"
   that sit beside content rather than in a toolbar. A <button>, so it can
   carry hx-* attributes and keyboard focus without an href. */
.nim-btn-link {
  padding: 0;
  font-size: var(--text-sm);
  font-weight: var(--font-normal);
  line-height: var(--leading-normal);
  color: var(--blue-550);
  text-align: left;
  background: none;
  border: none;
  cursor: pointer;
}

.nim-btn-link:hover {
  color: var(--blue-700);
  text-decoration: underline;
}

.nim-btn-link:focus-visible {
  outline: 2px solid var(--border-focus);
  outline-offset: 2px;
}

/* A link-button that is a card's own action (Edit, Set as default) rather
   than inline text. */
.nim-btn-link-strong {
  font-weight: var(--font-semibold);
}

/* Grey link-button for the quiet choice beside a primary one (Cancel next to
   Delete); the same greys as .nim-btn-secondary. */
.nim-btn-link-muted {
  color: var(--grey-550);
}

.nim-btn-link-muted:hover {
  color: var(--grey-700);
}

/* ==========================================
   USAGE EXAMPLES
   ========================================== */
/*
  Primary filled:     nim-btn nim-btn-primary nim-btn-filled
  Primary outline:    nim-btn nim-btn-primary nim-btn-outline
  Primary ghost:      nim-btn nim-btn-primary nim-btn-ghost

  Secondary filled:   nim-btn nim-btn-secondary nim-btn-filled
  Secondary outline:  nim-btn nim-btn-secondary nim-btn-outline
  Secondary ghost:    nim-btn nim-btn-secondary nim-btn-ghost

  Accent CTA:         nim-btn nim-btn-accent nim-btn-filled
  Accent outline:     nim-btn nim-btn-accent nim-btn-outline

  Special CTA:        nim-btn nim-btn-accent-flat

  With sizes:         nim-btn nim-btn-primary nim-btn-filled nim-btn-sm
                      nim-btn nim-btn-secondary nim-btn-outline nim-btn-lg
*/


/* ==========================================
   HTMX REQUEST STATE

   htmx is loaded globally in base.html, so these are global behaviour rather
   than any page's styling. They previously lived in four separate page
   stylesheets (login, register, profile, settings), each with its own copy and
   already diverging — settings.css had dropped the .button-text and
   button[disabled] rules, so a spinner there showed alongside the label instead
   of replacing it.
   ========================================== */

/* Swap out the label for the spinner while a request is in flight, rather than
   showing both. */
.htmx-indicator {
  display: none;
}

.htmx-request .htmx-indicator {
  display: inline-block;
}

.htmx-request .button-text {
  display: none;
}

.htmx-swapping {
  opacity: 0;
  transition: opacity var(--transition-base) ease-out;
}

button[disabled] {
  opacity: 0.8;
  cursor: not-allowed;
}

/* ==========================================
   PROSE

   Long-form running text — the terms and conditions, a privacy policy, any
   article-length block. Styles by ELEMENT rather than by class, so legal copy
   can be pasted in (or arrive from `sdo.addtl_tos_text|safe`) without every
   paragraph needing a class it will lose on the next edit.

   MEASURE: 32em, which is 65 characters per line — the middle of the 45-75
   band, and inside the 20-35em ballpark that band corresponds to.

   In `em`, not `ch`, and not px. Both em and ch scale with the font, but `ch`
   is the advance width of "0", and in Roboto "0" is meaningfully wider than the
   average lowercase letter: 65ch measured out at 74 characters on the rendered
   page, so the unit that looks like it states the character count is the one
   that misstates it. 32em has no such indirection — 32 x --text-base (17px) is
   544px, measured at 65 characters.

   --text-base sits in the type scale's fixed reading band, so the measure holds
   at 544px on every viewport and is only ever narrowed by its container.

   LEADING: --leading-body (1.6), not --leading-prose (1.7). variables.css sets
   the rule: leading follows measure, 60-80 characters wants 1.5-1.6, and 1.7
   is reserved for a 75ch article measure. At 65ch, 1.7 would over-open the
   lines and start breaking the paragraph into stripes.

   RHYTHM: spacing is set as margin-TOP on siblings via the lobotomised owl, so
   no element carries a trailing margin that has to be cancelled at the end of
   the flow, and headings can pull their own space without fighting the
   paragraph above.

   PROXIMITY: each heading sits much closer to the text it introduces than to
   the section it follows (48px above / 12px below for h2). That asymmetry is
   what makes sections read as sections without needing rules or boxes.
   ========================================== */

.nim-prose {
  max-width: 32em;
  font-family: var(--font-primary);
  font-size: var(--text-base);
  line-height: var(--leading-body);
  color: var(--text-primary);
}

.nim-prose > * {
  margin-top: 0;
  margin-bottom: 0;
}

/* Every sibling gets its space from the element above it. */
.nim-prose > * + * {
  margin-top: var(--space-16px);
}

.nim-prose h2 {
  font-size: var(--text-xl);
  font-weight: var(--font-semibold);
  line-height: var(--leading-normal);
  letter-spacing: var(--tracking-snug);
  color: var(--blue-700);
}

.nim-prose h3 {
  font-size: var(--text-lg);
  font-weight: var(--font-semibold);
  line-height: var(--leading-relaxed);
  letter-spacing: var(--tracking-normal);
  color: var(--text-primary);
}

/* Section breaks. The generic owl above already gave these 16px; these
   overrides open the gap ABOVE a heading without touching the gap below. */
.nim-prose > * + h2 {
  margin-top: var(--space-48px);
}

.nim-prose > * + h3 {
  margin-top: var(--space-32px);
}

.nim-prose h2 + *,
.nim-prose h3 + * {
  margin-top: var(--space-12px);
}

/* A heading whose own text is wrapped in <strong> (as the legal copy does)
   would otherwise render at the heading weight twice over. */
.nim-prose h2 strong,
.nim-prose h3 strong {
  font-weight: inherit;
}

.nim-prose ul,
.nim-prose ol {
  padding-left: var(--space-24px);
}

.nim-prose li + li {
  margin-top: var(--space-8px);
}

.nim-prose a {
  color: var(--color-primary);
  text-decoration: underline;
  /* Legal documents carry bare URLs; let them break rather than force the
     column wider than its measure. */
  overflow-wrap: break-word;
}

.nim-prose a:hover {
  color: var(--color-primary-hover);
}

.nim-prose strong {
  font-weight: var(--font-semibold);
}

/* Small print — a version stamp or effective date above the body. */
.nim-prose-meta {
  font-size: var(--text-sm);
  color: var(--text-tertiary);
}

@media (max-width: 767.98px) {
  .nim-prose h2 {
    font-size: var(--text-lg);
  }

  .nim-prose > * + h2 {
    margin-top: var(--space-32px);
  }

  .nim-prose > * + h3 {
    margin-top: var(--space-24px);
  }
}

/* ==========================================
   CARDS
   ========================================== */

.nim-card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: 0;
  padding: var(--space-24px);
  box-shadow: var(--shadow-sm);
  transition: all var(--transition-base);
}

.nim-card:hover {
  /*box-shadow: var(--shadow-md);*/
    transform: translateY(-4px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15) !important;
}

.nim-card-header {
  margin-bottom: var(--space-16px);
  padding-bottom: var(--space-16px);
  border-bottom: 1px solid var(--border-default);
}

.nim-card-body {
  margin-bottom: var(--space-16px);
}

.nim-card-footer {
  margin-top: var(--space-16px);
  padding-top: var(--space-16px);
  border-top: 1px solid var(--border-default);
}

/* ==========================================
   SECTION HEADER

   Title + supporting line introducing a page section: the account pages
   (Profile, Password, Library) all open with one. Deliberately quieter than
   the .nim-h* display scale — this labels a pane inside a page that already
   has a title, so it sits in the reading band and does not compete.
   ========================================== */

.nim-section-header {
  padding-bottom: var(--space-16px);
  margin-bottom: var(--space-32px);
  border-bottom: 1px solid var(--border-default);
}

.nim-section-title {
  margin: 0 0 var(--space-4px);
  font-size: var(--text-lg);
  font-weight: var(--font-medium);
  line-height: var(--leading-tight);
  color: var(--text-primary);
}

.nim-section-subtitle {
  margin: 0;
  font-size: var(--text-sm);
  font-weight: var(--font-normal);
  line-height: var(--leading-normal);
  color: var(--text-muted);
}

/* ==========================================
   EMPTY STATE

   Rendered by the {% empty_state %} tag (ui_tags). Copy on the left,
   illustration on the right; stacked and centred below 768px with the
   illustration first.

   Sized as a message, not a hero: an h3-sized title, body copy at the
   reading size, and a capped, centred width so the illustration sits beside the copy
   rather than out at the container's far edge.

   The illustration is a one-colour SVG (or transparent PNG) used as a mask, so the circle and the
   ink both come from tokens and the file never carries a colour. Add one
   .nim-empty-state__art--<name> modifier per illustration.
   ========================================== */

.nim-empty-state {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: var(--space-48px);
  max-width: 960px;
  margin-inline: auto;
  padding-block: var(--space-48px);
}

.nim-empty-state__title {
  margin: 0 0 var(--space-8px);
  color: var(--text-secondary);
}

.nim-empty-state__body {
  max-width: 32em;
  margin: 0 0 var(--space-24px);
  font-size: var(--text-base);
  line-height: var(--leading-body);
  color: var(--text-tertiary);
  text-wrap: pretty;
}

.nim-empty-state__art {
  display: grid;
  place-items: center;
  width: clamp(180px, 22vw, 260px);
  aspect-ratio: 1;
  border-radius: 50%;
  background-color: var(--blue-100);
}

.nim-empty-state__art::before {
  content: '';
  width: 72%;
  aspect-ratio: 1;
  background-color: var(--blue-900);
  -webkit-mask-position: center;
  mask-position: center;
  -webkit-mask-size: contain;
  mask-size: contain;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
}

/* In a content column beside navigation (the account pages), the full-page
   measure leaves the illustration stranded at the column's edge. */
.nim-empty-state--compact {
  max-width: 680px;
  gap: var(--space-40px);
}

.nim-empty-state--compact .nim-empty-state__art {
  width: clamp(160px, 16vw, 200px);
}

/* The url() goes on each modifier, not into a shared custom property: a
   relative url() inside a custom property can resolve against the page rather
   than this stylesheet. */
.nim-empty-state__art--cart::before {
  -webkit-mask-image: url('../../img/web/empty-state/empty-cart.svg');
  mask-image: url('../../img/web/empty-state/empty-cart.svg');
}

.nim-empty-state__art--library::before {
  -webkit-mask-image: url('../../img/web/empty-state/library-empty.svg');
  mask-image: url('../../img/web/empty-state/library-empty.svg');
}

.nim-empty-state__art--transfers::before {
  -webkit-mask-image: url('../../img/web/empty-state/transfer-empty.png');
  mask-image: url('../../img/web/empty-state/transfer-empty.png');
}

.nim-empty-state__art--orders::before {
  -webkit-mask-image: url('../../img/web/empty-state/orders-empty.png');
  mask-image: url('../../img/web/empty-state/orders-empty.png');
}

.nim-empty-state__art--watchlist::before {
  -webkit-mask-image: url('../../img/web/empty-state/watchlist-empty.png');
  mask-image: url('../../img/web/empty-state/watchlist-empty.png');
}

.nim-empty-state__art--addresses::before {
  -webkit-mask-image: url('../../img/web/empty-state/address-empty.png');
  mask-image: url('../../img/web/empty-state/address-empty.png');
}

@media (max-width: 767.98px) {
  .nim-empty-state {
    grid-template-columns: minmax(0, 1fr);
    justify-items: center;
    gap: var(--space-20px);
    padding-block: var(--space-32px);
    text-align: center;
  }

  .nim-empty-state__art {
    order: -1;
    width: 180px;
  }

  .nim-empty-state__title {
    font-size: var(--text-xl);
    line-height: var(--leading-normal);
  }
}

/* ==========================================
   FORMS
   ========================================== */

.nim-form-group {
  margin-bottom: var(--space-24px);
}

/* .nim-auth-label is the same control label under the auth templates' own name.
   It is listed here rather than redeclared in auth.css so the two cannot drift
   — they already had, by one greyscale step: auth labels were --grey-650 and
   the account pages' --grey-700, with everything else identical. */
.nim-form-label,
.nim-auth-label {
  display: block;
  margin-bottom: var(--space-8px);
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
  color: var(--text-primary);
}

/* Quieter label, for pages where the field itself carries the weight and a
   column of semibold headings would out-shout the values it labels. Must stay
   after the base rule above — forms.css is @imported, so it loses to it.
   .nim-auth-label is always this variant; it has no bold form. */
.nim-form-label-muted,
.nim-auth-label {
  font-weight: var(--font-normal);
  color: var(--grey-650);
}

.nim-form-input,
.nim-form-select,
.nim-form-textarea {
  display: block;
  width: 100%;
  padding: var(--space-12px) var(--space-16px);
  font-size: var(--text-base);
  line-height: var(--leading-caption);
  color: var(--text-primary);
  background-color: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-base);
  transition: all var(--transition-base);
}

.nim-form-input:focus,
.nim-form-select:focus,
.nim-form-textarea:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--blue-400) 10%, transparent);
}

.nim-form-input::placeholder {
  color: var(--text-placeholder);
}

.nim-form-input:disabled,
.nim-form-select:disabled,
.nim-form-textarea:disabled {
  background-color: var(--bg-disabled);
  cursor: not-allowed;
  opacity: 0.6;
}

.nim-form-helper {
  display: block;
  margin-top: var(--space-8px);
  font-size: var(--text-xs);
  color: var(--text-tertiary);
}

.nim-form-error {
  display: block;
  margin-top: var(--space-8px);
  font-size: var(--text-xs);
  color: var(--text-danger);
}

/* ==========================================
   PDF PREVIEW BUTTON

   The "Preview PDF" pill laid over a document cover (product page and
   spotlight cards), rendered by standards/partials/_preview_btn.html. White
   with a shadow so it holds over any first page; --sm for the card covers.
   ========================================== */

.nim-preview-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-8px);
  height: 2.25rem;
  padding: 0 var(--space-16px);
  font-family: var(--font-primary);
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  line-height: 1;
  white-space: nowrap;
  color: var(--text-primary);
  background-color: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-full);
  box-shadow: var(--shadow-md);
  cursor: pointer;
  transition: background-color var(--transition-base), border-color var(--transition-base);
}

.nim-preview-btn:hover {
  background-color: var(--grey-100);
  border-color: var(--grey-400);
}

.nim-preview-btn:focus-visible {
  outline: 2px solid var(--border-focus);
  outline-offset: 2px;
}

.nim-preview-btn--sm {
  gap: var(--space-6px);
  height: 1.75rem;
  padding: 0 var(--space-12px);
  font-size: var(--text-xs);
}

/* ==========================================
   TABS

   Promoted from two page stylesheets that both defined .custom-tabs with
   different values — products.css used a grey active fill, 4px rule and
   --blue-600 text; order-history.css a transparent fill, 3px rule and
   --blue-550. Same class name, two designs, drifting independently.

   The active tab carries a tinted fill, so its label reads from --blue-600
   rather than the brand --blue-550: on --blue-100 the brand blue manages only
   4.30:1 and fails AA, where --blue-600 clears it at 5.06:1. That is the exact
   case --blue-600 exists for.

   Hover is grey, not blue, so it cannot be mistaken for the active state.
   ========================================== */

.nim-tabs {
  display: flex;
  gap: 0;
  margin: 0;
  padding: 0;
  list-style: none;
  /* Tabs are sized to their labels and left-aligned; the strip scrolls rather
     than letting them shrink or wrap. */
  overflow-x: auto;
  scrollbar-width: none;
  border-bottom: 1px solid var(--border-subtle);
}

.nim-tabs::-webkit-scrollbar {
  display: none;
}

.nim-tab {
  display: flex;
  align-items: center;
  padding: var(--space-12px) var(--space-24px);
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  line-height: var(--leading-caption);
  white-space: nowrap;
  color: var(--text-muted);
  text-decoration: none;
  background-color: transparent;
  border: none;
  /* Transparent at the same width as the active rule, so gaining it does not
     nudge the label. The negative margin lets that rule sit on the strip's own
     hairline instead of below it. */
  border-bottom: 3px solid transparent;
  margin-bottom: -1px;
  transition: color var(--transition-base), background-color var(--transition-base);
}

.nim-tab:hover:not(.active) {
  color: var(--text-primary);
  background-color: var(--grey-100);
}

.nim-tab.active {
  color: var(--blue-600);
  font-weight: var(--font-semibold);
  background-color: var(--blue-100);
  border-bottom-color: var(--blue-700);
}

.nim-tab:focus-visible {
  outline: 2px solid var(--border-focus);
  outline-offset: -2px;
}

/* ==========================================
   BADGES
   ========================================== */

.nim-badge {
  display: inline-flex;
  align-items: center;
  padding: var(--space-4px) var(--space-12px);
  font-size: var(--text-xs);
  font-weight: var(--font-bold);
  line-height: var(--leading-none);
  border-radius: var(--radius-full);
  text-transform: uppercase;
  letter-spacing: var(--tracking-widest);
}

.nim-badge-primary {
  background-color: var(--blue-500);
  color: white;
}

/* --text-warning (--orange-900), not --orange-700. On this --orange-100 fill
   the 700 step measures 3.55:1 and fails AA; 900 clears it at 7.19:1. Darkening
   700 is not the fix — even --orange-800 only reaches 4.14:1 here, and 700 is
   correct in its actual role as the accent's fill/hover step. */
.nim-badge-accent {
  background-color: var(--orange-100);
  color: var(--text-warning);
}

/* Soft blue counterpart to .nim-badge-accent. Sentence case rather than the
   base's uppercase: this carries a count, and "1,204 STANDARDS" reads as
   shouting where a status label does not. */
.nim-badge-count {
  gap: var(--space-8px);
  padding: var(--space-4px) var(--space-10px);
  /* A chip rather than the base's full pill. */
  border-radius: var(--radius-sm);
  background-color: var(--color-primary-light);
  color: var(--blue-700);
  font-size: var(--text-xs);
  font-weight: var(--font-bold);
  text-transform: none;
  letter-spacing: var(--tracking-normal);
}

.nim-badge-grey {
  background-color: var(--grey-250);
  color: var(--grey-900);
}

/* A flat, square tag hung off the corner of a card ("Default" on an
   address). Sentence case and no tracking: it labels, it does not shout.
   Dark fill so it holds against a pale card edge (8.7:1 with white). */
.nim-badge-tab {
  padding: var(--space-4px) var(--space-8px);
  border-radius: 0 0 var(--radius-sm) 0;
  background-color: var(--grey-700);
  color: var(--text-on-dark);
  font-weight: var(--font-semibold);
  text-transform: none;
  letter-spacing: var(--tracking-normal);
}

/* Status pill for a library item whose deliverables are still being generated.
   Amber, not grey: this is a temporary state the user is waiting on rather
   than a control that has been switched off.

   Deliberately styled for a <span>, never a disabled <button> — the library's
   .btn-flat-action:disabled rule sets pointer-events: none, which silently
   suppresses the tooltip that explains the wait. Not uppercase or wide-tracked
   like .nim-badge, so it reads as a peer of the row's other pills. */
.nim-badge-generating {
  display: inline-flex;
  align-items: center;
  padding: var(--space-4px) var(--space-12px);
  font-size: var(--text-xs);
  font-weight: var(--font-semibold);
  line-height: var(--leading-relaxed);
  white-space: nowrap;
  border-radius: var(--radius-full);
  background-color: var(--orange-100);
  /* See .nim-badge-accent above: 700 is 3.55:1 on this fill, 900 is 7.19:1. */
  color: var(--text-warning);
  cursor: help;
}

/* ==========================================
   ALERTS
   ========================================== */

.nim-alert {
  padding: var(--space-16px);
  border-radius: var(--radius-base);
  border-left: 4px solid;
}

.nim-alert-info {
  background-color: var(--blue-100);
  border-color: var(--blue-400);
  color: var(--blue-900);
}

.nim-alert-warning {
  background-color: var(--orange-100);
  border-color: var(--orange-400);
  color: var(--orange-900);
}

.nim-alert-error {
  background-color: var(--red-100);
  border-color: var(--red-550);
  color: var(--red-700);
}

.nim-alert-success {
  background-color: var(--green-100);
  border-color: var(--green-550);
  color: var(--green-700);
}

/* An alert the reader closes: the message beside an X. Markup:
   <div class="nim-alert nim-alert-error nim-alert-dismissible" role="alert">
     <span class="nim-alert__text"></span>
     <button type="button" class="nim-alert__close" aria-label="Dismiss">…</button>
   </div> */
.nim-alert-dismissible {
  display: flex;
  align-items: flex-start;
  gap: var(--space-12px);
}

.nim-alert-dismissible[hidden] {
  display: none;
}

.nim-alert__text {
  flex: 1;
  min-width: 0;
}

.nim-alert__close {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--space-24px);
  height: var(--space-24px);
  margin: calc(-1 * var(--space-2px)) calc(-1 * var(--space-4px)) 0 0;
  padding: 0;
  font-size: var(--text-base);
  line-height: var(--leading-none);
  color: inherit;
  background: none;
  border: 0;
  border-radius: var(--radius-sm);
  opacity: 0.75;
  cursor: pointer;
}

.nim-alert__close:hover {
  opacity: 1;
  background-color: color-mix(in srgb, currentColor 10%, transparent);
}

.nim-alert__close:focus-visible {
  outline: 2px solid var(--border-focus);
  outline-offset: 1px;
  opacity: 1;
}

/* Notice variant: icon tile + title + body, for empty/unavailable states that
   need more than one line. The `border` shorthand deliberately replaces the
   base's 4px left accent with a full outline.

   Colours route through local properties so a tone variant only has to restate
   those, not the rules that consume them. Tile and glyph stay separate from the
   accent so a tone can carry a light tile with a coloured glyph instead of the
   default filled tile with a white one. */
.nim-alert-notice {
  --notice-tint: var(--blue-100);
  --notice-edge: var(--blue-250);
  --notice-accent: var(--blue-700);
  --notice-tile: var(--notice-accent);
  --notice-glyph: var(--text-on-dark);

  display: flex;
  align-items: center;
  gap: var(--space-12px);
  padding: var(--space-8px);
  background-color: var(--notice-tint);
  border: 1px solid var(--notice-edge);
  border-radius: var(--radius-md);
}

/* Amber tone, for states that are a route to access rather than a dead end. */
.nim-alert-notice-warning {
  --notice-tint: var(--orange-100);
  --notice-edge: var(--orange-250);
  --notice-accent: var(--orange-550);
  --notice-tile: var(--orange-550);
}

/* One type size (15px) for title and body, with the tile sized to the two
   lines it sits beside, so the notice reads as a pointer the buyer registers
   and moves past rather than a headline: ~58px tall, was ~82px. */
.nim-alert-notice-icon {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: var(--space-40px);
  height: var(--space-40px);
  border-radius: var(--radius-sm);
  background-color: var(--notice-tile);
  color: var(--notice-glyph);
  font-size: var(--text-base);
}

.nim-alert-notice-title {
  margin: 0 0 var(--space-2px);
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
  line-height: var(--leading-normal);
  color: var(--notice-accent);
}

/* --text-muted, the same grey as the section subtitles: neutral, so it holds
   on both the amber and the blue tint without picking up either hue. */
.nim-alert-notice-body {
  margin: 0;
  font-size: var(--text-sm);
  line-height: var(--leading-normal);
  color: var(--text-muted);
}

/* A notice that points somewhere (the superseding standard) carries the link
   in its body; underlined as well as coloured so it cannot be mistaken for
   emphasis inside grey running text. */
.nim-alert-notice-body a {
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* List tone: the notice carries grouped lines under its title (what checkout
   changed), so the tile sits at the top instead of centred on the text. */
.nim-alert-notice-list {
  align-items: flex-start;
  padding: var(--space-12px) var(--space-16px);
}

.nim-alert-notice-content {
  flex: 1;
  min-width: 0;
}

.nim-change-list__label {
  margin: var(--space-12px) 0 var(--space-4px);
  font-size: var(--text-xs);
  font-weight: var(--font-semibold);
  line-height: var(--leading-normal);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-secondary);
}

.nim-change-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

/* Item on the left, what happened to it on the right; the two stack when the
   row is too narrow for both. */
.nim-change-list__row {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: var(--space-2px) var(--space-16px);
  padding: var(--space-6px) 0;
  font-size: var(--text-sm);
  line-height: var(--leading-caption);
  border-top: 1px solid var(--notice-edge);
}

.nim-change-list__item {
  font-weight: var(--font-medium);
  color: var(--text-primary);
}

.nim-change-list__detail {
  display: inline-flex;
  align-items: center;
  gap: var(--space-6px);
  color: var(--text-secondary);
}

.nim-change-list__was {
  color: var(--text-muted);
}

.nim-change-list__now {
  font-weight: var(--font-semibold);
  color: var(--text-primary);
}

/* ==========================================
   CONTAINER
   ========================================== */

.nim-container {
  width: 100%;
  max-width: 1280px;
  margin-left: auto;
  margin-right: auto;
  padding-left: var(--space-16px);
  padding-right: var(--space-16px);
}

.nim-container-sm {
  max-width: 768px;
}

.nim-container-lg {
  max-width: 1536px;
}

/* ==========================================
   DIVIDER
   ========================================== */

.nim-divider {
  height: 1px;
  background-color: var(--border-default);
  border: none;
  margin: var(--space-24px) 0;
}

/* ==========================================
   DROPDOWN ACCORDION (Legacy support)
   ========================================== */

.nim-dropdown-accordion-toggle {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.nim-dropdown-accordion-toggle .nim-arrow {
  display: inline-block;
  transition: transform var(--transition-base);
}

.nim-dropdown-accordion-toggle .nim-arrow.nim-rotate-arrow {
  transform: rotate(-180deg);
}


/* ==========================================
   DOCUMENT LIST ROW
   blueprints/row-list_view_doc.html, shared by the SDO products page and the
   catalogue. Lives here rather than in either page's stylesheet because both
   render it and doc_list.html loads no standards CSS of its own.

   Built like .cart-row: a fixed row height with the cover derived from it at
   the catalogue cover's A4 ratio, so the picture spans the row and the text
   block is budgeted against it rather than setting the height itself. That is
   what keeps the list scannable — every row is the same height whatever the
   title length.
   ========================================== */

.doc-row {
  --doc-row-h: 8.5rem;                                 /* 136px */
  --doc-cover-w: calc(var(--doc-row-h) * 210 / 297);   /* A4, ~107px */
  /* The text and the actions share one height, shorter than the cover, and both
     centre against it. That is what makes the document number sit level with
     the top of Purchase Options and the metadata level with the bottom of Add
     to Watchlist: two blocks of equal height, centred on the same axis, each
     anchored to its own top and bottom.

     The figure is the buttons' own stacked height plus a tight gap. Anchoring
     both ends means the leftover space becomes the gap between them, so making
     this taller pushes them apart rather than adding padding. */
  --doc-row-body-h: 6.5rem;                            /* 104px */

  display: grid;
  grid-template-columns: var(--doc-cover-w) minmax(0, 1fr) auto;
  grid-template-areas: "cover info actions";
  gap: var(--space-20px);
  align-items: center;
  padding: var(--space-8px);
  /* Each row is its own card now — the <hr> that used to separate them is
     gone, so the border is what divides the list. */
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
}

/* A search that named an earlier edition than the one shown
   (search.earlier_edition): a strip across the card's top edge says so in the
   reader's words and links to that edition. Above the grid rather than in the
   text column, so the code line and the column's fixed height are untouched;
   only these cards grow, by the strip. */
.doc-row--earlier {
  grid-template-areas:
    "earlier earlier earlier"
    "cover   info    actions";
  row-gap: var(--space-8px);
}

.doc-row__earlier {
  grid-area: earlier;
  display: flex;
  align-items: center;
  gap: var(--space-6px);
  /* Out to the card's border: the padding it sits in is the card's own. */
  margin: calc(-1 * var(--space-8px)) calc(-1 * var(--space-8px)) 0;
  padding: var(--space-6px) var(--space-16px);
  font-size: var(--text-xs);
  line-height: var(--leading-caption);
  color: var(--blue-700);
  text-decoration: none;
  background-color: var(--color-primary-light);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.doc-row__earlier:hover {
  color: var(--blue-700);
}

.doc-row__earlier strong {
  font-weight: var(--font-semibold);
}

.doc-row__earlier-link {
  text-decoration: underline;
}

.doc-row__earlier:hover .doc-row__earlier-link {
  color: var(--color-primary-hover);
}

/* Cards need air between them — abutting borders read as one table, not a
   list of cards. */
.doc-row + .doc-row {
  margin-top: var(--space-24px);
}

.doc-row__cover {
  grid-area: cover;
  width: var(--doc-cover-w);
}

/* Exactly the cover's height, not merely capped at it: the cover is derived
   from --doc-row-h at its own ratio, so pinning the text column to the same
   figure lines the two up top and bottom. */
.doc-row__info {
  grid-area: info;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-4px);
  min-width: 0;
  height: var(--doc-row-body-h);
  overflow: hidden;
}

.doc-row__code {
  max-width: 100%;
  font-size: var(--text-lg);
  font-weight: var(--font-medium);
  line-height: var(--leading-normal);
  color: var(--color-primary);
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.doc-row__code:hover {
  color: var(--blue-700);
  text-decoration: underline;
}

/* Dark number for the publisher products page; search results keep the blue. */
.doc-row__code--neutral,
.doc-row__code--neutral:hover {
  color: var(--text-primary);
}

/* Clamped rather than single-line: the title is the part a reader actually
   scans, so it gets two lines before it gives up. */
.doc-row__title {
  margin: 0;
  font-size: var(--text-base);
  font-weight: var(--font-normal);
  line-height: var(--leading-normal);
  color: var(--text-secondary);
  /* Two lines, on --leading-normal rather than the wrapping --leading-caption.
     The tighter leading is what buys the second line: at 1.5 the pair would not
     fit the body height, and raising that height would push the two buttons
     apart, since the space left over between them is the gap. */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}


/* Pushed to the foot of the column so it sits on the cover's bottom edge,
   whatever height the title above it took. */
.doc-row__facts {
  display: flex;
  /* One line, never two. Five pills wrapping to a second or third line was
     what broke this row: .doc-row__info is a fixed 104px flex column, so the
     extra fact line did not push the card taller — it compressed the document
     number and the title instead, and overflow:hidden sliced their glyphs
     horizontally. Held to one line the budget is 26 + 4 + 44 + 4 + 19 = 97 of
     104, which is also the first time the title's 2-line clamp has been
     reachable.

     docRowFacts.js hides what does not fit behind a "+N more" toggle. overflow
     is the fallback for no-JS: the strip clips rather than wraps. */
  flex-wrap: nowrap;
  overflow: hidden;
  column-gap: var(--space-8px);
  /* Shrinkable and clipped; the wrapper below owns the bottom alignment. */
  flex: 0 1 auto;
  min-width: 0;
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: var(--text-xs);
  font-weight: var(--font-bold);
  color: var(--grey-550);
}

.doc-row__fact {
  display: inline-flex;
  align-items: center;
  gap: var(--space-6px);
  white-space: nowrap;
}

/* The lone pill a subscription-only row shows in place of the format/printing/
   delivery strip. Accent rather than the .text-success / .text-danger pair the
   other facts use: those read as a yes/no on something the reader is buying,
   and "sold only through a subscription" is neither — it is a different route
   to the same document. Colouring the whole pill, not just its icon, is what
   distinguishes it from a fact that happens to be absent. */
.doc-row__fact--subscription {
  color: var(--color-accent);
}

/* The count marker that leads a fact, e.g. the "2" in "2 Revisions". Sized in
   em so it tracks the strip's own font-size rather than needing a new number if
   that moves. White on --grey-550 measures 4.87:1. */
.doc-row__fact-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.5em;
  height: 1.5em;
  padding: 0 0.35em;
  border-radius: var(--radius-full);
  background-color: var(--grey-550);
  color: white;
  font-size: var(--text-xs);
  font-weight: var(--font-bold);
  line-height: 1;
}

/* Wrapping variant, for a strip with room to spare. The base rule clips to one
   line and relies on docRowFacts.js to page the remainder behind a "+N more"
   toggle — right for the fixed 104px column it was built for, but more
   interaction than a wide strip needs, and without that script the overflow is
   silently invisible.

   Wrapping brings back the dangling middot the base rule avoids by refusing to
   wrap, so the separator moves from a leading ::before to a trailing ::after.
   A middot ending a line reads as continuation; one starting a line reads as a
   mistake. */
.doc-row__facts--wrap {
  flex-wrap: wrap;
  overflow: visible;
  row-gap: var(--space-4px);
}

.doc-row__facts--wrap .doc-row__fact:not([hidden]) + .doc-row__fact:not([hidden])::before {
  content: none;
  margin: 0;
}

.doc-row__facts--wrap .doc-row__fact:not([hidden]):not(:last-child)::after {
  content: "·";
  margin-left: var(--space-6px);
  color: var(--text-placeholder);
}

/* Holds the pill strip and its overflow toggle. Pushed to the foot of the
   column so the strip still sits on the cover's bottom edge, whatever height
   the title above it took. */
.doc-row__meta {
  display: flex;
  align-items: center;
  gap: var(--space-8px);
  width: 100%;
  min-width: 0;
  margin: auto 0 0;
}

/* Middot between items. :not([hidden]) on both sides so a hidden pill never
   leaves an orphaned separator leading the strip — the pills the toggle hides
   are a contiguous run at one end, so the first visible pill correctly gets
   none. This also fixes the dangling middot that used to start the second line
   whenever the strip wrapped. */
.doc-row__fact:not([hidden]) + .doc-row__fact:not([hidden])::before {
  content: "·";
  margin-right: var(--space-2px);
  color: var(--text-placeholder);
}

/* The overflow toggle. A button, not a hover-only affordance, so it is
   reachable by keyboard and on touch.

   flex-shrink: 0, plus living OUTSIDE .doc-row__facts, is what guarantees it
   stays on screen: the strip gives up width before this does. As an <li> inside
   the clipped list, a pill wider than the column pushed it past the overflow
   edge and it vanished. */
.doc-row__more {
  flex: 0 0 auto;
  padding: 0;
  border: 0;
  background: none;
  /* Stated, not inherited. The toggle is a SIBLING of the strip, so `font:
     inherit` picked up .doc-row__info's 17px instead of the pills' 12px — a
     27px-tall control in a 19px row, which ate 8px of the column's 104px
     budget and put the squashing back on 25 of 25 cards. */
  font-family: inherit;
  font-size: var(--text-xs);
  font-weight: var(--font-bold);
  line-height: var(--leading-caption);
  color: var(--color-primary);
  cursor: pointer;
  white-space: nowrap;
}

.doc-row__more:hover {
  color: var(--blue-700);
  text-decoration: underline;
}

.doc-row__more:focus-visible {
  outline: 2px solid var(--border-focus);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

.doc-row__actions {
  grid-area: actions;
  display: flex;
  flex-direction: column;
  /* Anchored top and bottom rather than centred with a fixed gap, so the two
     buttons land on the same lines as the document number and the metadata. */
  justify-content: space-between;
  width: 13rem;
  height: var(--doc-row-body-h);
}

/* Both actions share one shape. Scoped to the row rather than set on .nim-btn,
   which every page uses.

   Height is left to the padding and line-height rather than fixed, so the
   button grows if its label ever wraps.

   28px has no token to draw on — it falls in the scale's 24 -> 32 gap — so it
   is composed from two steps rather than silently rounded to a neighbour. */
.doc-row__actions .nim-btn {
  /* Label left, mark right — which is what makes the asymmetric padding below
     read as intended rather than just nudging centred content sideways. */
  justify-content: space-between;
  gap: var(--space-16px);
  padding: var(--space-8px)
           var(--space-16px)
           var(--space-8px)
           calc(var(--space-24px) + var(--space-4px)); /* 28px */
  border-radius: var(--radius-base);
  font-size: var(--text-sm);
}

/* The watchlist button writes its icon before its label, so it is reversed
   here rather than in components/add_to_watchlist.html — that partial has three
   button variants (add, remove, signed-out) and reversing in CSS carries all
   three without touching the markup. */
.doc-row__actions .watchlist-component .nim-btn {
  flex-direction: row-reverse;
}

/* The eye gets the same treatment as the chevron opposite it: a size step up,
   and a stroke to thicken it, since Bootstrap Icons has no bold weight. At the
   button's own 15px it read as a hairline beside a 24px filled disc. No disc of
   its own — a second mark would compete with the primary action's. */
.doc-row__actions .watchlist-component .nim-btn i {
  font-size: var(--icon-sm);
  /* Without this the glyph's own line box grows with its font-size and makes
     this button taller than the primary one beside it. */
  line-height: var(--leading-none);
  -webkit-text-stroke: 0.6px currentColor;
}

/* The chevron's disc. --orange-700 rather than a lighter tint of the button's
   own --orange-550: at 1.15:1 against it, a light disc reads as a faint tint
   instead of a mark. Going darker gives the circle a real edge (3.0:1) and
   keeps the white chevron legible on it. */
.doc-row__cta-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: var(--icon-md);
  height: var(--icon-md);
  border-radius: 50%;
  background-color: var(--orange-700);
  color: var(--text-on-dark);
  font-size: var(--text-sm);
  /* Bootstrap Icons ships one weight, so the glyph is thickened with a stroke
     rather than a font-weight, which an icon font ignores. Without it the
     chevron reads as a hairline at this size. */
  -webkit-text-stroke: 0.6px currentColor;
}

@media (max-width: 767.98px) {
  .doc-row {
    grid-template-columns: var(--doc-cover-w) minmax(0, 1fr);
    grid-template-areas:
      "cover   info"
      "actions actions";
    column-gap: var(--space-16px);
  }

  .doc-row--earlier {
    grid-template-areas:
      "earlier earlier"
      "cover   info"
      "actions actions";
  }

  /* Stacked, not side by side. Halving the width made both labels compete for
     it: "Purchase Options" and "Add to Watchlist" are 16 characters each and
     had to wrap at phone widths, which grew the buttons unevenly and buried
     the primary action next to a secondary one of equal size. Full width and
     one above the other keeps the hierarchy and stops the wrapping.

     The base rule is already a column, so only the desktop height and width
     need undoing here. */
  .doc-row__actions {
    width: 100%;
    height: auto;
    gap: var(--space-8px);
  }

  .doc-row__actions > * {
    width: 100%;
  }

  /* The watchlist button sits inside its own wrapper, so it needs the width
     passed down to it as well. */
  .doc-row__actions .watchlist-component .nim-btn {
    width: 100%;
  }
}

/* ==========================================
   BREADCRUMB
   The single home for breadcrumb styling. It used to be split three ways:
   structure and the responsive ladder here, .breadcrumb-link/.breadcrumb-active
   in standards/css/products.css, and a scoped copy of that same pair plus the
   chevron divider in cart/css/cart.css — duplicated because products.css does
   not load on the cart page, which cart.css said in a comment at the time.

   Page stylesheets now own only the surface the trail sits on (the product
   page's band, the cart page's field). Everything about the trail itself is
   here, so the three pages cannot drift apart again.
   ========================================== */

.breadcrumb-container {
  padding: var(--space-16px) var(--space-12px);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* The tight band. Its own class rather than part of the product variant below,
   because the search results page wants the same rhythm without the wash. */
.breadcrumb-container--compact {
  padding: var(--space-8px) var(--space-12px);
}

.breadcrumb-container-product {
  background: linear-gradient(0deg, rgba(255, 255, 255, .9), color-mix(in srgb, var(--blue-550), white 85%));
}

.breadcrumb-responsive {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  margin-bottom: 0;
  padding: 0;
  white-space: nowrap;
  font-size: var(--text-sm);
  /* One em-based value rather than the 0.5 -> 1 -> 1.5px ladder this stepped
     through per breakpoint: tracking in em already scales with the type, so the
     per-breakpoint overrides only made it drift. */
  letter-spacing: var(--tracking-wide);
}

.breadcrumb-responsive .breadcrumb-item {
  display: inline-flex;
  align-items: center;
}

/* Bootstrap's default divider is "/". The box is sized in em off the glyph's
   own font-size so it stays in step with the type rather than needing literals
   kept in sync by hand. */
.breadcrumb-responsive .breadcrumb-item + .breadcrumb-item::before {
  content: "\f285"; /* bi-chevron-right */
  font-family: "bootstrap-icons" !important;
  font-size: var(--text-sm);
  line-height: var(--leading-none);
  width: 1em;
  height: 1em;
  display: inline-block;
  text-align: center;
  color: var(--grey-900);
  vertical-align: middle;
  padding-right: var(--space-8px);
  margin-right: var(--space-4px);
}

.breadcrumb-link {
  font-size: var(--text-sm);
  line-height: var(--leading-caption);
  color: var(--text-primary);
  text-decoration: none;
}

.breadcrumb-link:hover {
  color: var(--blue-550);
}

/* Scoped under .breadcrumb-responsive so it outranks Bootstrap's
   .breadcrumb-item.active on source order. As a bare single-class selector it
   lost that fight, which is why the products.css copy carried !important. */
.breadcrumb-responsive .breadcrumb-active {
  font-size: var(--text-sm);
  line-height: var(--leading-caption);
  font-weight: var(--font-medium);
  color: var(--grey-900);
}

/* Minimum touch target for the links. */
.breadcrumb-responsive a {
  padding: var(--space-4px) var(--space-8px);
  margin: calc(var(--space-4px) * -1) calc(var(--space-8px) * -1);
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}

.breadcrumb-responsive .admin-badge {
  padding: 0 var(--space-4px);
}

.breadcrumb-responsive .badge {
  font-size: var(--text-xs);
  min-width: var(--space-24px);
  min-height: var(--space-24px);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* The container's padding is the only thing that steps per breakpoint now.
   .breadcrumb-container--compact follows the base rule in each block so its
   tighter band wins on source order. */
@media (min-width: 576px) {
  .breadcrumb-container {
    padding: var(--space-24px) var(--space-16px);
  }

  .breadcrumb-container--compact {
    padding: var(--space-8px) var(--space-16px);
  }
}

@media (min-width: 768px) {
  .breadcrumb-container {
    padding: var(--space-32px) var(--space-24px);
    display: flex;
    justify-content: center;
  }

  .breadcrumb-container--compact {
    padding: var(--space-12px) var(--space-24px);
  }

  .breadcrumb-responsive {
    flex-wrap: wrap;
  }
}

@media (min-width: 992px) {
  .breadcrumb-container {
    padding: var(--space-40px) var(--space-32px);
  }

  .breadcrumb-container--compact {
    padding: var(--space-12px) var(--space-32px);
  }
}

/* The compact variant wraps its trail in a .container, which already supplies
   the site gutter — so the band's own horizontal padding stacked on top of it
   and pushed the breadcrumb 32px inside the header's left edge. Only visible
   below ~1264px, where the container is viewport-bound rather than capped and
   centred; above that its auto margins absorb symmetric band padding, which is
   why the misalignment looked intermittent.

   Vertical padding is untouched — the tighter band is deliberate. After the
   media queries above so it wins on source order at equal specificity. */
.breadcrumb-container--compact {
  padding-inline: 0;
}

/* ==========================================
   TERMS & CONDITIONS MODAL

   Chrome only — the document itself is styled by .nim-prose above. Kept here
   rather than in a page stylesheet because the modal is a blueprint partial
   that any page can include.
   ========================================== */

.nim-tos-header {
  padding: var(--space-20px) var(--space-32px);
  background-color: var(--bg-surface-tint);
  border-bottom: 1px solid var(--border-subtle);
}

.nim-tos-title {
  margin-bottom: 0;
  color: var(--blue-700);
}

/* Generous side padding, then the prose centres itself inside whatever is left,
   so the measure is set by .nim-prose's 65ch and not by the modal width. */
.nim-tos-body {
  padding: var(--space-40px) var(--space-32px);
}

.nim-tos-prose {
  margin-inline: auto;
}

.nim-tos-footer {
  padding: var(--space-16px) var(--space-32px);
  background-color: var(--bg-surface-tint);
  border-top: 1px solid var(--border-subtle);
}

@media (max-width: 767.98px) {
  .nim-tos-header,
  .nim-tos-footer {
    padding-inline: var(--space-20px);
  }

  .nim-tos-body {
    padding: var(--space-24px) var(--space-20px);
  }
}

/* Overlay elevation. Bootstrap ships .modal-content with only a small shadow
   above the xs breakpoint, which reads as a flat panel rather than a dialog
   once the page behind it has a textured ground of its own. */
.nim-tos-modal .modal-content {
  border: none;
  box-shadow: var(--shadow-2xl);
}

/* ==========================================
   FILTER PILLS
   ========================================== */

/* One applied filter, shown above a filtered list. The whole pill is the
   clear control, so the ✕ is decorative rather than a target of its own. */
.nim-filter-pill {
  display: inline-flex;
  align-items: center;
  gap: var(--space-4px);
  padding: var(--space-4px) var(--space-8px);
  border: 1px solid var(--blue-250);
  border-radius: var(--radius-full);
  background-color: var(--color-primary-light);
  color: var(--blue-700);
  font-size: var(--text-xs);
  font-weight: var(--font-normal);
  line-height: var(--leading-none);
  text-decoration: none;
  cursor: pointer;
}

.nim-filter-pill:hover {
  color: var(--blue-900);
}

/* The facet name carries the weight so "Print Access" reads as the label and
   "Not Printable" as the answer, without a second colour or size. */
.nim-filter-pill-facet {
  font-weight: var(--font-medium);
}

/* The ✕ rides the 12px type rather than Bootstrap Icons' 16px default, which
   would otherwise set the pill's height on its own. */
.nim-filter-pill .bi {
  font-size: var(--text-xs);
}

/* Reset rather than pill: no fill, so it reads as the odd one out in the row. */
.nim-filter-pill-clear {
  border-color: transparent;
  background-color: transparent;
  text-decoration: underline;
}

/* A pill this size sits below the 44px touch minimum, so the target is
   restored where the pointer is actually a finger; on a mouse it stays
   compact. */
@media (pointer: coarse) {
  .nim-filter-pill {
    min-height: 44px;
    padding-inline: var(--space-12px);
  }
}


/* ==========================================
   FILTER COUNT BADGE
   ========================================== */

/* How many filters are applied, shown on the "Filters" toggle. Outlined
   rather than filled: it sits inside an outline button, and a solid brand
   fill there would out-shout the button's own label. */
.nim-filter-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.25rem;
  height: 1.25rem;
  padding: 0 var(--space-4px);
  border: 1px solid var(--color-primary);
  border-radius: var(--radius-full);
  background-color: var(--bg-surface);
  color: var(--color-primary);
  font-size: var(--text-xs);
  font-weight: var(--font-medium);
  line-height: var(--leading-none);
  flex-shrink: 0;
}

/* ==========================================
   TOAST NOTIFICATIONS
   ========================================== */

/* Stamped by static/js/utils/toast.js into #toast-stack. The ring around the
   close button is the countdown: it drains over --nim-toast-duration and the
   toast closes when it ends. Hover or focus pauses it. --nim-toast-tone colours
   the icon and the ring per level. */
.nim-toast {
  --nim-toast-tone: var(--color-primary);
  display: flex;
  align-items: center;
  gap: var(--space-12px);
  width: min(22.5rem, calc(100vw - 2rem));
  padding: var(--space-12px) var(--space-12px) var(--space-12px) var(--space-16px);
  border: 1px solid var(--border-default);
  border-left: 4px solid var(--nim-toast-tone);
  border-radius: var(--radius-md);
  background-color: var(--bg-surface);
  box-shadow: var(--shadow-lg);
  color: var(--text-primary);
  pointer-events: auto;
  opacity: 0;
  transform: translateY(-0.5rem);
  transition:
    opacity var(--transition-base),
    transform var(--transition-base);
}

.nim-toast.is-shown {
  opacity: 1;
  transform: none;
}

.nim-toast.is-leaving {
  opacity: 0;
  transform: translateX(1rem);
}

.nim-toast--success {
  --nim-toast-tone: var(--text-success);
}

.nim-toast--error {
  --nim-toast-tone: var(--text-danger);
}

.nim-toast__icon {
  flex-shrink: 0;
  font-size: var(--text-base);
  color: var(--nim-toast-tone);
}

.nim-toast__message {
  flex: 1;
  margin: 0;
  font-size: var(--text-sm);
  line-height: var(--leading-normal);
}

.nim-toast__close {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  border: none;
  border-radius: var(--radius-full);
  background: none;
  color: var(--text-muted);
  font-size: var(--text-xs);
  cursor: pointer;
}

.nim-toast__close:hover {
  color: var(--text-primary);
  background-color: var(--bg-hover);
}

.nim-toast__close:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

.nim-toast__timer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
  pointer-events: none;
}

.nim-toast__timer-track,
.nim-toast__timer-ring {
  fill: none;
  stroke-width: 2.5;
}

.nim-toast__timer-track {
  stroke: transparent;
}

.nim-toast__timer-ring {
  stroke: transparent;
  stroke-dasharray: 100;
  stroke-linecap: round;
}

.nim-toast.is-timed .nim-toast__timer-track {
  stroke: var(--border-default);
}

.nim-toast.is-timed .nim-toast__timer-ring {
  stroke: var(--nim-toast-tone);
  animation: nim-toast-countdown var(--nim-toast-duration, 3000ms) linear forwards;
}

.nim-toast:hover .nim-toast__timer-ring,
.nim-toast:focus-within .nim-toast__timer-ring {
  animation-play-state: paused;
}

@keyframes nim-toast-countdown {
  from {
    stroke-dashoffset: 0;
  }
  to {
    stroke-dashoffset: 100;
  }
}

/* The ring stays: it is the only sign the toast will close. Only the slide
   goes. */
@media (prefers-reduced-motion: reduce) {
  .nim-toast,
  .nim-toast.is-leaving {
    transform: none;
    transition: none;
  }
}

/* ==========================================
   LOADING BAR
   ========================================== */

/* An indeterminate progress bar for content that is on its way, such as a
   third-party form still loading. Give it role="progressbar" and an
   aria-label; leaving out aria-valuenow marks it as indeterminate. */
.nim-loading-bar {
  position: relative;
  height: 4px;
  overflow: hidden;
  border-radius: var(--radius-full);
  background-color: var(--blue-100);
}

.nim-loading-bar::after {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 40%;
  border-radius: inherit;
  background-color: var(--color-primary);
  animation: nim-loading-bar 1.2s ease-in-out infinite;
}

@keyframes nim-loading-bar {
  from {
    transform: translateX(-100%);
  }
  to {
    transform: translateX(250%);
  }
}

/* No sweeping motion: a steady pulse still says "working". */
@media (prefers-reduced-motion: reduce) {
  .nim-loading-bar::after {
    width: 100%;
    animation: nim-loading-bar-pulse 2s ease-in-out infinite;
  }
}

@keyframes nim-loading-bar-pulse {
  50% {
    opacity: 0.4;
  }
}

/* ==========================================
   SECTION HEADER
   Orange rule, title, muted description: the home page "Powerful Features"
   header, shared with every heading on the Tools & Features page.
   ========================================== */

.features-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  margin-bottom: var(--space-32px);
}

.features-header__rule {
  width: 260px;
  max-width: 60%;
  height: var(--space-4px);
  background-color: var(--color-accent);
  margin-bottom: var(--space-24px);
}

.features-header__title {
  color: var(--text-secondary);
  margin-bottom: var(--space-8px);
  font-weight: var(--font-medium);
}

.features-header__desc {
  max-width: 71.625rem;
  font-size: var(--text-base);
  font-weight: var(--font-normal);
  line-height: var(--leading-normal);
  color: var(--text-muted);
  margin-bottom: 0;
}

/* Left-aligned, for headings that sit in a column beside other content. */
.features-header--start {
  align-items: flex-start;
  text-align: start;
}

/* ==========================================
   FEATURE CARDS
   Blue card with the orange corner flash that sweeps across on hover. Shared
   by the home page features section and the Store Features page; the section
   frame around them stays with each page.
   ========================================== */

.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(17rem, 1fr));
  gap: var(--space-32px);
}

.feature-card {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 200px;
  padding: var(--space-24px);
  overflow: hidden;
  background-color: var(--blue-700);
  /* Resting corner flash: a hard-stop gradient on the card itself, so the
     animated layer below is free to animate transform and nothing else.
     52px along the 225deg axis = 73px legs. */
  background-image: linear-gradient(225deg, var(--color-accent) 0 52px, transparent 52px);
  background-repeat: no-repeat;
  border-radius: var(--radius-sm);
  color: var(--text-on-dark);
}

/* Hover flash: the corner triangle itself grows across the card — same shape,
   same origin, so it reads as that corner extending rather than a second shape
   appearing behind it. Only transform animates (compositor); the fade is a
   static mask on the parent, which stays in the card's coordinate space while
   the triangle scales inside it. */
.feature-card__flash {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.feature-card__flash::before {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  width: 73px;
  height: 73px;
  background-color: var(--color-accent);
  clip-path: polygon(0 0, 100% 0, 100% 100%);
  transform-origin: 100% 0;
  transform: scale(1);
  /* Leaving: quicker and plainer than the entrance. */
  transition: transform 260ms cubic-bezier(0.4, 0, 1, 1);
  will-change: transform;
}

/* Entering on an exponential-out curve (the "Apple-smooth" cubic-bezier): most
   of the distance in the first fifth of the duration, then a glide to rest.
   14x is enough for the hypotenuse to clear the far corner at any card size. */
.feature-card:hover .feature-card__flash::before {
  transform: scale(14);
  transition: transform 520ms cubic-bezier(0.16, 1, 0.3, 1);
}

/* Two static layers over the moving triangle: the same dot texture as the
   section, and beneath it the card's own blue laid back over the orange below
   the icon. The blue is what fades the wash out; doing it here rather than
   masking the flash keeps the card free of a render surface, so the transform
   above stays a pure compositor animation. The dots sit on this element rather
   than on the card itself so they survive the blue — and carry across the
   orange on hover. Neither layer ever animates. */
.feature-card__flash::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(circle, rgba(255, 255, 255, 0.09) 1.2px, transparent 1.3px),
    linear-gradient(180deg, transparent 22%, var(--blue-700) 42%);
  background-size: 14px 14px, auto;
}

/* Short rule pinned to the bottom of the card */
.feature-card::after {
  content: "";
  order: 1;
  width: 26px;
  height: var(--space-2px);
  margin-top: auto;
  background-color: var(--bg-surface);
}

.feature-card__icon,
.feature-card__logo,
.feature-card__title,
.feature-card__text,
.feature-card::after {
  position: relative;
  z-index: 1;
}

.feature-card__icon {
  font-size: var(--text-2xl);
  line-height: var(--leading-none);
  margin-bottom: var(--space-16px);
  transition: color 200ms ease-out;
}

.feature-card:hover .feature-card__icon {
  color: var(--grey-900);
}

/* A publisher logo standing in for the icon. brightness(0) flattens whatever
   colours the source PNG has to black; invert(1) then lifts it to white, so it
   sits with the icons in either state. */
.feature-card__logo {
  height: var(--space-40px);
  width: auto;
  max-width: 65%;
  object-fit: contain;
  object-position: left center;
  margin-bottom: var(--space-16px);
  filter: brightness(0) invert(1);
  transition: filter 200ms ease-out;
}

.feature-card:hover .feature-card__logo {
  filter: brightness(0);
}

.feature-card__title {
  font-size: var(--text-lg);
  font-weight: var(--font-normal);
  line-height: var(--leading-normal);
  margin-bottom: var(--space-8px);
  color: var(--text-on-dark)
}

.feature-card__text {
  font-size: var(--text-sm);
  line-height: var(--leading-relaxed);
  color: rgba(255, 255, 255, 0.7);
  margin-bottom: var(--space-16px);
}

/* A single card left over on the last row sits in the middle column. */
@media (min-width: 992px) {
  .features-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .feature-card:last-child:nth-child(3n + 1) {
    grid-column: 2;
  }
}

@media (prefers-reduced-motion: reduce) {
  .feature-card__flash::before,
  .feature-card:hover .feature-card__flash::before,
  .feature-card__icon {
    transition: none;
  }
}
