/* ── Theme variables ── */
:root {
    --bg:            #fff;
    --fg:            #111;
    --fg-muted:      #6b7280;
    --fg-subtle:     #9ca3af;
    --border:        #e5e7eb;
    --accent:        #2563eb;
    --row-hover:     #f5f7ff;
    --tag-bg:        #dbeafe;
    --tag-fg:        #1e40af;
    --year-line:     #e5e7eb;
    --year-fg:       #d1d5db;
    --search-focus:  rgba(37, 99, 235, 0.15);
}

/* ── Base ── */
*,
*::before,
*::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    margin: 0;
    padding-top: 56px;
    font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 16px;
    line-height: 1.6;
    background-color: var(--bg);
    color: var(--fg);
    cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='32' height='32'%3E%3Ccircle cx='16' cy='16' r='9' fill='%2300b3ff' opacity='0.9'/%3E%3C/svg%3E") 16 16, auto;
}

button,
a,
input,
textarea,
select {
    cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='32' height='32'%3E%3Ccircle cx='16' cy='16' r='9' fill='%23003399'/%3E%3C/svg%3E") 16 16, pointer;
}

img {
    max-width: 100%;
    display: block;
    height: auto;
}

/* ── Navbar ── */
.navbar-brand {
    font-weight: 700;
}

.navbar-nav .nav-link {
    color: #fff;
}

.navbar-nav .nav-link:hover,
.navbar-nav .nav-link:focus {
    color: #eef2ff;
}

/* ── Main layout ── */
.works-main {
    padding: 60px 0 120px;
    background-color: var(--bg);
}

.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 0 24px;
}

/* ── Page header ── */
.page-header {
    margin-bottom: 2.5rem;
}

.page-title {
    font-size: 2.75rem;
    font-weight: 700;
    color: var(--fg);
    letter-spacing: -0.02em;
    margin: 0;
}

/* ── Search ── */
.search-wrapper {
    margin-bottom: 3rem;
}

.search-input {
    width: 100%;
    max-width: 420px;
    padding: 0.65rem 1rem;
    font-size: 1rem;
    font-family: inherit;
    border: 1.5px solid var(--border);
    border-radius: 0.375rem;
    background: var(--bg);
    color: var(--fg);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.search-input::placeholder {
    color: var(--fg-subtle);
}

.search-input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--search-focus);
}

/* ── Filter pills ── */
.filter-pills {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.875rem;
}

.filter-pill {
    padding: 0.3rem 0.85rem;
    font-size: 0.8125rem;
    font-weight: 500;
    font-family: inherit;
    border: 1.5px solid var(--border);
    border-radius: 999px;
    background: transparent;
    color: var(--fg-muted);
    transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}

.filter-pill:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.filter-pill.active {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}

.no-results {
    text-align: center;
    padding: 2rem;
    color: var(--fg-muted);
    font-size: 1rem;
}

/* ── Year groups ── */
.year-group {
    margin-bottom: 4rem;
}

.year-header {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    margin-bottom: 0.5rem;
}

.year-label {
    font-size: 1rem;
    font-weight: 600;
    color: var(--fg-subtle);
    letter-spacing: 0.05em;
    white-space: nowrap;
    flex-shrink: 0;
}

.year-line {
    flex: 1;
    height: 1px;
    background: var(--year-line);
}

/* ── Story rows ── */
.stories-list {
    display: flex;
    flex-direction: column;
}

.story-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 2rem;
    padding: 1.5rem 1rem;
    margin: 0 -1rem;
    border-bottom: 1px solid var(--border);
    text-decoration: none;
    color: inherit;
    border-radius: 0.5rem;
    transition: background-color 0.18s ease;
}

.story-row:last-child {
    border-bottom: none;
}

.story-row:hover {
    background-color: var(--row-hover);
    text-decoration: none;
    color: inherit;
}

.story-row:hover .story-arrow {
    transform: translateX(4px);
    color: var(--accent);
}

/* ── Story body (left) ── */
.story-body {
    flex: 1;
    min-width: 0;
}

.story-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-bottom: 0.5rem;
}

.tag {
    display: inline-block;
    padding: 0.15rem 0.6rem;
    background-color: var(--tag-bg);
    color: var(--tag-fg);
    border-radius: 0.25rem;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.tag.other {
    background-color: #d1fae5;
    color: #065f46;
}

.story-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--fg);
    line-height: 1.4;
    margin: 0 0 0.5rem;
}

.story-desc {
    font-size: 0.9375rem;
    color: var(--fg-muted);
    line-height: 1.55;
    margin: 0;
}

/* ── Story meta (right) ── */
.story-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.25rem;
    flex-shrink: 0;
    min-width: 160px;
    text-align: right;
}

.story-pub {
    font-size: 0.8125rem;
    color: var(--fg-muted);
    font-weight: 500;
}

.story-date {
    font-size: 0.8125rem;
    color: var(--fg-subtle);
}

.story-arrow {
    font-size: 1.125rem;
    color: var(--fg-subtle);
    margin-top: 0.5rem;
    transition: transform 0.18s ease, color 0.18s ease;
    display: inline-block;
}


/* ── Responsive ── */
@media (max-width: 640px) {
    .page-title {
        font-size: 2rem;
    }

    .story-row {
        flex-direction: column;
        gap: 1rem;
    }

    .story-meta {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        text-align: left;
        min-width: 0;
        width: 100%;
    }

    .story-arrow {
        margin-top: 0;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 16px;
    }

    .story-row {
        padding: 1.25rem 0.75rem;
        margin: 0 -0.75rem;
    }

    .story-title {
        font-size: 1rem;
    }
}
