/* ============================================
   NodeEditor.Net Docs — Global Styles
   Color scheme from WebHost / node-editor.css:
   - Canvas bg:    #1e1e2e
   - Node bg:      #2d2d3d / #252535
   - Node border:  #3d3d5c
   - Accent blue:  #6699ff
   - Accent green: #88cc88
   - Text:         #e0e0f0
   ============================================ */

:root {
    --bg-base: #121220;
    --bg-surface: #1a1a2a;
    --bg-elevated: #1e1e2e;
    --bg-card: #252535;
    --border-subtle: rgba(61, 61, 92, 0.4);
    --border-default: #3d3d5c;
    --accent: #6699ff;
    --accent-hover: #88aaff;
    --accent-green: #88cc88;
    --accent-purple: #c792ea;
    --text-primary: #e0e0f0;
    --text-secondary: rgba(224, 224, 240, 0.6);
    --text-muted: rgba(224, 224, 240, 0.4);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.4);
    --radius: 8px;
    --radius-lg: 12px;
}

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

html {
    scroll-behavior: smooth;
}

html, body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg-base);
    color: var(--text-primary);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
}

a {
    color: var(--accent);
    text-decoration: none;
    transition: color 0.2s;
}

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

h1, h2, h3, h4 { font-weight: 700; color: #fff; }
h1 { font-size: 2.2rem; margin-bottom: 1rem; }
h2 { font-size: 1.8rem; margin-bottom: 0.75rem; }
h3 { font-size: 1.3rem; margin-bottom: 0.5rem; }

h1:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
h1:focus:not(:focus-visible) { outline: none; }

img { max-width: 100%; height: auto; }

code {
    font-family: 'Cascadia Code', 'Fira Code', 'JetBrains Mono', Consolas, monospace;
    font-size: 0.88em;
    background: rgba(255, 255, 255, 0.06);
    padding: 2px 6px;
    border-radius: 4px;
    color: var(--accent-purple);
}

pre {
    overflow-x: auto;
    margin: 0;
}

pre code {
    display: block;
    padding: 16px 20px;
    background: #141422;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius);
    font-size: 0.85em;
    line-height: 1.7;
    white-space: pre;
    color: var(--text-primary);
}

/* Highlight.js theme overrides — match site dark scheme */
pre code.hljs {
    background: #141422;
    padding: 16px 20px;
}

/* ============================================
   Buttons
   ============================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 24px;
    font-size: 0.95rem;
    font-weight: 600;
    border-radius: var(--radius);
    border: 1px solid transparent;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s;
    color: #fff;
}

.btn-primary {
    background: linear-gradient(135deg, #5577dd, #6699ff);
    border-color: rgba(102, 153, 255, 0.3);
    box-shadow: 0 4px 16px rgba(102, 153, 255, 0.2);
}

.btn-primary:hover {
    background: linear-gradient(135deg, #6688ee, #77aaff);
    box-shadow: 0 6px 24px rgba(102, 153, 255, 0.35);
    transform: translateY(-1px);
    color: #fff;
}

.btn-outline {
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-primary);
    border-color: rgba(255, 255, 255, 0.15);
}

.btn-outline:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.25);
    color: #fff;
    transform: translateY(-1px);
}

.btn-lg {
    padding: 14px 32px;
    font-size: 1.05rem;
}

/* ============================================
   Cards
   ============================================ */
.card {
    background: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 24px;
    transition: border-color 0.25s, box-shadow 0.25s, transform 0.25s;
}

.card:hover {
    border-color: rgba(102, 153, 255, 0.3);
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

/* ============================================
   Sections
   ============================================ */
.section {
    padding: 80px 24px;
}

.section--alt {
    background: var(--bg-surface);
}

.section-container {
    max-width: 1200px;
    margin: 0 auto;
}

.section-header {
    text-align: center;
    margin-bottom: 48px;
}

.section-header h2 {
    background: linear-gradient(135deg, #e0e0f0, var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.section-header p {
    color: var(--text-secondary);
    font-size: 1.1rem;
    max-width: 600px;
    margin: 12px auto 0;
}

/* ============================================
   Grid Layouts
   ============================================ */
.grid-2 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
    gap: 24px;
}

.grid-3 {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.grid-4 {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 16px;
}

/* ============================================
   Badge
   ============================================ */
.badge {
    display: inline-block;
    padding: 4px 14px;
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    border-radius: 999px;
}

.badge--green {
    color: var(--accent-green);
    background: rgba(136, 204, 136, 0.1);
    border: 1px solid rgba(136, 204, 136, 0.2);
}

.badge--blue {
    color: var(--accent);
    background: rgba(102, 153, 255, 0.1);
    border: 1px solid rgba(102, 153, 255, 0.2);
}

/* ============================================
   Screenshot frame
   ============================================ */
.screenshot-frame {
    border-radius: var(--radius-lg);
    overflow: hidden;
    border: 1px solid var(--border-subtle);
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(102, 153, 255, 0.08);
}

.screenshot-frame img {
    display: block;
    width: 100%;
}

/* ============================================
   Feature icon
   ============================================ */
.feature-icon {
    font-size: 1.6rem;
    margin-bottom: 12px;
}

/* ============================================
   Table styling
   ============================================ */
.docs-table {
    width: 100%;
    border-collapse: collapse;
}

.docs-table th,
.docs-table td {
    padding: 10px 14px;
    text-align: left;
    border-bottom: 1px solid var(--border-subtle);
    font-size: 0.9rem;
}

.docs-table th {
    color: var(--text-secondary);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.78rem;
    letter-spacing: 0.04em;
}

.docs-table td a { font-weight: 600; }

.docs-table td:last-child { color: var(--text-secondary); }

/* ============================================
   Loading screen
   ============================================ */
.loading-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: var(--bg-base);
}

.loading-logo {
    width: 64px;
    height: 64px;
    margin-bottom: 24px;
    border-radius: 12px;
}

.loading-progress {
    position: relative;
    display: block;
    width: 6rem;
    height: 6rem;
    margin: 0 auto;
}

.loading-progress circle {
    fill: none;
    stroke: var(--border-default);
    stroke-width: 0.5rem;
    transform-origin: 50% 50%;
    transform: rotate(-90deg);
}

.loading-progress circle:last-child {
    stroke: var(--accent);
    stroke-dasharray: calc(3.141 * var(--blazor-load-percentage, 0%) * 0.8), 500%;
    transition: stroke-dasharray 0.05s ease-in-out;
}

.loading-progress-text {
    text-align: center;
    font-weight: 600;
    color: var(--text-secondary);
    margin-top: 12px;
}

.loading-progress-text:after {
    content: var(--blazor-load-percentage-text, "Loading");
}

/* ============================================
   Blazor error UI
   ============================================ */
#blazor-error-ui {
    background: #1e1e2e;
    color: var(--text-primary);
    bottom: 0;
    box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.3);
    border-top: 1px solid rgba(255, 77, 77, 0.3);
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: 0.75rem;
    top: 0.5rem;
}

.blazor-error-boundary {
    background: #b32121;
    padding: 1rem;
    color: white;
    border-radius: var(--radius);
}

.blazor-error-boundary::after {
    content: "An error has occurred."
}

/* ============================================
   Documentation article pages
   ============================================ */
.doc-content {
    max-width: 860px;
}

.doc-content h2 {
    font-size: 1.5rem;
    margin-top: 48px;
    margin-bottom: 16px;
    padding-top: 24px;
    border-top: 1px solid rgba(61, 61, 92, 0.25);
}

.doc-content h2:first-of-type {
    border-top: none;
    margin-top: 32px;
    padding-top: 0;
}

.doc-content h3 {
    font-size: 1.15rem;
    margin-top: 32px;
    margin-bottom: 12px;
}

.doc-content h4 {
    font-size: 1rem;
    margin-top: 24px;
    margin-bottom: 8px;
}

.doc-content p {
    color: var(--text-secondary);
    margin-bottom: 16px;
    line-height: 1.7;
}

.doc-content ul,
.doc-content ol {
    margin: 12px 0 20px;
    padding-left: 24px;
    color: var(--text-secondary);
}

.doc-content li {
    margin-bottom: 6px;
    line-height: 1.6;
}

.doc-content pre {
    margin-bottom: 20px;
    max-width: 100%;
}

.doc-content blockquote {
    border-left: 3px solid var(--accent);
    padding: 12px 20px;
    margin: 20px 0;
    background: rgba(102, 153, 255, 0.05);
    border-radius: 0 var(--radius) var(--radius) 0;
    color: var(--text-secondary);
}

.doc-content .info-box {
    background: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 20px 24px;
    margin: 20px 0;
}

.doc-content .info-box h4 {
    margin-top: 0;
    margin-bottom: 8px;
}

.doc-nav {
    display: flex;
    gap: 16px;
    margin-top: 48px;
    padding-top: 32px;
    border-top: 1px solid rgba(61, 61, 92, 0.3);
    flex-wrap: wrap;
}

.doc-nav a {
    font-weight: 600;
    font-size: 0.9rem;
}

/* ============================================
   Responsive
   ============================================ */
@media (max-width: 768px) {
    h1 { font-size: 1.7rem; }
    h2 { font-size: 1.4rem; }
    .section { padding: 48px 16px; }
    .grid-2, .grid-3 { grid-template-columns: 1fr; }
    .grid-4 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 480px) {
    .grid-4 { grid-template-columns: 1fr; }
}