@font-face {
    font-family: "IBMPlex";
    src: url("/icons/IBMPlexSans-Regular.ttf") format("truetype");
    font-weight: normal;
    font-style: normal;
}

@font-face {
    font-family: "IBMMono";
    src: url("/icons/IBMPlexMono-Regular.ttf") format("truetype");
    font-weight: normal;
    font-style: normal;
}

:root {
    /* Sidebar width */
    --sidebar: 350px;
    /* Solarized Light palette */
    --solar-bg: #fdf6e3;
    --solar-bg: #f0f0f0;
    --solar-base: #657b83;
    --solar-border: #93a1a1;
    --solar-glow: rgba(101, 123, 131, 0.3);
    --solar-glow-strong: rgba(101, 123, 131, 0.5);
    font-family: "IBMMono", serif, system-ui, sans-serif;
}

/* Layout grid: header + workspace */
body {
    margin: 0;
    font-family: "IBMMono", serif, system-ui, sans-serif;
    height: 100vh;
    display: grid;
    grid-template-rows: auto 1fr;
    overflow: hidden;
}

/* Sticky header */
header {
    position: sticky;
    top: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1.5rem;
    backdrop-filter: blur(8px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

/* Header controls spacing */
header > * {
    margin: 0 0.5rem;
}

/* Editor & preview area */
#workspace {
    display: grid;
    height: 100%;
    overflow: hidden;
    background-color: #fafafa;
}
#workspace.vertical {
    grid-template-columns: var(--sidebar) 1fr;
}
#workspace.horizontal {
    grid-template-rows: var(--sidebar) 1fr;
}

/* Editor panes */
#editors.vertical {
    display: grid;
    grid-template-rows: repeat(3, 1fr);
    height: 100%;
}
#editors.horizontal {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    height: 100%;
}

/* Pane styling */
#editors .pane {
    /*display: flex;
    flex-direction: column;*/
    min-width: 0;
    min-height: 0;
    border: 1px solid #333;
    overflow: hidden;
}
.pane h3 {
    margin: 0;
    padding: 0.25rem 0.5rem;
    font-size: 0.9rem;
    line-height: 1.4;
    color: #bbb;
    background: #2a2a2a;
}

.pane #h-html {
    color: #eee;
    background: hotpink;
}

.pane #h-css {
    color: #eee;
    background: rgba(58, 143, 255, 0.7);
}

.pane #h-js {
    color: #eee;
    background: #ffac1c;
}
.cm-editor {
    font-size: 0.85rem;
    /*height: 100%;
    width: 100%;
    overflow: auto;*/
}

/* Hide JS pane when toggled */
#editors.hide-js .js-pane {
    display: none !important;
}
#editors.hide-js.vertical {
    grid-template-rows: repeat(2, 1fr) !important;
}
#editors.hide-js.horizontal {
    grid-template-columns: 1fr 1fr !important;
}

/* Preview iframe */
iframe {
    width: 100%;
    height: 100%;
    border: none;
    background: #fff;
}

/* Common control styling */
select,
button,
label.upload-btn {
    font-family: "IBMMono", system-ui, sans-serif;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
    cursor: pointer;
    box-shadow:
        0 4px 10px rgba(0, 0, 0, 0.3),
        0 0 8px rgba(58, 143, 255, 0.7);
    transition:
        background 150ms,
        box-shadow 150ms,
        transform 100ms;
}

#link {
    position: relative;
    display: inline-block; /* give it a real box */
    color: inherit;
}

#link::before {
    content: ""; /* or content: ""; if you don’t need to repeat the text */
    position: absolute;
    left: -0.25em;
    top: 0.1em;

    /* highlight color */
    background-color: #ff6db7;

    /* make sure it covers your text height */
    height: 1em;
    width: calc(100%);

    z-index: -1;
}

#zipInput {
    display: none;
}
/* Icon-only controls */
button.icon-only,
label.upload-btn.icon-only {
    width: 2.5rem;
    padding: 0;
    justify-content: center;
}

/* Modal overlay and hide logic */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    justify-content: center;
    align-items: center;
    z-index: 1000;
}
.modal:not(.hidden) {
    display: flex;
}
.modal-content {
    background: var(--solar-bg);
    padding: 1rem;
    border-radius: 6px;
    width: 90%;
    max-width: 400px;
}
.modal-content ul {
    list-style: none;
    padding: 0;
    max-height: 300px;
    overflow-y: auto;
}
.modal-content li {
    display: flex;
    justify-content: space-between;
    margin: 0.5rem 0;
}
.modal-content button {
    margin-left: 0.5rem;
}
body.light-theme header {
    background: var(--solar-bg);
    box-shadow: 0 1px 3px var(--solar-glow);
    border-bottom: 1px solid var(--solar-border);
}
body.light-theme header select,
body.light-theme header button,
.modal-content button,
.modal-content label,
body.light-theme header label.upload-btn {
    background: #f0f0f0;
    color: var(--solar-base);
    border: 1px solid var(--solar-border);
    box-shadow:
        0 1px 3px var(--solar-glow),
        0 0 6px var(--solar-glow);
}
body.light-theme header select:hover,
body.light-theme header button:hover,
.modal-content button:hover,
.modal-content label:hover,
body.light-theme header label.upload-btn:hover {
    background: rgba(200, 0, 100, 0.3);
    color: #fff;
    box-shadow:
        0 2px 6px var(--solar-glow-strong),
        0 0 8px var(--solar-glow-strong);
    transform: translateY(-1px);
}
body.light-theme header select:active,
body.light-theme header button:active,
.modal-content button:active,
body.light-theme header label.upload-btn:active {
    box-shadow: inset 0 1px 2px var(--solar-glow-strong);
    transform: translateY(0);
}
/* keep it square & centered */
button.icon-only {
    width: 2.5rem;
    height: 2.5rem;
    padding: 0;
}
button.icon-only img {
    width: 1.2rem;
    height: 1.2rem;
}

/* ------------------------------------------ */
/* 1) Let grid & flex items actually shrink: */
/* ------------------------------------------ */
#editors,
#editors .pane,
.pane > div,           /* your #editor-html / #editor-css / #editor-js mount nodes */
.pane .cm-editor {
    /* CodeMirror root */
    min-height: 0;
}

/* ------------------------------------------ */
/* 2) Make the pane a clipped flex-column:    */
/* ------------------------------------------ */
.pane {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

/* ---------------------------------------------------- */
/* 3) Let the mount node flex and hand overflow inside */
/* ---------------------------------------------------- */
.pane > div {
    flex: 1 1 0; /* zero flex-basis so it won’t start “as tall as its content” */
    display: flex; /* establish a flex container for CM6 */
    flex-direction: column;
}

/* ------------------------------------------------------------------- */
/* 4) The real scroll host inside CM6 (and fallback for CM5) does the */
/*    scrolling — nothing else will grow the layout.                 */
/* ------------------------------------------------------------------- */
.pane .cm-editor .cm-scroller,
.pane .CodeMirror-scroll {
    flex: 1 1 auto;
    overflow: auto;
}
