/* ==========================================================================
   Web AI Secure — premium UI
   Design language ported from the eProfile "cinematic luxe" system:
   Fraunces serif display · pill buttons with accent glow · soft layered
   shadows · noise grain + blurred orbs + hero grid/beam · cyber-blue accent.
   All legacy variable names are preserved so existing inline styles work.
   ========================================================================== */
:root {
    /* --- background layers --- */
    --navy-900: #07090f;
    --navy-850: #0a0d16;
    --navy-800: #0e131f;
    --navy-700: #141b2c;
    --navy-600: #1b2540;
    --bg:       var(--navy-900);
    --bg-soft:  var(--navy-850);
    --bg-elev:  var(--navy-800);

    --line:      rgba(255,255,255,.08);
    --line-soft: rgba(255,255,255,.06);
    --line-strong: rgba(255,255,255,.16);

    /* --- ink --- */
    --txt:      #eef2fb;
    --txt-soft: #aeb9d6;
    --txt-mute: #6f7b9c;
    --ink:      var(--txt);
    --ink-dim:  var(--txt-soft);
    --ink-mute: var(--txt-mute);

    /* --- accent (electric cyber blue) --- */
    --blue-600: #1f5fff;
    --blue-500: #2f7bff;
    --blue-400: #4d9bff;
    --cyan-400: #38e1ff;
    --cyan-300: #7bedff;
    --accent:   #2f7bff;
    --accent-grad: linear-gradient(135deg, #7bedff 0%, #38e1ff 30%, #2f7bff 100%);

    /* --- status --- */
    --crit:  #ff5c7a;
    --high:  #ff9d4d;
    --med:   #ffd23f;
    --low:   #5aa0ff;
    --good:  #2ce6a8;

    --radius-sm: 12px;
    --radius:    18px;
    --radius-lg: 26px;

    --shadow-1: 0 1px 0 rgba(255,255,255,.04) inset, 0 24px 50px -28px rgba(0,0,0,.75);
    --shadow:   var(--shadow-1);
    --shadow-2: 0 14px 40px -16px rgba(47,123,255,.45), 0 50px 70px -30px rgba(0,0,0,.7);
    --glow-blue: 0 0 0 1px rgba(56,225,255,.18), 0 18px 50px -18px rgba(47,123,255,.6);

    --font-serif: 'Fraunces', 'Times New Roman', Georgia, serif;
    --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;

    --maxw: 1200px;
    --ease:     cubic-bezier(.2,.7,.2,1);
    --ease-out: cubic-bezier(.16,1,.3,1);
}

/* ---------- Light theme ---------- */
[data-theme="light"] {
    --navy-900: #eef2f9;
    --navy-850: #ffffff;
    --navy-800: #ffffff;
    --navy-700: #eef2f9;
    --navy-600: #e2e8f4;
    --line:      rgba(13,21,48,.10);
    --line-soft: rgba(13,21,48,.06);
    --line-strong: rgba(13,21,48,.18);
    --txt:      #0d1530;
    --txt-soft: #44506e;
    --txt-mute: #6b7790;
    --cyan-300: #1565c0;
    --cyan-400: #1976d2;
    --accent-grad: linear-gradient(135deg, #2f7bff 0%, #1565c0 100%);
    --shadow-1: 0 1px 0 rgba(13,21,48,.03) inset, 0 16px 38px -26px rgba(13,21,48,.22);
    --glow-blue: 0 0 0 1px rgba(47,123,255,.16), 0 16px 40px -18px rgba(47,123,255,.32);
}
[data-theme="light"] body { background: radial-gradient(1000px 520px at 82% -10%, rgba(47,123,255,.10), transparent 60%), #eef2f9; }
[data-theme="light"] h1, [data-theme="light"] h2, [data-theme="light"] h3, [data-theme="light"] h4 { color: #0d1530; }
[data-theme="light"] .stat .n, [data-theme="light"] .score-ring .val .num { color: #0d1530; }
[data-theme="light"] .nav { background: color-mix(in srgb, #fff 78%, transparent); }
[data-theme="light"] .nav.is-scrolled { background: color-mix(in srgb, #fff 92%, transparent); }
[data-theme="light"] .card { background: linear-gradient(180deg, #ffffff, #fbfcff); }
[data-theme="light"] .input { background: #fff; }
[data-theme="light"] .input:focus { background: #fff; }
[data-theme="light"] .noise { opacity: .012; }
[data-theme="light"] .grain-orb { opacity: .16; }
[data-theme="light"] .hero-grid { opacity: .3; }
[data-theme="light"] .hero-beam { opacity: .35; }
[data-theme="light"] code, [data-theme="light"] .codebox, [data-theme="light"] .issue-grid .blk { background: #eef2f9; }
[data-theme="light"] .issue, [data-theme="light"] .stat { background: rgba(13,21,48,.02); }
[data-theme="light"] .table tr:hover td { background: rgba(13,21,48,.03); }
[data-theme="light"] .btn-ghost { background: #fff; }
[data-theme="light"] .btn-primary, [data-theme="light"] .btn-primary:hover { color: #fff; }

/* Logo swap by theme (specificity must beat .brand-logo{display:block}) */
.brand-logo.brand-on-light { display: none; }
[data-theme="light"] .brand-logo.brand-on-dark { display: none; }
[data-theme="light"] .brand-logo.brand-on-light { display: block; }

/* Theme toggle button */
.theme-toggle { width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--line-strong); background: rgba(255,255,255,.03); color: var(--txt-soft); display: grid; place-items: center; cursor: pointer; transition: .2s var(--ease); flex: none; }
.theme-toggle:hover { color: var(--txt); border-color: var(--cyan-400); transform: translateY(-1px); }
.theme-toggle .ic-moon { display: none; }
.theme-toggle .ic-sun { display: block; }
[data-theme="light"] .theme-toggle .ic-sun { display: none; }
[data-theme="light"] .theme-toggle .ic-moon { display: block; }
[data-theme="light"] .theme-toggle { background: #fff; }

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
html, body { margin: 0; padding: 0; overflow-x: clip; max-width: 100%; }
body {
    font-family: var(--font);
    color: var(--txt);
    background: var(--navy-900);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    position: relative;
}
img, svg { max-width: 100%; }
a { color: var(--cyan-300); text-decoration: none; transition: color .2s var(--ease); }
a:hover { color: #fff; }

/* --- Serif display headings (the eProfile signature) --- */
h1, h2 {
    font-family: var(--font-serif);
    font-weight: 400;
    letter-spacing: -0.02em;
    line-height: 1.04;
    color: #fff;
    margin: 0 0 .4em;
    overflow-wrap: break-word;
}
h3, h4 { font-family: var(--font); font-weight: 700; letter-spacing: -.01em; line-height: 1.25; margin: 0 0 .5em; color: #fff; }
p { margin: 0 0 1rem; color: var(--txt-soft); }
.container { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 clamp(20px,4vw,40px); position: relative; z-index: 2; }
.muted { color: var(--txt-mute); }
.small { font-size: .88rem; }
.mono { font-family: var(--mono); }

/* --- Atmosphere: grain + orbs (added once in the layout) --- */
.noise {
    position: fixed; inset: 0; pointer-events: none; z-index: 0; opacity: .035; mix-blend-mode: overlay;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='200' height='200'><filter id='n'><feTurbulence baseFrequency='0.8' numOctaves='2' stitchTiles='stitch'/></filter><rect width='100%25' height='100%25' filter='url(%23n)' opacity='0.8'/></svg>");
}
.grain-orb { position: fixed; pointer-events: none; z-index: 0; width: 720px; height: 720px; border-radius: 50%; filter: blur(130px); opacity: .4; }
.orb-1 { top: -300px; left: -200px; background: radial-gradient(closest-side, rgba(47,123,255,.5), transparent 70%); }
.orb-2 { bottom: -320px; right: -220px; background: radial-gradient(closest-side, rgba(56,225,255,.32), transparent 70%); }

/* --- Nav --- */
.nav {
    position: sticky; top: 0; z-index: 80;
    backdrop-filter: saturate(140%) blur(16px); -webkit-backdrop-filter: saturate(140%) blur(16px);
    background: color-mix(in srgb, var(--navy-900) 72%, transparent);
    border-bottom: 1px solid transparent;
    transition: background .3s var(--ease), border-color .3s var(--ease);
}
.nav.is-scrolled { background: color-mix(in srgb, var(--navy-900) 90%, transparent); border-bottom-color: var(--line); }
.nav-inner { display: flex; align-items: center; justify-content: space-between; padding: 15px 0; }
.brand { display: flex; align-items: center; gap: 10px; }
.brand-logo { height: 40px; width: auto; display: block; }
@media (max-width: 560px) { .brand-logo { height: 32px; } }
.nav-links { display: flex; align-items: center; gap: clamp(16px,1.8vw,26px); }
.nav-links > a:not(.btn) {
    font-size: 12px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase;
    color: var(--txt-soft); position: relative;
}
.nav-links > a:not(.btn)::after { content: ""; position: absolute; left: 0; bottom: -6px; width: 0; height: 1.5px; background: var(--accent-grad); transition: width .3s var(--ease-out); }
.nav-links > a:not(.btn):hover { color: #fff; }
.nav-links > a:not(.btn):hover::after { width: 100%; }

/* --- Buttons (pills with accent glow) --- */
.btn {
    display: inline-flex; align-items: center; gap: 9px;
    padding: 12px 22px; border-radius: 999px;
    font-weight: 600; font-size: .92rem; letter-spacing: .02em;
    border: 1px solid transparent; cursor: pointer; white-space: nowrap;
    transition: transform .25s var(--ease), box-shadow .25s var(--ease), background .25s var(--ease), color .2s, border-color .2s;
}
.btn-primary { background: var(--accent-grad); color: #04122e; box-shadow: 0 14px 34px -14px rgba(47,123,255,.65); }
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 22px 46px -14px rgba(56,225,255,.7); color: #04122e; }
.btn-ghost { background: rgba(255,255,255,.03); border-color: var(--line-strong); color: var(--txt); }
.btn-ghost:hover { border-color: var(--cyan-400); color: #fff; background: color-mix(in srgb, var(--blue-500) 10%, transparent); }
.btn-block { width: 100%; justify-content: center; }
.btn-lg { padding: 15px 28px; font-size: 1rem; }

/* --- Cards --- */
.card {
    background: linear-gradient(180deg, var(--navy-800), var(--navy-850));
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-1);
}
.card-pad { padding: clamp(20px,3vw,30px); }
.glow-card { box-shadow: var(--glow-blue); border-color: rgba(56,225,255,.16); }

/* --- Forms --- */
.field { margin-bottom: 16px; }
.field label { display: block; font-size: .82rem; color: var(--txt-soft); margin-bottom: 7px; font-weight: 600; letter-spacing: .02em; }
.input {
    width: 100%; padding: 14px 16px; border-radius: 14px;
    background: rgba(255,255,255,.02); border: 1px solid var(--line-strong);
    color: var(--txt); font-size: .98rem; font-family: var(--font); transition: .18s var(--ease);
}
.input:focus { outline: none; border-color: var(--cyan-400); background: rgba(56,225,255,.04); box-shadow: 0 0 0 4px rgba(56,225,255,.12); }
.input::placeholder { color: var(--txt-mute); }
select.input { appearance: none; }

/* --- Alerts --- */
.alert { padding: 13px 17px; border-radius: 14px; margin-bottom: 18px; font-size: .92rem; border: 1px solid; backdrop-filter: blur(8px); }
.alert-error { background: rgba(255,92,122,.1); border-color: rgba(255,92,122,.4); color: #ffb3c0; }
.alert-success { background: rgba(44,230,168,.1); border-color: rgba(44,230,168,.4); color: #9af5d6; }
.alert-info { background: rgba(47,123,255,.1); border-color: rgba(47,123,255,.4); color: #bcd6ff; }

/* --- Badges / pills --- */
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 4px 11px; border-radius: 999px; font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; }
.badge::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.sev-critical { color: var(--crit); background: rgba(255,92,122,.12); }
.sev-high     { color: var(--high); background: rgba(255,157,77,.12); }
.sev-medium   { color: var(--med);  background: rgba(255,210,63,.12); }
.sev-low      { color: var(--low);  background: rgba(90,160,255,.12); }
.sev-info     { color: var(--good); background: rgba(44,230,168,.12); }
.pill { display: inline-flex; align-items: center; gap: 8px; padding: 7px 15px; border-radius: 999px; background: rgba(56,225,255,.07); border: 1px solid rgba(56,225,255,.22); color: var(--cyan-300); font-size: .8rem; font-weight: 600; letter-spacing: .01em; }

/* --- Layout helpers --- */
.grid { display: grid; gap: 22px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.flex { display: flex; }
.between { justify-content: space-between; }
.items-center { align-items: center; }
.gap-sm { gap: 10px; }
.section { padding: clamp(56px,8vw,104px) 0; position: relative; }
.eyebrow { display: inline-flex; align-items: center; gap: 10px; color: var(--cyan-300); font-weight: 700; font-size: .76rem; letter-spacing: .2em; text-transform: uppercase; }
.eyebrow::before { content: ""; width: 26px; height: 1.5px; background: var(--accent-grad); }

/* --- Footer --- */
.footer { border-top: 1px solid var(--line-soft); padding: 46px 0; margin-top: 70px; color: var(--txt-mute); font-size: .9rem; position: relative; z-index: 2; }
.footer a { color: var(--txt-soft); }
.footer a:hover { color: #fff; }

/* --- Stat tiles --- */
.stat { padding: 22px; border-radius: var(--radius-sm); background: rgba(255,255,255,.02); border: 1px solid var(--line); }
.stat .n { font-family: var(--font-serif); font-size: 2.3rem; font-weight: 500; color: #fff; line-height: 1; }
.stat .l { color: var(--txt-mute); font-size: .8rem; margin-top: 8px; text-transform: uppercase; letter-spacing: .08em; }

/* --- Score ring --- */
.score-ring { position: relative; width: 220px; height: 220px; }
.score-ring svg { transform: rotate(-90deg); }
.score-ring .val { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; }
.score-ring .val .num { font-family: var(--font-serif); font-size: 3.8rem; font-weight: 500; color: #fff; line-height: 1; }
.score-ring .val .max { color: var(--txt-mute); font-size: .9rem; }

/* --- Issue rows --- */
.issue { border: 1px solid var(--line); border-radius: var(--radius-sm); margin-bottom: 14px; overflow: hidden; background: rgba(255,255,255,.02); transition: border-color .2s var(--ease); }
.issue:hover { border-color: var(--line-strong); }
.issue-head { display: flex; align-items: center; gap: 14px; padding: 17px 19px; cursor: pointer; }
.issue-head h4 { margin: 0; font-size: 1rem; color: #fff; }
.issue-head .impact { margin-left: auto; font-family: var(--mono); color: var(--crit); font-weight: 700; font-size: .9rem; }
.issue-body { padding: 0 19px 19px; display: none; }
.issue.open .issue-body { display: block; }
.issue-grid { display: grid; gap: 14px; margin-top: 6px; }
.issue-grid .blk { background: var(--navy-900); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; }
.issue-grid .blk .t { font-size: .72rem; text-transform: uppercase; letter-spacing: .1em; color: var(--cyan-300); font-weight: 700; margin-bottom: 6px; }
.issue-grid .blk p { margin: 0; font-size: .9rem; color: var(--txt-soft); }

/* --- Scan progress --- */
.scan-stage { min-height: 100vh; display: grid; place-items: center; padding: 40px 20px; position: relative; z-index: 2; }
.radar { width: 160px; height: 160px; margin: 0 auto 30px; position: relative; }
.radar .ring { position: absolute; inset: 0; border-radius: 50%; border: 1px solid rgba(56,225,255,.25); }
.radar .ring:nth-child(2) { inset: 26px; }
.radar .ring:nth-child(3) { inset: 52px; }
.radar .sweep { position: absolute; inset: 0; border-radius: 50%; background: conic-gradient(from 0deg, transparent 0deg, rgba(56,225,255,.45) 50deg, transparent 70deg); animation: spin 1.6s linear infinite; }
.radar .core { position: absolute; inset: 50% auto auto 50%; width: 14px; height: 14px; transform: translate(-50%,-50%); border-radius: 50%; background: var(--cyan-400); box-shadow: 0 0 18px var(--cyan-400); }
@keyframes spin { to { transform: rotate(360deg); } }
.progress-track { height: 10px; border-radius: 999px; background: rgba(255,255,255,.06); overflow: hidden; border: 1px solid var(--line); }
.progress-fill { height: 100%; width: 0; border-radius: 999px; background: var(--accent-grad); transition: width .5s var(--ease); box-shadow: 0 0 16px rgba(56,225,255,.6); }
.console { font-family: var(--mono); font-size: .84rem; text-align: left; margin-top: 26px; max-height: 200px; overflow: hidden; }
.console .line { color: var(--txt-mute); opacity: 0; animation: fadein .35s forwards; }
.console .line .ok { color: var(--good); }
.console .line .run { color: var(--cyan-300); }
@keyframes fadein { to { opacity: 1; } }

/* --- Table --- */
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: .72rem; text-transform: uppercase; letter-spacing: .1em; color: var(--txt-mute); padding: 12px 14px; border-bottom: 1px solid var(--line); font-weight: 700; }
.table td { padding: 15px 14px; border-bottom: 1px solid var(--line-soft); font-size: .92rem; }
.table tr:hover td { background: rgba(255,255,255,.02); }
.score-chip { display: inline-grid; place-items: center; width: 46px; height: 46px; border-radius: 13px; font-weight: 800; font-size: .95rem; font-family: var(--mono); }

/* --- Hero --- */
.hero { position: relative; padding: clamp(70px,9vw,120px) 0 clamp(50px,7vw,90px); text-align: center; overflow: hidden; }
.hero-bg { position: absolute; inset: 0; pointer-events: none; z-index: 0; }
.hero-grid { position: absolute; inset: 0; background-image: linear-gradient(var(--line) 1px, transparent 1px), linear-gradient(90deg, var(--line) 1px, transparent 1px); background-size: 56px 56px; -webkit-mask-image: radial-gradient(120% 80% at 50% 0%, #000 30%, transparent 75%); mask-image: radial-gradient(120% 80% at 50% 0%, #000 30%, transparent 75%); opacity: .6; }
.hero-beam { position: absolute; inset: 0; background: conic-gradient(from 210deg at 50% 40%, transparent 0deg, rgba(56,225,255,.18) 70deg, transparent 150deg); opacity: .7; }
.hero .container { z-index: 2; }
.hero h1 { font-size: clamp(2.6rem, 6vw, 4.6rem); color: #fff; }
.hero h1 .grad { font-style: italic; font-weight: 500; }
.hero p.lead { font-size: clamp(1.05rem,1.3vw,1.2rem); max-width: 680px; margin: 22px auto 32px; color: var(--txt-soft); line-height: 1.65; }
.scan-box { max-width: 640px; margin: 0 auto; }
.scan-box form { display: flex; gap: 10px; }
.scan-box .input { flex: 1; }
.grad { background: var(--accent-grad); -webkit-background-clip: text; background-clip: text; color: transparent; }

.feature-ic { width: 46px; height: 46px; border-radius: 13px; display: grid; place-items: center; background: rgba(56,225,255,.08); border: 1px solid rgba(56,225,255,.2); margin-bottom: 16px; }
.feature-ic svg { width: 23px; height: 23px; stroke: var(--cyan-300); }

/* --- Code / embed boxes --- */
.codebox { position: relative; background: var(--navy-900); border: 1px solid var(--line); border-radius: 14px; margin-top: 8px; }
.codebox pre { margin: 0; padding: 16px 18px; overflow-x: auto; font-family: var(--mono); font-size: .82rem; color: #bcd6ff; white-space: pre-wrap; word-break: break-all; }
.copybtn { position: absolute; top: 9px; right: 9px; background: rgba(56,225,255,.12); border: 1px solid rgba(56,225,255,.3); color: var(--cyan-300); border-radius: 8px; padding: 6px 11px; font-size: .74rem; cursor: pointer; font-weight: 600; }
.copybtn:hover { background: rgba(56,225,255,.2); }
code { background: rgba(255,255,255,.06); padding: 1px 6px; border-radius: 5px; font-family: var(--mono); font-size: .85em; color: var(--cyan-300); }

/* --- Tabs (per-site console) --- */
.tabs { display: flex; gap: 4px; padding: 4px; background: rgba(255,255,255,.03); border: 1px solid var(--line); border-radius: 14px; margin-bottom: 22px; overflow-x: auto; }
.tab { flex: 1; text-align: center; white-space: nowrap; padding: 11px 16px; border-radius: 10px; font-size: .88rem; font-weight: 600; color: var(--txt-soft); transition: .2s var(--ease); }
.tab:hover { color: #fff; }
.tab.active { background: var(--accent-grad); color: #04122e; box-shadow: 0 8px 20px -10px rgba(47,123,255,.6); }
textarea.input { resize: vertical; min-height: 64px; font-family: var(--mono); font-size: .85rem; }
input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--cyan-400); cursor: pointer; }
input[type=radio] { accent-color: var(--cyan-400); }

/* --- Reveal-on-scroll --- */
.reveal { opacity: 0; transform: translateY(22px); transition: opacity .7s var(--ease-out), transform .7s var(--ease-out); }
.reveal.in { opacity: 1; transform: none; }

/* --- Auth shell --- */
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 40px 20px; position: relative; z-index: 2; }
.auth-card { width: min(450px, 100%); }

@media (max-width: 880px) {
    .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
    .nav-links > a:not(.btn) { display: none; }
    .scan-box form { flex-direction: column; }
}

/* ---------- Light-theme high-specificity overrides (must win source order) ---------- */
[data-theme="light"] .hero h1,
[data-theme="light"] .stat .n,
[data-theme="light"] .score-ring .val .num,
[data-theme="light"] .issue-head h4,
[data-theme="light"] .brand .logo { color: #0d1530; }
[data-theme="light"] .hero h1 .grad,
[data-theme="light"] .grad { background: var(--accent-grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
[data-theme="light"] .footer { background: rgba(255,255,255,.4); }
[data-theme="light"] .progress-track { background: rgba(13,21,48,.08); }
[data-theme="light"] .alert-info { color: #14418a; }
[data-theme="light"] .nav-links > a:not(.btn) { color: #44506e; }
[data-theme="light"] .nav-links > a:not(.btn):hover { color: #0d1530; }
