@import url("https://fonts.googleapis.com/css2?family=Lexend:wght@100..900&display=swap");

/*
Look at you, hacker! Sneaking a peek at my code... Or are you considering becoming a client?
Get a job, or better yet, hire my agency - FeysMedia. Let's talk business!
Call us now or drop an email:

FeysMedia e.U.
+436606787039
office@feysmedia.at

Inspiration for the effect: codepen.io
 */

:root {
  --hue: 134;

  --bg-blur: 10px;

  --tile-sz: 11vw;
  --input-bg: hsla(var(--hue), 65%, 90%, 0.4);
  --output-bg: var(--input-bg);
  --input-bs: 0 8px 32px rgba(0, 0, 0, 0.25),
  inset 0 1px 0 rgba(255, 255, 255, 0.5),
  inset 0 -1px 0 rgba(255, 255, 255, 0.1),
  inset 0 0 10px 10px rgba(255, 255, 255, 0.5);
  --output-bs: var(--input-bs);
  --input-border: 1px solid rgba(255, 255, 255, 0.3);
  --output-border: var(--input-border);

  --slider-thumb-bg: #f5f5f5;
  --slider-thumb-bs: 1px 1px 1px #000000, 0px 0px 1px #0d0d0d;

  --slider-track-bg: #666666;
  --slider-track-bs: 1px 1px 1px #000000, 0px 0px 1px #0d0d0d;

  --output-tile-bs: 0px 8px 16px rgba(0, 0, 0, 0.35),
  0 0px 12px rgba(255, 255, 255, 0.1);
  --output-tile-border: 1px solid rgba(255, 255, 255, 0.5);
  --output-tile-border-hover: 1px solid rgba(255, 255, 255, 1);
}

body {
  font-family: "Lexend", sans-serif;
  margin: 0;
  height: 100vh;
  /* 	overflow: clip; */
  background: radial-gradient(
    hsl(var(--hue), 65%, 90%),
    hsl(var(--hue), 65%, 50%),
    hsl(var(--hue), 65%, 20%)
  );
  display: grid;
  gap: 6px;
  place-content: center;
}



/* Input Section */
.hue-input {
  width: 100%;
  display: grid;
  padding: 0.5rem 1.25rem 1rem 1.25rem;
  gap: 0;
  background-color: var(--input-bg);
  border-radius: 24px;
  border: var(--input-border);
  box-shadow: var(--input-bs);
  backdrop-filter: blur(var(--bg-blur));
  -webkit-backdrop-filter: blur(var(--bg-blur));
}

/* Styling the Slider */
input[type="range"] {
  -webkit-appearance: none;
  width: 100%;
  background: transparent;
}

/* thumb */
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  background: var(--slider-thumb-bg);
  height: 36px;
  width: 12px;
  border-radius: 5px;
  margin-top: -10px;
  cursor: pointer;
  box-shadow: var(--slider-thumb-bs);
}

input[type="range"]::-moz-range-thumb {
  background: var(--slider-thumb-bg);
  height: 36px;
  width: 12px;
  border-radius: 5px;
  cursor: pointer;
  box-shadow: var(--slider-thumb-bs);
}

/* track */
input[type="range"]::-webkit-slider-runnable-track {
  width: 100%;
  height: 8.4px;
  cursor: pointer;
  box-shadow: var(--slider-track-bs);
  background: var(--slider-track-bg);
  border-radius: 2px;
  border: 0.2px solid #010101;
}

input[type="range"]::-moz-range-track {
  width: 100%;
  height: 8.4px;
  cursor: pointer;
  box-shadow: var(--slider-track-bs);
  background: var(--slider-track-bg);
  border-radius: 2px;
  border: 0.2px solid #010101;
}

/* focus */
input[type="range"]:focus {
  outline: none;
  background: transparent;
  border-color: transparent;
  color: transparent;
}

/* Rest of range box */
.hue-input h2 {
  justify-self: center;
  font-weight: 600;
}

.hue-input h2 .hue-value {
  font-weight: 900;
}

/* Output Section */
.range-output {
  width: 100%;
  display: flex;
  flex-flow: column wrap;
  place-content: center;
  gap: 2px;
  padding: 0.5rem 1.25rem 1rem 1.25rem;
  background-color: var(--output-bg);
  border-radius: 24px;
  box-shadow: var(--output-bs);
  border: var(--output-border);
  backdrop-filter: blur(var(--bg-blur));
  -webkit-backdrop-filter: blur(var(--bg-blur));
}

.output-row {
  width: 100%;
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  place-items: center;
  /* 	gap: 10px; */
}

.output-row p {
  font-size: 10px;
  font-weight: 600;
}

.output-tile-grp {
  display: flex;
  flex-flow: row nowrap;
  justify-content: space-between;
  width: 100%;
}

#labels {
  display: flex;
  flex-flow: row wrap;
  justify-content: space-between;
  text-align: center;
  row-gap: 0px;
  margin-bottom: -16px;
  color: #444444;
}

#labels p:first-of-type {
  width: 100%;
}

#labels p:nth-of-type(n + 2) {
  width: 22%;
}

.output-tile {
  border: var(--output-tile-border);
  min-width: 58px;

  min-height: 58px;
  max-width: 100px;
  max-height: 100px;
  width: var(--tile-sz);
  height: var(--tile-sz);
  border-radius: 8px;
  box-shadow: var(--output-tile-bs);
  transition: all 0.3s ease-out;
  z-index: 5;
}

.output-tile:hover {
  transform: scale(1.1);
  border: var(--output-tile-border-hover);
}

@media (max-width: 480px) {
  .hue-input {
    padding: 1rem 0.8rem;
  }

  input[type="range"] {
    width: 300px;
    place-self: center;
  }

  .range-output {
    position: relative;
    gap: 12px;
    padding: 0.5rem 1rem 1rem 1rem;
    z-index: 1;
  }

  .output-row {
    display: flex;
    flex-flow: row wrap;
  }

  .output-row p {
    text-align: center;
    font-size: 8px;
  }

  .output-tile-grp {
    display: flex;
    flex-flow: row wrap;
    gap: 4px;
  }

  .output-tile {
    position: relative;
    width: 60px;
    height: 60px;
    z-index: 2;
  }
}

/* Tile + Label wrapper */
.tile-with-label {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px; /* space between tile and label */
}

.tile-hex {
  font-size: 16px;
  color: #333; /* softer text */
  font-family: monospace;
}

/* === Updated nth-of-type selectors === */

/* Saturation 50% */
#sat50 .output-tile-grp .tile-with-label:nth-of-type(1) .output-tile {
  background-color: hsl(var(--hue), 50%, 20%);
}
#sat50 .output-tile-grp .tile-with-label:nth-of-type(2) .output-tile {
  background-color: hsl(var(--hue), 50%, 40%);
}
#sat50 .output-tile-grp .tile-with-label:nth-of-type(3) .output-tile {
  background-color: hsl(var(--hue), 50%, 60%);
}
#sat50 .output-tile-grp .tile-with-label:nth-of-type(4) .output-tile {
  background-color: hsl(var(--hue), 50%, 80%);
}

/* Saturation 75% */
#sat75 .output-tile-grp .tile-with-label:nth-of-type(1) .output-tile {
  background-color: hsl(var(--hue), 75%, 20%);
}
#sat75 .output-tile-grp .tile-with-label:nth-of-type(2) .output-tile {
  background-color: hsl(var(--hue), 75%, 40%);
}
#sat75 .output-tile-grp .tile-with-label:nth-of-type(3) .output-tile {
  background-color: hsl(var(--hue), 75%, 60%);
}
#sat75 .output-tile-grp .tile-with-label:nth-of-type(4) .output-tile {
  background-color: hsl(var(--hue), 75%, 80%);
}

/* Saturation 25% */
#sat25 .output-tile-grp .tile-with-label:nth-of-type(1) .output-tile {
  background-color: hsl(var(--hue), 25%, 20%);
}
#sat25 .output-tile-grp .tile-with-label:nth-of-type(2) .output-tile {
  background-color: hsl(var(--hue), 25%, 40%);
}
#sat25 .output-tile-grp .tile-with-label:nth-of-type(3) .output-tile {
  background-color: hsl(var(--hue), 25%, 60%);
}
#sat25 .output-tile-grp .tile-with-label:nth-of-type(4) .output-tile {
  background-color: hsl(var(--hue), 25%, 80%);
}


.background-text {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  grid-auto-rows: 40px;
  color: rgba(255,255,255,0.05);
  font-size: 24px;
  font-weight: bold;
  text-transform: uppercase;
  pointer-events: none;
  z-index: 0;
  overflow: hidden; /* ensures no scrollbars */
}




.background-text span {
  display: flex;
  align-items: center;
  justify-content: center;
}


/* Wrap for slider + rainbow bar */
.hue-slider-wrap {
  position: relative;
  width: 100%;
  height: 36px;
  border-radius: 8px;
  background: linear-gradient(
    to right,
    hsl(0, 100%, 50%),
    hsl(60, 100%, 50%),
    hsl(120, 100%, 50%),
    hsl(180, 100%, 50%),
    hsl(240, 100%, 50%),
    hsl(300, 100%, 50%),
    hsl(360, 100%, 50%)
  );
  margin-bottom: 0.5rem;
}

/* Make slider input transparent, so gradient shows behind */
.hue-slider-wrap input[type="range"] {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: transparent;
}

/* Swatch next to the hue value */
.hue-swatch {
  display: inline-block;
  width: 24px;
  height: 24px;
  margin-left: 8px;
  border-radius: 4px;
  border: 1px solid rgba(0,0,0,0.2);
  vertical-align: middle;
}


/* === Slider Styling with rainbow + track === */
.hue-slider-wrap {
  position: relative;
  width: 100%;
  height: 36px;
  border-radius: 12px;
  background: linear-gradient(
    to right,
    hsl(0, 100%, 50%),
    hsl(60, 100%, 50%),
    hsl(120, 100%, 50%),
    hsl(180, 100%, 50%),
    hsl(240, 100%, 50%),
    hsl(300, 100%, 50%),
    hsl(360, 100%, 50%)
  );
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 6px;
  box-sizing: border-box;
}

/* Grey bar track */
.hue-slider-wrap::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 6px;
  right: 6px;
  height: 8px;
  border-radius: 4px;
  background: #666;
  box-shadow: inset 0 1px 1px rgba(0,0,0,0.6),
  inset 0 -1px 1px rgba(255,255,255,0.4);
  transform: translateY(-50%);
}

/* Range input (transparent over track) */
.hue-slider-wrap input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 36px;
  background: transparent;
  position: relative;
  z-index: 2; /* above track */
  margin: 0;
  padding: 0;
  cursor: pointer;
}

/* Thumb */
.hue-slider-wrap input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #f5f5f5;
  border: 2px solid #222;
  box-shadow: 0 0 2px rgba(0,0,0,0.6);
  cursor: pointer;
}
.hue-slider-wrap input[type="range"]::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #f5f5f5;
  border: 2px solid #222;
  box-shadow: 0 0 2px rgba(0,0,0,0.6);
  cursor: pointer;
}
