/* korriwan.com: the glass tint control in the header. */
@layer header {
  /* the glass tint: a round button that opens out, to the left, into a slider */
  .tint {
    display: flex;
    flex-direction: row-reverse;   /* the button keeps its place on the right */
    align-items: center;
    overflow: hidden;
    width: 38px;
    height: 38px;
    border: 1px solid var(--line);
    border-radius: 19px;
    box-shadow: var(--lift);
    transition: width .5s cubic-bezier(.3, 1.25, .4, 1), background-color .2s ease;
  }
  .tint[data-open] { width: var(--tint-w, 204px); }
  .tint:not([data-open]):hover { background: var(--glass-strong); }
  .tint-btn {
    flex: none;
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: none;
    cursor: pointer;
  }
  .tint-btn:focus-visible { outline-offset: -4px; }
  .tint-btn .half {
    fill: var(--ink);
    stroke: none;
    opacity: calc(.15 + var(--tint) * .85);   /* the icon fills as the glass does */
  }
  .tint-range {
    --fill: calc(10px + var(--p, .6) * (100% - 20px));   /* where the thumb's centre sits along the track */
    -webkit-appearance: none;
    appearance: none;
    flex: none;
    width: calc(var(--tint-w, 204px) - 58px);
    height: 36px;                  /* a tall area to catch a finger around a thin track */
    margin: 0 6px 0 14px;
    padding: 0;
    background: none;
    cursor: pointer;
    visibility: hidden;
    opacity: 0;
    transition: opacity .15s ease, visibility 0s .5s;
  }
  .tint[data-open] .tint-range {
    visibility: visible;
    opacity: 1;
    transition: opacity .3s ease .15s, visibility 0s;
  }
  .tint-range::-webkit-slider-runnable-track {
    height: 4px;
    border-radius: 2px;
    background: linear-gradient(to right, var(--ink) var(--fill), color-mix(in srgb, var(--ink) 20%, transparent) var(--fill));
  }
  .tint-range::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    margin-top: -8px;              /* centres the thumb on the track */
    border: 0;
    border-radius: 50%;
    background: var(--spark);
    box-shadow: 0 0 0 .5px var(--line), 0 1px 4px var(--shade);
  }
  .tint-range::-moz-range-track {
    height: 4px;
    border-radius: 2px;
    background: color-mix(in srgb, var(--ink) 20%, transparent);
  }
  .tint-range::-moz-range-progress {
    height: 4px;
    border-radius: 2px;
    background: var(--ink);
  }
  .tint-range::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border: 0;
    border-radius: 50%;
    background: var(--spark);
    box-shadow: 0 0 0 .5px var(--line), 0 1px 4px var(--shade);
  }
  .tint-range:focus-visible { outline: none; }
  .tint-range:focus-visible::-webkit-slider-thumb { box-shadow: 0 0 0 2px var(--focus), 0 1px 4px var(--shade); }
  .tint-range:focus-visible::-moz-range-thumb { box-shadow: 0 0 0 2px var(--focus), 0 1px 4px var(--shade); }
  @media (prefers-reduced-motion: reduce) {
    .tint, .tint-range, .tint[data-open] .tint-range { transition: none; }
  }
}
