/* ------------------------------------------------------------------
 * Kadi / Koromia Apps — reset, typography defaults, shared primitives
 * Depends on tokens.css.
 * ------------------------------------------------------------------ */

/* ---- Reset ------------------------------------------------------- */

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

* {
  margin: 0;
}

html {
  -webkit-text-size-adjust: 100%;
  tab-size: 4;
  scroll-behavior: smooth;
}

body {
  min-height: 100svh;
  background: var(--bg-deep);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: var(--text-body-lg);
  font-weight: 400;
  line-height: var(--leading-relaxed);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  font-synthesis-weight: none;
  /* Nothing on this site may cause the page itself to scroll sideways.
     Wide content scrolls inside its own container instead. */
  overflow-x: hidden;
}

img,
picture,
svg,
video,
canvas {
  display: block;
  max-width: 100%;
}

img,
video {
  height: auto;
}

input,
button,
textarea,
select {
  font: inherit;
  color: inherit;
}

p,
h1,
h2,
h3,
h4,
h5,
h6,
li {
  overflow-wrap: break-word;
}

ul[role='list'],
ol[role='list'] {
  list-style: none;
  padding: 0;
}

:target {
  scroll-margin-top: var(--space-3xl);
}

/* ---- Typography -------------------------------------------------- */

h1,
h2,
h3,
h4 {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: var(--leading-snug);
  letter-spacing: var(--tracking-headline);
  text-wrap: balance;
}

h1 {
  font-size: var(--text-display-lg);
  letter-spacing: var(--tracking-display);
  line-height: var(--leading-tight);
}

h2 {
  font-size: var(--text-headline-lg);
}

h3 {
  font-size: var(--text-headline-md);
}

h4 {
  font-size: var(--text-headline-sm);
  font-weight: 600;
}

p {
  text-wrap: pretty;
}

strong,
b {
  font-weight: 600;
  color: var(--ink);
}

small {
  font-size: var(--text-body-sm);
}

code,
kbd,
samp {
  font-family: var(--font-mono);
  font-size: 0.9em;
}

abbr[title] {
  text-decoration: underline dotted;
  cursor: help;
}

/* ---- Links ------------------------------------------------------- */

a {
  color: var(--clay);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
  transition: color var(--dur-fast) var(--ease-out);
}

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

/* ---- Focus -------------------------------------------------------
   Visible, high contrast, and never removed. The clay-on-near-black
   ring clears 3:1 against every surface token. */

:focus-visible {
  outline: 2px solid var(--clay);
  outline-offset: 3px;
  border-radius: 2px;
}

:focus:not(:focus-visible) {
  outline: none;
}

/* ---- Utilities ---------------------------------------------------- */

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* Keyboard escape hatch past the header on every page. */
.skip-link {
  position: absolute;
  top: var(--space-sm);
  left: var(--space-sm);
  z-index: 100;
  padding: var(--space-sm) var(--space-md);
  background: var(--clay);
  color: var(--ink-inverse);
  font-family: var(--font-mono);
  font-size: var(--text-mono-sm);
  font-weight: 700;
  letter-spacing: var(--tracking-eyebrow);
  text-transform: uppercase;
  text-decoration: none;
  border-radius: var(--radius-sm);
  transform: translateY(-200%);
  transition: transform var(--dur-fast) var(--ease-out);
}

.skip-link:focus {
  transform: translateY(0);
  color: var(--ink-inverse);
}

.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.eyebrow {
  font-family: var(--font-mono);
  font-size: var(--text-eyebrow);
  font-weight: 500;
  letter-spacing: var(--tracking-eyebrow);
  text-transform: uppercase;
  color: var(--clay);
}

/* ---- Reduced motion ----------------------------------------------
   A global kill switch. Any animation added anywhere on the site is
   covered by this without the author having to remember — which is the
   point. Individual components may still add their own richer
   reduced-motion variants on top. */

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }

  :root {
    --dur-fast: 0.01ms;
    --dur-med: 0.01ms;
    --dur-slow: 0.01ms;
  }
}

/* ---- Print -------------------------------------------------------
   Legal pages get printed and filed. Make that not look terrible. */

@media print {
  body {
    background: #fff;
    color: #000;
    font-size: 11pt;
  }

  a {
    color: #000;
    text-decoration: underline;
  }

  /* Expose destinations so a printed policy stays verifiable. */
  main a[href^='http']::after {
    content: ' (' attr(href) ')';
    font-size: 9pt;
    word-break: break-all;
  }

  .site-header,
  .site-footer,
  .skip-link,
  .legal-toc {
    display: none !important;
  }
}
