/**
 * LEARNature-ly Base Stylesheet v1
 * Stable URL: https://learnature-ly.com/shared/design-system/ln-base.css
 *
 * Loads AFTER tokens.v1.css. Provides:
 *   - Modern minimal CSS reset
 *   - Body styling using tokens
 *   - Typography scale
 *   - Touch target safety (WCAG 2.5.8)
 *   - Reduced-motion + RTL support
 *
 * Apps opt-in by adding ONE link tag after tokens:
 *   <link rel="stylesheet" href="/shared/design-system/tokens.v1.css">
 *   <link rel="stylesheet" href="/shared/design-system/ln-base.css">
 *   <link rel="stylesheet" href="/your-app/styles.css">
 */

/* ====================================================================
 * RESET — Josh Comeau's modern reset, simplified.
 * ==================================================================== */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }

html {
  text-size-adjust: 100%;
  -webkit-text-size-adjust: 100%;
}

body {
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-tap-highlight-color: transparent;
  background-color: var(--ln-bg-primary);
  color: var(--ln-text-primary);
  font-family: var(--ln-font-ui);
  font-size: var(--ln-text-base);
  min-height: 100dvh;
  /* Smooth theme + per-app tint transitions */
  transition:
    background-color var(--ln-transition-default) var(--ln-easing-default),
    color            var(--ln-transition-default) var(--ln-easing-default);
}

body[dir="rtl"] {
  font-family: var(--ln-font-arabic);
}

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

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

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

/* ====================================================================
 * TYPOGRAPHY scale (semantic h1-h6)
 * ==================================================================== */
h1 {
  font-size: var(--ln-text-4xl);
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.015em;
}
h2 {
  font-size: var(--ln-text-3xl);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.01em;
}
h3 {
  font-size: var(--ln-text-2xl);
  font-weight: 700;
  line-height: 1.25;
}
h4 {
  font-size: var(--ln-text-xl);
  font-weight: 600;
  line-height: 1.3;
}
h5 {
  font-size: var(--ln-text-lg);
  font-weight: 600;
  line-height: 1.35;
}
h6 {
  font-size: var(--ln-text-sm);
  font-weight: 600;
  line-height: 1.4;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ln-text-secondary);
}

/* ====================================================================
 * Touch target minimum — WCAG 2.5.8 (44×44 CSS px)
 * ==================================================================== */
button,
[role="button"],
a.btn,
.btn,
input[type="button"],
input[type="submit"],
input[type="reset"] {
  min-height: 44px;
  min-width: 44px;
}

/* Allow opt-out via .ln-btn-tight for compact buttons in dense UIs */
.ln-btn-tight {
  min-height: 36px;
  min-width: 36px;
}

/* ====================================================================
 * Focus visible — keyboard navigation
 * ==================================================================== */
:focus-visible {
  outline: 2px solid var(--ln-accent);
  outline-offset: 2px;
  border-radius: var(--ln-radius-sm);
}

/* ====================================================================
 * Skip link — accessibility (keyboard + screen reader)
 * ==================================================================== */
.ln-skip-link {
  position: absolute;
  inset-inline-start: 0;
  top: -100px;
  z-index: 9999;
  padding: var(--ln-space-3) var(--ln-space-4);
  background: var(--ln-accent);
  color: var(--ln-accent-text);
  font-weight: 700;
  border-radius: 0 0 var(--ln-radius-md) 0;
  transition: top var(--ln-transition-default);
}
.ln-skip-link:focus {
  top: 0;
}

/* ====================================================================
 * Scrollbar — themed thin (no Webkit/Gecko hack rabbit-hole)
 * ==================================================================== */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--ln-color-midnight-500) transparent;
}
*::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
*::-webkit-scrollbar-thumb {
  background: var(--ln-color-midnight-500);
  border-radius: var(--ln-radius-full);
}
*::-webkit-scrollbar-track {
  background: transparent;
}

/* ====================================================================
 * Selection (text highlight)
 * ==================================================================== */
::selection {
  background: var(--ln-accent);
  color: var(--ln-accent-text);
}

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