/* "Keep it simple. Or go all in." slider, shared by start.html and
   about.html (rendered by /slider.js into any [data-as-slider]). Uses the
   page tokens both pages define: --bg-elevated, --fg-*, --border-subtle,
   --font-display, --ease-out-expo. */

.as-sub { margin: 18px auto 0; }

/* The slider panel. --tint changes with the level (set by about.html's script) */
.as-dial {
  --tint: 233, 203, 120; /* the app's gold, at every step */
  max-width: 680px;
  margin: clamp(32px, 5vw, 48px) auto 0;
  padding: 30px 30px 18px;
  text-align: left;
  border-radius: 22px;
  border: 1px solid rgba(var(--tint), 0.28);
  background:
    radial-gradient(circle at 0% 0%, rgba(var(--tint), 0.18) 0%, transparent 60%),
    radial-gradient(circle at 100% 100%, rgba(var(--tint), 0.06) 0%, transparent 55%),
    var(--bg-elevated);
  transition: border-color 400ms ease, background 400ms ease;
}
.as-control { margin-bottom: 24px; }
.as-control input[type="range"] {
  --fill: 0%;
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  margin: 0;
  border-radius: 999px;
  background: linear-gradient(90deg, rgb(var(--tint)) var(--fill), rgba(255,255,255,0.12) var(--fill));
  outline: none;
  cursor: pointer;
}
.as-control input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: linear-gradient(180deg, #E9CB78 0%, #CDA64A 45%, #A67D32 100%);
  border: 0;
  box-shadow: 0 0 0 5px rgba(var(--tint), 0.22), 0 4px 12px rgba(0,0,0,0.5);
  transition: box-shadow 300ms ease;
}
.as-control input[type="range"]::-moz-range-thumb {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: linear-gradient(180deg, #E9CB78 0%, #CDA64A 45%, #A67D32 100%);
  border: 0;
  box-shadow: 0 0 0 5px rgba(var(--tint), 0.22), 0 4px 12px rgba(0,0,0,0.5);
}
.as-control input[type="range"]:focus-visible::-webkit-slider-thumb {
  box-shadow: 0 0 0 7px rgba(var(--tint), 0.4), 0 4px 12px rgba(0,0,0,0.5);
}
.as-stops {
  position: relative;
  height: 22px;
  margin-top: 14px;
}
.as-stops button { position: absolute; top: 0; }
.as-stops button[data-go="1"] { left: 0; }
.as-stops button[data-go="4"] { left: 50%; transform: translateX(-50%); }
.as-stops button[data-go="7"] { right: 0; }
.as-stops button {
  font: inherit;
  font-family: "Plus Jakarta Sans", var(--font-body); /* matches .eyebrow */
  font-size: 11px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  font-weight: 600;
  color: var(--fg-tertiary);
  background: none;
  border: 0;
  padding: 4px 0;
  cursor: pointer;
  transition: color 300ms ease;
}
.as-stops button.on { color: rgb(var(--tint)); }
.as-lede {
  margin: 0 0 14px;
  min-height: 2.7em;
  font-family: var(--font-display);
  font-size: 21px;
  line-height: 1.35;
  color: var(--fg-primary);
}
.as-lede.swap { animation: asLede 420ms var(--ease-out-expo); }
@keyframes asLede {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}
.as-count {
  margin: 0 0 16px;
  font-size: 12px;
  letter-spacing: 0.04em;
  color: var(--fg-tertiary);
}
.as-count b { color: rgb(var(--tint)); font-weight: 600; transition: color 400ms ease; }

/* Feature tiles: all 12 always laid out (no jumps); the level lights them up */
.as-grid {
  list-style: none;
  margin: 0 0 12px;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}
.as-grid-wrap {
  /* height is animated by about.html's script; padding leaves room for the pop */
  overflow: hidden;
  margin: -8px;
  padding: 8px;
  transition: height 480ms var(--ease-out-expo);
}
.as-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 16px 6px 14px;
  border-radius: 16px;
  text-align: center;
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid var(--border-subtle);
  transition: border-color 360ms ease, box-shadow 360ms ease, background 360ms ease;
}
.as-tile[hidden] { display: none; }
.as-ico {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  color: rgb(var(--tint));
  background: rgba(var(--tint), 0.14);
  transition: box-shadow 360ms ease;
}
.as-ico svg { width: 22px; height: 22px; }
.as-name {
  font-size: 13px;
  line-height: 1.3;
  color: var(--fg-secondary);
  transition: color 360ms ease;
}
/* Tiles are buttons: tap to show a one-line caption under the row */
.as-hit {
  flex: 1;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: inherit;
  gap: inherit;
  padding: 0;
  margin: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  text-align: center;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.as-hit:focus-visible { outline: 2px solid rgba(var(--tint), 0.8); outline-offset: 3px; border-radius: 12px; }
.as-tile.sel {
  border-color: rgba(var(--tint), 0.75);
  background: rgba(var(--tint), 0.12);
  box-shadow: 0 0 0 1px rgba(var(--tint), 0.35), 0 10px 26px -12px rgba(var(--tint), 0.6);
}
.as-tile.sel .as-name { color: var(--fg-primary); }
.as-tip {
  grid-column: 1 / -1;
  list-style: none;
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid rgba(var(--tint), 0.35);
  background: rgba(var(--tint), 0.08);
  font-size: 14px;
  line-height: 1.5;
  color: var(--fg-secondary);
  text-align: left;
}
.as-tip[hidden] { display: none; }
.as-tip strong { color: var(--fg-primary); font-weight: 600; margin-right: 6px; }
.as-tip.in { animation: asTip 320ms var(--ease-out-expo); }
@keyframes asTip {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: none; }
}
.as-hint { color: var(--fg-tertiary); }

/* Just added by the last step: pop in, then stay highlighted until the next change */
.as-tile.new {
  border-color: rgba(var(--tint), 0.55);
  background: rgba(var(--tint), 0.08);
  box-shadow: 0 0 0 1px rgba(var(--tint), 0.25), 0 10px 30px -10px rgba(var(--tint), 0.55);
  animation: asPop 620ms var(--ease-out-expo) both;
}
.as-tile.new .as-ico { box-shadow: 0 0 22px rgba(var(--tint), 0.45); }
.as-tile.new .as-name { color: var(--fg-primary); }
@keyframes asPop {
  0% { transform: translateY(10px) scale(0.86); opacity: 0; }
  60% { transform: translateY(0) scale(1.05); opacity: 1; }
  100% { transform: none; opacity: 1; }
}
@media (max-width: 640px) {
  /* Phones: three ~84px squares per row, centred. Every label gets the same
     two-line slot under the icon, so icons and first lines align across a
     row whether a label wraps or not, and every tile is the same size. */
  .as-grid {
    grid-template-columns: repeat(3, minmax(0, 84px));
    justify-content: center;
    gap: 12px;
  }
  .as-dial { padding: 24px 18px 14px; }
  .as-tile {
    aspect-ratio: 1;
    justify-content: center;
    gap: 6px;
    padding: 6px 4px;
    border-radius: 14px;
  }
  .as-ico { width: 32px; height: 32px; border-radius: 10px; }
  .as-ico svg { width: 17px; height: 17px; }
  .as-name {
    font-size: 11px;
    line-height: 1.2;
    height: 2.4em; /* exactly two lines */
    display: flex;
    align-items: flex-start;
    justify-content: center;
    text-wrap: balance;
    overflow: hidden;
  }
}
@media (prefers-reduced-motion: reduce) {
  .as-tile, .as-ico, .as-dial, .as-grid-wrap { transition: none; }
  .as-tile.new, .as-lede.swap, .as-tip.in { animation: none; }
}
