/* Examples */

@media (max-width: 768px) {
  .examples-preview__canvas {
      padding: 1rem 1rem 1rem 2.2rem;
    }

  .examples-output__item p {
      font-size: 0.88rem;
    }
}

#examples {
  position: relative;
  padding-block: clamp(2.5rem, 5vh, 4.5rem);
}

#examples .container {
  min-height: calc(100svh - var(--header-height) - (clamp(2.5rem, 5vh, 4.5rem) * 2));
  display: flex;
  flex-direction: column;
  justify-content: center;
}

#examples::before {
  content: '';
  position: absolute;
  inset: 8% 0 auto;
  height: clamp(18rem, 26vw, 24rem);
  background:
    radial-gradient(circle at 22% 18%, rgba(var(--brand-color-rgb), 0.14), transparent 44%),
    radial-gradient(circle at 78% 30%, rgba(var(--brand-color-deep-rgb), 0.12), transparent 42%);
  pointer-events: none;
}

.examples-intro {
  max-width: min(100%, 48rem);
  margin-inline: auto;
  margin-bottom: clamp(1.4rem, 2.8vw, 2.2rem);
  text-align: center;
}

.examples-stage {
  position: relative;
  width: min(100%, 84rem);
  margin-inline: auto;
  flex: 1 1 auto;
}

.examples-preview {
  display: flex;
  min-width: 0;
}

.examples-preview__frame {
  position: relative;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-height: clamp(34rem, 78vh, 46rem);
  width: 100%;
  border: 1px solid rgba(var(--brand-color-rgb), 0.12);
  border-radius: var(--radius-md);
  background: rgba(22, 18, 20, 0.96);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.14);
  overflow: hidden;
}

.examples-preview__chrome {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.7rem 0.9rem;
  border-bottom: 1px solid rgba(var(--brand-color-rgb), 0.14);
  background: rgba(var(--brand-color-rgb), 0.12);
}

.examples-preview__chrome span {
  width: 0.65rem;
  height: 0.65rem;
  border-radius: 999px;
  background: #ff5f57;
}

.examples-preview__chrome span:nth-child(2) {
  background: #febc2e;
}

.examples-preview__chrome span:nth-child(3) {
  background: #28c840;
}

.examples-preview__title {
  margin-left: 0.55rem;
  color: rgba(255, 255, 255, 0.94);
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.examples-ide {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  align-content: start;
  min-height: 0;
  height: auto;
}

#examples .examples-tabs {
  display: flex;
  flex-wrap: nowrap;
  align-items: flex-end;
  gap: 0.3rem;
  padding: 0.4rem 0.55rem 0;
  border-bottom: 1px solid rgba(var(--brand-color-rgb), 0.08);
  background: rgba(var(--brand-color-rgb), 0.04);
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
  align-self: start;
}

#examples .examples-tabs::-webkit-scrollbar {
  display: none;
}

#examples .examples-tab {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  min-height: 2rem;
  padding: 0.32rem 0.62rem 0.36rem;
  border: 1px solid transparent;
  border-bottom: none;
  border-radius: 0;
  background: rgba(255, 255, 255, 0.02);
  color: var(--text-muted);
  font: inherit;
  font-size: 0.72rem;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
  transition: color var(--transition-med), background var(--transition-med), border-color var(--transition-med);
}

#examples .examples-tab.is-active {
  color: var(--text-primary);
  background: rgba(var(--brand-color-rgb), 0.1);
  border-color: rgba(var(--brand-color-rgb), 0.16);
}

.examples-tab-more {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2rem;
  min-width: 2.3rem;
  padding: 0.32rem 0.62rem 0.36rem;
  border: 1px solid rgba(var(--brand-color-rgb), 0.16);
  border-bottom: none;
  border-radius: 0;
  background: rgba(var(--brand-color-rgb), 0.03);
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
  opacity: 0.82;
  pointer-events: none;
}

.examples-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(13.5rem, 0.56fr);
  min-height: 0;
  height: 100%;
}

.examples-editor {
  position: relative;
  min-height: 0;
  height: 100%;
  overflow: hidden;
  background: rgba(24, 17, 20, 0.92);
}

.examples-file {
  position: absolute;
  inset: 0;
  padding: 0.8rem 0.75rem 1.9rem 0;
  overflow-x: auto;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(var(--brand-color-rgb), 0.42) rgba(255, 255, 255, 0.06);
  opacity: 0;
  pointer-events: none;
}

.examples-file::-webkit-scrollbar {
  width: 0.58rem;
  height: 0.58rem;
}

.examples-file::-webkit-scrollbar-corner {
  background: rgba(255, 255, 255, 0.06);
}

.examples-file::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.06);
  border-radius: 999px;
}

.examples-file::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, rgba(var(--brand-color-rgb), 0.78), rgba(var(--brand-color-deep-rgb), 0.6));
  border-radius: 999px;
  border: 2px solid rgba(22, 18, 20, 0.16);
}

.examples-file::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, rgba(var(--brand-color-rgb), 0.9), rgba(var(--brand-color-deep-rgb), 0.72));
}

.examples-file.is-active {
  opacity: 1;
  pointer-events: auto;
}

.examples-code-line {
  display: grid;
  grid-template-columns: 2.5rem minmax(0, 1fr);
  align-items: center;
  gap: 0.75rem;
  min-height: 1.15rem;
  padding: 0.18rem 0.9rem 0.18rem 0.7rem;
}

.examples-code-line__no {
  color: rgba(255, 255, 255, 0.32);
  font-size: 0.68rem;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.examples-code-line__bar {
  display: block;
  width: var(--line-size, 100%);
  height: 0.52rem;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0.07));
}

.examples-code-line--accent .examples-code-line__bar {
  background: linear-gradient(90deg, rgba(var(--brand-color-rgb), 0.82), rgba(var(--brand-color-deep-rgb), 0.4));
}

.examples-code-line__text {
  display: block;
  min-width: 0;
  color: rgba(244, 247, 251, 0.92);
  font-family: 'Fira Code', monospace;
  font-size: 0.75rem;
  line-height: 1.45;
  white-space: pre;
}

.examples-minimap {
  display: flex;
  flex-direction: column;
  border-left: 1px solid rgba(var(--brand-color-rgb), 0.08);
  background: rgba(var(--brand-color-rgb), 0.03);
  padding: 0.85rem 0.9rem 0.9rem;
  overflow: hidden;
  min-height: 0;
}

.examples-minimap__item {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  display: none;
  flex-direction: column;
  justify-content: flex-start;
  padding: 0.95rem 0.95rem 1rem 1.05rem;
  border: 0;
  background: transparent;
  opacity: 0;
  visibility: hidden;
  transform: none;
  box-shadow: none;
  transition: opacity var(--transition-med), background var(--transition-med);
}

.examples-minimap__item h3 {
  margin-bottom: 0.45rem;
  font-size: 1.05rem;
}

.examples-minimap__item p {
  margin-bottom: 0;
  max-width: 32ch;
  font-size: 0.95rem;
  line-height: 1.72;
}

.examples-minimap__item.is-active {
  display: flex;
  opacity: 1;
  visibility: visible;
  background: transparent;
}

:root[data-theme="light"] #examples::before {
  background:
    radial-gradient(circle at 22% 18%, rgba(var(--brand-color-rgb), 0.1), transparent 42%),
    radial-gradient(circle at 78% 30%, rgba(var(--brand-color-deep-rgb), 0.08), transparent 40%);
}

:root[data-theme="light"] .examples-preview__frame {
  background: #ffffff;
  box-shadow: 0 20px 36px rgba(22, 29, 37, 0.08);
}

:root[data-theme="light"] .examples-editor {
  background: rgba(255, 249, 250, 0.98);
}

:root[data-theme="light"] .examples-file {
  scrollbar-color: rgba(var(--brand-color-rgb), 0.46) rgba(22, 29, 37, 0.08);
}

:root[data-theme="light"] .examples-file::-webkit-scrollbar-track {
  background: rgba(22, 29, 37, 0.08);
}

:root[data-theme="light"] .examples-file::-webkit-scrollbar-thumb {
  border-color: rgba(255, 255, 255, 0.72);
}

:root[data-theme="light"] #examples .examples-tab {
  background: rgba(22, 29, 37, 0.03);
}

:root[data-theme="light"] #examples .examples-tab.is-active {
  background: rgba(var(--brand-color-rgb), 0.12);
}

:root[data-theme="light"] .examples-preview__title {
  color: rgba(22, 29, 37, 0.76);
}

:root[data-theme="light"] .examples-code-line__no {
  color: rgba(22, 29, 37, 0.34);
}

:root[data-theme="light"] .examples-code-line__bar {
  background: linear-gradient(90deg, rgba(22, 29, 37, 0.13), rgba(22, 29, 37, 0.06));
}

:root[data-theme="light"] .examples-code-line__text {
  color: rgba(22, 29, 37, 0.88);
}

:root[data-theme="light"] .examples-minimap {
  background: rgba(22, 29, 37, 0.02);
}

:root[data-theme="light"] .examples-minimap__item {
  background: transparent;
}

.examples-cta {
  margin-top: 1.5rem;
  text-align: center;
}

.examples-cta .btn {
  min-height: 2.9rem;
  padding: 0.72rem 1.05rem;
  border-color: rgba(var(--brand-color-rgb), 0.22);
  background: rgba(var(--brand-color-rgb), 0.08);
  color: #fff1ee;
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.14);
}

.examples-cta .btn:hover {
  border-color: rgba(var(--brand-color-rgb), 0.32);
  background: rgba(var(--brand-color-rgb), 0.12);
  color: #fff6f4;
  box-shadow: 0 16px 28px rgba(0, 0, 0, 0.18);
}

:root[data-theme="light"] .examples-cta .btn {
  border-color: rgba(var(--brand-color-rgb), 0.2);
  background: rgba(var(--brand-color-rgb), 0.08);
  color: #8f3726;
  box-shadow: 0 10px 22px rgba(22, 29, 37, 0.06);
}

:root[data-theme="light"] .examples-cta .btn:hover {
  border-color: rgba(var(--brand-color-rgb), 0.28);
  background: rgba(var(--brand-color-rgb), 0.12);
  color: #a13f2d;
  box-shadow: 0 14px 24px rgba(22, 29, 37, 0.08);
}

@media (max-width: 1100px) {
  #examples .container {
      min-height: auto;
    }

  .examples-preview__frame {
      min-height: clamp(32rem, 74vh, 42rem);
    }

  .examples-workspace {
      grid-template-columns: 1fr;
    }

  .examples-minimap {
      border-left: 0;
      border-top: 1px solid rgba(var(--brand-color-rgb), 0.08);
    }
}

@media (max-width: 768px) {
  .examples-preview__title {
      display: none;
    }

  .examples-workspace {
      grid-template-rows: minmax(0, 1fr) auto;
      align-content: end;
    }

  .examples-ide {
      min-height: 32rem;
    }

  .examples-minimap {
      height: 7.2rem;
      min-height: 7.2rem;
      align-self: end;
      padding: 0.18rem 0.32rem 0.24rem;
    }

  .examples-minimap__item {
      flex: 0 0 auto;
      padding: 0.34rem 0.4rem 0.38rem 0.46rem;
    }

  .examples-minimap__item h3 {
      margin-bottom: 0.24rem;
      font-size: 0.88rem;
    }

  .examples-minimap__item p {
      max-width: none;
      font-size: 0.78rem;
      line-height: 1.46;
    }

  .examples-file {
      min-height: 0;
      max-height: none;
    }

  .examples-code-line {
      grid-template-columns: 2.4rem minmax(0, 1fr);
      gap: 0.7rem;
      padding-inline: 0.75rem;
    }
}
