@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:ital,wght@0,300;0,400;0,500;1,300;1,400&family=DM+Sans:wght@300;400;500&family=Share+Tech+Mono&display=swap');

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

:root {
    --bg:           #f9f9f8;
    --bg2:          #f2f4f7;
    --bg3:          #eaf0f6;
    --border:       #dce5ee;
    --border2:      #c8d8e8;
    --fg:           #1a2530;
    --fg-dim:       #4a6070;
    --fg-dimmer:    #8aa0b0;
    --accent:       #4a9ec4;
    --accent2:      #2a7ea0;
    --accent-light: #c8e8f4;
    --accent-pale:  #eaf5fb;
    --font-serif:   'Cormorant Garamond', Georgia, serif;
    --font-sans:    'DM Sans', system-ui, sans-serif;
    --font-mono:    'Share Tech Mono', 'Courier New', monospace;
    --radius:       2px;
    --max-content:  880px;
    --mesh-h:       200px;
}

html {
    scroll-behavior: smooth;
    scrollbar-color: var(--border2) var(--bg);
    scrollbar-width: thin;
}

body {
    background: var(--bg);
    color: var(--fg);
    font-family: var(--font-sans);
    font-size: 14px;
    line-height: 1.75;
    min-height: 100vh;
}

/* Mesh banner */
#mesh-banner {
    grid-area: mesh;
    width: 100%;
    height: var(--mesh-h);
    background: var(--bg);
    position: relative;
    overflow: hidden;
    border-bottom: 1px solid var(--border);
    margin: 0 -28px; /* bleed past wrapper padding */
    width: calc(100% + 56px); /* compensate for the bleed */
}

#mesh-container {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}

#mesh-container canvas {
    display: block;
    width: 100% !important;
    height: 100% !important;
}

/* Fade mesh into page at bottom */
#mesh-banner::after {
    content: '';
    position: absolute;
    bottom: 0; left: 0; right: 0;
    height: 60px;
    background: linear-gradient(to bottom, transparent, var(--bg));
    pointer-events: none;
}

/* Layout */
#wrapper {
    max-width: 1160px;
    margin: 0 auto;
    padding: 0 28px;
    display: grid;
    grid-template-columns: 248px 1fr;
    grid-template-rows: auto 1fr auto;
    grid-template-areas:
        "header header"
        "mesh    mesh"
        "sidebar content"
        "footer footer";
    gap: 0;
    min-height: 100vh;
    position: relative;
}

/* Header */
#site-header {
    grid-area: header;
    border-bottom: 1px solid var(--border);
    padding: 26px 0 20px;
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 20px;
}

#site-header h1 {
    font-family: var(--font-serif);
    font-size: 2rem;
    font-weight: 400;
    color: var(--fg);
    letter-spacing: 0.04em;
    line-height: 1;
}

#site-header .header-meta {
    font-family: var(--font-mono);
    font-size: 0.62rem;
    color: var(--fg-dimmer);
    letter-spacing: 0.22em;
    text-transform: uppercase;
    text-align: right;
    line-height: 1.9;
}

.overworld-link {
    font-family: var(--font-mono);
    font-size: 0.62rem;
    color: var(--accent2);
    text-decoration: none;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    border-bottom: 1px solid var(--accent-light);
    transition: color 0.2s, border-color 0.2s;
}
.overworld-link:hover { color: var(--accent); border-color: var(--accent); }

/* Sidebar */
#sidebar {
    grid-area: sidebar;
    padding: 32px 28px 40px 0;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    border-right: 1px solid var(--border);
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
}

.toc-title {
    font-family: var(--font-mono);
    font-size: 0.58rem;
    letter-spacing: 0.35em;
    text-transform: uppercase;
    color: var(--fg-dimmer);
    margin-bottom: 20px;
    display: block;
}

.toc-section {
    margin-bottom: 24px;
}

.toc-section-label {
    font-family: var(--font-mono);
    font-size: 0.6rem;
    color: var(--accent2);
    letter-spacing: 0.2em;
    text-transform: uppercase;
    margin-bottom: 8px;
    display: block;
}

.toc-list {
    list-style: none;
    padding: 0;
}

.toc-list li {
    margin-bottom: 2px;
}

.toc-list a {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    color: var(--fg-dim);
    text-decoration: none;
    display: block;
    padding: 3px 0 3px 12px;
    border-left: 1px solid var(--border);
    transition: color 0.15s, border-color 0.15s, padding-left 0.15s;
    line-height: 1.4;
}

.toc-list a:hover,
.toc-list a.active {
    color: var(--accent);
    border-left-color: var(--accent);
    padding-left: 16px;
}

.toc-list.sub a {
    font-size: 0.66rem;
    padding-left: 22px;
    color: var(--fg-dimmer);
}
.toc-list.sub a:hover,
.toc-list.sub a.active {
    color: var(--fg-dim);
    border-left-color: var(--border2);
    padding-left: 26px;
}

/* Content */
#content {
    grid-area: content;
    padding: 36px 0 64px 52px;
    max-width: var(--max-content);
    animation: fadeUp 0.45s ease both;
}

@keyframes fadeUp {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: none; }
}

/* Tabs */
#section-tabs {
    display: flex;
    gap: 0;
    margin-bottom: 40px;
    border-bottom: 1px solid var(--border);
}

.section-tab {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--fg-dimmer);
    padding: 10px 22px;
    cursor: pointer;
    border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    background: none;
    transition: color 0.2s, border-color 0.2s;
}

.section-tab:hover { color: var(--fg-dim); }
.section-tab.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

.content-section { display: none; }
.content-section.active { display: block; }

/* Typography */
.doc-section {
    margin-bottom: 60px;
    scroll-margin-top: 28px;
}

.doc-section h2 {
    font-family: var(--font-serif);
    font-size: 1.55rem;
    font-weight: 400;
    color: var(--fg);
    letter-spacing: 0.02em;
    border-bottom: 1px solid var(--border);
    padding-bottom: 10px;
    margin-bottom: 20px;
    line-height: 1.2;
}

.doc-section h3 {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    font-weight: normal;
    color: var(--accent2);
    letter-spacing: 0.22em;
    text-transform: uppercase;
    margin: 28px 0 12px;
}

.doc-section h4 {
    font-family: var(--font-sans);
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--fg-dim);
    margin: 18px 0 8px;
    letter-spacing: 0.01em;
}

p {
    margin-bottom: 14px;
    color: var(--fg);
    font-size: 0.9rem;
    line-height: 1.8;
}

em { font-style: italic; }
strong { font-weight: 500; }

a {
    color: var(--accent2);
    text-decoration: none;
    border-bottom: 1px solid var(--accent-light);
    transition: color 0.2s, border-color 0.2s;
}
a:hover { color: var(--accent); border-color: var(--accent); }

/* Lists */
ul, ol {
    list-style: none;
    padding: 0;
    margin-bottom: 16px;
}

ul li, ol li {
    padding-left: 18px;
    margin-bottom: 6px;
    position: relative;
    font-size: 0.88rem;
    color: var(--fg);
}

ul li::before {
    content: '—';
    position: absolute;
    left: 0;
    color: var(--fg-dimmer);
    font-family: var(--font-mono);
}

ol { counter-reset: ol-c; }
ol li { counter-increment: ol-c; }
ol li::before {
    content: counter(ol-c) '.';
    position: absolute;
    left: 0;
    color: var(--accent2);
    font-family: var(--font-mono);
    font-size: 0.72rem;
}

/* Inline code */
code {
    font-family: var(--font-mono);
    font-size: 0.8em;
    background: var(--bg3);
    color: var(--accent2);
    padding: 1px 5px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

/* Code blocks */
.code-block {
    background: var(--bg2);
    border: 1px solid var(--border2);
    border-left: 3px solid var(--accent);
    padding: 16px 18px;
    margin: 14px 0 20px;
    overflow-x: auto;
    position: relative;
    border-radius: var(--radius);
}

.code-block-label {
    font-family: var(--font-mono);
    font-size: 0.56rem;
    color: var(--fg-dimmer);
    letter-spacing: 0.28em;
    text-transform: uppercase;
    position: absolute;
    top: 8px;
    right: 36px;
}

.code-block pre {
    font-family: var(--font-mono);
    font-size: 0.78rem;
    line-height: 1.75;
    white-space: pre;
    color: var(--fg);
}

.copy-btn {
    position: absolute;
    bottom: 8px;
    right: 10px;
    background: transparent;
    border: 1px solid var(--border);
    color: var(--fg-dimmer);
    font-family: var(--font-mono);
    font-size: 0.58rem;
    letter-spacing: 0.18em;
    padding: 2px 8px;
    cursor: pointer;
    text-transform: uppercase;
    transition: color 0.15s, border-color 0.15s;
    border-radius: var(--radius);
}
.copy-btn:hover { color: var(--accent); border-color: var(--accent); }

/* Syntax tokens */
.t-kw  { color: #2a7ea0; }
.t-fn  { color: #3a6ea8; }
.t-st  { color: #4a8a60; }
.t-cm  { color: var(--fg-dimmer); font-style: italic; }
.t-nm  { color: #8a6030; }
.t-op  { color: #7a8898; }
.t-sh  { color: #4a8a60; }
.t-flag{ color: #6a9a50; }
.t-ph  { color: var(--accent2); }
.t-cmd { color: #3a6ea8; }

/* Callouts */
.callout {
    border: 1px solid var(--border2);
    border-left: 3px solid var(--accent);
    background: var(--accent-pale);
    padding: 12px 16px;
    margin: 16px 0;
    font-size: 0.86rem;
    border-radius: var(--radius);
}

.callout.warn {
    border-left-color: #c87050;
    background: #fdf5f2;
}

.callout.note {
    border-left-color: var(--accent);
    background: var(--accent-pale);
}

.callout .callout-head {
    font-family: var(--font-mono);
    font-size: 0.6rem;
    letter-spacing: 0.25em;
    text-transform: uppercase;
    color: var(--fg-dimmer);
    display: block;
    margin-bottom: 5px;
}

.callout.warn .callout-head { color: #c87050; }
.callout.note .callout-head { color: var(--accent); }

/* Pipeline */
.pipeline-flow {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    margin: 18px 0;
    font-family: var(--font-mono);
    font-size: 0.76rem;
}

.pipeline-step {
    background: var(--bg3);
    border: 1px solid var(--border2);
    padding: 5px 14px;
    color: var(--fg-dim);
    border-radius: var(--radius);
}

.pipeline-arrow { color: var(--fg-dimmer); }

/* Tables */
table {
    width: 100%;
    border-collapse: collapse;
    margin: 14px 0 18px;
    font-size: 0.84rem;
}

th {
    font-family: var(--font-mono);
    font-size: 0.62rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--fg-dimmer);
    text-align: left;
    padding: 8px 12px;
    border-bottom: 1px solid var(--border2);
}

td {
    padding: 7px 12px;
    border-bottom: 1px solid var(--border);
    color: var(--fg-dim);
    vertical-align: top;
    font-size: 0.85rem;
}

tr:last-child td { border-bottom: none; }
td:first-child { color: var(--fg); font-family: var(--font-mono); font-size: 0.78rem; }

/* HOME — Tool cards */
.home-intro {
    margin-bottom: 40px;
}

.home-intro h2 {
    font-family: var(--font-serif);
    font-size: 1.7rem;
    font-weight: 400;
    color: var(--fg);
    letter-spacing: 0.02em;
    margin-bottom: 14px;
    line-height: 1.2;
}

.home-intro p {
    max-width: 560px;
    color: var(--fg-dim);
}

.tool-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 48px;
}

.tool-card-home {
    border: 1px solid var(--border2);
    background: var(--bg);
    padding: 20px 22px 22px;
    position: relative;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s, transform 0.2s;
    border-radius: var(--radius);
    overflow: hidden;
}

.tool-card-home::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 2px;
    background: var(--accent-light);
    transition: background 0.2s;
}

.tool-card-home:hover {
    border-color: var(--accent);
    background: var(--accent-pale);
    transform: translateY(-2px);
}

.tool-card-home:hover::before {
    background: var(--accent);
}

.card-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
}

.card-name {
    font-family: var(--font-serif);
    font-size: 1.25rem;
    font-weight: 400;
    color: var(--fg);
    letter-spacing: 0.02em;
    line-height: 1.1;
}

.card-filename {
    font-family: var(--font-mono);
    font-size: 0.58rem;
    color: var(--fg-dimmer);
    letter-spacing: 0.12em;
    text-align: right;
    line-height: 1.5;
    padding-top: 3px;
}

.card-tagline {
    font-size: 0.83rem;
    color: var(--fg-dim);
    line-height: 1.6;
    margin-bottom: 14px;
}

.card-footer {
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: var(--font-mono);
    font-size: 0.6rem;
    color: var(--fg-dimmer);
    letter-spacing: 0.15em;
    text-transform: uppercase;
}

.card-footer::before {
    content: '';
    display: inline-block;
    width: 6px;
    height: 6px;
    border: 1px solid var(--accent-light);
    border-radius: 50%;
    background: var(--accent-pale);
    transition: border-color 0.2s, background 0.2s;
}

.tool-card-home:hover .card-footer::before {
    border-color: var(--accent);
    background: var(--accent);
}

/* Docs tool cards */
.doc-tool-card {
    border: 1px solid var(--border2);
    background: var(--bg2);
    padding: 18px 20px;
    margin-bottom: 18px;
    position: relative;
    border-radius: var(--radius);
}

.doc-tool-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0;
    width: 3px; height: 100%;
    background: var(--accent);
    border-radius: var(--radius) 0 0 var(--radius);
}

.doc-tool-card-name {
    font-family: var(--font-serif);
    font-size: 1.08rem;
    font-weight: 400;
    color: var(--fg);
    margin-bottom: 3px;
    letter-spacing: 0.02em;
}

.doc-tool-card-sub {
    font-family: var(--font-mono);
    font-size: 0.62rem;
    color: var(--fg-dimmer);
    letter-spacing: 0.18em;
    text-transform: uppercase;
    margin-bottom: 10px;
    display: block;
}

.doc-tool-card-desc {
    font-size: 0.87rem;
    color: var(--fg-dim);
    line-height: 1.65;
}

/* HR */
hr {
    border: none;
    border-top: 1px solid var(--border);
    margin: 30px 0;
}

/* Footer */
#site-footer {
    grid-area: footer;
    border-top: 1px solid var(--border);
    padding: 20px 0;
    text-align: center;
}

.footer-text {
    font-family: var(--font-mono);
    font-size: 0.56rem;
    color: var(--fg-dimmer);
    letter-spacing: 0.32em;
    text-transform: uppercase;
}

/* Scrollbar */
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 2px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent-light); }

/* TOC margin utility */
.mt-8 { margin-top: 8px; }

/* Deep-link flash highlight (e.g. /osint-suite#phone) */
@keyframes flashHighlight {
    0%   { box-shadow: 0 0 0 0 rgba(74, 158, 196, 0); background-color: transparent; }
    12%  { box-shadow: 0 0 0 3px var(--accent-light); background-color: var(--accent-pale); }
    100% { box-shadow: 0 0 0 0 rgba(74, 158, 196, 0); background-color: transparent; }
}
.flash-highlight {
    animation: flashHighlight 2.4s ease;
    border-radius: 6px;
}
