/* ==========================================================================
   SAFA BUILDERS — Base Styles & Typography
   ========================================================================== */

/* ── Body ── */
body {
  font-family: var(--font-family);
  font-size: var(--fs-base);
  font-weight: var(--fw-regular);
  line-height: var(--lh-normal);
  color: var(--clr-text);
  background-color: var(--clr-white);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ── Headings ── */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-family);
  font-weight: var(--fw-bold);
  line-height: var(--lh-tight);
  color: var(--clr-text);
}

h1 { font-size: clamp(var(--fs-3xl), 5vw, var(--fs-5xl)); }
h2 { font-size: clamp(var(--fs-2xl), 4vw, var(--fs-4xl)); }
h3 { font-size: clamp(var(--fs-xl), 3vw, var(--fs-3xl)); }
h4 { font-size: clamp(var(--fs-lg), 2vw, var(--fs-2xl)); }
h5 { font-size: var(--fs-xl); }
h6 { font-size: var(--fs-lg); }

/* ── Paragraphs ── */
p {
  line-height: var(--lh-relaxed);
  color: var(--clr-text-light);
}

/* ── Links ── */
a {
  transition: var(--transition-fast);
}

/* Inline body links (no explicit class) must be distinguishable beyond color */
a:not([class]):not([role]) {
  text-decoration: underline;
}

/* ── Blockquote ── */
blockquote {
  border-left: 4px solid var(--clr-secondary);
  padding-left: var(--sp-6);
  font-style: italic;
  color: var(--clr-text-light);
}

/* ── Strong / Bold ── */
strong, b {
  font-weight: var(--fw-semibold);
  color: var(--clr-text);
}

/* ── Code ── */
code, pre {
  font-family: monospace;
  background-color: var(--clr-bg);
  border-radius: var(--radius-sm);
}

code {
  padding: 0.125rem 0.375rem;
  font-size: var(--fs-sm);
}

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

/* ── Text Utilities ── */
.text-primary     { color: var(--clr-primary); }
.text-secondary   { color: var(--clr-secondary); }
.text-accent      { color: var(--clr-accent); }
.text-white       { color: var(--clr-white); }
.text-muted       { color: var(--clr-text-muted); }
.text-light       { color: var(--clr-text-light); }

.text-xs    { font-size: var(--fs-xs); }
.text-sm    { font-size: var(--fs-sm); }
.text-base  { font-size: var(--fs-base); }
.text-lg    { font-size: var(--fs-lg); }
.text-xl    { font-size: var(--fs-xl); }
.text-2xl   { font-size: var(--fs-2xl); }

.font-light     { font-weight: var(--fw-light); }
.font-regular   { font-weight: var(--fw-regular); }
.font-medium    { font-weight: var(--fw-medium); }
.font-semibold  { font-weight: var(--fw-semibold); }
.font-bold      { font-weight: var(--fw-bold); }

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

.uppercase    { text-transform: uppercase; }
.capitalize   { text-transform: capitalize; }
.leading-tight  { line-height: var(--lh-tight); }
.leading-relaxed{ line-height: var(--lh-relaxed); }
.tracking-wide  { letter-spacing: 0.05em; }
.tracking-wider { letter-spacing: 0.1em; }

/* ── Background Utilities ── */
.bg-primary   { background-color: var(--clr-primary); }
.bg-secondary { background-color: var(--clr-secondary); }
.bg-white     { background-color: var(--clr-white); }
.bg-light     { background-color: var(--clr-bg); }
.bg-alt       { background-color: var(--clr-bg-alt); }

/* ── Display Utilities ── */
.d-flex       { display: flex; }
.d-grid       { display: grid; }
.d-block      { display: block; }
.d-none       { display: none; }
.d-inline     { display: inline; }
.d-inline-flex{ display: inline-flex; }

.align-center   { align-items: center; }
.justify-center { justify-content: center; }
.justify-between{ justify-content: space-between; }
.flex-wrap      { flex-wrap: wrap; }
.gap-4          { gap: var(--sp-4); }
.gap-6          { gap: var(--sp-6); }
.gap-8          { gap: var(--sp-8); }

/* ── Spacing Utilities ── */
.mt-auto { margin-top: auto; }
.mb-0    { margin-bottom: 0; }
.mb-4    { margin-bottom: var(--sp-4); }
.mb-6    { margin-bottom: var(--sp-6); }
.mb-8    { margin-bottom: var(--sp-8); }
.pt-0    { padding-top: 0; }

/* ── Width Utilities ── */
.w-full  { width: 100%; }
.w-auto  { width: auto; }
.max-w-sm{ max-width: 28rem; }
.max-w-md{ max-width: 42rem; }
.max-w-lg{ max-width: 56rem; }
.max-w-xl{ max-width: 72rem; }

/* ── Border Utilities ── */
.rounded     { border-radius: var(--radius); }
.rounded-lg  { border-radius: var(--radius-lg); }
.rounded-xl  { border-radius: var(--radius-xl); }
.rounded-2xl { border-radius: var(--radius-2xl); }
.rounded-full{ border-radius: var(--radius-full); }

/* ── Shadow Utilities ── */
.shadow-sm { box-shadow: var(--shadow-sm); }
.shadow     { box-shadow: var(--shadow); }
.shadow-md { box-shadow: var(--shadow-md); }
.shadow-lg { box-shadow: var(--shadow-lg); }

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

/* ── Overflow ── */
.overflow-hidden { overflow: hidden; }

/* ── Position ── */
.relative { position: relative; }
.absolute { position: absolute; }
.fixed    { position: fixed; }

/* ── Divider ── */
.divider {
  display: block;
  width: 60px;
  height: 3px;
  background: linear-gradient(90deg, var(--clr-secondary), var(--clr-primary-light));
  border-radius: var(--radius-full);
  margin: var(--sp-4) 0;
}

.divider-center {
  margin-left: auto;
  margin-right: auto;
}

/* ── Lazy load image placeholder ── */
img[data-src] {
  opacity: 0;
  transition: opacity 0.4s ease;
}

img.loaded {
  opacity: 1;
}
