/* ==========================================================================
   Mamoswine Design System - Base Styles & Design Tokens
   Light Theme Only, Modern CSS, Fluid Typography & Spacing Grid
   ========================================================================== */

:root {
  /* Color Palette - WCAG 2.2 AA Compliant (4.5:1 on background and surface) */
  --color-bg: #F6FBFD;
  --color-surface: #FFFFFF;
  --color-ink: #12222E;
  --color-muted: #4A5B68;
  --color-primary: #0B6E99;
  --color-primary-hover: #09577A;
  --color-primary-focus: rgba(11, 110, 153, 0.25);
  --color-ice-tint: #E3F4FB;
  --color-accent: #8A5322;
  --color-accent-hover: #6E3F18;
  --color-accent-tint: #F6EBDD;
  --color-border: #D6E6EE;
  --color-border-subtle: #E8F2F7;
  --color-success: #1E7B4E;
  --color-success-bg: #EAF7EE;
  --color-warning: #8A5A00;
  --color-warning-bg: #FDF7EA;
  --color-danger: #B3261E;
  --color-danger-bg: #FCECEB;

  /* 18 Official Pokémon Type Colors */
  --type-normal: #9FA19F;
  --type-fire: #E62829;
  --type-water: #2980EF;
  --type-grass: #3FA129;
  --type-electric: #D4A000;
  --type-ice: #2BBADF;
  --type-fighting: #D05E00;
  --type-poison: #8E35CE;
  --type-ground: #8A5322;
  --type-flying: #5D9BE5;
  --type-psychic: #DE2E6A;
  --type-bug: #7A8E0E;
  --type-rock: #8E855A;
  --type-ghost: #603770;
  --type-dragon: #4454CC;
  --type-steel: #50889B;
  --type-dark: #453432;
  --type-fairy: #D64ED6;

  /* Typography */
  --font-system: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji";
  --font-mono: ui-monospace, "Cascadia Code", "Source Code Pro", Menlo, Consolas, monospace;

  /* Fluid Type Scale */
  --text-xs: clamp(0.75rem, 0.72rem + 0.15vw, 0.8125rem);
  --text-sm: clamp(0.84rem, 0.81rem + 0.18vw, 0.9375rem);
  --text-base: clamp(1rem, 0.96rem + 0.22vw, 1.125rem);
  --text-lg: clamp(1.15rem, 1.08rem + 0.35vw, 1.3125rem);
  --text-xl: clamp(1.35rem, 1.25rem + 0.55vw, 1.625rem);
  --text-2xl: clamp(1.65rem, 1.48rem + 0.85vw, 2.125rem);
  --text-3xl: clamp(2.1rem, 1.85rem + 1.25vw, 2.75rem);
  --text-4xl: clamp(2.6rem, 2.2rem + 2vw, 3.5rem);

  /* Spacing Grid (4px base) */
  --space-1: 0.25rem;   /* 4px */
  --space-2: 0.5rem;    /* 8px */
  --space-3: 0.75rem;   /* 12px */
  --space-4: 1rem;      /* 16px */
  --space-5: 1.5rem;    /* 24px */
  --space-6: 2rem;      /* 32px */
  --space-7: 3rem;      /* 48px */
  --space-8: 4rem;      /* 64px */
  --space-9: 6rem;      /* 96px */

  /* Radii */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 9999px;

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(18, 34, 46, 0.05);
  --shadow-md: 0 4px 14px rgba(18, 34, 46, 0.08);
  --shadow-lg: 0 10px 30px rgba(18, 34, 46, 0.12);

  /* Layout Widths */
  --container-max: 1240px;
  --container-narrow: 820px;
  --container-wide: 1360px;
  --header-height: 72px;

  /* Transitions */
  --transition-fast: 150ms ease;
  --transition-normal: 250ms ease;
}

/* CSS Reset & Box Sizing */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-family: var(--font-system);
  font-size: 16px;
  line-height: 1.65;
  background-color: var(--color-bg);
  color: var(--color-ink);
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  color-scheme: light;
}

@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;
  }
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background-color: var(--color-bg);
  color: var(--color-ink);
  font-size: var(--text-base);
  overflow-x: hidden;
}

/* Typography Defaults */
h1, h2, h3, h4, h5, h6 {
  color: var(--color-ink);
  font-weight: 700;
  line-height: 1.25;
  text-wrap: balance;
}

h1 { font-size: var(--text-3xl); margin-bottom: var(--space-4); }
h2 { font-size: var(--text-2xl); margin-bottom: var(--space-3); }
h3 { font-size: var(--text-xl); margin-bottom: var(--space-2); }
h4 { font-size: var(--text-lg); margin-bottom: var(--space-2); }

p {
  margin-bottom: var(--space-4);
  max-width: 72ch;
}

a {
  color: var(--color-primary);
  text-decoration: underline;
  text-underline-offset: 3px;
  transition: color var(--transition-fast), text-decoration-color var(--transition-fast);
}

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

a:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 3px;
  border-radius: var(--radius-sm);
}

strong {
  font-weight: 700;
}

em {
  font-style: italic;
}

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

ul, ol {
  margin-bottom: var(--space-4);
  padding-left: var(--space-5);
}

li {
  margin-bottom: var(--space-1);
}

/* Skip link for accessibility */
.skip-link {
  position: absolute;
  top: -100px;
  left: var(--space-4);
  background: var(--color-primary);
  color: #FFFFFF;
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-md);
  font-weight: 600;
  text-decoration: none;
  z-index: 99999;
  transition: top var(--transition-fast);
}

.skip-link:focus {
  top: var(--space-4);
}

/* Screen reader only utility */
.screen-reader-text,
.sr-only {
  border: 0;
  clip: rect(1px, 1px, 1px, 1px);
  clip-path: inset(50%);
  height: 1px;
  margin: -1px;
  overflow: hidden;
  padding: 0;
  position: absolute;
  width: 1px;
  word-wrap: normal !important;
}

.screen-reader-text:focus {
  background-color: var(--color-surface);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  clip: auto !important;
  clip-path: none;
  color: var(--color-primary);
  display: block;
  font-size: var(--text-sm);
  font-weight: 700;
  height: auto;
  left: 1rem;
  top: 1rem;
  padding: 0.75rem 1.25rem;
  text-decoration: none;
  width: auto;
  z-index: 100000;
}

/* External Link styling */
a[target="_blank"]::after {
  content: "";
  display: inline-block;
  width: 0.85em;
  height: 0.85em;
  margin-left: 0.25em;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%230B6E99' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6'%3E%3C/path%3E%3Cpolyline points='15 3 21 3 21 9'%3E%3C/polyline%3E%3Cline x1='10' y1='14' x2='21' y2='3'%3E%3C/line%3E%3C/svg%3E");
  background-size: contain;
  background-repeat: no-repeat;
  vertical-align: -0.08em;
}
