/****
=====================
  TABLE OF CONTENTS
=====================

    1. GLOBAL VARIABLES IN ROOT, FONT DECLARATIONS
    2. GLOBAL SETTINGS FOR WHOLE DOCUMENT (body, html, scrollbars, universal inline elements)
    3. HEADER, TITLE, & SUBTITLE 
    4. MAIN CONTENT SECTIONS
        4a. Navigation & Buttons
        4c. Prompt Content
    5. OPTIONS
    6. FOOTER
****/

/** ==========================================
      1. Global Variables, Font Declarations
    ========================================== **/
:root {
    font-size: 125%;
    --clr-mainbg: hsl(from lightgray 210 10 l);
    --clr-text: hsl(208, 10%, 20%);
    --clr-optionsbg: hsl(from var(--clr-mainbg) h s calc(l - 10));
    --clr-transgray: hsla(from var(--clr-mainbg) h s l / 0.15);
    --clr-barelygray: hsla(from var(--clr-mainbg) h s l / 0.175);
    --clr-semigray: hsla(from var(--clr-mainbg) h s l / 0.2);
    --clr-darkergray: gray;
    --clr-lightergray: lightgray;
    --clr-unhovers: #002f44;
    --clr-hovers: #2c007e;
}

:root:has(#darkmode:checked) {
    --clr-mainbg: hsl(from lightgray 210 10 25);
    --clr-text: hsl(208, 10%, 70%);
    --clr-optionsbg: hsl(from var(--clr-mainbg) h s calc(l - 10));
    --clr-transgray: hsla(from var(--clr-mainbg) h s l / 0.15);
    --clr-barelygray: hsla(from var(--clr-mainbg) h s l / 0.175);
    --clr-semigray: hsla(from var(--clr-mainbg) h s l / 0.2);
    --clr-darkergray: hsl(from gray h s calc(l - 30));
    --clr-lightergray: hsl(from lightgray h s calc(l - 30));
    --clr-unhovers: hsl(from #002f44 h calc(s / 1.25) calc(50 - l));
    --clr-hovers: hsl(from #2c007e h calc(s / 1.252) calc(50 - l));
}

:root:has(#darkmode:checked) #backimage { filter: invert(); }
:root:has(#darkmode:checked) #notepad { color: hsl(from var(--clr-text) 28 s 20); filter: invert(); }

@font-face {
    font-family: 'Aardvark Cafe';
    src: url('../fonts/AARDC___.TTF');
}

@font-face {
    font-family: 'Santor';
    src: url('../fonts/santor\ 1.002.otf');
}

@font-face {
    font-family: 'Wind';
    src: url('../fonts/wind.ttf');
}

/** ===================================
      2. Global Settings for Document
    =================================== **/
html, * {
    scrollbar-width: thin;
    /* scrollbar-color: #044793 transparent; */
    box-sizing: border-box;
}

::-webkit-scrollbar {
    height: 8px;
    width: 8px;
    /* background-color: transparent; */
}

::-webkit-scrollbar-thumb {
    /* background-color: #044793; */
}

body {
    display: grid;
    grid-template-columns: 1.5fr 6fr 11fr 4fr;
    grid-template-areas: 
    '. .       title  .'
    '. options main   .'
    '. .       footer .';
    margin: 0px;
    padding-bottom: 10vh;
    font-family: 'Helvetica', sans-serif;
    color: var(--clr-text);
    font-size: 0.8rem;
    background-image: url('../media/rainbow.gif');
    background-repeat: repeat;
}

#backimage {
    position: fixed;
    top: -1vh;
    left: -1vw;
    width: 102vw;
    height: 102vh;
    background-image: url('../media/hexellence.webp');
    z-index: -4;
    transition: filter 0.44s ease;
}

a {
    color: var(--clr-unhovers);
    transition: color 0.22s;
}

a:hover {
    color: var(--clr-hovers);
}

address {
    display: inline;
}

/** ================================
      3. Header, Title, & Subtitle
    ================================ **/
header {
    grid-area: title;
    position: relative;
    padding-block: 100px 60px;
    background-image:
        linear-gradient(transparent 33%, var(--clr-barelygray), var(--clr-semigray), var(--clr-mainbg));
}

header::after, header::before {
    content: "";
    position: absolute;
    top: 0;
    width: 0.1em;
    height: 100%;
    background-image:
        linear-gradient(transparent 33%, var(--clr-semigray), var(--clr-mainbg));
}

header::after { right: 0; } header::before { left: 0; }

h1 {
    margin: 0;
    padding-right: 10vw;
    font-family: 'Wind';
    font-weight: normal;
    font-size: 72px;
    text-align: right;
}

.subtitle {
    margin: -0.5em 0;
    padding-left: 5vw;
    font-family: 'Santor';
    font-size: 25px;
    font-weight: bold;
    text-align: center;
}

/** ==========================================
      4. Main Content Sections
    ========================================== **/
main {
    position: relative;
    grid-area: main;
    padding: 0.5em;
    background-color: var(--clr-mainbg);
    border-bottom-left-radius: 0.33em;
    border-bottom-right-radius: 0.33em;
    z-index: 444;
}

/** 4a. Navigation & Buttons
  ---------------------------------- **/
nav {
    position: absolute;
    top: 0em;
    right: 7.15em;
    width: 2.5em;
    height: auto;
    aspect-ratio: 1 / 1;
    padding: 0.4em;
    background-color: var(--clr-darkergray);
    border: none;
    -webkit-clip-path: polygon(25% 5%, 75% 5%, 100% 50%, 75% 95%, 25% 95%, 0% 50%);
    clip-path: polygon(25% 5%, 75% 5%, 100% 50%, 75% 95%, 25% 95%, 0% 50%);
    z-index: 44;
}

nav #darkbutton {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 89%;
    height: auto;
    max-width: 94%;
    max-height: 94%;
    aspect-ratio: 1 / 1;
    border: none;
    -webkit-clip-path: polygon(25% 5%, 75% 5%, 100% 50%, 75% 95%, 25% 95%, 0% 50%);
    clip-path: polygon(25% 5%, 75% 5%, 100% 50%, 75% 95%, 25% 95%, 0% 50%);
    z-index: 44;
}

nav #darkbutton input[type="checkbox"] {
    position: absolute;
    top: -10%;
    left: -20%;
    appearance: none;
    vertical-align: middle;
    width: 200%;
    height: 200%;
    background-image: conic-gradient(#85dce6, yellow, purple);
    outline: none;
    border: none;
    transform: rotate(-90deg);
    transition: 0.44s ease;
    z-index: 44;
}

nav #darkbutton input[type="checkbox"]::before, nav #darkbutton input[type="checkbox"]::after {
    position: absolute;
    width: 1em;
    height: auto;
    aspect-ratio: 1 / 1;
    font-size: 1.65em;
    font-weight: bold;
}

nav #darkbutton input[type="checkbox"]::before {
    content: "☀︎";
    top: 0.2em;
    left: 1.85em;
    color: goldenrod;
    -webkit-text-stroke: 0em goldenrod;
}

nav #darkbutton input[type="checkbox"]::after {
    content: "☾";
    top: 0.1em;
    left: 0.45em;
    color: var(--clr-hovers);
    -webkit-text-stroke: 0em var(--clr-hovers);
}

nav #darkbutton input[type="checkbox"]:checked {
    left: -9%;
    transform: rotate(0deg);
}

nav #darkbutton input[type="checkbox"]:hover {
    top: -20%;
    left: -20%;
    transform: rotate(-45deg);
}

button {
    position: absolute;
    display: block;
    top: 0em;
    right: 3em;
    width: min-content;
    height: auto;
    aspect-ratio: 1 / 1;
    padding: 0.2em;
    background-color: var(--clr-darkergray);
    font-size: 1em;
    font-family: 'Santor';
    font-weight: bold;
    border: none;
    -webkit-clip-path: polygon(25% 5%, 75% 5%, 100% 50%, 75% 95%, 25% 95%, 0% 50%);
    clip-path: polygon(25% 5%, 75% 5%, 100% 50%, 75% 95%, 25% 95%, 0% 50%);
    z-index: 44;
}

button span {
    display: flex;
    height: 100%;
    padding: 0.4em;
    align-items: center;
    background-color: var(--clr-lightergray);
    -webkit-clip-path: polygon(25% 5%, 75% 5%, 100% 50%, 75% 95%, 25% 95%, 0% 50%);
    clip-path: polygon(25% 5%, 75% 5%, 100% 50%, 75% 95%, 25% 95%, 0% 50%);
    transition: background-color 0.22s ease;
}

button span:hover {
    background-color: hsl(from var(--clr-lightergray) h s calc(l - 5));
}

button span:active {
    background-color: hsl(from var(--clr-lightergray) h s calc(l - 15));
}

#configbutton {
    position: absolute;
    top: 6.75em;
    left: -0.9em;
    contain: paint;
    margin: 0;
    padding: 0;
    width: 2.2em;
    height: 2.2em;
    background-color: hsl(from var(--clr-optionsbg) h s calc(l - 11));
    -webkit-clip-path: polygon(25% 5%, 75% 5%, 100% 50%, 75% 95%, 25% 95%, 0% 50%);
    clip-path: polygon(25% 5%, 75% 5%, 100% 50%, 75% 95%, 25% 95%, 0% 50%);
    z-index: 44;
}

#configbutton fieldset {
    position: relative;
    margin: 7%;
    padding: 0.1em;
    height: 87%;
    width: 87%;
    background-color: hsl(from var(--clr-mainbg) h s calc(l + 10));
    -webkit-clip-path: polygon(25% 5%, 75% 5%, 100% 50%, 75% 95%, 25% 95%, 0% 50%);
    clip-path: polygon(25% 5%, 75% 5%, 100% 50%, 75% 95%, 25% 95%, 0% 50%);
    border: none;
    transition: background-color 0.22s ease;
}

#configbutton fieldset:hover {
    background-color: hsl(from var(--clr-mainbg) h s calc(l + 5));
}

#configbutton fieldset:active {
    background-color: hsl(from var(--clr-mainbg) h s hsl(l - 10));
}

#config {
    appearance: none;
    margin: 0;
    width: 0;
    height: 0;
}

#configbutton label {
    cursor: pointer;
    position: absolute;
    top: 10%;
    left: 10%;
    width: 80%;
    height: 80%;
}

#configbutton svg {
    stroke: hsl(from var(--clr-optionsbg) h s calc(l - 11));
    stroke-dasharray: 580 611;
    stroke-dashoffset: -171;
    stroke-width: 18;
    stroke-linecap: round;
    stroke-linejoin: round;
    transition: rotate calc(1500ms / 2) calc(250ms / 2), stroke-dasharray calc(1000ms / 2) calc(250ms / 2) linear, stroke-dashoffset calc(500ms / 2) linear, stroke-width calc(1750ms / 2);
}

#configbutton:has(#config:checked) svg {
    stroke-dasharray: 155 611;
    stroke-dashoffset: -10;
    stroke-width: 14;
    rotate: 360deg;
    transition: rotate calc(1500ms / 2), stroke-dasharray calc(750ms / 2) calc(750ms / 2) linear, stroke-dashoffset calc(330ms / 2) calc(1500ms / 2) linear, stroke-width calc(1750ms / 2) ease-out;
}

#warning {
    padding-left: 2rem;
    font-weight: bold;
    color: red;
    font-style: italic;
    display: none;
}

/** 4b. Prompt Content
  ---------------------------------- **/
#notepad {
    margin-left: 0.5em;
    padding: 0.4em;
    min-height: 4.75em; /* optionally make main a vertical flexbox  so that the notepad will grow*/
    background-image: url('../media/notebook.png');
    border-radius: 0.25em;
    border: 0.1em solid hsl(from var(--clr-mainbg) h s 94);
    transition: filter 0.44s ease;
    z-index: 4;
}

#notepad div {
    margin-block: 1em;
    /* display: none; */
}

#notepad div:last-child {
    margin-bottom: 0.1em;
}

#notepad span {
    padding-left: 2em;
}

#dialoguebox, #actionbox, #colorbox, #traitbox, #themebox, #whobox, #whybox, #timebox { display: none; }

body:has(#chkQuote:checked) #dialoguebox,
body:has(#chkAction:checked) #actionbox,
body:has(#chkColor:checked) #colorbox,
body:has(#chkTrait:checked) #traitbox,
body:has(#chkTheme:checked) #themebox,
body:has(#chkCompany:checked) #whobox,
body:has(#chkReason:checked) #whybox,
body:has(#chkDuration:checked) #timebox
{ display: block; }

h2 {
    margin-block: 0.1em;
    font-size: 1.1rem;
    font-weight: normal;
    font-style: italic;
}

h3 {
    margin-block: 0;
    display: block;
    font-size: 1em;
    font-style: italic;
}

/** ==========================================
      5. Options
    ========================================== **/

#options {
    margin: 1em 0;
    position: relative;
    contain: paint;
    grid-area: options;
    left: calc(100% - 0.55em);
    padding: 0.5em;
    background-color: var(--clr-optionsbg);
    border-top-left-radius: 0.33em;
    border-bottom-left-radius: 0.33em;
    z-index: 44;
    transition: 0.75s;
}

:root:has(#config:checked) #options {
    left: 0;
    padding-left: 0.5em;
}

#opts {
    justify-content: center;
    column-gap: 1rem;
    margin-bottom: 1rem;
    font-family: 'Helvetica', sans-serif;
    font-size: 0.6rem;
    font-weight: bold;
    line-height: 1.45;
}

#opts fieldset {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-start;
    align-items: flex-start;
    align-content: flex-start;
    margin: 0;
    padding-left: 0.1em;
    width: max-content;
    min-width: 24ch;
    max-width: calc(18ch + 13.5vw);
    border: none;
}

#opts h4 {
    margin: 0;
    flex-shrink: 0;
    font-family: 'Wind';
    font-size: 1.5em;
    font-style: italic;
    text-decoration: underline;
}

#opts p { margin-block: 0.95em; width: 100%; flex-shrink: 0; }
#opts input { display: inline-block; }

#opts input[type="checkbox"] {
    flex-grow: 0;
    appearance: none;
    margin-inline: 0.5rem;
    vertical-align: middle;
    width: 0.5rem;
    height: 0.5rem;
    outline-offset: 2px;
    outline: 2.5px solid var(--clr-darkergray);
    border-radius: 0.025rem;
    transition: outline 0.22s, background-color 0.22s;
}

#opts input[type="checkbox"]:not(:disabled) { outline-color: var(--clr-unhovers); }
#opts input[type="checkbox"]:is(:hover, :focus):not(:disabled) { outline-color: var(--clr-hovers); }
#opts input[type="checkbox"]:checked { background-color: var(--clr-darkergray); }
#opts input[type="checkbox"]:checked:not(:disabled) { background-color: var(--clr-unhovers); }

#opts label {
    position: relative;
    top: 1px;
}

#opts .info {
    position: relative;
    margin: 0;
    width: 100%;
    flex-shrink: 0;
}

#opts .info::after {
    content: "?";
    position: absolute;
    right: 0;
    bottom: 0;
    width: 1.15em;
    height: 1.15em;
    background-color: var(--clr-mainbg);
    -webkit-clip-path: polygon(25% 5%, 75% 5%, 100% 50%, 75% 95%, 25% 95%, 0% 50%);
    clip-path: polygon(25% 5%, 75% 5%, 100% 50%, 75% 95%, 25% 95%, 0% 50%);
    text-align: center;
    font-family: 'Wind';
    font-weight: bold;
    font-size: 1.25em;
    line-height: 1.2;
    transition: 0.22s ease;
    z-index: 44;
}

#opts .info:hover::after {
    text-shadow: 1px 1px 2px var(--clr-hovers);
}

#opts .info::before {
    content: "";
    position: absolute;
    right: -0.05em;
    bottom: -0.05em;
    width: 1.25em;
    height: 1.25em;
    background-color: var(--clr-text);
    -webkit-clip-path: polygon(25% 5%, 75% 5%, 100% 50%, 75% 95%, 25% 95%, 0% 50%);
    clip-path: polygon(25% 5%, 75% 5%, 100% 50%, 75% 95%, 25% 95%, 0% 50%);
    font-size: 1.25em;
    transition: 0.44s ease;
    z-index: 4;
}

#opts .info:hover::before {
    background-color: var(--clr-hovers);
}

/** ==========================================
      5. Footer
    ========================================== **/

footer {
    position: relative;
    grid-area: footer;
    max-height: 3em;
    top: 0.5em;
    padding: 0.5em;
    background-color: var(--clr-mainbg);
    border-radius: 0.33em;
    overflow: hidden;
    z-index: 444;
    transition: max-height 0.66s ease 0.22s, linear-gradient 0.88s ease;
}

footer::after {
    position: absolute;
    bottom: 0;
    left: 0;
    content: "...";
    text-align: center;
    width: 100%;
    height: 1.5em;
    background-image: linear-gradient(transparent 0%, var(--clr-mainbg) 35%);
}

footer:hover {
    max-height: 12rem;
}

footer:hover::after {
    background-image: linear-gradient(transparent 0%, hsl(from var(--clr-mainbg) h s calc(l - 5)) 35%)
}

/**** small screen breakpoints ****/

@media screen and (max-width: 1225px) {
    body {
        grid-template-columns: 0.5fr 3fr 6fr 1fr;
    }
}

@media screen and (max-width: 1000px) {
    body {
        grid-template-columns: 0.25fr 1fr 10fr .5fr;
    }
}

@media screen and (max-width: 800px) {
    
    body {
        grid-template-columns: 0.5fr 0.125fr 10fr 0.5fr;
    }
    #options { display: none; }
    main form { visibility: hidden; }
    #warning { display: block; }

}

/**** highest resolution appearance ****/

@media screen and (min-width: 1600px) {
    
    body {
        grid-template-columns: 5fr 7fr 12fr 10fr;
    }

}