/**
 * Icon Base Styles
 *
 * Core CSS for the mask-image based icon system.
 * Import this file alongside an icon set (e.g., material.css) to use icons.
 *
 * @example
 * <link rel="stylesheet" href="@byjackli-labs/ui/themes/icons/base.css" />
 * <link rel="stylesheet" href="@byjackli-labs/ui/themes/icons/material.css" />
 */

/* Fallback icon (simple square with border) */
:root {
  --icon-fallback: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Crect x='4' y='4' width='16' height='16' rx='2' fill='none' stroke='currentColor' stroke-width='2'/%3E%3C/svg%3E");
}

/* Base icon class */
.bjl-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1em;
  height: 1em;
  flex-shrink: 0;

  /* Mask-based rendering */
  background-color: currentColor;
  mask-image: var(--icon);
  mask-size: contain;
  mask-repeat: no-repeat;
  mask-position: center;

  /* Webkit prefix for Safari support */
  -webkit-mask-image: var(--icon);
  -webkit-mask-size: contain;
  -webkit-mask-repeat: no-repeat;
  -webkit-mask-position: center;
}

/* Size variants */
.bjl-icon.s-xs {
  width: 0.75em;
  height: 0.75em;
}

.bjl-icon.s-sm {
  width: 0.875em;
  height: 0.875em;
}

/* md is the default (1em), no class needed */

.bjl-icon.s-lg {
  width: 1.25em;
  height: 1.25em;
}

.bjl-icon.s-xl {
  width: 1.5em;
  height: 1.5em;
}

/* Custom SVG children - disable mask rendering */
.bjl-icon.custom {
  background-color: transparent;
  mask-image: none;
  -webkit-mask-image: none;
  color: inherit;
}

.bjl-icon.custom svg {
  width: 100%;
  height: 100%;
}

/* Spin animation */
.bjl-icon.spin {
  animation: icon-spin 1s linear infinite;
}

@keyframes icon-spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
  .bjl-icon.spin {
    animation: none;
  }
}
