/* =====================================================
   GMG Theme System - Main Entry Point
   Import this file to get the complete theme system
   ===================================================== */

/* Design Tokens & CSS Variables */
@import url('./variables.css');

/* Layout & Grid System */
@import url('./layout.css');

/* Component Library */
@import url('./components.css');

/* Animations & Transitions */
@import url('./animations.css');

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

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: var(--leading-normal);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  scroll-behavior: smooth;
}

body {
  background-color: var(--color-bg);
  color: var(--color-text);
  min-height: 100vh;
  transition: background-color var(--transition-slow), color var(--transition-slow);
}

/* =====================================================
   TYPOGRAPHY BASE
   ===================================================== */

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: var(--font-semibold);
  line-height: var(--leading-tight);
  color: var(--color-text);
}

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

p {
  margin-bottom: var(--space-4);
  line-height: var(--leading-relaxed);
}

a {
  color: var(--color-primary);
  text-decoration: none;
  transition: var(--transition-colors);
}

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

strong, b {
  font-weight: var(--font-semibold);
}

small {
  font-size: var(--text-sm);
}

code {
  font-family: var(--font-mono);
  font-size: 0.9em;
  padding: var(--space-1) var(--space-2);
  background: var(--color-surface-hover);
  border-radius: var(--radius-sm);
}

pre {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  padding: var(--space-4);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  overflow-x: auto;
}

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

blockquote {
  padding-left: var(--space-4);
  border-left: 3px solid var(--color-primary);
  color: var(--color-text-muted);
  font-style: italic;
}

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

/* Lists */
ul, ol {
  padding-left: var(--space-6);
  margin-bottom: var(--space-4);
}

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

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

input, textarea, select, button {
  font-family: inherit;
  font-size: inherit;
}

button {
  cursor: pointer;
  border: none;
  background: none;
}

/* Remove default focus styles (we add our own) */
:focus {
  outline: none;
}

/* Visible focus for keyboard navigation */
:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

/* =====================================================
   IMAGE & MEDIA
   ===================================================== */

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

/* =====================================================
   SELECTION
   ===================================================== */

::selection {
  background: var(--color-primary-muted);
  color: var(--color-text);
}

/* =====================================================
   SCROLLBAR STYLING
   ===================================================== */

::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--color-bg-alt);
}

::-webkit-scrollbar-thumb {
  background: var(--color-border);
  border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--color-border-hover);
}

/* Firefox */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--color-border) var(--color-bg-alt);
}

/* =====================================================
   PRINT STYLES
   ===================================================== */

@media print {
  body {
    background: white;
    color: black;
  }
  
  .no-print {
    display: none !important;
  }
}

/* =====================================================
   THEME TOGGLE BUTTON STYLES
   ===================================================== */

.theme-toggle-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-2);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  color: var(--color-text);
  cursor: pointer;
  transition: var(--transition-all);
  min-width: 40px;
  height: 40px;
}

.theme-toggle-btn:hover {
  background: var(--color-surface-hover);
  border-color: var(--color-border-hover);
}

.theme-toggle-btn:active {
  transform: scale(0.95);
}

.theme-toggle-icon {
  font-size: var(--text-lg);
  line-height: 1;
}

.theme-toggle-label {
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
}

/* Compact toggle for navbar */
.theme-toggle-compact {
  width: 36px;
  height: 36px;
  padding: var(--space-2);
  border-radius: var(--radius-full);
  background: transparent;
  border: none;
}

.theme-toggle-compact:hover {
  background: var(--color-surface-hover);
}

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

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

.not-sr-only {
  position: static;
  width: auto;
  height: auto;
  padding: 0;
  margin: 0;
  overflow: visible;
  clip: auto;
  white-space: normal;
}

/* Skip to main content link */
.skip-link {
  position: absolute;
  top: -40px;
  left: 0;
  background: var(--color-primary);
  color: white;
  padding: var(--space-2) var(--space-4);
  z-index: 100;
  transition: top var(--transition-fast);
}

.skip-link:focus {
  top: 0;
}

/* =====================================================
   UTILITY CLASSES
   ===================================================== */

.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.line-clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.line-clamp-3 {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.cursor-pointer { cursor: pointer; }
.cursor-default { cursor: default; }
.cursor-not-allowed { cursor: not-allowed; }

.select-none { user-select: none; }
.select-all { user-select: all; }
.select-text { user-select: text; }

.pointer-events-none { pointer-events: none; }
.pointer-events-auto { pointer-events: auto; }

.opacity-0 { opacity: 0; }
.opacity-50 { opacity: 0.5; }
.opacity-75 { opacity: 0.75; }
.opacity-100 { opacity: 1; }

.visible { visibility: visible; }
.invisible { visibility: hidden; }

/* =====================================================
   DEBUG HELPERS (remove in production)
   ===================================================== */

.debug * {
  outline: 1px solid rgba(255, 0, 0, 0.2);
}

.debug-grid {
  background-image: 
    linear-gradient(to right, rgba(0, 0, 255, 0.1) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(0, 0, 255, 0.1) 1px, transparent 1px);
  background-size: 8px 8px;
}
