/* websuche.de – Basis-Stylesheet. Keine externen Fonts/CDNs (DSGVO). */

:root {
    --bg: #ffffff;
    --bg-soft: #f6f7fb;
    --surface: #ffffff;
    --text: #1f2430;
    --text-muted: #5d6576;
    --border: #e3e6ee;
    --primary: #1d4ed8;
    --primary-hover: #1e40af;
    --visited: #6d28d9;
    --accent: #84cc16;
    --url: #15803d;
    --ai-bg: linear-gradient(135deg, #eef4ff 0%, #f3fbe7 100%);
    --ai-border: #c9d8fb;
    --chip-bg: #eef2fb;
    --chip-hover: #dde6fb;
    --shadow: 0 1px 2px rgb(16 24 40 / .06), 0 4px 16px rgb(16 24 40 / .06);
    --radius: 14px;
    --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    color-scheme: light;
}

/* Dunkelmodus nur auf Wunsch (Umschalter oben rechts), Standard ist hell. */
:root[data-theme="dark"] {
    --bg: #0f1218;
    --bg-soft: #151a22;
    --surface: #171c25;
    --text: #e6e9ef;
    --text-muted: #9aa3b5;
    --border: #2a3140;
    --primary: #7ea6ff;
    --primary-hover: #a5c1ff;
    --visited: #c4a6ff;
    --accent: #a3e635;
    --url: #6ee7a0;
    --ai-bg: linear-gradient(135deg, #172238 0%, #1a2618 100%);
    --ai-border: #2c3c5e;
    --chip-bg: #1e2533;
    --chip-hover: #283246;
    --shadow: 0 1px 2px rgb(0 0 0 / .3), 0 4px 16px rgb(0 0 0 / .25);
    color-scheme: dark;
}

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

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--bg);
    color: var(--text);
    font: 16px/1.55 var(--font);
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

.sr-only {
    position: absolute; width: 1px; height: 1px; overflow: hidden;
    clip: rect(0 0 0 0); white-space: nowrap;
}

/* ---------- Logo ---------- */

.logo { display: inline-block; line-height: 0; }
.logo img { display: block; width: auto; height: 100%; }
.logo-lg { height: clamp(5.5rem, 22vw, 9rem); margin-bottom: 2rem; }
.logo-sm { height: 2.6rem; flex: none; }
.logo-dark { display: none !important; }
:root[data-theme="dark"] .logo-light { display: none !important; }
:root[data-theme="dark"] .logo-dark { display: block !important; }

/* ---------- Hell/Dunkel-Umschalter ---------- */

.theme-toggle {
    display: inline-flex; align-items: center; justify-content: center; flex: none;
    width: 2.4rem; height: 2.4rem; padding: 0;
    border: 1px solid var(--border); border-radius: 999px;
    background: var(--surface); color: var(--text-muted);
    cursor: pointer;
}
.theme-toggle:hover { color: var(--text); border-color: var(--text-muted); }
.theme-toggle svg { width: 1.15rem; height: 1.15rem; }
.theme-toggle .icon-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-sun { display: block; }
:root[data-theme="dark"] .theme-toggle .icon-moon { display: none; }
.home > .theme-toggle { position: absolute; top: 1rem; right: 16px; }
.topbar .theme-toggle { margin-left: auto; }

/* ---------- Suchfeld ---------- */

.searchbox {
    position: relative;
    display: flex;
    width: 100%;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 999px;
    box-shadow: var(--shadow);
    transition: border-color .15s, box-shadow .15s;
}
.searchbox:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--primary) 18%, transparent), var(--shadow);
}
.searchbox-icon {
    position: absolute; left: 1.1rem; top: 50%;
    width: 1.2rem; height: 1.2rem; transform: translateY(-50%);
    color: var(--text-muted); pointer-events: none;
}
.searchbox input {
    flex: 1;
    min-width: 0;
    padding: .85rem 1rem .85rem 3rem;
    border: 0;
    background: transparent;
    color: var(--text);
    font: inherit;
    font-size: 1.05rem;
    outline: none;
}
.searchbox input::-webkit-search-cancel-button { cursor: pointer; }
.searchbox button {
    margin: .3rem;
    padding: 0 1.4rem;
    border: 0;
    border-radius: 999px;
    background: var(--primary);
    color: #fff;
    font: inherit;
    font-weight: 600;
    cursor: pointer;
}
.searchbox button:hover { background: var(--primary-hover); }
:root[data-theme="dark"] .searchbox button { color: #0f1218; }

/* ---------- Chips ---------- */

.chips { display: flex; flex-wrap: wrap; gap: .5rem; margin: 0; padding: 0; list-style: none; }
.chip {
    display: inline-block;
    padding: .35rem .85rem;
    border-radius: 999px;
    background: var(--chip-bg);
    color: var(--text);
    font-size: .92rem;
    text-decoration: none !important;
    transition: background .15s;
}
.chip:hover { background: var(--chip-hover); }

.badge-ai {
    display: inline-flex; align-items: center; justify-content: center;
    padding: .1rem .45rem;
    border-radius: 6px;
    background: linear-gradient(135deg, var(--primary), #65a30d);
    color: #fff;
    font-size: .72rem; font-weight: 800; letter-spacing: .04em;
}

/* ---------- Startseite ---------- */

.home {
    position: relative;
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem 16px 3rem;
    background:
        radial-gradient(60rem 30rem at 50% -10%, color-mix(in srgb, var(--primary) 9%, transparent), transparent),
        var(--bg);
}
.home-center { width: 100%; max-width: 640px; text-align: center; margin-top: -6vh; }
.home-hint {
    display: flex; align-items: center; justify-content: center; gap: .5rem;
    margin: 1.25rem 0 0; color: var(--text-muted); font-size: .9rem;
}
.home-features {
    display: inline-flex; flex-direction: column; gap: .45rem;
    margin: 1.75rem 0 0; padding: 0; list-style: none;
    text-align: left; color: var(--text-muted); font-size: .9rem; line-height: 1.45;
}
.home-features li { display: flex; gap: .55rem; }
.home-features strong { color: var(--text); font-weight: 600; }
.home .searchbox input { padding-top: 1rem; padding-bottom: 1rem; font-size: 1.1rem; }

.recent { width: 100%; max-width: 640px; margin-top: 3.5rem; text-align: center; }
.recent h2 {
    margin: 0 0 .75rem; color: var(--text-muted);
    font-size: .78rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase;
}
.recent .chips { justify-content: center; }

/* ---------- Kopfzeile Ergebnisseite ---------- */

.topbar {
    position: sticky; top: 0; z-index: 10;
    background: color-mix(in srgb, var(--bg) 88%, transparent);
    backdrop-filter: saturate(1.4) blur(10px);
    border-bottom: 1px solid var(--border);
}
.topbar-inner {
    display: flex; align-items: center; gap: 1.5rem;
    max-width: 1180px; margin: 0 auto; padding: .75rem 16px;
}
.topbar .searchbox { max-width: 640px; box-shadow: none; }
.topbar .searchbox input { padding-top: .65rem; padding-bottom: .65rem; }

@media (max-width: 640px) {
    .topbar-inner { flex-direction: column; align-items: stretch; gap: .6rem; }
    .topbar .logo { align-self: center; height: 2.2rem; }
    .topbar .theme-toggle { position: absolute; top: .75rem; right: 16px; }
    .searchbox button { padding: 0 1rem; }
}

/* ---------- Ergebnisseite ---------- */

.serp {
    flex: 1;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 300px;
    gap: 3rem;
    width: 100%;
    max-width: 1180px;
    margin: 0 auto;
    padding: 1.25rem 16px 3rem;
}
.serp-main { max-width: 720px; min-width: 0; }
.serp-meta { margin: 0 0 1rem; color: var(--text-muted); font-size: .88rem; }
.serp-time { opacity: .7; }

@media (max-width: 960px) {
    .serp { grid-template-columns: minmax(0, 1fr); gap: 1.5rem; }
}

/* KI-Überblick */

.ai-box {
    margin-bottom: 1.75rem;
    padding: 1.1rem 1.25rem 1rem;
    border: 1px solid var(--ai-border);
    border-radius: var(--radius);
    background: var(--ai-bg);
}
.ai-head { display: flex; align-items: center; gap: .55rem; margin-bottom: .6rem; }
.ai-head h2 { margin: 0; font-size: 1rem; font-weight: 700; }
.ai-text { margin: 0; font-size: 1.02rem; line-height: 1.65; }
.cite {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 1.25rem; height: 1.25rem; margin: 0 .1rem; padding: 0 .3rem;
    border-radius: 999px;
    background: var(--surface);
    border: 1px solid var(--ai-border);
    font-size: .72rem; font-weight: 700;
    vertical-align: .15em;
    text-decoration: none !important;
}
.cite:hover { background: var(--primary); color: #fff; border-color: var(--primary); }



.skeleton { display: grid; gap: .55rem; padding: .2rem 0 .4rem; }
.skeleton span {
    height: .8rem; border-radius: 6px;
    background: linear-gradient(90deg, var(--chip-bg) 25%, var(--chip-hover) 50%, var(--chip-bg) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.3s infinite linear;
}
.skeleton span:nth-child(2) { width: 92%; }
.skeleton span:nth-child(3) { width: 64%; }
@keyframes shimmer { to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { .skeleton span { animation: none; } }

/* Trefferliste */

.results { margin: 0; padding: 0; list-style: none; }
.result {
    display: flex; gap: 1rem; align-items: flex-start;
    padding: 1rem 0;
    border-bottom: 1px solid var(--border);
}
.result:last-child { border-bottom: 0; }
.result-body { flex: 1; min-width: 0; }
.result-link { display: block; text-decoration: none !important; }
.result-crumb {
    display: block;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    color: var(--url); font-size: .82rem;
}
.result-title {
    margin: .1rem 0 .3rem;
    color: var(--primary);
    font-size: 1.15rem; font-weight: 600; line-height: 1.35;
    overflow-wrap: anywhere;
}
.result-link:visited .result-title { color: var(--visited); }
.result-link:hover .result-title { text-decoration: underline; }
.result-snippet { margin: 0; color: var(--text-muted); font-size: .94rem; overflow-wrap: anywhere; }

/* Seitenleiste */

.serp-side { display: flex; flex-direction: column; gap: 1.5rem; min-width: 0; }
.card {
    padding: 1rem 1.1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
}
.card h2 { margin: 0 0 .75rem; font-size: .9rem; }

/* Hinweise & Textseiten */

.notice { padding: 2rem 0; }
.notice h1 { margin: 0 0 .5rem; font-size: 1.35rem; }
.notice p { margin: 0; color: var(--text-muted); }

.page-text { flex: 1; width: 100%; max-width: 720px; margin: 0 auto; padding: 2rem 16px 3rem; }
.page-text h1 { font-size: 1.8rem; margin-top: 0; }
.page-text h2 { font-size: 1.15rem; margin-top: 2rem; }
.page-text li { margin-bottom: .5rem; }

/* Fußzeile */

.site-footer {
    padding: 1.25rem 16px;
    border-top: 1px solid var(--border);
    background: var(--bg-soft);
    color: var(--text-muted);
    font-size: .85rem;
    text-align: center;
}
.site-footer nav { display: flex; flex-wrap: wrap; justify-content: center; gap: .4rem 1.5rem; margin-bottom: .4rem; }
.site-footer a { color: var(--text-muted); }
.site-footer p { margin: 0; }

/* Ladezustand der Trefferliste */

.loading-note { display: flex; align-items: center; gap: .6rem; margin: .5rem 0 1rem; color: var(--text-muted); font-size: .92rem; }
.spinner {
    width: 1rem; height: 1rem; flex: none;
    border: 2px solid var(--border); border-top-color: var(--primary); border-radius: 50%;
    animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.skeleton-results { gap: 1.4rem; }
.skeleton-results span, .skeleton-results span:nth-child(n) { width: 100%; height: 4.5rem; border-radius: 10px; }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 2s; } }
.results + .loading-note { margin-top: .25rem; padding-top: .9rem; border-top: 1px solid var(--border); }
