/* Basic reset */
:root {
  --brand-blue-color: rgb(0, 102, 235);
  --brand-white-color: #fff;
  --brand-black-color: #222222;
  --brand-green-color: #91E651;
  --brand-pink-color: #D67AC4;
}



body {
  margin: 0;
  font-family: sans-serif;
  background: black;
  color: var(--brand-white-color);
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

p,
div {
  font-family: "Georama", sans-serif;
  font-size: 1rem;
}

.header p {
  font-size: 0.8rem;
}

pre,
code {
  font-size: 0.85rem;
}

select {
  font-family: "Allerta", sans-serif;
}

h2 {
  font-family: "Allerta", sans-serif;
  font-size: 2rem !important;
}

h3 {
  font-family: "Allerta", sans-serif;
  font-size: 1.5rem !important;
}

.header {
  position: absolute;
  /* padding: 0rem 2rem; */
  top: 0.2rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 20;
  /* max-width: 22rem;  */
}

.topBox {
  display: flex;
  flex-direction: row;
  width: 100%;
  justify-content: space-between;
  align-items: center;
  gap: 1.5rem;
}

.main {
  /* padding-top: 5rem; */
  position: relative;
  display: grid;
  grid-template-columns:
    minmax(0, 1fr) minmax(0, calc(100vh - 3rem)) minmax(320px, 28rem) minmax(0, 1fr);
  width: 100vw;
  max-width: 100%;
  height: 100vh;
  /* leave room for the topBox; tweak 80px if needed */
  align-items: start;
  align-content: center;
  gap: 1.5rem;
  box-sizing: border-box;
  padding: 1.5rem 2rem;
}

.mainLeft,
.mainRight {
  min-width: 0;
  height: 100%;
  min-height: 0;
}

.row1,
.row2,
.row4 {
  min-height: 0;
  overflow: auto;
}

.row4 {
  display: flex;
  flex-direction: row;
  gap: 1rem;
}

.mainLeft {
  grid-column: 2;
  display: flex;
  justify-content: center;
  align-items: stretch;
  /* overflow: hidden; */
  flex: 1;
  height: 100%;
}

.mainRight {
  grid-column: 3;
  /* height: 80%; */
  display: grid;
  position: relative;
  grid-template-rows: auto auto auto;
  /* justify-content: flex-start; */
  gap: 1rem;
  /* flex: 0 0 auto; */
  /* width: clamp(280px, 28vw, 380px); */
  /* justify-content: space-between;
  align-items: flex-start; */
  /* width: 100%;
  min-width: 0;  */
  /* padding-right: 1rem; */
}

.codeWrapper {
  width: 100%;
  height: 100%;
  filter: drop-shadow(0px 11px 11px rgba(0, 0, 0, 0.3));
  background: rgba(0, 0, 0, 0.75);
  border-radius: clamp(6px, 2vw, 16px);

}

.codeContainer {
  /* width: fit-content; */
  background: rgba(0, 102, 235, 0.5);
  color: white;
  align-self: flex-start;
  border-radius: clamp(6px, 2vw, 16px);
  border: 1px solid white;
  box-sizing: border-box;
  /* box-shadow: 0px 11px 11px rgba(0, 0, 0, 0.3); */
  /* was filter: drop-shadow(...) */
  width: 100%;
  max-width: 100%;
  height: auto;
  max-height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.85) transparent;
}

.codeContainer::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

.codeContainer::-webkit-scrollbar-track {
  background: transparent;
}

.codeContainer::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.85);
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: content-box;
}

.codeContainer pre {
  /* box-sizing: border-box; */
  position: relative;
  white-space: pre;
  overflow-x: auto;
  overflow-y: auto;
  margin: 0;
  padding: 1rem;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.85) transparent;
}

h2 {
  font-size: 1.5rem;
}

/* UI dropdown */
#p5js-widget-ui {
  /* position: fixed;
  top: 20px;
  right: 20px; */
  z-index: 30;
}

#p5js-sketch-select {
  display: block;
  width: 11.5rem;
  max-width: 100%;
  box-sizing: border-box;
  padding: 12px 44px 12px 18px;
  margin: 1rem;
  font-size: 1rem;
  border-radius: 8px;
  font-weight: bold;
  background: rgba(0, 102, 235, 0.5);
  color: #fff;
  filter: drop-shadow(0px 11px 11px rgba(0, 0, 0, 0.3));
  /* box-shadow: 0 4px 16px rgba(0,0,0,0.3); */
  color: var(--brand-white-color);
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-image: url('data:image/svg+xml;utf8,<svg fill="white" height="20" viewBox="0 0 20 20" width="20" xmlns="http://www.w3.org/2000/svg"><path d="M7 8l3 3 3-3" stroke="white" stroke-width="2" fill="none" stroke-linecap="round"/></svg>');
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 24px 24px;
  border: 1px solid var(--brand-white-color);
  /* box-shadow: none; */
  position: relative;
  z-index: 3;
  justify-self: flex-end;
}

#p5js-sketch-select:focus {
  outline: 2px solid var(--brand-white-color);
  box-shadow: 0 0 0 2px var(--brand-white-color), 0 4px 16px rgba(0, 0, 0, 0.3);
}

/* Canvas container */
#p5js-sketch-container {
  width: min(100%, calc(100vh - 4rem));
  aspect-ratio: 1/1;
  height: 100%;
  min-height: 0;
  max-width: 1280px;
  display: flex;
  justify-content: center;
  align-items: center;
  border-radius: clamp(6px, 2vw, 16px);
  filter: drop-shadow(0px 11px 11px rgba(0, 0, 0, 0.3));
  overflow: hidden;
}

canvas {
  display: block;
  margin: 0;
}

#p5js-sketch-title {
  flex: 1 1 0;
  min-width: max-content;
  white-space: nowrap;
}

.snippet-lightbox-button {
  cursor: pointer;
  color: var(--brand-blue-color);
  text-decoration: underline;
  transition: all 0.2s ease;
}

.snippet-lightbox-button p{
  font-size: 0.8rem;
}

.link-out a,
.link-out p {
  font-size: 0.8rem;
  color: var(--brand-blue-color);
  transition: all 0.2s ease;

}
.link-out a:hover,
.link-out p:hover {
  transform: translateY(-2px);
}

.snippet-lightbox-button:hover {
  transform: translateY(-2px);
  /* box-shadow: 0 8px 16px rgba(102, 126, 234, 0.4); */
}


.snippet-lightbox-container {
  display: none;
  /* confined to the .mainRight area by being absolute inside it */
  position: absolute;
  inset: 0; /* top:0; right:0; bottom:0; left:0; */
  width: 100%;
  height: 100%;
  /* background: rgba(0, 0, 0, 0.95); */
  z-index: 999;
  justify-content: center;
  align-items: center;
  padding: 2rem;
}

.snippet-lightbox-container.active {
  display: flex;
  padding: 0;
}

.lightbox-content {
  position: relative;
  /* background: #1a1a1a; */
  border-radius: 1rem;
  max-width: 80vw;
  max-height: 80vh;
  overflow: hidden;
  padding: 1.5rem; 
  /* box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5); */
}

.lightbox-content .codeContainer {
  max-height: 70vh;
  padding: 1.2rem;
}

.lightbox-content .codeScroll {
  max-height: 70vh;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.85) transparent;
}

.lightbox-content .codeScroll::-webkit-scrollbar {
  width: 8px;
}

.lightbox-content .codeScroll::-webkit-scrollbar-track {
  background: transparent;
}

.lightbox-content .codeScroll::-webkit-scrollbar-thumb {
  background-color: rgba(255, 255, 255, 0.85);
  border-radius: 4px;
}

@media (max-width: 750px) {
  body {
    height: auto;
    min-height: 100dvh;
    overflow: auto;
  }

  .header {
    position: absolute;
    /* grid-column: 1 / -1; */
    left: 0.5rem;
    grid-row: 1;

  }

  .main {
    align-content: start;
    grid-template-columns: 1fr;
    grid-template-rows: auto auto auto;
    height: 100vh;
    overflow-y: auto;
    min-height: 100vh;
    gap: 5rem;
    max-width: 1600px;
  }

  .mainLeft,
  .mainRight {
    grid-column: 1;
    height: auto;
  }

  .mainLeft {
    grid-row: 2;
    aspect-ratio: 1/1;
    /* padding-top: 3rem; */
    z-index: 1;

  }

  .mainRight {
    grid-row: 3;
    z-index: 20;
  }

  .topBox {
    flex-direction: column;
    gap: 1rem;
    padding-top: 1rem;
    align-items: flex-start;
  }

  #p5js-sketch-title {
    margin: 0;
  }

  .codeContainer {
    overflow: hidden;
  }

  .codeContainer pre {
    overflow: visible;
    transform-origin: top left;
    width: fit-content;
  }

  .row1 {
    margin-top: 3rem;
  }

  .row3 {
    margin-bottom: 2rem;
  }
}