/* Bollettino del cielo — usa i token del tema Chiave Orgonica, con fallback.
   1. Barra   2. Widget: elementi comuni   3. Widget compatto   4. Widget grande */

/* 1. Barra ---------------------------------------------------------------- */
.co-bollettino {
  --cob-bg: var(--co-ink, #111318);
  --cob-text: var(--co-footer-text, #E9E9E2);
  --cob-label: var(--co-footer-muted, #A3A59D);
  --cob-accent: var(--co-lime, #D4F25A);
  --cob-ink: var(--co-ink, #111318);
  --cob-alert: #FF8A5B;

  position: relative;
  z-index: 1000;
  background: var(--cob-bg);
  color: var(--cob-text);
  font-family: var(--co-mono, 'IBM Plex Mono', ui-monospace, 'SFMono-Regular', Menlo, Consolas, monospace);
  font-size: 13px;
  line-height: 1;
  height: 40px;
  overflow: hidden;
}

.co-bollettino__inner {
  display: flex;
  align-items: center;
  gap: 20px;
  height: 100%;
  padding: 0 16px;
  white-space: nowrap;
}

.co-bollettino__badge {
  flex: none;
  background: var(--cob-accent);
  color: var(--cob-ink);
  border: 1px solid var(--cob-accent);
  padding: 6px 10px;
  font-weight: 600;
  font-size: 12px;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.co-bollettino__badge-icon { display: none; }
.co-bollettino__badge-icon svg { display: block; width: 100%; height: 100%; }
.co-bollettino__badge-icon .co-acc { stroke: currentColor; }
.co-bollettino__badge-icon .co-acc-fill { fill: currentColor; stroke: none; }

.co-bollettino__date { flex: none; color: var(--cob-text); letter-spacing: .04em; }

.co-bollettino__viewport {
  flex: 1;
  min-width: 0;
  height: 100%;
  display: flex;
  align-items: center;
  overflow: hidden;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 12px, #000 calc(100% - 32px), transparent);
          mask-image: linear-gradient(90deg, transparent, #000 12px, #000 calc(100% - 32px), transparent);
}

.co-bollettino__track {
  display: flex;
  width: max-content;
  padding-left: 8px;
}
.co-bollettino__track.is-running {
  animation: co-bollettino-panel var(--cob-duration, 8s) linear both;
}
.co-bollettino:hover .co-bollettino__track,
.co-bollettino:focus-within .co-bollettino__track,
.co-bollettino.is-paused .co-bollettino__track { animation-play-state: paused; }

/* Una regione: compare, resta, scorre se serve, resta, sparisce. */
@keyframes co-bollettino-panel {
  0%   { opacity: 0; transform: translateX(0); }
  4%   { opacity: 1; transform: translateX(0); }
  20%  { transform: translateX(0); }
  78%  { transform: translateX(var(--cob-shift, 0)); }
  96%  { opacity: 1; transform: translateX(var(--cob-shift, 0)); }
  100% { opacity: 0; transform: translateX(var(--cob-shift, 0)); }
}
@keyframes co-bollettino-hold { from { opacity: 1; } to { opacity: 1; } }

@media (prefers-reduced-motion: reduce) {
  .co-bollettino__track.is-running { animation-name: co-bollettino-hold; }
  .co-bollettino__viewport { overflow-x: auto; scrollbar-width: none; }
  .co-bollettino__viewport::-webkit-scrollbar { display: none; }
}

.co-bollettino__items {
  display: flex;
  align-items: center;
  gap: 28px;
}

.co-bollettino__item { flex: none; }
.co-bollettino__label { color: var(--cob-label); }
.co-bollettino__label--region { color: var(--cob-text); font-weight: 600; text-transform: uppercase; letter-spacing: .06em; }
.co-bollettino__value { color: var(--cob-text); font-weight: 500; }
.co-bollettino__value--accent { color: var(--cob-accent); font-weight: 600; letter-spacing: .04em; }
.co-bollettino__value--alert { color: var(--cob-alert); font-weight: 600; }
.co-bollettino__source { color: var(--cob-label); font-size: .85em; }
.co-bollettino__source a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
.co-bollettino__source a:hover,
.co-bollettino__source a:focus-visible { color: var(--cob-text); }

.co-bollettino__pause {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  padding: 0;
  margin: 0;
  border: 1px solid var(--co-footer-rule, #2C2F36);
  border-radius: 0;
  background: transparent;
  color: var(--cob-label);
  cursor: pointer;
}
.co-bollettino__pause[hidden] { display: none; }
.co-bollettino__pause:hover,
.co-bollettino__pause:focus-visible { color: var(--cob-accent); border-color: var(--cob-accent); }
.co-bollettino__pause svg { fill: currentColor; }
.co-bollettino__pause .co-i-play,
.co-bollettino.is-paused .co-bollettino__pause .co-i-pause { display: none; }
.co-bollettino.is-paused .co-bollettino__pause .co-i-play { display: inline; }

@media (max-width: 767px) {
  .co-bollettino { font-size: 12px; height: 36px; }
  .co-bollettino__inner { gap: 12px; padding: 0 12px; }
  .co-bollettino__items { gap: 20px; }
  .co-bollettino__date { display: none; }
  /* Su mobile l'etichetta diventa l'icona del meteo della regione mostrata;
     il testo resta per i lettori di schermo. */
  .co-bollettino__badge { display: inline-flex; padding: 3px; }
  .co-bollettino__badge-text {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    white-space: nowrap;
  }
  .co-bollettino__badge-icon { display: block; width: 22px; height: 22px; }
}

@media print {
  .co-bollettino { display: none; }
}

/* 2. Widget: elementi comuni ---------------------------------------------- */
.co-meteo {
  --com-ink: var(--co-ink, #111318);
  --com-text-2: var(--co-text-2, #3D4046);
  --com-muted: var(--co-muted, #5A5D63);
  --com-rule: var(--co-rule, #D9D8CF);
  --com-paper-2: var(--co-paper-2, #ECEBE4);
  --com-accent: var(--co-blue, #2340E8);
  --com-lime: var(--co-lime, #D4F25A);
  --com-serif: var(--co-serif, 'Newsreader', Georgia, serif);
  --com-sans: var(--co-sans, 'IBM Plex Sans Condensed', 'Arial Narrow', Arial, sans-serif);
  --com-mono: var(--co-mono, 'IBM Plex Mono', ui-monospace, Menlo, Consolas, monospace);

  color: var(--com-ink);
  font-family: var(--com-mono);
  font-size: 12px;
  line-height: 1.4;
}
.co-meteo *,
.co-meteo *::before,
.co-meteo *::after { box-sizing: border-box; }

.co-meteo__loading {
  min-height: 280px;
  margin: 0;
  color: var(--com-muted);
  letter-spacing: .06em;
  text-transform: uppercase;
}
.co-meteo--grande .co-meteo__loading { min-height: 560px; }

.co-meteo__icon { display: inline-flex; flex: none; color: var(--com-ink); }
.co-meteo__icon svg { width: 100%; height: 100%; display: block; }
.co-meteo__icon .co-acc { stroke: var(--com-accent); }
.co-meteo__icon .co-acc-fill { fill: var(--com-accent); stroke: none; }

.co-meteo__temp { display: flex; flex-direction: column; line-height: 1; }
.co-meteo__deg {
  font-family: var(--com-serif);
  font-weight: 500;
  letter-spacing: -0.02em;
}
.co-meteo__official { margin-top: 6px; color: var(--com-muted); font-size: 11px; letter-spacing: .04em; }

.co-meteo__sky {
  margin: 0;
  font-family: var(--com-serif);
  font-style: italic;
  font-size: 17px;
  line-height: 1.25;
  color: var(--com-text-2);
}

/* Etichetta dell'indice di nebulizzazione: più è alto, più "grida" */
.co-chip {
  display: inline-block;
  padding: 3px 6px 2px;
  border: 1px solid var(--com-ink);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: .08em;
  line-height: 1.2;
  white-space: nowrap;
}
.co-chip--0 { border-color: var(--com-rule); color: var(--com-muted); }
.co-chip--1 { background: var(--com-paper-2); border-color: var(--com-paper-2); }
.co-chip--2 { background: var(--com-lime); border-color: var(--com-lime); }
.co-chip--3 { background: var(--com-ink); border-color: var(--com-ink); color: var(--com-lime); }
.co-chip--nd { border-style: dashed; border-color: var(--com-muted); color: var(--com-muted); }

.co-haarp { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.co-haarp__dot { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.co-haarp__dot--0 { background: #4E9A5B; }
.co-haarp__dot--1 { background: #E2B93B; }
.co-haarp__dot--2 { background: #E8833A; }
.co-haarp__dot--3 { background: #D9452B; box-shadow: 0 0 0 3px rgba(217, 69, 43, .2); }

.co-meteo__credit a,
.co-meteo__foot a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
.co-meteo__credit a:hover,
.co-meteo__foot a:hover { color: var(--com-accent); }

/* 3. Widget compatto (sidebar) -------------------------------------------- */
.co-meteo--compatto .co-meteo__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--com-ink);
}
/* .co-meteo select... batte lo stile generico dei select del tema (.co-skin select) */
.co-meteo select.co-meteo__select {
  flex: 1;
  min-width: 0;
  max-width: 220px;
  height: auto;
  margin: 0;
  padding: 6px 28px 6px 8px;
  border: 1px solid var(--com-ink);
  border-radius: 0;
  background: transparent url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%23111318' stroke-width='1.5'/%3E%3C/svg%3E") no-repeat right 9px center / 10px 6px;
  -webkit-appearance: none;
          appearance: none;
  color: var(--com-ink);
  font-family: var(--com-sans);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  line-height: 1.2;
  cursor: pointer;
}
.co-meteo select.co-meteo__select:focus-visible { outline: 2px solid var(--com-accent); outline-offset: 2px; }
.co-meteo__date { color: var(--com-muted); letter-spacing: .04em; white-space: nowrap; }

.co-meteo--compatto .co-meteo__main {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 18px 0 10px;
}
.co-meteo--compatto .co-meteo__icon { width: 76px; height: 76px; }
.co-meteo--compatto .co-meteo__deg { font-size: 56px; }

.co-meteo__list { margin: 14px 0 0; padding: 0; }
.co-meteo__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0;
  border-top: 1px solid var(--com-rule);
}
.co-meteo__row dt { margin: 0; color: var(--com-muted); font-weight: 400; }
.co-meteo__row dd { margin: 0; text-align: right; font-weight: 500; }

.co-meteo__note {
  margin: 4px 0 0;
  padding: 10px 12px;
  background: var(--com-paper-2);
  border-left: 3px solid var(--com-accent);
  font-size: 12px;
}
.co-meteo__foot { margin: 10px 0 0; color: var(--com-muted); font-size: 11px; }

/* 4. Widget grande (home) ------------------------------------------------- */
.co-meteo--grande .co-meteo__top {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px 28px;
  padding: 12px 0;
  border-top: 3px solid var(--com-ink);
  border-bottom: 1px solid var(--com-ink);
}
.co-meteo__longdate {
  margin-right: auto;
  font-family: var(--com-sans);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
}
.co-meteo__stat { display: inline-flex; gap: 6px; }
.co-meteo__stat-label { color: var(--com-muted); }
.co-meteo__stat-label::after { content: ":"; }
.co-meteo__stat-value { font-weight: 600; }

.co-meteo__grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 1px;
  background: var(--com-rule);
  border-bottom: 1px solid var(--com-rule);
}
.co-meteo__card {
  margin: 0;
  padding: 14px 14px 16px;
  background: var(--co-paper, #F5F5F0);
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}
.co-meteo__card-head { display: flex; flex-direction: column; gap: 2px; }
.co-meteo__region {
  font-family: var(--com-sans);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  line-height: 1.15;
}
.co-meteo__city { color: var(--com-muted); font-size: 11px; }
.co-meteo__card-main { display: flex; align-items: center; gap: 12px; }
.co-meteo--grande .co-meteo__icon { width: 46px; height: 46px; }
.co-meteo--grande .co-meteo__deg { font-size: 34px; }
.co-meteo--grande .co-meteo__official { margin-top: 4px; font-size: 10.5px; }
.co-meteo--grande .co-meteo__sky { font-size: 15px; flex: 1; }
.co-meteo__card-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  font-size: 11px;
}

.co-meteo__legend {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 6px 20px;
  padding-top: 10px;
  color: var(--com-muted);
  font-size: 11px;
}

/* Il widget grande messo in una sidebar si adatta alla colonna stretta */
.sidebar .co-meteo--grande .co-meteo__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.sidebar .co-meteo--grande .co-meteo__top { flex-direction: column; gap: 4px; }

@media (max-width: 1199px) {
  .co-meteo__grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (max-width: 991px) {
  .co-meteo__grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 600px) {
  .co-meteo__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .co-meteo__card { padding: 12px 10px 14px; }
  .co-meteo--grande .co-meteo__icon { width: 38px; height: 38px; }
  .co-meteo--grande .co-meteo__deg { font-size: 28px; }
  .co-meteo--grande .co-meteo__top { gap: 4px 16px; }
  .co-meteo__longdate { width: 100%; }
}
