/**
 * Color Palette Generator - Coolors-style
 * Full viewport for toolbar + strip; content below can scroll.
 */

body.color-palette-page {
    min-height: 100vh;
    width: 100%;
    max-width: 100vw;
    overflow-x: hidden;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    margin: 0;
    padding: 0;
}

body.color-palette-page .color-palette-main {
    flex: 1;
    min-height: 100vh;
}

/* Hide footer on Color Palette page (template skips get_footer; this guards any edge case) */
body.color-palette-page .site-footer {
    display: none !important;
}

.color-palette-main {
    min-height: 100vh;
    padding: 0;
    margin: 0;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    background: #0f0f10;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    overflow: visible;
}

.color-palette-bar {
    flex-shrink: 0;
    padding: 12px 20px;
    background: #1a1a1c;
    border-bottom: 1px solid #2a2a2d;
}

.color-palette-hint {
    color: #9ca3af;
    font-size: 0.9rem;
    margin: 0 0 10px 0;
    text-align: center;
}

.color-palette-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.color-palette-toolbar-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border: none;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    background: #262628;
    color: #e5e5e5;
    transition: background 0.2s, color 0.2s;
}

.color-palette-toolbar-btn:hover {
    background: #3a3a3d;
    color: #fff;
}

.color-palette-toolbar-btn svg {
    flex-shrink: 0;
}

#palette-generate {
    background: #ED1C24;
    color: #fff;
}

#palette-generate:hover {
    background: #c9181f;
    color: #fff;
}

.color-palette-feedback {
    font-size: 0.8rem;
    color: #7dd392;
    margin-left: 8px;
}

/* Saved dropdown */
.color-palette-saved-wrap {
    position: relative;
}
.color-palette-saved-dropdown {
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    margin-top: 6px;
    min-width: 220px;
    max-height: 280px;
    overflow-y: auto;
    background: #1a1a1c;
    border: 1px solid #3a3a3d;
    border-radius: 8px;
    box-shadow: 0 10px 32px rgba(0, 0, 0, 0.5);
    z-index: 100;
    padding: 8px 0;
}
.color-palette-saved-dropdown[hidden] {
    display: none !important;
}
.color-palette-saved-list { list-style: none; margin: 0; padding: 0; }
.color-palette-saved-list li {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    cursor: pointer;
    transition: background 0.15s;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    color: #e5e5e5;
    font-size: 0.9rem;
}
.color-palette-saved-list li:hover { background: rgba(255, 255, 255, 0.08); }
.color-palette-saved-list .saved-swatch {
    display: flex;
    width: 48px;
    height: 24px;
    border-radius: 4px;
    overflow: hidden;
    flex-shrink: 0;
}
.color-palette-saved-list .saved-swatch span { flex: 1; height: 100%; }
.color-palette-saved-list .saved-name { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.color-palette-saved-list .saved-delete {
    padding: 4px;
    border: none;
    background: none;
    color: #9ca3af;
    cursor: pointer;
    border-radius: 4px;
    flex-shrink: 0;
}
.color-palette-saved-list .saved-delete:hover { color: #ef4444; background: rgba(239, 68, 68, 0.15); }
.color-palette-saved-empty { margin: 0; padding: 16px; color: #6b7280; font-size: 0.9rem; }
.color-palette-saved-list:not(:empty) ~ .color-palette-saved-empty { display: none; }

/* Grid wrapper for overlay - no overflow */
.color-palette-grid-wrap {
    position: relative;
    flex: 0 0 70vh;
    height: 70vh;
    min-height: 0;
    width: 100%;
    max-width: 100%;
    overflow: hidden;
}

/* SEO content section below the color strip */
.color-palette-intro {
    flex-shrink: 0;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    padding: 32px 20px 48px;
}

.color-palette-intro-inner {
    max-width: 720px;
    margin: 0 auto;
}

.color-palette-intro h2 {
    margin: 0 0 1rem;
    font-size: 1.35rem;
    font-weight: 600;
    color: #e5e5e5;
    line-height: 1.3;
    text-align: center;
}

.color-palette-intro p {
    margin: 0 0 1rem;
    font-size: 0.95rem;
    line-height: 1.7;
    color: #9ca3af;
    text-align: left;
}

.color-palette-intro p:last-child {
    margin-bottom: 0;
}

.color-palette-intro strong {
    color: #d1d5db;
    font-weight: 600;
}

/* Full-bleed grid - fits viewport, no scroll */
.color-palette-grid {
    display: grid;
    grid-template-columns: repeat(var(--palette-cols, 5), 1fr);
    gap: 0;
    height: 100%;
    min-height: 0;
    width: 100%;
    max-width: 100%;
    overflow: hidden;
}

/* Plus buttons between colors - show only on hover */
.color-palette-plus-overlay {
    position: absolute;
    left: 0;
    top: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    z-index: 4;
}

.color-palette-plus-zone {
    pointer-events: auto;
    position: absolute;
    top: 0;
    bottom: 0;
    width: 40px;
    margin-left: -20px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.color-palette-plus-between {
    position: relative;
    width: 48px;
    height: 48px;
    border: none;
    border-radius: 50%;
    background: #fff;
    color: #1a1a1c;
    font-size: 1.5rem;
    font-weight: 300;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.25);
    transition: opacity 0.2s ease, transform 0.15s ease, box-shadow 0.15s ease;
    opacity: 0;
}

.color-palette-plus-zone:hover .color-palette-plus-between {
    opacity: 1;
}

.color-palette-plus-zone:hover .color-palette-plus-between:hover {
    transform: scale(1.08);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.color-palette-plus-between:focus {
    opacity: 1;
    outline: 2px solid #ED1C24;
    outline-offset: 2px;
}

.color-palette-slot {
    position: relative;
    display: flex;
    flex-direction: column;
    min-height: 180px;
}

.color-palette-block {
    flex: 1;
    min-height: 120px;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    align-items: center;
    padding: 0 16px 36px 16px;
    position: relative;
    cursor: pointer;
    transition: filter 0.15s;
}

.color-palette-block:hover {
    filter: brightness(1.03);
}

.color-palette-block:focus {
    outline: 2px solid rgba(255, 255, 255, 0.6);
    outline-offset: -2px;
}

/* Hover actions - centered in the color block, visible on slot hover */
.color-palette-hover-actions {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    flex-direction: column;
    gap: 4px;
    opacity: 0;
    transition: opacity 0.2s ease;
    z-index: 5;
}

.color-palette-slot:hover .color-palette-hover-actions {
    opacity: 1;
}

.color-palette-hover-btn {
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 6px;
    background: rgba(0, 0, 0, 0.45);
    color: #fff;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, color 0.2s;
}

.color-palette-hover-btn:hover {
    background: rgba(0, 0, 0, 0.7);
    color: #fff;
}

.color-palette-slot[data-locked="true"] .color-palette-lock {
    background: #ED1C24;
    color: #fff;
}

.color-palette-slot[data-locked="true"] .color-palette-lock:hover {
    background: #c9181f;
}

.color-palette-slot[data-favorite="true"] .color-palette-favorite {
    color: #f472b6;
    fill: #f472b6;
}

.color-palette-slot[data-favorite="true"] .color-palette-favorite:hover {
    color: #f9a8d4;
}

.color-palette-picker {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    opacity: 0;
    cursor: pointer;
    border: none;
}

/* Footer: hex (no #) + color name, centered; click to copy hex */
.color-palette-block-footer {
    padding: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    text-align: center;
    cursor: pointer;
    width: 100%;
}

.color-palette-hex {
    font-family: ui-monospace, monospace;
    font-size: 1.1rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.9);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
    user-select: all;
    letter-spacing: 0.04em;
}

.color-palette-name {
    font-size: 0.9rem;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.95);
    text-shadow: 0 1px 1px rgba(0, 0, 0, 0.3);
}

.color-palette-block-footer:hover .color-palette-hex,
.color-palette-block-footer:hover .color-palette-name {
    color: #fff;
}

/* Dark blocks: lighter text */
.color-palette-slot .color-palette-block[data-dark="true"] .color-palette-hex,
.color-palette-slot .color-palette-block[data-dark="true"] .color-palette-name {
    color: rgba(255, 255, 255, 0.95);
}

/* Info popover */
.color-palette-info-popover {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    min-width: 260px;
    padding: 16px 20px 16px 16px;
    background: #1a1a1c;
    border: 1px solid #3a3a3d;
    border-radius: 12px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
    z-index: 1000;
    display: flex;
    align-items: flex-start;
    gap: 14px;
}

.color-palette-info-popover[hidden] {
    display: none !important;
}

.color-palette-info-popover-swatch {
    width: 48px;
    height: 48px;
    border-radius: 8px;
    flex-shrink: 0;
    border: 2px solid rgba(255, 255, 255, 0.2);
}

.color-palette-info-popover-values {
    flex: 1;
    font-size: 0.9rem;
    color: #e5e5e5;
    line-height: 1.6;
    font-family: ui-monospace, monospace;
}

.color-palette-info-popover-close {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 28px;
    height: 28px;
    border: none;
    background: none;
    color: #9ca3af;
    font-size: 1.25rem;
    cursor: pointer;
    border-radius: 4px;
    line-height: 1;
}

.color-palette-info-popover-close:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
}
