/* Koukousk Solutions UI: tokens for the web.
   Derived from the Squirt Mac app; the web translation has not been reviewed by the owner.
   Read references/web.md before using. */

:root {
  color-scheme: light dark;

  /* Surface: neutral graphite, lit from above. */
  --stage: #e6e6e2;
  --surface-top: #fefefc;
  --surface-foot: #f4f4f0;
  --ink: #1b1e22;            /* the opposite of the surface, solid */
  --text: #1c1c1e;
  --text-soft: #5c5c62;
  --rule: rgba(0, 0, 0, 0.1);

  /* The one accent. Swap this block to change fruit. */
  --accent: #ff7a1a;
  --on-accent: #ffffff;

  /* One measure. */
  --gap: 19px;               /* between separate things, and from the edges */
  --gap-in: 9px;             /* between the parts of one thing */

  /* Glass. */
  --glass-fill: rgba(255, 255, 255, 0.55);
  --glass-rim: rgba(255, 255, 255, 0.7);
  --lens-fill: rgba(255, 255, 255, 0.75);

  /* Type. */
  --display: "Futura", "Futura-Bold", "Jost", "Avenir Next", sans-serif;
  --body: -apple-system, system-ui, "Segoe UI", sans-serif;

  /* Motion. */
  --rise: 450ms cubic-bezier(0.3, 1.3, 0.5, 1);
  --glide: 360ms cubic-bezier(0.3, 0.9, 0.3, 1);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --stage: #141416;
    --surface-top: #292a2d;
    --surface-foot: #1c1d1f;
    --ink: #eceef0;
    --text: #f2f2f2;
    --text-soft: #a9a9ae;
    --rule: rgba(255, 255, 255, 0.12);
    --glass-fill: rgba(255, 255, 255, 0.08);
    --glass-rim: rgba(255, 255, 255, 0.16);
    --lens-fill: rgba(255, 255, 255, 0.16);
  }
}
:root[data-theme="dark"] {
  --stage: #141416; --surface-top: #292a2d; --surface-foot: #1c1d1f; --ink: #eceef0;
  --text: #f2f2f2; --text-soft: #a9a9ae; --rule: rgba(255, 255, 255, 0.12);
  --glass-fill: rgba(255, 255, 255, 0.08); --glass-rim: rgba(255, 255, 255, 0.16); --lens-fill: rgba(255, 255, 255, 0.16);
}

/* Other accents offered. */
:root[data-accent="lemon"]      { --accent: #c79500; --on-accent: #1c1c1e; }
:root[data-accent="lime"]       { --accent: #4f9a12; --on-accent: #1c1c1e; }
:root[data-accent="grapefruit"] { --accent: #e8574a; }
:root[data-accent="cherry"]     { --accent: #c9152f; }
:root[data-accent="grape"]      { --accent: #7a45e0; }

body {
  margin: 0;
  background: linear-gradient(var(--surface-top), var(--surface-foot)) fixed, var(--stage);
  color: var(--text);
  font: 16px/1.5 var(--body);
}

/* The few big lines. */
.display {
  font-family: var(--display);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: -0.02em;
  line-height: 1.05;
}

/* One shape for every piece of glass: soft corners, about 0.3 of its height, 14px at most. */
.glass {
  --h: 44px;
  height: var(--h);
  border-radius: min(calc(var(--h) * 0.3), 14px);
  background: var(--glass-fill);
  box-shadow: inset 0 0 0 1px var(--glass-rim);
  -webkit-backdrop-filter: blur(18px) saturate(1.6);
  backdrop-filter: blur(18px) saturate(1.6);
}
.glass.main { background: var(--accent); color: var(--on-accent); }

/* A bar of choices with one lens. Position the lens from script: set --at (px from the bar's
   left edge to the lens's middle) and --w (its width). It lies under the labels. */
.bar { position: relative; display: inline-flex; align-items: center; padding: 0 4px; }
.bar > .lens {
  position: absolute; top: 50%; left: 0;
  width: var(--w, 50px); height: calc(var(--h) - 8px);
  transform: translate(calc(var(--at, 0px) - 50%), -50%);
  border-radius: min(calc((var(--h) - 8px) * 0.3), 14px);
  background: var(--lens-fill);
  box-shadow: inset 0 0 0 1px var(--glass-rim);
  transition: transform var(--glide), width var(--glide);
  pointer-events: none;
}
.bar > .item { position: relative; padding: 0 14px; line-height: var(--h); color: var(--text-soft); }
.bar > .item[aria-current="true"], .bar > .item:hover { color: var(--text); }

@media (prefers-reduced-motion: reduce) {
  .bar > .lens { transition: none; }
}
