/* PNG → ICO converter & favicon generator — tool-specific styles.
   Prefix: icg-   Colours come from the global tokens, so light and dark themes follow the site. */

/* display:flex/grid rules below would otherwise beat the [hidden] attribute. */
.icg-tool [hidden],
.icg-content [hidden] { display: none !important; }

.icg-tool {
    max-width: 760px;
    margin: 0 auto 2.5rem;
}

.icg-panel {
    background: var(--bg-primary, #fff);
    border: 1px solid var(--border-color, #e2e8f0);
    border-radius: var(--border-radius-lg, 12px);
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

/* ---------------------------------------------------------- drop zone */
.icg-drop {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .5rem;
    padding: 2.5rem 1.25rem;
    text-align: center;
    border: 2px dashed var(--border-color, #cbd5e1);
    border-radius: var(--border-radius-lg, 12px);
    background: var(--bg-secondary, #f8fafc);
    color: var(--text-primary, #1e293b);
    cursor: pointer;
    transition: border-color .15s ease, background-color .15s ease;
}
.icg-drop:hover,
.icg-drop.is-over { border-color: var(--primary-color, #0066cc); background: var(--bg-tertiary, #eef2f7); }
.icg-drop:focus-visible { outline: 3px solid var(--primary-color, #0066cc); outline-offset: 2px; }
.icg-drop-icon { font-size: 2rem; color: var(--primary-color, #0066cc); }
.icg-drop-title { font-size: 1.0625rem; line-height: 1.4; }
.icg-drop-hint { font-size: .9375rem; color: var(--text-secondary, #475569); }

/* ------------------------------------------------------- loaded image */
.icg-loaded { display: flex; gap: 1.25rem; align-items: center; flex-wrap: wrap; }
.icg-checker {
    flex: 0 0 auto;
    width: 160px; height: 160px;
    display: flex; align-items: center; justify-content: center;
    border: 1px solid var(--border-color, #e2e8f0);
    border-radius: var(--border-radius, 8px);
    background-color: #fff;
    background-image:
        linear-gradient(45deg, #e5e7eb 25%, transparent 25%, transparent 75%, #e5e7eb 75%),
        linear-gradient(45deg, #e5e7eb 25%, transparent 25%, transparent 75%, #e5e7eb 75%);
    background-size: 16px 16px;
    background-position: 0 0, 8px 8px;
    overflow: hidden;
}
.icg-checker canvas { max-width: 100%; max-height: 100%; display: block; }
.icg-loaded-info { flex: 1 1 220px; min-width: 0; display: flex; flex-direction: column; align-items: flex-start; gap: .5rem; }
.icg-name { margin: 0; font-weight: 600; font-size: 1.0625rem; color: var(--text-primary, #1e293b); overflow-wrap: anywhere; }
.icg-meta { margin: 0; font-size: .9375rem; color: var(--text-secondary, #475569); }

.icg-note {
    margin: 0;
    padding: .75rem 1rem;
    border-radius: var(--border-radius, 8px);
    border: 1px solid var(--border-color, #e2e8f0);
    border-left: 4px solid var(--warning-color, #d97706);
    background: var(--bg-secondary, #f8fafc);
    color: var(--text-primary, #1e293b);
    font-size: .9375rem;
    line-height: 1.5;
}

/* ------------------------------------------------------------ options */
.icg-options { display: flex; flex-direction: column; gap: 1rem; }
.icg-presets { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }
.icg-label { font-size: .9375rem; font-weight: 600; color: var(--text-primary, #1e293b); margin-right: .25rem; }

.icg-chip {
    min-height: 44px;
    padding: .5rem 1rem;
    border: 1px solid var(--border-color, #cbd5e1);
    border-radius: 999px;
    background: var(--bg-primary, #fff);
    color: var(--text-primary, #1e293b);
    font: inherit;
    font-size: .9375rem;
    cursor: pointer;
    transition: border-color .15s ease, background-color .15s ease;
}
.icg-chip:hover { border-color: var(--primary-color, #0066cc); }
.icg-chip[aria-pressed="true"] {
    border-color: var(--primary-color, #0066cc);
    background: var(--bg-tertiary, #eef2f7);
    box-shadow: inset 0 0 0 1px var(--primary-color, #0066cc);
    font-weight: 600;
}
.icg-chip:focus-visible,
.icg-btn:focus-visible,
.icg-check input:focus-visible,
.icg-more summary:focus-visible,
.icg-color input:focus-visible,
.icg-snippet:focus-visible { outline: 3px solid var(--primary-color, #0066cc); outline-offset: 2px; }

.icg-more { border: 1px solid var(--border-color, #e2e8f0); border-radius: var(--border-radius, 8px); background: var(--bg-secondary, #f8fafc); }
.icg-more summary {
    min-height: 44px;
    display: flex; align-items: center;
    padding: 0 1rem;
    cursor: pointer;
    font-weight: 600;
    font-size: .9375rem;
    color: var(--text-primary, #1e293b);
}
.icg-more-body { padding: .25rem 1rem 1rem; display: flex; flex-direction: column; gap: 1rem; }
.icg-fieldset { border: 0; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: .5rem 1rem; align-items: center; min-width: 0; }
.icg-fieldset legend { padding: 0; margin-bottom: .5rem; font-size: .9375rem; font-weight: 600; color: var(--text-primary, #1e293b); }
.icg-check { display: inline-flex; align-items: center; gap: .5rem; min-height: 44px; font-size: .9375rem; color: var(--text-primary, #1e293b); cursor: pointer; }
.icg-check input { width: 20px; height: 20px; margin: 0; accent-color: var(--primary-color, #0066cc); }
.icg-color input { width: 44px; height: 44px; padding: 2px; border: 1px solid var(--border-color, #cbd5e1); border-radius: var(--border-radius-sm, 6px); background: var(--bg-primary, #fff); cursor: pointer; }
.icg-color input:disabled { opacity: .45; cursor: not-allowed; }
.icg-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ------------------------------------------------------------ buttons */
.icg-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
    min-height: 48px;
    padding: .625rem 1.5rem;
    border: 1px solid transparent;
    border-radius: var(--border-radius, 8px);
    font: inherit;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: background-color .15s ease, border-color .15s ease;
}
.icg-btn:disabled { opacity: .5; cursor: not-allowed; }
/* --btn-primary-* are defined for both themes (dark: #2563eb + white = 5.2:1); --primary-color is lightened in dark mode and fails with white text. */
.icg-btn-primary { background: var(--btn-primary-bg, #0066cc); color: var(--btn-primary-fg, #fff); }
.icg-btn-primary:hover:not(:disabled) { background: var(--btn-primary-hover, #0052a3); }
.icg-btn-secondary { background: var(--bg-primary, #fff); color: var(--primary-color, #0066cc); border-color: var(--primary-color, #0066cc); }
.icg-btn-secondary:hover:not(:disabled) { background: var(--bg-tertiary, #eef2f7); }
.icg-btn-quiet { background: transparent; color: var(--text-primary, #1e293b); border-color: var(--border-color, #cbd5e1); }
.icg-btn-quiet:hover:not(:disabled) { background: var(--bg-tertiary, #eef2f7); }
.icg-btn-sm { min-height: 44px; padding: .5rem 1rem; font-size: .9375rem; }
#icgCreate { align-self: flex-start; }

/* ------------------------------------------------------------- status */
.icg-status { margin: 0; font-size: 1rem; line-height: 1.5; color: var(--text-primary, #1e293b); }
.icg-status-error {
    padding: .75rem 1rem;
    border-radius: var(--border-radius, 8px);
    border: 1px solid var(--error-color, #dc2626);
    border-left-width: 4px;
    color: var(--text-primary, #1e293b);
    background: var(--bg-secondary, #f8fafc);
}

/* ------------------------------------------------------------- result */
.icg-result { display: flex; flex-direction: column; gap: 1rem; padding-top: 1.25rem; border-top: 1px solid var(--border-color, #e2e8f0); }
.icg-result-title { margin: 0; font-size: 1.125rem; color: var(--text-primary, #1e293b); }
.icg-thumbs { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: .75rem; }
.icg-thumb {
    display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: .25rem;
    min-width: 76px;
    padding: .625rem;
    border: 1px solid var(--border-color, #e2e8f0);
    border-radius: var(--border-radius, 8px);
    background: var(--bg-secondary, #f8fafc);
    font-size: .875rem;
    color: var(--text-primary, #1e293b);
}
.icg-thumb img {
    image-rendering: auto;
    background-color: #fff;
    background-image:
        linear-gradient(45deg, #e5e7eb 25%, transparent 25%, transparent 75%, #e5e7eb 75%),
        linear-gradient(45deg, #e5e7eb 25%, transparent 25%, transparent 75%, #e5e7eb 75%);
    background-size: 8px 8px;
    background-position: 0 0, 4px 4px;
    border-radius: 2px;
}
.icg-thumb small { color: var(--text-secondary, #475569); font-size: .8125rem; }
.icg-actions { display: flex; flex-wrap: wrap; gap: .75rem; }

.icg-snippet-wrap { display: flex; flex-direction: column; gap: .5rem; }
.icg-snippet-head { display: flex; align-items: center; justify-content: space-between; gap: .75rem; flex-wrap: wrap; }
.icg-snippet {
    margin: 0;
    padding: .875rem 1rem;
    overflow-x: auto;
    border: 1px solid var(--border-color, #e2e8f0);
    border-radius: var(--border-radius, 8px);
    background: var(--bg-secondary, #f8fafc);
    color: var(--text-primary, #1e293b);
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: .875rem;
    line-height: 1.6;
    white-space: pre;
}

.icg-foot { margin: 0; font-size: .9375rem; color: var(--text-secondary, #475569); }
.icg-foot i { margin-right: .35rem; color: var(--success-color, #059669); }

/* ---------------------------------------------------- ICO → PNG page */
.icp-loaded { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.icp-result { padding-top: 0; border-top: 0; }
.icp-list { gap: 1rem; }
.icp-card { min-width: 132px; padding: .875rem; gap: .5rem; text-align: center; }
.icp-card .icg-btn { width: 100%; }
.icp-bad { font-weight: 600; }

/* ------------------------------------------------------------ content */
.icg-content { max-width: 760px; margin: 0 auto 3rem; color: var(--text-primary, #1e293b); }
.icg-content h2 { font-size: 1.375rem; margin: 2rem 0 .75rem; }
.icg-content h3 { font-size: 1.0625rem; margin: 0 0 .25rem; }
.icg-content p, .icg-content li { font-size: 1rem; line-height: 1.65; color: var(--text-primary, #1e293b); }
.icg-content p { margin: 0 0 1rem; }
.icg-content code { padding: .1rem .35rem; border-radius: 4px; background: var(--bg-tertiary, #eef2f7); font-size: .9em; }
.icg-table-wrap { overflow-x: auto; margin: 0 0 1rem; }
.icg-table { width: 100%; border-collapse: collapse; font-size: 1rem; }
.icg-table th, .icg-table td { text-align: left; padding: .625rem .75rem; border-bottom: 1px solid var(--border-color, #e2e8f0); vertical-align: top; }
.icg-table th { font-size: .9375rem; color: var(--text-secondary, #475569); }
.icg-table td:first-child { white-space: nowrap; font-weight: 600; }
.icg-content .faq-item { margin: 0 0 1rem; }
.icg-related { padding-left: 1.25rem; }
.icg-related a { color: var(--primary-color, #0066cc); }

@media (max-width: 560px) {
    .icg-panel { padding: 1rem; }
    .icg-btn { width: 100%; }
    #icgCreate { align-self: stretch; }
    .icg-btn-sm { width: auto; }
    .icg-checker { width: 128px; height: 128px; }
}

@media (prefers-reduced-motion: reduce) {
    .icg-drop, .icg-chip, .icg-btn { transition: none; }
}
