:root {
    --gray-light: #f8f9fa;
    --gray-medium: #e9ecef;
    --border-color: #dee2e6;
    --primary: #0d6efd;
    --text: black;
    --shadow: rgba(0, 0, 0, 0.1);
    --err-color: #f48771;
    --success-color: #6a9955;
    --hightlight-color: #4ec9b0;
    --neutral-color: #d4d4d4;
}

body {
    font-family: 'Gill Sans', 'Gill Sans MT', Calibri, 'Trebuchet MS', sans-serif;
    color: var(--text);
    background: var(--gray-light);
    margin: 0;
    padding: 1rem;
}

body p {
        margin-bottom: 1rem;
        margin-top: 1rem;
        line-height: 1.6;
        max-width: 40rem;
        hyphens: none;
    }

hr {
    margin: 2rem 0;
}

pre {
    background-color: var(--gray-light);
    padding: 1rem;
}

.explanation p {
        margin: 1rem auto;
    }

img {
    max-width: 100%;
}

nav ul {
        list-style: none;
        display: flex;
        gap: 1rem;
        justify-content: space-around;
    }

:is(nav ul) a {
            transition: all 0.2s;
            text-underline-offset: 1px;
            text-decoration-thickness: 1px;
        }

:is(:is(nav ul) li.active) a {
                text-decoration-thickness: 3px;
                text-underline-offset: 4px;
            }

.container {
    max-width: 60rem;
    margin: 0 auto;
    background: white;
    padding: 2rem;
    border: 1px solid var(--border-color);
    min-height: 175vh;
}

h1 {
    font-size: 2rem;
    margin-bottom: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: baseline;
}

h1 a {
        font-size: 1rem;
    }

.content-preview {
    display: grid;
    grid-template-columns: 1fr 1fr;
    background-color: var(--gray-light);
    gap: 1rem;
    margin: 2rem 0;
    border: 1px solid var(--border-color);
}

.preview-item {
    display: flex;
    flex-direction: column;
    padding: 1.5rem;
    text-align: center;
}

.preview-item img {
        width: 100%;
        height: auto;
        border: 1px solid var(--border-color);
    }

.preview-item textarea {
        width: 100%;
        min-height: 300px;
        font-family: 'Monaco', 'Menlo', 'Consolas', monospace;
        font-size: 0.75rem;
        padding: 0.5rem;
        border: 1px solid var(--border-color);
        resize: vertical;
        word-break: break-all;
        overflow-wrap: break-word;
    }

:is(.preview-item textarea):focus {
            outline: none;
            border-color: var(--primary);
        }

:is(.preview-item textarea):disabled {
            opacity: 0.5;
            cursor: not-allowed;
        }

.preview-label {
    margin-top: 0.75rem;
    font-size: 0.9rem;
    font-weight: 500;
}

.controls {
    display: flex;
    gap: 0.75rem;
    margin: 1.5rem 0;
    flex-wrap: wrap;
    align-items: center;
}

label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 500;
    font-size: 0.9rem;
}

select {
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border-color);
    background: white;
    cursor: pointer;
    font-size: 0.9rem;
    font-family: inherit;
    transition: border-color 0.15s;
}

select:focus {
        outline: none;
        border-color: var(--primary);
    }

select:disabled {
        opacity: 0.5;
        cursor: not-allowed;
    }

button {
    padding: 0.5rem 1rem;
    font-weight: 500;
    font-size: 0.9rem;
    font-family: inherit;
    cursor: pointer;
    border: 1px solid;
    border-color: var(--border-color);
    background: white;
    transition: all 0.2s;
}

button:hover:not(:disabled) {
        border-color: black;
        transform: translateY(-1px);
        box-shadow: 0 2px 4px var(--shadow);
    }

button:active:not(:disabled) {
        transform: translateY(0);
        box-shadow: none;
    }

button:disabled {
        opacity: 0.5;
        cursor: not-allowed;
    }

.stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin: 1.5rem 0;
}

.stat-card {
    padding: 1rem;
    border: 1px solid var(--border-color);
    background: var(--gray-light);
}

.stat-card .stat-label {
        font-size: 0.85rem;
        margin-bottom: 0.25rem;
        text-transform: uppercase;
        letter-spacing: 0.5px;
    }

.stat-card .stat-value {
        font-size: 1.5rem;
        font-weight: 600;
    }

.log-container {
    transition: all 0.2s;
    background: #1e1e1e;
    padding: 1rem;
    height: 400px;
    overflow-y: auto;
    font-family: 'Monaco', 'Menlo', 'Consolas', monospace;
    font-size: 0.85rem;
    line-height: 1.6;
    border: 1px solid #000;
    margin-top: 1rem;
}

.log-container::-webkit-scrollbar {
        width: 8px;
    }

.log-container::-webkit-scrollbar-track {
        background: #2d2d2d;
    }

.log-container::-webkit-scrollbar-thumb {
        background: var(--gray-dark);
    }

:is(.log-container::-webkit-scrollbar-thumb):hover {
            background: #888;
        }

.log-entry {
    margin: 0.25rem 0;
}

.log-entry.log-info {
        color: var(--neutral-color);
    }

.log-entry.log-hash {
        color: var(--hightlight-color);
    }

.log-entry.log-success {
        color: var(--success-color);
        font-weight: 500;
    }

.log-entry.log-error {
        color: var(--err-color);
        font-weight: 500;
    }

@media (max-width: 768px) {
    body {
        padding: 0.5rem;
    }

    .container {
        padding: 1rem;
    }

    h1 {
        font-size: 1.5rem;
    }

    .content-preview {
        grid-template-columns: 1fr;
    }

    .controls {
        flex-direction: column;
        align-items: stretch;
    }

        .controls button,.controls select {
            width: 100%;
        }

    .stats {
        grid-template-columns: 1fr;
    }
}
/*
see https://www.joshwcomeau.com/css/custom-css-reset/
*/

/* 1. Box-sizing model */
*, *::before, *::after {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    /* 3. Enable keyword animations */
    interpolate-size: allow-keywords;
}


* {
    /* 2. Remove default margin */
    margin: 0;

    /*
        3. Add accessible line-height 
        see https://kittygiraudel.com/2020/05/18/using-calc-to-figure-out-optimal-line-height/
    */
    line-height: calc(2px + 2ex + 2px);
}

body {
    /* 4. Improve text rendering */
    -webkit-font-smoothing: antialiased;
}

/* 5. Improve media defaults */
img, picture, video, canvas, svg {
    display: block;
    max-width: 100%;
}

/* 6. Inherit fonts for form controls */
input, button, textarea, select {
    font: inherit;
}

/* 7. Avoid text overflows */
p {
    text-wrap: pretty;
    overflow-wrap: break-word;
    hyphens: auto;
}

/* 8. Improve line wrapping */
h1, h2, h3, h4, h5, h6 {
    text-wrap: balance;
    overflow-wrap: break-word;
}


/*
  9. Create a root stacking context

  __OPTIONAL__

  see https://www.joshwcomeau.com/css/custom-css-reset/#nine-root-stacking-context-10
  see https://www.joshwcomeau.com/css/stacking-contexts/
*/
#root {
    isolation: isolate;
}

/* see https://gomakethings.com/how-to-animate-scrolling-to-anchor-links-with-one-line-of-css/#accessibility-concerns */
@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }
}
