/**
 * Base Styles - Complete Design System
 */

/* Skip link (a11y) */
.skip-link {
  position: absolute;
  top: -100%;
  left: 0;
  z-index: 9999;
  padding: 0.75rem 1.25rem;
  background: var(--teal-600);
  color: #fff;
  font-weight: var(--font-weight-semibold);
  font-size: var(--text-sm);
  text-decoration: none;
  border-radius: 0 0 var(--border-radius-md) 0;
}
.skip-link:focus {
  top: 0;
}

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

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  overflow-x: clip; /* clip (not hidden) keeps position: sticky working */
}

body {
  position: relative;
  font-family: var(--font-ui);
  font-size: var(--text-base);
  font-weight: var(--font-weight-normal);
  line-height: var(--leading-body);
  color: var(--text-secondary);
  background: var(--bg-page);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: clip;
  -webkit-tap-highlight-color: transparent;
}

/* Long tokens (transliterations, URLs) must never push the page wide */
p, li, h1, h2, h3, h4, h5, h6, figcaption {
  overflow-wrap: anywhere;
}

/* iOS zooms the viewport on any focused input below 16px */
@media (pointer: coarse) {
  input, textarea, select {
    font-size: max(1rem, 1em);
  }
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background:
    radial-gradient(circle at 30% 20%, rgba(42, 95, 92, 0.03) 0%, transparent 50%),
    radial-gradient(circle at 70% 80%, rgba(107, 181, 173, 0.12) 0%, transparent 50%);
  pointer-events: none;
  z-index: 0;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) body::before {
    background:
      radial-gradient(circle at 30% 20%, rgba(107, 181, 173, 0.03) 0%, transparent 50%),
      radial-gradient(circle at 70% 80%, rgba(107, 181, 173, 0.05) 0%, transparent 50%);
  }
}

[data-theme="dark"] body::before {
  background:
    radial-gradient(circle at 30% 20%, rgba(107, 181, 173, 0.03) 0%, transparent 50%),
    radial-gradient(circle at 70% 80%, rgba(107, 181, 173, 0.05) 0%, transparent 50%);
}

h1, h2, h3, h4, h5, h6 {
  font-weight: var(--font-weight-bold);
  line-height: var(--leading-heading);
  letter-spacing: var(--tracking-heading);
  color: var(--text-primary);
  margin: 0;
}

h1 { font-size: var(--text-h1); }
h2 { font-size: var(--text-h2); }
h3 { font-size: var(--text-h3); }
h4 { font-size: var(--text-h4); }
h5 { font-size: var(--text-h5); }
h6 { font-size: var(--text-h6); }

p {
  margin: 0;
  line-height: var(--leading-body);
}

.text-arabic,
.arabic,
.arabic-small,
.arabic-medium,
.arabic-large,
.arabic-huge {
  font-family: var(--font-arabic);
  line-height: var(--leading-arabic);
  font-weight: var(--font-weight-bold);
}

.arabic-small { font-size: var(--text-arabic-base); }
.arabic-medium { font-size: var(--text-arabic-medium); }
.arabic-large { font-size: var(--text-arabic-large); }
.arabic-huge { font-size: var(--text-arabic-display); }

a {
  color: var(--teal-600);
  text-decoration: none;
  transition: color var(--duration-fast) var(--ease-in-out);
}

a:hover {
  color: var(--teal-700);
}

ul, ol {
  list-style: none;
}

button {
  font-family: inherit;
  font-size: inherit;
  border: none;
  background: none;
  color: inherit;
}

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

:focus-visible {
  outline: 2px solid var(--teal-600);
  outline-offset: 2px;
}

.hidden {
  display: none !important;
}

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

/* Utilities */
.text-center { text-align: center; }
.text-muted { color: var(--text-quaternary); }
.text-accent { color: var(--teal-600); }
.text-gold { color: var(--gold-400); }
.text-xs { font-size: var(--text-xs); }
.text-sm { font-size: var(--text-sm); }
.text-base { font-size: var(--text-base); }
.text-lg { font-size: var(--text-lg); }
.text-xl { font-size: var(--text-xl); }

.mb-xs { margin-bottom: var(--space-2); }
.mb-sm { margin-bottom: var(--space-4); }
.mb-md { margin-bottom: var(--space-6); }
.mb-lg { margin-bottom: var(--space-8); }
.mb-xl { margin-bottom: var(--space-12); }

.mt-xs { margin-top: var(--space-2); }
.mt-sm { margin-top: var(--space-4); }
.mt-md { margin-top: var(--space-6); }
.mt-lg { margin-top: var(--space-8); }
.mt-xl { margin-top: var(--space-12); }

/* Layout Containers */
.container {
  width: min(100% - (var(--space-6) * 2), var(--container-wide));
  margin-inline: auto;
}

.container-wide {
  width: min(100% - (var(--space-6) * 2), var(--container-wide));
  margin-inline: auto;
}

.container-narrow {
  width: min(100% - (var(--space-6) * 2), var(--container-text));
  margin-inline: auto;
}

.main {
  position: relative;
  z-index: 1;
}
