/* ==========================================================================
   TECHOSTER — TOOLS HUB & DOMAIN AUDIT
   Full-width, enterprise-grade tools directory + comprehensive audit view.
   Font is inherited globally (Inter). Brand tokens: Link Blue #0964B0,
   Spark Orange #F0743A, Grow Green #68C185, Warm Amber #F4C16D.
   ========================================================================== */

.tools-hub {
    /* Fixed site header is 80px tall — clear it with NO extra hero dead space. */
    --thub-pad-x: clamp(1.5rem, 3vw, 2rem);        /* 24px–32px side padding  */
    --thub-blue: #0964B0;
    --thub-blue-dark: #074e88;
    --thub-orange: #F0743A;
    --thub-green: #68C185;
    --thub-amber: #F4C16D;
    --thub-ink: #0f172a;
    --thub-muted: #475569;
    --thub-line: #e2e8f0;
    --thub-surface: #ffffff;
    --thub-surface-2: #f8fafc;
    --thub-bg: #f4f7fb;
    --thub-radius: 12px;
    --thub-shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 8px 24px -16px rgba(9, 100, 176, .28);
    --thub-shadow-hover: 0 10px 20px -8px rgba(9, 100, 176, .28), 0 24px 48px -24px rgba(9, 100, 176, .30);

    padding-top: 80px;               /* offset the fixed header, nothing more   */
    background:
        radial-gradient(1200px 480px at 100% -10%, rgba(240, 116, 58, .06), transparent 60%),
        radial-gradient(1000px 460px at 0% -5%, rgba(9, 100, 176, .07), transparent 60%),
        var(--thub-bg);
    color: var(--thub-ink);
    min-height: 100vh;
}

.thub-wrap {
    width: 100%;
    padding-inline: var(--thub-pad-x);
}

/* ---------- 1. TOP BAR / DOMAIN AUDIT SEARCH (near top, no dead space) ---------- */
.thub-top {
    /* Small, deliberate top padding only — content sits high in the viewport. */
    padding-block: clamp(1.25rem, 2.5vw, 2rem) clamp(1rem, 2vw, 1.5rem);
    border-bottom: 1px solid var(--thub-line);
}

.thub-top-inner {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1.25rem 2rem;
}

.thub-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: .45rem;
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--thub-blue);
    background: rgba(9, 100, 176, .08);
    padding: .3rem .7rem;
    border-radius: 999px;
    margin-bottom: .6rem;
}

.thub-title {
    font-size: clamp(1.6rem, 1.1rem + 1.8vw, 2.4rem);
    font-weight: 800;
    line-height: 1.1;
    letter-spacing: -.02em;
    margin: 0 0 .4rem;
    color: var(--thub-ink);
}
.thub-title span { color: var(--thub-blue); }

.thub-sub {
    margin: 0;
    max-width: 46ch;
    color: var(--thub-muted);
    font-size: 1rem;
    font-weight: 500;
}

/* Search / audit form */
.thub-search {
    flex: 1 1 460px;
    max-width: 620px;
}
.thub-search-label {
    display: block;
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--thub-muted);
    margin-bottom: .45rem;
}
.thub-search-row {
    display: flex;
    gap: .6rem;
    background: var(--thub-surface);
    border: 1.5px solid var(--thub-line);
    border-radius: 14px;
    padding: .4rem .4rem .4rem .95rem;
    box-shadow: var(--thub-shadow);
    transition: border-color .2s, box-shadow .2s;
}
.thub-search-row:focus-within {
    border-color: var(--thub-blue);
    box-shadow: 0 0 0 4px rgba(9, 100, 176, .14);
}
.thub-search-row .thub-globe {
    align-self: center;
    color: var(--thub-blue);
    width: 20px; height: 20px;
    flex: none;
}
.thub-search-input {
    flex: 1 1 auto;
    border: 0;
    outline: 0;
    background: transparent;
    font-size: 1rem;
    font-weight: 600;
    color: var(--thub-ink);
    min-width: 0;
}
.thub-search-input::placeholder { color: #94a3b8; font-weight: 500; }

.thub-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    border: 0;
    cursor: pointer;
    font-weight: 700;
    font-size: .92rem;
    padding: .7rem 1.25rem;
    border-radius: 11px;
    background: linear-gradient(135deg, var(--thub-blue), var(--thub-blue-dark));
    color: #fff;
    white-space: nowrap;
    transition: transform .2s, box-shadow .2s, background .2s;
    box-shadow: 0 10px 22px -10px rgba(9, 100, 176, .6);
}
.thub-btn:hover { transform: translateY(-1px); background: linear-gradient(135deg, var(--thub-orange), #d95e26); box-shadow: 0 14px 26px -10px rgba(240, 116, 58, .55); }
.thub-btn:disabled { opacity: .6; cursor: not-allowed; transform: none; }
.thub-btn.is-ghost {
    background: var(--thub-surface);
    color: var(--thub-blue);
    border: 1.5px solid var(--thub-line);
    box-shadow: none;
}
.thub-btn.is-ghost:hover { border-color: var(--thub-blue); background: rgba(9,100,176,.05); color: var(--thub-blue); transform: none; }

.thub-hint { margin: .55rem 0 0; font-size: .8rem; color: var(--thub-muted); }
.thub-hint.is-error { color: #dc2626; font-weight: 600; }

/* ---------- 2. DETAILED TOOL CARDS GRID (full width) ---------- */
.thub-grid-section { padding-block: clamp(1.5rem, 3vw, 2.25rem) clamp(2.5rem, 5vw, 4rem); }

.thub-section-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1.25rem;
}
.thub-section-head h2 {
    font-size: clamp(1.25rem, 1rem + 1vw, 1.6rem);
    font-weight: 800;
    letter-spacing: -.01em;
    margin: 0;
}
.thub-section-head p { margin: .15rem 0 0; color: var(--thub-muted); font-size: .95rem; }

.thub-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));   /* desktop: 4 cols */
    gap: clamp(1rem, 1.5vw, 1.5rem);
}
@media (max-width: 1200px) { .thub-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 900px)  { .thub-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } } /* tablet: 2 */
@media (max-width: 560px)  { .thub-grid { grid-template-columns: 1fr; } }                        /* mobile: 1 */

.thub-card {
    display: flex;
    flex-direction: column;
    background: var(--thub-surface);
    border: 1px solid var(--thub-line);
    border-radius: var(--thub-radius);
    padding: 1.35rem 1.35rem 1.25rem;
    box-shadow: var(--thub-shadow);
    transition: transform .22s cubic-bezier(.22,1,.36,1), box-shadow .22s, border-color .22s;
    position: relative;
    overflow: hidden;
}
.thub-card::before {
    content: "";
    position: absolute;
    inset: 0 0 auto 0;
    height: 3px;
    background: linear-gradient(90deg, var(--c1, var(--thub-blue)), var(--c2, var(--thub-orange)));
    opacity: .9;
}
.thub-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--thub-shadow-hover);
    border-color: rgba(9, 100, 176, .35);
}

.thub-card-top { display: flex; align-items: center; gap: .8rem; margin-bottom: .9rem; }
.thub-card-icon {
    flex: none;
    width: 46px; height: 46px;
    display: grid; place-items: center;
    border-radius: 11px;
    font-size: 1.15rem;
    color: #fff;
    background: linear-gradient(135deg, var(--c1, var(--thub-blue)), var(--c2, var(--thub-orange)));
    box-shadow: 0 8px 18px -8px color-mix(in srgb, var(--c1, var(--thub-blue)) 70%, transparent);
}
.thub-card-name { font-size: 1.05rem; font-weight: 800; line-height: 1.2; margin: 0; }

.thub-badge {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    align-self: flex-start;
    font-size: .68rem;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
    padding: .28rem .6rem;
    border-radius: 999px;
    margin-bottom: .75rem;
    border: 1px solid transparent;
}
.thub-badge[data-cat="Authentication"]     { color: #0964B0; background: #e8f1fb; border-color: #cfe2f6; }
.thub-badge[data-cat="Email Security"]      { color: #4338ca; background: #eef0ff; border-color: #dcdffb; }
.thub-badge[data-cat="Transport Security"]  { color: #15803d; background: #e9f8ef; border-color: #cdefd9; }
.thub-badge[data-cat="Brand & Trust"]       { color: #b45309; background: #fdf3e2; border-color: #f6e2be; }
.thub-badge[data-cat="DNS Record"]          { color: #c2410c; background: #fdece2; border-color: #f7d5c2; }
.thub-badge[data-cat="Header Analysis"]     { color: #7c3aed; background: #f3ecfe; border-color: #e6d8fb; }
.thub-badge[data-cat="Network / DNS"]       { color: #0e7490; background: #e4f6fa; border-color: #c4ebf2; }

.thub-card-desc {
    margin: 0 0 1rem;
    color: var(--thub-muted);
    font-size: .9rem;
    line-height: 1.55;
    flex: 1 1 auto;
}

.thub-caps { list-style: none; margin: 0 0 1.15rem; padding: 0; display: grid; gap: .4rem; }
.thub-caps li {
    display: flex;
    align-items: flex-start;
    gap: .5rem;
    font-size: .82rem;
    font-weight: 600;
    color: #334155;
}
.thub-caps li svg { flex: none; width: 15px; height: 15px; color: var(--thub-green); margin-top: 1px; }

.thub-cta {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    width: 100%;
    padding: .65rem 1rem;
    border-radius: 10px;
    font-weight: 700;
    font-size: .88rem;
    text-decoration: none;
    color: var(--thub-blue);
    background: rgba(9, 100, 176, .07);
    border: 1px solid rgba(9, 100, 176, .18);
    cursor: pointer;
    transition: background .2s, color .2s, transform .2s;
}
.thub-cta:hover { background: var(--thub-blue); color: #fff; transform: translateY(-1px); }
.thub-cta svg { width: 16px; height: 16px; transition: transform .2s; }
.thub-cta:hover svg { transform: translateX(3px); }

/* ---------- 3. COMPREHENSIVE AUDIT VIEW ---------- */
.audit-view { padding-block: 1.5rem 0; }
.audit-view[hidden] { display: none; }

.audit-loading {
    display: flex; align-items: center; gap: .8rem;
    padding: 2.5rem; justify-content: center;
    color: var(--thub-muted); font-weight: 600;
}
.audit-spinner {
    width: 26px; height: 26px; border-radius: 50%;
    border: 3px solid rgba(9,100,176,.2); border-top-color: var(--thub-blue);
    animation: thubspin .7s linear infinite;
}
@keyframes thubspin { to { transform: rotate(360deg); } }

/* Overview banner */
.audit-banner {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 1.5rem;
    background: var(--thub-surface);
    border: 1px solid var(--thub-line);
    border-radius: 16px;
    padding: 1.5rem 1.75rem;
    box-shadow: var(--thub-shadow);
    margin-bottom: 1.25rem;
}
.audit-score {
    --deg: 0deg;
    --ring: var(--thub-green);
    position: relative;
    width: 108px; height: 108px; flex: none;
    border-radius: 50%;
    display: grid; place-items: center;
    background: conic-gradient(var(--ring) var(--deg), #e9eef5 0);
}
.audit-score::before { content: ""; position: absolute; inset: 10px; border-radius: 50%; background: var(--thub-surface); }
.audit-score-num { position: relative; font-size: 1.9rem; font-weight: 800; line-height: 1; }
.audit-score-num small { display: block; font-size: .62rem; font-weight: 700; letter-spacing: .08em; color: var(--thub-muted); text-transform: uppercase; margin-top: 2px; }

.audit-banner-main h2 { margin: 0 0 .1rem; font-size: 1.35rem; font-weight: 800; }
.audit-banner-main .audit-domain { color: var(--thub-blue); }
.audit-banner-main p { margin: .2rem 0 0; color: var(--thub-muted); font-size: .92rem; }

.audit-verdict {
    display: inline-flex; align-items: center; gap: .5rem;
    padding: .55rem 1.1rem; border-radius: 999px;
    font-weight: 800; font-size: .95rem; letter-spacing: .01em;
}
.v-pass { background: #e9f8ef; color: #15803d; border: 1px solid #bbf7d0; }
.v-warn { background: #fdf6e3; color: #b45309; border: 1px solid #fde3a7; }
.v-fail { background: #fdeceb; color: #b91c1c; border: 1px solid #fbc5c2; }

.audit-quickstats { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .7rem; }
.audit-chip {
    display: inline-flex; align-items: center; gap: .35rem;
    font-size: .74rem; font-weight: 700; padding: .28rem .6rem; border-radius: 999px;
    background: var(--thub-surface-2); border: 1px solid var(--thub-line); color: #334155;
}
.audit-chip svg { width: 13px; height: 13px; }
.audit-chip.ok  svg { color: var(--thub-green); }
.audit-chip.bad svg { color: #dc2626; }
.audit-chip.warn svg { color: #d97706; }

/* Section blocks */
.audit-block { margin-bottom: 1.25rem; }
.audit-block-title {
    display: flex; align-items: center; gap: .55rem;
    font-size: .95rem; font-weight: 800; letter-spacing: .02em;
    text-transform: uppercase; color: #334155; margin: 0 0 .75rem;
}
.audit-block-title svg { width: 18px; height: 18px; color: var(--thub-blue); }

/* Authentication breakdown grid */
.audit-auth-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1rem;
}
.audit-auth-card {
    background: var(--thub-surface);
    border: 1px solid var(--thub-line);
    border-left: 4px solid var(--st, #94a3b8);
    border-radius: 12px;
    padding: 1.1rem 1.2rem;
    box-shadow: var(--thub-shadow);
    transition: transform .2s, box-shadow .2s;
}
.audit-auth-card:hover { transform: translateY(-2px); box-shadow: var(--thub-shadow-hover); }
.audit-auth-head { display: flex; align-items: center; justify-content: space-between; gap: .5rem; margin-bottom: .5rem; }
.audit-auth-head h4 { margin: 0; font-size: 1rem; font-weight: 800; }
.audit-pill {
    font-size: .68rem; font-weight: 800; letter-spacing: .04em; text-transform: uppercase;
    padding: .24rem .55rem; border-radius: 999px; white-space: nowrap;
}
.st-pass    { --st: #22c55e; } .audit-auth-card.st-pass .audit-pill { background:#e9f8ef; color:#15803d; }
.st-warn    { --st: #f59e0b; } .audit-auth-card.st-warn .audit-pill { background:#fdf6e3; color:#b45309; }
.st-fail    { --st: #ef4444; } .audit-auth-card.st-fail .audit-pill { background:#fdeceb; color:#b91c1c; }
.st-missing { --st: #94a3b8; } .audit-auth-card.st-missing .audit-pill { background:#f1f5f9; color:#475569; }
.audit-auth-card p { margin: 0; font-size: .85rem; color: var(--thub-muted); line-height: 1.5; }
.audit-auth-card .audit-mini {
    margin-top: .6rem; font-family: 'JetBrains Mono', ui-monospace, monospace;
    font-size: .72rem; color: #0f172a; background: var(--thub-surface-2);
    border: 1px solid var(--thub-line); border-radius: 8px; padding: .5rem .6rem;
    word-break: break-all; white-space: pre-wrap; max-height: 5.5rem; overflow: auto;
}

/* Mail server & network */
.audit-net-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 1rem; }
@media (max-width: 820px){ .audit-net-grid { grid-template-columns: 1fr; } }
.audit-panel {
    background: var(--thub-surface); border: 1px solid var(--thub-line);
    border-radius: 12px; padding: 1.1rem 1.2rem; box-shadow: var(--thub-shadow);
}
.audit-panel h4 { margin: 0 0 .75rem; font-size: .82rem; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; color: var(--thub-muted); }
.audit-mx-table { width: 100%; border-collapse: collapse; font-size: .85rem; }
.audit-mx-table th { text-align: left; font-size: .68rem; letter-spacing: .05em; text-transform: uppercase; color: var(--thub-muted); padding: .35rem .5rem; border-bottom: 1px solid var(--thub-line); }
.audit-mx-table td { padding: .5rem .5rem; border-bottom: 1px solid var(--thub-line); color: #0f172a; }
.audit-mx-table td.prio { font-weight: 800; color: var(--thub-blue); width: 60px; }
.audit-mx-table td.host { font-family: 'JetBrains Mono', ui-monospace, monospace; font-size: .8rem; word-break: break-all; }
.audit-kv { display: grid; gap: .55rem; }
.audit-kv > div { display: flex; justify-content: space-between; gap: 1rem; font-size: .85rem; border-bottom: 1px dashed var(--thub-line); padding-bottom: .5rem; }
.audit-kv .k { color: var(--thub-muted); font-weight: 600; }
.audit-kv .val { font-weight: 700; text-align: right; word-break: break-all; }
.audit-kv .val.mono { font-family: 'JetBrains Mono', ui-monospace, monospace; font-size: .78rem; font-weight: 600; }

/* Recommendations */
.audit-recs { display: grid; gap: .7rem; }
.audit-rec {
    display: flex; gap: .8rem; align-items: flex-start;
    background: var(--thub-surface); border: 1px solid var(--thub-line);
    border-left: 4px solid var(--rc, var(--thub-amber));
    border-radius: 12px; padding: .95rem 1.1rem; box-shadow: var(--thub-shadow);
}
.audit-rec .audit-rec-ic { flex: none; width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; color: #fff; background: var(--rc, var(--thub-amber)); }
.audit-rec .audit-rec-ic svg { width: 16px; height: 16px; }
.audit-rec h5 { margin: 0 0 .15rem; font-size: .92rem; font-weight: 800; }
.audit-rec p { margin: 0; font-size: .84rem; color: var(--thub-muted); line-height: 1.5; }
.audit-rec.sev-high { --rc: #ef4444; }
.audit-rec.sev-med  { --rc: #f59e0b; }
.audit-rec.sev-low  { --rc: #0964B0; }
.audit-rec.sev-ok   { --rc: #22c55e; }

/* Raw output toggle */
.audit-raw details {
    background: var(--thub-surface); border: 1px solid var(--thub-line);
    border-radius: 12px; box-shadow: var(--thub-shadow); overflow: hidden;
}
.audit-raw summary {
    cursor: pointer; list-style: none; padding: .95rem 1.2rem;
    font-weight: 800; font-size: .9rem; display: flex; align-items: center; gap: .6rem;
    color: #334155;
}
.audit-raw summary::-webkit-details-marker { display: none; }
.audit-raw summary .chev { margin-left: auto; transition: transform .2s; }
.audit-raw details[open] summary .chev { transform: rotate(180deg); }
.audit-raw summary svg { width: 18px; height: 18px; color: var(--thub-blue); }
.audit-raw-body { padding: 0 1.2rem 1.2rem; }
.audit-raw-item { margin-top: .9rem; }
.audit-raw-item .lbl { font-size: .72rem; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; color: var(--thub-muted); margin-bottom: .35rem; }
.audit-raw-item pre {
    margin: 0; font-family: 'JetBrains Mono', ui-monospace, monospace; font-size: .78rem;
    background: #0f172a; color: #7dd3fc; border-radius: 8px; padding: .8rem .9rem;
    white-space: pre-wrap; word-break: break-all; overflow-x: auto;
}
.audit-raw-item pre.empty { color: #64748b; background: var(--thub-surface-2); border: 1px dashed var(--thub-line); }

.audit-reveal { animation: auditRise .5s cubic-bezier(.22,1,.36,1) both; }
@keyframes auditRise { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }

/* ---------- Dark-mode awareness (respects OS; site chrome stays light) ---------- */
@media (prefers-color-scheme: dark) {
    .tools-hub {
        --thub-ink: #e5edf7;
        --thub-muted: #94a3b8;
        --thub-line: #24303f;
        --thub-surface: #131c27;
        --thub-surface-2: #0f1722;
        --thub-bg: #0b1220;
    }
    .thub-card::before { opacity: 1; }
    .audit-score::before { background: var(--thub-surface); }
    .thub-badge[data-cat] { filter: brightness(1.05); }
    .audit-raw-item pre { background: #0a1120; }
}
