@import url('https://fonts.googleapis.com/css2?family=DM+Serif+Text&family=Lato:wght@400;700&display=swap');

/* Copyright 2025 unschooled.art */

/* --- General Body & Layout --- */
body {
    font-family: 'Lato', Arial, sans-serif;
    margin: 0;
    padding: 0;
    background-color: #e6e6e6;
    color: #333;
    line-height: 1.6;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

main {
    flex-grow: 1;
    padding: 1rem;
    max-width: 1200px;
    width: 90%;
    margin: 20px auto;
}

/* --- Header & Footer --- */
header, footer {
    background-color: #000000;
    color: #ecf0f1;
    padding: 1rem;
    text-align: center;
}

header {
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

header h1 {
    font-family: 'DM Serif Text', serif;
    margin: 0;
    font-size: 2.2em;
    font-weight: 400;
}

header p {
    font-family: 'Lato', Arial, sans-serif;
    margin-top: 0.5rem; /* Increased top margin */
    margin-bottom: 0;
    color: #ccc;
    max-width: 800px; /* Constrain width for readability */
    margin-left: auto; /* Center the block */
    margin-right: auto; /* Center the block */
    font-size: 1em;
}

/* --- Navigation Bar Styles --- */
nav {
  max-width: 1200px;
  width: 90%;
  margin: 20px auto 0 auto;
  background-color: #000;
  overflow: hidden;
  border-radius: 12px;
  padding: 8px 0;
}

nav ul {
  list-style-type: none;
  margin: 0;
  padding: 0;
  display: flex;
  justify-content: center;
  gap: 30px;
  font-family: 'Lato', sans-serif;
  text-transform: uppercase;
}

nav a {
  display: block;
  color: white;
  text-align: center;
  padding: 8px 10px;
  text-decoration: none;
  font-size: 0.9em;
}

nav a:hover {
  background-color: #000;
  color: white;
  text-decoration: underline;
}

@media (max-width: 768px) {
  nav ul {
    gap: 15px;
  }
}
@media (max-width: 480px) {
  nav ul {
    flex-wrap: wrap;
    gap: 10px 20px;
  }
}


footer {
    margin-top: 2rem;
    font-size: 0.9em;
    color: #bdc3c7;
    padding: 2rem; /* Increased padding */
}

.footer-content {
    max-width: 800px;
    margin: 0 auto 2rem auto; /* Center content and add space below */
    text-align: left; /* Align text to the left for readability */
}

.footer-content h2 {
    font-family: 'DM Serif Text', serif;
    font-weight: 400;
    font-size: 1.5em;
    text-align: center;
    margin-bottom: 1rem;
}

.footer-content p {
    color: #ccc;
    line-height: 1.7;
}

.copyright {
    font-size: 0.8em;
    color: #888;
    margin-top: 1rem;
}

/* --- Main Control Panel Section --- */
.control-panel {
    margin-top: 2.5rem;
    margin-bottom: 2.5rem;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    align-items: stretch;
}

.panel-card {
    background-color: #ffffff;
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

@media (max-width: 992px) {
    .control-panel {
        grid-template-columns: 1fr;
    }
}

.panel-column {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
}

.input-header {
    font-family: 'DM Serif Text', serif;
    font-weight: 400;
    margin-top: 0;
    font-size: 1.2em;
}

.input-controls {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 1.5rem;
    margin-top: 1rem;
}

.or-divider {
    font-weight: 600;
    color: #aaa;
}

/* --- HSL Slider Styles --- */
.slider-controls {
    width: 100%;
    max-width: 350px;
    margin-top: 2rem;
    border-top: 1px solid #eee;
    padding-top: 2rem;
}

.slider-group {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 0.5rem;
}

.slider-group label {
    font-weight: 700;
    width: 85px;
    text-align: left;
}

.slider-group span {
    font-weight: 600;
    width: 35px;
    text-align: right;
}

input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    flex-grow: 1;
    height: 8px;
    background: #ddd;
    outline: none;
    border-radius: 4px;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    background: #000;
    cursor: pointer;
    border-radius: 50%;
}

input[type="range"]::-moz-range-thumb {
    width: 20px;
    height: 20px;
    background: #000;
    cursor: pointer;
    border-radius: 50%;
    border: none;
}

.hidden {
    display: none;
}

.image-palette-section.hidden {
    display: none;
}

input[type="color"] {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    width: 60px;
    height: 60px;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    background-color: transparent;
    box-shadow: 0 0 0 3px #fff, 0 0 0 5px #ccc;
    transition: box-shadow 0.2s;
}
input[type="color"]::-webkit-color-swatch {
    border-radius: 50%;
    border: none;
}
input[type="color"]::-moz-color-swatch {
    border-radius: 50%;
    border: none;
}
input[type="color"]:hover {
    box-shadow: 0 0 0 3px #fff, 0 0 0 5px #3498db;
}


button {
    padding: 0.8rem 2rem;
    font-size: 1rem;
    font-weight: 600;
    color: #fff;
    background-color: #000000;
    border: none;
    border-radius: 30px;
    cursor: pointer;
    transition: background-color 0.2s, transform 0.2s;
}

button:hover {
    background-color: #333333;
    transform: translateY(-2px);
}

.button-secondary {
    background-color: transparent;
    color: #555555;
    border: 1px solid #555555;
    margin-top: 1.5rem;
    font-weight: normal;
    padding: 0.6rem 1.5rem;
    font-size: 0.9rem;
}

.button-secondary:hover {
    background-color: #555555;
    color: #ffffff;
}


/* --- Image Palette Section --- */
.image-palette-section {
    background-color: #ffffff;
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    margin-bottom: 2.5rem;
    display: flex;
    flex-wrap: wrap;
    gap: 2rem;
    align-items: center;
}

.image-preview-container {
    flex: 1;
    min-width: 200px;
}

#imagePreview {
    max-width: 100%;
    height: auto;
    max-height: 250px;
    border-radius: 8px;
    object-fit: contain;
}

.extracted-palette-container {
    flex: 2;
}

.extracted-palette-container p {
    margin-top: 0;
    font-weight: 600;
}

#extractedPalette {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
}

.extracted-swatch {
    width: 50px;
    height: 50px;
    border-radius: 8px;
    cursor: pointer;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
    transition: transform 0.2s;
    border: 2px solid #fff;
}

.extracted-swatch:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

/* --- Color Wheel Section --- */
.color-wheel-container {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 1.5rem;
}

#colorWheelCanvas {
    cursor: pointer;
    max-width: 100%;
    height: auto;
}

.wheel-controls {
    text-align: center;
}

.wheel-controls label {
    display: block;
    font-weight: 400;
    margin-bottom: 0.25rem;
    font-family: 'DM Serif Text', serif;
    font-size: 1.3em;
}

.wheel-instructions {
    font-size: 0.9em;
    color: #666;
    margin: 0 0 1.25rem 0;
    max-width: 240px;
    line-height: 1.4;
}

.select-wrapper {
    position: relative;
    display: inline-block;
}

.select-wrapper::after {
    content: '▼';
    font-size: 1rem;
    color: #fff;
    background-color: #000000;
    padding: 0 0.8rem;
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    pointer-events: none;
    border-radius: 0 30px 30px 0;
    display: flex;
    align-items: center;
}

#harmonySelector {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    padding: 0.8rem 3rem 0.8rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    color: #2c3e50;
    background-color: #ecf0f1;
    border: 2px solid #bdc3c7;
    border-radius: 30px;
    cursor: pointer;
    font-family: 'Lato', Arial, sans-serif;
}

/* --- Schemes Output Section --- */
.schemes-output-section {
    /* This container is now primarily for spacing */
}

.schemes-output-section .scheme {
    background-color: #ffffff;
    padding: 1.5rem 2rem;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    margin-bottom: 2rem;
    position: relative;
}

.schemes-output-section .scheme h2 {
    font-family: 'DM Serif Text', serif;
    font-weight: 400;
    margin-top: 0;
    font-size: 1.5em;
    color: #2c3e50;
    border-bottom: 1px solid #e0e0e0;
    padding-bottom: 0.75rem;
}

.palette {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-top: 1.5rem;
}

.color-box {
    flex: 1;
    min-width: 120px;
    height: 160px;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    font-weight: 600;
    color: #fff;
    text-align: center;
    box-shadow: 0 2px 5px rgba(0,0,0,0.15);
    padding-bottom: 10px;
    transition: transform 0.2s, box-shadow 0.2s;
}

.color-box:hover {
    transform: translateY(-5px);
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
}

.color-box span {
    background-color: rgba(0, 0, 0, 0.4);
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.9em;
}

/* --- Responsive Two-Column Layout for Scheme Results --- */
@media (min-width: 900px) {
  .schemes-output-section.grid-view {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 2rem;
  }

  .schemes-output-section.grid-view .scheme {
    margin-bottom: 0;
  }

  .schemes-output-section.grid-view .scheme:first-child {
    grid-column: 1 / -1;
  }
}

/* --- Download Icon Styles --- */
.download-btn {
    position: absolute;
    top: 1.5rem;
    right: 2rem;
    cursor: pointer;
    opacity: 0.6;
    transition: opacity 0.2s ease-in-out;
}

.download-btn:hover {
    opacity: 1;
}

.download-btn svg {
    width: 24px;
    height: 24px;
    fill: #2c3e50;
}

/* --- Download All Button Section --- */
.download-all-section {
    text-align: center;
    margin-top: 2rem; 
}