/* ============================================
   EventCos Design System - Base Styles
   Version: 1.0.0
   Last Updated: 2025-01-06

   Global HTML element styles using design tokens
   ============================================ */

/* ==========================================
   HTML & Body Base
   ========================================== */
html {
  font-size: 16px; /* Base font size - 1rem = 16px */
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

body {
  font-family: var(--font-primary) !important;
  font-size: var(--text-base);
  font-weight: var(--font-regular);
  line-height: var(--leading-normal);
  color: var(--text-primary);
  background-color: var(--bg-primary);
  margin: 0;
  padding: 0;
  transition: background-color var(--transition-base), color var(--transition-base);
}

/* ==========================================
   Typography - Headings
   ========================================== */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-primary) !important;
  font-weight: var(--font-bold);
  line-height: var(--leading-tight);
  margin-top: 0;
  margin-bottom: var(--space-4);
  color: var(--text-primary);
}

h1 {
  font-size: var(--text-4xl);
  font-weight: var(--font-extrabold);
  letter-spacing: var(--tracking-tight);
}

h2 {
  font-size: var(--text-3xl);
  font-weight: var(--font-bold);
  letter-spacing: var(--tracking-tight);
}

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

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

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

h6 {
  font-size: var(--text-base);
  font-weight: var(--font-medium);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
}

/* ==========================================
   Typography - Paragraphs & Text
   ========================================== */
p {
  font-family: var(--font-primary) !important;
  font-size: var(--text-base);
  line-height: var(--leading-relaxed);
  margin-top: 0;
  margin-bottom: var(--space-4);
  color: var(--text-primary);
}

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

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

em, i {
  font-style: italic;
}

code {
  font-family: var(--font-mono);
  font-size: 0.875em;
  padding: var(--space-1) var(--space-2);
  background-color: var(--bg-tertiary);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
}

pre {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  padding: var(--space-4);
  background-color: var(--bg-tertiary);
  border-radius: var(--radius-md);
  overflow-x: auto;
  margin-bottom: var(--space-4);
}

pre code {
  padding: 0;
  background-color: transparent;
}

/* ==========================================
   Links
   ========================================== */
a {
  font-family: var(--font-primary) !important;
  color: var(--text-link);
  text-decoration: none;
  transition: color var(--transition-fast), text-decoration var(--transition-fast);
  cursor: pointer;
}

a:hover {
  color: var(--text-link-hover);
  text-decoration: underline;
}

a:visited {
  color: var(--text-link-visited);
}

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

a:active {
  color: var(--text-link-hover);
}

/* Remove underline for links inside buttons */
button a,
.btn a {
  text-decoration: none !important;
}

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

li {
  margin-bottom: var(--space-2);
  line-height: var(--leading-relaxed);
}

ul ul, ol ul, ul ol, ol ol {
  margin-bottom: 0;
}

/* ==========================================
   Horizontal Rule
   ========================================== */
hr {
  border: 0;
  border-top: 1px solid var(--border-primary);
  margin: var(--space-8) 0;
}

/* ==========================================
   Blockquote
   ========================================== */
blockquote {
  margin: 0 0 var(--space-4);
  padding: var(--space-4) var(--space-6);
  border-left: 4px solid var(--border-focus);
  background-color: var(--bg-secondary);
  color: var(--text-secondary);
  font-style: italic;
}

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

/* ==========================================
   Tables
   ========================================== */
table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: var(--space-4);
}

thead {
  background-color: var(--bg-secondary);
  border-bottom: 2px solid var(--border-secondary);
}

th {
  font-weight: var(--font-semibold);
  text-align: left;
  padding: var(--space-3) var(--space-4);
  color: var(--text-primary);
}

td {
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--border-primary);
}

tbody tr:hover {
  background-color: var(--state-hover);
}

/* ==========================================
   Forms - Global Base
   ========================================== */
label {
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  color: var(--text-primary);
  margin-bottom: var(--space-2);
  display: inline-block;
}

input,
textarea,
select {
  font-family: var(--font-primary) !important;
  font-size: var(--text-base);
  color: var(--text-primary);
}

/* ==========================================
   Images & Media
   ========================================== */
img {
  max-width: 100%;
  height: auto;
  display: block;
}

figure {
  margin: 0 0 var(--space-4);
}

figcaption {
  font-size: var(--text-sm);
  color: var(--text-muted);
  margin-top: var(--space-2);
  text-align: center;
}

/* ==========================================
   Focus States (Global)
   ========================================== */
*:focus-visible {
  outline: 2px solid var(--border-focus);
  outline-offset: 2px;
}

/* Remove default focus outline (we use custom one above) */
*:focus {
  outline: none;
}

/* ==========================================
   Selection
   ========================================== */
::selection {
  background-color: var(--state-focus);
  color: var(--text-primary);
}

::-moz-selection {
  background-color: var(--state-focus);
  color: var(--text-primary);
}

/* ==========================================
   Scrollbar Styling (Webkit browsers)
   ========================================== */
::-webkit-scrollbar {
  width: 12px;
  height: 12px;
}

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

::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: var(--radius-full);
  border: 2px solid var(--bg-secondary);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* ==========================================
   Utility Classes
   ========================================== */

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

/* Skip to Main Content Link */
.skip-to-main {
  position: absolute;
  top: -40px;
  left: 0;
  background: var(--brand-primary-500);
  color: var(--text-inverse);
  padding: var(--space-2) var(--space-4);
  text-decoration: none;
  z-index: var(--z-tooltip);
  transition: top var(--transition-fast);
}

.skip-to-main:focus {
  top: 0;
}

/* Text Utilities */
.text-muted {
  color: var(--text-muted) !important;
}

.text-secondary {
  color: var(--text-secondary) !important;
}

/* ==========================================
   Print Styles
   ========================================== */
@media print {
  body {
    background: white;
    color: black;
  }

  a {
    text-decoration: underline;
  }

  a[href]:after {
    content: " (" attr(href) ")";
  }

  /* Hide navigation and UI elements when printing */
  nav, .sidebar, .navbar, .modal, .btn, button {
    display: none !important;
  }
}
