/*
 Theme Name:   GeneratePress Child
 Theme URI:    https://generatepress.com
 Description:  Default GeneratePress child theme
 Author:       Tom Usborne
 Author URI:   https://tomusborne.com
 Template:     generatepress
 Version:      0.1
*/

/* --- Code Blocks (pre code) --- */
.wp-block-code {
    background-color: #1a005b; /* Dark background, common for code */
    color: #f8f8f2; /* Light text color */
    padding: 1.25em 1.5em; /* Ample padding */
    border-radius: 6px; /* Slightly rounded corners */
    overflow-x: auto; /* Enable horizontal scrolling for long lines */
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, Courier, monospace; /* Monospace font */
    font-size: 0.9em; /* Slightly smaller font size */
    line-height: 1.5; /* Good line spacing */
    white-space: pre-wrap; /* Ensures lines wrap if they are too long */
    word-break: break-word;
    position: relative; /* Crucial for positioning the copy button absolutely within */
}

/* Style for the code itself within the pre block */
.wp-block-code code {
    color: #f8f8f2; /* Inherit text color from parent */
    font-size: inherit; /* Inherit font size */
    background: none; /* Remove any default background if present */
    padding: 0;
}

/* --- Code Block Comments (Hash Lines) --- */
.wp-block-code .code-comment-line {
    color: #42ff00; /* A shade of green */
}

/* --- Inline Code (code) --- */
code {
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, Courier, monospace;
    background-color: #f6f1ff; /* Light grey background for inline code */
    padding: 0.2em 0.4em; /* Small padding around inline code */
    border-radius: 3px;
    font-size: 0.85em; /* Slightly smaller for inline code */
    color: #260080; /* A distinct color for inline code */
}

/* --- Styles for the Copy Button --- */
.code-copy-button {
    position: absolute;
    top: 0.75em; /* Adjust for desired vertical position */
    right: 0.75em; /* Adjust for desired horizontal position */
    padding: 0.3em 0.6em;
    background-color: #4a1999; /* Example button color */
    color: #f0f0f0;
    border: 1px solid #6a3bb9;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.75em; /* Smaller font for the button */
    opacity: 0; /* Initially hidden */
    transition: opacity 0.2s ease-in-out, background-color 0.2s ease-in-out;
    z-index: 1; /* Ensure it's above the code text */
}

.wp-block-code:hover .code-copy-button {
    opacity: 1; /* Show button on hover of the code block */
}

.code-copy-button:hover {
    background-color: #ffffff; /* Slightly lighter on hover */
}

.code-copy-button:active {
    background-color: #3a0f79; /* Darker when pressed */
}

.code-copy-button:disabled,
.code-copy-button[disabled] { /* Style for disabled state (e.g., after copying) */
    background-color: #555;
    color: #aaa;
    cursor: default;
}