/* ========== GLOBAL RESET & BASE ==========
   Establish the foundation for a calm, intentional design system */

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

html {
  scroll-behavior: smooth;
}

body {
  background-color: var(--color-background);
  color: var(--color-text-primary);
  font-family: var(--font-body);
  font-size: var(--font-size-body);
  line-height: var(--line-height-normal);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  letter-spacing: 0;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ========== HEADINGS - Serif, confident, generous spacing ========== */
h1,
h2,
h3,
h4,
h5,
h6 {
  font-family: var(--font-headings);
  font-weight: 700;
  color: var(--color-text-primary);
  line-height: var(--line-height-tight);
  margin-bottom: var(--spacing-sm);
  letter-spacing: var(--letter-spacing-tight);
}

h1 {
  font-size: var(--font-size-h1);
  margin-bottom: var(--spacing-md);
}

h2 {
  font-size: var(--font-size-h2);
  margin-bottom: var(--spacing-md);
}

h3 {
  font-size: var(--font-size-h3);
  margin-bottom: var(--spacing-sm);
}

h4 {
  font-size: var(--font-size-h4);
  margin-bottom: var(--spacing-sm);
}

/* ========== PARAGRAPHS & TEXT ==========
   Clean sans-serif, 16-18px, line-height 1.6-1.8, max 720px for text blocks */
p {
  max-width: var(--max-text-width);
  margin-bottom: var(--spacing-sm);
  line-height: var(--line-height-normal);
}

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

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

code {
  background-color: rgba(0, 0, 0, 0.05);
  padding: var(--spacing-xs) var(--spacing-xs);
  border-radius: var(--radius-sm);
  font-family: 'Monaco', 'Menlo', 'Courier New', monospace;
  font-size: var(--font-size-xs);
}

/* ========== LINKS - Subtle and clear ========== */
a {
  color: var(--color-accent);
  text-decoration: none;
  transition: color var(--transition-fast);
  cursor: pointer;
}

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

a:active {
  opacity: 0.8;
}

/* ========== UTILITY CLASSES ========== */
.container {
  max-width: var(--max-container-width);
  margin: 0 auto;
  padding: 0 var(--spacing-md);
}

.text-muted {
  color: var(--color-text-secondary);
  opacity: 0.75;
}

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

.text-center {
  text-align: center;
}

.text-right {
  text-align: right;
}

.text-left {
  text-align: left;
}

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

/* ========== FLEXBOX UTILITIES ========== */
.flex-center {
  display: flex;
  align-items: center;
  justify-content: center;
}

.flex-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.flex-start {
  display: flex;
  align-items: flex-start;
}

/* ========== SPACING UTILITIES ========== */
.mt-xs { margin-top: var(--spacing-xs); }
.mt-sm { margin-top: var(--spacing-sm); }
.mt-md { margin-top: var(--spacing-md); }
.mt-lg { margin-top: var(--spacing-lg); }
.mt-xl { margin-top: var(--spacing-xl); }

.mb-xs { margin-bottom: var(--spacing-xs); }
.mb-sm { margin-bottom: var(--spacing-sm); }
.mb-md { margin-bottom: var(--spacing-md); }
.mb-lg { margin-bottom: var(--spacing-lg); }
.mb-xl { margin-bottom: var(--spacing-xl); }

.px-sm { padding-left: var(--spacing-sm); padding-right: var(--spacing-sm); }
.px-md { padding-left: var(--spacing-md); padding-right: var(--spacing-md); }

.py-sm { padding-top: var(--spacing-sm); padding-bottom: var(--spacing-sm); }
.py-md { padding-top: var(--spacing-md); padding-bottom: var(--spacing-md); }

/* ========== SELECTION ==========
   Calm, not flashy */
::selection {
  background-color: var(--color-accent);
  color: var(--color-white);
}

/* ========== ERROR & EMPTY STATE RULES (Design) ==========
   Errors: Explain what went wrong + how to fix. Never blame the user.
   Use .error-state, .error-state-title, .error-state-message, .error-state-fix.
   Empty states: Provide a clear next action. Never feel dead.
   Use .empty-state, .empty-state-title, .empty-state-description + primary CTA. */