/*
  Public portal base: typography, layout utilities, focus, motion and MudBlazor
  normalisation. Rules: every selector is a pub- class or rooted at .ds-pub-shell; colours
  come only from pub-tokens.css; MudBlazor internals are overridden with compound selectors
  (no !important unless the MudBlazor rule being beaten is itself !important).
*/

.ds-pub-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--pub-canvas);
  color: var(--pub-ink);
  font-family: var(--pub-font-sans);
  font-size: var(--pub-text-md);
  line-height: var(--pub-lh-body);
  font-feature-settings: var(--pub-font-features);
  font-optical-sizing: auto;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

.ds-pub-shell *,
.ds-pub-shell *::before,
.ds-pub-shell *::after { box-sizing: border-box; }

.ds-pub-shell h1, .ds-pub-shell h2, .ds-pub-shell h3,
.ds-pub-shell h4, .ds-pub-shell h5, .ds-pub-shell h6,
.ds-pub-shell p, .ds-pub-shell figure, .ds-pub-shell dl, .ds-pub-shell dd,
.ds-pub-shell ol, .ds-pub-shell ul, .ds-pub-shell blockquote { margin: 0; }

.ds-pub-shell ol, .ds-pub-shell ul { padding: 0; }
.ds-pub-shell .pub-list-reset { list-style: none; }
.ds-pub-shell img { display: block; max-width: 100%; height: auto; }
.ds-pub-shell button, .ds-pub-shell input, .ds-pub-shell select, .ds-pub-shell textarea { font: inherit; color: inherit; }
.ds-pub-shell a { color: var(--pub-primary); text-decoration: none; }
.ds-pub-shell a:hover { color: var(--pub-primary-hover); }
.ds-pub-shell ::selection { background: var(--pub-primary-soft); color: var(--pub-ink); }

/* Headings: serif display for page titles and editorial headings; Inter below h3 */
.ds-pub-shell .pub-display,
.ds-pub-shell .pub-h1 {
  font-family: var(--pub-font-display);
  font-weight: 500;
  font-style: normal;
  font-variation-settings: "SOFT" 20, "WONK" 0;
  font-size: var(--pub-text-4xl);
  line-height: var(--pub-lh-display);
  letter-spacing: var(--pub-ls-display);
  color: var(--pub-ink);
  text-wrap: balance;
}

.ds-pub-shell .pub-h2 {
  font-family: var(--pub-font-display);
  font-weight: 500;
  font-variation-settings: "SOFT" 20, "WONK" 0;
  font-size: var(--pub-text-3xl);
  line-height: var(--pub-lh-heading);
  letter-spacing: var(--pub-ls-heading);
  color: var(--pub-ink);
  text-wrap: balance;
}

.ds-pub-shell .pub-h3 {
  font-family: var(--pub-font-display);
  font-weight: 500;
  font-variation-settings: "SOFT" 20, "WONK" 0;
  font-size: var(--pub-text-2xl);
  line-height: 1.2;
  letter-spacing: var(--pub-ls-heading);
  color: var(--pub-ink);
}

.ds-pub-shell .pub-h4 {
  font-family: var(--pub-font-sans);
  font-weight: 600;
  font-size: var(--pub-text-lg);
  line-height: 1.35;
  letter-spacing: -0.012em;
  color: var(--pub-ink);
}

.ds-pub-shell .pub-h5 {
  font-family: var(--pub-font-sans);
  font-weight: 600;
  font-size: var(--pub-text-md);
  line-height: 1.4;
  letter-spacing: -0.01em;
  color: var(--pub-ink);
}

.pub-lede {
  font-size: var(--pub-text-lg);
  line-height: 1.55;
  color: var(--pub-ink-2);
  max-width: 62ch;
  text-wrap: pretty;
}

.pub-prose {
  font-size: var(--pub-text-md);
  line-height: var(--pub-lh-body);
  color: var(--pub-ink-2);
  max-width: 72ch;
  white-space: pre-line;
  overflow-wrap: anywhere;
}

.pub-eyebrow {
  display: inline-block;
  font-size: var(--pub-text-2xs);
  font-weight: 600;
  line-height: 1.4;
  letter-spacing: var(--pub-ls-caps);
  text-transform: uppercase;
  color: var(--pub-ink-3);
}

.pub-eyebrow--accent { color: var(--pub-accent-ink); }

.pub-ui { font-size: var(--pub-text-sm); line-height: var(--pub-lh-ui); letter-spacing: var(--pub-ls-ui); }
.pub-meta { font-size: var(--pub-text-sm); line-height: var(--pub-lh-ui); color: var(--pub-ink-3); }
.pub-text-muted { color: var(--pub-ink-2); }
.pub-text-subtle { color: var(--pub-ink-3); }
.pub-num { font-variant-numeric: tabular-nums; font-feature-settings: "cv11", "ss01", "tnum"; }
.pub-truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.pub-line-clamp-2, .pub-line-clamp-3 { display: -webkit-box; -webkit-box-orient: vertical; overflow: hidden; }
.pub-line-clamp-2 { -webkit-line-clamp: 2; line-clamp: 2; }
.pub-line-clamp-3 { -webkit-line-clamp: 3; line-clamp: 3; }

.pub-visually-hidden {
  /* !important: must win over any component positioning */
  position: absolute !important;
  width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

/* Layout */
.pub-container {
  width: 100%;
  max-width: calc(var(--pub-container) + 2 * var(--pub-gutter));
  margin-inline: auto;
  padding-inline: var(--pub-gutter);
}
.pub-container--wide { max-width: calc(var(--pub-container-wide) + 2 * var(--pub-gutter)); }
.pub-container--narrow { max-width: calc(var(--pub-container-narrow) + 2 * var(--pub-gutter)); }

.pub-main { flex: 1 0 auto; outline: none; display: block; }

.pub-stack-1 > * + * { margin-top: var(--pub-space-1); }
.pub-stack-2 > * + * { margin-top: var(--pub-space-2); }
.pub-stack-3 > * + * { margin-top: var(--pub-space-3); }
.pub-stack-4 > * + * { margin-top: var(--pub-space-4); }
.pub-stack-6 > * + * { margin-top: var(--pub-space-6); }
.pub-stack-8 > * + * { margin-top: var(--pub-space-8); }

.pub-cluster { display: flex; flex-wrap: wrap; align-items: center; gap: var(--pub-space-2); min-width: 0; }
.pub-cluster--lg { gap: var(--pub-space-3) var(--pub-space-4); }
.pub-dot-sep > * + *::before { content: "\00B7"; margin-right: var(--pub-space-2); color: var(--pub-ink-3); }
.pub-dot-sep { display: flex; flex-wrap: wrap; align-items: center; column-gap: var(--pub-space-2); row-gap: var(--pub-space-1); }

.pub-grid { display: grid; gap: var(--pub-space-6); grid-template-columns: repeat(12, minmax(0, 1fr)); }
.pub-grid > * { grid-column: span 12; min-width: 0; }
@media (min-width: 1024px) {
  .pub-grid > .pub-col-lg-3 { grid-column: span 3; }
  .pub-grid > .pub-col-lg-4 { grid-column: span 4; }
  .pub-grid > .pub-col-lg-5 { grid-column: span 5; }
  .pub-grid > .pub-col-lg-6 { grid-column: span 6; }
  .pub-grid > .pub-col-lg-7 { grid-column: span 7; }
  .pub-grid > .pub-col-lg-8 { grid-column: span 8; }
}
@media (min-width: 768px) and (max-width: 1023.98px) {
  .pub-grid > .pub-col-md-6 { grid-column: span 6; }
}

/* Focus: one visible, consistent ring everywhere */
.ds-pub-shell :focus-visible {
  outline: 2px solid var(--pub-focus);
  outline-offset: 2px;
}
.ds-pub-shell :focus:not(:focus-visible) { outline: none; }
/* Headings receive programmatic focus after navigation (FocusOnNavigate) for screen readers;
   they are not interactive, so no visible ring. */
.ds-pub-shell h1:focus, .ds-pub-shell h1:focus-visible { outline: none; }

/* Lucide line icons (see Theme/LucideIcons.cs): MudIcon wraps them in an svg that inherits
   fill:currentColor from .mud-svg-icon, so stroke icons must opt out explicitly. */
.ds-pub-shell .pub-lucide,
.ds-pub-shell .mud-svg-icon .pub-lucide {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.ds-pub-shell .mud-icon-root.pub-icon { width: 20px; height: 20px; font-size: 20px; flex: none; }
.ds-pub-shell .mud-icon-root.pub-icon--xs { width: 14px; height: 14px; font-size: 14px; }
.ds-pub-shell .mud-icon-root.pub-icon--sm { width: 16px; height: 16px; font-size: 16px; }
.ds-pub-shell .mud-icon-root.pub-icon--lg { width: 24px; height: 24px; font-size: 24px; }
.ds-pub-shell .mud-icon-root.pub-icon--xl { width: 32px; height: 32px; font-size: 32px; }

/* ---- MudBlazor normalisation (inside the public shell only) ---- */
.ds-pub-shell .mud-typography { font-family: var(--pub-font-sans); }
.ds-pub-shell .mud-button-root { text-transform: none; letter-spacing: var(--pub-ls-ui); font-family: var(--pub-font-sans); }
.ds-pub-shell .mud-input,
.ds-pub-shell .mud-input-label,
.ds-pub-shell .mud-select,
.ds-pub-shell .mud-list-item-text { font-family: var(--pub-font-sans); }
.ds-pub-shell .mud-input.mud-input-outlined .mud-input-outlined-border { border-color: var(--pub-border-strong); border-radius: var(--pub-radius); }
.ds-pub-shell .mud-input.mud-input-outlined:hover .mud-input-outlined-border { border-color: var(--pub-ink-3); }
.ds-pub-shell .mud-input.mud-input-outlined.mud-focused .mud-input-outlined-border { border-color: var(--pub-primary); border-width: 2px; }
.ds-pub-shell .mud-input-helper-text { color: var(--pub-ink-3); }

.ds-pub-shell .mud-popover.mud-paper {
  border: 1px solid var(--pub-border);
  border-radius: var(--pub-radius-lg);
  box-shadow: var(--pub-shadow-lg);
  background: var(--pub-surface);
}
.ds-pub-shell .mud-list-item { font-size: var(--pub-text-sm); }
.ds-pub-shell .mud-selected-item { background: var(--pub-primary-soft); color: var(--pub-primary-soft-ink); }

.ds-pub-shell .mud-dialog {
  border-radius: var(--pub-radius-xl);
  border: 1px solid var(--pub-border);
  box-shadow: var(--pub-shadow-lg);
  background: var(--pub-surface);
  color: var(--pub-ink);
}
.ds-pub-shell .mud-dialog .mud-dialog-title { font-family: var(--pub-font-sans); font-weight: 600; }

.ds-pub-shell .mud-snackbar {
  border-radius: var(--pub-radius-lg);
  box-shadow: var(--pub-shadow-lg);
  font-family: var(--pub-font-sans);
  font-size: var(--pub-text-sm);
}

.ds-pub-shell .mud-tooltip {
  background: var(--pub-surface-inverse);
  color: var(--pub-ink-inverse);
  font-size: var(--pub-text-xs);
  border-radius: var(--pub-radius-sm);
}

/* Motion: everything respects reduced-motion */
@media (prefers-reduced-motion: reduce) {
  .ds-pub-shell *,
  .ds-pub-shell *::before,
  .ds-pub-shell *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
