/* World clock widget. Tokens from _shared/embed.css. */

.wc {
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
}

.wc-title {
  flex: none;
  font-size: clamp(9px, 6vmin, 18px);
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.wc-grid {
  display: flex;
  flex: 1 1 0;
  flex-wrap: wrap;
  align-content: center;
  justify-content: center;
  gap: 0.35em;
  min-height: 0;
}

/* Equal cards; a short last row stays centered. */
.wc-card {
  flex: 0 0 calc((100% - (var(--cols, 3) - 1) * 0.35em) / var(--cols, 3));
  height: calc((100% - (var(--rows, 1) - 1) * 0.35em) / var(--rows, 1));
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
  min-height: 0;
  padding: 0.24em 0.32em;
  border-radius: 0.2em;
  background: var(--card-bg);
  transition: background-color 0.6s ease;
}

.wc-card.is-night {
  background: color-mix(in srgb, var(--card-bg), rgba(40, 40, 90, 0.1));
}

:root[data-scheme="dark"] .wc-card.is-night {
  background: color-mix(in srgb, var(--card-bg), rgba(0, 0, 0, 0.25));
}

.wc-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.2em;
  min-width: 0;
}

.wc-city {
  min-width: 0;
  overflow: hidden;
  color: var(--fg);
  font-size: 0.34em;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.wc-icon-box {
  display: inline-flex;
  flex: none;
  width: 0.4em;
  height: 0.4em;
}

.wc-icon-box:empty {
  display: none;
}

.wc-icon {
  width: 100%;
  height: 100%;
}

.wc-sun {
  fill: #f5a524;
  stroke: #f5a524;
  stroke-width: 2;
  stroke-linecap: round;
}

.wc-moon {
  fill: var(--muted);
}

:root[data-style="neon"] .wc-sun,
:root[data-style="neon"] .wc-moon {
  filter: drop-shadow(0 0 2px currentColor);
}

.wc-time {
  margin-top: 0.06em;
  font-size: 1em;
  line-height: 1.05;
  white-space: nowrap;
}

.wc-period {
  margin-left: 0.15em;
  color: var(--muted);
  font-size: 0.36em;
  font-weight: 600;
  text-shadow: none;
}

.wc-meta {
  margin-top: 0.14em;
  overflow: hidden;
  font-size: 0.27em;
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── List ── */

.wc--list .wc-card {
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 0.4em;
  padding: 0.16em 0.36em;
}

.wc--list .wc-left {
  flex: 1;
  min-width: 0;
}

.wc--list .wc-top {
  justify-content: flex-start;
}

.wc--list .wc-time {
  margin: 0;
  font-size: 0.9em;
}

.wc--list .wc-city {
  font-size: 0.42em;
}

.wc--list .wc-meta {
  font-size: 0.3em;
}

.wc--list .wc-icon-box {
  margin-left: 0.15em;
}

/* ── Analog faces ── */

.wc-face {
  display: block;
  flex: 1 1 auto;
  width: 100%;
  min-height: 0;
  margin: 0.08em 0;
}

.wc--analog:not(.wc--list) .wc-face {
  flex: 1 1 0;
}

.wc--analog .wc-time {
  font-size: 0.42em;
  text-align: center;
}

.wc--analog:not(.wc--list) .wc-meta,
.wc--analog:not(.wc--list) .wc-top {
  justify-content: center;
  text-align: center;
}

.wc--analog.wc--list .wc-face {
  flex: none;
  width: 1.45em;
  height: 1.45em;
  margin: 0;
}

.wc-rim {
  fill: var(--face);
  stroke: var(--face-line);
  stroke-width: 2;
}

.wc-tick {
  stroke: var(--face-line);
  stroke-width: 2.6;
  stroke-linecap: round;
}

.wc-hand {
  stroke: var(--hand);
  stroke-linecap: round;
}

.wc-cap {
  fill: var(--accent);
}

:root[data-style="neon"] .wc-hand,
:root[data-style="neon"] .wc-rim {
  filter: drop-shadow(0 0 2px color-mix(in srgb, var(--accent) 70%, transparent));
}
