/* Dark mode DIP switch */

/* PCB silkscreen wrapper */
.dip-silkscreen {
    position: relative;
    display: inline-flex;
    flex-direction: column;
    gap: 0.35em;
    font-size: 0.65em;
    letter-spacing: 0.12em;
    color: #eaeaea;
    border: 0.08em solid #fff;
    padding: 0.6em 0.6em 0.6em 1.2em;
}

/* Silkscreen alignment notch */
.dip-silkscreen::before {
    content: "";
    position: absolute;
    left: -1.2em;
    top: 50%;
    transform: translateY(-50%);
    width: 2em;
    height: 2em;
    background: var(--bg-image, transparent);
    border-radius: 50%;
}

.dip-silkscreen::after {
    content: "";
    position: absolute;
    left: -1.2em;
    top: 50%;
    transform: translateY(-50%);
    width: 2em;
    height: 2em;
    border: 1px solid #fff;
    border-left: none;
    border-top: none;
    border-bottom: none;
    border-radius: 50%;
    z-index: 3;
}

/* DIP switch container (PCB area) */
.dip-panel {
    display: inline-block;
    padding: 0.7em 0.9em;
    background-color: #9b111e;
    border: 0.15em solid #000;
    box-shadow: inset -0.15em -0.15em 0 #444;
    font-family: "Courier New", monospace;
    color: #fff;
    transition: background-color 0.2s ease;
}

.dip-silk-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    white-space: nowrap;
}

/* Board ID */
.dip-silk-id {
    font-weight: bold;
}

/* Functional label */
.dip-silk-label {
    font-size: 0.9em;
    opacity: 0.9;
}

/*dark mode color-switch for DIP switch, disabled for now*/
/* .dip-panel.dark-board {
               background-color: #1e1e1e;
           } */

/* Titles */
.dip-title {
    font-size: 1em;
    margin-bottom: 0.4em;
    letter-spacing: 0.15em;
}

.dip-text {
    display: flex;
    justify-content: space-between;
}

.dip-on {
    position: relative;
    font-size: 0.75em;
    margin-bottom: 0.3em;
    padding-left: 0.9em;
}

.dip-dip {
    font-size: 0.75em;
    margin-bottom: 0.3em;
}

.dip-row {
    position: relative;
    display: flex;
    gap: 0.6em;
}

/* Orientation dot */
.dip-row::before {
    content: "";
    position: absolute;
    left: -0.65em;
    top: 0.35em;
    width: 0.4em;
    height: 0.4em;
    background-color: #ffffff;
    border-radius: 50%;
    z-index: 2;
    box-shadow: inset -0.05em -0.05em 0 #444;
}

/* Individual DIP body */
.dip-switch {
    position: relative;
    width: 1.4em;
    height: 2.8em;
    background-color: #2a2a2a;
    border: 0.08em solid #000;
}

/* Hidden checkbox */
.dip-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

/* Slider tab */
.dip-tab {
    position: absolute;
    left: 0.15em;
    width: 1.1em;
    height: 1.1em;
    background-color: #eaeaea;
    border: 0.08em solid #000;
    transition: top 0.15s steps(1);
}

/* OFF position */
.dip-tab {
    top: 1.35em;
}

/* ON position */
.dip-switch input:checked+.dip-tab {
    top: 0.15em;
}

/* Switch number */
.dip-num {
    font-size: 0.65em;
    text-align: center;
    margin-top: 0.3em;
}


/* Monochrome =============================================== /green-phosphor video mode */
body.video-mono #mono-filter {
    filter:
        grayscale(100%) sepia(100%) hue-rotate(90deg) saturate(160%) brightness(0.95);
}

body {
    position: relative;
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: -1;
    background-repeat: repeat;
    background-size: auto;
    pointer-events: none;
    background-image: var(--bg-image);
}

body.video-mono::before {
    opacity: 1.0;
    filter:
        grayscale(100%) sepia(80%) hue-rotate(90deg) saturate(130%);
}

/* Terminal ================================================== / ROM font mode */
body.font-mono * {
    font-family: "Courier New", Courier, monospace;
    font-variant-ligatures: none;
    font-feature-settings: "liga" 0, "clig" 0;
}

#crt-layer {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 9999;
    display: none;
}

body.video-scanlines #crt-layer {
    display: block;
    animation: vhold 6s steps(1) infinite;
}

@keyframes vhold {

    0%,
    98% {
        transform: translateY(0);
    }

    99% {
        transform: translateY(0.5px);
    }
}

body.video-scanlines img,
body.video-scanlines canvas {
    image-rendering: pixelated;
    image-rendering: crisp-edges;
}

#crt-layer::after {
    content: "";
    position: absolute;
    inset: 0;

    background:
        repeating-linear-gradient(to bottom,
            rgba(0, 0, 0, 0.25) 0px,
            rgba(0, 0, 0, 0.25) 1px,
            rgba(0, 0, 0, 0.0) 2px,
            rgba(0, 0, 0, 0.0) 4px);

    mix-blend-mode: multiply;
}

/*Reset ====================================================== / DIP block*/
/* Momentary reset switch */
.dip-momentary .dip-tab {
    top: 1.35em;
    /* OFF position */
    transition: top 0.18s cubic-bezier(0.2, 0.6, 0.4, 1);
}

.dip-momentary.active .dip-tab {
    top: 0.15em;
    /* ON position */
}