/* ============================================================
   FONOBLE — Hacker Theme
   Green/black terminal aesthetic, mobile-first, dark mode
   ============================================================ */

/* ── Fonts ─────────────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Share+Tech+Mono&family=Inter:wght@400;500;600&display=swap');

/* ── Variables ─────────────────────────────────────────────── */
:root {
    --black:        #0a0a0a;
    --black-2:      #111111;
    --black-3:      #1a1a1a;
    --black-4:      #222222;
    --black-5:      #2a2a2a;

    --green:        #00ff41;
    --green-dim:    #00cc33;
    --green-dark:   #003d0f;
    --green-glow:   rgba(0, 255, 65, 0.15);

    --cyan:         #00e5ff;
    --cyan-dim:     #00b8cc;
    --pink:         #ff2d78;
    --pink-dim:     #cc1f5a;
    --blue:         #2979ff;
    --blue-dim:     #1a4fcc;
    --amber:        #ffab00;

    --text:         #c8ffc8;
    --text-dim:     #7aad7a;
    --text-muted:   #4a7a4a;
    --border:       rgba(0, 255, 65, 0.15);
    --border-hover: rgba(0, 255, 65, 0.35);

    --font-mono:    'Share Tech Mono', 'Courier New', monospace;
    --font-sans:    'Inter', system-ui, sans-serif;

    --radius:       4px;
    --radius-lg:    8px;
    --header-h:     56px;
    --max-w:        860px;
}

/* ── Reset ─────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body {
    background: var(--black);
    color: var(--text);
    font-family: var(--font-sans);
    font-size: 15px;
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

a { color: var(--cyan); text-decoration: none; }
a:hover { color: var(--green); }

img { max-width: 100%; display: block; }

/* ── Scanline overlay (subtle CRT effect) ───────────────────── */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    background: repeating-linear-gradient(
            0deg,
            transparent,
            transparent 2px,
            rgba(0, 0, 0, 0.03) 2px,
            rgba(0, 0, 0, 0.03) 4px
    );
    pointer-events: none;
    z-index: 9999;
}

/* ── Header ─────────────────────────────────────────────────── */
#site-header {
    position: sticky;
    top: 0;
    z-index: 100;
    height: var(--header-h);
    background: var(--black-2);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 0 20px;
}

.logo {
    font-family: var(--font-mono);
    font-size: 22px;
    color: var(--green);
    letter-spacing: 2px;
    white-space: nowrap;
    text-shadow: 0 0 12px var(--green);
    flex-shrink: 0;
}

.logo:hover { color: var(--green); opacity: 0.85; }

.logo-f {
    color: var(--cyan);
    text-shadow: 0 0 12px var(--cyan);
}

/* ── Search box ─────────────────────────────────────────────── */
.search-form { flex: 1; }

.search-box {
    display: flex;
    align-items: center;
    background: var(--black-3);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    transition: border-color 0.2s;
}

.search-box:focus-within {
    border-color: var(--green);
    box-shadow: 0 0 0 2px var(--green-glow);
}

.search-box input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text);
    font-family: var(--font-mono);
    font-size: 15px;
    padding: 10px 14px;
    caret-color: var(--green);
}

.search-box input::placeholder { color: var(--text-muted); }

.search-box button {
    background: transparent;
    border: none;
    border-left: 1px solid var(--border);
    color: var(--green);
    padding: 0 14px;
    height: 40px;
    cursor: pointer;
    display: flex;
    align-items: center;
    transition: background 0.15s, color 0.15s;
}

.search-box button:hover {
    background: var(--green-glow);
    color: var(--green);
}

/* ── Safe search toggle ─────────────────────────────────────── */
.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

.safe-toggle {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--text-dim);
    font-family: var(--font-mono);
    cursor: pointer;
}

.toggle {
    display: inline-flex;
    align-items: center;
    width: 36px;
    height: 20px;
    background: var(--black-4);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 2px;
    transition: background 0.2s, border-color 0.2s;
    position: relative;
}

.toggle.on {
    background: var(--green-dark);
    border-color: var(--green-dim);
}

.knob {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--text-muted);
    transition: transform 0.2s, background 0.2s;
    display: block;
}

.toggle.on .knob {
    transform: translateX(16px);
    background: var(--green);
    box-shadow: 0 0 6px var(--green);
}

/* ── Homepage ───────────────────────────────────────────────── */
.homepage #site-header { background: transparent; border-bottom: none; }
.homepage #site-footer { margin-top: auto; }

.home-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    text-align: center;
}

.home-logo {
    font-family: var(--font-mono);
    font-size: clamp(48px, 10vw, 96px);
    color: var(--green);
    letter-spacing: 8px;
    text-shadow: 0 0 30px var(--green), 0 0 60px rgba(0,255,65,0.3);
    margin-bottom: 8px;
    line-height: 1;
}

.home-logo .logo-f {
    color: var(--cyan);
    text-shadow: 0 0 30px var(--cyan), 0 0 60px rgba(0,229,255,0.3);
}

.tagline {
    font-size: 13px;
    color: var(--text-muted);
    font-family: var(--font-mono);
    letter-spacing: 2px;
    margin-bottom: 40px;
    margin-top: 8px;
}

.home-search {
    width: 100%;
    max-width: 600px;
    margin-bottom: 28px;
}

.home-search .search-box {
    height: 52px;
}

.home-search .search-box input {
    font-size: 16px;
}

.home-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
}

.badge {
    font-family: var(--font-mono);
    font-size: 11px;
    padding: 4px 10px;
    border: 1px solid var(--border);
    border-radius: 20px;
    color: var(--text-muted);
    letter-spacing: 1px;
}

/* ── Results page layout ────────────────────────────────────── */
.results-page {
    display: flex;
    flex-direction: column;
}

.results-main {
    flex: 1;
    max-width: var(--max-w);
    width: 100%;
    margin: 0 auto;
    padding: 20px 20px 40px;
}

/* ── Result tabs ────────────────────────────────────────────── */
.result-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 16px;
    border-bottom: 1px solid var(--border);
    padding-bottom: 0;
}

.tab {
    font-family: var(--font-mono);
    font-size: 13px;
    padding: 8px 16px;
    color: var(--text-dim);
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    transition: color 0.15s, border-color 0.15s;
    letter-spacing: 1px;
}

.tab:hover { color: var(--green); }

.tab.active {
    color: var(--green);
    border-bottom-color: var(--green);
    text-shadow: 0 0 8px var(--green-glow);
}

/* ── Result count ───────────────────────────────────────────── */
.result-count {
    font-size: 12px;
    color: var(--text-muted);
    font-family: var(--font-mono);
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.safe-badge {
    color: var(--green-dim);
    border: 1px solid var(--green-dark);
    padding: 1px 8px;
    border-radius: 20px;
    font-size: 11px;
}

/* ── AI answer box ──────────────────────────────────────────── */
.ai-box {
    background: var(--black-3);
    border: 1px solid var(--cyan-dim);
    border-left: 3px solid var(--cyan);
    border-radius: var(--radius-lg);
    padding: 16px 20px;
    margin-bottom: 24px;
    box-shadow: 0 0 20px rgba(0, 229, 255, 0.05);
}

.ai-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--cyan);
    letter-spacing: 2px;
    margin-bottom: 10px;
    text-transform: uppercase;
}

.ai-content {
    color: var(--text);
    font-size: 14px;
    line-height: 1.7;
}

.ai-actions {
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px solid var(--border);
}

.ai-chat-link {
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--cyan-dim);
    letter-spacing: 1px;
}

.ai-chat-link:hover { color: var(--cyan); }

/* ── Web result items ───────────────────────────────────────── */
.results-list { display: flex; flex-direction: column; gap: 24px; }

.result-item {
    border-bottom: 1px solid var(--border);
    padding-bottom: 24px;
}

.result-url {
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--green-dim);
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.result-title {
    font-size: 18px;
    font-weight: 500;
    line-height: 1.3;
    margin-bottom: 6px;
}

.result-title a {
    color: var(--cyan);
    transition: color 0.15s, text-shadow 0.15s;
}

.result-title a:hover {
    color: var(--green);
    text-shadow: 0 0 8px var(--green-glow);
}

.result-snippet {
    font-size: 14px;
    color: var(--text-dim);
    line-height: 1.6;
}

.adult-badge {
    display: inline-block;
    margin-top: 6px;
    font-family: var(--font-mono);
    font-size: 10px;
    padding: 2px 8px;
    background: rgba(255, 45, 120, 0.1);
    border: 1px solid var(--pink-dim);
    color: var(--pink);
    border-radius: 20px;
    letter-spacing: 1px;
}

/* ── Image grid ─────────────────────────────────────────────── */
.image-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 8px;
}

.image-item {
    position: relative;
    background: var(--black-3);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    aspect-ratio: 1;
    display: flex;
    flex-direction: column;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.image-item:hover {
    border-color: var(--cyan-dim);
    box-shadow: 0 0 12px rgba(0, 229, 255, 0.1);
}

.image-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.image-caption {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(10, 10, 10, 0.85);
    font-size: 11px;
    color: var(--text-dim);
    padding: 4px 6px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    opacity: 0;
    transition: opacity 0.2s;
}

.image-item:hover .image-caption { opacity: 1; }

/* ── Video results ──────────────────────────────────────────── */
.video-item {
    display: flex;
    gap: 16px;
    align-items: flex-start;
}

.video-thumb {
    position: relative;
    flex-shrink: 0;
    width: 160px;
    height: 90px;
    background: var(--black-3);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.video-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.play-icon {
    position: absolute;
    font-size: 28px;
    color: var(--green);
    text-shadow: 0 0 12px var(--green);
    opacity: 0.8;
}

.platform-badge {
    font-family: var(--font-mono);
    font-size: 10px;
    padding: 2px 8px;
    background: var(--green-dark);
    color: var(--green-dim);
    border-radius: 20px;
    letter-spacing: 1px;
    display: inline-block;
    margin-bottom: 6px;
}

/* ── AI Chat ────────────────────────────────────────────────── */
.ai-chat {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.chat-msg { display: flex; }
.chat-msg.user { justify-content: flex-end; }
.chat-msg.assistant { justify-content: flex-start; }

.chat-bubble {
    max-width: 80%;
    padding: 12px 16px;
    border-radius: var(--radius-lg);
    font-size: 14px;
    line-height: 1.6;
}

.chat-msg.user .chat-bubble {
    background: var(--green-dark);
    border: 1px solid var(--green-dim);
    color: var(--text);
    font-family: var(--font-mono);
}

.chat-msg.assistant .chat-bubble {
    background: var(--black-3);
    border: 1px solid var(--border);
    color: var(--text);
}

.chat-form { margin-top: 8px; }

.chat-form .search-box button {
    background: var(--green-dark);
    color: var(--green);
    border-left: 1px solid var(--green-dim);
    padding: 0 20px;
    font-family: var(--font-mono);
    font-size: 13px;
    width: auto;
}

.clear-chat {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--text-muted);
    align-self: center;
    letter-spacing: 1px;
}

.clear-chat:hover { color: var(--pink); }

/* ── No results ─────────────────────────────────────────────── */
.no-results {
    padding: 40px 0;
    color: var(--text-dim);
    font-family: var(--font-mono);
    text-align: center;
}

.no-results strong { color: var(--green); }
.no-results a { color: var(--cyan); }

/* ── Pagination ─────────────────────────────────────────────── */
.pagination {
    display: flex;
    gap: 6px;
    justify-content: center;
    margin-top: 40px;
    flex-wrap: wrap;
}

.page-btn {
    font-family: var(--font-mono);
    font-size: 13px;
    padding: 6px 12px;
    background: var(--black-3);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-dim);
    transition: border-color 0.15s, color 0.15s;
}

.page-btn:hover {
    border-color: var(--green-dim);
    color: var(--green);
}

.page-btn.active {
    background: var(--green-dark);
    border-color: var(--green-dim);
    color: var(--green);
    text-shadow: 0 0 6px var(--green-glow);
}

/* ── Footer ─────────────────────────────────────────────────── */
#site-footer {
    border-top: 1px solid var(--border);
    padding: 16px 20px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px 24px;
    justify-content: center;
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--text-muted);
    letter-spacing: 1px;
    background: var(--black-2);
}

/* ── Scrollbar ──────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--black); }
::-webkit-scrollbar-thumb { background: var(--black-4); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--green-dark); }

/* ── Selection ──────────────────────────────────────────────── */
::selection { background: var(--green-dark); color: var(--green); }

/* ── Mobile ─────────────────────────────────────────────────── */
@media (max-width: 600px) {
    #site-header { padding: 0 12px; gap: 10px; }

    .logo { font-size: 18px; letter-spacing: 1px; }

    .safe-toggle span { display: none; }

    .results-main { padding: 16px 12px 32px; }

    .result-tabs { gap: 0; }
    .tab { padding: 8px 10px; font-size: 12px; }

    .home-logo { letter-spacing: 4px; }
    .tagline { font-size: 11px; letter-spacing: 1px; }

    .image-grid { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }

    .video-item { flex-direction: column; }
    .video-thumb { width: 100%; height: 180px; }

    .chat-bubble { max-width: 95%; }

    .result-title { font-size: 16px; }
}

/* ── Eagan thinking dots ────────────────────────────────────── */
.eagan-cursor {
    display: inline-flex;
    gap: 5px;
    align-items: center;
    padding: 4px 2px;
    vertical-align: middle;
}

.eagan-cursor span {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--green);
    box-shadow: 0 0 6px var(--green);
    animation: dot-bounce 1.2s ease-in-out infinite;
}

.eagan-cursor span:nth-child(2) { animation-delay: 0.2s; }
.eagan-cursor span:nth-child(3) { animation-delay: 0.4s; }

@keyframes dot-bounce {
    0%, 80%, 100% { transform: translateY(0);    opacity: 0.35; }
    40%           { transform: translateY(-6px); opacity: 1;    }
}

/* ── PWA standalone mode ────────────────────────────────────── */
@media (display-mode: standalone) {
    #site-header { padding-top: env(safe-area-inset-top); }
    body { padding-bottom: env(safe-area-inset-bottom); }
}

/* ── PWA standalone mode ────────────────────────────────────── */
@media (display-mode: standalone) {
    #site-header { padding-top: env(safe-area-inset-top); }
    body { padding-bottom: env(safe-area-inset-bottom); }
}