/* ═══════════════════════════════════════════════════════════════
   Stemulator — Global Design System
   ─────────────────────────────────────────────────────────────── */

/* ── Custom Fonts ─────────────────────────────────────────────── */
@font-face {
    font-family: DSEG7Classic-Bold;
    src: url(/fonts/DSEG7Classic-Bold.woff);
    font-display: block;
}

@font-face {
    font-family: 'DSEG7 Classic';
    src: url(/fonts/DSEG7Classic-Regular.woff);
    font-display: block;
}

/* ── Design Tokens ────────────────────────────────────────────── */
:root {
    /* Radii */
    --radius-xs: 6px;
    --radius-sm: 10px;
    --radius-md: 14px;
    --radius-lg: 20px;
    --radius-xl: 28px;

    /* Glass surfaces */
    --glass-bg: rgba(14, 14, 28, 0.72);
    --glass-bg-lighter: rgba(22, 22, 42, 0.65);
    --glass-border: rgba(255, 255, 255, 0.09);
    --glass-border-hi: rgba(255, 255, 255, 0.16);
    --glass-blur: blur(40px) saturate(200%);
    --glass-blur-sm: blur(20px) saturate(160%);

    /* Accent */
    --accent: #6366f1;
    --accent-2: #8b5cf6;
    --accent-glow: rgba(99, 102, 241, 0.32);
    --accent-glow2: rgba(139, 92, 246, 0.24);
    --green: #28ca41;
    --red: #ff5f57;
    --yellow: #ffbd2e;
    --cyan: #22d3ee;

    /* Text */
    --text-primary: rgba(255, 255, 255, 0.92);
    --text-secondary: rgba(255, 255, 255, 0.55);
    --text-muted: rgba(255, 255, 255, 0.28);

    /* Fonts */
    --font-ui: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: 'Geist Mono', 'Fira Code', 'Cascadia Code', monospace;

    /* Shadows */
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.35);
    --shadow-md: 0 8px 32px rgba(0, 0, 0, 0.50);
    --shadow-lg: 0 24px 72px rgba(0, 0, 0, 0.65);
    --shadow-glow: 0 0 28px var(--accent-glow);

    /* Transitions */
    --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
    --ease-smooth: cubic-bezier(0.25, 1, 0.5, 1);
    --t-fast: 0.12s;
    --t-normal: 0.22s;
    --t-slow: 0.35s;
}

/* ── Base Reset ───────────────────────────────────────────────── */
*,
*::before,
*::after {
    box-sizing: border-box;
}

body,
html {
    margin: 0;
    padding: 0;
    overflow: hidden;
    background: #0c0c1f;
    font-family: var(--font-ui);
    font-size: 14px;
    line-height: 1.5;
    color: var(--text-primary);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

#sapper {
    overflow: hidden;
}

/* ── Typography ───────────────────────────────────────────────── */
h1,
h2,
h3,
h4,
h5,
h6 {
    margin: 0 0 0.5em 0;
    font-weight: 600;
    line-height: 1.2;
    letter-spacing: -0.02em;
    color: var(--text-primary);
}

h1 {
    font-size: 2em;
}

h2 {
    font-size: 1.5em;
}

h3 {
    font-size: 1.25em;
}

a {
    color: var(--accent);
    text-decoration: none;
    transition: opacity var(--t-fast);
}

a:hover {
    opacity: 0.8;
}

/* ── Code & Mono ──────────────────────────────────────────────── */
code,
kbd,
samp,
pre {
    font-family: var(--font-mono);
    font-size: 0.875em;
}

code {
    color: #c4b5fd;
    background: rgba(139, 92, 246, 0.12);
    border: 1px solid rgba(139, 92, 246, 0.2);
    padding: 0.15em 0.45em;
    border-radius: var(--radius-xs);
}

/* ── Buttons (global reset) ───────────────────────────────────── */
button {
    font-family: var(--font-ui);
    cursor: pointer;
}

button:active {
    transform: scale(0.94);
}

/* ── Scrollbars (webkit) ──────────────────────────────────────── */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.12);
    border-radius: 3px;
    transition: background 0.2s;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.22);
}

/* Firefox scrollbars */
* {
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.12) transparent;
}

/* ── Selection ────────────────────────────────────────────────── */
::selection {
    background: rgba(99, 102, 241, 0.35);
    color: #fff;
}

/* ── SVG cursor ───────────────────────────────────────────────── */
svg {
    cursor: move;
}

.wire-connection {
    cursor: pointer !important;
}

/* ── Blockly overrides ────────────────────────────────────────── */

/* Hide Blockly's native toolbox — replaced by KiduinoToolbox */
.blocklyToolboxDiv {
    display: none !important;
}

/* Flyout panel */
.blocklyFlyout {
    border-radius: 0 var(--radius-md) var(--radius-md) 0 !important;
    box-shadow: 4px 0 28px rgba(0, 0, 0, 0.45) !important;
}

.blocklyFlyoutBackground {
    fill: #12102b !important;
    fill-opacity: 0.98 !important;
}

/* Workspace canvas background */
.blocklyMainBackground {
    fill: #f0f4f8 !important;
}

/* Scrollbar knob */
.blocklyScrollbarKnob {
    fill: rgba(100, 80, 200, 0.35) !important;
}

.blocklyScrollbarKnob:hover {
    fill: rgba(120, 100, 220, 0.5) !important;
}

/* Block widget overflow fix */
.blocklyWidgetDiv .blocklyMenu {
    overflow-y: hidden;
}

/* ── Utility classes ──────────────────────────────────────────── */
.glass {
    background: var(--glass-bg);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}