@import "./constants.css";

* {
  box-sizing: border-box;
  margin: 0;
}

body {
  min-height: 100vh;
  font-size: var(--font-size);
  color: var(--text-color);
  font-family: var(--font);
  line-height: 1.2;
  background: var(--background-color);
  background-image:
    linear-gradient(rgba(39, 46, 51, 0.8)), url(./images/dithered-image1.png);
  background-size: cover;
}

::selection {
  background: rgba(255, 136, 56, 0.2);
}

mark {
  background-color: var(--background-color);
  color: var(--text-color);
  padding: 0 2px;
}

a {
  text-decoration: none;
}

a,
a:visited {
  color: var(--link-color);
}

a:hover,
a:focus {
  color: var(--link-color-hover);
  text-decoration: underline;
}

.layout {
  width: 100%;
  display: grid;
  grid-gap: 0 var(--margin);
  grid-template:
    "header header header"
    "leftSidebar main rightSidebar"
    auto / 1fr 2fr 1fr;
}

/* ----- header ----- */

header {
  grid-area: header;
  font-size: 1.1em;
  background-color: var(--background-color);
}

.header-title {
  font-variant: small-caps;
  font-family: BlackPearl;
  font-size: clamp(2em, 5vw, 3em);
  letter-spacing: 4px;
  background-image:
    linear-gradient(rgba(79, 91, 88, 0.6), rgba(79, 91, 88, 1)),
    url(./images/checkerboard-move.gif);
  background-size: 65px;
  padding: 50px 20px 0 20px;
  color: rgb(var(--background-color-g));
}

.header-title h1 {
  margin: 0;
  line-height: 0.55em;
}

.sidebar-title {
  color: var(--header-color);
  padding: 0.2em 0;
  margin-bottom: 0.35em;
  border-bottom: 3px dashed var(--content-highlight);
}

.left-sidebar {
  grid-area: leftSidebar;
  padding: 10px 15px;
  position: relative;
}
.left-sidebar::before {
  content: "";
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  width: calc(100% / 4);
  background-color: var(--background-color);
  z-index: -1;
}

.left-box {
  display: flex;
  align-items: flex-start;
}

.babble {
  margin: 3em 0 0.5em;
  width: 200px;
}

#statuscafe-username {
  margin-bottom: 0.25em;
  text-align: left;
}

.babble-box {
  --b: 2em;
  --p: 13%;
  text-align: center;
  width: 100%;
  padding: 0.55em;
  border-radius: 8px;
  background: var(--blockquote-background);
  position: relative;
  margin-left: -1em;
}

.babble-box:before {
  content: "";
  position: absolute;
  top: 100%;
  left: clamp(var(--b) / -2, var(--p) - 3 * var(--b) / 4, 100% - var(--b));
  width: var(--b);
  aspect-ratio: 1;
  background: inherit;
  --g: #000 calc(100% - 1px), #0000;
  -webkit-mask:
    radial-gradient(circle closest-side at 12% 88%, var(--g)),
    radial-gradient(20% 20% at 52% 55%, var(--g)),
    radial-gradient(25% 25% at 75% 0, var(--g));
}

.babble-box hr {
  border: 0;
  border-top: 2px dashed var(--content-highlight);
  margin-bottom: 0.25em;
}

.accordion {
  background-color: var(--content-background-color);
  color: var(--header-color);
  cursor: pointer;
  padding: 0.75em 1em;
  font-family: var(--heading-font);
  font-weight: bold;
  width: 100%;
  text-align: left;
  border: none;
  border-radius: 8px;
  font-size: 1.2em;
}

.accordion:after {
  content: "🞃";
  float: right;
}

.left-sidebar .active:after {
  content: "🞁";
}

.left-sidebar .active,
.accordion:hover {
  background-color: var(--blockquote-background);
}

.left-sidebar .active {
  border-radius: 8px 8px 0 0;
}

.panel {
  padding: 0 1em 1em;
  background-color: var(--blockquote-background);
  border-radius: 0 0 8px 8px;
  max-height: 250px;
  overflow: scroll;
  display: none;
}

.panel.show {
  display: block;
}

.panel hr {
  border: 0;
  border-top: 3px dashed var(--content-highlight);
  margin: 0 0 0.75em;
}

.buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  justify-content: space-evenly;
}

.buttons img {
  transition: 0.3s;
}

.buttons img:hover {
  transform: scale(120%);
  box-shadow: 0 0 4px #000;
}

.spacer {
  margin: 1.5em;
}

.right-sidebar {
  grid-area: rightSidebar;
  padding-right: 15px;
}

.right-sidebar h2 {
  font-family: var(--heading-font);
  font-weight: bold;
}

.L,
.R {
  --r: 8px;
  padding: var(--padding);
  margin: 1.75em 0;
  mask:
    linear-gradient(#000 0 0) no-repeat 50% / calc(100% - 2 * var(--r))
      calc(100% - 2 * var(--r)),
    radial-gradient(farthest-side, #000 97%, #0000) 0 0 / calc(2 * var(--r))
      calc(2 * var(--r)) round;
  background-color: var(--blockquote-background);
}

.L {
  transform: perspective(1px) rotate(-0.5deg);
}

.R {
  transform: perspective(1px) rotate(1deg);
}

/* ----- nav ----- */

nav {
  padding: 10px 25px;
  background: linear-gradient(
    90deg,
    rgba(var(--background-color-g), 1) 40%,
    rgba(var(--background-color-g), 0.2) 100%
  );
}

nav ul {
  margin: 0 -5px;
  padding: 0;
  list-style: none;
  user-select: none;
}

nav ul li {
  margin-bottom: 0;
}

nav > ul li > a,
nav > ul li > strong {
  display: inline-block;
  padding: 5px 10px;
}

nav ul ul li > a {
  padding-left: 30px;
}

header nav ul {
  display: flex;
  flex-wrap: wrap;
  margin: 0;
}

header nav ul li {
  position: relative;
}

header nav ul li:first-child > a {
  padding-left: 0;
}

header nav ul li:last-child > a {
  padding-right: 0;
}

/* ----- subnav ----- */

header nav ul ul {
  background: rgba(var(--background-color-g));
  display: none;
  position: absolute;
  top: 100%;
  padding: 0.5em;
  z-index: 1;
  border-radius: 0 0 20px 20px;
  min-width: 150px;
}

header nav ul li:hover ul,
header nav ul li:focus-within ul {
  display: block;
}

header nav ul li strong {
  color: var(--link-color);
  text-decoration: underline;
}

header nav ul ul li a {
  display: block;
  padding-left: 0;
  padding-right: 0;
}

/* ----- main content ----- */

main {
  grid-area: main;
  width: 95%;
  max-width: 800px;
  margin: 0 auto;
}

.outer-text h1 {
  font-size: 3em;
  font-variant: small-caps;
  font-family: BlackPearl;
  letter-spacing: 2px;
  margin: 0;
  color: #dbdcdd;
  text-shadow: 0 0 6px #dbdcdd9c;
}

.inner {
  overflow-y: auto;
  padding: var(--padding);
  background: var(--content-background-color);
  line-height: 1.5;
  border-image-slice: 50;
  border-image-width: 42px;
  border-image-outset: 20px;
  border-image-repeat: round round;
  border-image-source: url("./images/imgborder.png");
  border-style: solid;
  box-sizing: border-box;
  border-radius: 2px;
  max-height: 600px;
}

main p {
  margin: 0.35em 0;
}

blockquote {
  background: var(--blockquote-background);
  padding: 15px;
  margin: 1em 0;
  border-radius: 8px;
}

main hr {
  border: 0;
  border-top: 3px dashed var(--content-highlight);
  margin: 0.5em 0;
}

main h1,
main h2,
main h3 {
  font-family: var(--heading-font);
  margin-bottom: 0;
  line-height: 1.5;
  color: var(--header-color);
}

main h1 {
  font-size: 1.5em;
}
main h2 {
  font-size: 1.4em;
}
main h3 {
  font-size: 1.1em;
}

/* ----- mobile ----- */

@media (max-width: 1350px) {
  .left-box {
    flex-wrap: wrap;
  }

  .babble-box {
    margin-left: 0;
    margin-bottom: 1em;
  }

  .babble-box:before {
    display: none;
  }
}

@media (max-width: 875px) {
  .layout {
    width: 100%;
    grid-template: "header" auto "main" auto "leftSidebar" auto "rightSidebar" auto / 1fr;
  }

  .left-sidebar::before {
    display: none;
  }

  .babble {
    margin: 0.25em;
  }

  aside {
    padding: 9px;
  }

  nav {
    padding: 0.5em;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  nav > ul li > a,
  nav > ul li > details summary,
  nav > ul li > strong {
    padding: 0.5em;
  }

  main {
    max-height: none;
    padding: 0px 15px;
    margin: 0px 10px 25px;
    width: auto;
  }
}
