/* Monitor de butlletins: mateixa estètica que El Compromís d'Educar. */

@font-face {
  font-family: 'Merriweather';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('fonts/merriweather-latin-ext-700-normal.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Merriweather';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('fonts/merriweather-latin-700-normal.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Source Sans 3';
  font-style: normal;
  font-weight: 200 900;
  font-display: swap;
  src: url('fonts/source-sans-3-latin-ext-wght-normal.woff2') format('woff2-variations');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Source Sans 3';
  font-style: normal;
  font-weight: 200 900;
  font-display: swap;
  src: url('fonts/source-sans-3-latin-wght-normal.woff2') format('woff2-variations');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --navy-900: #0f1d38;
  --navy-800: #14264a;
  --navy-700: #1d3461;
  --navy-600: #2a4677;
  --slate-400: #7d8ea8;
  /* Gris per a text sobre fons clar (contrast ≥ 4,5:1, WCAG AA). */
  --slate-500: #5a6982;
  --slate-300: #aebbcf;
  --slate-200: #d3dbe7;
  --slate-100: #e7ecf3;
  --ivory: #f7f2e7;
  --paper: #fbf8f1;
  --ink: #23262d;
  --ink-soft: #4a4f5a;
  --boe: #8c2f24;
  --boe-bg: #f6e6e1;
  --boib: #1f5a63;
  --boib-bg: #dfeeef;
  --error: #9b3b32;
  --font-serif: 'Merriweather', Georgia, 'Times New Roman', serif;
  --font-sans: 'Source Sans 3', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --radius: 6px;
  --shadow: 0 1px 2px rgb(15 29 56 / 0.06), 0 6px 20px rgb(15 29 56 / 0.06);
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--ivory);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 1.0625rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

.is-embed body { background: transparent; }

a { color: var(--navy-600); text-underline-offset: 0.18em; }
a:hover { color: var(--navy-800); }
:focus-visible { outline: 2px solid #b08a4a; outline-offset: 2px; }

[hidden] { display: none !important; }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.wrap { width: 100%; max-width: 70rem; margin-inline: auto; padding-inline: 1.25rem; }
.is-embed .wrap { max-width: none; padding-inline: 0.25rem; }

/* Capçalera */
.topbar { background: var(--navy-800); color: var(--ivory); border-bottom: 3px solid var(--navy-900); }
.topbar__inner {
  display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between;
  gap: 1.5rem; padding-block: 2rem 1.75rem;
}
.eyebrow {
  margin: 0 0 0.35rem; font-size: 0.78rem; font-weight: 600; letter-spacing: 0.16em;
  text-transform: uppercase; color: var(--slate-300);
}
.topbar__title { margin: 0; font-family: var(--font-serif); font-size: clamp(1.5rem, 1.1rem + 1.6vw, 2.2rem); line-height: 1.25; }
.topbar__lead { margin: 0.5rem 0 0; color: var(--slate-200); max-width: 38rem; }

.sync { display: flex; flex-direction: column; align-items: flex-end; gap: 0.4rem; }
.sync__status { margin: 0; font-size: 0.88rem; color: var(--slate-300); text-align: right; }
.topbar .button { background: var(--ivory); color: var(--navy-800); border-color: var(--ivory); }
.topbar .button:hover:not(:disabled) { background: var(--paper); }

/* Botons */
.button {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem;
  padding: 0.6rem 1.2rem; border: 1px solid var(--navy-800); border-radius: var(--radius);
  background: var(--navy-800); color: var(--ivory); font: inherit; font-size: 0.95rem; font-weight: 600;
  text-decoration: none; cursor: pointer;
  transition: background-color 0.18s ease, color 0.18s ease, box-shadow 0.25s cubic-bezier(0.22, 1, 0.36, 1), transform 0.25s cubic-bezier(0.22, 1, 0.36, 1);
}
.button:hover:not(:disabled) { background: var(--navy-700); color: var(--paper); transform: translateY(-1px); box-shadow: 0 4px 12px rgb(15 29 56 / 0.16); }
.button:active:not(:disabled) { transform: translateY(0) scale(0.97); box-shadow: none; transition-duration: 0.08s; }
.button:disabled { opacity: 0.6; cursor: progress; }
.button--ghost { background: transparent; color: var(--navy-800); }
.button--ghost:hover:not(:disabled) { background: var(--navy-800); color: var(--ivory); }
.button--small { padding: 0.4rem 0.9rem; font-size: 0.88rem; }

/* Filtres */
.main { padding-block: 1.75rem 3rem; }
.is-embed .main { padding-block: 0.5rem 1rem; }

.filters {
  display: grid; grid-template-columns: minmax(14rem, 2.2fr) repeat(2, minmax(8rem, 1fr)) repeat(2, minmax(9rem, 1fr)) auto;
  gap: 0.9rem; align-items: end;
  padding: 1.1rem; background: var(--paper); border: 1px solid var(--slate-200); border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.field label { display: block; margin-bottom: 0.3rem; font-size: 0.82rem; font-weight: 600; color: var(--navy-800); }
.field input, .field select {
  width: 100%; min-height: 2.75rem; padding: 0.5rem 0.7rem; font: inherit; font-size: 1rem; color: var(--ink);
  background: var(--ivory); border: 1px solid var(--slate-300); border-radius: var(--radius);
}
.field input:focus, .field input:focus-within, .field select:focus {
  outline: none; border-color: var(--navy-600); background: #fff; box-shadow: 0 0 0 3px rgb(42 70 119 / 0.18);
}

.summary {
  display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 0.5rem 1.5rem;
  margin: 1.25rem 0 0.75rem; font-size: 0.93rem; color: var(--ink-soft);
}
.summary p { margin: 0; }
.follow { display: inline-flex; flex-wrap: wrap; gap: 0.25rem 1rem; margin-right: auto; }
.rss-link { display: inline-block; padding-block: 0.45rem; font-size: 0.88rem; font-weight: 600; }
.checks { display: inline-flex; flex-wrap: wrap; gap: 0.25rem 1.25rem; }
.check { display: inline-flex; align-items: center; gap: 0.45rem; cursor: pointer; }
.check input { flex: none; width: 1.1rem; height: 1.1rem; margin: 0; accent-color: var(--navy-800); }

.notice { padding: 0.75rem 1rem; border-radius: var(--radius); }
.notice--error { background: #f6e6e1; border-left: 3px solid var(--error); color: var(--error); }
.notice--ai {
  margin: 1rem 0 0; font-size: 0.92rem; line-height: 1.5; color: var(--ink-soft);
  background: var(--slate-100); border-left: 3px solid var(--navy-700);
}
.notice--ai strong { color: var(--navy-800); }

/* Subscripció */
.panel {
  max-width: 44rem; padding: 1.5rem 1.6rem; background: var(--paper); border: 1px solid var(--slate-200);
  border-radius: var(--radius); box-shadow: var(--shadow);
}
.panel h2 { margin: 0 0 0.75rem; font-family: var(--font-serif); font-size: 1.3rem; color: var(--navy-800); }
.panel p { margin: 0 0 1rem; }
.panel .notice { margin-bottom: 1rem; }
.notice--ok { background: var(--boib-bg); border-left: 3px solid var(--boib); color: var(--boib); }
.subscribe { display: grid; gap: 1.1rem; }
.subscribe p { margin: 0; }
.choices { margin: 0; padding: 0.8rem 1rem 0.9rem; border: 1px solid var(--slate-200); border-radius: var(--radius); }
.choices legend { padding: 0 0.35rem; font-size: 0.82rem; font-weight: 600; color: var(--navy-800); }
.choices .check { min-height: 2.5rem; margin: 0 1.25rem 0 0; }
.privacy {
  display: grid; grid-template-columns: max-content 1fr; gap: 0.25rem 1rem; margin: 0; padding: 0.9rem 1rem;
  font-size: 0.86rem; color: var(--ink-soft); background: var(--slate-100); border-radius: var(--radius);
}
.privacy dt { font-weight: 600; color: var(--navy-800); }
.privacy dd { margin: 0; }
.check--consent { align-items: flex-start; font-size: 0.95rem; }
.check--consent input { margin-top: 0.3rem; }
.note { font-size: 0.86rem; color: var(--ink-soft); }
.subscribe .button { justify-self: start; }
.unsubscribe { margin-top: 1.5rem; padding-top: 1.25rem; border-top: 1px solid var(--slate-200); }
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

/* Targetes */
.feed { list-style: none; margin: 0; padding: 0; display: grid; gap: 1rem; }

.card {
  padding: 1.25rem 1.4rem; background: var(--paper); border: 1px solid var(--slate-200);
  border-left: 4px solid var(--navy-700); border-radius: var(--radius); box-shadow: var(--shadow);
}
.card[data-origen='BOE'] { border-left-color: var(--boe); }
.card[data-origen='BOIB'] { border-left-color: var(--boib); }
.card.is-discarded { border-left-style: dashed; background: var(--ivory); box-shadow: none; }

.card__meta { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 0.75rem; font-size: 0.85rem; color: var(--ink-soft); }
.badge {
  display: inline-block; padding: 0.1rem 0.5rem; border-radius: 3px; font-size: 0.75rem; font-weight: 700;
  letter-spacing: 0.08em;
}
.badge--BOE { background: var(--boe-bg); color: var(--boe); }
.badge--BOIB { background: var(--boib-bg); color: var(--boib); }
.chip {
  display: inline-block; padding: 0.05rem 0.55rem; border: 1px solid var(--slate-300); border-radius: 999px;
  font-size: 0.8rem; color: var(--navy-700); background: var(--slate-100);
}
.chip--muted { color: var(--ink-soft); border-style: dashed; background: transparent; }

.card__title {
  margin: 0.6rem 0 0.3rem; font-family: var(--font-serif); font-size: 1.08rem; font-weight: 700; line-height: 1.45;
  color: var(--navy-800);
}
.card__emissor { margin: 0 0 0.6rem; font-size: 0.88rem; color: var(--slate-500); text-transform: uppercase; letter-spacing: 0.03em; }
.card__summary { margin: 0 0 0.9rem; color: var(--ink); }
.card__summary.is-pending { color: var(--ink-soft); font-style: italic; }
.ai-label {
  display: inline-block; margin-right: 0.35rem; padding: 0 0.4rem; border-radius: 3px;
  font-size: 0.72rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; vertical-align: 0.1em;
  color: var(--navy-700); background: var(--slate-100); border: 1px solid var(--slate-200); cursor: help;
}
.card__actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 1rem; }
.card__id { margin-left: auto; font-size: 0.8rem; color: var(--slate-500); font-variant-numeric: tabular-nums; }

.empty { padding: 2.5rem 1rem; text-align: center; color: var(--ink-soft); border: 1.5px dashed var(--slate-300); border-radius: var(--radius); }

.skeleton { height: 9rem; border-radius: var(--radius); background: linear-gradient(90deg, var(--slate-100), var(--paper), var(--slate-100)); background-size: 200% 100%; animation: shimmer 1.4s infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }

.more { display: flex; justify-content: center; margin-top: 1.5rem; }

.footer { border-top: 1px solid var(--slate-200); padding-block: 1.5rem 2rem; font-size: 0.88rem; color: var(--ink-soft); }
.footer p { margin: 0; }

@media (max-width: 60rem) {
  .filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .field--search { grid-column: 1 / -1; }
  .filters__actions { grid-column: 1 / -1; }
  .filters__actions .button { width: 100%; }
}

@media (max-width: 36rem) {
  .panel { padding: 1.15rem 1rem; }
  .privacy { grid-template-columns: 1fr; }
  .privacy dd { margin-bottom: 0.4rem; }
  .topbar__inner { align-items: stretch; }
  .sync { align-items: stretch; }
  .sync__status { text-align: left; }
  .card { padding: 1.1rem; }
  .card__id { margin-left: 0; width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
