@import url('https://fonts.googleapis.com/css2?family=Familjen+Grotesk:ital,wght@0,400..700;1,400..700&display=swap');

/* set Familijen Grotesk */
* {
    font-family: "Familjen Grotesk", sans-serif;
    font-optical-sizing: auto;
    font-weight: normal;
    font-style: normal;
}

:root {
    --app-bg: #f5f7fa;
    --border-colour: #e5e7eb;
    --primary-gradient: ;
    --primary-gradient-start: #667eea;
    --primary-gradient-end: #764ba2;
    --primary: #667eea;
    --secondary: #f3f4f6;
    --text-main: #4b5563;
    --text-secondary: #6b7280;
    --card-pink: #f093fb;
    --card-blue: #4facfe;
    --card-purple: #a78bfa;
    --card-red: #fa709a;
    --card-orange: #fbbf24;
    --card-green: #43e97b;
}

.brandbg {
    background: linear-gradient(135deg, #667eea, #764ba2 100%);
}

button.brandbg {
    border: 0px;
    outline: 0px;
    color: #fff;
    padding: 5px;
    margin-bottom: 5px;
    margin-top: 5px;
    transition: all 0.1s ease-in-out;
}

button.brandbg:hover {
    background: linear-gradient(135deg, #764ba2, #667eea 100%);
}

sep[horizontal] {
    border-bottom: 1px solid var(--border-colour);
    display: block;
    width: calc(100% + 10px);
    margin-left: -5px;
    margin-bottom: 5px;
}


button {
    border-radius: 5px;
}

html,
body {
    margin: 0px;
    padding: 0px;
    height: 100vh;
    max-height: 100vh;
    background-color: var(--app-bg);
    overflow: hidden;
}

body {
    display: grid;
    grid-template-columns: 0.2fr 1fr;
    grid-template-rows: 45px 1fr;
    grid-column-gap: 0px;
    grid-row-gap: 0px;
}

.toolbar .title:not(input) {
    background: linear-gradient(135deg, #667eea, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    font-size: 1.8em;
    background-clip: text;
    font-weight: 1000;
}

section.toolbar {
    /* grid-area: 1 / 1 / 2 / 3; */
    padding: 5px;
    border-bottom: 1px solid var(--border-colour);
}

* {
    font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
}

section.gridpicker>h5 {
    color: var(--text-secondary);
    margin-block-end: 5px;
    margin-block-start: 0px;
}

section.gridpicker {
    grid-area: 2 / 1 / 3 / 2;
    padding: 5px;
    border-right: 1px solid var(--border-colour);
}

section.grid {
    grid-area: 2 / 2 / 3 / 3;
    display: block;
    width: 100%;
    height: 100%;
    max-height: 100%;
    max-width: 100%;
    background-size: 4px 4px;
    background-repeat: round;
    position: relative;
    overflow: auto;
}

section.grid .canvas {
    position: relative;
    min-width: 100%;
    min-height: 100%;
    width: 100%;
    height: 100%;
    /* Keep the dotted background on the visible area */
    background-size: 9px 9px;
    background: linear-gradient(135deg, var(--primary-gradient-start), var(--primary-gradient-end));
}

section.grid .canvas.dragging {
    background: radial-gradient(#000 1px, transparent 1px) center / cover no-repeat, linear-gradient(135deg, var(--primary-gradient-start), var(--primary-gradient-end));
}

/* section.grid .canvas.dragging:after {
    content: '';
    display: block;
    margin: 0;
    height: calc(100% + 75px);
    width: calc(100% + 75px);
    background-color: none;
    background-image: radial-gradient(#000 1px, transparent 1px);
    background-size: 50px 50px;
    left: -75px;
    top: -75px;
    
    position: absolute; 
    
    pointer-events: none;
} */

ul.grids,
ul.grids li {
    all: unset;
    user-select: none;
}

ul.grids li {
    display: block;
    margin-bottom: 5px;
    border-radius: 5px;
}

ul.grids li::before {
    content: var(--icon);
    font-size: 1em;
    /* Example: adjust marker size */
    display: inline-block;
    aspect-ratio: 1 / 1;
    height: 3ch;
    vertical-align: middle;
    text-align: center;
    border-radius: 5px;
    z-index: 99;
    margin: 2px;
    background-color: var(--colour);
}

ul.grids li:hover {
    background-color: var(--border-colour);
}

.gridpicker>button {
    width: 100%;
}

.note {
    min-width: 200px;
    min-height: 200px;
    resize: both;
    background-color: var(--app-bg);
    border: 1px solid var(--border-colour);
    border-radius: 10px;
    overflow: hidden;
    user-select: none;
}

.note .title {
    border-top: var(--card-colour, --primary) 5px solid;
    padding: 10px;
    width: calc(100% - 20px);
    display: flex;
    justify-content: space-between;
}

.note .title div {
    float: right;
    display: flex;
    flex-wrap: nowrap;
}

.note .title span {
    font-weight: bold;
}

.note .title * {
    float: right;
}

.note .title button {
    outline: 0px;
    border: 0px;
    margin: 2px;
}

.note .noteContent {
    padding-left: 10px;
    padding-bottom: 10px;
    padding-right: 10px;
    width: calc(100% - 20px);
    display: block;
}

.note.editing {
    position: sticky;
    top: 5 !important;
    left: 40px !important;
    width: calc(80vw) !important;
    height: calc(80vh) !important;
    z-index: 9999999 !important;
}

.canvas:has(.editing)::after {
    background: rgba(0, 0, 0, 0.5);
    width: 100%;
    height: 100%;
    content: " ";
    display: block;
}

dialog {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    border: 0px;
    border-radius: 10px;
    z-index: 9999999999999999999999;
    overflow: auto;
    overflow-x: hidden;
    /* padding: 0px; */
    display: flex;
    flex-direction: column;
}

body:has(dialog[open])::after {
    background: rgba(0, 0, 0, 0.5);
    width: 100%;
    height: 100%;
    content: " ";
    display: block;
    position: absolute;
    top: 0px;
    left: 0px;
}

dialog .title {
    font-weight: bold;
    font-size: 1.2em;
}

.noteeditor {
    width: 80vw;
    height: 80vh;
}

.noteeditor .meta {
    color: rgba(5, 5, 5, 0.5)
}

.noteeditor>div:not(.titleRow) {
    width: calc(100%) !important;
    height: calc(100% - 20px) !important;
    gap: 2px;
}

.noteeditor>div:not(.titleRow)>div {
    margin-top: 1px;
}

.noteeditor>div:not(.titleRow)>* {
    background-color: var(--border-colour);
    border: 0px;
    border-radius: 5px;
    border-top-left-radius: 3px;
    border-top-right-radius: 3px;
    padding: 10px;
    resize: none;
    overflow: scroll;
    width: calc(100%) !important;
    height: calc(100%) !important;
}

.currentGrid {
    font-weight: bold !important;
}

.fab {
    position: fixed;
    right: 20px;
    bottom: 20px;
    font-size: 2em;
    width: 60px;
    /* fixed width */
    height: 60px;
    /* same height — ensures it's a perfect circle */
    display: flex;
    /* centers the icon/text */
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    /* perfect circle */
    background-color: var(--primary);
    border: 0;
    color: #fff;
    cursor: pointer;
}

input[type=radio][name=gridcolour] {
    width: 50px !important;
    height: 40px !important;
    all: unset;
    background-color: var(--c);
    display: inline-block;
    border: 3px solid white;
    outline: 1px solid gray;
    border-radius: 5px;
    margin: 5px;
}

input[type=radio][name=gridcolour]:checked {
    border: 3px solid var(--primary);
}

input:not([type=radio]) {
    background-color: var(--border-colour);
    border: 0px;
    border-radius: 5px;
    padding: 10px;
}

icon,
.icon {
    padding: 2px;
    background-color: var(--border-colour);
    aspect-ratio: 1/1;
    width: 2.3ch;
    text-align: center;
    vertical-align: middle;
    border-radius: 5px;
    ;
    display: inline-block;
}

.titleRow {
    display: flex;
    width: 100%;
    gap: 1px;
}

.titleRow *:first-child {
    border-bottom-right-radius: 3px;
    border-top-right-radius: 3px;
    border-bottom-left-radius: 3px;
}

.titleRow *:last-child {
    width: 100px;
    border-bottom-right-radius: 3px;
    border-bottom-left-radius: 3px;
    border-top-left-radius: 3px;
    display: inline-block;
}

.titleRow .title {
    width: 100%;
    border-bottom-right-radius: 3px;
    border-bottom-left-radius: 3px;
    border-top-left-radius: 3px;
    border-top-right-radius: 3px;
    display: inline-block;
}

.toolbar .titleRow {
    display: grid;
    grid-template-columns: 38px 1fr 100px;
}

.notemd {
    & pre {
        margin: 0px;
    }

    & code {
        background: rgba(0, 0, 0, 0.5);
        padding: 2px;
        border-radius: 2px;
        font-family: monospace
    }

    & para {
        display: block;
        margin-block-start: 1em;
        margin-block-end: 1em;
        margin-inline-start: 0px;
        margin-inline-end: 0px;
        unicode-bidi: isolate;
    }

    & bi {
        font-weight: bold;
        font-style: italic;
    }

    & pre:has(code)>code,
    & pre:has(code) {
        width: calc(100% - 10px);
        display: block;
    }

    & pre:has(code)>code {
        padding: 10px;
    }

    & pre:has(code) {
        margin-block-start: 10px;
        margin-block-end: 10px;
    }

    & blockquote:before {
        border-left: 5px solid turquoise;
        display: inline-block;
        content: 'a';
        color: transparent;
        width: 5px;
        height: 100%;
        padding-top: 10px;
        padding-bottom: 10px;
        position: relative;
        left: -40px;
    }
}