:root {
    --bg: #ffffff;
    --bg-elevated: #f8f9fa;
    --fg: #1a1a2e;
    --fg-muted: #4a4a6a;
    --fg-subtle: #8b8ba6;
    --border: #e0e0eb;
    --border-strong: #cfcfe0;
    --accent: #2563eb;
    --accent-hover: #1d4ed8;
    --accent-light: #eff6ff;
    --accent-purple: #7c3aed;
    --accent-purple-hover: #6d28d9;
    --accent-purple-light: #f5f3ff;
    --shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
    --shadow-hover: 0 4px 12px rgba(37,99,235,0.12), 0 2px 4px rgba(37,99,235,0.08);
    --radius: 8px;
    --radius-full: 9999px;
    --transition: 150ms ease;
    --max-width: 720px;
    --header-h: 56px;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #0f0f1a;
        --bg-elevated: #1a1a2e;
        --fg: #f0f0f5;
        --fg-muted: #a0a0b8;
        --fg-subtle: #6a6a8a;
        --border: #2a2a4a;
        --border-strong: #3a3a5a;
        --accent: #60a5fa;
        --accent-hover: #93c5fd;
        --accent-light: #1e3a5f;
        --accent-purple: #a78bfa;
        --accent-purple-hover: #c4b5fd;
        --accent-purple-light: #2e1a4a;
        --shadow: 0 1px 3px rgba(0,0,0,0.4), 0 1px 2px rgba(0,0,0,0.3);
        --shadow-hover: 0 4px 12px rgba(96,165,250,0.15), 0 2px 4px rgba(96,165,250,0.1);
    }
}

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

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
    -webkit-tap-highlight-color: transparent;
    overscroll-behavior: none;
}

.material-symbols-rounded {
    font-family: 'Material Symbols Rounded';
    font-weight: 400;
    font-style: normal;
    font-size: 24px;
    line-height: 1;
    letter-spacing: normal;
    text-transform: none;
    display: inline-block;
    white-space: nowrap;
    word-wrap: normal;
    direction: ltr;
    -webkit-font-feature-settings: 'liga';
    -webkit-font-smoothing: antialiased;
    font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
}

.material-symbols-rounded.filled { font-variation-settings: 'FILL' 1, 'wght' 400, 'GRAD' 0, 'opsz' 24; }
.material-symbols-rounded.sharp { font-family: 'Material Symbols Sharp'; }
.material-symbols-rounded.outlined { font-family: 'Material Symbols Outlined'; }

body {
    font-family: 'Space Grotesk', sans-serif;
    background: var(--bg);
    color: var(--fg);
    line-height: 1.5;
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overscroll-behavior: none;
}

a {
    color: var(--accent);
    text-decoration: none;
    -webkit-tap-highlight-color: transparent;
}

a:hover { text-decoration: underline; }

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

button, input, select, textarea {
    font: inherit;
    color: inherit;
    background: none;
    border: none;
    outline: none;
}

button { cursor: pointer; -webkit-tap-highlight-color: transparent; }

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

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

.topnav {
    position: sticky;
    top: 0;
    z-index: 100;
    height: var(--header-h);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    padding: 0 24px;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    backdrop-filter: blur(8px);
    background: rgba(var(--bg), 0.9);
}

/* Pages with only wordmark (about, contact) - left align */
.topnav:has(> .wordmark:only-child) {
    justify-content: flex-start;
}

@media (max-width: 640px) {
    .topnav {
        height: auto;
        min-height: var(--header-h);
        display: grid;
        grid-template-rows: auto 1fr;
        grid-template-columns: 1fr auto;
        gap: 10px 12px;
        padding: 10px 16px;
        top: -54px;
    }

    .topnav > .wordmark {
        grid-row: 1;
        grid-column: 1 / -1;
        text-align: center;
        justify-self: center;
        margin: 0;
        min-width: 0;
        height: 44px;
    }

    .topnav > .topnav-actions {
        grid-row: 1;
        grid-column: 2;
        justify-self: end;
        height: 44px;
    }

    .topnav > .topnav-search {
        grid-row: 2;
        grid-column: 1 / -1;
        width: 100%;
        max-width: none;
        /* margin-top: 4px; */
    }

    /* About/Contact pages - only wordmark, left align on mobile */
    .topnav:has(> .wordmark:only-child) > .wordmark {
        justify-self: start;
        text-align: left;
    }
}

/* Desktop home: only actions visible (wordmark + search hidden) - keep actions on right */
body.is-index .topnav:not(.has-search) {
    background: transparent;
    border: none;
    backdrop-filter: none;
    justify-content: flex-end;
}

/* Mobile home: wordmark hidden, actions on right */
@media (max-width: 640px) {
    body.is-index .topnav:not(.has-search) {
        justify-content: flex-end;
        gap: 0;
    }
}

body.is-index .topnav:not(.has-search) .wordmark { display: none; }
body.is-index .topnav:not(.has-search) .topnav-search { display: none; }
body.is-index .topnav:not(.has-search) .verticals { display: none; }

.wordmark {
    font-family: 'Sora', sans-serif;
    font-size: clamp(20px, 3vw, 24px);
    font-weight: 600;
    letter-spacing: -0.5px;
    text-decoration: none;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    flex: none;
}

.wordmark:hover { text-decoration: none; opacity: 0.8; }

.wordmark-ind, .wordmark-x { color: var(--accent); }
.wordmark-dash { color: var(--accent-purple); }

.topnav-search {
    flex: 1;
    max-width: 584px;
    display: flex;
}

.topnav-search .search-bar {
    width: 100%;
    height: 44px;
    padding: 0 6px 0 16px;
    border-radius: var(--radius-full);
    box-shadow: var(--shadow);
}

.topnav-search .search-bar:hover { box-shadow: var(--shadow-hover); }

.topnav-search .search-bar:focus-within {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-light), var(--shadow-hover);
}

.topnav-search .search-icon {
    font-size: 20px;
    color: var(--fg-subtle);
    margin-right: 12px;
    flex-shrink: 0;
}

.topnav-search .search-bar:focus-within .search-icon {
    color: var(--accent);
    font-variation-settings: FILL 1, wght 400, GRAD 0, opsz 24;
}

.topnav-search .clear-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    border-radius: var(--radius-full);
    color: var(--fg-subtle);
    cursor: pointer;
    transition: all var(--transition);
    flex-shrink: 0;
    margin-left: 8px;
    margin-right: -4px;
}

.topnav-search .clear-btn[hidden],
.home-search-bar .clear-btn[hidden],
.search-bar .clear-btn[hidden] { display: none; }

.topnav-search .clear-btn:hover { background: var(--bg-elevated); color: var(--fg); }
.topnav-search .clear-btn .material-symbols-rounded { font-size: 20px; }

.topnav-search .voice-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: solid 1px var(--border);
    background: var(--bg-elevated);
    border-radius: var(--radius-full);
    color: var(--fg-subtle);
    cursor: pointer;
    transition: all var(--transition);
    flex-shrink: 0;
    margin-left: 8px;
}

.topnav-search .voice-btn:hover { background: var(--bg-elevated); color: var(--accent); }
.topnav-search .voice-btn.listening {
    background: var(--accent-light);
    border: solid 1px var(--accent);
    color: var(--accent);
    animation: pulse 1.5s ease-in-out infinite;
}
.topnav-search .voice-btn .material-symbols-rounded { font-size: 20px; }

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

.topnav-search .voice-btn .material-symbols-rounded { font-size: 20px; }

.home-search-bar {
    width: 100%;
    height: 48px;
    padding: 0 20px;
    border-radius: var(--radius-full);
    box-shadow: var(--shadow);
    background: var(--bg);
    border: 1px solid var(--border);
    transition: all var(--transition);
}

.home-search-bar:hover {
    box-shadow: var(--shadow-hover);
    border-color: var(--border-strong);
}

.home-search-bar:focus-within {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-light), var(--shadow-hover);
}

.home-search-bar .search-icon {
    font-size: 22px;
    color: var(--fg-subtle);
    margin-right: 14px;
    flex-shrink: 0;
}

.home-search-bar:focus-within .search-icon { color: var(--accent); }

.home-search-bar .clear-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: none;
    background: transparent;
    border-radius: var(--radius-full);
    color: var(--fg-subtle);
    cursor: pointer;
    transition: all var(--transition);
    flex-shrink: 0;
    margin-left: 10px;
    margin-right: -4px;
}

.home-search-bar .clear-btn:hover { background: var(--bg-elevated); color: var(--fg); }
.home-search-bar .clear-btn .material-symbols-rounded { font-size: 20px; }

.home-search-bar .voice-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: var(--bg-elevated);
    border: solid 1px var(--border);
    border-radius: var(--radius-full);
    color: var(--fg-subtle);
    cursor: pointer;
    transition: all var(--transition);
    flex-shrink: 0;
    margin-left: 10px;
}

.home-search-bar .voice-btn:hover { background: var(--bg-elevated); color: var(--accent); }
.home-search-bar .voice-btn.listening {
    background: var(--accent-light);
    border: solid 1px var(--accent);
    color: var(--accent);
    animation: pulse 1.5s ease-in-out infinite;
}
.home-search-bar .voice-btn .material-symbols-rounded { font-size: 20px; font-variation-settings: 'FILL' 1, 'wght' 400, 'GRAD' 0, 'opsz' 24; }

.search-bar {
    width: 100%;
    max-width: 584px;
    display: flex;
    align-items: center;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-full);
    padding: 0 6px 0 20px;
    transition: all var(--transition);
    box-shadow: var(--shadow);
}

.search-bar:hover { border-color: var(--border-strong); box-shadow: var(--shadow-hover); }
.search-bar:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-light), var(--shadow-hover); }

.search-icon { font-size: 20px; color: var(--fg-subtle); flex-shrink: 0; margin-right: 12px; }
.search-bar:focus-within .search-icon { color: var(--accent); }

.search-bar input {
    flex: 1;
    border: none;
    outline: none;
    background: transparent;
    font-family: inherit;
    font-size: 16px;
    color: var(--fg);
    padding: 16px 0;
    min-width: 0;
}

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

.search-bar input::-webkit-search-cancel-button,
.search-bar input::-webkit-search-decoration,
.search-bar input::-webkit-search-results-button,
.search-bar input::-webkit-search-results-decoration { -webkit-appearance: none; appearance: none; display: none; }
.search-bar input[type="search"]::-ms-clear { display: none; }

.clear-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: none;
    background: transparent;
    border-radius: var(--radius-full);
    color: var(--fg-subtle);
    cursor: pointer;
    transition: all var(--transition);
    flex-shrink: 0;
    margin-left: 8px;
}

.clear-btn:hover { background: var(--bg-elevated); color: var(--fg); }
.clear-btn .material-symbols-rounded { font-size: 20px; }

.topnav-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }

.icon-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: none;
    background: transparent;
    border-radius: var(--radius-full);
    color: var(--fg-muted);
    cursor: pointer;
    transition: all var(--transition);
}

.icon-btn:hover { background: var(--bg-elevated); color: var(--fg); }
.icon-btn[aria-expanded="true"] { background: var(--bg-elevated); color: var(--fg); }
.icon-btn .material-symbols-rounded { font-size: 22px; }

.dropdown {
    position: absolute;
    top: calc(var(--header-h) + 8px);
    right: 24px;
    min-width: 280px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-hover);
    z-index: 200;
    overflow: hidden;
}

.dropdown[hidden] { display: none; }

.dropdown-header { padding: 12px 16px; border-bottom: 1px solid var(--border); }
.dropdown-title { font-size: 13px; font-weight: 600; color: var(--fg-muted); text-transform: uppercase; letter-spacing: 0.5px; }

.app-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; padding: 12px; }

.app-tile {
    display: flex; flex-direction: column; align-items: center; gap: 8px;
    padding: 8px; border: none; background: transparent;
    border-radius: 16px; color: var(--fg-muted);
    cursor: pointer; transition: all var(--transition);
    font-family: inherit; font-size: 12px; font-weight: 500;
}

.app-tile:hover { background: var(--bg); color: var(--fg); transform: scale(1.02); }
.app-tile:active { transform: scale(0.98); }
.app-icon {
    display: flex; align-items: center; justify-content: center;
    width: 48px; height: 48px; border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    transition: all var(--transition);
}
.app-tile:hover .app-icon { transform: scale(1.05); box-shadow: 0 4px 16px rgba(0,0,0,0.2); }
.app-icon .material-symbols-rounded { font-size: 24px; color: white; }

.account-info { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.account-avatar {
    display: flex; align-items: center; justify-content: center;
    width: 40px; height: 40px; border-radius: var(--radius-full);
    background: var(--accent-light); color: var(--accent);
}
.account-avatar .material-symbols-rounded { font-size: 22px; }
.account-details { display: flex; flex-direction: column; min-width: 0; }
.account-name { font-size: 14px; font-weight: 600; color: var(--fg); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.account-npub { font-size: 12px; color: var(--fg-subtle); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.dropdown-divider { height: 1px; background: var(--border); margin: 4px 0; }

.dropdown-item {
    display: flex; align-items: center; gap: 12px; width: 100%;
    padding: 10px 16px; border: none; background: transparent;
    color: var(--fg); font-family: inherit; font-size: 14px; font-weight: 500;
    text-align: left; cursor: pointer; transition: background var(--transition);
}

.dropdown-item:hover:not(:disabled) { background: var(--bg); }
.dropdown-item:disabled { color: var(--fg-subtle); cursor: not-allowed; }
.dropdown-item.danger { color: #dc2626; }
.dropdown-item.danger:hover:not(:disabled) { background: #fef2f2; }

.dropdown-item-icon { display: flex; align-items: center; justify-content: center; width: 20px; height: 20px; flex-shrink: 0; color: var(--fg-subtle); }
.dropdown-item:hover .dropdown-item-icon { color: var(--fg); }
.dropdown-item.danger .dropdown-item-icon { color: #dc2626; }
.dropdown-item-icon .material-symbols-rounded { font-size: 18px; }

.main {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0 0 40px;
    width: 100%;
    max-width: var(--max-width);
    margin: 0 auto;
}

.home-shell {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 32px;
    flex: 1;
}

.home-shell[hidden] { display: none; }

.home-brand { margin-top: 40px; }
.home-wordmark {
    font-family: 'Sora', sans-serif;
    font-size: clamp(56px, 10vw, 96px);
    font-weight: 700;
    letter-spacing: -4px;
    line-height: 1.1;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0;
}

.home-wordmark:hover { text-decoration: none; opacity: 0.8; }

.home-wordmark .wordmark-ind,
.home-wordmark .wordmark-x { color: var(--accent); }
.home-wordmark .wordmark-dash { color: var(--accent-purple); }

.home-search-form {
    width: 100%;
    max-width: 584px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    padding: 0 16px;
}

.home-search-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    justify-content: center;
    width: 100%;
}

.search-shell {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.search-form { width: 100%; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.search-form[hidden] { display: none; }

.verticals {
    display: flex;
    justify-content: flex-start;
    overflow: visible;
    padding: 8px 14px;
    gap: 16px;
    width: 100%;
}

@media (max-width: 640px) {
    .verticals {
        overflow-x: auto;
        overflow-y: hidden;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        padding-bottom: 8px;
    }
    .verticals::-webkit-scrollbar { display: none; }
}

.verticals[hidden] { display: none; }

.vertical-chip {
    font-family: inherit;
    font-size: 14px;
    font-weight: 500;
    color: var(--fg-subtle);
    background: transparent;
    border: none;
    border-radius: 2px;
    cursor: pointer;
    padding: 4px 8px 0;
    transition: all 0.3s ease;
    width: auto;
    text-align: center;
    position: relative;
}

.vertical-chip:disabled { opacity: 0.5; }
.vertical-chip:hover { color: var(--fg); }
.vertical-chip.active { color: var(--fg); background: transparent; }

.vertical-chip hr {
    margin: 2px auto 0;
    border-radius: 3px;
    border: 2px solid transparent;
    transition: all 0.3s ease;
    width: 100%;
}

.vertical-chip:hover hr { border-color: var(--border); }
.vertical-chip.active hr { border-color: var(--accent); }

.status-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--fg-muted);
    padding: 8px 12px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    width: 100%;
    max-width: 584px;
}

.status-bar[hidden] { display: none; }

.status-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--fg-subtle);
}

.status-indicator.connected { background: #34a853; }
.status-indicator.connecting {
    background: #fbbc04;
    animation: pulse 1.5s ease-in-out infinite;
}

.results-section {
    width: 100%;
    max-width: var(--max-width);
    animation: fadeIn 200ms ease;
    padding: 8px 24px 0;
}

.results-section[hidden] { display: none; }

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

.results-header {
    display: flex; align-items: baseline; justify-content: space-between;
    gap: 16px; margin-bottom: 12px; padding-bottom: 12px;
    border-bottom: 1px solid var(--border); flex-wrap: wrap;
}

.results-title {
    font-family: 'Sora', sans-serif; font-size: 13px; font-weight: 600; color: var(--fg);
}

.results-meta { font-size: 13px; color: var(--fg-muted); }

.results-feed { display: flex; flex-direction: column; gap: 4px; }

.result-item {
    padding: 16px 0; border-bottom: 1px solid var(--border);
    transition: background var(--transition-fast);
    /*border-radius: var(--radius);*/
    margin: 0 -4px; padding-left: 4px; padding-right: 4px;
}

.result-item:last-child { border-bottom: none; }
.result-item:hover { background: transparent; box-shadow: none; }

.result-url { font-size: 13px; color: #1a7c3a; margin-bottom: 4px; word-break: break-all; line-height: 1.3; }

@media (prefers-color-scheme: dark) { .result-url { color: #8fbc8f; } }

.result-title { font-size: 18px; font-weight: 500; color: var(--fg); line-height: 1.35; margin-bottom: 6px; }
.result-title a { color: var(--accent); text-decoration: none; transition: color var(--transition); }
.result-title a:hover { text-decoration: underline; }

.result-snippet { font-size: 14px; color: var(--fg-muted); line-height: 1.6; max-width: 100%; }

.result-meta { display: flex; align-items: center; gap: 16px; margin-top: 8px; font-size: 12px; color: var(--fg-subtle); }

.pagination {
    display: flex; align-items: center; justify-content: center; gap: 8px;
    margin-top: 24px; padding-top: 24px; border-top: 1px solid var(--border);
}

.pagination[hidden] { display: none; }
.pagination .btn { padding: 10px 20px; font-size: 14px; }
.page-info { font-size: 14px; color: var(--fg-muted); min-width: 80px; text-align: center; }

.empty-state {
    display: flex; flex-direction: column; align-items: center;
    text-align: center; padding: 60px 24px; color: var(--fg-muted);
    width: 100%; max-width: var(--max-width);
    animation: fadeIn var(--transition-slow) ease;
}

.empty-state[hidden] { display: none; }

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.empty-icon { font-size: 72px; color: var(--fg-subtle); margin-bottom: 20px; opacity: 0.5; }
.empty-state p { font-size: 16px; max-width: 360px; line-height: 1.6; }

.footer {
    margin-top: auto;
    padding: 24px;
    border-top: 1px solid var(--border);
    background: var(--bg-elevated);
}

.footer-content {
    max-width: var(--max-width); margin: 0 auto;
    display: flex; justify-content: space-between; align-items: center;
    flex-wrap: wrap; gap: 16px;
    font-size: 13px; color: var(--fg-subtle);
}

.footer-links { display: flex; gap: 20px; flex-wrap: wrap; }
.footer-links a { color: var(--fg-subtle); }
.footer-links a:hover { color: var(--fg); }
.footer-copyright { white-space: nowrap; }

.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    font-family: inherit; font-size: 14px; font-weight: 500;
    border: 1px solid transparent; border-radius: var(--radius);
    padding: 10px 20px; cursor: pointer; transition: all var(--transition);
    white-space: nowrap;
}

.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary {
    background: var(--accent); color: #fff; border-color: var(--accent);
}
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); border-color: var(--accent-hover); }

.btn-secondary {
    background: var(--bg-elevated); color: var(--fg); border-color: var(--border);
}
.btn-secondary:hover:not(:disabled) { background: var(--border); border-color: var(--border-strong); }

.btn-ghost {
    background: transparent; color: var(--fg-muted); border-color: transparent;
}
.btn-ghost:hover:not(:disabled) { background: var(--bg-elevated); color: var(--fg); }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

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

/* ===== MAP STYLES ===== */
.map-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 50;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.map-container.active {
    opacity: 1;
    visibility: visible;
}

.map-container #map {
    width: 100%;
    height: 100%;
}

body.map-active .map-container {
    opacity: 1;
    visibility: visible;
}

/* Location info panel */
.location-info {
    position: fixed;
    bottom: 24px;
    right: 24px;
    max-width: 360px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-hover);
    padding: 16px;
    z-index: 100;
    display: none;
    max-height: 60vh;
    overflow-y: auto;
}

.location-info h3 {
    margin: 0 0 12px;
    font-size: 16px;
    font-weight: 600;
}

.location-image {
    margin: 12px 0;
    border-radius: var(--radius);
    overflow: hidden;
}

.location-image img {
    width: 100%;
    height: auto;
    display: block;
}

.location-details p,
.address-details p {
    margin: 4px 0;
    font-size: 13px;
}

.address-details h4 {
    margin: 12px 0 8px;
    font-size: 13px;
    font-weight: 600;
}

.attribution {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
    font-size: 11px;
    color: var(--fg-subtle);
}

.attribution a { color: var(--accent); }

/* ===== IMAGE GRID ===== */
.image-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 12px;
    width: 100%;
}

.image-grid-item {
    position: relative;
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--bg-elevated);
    aspect-ratio: 4/3;
}

.image-grid-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.image-grid-item:hover img {
    transform: scale(1.05);
}

.image-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.image-grid-item:hover .image-overlay {
    opacity: 1;
}

.image-overlay .material-symbols-rounded {
    color: white;
    font-size: 32px;
}

/* ===== VIDEO GRID ===== */
.search-sources {
    font-size: 12px;
    color: var(--fg-subtle);
    padding: 4px 0 8px;
}

.video-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 100%;
}

.video-grid-item {
    display: flex;
    gap: 12px;
    background: var(--bg-elevated);
    border-radius: var(--radius);
    overflow: hidden;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.video-grid-item:hover {
    transform: translateX(4px);
    box-shadow: var(--shadow-hover);
}

.video-grid-item > a {
    position: relative;
    flex-shrink: 0;
    width: 240px;
    display: block;
    text-decoration: none;
    color: inherit;
}

.video-thumb-wrap {
    position: relative;
    aspect-ratio: 16/9;
    overflow: hidden;
    background-color: #1a1a2e;
    display: flex;
    align-items: center;
    justify-content: center;
}

.video-thumb-wrap .video-thumbnail {
    width: 100%;
    height: 100%;
    object-fit: contain;
    transition: transform 0.3s ease;
}

.video-grid-item:hover .video-thumb-wrap .video-thumbnail {
    transform: scale(1.05);
}

.video-duration {
    position: absolute;
    bottom: 6px;
    right: 6px;
    background: rgba(0, 0, 0, 0.85);
    color: white;
    padding: 2px 5px;
    border-radius: 3px;
    font-size: 11px;
    font-weight: 500;
    line-height: 1.3;
    pointer-events: none;
}

.video-info {
    padding: 12px 12px 12px 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-width: 0;
}

.video-title {
    font-size: 14px;
    font-weight: 500;
    line-height: 1.4;
    margin: 0 0 6px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.video-title a { color: var(--fg); }
.video-title a:hover { color: var(--accent); }

.video-channel {
    font-size: 13px;
    color: var(--fg-muted);
    margin: 0 0 4px;
}

.video-source-url {
    font-size: 12px;
    color: #1a7c3a;
    margin-bottom: 2px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

@media (prefers-color-scheme: dark) {
    .video-source-url { color: #8fbc8f; }
}

.video-meta {
    font-size: 12px;
    color: var(--fg-subtle);
    margin: 0;
}

/* ===== NEWS RESULTS ===== */
.news-results .result-item {
    display: flex;
    gap: 12px;
    padding: 16px 0;
    align-items: flex-start;
}

.news-thumbnail {
    width: 120px;
    height: 80px;
    object-fit: cover;
    border-radius: var(--radius);
    flex-shrink: 0;
    background: var(--bg-elevated);
}

.news-text-container {
    flex: 1;
    min-width: 0;
}

.news-text-container .result-title {
    margin-bottom: 6px;
    font-size: 16px;
}

.news-text-container .result-snippet {
    font-size: 13px;
    line-height: 1.5;
    margin-bottom: 8px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.news-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    font-size: 12px;
    color: var(--fg-subtle);
}

.news-author,
.news-source,
.news-date {
    white-space: nowrap;
}

.news-source {
    font-weight: 500;
    color: var(--fg-muted);
}

/* No subscriptions message */
.news-no-subscriptions {
    text-align: center;
    padding: 40px 24px;
}

.news-no-subscriptions .material-symbols-rounded {
    font-size: 48px;
    color: var(--fg-subtle);
    margin-bottom: 16px;
}

.subscription-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 16px;
    align-items: center;
}

.search-all-sources-note {
    font-size: 12px;
    color: var(--fg-subtle);
    margin: 4px 0 0 !important;
}

/* ===== NOSTR RESULTS ===== */
.nostr-results .result-item {
    padding: 16px 0;
}

.nostr-results .result-url {
    font-size: 12px;
    color: var(--accent-purple);
    font-family: 'Space Grotesk', monospace;
}

.nostr-results .result-title {
    font-size: 15px;
    font-weight: 500;
}

.nostr-results .result-snippet {
    font-size: 13px;
}

.nostr-results .result-meta span {
    padding: 2px 8px;
    background: var(--bg-elevated);
    border-radius: var(--radius-full);
    font-size: 11px;
}

/* ===== NO RESULTS ===== */
.no-results {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 40px 24px;
    color: var(--fg-muted);
}

.no-results .material-symbols-rounded {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.no-results p {
    font-size: 16px;
    max-width: 360px;
    line-height: 1.6;
}

/* ===== LOADING SPINNER ===== */
.loading-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid transparent;
    border-top-color: currentColor;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-right: 8px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ===== TOAST ===== */
.toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px 24px;
    box-shadow: var(--shadow-hover);
    z-index: 1000;
    opacity: 0;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

/* ===== MOCK NOTICE ===== */
.mock-notice {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    background: var(--accent-purple-light);
    border: 1px solid var(--accent-purple);
    border-radius: var(--radius);
    margin-bottom: 16px;
    font-size: 13px;
    color: var(--accent-purple);
}

.mock-notice .material-symbols-rounded {
    font-size: 16px;
}

/* ===== INSPECT BUTTON ===== */
.inspect-btn {
    width: 32px;
    height: 32px;
    position: absolute;
    top: 10px;
    right: 4px;
    color: var(--fg-subtle);
}

.inspect-btn:hover { background: var(--bg); color: var(--fg); }

.result-item {
    position: relative;
    padding-right: 40px;
}

.video-info {
    position: relative;
    padding-right: 40px;
}

.video-info .inspect-btn {
    top: 8px;
    right: 8px;
}

/* ===== INSPECT MODAL ===== */
.modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 1500;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    animation: modalFadeIn 200ms ease;
}

.modal-backdrop[hidden] { display: none; }

@keyframes modalFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-panel {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: var(--shadow-hover);
    width: 100%;
    max-width: 680px;
    max-height: 85vh;
    max-height: 85dvh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: modalPop 200ms ease;
}

@keyframes modalPop {
    from { opacity: 0; transform: scale(0.96) translateY(8px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.modal-title {
    font-family: 'Sora', sans-serif;
    font-size: 15px;
    font-weight: 600;
    color: var(--fg);
}

.modal-body {
    padding: 16px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.inspect-preview {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 12px;
}

.inspect-thumbnail {
    max-width: 100%;
    max-height: 260px;
    border-radius: var(--radius);
    object-fit: contain;
    background: var(--bg);
}

.inspect-title {
    font-size: 17px;
    font-weight: 600;
    line-height: 1.4;
    margin-bottom: 8px;
    word-break: break-word;
}

.inspect-title a {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.inspect-open-icon { font-size: 16px; }

.inspect-snippet {
    font-size: 14px;
    color: var(--fg-muted);
    line-height: 1.6;
    margin-bottom: 12px;
    word-break: break-word;
}

.inspect-details {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    margin-bottom: 12px;
}

.inspect-row {
    display: flex;
    gap: 12px;
    padding: 8px 12px;
    border-bottom: 1px solid var(--border);
    font-size: 13px;
}

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

.inspect-key {
    flex: 0 0 160px;
    color: var(--fg-subtle);
    font-weight: 500;
    word-break: break-word;
}

.inspect-value {
    flex: 1;
    color: var(--fg);
    min-width: 0;
    word-break: break-word;
}

.inspect-nested summary {
    cursor: pointer;
    color: var(--accent);
    user-select: none;
}

.inspect-nested pre {
    margin-top: 6px;
    font-family: 'SF Mono', 'Menlo', 'Consolas', monospace;
    font-size: 12px;
    line-height: 1.5;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 8px;
    overflow-x: auto;
    white-space: pre-wrap;
    word-break: break-word;
}

.inspect-raw-wrap {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

.inspect-raw-wrap > summary {
    cursor: pointer;
    padding: 10px 12px;
    font-size: 13px;
    font-weight: 500;
    color: var(--fg);
    background: var(--bg);
    user-select: none;
    list-style: none;
    display: flex;
    align-items: center;
    gap: 6px;
}

.inspect-raw-wrap > summary::-webkit-details-marker { display: none; }

.inspect-raw-wrap > summary::before {
    content: 'chevron_right';
    font-family: 'Material Symbols Rounded';
    font-size: 18px;
    color: var(--fg-subtle);
    transition: transform 150ms ease;
}

.inspect-raw-wrap[open] > summary::before {
    transform: rotate(90deg);
}

.inspect-raw-size {
    font-size: 11px;
    color: var(--fg-subtle);
    font-weight: 400;
}

.inspect-raw-toolbar {
    display: flex;
    justify-content: flex-end;
    padding: 8px 12px 0;
}

.inspect-raw-toolbar .btn {
    padding: 6px 12px;
    font-size: 12px;
}

.inspect-raw-toolbar .btn .material-symbols-rounded { font-size: 16px; }

.inspect-raw {
    margin-top: 8px;
    font-family: 'SF Mono', 'Menlo', 'Consolas', monospace;
    font-size: 12px;
    line-height: 1.5;
    background: var(--bg);
    border: none;
    border-top: 1px solid var(--border);
    padding: 12px;
    overflow: auto;
    max-height: 320px;
    white-space: pre-wrap;
    word-break: break-word;
}

body.modal-open { overflow: hidden; }

/* Image overlay action buttons */
.image-actions {
    display: flex;
    gap: 8px;
}

.image-action {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: var(--radius-full);
    background: rgba(0, 0, 0, 0.6);
    color: white;
    border: none;
    cursor: pointer;
    transition: background 150ms ease, transform 150ms ease;
}

.image-action:hover { background: rgba(0, 0, 0, 0.85); transform: scale(1.05); }

.image-action .material-symbols-rounded { font-size: 20px; color: white; }

.image-action.inspect-btn {
    position: static;
    width: auto;
    height: auto;
    top: auto;
    right: auto;
}

/* ===== RESPONSIVE ADJUSTMENTS ===== */
@media (max-width: 640px) {
    .image-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 8px;
    }
    
    .video-grid-item {
        flex-direction: column;
    }

    .video-grid-item > a {
        width: 100%;
    }

    .video-info {
        padding: 12px;
    }
    
    .news-results .result-item {
        flex-direction: column;
    }
    
    .news-thumbnail {
        width: 100%;
        height: 180px;
    }
    
    .location-info {
        left: 12px;
        right: 12px;
        bottom: 12px;
        max-width: none;
    }

    .modal-backdrop {
        padding: 12px;
        align-items: flex-end;
    }

    .modal-panel {
        max-height: 88vh;
        max-height: 88dvh;
        border-radius: 16px 16px 8px 8px;
    }

    .inspect-row {
        flex-direction: column;
        gap: 4px;
    }

    .inspect-key {
        flex: none;
    }
}