/* ============================================================
   UMBRIXA — Redesign 2026
   Phantom Grid + Playfair Display
   ============================================================ */

:root {
    --bg:            #07070d;
    --bg-card:       rgba(255,255,255,.03);
    --bg-card-hover: rgba(120,80,200,.08);
    --bg-input:      rgba(255,255,255,.05);
    --border:        rgba(255,255,255,.07);
    --border-accent: rgba(140,100,220,.3);
    --accent:        #9070d8;
    --accent-hover:  #a888e8;
    --accent-dim:    rgba(120,80,200,.12);
    --text:          rgba(255,255,255,.88);
    --text-muted:    rgba(255,255,255,.45);
    --text-dim:      rgba(255,255,255,.22);
    --green:         #3ecf8e;
    --red:           #f55;
    --radius:        10px;
    --radius-sm:     7px;
    --shadow:        0 8px 40px rgba(0,0,0,.6);
    --grid-color:    rgba(100,70,180,.07);
    --grid-size:     40px;
}

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

html { font-size: 16px; scroll-behavior: smooth; overflow-x: hidden; }

body {
    background-color: var(--bg);
    background-image:
        linear-gradient(var(--grid-color) 1px, transparent 1px),
        linear-gradient(90deg, var(--grid-color) 1px, transparent 1px);
    background-size: var(--grid-size) var(--grid-size);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
}

/* Gradiente radiale viola che emerge dall'alto */
body::before {
    content: '';
    position: fixed; inset: 0; z-index: 0; pointer-events: none;
    background: radial-gradient(ellipse 85% 55% at 50% -5%,
        rgba(70,35,140,.5) 0%, transparent 60%);
}

p, li, td, th, div { overflow-wrap: break-word; word-break: break-word; }
code, pre, .result-card__url { word-break: break-all; }

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

.container {
    max-width: 960px;
    margin: 0 auto;
    padding: 0 1.5rem;
    position: relative; z-index: 1;
}

/* ---- HEADER ---- */
.site-header {
    border-bottom: 1px solid var(--border);
    padding: 1rem 2rem;
    position: sticky; top: 0; z-index: 100;
    /* backdrop-filter sul ::before, non sull'header stesso:
       backdrop-filter su un elemento crea un containing block per position:fixed nei figli,
       clippandoli alla sua box. Usare ::before preserva il blur senza quel side effect. */
}
.site-header::before {
    content: '';
    position: absolute; inset: 0; z-index: -1;
    background: rgba(7,7,13,.82);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
}

.header-inner {
    display: flex; align-items: center; gap: 1.5rem; flex-wrap: wrap;
    max-width: 960px; margin: 0 auto;
}

.site-logo {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 1.15rem; font-weight: 900; font-style: italic;
    background: linear-gradient(135deg, #f0e8ff 0%, #c0a0e8 50%, #8050c0 100%);
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
    white-space: nowrap;
}
.site-logo span { -webkit-text-fill-color: inherit; }

.header-search { flex: 1; min-width: 200px; }
.header-search form { display: flex; gap: 0.4rem; }
.header-search input {
    flex: 1; background: var(--bg-input); border: 1px solid var(--border);
    border-radius: var(--radius-sm); color: var(--text);
    font-size: 0.9rem; padding: 0.45rem 0.75rem; outline: none;
    transition: border-color .2s;
}
.header-search input:focus { border-color: var(--border-accent); }

.header-search__btn {
    background: var(--accent); border: none; border-radius: var(--radius-sm);
    color: #fff; cursor: pointer; font-size: 0.88rem; font-weight: 600;
    padding: 0.45rem 1rem; transition: background .2s; white-space: nowrap;
}
.header-search__btn:hover { background: var(--accent-hover); }

.header-nav { display: flex; gap: 1.5rem; font-size: 0.82rem; white-space: nowrap; }
.header-nav a { color: var(--text-dim); transition: color .15s; }
.header-nav a:hover { color: var(--text-muted); }

/* ---- HERO ---- */
.hero {
    position: relative; z-index: 1;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    min-height: 62vh; padding: 4rem 1.5rem 3rem;
    text-align: center;
}

.hero-eyebrow {
    font-size: 0.68rem; letter-spacing: 0.18em; text-transform: uppercase;
    color: rgba(150,120,220,.55);
    border: 1px solid rgba(150,120,220,.2);
    padding: 0.28rem 0.9rem; border-radius: 100px;
    display: inline-block; margin-bottom: 1.5rem;
}

.hero-logo {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: clamp(3.5rem, 9vw, 6.5rem);
    font-weight: 900; font-style: italic;
    letter-spacing: -0.02em; line-height: 1;
    margin-bottom: 0.7rem;
    background: linear-gradient(150deg, #f0e8ff 0%, #c0a0e8 45%, #8050c0 100%);
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 0 40px rgba(120,70,200,.3));
}
.hero-logo span { -webkit-text-fill-color: inherit; }

.hero-tagline {
    font-size: 0.82rem; color: var(--text-dim);
    letter-spacing: 0.1em; text-transform: uppercase;
    margin-bottom: 2.5rem;
}

/* ---- SEARCH WRAP ---- */
.search-wrap { width: 100%; max-width: 660px; }

.search-bar {
    display: flex; align-items: center;
    background: var(--bg-input);
    border: 1px solid var(--border-accent);
    border-radius: 12px;
    padding: 0 0.5rem 0 1.25rem;
    box-shadow: 0 0 0 1px rgba(140,100,220,.08), var(--shadow);
    transition: border-color .2s, box-shadow .2s;
    max-width: 660px; margin: 0 auto;
}
.search-bar:focus-within {
    border-color: rgba(160,120,240,.6);
    box-shadow: 0 0 0 3px rgba(140,100,220,.12), var(--shadow);
}

.search-bar input[type="search"],
.search-bar input[type="text"] {
    flex: 1; background: none; border: none; outline: none;
    color: var(--text); font-size: 1rem;
    padding: 1rem 0; caret-color: var(--accent);
}
.search-bar input::placeholder { color: var(--text-dim); }

.search-bar button {
    background: var(--accent); border: none; border-radius: 8px;
    color: #fff; cursor: pointer; font-size: 0.88rem; font-weight: 600;
    padding: 0.6rem 1.3rem; margin: 0.35rem 0;
    transition: background .15s; flex-shrink: 0;
}
.search-bar button:hover { background: var(--accent-hover); }

.search-hint {
    font-size: 0.73rem; color: var(--text-dim);
    margin-top: 0.85rem; letter-spacing: 0.04em;
}

.stats-bar { display: none; }

/* ---- SECTION DIVIDER ---- */
.section-divider {
    position: relative; z-index: 1;
    display: flex; align-items: center; gap: 1.25rem;
    max-width: 960px; margin: 2rem auto;
    padding: 0 1.5rem;
}
.section-divider::before,
.section-divider::after {
    content: ''; flex: 1;
    height: 1px; background: var(--border);
}
.section-divider span {
    font-size: 0.65rem; letter-spacing: 0.14em; text-transform: uppercase;
    color: var(--text-dim); white-space: nowrap;
}

/* ---- CATEGORIE GRID ---- */
.section-title {
    font-size: 0.65rem; font-weight: 600; letter-spacing: 0.12em;
    text-transform: uppercase; color: var(--text-dim); margin-bottom: 1rem;
    position: relative; z-index: 1;
}

.categories-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.7rem; margin-bottom: 2rem;
    position: relative; z-index: 1;
}

.cat-card {
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 0.9rem 1.1rem;
    cursor: pointer; display: block; color: var(--text);
    transition: border-color .15s, background .15s;
}
.cat-card:hover {
    border-color: var(--border-accent);
    background: var(--bg-card-hover); color: var(--text);
}
.cat-card__icon { display: none; }
.cat-card__label {
    font-size: 0.83rem; font-weight: 600; margin-bottom: 0.2rem;
    color: rgba(255,255,255,.75);
}
.cat-card__desc { display: none; }
.cat-card__count { font-size: 0.7rem; color: rgba(140,100,220,.6); margin-top: 0.2rem; }

/* ---- RISULTATI / LISTE ---- */
.results-list {
    display: flex; flex-direction: column; gap: 0;
    margin-bottom: 2rem; position: relative; z-index: 1;
}

.result-card {
    border-bottom: 1px solid var(--border);
    padding: 0.85rem 0;
    transition: background .15s;
}
.result-card:last-child { border-bottom: none; }
.result-card:first-child { border-top: 1px solid var(--border); }

.result-card__top { display: flex; align-items: flex-start; gap: 1rem; flex-wrap: wrap; }

.result-card__title {
    font-size: 0.9rem; font-weight: 600;
    color: rgba(200,175,255,.8); display: block; margin-bottom: 0.15rem;
}
.result-card__title:hover { color: var(--accent-hover); }

.result-card__url {
    font-size: 0.7rem; color: var(--text-dim);
    font-family: 'Courier New', monospace; word-break: break-all; margin-bottom: 0.3rem;
}
.result-card__desc {
    font-size: 0.83rem; color: var(--text-muted); line-height: 1.5;
}
.result-card__meta {
    display: flex; gap: 0.5rem; flex-wrap: wrap; margin-top: 0.4rem; align-items: center;
}

/* ---- RECENT LIST (homepage) ---- */
.recent-list {
    display: flex; flex-direction: column;
    position: relative; z-index: 1;
    margin-bottom: 3rem;
}
.site-row {
    display: flex; align-items: baseline; gap: 1rem;
    padding: 0.7rem 0;
    border-bottom: 1px solid var(--border);
    text-decoration: none; transition: opacity .15s;
}
.site-row:first-child { border-top: 1px solid var(--border); }
.site-row:last-child { border-bottom: none; }
.site-row__title {
    font-size: 0.87rem; font-weight: 600;
    color: rgba(200,175,255,.8); flex: 1;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0;
}
.site-row:hover .site-row__title { color: var(--accent-hover); }
.site-row__cat {
    font-size: 0.7rem; color: rgba(140,100,220,.5);
    white-space: nowrap; flex-shrink: 0;
}
.site-row__onion {
    font-family: 'Courier New', monospace; font-size: 0.68rem;
    color: var(--text-dim); white-space: nowrap; overflow: hidden;
    text-overflow: ellipsis; max-width: 220px; flex-shrink: 0;
}

/* ---- BADGE ---- */
.badge {
    font-size: 0.68rem; font-weight: 600;
    padding: 0.18rem 0.5rem; border-radius: 20px;
    background: var(--accent-dim); color: var(--accent);
    letter-spacing: 0.02em;
}
.badge--green { background: rgba(62,207,142,.1); color: var(--green); }
.badge--muted { background: rgba(255,255,255,.06); color: var(--text-muted); }

/* ---- PAGINAZIONE ---- */
.pagination {
    display: flex; justify-content: center; gap: 0.4rem;
    padding: 1.5rem 0 3rem; flex-wrap: wrap;
    position: relative; z-index: 1;
}
.page-btn {
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius-sm); color: var(--text-muted);
    font-size: 0.83rem; padding: 0.38rem 0.7rem;
    text-decoration: none; transition: all .15s;
}
.page-btn:hover, .page-btn.active {
    border-color: var(--border-accent); color: var(--accent); background: var(--accent-dim);
}

/* ---- SIDEBAR FILTRI ---- */
.search-layout {
    display: grid; grid-template-columns: 200px 1fr;
    gap: 1.5rem; align-items: start; padding: 2rem 0;
    position: relative; z-index: 1;
}
.sidebar {
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 1rem; position: sticky; top: 72px;
}
.sidebar-title {
    font-size: 0.68rem; font-weight: 700; letter-spacing: 0.1em;
    text-transform: uppercase; color: var(--text-dim); margin-bottom: 0.75rem;
}
.filter-list { list-style: none; display: flex; flex-direction: column; gap: 0.15rem; }
.filter-list a {
    display: flex; align-items: center; justify-content: space-between;
    padding: 0.38rem 0.6rem; border-radius: var(--radius-sm);
    font-size: 0.83rem; color: var(--text-muted); transition: all .15s;
}
.filter-list a:hover, .filter-list a.active { background: var(--accent-dim); color: var(--accent); }
.filter-count { font-size: 0.7rem; color: var(--text-dim); }

/* ---- FOOTER ---- */
.site-footer {
    border-top: 1px solid var(--border);
    padding: 2.5rem 0 2rem;
    position: relative; z-index: 1;
}
.footer-inner {
    display: flex; flex-direction: column;
    align-items: center; gap: 1rem;
    text-align: center;
}
.footer-copy {
    font-size: 0.78rem; color: var(--text-dim);
    letter-spacing: 0.03em; margin: 0;
}
.footer-tor { color: var(--accent); }
.footer-nav {
    display: flex; flex-wrap: wrap;
    justify-content: center; align-items: center;
    gap: 0; padding: 0; margin: 0;
}
.footer-nav a,
.footer-copy-btn {
    color: var(--text-dim); font-size: 0.78rem;
    transition: color .15s; padding: 0.3rem 0.6rem;
    white-space: nowrap;
}
.footer-nav a:hover,
.footer-copy-btn:hover { color: var(--text-muted); }
.footer-copy-btn {
    background: none; border: none; cursor: pointer;
    font-family: inherit;
}
.footer-nav > * + *::before {
    content: '·';
    color: var(--border-accent);
    margin-right: 0.6rem;
}

/* ---- SELECT (dark theme) ---- */
select {
    background: #12121f; color: var(--text);
    border: 1px solid var(--border); border-radius: var(--radius-sm);
    font-size: 0.85rem; padding: 0.45rem 0.75rem; cursor: pointer;
    appearance: auto;
}
select option {
    background: #12121f; color: var(--text);
}
select:focus { outline: none; border-color: var(--border-accent); }

/* ---- HEADER ACTIONS (search icon + hamburger group) ---- */
.header-actions {
    display: flex; align-items: center; gap: 0.4rem;
    margin-left: auto; flex-shrink: 0;
}

.search-icon-btn {
    display: none; align-items: center; justify-content: center;
    background: transparent; border: 1px solid var(--border);
    border-radius: var(--radius-sm); cursor: pointer;
    padding: 0.45rem 0.55rem; color: var(--text-dim);
    transition: color .15s, border-color .15s;
}
.search-icon-btn:hover { color: var(--text-muted); border-color: var(--border-accent); }

.mobile-search-bar {
    display: none;
    padding: 0.5rem 0 0.25rem;
}
.mobile-search-bar form { display: flex; gap: 0.4rem; }
.mobile-search-bar input {
    flex: 1; background: var(--bg-input); border: 1px solid var(--border);
    border-radius: var(--radius-sm); color: var(--text);
    font-size: 0.9rem; padding: 0.5rem 0.75rem; outline: none;
    transition: border-color .2s; min-width: 0;
}
.mobile-search-bar input:focus { border-color: var(--border-accent); }
.mobile-search-bar button {
    background: var(--accent); border: none; border-radius: var(--radius-sm);
    color: #fff; cursor: pointer; font-size: 0.88rem; font-weight: 600;
    padding: 0.5rem 1rem; white-space: nowrap; transition: background .2s;
}
.mobile-search-bar button:hover { background: var(--accent-hover); }

/* ---- HAMBURGER ---- */
.hamburger {
    display: none; flex-direction: column; justify-content: center; gap: 5px;
    background: transparent; border: 1px solid var(--border);
    border-radius: var(--radius-sm); cursor: pointer;
    padding: 0.45rem 0.55rem; flex-shrink: 0;
}
.hamburger span {
    display: block; width: 18px; height: 2px;
    background: var(--text-dim); border-radius: 2px; transition: all .2s;
}

/* ---- SITE LINK BUTTONS ---- */
.site-links { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.75rem; }
.site-link {
    font-size: 0.82rem; font-weight: 600; padding: 0.45rem 1rem;
    border-radius: var(--radius-sm); text-decoration: none; transition: all .15s;
    letter-spacing: 0.02em;
}
.site-link--onion {
    background: transparent; color: var(--accent);
    border: 1px solid var(--border-accent);
}
.site-link--onion:hover { background: var(--accent-dim); color: var(--accent-hover); }
.site-link--clearnet {
    background: transparent; color: var(--green);
    border: 1px solid rgba(62,207,142,.25);
}
.site-link--clearnet:hover { background: rgba(62,207,142,.08); }

/* ---- TOR MODAL ---- */
.tor-modal {
    position: fixed; inset: 0; background: rgba(0,0,0,.88);
    display: flex; align-items: center; justify-content: center;
    z-index: 10000; padding: 1rem;
}
.tor-modal__box {
    background: #12121f; border: 1px solid rgba(140,100,220,.25);
    border-radius: var(--radius); box-shadow: 0 0 0 1px rgba(0,0,0,.5), var(--shadow);
    max-width: 420px; width: 100%; padding: 2rem;
    position: relative; text-align: center;
}
.tor-modal__close {
    position: absolute; top: 0.75rem; right: 0.9rem;
    background: none; border: none; color: var(--text-dim);
    cursor: pointer; font-size: 1rem; line-height: 1; padding: 0.2rem 0.4rem;
}
.tor-modal__close:hover { color: var(--text); }
.tor-modal__icon { font-size: 1.4rem; margin-bottom: 0.75rem; color: var(--accent); }
.tor-modal__title { font-size: 1rem; font-weight: 700; color: var(--text); margin-bottom: 0.6rem; }
.tor-modal__body { font-size: 0.85rem; color: var(--text-muted); line-height: 1.6; margin-bottom: 1.25rem; }
.tor-modal__actions { display: flex; flex-direction: column; gap: 0.5rem; }
.tor-modal__btn {
    border-radius: var(--radius-sm); font-size: 0.85rem; font-weight: 600;
    padding: 0.6rem 1.2rem; text-align: center; text-decoration: none;
    transition: background .15s, color .15s; display: block;
}
.tor-modal__btn--accent { background: var(--accent); color: #fff; }
.tor-modal__btn--accent:hover { background: var(--accent-hover); }
.tor-modal__btn--outline { border: 1px solid var(--border); color: var(--text-muted); }
.tor-modal__btn--outline:hover { border-color: var(--border-accent); color: var(--accent); }

/* ---- NAV OVERLAY (mobile) ---- */
.nav-overlay {
    display: none; position: fixed; inset: 0;
    background: rgba(0,0,0,.55); z-index: 8998; cursor: pointer;
}
.nav-overlay.is-open { display: block; }

/* ---- RESPONSIVE ---- */
@media (max-width: 768px) {
    .site-header { padding: 0.65rem 0; }
    .hamburger { display: flex; }
    .search-icon-btn { display: flex; }
    .header-inner { flex-wrap: nowrap; }
    .header-search { display: none; }
    .mobile-search-bar.is-open { display: block; }

    /* Drawer da sinistra */
    .header-nav {
        position: fixed; top: 0; left: 0; bottom: 0;
        width: min(280px, 80vw);
        background: #0c0c18;
        border-right: 1px solid var(--border-accent);
        display: flex; flex-direction: column;
        padding: 5rem 1.75rem 2rem;
        gap: 0;
        transform: translateX(-100%);
        transition: transform .27s cubic-bezier(.4,0,.2,1);
        z-index: 8999;
        overflow-y: auto;
    }
    .header-nav.is-open { transform: translateX(0); }
    .header-nav a {
        padding: 0.85rem 0; font-size: 1rem;
        border-bottom: 1px solid var(--border);
        color: var(--text);
    }
    .header-nav a:last-child { border-bottom: none; }
    .header-nav a:hover { color: var(--accent); }

    /* Hamburger → X quando aperto */
    .hamburger.is-open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
    .hamburger.is-open span:nth-child(2) { opacity: 0; transform: scaleX(0); }
    .hamburger.is-open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

    .search-layout { grid-template-columns: 1fr; }
    .hero { padding: 2.5rem 1rem 2rem; min-height: 50vh; }
    .categories-grid { grid-template-columns: repeat(2, 1fr); }
    .site-row__onion { display: none; }
}

@media (max-width: 480px) {
    .categories-grid { grid-template-columns: 1fr 1fr; }
    .hero-logo { font-size: 3rem; }
}

/* ---- UTILITY ---- */
.text-muted { color: var(--text-muted); }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mb-2 { margin-bottom: 1rem; }
.tor-banner { display: none; }
.clearnet-notice { display: none; }
