/* ================================================
   DMS.CA — Dark Tech Theme
   ================================================ */

/* CUSTOM PROPERTIES */
:root {
    --hdr-bg:        #1a1a2e;
    --hdr-border:    #0f3460;
    --hdr-height:    66px;
    --accent:        #3a86ff;
    --accent-dark:   #2563eb;
    --accent-glow:   rgba(58, 134, 255, .22);
    --page-bg:       #eef1f8;
    --surface:       #ffffff;
    --text:          #1e293b;
    --text-light:    #475569;
    --text-muted:    #94a3b8;
    --border:        #e2e8f0;
    --footer-bg:     #1a1a2e;
    --footer-border: #0f3460;
    --footer-text:   #94a3b8;
    --radius:        8px;
    --radius-lg:     14px;
    --shadow-sm:     0 1px 3px rgba(0,0,0,.08);
    --shadow-md:     0 4px 12px rgba(0,0,0,.10);
    --shadow-lg:     0 8px 30px rgba(0,0,0,.14);
    --max-w:         1140px;
    --font-sans:     'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
    --font-mono:     'JetBrains Mono', 'Fira Code', ui-monospace, 'Cascadia Code', monospace;
    --ease:          .15s ease;
}

/* RESET */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }
body {
    font-family: var(--font-sans);
    font-size: 1rem;
    line-height: 1.65;
    color: var(--text);
    background: var(--page-bg);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    min-height: 100vh;
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--accent); text-decoration: none; transition: color var(--ease); }
a:hover { color: var(--accent-dark); }
ul, ol { list-style: none; }

/* PARTICLE CANVAS */
#particle-canvas {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    pointer-events: none;
    z-index: 0;
}

/* Content layers sit above the particle canvas */
.site-main   { position: relative; z-index: 1; }
.site-footer { position: relative; z-index: 1; }

/* CONTAINER */
.container {
    max-width: var(--max-w);
    margin: 0 auto;
    padding: 0 24px;
}

/* ── HEADER ─────────────────────────────────── */
.site-header {
    background: var(--hdr-bg);
    border-bottom: 1px solid var(--hdr-border);
    height: var(--hdr-height);
    position: sticky;
    top: 0;
    z-index: 200;
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: var(--hdr-height);
}

/* Brand */
.site-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #e2e8f0;
    font-weight: 700;
    font-size: 1.2rem;
    letter-spacing: -.025em;
    flex-shrink: 0;
}
.site-brand:hover { color: #fff; }

.brand-mark {
    width: 34px;
    height: 34px;
    background: var(--accent);
    border-radius: 7px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: .85rem;
    font-weight: 800;
    box-shadow: 0 2px 12px var(--accent-glow);
    flex-shrink: 0;
    line-height: 1;
    user-select: none;
}

/* ── NAVIGATION ──────────────────────────────── */
.site-nav ul {
    display: flex;
    align-items: center;
    gap: 2px;
}

.site-nav li a {
    display: block;
    color: #94a3b8;
    font-size: .875rem;
    font-weight: 500;
    padding: 6px 14px;
    border-radius: var(--radius);
    transition: color var(--ease), background var(--ease);
    white-space: nowrap;
}

.site-nav li a:hover {
    color: #f1f5f9;
    background: rgba(255,255,255,.07);
}

.site-nav li.current a,
.site-nav li.section a {
    color: var(--accent);
    background: rgba(58,134,255,.12);
}

/* Mobile nav toggle */
.nav-toggle {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 38px;
    height: 38px;
    background: rgba(255,255,255,.06);
    border: 1px solid rgba(255,255,255,.1);
    border-radius: var(--radius);
    cursor: pointer;
    padding: 9px 8px;
    flex-shrink: 0;
}

.nav-toggle span {
    display: block;
    width: 100%;
    height: 2px;
    background: #94a3b8;
    border-radius: 2px;
    transition: transform .2s, opacity .2s;
}

.nav-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ── MAIN ─────────────────────────────────────── */
.site-main {
    padding: 40px 0 80px;
    min-height: calc(100vh - var(--hdr-height) - 110px);
}

/* Page layout — sidebar + content grid */
.page-layout {
    display: grid;
    grid-template-columns: 220px 1fr;
    gap: 28px;
    align-items: start;
}

.page-layout.no-sidebar {
    grid-template-columns: 1fr;
}

.page-sidebar {
    position: sticky;
    top: calc(var(--hdr-height) + 16px);
}

/* ── SIDEBAR ──────────────────────────────────── */
.sidebar-nav {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.sidebar-nav h3 {
    font-size: .75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--text-muted);
    padding: 14px 16px 10px;
    border-bottom: 1px solid var(--border);
}

.sidebar-nav > ul { padding: 6px 0; }

.sidebar-nav li a {
    display: block;
    padding: 8px 16px;
    color: var(--text-light);
    font-size: .875rem;
    font-weight: 500;
    border-left: 3px solid transparent;
    transition: background var(--ease), color var(--ease), border-color var(--ease);
    line-height: 1.4;
}

.sidebar-nav li a:hover {
    background: #f8fafc;
    color: var(--text);
}

.sidebar-nav li.current > a,
.sidebar-nav li.section > a {
    border-left-color: var(--accent);
    background: rgba(58,134,255,.06);
    color: var(--accent);
    font-weight: 600;
}

/* Nested levels */
.sidebar-nav ul ul { padding: 0; }
.sidebar-nav ul ul li a { padding-left: 28px; font-size: .85rem; }
.sidebar-nav ul ul ul li a { padding-left: 40px; }

/* ── BREADCRUMBS ──────────────────────────────── */
#Breadcrumbs {
    font-size: .8rem;
    color: var(--text-muted);
    margin-bottom: 14px;
    display: flex;
    align-items: center;
    gap: 5px;
    flex-wrap: wrap;
}

#Breadcrumbs a {
    color: var(--text-muted);
    transition: color var(--ease);
    border-bottom: none;
}
#Breadcrumbs a:hover { color: var(--accent); }

/* ── PAGE CONTENT / TYPOGRAPHY ────────────────── */
.page-content {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 40px 48px;
    box-shadow: var(--shadow-sm);
    min-width: 0;
}

.page-content h1 {
    font-size: 2rem;
    font-weight: 700;
    line-height: 1.2;
    color: var(--text);
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 2px solid var(--border);
    letter-spacing: -.03em;
}
.page-content h2 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text);
    margin: 32px 0 12px;
    letter-spacing: -.02em;
}
.page-content h3 {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text);
    margin: 24px 0 10px;
}
.page-content h4 {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--text);
    margin: 20px 0 8px;
}
.page-content h5 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-light);
    margin: 16px 0 6px;
}
.page-content h6 {
    font-size: .875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .07em;
    color: var(--text-muted);
    margin: 14px 0 6px;
}

.page-content p {
    margin-bottom: 16px;
    color: var(--text);
    line-height: 1.75;
}

.page-content .intro {
    font-size: 1.15rem;
    color: var(--text-light);
    line-height: 1.7;
    margin-bottom: 24px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border);
}

.page-content a {
    color: var(--accent);
    border-bottom: 1px solid rgba(58,134,255,.25);
    transition: color var(--ease), border-color var(--ease);
}
.page-content a:hover {
    color: var(--accent-dark);
    border-bottom-color: var(--accent-dark);
}

.page-content ul,
.page-content ol {
    margin: 0 0 16px 24px;
}
.page-content ul  { list-style: disc; }
.page-content ol  { list-style: decimal; }
.page-content li  { margin-bottom: 6px; line-height: 1.7; }

/* Selection highlight */
::selection     { background: var(--accent); color: #fff; text-shadow: none; }
::-moz-selection { background: var(--accent); color: #fff; text-shadow: none; }

/* Tables */
.page-content table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 24px;
    font-size: .9rem;
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
}
.page-content table th {
    background: var(--hdr-bg);
    color: #e2e8f0;
    font-weight: 600;
    padding: 12px 16px;
    text-align: left;
    font-size: .8rem;
    text-transform: uppercase;
    letter-spacing: .05em;
}
.page-content table td {
    padding: 11px 16px;
    border-bottom: 1px solid var(--border);
    vertical-align: top;
    color: var(--text);
}
.page-content table tr:last-child td { border-bottom: none; }
.page-content table tr:nth-child(even) td { background: #f8fafc; }

/* Blockquote */
.page-content blockquote {
    border-left: 4px solid var(--accent);
    background: rgba(58,134,255,.04);
    margin: 24px 0;
    padding: 16px 24px;
    border-radius: 0 var(--radius) var(--radius) 0;
    font-style: italic;
    color: var(--text-light);
}
.page-content blockquote p { margin-bottom: 0; }

/* Code */
.page-content pre {
    background: #0f172a;
    color: #e2e8f0;
    padding: 20px 24px;
    border-radius: var(--radius);
    overflow-x: auto;
    font-family: var(--font-mono);
    font-size: .875rem;
    line-height: 1.7;
    margin-bottom: 24px;
    box-shadow: var(--shadow-sm);
    border: 1px solid rgba(255,255,255,.06);
}
.page-content code {
    font-family: var(--font-mono);
    background: #f1f5f9;
    color: #e94560;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: .875em;
}
.page-content pre code {
    background: none;
    color: inherit;
    padding: 0;
    font-size: inherit;
}

/* Images */
.page-content img {
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    margin-bottom: 20px;
    max-width: 100%;
    height: auto;
    border: 1px solid var(--border);
}

.page-content img.left  { float: left; max-width: 48%; margin: 4px 20px 12px 0; }
.page-content img.right { float: right; max-width: 48%; margin: 4px 0 12px 20px; }
.page-content img.center { display: block; margin: 0 auto 20px; float: none; }

.page-content .captionImage { margin-bottom: 16px; }
.page-content .captionImage p { font-size: .8rem; color: var(--text-muted); font-style: italic; margin: 6px 0 0; }

/* Caption images */
.page-content .captionImage.left  { float: left; max-width: 48%; margin: 4px 20px 12px 0; }
.page-content .captionImage.right { float: right; max-width: 48%; margin: 4px 0 12px 20px; }
.page-content .captionImage.center { display: block; margin: 0 auto 20px; float: none; }
.page-content .captionImage img   { margin: 0; border-radius: var(--radius); }

/* ── FORMS ────────────────────────────────────── */
.typography form,
.page-content form {
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 28px 32px;
    margin-top: 28px;
    box-shadow: var(--shadow-sm);
    max-width: 540px;
}

fieldset {
    border: none;
    padding: 0;
    margin: 0;
}

.field {
    margin-bottom: 20px;
}

.field label.left,
.field > label {
    display: block;
    font-size: .875rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 7px;
}

.field input.text,
.field input[type="text"],
.field input[type="email"],
.field input[type="url"],
.field input[type="password"],
.field input[type="number"],
.field textarea,
.field select {
    display: block;
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    font-size: .95rem;
    font-family: var(--font-sans);
    color: var(--text);
    background: #fff;
    transition: border-color var(--ease), box-shadow var(--ease);
    outline: none;
    -webkit-appearance: none;
}

.field input.text:focus,
.field input[type="text"]:focus,
.field input[type="email"]:focus,
.field input[type="url"]:focus,
.field input[type="password"]:focus,
.field input[type="number"]:focus,
.field textarea:focus,
.field select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

textarea { resize: vertical; min-height: 100px; }

/* Optionset / Checkboxset */
.optionset ul,
.checkboxset ul {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0;
    padding: 0;
}

.optionset li,
.checkboxset li {
    list-style: none;
    margin: 0;
}

.optionset li label,
.checkboxset li label {
    display: flex;
    align-items: center;
    gap: 9px;
    cursor: pointer;
    padding: 9px 16px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    font-size: .9rem;
    font-weight: 500;
    color: var(--text);
    background: #fff;
    transition: border-color var(--ease), background var(--ease), color var(--ease);
    user-select: none;
}

.optionset li label:hover,
.checkboxset li label:hover {
    border-color: var(--accent);
    background: rgba(58,134,255,.04);
}

input[type="radio"],
input[type="checkbox"] {
    accent-color: var(--accent);
    width: 15px;
    height: 15px;
    cursor: pointer;
    flex-shrink: 0;
}

/* Actions */
.Actions {
    margin-top: 24px;
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

input[type="submit"],
.Actions .action,
button.action,
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: var(--radius);
    padding: 11px 28px;
    font-size: .95rem;
    font-weight: 600;
    font-family: var(--font-sans);
    cursor: pointer;
    transition: background var(--ease), box-shadow var(--ease), transform .1s;
    box-shadow: 0 2px 12px var(--accent-glow);
    letter-spacing: .01em;
    line-height: 1;
    text-decoration: none;
    -webkit-appearance: none;
}

input[type="submit"]:hover,
.Actions .action:hover,
button.action:hover,
.btn:hover {
    background: var(--accent-dark);
    box-shadow: 0 4px 20px rgba(58,134,255,.4);
    transform: translateY(-1px);
    color: #fff;
}

input[type="submit"]:active,
.Actions .action:active,
button.action:active,
.btn:active {
    transform: translateY(0);
    box-shadow: 0 1px 6px var(--accent-glow);
}

/* Form messages */
.message {
    padding: 10px 14px;
    border-radius: var(--radius);
    font-size: .875rem;
    font-weight: 500;
    margin-bottom: 16px;
    border: 1px solid;
}

.message.good,
.message.success  { background: #f0fdf4; color: #166534; border-color: #bbf7d0; }
.message.bad,
.message.error,
.message.required { background: #fef2f2; color: #991b1b; border-color: #fecaca; }
.message.warning  { background: #fffbeb; color: #92400e; border-color: #fde68a; }

form .requiredField label.left::after {
    content: " *";
    color: #ef4444;
    font-weight: 400;
}

/* ── SEARCH RESULTS ───────────────────────────── */
.searchResults h1 {
    border-bottom: none;
    padding-bottom: 0;
    margin-bottom: 4px;
}

.searchResults p.searchQuery {
    color: var(--text-muted);
    font-size: .9rem;
    margin-bottom: 28px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border);
}

#SearchResults {
    list-style: none;
    margin: 0;
    padding: 0;
}

#SearchResults li {
    border-bottom: 1px solid var(--border);
    padding: 20px 0;
}

#SearchResults h4 a {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--text);
    border-bottom: none;
}
#SearchResults h4 a:hover { color: var(--accent); }
#SearchResults p  { color: var(--text-light); font-size: .9rem; margin: 6px 0 8px; }
a.readMoreLink    { font-size: .8rem; font-weight: 500; color: var(--accent); border-bottom: none; }
a.readMoreLink:hover { border-bottom: 1px solid var(--accent); }

#PageNumbers { margin-top: 8px; }

#PageNumbers .pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 24px 0;
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
}

#PageNumbers .pagination a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 34px;
    height: 34px;
    padding: 0 10px;
    border-radius: var(--radius);
    font-size: .875rem;
    font-weight: 500;
    color: var(--text-light);
    border: 1px solid var(--border);
    background: #fff;
    transition: all var(--ease);
    text-decoration: none;
}

#PageNumbers .pagination a:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: rgba(58,134,255,.05);
}

#PageNumbers .pagination .prev,
#PageNumbers .pagination .next {
    color: var(--accent);
    border-color: var(--accent);
    padding: 0 16px;
    font-size: .85rem;
    font-weight: 600;
}

#PageNumbers p {
    text-align: center;
    color: var(--text-muted);
    font-size: .85rem;
    padding: 12px 0;
    margin: 0;
}

/* ── FOOTER ───────────────────────────────────── */
.site-footer {
    background: var(--footer-bg);
    border-top: 1px solid var(--footer-border);
    padding: 28px 0;
    font-size: .85rem;
}

.footer-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    flex-wrap: wrap;
}

.footer-brand-link {
    color: #e2e8f0;
    font-weight: 700;
    font-size: 1rem;
    letter-spacing: -.015em;
    display: inline-block;
    margin-bottom: 4px;
    transition: color var(--ease);
}
.footer-brand-link:hover { color: var(--accent); }

.footer-tagline {
    color: #475569;
    font-size: .8rem;
    margin: 0;
    line-height: 1.4;
}

.footer-nav .site-nav ul {
    display: flex;
    flex-wrap: wrap;
    gap: 2px;
}

.footer-nav .site-nav li a {
    color: var(--footer-text);
    padding: 4px 10px;
    font-size: .825rem;
}
.footer-nav .site-nav li a:hover {
    color: var(--accent);
    background: rgba(58,134,255,.08);
}
.footer-nav .site-nav li.current a,
.footer-nav .site-nav li.section a { color: var(--accent); }

.footer-copy { color: #475569; }

/* ── RESPONSIVE ───────────────────────────────── */
@media (max-width: 900px) {
    .page-layout { grid-template-columns: 1fr; }
    .page-sidebar { position: static; }
}

@media (max-width: 720px) {
    .nav-toggle { display: flex; }

    .site-header { position: relative; }

    .site-nav {
        display: none;
        position: absolute;
        top: var(--hdr-height);
        left: 0;
        right: 0;
        background: var(--hdr-bg);
        border-bottom: 1px solid var(--hdr-border);
        padding: 12px 16px 18px;
        box-shadow: var(--shadow-lg);
        z-index: 100;
    }

    .site-nav.is-open { display: block; }

    .site-nav ul {
        flex-direction: column;
        align-items: stretch;
        gap: 2px;
    }

    .site-nav li a { padding: 10px 16px; }

    .page-content { padding: 24px 20px; }
    .page-content h1 { font-size: 1.65rem; }
    .page-content h2 { font-size: 1.3rem; }

    .site-main { padding: 28px 0 60px; }

    .typography form,
    .page-content form { padding: 20px 16px; }

    .footer-inner {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }
}

@media (max-width: 480px) {
    .container { padding: 0 14px; }
    .page-content { padding: 18px 14px; }
    .page-content h1 { font-size: 1.4rem; }
    .optionset ul { flex-direction: column; }
    .page-content img.left,
    .page-content img.right { float: none; max-width: 100%; margin: 0 0 16px; }
}

/* PRINT */
@media print {
    .site-header, .site-footer, .nav-toggle, .page-sidebar { display: none !important; }
    body { background: #fff; color: #000; }
    .page-content { box-shadow: none; border: none; padding: 0; }
    .page-content a { color: #000; }
    .page-content a[href]::after { content: " (" attr(href) ")"; font-size: .8em; color: #666; }
}
