@import url('./vendor/modern-normalize.min.css') layer(normalize);

:root {
  color-scheme: light dark;
  --paper: oklch(93% 1% 68deg);
  --black: oklch(30% 1% 68deg);
  --text: oklch(45% 1% 68deg);
  --radius: 8px;
  --radiusExterior: calc(var(--radius) + 6px);
}

.middle {
  display: grid;
  place-items: center;
}

.hidden {
  display: none;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.text {
  color: var(--text);
  -webkit-filter: url("#distort");
  filter: url("#distort");
}

.text-base {
  font-size: 1rem;
}

.user-select-none {
  user-select: none;
  pointer-events: none;
}

.font-serif {
  font-family: serif;
  hyphens: auto;
}

.font-sans-serif {
  font-family: sans-serif;
}

.font-mono {
  font-family: monospace;
}

.m-0 {
  margin: 0;
}

.my-1 {
  margin-top: 1em;
  margin-bottom: 1em;
}

.pl-2 {
  padding-left: 2em;
}

.monogram {
  flex: 1;
  font-size: 1.75em;
  position: relative;
  top: 1px;
}

.container {
  top: 0;
  position: absolute;
  margin: 16px;
  overflow: scroll;
  padding: 5px;
  width: 87%;
  height: calc(84%);
  border-radius: var(--radius);
  scrollbar-width: thin;
}

body {
  font-size: 0.85em;
  line-height: 1.25em;
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a {
  color: inherit;
}

button, input {
  color: inherit;
  caret-color: var(--black);
  font-size: 0.9em;
  line-height: 1.4em;

  &:focus {
    outline: 0;
  }
}

::selection {
  color: var(--paper);
  background-color: var(--black);
}

p + p {
  margin-top: 0;
}

main {
  border-radius: var(--radiusExterior);
  background-color: var(--paper);
  width: 260px;
  aspect-ratio: 69/114;
  position: relative;
  border: 1.5px solid oklch(88% 0% 68deg);
}

main:after {
  content: '';
  pointer-events: none;
  z-index: 1;
  position: absolute;
  border-radius: var(--radius);
  top: 4%;
  width: calc(87%);
  height: calc(84%);
  box-shadow: inset 2px 0px 2px -2px oklch(75% 0% 68deg), inset 0 2px 2px -2px oklch(75% 0% 68deg), inset -2px -2px 2px -2px oklch(89% 0% 68deg);
}

main:before {
  content: '';
  pointer-events: none;
  position: absolute;
  border-radius: var(--radiusExterior);
  width: calc(100% + 10px);
  height: calc(100% + 10px);
  z-index: -1;
  background: linear-gradient(135deg, oklch(95% 0% 68deg), oklch(89% 1% 68deg));
}

.bg-paper {
  background-color: var(--paper);
}

.border {
  border: .5px solid var(--text);
}

#emailForm {
  display: flex;
  max-width: 100%;

  input {
    flex: 1;
    border-radius: 0;
    appearance: none;
    border-radius: 4px 0 0 4px;
  }

  button {
    font-weight: inherit;
    border-left: 0;
    padding-top: 1px;
    padding-bottom: 1px;
    border-radius: 0 4px 4px 0;

    &:active {
      background-color: var(--black);
      color: var(--paper);
    }
  }
}

#message {
  margin-top: -5px;
  border-top: 4px solid var(--text);
  background-color: var(--text);
  color: var(--paper);
  border-radius: 0 0 4px 4px;
  padding-left: 4px;

  &:empty {
    display: none;
  }
}

#menu-bar {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 0 5px;

  .battery {
    width: 11px;
    border-radius: 2px;
    height: 8px;
    border: .5px solid var(--text);
    position: relative;
    padding: 0.5px;

    &:after {
      content: '';
      display: block;
      position: absolute;
      right: -2px;
      top: 1px;
      width: 1px;
      height: 5px;
      background-color: var(--text);
      border-top-right-radius: 1px;
      border-bottom-right-radius: 1px;
    }
  }

  .level {
    background-color: var(--text);
    height: 100%;
    width: 67%;
    border-radius: 1px;
  }

  .percent {
    color: var(--text);
    font-size: 0.5em;
  }
}

.controls {
  display: flex;
  position: absolute;
  bottom: 4px;
  gap: 5px;
}

.button {
  background-color: var(--paper);
  box-shadow: 1px 1px 1px 0px oklch(75% 0% 68deg), 0 2px 2px -2px oklch(60% 0% 68deg), 0 -1px 1px 0 oklch(89% 0% 68deg);
  border: 0;
  border-radius: 8px;
  border-width: 1px;
  height: 8px;
  width: 85px;
  appearance: none;

  &:active:not(:disabled), &.active {
    box-shadow: 0 1px 1px 0px oklch(80% 0% 68deg) inset, 
                0 -1px 1px 0 oklch(85% 0% 68deg) inset;
  }
}

.page {
  display: none;
  view-transition-name: page-content;
}

.page.active {
  display: block;
}

.block {
  display: block;
}

.page.initial-load {
  animation: eink-fade-in 250ms ease-out forwards;
}

::view-transition-old(page-content),
::view-transition-new(page-content) {
  animation: none;
  mix-blend-mode: normal;
}

::view-transition-old(page-content) {
  animation: eink-fade-out 250ms ease-out forwards;
}

::view-transition-new(page-content) {
  animation: eink-fade-in 250ms ease-out forwards;
  animation-delay: 100ms;
  opacity: 0;
}

@keyframes eink-fade-out {
  0% {
    opacity: 1;
    filter: contrast(1) brightness(1);
  }
  20% {
    filter: contrast(0.3) brightness(0.8);
  }
  40% {
    filter: contrast(0.5) brightness(0.6) invert(1);
  }
  60% {
    filter: contrast(0.2) brightness(0.9) invert(0);
  }
  80% {
    filter: contrast(0.6) brightness(0.7) invert(1);
  }
  100% {
    opacity: 0;
    filter: contrast(1) brightness(1) invert(0);
  }
}

@keyframes eink-fade-in {
  0% {
    opacity: 0;
    filter: contrast(0.2) brightness(0.5);
  }
  20% {
    opacity: 0.3;
    filter: contrast(0.4) brightness(0.7) invert(1);
  }
  40% {
    opacity: 0.6;
    filter: contrast(0.3) brightness(0.6) invert(0);
  }
  60% {
    opacity: 0.8;
    filter: contrast(0.5) brightness(0.8) invert(1);
  }
  80% {
    opacity: 0.9;
    filter: contrast(0.8) brightness(0.9) invert(0);
  }
  100% {
    opacity: 1;
    filter: contrast(1) brightness(1);
  }
}

.controls-labels {
  display: flex;
  position: absolute;
  justify-self: center;
  justify-content: center;
  bottom: 0;
  left: 0;
  right: 0;
  gap: 5px;
  font-size: 0.7em;

  .button-label {
    border-bottom: 0;
    border-radius: 4px 4px 0 0;
    padding: 0 10px;
    min-width: 75px;
    text-align: center;
    line-height: 1.75em;
  }
}

#debug-image {
  width: 100%;
}
