/* The workout summary with the rings that close: the card of tonight's session in Forgeline, a made-up gym app, on
   a near black page. The three rings are drawn in SVG by script.js every frame; the page carries a soft aura in the
   colour of the ring being read and a fine grain. */
:root {
  --page: #0a0a0c;          /* the page */
  --card: #141417;          /* the body of the card */
  --edge: rgba(255, 255, 255, 0.07); /* its edge at rest */
  --ink: #efeff2;           /* the words */
  --muted: #85858f;         /* the small words */
  --move: #ff7a3d;          /* the outer ring, move */
  --exercise: #f2c94c;      /* the middle ring, exercise */
  --stand: #9b8cff;         /* the inner ring, stand */
  --aura: #ff7a3d;          /* the light behind the card (follows the ring being read) */
}

* {
  box-sizing: border-box;
}

html {
  touch-action: manipulation;
}

html,
body {
  margin: 0;
  overflow-x: clip;
}

body {
  min-height: 100svh;
  background: var(--page);
  color: var(--ink);
  font-family: 'Mona Sans Variable', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* the grain over everything */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.07;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}

.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.stage {
  position: relative;
  min-height: 100svh;
  display: grid;
  place-items: center;
  padding: 14px;
  overflow: hidden;
  perspective: 1200px;
}

.aura {
  position: absolute;
  left: 50%;
  top: 50%;
  width: min(120vw, 120vh, 760px);
  aspect-ratio: 1;
  translate: -50% -50%;
  border-radius: 50%;
  background: radial-gradient(closest-side, color-mix(in srgb, var(--aura) 22%, transparent), transparent 72%);
  opacity: 0.8;
  pointer-events: none;
  transition: background 0.6s ease;
}

.sum {
  position: relative;
  width: min(88vw, 340px);
  padding: clamp(14px, 3.6vh, 22px) clamp(16px, 5vw, 22px) clamp(14px, 3.4vh, 20px);
  border-radius: 24px;
  background:
    radial-gradient(120% 70% at 50% 0%, rgba(255, 255, 255, 0.045), transparent 60%),
    var(--card);
  box-shadow:
    inset 0 0 0 1px var(--edge),
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    0 1px 2px rgba(0, 0, 0, 0.5),
    0 18px 40px -18px rgba(0, 0, 0, 0.85),
    0 50px 90px -40px rgba(0, 0, 0, 0.9);
  opacity: 0;
  transform-style: preserve-3d;
}

/* the edge that catches the light from above */
.sum::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0) 38%, rgba(255, 255, 255, 0) 70%, rgba(255, 255, 255, 0.05));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
}

.sum__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: var(--muted);
}

.sum__brand {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--ink);
  font-weight: 600;
  font-variation-settings: 'wdth' 110;
  letter-spacing: 0.01em;
  font-size: 13px;
}

.sum__mark {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: var(--ink);
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.sum__mark-arc {
  stroke: var(--move);
}

.sum__day {
  font-variant-numeric: tabular-nums;
}

.sum__title {
  margin-top: clamp(10px, 2.6vh, 16px);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.sum__name {
  margin: 0;
  font-size: clamp(17px, 4.6vh, 21px);
  font-weight: 620;
  font-variation-settings: 'wdth' 104;
  letter-spacing: -0.01em;
  line-height: 1.1;
}

.sum__meta {
  margin: 4px 0 0;
  font-size: 12px;
  color: var(--muted);
}

.sum__chip {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px 5px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 560;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.06);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.1), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  opacity: 0;
}

.sum__chip svg {
  width: 12px;
  height: 12px;
  fill: none;
  stroke: var(--exercise);
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* the rings */
.rings {
  position: relative;
  width: min(64vw, 42vh, 232px);
  aspect-ratio: 1;
  margin: clamp(10px, 2.6vh, 18px) auto 0;
  container-type: inline-size;
  touch-action: pan-y;
}

.rings__svg {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.ring-track {
  fill: none;
  opacity: 0.16;
}

.ring-arc,
.ring-over,
.ring-glow,
.ring-sweep,
.ring-trail,
.ring-wave {
  fill: none;
  stroke-linecap: round;
}

.ring-trail {
  stroke: #ffffff;
  stroke-linecap: butt;
  mix-blend-mode: plus-lighter;
}

.ring-sweep {
  stroke: #ffffff;
  mix-blend-mode: plus-lighter;
}

.ring-arrow {
  fill: none;
  stroke: rgba(10, 10, 12, 0.82);
  stroke-width: 2.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.rings__mid {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  text-align: center;
  pointer-events: none;
}

.rings__label {
  font-size: max(9px, 5.4cqw);
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--move);
}

.rings__value {
  margin-top: 0.5cqw;
  font-size: 15cqw;
  font-weight: 640;
  font-variation-settings: 'wdth' 92;
  letter-spacing: -0.03em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.rings__unit {
  margin-top: 1.4cqw;
  font-size: max(9px, 4.9cqw);
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

/* the three figures under the rings */
.stats {
  list-style: none;
  margin: clamp(12px, 3vh, 18px) 0 0;
  padding: clamp(10px, 2.4vh, 14px) 0 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
}

.stat {
  display: grid;
  gap: 3px;
  padding: 6px 8px;
  margin: -6px -8px;
  border-radius: 12px;
  cursor: default;
  transition: background 0.3s ease;
}

.stat:nth-child(2) {
  justify-self: center;
}

.stat:nth-child(3) {
  justify-self: end;
  text-align: right;
}

.stat__name {
  font-size: 11px;
  color: var(--muted);
}

.stat__num {
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.stat__num b {
  font-weight: 640;
  font-size: 16px;
}

.stat:nth-child(1) b { color: var(--move); }
.stat:nth-child(2) b { color: var(--exercise); }
.stat:nth-child(3) b { color: var(--stand); }

.stat__num i {
  font-style: normal;
  color: var(--muted);
  margin-left: 1px;
}

.stat.is-on {
  background: rgba(255, 255, 255, 0.05);
}

/* the drawn pointer of the walk on its own */
.hand {
  position: absolute;
  left: 0;
  top: 0;
  width: 22px;
  height: 22px;
  pointer-events: none;
  opacity: 0;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.6));
}

.hand path {
  fill: #f6f6f8;
  stroke: #0a0a0c;
  stroke-width: 1.2;
  stroke-linejoin: round;
}
