/* thanks to the one and only Andy Bell */

/* Box sizing rules */

*,
*::before,
*::after {
  box-sizing: border-box;
}

/* Remove default margin */

body,
h1,
h2,
h3,
h4,
p,
figure,
blockquote,
dl,
dd {
  margin: 0;
}

/* Remove list styles on ul, ol elements with a list role, which suggests default styling will be removed */

ul[role='list'],
ol[role='list'] {
  list-style: none;
}

/* Set core root defaults */

html:focus-within {
  scroll-behavior: smooth;
}

/* Set core body defaults */

body {
  min-height: 100vh;
  text-rendering: optimizeSpeed;
  line-height: 1.5;
}

/* A elements that don't have a class get default styles */

a:not([class]) {
  text-decoration-skip-ink: auto;
}

/* Make images easier to work with */

img,
picture {
  /* max-width: 100%; */
  display: block;
}

/* Inherit fonts for inputs and buttons */

input,
button,
textarea,
select {
  font: inherit;
}

/* Remove all animations, transitions and smooth scroll for people that prefer not to see them */

@media (prefers-reduced-motion: reduce) {
  html:focus-within {
   scroll-behavior: auto;
  }
  
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* fonts */

@font-face {
  font-family: "bricolage";
  src: url("../fonts/bricolagegrotesque[opsz\,wdth\,wght].ttf");
  font-weight: 100 900;
  font-style: normal italic;
}

@font-face {
  font-family: "inter";
  src: url("../fonts/inter.var.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal italic;
}

@font-face {
  font-family: monaspace;
  src: url("../fonts/monaspaceradonvarvf[wght\,wdth\,slnt].ttf");
  font-weight: 200 800;
}

/* variables */

:root {
  --color-main: rgb(215, 105, 140, 1);
  --color-main: rgb(30, 88, 178);
  --color-main-light: rgb(215, 105, 140, 0.3);
  --color-main-light: rgb(200, 221, 255);
  --color-body: #121212;
  /* --font-interface: "monaspace"; */
  --font-interface: "bricolage";
  --font-input: "monaspace";
  /*screen minimal size*/
  --min-height: 800px;
  --min-width: 400px;
  /*layout coloros*/
  --color-grey: hsl(0, 0%, 95%);
  --color-montage: white;
  --color-preview: hsl(0, 0%, 80%);
  --color-asset: hsl(0, 0%, 80%);
  --color-app-wrapp: hsl(0, 0%, 80%);
  --color-preview: hsl(0, 0%, 95%);
  --color-previewScreen: hsl(0, 0%, 100%);
  --color-montage-order: white;
  --color-app-wrapp: hsl(0, 0%, 90%);
  --color-assets-background: hsl(0, 0%, 70%);
  --hidden: 0;
}

img::selection {
  background: transparent;
}

#loading {
  inset: 0;
  position: fixed;
  z-index: 2000;
  background: rgb(230, 230, 230, 0.9);
  margin: 0;
  padding: 0;
  display: flex;
  align-items: center;
  /* justify-content: space-around; */
  justify-content: space-evenly;
  flex-direction: column;
  z-index: 999999999999999999999999999999;
}

.box {
  /* margin: auto; */
  display: flex;
  background: white;
  border-radius: 3em;
  flex-direction: column;
  /* height: 100px; */
  position: relative;
  padding: 1em;
}

#dots {
  margin: auto;
  display: flex;
  align-items: center;
}

.box::after {
  position: absolute;
  height: 30px;
  width: 40px;
  background: white;
  display: block;
  bottom: -20px;
  right: 0;
  content: "";
  clip-path: polygon(0 0, 0% 100%, 42% 0);
  justify-content: space-around;
}

.dot {
  opacity: 0;
  width: 10px;
  height: 10px;
  display: block;
  border-radius: 50%;
  background: grey;
  margin: 0 5px;
  animation: blink 1000ms infinite;
}

#dot1 {
  animation-delay: 50ms;
}

#dot2 {
  animation-delay: 100ms;
}

#dot3 {
  animation-delay: 150ms;
}

@keyframes blink {
  0% {
    opacity: 0;
  }

  33% {
    opacity: 1;
  }
  66% {
    opacity: 1;
  }
  /* 80% { */
  /**/
  /*  opacity: 1; */
  /* } */
  100% {
    opacity: 0;
  }
}

#loading p {
  
  font-style: italic;
  text-align: center;
}

#loading.hide {
  display: none;
}

* {
  user-select: none;
}

.moveable {
  position: fixed;
  border: 2px solid var(--color-body);
  z-index: 400000;
  background: white;
}

.resizable {
  overflow: auto;
  resize: both;
}

button,
#returnhome {
  border: 1px solid var(--color-body);
  background: white;
  padding: 0.2em 1ch;
}

:is(button, #returnhome):hover {
  background: var(--color-main);
  color: white;
}

#homeButtonsList {
  resize: unset;
  padding: 0;
  background: white;
  font-size: 0.7em;
  height: 8em;
  width: max-content;
  left: 10vw;
  top: 20em;
  position: fixed;
  /* top: 1em; */
  /* right: 1em; */
  z-index: 999999998;
  font-size: 0.8em;
  height: max-content;

  & h2 {
    margin: 0;
    & > button {
      position: absolute;
      margin-left: auto;
      font-size: 1em;
      width: 2ch;
      right: 1ch;
      top: 0.1em;
      text-align: center;
      background: unset;
      color: white;
      cursor: pointer;
      &:hover {
        color: white;
        background: unset;
        font-weight: 800;
      }
    }
  }
  & p {
    border-bottom: 3px solid black;
    display: grid;
    grid-template-columns: 1fr 3ch;
    justify-content: space-between;
  }
  & button {
    border: none;
    margin: 0;
    text-decoration: none;
    display: inline-block;
    text-transform: uppercase;
    font-weight: 400;
    text-align: left;
    background: white;
    &.reset {
      background: lightgrey;
    }
  }
}

.hide {
  display: none !important;
}

.manip input[type="number"] {
  /* border: 0px solid transparent; */
  /* border-bottom: 2px solid black; */
  /* max-width: 10ch; */
  /* display: inline; */
}

.manip label {
}

.manip details {
  margin-bottom: 2em;
}

.manip details summary {
  border-bottom: 1px solid black;
  margin-bottom: 0.5em;
}

.manip details.location div {
  max-width: fit-content;
  margin: auto;
  gap: 0.5em 0.5em;
  display: grid;
  grid-template-columns: [label-start] 8ch [label-end input-start] 1fr [input-end];
}

.manip .location summary {
  grid-column: 1 / -1;
}

.manip .location label {
  grid-column: label;
}

.manip .location input {
  grid-column: input;
}

.manip .zindex {
  display: flex;
}

.manip details {
  padding: 0 3ch;
}

.manip details {
  cursor: pointer;
  text-transform: uppercase;
  font-weight: 500;
}

.manip .zindex button {
  display: inline;
  width: 30px;
}

.toDrag {
  box-shadow: 0 0 0 5px #eee;
}

/* ui in blocks */

.block-ui {
  overflow-y: auto;
  max-height: 80vh;

  & > div {
    padding: 1em 2ch;
  }

  & ul {
    /* margin: 4em 0; */
    padding: 0;
  }

  button {
    background: #ccc;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.8em;
    margin: auto;
  }

  h2 {
    background: black;
    font-size: 0.8em;
    letter-spacing: 0.2ch;
    text-transform: uppercase;
    color: white;
    margin-bottom: 1em;
    padding: 0.3em 2ch;
    position: sticky;
    top: 0;
    & button {
      position: absolute;
      right: 0;
      color: white;
      background: transparent;
      border: none;
    }
  }

  & h3 {
    text-transform: uppercase;
    margin-top: 1em;
    margin-bottom: 0.5em;
    font-weight: 400;
  }

  & li.header {
    font-weight: 800;
    margin-bottom: 0.3em;
  }
}

/* /css changes */

#styleWrapper {
  display: block;
  position: fixed;
  top: 2em;
  left: 2em;
  max-height: 80vh;
  width: 50ch;
  background: lightgrey;
  font-size: 0.8em;
  font-family: monospace;
}

#styleWrapper style {
  /* position: absolute; */
  white-space: pre-wrap;
  width: 100%;
  display: block;
  /* background: #cccd; */
  border-bottom: 2px solid white;
  padding: 0.5em 0;
}

#styleWrapper style.activatedStyle {
  background: white;
}

.closeTo {
  background: lightgrey;
}

#styleWrapper {
}

#styleWrapper style:hover::after {
  content: attr(id);
  color: white;
  background: grey;
}

#contextualUI > section {
  margin: 0 2ch 1em;
}

#contextualUI .block {
  display: grid;
  grid-template-rows: repeat(3, 10ch);
  grid-template-columns: repeat(3, 10ch);
  gap: 0.5em 2ch;

  /* grid-template-areas: ". top . ", "left block right", ". bottom ."; */
}

#contextualUI input {
  max-width: 10ch;
  display: block;
  border: 0;
  border-bottom: 3px solid grey;
}

.input-left {
  grid-area: left;
  grid-row: 2;
  grid-column: 1;
  justify-self: end;
}

.input-right {
  grid-area: right;
  grid-row: 2;
  grid-column: 3;
}

.input-top {
  grid-row: 1;
  grid-column: 2;
  align-items: end;
}

.input-bottom {
  grid-row: 3;
  grid-column: 2;
}

#input-element {
  grid-row: 2;
  grid-column: 2;
  background: lightgrey;
  width: 100%;
  height: 100%;
  display: block;
}

/*show the contextual id only if an element is selected.*/

#contextualUI {
  visibility: hidden;
}

:has(.asset-selected) #contextualUI {
  visibility: visible;
}

#selectedId {
  display: none;
}

:has(.asset-selected) #selectedId {
  display: block;
}

:root {
  --hidden-opacity: 0.01;
}

.asset-selected .asset-selected:hover {
  --hidden-opacity: 0.9;
}

/*visibility when active*/

#deselectAsset {
  display: none;
  /* position: fixed; */
  /* margin-top: max-content; */
  /* background: var(--color-main); */
  /* text-transform: uppercase; */
  /* height: 2em; */
  /* z-index: 999999999; */
}

&:has(.asset-selected) #deselectAsset {
  display: block;
}

/* // css to show the grid at some point */

#preview #previewScreen.show-grid {
  --grid-size: 10%;
  background-image: linear-gradient(
      to right,
      rgb(0, 0, 0, 0.3) 1px,
      transparent 1px
    ),
    linear-gradient(to bottom, rgb(0, 0, 0, 0.3) 1px, transparent 1px);
  background-size: var(--grid-size) var(--grid-size);
  /* creates 10 rows and 10 columns */
}

.meta > span {
  display: block;
}

/*all dialog*/

dialog {
  & form {
    display: block;

    & input {
      display: block;

      margin-bottom: 2em;
    }
  }

  p {
    margin-top: 2em;
  }
}

::backdrop {
  background: #333333cc;
}

/* custom dialog */

#login[open] {
  max-width: 80ch;
  gap: 2em;
  padding: 2em 4ch;

  & .introtext {
    margin-bottom: 5em;
    max-width: 40ch;
  }
  & input {
    width: 100%;
  }
}

#returnhome {
  font-size: 0.8em;
  position: fixed;
  top: 1em;
  right: 1em;
  text-decoration: none;
  text-transform: uppercase;
}

.active-menu {
  color: orange;
}

#show-tools {
  font-size: 0.8em;
  text-transform: uppercase;
  position: fixed;
  top: 1em;
  left: 1em;
}

label {
  font-family: var(--font-interface);
}

input:is([type="text"], [type="password"]) {
  font-family: var(--font-input);
  border: none;
  border-bottom: 2px dotted var(--color-body);
  color: var(--color-main);
}

#delay-tools {
  background: white;
  padding: 0.5em 2ch;
  border: 2px solid var(--color-body);
  border-radius: 32px;
  margin-left: auto;
  & input {
    border: none;
    border-bottom: 1px solid grey;
    color: var(--color-main);
    max-width: 9ch;
  }
}

#delaytest {
  background: black;
  width: 20px;
  height: 20px;
  display: inline-block;
  position: relative;
  top: 5px;
  margin-right: 1ch;
  background: grey;
  border: 2px solid black;
  background: conic-gradient(
    var(--color-main) var(--angle),
    /*initially, this is set to 0deg. */ white 0 45deg
  );
  &.running {
    animation: fillCircle var(--delay-value) linear;
  }
}

@keyframes fillCircle {
  to {
    --angle: 360deg;
  }
}

/*if there is no object selected, hide the object panel*/

/* body :not(:has(.asset-selected)) #showContextual { */

/* display: none; */

/* } */

@property --angle {
  syntax: "<angle>"; /* this can be angle or percentage */
  initial-value: 0deg;
  inherits: false;
}

.reset {
}

.preview #readerMode {
  background: var(--color-main-light);
  color: var(--color-main);
  border: 5px solid white;
  box-shadow: none;
}

body {
  /* background: var(--color-grey); */
}

html {
  color: var(--color-body);
  font-family: var(--font-interface);
  scrollbar-gutter: stable;
  /* height: 100vh; */
}

.storymanager {
  display: grid;
  grid-template-columns: 1fr 2fr;
  grid-template-rows: max-content 1fr;

  height: 100vh;
}

.storymanager > header {
  border-bottom: 1px solid grey;
  grid-column: 1 / -1;
  top: 0;
  z-index: 3;
  background: white;
  position: sticky;
  display: flex;
  justify-content: space-between;
  padding: 0.8em 2ch;

  & h1 {
    font-weight: 300;
    font-size: 1em;
    background: white;
  }
}

#menu {
  overflow-y: scroll;
  grid-column: 1;
  height: 100%;
  grid-column: 1;

  & header {
    display: flex;
    padding: 0.8em 2ch;
    background: var(--color-body);
    color: white;
    align-items: center;
    justify-content: space-between;

    & a {
      color: white;
      font-style: italic;
      text-decoration: none;
      font-family: var(--font-interface);

      &:hover {
        background: var(--color-main);
      }
    }
  }
}

#projects-list {
  list-style-type: none;
  margin: 2em 1ch 1em 0;

  & li {
    margin-bottom: 0.8em;
    margin-bottom: 1em;
    color: inherit;
    text-decoration: none;

    & :is(datetime, button) {
      grid-column: 1;
    }

    & datetime {
      display: block;
      text-transform: uppercase;
      width: max-content;
      border-bottom: 1px solid grey;
      margin-bottom: 0em;
      font-size: 0.7em;
    }

    & a {
      font-weight: 800;
      color: inherit;
      text-decoration: none;
      font-size: 2em;
      font-family: var(--font-interface);
    }

    & button {
      background: unset;
      border: unset;
      padding: 0;
      font-style: italic;
      text-decoration: underline;
    }
  }
}

#projects-list a {
}

#projects-list a:hover {
  color: var(--color-main);
  text-decoration: none;
}

/*projects*/

.project {
  display: none;

  &:target {
    display: block;
  }

  & header {
    display: grid;
    align-items: center;
    & h2 {
      margin-top: 1em;
      font-size: 2em;
      text-align: center;
      text-decoration: underline;
      text-underline-offset: 5px;
      text-decoration-color: var(--color-main);
    }
    & button {
      display: inline-block;
      font-weight: 600;
      border: 0;
      cursor: pointer;
      &:hover {
        background: white !important;
        color: var(--color-main) !important;
      }
    }
  }
}

.project ul {
  list-style-type: none;
  & li {
    border-left: 5px solid var(--color-higlight, rgb(200, 200, 200));
    padding-left: 1ch;
    display: grid;
    grid-template-areas: "id" "title" "buttons";
    margin-bottom: 3em;
    /* grid-template-columns: [id-start] 4ch [id-end title-start] 70% [title-end buttons-start] 1fr [buttons-end]; */
    align-items: end;
    &:hover {
      --color-higlight: var(--color-main);
    }
    & .sequence-id {
      font-size: 0.8em;
      margin-right: 4ch;
      grid-area: id;
      color: var(--color-main);
      &::before {
        content: "# ";
      }
    }

    & .sequence-title {
      font-size: 2em;
      font-weight: 600;
      line-height: 1.2;
      margin: 0;
      grid-area: title;
      color: var(--color-higlight, black);
    }
    & .buttons {
      display: flex;
      justify-content: start;
      gap: 0 3ch;
      grid-area: buttons;
      a,
      button {
        width: unset;
        font-size: 0.8em;
        font-weight: 600;
        text-transform: uppercase;
        border: none;
        font-style: italic;
        padding: 0;
        cursor: pointer;
        border-bottom: 2px solid var(--color-highlight, grey);
        &:hover {
          background: white !important;
          color: var(--color-main) !important;
        }
      }
    }

    & a {
      text-decoration: none;
      font-style: italic;
      color: inherit;
      font-size: 0.8em;
    }
  }
}

#projectback {
  display: block;
  margin-bottom: 2em;
  color: inherit;
  text-decoration: none;
}

.deletemodal {
  background: white;
  padding: 1rem;
}

/*login & logout*/

button {
  padding: 0.2em 0.5ch;
  border: 1px solid grey;
  background: white;

  &:hover {
    background: var(--color-main);
  }
}

#new-project {
  grid-row: 2;
  grid-column: 2;
}

#projectSequences {
  margin: 2em;
  position: relative;
  padding: 0.5em;
}

dialog {
  /* display: block; */
  & input {
    display: block;
    border: 0;
    border-bottom: 3px solid var(--color-main);
    color: var(--color-main);
    margin: 1em 0;
    padding: 0;
  }
}
