/* ---------------------------------------------------------------------------
   blogson - shared styles
   --------------------------------------------------------------------------- */

@import url("https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;500&family=Space+Mono:wght@400;700&display=swap");

:root {
    --bg: #0c0c0c;
    --fg: #c8c8c8;
    --fg-dim: #666;
    --fg-bright: #e8e8e8;
    --accent: #ff6600;
    --link: #88aaff;
    --link-hover: #bbddff;
    --red: #cc4444;
    --red-hover: #ee5555;
    --border: #222;
    --tag-bg: #1a1a1a;
    --input-bg: #111;
    --btn-bg: #1a1a1a;
}

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

body {
    background: var(--bg);
    color: var(--fg);
    font-family: "IBM Plex Mono", monospace;
    font-size: 14px;
    line-height: 1.6;
    padding: 2rem;
    max-width: 900px;
    margin: 0 auto;
}

/* --- header --- */

header {
    border-bottom: 1px solid var(--border);
    padding-bottom: 1rem;
    margin-bottom: 2rem;
}

header h1 {
    font-family: "Space Mono", monospace;
    font-size: 1.1rem;
    color: var(--accent);
    letter-spacing: 0.05em;
}

header .subtitle {
    color: var(--fg-dim);
    font-size: 0.75rem;
    margin-left: 0.5rem;
}

/* Index uses a flex header with a right-hand group */
header.with-right {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
}

.header-right {
    display: flex;
    align-items: baseline;
    gap: 1.2rem;
}

header .meta {
    font-size: 0.75rem;
    color: var(--fg-dim);
}

header .brand-link {
    font-family: "Space Mono", monospace;
    font-size: 1.1rem;
    color: var(--accent);
    letter-spacing: 0.05em;
    text-decoration: none;
}

header .brand-link:hover {
    opacity: 0.8;
}

/* --- footer --- */

footer {
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
    font-size: 0.7rem;
    color: var(--fg-dim);
}

footer a {
    color: var(--fg-dim);
}

.shortcuts {
    margin-top: 0.4rem;
    color: var(--fg-dim);
    opacity: 0.6;
    font-size: 0.65rem;
}

/* --- flash messages --- */

.flash {
    background: var(--input-bg);
    border-left: 3px solid var(--accent);
    padding: 0.5rem 1rem;
    margin-bottom: 1.5rem;
    font-size: 0.85rem;
}

/* --- random button (index) --- */

.random-btn {
    font-size: 0.75rem;
    color: var(--fg-dim);
    text-decoration: none;
    border: 1px dashed var(--border);
    padding: 0.2rem 0.6rem;
    border-radius: 3px;
    transition: all 0.2s;
    white-space: nowrap;
}

.random-btn:hover {
    color: var(--accent);
    border-color: var(--accent);
    border-style: solid;
}

/* --- filter bar (index) --- */

.filter-bar {
    margin-bottom: 1.5rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.filter-bar a {
    font-size: 0.7rem;
    color: var(--fg-dim);
    text-decoration: none;
    padding: 0.15rem 0.5rem;
    border: 1px solid var(--border);
    border-radius: 2px;
    transition: all 0.15s;
}

.filter-bar a:hover,
.filter-bar a.active {
    color: var(--accent);
    border-color: var(--accent);
}

.feed-select {
    font-family: inherit;
    font-size: 0.7rem;
    color: var(--fg-dim);
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 2px;
    padding: 0.15rem 0.5rem;
    cursor: pointer;
    outline: none;
    margin-left: auto;
}

.feed-select:hover,
.feed-select:focus {
    color: var(--accent);
    border-color: var(--accent);
}

.feed-select option {
    background: var(--bg);
    color: var(--fg);
}

/* --- entries (index) --- */

.entry {
    padding: 0.5rem 0;
    padding-left: 0.75rem;
    border-bottom: 1px solid var(--border);
    border-left: 3px solid transparent;
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 1rem;
    align-items: baseline;
    transition: border-color 0.3s;
}

.entry:hover,
.entry.focused {
    background: var(--tag-bg);
    margin: 0 -0.5rem;
    padding: 0.5rem;
    padding-left: 0.75rem;
    border-radius: 2px;
}

.entry.focused {
    outline: 1px solid var(--border);
}

.entry a {
    color: var(--link);
    text-decoration: none;
    word-break: break-word;
}

.entry a:hover {
    color: var(--link-hover);
    text-decoration: underline;
}

.entry .feed-tag {
    font-size: 0.7rem;
    color: var(--fg-dim);
    background: var(--tag-bg);
    padding: 0.15rem 0.4rem;
    border-radius: 2px;
    white-space: nowrap;
    border: 1px solid var(--border);
    cursor: default;
    position: relative;
    transition: color 0.3s;
}

.entry .date,
.entry .visits {
    font-size: 0.7rem;
    color: var(--fg-dim);
    white-space: nowrap;
}

.entry .visits {
    opacity: 0.85;
}

.eye {
    font-size: 0.85em;
}

.entry-info {
    display: flex;
    align-items: baseline;
    gap: 0.6rem;
    min-width: 0;
}

.entry-main {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.entry-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
    margin-left: 1.4rem; /* aligns with title after the favicon */
}

.tag {
    font-size: 0.65rem;
    color: var(--fg-dim);
    background: var(--tag-bg);
    padding: 0.05rem 0.35rem;
    border-radius: 2px;
    border: 1px solid var(--border);
    white-space: nowrap;
}

.tag-more {
    font-style: italic;
}

.author {
    font-size: 0.7rem;
    color: var(--fg-dim);
    font-style: italic;
    white-space: nowrap;
    opacity: 0.8;
}

.entry-right {
    display: flex;
    align-items: baseline;
    gap: 0.8rem;
}

.favicon {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
    position: relative;
    top: 2px;
    opacity: 0.7;
}

.tooltip {
    display: none;
    position: absolute;
    bottom: calc(100% + 8px);
    right: 0;
    background: var(--tag-bg);
    border: 1px solid var(--border);
    color: var(--fg);
    padding: 0.5rem 0.7rem;
    border-radius: 3px;
    font-size: 0.7rem;
    white-space: normal;
    width: max-content;
    max-width: 300px;
    line-height: 1.4;
    z-index: 10;
    pointer-events: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.feed-tag:hover .tooltip {
    display: block;
}

/* --- section headings (admin/submit) --- */

h2 {
    font-family: "Space Mono", monospace;
    font-size: 0.85rem;
    color: var(--fg-dim);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 1rem;
}

/* --- add form (admin/submit) --- */

.add-form {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 2.5rem;
}

.add-form input[type="text"] {
    flex: 1;
    background: var(--input-bg);
    border: 1px solid var(--border);
    color: var(--fg-bright);
    padding: 0.5rem 0.75rem;
    font-family: inherit;
    font-size: 0.85rem;
    border-radius: 2px;
    outline: none;
}

.add-form input[type="text"]:focus {
    border-color: var(--accent);
}

.add-form input[type="text"]::placeholder {
    color: var(--fg-dim);
}

/* --- buttons --- */

.btn {
    background: var(--btn-bg);
    color: var(--fg);
    border: 1px solid var(--border);
    padding: 0.5rem 1rem;
    font-family: inherit;
    font-size: 0.8rem;
    cursor: pointer;
    border-radius: 2px;
    transition: all 0.15s;
}

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

.btn-danger {
    color: var(--red);
}

.btn-danger:hover {
    color: var(--red-hover);
    border-color: var(--red);
}

.actions-bar {
    margin-bottom: 2rem;
}

/* --- feed list (admin/submit) --- */

.feed-list {
    list-style: none;
}

.feed-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.6rem 0;
    border-bottom: 1px solid var(--border);
    gap: 1rem;
}

.feed-item:hover {
    background: var(--input-bg);
    margin: 0 -0.5rem;
    padding: 0.6rem 0.5rem;
    border-radius: 2px;
}

.feed-info {
    min-width: 0;
    flex: 1;
}

.feed-title {
    color: var(--fg-bright);
    font-size: 0.9rem;
}

.feed-url {
    color: var(--fg-dim);
    font-size: 0.75rem;
    word-break: break-all;
}

.feed-count {
    color: var(--fg-dim);
    font-size: 0.75rem;
    white-space: nowrap;
}

.feed-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

/* --- empty state --- */

.empty {
    color: var(--fg-dim);
    padding: 2rem 0;
    font-style: italic;
    text-align: center;
}

/* --- mobile --- */

@media (max-width: 600px) {
    body {
        padding: 1rem;
        font-size: 13px;
    }
    .entry {
        grid-template-columns: 1fr;
        gap: 0.2rem;
    }
    .entry-right {
        justify-content: flex-start;
    }
    .add-form {
        flex-direction: column;
    }
    .feed-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.4rem;
    }
    .feed-actions {
        align-self: flex-end;
    }
}
