/* =============================================================
   Pitvolt - Iconography
   Sits on top of colors_and_type.css. The "twist" is applied via
   ::before (clay-red notch) and ::after (yellow voltage spark).
   ============================================================= */

/* Wrapper for any icon - works for <PvIcon> in React or static markup */
.pv-icon {
  --pv-icon-size: 1.25em;        /* default size: tracks current font-size */
  --pv-icon-stroke: 12;          /* on Phosphor's 256 viewBox; Light is ~16, we go lighter */
  --pv-icon-notch: 22%;          /* notch size as % of icon */
  --pv-icon-spark: 14%;          /* spark dot size as % of icon */
  --pv-icon-notch-color: var(--accent-secondary); /* clay red */
  --pv-icon-spark-color: var(--accent-primary);   /* yellow */

  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--pv-icon-size);
  height: var(--pv-icon-size);
  flex-shrink: 0;
  color: currentColor;
  vertical-align: -0.18em;       /* optical centering with body text */
  line-height: 1;
}

/* The actual SVG glyph - inherits color */
.pv-icon > svg {
  width: 100%;
  height: 100%;
  stroke-width: var(--pv-icon-stroke);
  display: block;
  /* clip-path applies the corner notch to the glyph itself */
  clip-path: polygon(
    0 0,
    calc(100% - var(--pv-icon-notch)) 0,
    100% var(--pv-icon-notch),
    100% 100%,
    0 100%
  );
}

/* Notch - a clay-red triangle that fills the cut-away corner.
   Implemented as a child <span class="pv-icon__notch"> for renderer
   compatibility (some screenshot tools drop ::before/::after). */
.pv-icon__notch {
  position: absolute;
  top: 0;
  right: 0;
  width: var(--pv-icon-notch);
  height: var(--pv-icon-notch);
  background: var(--pv-icon-notch-color);
  clip-path: polygon(100% 0, 100% 100%, 0 0);
  pointer-events: none;
}

/* Spark - small yellow voltage dot at lower-left, with a soft glow */
.pv-icon__spark {
  position: absolute;
  bottom: 6%;
  left: 6%;
  width: var(--pv-icon-spark);
  height: var(--pv-icon-spark);
  background: var(--pv-icon-spark-color);
  border-radius: 50%;
  box-shadow: 0 0 6px var(--pv-icon-spark-color);
  pointer-events: none;
}

/* ---------- Variants ---------- */

/* Filled: solid glyph instead of outline. Set via the wrapper. */
.pv-icon--filled > svg {
  stroke-width: 0;
}
.pv-icon--filled > svg * {
  fill: currentColor !important;
  stroke: none !important;
}

/* No twist - for cases where the brand mark is too much (e.g. UI-dense lists) */
.pv-icon--plain .pv-icon__notch,
.pv-icon--plain .pv-icon__spark { display: none; }
.pv-icon--plain > svg { clip-path: none; }

/* Status overrides: glyph color carries the meaning */
.pv-icon--warning { color: var(--accent-secondary); }
.pv-icon--warning .pv-icon__notch { display: none; } /* no notch; whole icon is the alert */
.pv-icon--warning .pv-icon__spark { background: #fff; box-shadow: none; }

.pv-icon--success { color: var(--accent-primary); }
.pv-icon--success .pv-icon__notch { display: none; }
.pv-icon--success .pv-icon__spark { background: var(--text-primary); box-shadow: none; }

.pv-icon--info { color: var(--text-muted); }

/* Sizes - clamp variants for predictable sizing in dense UI */
.pv-icon--xs { --pv-icon-size: 14px; --pv-icon-notch: 28%; --pv-icon-spark: 18%; }
.pv-icon--sm { --pv-icon-size: 18px; --pv-icon-notch: 24%; --pv-icon-spark: 16%; }
.pv-icon--md { --pv-icon-size: 24px; }
.pv-icon--lg { --pv-icon-size: 32px; --pv-icon-notch: 20%; --pv-icon-spark: 13%; }
.pv-icon--xl { --pv-icon-size: 48px; --pv-icon-notch: 18%; --pv-icon-spark: 11%; }

/* ---------- Optional chip container ---------- */

.icon-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: var(--r-md);
  background: var(--glass-fill);
  border: 1px solid var(--glass-border);
  flex-shrink: 0;
}
.icon-chip--lg { width: 56px; height: 56px; border-radius: var(--r-lg); }
.icon-chip--bright { background: var(--glass-fill-bright); }
.icon-chip--on-elevated {
  background: rgba(10, 10, 10, 0.04);
  border-color: var(--border-on-elevated);
}
.icon-chip--accent {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
  color: var(--text-on-elevated);
}

/* When inside a chip, drop the wrapper's intrinsic margin */
.icon-chip > .pv-icon { vertical-align: 0; }
