/* Iconyz: home page banner and the /iconyz library page. */
.iyz, .iyz-banner {
  --card: var(--bg-card);
  --mut: var(--ink-muted);
  --acc: var(--accent-fill);
}
/* The page's color picker sets --ic on <html>; the banner uses the brand color. */
.iyz-banner { --ic: var(--accent); }

/* ---------- Home banner: full width, three rows of icons ---------- */
.iyz-banner {
  --cell: 76px;
  --gap: 12px;
  display: block;
  width: 100%;
  margin: 0 0 2rem;
  padding: 1.1rem 1.25rem 1.25rem;
  background: linear-gradient(135deg, var(--accent-soft), transparent 60%), var(--bg-card);
  border: 1px solid var(--line-strong);
  border-radius: 18px;
  color: var(--ink);
  text-decoration: none;
  transition: border-color 160ms var(--ease), box-shadow 160ms var(--ease);
}
.iyz-banner:hover, .iyz-banner:focus-visible {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
  outline: none;
}
.iyz-banner-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: .35rem 1rem;
  margin-bottom: .9rem;
}
.iyz-banner-head h2 { margin: 0; font-size: 1.35rem; font-weight: 800; letter-spacing: -.02em; }
.iyz-banner-head p { margin: 0; color: var(--mut); font-size: .92rem; flex: 1 1 260px; }
.iyz-banner-cta { color: var(--accent); font-weight: 700; font-size: .92rem; white-space: nowrap; }
.iyz-banner-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(var(--cell), 1fr));
  grid-template-rows: repeat(3, var(--cell));
  grid-auto-rows: var(--cell);
  gap: var(--gap);
  /* Exactly three rows; the rest are clipped. */
  height: calc(3 * var(--cell) + 2 * var(--gap));
  overflow: hidden;
}
.iyz-banner-grid i {
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: var(--bg);
  border: 1px solid var(--line);
  color: var(--ic);
}
.iyz-banner-grid svg { width: 48px; height: 48px; }
.iyz-banner-grid i:hover svg path:last-of-type {
  stroke-dasharray: 1;
  animation: iyz-draw 1s ease-out;
}
@media (max-width: 640px) {
  .iyz-banner { --cell: 58px; --gap: 8px; padding: 1rem; }
  .iyz-banner-grid svg { width: 38px; height: 38px; }
}

/* ---------- /iconyz page ---------- */
.iyz h1 { font-size: clamp(34px, 6vw, 56px); line-height: 1.05; letter-spacing: -.03em; margin: 0 0 12px; font-weight: 800; }
.iyz .sub { color: var(--mut); max-width: 52ch; margin: 0 0 28px; font-size: 17px; }
.iyz .stats { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 22px; }
.iyz .stats span { padding: 6px 12px; border: 1px solid var(--line); border-radius: 999px; background: var(--card); font-size: 14px; color: var(--mut); }
.iyz .stats b { color: var(--ink); font-weight: 800; }
.iyz .stats .tot { background: var(--acc); border-color: var(--acc); color: #fff; }
.iyz .stats .tot b { color: #fff; }
/* Toolbar: search + style on the first row, display controls and copy on the second. */
.iyz .bar { display: flex; flex-direction: column; gap: 10px; margin-bottom: 22px; padding: 10px; background: color-mix(in srgb, var(--card) 88%, transparent); backdrop-filter: blur(10px); border: 1px solid var(--line-strong); border-radius: 16px; position: sticky; top: 8px; z-index: 5; box-shadow: var(--shadow-card); }
.iyz .bar-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.iyz .bar-search { position: relative; flex: 1 1 240px; min-width: 0; display: flex; }
.iyz .bar-search svg { position: absolute; left: 13px; top: 50%; width: 17px; height: 17px; transform: translateY(-50%); color: var(--mut); pointer-events: none; }
.iyz .bar-search input { width: 100%; height: 42px; padding: 0 14px 0 40px; border-radius: 11px; border: 1px solid var(--line); background: var(--bg-input); color: var(--ink); font: inherit; transition: border-color 160ms var(--ease), box-shadow 160ms var(--ease); }
.iyz .bar-search input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.iyz .seg { display: flex; gap: 2px; padding: 3px; background: var(--bg-input); border: 1px solid var(--line); border-radius: 11px; overflow-x: auto; scrollbar-width: none; max-width: 100%; }
.iyz .seg::-webkit-scrollbar { display: none; }
.iyz .seg button { flex: none; height: 34px; border: 0; background: none; color: var(--mut); font: inherit; font-size: 14px; font-weight: 600; padding: 0 13px; border-radius: 8px; cursor: pointer; white-space: nowrap; transition: color 160ms var(--ease), background 160ms var(--ease); }
.iyz .seg button:hover { color: var(--ink); background: var(--bg-card-hover); }
.iyz .seg button[aria-pressed=true] { background: var(--acc); color: #fff; box-shadow: 0 2px 8px rgba(118, 78, 249, .35); }
.iyz .seg button:focus-visible, .iyz .bar-switch input:focus-visible + span, .iyz .bar input[type=range]:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.iyz .bar-tools { padding: 2px 4px 0; gap: 8px 20px; border-top: 1px solid var(--line); padding-top: 10px; }
.iyz .bar-ctl, .iyz .bar-switch { display: inline-flex; align-items: center; gap: 9px; font-size: 13.5px; font-weight: 600; color: var(--mut); cursor: pointer; user-select: none; }
.iyz .bar input[type=range] { accent-color: var(--acc); width: 96px; margin: 0; cursor: pointer; }
.iyz .bar-ctl output { min-width: 2.6em; padding: 2px 6px; border-radius: 6px; background: var(--bg-input); color: var(--ink); font: 600 12px var(--mono); text-align: center; }
.iyz .bar-color input { width: 26px; height: 26px; padding: 0; border: 2px solid var(--line-strong); border-radius: 50%; background: none; cursor: pointer; overflow: hidden; }
.iyz .bar-color input::-webkit-color-swatch-wrapper { padding: 0; }
.iyz .bar-color input::-webkit-color-swatch { border: 0; border-radius: 50%; }
.iyz .bar-color input::-moz-color-swatch { border: 0; border-radius: 50%; }
.iyz .bar-switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.iyz .bar-switch span { position: relative; width: 32px; height: 18px; border-radius: 999px; background: var(--line-strong); transition: background 160ms var(--ease); }
.iyz .bar-switch span::after { content: ""; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: var(--ink-muted); transition: transform 160ms var(--ease), background 160ms var(--ease); }
.iyz .bar-switch input:checked + span { background: var(--acc); }
.iyz .bar-switch input:checked + span::after { transform: translateX(14px); background: #fff; }
.iyz .bar-count { margin-left: auto; font-size: 13px; color: var(--ink-dim); font-variant-numeric: tabular-nums; }
.iyz .bar .ifi-btn--primary svg { width: 16px; height: 16px; }
@media (max-width: 640px) {
  .iyz .bar { top: 4px; padding: 8px; }
  .iyz .bar-tools { gap: 10px 16px; }
  .iyz .bar-count { width: 100%; margin-left: 0; order: 9; }
  .iyz .bar .ifi-btn--primary { margin-left: auto; }
}
.iyz .grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 12px; }
.iyz .cell { content-visibility: auto; contain-intrinsic-size: auto 134px; display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 22px 8px 14px; background: var(--card); border: 1px solid var(--line); border-radius: 16px; cursor: pointer; color: var(--ink); font: inherit; }
.iyz .cell:hover, .iyz .cell:focus-visible { border-color: var(--acc); outline: none; box-shadow: 0 0 0 3px var(--accent-soft); }
.iyz .cell svg { width: 52px; height: 52px; color: var(--ic); }
.iyz .cell span { font-size: 13px; color: var(--mut); text-align: center; overflow-wrap: anywhere; line-height: 1.3; }
.iyz .empty { grid-column: 1/-1; }
.iyz .cell:hover svg path:last-of-type, .iyz .loop .cell svg path:last-of-type { stroke-dasharray: 1; animation: iyz-draw 1s ease-out; }
.iyz .loop .cell svg path:last-of-type { animation-iteration-count: infinite; }
@keyframes iyz-draw { from { stroke-dashoffset: 1 } to { stroke-dashoffset: 0 } }
@keyframes iyz-fadein { from { opacity: 0 } }
.iyz dialog { border: 1px solid var(--line-strong); border-radius: 20px; background: var(--card); color: var(--ink); padding: 0; width: min(720px, calc(100% - 24px)); max-height: calc(100% - 24px); }
.iyz dialog::backdrop { background: rgba(10, 8, 25, .65); }
.iyz .mi { padding: 20px; }
.iyz .mh { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.iyz .mh h2 { margin: 0; font-size: 22px; }
.iyz .mgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; }
.iyz .mv { display: flex; flex-direction: column; gap: 6px; padding: 16px; border: 1px solid var(--line); border-radius: 14px; background: var(--bg); }
.iyz .pv { display: grid; place-items: center; height: 96px; color: var(--ic); }
.iyz .pv svg { width: 72px; height: 72px; }
.iyz .mv small { color: var(--mut); font-size: 13px; flex: 1; }
.iyz .pv svg path:last-of-type { stroke-dasharray: 1; animation: iyz-draw 1.3s ease-out; }
.iyz .pv svg g:first-of-type { animation: iyz-fadein .9s ease-out; }
.iyz .ah { grid-column: 1/-1; margin: 8px 0 0; font-size: 14px; color: var(--mut); font-weight: 600; }
.iyz #toast { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom, 0px)); transform: translate(-50%, 20px); background: var(--ink); color: var(--bg); padding: 10px 18px; border-radius: 999px; font-weight: 600; opacity: 0; transition: .2s; pointer-events: none; }
.iyz #toast.on { opacity: 1; transform: translate(-50%, 0); }

@media (prefers-reduced-motion: reduce) {
  .iyz svg, .iyz svg *, .iyz-banner svg * { animation: none !important; }
}
.iyz .mv .ifi-btn { justify-content: center; }
/* Server-rendered name list: clicking a name searches the grid. */
.iyz .iyz-names summary { cursor: pointer; color: var(--accent); font-weight: 600; margin-bottom: .75rem; }
.iyz .iyz-names ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.iyz .iyz-names button { border: 1px solid var(--line); background: var(--card); color: var(--mut); font: 12.5px var(--mono); padding: 4px 9px; border-radius: 7px; cursor: pointer; }
.iyz .iyz-names button:hover { color: var(--ink); border-color: var(--accent); }
