@use '../base' as *;

// --------------------------------

// (START) Global editor code https://codyhouse.co/ds/globals/typography

// --------------------------------

:root {
  // font family
  --font-primary: system-ui, sans-serif;

  // font size
  --text-base-size: 1rem; // body font-size
  --text-scale-ratio: 1.2; // multiplier used to generate the type scale values 👇
  
  // line-height
  --body-line-height: 1.4;
  --heading-line-height: 1.2;
  
  // capital letters - used in combo with the lhCrop mixin
  --font-primary-capital-letter: 1;

  // unit - don't modify unless you want to change the typography unit (e.g., from Rem to Em units)
  --text-unit: var(--text-base-size); // if Em units → --text-unit: 1em;
}

:root, * {
  // type scale
  --text-xs: calc((var(--text-unit) / var(--text-scale-ratio)) / var(--text-scale-ratio));
  --text-sm: calc(var(--text-xs) * var(--text-scale-ratio));
  --text-md: calc(var(--text-sm) * var(--text-scale-ratio) * var(--text-scale-ratio));
  --text-lg: calc(var(--text-md) * var(--text-scale-ratio));
  --text-xl: calc(var(--text-lg) * var(--text-scale-ratio));
  --text-xxl: calc(var(--text-xl) * var(--text-scale-ratio));
  --text-xxxl: calc(var(--text-xxl) * var(--text-scale-ratio));
  --text-xxxxl: calc(var(--text-xxxl) * var(--text-scale-ratio));
}

@include breakpoint(md) {
  :root {
    --text-base-size: 1.125rem;
    --text-scale-ratio: 1.215;
  }
}

h1, h2, h3, h4 {
  --heading-font-weight: 700;
}

// --------------------------------

// (END) Global editor code

// --------------------------------

html {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.link {
  text-decoration: none;
  background-image: linear-gradient(to right, currentColor 50%, alpha(var(--color-contrast-higher), 0.15) 50%);
  background-size: 200% 1px;
  background-repeat: no-repeat;
  background-position: 100% 100%;
  transition: background-position 0.2s;

  &:hover {
    background-position: 0% 100%;
  }
}

mark {
  background-color: alpha(var(--color-accent), 0.2);
  color: inherit;
}

.text-component {
  --line-height-multiplier: 1;
  --text-space-y-multiplier: 1;
  
  > * { // use Em units
    --text-unit: 1em;
    --space-unit: 1em;
  }

  blockquote {
    padding-left: 1em;
    border-left: 4px solid var(--color-contrast-lower);
    font-style: italic;
  }

  hr {
    background: var(--color-contrast-lower);
    height: 1px;
  }

  figcaption {
    font-size: var(--text-sm);
    color: var(--color-contrast-low);
  }
}

.article { // e.g., blog posts
  --body-line-height: 1.58; // set body line-height
  --text-space-y-multiplier: 1.2; // control vertical spacing
}