/* Timeline: an NES/SNES-gray look. Pixel font for titles and years, plain text for the rest. */
:root {
    --bg: #d1d1d1;        /* console body */
    --panel: #a0a0a0;     /* darker plastic */
    --ink: #222222;
    --ink-soft: #444444;
    --muted: #595959;
    --paper: #eeeeee;
    --accent: #5850ae;    /* SNES purple */
    --accent-dark: #46408a;
    --pixel: 'Press Start 2P', monospace;
    --top-h: 120px;       /* set from the header's real height */
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html { scroll-padding-top: var(--top-h); }

body {
    margin: 0;
    font-family: Arial, Helvetica, sans-serif;
    background: var(--bg);
    color: var(--ink);
}

.visually-hidden {
    position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

/* ---- Header and toolbar (sticky) ---- */
.top {
    position: sticky;
    top: 0;
    z-index: 20;
    background: var(--panel);
    border-bottom: 3px solid var(--ink-soft);
    padding: 10px 20px 12px;
}
.title-row { display: flex; align-items: baseline; gap: 16px; }
.header-title {
    font-family: var(--pixel);
    font-weight: normal;
    font-size: 1.4em;
    margin: 0;
}
.count { font-size: 0.85em; color: var(--ink); }

.toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 12px;
    margin-top: 10px;
}
.search input, .year-jump select {
    font: inherit;
    font-size: 0.95em;
    padding: 6px 10px;
    border: 2px solid var(--ink-soft);
    border-radius: 0;
    background: var(--paper);
    color: var(--ink);
}
.search input { width: 220px; }
.year-jump { display: none; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
    font: inherit;
    font-size: 0.85em;
    padding: 4px 10px;
    border: 2px solid var(--ink-soft);
    border-radius: 0;
    background: var(--bg);
    color: var(--ink);
    cursor: pointer;
    white-space: nowrap;
}
.chip:hover { background: var(--paper); }
.chip[aria-pressed="true"] { background: var(--accent); border-color: var(--accent-dark); color: #fff; }

/* ---- Layout: year rail + wall ---- */
.layout { display: flex; align-items: flex-start; }

.rail {
    position: sticky;
    top: var(--top-h);
    flex: 0 0 170px;
    max-height: calc(100vh - var(--top-h));
    overflow-y: auto;
    background: var(--panel);
    padding: 14px 14px 20px;
    scrollbar-width: thin;
    scrollbar-color: var(--accent) var(--ink-soft);
}
.decade { margin-bottom: 12px; }
.decade-label {
    font-family: var(--pixel);
    font-size: 0.6em;
    color: var(--ink);
    margin-bottom: 4px;
    border-bottom: 2px solid var(--ink-soft);
    padding-bottom: 4px;
}
.decade-years { display: grid; grid-template-columns: 1fr 1fr; }
.rail a {
    font-family: var(--pixel);
    font-size: 0.65em;
    color: var(--ink);
    text-decoration: none;
    padding: 5px 4px;
}
.rail a:hover { background: var(--paper); }
.rail a.current { background: var(--accent); color: #fff; }
.rail a.none { color: var(--muted); opacity: 0.5; }

main { flex: 1; min-width: 0; padding: 0 20px 40px; }

.year { margin-top: 8px; }
.year h2 {
    position: sticky;
    top: var(--top-h);
    z-index: 5;
    margin: 0 -20px 14px;
    padding: 10px 20px;
    background: var(--bg);
    border-bottom: 2px solid var(--panel);
    font-family: var(--pixel);
    font-weight: normal;
    font-size: 1.1em;
    color: var(--accent-dark);
}

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
}

.tile {
    display: flex;
    flex-direction: column;
    border: 2px solid var(--panel);
    background: var(--bg);
    padding: 12px;
    text-align: center;
}
.tile img {
    width: 100%;
    height: 150px;
    object-fit: contain;
    background: var(--paper);
    border: 1px solid var(--panel);
}
.tile .credit {
    margin-top: 4px;
    font-size: 0.65em;
    color: var(--muted);
    text-decoration: none;
    overflow-wrap: anywhere;
}
.tile .credit:hover { text-decoration: underline; }
.tile .caption { font-size: 0.9em; margin: 8px 0 6px; flex-grow: 1; }
.tile .category { font-size: 0.8em; color: var(--muted); font-style: italic; margin: 0; }

.empty, .loading { padding: 40px 0; text-align: center; }

/* ---- Footer ---- */
#credits {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    padding: 12px 20px;
    background: var(--panel);
    border-top: 3px solid var(--ink-soft);
    font-size: 0.8em;
    color: var(--ink);
}
#credits a { color: var(--ink); }
#credits a:hover { color: var(--accent); }
#credits .gh { line-height: 0; }
.github-icon { width: 18px; height: 18px; }

/* ---- Phones and narrow windows: picker instead of rail, chips scroll sideways ---- */
@media (max-width: 760px) {
    .top { padding: 8px 12px 10px; }
    .header-title { font-size: 1em; }
    .rail { display: none; }
    main { padding: 0 12px 32px; }
    .year h2 { margin: 0 -12px 12px; padding: 8px 12px; font-size: 0.95em; }
    .toolbar { flex-wrap: nowrap; display: grid; grid-template-columns: 1fr auto; }
    .search input { width: 100%; }
    .year-jump { display: block; }
    .chips {
        grid-column: 1 / -1;
        flex-wrap: nowrap;
        overflow-x: auto;
        scrollbar-width: none;
        margin: 0 -12px;
        padding: 0 12px 2px;
    }
    .chips::-webkit-scrollbar { display: none; }
    .grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
    .tile { padding: 8px; }
    .tile img { height: 120px; }
    #credits { justify-content: center; text-align: center; }
}
