/* Header */

hgroup {
  margin: 0;

  p {
    display: none;
  }
}

hgroup .room-name {
  font-size: 3rem;
  letter-spacing: -1px;
  font-weight: bold;
  text-decoration: none;

  color: white;

  @media (prefers-color-scheme: dark) {
    color: black;
  }

  -webkit-text-stroke: 8px var(--pico-primary);
  /* proper stroke */
  text-shadow: 4px 4px 4px rgba(0, 0, 0, 0.3);
  /* subtle drop shadow */
  paint-order: stroke fill;
}

img.logo {
  width: 14rem;
  position: relative;
  left: -10px;
}

/* Layout */
main.grid {
  display: grid;
  grid-template-columns: 1fr 8fr 4fr;
  gap: 1rem;
}

main.grid aside:first-of-type {
  grid-column: 1;
}

main.grid section {
  grid-column: 2;
  height: calc(100vh - 10rem);
}

main.grid section+aside {
  grid-column: 3;
  width: 10rem;
}

/* Chat */

.room-chat {
  display: flex;
  flex-direction: column;
}

.room-chat form {
  flex: 1;
  display: flex;
  flex-direction: row;
  gap: 0.5rem;
  margin-top: 1rem;

  button {
    height: 3rem;
    line-height: 3rem;
    padding: 0 0.5rem;
  }
}

input[name="msg"].action {
  background-color: var(--pico-primary-border);
}

.slots {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(3rem, 1fr));
  gap: 0.5rem;
}

.slots div {
  border: 2px dashed var(--pico-muted-color);
  border-radius: 10px;
  aspect-ratio: 1/1;
  cursor: pointer;
}

.slots div:hover {
  border-color: var(--pico-primary);
}

.slots div img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 10px;
}

ul.messages {
  max-height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  scroll-behavior: smooth;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0;

  span>p:first-of-type {
    display: inline;
  }

  img {
    height: 10rem;
    aspect-ratio: 4/3;
    object-fit: cover;
    background-color: var(--pico-muted-color);
    border-radius: 10px;
    margin: 0.2rem 0;
    box-shadow: 1px 1px 3px #0005;
    vertical-align: top;
  }

  video,
  iframe,
  audio {
    height: 10rem;
    aspect-ratio: 4/3;
    object-fit: cover;
    background-color: var(--pico-muted-color);
    border-radius: 10px;
    margin: 0.2rem 0;
    box-shadow: 1px 1px 3px #0005;
    vertical-align: top;
  }

  li {
    overflow-wrap: break-word;
    /* preferred modern option */
    word-break: break-word;
    /* fallback (WebKit/Edge) */
    white-space: pre-wrap;
    /* respect line breaks, but wrap long lines */
    max-width: 100%;
    /* make sure it doesn't overflow container */

    list-style: none;
    position: relative;
    margin: 0;
    padding: 0;
    padding-left: 1rem;
    /* push whole block over */
    text-indent: -1rem;
    /* pull first line back */
  }

  li b {
    text-overflow: ellipsis;
    overflow: hidden;
    white-space: nowrap;
    max-width: 10rem;
  }

  li button {
    top: 0.2rem;
    right: 0.2rem;
  }

  li:hover {
    color: var(--pico-primary-hover);
    text-decoration: underline;

    p {
      color: inherit;
      text-decoration: inherit;
    }
  }

  .time-gap {
    margin-top: 2.5rem;
    opacity: 0.5;
  }

  li:hover button {
    display: block;
  }
}

/* Nav */

hr {
  width: 80%;
}

/* Form errors */

@keyframes output-slide {
  from {
    opacity: 0;
    transform: translateX(-1rem);
  }

  to {
    opacity: 1;
    transform: translateX(0);
  }
}

output {
  display: block;
  color: var(--pico-primary);
  font-weight: bold;
  margin-bottom: 1rem;
  animation: output-slide 0.2s ease-in-out;
}

form fieldset {
  margin-bottom: 0;
}

form button[type="submit"] {
  width: unset;
}

/* Gfx */

div.plasma {
  left: 0;
  top: 0;
  width: 100vw;
  height: 100vh;
  position: fixed;
  z-index: -1;
  inset: 0;
  touch-action: none;
}

/* Delete button */

button.delete {
  position: absolute;
  right: 1rem;
  top: 0;
  padding: 0 0.2rem;
  height: 1.2rem;
  line-height: 1rem;
  display: none;
  background: var(--pico-primary-hover-background);
  border-color: transparent;
}

/* Participants */

ul.participants {
  li {
    position: relative;
  }

  li:hover button.delete {
    top: 1rem;
    display: block;
  }
}

/* Mobile nav */

nav.mobile-nav {
  display: none;
}

@media (max-width: 600px) {

  nav.mobile-nav {
    position: fixed;
    z-index: 10;
    top: 0;
    left: 0;
    right: 0;
    display: block;

    ul {
      display: flex;
      justify-content: center;
      align-items: center;
    }

    button.active {
      background: none;
      color: var(--pico-primary);
    }
  }
}

@media (max-width: 600px) {
  main.grid {
    display: flex;
    flex-direction: column;
    gap: 0;
  }
}