/* ==========================================================================
   RanKnight — Base: reset, typography, layout primitives, buttons, utilities
   Reads tokens.css. Loaded on every page after tokens.css + fonts.css.
   ========================================================================== */

/* ---- Reset ---- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body {
  font-family: var(--font-body);
  font-size: 1.0625rem;         /* ~17px */
  line-height: 1.6;
  color: var(--color-text);
  background: var(--color-surface);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img, picture, svg, video { display: block; max-width: 100%; }
img { height: auto; }
a { color: inherit; text-decoration: none; }
button, input, textarea, select { font: inherit; color: inherit; }
ul[class], ol[class] { list-style: none; padding: 0; }
:target { scroll-margin-top: 6rem; }

/* ---- Typography ---- */
h1, h2, h3, h4 {
  font-family: var(--font-display);
  color: var(--color-heading);
  line-height: 1.05;
  font-weight: 800;
  letter-spacing: -0.02em;
  text-wrap: balance;
}
h1 { font-size: var(--display-hero); font-weight: 900; }
h2 { font-size: var(--display-lg); }
h3 { font-size: var(--text-xl); line-height: 1.15; }
h4 { font-size: var(--text-md); line-height: 1.2; }
p  { max-width: 66ch; }
strong { font-weight: 600; color: var(--color-heading); }

.eyebrow {
  font-family: var(--font-display);
  font-size: var(--text-sm);
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--color-accent-text);
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
}
.lede { font-size: var(--text-md); color: var(--color-text-muted); max-width: 60ch; text-align: left; }
/* In centered sections, keep the heading centered but let the body lede read left-aligned
   as a centered block (design-system: no centered multi-line body copy). */
.section__head--center .lede { margin-inline: auto; }

/* ---- Layout primitives ---- */
.container { width: 100%; max-width: var(--container); margin-inline: auto; padding-inline: var(--gutter); }
.container--narrow { max-width: var(--container-narrow); }
.section { padding-block: var(--space-8); background: var(--color-surface); color: var(--color-text); }
.section--tight { padding-block: var(--space-7); }
.section--tight-top { padding-top: var(--space-4); }
.section__head { max-width: 52ch; margin-bottom: var(--space-6); }
.section__head--center { margin-inline: auto; text-align: center; }
.stack > * + * { margin-top: var(--space-4); }
.grid { display: grid; gap: var(--space-5); }
@media (min-width: 768px) {
  .grid--2 { grid-template-columns: repeat(2, 1fr); }
  .grid--3 { grid-template-columns: repeat(3, 1fr); }
}
.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;
}

/* Small layout utilities */
.text-center { text-align: center; }
.mx-auto { margin-inline: auto; }
.eyebrow--center { justify-content: center; }

/* ---- Skip link ---- */
.skip-link {
  position: absolute; left: var(--space-3); top: -3rem; z-index: 200;
  background: var(--color-accent); color: var(--color-on-accent);
  padding: var(--space-2) var(--space-4); border-radius: var(--radius-sm); font-weight: 600;
  transition: top var(--dur) var(--ease-out);
}
.skip-link:focus { top: var(--space-3); }

/* ---- Focus ring (keyboard only) ---- */
:focus-visible { outline: 3px solid var(--color-accent); outline-offset: 2px; border-radius: 4px; }
:focus:not(:focus-visible) { outline: none; }

/* ---- Buttons ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2);
  font-family: var(--font-display); font-weight: 700; font-size: var(--text-base);
  letter-spacing: -0.01em; line-height: 1;
  padding: 0.95rem 1.5rem; border-radius: var(--radius-pill);
  border: 1.5px solid transparent; cursor: pointer;
  transition: transform var(--dur) var(--ease-out), background var(--dur) var(--ease-out),
              border-color var(--dur) var(--ease-out), color var(--dur) var(--ease-out);
}
.btn:hover { transform: translateY(-2px); }
.btn--primary { background: var(--color-accent); color: var(--color-on-accent); box-shadow: var(--shadow-gold); }
.btn--primary:hover { background: var(--color-accent-hover); }
.btn--ghost { background: transparent; color: var(--color-heading); border-color: var(--color-border); }
.btn--ghost:hover { border-color: var(--color-accent); color: var(--color-accent-text); }
.btn--lg { font-size: var(--text-md); padding: 1.1rem 1.9rem; }
.btn svg { width: 1.1em; height: 1.1em; }

/* Inline text link with underline affordance */
.link { color: var(--color-accent-text); font-weight: 600; display: inline-flex; align-items: center; gap: .4rem; }
.link:hover { text-decoration: underline; text-underline-offset: 3px; }
.link svg { width: 1em; height: 1em; transition: transform var(--dur) var(--ease-out); }
.link:hover svg { transform: translateX(3px); }

/* ---- Cards ---- */
.card {
  background: var(--color-card); border: 1px solid var(--color-border);
  border-radius: var(--radius); padding: var(--space-5);
}

/* ---- Reveal (reduced-motion-complete: base = visible; motion only when allowed) ---- */
.reveal {}
@media (prefers-reduced-motion: no-preference) {
  @supports (animation-timeline: view()) {
    .reveal {
      opacity: 0; transform: translateY(1.4rem);
      animation: reveal linear both;
      animation-timeline: view();
      animation-range: entry 0% cover 22%;
    }
  }
}
@keyframes reveal { to { opacity: 1; transform: none; } }

/* Divider */
.rule { height: 1px; background: var(--color-border); border: 0; }
