/* Estilos gerais */
:root {
    --color-primary: #2563eb;
    --color-accent: #10b981;
    --color-muted: #6b7280;
    --bg: #f5f7fb;
    --surface: #ffffff;
    --shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
}

* {
    box-sizing: border-box;
}
html {
    font-size: 62.5%;
}
body {
    margin: 0;
    font-family: "Inter", system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
    background: var(--bg);
    color: #111827;
}

header {
    background-color: var(--color-primary);
    padding: 20px;
    color: white;

    h1 {
        font-size: 3rem;
        text-align: center;
    }

    a {
        height: 80px;
        width: 80px;
        font-size: 4rem;
        position: fixed;
        top: 18px;
        display: grid;
        place-content: center;
        line-height: 4rem;
        text-decoration: none;
    }

    .glow-on-hover {
        border: none;
        outline: none;
        color: #fff;
        background: #111;
        cursor: pointer;
        z-index: 0;
        border-radius: 10px;
    }

    .glow-on-hover:before {
        content: "";
        background: linear-gradient(
            45deg,
            #ff0000,
            #ff7300,
            #fffb00,
            #48ff00,
            #00ffd5,
            #002bff,
            #7a00ff,
            #ff00c8,
            #ff0000
        );
        position: absolute;
        top: -2px;
        left: -2px;
        background-size: 400%;
        z-index: -1;
        filter: blur(5px);
        width: calc(100% + 4px);
        height: calc(100% + 4px);
        animation: glowing 20s linear infinite;
        opacity: 0;
        transition: opacity 0.3s ease-in-out;
        border-radius: 10px;
    }

    .glow-on-hover:active {
        color: #000;
    }

    .glow-on-hover:active:after {
        background: transparent;
    }

    .glow-on-hover:hover:before {
        opacity: 1;
    }

    .glow-on-hover:after {
        z-index: -1;
        content: "";
        position: absolute;
        width: 100%;
        height: 100%;
        background: #111;
        left: 0;
        top: 0;
        border-radius: 10px;
    }

    @keyframes glowing {
        0% {
            background-position: 0 0;
        }
        50% {
            background-position: 400% 0;
        }
        100% {
            background-position: 0 0;
        }
    }
}

main {
    padding: 2rem 1rem 6rem;
    max-width: 1200px;
    margin: 0 auto;
}

.card {
    background: var(--surface);
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    box-shadow: var(--shadow);
    padding: 2rem;
    margin: 2rem auto;
}
.card h2 {
    margin-top: 0;
    font-size: 2rem;
}

.tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}
.tab {
    padding: 0.8rem 1.2rem;
    border: 1px solid #e5e7eb;
    background: #fff;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1.4rem;
}
.tab.active {
    background: var(--color-primary);
    color: #fff;
    border-color: var(--color-primary);
}

.tab-panels {
    margin-top: 0.5rem;
}
.tab-panel {
    display: none;
}
.tab-panel.show {
    display: block;
}

.controls-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.2rem;
    margin-bottom: 1rem;
}
.controls-grid label {
    font-size: 1.4rem;
    display: grid;
    gap: 0.4rem;
}
.controls-grid input[type="range"] {
    width: 100%;
}
.controls-grid input[type="text"] {
    padding: 0.8rem 1rem;
    font-size: 1.4rem;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
}
.controls-grid .val {
    font-weight: 600;
    color: var(--color-primary);
    margin-left: 0.6rem;
}

.preview {
    display: grid;
    grid-template-columns: 160px 1fr;
    gap: 1.2rem;
    align-items: stretch;
}
.swatch {
    border-radius: 10px;
    border: 1px solid #e5e7eb;
    box-shadow: var(--shadow);
    min-height: 120px;
}
.code pre {
    background: #111827;
    color: #e5e7eb;
    padding: 1rem 1.2rem;
    border-radius: 8px;
    overflow: auto;
    font-size: 1.3rem;
}

.conversions {
    margin-top: 1rem;
}
.conversions h4 {
    margin: 0.5rem 0;
}
.conversions ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    gap: 0.6rem;
    font-size: 1.4rem;
}

/* Círculo cromático */
.wheel-wrap {
    position: relative;
    display: grid;
    grid-template-columns: 360px 1fr;
    gap: 1.6rem;
    align-items: start;
}
#wheelKnob {
    position: absolute;
    width: 18px;
    height: 18px;
    border: 3px solid #fff;
    border-radius: 50%;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
    transform: translate(-50%, -50%);
    pointer-events: none;
}
.wheel-controls label {
    display: block;
    font-size: 1.4rem;
    margin-bottom: 0.4rem;
}
.wheel-controls input[type="range"] {
    width: 100%;
}

.scheme-controls {
    margin: 1.2rem 0;
    display: flex;
    gap: 0.8rem;
    align-items: center;
}
.scheme-controls label {
    font-size: 1.4rem;
}
.scheme-controls select {
    padding: 0.6rem 0.8rem;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
}
.scheme-controls .toggles {
    display: flex;
    gap: 1rem;
    align-items: center;
    margin-left: 0.6rem;
}
.scheme-controls .toggles label {
    display: inline-flex;
    gap: 0.4rem;
    align-items: center;
}
.scheme-controls .actions {
    margin-left: auto;
    display: flex;
    gap: 0.6rem;
}
.btn {
    background: var(--color-primary);
    color: #fff;
    border: 1px solid var(--color-primary);
    padding: 0.6rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
}
.btn:hover {
    filter: brightness(1.05);
}
.btn.small {
    padding: 0.4rem 0.8rem;
    font-size: 1.2rem;
}
.btn.outline {
    background: #fff;
    color: var(--color-primary);
}
.btn.outline:hover {
    background: #eef2ff;
}

.palette {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 0.8rem;
    margin: 1rem 0 1.4rem;
}
.swatch-item {
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: var(--shadow);
    background: #fff;
}
.swatch-item .tone {
    height: 64px;
}
.swatch-item .meta {
    padding: 0.6rem 0.8rem;
    font-size: 1.2rem;
    color: var(--color-muted);
    display: grid;
    gap: 0.2rem;
}
.swatch-item .meta code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

.sample {
    margin-top: 1.2rem;
}
.card-sample {
    --color-1: hsl(221 80% 50%);
    --color-2: hsl(341 80% 50%);
    --color-3: hsl(101 80% 50%);
    --surface: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 1.2rem 1.4rem;
    box-shadow: var(--shadow);
}
.card-sample .badge {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
    background: var(--color-2);
    color: #fff;
    font-size: 1.2rem;
    margin-bottom: 0.4rem;
}
.card-sample h4 {
    margin: 0.4rem 0;
    color: var(--color-1);
}
.card-sample p {
    color: var(--color-3);
    margin-top: 0;
}
.card-sample .btn {
    background: var(--color-1);
    color: #fff;
    border: 0;
    padding: 0.6rem 1rem;
    border-radius: 8px;
    cursor: pointer;
}

/* Responsivo */
@media (max-width: 860px) {
    .preview {
        grid-template-columns: 1fr;
    }
    .wheel-wrap {
        grid-template-columns: 1fr;
    }
}

canvas {
    border-radius: 50%;
}

.wheel-controls input[type="range"],
.controls-grid input[type="range"] {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: #ddd;
    outline: none;
    appearance: none;
    transition: background 0.3s ease;
}

.wheel-controls input[type="range"]::-webkit-slider-thumb,
.controls-grid input[type="range"]::-webkit-slider-thumb {
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--color-accent);
    cursor: pointer;
    border: 2px solid white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
}

.wheel-controls input[type="range"]::-webkit-slider-thumb:hover,
.controls-grid input[type="range"]::-webkit-slider-thumb:hover {
    background: var(--color-primary);
    transform: scale(1.1);
}

.wheel-controls input[type="range"]::-moz-range-thumb,
.controls-grid input[type="range"]::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--color-accent);
    cursor: pointer;
    border: 2px solid white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
}

.wheel-controls input[type="range"]::-moz-range-thumb:hover,
.controls-grid input[type="range"]::-moz-range-thumb:hover {
    background: var(--color-primary);
    transform: scale(1.1);
}

.wheel-controls .range-value {
    font-size: 1.2rem;
    color: var(--color-accent);
    font-weight: bold;
    text-align: center;
    margin-top: 5px;
}

/* ===== Exemplos práticos de propriedades de cor ===== */
.color-demos {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.2rem;
}
.demo-card {
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    overflow: hidden;
    background: #fff;
    box-shadow: var(--shadow);
    display: grid;
    grid-template-rows: 180px auto;
}
.demo-preview {
    position: relative;
}
.demo-caption {
    padding: 0.8rem 1rem 1.2rem;
}
.demo-caption .cap-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.8rem;
}
.demo-caption h4 {
    margin: 0.4rem 0 0.6rem;
}
.demo-caption pre {
    background: #111827;
    color: #e5e7eb;
    padding: 0.8rem 1rem;
    border-radius: 8px;
    overflow: auto;
    font-size: 1.2rem;
}
.btn.tiny {
    padding: 0.25rem 0.6rem;
    font-size: 1.1rem;
    border-radius: 6px;
}

/* Responsivo: 1 coluna em telas pequenas */
@media (max-width: 820px) {
    .color-demos {
        grid-template-columns: 1fr;
    }
}

/* Cor sólida */
.demo-solid .demo-preview {
    background: crimson;
}

/* Gradiente linear */
.demo-linear .demo-preview {
    background: linear-gradient(to right, red, blue);
}

/* Gradiente radial */
.demo-radial .demo-preview {
    background: radial-gradient(circle, red, yellow, green);
}

/* Gradiente cônico */
.demo-conic .demo-preview {
    background: conic-gradient(from 90deg, red, yellow, green);
}

/* Imagem + cor com background-blend-mode */
.demo-blend .demo-preview {
    background-image: url("https://images.unsplash.com/photo-1500530855697-b586d89ba3ee?q=80&w=800&auto=format&fit=crop"),
        linear-gradient(135deg, rgba(239, 68, 68, 0.65), rgba(59, 130, 246, 0.65));
    background-size: cover;
    background-position: center;
    background-blend-mode: multiply;
}

/* Sombras coloridas */
.demo-shadow .demo-preview {
    display: grid;
    place-items: center;
    gap: 0.6rem;
    grid-auto-flow: row;
}
.demo-shadow .box {
    width: 72px;
    height: 72px;
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 6px 24px rgba(37, 99, 235, 0.35), 0 0 0 6px rgba(16, 185, 129, 0.25);
}
.demo-shadow .text {
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    font-weight: 800;
    color: #111;
    letter-spacing: 0.5px;
    text-shadow: 0 2px 0 rgba(239, 68, 68, 0.8), 0 4px 12px rgba(59, 130, 246, 0.5);
}

/* Filtros */
.demo-filters .demo-preview {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.8rem;
    padding: 0.8rem;
}
.demo-filters .tile {
    border-radius: 10px;
    background: linear-gradient(120deg, #ef4444, #f59e0b, #22c55e, #3b82f6);
}
.demo-filters .filtered {
    filter: hue-rotate(90deg) brightness(1.2);
}

/* Máscara com mask-image */
.demo-mask .demo-preview {
    background: linear-gradient(90deg, #3b82f6, #8b5cf6);
    -webkit-mask-image: radial-gradient(circle, #fff 60%, transparent 61%);
    mask-image: radial-gradient(circle, #fff 60%, transparent 61%);
}

/* Recorte com clip-path (estrela) */
.demo-clip .demo-preview {
    background: #f43f5e;
    -webkit-clip-path: polygon(50% 5%, 61% 35%, 95% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 5% 35%, 39% 35%);
    clip-path: polygon(50% 5%, 61% 35%, 95% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 5% 35%, 39% 35%);
}

/* Texto com gradiente */
.demo-gradtext .demo-preview {
    display: grid;
    place-items: center;
}
.demo-gradtext .grad-text {
    font-size: 1.6rem;
    font-weight: 800;
    background: linear-gradient(90deg, #ef4444, #3b82f6);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

/* accent-color */
.demo-accent .demo-preview {
    display: grid;
    place-content: center;
    gap: 0.6rem;
}
.demo-accent input[type="range"] {
    width: 160px;
}
.demo-accent input {
    accent-color: #6366f1;
}
