/**
 * CityGaerGame Base Stylesheet
 * Medieval-inspired, immersive design for tabletop gaming enthusiasts
 * Family-friendly, strategic, and community-focused aesthetic
 */

/* ============================================
   CSS VARIABLES
   ============================================ */
:root {
  /* Color Palette - Medieval & Immersive Theme */
  --color-parchment: #f4ede4;
  --color-aged-paper: #e8dcc8;
  --color-stone: #4d3f26;
  --color-dark-wood: #74593b;
  --color-rich-brown: #5a4230;
  --color-warm-brown: #8b6f47;
  --color-gold: #d4a853;
  --color-light-gold: #e8c776;
  
  /* Semantic Colors */
  --color-background: var(--color-parchment);
  --color-surface: #ffffff;
  --color-surface-secondary: var(--color-aged-paper);
  --color-text: var(--color-stone);
  --color-text-muted: #5a5040;
  --color-text-light: #7a6f5f;
  
  --color-primary: #8b6f47;
  --color-primary-dark: #6d5436;
  --color-primary-light: #a58a62;
  --color-primary-pale: #d4c4a8;
  
  --color-accent: var(--color-gold);
  --color-accent-dark: #b89142;
  --color-accent-light: var(--color-light-gold);
  
  --color-success: #5a7a3d;
  --color-success-light: #d4e4c4;
  --color-warning: #c78d44;
  --color-warning-light: #f4dfc4;
  --color-danger: #a24636;
  --color-danger-light: #f4d4cc;
  
  /* Neutral Grays with Warm Undertone */
  --color-gray-50: #faf8f5;
  --color-gray-100: #f0ebe4;
  --color-gray-200: #e4ddd0;
  --color-gray-300: #ccc4b4;
  --color-gray-400: #a89d88;
  --color-gray-500: #8a7f6d;
  --color-gray-600: #6d6456;
  --color-gray-700: #524c40;
  --color-gray-800: #3a352c;
  --color-gray-900: #25211a;
  
  /* Border Colors */
  --color-border: var(--color-gray-300);
  --color-border-light: var(--color-gray-200);
  --color-border-dark: var(--color-gray-400);
  
  /* Typography */
  --font-family-base: 'Crimson Text', 'Georgia', 'Times New Roman', serif;
  --font-family-heading: 'Cinzel', 'Trajan Pro', 'Times New Roman', serif;
  --font-family-accent: 'Quattrocento', 'Georgia', serif;
  --font-family-ui: 'Lato', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', sans-serif;
  
  /* Font Sizes - Modular Scale (1.250 - Major Third) */
  --font-size-xs: 0.64rem;    /* 10.24px */
  --font-size-sm: 0.8rem;     /* 12.8px */
  --font-size-base: 1rem;     /* 16px */
  --font-size-md: 1.125rem;   /* 18px */
  --font-size-lg: 1.25rem;    /* 20px */
  --font-size-xl: 1.563rem;   /* 25px */
  --font-size-2xl: 1.953rem;  /* 31.25px */
  --font-size-3xl: 2.441rem;  /* 39px */
  --font-size-4xl: 3.052rem;  /* 48.8px */
  --font-size-5xl: 3.815rem;  /* 61px */
  
  /* Line Heights */
  --line-height-tight: 1.2;
  --line-height-snug: 1.375;
  --line-height-normal: 1.6;
  --line-height-relaxed: 1.75;
  --line-height-loose: 2;
  
  /* Font Weights */
  --font-weight-light: 300;
  --font-weight-normal: 400;
  --font-weight-medium: 500;
  --font-weight-semibold: 600;
  --font-weight-bold: 700;
  
  /* Spacing Scale */
  --space-0: 0;
  --space-1: 0.25rem;   /* 4px */
  --space-2: 0.5rem;    /* 8px */
  --space-3: 0.75rem;   /* 12px */
  --space-4: 1rem;      /* 16px */
  --space-5: 1.25rem;   /* 20px */
  --space-6: 1.5rem;    /* 24px */
  --space-8: 2rem;      /* 32px */
  --space-10: 2.5rem;   /* 40px */
  --space-12: 3rem;     /* 48px */
  --space-16: 4rem;     /* 64px */
  --space-20: 5rem;     /* 80px */
  --space-24: 6rem;     /* 96px */
  
  /* Border Radius */
  --radius-none: 0;
  --radius-sm: 0.125rem;  /* 2px */
  --radius-base: 0.25rem; /* 4px */
  --radius-md: 0.375rem;  /* 6px */
  --radius-lg: 0.5rem;    /* 8px */
  --radius-xl: 0.75rem;   /* 12px */
  --radius-2xl: 1rem;     /* 16px */
  --radius-full: 9999px;
  
  /* Shadows - Medieval & Parchment-inspired */
  --shadow-sm: 0 1px 2px 0 rgba(44, 36, 22, 0.08);
  --shadow-base: 0 2px 4px 0 rgba(44, 36, 22, 0.12), 0 1px 2px 0 rgba(44, 36, 22, 0.08);
  --shadow-md: 0 4px 6px -1px rgba(44, 36, 22, 0.15), 0 2px 4px -1px rgba(44, 36, 22, 0.08);
  --shadow-lg: 0 10px 15px -3px rgba(44, 36, 22, 0.15), 0 4px 6px -2px rgba(44, 36, 22, 0.08);
  --shadow-xl: 0 20px 25px -5px rgba(44, 36, 22, 0.15), 0 10px 10px -5px rgba(44, 36, 22, 0.08);
  --shadow-2xl: 0 25px 50px -12px rgba(44, 36, 22, 0.25);
  --shadow-inner: inset 0 2px 4px 0 rgba(44, 36, 22, 0.1);
  --shadow-emboss: inset 0 1px 0 0 rgba(255, 255, 255, 0.5), 0 1px 2px 0 rgba(44, 36, 22, 0.1);
  
  /* Transitions */
  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-base: 250ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 350ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slower: 500ms cubic-bezier(0.4, 0, 0.2, 1);
  
  /* Z-index Scale */
  --z-dropdown: 1000;
  --z-sticky: 1020;
  --z-fixed: 1030;
  --z-modal-backdrop: 1040;
  --z-modal: 1050;
  --z-popover: 1060;
  --z-tooltip: 1070;
  
  /* Container Widths */
  --container-sm: 640px;
  --container-md: 768px;
  --container-lg: 1024px;
  --container-xl: 1280px;
  --container-2xl: 1400px;
  
  /* Breakpoints (for reference in media queries) */
  --breakpoint-sm: 640px;
  --breakpoint-md: 768px;
  --breakpoint-lg: 1024px;
  --breakpoint-xl: 1280px;
  --breakpoint-2xl: 1536px;
}

/* ============================================
   RESET / NORMALIZE
   ============================================ */

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

/* Remove default margins and padding */
* {
  margin: 0;
  padding: 0;
}

/* HTML & Body */
html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }
}

html:focus-within {
  scroll-behavior: smooth;
}

/* Responsive images and media */
img,
picture,
video,
canvas,
svg {
  display: block;
  max-width: 100%;
  height: auto;
}

img {
  border-style: none;
}

/* Remove built-in form typography styles */
input,
button,
textarea,
select {
  font: inherit;
  color: inherit;
}

/* Remove button default styles */
button {
  background: none;
  border: none;
  cursor: pointer;
}

/* Remove list styles */
ol,
ul {
  list-style: none;
}

/* Inherit fonts for form controls */
input,
button,
textarea,
select,
optgroup {
  font-family: inherit;
  font-size: 100%;
  line-height: inherit;
  margin: 0;
}

/* Remove textarea resize handle in some browsers */
textarea {
  resize: vertical;
}

/* Tables */
table {
  border-collapse: collapse;
  border-spacing: 0;
}

/* Remove default button appearance */
button,
[type="button"],
[type="reset"],
[type="submit"] {
  -webkit-appearance: button;
  appearance: button;
}

/* Remove inner border and padding in Firefox */
button::-moz-focus-inner,
[type="button"]::-moz-focus-inner,
[type="reset"]::-moz-focus-inner,
[type="submit"]::-moz-focus-inner {
  border-style: none;
  padding: 0;
}

/* Restore focus styles */
button:-moz-focusring,
[type="button"]:-moz-focusring,
[type="reset"]:-moz-focusring,
[type="submit"]:-moz-focusring {
  outline: 1px dotted ButtonText;
}

/* Remove spinner in number inputs */
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
  height: auto;
}

/* Search input appearance */
[type="search"] {
  -webkit-appearance: textfield;
  appearance: textfield;
  outline-offset: -2px;
}

[type="search"]::-webkit-search-decoration {
  -webkit-appearance: none;
}

/* ============================================
   BASE STYLES
   ============================================ */

body {
  font-family: var(--font-family-base);
  font-size: var(--font-size-base);
  line-height: var(--line-height-normal);
  font-weight: var(--font-weight-normal);
  color: var(--color-text);
  background-color: var(--color-background);
  background-image: 
    radial-gradient(circle at 20% 50%, rgba(212, 168, 83, 0.03) 0%, transparent 50%),
    radial-gradient(circle at 80% 80%, rgba(139, 111, 71, 0.03) 0%, transparent 50%);
  min-height: 100vh;
  overflow-x: hidden;
}

/* Headings */
h1,
h2,
h3,
h4,
h5,
h6 {
  font-family: var(--font-family-heading);
  font-weight: var(--font-weight-bold);
  line-height: var(--line-height-tight);
  color: var(--color-dark-wood);
  margin-bottom: var(--space-4);
  letter-spacing: 0.02em;
  text-transform: capitalize;
}

h1 {
  font-size: var(--font-size-4xl);
  margin-bottom: var(--space-6);
  letter-spacing: 0.01em;
}

h2 {
  font-size: var(--font-size-3xl);
  margin-bottom: var(--space-5);
}

h3 {
  font-size: var(--font-size-2xl);
}

h4 {
  font-size: var(--font-size-xl);
}

h5 {
  font-size: var(--font-size-lg);
}

h6 {
  font-size: var(--font-size-base);
}

@media (max-width: 768px) {
  h1 {
    font-size: var(--font-size-3xl);
  }
  
  h2 {
    font-size: var(--font-size-2xl);
  }
  
  h3 {
    font-size: var(--font-size-xl);
  }
}

/* Paragraphs */
p {
  margin-bottom: var(--space-4);
  max-width: 70ch;
}

p:last-child {
  margin-bottom: 0;
}

/* Links */
a {
  color: var(--color-primary);
  text-decoration: none;
  transition: color var(--transition-base);
  position: relative;
}

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

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

/* Strong and emphasis */
strong,
b {
  font-weight: var(--font-weight-bold);
  color: var(--color-dark-wood);
}

em,
i {
  font-style: italic;
}

/* Small text */
small {
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
}

/* Blockquotes */
blockquote {
  margin: var(--space-6) 0;
  padding: var(--space-4) var(--space-6);
  border-left: 4px solid var(--color-accent);
  background: var(--color-surface-secondary);
  font-style: italic;
  color: var(--color-text-muted);
  border-radius: var(--radius-base);
}

blockquote p:last-child {
  margin-bottom: 0;
}

/* Code */
code,
pre {
  font-family: 'Courier New', Courier, monospace;
  font-size: var(--font-size-sm);
  background: var(--color-gray-100);
  border-radius: var(--radius-sm);
}

code {
  padding: var(--space-1) var(--space-2);
  color: var(--color-danger);
}

pre {
  padding: var(--space-4);
  overflow-x: auto;
  margin: var(--space-4) 0;
  border: 1px solid var(--color-border-light);
}

pre code {
  padding: 0;
  background: none;
  color: inherit;
}

/* Horizontal rule */
hr {
  margin: var(--space-8) 0;
  border: 0;
  height: 2px;
  background: linear-gradient(to right, transparent, var(--color-border), transparent);
  position: relative;
}

hr::after {
  content: '⚔';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: var(--color-background);
  padding: 0 var(--space-4);
  color: var(--color-accent);
  font-size: var(--font-size-lg);
}

/* Selection */
::selection {
  background: var(--color-accent-light);
  color: var(--color-dark-wood);
}

::-moz-selection {
  background: var(--color-accent-light);
  color: var(--color-dark-wood);
}

/* ============================================
   UTILITIES
   ============================================ */

/* Container */
.container {
  width: 100%;
  max-width: var(--container-xl);
  margin-left: auto;
  margin-right: auto;
  padding-left: var(--space-4);
  padding-right: var(--space-4);
}

@media (min-width: 640px) {
  .container {
    max-width: var(--container-sm);
    padding-left: var(--space-6);
    padding-right: var(--space-6);
  }
}

@media (min-width: 768px) {
  .container {
    max-width: var(--container-md);
  }
}

@media (min-width: 1024px) {
  .container {
    max-width: var(--container-lg);
    padding-left: var(--space-8);
    padding-right: var(--space-8);
  }
}

@media (min-width: 1280px) {
  .container {
    max-width: var(--container-xl);
  }
}

@media (min-width: 1536px) {
  .container {
    max-width: var(--container-2xl);
  }
}

/* Container variants */
.container-sm {
  max-width: var(--container-sm);
}

.container-md {
  max-width: var(--container-md);
}

.container-lg {
  max-width: var(--container-lg);
}

.container-fluid {
  max-width: 100%;
}

/* Flexbox utilities */
.flex {
  display: flex;
}

.inline-flex {
  display: inline-flex;
}

.flex-row {
  flex-direction: row;
}

.flex-col {
  flex-direction: column;
}

.flex-wrap {
  flex-wrap: wrap;
}

.flex-nowrap {
  flex-wrap: nowrap;
}

.items-start {
  align-items: flex-start;
}

.items-center {
  align-items: center;
}

.items-end {
  align-items: flex-end;
}

.items-stretch {
  align-items: stretch;
}

.justify-start {
  justify-content: flex-start;
}

.justify-center {
  justify-content: center;
}

.justify-end {
  justify-content: flex-end;
}

.justify-between {
  justify-content: space-between;
}

.justify-around {
  justify-content: space-around;
}

.flex-1 {
  flex: 1 1 0%;
}

.flex-auto {
  flex: 1 1 auto;
}

.flex-none {
  flex: none;
}

.gap-1 { gap: var(--space-1); }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }
.gap-5 { gap: var(--space-5); }
.gap-6 { gap: var(--space-6); }
.gap-8 { gap: var(--space-8); }

/* Grid utilities */
.grid {
  display: grid;
}

.grid-cols-1 { grid-template-columns: repeat(1, minmax(0, 1fr)); }
.grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-cols-6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.grid-cols-12 { grid-template-columns: repeat(12, minmax(0, 1fr)); }

@media (min-width: 768px) {
  .md\:grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .md\:grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .md\:grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

@media (min-width: 1024px) {
  .lg\:grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .lg\:grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .lg\:grid-cols-6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }
}

/* Text alignment */
.text-left { text-align: left; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-justify { text-align: justify; }

/* Text utilities */
.text-uppercase { text-transform: uppercase; }
.text-lowercase { text-transform: lowercase; }
.text-capitalize { text-transform: capitalize; }

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

.italic { font-style: italic; }

/* Display utilities */
.block { display: block; }
.inline-block { display: inline-block; }
.inline { display: inline; }
.hidden { display: none; }

/* Visibility */
.visible { visibility: visible; }
.invisible { visibility: hidden; }

/* Position utilities */
.relative { position: relative; }
.absolute { position: absolute; }
.fixed { position: fixed; }
.sticky { position: sticky; }

/* Overflow */
.overflow-auto { overflow: auto; }
.overflow-hidden { overflow: hidden; }
.overflow-visible { overflow: visible; }
.overflow-scroll { overflow: scroll; }

/* Width utilities */
.w-full { width: 100%; }
.w-auto { width: auto; }
.w-fit { width: fit-content; }

/* Screen reader only */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

.sr-only-focusable:active,
.sr-only-focusable:focus {
  position: static;
  width: auto;
  height: auto;
  overflow: visible;
  clip: auto;
  white-space: normal;
}

/* Spacing utilities */
.m-0 { margin: 0; }
.m-auto { margin: auto; }
.mx-auto { margin-left: auto; margin-right: auto; }
.my-auto { margin-top: auto; margin-bottom: auto; }

.mt-0 { margin-top: 0; }
.mt-1 { margin-top: var(--space-1); }
.mt-2 { margin-top: var(--space-2); }
.mt-3 { margin-top: var(--space-3); }
.mt-4 { margin-top: var(--space-4); }
.mt-6 { margin-top: var(--space-6); }
.mt-8 { margin-top: var(--space-8); }

.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: var(--space-1); }
.mb-2 { margin-bottom: var(--space-2); }
.mb-3 { margin-bottom: var(--space-3); }
.mb-4 { margin-bottom: var(--space-4); }
.mb-6 { margin-bottom: var(--space-6); }
.mb-8 { margin-bottom: var(--space-8); }

.p-0 { padding: 0; }
.p-2 { padding: var(--space-2); }
.p-4 { padding: var(--space-4); }
.p-6 { padding: var(--space-6); }
.p-8 { padding: var(--space-8); }

/* Shadow utilities */
.shadow-sm { box-shadow: var(--shadow-sm); }
.shadow { box-shadow: var(--shadow-base); }
.shadow-md { box-shadow: var(--shadow-md); }
.shadow-lg { box-shadow: var(--shadow-lg); }
.shadow-xl { box-shadow: var(--shadow-xl); }
.shadow-none { box-shadow: none; }

/* Border radius */
.rounded-none { border-radius: var(--radius-none); }
.rounded-sm { border-radius: var(--radius-sm); }
.rounded { border-radius: var(--radius-base); }
.rounded-md { border-radius: var(--radius-md); }
.rounded-lg { border-radius: var(--radius-lg); }
.rounded-xl { border-radius: var(--radius-xl); }
.rounded-full { border-radius: var(--radius-full); }

/* ============================================
   COMPONENTS
   ============================================ */

/* Button */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  font-family: var(--font-family-ui);
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-medium);
  line-height: var(--line-height-snug);
  text-align: center;
  text-decoration: none;
  white-space: nowrap;
  vertical-align: middle;
  cursor: pointer;
  user-select: none;
  border: 2px solid transparent;
  padding: var(--space-3) var(--space-6);
  border-radius: var(--radius-md);
  transition: all var(--transition-base);
  position: relative;
  overflow: hidden;
  background: var(--color-primary);
  color: var(--color-parchment);
  box-shadow: var(--shadow-base);
}

.btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
  transition: left var(--transition-slow);
}

.btn:hover {
  background: var(--color-primary-dark);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.btn:hover::before {
  left: 100%;
}

.btn:active {
  transform: translateY(0);
  box-shadow: var(--shadow-sm);
}

.btn:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

.btn:disabled,
.btn.disabled {
  opacity: 0.6;
  cursor: not-allowed;
  pointer-events: none;
  box-shadow: none;
  transform: none;
}

/* Button variants */
.btn-primary {
  background: var(--color-primary);
  color: var(--color-parchment);
}

.btn-primary:hover {
  background: var(--color-primary-dark);
}

.btn-accent {
  background: var(--color-accent);
  color: var(--color-dark-wood);
}

.btn-accent:hover {
  background: var(--color-accent-dark);
}

.btn-secondary {
  background: var(--color-surface);
  color: var(--color-text);
  border-color: var(--color-border);
  box-shadow: var(--shadow-sm);
}

.btn-secondary:hover {
  background: var(--color-gray-100);
  border-color: var(--color-border-dark);
}

.btn-outline {
  background: transparent;
  color: var(--color-primary);
  border-color: var(--color-primary);
  box-shadow: none;
}

.btn-outline:hover {
  background: var(--color-primary);
  color: var(--color-parchment);
  border-color: var(--color-primary);
}

.btn-ghost {
  background: transparent;
  color: var(--color-primary);
  box-shadow: none;
}

.btn-ghost:hover {
  background: var(--color-gray-100);
}

/* Button sizes */
.btn-sm {
  padding: var(--space-2) var(--space-4);
  font-size: var(--font-size-sm);
}

.btn-lg {
  padding: var(--space-4) var(--space-8);
  font-size: var(--font-size-lg);
}

.btn-block {
  display: flex;
  width: 100%;
}

/* Input */
.input {
  display: block;
  width: 100%;
  font-family: var(--font-family-ui);
  font-size: var(--font-size-base);
  line-height: var(--line-height-normal);
  color: var(--color-text);
  background-color: var(--color-surface);
  background-clip: padding-box;
  border: 2px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4);
  transition: border-color var(--transition-base), box-shadow var(--transition-base);
  box-shadow: var(--shadow-inner);
}

.input::placeholder {
  color: var(--color-text-light);
  opacity: 0.7;
}

.input:hover {
  border-color: var(--color-border-dark);
}

.input:focus {
  outline: 0;
  border-color: var(--color-primary);
  box-shadow: var(--shadow-inner), 0 0 0 3px var(--color-primary-pale);
}

.input:disabled,
.input[readonly] {
  background-color: var(--color-gray-100);
  opacity: 0.7;
  cursor: not-allowed;
}

.input.is-invalid,
.input:invalid {
  border-color: var(--color-danger);
}

.input.is-invalid:focus {
  box-shadow: var(--shadow-inner), 0 0 0 3px var(--color-danger-light);
}

/* Textarea */
textarea.input {
  min-height: 120px;
  resize: vertical;
}

/* Select */
select.input {
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%235a4230' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right var(--space-3) center;
  background-size: 12px;
  padding-right: var(--space-8);
}

/* Checkbox and Radio */
.checkbox,
.radio {
  appearance: none;
  width: 1.25rem;
  height: 1.25rem;
  border: 2px solid var(--color-border);
  background-color: var(--color-surface);
  cursor: pointer;
  transition: all var(--transition-base);
  position: relative;
  flex-shrink: 0;
}

.checkbox {
  border-radius: var(--radius-sm);
}

.radio {
  border-radius: var(--radius-full);
}

.checkbox:hover,
.radio:hover {
  border-color: var(--color-primary);
}

.checkbox:checked,
.radio:checked {
  background-color: var(--color-primary);
  border-color: var(--color-primary);
}

.checkbox:checked::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 5px;
  width: 4px;
  height: 8px;
  border: solid var(--color-surface);
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.radio:checked::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 8px;
  height: 8px;
  border-radius: var(--radius-full);
  background-color: var(--color-surface);
}

.checkbox:focus-visible,
.radio:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

/* Label */
.label {
  display: inline-block;
  font-family: var(--font-family-ui);
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-medium);
  color: var(--color-text);
  margin-bottom: var(--space-2);
}

.label-required::after {
  content: ' *';
  color: var(--color-danger);
}

/* Form group */
.form-group {
  margin-bottom: var(--space-5);
}

.form-group:last-child {
  margin-bottom: 0;
}

/* Card */
.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  box-shadow: var(--shadow-base);
  transition: box-shadow var(--transition-base), transform var(--transition-base);
  position: relative;
  overflow: hidden;
}

.card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--color-accent), var(--color-primary));
  opacity: 0;
  transition: opacity var(--transition-base);
}

.card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
}

.card:hover::before {
  opacity: 1;
}

.card-header {
  margin-bottom: var(--space-4);
  padding-bottom: var(--space-4);
  border-bottom: 1px solid var(--color-border-light);
}

.card-title {
  font-family: var(--font-family-heading);
  font-size: var(--font-size-xl);
  font-weight: var(--font-weight-bold);
  color: var(--color-dark-wood);
  margin-bottom: 0;
}

.card-body {
  color: var(--color-text);
}

.card-footer {
  margin-top: var(--space-4);
  padding-top: var(--space-4);
  border-top: 1px solid var(--color-border-light);
}

/* Card variants */
.card-elevated {
  box-shadow: var(--shadow-lg);
}

.card-bordered {
  border: 2px solid var(--color-border);
}

.card-accent {
  border-color: var(--color-accent);
}

/* Badge */
.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-family-ui);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-semibold);
  line-height: 1;
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-full);
  background: var(--color-primary);
  color: var(--color-surface);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.badge-primary {
  background: var(--color-primary);
  color: var(--color-surface);
}

.badge-accent {
  background: var(--color-accent);
  color: var(--color-dark-wood);
}

.badge-success {
  background: var(--color-success);
  color: var(--color-surface);
}

.badge-warning {
  background: var(--color-warning);
  color: var(--color-dark-wood);
}

.badge-danger {
  background: var(--color-danger);
  color: var(--color-surface);
}

/* Alert */
.alert {
  padding: var(--space-4) var(--space-5);
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  margin-bottom: var(--space-4);
  font-family: var(--font-family-ui);
  position: relative;
}

.alert-success {
  background-color: var(--color-success-light);
  border-color: var(--color-success);
  color: var(--color-success);
}

.alert-warning {
  background-color: var(--color-warning-light);
  border-color: var(--color-warning);
  color: var(--color-dark-wood);
}

.alert-danger {
  background-color: var(--color-danger-light);
  border-color: var(--color-danger);
  color: var(--color-danger);
}

.alert-info {
  background-color: var(--color-primary-pale);
  border-color: var(--color-primary);
  color: var(--color-primary-dark);
}

/* Divider */
.divider {
  height: 1px;
  background: var(--color-border);
  margin: var(--space-6) 0;
  border: 0;
}

.divider-vertical {
  width: 1px;
  height: auto;
  background: var(--color-border);
  margin: 0 var(--space-4);
}

/* Link with underline animation */
.link-animated {
  position: relative;
  display: inline-block;
}

.link-animated::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 100%;
  height: 2px;
  background: var(--color-accent);
  transform: scaleX(0);
  transform-origin: right;
  transition: transform var(--transition-base);
}

.link-animated:hover::after {
  transform: scaleX(1);
  transform-origin: left;
}

/* ============================================
   ACCESSIBILITY
   ============================================ */

/* Focus styles */
:focus {
  outline: 2px solid transparent;
  outline-offset: 2px;
}

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

/* Skip to content link */
.skip-to-content {
  position: absolute;
  top: -100px;
  left: 0;
  background: var(--color-dark-wood);
  color: var(--color-parchment);
  padding: var(--space-3) var(--space-4);
  text-decoration: none;
  border-radius: var(--radius-base);
  z-index: 9999;
  transition: top var(--transition-base);
}

.skip-to-content:focus {
  top: var(--space-4);
  left: var(--space-4);
}

/* Reduce motion for users who prefer it */
@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;
  }
}

/* High contrast mode adjustments */
@media (prefers-contrast: high) {
  .btn {
    border-width: 2px;
  }
  
  .card {
    border-width: 2px;
  }
  
  .input {
    border-width: 2px;
  }
}

/* Dark mode support (respecting user preference) */
@media (prefers-color-scheme: dark) {
  :root {
    --color-background: #1a1510;
    --color-surface: #25211a;
    --color-surface-secondary: #2c2416;
    --color-text: #e8dcc8;
    --color-text-muted: #a89d88;
    --color-text-light: #8a7f6d;
    --color-border: #3d2f1f;
    --color-border-light: #2c2416;
    --color-border-dark: #5a4230;
  }
  
  .card {
    background: var(--color-surface);
  }
  
  .input {
    background-color: var(--color-surface);
  }
}

/* Print styles */
@media print {
  *,
  *::before,
  *::after {
    background: transparent !important;
    color: #000 !important;
    box-shadow: none !important;
    text-shadow: none !important;
  }
  
  a,
  a:visited {
    text-decoration: underline;
  }
  
  a[href]::after {
    content: " (" attr(href) ")";
  }
  
  abbr[title]::after {
    content: " (" attr(title) ")";
  }
  
  pre {
    white-space: pre-wrap !important;
  }
  
  pre,
  blockquote {
    border: 1px solid #999;
    page-break-inside: avoid;
  }
  
  thead {
    display: table-header-group;
  }
  
  tr,
  img {
    page-break-inside: avoid;
  }
  
  p,
  h2,
  h3 {
    orphans: 3;
    widows: 3;
  }
  
  h2,
  h3 {
    page-break-after: avoid;
  }
  
  .btn,
  .badge {
    border: 1px solid #000;
  }
}
