/* =====================
   CSS VARIABLES
===================== */
:root {
  --font-main: "Outfit", sans-serif;

  --clr-dark: #2f2820;
  --clr-muted: #a39e9a;
  --clr-border: #c1bdb9;

  --clr-bg-light: #f1eee9;
  --clr-bg-gray: #ebe7df;
  --clr-primary: #ca5c5b;

  --radius-sm: 4px;
  --radius-md: 12px;
  --radius-lg: 16px;

  --gap-sm: 8px;
  --gap-md: 16px;
  --gap-lg: 26px;
}

/* =====================
   RESET & BASE
===================== */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-main);
  font-size: 1rem;
}

main {
  height: 100vh;
}

/* =====================
   FLEX HELPERS
===================== */
.flex {
  display: flex;
  flex-wrap: wrap;
  height: 100%;
}

.center-column {
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* =====================
   PANELS
===================== */
.panel {
  flex: 1;
  min-width: 468px;
  min-height: 0;
  padding: 40px 80px;
}

.label {
  color: var(--clr-dark);
}

/* =====================
   COLOR PALETTE
===================== */
.color-palette {
  position: relative;
  background-color: var(--clr-bg-gray);
}

.color-palette::before {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.2;
  background: url(images/CA_Illustration-1.png) no-repeat;
  background-size: 120%;
  background-position: 160% 100%;
}

.color-palette > * {
  position: relative;
  z-index: 1;
}

/* =====================
   PALETTE & CARDS
===================== */
.palette {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--gap-md);
  margin-top: var(--gap-md);
}

.color-box {
  display: flex;
  flex-direction: column;
}

.card-title {
  align-self: center;
  font-weight: 700;
}

.color-card {
  width: 200px;
  height: 380px;
  margin-top: 6px;
  margin-bottom: 10px;
  border-radius: var(--radius-lg);
  box-shadow: rgba(0, 0, 0, 0.45) 0px 25px 20px -20px;
}

.color-picker-container {
  display: flex;
  align-items: center;
  gap: var(--gap-sm);
}

.color-picker-wrapper {
  position: relative;
  top: 3px;
  left: 3px;
}

.color-picker {
  -webkit-appearance: none;
  appearance: none;
  border: var(--clr-border);
  padding: 0;
  background: none;
  cursor: pointer;
  height: 30px;
  width: 30px;
  border-radius: 100%;  
  opacity: 0;
  position: absolute;
  top: 0;
  left: 0;
}

.color-icon img {
  width: 30px;
  height: 30px;
  pointer-events: none; /* so click passes to input */
}

.color-picker::-webkit-color-swatch-wrapper {
  padding: 0;
} 

.color-picker::-webkit-color-swatch {
  border: var(--clr-border);
}

input[type="color"]:focus-visible {
  outline: 2px solid #000;
  outline-offset: 2px;
}

/* =====================
   VISUALIZATION
===================== */
.visualization {
  background-color: var(--clr-bg-light);
}

.viz {
  display: flex;
  flex-direction: column;
  gap: var(--gap-lg);
  margin-top: var(--gap-md);
}

.viz-card {
  padding: 16px 24px;
  
  border-radius: var(--radius-lg);
  box-shadow: rgba(0, 0, 0, 0.1) 0px 1px 3px 0px, rgba(0, 0, 0, 0.06) 0px 1px 2px 0px;
}

.viz-row {
  display: flex;
  gap: var(--gap-lg);
}

.viz-row div {
  background-color: #fff;
}

/* =====================
   WCAG RESULT
===================== */

.wcag {
  margin-top: var(--gap-lg);
  display: flex;
  gap: 4rem;
}

.result-container div {
  display: flex;
  justify-content: space-between;
  gap: 16px;
}

.result-container div p:first-child {
  color: var(--clr-muted);  
}

/* =====================
   CONTROLS
===================== */
.controls {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 14px;
  margin-top: 70px;
}

.checkbox {
    user-select: none;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.checkbox input {
  appearance: none;
  -webkit-appearance: none;

  width: 18px;
  height: 18px;
  border: 2px solid #555;
  border-radius: 4px;
  cursor: pointer;
  position: relative;
}

.checkbox input:checked {
  background-color: #ffffff;
  border-color: #000000;
}

.checkbox input:checked::after {
  content: "";
  position: absolute;
  left: 4px;
  top: 0px;
  width: 5px;
  height: 10px;
  border: solid #000000;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

/* =====================
   BUTTON
===================== */
button {
  display: flex;
  align-items: center;
  gap: var(--gap-sm);
  padding: 12px;
  border: none;
  border-radius: var(--radius-md);
  font-size: 20px;
  font-weight: 300;
  background-color: var(--clr-primary);
  color: #fff;
  cursor: pointer;
  user-select: none;
  font-family: var(--font-main);
}

button:active {
  transform: scale(0.98);
}

button img {
  height: 2rem;
}

/* =====================
   RESPONSIVE — TABLET
===================== */
@media (max-width: 1024px) {
  main {
    height: auto;
    min-height: 100vh;
  }

  .flex {
    flex-direction: column;
    min-height: 100vh;
  }

  .panel {
    min-width: 320px;
    padding: 32px 40px;
  }

  .color-card {
    width: 160px;
    height: 300px;
  }

  .controls {
    margin-top: 32px;
  }

  .viz-row {
    flex-wrap: wrap;
  }

  .wcag {
    flex-wrap: wrap;
  }
}

/* =====================
   RESPONSIVE — PHONE
===================== */
@media (max-width: 600px) {
  .panel {
    min-width: 0;
    width: 100%;
    padding: 24px 20px;
  }

  .flex {
    flex-direction: column;
  }

  .palette {
    flex-direction: column;
    align-items: center;
    gap: var(--gap-lg);
  }

  .color-box {
    width: 100%;
    max-width: 280px;
  }

  .color-card {
    width: 100%;
    max-width: 280px;
    height: 200px;
    margin-left: auto;
    margin-right: auto;
  }

  .color-picker-container {
    justify-content: center;
  }

  .controls {
    margin-top: 24px;
    width: 100%;
    align-items: stretch;
  }

  button {
    width: 100%;
    justify-content: center;
    padding: 10px 12px;
    font-size: 1rem;
    min-height: 48px;
  }

  .checkbox {
    padding: 4px 0;
  }

  .viz-card {
    padding: 20px 16px;
  }

  .viz-row {
    flex-direction: column;
    gap: var(--gap-md);
  }

  .wcag {
    flex-direction: column;
    margin-top: var(--gap-md);
    gap: var(--gap-md);
  }

  .wcag-result h4 {
    font-size: 0.9375rem;
  }

  .result-container div {
    justify-content: start;
  }

  .color-palette::before {
    background-size: 100%;
    background-position: 80% 100%;
    opacity: 0.15;
  }

  h2.label {
    font-size: 1.125rem;
    text-align: center;
  }

  .card-title {
    font-size: 0.875rem;
  }
}

@media (max-width: 380px) {
  .panel {
    padding: 20px 16px;
  }

  .color-card {
    height: 180px;
  }
}

/* =====================
   RESPONSIVE — DESKTOP SCALING
===================== */
@media (min-width: 768px) {
  body {
    font-size: 1.0625rem; /* 17px */
  }
}

@media (min-width: 1440px) {
  body {
    font-size: 1.125rem; /* 18px */
  }
}