/**
* Copyright (c) 2025 notepadjs.com
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to use, copy, modify, merge, publish, distribute, and/or sublicense
* the **Software**, subject to the following conditions:
*
* 1. The **Software** may be distributed at no cost. If the recipient
*    wishes to make a monetary contribution, a voluntary donation to
*    [author](mailto:admin@aconfa.net) is appreciated but not required.
*
* 2. The **Software** is provided "as is", without warranty of any kind,
*    express or implied, including but not limited to the warranties of
*    merchantability, fitness for a particular purpose and non‑infringement.
*    In no event shall the authors or copyright holders be liable for any
*    claim, damages or other liability, whether in an action of contract,
*    tort or otherwise, arising from, out of or in connection with the
*    **Software** or the use or other dealings in the **Software**.
*/

/* aconfa.net X notepadjs.com modernized, variable-driven edition */

/* variables */

:root {
    --font-primary: "Playfair", serif;
    --font-mono: monospace;
    --anim-blur-duration: 3.5s;
    --anim-blur-ease: ease-out;
    --blur-start: 3.0px;
    --blur-end: 0;
    --opacity-start: 0.0;
    --opacity-end: 1;
    --padding-default: 1rem;
    --padding-editor: 2rem;
    --padding-titlebar-y: 0.5rem;
    --padding-titlebar-x: 1rem;
    --margin-default: 2rem;
    --margin-small: 1rem;
    --radius-default: 0.5rem;
    --shadow-inset: rgba(0,0,0,0.1) 0 2px 5px inset;
    --shadow-float: 0 0px 10px rgba(0,0,0,0.1);
    --opacity-container: 0.95;
    --opacity-float: 0.9;
    /* --overlay-width: 50%; */
    /* --overlay-height: 20%; */
    /* --overlay-top: 550px; */
    --float-top: 10%;
    --float-left: 10%;
    --float-width: 50%;
    --float-height: 50%;
    --divider-width: 5px;
    --divider-bg: transparent;
    --spoiler-transition: 0.25s ease;
    --fullscreen-bg: transparent;
    --pre-padding: 0.5rem;
    --pre-background: #000;
    --pre-color: white;
    --pre-radius: 5px;
    --pre-shadow: -1px 0 5px rgba(0,0,0,0.1);
    --pre-max-height: 100%;
    --pre-overflow-x: hidden;
}

/* user animations

* {transition: 0.05s;} */

/* user animations

* {
    animation: blurIn var(--anim-blur-duration) var(--anim-blur-ease) forwards;
} */

.fade\.in, .fadein {
    animation: blurIn var(--anim-blur-duration) var(--anim-blur-ease) forwards;
}

@keyframes blurIn {
    from { opacity: var(--opacity-start); filter: blur(var(--blur-start)); }
    to { opacity: var(--opacity-end); filter: blur(var(--blur-end)); }
}

/* 
.streaming {
    pointer-events: none;
    filter: blur(var(--blur-start));
    cursor: wait; 
} 
*/
/* Layout section */

#preview-box {
    overflow-y: auto;
}

html, body {
    font-family: var(--font-primary);
    user-select: none;
    margin: 0;
    box-sizing: border-box !important;
    height: 100%;
    overflow: hidden;
}

#editor-container {
    transition-delay: 0.05s;
    display: flex;
    flex-direction: row;
    width: 100%;
    height: 100%;
}

.editor-box {
    flex: 1;
    width: 100%;
    overflow: hidden;
}

/* epic full-height (!) */

.full-height {
    width: 100%;
    min-height: 100%;
    box-sizing: border-box;
    resize: none;
    overflow-wrap: break-word;
}

#editor, #preview, #topics, #index {
    flex: 1;
    padding: var(--padding-default);
    overflow-y: auto;
    border-radius: 1px;
}

#editor:focus, #editor-float {
    border: none;
    outline: none;
}

#editor.disabled {
    cursor: wait;
}

/* default details */

.container {
    border-radius: var(--radius-default);
    opacity: var(--opacity-container);
    transition: 0.1s ease;
    padding: 2.0rem;
    margin: var(--margin-default);
}

.container:hover {
    opacity: 1;
    transition: 0.2s ease;
}

@media (max-width: 400px) {
    .container {
        padding: var(--padding-default);
        margin: var(--margin-small);
    }
}

img {
    max-width: 100% !important;
    border-radius: var(--radius-default);
}

pre {
    background: var(--pre-background);
    color: var(--pre-color);
    padding: var(--pre-padding);
    border-radius: var(--pre-radius);
    box-shadow: var(--pre-shadow);
    white-space: pre-wrap;
    overflow-x: var(--pre-overflow-x);
    max-width: 100%;
    outline: none;
}

pre code {
    white-space: pre-wrap !important;
    overflow-x: var(--pre-overflow-x);
    outline: none;
}

p {
    white-space: pre-wrap;
}

p:before {
    width: 1rem;
    content: '';
    display: inline-block;
}

textarea#editor {
    border: medium;
    box-shadow: var(--shadow-inset);
    padding-left: var(--padding-editor);
}

/* selection handler */

*::selection, *::-moz-selection {
    color: #000;
    background: rgba(175,238,238,0.8);
}

pre code::selection, pre code::-moz-selection {
    color: #000;
    background: #b3d4fc
}

/* aconfa.net */

a { color: cornflowerblue; }

a:visited { color: royalblue; }

/* notepadjs.com X aconfa.net */

pre.spoiler {
    overflow: hidden;
    transition: var(--spoiler-transition);
}

pre.spoiler.hidden { max-height: 1.05rem; }

pre.spoiler .spoiler-header {
    font-size: 95%;
    cursor: pointer;
    margin: -0.45rem;
    user-select: none;
    padding: 0.7rem 1rem;
}

#preview:fullscreen,
#topics:fullscreen,
#index:fullscreen {
    background: var(--fullscreen-bg);
}

@media (max-width: 1280px) {

    textarea#editor { 
        padding-left: 1rem; 
    }

}

/* divider */

#divider {
    flex: 0 0 auto;
    position: relative;
}

#handle {
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    cursor: grab;
    z-index: 9999;
    user-select: none;
    position: absolute;
    filter: blur(0.00rem);
    box-shadow: var(--shadow-float);
    background: rgba(255, 255, 255, 0.5);
}

/* showNotify */

#notify {
    transition-duration: 0.05s;
    overflow-y: hidden;
    line-height: 1.6em;
    position: fixed;
    right: 10%;
    bottom: 20%;
    display: flex;
    align-items: flex-start;
    gap: 0.4rem;
    border-radius: 2rem;
    padding: 2rem;
    pointer-events: none;
    background: rgba(255,255,255,.15);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
    font-family: -apple-system, sans-serif;
    box-shadow: 0 .1rem .3rem rgba(255,255,255,.1), 0 .1rem .3rem rgba(0,0,0,.1);
    user-select: none;
    z-index: 9999;
    opacity: 0;
    animation: containerFadeIn 400ms ease forwards;
}

@media (max-width:400px) {
    #notify{
        left: 100px;
        bottom: 150px;
        scale: 0.8;
    }
}

#notify .handle {
    transition-duration: 0.55s;
    width: 0.5rem;
    height: 3rem;
    margin-right: 1rem;
    background: transparent;
    border-radius: 0.25rem;
    animation: handleNotify 4s ease-in-out alternate;
}

#notify span {
    overflow-y: hidden;
    color: black;
    user-select: none;
    padding: 0.7rem 0.6rem 0 0;
    display: block;
    max-height: 300px;
    overflow-x: hidden;
    scroll-behavior: smooth;
}

.message {
    display: block;
    margin: 0;
    padding: 0.2rem 0;
    animation: messageSlideIn 100ms ease;
    word-break: keep-all;
    overflow-wrap: normal;
    white-space: nowrap;
    hyphens: none;
}

@keyframes containerFadeIn {
    from {
        opacity: 0.2;
        transform: translateY(0rem);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes containerFadeOut {
    from {
        opacity: 1;
        transform: translateY(0);
    }
    to {
        opacity: 0;
        transform: translateY(0rem);
    }
}

@keyframes messageSlideIn {
    from {
        opacity: 0;
        transform: translateY(0.0rem);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes messageSlideOut {
    0% {
        opacity: 1;
        transform: translateY(0);
        max-height: 1.6em;
    }
    50% {
        opacity: 0.1;
        transform: translateY(-0.0rem);
        max-height: 0;
        padding: 0;
        margin: 0;  
    }
    100% {
        opacity: 0;
        transform: translateY(-0.0rem);
        max-height: 0;
        padding: 0;
        margin: 0;
    }
}

@keyframes handleNotify {
    0% {
        opacity: 0.9;
        filter: brightness(1.05);
        box-shadow: 0 0 .9rem rgba(255,255,0,.0);
    }
    15% {
        opacity: .9;
        filter: brightness(1.1);
        box-shadow: 0 0 .9rem rgba(255,255,0,.0);
    }
    20% {
        opacity: .7;
        filter: brightness(1.25);
        box-shadow: 0 0 .4rem rgba(255,255,0,.5);
        background: #ffd700;
    }
    80% {
        opacity: .7;
        filter: brightness(1.1);
        box-shadow: 0 0 .4rem rgba(255,255,0,.5);
        filter: saturate(1.5);
        background: transparent;
    }
    85% {
        opacity: .9;
        filter: brightness(1.1);
        box-shadow: 0 0 .9rem rgba(255,255,0,.0);
    }
    100% {
        opacity: .9;
        filter: brightness(1.05);
        box-shadow: 0 0 .9rem rgba(255,255,0,.0);
    }
}