/* Shared Chartclock skins. Sized against the widget/window container, not the
   monitor, so a 300px overlay and a full-bleed page both read correctly. */

.classic,
.ruler,
.rings,
.pies,
.pulse {
  --cc-green: #00a000;
  --cc-green-bright: #16d016;
  --cc-red: #d40000;
  --cc-amber: #ff8c1a;
  --cc-ink: #f4f6f5;
  --cc-dim: rgba(244, 246, 245, 0.55);
  --cc-mono: 'SF Mono', 'Menlo', 'Consolas', 'DejaVu Sans Mono', monospace;
  --cc-sans: 'Lato', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  font-family: var(--cc-sans);
  color: var(--cc-ink);
}

/* Classic ---------------------------------------------------------------- */

.classic {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
}

.classic__clock {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.02em;
  background: var(--cc-green, #008000);
  font-weight: 700;
  font-size: clamp(22px, 14cqw, 170px);
  line-height: 1;
  letter-spacing: -0.01em;
}

.classic__colon {
  opacity: 0.75;
}

.classic__meridiem {
  align-self: flex-start;
  margin-left: 0.25em;
  padding-top: 0.35em;
  font-size: 0.22em;
  letter-spacing: 0.12em;
  color: rgba(255, 255, 255, 0.8);
}

.classic__labels,
.classic__values {
  display: flex;
}

.classic__labels {
  background: #000;
}

.classic__values {
  background: var(--cc-red, #ff0000);
}

.classic__label,
.classic__value {
  flex: 1;
  width: 25%;
  padding: 0.15em 0.4em;
  text-align: right;
  border-left: 0.12em solid rgba(255, 255, 255, 0.28);
  font-variant-numeric: tabular-nums;
}

.classic__label:first-child,
.classic__value:first-child {
  border-left: 0;
}

.classic__label {
  font-size: clamp(8px, 2.2cqw, 28px);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--cc-dim, rgba(255, 255, 255, 0.7));
}

.classic__value {
  font-family: var(--cc-mono);
  font-weight: 700;
  font-size: clamp(14px, 5.5cqw, 72px);
}

.classic__value.is-closing {
  background: #ff2a2a;
  color: #fff;
}

/* Ruler ------------------------------------------------------------------- */

.ruler {
  display: flex;
  flex-direction: column;
  gap: 0.4em;
  height: 100%;
  min-height: 0;
  padding: 0.5em 0.7em 0.35em;
}

.ruler__head {
  display: flex;
  align-items: baseline;
  gap: 0.4em;
}

.ruler__clock {
  font-family: var(--cc-mono);
  font-weight: 700;
  font-size: clamp(16px, 7cqw, 56px);
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.ruler__meridiem {
  font-size: clamp(8px, 2cqw, 16px);
  letter-spacing: 0.1em;
  color: var(--cc-dim);
}

.ruler__confluence {
  margin-left: auto;
  font-size: clamp(8px, 2cqw, 16px);
  letter-spacing: 0.08em;
  color: var(--cc-amber);
  font-variant-numeric: tabular-nums;
}

.ruler__tracks {
  display: flex;
  flex-direction: column;
  flex: 1;
  justify-content: space-evenly;
  gap: 0.25em;
  min-height: 0;
}

.ruler__track {
  display: flex;
  align-items: center;
  gap: 0.5em;
}

.ruler__name {
  width: 12cqw;
  min-width: 2.4em;
  max-width: 4.5em;
  font-size: clamp(11px, 3.2cqw, 22px);
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--cc-ink);
  text-align: right;
}

.ruler__lane {
  position: relative;
  flex: 1;
  height: clamp(10px, 4.2cqw, 28px);
  background: rgba(255, 255, 255, 0.07);
  border-radius: 3px;
  overflow: hidden;
}

.ruler__grid {
  position: absolute;
  inset: 0;
}

.ruler__tick {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 1px;
  background: rgba(255, 255, 255, 0.16);
}

.ruler__fill {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0;
  background: linear-gradient(90deg, var(--cc-green) 0%, var(--cc-green-bright) 100%);
}

.ruler__track.is-closing .ruler__fill {
  background: linear-gradient(90deg, var(--cc-red) 0%, #ff5a3c 100%);
}

.ruler__value {
  width: 14cqw;
  min-width: 3em;
  max-width: 5.5em;
  font-family: var(--cc-mono);
  font-size: clamp(11px, 3cqw, 22px);
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.ruler__track.is-closing .ruler__value {
  color: #ff7a5c;
}

.ruler__track[data-timeframe='15m'] .ruler__lane {
  height: clamp(12px, 4.8cqw, 32px);
}

.ruler .tape {
  margin-top: 0.25em;
}

.surface.is-confluence {
  box-shadow: inset 0 0 0 1px var(--cc-amber);
}

/* Rings ------------------------------------------------------------------- */

.rings {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  min-height: 0;
  padding: 0.4em;
}

.rings__svg {
  height: 100%;
  max-height: min(70cqw, 100%);
  aspect-ratio: 1;
  transform: rotate(-90deg);
}

.rings__track {
  fill: none;
  stroke: rgba(255, 255, 255, 0.08);
  stroke-width: 6;
}

.rings__arc {
  fill: none;
  stroke: var(--cc-green-bright);
  stroke-width: 6;
  stroke-linecap: butt;
}

.rings__arc--5m {
  stroke: #46e0a0;
}

.rings__arc--1m {
  stroke: #ffd24a;
}

.rings__arc--10s {
  stroke: var(--cc-amber);
}

.rings__arc.is-closing {
  stroke: var(--cc-red);
}

.rings__readout {
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
}

.rings__centre {
  font-family: var(--cc-mono);
  font-weight: 700;
  font-size: clamp(14px, 5cqw, 36px);
  font-variant-numeric: tabular-nums;
}

.rings__caption,
.rings__phase {
  font-size: clamp(8px, 1.8cqw, 14px);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--cc-dim);
}

/* Session tape ------------------------------------------------------------ */

.tape {
  display: flex;
  flex-direction: column;
  width: 100%;
  min-width: 0;
}

.tape__labels {
  display: flex;
  width: 100%;
}

.tape__label {
  flex: 1;
  min-width: 0;
  padding: 0.2em 0.05em;
  overflow: hidden;
  text-align: center;
  text-overflow: ellipsis;
  font-size: clamp(8px, 1.8cqw, 14px);
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--cc-dim);
  white-space: nowrap;
}

.tape__label.is-active {
  color: var(--cc-ink);
  font-weight: 700;
}

.tape__label.is-empty {
  flex-grow: 1;
}

.tape__strip {
  position: relative;
  display: flex;
  width: 100%;
  height: clamp(6px, 1.6cqw, 12px);
  overflow: hidden;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.04);
}

.tape__swatch {
  flex-basis: 0;
  min-width: 0;
  background: rgba(255, 255, 255, 0.08);
}

.tape__swatch--pre,
.tape__swatch--ah {
  background: rgba(255, 255, 255, 0.05);
}

.tape__swatch--orb {
  background: rgba(22, 208, 22, 0.28);
}

.tape__swatch--am,
.tape__swatch--pm {
  background: rgba(22, 208, 22, 0.12);
}

.tape__swatch--lunch {
  background: rgba(255, 255, 255, 0.03);
}

.tape__swatch--power {
  background: rgba(255, 140, 26, 0.28);
}

.tape__swatch--moc {
  background: rgba(212, 0, 0, 0.45);
}

.tape__swatch.is-active {
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.45);
}

.tape__swatch.is-empty {
  flex-grow: 1;
}

.tape__playhead {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  background: #fff;
  pointer-events: none;
  transform: translateX(-1px);
}

/* Pies -------------------------------------------------------------------- */

@keyframes cc-pulse {
  0%,
  100% {
    filter: brightness(1);
  }
  50% {
    filter: brightness(1.7);
  }
}

.pies {
  container-type: inline-size;
  display: flex;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
}

.pies__wide {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
  padding: 0.45em 0.55em 0.3em;
  gap: 0.45em;
}

.pies__nested {
  display: none;
  flex: 1;
  align-items: center;
  justify-content: center;
  padding: 0.4em;
}

@container (max-width: 420px) {
  .pies__wide {
    display: none;
  }

  .pies__nested {
    display: flex;
  }
}

.pies__row {
  display: flex;
  flex: 1;
  align-items: center;
  justify-content: space-evenly;
  gap: 0.5em;
  min-height: 0;
}

.pies__disc {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3em;
  min-width: 0;
  flex: 1;
}

.pies__svg {
  width: 100%;
  max-width: min(22cqw, 140px);
  aspect-ratio: 1;
}

.pies__remaining {
  fill: rgba(255, 255, 255, 0.08);
}

.pies__elapsed {
  fill: var(--cc-green-bright);
}

.pies__elapsed--5m {
  fill: #46e0a0;
}

.pies__elapsed--1m {
  fill: #ffd24a;
}

.pies__elapsed--10s {
  fill: var(--cc-amber);
}

.pies__disc.is-closing .pies__elapsed,
.pies__elapsed.is-closing {
  fill: var(--cc-red);
  animation: cc-pulse 0.4s ease-in-out infinite;
}

.surface.is-confluence .pies__elapsed {
  animation: cc-pulse 0.35s ease-in-out infinite;
}

.pies__caption {
  font-size: clamp(11px, 3.2cqw, 22px);
  font-weight: 700;
  letter-spacing: 0.04em;
}

.pies__nested-svg {
  height: 100%;
  max-height: min(70cqw, 100%);
  aspect-ratio: 1;
}

.pies__track {
  fill: none;
  stroke: rgba(255, 255, 255, 0.08);
}

.pies__phase {
  fill: rgba(255, 255, 255, 0.08);
}

.pies__phase--orb {
  fill: rgba(22, 208, 22, 0.35);
}

.pies__phase--am,
.pies__phase--pm {
  fill: rgba(22, 208, 22, 0.16);
}

.pies__phase--lunch {
  fill: rgba(255, 255, 255, 0.05);
}

.pies__phase--power {
  fill: rgba(255, 140, 26, 0.35);
}

.pies__phase--moc {
  fill: rgba(212, 0, 0, 0.5);
}

.pies__phase.is-active {
  fill: var(--cc-green-bright);
}

.pies__hand {
  stroke: #fff;
  stroke-width: 1.5;
  stroke-linecap: round;
}

/* Pulse ------------------------------------------------------------------- */

.pulse {
  display: flex;
  flex-direction: column;
  justify-content: space-evenly;
  width: 100%;
  height: 100%;
  min-height: 0;
  padding: 0.55em 0.7em;
  gap: 0.4em;
}

.pulse__row {
  display: flex;
  align-items: center;
  gap: 0.5em;
}

.pulse__name {
  width: 12cqw;
  min-width: 2.4em;
  max-width: 4.5em;
  font-size: clamp(11px, 3.2cqw, 22px);
  font-weight: 700;
  letter-spacing: 0.04em;
  text-align: right;
}

.pulse__cells {
  display: flex;
  flex: 1;
  gap: 0.2em;
  min-width: 0;
  height: clamp(12px, 5cqw, 32px);
}

.pulse__cell {
  position: relative;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.07);
  border-radius: 3px;
}

.pulse__fill {
  display: block;
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, var(--cc-green) 0%, var(--cc-green-bright) 100%);
}

.pulse__cell.is-active {
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.35);
}

.pulse__row.is-closing .pulse__fill {
  background: linear-gradient(90deg, var(--cc-red) 0%, #ff5a3c 100%);
}

.pulse__row.is-closing .pulse__cell:last-child {
  animation: cc-pulse 0.3s ease-in-out infinite;
}

.pulse.is-confluence {
  animation: cc-pulse 0.4s ease-in-out;
}
