.typo3-styleguide__frame {
    overflow-x: hidden;
    width: 100%;
    box-sizing: border-box;
}

:root {
    --typo3-sg-bg-primary: #ffffff;
    --typo3-sg-bg-secondary: #f6f4f0;
    --typo3-sg-text-primary: #000000;
    --typo3-sg-text-secondary: #646464;
    --typo3-sg-border: #ddd;
    --typo3-sg-accent: #f49700;
    --typo3-sg-hover-overlay: rgba(0, 0, 0, 0.1);
    --typo3-sg-copy-bg: rgba(0, 0, 0, 0.7);
    --typo3-sg-copy-text: #ffffff;
}

/* Dark Mode */
@media (prefers-color-scheme: dark) {
    :root {
        --typo3-sg-bg-primary: #1a1a1a;
        --typo3-sg-bg-secondary: #2d2d2d;
        --typo3-sg-text-primary: #e0e0e0;
        --typo3-sg-text-secondary: #a0a0a0;
        --typo3-sg-border: #444444;
        --typo3-sg-accent: #ff9f00;
        --typo3-sg-hover-overlay: rgba(255, 255, 255, 0.1);
        --typo3-sg-copy-bg: rgba(255, 255, 255, 0.9);
        --typo3-sg-copy-text: #000000;
    }
}

.typo3-styleguide__element-container {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 20px;
    margin: 0 40px;
}

.typo3-styleguide__element-container--icons {
    display: grid !important;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 24px;
    padding: 10px 0;
    margin: 0 40px;
    box-sizing: border-box;
}

.typo3-styleguide__element--icon {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 180px;
    justify-self: center;
}

@media (max-width: 768px) {
    .typo3-styleguide__element-container {
        margin: 0 20px;
    }

    .typo3-styleguide__element-container--icons {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
        gap: 16px;
        margin: 0 20px;
    }

    .typo3-styleguide__element--icon {
        min-width: 150px;
    }
}

@media (max-width: 480px) {
    .typo3-styleguide__element-container {
        margin: 0 16px;
    }

    .typo3-styleguide__element-container--icons {
        grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
        gap: 12px;
        margin: 0 16px;
    }

    .typo3-styleguide__element--icon {
        min-width: 120px;
    }

    .typo3-styleguide__element--icon .typo3-styleguide__element-caption {
        font-size: 0.875rem;
    }
}

.typo3-styleguide__element[data-copy]:hover {
    cursor: pointer;
}

.typo3-styleguide__image {
    background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUBAMAAAB/pwA+AAAAIGNIUk0AAHomAACAhAAA+gAAAIDoAAB1MAAA6mAAADqYAAAXcJy6UTwAAAAnUExURfz8/P7+/ujo6Obm5ufn5/////39/enp6efn6Ofo6P39/urq6unp6vERkkUAAAABYktHRAX4b+nHAAAAB3RJTUUH6QYMDDA6KFm81wAAAGVJREFUCNdjYBQUFBRQdnFxcWYQDQ0NDatQUlJSgTBLlJRmIphKpDMDS4DmTmbgSktLE9heXl5+iEEdSFYzAvkLGCyBcu5gVQxOQB3uqVCm5iQ4Uwk7E0ltE5JoO4RpAjTXCOwrAMX7Nqc6R1FeAAAAJXRFWHRkYXRlOmNyZWF0ZQAyMDI1LTA2LTEyVDEyOjQ4OjQzKzAwOjAwMTAHLQAAACV0RVh0ZGF0ZTptb2RpZnkAMjAyNS0wNi0xMlQxMjo0ODo0MyswMDowMEBtv5EAAAAodEVYdGRhdGU6dGltZXN0YW1wADIwMjUtMDYtMTJUMTI6NDg6NTgrMDA6MDDZ1coqAAAAAElFTkSuQmCC);
    background-size: 20px 20px;
    background-position: 0 0, 0 10px, 10px -10px, -10px 0;
    padding: 40px;
    max-width: 200px;
    min-width: 80px;
    max-height: 200px;
    min-height: 80px;
    display: flex;
    justify-content: center;
    align-items: center;
    border: 1px solid var(--typo3-sg-border);
    border-radius: 10px;
    transition: transform 0.2s ease, background 0.2s ease;
}

.typo3-styleguide__image:hover {
    background: linear-gradient(
        var(--typo3-sg-hover-overlay),
        var(--typo3-sg-hover-overlay)
    ),
    url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUBAMAAAB/pwA+AAAAIGNIUk0AAHomAACAhAAA+gAAAIDoAAB1MAAA6mAAADqYAAAXcJy6UTwAAAAnUExURfz8/P7+/ujo6Obm5ufn5/////39/enp6efn6Ofo6P39/urq6unp6vERkkUAAAABYktHRAX4b+nHAAAAB3RJTUUH6QYMDDA6KFm81wAAAGVJREFUCNdjYBQUFBRQdnFxcWYQDQ0NDatQUlJSgTBLlJRmIphKpDMDS4DmTmbgSktLE9heXl5+iEEdSFYzAvkLGCyBcu5gVQxOQB3uqVCm5iQ4Uwk7E0ltE5JoO4RpAjTXCOwrAMX7Nqc6R1FeAAAAJXRFWHRkYXRlOmNyZWF0ZQAyMDI1LTA2LTEyVDEyOjQ4OjQzKzAwOjAwMTAHLQAAACV0RVh0ZGF0ZTptb2RpZnkAMjAyNS0wNi0xMlQxMjo0ODo0MyswMDowMEBtv5EAAAAodEVYdGRhdGU6dGltZXN0YW1wADIwMjUtMDYtMTJUMTI6NDg6NTgrMDA6MDDZ1coqAAAAAElFTkSuQmCC);
}

.typo3-styleguide__icon .typo3-styleguide__image-box {
    height: 50px;
    width: 50px;
}

.typo3-styleguide__image-box {
    height: 100px;
    width: 100px;
}

.typo3-styleguide__image-box img {
    height: 100%;
    width: 100%;
    object-fit: contain;
    object-position: center;
}

.typo3-styleguide__element-caption {
    font-family: monospace, sans-serif;
    width: 100%;
    text-align: center;
    margin-top: 10px;
    color: var(--typo3-sg-text-primary);
}

.typo3-styleguide__image-caption-text {
    word-wrap: break-word;
    hyphens: auto;
    margin: 0;
}

.typo3-styleguide__color {
    font-family: monospace, sans-serif;
    padding: 40px;
    width: 200px;
    height: 200px;
    display: flex;
    gap: 10px;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    border: 1px solid #ddd;
    border-radius: 10px;
    position: relative;
    overflow: hidden;
}

.typo3-styleguide__color::after {
    content: "";
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0);
    pointer-events: none;
}

.typo3-styleguide__color:hover::after {
    background: rgba(0, 0, 0, 0.2);
}

.typo3-styleguide__color p {
    margin: 0;
    padding: 0;
}

.typo3-styleguide__color-value {
    font-weight: bolder;
}

.typo3-styleguide__color-label {
    font-style: italic;
    text-align: center;
}

.typo3-styleguide__font {
    padding: 40px;
    width: 100%;
    min-height: 100px;
    display: flex;
    gap: 20px;
    font-size: 20px;
    flex-direction: column;
    justify-content: center;
    border: 1px solid #ddd;
    border-radius: 10px;
    margin-bottom: 2rem;
}

.typo3-styleguide__font p {
    margin: 0;
    padding: 0;
}

.typo3-styleguide__element[data-copy]:focus {
    outline: 2px solid var(--typo3-sg-accent);
    outline-offset: 2px;
}

.copy-hint {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.8);
    background: var(--typo3-sg-copy-bg);
    color: var(--typo3-sg-copy-text);
    padding: 8px 16px;
    border-radius: 6px;
    z-index: 10;
    pointer-events: none;
    font-family: sans-serif;
    font-size: 0.875rem;
    font-weight: 500;
    backdrop-filter: blur(4px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    opacity: 0;
    transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@media (prefers-reduced-motion: reduce) {
    .copy-hint { transition: none; }
}

.copy-hint--error {
    background: #dc3545;
    color: white;
}

.typo3-styleguide__element--icon[data-copy]:hover .typo3-styleguide__image {
    transform: scale(1.02);
    overflow: hidden;
}

.typo3-styleguide__element--icon[data-copy]:active .typo3-styleguide__image {
    transform: scale(1);
}
