@reference "../../../global.css";

.examples {
  --examples-repl-gap: 24px;
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.examples-menu-section h2 {
  margin: 0 0 12px;
  color: var(--repl-docs-accent);
  font-family: 'Ubuntu Sans', sans-serif;
  font-size: 12px;
  font-weight: 700;
  line-height: 16px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.examples-menu-container {
  display: grid;
  grid-template-rows: 100%;
  grid-template-columns: 100vw 100vw;
  grid-template-areas: 'example-content-panel example-repl-panel';
  height: calc(100% - var(--header-height) - var(--panel-toggle-height));
  margin-top: var(--header-height);
  transform: translate3d(0, 0, 0);
  transition: transform 500ms;
}

.examples-panel-input {
  transform: translate3d(-100vw, 0, 0);
}

.examples-panel-output {
  transform: translate3d(-200vw, 0, 0);
}

.examples-panel-console {
  transform: translate3d(-300vw, 0, 0);
}

.examples-menu,
.examples-repl {
  min-width: 0;
  min-height: 0;
}

.examples-menu {
  grid-area: example-content-panel;
  position: relative;
  overflow-y: auto;
  padding: 20px 22px 28px 18px;
}

.examples-menu-section + .examples-menu-section {
  margin-top: 24px;
}

.example-button,
.example-button-new {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  align-items: start;
  gap: 12px;
  width: 100%;
  box-sizing: border-box;
  background: var(--examples-card-bg);
  color: var(--examples-text);
  text-decoration: none;
  text-align: left;
  padding: 14px 16px;
  transition:
    transform 180ms ease,
    box-shadow 180ms ease,
    background 180ms ease;
  box-shadow: 6px 6px 0 0 var(--color-shadow-base);
  @apply border-[1.6px] border-border-base rounded-2xl overflow-hidden transition-transform;
}

.example-button + .example-button {
  margin-top: 10px;
}

.example-button:hover,
.example-button.selected,
.example-button-new:hover {
  @apply bg-background-accent;
  @apply -translate-y-1;
}

.example-button-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  min-height: 44px;
  border-radius: 14px;
  background: color-mix(in srgb, var(--repl-docs-input-strip-bg), white 24%);
  font-size: 24px;
  line-height: 1;
}

.example-button-content {
  min-width: 0;
}

.example-button h3 {
  margin: 0;
  color: var(--examples-text);
  font-family: 'Tomorrow', sans-serif;
  font-size: 18px;
  font-weight: 600;
  line-height: 24px;
}

.example-button p {
  margin: 6px 0 0;
  color: var(--examples-text-soft);
  font-family: 'Ubuntu Sans', sans-serif;
  font-size: 14px;
  font-weight: 600;
  line-height: 20px;
}

.example-button-new {
  grid-template-columns: 1fr;
  justify-items: center;
  margin-top: 28px;
  text-align: center;
  color: var(--repl-docs-accent);
  font-family: 'Ubuntu Sans', sans-serif;
  font-size: 14px;
  font-weight: 700;
  line-height: 20px;
}

.examples-repl {
  grid-area: example-repl-panel;
  overflow: hidden;
  padding: 20px 18px 28px 0;
}

.examples-repl-shell {
  position: relative;
  min-width: 0;
  min-height: 0;
  height: 100%;
  overflow: hidden;
  border-radius: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.examples .repl {
  display: grid;
  grid-template-rows: auto;
  grid-template-columns: 100vw 100vw 100vw;
  grid-template-areas: 'repl-input-panel repl-output-panel repl-detail-panel';
  height: 100%;
  max-height: 100%;
  background: transparent;
}

.examples .repl-panel {
  box-shadow: 6px 6px 0 0 var(--color-shadow-base);
  @apply border-[1.6px] border-border-base rounded-2xl overflow-hidden;
}

.examples .repl-input-panel,
.examples .repl-output-panel,
.examples .repl-detail-panel {
  overflow: hidden;
}

.examples .repl-input-panel {
  grid-area: repl-input-panel;
}

.examples .repl-output-panel {
  grid-area: repl-output-panel;
}

.examples .repl-detail-panel {
  grid-area: repl-detail-panel;
}

@media (max-width: 767px) {
  .examples {
    --panel-toggle-height: 52px;
  }

  .examples-menu-container {
    @apply m-0 p-0;
  }

  .examples.examples-active-examples .examples-menu-container {
    transform: translate3d(0, 0, 0);
  }

  .examples.examples-active-input .examples-menu-container,
  .examples.examples-active-output .examples-menu-container,
  .examples.examples-active-console .examples-menu-container {
    transform: translate3d(-100vw, 0, 0);
  }

  .examples-repl {
    @apply p-0;
  }

  .examples-repl-shell {
    overflow: hidden;
    padding: 0;
    box-sizing: border-box;
    border: 1.6px solid var(--repl-docs-border);
    border-radius: 16px;
    background: var(--examples-card-bg);
    box-shadow: 6px 6px 0 0 var(--examples-shadow);
  }

  .examples .repl {
    width: 300%;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    grid-template-rows: minmax(0, 1fr);
    height: 100%;
    transform: translate3d(0, 0, 0);
    transition: transform 500ms;
  }

  .examples.examples-active-output .repl {
    transform: translate3d(-33.333333%, 0, 0);
  }

  .examples.examples-active-console .repl {
    transform: translate3d(-66.666667%, 0, 0);
  }

  .examples .repl-panel {
    width: 100%;
    height: 100%;
    justify-self: stretch;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    background: transparent;
  }
}

@media (min-width: 768px) {
  .examples-menu-container {
    height: 100%;
    margin-top: 0;
    grid-template-columns: minmax(280px, 360px) minmax(0, 1fr);
    box-sizing: border-box;
    padding: 118px 24px 28px;
    transform: translate3d(0, 0, 0);
    transition: none;
  }

  .examples-menu {
    padding: 0 20px 20px 0;
  }

  .examples-repl {
    overflow: visible;
  }

  .examples-repl-shell {
    overflow: visible;
  }

  .examples .repl {
    gap: 0;
    grid-template-rows: minmax(0, 1.15fr) minmax(220px, 0.85fr) minmax(220px, 0.72fr);
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
      'repl-input-panel'
      'repl-output-panel'
      'repl-detail-panel';
  }

  .examples .repl-input-panel,
  .examples .repl-output-panel {
    margin-bottom: 12px;
  }

  .examples .repl-detail-panel {
    margin-top: 0;
  }

  .examples .repl-detail-panel .repl-tab-buttons {
    border-top: 0;
  }
}

@media (min-width: 1200px) {
  .examples-menu-container {
    grid-template-columns: minmax(300px, 360px) minmax(0, 1fr);
  }

  .examples .repl {
    grid-template-rows: minmax(0, 1fr) minmax(220px, 0.72fr);
    grid-template-columns:
      minmax(0, var(--repl-main-left-width, calc((100% - var(--examples-repl-gap)) / 2)))
      var(--examples-repl-gap)
      minmax(0, 1fr);
    grid-template-areas:
      'repl-input-panel repl-main-resizer repl-output-panel'
      'repl-input-panel repl-main-resizer repl-detail-panel';
  }

  .examples .repl-main-resizer {
    grid-area: repl-main-resizer;
    align-self: stretch;
    width: var(--examples-repl-gap);
  }

  .examples .repl-main-resizer:hover .repl-main-resizer-line {
    box-shadow: 0 0 0 4px rgba(178, 228, 255, 0.7);
    @apply bg-border-base;
  }

  .examples .repl-input-panel {
    margin-bottom: 0;
  }

  .examples .repl-output-panel {
    margin-bottom: 0;
    border-bottom: 0;
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
  }

  .examples .repl-detail-panel {
    border-top: 0;
    border-top-left-radius: 0;
    border-top-right-radius: 0;
  }

  .examples .repl-detail-panel .repl-tab-buttons {
    @apply border-t-[1.6px] border-border-base;
  }
}
