/* Magogi base layer — element defaults, typography, buttons, a11y utilities.
 * Ported from mgf-website's global.css so type, links, focus rings, and buttons
 * match the flagship site exactly. Depends on tokens.css. KIT-READY. */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  font-family: var(--font-sans);
  color: var(--color-text);
  background: var(--color-bg);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

main {
  flex: 1;
}

a {
  color: var(--color-link);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.15em;
}

a:hover {
  color: var(--color-link-hover);
}

/* Visible keyboard focus for all interactive elements (WCAG 2.4.7 / 2.4.11).
 * Teal outline clears 3:1 against both Paper and Ink; offset keeps it clear of
 * the element's own fill. */
:focus-visible {
  outline: 2px solid var(--color-link);
  outline-offset: 2px;
}

code,
kbd,
pre,
samp {
  font-family: var(--font-mono);
}

img,
svg,
video {
  max-width: 100%;
  height: auto;
  display: block;
}

h1,
h2,
h3,
h4 {
  font-family: var(--font-display);
  line-height: 1.15;
  letter-spacing: -0.01em;
  margin: 0 0 var(--space-4);
}

h1 {
  font-size: clamp(1.6rem, 3vw, 2.25rem);
}

h2 {
  font-size: clamp(1.3rem, 2.2vw, 1.75rem);
}

p {
  margin: 0 0 var(--space-4);
}

.container {
  max-width: var(--content-max);
  margin-inline: auto;
  padding-inline: var(--space-6);
}

.prose {
  max-width: var(--content-prose);
}

/* --- Buttons (Brand Book Part VIII) ------------------------------------- */

.button {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 0.9rem;
  line-height: 1.2;
  text-decoration: none;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background-color var(--motion-fast) var(--ease-standard),
    color var(--motion-fast) var(--ease-standard),
    border-color var(--motion-fast) var(--ease-standard);
}

.button-primary {
  background: var(--color-primary);
  color: white;
}

.button-primary:hover {
  background: var(--color-primary-shade);
  color: white;
}

.button-secondary {
  background: transparent;
  /* Foreground tracks the text colour so the outline stays legible in both
   * themes (indigo on Ink would be near-invisible). */
  color: var(--color-text);
  border-color: var(--color-border-strong);
}

.button-secondary:hover {
  background: var(--color-primary-tint);
}

/* Signature gold CTA — at most ONE per view (Brand Book Part VIII). Ink text on
 * Keystone Gold (≈9:1); white on gold fails contrast, so never use it. */
.button-accent {
  background: var(--color-accent);
  color: var(--mgf-ink);
}

.button-accent:hover {
  background: color-mix(in srgb, var(--mgf-gold) 88%, black);
  color: var(--mgf-ink);
}

/* Destructive action — outline by default, fills red on hover. */
.button-danger {
  background: transparent;
  color: var(--color-error-text);
  border-color: color-mix(in srgb, var(--mgf-error) 55%, transparent);
}

.button-danger:hover {
  background: var(--mgf-error);
  color: white;
  border-color: var(--mgf-error);
}

.button-sm {
  padding: var(--space-1) var(--space-3);
  font-size: 0.8rem;
}

/* Motion is rare and meaningful (round-3 UI). Honor a reduced-motion request
 * globally: strip movement, keep state changes (contrast/outline/underline). */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

/* Text utilities */
.mono {
  font-family: var(--font-mono);
}

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

.lead {
  color: var(--color-text-muted);
  font-size: 1.05rem;
}

/* Visually-hidden utility (accessible labels) */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
