/* ═══════════════════════════════════════════════
   hologram: modules reference styles

   Chrome (reset, header, glitch title, tool nav, footer) comes from
   ware/shell/app-shell.css, linked ahead of this file. This file owns the
   palette and the reference list. Same six base colours as
   ware/hologram/index.html, so the two pages read as one project.

   app-shell.css reads --bg, --surface, --border, --text, --dim and --accent
   with no fallbacks and defines none of them; scripts/check-shell-tokens.mjs
   fails the build if this file stops defining all six.
   ═══════════════════════════════════════════════ */

/* -- PALETTE -- */
:root {
    --bg: #14141b;
    --surface: #1c1b26;
    --panel: #232232;
    --border: #33304a;
    --text: #e8e6f0;
    --dim: #9d99b5;
    --accent: #c45fff;
    --accent2: #7cc7ff;
    --row-border: #2a2940;

    /* -- SHELL OVERRIDES -- */
    --scanline:      rgba(196,95,255,0.03);
    --title-size:    14px;
    --title-color:   var(--accent);
    --title-glow:    0 0 12px rgba(196,95,255,0.3);
    --glitch-speed:  3s;
    --glitch-tint-1: rgba(0,245,255,0.25);
    --glitch-tint-2: rgba(255,61,110,0.25);
    --footer-pad:    10px 24px;
    --backlink-color: var(--accent2);
    --backlink-hover: #ffffff;
    --backlink-glow:  var(--accent);
    --backlink-hover-border: var(--accent);
}

a { color: var(--accent2); }

/* -- HEADER -- */
.header-stat {
    font-family: 'Courier Prime', monospace;
    font-size: 10px;
    color: var(--dim);
}
.header-stat span { color: var(--accent); }

/* The spectral sweep from index.html, as a hairline under the header. */
header {
    position: relative;
}
header::after {
    content: '';
    position: absolute;
    left: 0; right: 0; bottom: -1px;
    height: 2px;
    background: linear-gradient(90deg,
      #7a5cff 0%, #2f6bff 17%, #00f5ff 33%,
      #39ff6e 50%, #ffe03a 67%, #ff7c1f 83%, #ff3d6e 100%);
    opacity: .55;
}

/* -- MAIN -- */
main {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: 20px 24px;
}

/* -- SEARCH -- */
.search-row {
    display: flex;
    gap: 0;
    margin-bottom: 16px;
    flex-shrink: 0;
}
.search-input {
    flex: 1;
    font-family: 'Courier Prime', monospace;
    font-size: 12px;
    background: var(--surface);
    color: var(--accent2);
    border: 1px solid var(--border);
    border-right: none;
    padding: 10px 14px;
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.search-input::placeholder { color: #4a4660; }
.search-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 12px rgba(196,95,255,0.12);
}
.search-clear {
    font-family: 'Press Start 2P', monospace;
    font-size: 7px;
    background: var(--surface);
    color: var(--dim);
    border: 1px solid var(--border);
    padding: 0 14px;
    cursor: pointer;
    transition: color 0.15s, border-color 0.15s;
    letter-spacing: 0.05em;
}
.search-clear:hover {
    color: var(--accent);
    border-color: var(--accent);
}

/* -- MODULE TABS -- */
.module-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 3px;
    margin-bottom: 16px;
    flex-shrink: 0;
}
.module-tab {
    font-family: 'Press Start 2P', monospace;
    font-size: 7px;
    background: none;
    color: var(--dim);
    border: 1px solid transparent;
    padding: 5px 8px;
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
}
.module-tab:hover {
    color: var(--accent2);
    border-color: var(--border);
}
.module-tab.active {
    color: var(--accent);
    border-color: var(--accent);
    text-shadow: 0 0 6px rgba(196,95,255,0.3);
}

/* -- STATS -- */
.stats-bar {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
    font-family: 'Courier Prime', monospace;
    font-size: 10px;
    color: var(--dim);
    flex-shrink: 0;
}
.stats-bar .stat-count { color: var(--accent2); }
.stats-bar .stat-sep { color: var(--border); }

/* -- MODULES CONTAINER (scrollable) -- */
#modules {
    flex: 1;
    overflow-y: auto;
    padding-right: 8px;
}
#modules::-webkit-scrollbar { width: 6px; }
#modules::-webkit-scrollbar-track { background: var(--surface); }
#modules::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
#modules::-webkit-scrollbar-thumb:hover { background: var(--dim); }

/* -- MODULE SECTIONS -- */
.module-section { margin-bottom: 24px; }
.module-section[hidden] { display: none; }

.module-header {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    padding: 10px 14px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-left: 3px solid var(--accent);
    margin-bottom: 10px;
}
.module-header h2 {
    font-family: 'Press Start 2P', monospace;
    font-size: 10px;
    font-weight: 400;
    color: var(--accent);
    text-shadow: 0 0 6px rgba(196,95,255,0.2);
    margin: 0;
}
.module-header .module-file {
    font-family: 'Courier Prime', monospace;
    font-size: 10px;
    color: var(--dim);
}
.module-header .module-count {
    font-family: 'Courier Prime', monospace;
    font-size: 10px;
    color: var(--accent2);
    margin-left: auto;
}

.module-desc {
    font-family: 'Courier Prime', monospace;
    font-size: 11px;
    line-height: 1.65;
    color: var(--dim);
    margin: 0 0 12px;
    padding-left: 3px;
    max-width: 78ch;
}
.module-desc + .module-desc { margin-top: -6px; }

/* -- TYPES AND CONSTANTS -- */
.types {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 10px 14px;
    margin-bottom: 12px;
    overflow-x: auto;
}
.types .types-label {
    font-family: 'Press Start 2P', monospace;
    font-size: 7px;
    color: var(--dim);
    letter-spacing: 0.05em;
    display: block;
    margin-bottom: 8px;
}
.types pre {
    font-family: 'Courier Prime', monospace;
    font-size: 11px;
    line-height: 1.6;
    color: var(--text);
    white-space: pre;
}
.types pre .c { color: #6b6785; }

/* -- FUNCTIONS -- */
.fn {
    border-bottom: 1px solid var(--row-border);
    padding: 9px 3px 10px;
}
.fn:last-child { border-bottom: 0; }
.fn[hidden] { display: none; }

.fn .sig {
    display: block;
    font-family: 'Courier Prime', monospace;
    font-size: 12px;
    color: var(--text);
    white-space: pre-wrap;
    margin-bottom: 4px;
}
.fn .sig b {
    color: var(--accent2);
    font-weight: 700;
}

.fn .fn-desc {
    font-family: 'Courier Prime', monospace;
    font-size: 11px;
    line-height: 1.6;
    color: var(--dim);
    max-width: 78ch;
}

/* -- EMPTY STATE -- */
.no-results {
    font-family: 'Courier Prime', monospace;
    font-size: 12px;
    color: var(--dim);
    padding: 24px 3px;
}
.no-results[hidden] { display: none; }

/* -- FOOTER -- */
/* padding, border and flex-shrink come from the shell. */
footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    background: var(--bg);
}
footer .footer-left {
    font-family: 'Courier Prime', monospace;
    font-size: 10px;
    color: var(--dim);
}
footer .footer-right {
    font-family: 'Press Start 2P', monospace;
    font-size: 6px;
    color: var(--dim);
    letter-spacing: 0.1em;
    white-space: nowrap;
}
footer .footer-right span { color: var(--accent); }

/* -- MOBILE -- */
@media (max-width: 640px) {
    header { padding: 12px 16px; }
    h1.glitch { font-size: 11px; }
    .header-right { gap: 8px; }
    main { padding: 16px 14px; }
    .module-tabs { gap: 2px; }
    .module-tab { font-size: 6px; padding: 4px 6px; }
    .module-header .module-count { margin-left: 0; }
}
