@import url('layers.css');

/* Required utilities */
@import url('utilities/density.css');
@import url('utilities/variants.css');

@layer ed-native {
  /* region General ~~~~~~~~~~~~~~~~~~~~~~~~~ */
  html {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    tab-size: 4;
  }

  /* Hide mobile-only elements when the page is in desktop view */
  ed-page[view='desktop'] .ed-mobile-only {
    display: none !important;
  }

  /* Hide desktop-only elements when the page is in mobile view */
  ed-page[view='mobile'] .ed-desktop-only {
    display: none !important;
  }

  *,
  *::before,
  *::after {
    box-sizing: inherit;
  }

  body {
    min-height: 100vh;
    margin: 0;
    padding: 0;
    color: var(--ed-color-text);
    font-family: var(--ed-font-family-body);
    font-size: var(--ed-font-size-m);
    font-weight: var(--ed-font-weight-body);
    line-height: var(--ed-line-height-normal);
    -moz-osx-font-smoothing: grayscale;
    -webkit-font-smoothing: antialiased;
    text-size-adjust: none;
    -moz-text-size-adjust: none;
    -webkit-text-size-adjust: none;
  }

  /* endregion */
  /* region Block Text ~~~~~~~~~~~~~~~~~~~~~~ */
  h1,
  h2,
  h3,
  h4,
  h5,
  h6 {
    font-family: var(--ed-font-family-heading);
    font-weight: var(--ed-font-weight-heading);
    line-height: var(--ed-line-height-normal);
    color: var(--ed-color-title);
    text-wrap: balance;
  }

  h1 {
    font-size: var(--ed-font-size-2xl);
  }

  h2 {
    font-size: var(--ed-font-size-xl);
  }

  h3 {
    font-size: var(--ed-font-size-l);
  }

  h4,
  h5,
  h6 {
    font-size: var(--ed-font-size-l);
  }

  p {
    text-wrap: pretty;
  }

  /* endregion */
  /* region Thematic Break ~~~~~~~~~~~~~~~~~~ */
  hr {
    margin: var(--ed-space-4) 0;
    border: none;
    border-top: solid var(--ed-border-width-1) var(--ed-color-border);
  }

  /* endregion */
  /* region Inline Text ~~~~~~~~~~~~~~~~~~~~~ */
  strong,
  b {
    font-weight: var(--ed-font-weight-bold);
  }

  em,
  i {
    font-style: italic;
  }

  u {
    text-decoration-line: underline;
    text-decoration-thickness: 0.09375em;
    text-underline-offset: 0.125em;
  }

  s {
    text-decoration-line: line-through;
    text-decoration-thickness: 0.09375em;
  }

  ins {
    text-decoration-color: var(--ed-color-success-fill-normal);
    text-decoration-line: underline;
    text-decoration-thickness: 0.09375em;
    text-underline-offset: 0.125em;
  }

  del {
    color: color-mix(in oklab, currentColor, transparent 10%);
    text-decoration-color: var(--ed-color-danger-fill-normal);
    text-decoration-line: line-through;
    text-decoration-thickness: 0.09375em;
  }

  mark {
    background-color: var(--ed-color-warning-fill-light);
    border-radius: var(--ed-border-radius-1x);
  }

  small {
    font-size: var(--ed-font-size-smaller);
  }

  sub,
  sup {
    font-size: var(--ed-font-size-smaller);
    line-height: 0;
  }

  sub {
    vertical-align: sub;
  }

  sup {
    vertical-align: super;
  }

  abbr[title] {
    text-decoration-line: underline;
    text-decoration-style: dotted;
    text-decoration-thickness: 0.09375em;
    text-underline-offset: 0.125em;

    cursor: help;
  }

  kbd {
    padding: 0.125em 0.25em;
    font-family: var(--ed-font-family-code);
    font-size: var(--ed-font-size-smaller);
    font-weight: var(--ed-font-weight-code);
    border: solid var(--ed-border-width-1) color-mix(in oklab, currentColor, transparent 50%);
    border-radius: var(--ed-border-radius-2x);
    box-shadow: 0 0.125em 0 0 color-mix(in oklab, currentColor, transparent 50%);

    ed-icon {
      vertical-align: -2px;
    }
  }

  /* endregion */
  /* region Links ~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  a {
    color: var(--ed-color-text-link);
    text-decoration: var(--ed-link-decoration-default);
    -webkit-text-decoration: var(--ed-link-decoration-default);
    text-decoration-thickness: round(0.0625em, 1px);
    text-underline-offset: 0.125em;
  }

  *:is([appearance~='accent'], .ed-accent) {
    a,
    a:hover {
      color: currentColor;
    }
  }

  @media (hover: hover) {
    a:hover {
      text-decoration: var(--ed-link-decoration-hover);
      -webkit-text-decoration: var(--ed-link-decoration-hover);
    }
  }

  a:active {
    text-decoration: var(--ed-link-decoration-hover);
    -webkit-text-decoration: var(--ed-link-decoration-hover);
    text-decoration-thickness: round(0.125em, 1px);
  }

  a:focus,
  button:focus {
    outline: none;
  }

  a:focus-visible,
  button:focus-visible {
    outline: var(--ed-focus-ring);
    outline-offset: var(--ed-focus-ring-offset);
  }

  /* endregion */
  /* region Code ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  code,
  samp,
  var {
    padding: 0.125em 0.25em;

    font-family: var(--ed-font-family-code);
    font-size: var(--ed-font-size-smaller);
    font-weight: var(--ed-font-weight-code);
    background-color: var(--ed-color-code-highlight);
    border-radius: var(--ed-border-radius-1x);
  }

  pre {
    padding: var(--ed-space-4);
    font-family: var(--ed-font-family-code);
    font-size: var(--ed-font-size-smaller);
    font-weight: var(--ed-font-weight-code);
    white-space: pre;
    background-color: var(--ed-color-code-highlight);
    border-radius: var(--ed-border-radius-2x);

    /* Remove overlapping styles for child code elements */

    & code,
    & samp,
    & var {
      padding: 0;
      font-size: 1em;
      background-color: transparent;
    }

    /* Print styles */
    @media print {
      background: none;
      border: solid var(--ed-border-width-1) var(--ed-color-border);
    }
  }
  /* endregion */
}
