/* Favicon Generator — a hero uploader (after="hide") over a split: the Preview
   card (every size, the downloads) and the HTML snippet on the left, source,
   background and shape on the right. The layout is styles/components/form.css;
   the size tiles, the source thumbnail, the colour well and the snippet are the
   page's own. */

/* ── Source row: checkered thumbnail, name over dimensions. */
.fg-source-thumb-wrap {
  flex: none;
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  background:
    linear-gradient(45deg, var(--checker-1) 25%, transparent 25%) 0 0 / 8px 8px,
    linear-gradient(-45deg, var(--checker-1) 25%, transparent 25%) 0 4px / 8px 8px,
    linear-gradient(45deg, transparent 75%, var(--checker-1) 75%) 4px -4px / 8px 8px,
    linear-gradient(-45deg, transparent 75%, var(--checker-1) 75%) -4px 0 / 8px 8px,
    var(--checker-2);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.fg-source-thumb {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.fg-source-meta { min-width: 0; }

.fg-source-name {
  display: block;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.fg-source-dims { font-family: var(--mono); }

/* ── Background colour row — dimmed and inert while Transparent is on (the
   JS toggles is-disabled). */
.fg-bg-color-row { transition: opacity var(--duration-snap) var(--ease-standard); }
.fg-bg-color-row.is-disabled {
  opacity: 0.35;
  pointer-events: none;
}

.fg-bg-color-controls {
  display: flex;
  align-items: center;
  gap: var(--row-gap);
}

input[type="color"].fg-color-input {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  cursor: pointer;
  padding: 2px;
  background: none;
  flex-shrink: 0;
}

.fg-color-hex {
  font-size: 13px;
  font-family: var(--mono);
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

/* ── Size tiles: as many across as fit, filling their flush row edge to edge
   (the row inherits the card's top corners). */
.fg-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 0;
}

.fg-size-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-4) var(--space-2) var(--space-3);
  border: none;
  background: var(--card-bg);
  color: inherit;
  font: inherit;
  cursor: pointer;
  user-select: none;
  transition: background var(--duration-snap) var(--ease-standard);
}

.fg-size-card:hover { background: var(--bg-hover); }
.fg-size-card:active { background: var(--bg-hover-strong); }

.fg-canvas-wrap {
  width: 64px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    linear-gradient(45deg, var(--checker-1) 25%, transparent 25%) 0 0 / 8px 8px,
    linear-gradient(-45deg, var(--checker-1) 25%, transparent 25%) 0 4px / 8px 8px,
    linear-gradient(45deg, transparent 75%, var(--checker-1) 75%) 4px -4px / 8px 8px,
    linear-gradient(-45deg, transparent 75%, var(--checker-1) 75%) -4px 0 / 8px 8px,
    var(--checker-2);
  border-radius: var(--radius-xs);
  overflow: hidden;
  flex-shrink: 0;
}

.fg-size-canvas { display: block; width: 64px; height: 64px; }

.fg-size-card[data-size="16"] .fg-size-canvas,
.fg-size-card[data-size="32"] .fg-size-canvas {
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

.fg-size-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  font-family: var(--mono);
  line-height: 1;
}

.fg-size-use {
  font-size: 10px;
  color: var(--text-muted);
  text-align: center;
  line-height: 1.3;
}

/* ── HTML snippet. */
.fg-html-hint {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.5;
}

.fg-html-code {
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.65;
  color: var(--text);
  background: var(--bg-recessed);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  overflow-x: auto;
  white-space: pre;
  margin: 0;
}

/* On a phone the three actions can't share one line; when they wrap, let
   each line's buttons share its width so the tray reads as even rows
   instead of ragged right-aligned leftovers. */
@media (max-width: 480px) {
  #fg-copy-html,
  #fg-dl-ico,
  #fg-dl-zip {
    flex: 1 1 auto;
  }
}
