/* frogsymbols - tool-specific styling on top of the shared web-tool shell.
   The shell (/shared/tool-shell.css) supplies the :root tokens,
   the topnav header, page-hero, layout, footer, and ad slots in 16px
   Montserrat. frogsymbols' search/grid/export UI is designed for a 13px
   monospace console look, so the tool surfaces scope mono + 13px to
   themselves while the shared header stays sans/16px. */

/* Bundled outline faces. One @font-face per bundled entry in
   js/font-faces.js (cssFamily -> the same TTF). font-display:swap so the
   browse grid never blocks on the multi-MB font: it paints in the native
   font first, then swaps to the face once loaded.

   Face theming mechanism: app.js writes the selected face's cssFamily
   straight onto each grid glyph (.cell-glyph) and the preview meta-glyph
   (#metaGlyph) as an inline font-family ('' for the system face). Inline
   style works for any registry entry without a per-id CSS rule, so adding a
   face stays a one-liner in font-faces.js + one @font-face below. */
@font-face {
    font-family: 'FS_NotoEmoji';
    src: url('./fonts/NotoEmoji-Regular.ttf') format('truetype');
    font-display: swap;
}
@font-face {
    font-family: 'FS_NotoSymbols';
    src: url('./fonts/NotoSansSymbols2-Regular.ttf') format('truetype');
    font-display: swap;
}

/* Tool content: mono console theme, scoped so it does not touch the
   shared header / hero / footer. */
.tool-content {
    font-family: var(--mono);
    font-size: 13px;
    line-height: 1.45;
    gap: 0;
}

/* Search bar */
.search-bar {
    display: grid;
    grid-template-columns: 1fr auto auto auto;
    gap: 10px;
    margin-bottom: 14px;
}
.search-input {
    width: 100%;
    padding: 10px 12px;
    background: var(--surface-dark);
    border: 1px solid var(--border-dark);
    color: var(--text-light);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 14px;
}
.search-input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-focus);
}
.search-hint {
    margin: -6px 0 14px;
    font-size: 12px;
    color: var(--muted);
    letter-spacing: 0.04em;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 10px 16px;
    background: var(--accent);
    color: #07140d;
    border: none;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.02em;
    cursor: pointer;
}
.btn:hover { background: var(--accent-dark); color: #fff; }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn--ghost {
    background: transparent;
    color: var(--text-light);
    border: 1px solid var(--border-dark);
}
.btn--ghost:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-soft);
}

/* Filter chips */
.chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 18px;
}
.chip {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    padding: 6px 16px;
    background: transparent;
    border: 1px solid var(--border-dark);
    color: var(--muted);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 12px;
    letter-spacing: 0.04em;
    cursor: pointer;
}
.chip:hover { border-color: var(--accent); color: var(--accent); }
.chip[aria-pressed="true"] {
    background: var(--accent-soft);
    border-color: var(--accent);
    color: var(--accent);
}

/* Font-face selector - sits under the filter chips, themes browse + export. */
.face-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 18px;
}
.face-row label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--muted);
    font-weight: 700;
}
#fontFace {
    min-height: 40px;
    padding: 6px 12px;
    background: var(--surface-dark);
    border: 1px solid var(--border-dark);
    color: var(--text-light);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 12px;
    letter-spacing: 0.04em;
    cursor: pointer;
    max-width: 100%;
}
#fontFace:hover { border-color: var(--accent); }
#fontFace:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-focus);
}

/* Pagination */
.pager {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 16px 0;
    flex-wrap: wrap;
}
.pager-info {
    color: var(--muted);
    font-size: 12px;
    letter-spacing: 0.04em;
}

/* Symbol grid */
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 10px;
}
.cell {
    background: var(--surface-dark);
    border: 1px solid var(--border-dark);
    border-radius: var(--radius-sm);
    padding: 12px 10px 10px;
    cursor: pointer;
    text-align: center;
    transition: border-color 80ms ease, background 80ms ease;
}
.cell:hover, .cell:focus-visible {
    border-color: var(--accent);
    background: var(--accent-soft);
    outline: none;
}
.cell-glyph {
    font-family: var(--mono);
    font-size: 36px;
    line-height: 1;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-light);
}
.cell-int {
    font-size: 11px;
    color: var(--text-light);
    margin-top: 8px;
    letter-spacing: 0.02em;
}
.cell-hex {
    font-size: 10px;
    color: var(--muted);
    margin-top: 2px;
    letter-spacing: 0.04em;
    word-break: break-all;
}
.cell-name {
    font-size: 10px;
    color: var(--muted);
    margin-top: 6px;
    letter-spacing: 0.02em;
    line-height: 1.3;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.empty {
    padding: 32px 12px;
    text-align: center;
    color: var(--muted);
    border: 1px dashed var(--border-dark);
    border-radius: var(--radius-md);
}

/* Export panel - side-pane on desktop, full-screen on mobile. Lives
   outside .tool-content in the DOM, so it sets its own mono font. */
.panel-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(7, 9, 11, 0.65);
    display: none;
    z-index: 10;
}
.panel-backdrop[data-open="true"] { display: block; }

.panel {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: min(440px, 100vw);
    background: var(--surface-dark);
    border-left: 1px solid var(--border-dark);
    transform: translateX(100%);
    transition: transform 160ms ease;
    z-index: 11;
    display: flex;
    flex-direction: column;
    font-family: var(--mono);
    font-size: 13px;
    line-height: 1.45;
}
.panel[data-open="true"] { transform: translateX(0); }

.panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-dark);
}
.panel-title {
    font-size: 12px;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--accent);
}
.panel-close {
    background: transparent;
    border: 1px solid var(--border-dark);
    color: var(--muted);
    width: 28px;
    height: 28px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-family: inherit;
    font-size: 14px;
}
.panel-close:hover { border-color: var(--accent); color: var(--accent); }

.panel-body {
    padding: 16px;
    overflow-y: auto;
    display: grid;
    gap: 16px;
    flex: 1;
}

.field { display: grid; gap: 6px; }
.field label {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--muted);
    font-weight: 700;
}
.field input[type="text"],
.field input[type="number"] {
    width: 100%;
    padding: 10px 12px;
    background: var(--bg-dark);
    border: 1px solid var(--border-dark);
    color: var(--text-light);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 13px;
}
.field input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-focus);
}
.field input[type="range"] {
    width: 100%;
    accent-color: var(--accent);
}
.field input[type="color"] {
    width: 100%;
    height: 40px;
    background: var(--bg-dark);
    border: 1px solid var(--border-dark);
    border-radius: var(--radius-sm);
    padding: 3px;
    cursor: pointer;
}
.color-row {
    display: grid;
    grid-template-columns: 60px 1fr;
    gap: 8px;
}

.preview-stage {
    background: var(--bg-deep);
    border: 1px solid var(--border-dark);
    border-radius: var(--radius-md);
    padding: 16px;
    display: grid;
    place-items: center;
    min-height: 220px;
}
.preview-stage canvas {
    max-width: 100%;
    max-height: 260px;
    display: block;
    image-rendering: auto;
}

.meta-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    font-size: 11px;
    color: var(--muted);
    letter-spacing: 0.04em;
}
.meta-row strong {
    display: block;
    color: var(--text-light);
    font-weight: 700;
    font-size: 12px;
    margin-bottom: 2px;
}

/* Download buttons row inside the export panel - SVG + PNG side-by-side,
   stacks on narrow viewports. */
.download-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

/* Right-click context menu. Hidden until data-open="true". Positioned
   programmatically in app.js, clamped to viewport. */
.ctxmenu {
    position: fixed;
    top: 0;
    left: 0;
    min-width: 160px;
    background: var(--surface-dark);
    border: 1px solid var(--border-dark);
    border-radius: var(--radius-sm);
    padding: 4px;
    display: none;
    z-index: 20;
    font-family: var(--mono);
}
.ctxmenu[data-open="true"] { display: block; }
.ctxmenu-item {
    display: block;
    width: 100%;
    background: transparent;
    border: none;
    color: var(--text-light);
    padding: 8px 12px;
    text-align: left;
    font-family: inherit;
    font-size: 12px;
    letter-spacing: 0.02em;
    border-radius: var(--radius-sm);
    cursor: pointer;
}
.ctxmenu-item:hover, .ctxmenu-item:focus-visible {
    background: var(--accent-soft);
    color: var(--accent);
    outline: none;
}

.warn {
    display: none;
    color: #ffdede;
    background: rgba(255, 107, 107, 0.10);
    border: 1px solid rgba(255, 107, 107, 0.4);
    border-radius: var(--radius-sm);
    padding: 10px 12px;
    font-size: 12px;
}
.warn[data-visible="true"] { display: block; }

/* Mobile breakpoints */
@media (max-width: 600px) {
    .grid { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 8px; }
    .cell-glyph { font-size: 30px; height: 38px; }
    .search-bar { grid-template-columns: 1fr; }
    .panel { width: 100vw; border-left: none; }
    .download-row { grid-template-columns: 1fr; }
}

@media (max-width: 375px) {
    .grid { grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); }
    .cell-glyph { font-size: 26px; height: 34px; }
}
