/* ABOUTME: Utility classes for the Plumbline theme. */
/* ABOUTME: Accessibility helpers, screen-reader utilities, reduced motion. */

@layer utilities {
  /*
   * Taxonomy pills: utilities layer beats blocks.css entry-link rules.
   * blocks.css previously used transition shorthand on .pl-entry a, which zeroed these animations.
   */
  a.pl-taxonomy-pill {
    transition:
      background-color 0.33s var(--pl-easing-default),
      border-color 0.33s var(--pl-easing-default),
      color 0.33s var(--pl-easing-default);
  }

  /* --- Screen Reader Text --- */
  .screen-reader-text {
    clip: rect(1px, 1px, 1px, 1px);
    clip-path: inset(50%);
    height: 1px;
    width: 1px;
    margin: -1px;
    overflow: hidden;
    padding: 0;
    position: absolute;
    word-wrap: normal !important;
  }

  .screen-reader-text:focus {
    clip: auto !important;
    clip-path: none;
    display: block;
    height: auto;
    width: auto;
    margin: 0;
    overflow: visible;
    padding: 0.75rem 1.25rem;
    position: fixed;
    top: 5px;
    left: 5px;
    z-index: 100000;
    background-color: var(--pl-color-surface-page, #fff);
    color: var(--pl-color-text-primary, #1c1917);
    font-size: var(--pl-text-sm, 0.875rem);
    font-weight: 600;
    line-height: normal;
    text-decoration: none;
    border-radius: var(--pl-radius-sm, 4px);
    box-shadow: var(--pl-shadow-lg, 0 4px 12px rgba(0, 0, 0, 0.15));
  }

  /* --- Skip Link --- */
  .pl-skip-link:focus {
    clip: auto !important;
    clip-path: none;
    display: block;
    height: auto;
    width: auto;
    margin: 0;
    overflow: visible;
    padding: 0.75rem 1.25rem;
    position: fixed;
    top: 5px;
    left: 5px;
    z-index: 100000;
    background-color: var(--pl-color-primary, #2563eb);
    color: var(--pl-color-text-inverse, #fff);
    font-size: var(--pl-text-base, 1rem);
    font-weight: 700;
    line-height: normal;
    text-decoration: none;
    border-radius: var(--pl-radius-sm, 4px);
    box-shadow: var(--pl-shadow-lg, 0 4px 12px rgba(0, 0, 0, 0.15));
  }

  /* ========================================
     PL Decorators — Shape Utilities
     ======================================== */

  .pl-shape-arch img {
    clip-path: ellipse(50% 65% at 50% 35%);
  }

  .pl-shape-circle img {
    clip-path: circle(50%);
  }

  .pl-shape-rounded img {
    border-radius: var(--pl-radius-lg);
  }

  /* ========================================
     PL Decorators — Heading Accent Bar
     ======================================== */

  .pl-heading-bar::after {
    content: '';
    display: block;
    width: 4.5rem;
    height: 4px;
    border-radius: var(--pl-radius-full);
    background: var(--pl-color-accent);
    margin-top: var(--pl-space-2);
  }

  .pl-heading-bar--center::after {
    margin-inline: auto;
  }

  /* ========================================
     PL Decorators — Section Dividers
     ======================================== */

  .pl-divider-wave {
    position: relative;
  }

  .pl-divider-wave::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    right: 0;
    height: 4rem;
    background: var(--pl-color-surface-page);
    clip-path: ellipse(55% 100% at 50% 100%);
    pointer-events: none;
  }

  .pl-divider-angle {
    position: relative;
  }

  .pl-divider-angle::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    right: 0;
    height: 3rem;
    background: var(--pl-color-surface-page);
    clip-path: polygon(0 100%, 100% 0%, 100% 100%);
    pointer-events: none;
  }

  /* --- Reduced Motion --- */
  @media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
      animation-duration: 0.01ms !important;
      animation-iteration-count: 1 !important;
      transition-duration: 0.01ms !important;
      scroll-behavior: auto !important;
    }
  }
}
