@layer components {
  /* ===================================================
     Sacred Lists, Symbolic Lists and TL;DR Sections
     Version: 3.0, Responsive Rewrite (2026)

     Improvements:
     • Responsive typography for all list elements
     • Safer spacing across desktop, tablet and mobile
     • Improved wrapping for long links and labels
     • Better symbolic marker alignment
     • Responsive TL;DR heading treatment
     • Reduced motion support
     • Preserves existing class names and theme tokens
     =================================================== */

  /* ===================================================
     List introduction and preface
     =================================================== */

  :where(.list-intro) {
    max-width: 100%;
    margin: 0 0 var(--space-sm, 1rem);

    color: var(--text-primary);
    font-family: var(--font-display);
    font-size: clamp(1.15rem, 1.6vw, var(--font-size-lg, 1.5rem));
    font-weight: var(--type-weight-medium, 500);
    line-height: 1.55;
    letter-spacing: 0.02em;
    text-align: left;

    overflow-wrap: break-word;
    word-break: normal;
  }

  /* ===================================================
     TL;DR heading
     =================================================== */

  :where(.tldr-heading) {
    display: inline-block;
    width: fit-content;
    max-width: 100%;

    margin:
      var(--space-md, 1.5rem)
      0
      var(--space-sm, 1rem);

    padding: 0.2rem 0.6rem;

    border: 1px solid var(--line-soft);
    border-radius: 999px;

    background: var(--surface-2);
    color: var(--text-highlight);

    font-family: var(--page-title);
    font-size: clamp(1.75rem, 3vw, 3rem);
    font-weight: var(--type-weight-semibold, 600);
    line-height: 1.1;
    letter-spacing: 0.02em;
    text-align: left;

    white-space: normal;
    overflow-wrap: anywhere;
    word-break: normal;
  }

  /* ===================================================
     Symbolic list container
     =================================================== */

  :where(.list-emoji) {
    --list-emoji-char: "✦";

    width: 100%;
    max-width: 100%;

    margin:
      var(--space-sm, 1rem)
      0
      var(--space-md, 1.5rem);

    padding: 0;

    list-style: none;

    white-space: normal;
    overflow-wrap: break-word;
    word-break: normal;
  }

  /* ===================================================
     Symbolic list items
     =================================================== */

  :where(.list-emoji) > li {
    position: relative;

    min-width: 0;
    margin: 0 0 var(--space-sm, 1rem);
    padding-left: clamp(2rem, 3vw, var(--space-lg, 3rem));

    color: var(--text-primary);
    font-family: var(--font-serif, "Libre Baskerville", serif);
    font-size: var(--type-list-item-size-compact, clamp(1rem, 1.2vw, var(--type-body-size)));
    line-height: 1.9;

    overflow-wrap: break-word;
    word-break: normal;
  }

  :where(ol:not([class])) > li {
    font-size: var(--type-list-item-size-compact, clamp(1rem, 1.2vw, var(--type-body-size)));
  }

  :where(.list-emoji) > li:last-child {
    margin-bottom: 0;
  }

  /* ===================================================
     Symbolic marker
     =================================================== */

  :where(.list-emoji) > li::before {
    content: var(--list-emoji-char);

    position: absolute;
    top: 0.1em;
    left: 0;

    width: 1.5rem;

    color: var(--text-accent);
    font-size: 1em;
    line-height: var(--font-base-line);
    text-align: center;

    opacity: 0.9;
  }

  /* ===================================================
     Links inside symbolic lists
     =================================================== */

  :where(.list-emoji) > li a {
    color: var(--text-accent);
    font-weight: var(--type-weight-semibold, 600);
    text-decoration: none;

    overflow-wrap: anywhere;
    word-break: normal;

    transition:
      color 0.3s ease,
      text-shadow 0.3s ease;
  }

  :where(.list-emoji) > li a:hover {
    color: var(--highlight);
    text-shadow: 0 0 8px var(--shadow-glow);
  }

  :where(.list-emoji) > li a:focus-visible {
    color: var(--highlight);
    outline: 2px solid
      color-mix(
        in srgb,
        var(--text-accent) 70%,
        transparent
      );
    outline-offset: 3px;
    border-radius: 0.15rem;
  }

  /* ===================================================
     Nested lists
     =================================================== */

  :where(.list-emoji) ul,
  :where(.list-emoji) ol {
    margin:
      var(--space-xs, 0.5rem)
      0
      0;

    padding-left: clamp(1.25rem, 3vw, 2rem);

    font-size: 0.96em;
    line-height: 1.75;
  }

  :where(.list-emoji) ul {
    list-style: disc;
  }

  :where(.list-emoji) ol {
    list-style: decimal;
  }

  :where(.list-emoji) ul li,
  :where(.list-emoji) ol li {
    margin-bottom: var(--space-xs, 0.5rem);
  }

  /* ===================================================
     Gnostic card interaction
     =================================================== */

  :where(.gnostic-card:hover)
  :where(.list-emoji) > li::before {
    color: var(--strong-text, var(--highlight));
    opacity: 1;

    transition:
      color 0.2s ease,
      opacity 0.2s ease;
  }

  /* ===================================================
     Tablet responsiveness
     =================================================== */

  @media (max-width: 1024px) {
    :where(.list-intro) {
      font-size: clamp(1.1rem, 2.2vw, 1.4rem);
      line-height: 1.5;
    }

    :where(.tldr-heading) {
      font-size: clamp(1.6rem, 4vw, 2.4rem);
      line-height: 1.12;
    }

    :where(.list-emoji) > li {
      padding-left: 2.5rem;
      font-size: var(--type-list-item-size-compact-tablet, clamp(1rem, 1.8vw, 1.05rem));
      line-height: 1.85;
    }

    :where(ol:not([class])) > li {
      font-size: var(--type-list-item-size-compact-tablet, clamp(1rem, 1.8vw, 1.05rem));
    }

    :where(.list-emoji) > li::before {
      left: 0.2rem;
    }
  }

  /* ===================================================
     Mobile responsiveness
     =================================================== */

  @media (max-width: 768px) {
    :where(.list-intro) {
      margin-bottom: var(--space-sm, 1rem);

      font-size: clamp(1.05rem, 4.5vw, 1.3rem);
      line-height: 1.5;
      letter-spacing: 0.015em;
    }

    :where(.tldr-heading) {
      display: block;
      width: fit-content;
      max-width: 100%;

      margin:
        var(--space-md, 1.5rem)
        0
        var(--space-sm, 1rem);

      padding: 0.25rem 0.7rem;

      font-size: clamp(1.35rem, 6vw, 1.8rem);
      line-height: 1.15;
      letter-spacing: 0.015em;
    }

    :where(.list-emoji) {
      width: 100%;

      margin:
        var(--space-sm, 1rem)
        0
        var(--space-md, 1.5rem);

      padding: 0;
    }

    :where(.list-emoji) > li {
      margin-bottom: calc(var(--space-sm, 1rem) + 0.15rem);
      padding-left: 2rem;

      font-size: var(--type-list-item-size-compact-mobile, clamp(0.98rem, 4vw, 1.05rem));
      line-height: 1.75;

      overflow-wrap: anywhere;
      word-break: normal;
    }

    :where(ol:not([class])) > li {
      font-size: var(--type-list-item-size-compact-mobile, clamp(0.98rem, 4vw, 1.05rem));
    }

    :where(.list-emoji) > li::before {
      top: 0.08em;
      left: 0.2rem;

      width: 1.25rem;
      font-size: 0.95em;
    }

    :where(.list-emoji) > li a {
      display: inline;

      overflow-wrap: anywhere;
      word-break: normal;
    }

    :where(.list-emoji) ul,
    :where(.list-emoji) ol {
      padding-left: 1.25rem;

      font-size: 0.95em;
      line-height: 1.7;
    }
  }

  /* ===================================================
     Narrow mobile responsiveness
     =================================================== */

  @media (max-width: 420px) {
    :where(.list-intro) {
      font-size: 1.05rem;
      line-height: 1.45;
    }

    :where(.tldr-heading) {
      margin-top: var(--space-sm, 1rem);
      padding: 0.2rem 0.6rem;

      font-size: 1.3rem;
      line-height: 1.15;
    }

    :where(.list-emoji) > li {
      margin-bottom: 0.95rem;
      padding-left: 1.75rem;

      font-size: var(--type-list-item-size-compact-narrow, 0.96rem);
      line-height: 1.7;
    }

    :where(ol:not([class])) > li {
      font-size: var(--type-list-item-size-compact-narrow, 0.96rem);
    }

    :where(.list-emoji) > li::before {
      top: 0.06em;
      left: 0.1rem;

      width: 1.15rem;
      font-size: 0.9em;
    }

    :where(.list-emoji) ul,
    :where(.list-emoji) ol {
      padding-left: 1.1rem;
      line-height: 1.65;
    }
  }

  /* ===================================================
     Very narrow screens
     =================================================== */

  @media (max-width: 340px) {
    :where(.tldr-heading) {
      width: 100%;
      padding-inline: 0.5rem;

      font-size: 1.2rem;
      text-align: center;
    }

    :where(.list-emoji) > li {
      padding-left: 1.6rem;

      font-size: var(--type-list-item-size-compact-min, 0.93rem);
      line-height: 1.65;
    }

    :where(ol:not([class])) > li {
      font-size: var(--type-list-item-size-compact-min, 0.93rem);
    }

    :where(.list-emoji) > li::before {
      left: 0;
    }
  }

  /* ===================================================
     Reduced motion
     =================================================== */

  @media (prefers-reduced-motion: reduce) {
    :where(.list-emoji) > li a,
    :where(.gnostic-card:hover)
    :where(.list-emoji) > li::before {
      transition: none;
    }
  }
}
