:root {
    --panel-bg: #e0dcd3;
    --panel-border: #444;
    --paper-bg: #ffffff;
    --text-primary: #222;
    --accent: #0000cc;
    --grid-color: rgba(0, 0, 0, 0.1);
    
    --lcd-bg: #8bac0f;
    --lcd-text: #0f380f;
    --lcd-trace: #0f380f;
    
    --led-off: #550000;
    --led-on: #ff0000;
    --glow: none;
    
    --shadow-hard: 4px 4px 0px rgba(0,0,0,0.3);
    --shadow-inset: inset 2px 2px 0px rgba(0,0,0,0.2);
    --border-width: 2px;
}

[data-theme="dark"] {
    --panel-bg: #2d2d2d;
    --panel-border: #fefefe;
    --paper-bg: #000000;
    --text-primary: #00ff00;
    --accent: #ffff00; 
    --grid-color: rgba(0, 255, 0, 0.15);
    
    --lcd-bg: #003300; 
    --lcd-text: #00ff00;
    --lcd-trace: #00ff00;
    
    --led-off: #330000;
    --led-on: #ff3333;
    --glow: 0 0 0 transparent;
}

* { 
    box-sizing: border-box; 
    cursor: none; 
}

iframe {
    cursor: none;
}

body {
    margin: 0;
    font-family: 'VT323', monospace;
    font-size: 18px;
    background-color: var(--paper-bg);
    color: var(--text-primary);
    transition: 0s;
    min-height: 100vh;
    display: flex; justify-content: center;
    image-rendering: pixelated;
}

.schematic-bg {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background-image: radial-gradient(var(--grid-color) 20%, transparent 20%);
    background-position: 0 0;
    background-size: 20px 20px;
    z-index: -1;
}

.main-rack { width: 100%; max-width: 850px; margin-top: 20px; display: flex; flex-direction: column; }

.instrument-panel {
    background: var(--panel-bg);
    border: 4px solid var(--panel-border);
    border-radius: 0px;
    padding: 15px;
    display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center;
    position: sticky; top: 0; z-index: 100;
    box-shadow: var(--shadow-hard);
}

.screw { 
    width: 10px; height: 10px; 
    background: #888; 
    border-radius: 0;
    position: absolute; 
    border: 1px solid #000;
}
.screw::after { 
    content:'+'; position:absolute; top:-6px; left:0px; 
    font-family:'VT323'; color:#000; font-size:16px; 
}
.tl {top:5px; left:5px;} .tr {top:5px; right:5px;} .bl {bottom:5px; left:5px;} .br {bottom:5px; right:5px;}

.panel-section { display: flex; flex-direction: column; align-items: center; padding: 0 15px; }

.label { 
    font-size: 14px; 
    color: var(--text-primary); margin-bottom: 5px; 
    background: var(--paper-bg); 
    padding: 2px 6px; 
    border: 2px solid var(--panel-border); 
    text-transform: uppercase;
}

.lcd-housing {
    position: relative;
    background: #000; padding: 10px 10px; 
    border-radius: 0;
    border: 4px solid #444;
    box-shadow: none;
}
.brand { color: #ccc; font-size: 8%; margin-bottom: 5px; text-transform: uppercase; }
.brand span { color: var(--accent); }

.lcd-screen-container {
    position: relative;
    width: 280px; height: 70px;
    background: var(--lcd-bg);
    overflow: hidden;
    border: 2px solid #000;
    background-image: linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.1) 50%);
    background-size: 100% 4px;
}

#scope-canvas { position: absolute; top: 0; left: 0; width: 100%; height: 100%; z-index: 1; image-rendering: pixelated; }

.lcd-overlay {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%; z-index: 2;
    padding: 5px;
    font-family: 'VT323', monospace; font-size: 24px;
    color: var(--lcd-text);
}

.scanlines { display: none; }

.blink { animation: blink 0.5s step-end infinite; }
@keyframes blink { 50% { opacity: 0; } }

.toggle-switch { position: relative; width: 40px; height: 60px; display: inline-block; }
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.switch-body {
    position: absolute; top: 0; left: 0; right: 0; bottom: 0;
    background: #222; border: 2px solid #000;
}
.switch-handle {
    position: absolute; top: 5px; left: 5px; width: 26px; height: 20px;
    background: #999;
    border: 2px solid #fff; border-right-color: #555; border-bottom-color: #555;
    transition: 0s;
}
input:checked + .switch-body .switch-handle { top: 30px; background: #666; }

.led-indicator {
    width: 10px; height: 10px; background: var(--led-off);
    border: 2px solid #000; margin-top: 8px;
    border-radius: 0;
}
.led-on { background: var(--led-on); }

.knob-row { display: flex; gap: 8px; }
.tact-btn {
    background: #ccc; border: 2px solid #000; padding: 0;
    width: 36px; height: 36px; border-radius: 0;
    box-shadow: 4px 4px 0 #000;
    display: flex; align-items: center; justify-content: center;
    cursor: none;
    transition: transform 0.1s, box-shadow 0.1s;
}
.tact-btn:hover { transform: translate(2px, 2px); box-shadow: 2px 2px 0 #000; }
.tact-btn:active { transform: translate(4px, 4px); box-shadow: none; }
.btn-cap {
    width: 100%; height: 100%; background: transparent; 
    font-size: 14px; font-weight: bold; color: #000;
    display: flex; align-items: center; justify-content: center;
    box-shadow: inset 2px 2px 0 #fff, inset -2px -2px 0 #888;
}
.red-cap { background: rgb(255, 0, 0); color: #fff; box-shadow: inset 2px 2px 0 #f88, inset -2px -2px 0 #800; }

.datasheet-body {
    padding: 30px; margin-top: 10px;
    border: 4px solid var(--text-primary);
    background: var(--paper-bg);
    box-shadow: var(--shadow-hard);
}

.datasheet-header {
    border-bottom: 4px solid var(--text-primary);
    padding-bottom: 20px; margin-bottom: 30px;
    display: flex; justify-content: space-between; align-items: center;
}
h1 { font-size: 28px; margin: 0; text-transform: uppercase; }
.doc-id { font-size: 14px; background: var(--text-primary); color: var(--paper-bg); padding: 2px 5px; }

.ic-package-container {
    display: flex; flex-direction: column; align-items: center;
    text-decoration: none; cursor: none; margin-right: 20px;
}
.ic-package-container:hover { transform: translateY(-4px); }

.ic-pins {
    width: 90%; height: 6px; background: #ccc;
    background-image: repeating-linear-gradient(
        90deg,
        transparent 0px, transparent 4px,
        #000 4px, #000 6px,
        transparent 6px, transparent 10px
    );
    z-index: 0;
}
.ic-pins.top { border-top: 2px solid #000; }
.ic-pins.bottom { border-bottom: 2px solid #000; }

.ic-body {
    position: relative; width: 140px; height: 50px;
    background: #222;
    border: 2px solid #000;
    display: flex; align-items: center; justify-content: center; z-index: 10;
}

.ic-notch {
    position: absolute; left: -2px; top: 50%; transform: translateY(-50%);
    width: 8px; height: 16px;
    background: var(--paper-bg); border: 2px solid #000; border-left: none;
}
.ic-pin-1-dot {
    position: absolute; bottom: 5px; left: 8px; width: 4px; height: 4px;
    background: #555; border-radius: 0;
}

.ic-text {
    display: flex; flex-direction: column; align-items: center;
    font-family: 'VT323', monospace; color: #fff;
}
.ic-text .brand { font-size: 10px; opacity: 0.5; }
.ic-text .model { font-size: 18px; color: #fff; }

.ic-package-container:hover .model { color: var(--accent); }

.section-title { 
    border-bottom: 4px dotted var(--text-primary); 
    margin-bottom: 15px; display: flex; align-items: baseline; gap: 10px;
}
.sec-num { font-size: 24px; background: var(--accent); color: #fff; padding: 0 5px;}

.technical-text { font-size: 18px; line-height: 1.4; }

.pinout-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; }
.pin-item {
    border: 2px solid var(--text-primary); padding: 5px; font-size: 16px;
    display: flex; align-items: center; gap: 10px;
    box-shadow: 4px 4px 0 rgba(0,0,0,0.2);
}
.pin-num { background: var(--text-primary); color: var(--paper-bg); width: 20px; height: 20px; text-align: center; line-height: 20px; }

.schematic-block {
    border-left: 4px solid var(--accent); padding-left: 15px; margin-bottom: 30px;
}
.param { font-size: 16px; color: var(--accent); margin: 5px 0; background: rgba(0,0,0,0.05); display: inline-block; padding: 0 5px; }

.clamped-text {
    text-align: justify;
    text-justify: inter-word;
    font-family: 'VT323', monospace;
    font-size: 18px;
    line-height: 1.4;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.clamped-text.expanded {
    -webkit-line-clamp: unset !important;
    display: block !important;
    overflow: visible !important;
}

.toggle-link {
    background: var(--text-primary);
    border: none;
    color: var(--paper-bg);
    font-family: 'VT323', monospace;
    font-size: 16px;
    cursor: none;
    padding: 2px 6px;
    margin-top: 10px;
    display: inline-block;
    box-shadow: 2px 2px 0 var(--accent);
}
.toggle-link:hover { transform: translate(2px, 2px); box-shadow: none; }

#cursor-probe {
    position: fixed; width: 0; height: 0;
    border-left: 4px solid transparent; border-right: 4px solid transparent; border-bottom: 20px solid #b82424;
    transform: rotate(-30deg); transform-origin: bottom center;
    pointer-events: none; z-index: 999999;
    filter: none;
}
#cursor-probe::after {
    content: ''; position: absolute; bottom: -30px; left: -2px; width: 4px; height: 10px; background: #ccc;
    z-index: 999999;
}

@media (max-width: 600px) {
    body {
        transform: scale(0.80);
        transform-origin: top center;
    }

    .main-rack {
        width: 100%;
        overflow-x: hidden;
    }

    .instrument-panel,
    .datasheet-body {
        padding-left: 0 !important;
        padding-right: 0 !important;
    }

    .instrument-panel {
        flex-wrap: wrap;
        justify-content: center;
    }

    h1, p, .technical-text, .clamped-text {
        word-break: break-word;
    }

    .ic-package-container {
        transform: scale(0.8);
        transform-origin: center;
    }

    .toggle-link {
        font-size: 14px;
    }

    #cursor-probe {
        display: none !important;
    }
}

/* Soft PCB-trace background effect */
.datasheet-body {
    background-image:
        linear-gradient(90deg, rgba(0, 255, 0, 0.05) 1px, transparent 1px),
        linear-gradient(rgba(0, 255, 0, 0.05) 1px, transparent 1px);
    background-size: 24px 24px;
}

/* Section titles: add a tiny electronic symbol */
.section-title::before {
    content: "⏚ ";   /* Ground symbol */
    color: var(--accent);
    font-size: 20px;
}

/* Electronics-style divider */
.section-title {
    border-bottom: 4px dashed var(--text-primary);
}

/* PCB pad dots on left side */
.schematic-block {
    position: relative;
}
.schematic-block::before {
    content: "";
    position: absolute;
    left: -12px;
    top: 8px;
    width: 6px;
    height: 6px;
    background: var(--accent);
}

/* Subtle glow around active parts */
h4, .param, .toggle-link {
    text-shadow: 0 0 4px rgba(0,255,0,0.2);
}

/* LED-style indicator dot on links */
.toggle-link::after {
    content: " •";
    color: var(--accent);
}

/* Slight oscilloscope grid under project items */
.schematic-block {
    background-image:
        linear-gradient(rgba(0,255,0,0.07) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0,255,0,0.07) 1px, transparent 1px);
    background-size: 18px 18px;
}
body.project-page * {
    cursor: none !important;
    
}
body.project-page .main-rack {
    max-width: 1200px !important;
    margin: 0 auto;
    width: 100%;
}
/* Professional Pixel Electronics Footer */

.social-links {
    display: flex;
    justify-content: center;
    gap: 25px;
    margin-bottom: 20px;
}

.social-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    text-decoration: none;
    border: 2px solid var(--text-primary);
    background: var(--paper-bg);
    color: var(--text-primary);
    font-family: 'VT323', monospace;
    box-shadow: 3px 3px 0 var(--accent);
    transition: 0s;
}

.social-item:hover {
    transform: translate(2px, 2px);
    box-shadow: none;
}

.social-icon {
    width: 20px;
    height: 20px;
    image-rendering: pixelated;
}
/* CONTACT FORM */

.contact-form {
    max-width: 600px;
    margin: 0 auto;
    padding: 20px 0;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.contact-row {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.contact-label {
    font-family: 'VT323', monospace;
    font-size: 20px;
    color: var(--text-primary);
    letter-spacing: 2px;
}

.contact-input,
.contact-textarea {
    background: var(--paper-bg);
    border: 2px solid var(--text-primary);
    width: 100%;
    padding: 10px;
    font-family: 'VT323', monospace;
    font-size: 18px;
    color: var(--text-primary);
    box-shadow: 3px 3px 0 var(--accent);
}

.contact-input:focus,
.contact-textarea:focus {
    outline: none;
    box-shadow: 3px 3px 10px var(--accent) inset;
}

.contact-textarea {
    height: 140px;
    resize: vertical;
}

.contact-btn {
    width: 100%;
    padding: 12px;
    background: var(--text-primary);
    color: var(--paper-bg);
    font-family: 'VT323', monospace;
    font-size: 22px;
    border: none;
    cursor: none;
    box-shadow: 3px 3px 0 var(--accent);
}

.contact-btn:hover {
    transform: translate(2px, 2px);
    box-shadow: none;
}
