/* The Battery health page of Lumo One, a made-up phone: one card alone on white, a single green accent. */
:root {
  --fondo: #ffffff;
  --carta: #ffffff;
  --bordo: #e8eaec;
  --tinta: #f3f5f6;          /* the empty battery, the bar track, the switch when off */
  --testo: #101315;
  --testo-2: #5a6168;
  --testo-3: #9aa1a8;
  --accento: #14a36b;        /* the single accent: the charge, the curve, the switch, the stop mark */
  --accento-chiaro: #e4f6ee;
  --ombra: 16, 24, 30;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
html { font-size: clamp(10px, min(3.6vw, 2.85vh), 17px); }
body {
  background: var(--fondo);
  color: var(--testo);
  font-family: "Mona Sans Variable", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
}
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }

.stage { height: 100vh; display: grid; place-items: center; padding: 2vh 4vw; }

/* the card: a body, a 1px edge that catches light at the top, three soft shadows */
.card {
  position: relative;
  width: min(22em, 92vw);
  padding: 1.25em 1.3em 1.2em;
  border-radius: 1.5em;
  background: var(--carta);
  box-shadow:
    0 1px 1px rgba(var(--ombra), .05),
    0 6px 14px -6px rgba(var(--ombra), .10),
    0 24px 48px -24px rgba(var(--ombra), .22);
  display: grid;
  gap: 1em;
  isolation: isolate;
  overflow: clip;
}
.card__edge {
  position: absolute; inset: 0; border-radius: inherit; pointer-events: none; z-index: 2;
  padding: 1px;
  background: linear-gradient(180deg, rgba(20, 163, 107, .28), var(--bordo) 22%, var(--bordo) 80%, #e0e3e6);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude;
}

/* the header: a back chevron in a soft square, the title, the device */
.head { display: grid; grid-template-columns: auto 1fr; gap: .7em; align-items: center; }
.back {
  width: 2.1em; height: 2.1em; border-radius: .7em; background: var(--tinta);
  display: grid; place-items: center;
}
.back svg { width: 1.05em; height: 1.05em; fill: none; stroke: var(--testo-2); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.head__title { font-size: 1.12em; font-weight: 640; font-stretch: 104%; letter-spacing: -.01em; line-height: 1.15; }
.head__sub { font-size: .78em; color: var(--testo-3); margin-top: .12em; }

/* the hero: the battery drawn in HTML and the big figure */
.hero { display: grid; grid-template-columns: auto 1fr; gap: 1.1em; align-items: center; padding: .2em 0 .1em; }
.cell { display: flex; align-items: center; gap: .18em; }
.cell__body {
  position: relative; display: block;
  width: 8.4em; height: 3.9em; border-radius: .95em;
  background: var(--tinta);
  box-shadow: inset 0 0 0 1px rgba(var(--ombra), .07), inset 0 1px 2px rgba(var(--ombra), .06);
  overflow: hidden;
  padding: .28em;
}
.cell__fill {
  position: relative; display: block; height: 100%; width: 0%;
  border-radius: .7em 0 0 .7em;
  background: linear-gradient(180deg, #2bc184, var(--accento) 60%, #11915f);
}
.cell__wave {
  position: absolute; top: 0; left: 100%; height: 100%; width: .7em;
  overflow: visible;
}
.cell__shine {
  position: absolute; left: .3em; right: 0; top: .22em; height: .55em; border-radius: .4em;
  background: linear-gradient(180deg, rgba(255, 255, 255, .42), rgba(255, 255, 255, 0));
  pointer-events: none;
}
/* the thin mark where the battery was new: the full 100% */
.cell__mark {
  position: absolute; top: .28em; bottom: .28em; right: .28em; width: 1px;
  background: repeating-linear-gradient(180deg, rgba(var(--ombra), .28) 0 .18em, transparent .18em .36em);
  opacity: 0;
}
.cell__tip { width: .32em; height: 1.35em; border-radius: 0 .3em .3em 0; background: #dfe3e6; }

.hero__txt { min-width: 0; }
.big { display: flex; align-items: baseline; font-size: 2.9em; font-weight: 620; font-stretch: 92%; letter-spacing: -.035em; line-height: 1; }
.big__pct { font-size: .5em; color: var(--testo-3); margin-left: .08em; font-weight: 560; letter-spacing: 0; }
.hero__lab { font-size: .8em; color: var(--testo-2); margin-top: .3em; }

/* the rolling digits */
.roll { display: inline-flex; font-variant-numeric: tabular-nums; white-space: nowrap; }
.roll .ch { display: inline-block; position: relative; height: 1.1em; line-height: 1.1em; overflow: hidden; vertical-align: bottom; }
.roll .col { display: block; will-change: transform; }
.roll .col span { display: block; height: 1.1em; text-align: center; }

/* the two rows */
.rows { display: grid; border-top: 1px solid var(--bordo); }
.row {
  display: flex; align-items: center; justify-content: space-between;
  padding: .66em 0; border-bottom: 1px solid var(--bordo);
  font-size: .9em;
}
.row dt { color: var(--testo-2); }
.row dd { font-weight: 600; font-variant-numeric: tabular-nums; }
.tag {
  display: inline-grid; place-items: center;
  font-size: .86em; font-weight: 600; color: var(--accento);
  background: var(--accento-chiaro); border-radius: 99em; padding: .22em .7em;
}

/* the twelve months of capacity */
.trend { position: relative; }
.trend__head { display: flex; justify-content: space-between; font-size: .74em; color: var(--testo-3); margin-bottom: .5em; }
.trend__now { color: var(--accento); font-weight: 600; }
.trend__svg { display: block; width: 100%; height: auto; aspect-ratio: 6 / 1; overflow: visible; }
.trend__base { stroke: var(--bordo); stroke-width: 1; vector-effect: non-scaling-stroke; }
.trend__area { fill: rgba(20, 163, 107, .08); opacity: 0; }
.trend__line { fill: none; stroke: var(--accento); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 1; stroke-dashoffset: 1; }
.trend__pin {
  position: absolute; width: .8em; height: .8em; margin: -.4em 0 0 -.4em; border-radius: 50%;
  background: var(--carta); box-shadow: 0 0 0 2px var(--accento), 0 2px 6px rgba(var(--ombra), .18);
  display: grid; place-items: center; opacity: 0; left: 0; top: 0;
}
.trend__pin-in { width: .3em; height: .3em; border-radius: 50%; background: var(--accento); }

/* the option and its switch */
.opt { border-top: 1px solid var(--bordo); padding-top: .85em; }
.opt__top { display: flex; align-items: center; justify-content: space-between; gap: 1em; }
.opt__title { font-size: .92em; font-weight: 600; }
.opt__sub { font-size: .74em; color: var(--testo-3); margin-top: .15em; }
.switch {
  position: relative; flex: none;
  width: 2.9em; height: 1.7em; border-radius: 99em;
  background: #e3e7ea;
  box-shadow: inset 0 1px 2px rgba(var(--ombra), .10);
  transition: background-color .25s;
}
.switch.is-on { background: var(--accento); }
.switch__knob {
  position: absolute; top: .15em; left: .15em;
  width: 1.4em; height: 1.4em; border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 1px rgba(var(--ombra), .12), 0 3px 8px -2px rgba(var(--ombra), .28);
}

/* the line that opens under the switch */
.limit { overflow: hidden; } /* always as tall as its line: the card never changes height while the line shows */
.limit__in { opacity: 0; }
.limit__in { padding-top: .8em; }
.limit__lab { font-size: .8em; color: var(--testo-2); }
.limit__lab strong { color: var(--testo); font-weight: 650; font-variant-numeric: tabular-nums; }
.bar { position: relative; margin-top: .55em; height: .9em; }
.bar__track { position: absolute; left: 0; right: 0; top: .25em; height: .4em; border-radius: 99em; background: var(--tinta); overflow: hidden; }
.bar__fill { display: block; height: 100%; width: 0%; border-radius: inherit; background: linear-gradient(90deg, #8fdcbb, var(--accento)); }
.bar__stop { position: absolute; top: 0; bottom: 0; left: 100%; width: 0; }
.bar__stop-line {
  position: absolute; left: -1.5px; top: -.05em; bottom: -.05em; width: 3px; border-radius: 2px;
  background: var(--testo); box-shadow: 0 0 0 2px var(--carta);
}

@media (hover: hover) {
  .switch:hover .switch__knob { box-shadow: 0 1px 1px rgba(var(--ombra), .12), 0 4px 10px -2px rgba(var(--ombra), .34); }
  .back:hover { background: #eaedef; }
}
.switch:focus-visible { outline: 2px solid var(--accento); outline-offset: 3px; }
