/* ==========================================================================
   Mipplet — el anillo (elemento firma). Compartido por landing y cuentas.
   ========================================================================== */

/* --- El anillo ----------------------------------------------------------- */
.ring { margin: 0; justify-self: center; width: 100%; max-width: 540px; }
.ring__stage { position: relative; aspect-ratio: 1; }
.ring__svg { width: 100%; height: 100%; overflow: visible; }

.ring__track .past {
  fill: none;
  stroke: var(--border-strong);
  stroke-width: 3;
  stroke-linecap: round;
}
.ring__track .future {
  fill: none;
  stroke: var(--accent);
  stroke-opacity: 0.55;
  stroke-width: 3;
  stroke-linecap: round;
  stroke-dasharray: 0.1 7;
}
.ring__sleep path {
  fill: none;
  stroke: var(--violet-300);
  stroke-width: 10;
  stroke-linecap: round;
  opacity: 0.75;
}
.theme-night .ring__sleep path { stroke: var(--accent-muted); }
.ring__ticks text {
  fill: var(--text-3);
  font-size: 10px;
  font-weight: var(--fw-semi);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.01em;
}
.ring__ticks .now-line { stroke: var(--text); stroke-width: 1.5; stroke-linecap: round; }
.ring__ticks .now-text { fill: var(--text); font-weight: var(--fw-bold); }

/* Trazo del anillo al cargar */
.js .ring__track .past,
.js .ring__sleep path {
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  animation: draw 1100ms var(--ease-out) 200ms forwards;
}
.js .ring__sleep path { animation-delay: 700ms; animation-duration: 600ms; }
.js .ring__track .future,
.js .ring__ticks { opacity: 0; animation: fade 500ms var(--ease-out) 900ms forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes fade { to { opacity: 1; } }

.node { cursor: pointer; outline: none; }
.node__body {
  transform-box: fill-box;
  transform-origin: center;
  transition: transform var(--dur-comp) var(--ease-spring);
}
.js .node__body { animation: pop 520ms var(--ease-spring) both; animation-delay: var(--d, 0ms); }
@keyframes pop { from { opacity: 0; transform: scale(0.4); } }
.node:hover .node__body,
.node:focus-visible .node__body { transform: scale(1.14); }
.node__disc { fill: var(--surface); stroke: var(--border-strong); stroke-width: 1; }
.node__icon {
  color: var(--accent);
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.node:focus-visible .node__disc { stroke: var(--accent); stroke-width: 2.5; }
.node--next .node__disc { fill: var(--bg); stroke: var(--accent); stroke-opacity: 0.7; stroke-dasharray: 2.4 3; }
.node--next .node__icon { color: var(--accent); opacity: 0.75; }
.node--running .node__disc { fill: var(--primary); stroke: none; }
.node--running .node__icon { color: var(--on-primary); }
.node__halo {
  fill: none;
  stroke: var(--accent);
  stroke-width: 1.5;
  transform-box: fill-box;
  transform-origin: center;
  animation: halo 2.2s var(--ease-out) infinite;
}
@keyframes halo { from { opacity: 0.7; transform: scale(1); } to { opacity: 0; transform: scale(1.75); } }
.node__badge { fill: var(--primary); }
.node__badge-text { fill: var(--on-primary); font-size: 9px; font-weight: var(--fw-bold); text-anchor: middle; }

.ring__center {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 2px;
  padding: 24%;
  text-align: center;
  pointer-events: none;
}
.ring__label { font-size: var(--fs-label); font-weight: var(--fw-semi); color: var(--text-2); }
.ring__value {
  font-size: clamp(2.75rem, 1.9rem + 3.2vw, 4.25rem);
  font-weight: var(--fw-bold);
  line-height: 1;
  letter-spacing: -0.045em;
  margin-block: 4px 6px;
}
.ring__sub { font-size: var(--fs-caption); color: var(--text-2); max-width: 22ch; }
.ring__source { margin-top: var(--s-3); pointer-events: auto; }
.ring__source .icon { color: var(--success); }

.ring__chip {
  position: absolute;
  top: 4%;
  right: -2%;
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  padding: 10px var(--s-4);
  border-radius: var(--r-float);
  font-size: var(--fs-caption);
  font-weight: var(--fw-semi);
  color: var(--text-2);
}
.ring__chip strong { color: var(--text); font-size: var(--fs-small); }
.ring__pulse {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 0 var(--accent);
  animation: beat 2.2s var(--ease-out) infinite;
}
@keyframes beat {
  0% { box-shadow: 0 0 0 0 rgb(118 84 214 / 0.5); }
  70%, 100% { box-shadow: 0 0 0 8px rgb(118 84 214 / 0); }
}
.js .ring__chip { animation: rise 600ms var(--ease-out) 1100ms both; }

.ring__tip {
  position: absolute;
  z-index: 3;
  min-width: 140px;
  padding: 10px 14px;
  border-radius: 14px;
  font-size: var(--fs-caption);
  color: var(--text-2);
  pointer-events: none;
  transform: translate(-50%, calc(-100% - 22px));
  animation: tip-in var(--dur-micro) var(--ease-out);
}
.ring__tip strong { display: block; color: var(--text); font-size: var(--fs-label); }
@keyframes tip-in { from { opacity: 0; transform: translate(-50%, calc(-100% - 16px)); } }

.ring__legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: var(--s-2) var(--s-5);
  margin-top: -9%;
  font-size: var(--fs-caption);
  color: var(--text-2);
}
.ring__legend > span { display: inline-flex; align-items: center; gap: var(--s-2); }
.ring__example { color: var(--text-3); }
.lg { display: inline-block; flex: none; }
.lg--done { width: 12px; height: 12px; border-radius: 50%; background: var(--surface); box-shadow: inset 0 0 0 1px var(--border-strong); }
.lg--sleep { width: 18px; height: 6px; border-radius: 3px; background: var(--violet-300); opacity: 0.8; }
.lg--next { width: 12px; height: 12px; border-radius: 50%; border: 1.5px dashed var(--accent); }


/* Al volver a dibujarse con datos nuevos, el anillo no repite la entrada. */
.ring.is-drawn .ring__track .past,
.ring.is-drawn .ring__sleep path { animation: none; stroke-dashoffset: 0; }
.ring.is-drawn .ring__track .future,
.ring.is-drawn .ring__ticks { animation: none; opacity: 1; }
.ring.is-drawn .node__body { animation: none; }
