/* ==========================================================================
   Handwriting Personality - front-end replica
   Base reset + theme variables (derived from R74n stylesheet.css)
   ========================================================================== */

html, body, div, span, h1, h2, h3, p, img, button, canvas, small, em, a {
    margin: 0;
    padding: 0;
    border: 0;
    font-size: 100%;
    font: inherit;
    vertical-align: baseline;
}
body { line-height: 1; }
img { display: inline-block; }
button { background: none; }
em { font-style: italic; }

:root {
    --t-back: rgb(0, 0, 0);
    --t-text: rgb(255, 255, 255);
    --t-brand: rgb(0, 255, 255);
    --t-brand-l: rgba(0, 255, 255, 0.75);
    --t-brand-d: rgba(0, 255, 255, 0.5);
    --t-link: rgb(255, 90, 255);
    --t-link-h: rgb(255, 130, 255);
    --t-link-a: rgb(255, 179, 255);
    --t-input: rgb(59, 59, 59);
    --t-border-l: rgba(255, 255, 255, 0.4);
    --t-border-d: rgba(255, 255, 255, 0.25);
}

@font-face {
    font-family: 'VT323';
    src: url('assets/fonts/VT323-Regular.ttf') format('truetype');
    font-feature-settings: "liga" 0;
}

html, body {
    background-color: var(--t-back);
    color-scheme: dark;
}
body {
    color: var(--t-text);
    font-family: 'VT323', 'Courier New', Courier, monospace;
    font-size: 35px;
    font-variant-ligatures: none;
    word-wrap: break-word;
}

*:focus { outline: none; }
*:focus-visible { outline: 2px dashed var(--t-brand) !important; }

a { color: var(--t-link); text-decoration: none; cursor: pointer; }
a:hover { color: var(--t-link-h); }
a:active { color: var(--t-link-a); }

::selection { background: var(--t-brand); color: #000; }

/* ==========================================================================
   Header
   ========================================================================== */

header {
    display: flex;
    align-items: center;
    padding-top: 0.5em;
    padding-bottom: 0.5em;
    border-bottom: solid 3px var(--t-border-l);
    transition: 0.2s padding-top, 0.2s padding-bottom;
    flex-shrink: 0;
}
header > * { margin-left: 22px; flex-grow: 1; }
header > *:first-child { flex-shrink: 0; flex-grow: 0; }
header > *:last-child { margin-right: 22px; flex-grow: 0; }

header.min { padding-top: 0.1em; padding-bottom: 0.1em; }
header.min * { font-size: 30px !important; }

header .home {
    font-size: 32pt;
    width: 1.4em;
    height: 1.4em;
    color: transparent;
    background-image: url("assets/images/doodle/home.png");
    background-size: contain;
    background-repeat: no-repeat;
    flex-grow: 0;
}
header .pagetitle {
    display: inline-block;
    margin-left: 0.5em;
    font-size: 32pt;
    font-weight: bold;
}
header > img[role="button"] { width: 42px; height: 42px; flex-grow: 0; }

.doodle {
    filter: drop-shadow(0px 0px 5px #222);
}
img[role="button"] {
    cursor: pointer;
    transition: 0.2s scale;
    user-select: none;
    -webkit-user-drag: none;
}
img[role="button"]:hover { scale: 1.2; }
img[role="button"]:active { scale: 1.1; }

/* ==========================================================================
   SPA layout
   ========================================================================== */

.spa {
    display: flex;
    flex-direction: column;
    height: 100vh;
    height: 100svh;
    overflow: hidden;
}
.spa > .content {
    flex-grow: 1;
    overflow-y: scroll;
    overflow-x: hidden;
    margin: 0;
    scroll-behavior: smooth;
    scrollbar-width: none;
    -ms-overflow-style: none;
}
.spa > .content::-webkit-scrollbar { width: 0; height: 0; display: none; }

.spa .page {
    height: 100%;
    width: 100%;
    position: relative;
}
.spa .page > div {
    position: absolute;
    top: 45%;
    left: 50%;
    translate: -50% -50%;
    display: inline-block;
    max-height: 85%;
    max-width: 1000px;
    margin-left: auto;
    margin-right: auto;
}
.spa .page.centered { text-align: center; }
.spa .page.centered > div { width: 90%; }

.spa .page .subtitle {
    font-size: 0.8em;
    opacity: 0.8;
    font-style: italic;
}
.spa .page .pop {
    margin-top: 0.25em;
    margin-bottom: 0.25em;
    font-size: 1.5em;
}
.spa .page .promo {
    font-size: 0.6em;
    opacity: 0.9;
    margin-top: 0.7em;
}
.spa .page .promo button {
    padding: 0.6em 0.3em;
}

/* pages navigation mode */
.spa.paths .page { display: none; }
.spa.paths .page[data-current="true"] { display: block; }

/* ==========================================================================
   Page-level option grid (from the page's own <style>)
   ========================================================================== */

.page .pop {
    padding-top: 0.5em;
    width: 100%;
}
.page .pop > img {
    image-rendering: pixelated;
    image-rendering: -moz-crisp-edges;
    image-rendering: crisp-edges;
    width: 1.5em;
    height: 1.5em;
    cursor: pointer;
    padding: 10px;
    transition: 0.2s scale;
    user-select: none;
    -webkit-user-drag: none;
}
.page .pop > img:hover { scale: 1.2; }
.page .pop > img:active { scale: 0.9; }

.page img[data-selected="true"] {
    border: solid 3px var(--t-brand-d);
    scale: 1.2;
    padding: 10px;
}

.page canvas {
    margin-top: 1em;
    max-width: 500px;
    width: 100%;
    image-rendering: pixelated;
}

/* ==========================================================================
   Controls (arrows)
   ========================================================================== */

.spa .controls img {
    height: 65px;
    width: 65px;
    cursor: pointer;
    -webkit-user-drag: none;
    user-drag: none;
    transition: all 0.2s;
    padding: 20px;
    image-rendering: pixelated;
    z-index: 1000;
}
.spa .controls img:hover { scale: 1.5; }
.spa .controls img:active { scale: 1.1; }

.spa .page .controls {
    position: absolute;
    top: unset;
    bottom: 10px;
    translate: -50% 0%;
    left: 50%;
}

.spa .content > .controls img { position: absolute; }
.spa .content > .controls .left { left: 0%; top: 50%; translate: 0% -50%; }
.spa .content > .controls .right { right: 0%; top: 50%; translate: 0% -50%; }
.spa .content > .controls .up { left: 50%; top: 10%; translate: -50% 0%; }
.spa .content > .controls .down { left: 50%; bottom: 0%; translate: -50% 0%; }
.spa .content > .controls .mobile { display: none; }
.spa .content > .controls .hidden { display: none; }

.spa img { touch-action: manipulation; -webkit-touch-callout: none; }

@media only screen and (max-width: 800px) {
    .spa .content > .controls img { display: none; }
    .spa .content > .controls .mobile { display: block; }
    .spa .page .pop { margin-bottom: 0; padding-top: 0; font-size: 1.3em; }
    .spa .page .title { font-size: 0.9em; }
    .spa .page .justify { text-align: justify; }
    .spa .controls img { height: 55px; width: 55px; }
}

/* ==========================================================================
   Global dialog
   ========================================================================== */

.globalDialog {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.75);
    text-align: center;
    backdrop-filter: blur(10px);
    z-index: 9999;
    display: none;
    align-items: center;
    flex-direction: column;
    font-family: 'VT323', 'Courier New', Courier, monospace;
    font-variant-ligatures: no-common-ligatures;
    font-size: 35px;
    text-shadow: 0 0 10px black, 0 0 10px black, 0 0 10px black;
    color: var(--t-text);
}
.globalDialog.open { display: flex; }
.globalDialog > div {
    flex-direction: column;
    display: flex;
    width: 50%;
    flex-grow: 1;
    overflow-y: scroll;
    margin: auto;
    justify-content: space-around;
    scrollbar-width: none;
}
.globalDialog > div > div {
    flex-direction: row;
    display: flex;
    padding: 0.5em;
    flex-wrap: wrap;
    justify-content: space-between;
    flex-grow: 1;
}
.globalDialog > div > div:first-child { padding-top: 0.1em; }
.globalDialog .doodle { width: unset; height: 1.5em; }
.globalDialog > div > div > div {
    display: flex;
    flex-direction: column;
    width: 100%;
}
.globalDialog > div > div > div > * { margin-bottom: 1em; }
.globalDialogTitle { flex-grow: 1; text-align: left; }
.globalDialog .doodle.x { filter: drop-shadow(0px 0px 6px black); }

@media only screen and (max-width: 900px) {
    .globalDialog > div { width: 90%; }
}

/* ==========================================================================
   Buttons
   ========================================================================== */

button {
    color: var(--t-text);
    background-color: var(--t-input);
    border: solid 3px var(--t-border-l);
    border-right-color: var(--t-border-d);
    border-bottom-color: var(--t-border-d);
    border-radius: 0;
    cursor: pointer;
    font-family: inherit;
    font-size: 20px;
    padding: 10px 0.5em;
    margin: 4px 0;
    transition: filter 0.2s, scale 0.2s;
}
button:hover { filter: brightness(125%); }
button:active { filter: brightness(50%); scale: 0.98; }
