/* ==========================================================================
   Shared countdown layout math — every template's countdown widget uses
   this grid/sizing so 4 units never overflow at 375px. Visual skin (colors,
   shapes, effects) lives in countdown-skins.css or the template's own CSS.
   ========================================================================== */

.cw {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--space-2);
  width: 100%;
  max-width: 480px;
  margin: var(--space-5) auto 0;
}

.cw-unit {
  position: relative; /* anchors ring/badge skins' absolutely-positioned layers */
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-1);
  min-width: 0;
  transition: transform 0.2s ease;
}

@media (hover: hover) and (pointer: fine) {
  .cw-unit:hover {
    transform: translateY(-3px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .cw-unit {
    transition: none;
  }
}

.cw-num {
  font-size: var(--fs-countdown-num);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  white-space: nowrap;
}

.cw-label {
  font-size: var(--fs-countdown-label);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  white-space: nowrap;
  color: var(--color-text-muted);
}

/* Ring skin structure (SVG progress ring behind a centered number) */
.cw--ring .cw-unit {
  aspect-ratio: 1 / 1;
}

.cw-ring-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.cw-ring-track {
  fill: none;
  stroke: var(--color-border);
  stroke-width: 6;
}

.cw-ring-progress {
  fill: none;
  stroke: var(--color-accent);
  stroke-width: 6;
  stroke-linecap: round;
  transition: stroke-dashoffset 0.3s linear;
}

/* Bar skin structure (thin progress bar under the number) */
.cw-bar-track {
  width: 100%;
  height: 6px;
  border-radius: var(--radius-full);
  background: var(--color-border);
  overflow: hidden;
  margin-top: var(--space-1);
}

.cw-bar-fill {
  height: 100%;
  width: 0%;
  background: var(--color-accent);
  transition: width 0.3s linear;
}

/* Stacked skin structure (label left, number right, one per row) */
.cw--stacked {
  grid-template-columns: 1fr;
  gap: var(--space-2);
  max-width: 320px;
}

.cw--stacked .cw-unit {
  flex-direction: row;
  justify-content: space-between;
  width: 100%;
}

/* Inline skin structure (compact single-line reading) */
.cw--inline {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: baseline;
  gap: var(--space-1);
  max-width: none;
  width: auto;
}

.cw--inline .cw-unit {
  flex-direction: row;
  align-items: baseline;
  gap: 4px;
}

@media (min-width: 768px) {
  .cw {
    gap: var(--space-3);
    max-width: 560px;
  }

  .cw--stacked {
    max-width: 360px;
  }
}
