/* Site-only rules. They use the app's tokens from theme/theme.css and add no colour or spacing values
   of their own. Everything shared with the app comes from the synced files in theme/. */

.skip-link:focus {
  position: fixed;
  top: var(--spacing-sm);
  left: var(--spacing-sm);
  z-index: 2000;
  padding: var(--spacing-sm) var(--spacing-md);
  background: var(--content-bg);
  color: var(--text-primary);
  border-radius: var(--border-radius);
  box-shadow: var(--shadow);
}

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

/* Contrast. WCAG 2.2 AA (FR-013) needs 4.5:1 for normal text. The app's primary blue (--primary-color) is
   3.97:1 with white text and about 4.4:1 as text on the dark page, so the site keeps the app's tokens but picks
   the readable ones. Everything else (body links, headings, cards) already passes with the app's own rules. */
.btn-primary {
  --primary-color: var(--primary-hover);
}

.btn-primary:hover {
  filter: brightness(1.2);
}

/* "Read the guides": the app's secondary grey is under 4.5:1 on the dark page. */
.btn-outline-secondary {
  --secondary-color: var(--text-primary);
}

.btn-outline-secondary:hover {
  --text-light: var(--body-bg);
}

/* The app forces breadcrumb links to --primary-color with !important; point that token at a readable blue. */
.breadcrumb {
  --crumb: var(--primary-hover);
}

[data-theme="dark"] .breadcrumb {
  --crumb: color-mix(in srgb, var(--primary-color) 70%, white);
}

.breadcrumb-item a {
  --primary-color: var(--crumb);
}

.breadcrumb-item a:hover {
  --primary-hover: var(--crumb);
}

/* Links inside a notice (the ended-promotion message). The notice keeps Bootstrap's light background in both
   themes, but the app's link colour is near its text in light mode and white in dark mode, which almost vanishes.
   Take the notice's own text colour and mark links with an underline instead (WCAG 1.4.1, 1.4.3). The app's
   link rule (custom-theme-overrides.css) colours links with --text-primary and removes the underline through a
   long :not() chain, so point the token here and force the underline. */
.alert a {
  --text-primary: var(--bs-alert-color);
  text-decoration: underline !important;
}

/* Links in running text (guides and posts) get the same colour as the text under the app's link rule, so they
   would only stand out by brightness. Underline them; buttons such as "Open in the app" keep their own look. */
.prose a:not(.btn) {
  text-decoration: underline !important;
  text-underline-offset: 0.15em;
}

/* A badge that is a link: the app's link rule would turn its text dark on the grey badge. */
.tag-badge {
  color: var(--text-light) !important;
}

.meta,
.coming-soon,
.hero .lead {
  color: var(--text-primary);
}

.icon {
  vertical-align: -0.125em;
}

.prose {
  max-width: 44rem;
  margin-inline: auto;
  /* Long URLs (the licence links) must wrap rather than widen the page on a phone. */
  overflow-wrap: anywhere;
}

.legal-attribution {
  overflow-wrap: anywhere;
}

.prose img,
.prose picture {
  max-width: 100%;
  height: auto;
}

.hero {
  padding-block: var(--spacing-xl);
  text-align: center;
}

.hero h1 {
  font-size: clamp(2rem, 6vw, 3rem);
  margin-bottom: var(--spacing-md);
  border-bottom: 0;
}

.hero .lead {
  max-width: 40rem;
  margin-inline: auto;
}

/* The d20 mascot under the hero's buttons. */
.hero-mascot {
  width: 10rem;
  height: auto;
  margin-top: var(--spacing-lg);
}

.feature-card,
.post-card,
.guide-card {
  height: 100%;
  background: var(--card-bg);
  border: 1px solid var(--border-light);
  border-radius: var(--border-radius-card);
  box-shadow: var(--card-shadow);
  padding: var(--spacing-lg);
}

.post-card a,
.guide-card a {
  text-decoration: none;
}

.feature-shot {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 10;
  margin-bottom: var(--spacing-md);
  border-radius: var(--border-radius);
}

video.feature-shot {
  object-fit: cover;
  background: var(--card-bg);
}

.meta {
  font-size: var(--font-size-sm);
}

.promo-banner {
  background: var(--card-bg);
  border: 1px solid var(--primary-color);
  border-radius: var(--border-radius-card);
  padding: var(--spacing-md) var(--spacing-lg);
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}
