/**
 * The following styles get applied both on the front of your site
 * and in the editor.
 */

 
 /**
 * CSS rules that set theme-specific dark mode colors and values should be specified in the theme, not here.
 * In the theme code, register a custom block stylesheet for the cmd-media/dark-light-mode block.
 * Use body.cmddark in their selectors to apply them only when dark mode is active.
 * Dark mode should set new values for the color variables that are specified in theme.json.
 * Here is an example of the main rule you would include in the custom block stylesheet in the theme:
 *
 * body.cmddark {
 *   --wp--preset--color--base: #111111;
 *   --wp--preset--color--contrast: #ffffff;
 * } 
 */


/**
 * Styles for the toggle block.
 */
.wp-block-cmd-media-dark-light-mode .toggle {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  position: relative;
  cursor: pointer;
  gap: 1ch;
  border: 0;
  padding: 0;
  background-color: transparent;
  font: inherit;
}

.wp-block-cmd-media-dark-light-mode .toggle__display {
  --offset: 0.15em;
  --diameter: 1em;
  display: inline-flex;
  align-items: center;
  justify-content: space-around;
  box-sizing: content-box;
  width: calc(var(--diameter) * 2 + var(--offset) * 2);
  height: calc(var(--diameter) + var(--offset) * 2);
  border: 0.1em solid rgba(0, 0, 0, 0.2);
  position: relative;
  border-radius: 100vw;
  background-color: var(--wp--preset--color--contrast);
  transition: 250ms;
}

.wp-block-cmd-media-dark-light-mode .toggle__display::before {
  content: "";
  z-index: 2;
  position: absolute;
  top: 50%;
  left: var(--offset);
  box-sizing: border-box;
  width: var(--diameter);
  height: var(--diameter);
  border: 0.1em solid rgba(0, 0, 0, 0.2);
  border-radius: 50%;
  background-color: var(--wp--preset--color--base);
  transform: translate(0, -50%);
  will-change: transform;
  transition: inherit;
}

.wp-block-cmd-media-dark-light-mode .toggle:focus .toggle__display,
.wp-block-cmd-media-dark-light-mode .toggle__input:focus+.toggle__display {
  outline: 1px dotted #212121;
  outline: 1px auto -webkit-focus-ring-color;
  outline-offset: 2px;
}

.wp-block-cmd-media-dark-light-mode .toggle:focus,
.wp-block-cmd-media-dark-light-mode .toggle:focus:not(:focus-visible) .toggle__display,
.wp-block-cmd-media-dark-light-mode .toggle__input:focus:not(:focus-visible)+.toggle__display {
  outline: 0;
}

.wp-block-cmd-media-dark-light-mode .toggle[aria-pressed=true] .toggle__display,
.wp-block-cmd-media-dark-light-mode .toggle__input:checked+.toggle__display {
  background-color: #e3f5eb;
}

.wp-block-cmd-media-dark-light-mode .toggle[aria-pressed=true] .toggle__display::before,
.wp-block-cmd-media-dark-light-mode .toggle__input:checked+.toggle__display::before {
  transform: translate(100%, -50%);
}

.wp-block-cmd-media-dark-light-mode .toggle[disabled] .toggle__display,
.wp-block-cmd-media-dark-light-mode .toggle__input:disabled+.toggle__display {
  opacity: 0.6;
  filter: grayscale(40%);
  cursor: not-allowed;
}

.wp-block-cmd-media-dark-light-mode [dir=rtl] .toggle__display::before {
  left: auto;
  right: var(--offset);
}

.wp-block-cmd-media-dark-light-mode [dir=rtl] .toggle[aria-pressed=true]+.toggle__display::before,
.wp-block-cmd-media-dark-light-mode [dir=rtl] .toggle__input:checked+.toggle__display::before {
  transform: translate(-100%, -50%);
}


.theme-switch {
  display: flex;
  justify-content: center;
  align-items: center;
}

.theme-switch .checkbox {
  opacity: 0;
  position: absolute;
}

.theme-switch .label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px;
  border-radius: 50px;
  position: relative;
  /* max-height: 15px; */
  width: 60px;
  cursor: pointer;
  /* box-shadow: var(--switch-shadow); */
  transition: all 0.1s cubic-bezier(0.76, 0, 0.24, 1);
  border: 1px solid var(--wp--preset--color--secondary-1-medium);
}

.theme-switch .label:hover .moon,
.theme-switch .label:hover .sun {
  transform: rotate(360deg);
}

.theme-switch .ball {
  transition: all 0.1s cubic-bezier(0.76, 0, 0.24, 1);
  background-color: var(--wp--preset--color--tc-blue);
  position: absolute;
  border-radius: 50%;
  top: 7.5px;
  left: 9px;
  height: 25px;
  width: 25px;
}

.theme-switch .moon {
  color: var(--wp--preset--color--tc-blue);
  transform-origin: center center;
  transition: all 0.5s cubic-bezier(0.76, 0, 0.24, 1);
  transform: rotate(0);
  height: 20px;
  width: 20px;
}

.theme-switch .sun {
  color: var(--wp--preset--color--button-bgcolor);
  transform-origin: center center;
  transition: all 0.5s cubic-bezier(0.76, 0, 0.24, 1);
  transform: rotate(0);
  height: 20px;
  width: 20px;
}

.theme-switch .ball {
  transform: translatex(0);
}

.dark .theme-switch .ball {
  transform: translatex(40px);
}

@media (prefers-color-scheme: dark) {
  .theme-switch .ball {
    transform: translatex(40px);
  }

  .cmddark .theme-switch .ball {
    transform: translatex(0);
  }
}


/**
 * Not clear whether we need these old styles from the block or not.
 * I am not sure what they're all for.
 */

/*  
:root {
  color-scheme: light dark;
  --background-color: #ffffff;
  --text-color: #000000;
}

:root.dark {
  --background-color: #242525;
  --text-color: #a29a8c;
}

body {
  --bg-color: #fff;
  --text-color: #303030;
  --switch-shadow: 0px 0px 10px 3px rgba(0, 0, 0, 0.1) inset;
  --transition: all 0.3s cubic-bezier(0.76, 0, 0.24, 1);

  background-color: var(--bg-color) !important;
  color: var(--text-color) !important;
}

.dark body {
  --wp--preset--color--base: #242525;
  --bg-color: #242525;
  --text-color: #a29a8c;
  --switch-shadow: 0px 0px 10px 3px rgba(0, 0, 0, 0.5) inset;
}

@media (prefers-color-scheme: dark) {
  body {
    --bg-color: #242525;
    --text-color: #a29a8c;
    --switch-shadow: 0px 0px 10px 3px rgba(0, 0, 0, 0.5) inset;
  }

  .light body {
    --bg-color: #fff;
    --text-color: #6c6d74;
    --switch-shadow: 0px 0px 10px 3px rgba(0, 0, 0, 0.1) inset;
  }
}

body {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  background: var(--bg-color);
  transition: var(--transition);
} */
