/* ============================================================
   byteCoder — Bookmark Grid
   Complements billheyman.com: same monospace font, same palette,
   same content-first minimalism.
   ============================================================ */

/* --- Reset & Base --- */

*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Courier New', Courier, monospace;
    font-size: 15px;
    line-height: 1.6;
    color: #333;
    background: #fff;
}

a {
    color: #0066cc;
    text-decoration: none;
}

a:hover {
    color: #0052a3;
    text-decoration: underline;
}

/* --- Header --- */

header {
    border-bottom: 1px solid #ddd;
    padding: 1em 1.5em;
    position: sticky;
    top: 0;
    background: #fff;
    z-index: 100;
}

.header-inner {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 1.5em;
}

.logo {
    font-size: 1.4em;
    font-weight: bold;
    color: #333;
    white-space: nowrap;
    letter-spacing: -0.5px;
}

.logo:hover {
    color: #0066cc;
    text-decoration: none;
}

.tagline {
    font-size: 0.85em;
    color: #888;
    white-space: nowrap;
}

.tagline a {
    color: #0066cc;
}

.count {
    font-size: 0.8em;
    color: #888;
    white-space: nowrap;
}

.search-wrap {
    flex: 1;
    max-width: 400px;
}

#search {
    width: 100%;
    font-family: inherit;
    font-size: 0.9em;
    padding: 0.5em 0.75em;
    border: 1px solid #ddd;
    border-radius: 3px;
    background: #f9f9f9;
    color: #333;
    outline: none;
    transition: border-color 0.2s;
}

#search:focus {
    border-color: #0066cc;
    background: #fff;
}

/* --- Filter Pills --- */

nav#filters {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0.75em 1.5em;
    border-bottom: 1px solid #ddd;
    display: flex;
    flex-wrap: wrap;
    gap: 0.4em;
    align-items: center;
}

.pill {
    font-family: inherit;
    font-size: 0.8em;
    padding: 0.3em 0.7em;
    border: 1px solid #ddd;
    border-radius: 3px;
    background: #f0f0f0;
    color: #555;
    cursor: pointer;
    transition: background 0.2s, color 0.2s, border-color 0.2s;
    white-space: nowrap;
}

.pill:hover {
    background: #e0e0e0;
    border-color: #ccc;
}

.pill.active {
    background: #0066cc;
    color: #fff;
    border-color: #0066cc;
}

.pill-divider {
    width: 1px;
    height: 1.2em;
    background: #ddd;
    margin: 0 0.3em;
}

/* --- Card Grid --- */

main {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1.5em;
}

.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.25em;
}

/* --- Card --- */

.card {
    border: 1px solid #ddd;
    border-radius: 3px;
    background: #f9f9f9;
    overflow: hidden;
    transition: box-shadow 0.2s;
    display: flex;
    flex-direction: column;
}

.card:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.card-img {
    width: 100%;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    display: block;
    background: #e8e8e8;
}

.card-img.placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    color: #bbb;
    font-size: 2em;
}

.card-body {
    padding: 1em;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.5em;
}

.card-title {
    font-size: 0.95em;
    font-weight: bold;
    color: #333;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.card-title a {
    color: inherit;
}

.card-title a:hover {
    color: #0066cc;
}

.card-detail {
    font-size: 0.85em;
    color: #555;
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    flex: 1;
}

.card-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.75em;
    color: #888;
    margin-top: auto;
    padding-top: 0.5em;
    border-top: 1px solid #eee;
}

.card-date {
    white-space: nowrap;
}

.card-source {
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: bold;
}

.card-source.x { color: #333; }
.card-source.feedly { color: #2bb24c; }

/* --- Category Badges --- */

.card-categories {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3em;
}

.badge {
    font-size: 0.7em;
    padding: 0.15em 0.5em;
    border-radius: 2px;
    background: #e8e8e8;
    color: #666;
    white-space: nowrap;
}

/* --- Loading / Empty States --- */

.loading, .empty {
    text-align: center;
    padding: 2em;
    color: #888;
    font-size: 0.95em;
}

.loading[aria-hidden="true"],
.empty[aria-hidden="true"] {
    display: none;
}

/* --- Footer --- */

footer {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2em 1.5em;
    border-top: 1px solid #ddd;
    text-align: center;
    font-size: 0.85em;
    color: #888;
}

/* --- Responsive --- */

@media (max-width: 600px) {
    .header-inner {
        flex-direction: column;
        align-items: stretch;
        gap: 0.75em;
    }

    .logo {
        text-align: center;
    }

    .search-wrap {
        max-width: 100%;
    }

    nav#filters {
        padding: 0.5em 1em;
    }

    main {
        padding: 1em;
    }

    .card-grid {
        grid-template-columns: 1fr;
        gap: 1em;
    }
}

@media (min-width: 900px) {
    .card-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (min-width: 1100px) {
    .card-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* --- Print --- */

@media print {
    header, nav#filters, footer, .loading, .empty { display: none; }
    .card { break-inside: avoid; box-shadow: none; border: 1px solid #ccc; }
    .card-grid { grid-template-columns: repeat(2, 1fr); }
}
