/* ==========================================================================
   Base Styles — Global Reset, Typography, Form Elements
   All values reference CSS custom properties from variables.css
   ========================================================================== */

/* --------------------------------------------------------------------------
   CSS Reset
   -------------------------------------------------------------------------- */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

img,
picture,
video,
svg {
  display: block;
  max-width: 100%;
}

/* --------------------------------------------------------------------------
   Body
   -------------------------------------------------------------------------- */
body {
  font-family: var(--font-sans);
  font-size: var(--text-base);
  font-weight: var(--font-weight-normal);
  line-height: var(--leading-normal);
  color: var(--color-foreground);
  background-color: var(--color-page-bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* --------------------------------------------------------------------------
   Typography — Headings
   -------------------------------------------------------------------------- */
h1,
h2,
h3,
h4 {
  font-weight: var(--font-weight-semibold);
  line-height: var(--leading-tight);
  color: var(--color-foreground);
}

h1 {
  font-size: var(--text-3xl);
  margin-bottom: var(--space-6);
}

h2 {
  font-size: var(--text-2xl);
  margin-bottom: var(--space-5);
}

h3 {
  font-size: var(--text-xl);
  margin-bottom: var(--space-4);
}

h4 {
  font-size: var(--text-lg);
  margin-bottom: var(--space-3);
}

/* --------------------------------------------------------------------------
   Typography — Paragraphs & Small Text
   -------------------------------------------------------------------------- */
p {
  margin-bottom: var(--space-4);
}

small {
  font-size: var(--text-sm);
  color: var(--color-muted-foreground);
}

/* --------------------------------------------------------------------------
   Links
   -------------------------------------------------------------------------- */
a {
  color: var(--color-info);
  text-decoration: none;
  transition: var(--transition-colors);
}

a:hover {
  color: var(--color-primary);
  text-decoration: underline;
}

/* --------------------------------------------------------------------------
   Form Elements — Base Styles
   -------------------------------------------------------------------------- */
input,
select,
textarea,
button {
  font-family: inherit;
  font-size: inherit;
  line-height: inherit;
  color: inherit;
}

input,
select,
textarea {
  display: block;
  width: 100%;
  padding: var(--space-2) var(--space-3);
  background-color: var(--color-input-background);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  transition: var(--transition-colors), var(--transition-shadow);
}

input:hover,
select:hover,
textarea:hover {
  border-color: var(--color-border-strong);
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--color-ring);
  box-shadow: 0 0 0 2px rgba(163, 163, 163, 0.25);
}

textarea {
  resize: vertical;
  min-height: 5rem;
}

select {
  cursor: pointer;
  appearance: none;
  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='%236b7280' d='M6 8.825a.5.5 0 0 1-.354-.146l-4-4a.5.5 0 1 1 .708-.708L6 7.617l3.646-3.646a.5.5 0 1 1 .708.708l-4 4A.5.5 0 0 1 6 8.825z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right var(--space-3) center;
  padding-right: var(--space-8);
}

button {
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  font-weight: var(--font-weight-medium);
  border: none;
  border-radius: var(--radius-md);
  background-color: var(--color-primary);
  color: var(--color-primary-foreground);
  transition: var(--transition-colors);
}

button:hover {
  background-color: var(--color-primary-hover);
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* --------------------------------------------------------------------------
   Accessibility — Focus-Visible Outline
   -------------------------------------------------------------------------- */
:focus-visible {
  outline: 2px solid var(--color-ring);
  outline-offset: 2px;
}

/* Remove default focus ring for mouse users */
:focus:not(:focus-visible) {
  outline: none;
}

/* --------------------------------------------------------------------------
   Utility — 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;
}
