/* TRIZEL — Base Styles (Phase H1-C)
 * Core HTML element styles for progressive enhancement
 * Works without JavaScript, enhanced with JS
 */

/* ═══════════════════════════════════════════════════════════════
   RESET & BASE HTML ELEMENTS
   ═══════════════════════════════════════════════════════════════ */

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

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-system);
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  color: var(--color-text);
  background-color: var(--color-bg);
  min-height: 100vh;
}

/* ═══════════════════════════════════════════════════════════════
   TYPOGRAPHY ELEMENTS
   ═══════════════════════════════════════════════════════════════ */

h1, h2, h3, h4, h5, h6 {
  font-weight: var(--font-bold);
  line-height: var(--leading-tight);
  margin-bottom: var(--space-4);
  color: var(--color-text);
}

h1 {
  font-size: var(--text-fluid-5xl);
  font-weight: var(--font-extrabold);
  letter-spacing: var(--tracking-tighter);
}

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

h3 {
  font-size: var(--text-fluid-3xl);
  letter-spacing: var(--tracking-tight);
}

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

h5 {
  font-size: var(--text-fluid-xl);
}

h6 {
  font-size: var(--text-fluid-lg);
}

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

a {
  color: var(--color-accent);
  text-decoration: none;
  transition: color var(--transition-base);
}

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

a:focus-visible {
  outline: var(--focus-ring-width) solid var(--focus-ring-color);
  outline-offset: var(--focus-ring-offset-width);
  border-radius: var(--radius-sm);
}

/* ═══════════════════════════════════════════════════════════════
   LISTS
   ═══════════════════════════════════════════════════════════════ */

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

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

/* ═══════════════════════════════════════════════════════════════
   CODE & PRE
   ═══════════════════════════════════════════════════════════════ */

code {
  font-family: var(--font-mono);
  font-size: 0.9em;
  padding: 0.125rem 0.375rem;
  background: var(--color-surface-overlay);
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-sm);
}

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

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

/* ═══════════════════════════════════════════════════════════════
   ACCESSIBILITY
   ═══════════════════════════════════════════════════════════════ */

.skip-to-content {
  position: absolute;
  top: -999px;
  left: -999px;
  z-index: 9999;
  padding: var(--space-3) var(--space-4);
  background: var(--color-accent);
  color: var(--color-text-inverse);
  font-weight: var(--font-semibold);
  text-decoration: none;
  border-radius: var(--radius-md);
}

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

/* Screen reader only content */
.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;
}

/* ═══════════════════════════════════════════════════════════════
   LAYOUT UTILITIES
   ═══════════════════════════════════════════════════════════════ */

.container {
  width: 100%;
  max-width: var(--container-xl);
  margin-left: auto;
  margin-right: auto;
  padding-left: var(--space-fluid-md);
  padding-right: var(--space-fluid-md);
}

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

.container-wide {
  max-width: var(--container-2xl);
}

/* ═══════════════════════════════════════════════════════════════
   RESPONSIVE IMAGES
   ═══════════════════════════════════════════════════════════════ */

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

/* ═══════════════════════════════════════════════════════════════
   TABLES — RESPONSIVE HANDLING
   ═══════════════════════════════════════════════════════════════ */

table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: var(--space-6);
}

/* Wrapper for responsive tables */
.table-wrapper {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin-bottom: var(--space-6);
}

th, td {
  padding: var(--space-3) var(--space-4);
  text-align: left;
  border-bottom: 1px solid var(--color-border);
}

th {
  font-weight: var(--font-semibold);
  background: var(--color-surface-overlay);
}

/* ═══════════════════════════════════════════════════════════════
   REDUCED MOTION — ACCESSIBILITY
   ═══════════════════════════════════════════════════════════════ */

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

/* ═══════════════════════════════════════════════════════════════
   PRINT STYLES
   ═══════════════════════════════════════════════════════════════ */

@media print {
  body {
    font-size: 12pt;
    line-height: 1.5;
    color: #000;
    background: #fff;
  }

  a {
    color: #000;
    text-decoration: underline;
  }

  a[href^="http"]::after {
    content: " (" attr(href) ")";
    font-size: 0.8em;
  }

  .skip-to-content,
  nav,
  .site-nav,
  .site-footer,
  .btn {
    display: none;
  }

  .container {
    max-width: none;
    padding: 0;
  }

  h1, h2, h3, h4, h5, h6 {
    page-break-after: avoid;
  }

  p, ul, ol, table {
    page-break-inside: avoid;
  }
}
