/* ============================================================
   Helix Design System — Typography  v1
   
   Provides: Inter font, HTML baseline, heading scale,
   body text helpers, code/mono helpers, link styles.
   Import AFTER tokens.css.
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:ital,opsz,wght@0,14..32,400;0,14..32,500;0,14..32,600;0,14..32,700;0,14..32,800;1,14..32,400&family=JetBrains+Mono:wght@400;500&display=swap');

/* ── Global Reset & Base ── */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  line-height: var(--leading-normal);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  font-feature-settings: 'cv02', 'cv03', 'cv04', 'cv11';
  overflow-x: hidden;
  scroll-behavior: smooth;
  touch-action: auto;
  -webkit-text-size-adjust: 100%;
  -ms-text-size-adjust: 100%;
}

body {
  font-family: var(--font-sans);
  font-size: var(--text-base);
  font-weight: var(--font-weight-normal);
  line-height: var(--leading-normal);
  background: var(--color-bg);
  color: var(--color-text);
  min-height: 100svh;
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
}

/* Reduced motion */
@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;
  }
}

/* ── Page-enter animation ── */
@keyframes hx-page-enter {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}

.hx-page-enter {
  animation: hx-page-enter var(--duration-enter) var(--ease-out);
}

/* ── Headings ── */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-sans);
  font-weight: var(--font-weight-semibold);
  line-height: var(--leading-tight);
  color: var(--color-text);
  letter-spacing: -0.01em;
}

h1 { font-size: var(--text-3xl); font-weight: var(--font-weight-bold); }
h2 { font-size: var(--text-2xl); }
h3 { font-size: var(--text-xl); }
h4 { font-size: var(--text-lg); }
h5 { font-size: var(--text-md); }
h6 { font-size: var(--text-base); }

/* ── Body text helpers ── */
p {
  line-height: var(--leading-relaxed);
  color: var(--color-text);
}

.hx-text-xs    { font-size: var(--text-xs); }
.hx-text-sm    { font-size: var(--text-sm); }
.hx-text-base  { font-size: var(--text-base); }
.hx-text-md    { font-size: var(--text-md); }
.hx-text-lg    { font-size: var(--text-lg); }
.hx-text-xl    { font-size: var(--text-xl); }
.hx-text-2xl   { font-size: var(--text-2xl); }
.hx-text-3xl   { font-size: var(--text-3xl); }

.hx-font-normal   { font-weight: var(--font-weight-normal); }
.hx-font-medium   { font-weight: var(--font-weight-medium); }
.hx-font-semibold { font-weight: var(--font-weight-semibold); }
.hx-font-bold     { font-weight: var(--font-weight-bold); }

.hx-text-muted    { color: var(--color-text-muted); }
.hx-text-dim      { color: var(--color-text-dim); }
.hx-text-accent   { color: var(--color-accent); }
.hx-text-success  { color: var(--color-success); }
.hx-text-error    { color: var(--color-error); }
.hx-text-warning  { color: var(--color-warning); }

.hx-leading-tight   { line-height: var(--leading-tight); }
.hx-leading-snug    { line-height: var(--leading-snug); }
.hx-leading-normal  { line-height: var(--leading-normal); }
.hx-leading-relaxed { line-height: var(--leading-relaxed); }

/* ── Inline elements ── */
a {
  color: var(--color-accent);
  text-decoration: none;
  transition: color var(--transition-fast);
}
a:hover {
  color: var(--color-accent-hover);
}
a:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
  border-radius: var(--radius-xs);
}

strong, b { font-weight: var(--font-weight-semibold); }
em, i     { font-style: italic; }

small { font-size: var(--text-xs); color: var(--color-text-muted); }

mark {
  background: rgba(var(--color-accent-rgb), 0.25);
  color: var(--color-text);
  border-radius: var(--radius-xs);
  padding: 0 var(--space-0-5);
}

del { color: var(--color-text-dim); text-decoration: line-through; }
ins { color: var(--color-success); text-decoration: none; }

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

/* ── Monospace / Code ── */
code,
kbd,
samp,
pre {
  font-family: var(--font-mono);
  font-size: 0.9em;
}

code {
  background: var(--color-surface-2);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xs);
  padding: var(--space-0-5) var(--space-1);
  color: var(--color-accent-2);
}

pre {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  overflow-x: auto;
  line-height: var(--leading-relaxed);
}

pre code {
  background: none;
  border: none;
  padding: 0;
  font-size: inherit;
  color: var(--color-text);
}

kbd {
  background: var(--color-surface-2);
  border: 1px solid var(--color-border-2);
  border-radius: var(--radius-xs);
  padding: var(--space-0-5) var(--space-1-5);
  font-size: var(--text-xs);
  box-shadow: 0 1px 0 var(--color-border-2);
}

/* ── Media ── */
img,
video {
  display: block;
  max-width: 100%;
  height: auto;
}

svg {
  display: inline-block;
  width: 1em;
  height: 1em;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
  vertical-align: middle;
}

/* ── Lists ── */
ul,
ol {
  list-style: none;
}

/* Prose/content lists */
.hx-prose ul { list-style: disc; padding-left: var(--space-6); }
.hx-prose ol { list-style: decimal; padding-left: var(--space-6); }
.hx-prose li { margin-bottom: var(--space-1); }

/* ── HR ── */
hr {
  border: none;
  border-top: 1px solid var(--color-border);
  margin: var(--space-6) 0;
}

/* ── Selection ── */
::selection {
  background: var(--color-accent);
  color: #fff;
}

/* ── Scrollbars ── */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--color-surface-3);
  border-radius: var(--radius-full);
}
::-webkit-scrollbar-thumb:hover {
  background: var(--color-text-dim);
}
* {
  scrollbar-color: var(--color-surface-3) transparent;
  scrollbar-width: thin;
}

/* ── Focus (keyboard-only, accessible) ── */
:focus {
  outline: none;
}
:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
  border-radius: var(--radius-xs);
}
