/* utility_blocks/code - Clean CSS for Rise theme */

/* Constrain code block wrapper to content width */
.block-text--code {
  max-width: 76rem;
  margin: 0 auto;
}

/* Code block base styling */
.block-text__code {
  background: #fafafa;
  border: 0.1rem solid #eee;
  border-radius: 0.3rem;
  color: #000;
  font-family: Courier, monospace;
  font-size: 1.5rem;
  overflow: auto;
  padding: 3rem;
  white-space: pre;
  max-width: 100%;
  box-sizing: border-box;
}

/* Responsive font size */
@media (min-width: 768px) {
  .block-text__code {
    font-size: 1.3rem;
  }
}

/* Column layout for code blocks */
.block-text--code .block-text__col {
  box-sizing: border-box;
  display: block;
  min-height: 1px;
  padding-inline: 1.5rem;
  width: 100%;
  max-width: 100%;
}

.block-text--code .block-text__col:first-child {
  margin-inline-start: 0;
}

/* Clear floats after code block */
.block-text--code::after {
  content: "";
  display: table;
  clear: both;
}

/* Figure positioning for controls */
.block-text__figure {
  position: relative;
}

/* Code controls container */
.block-text__code-controls {
  position: absolute;
  top: 1rem;
  right: 1rem;
  display: flex;
  gap: 0.5rem;
  z-index: 10;
}

/* Clean button styling */
.code-control-btn {
  background: none;
  border: none;
  padding: 0.5rem;
  cursor: pointer;
  color: #666;
  transition: color 0.2s, background 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
}

.code-control-btn:hover {
  color: #000;
  background: rgba(0, 0, 0, 0.05);
}

.code-control-btn svg {
  display: block;
}

/* Copy feedback */
.code-copy-btn.copied {
  color: #27ae60;
}

/* Text wrapping toggle */
.block-text__code.wrapped {
  white-space: pre-wrap;
  word-break: break-word;
}
