/* Capçalera global (avís + logo + menús) i les variables de la web que necessita. Es carrega a TOTES les pàgines: portada, llistats, «Troba fitxes»
   (via base_web.html, amb site.css) i la pàgina de cada fitxa (fitxa_visor.html, amb visor.css). */
:root {
  --bg: #fdf8f2;
  --card: #fff;
  --ink: #1f1f1f;
  --ink-2: #1f1f1f;
  --line: #ecdcc9;
  --brand: #4a3d7d;
  --brand-2: #8e7dbe;
  --brand-2-text: #6354a0; /* violeta fosc per a text i enllaços sobre blanc (contrast) */
  --brand-suau: #f1eef8;
  --sec: #f9e5cf; /* color secundari (crema) */
  --sun: #f2d0a9;
  --shadow: 0 1px 2px rgba(42, 35, 71, .06), 0 6px 18px rgba(42, 35, 71, .07);
  --shadow-up: 0 2px 4px rgba(42, 35, 71, .08), 0 14px 30px rgba(42, 35, 71, .13);
  --titols: "Fredoka", "Andika", system-ui, sans-serif;
  --tipus-text: "Andika", "Atkinson Hyperlegible", "Segoe UI", system-ui, sans-serif;
}
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }
.logo { font-family: var(--titols); }
.web-cap :focus-visible { outline: 3px solid var(--brand-2); outline-offset: 2px; }

/* ---------- capçalera global ---------- */
.web-cap { position: sticky; top: 0; z-index: 30; background: rgba(255, 255, 255, .96); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
/* Avís fix: una sola línia dins la capçalera enganxosa; el detall es desplega com a capa (no empeny el contingut) */
:root { --avis-h: 1.9rem; }
.avis { position: relative; background: var(--sec); border-bottom: 1px solid #ebc79d; font-size: .84rem; line-height: 1.3; }
.avis summary { list-style: none; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: .7rem; min-height: var(--avis-h); padding: .2rem 1.2rem; }
.avis summary::-webkit-details-marker { display: none; }
.avis summary b { font-family: var(--titols); font-weight: 600; font-size: .92rem; white-space: nowrap; }
.avis-resum { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.avis-mes { flex: none; font-weight: 700; color: var(--brand); background: #fff; border-radius: 999px; padding: .05rem .65rem; box-shadow: var(--shadow); }
.avis-mes::before { content: attr(data-mes); }
.avis[open] .avis-mes::before { content: attr(data-menys); }
.avis summary:hover .avis-mes { background: var(--brand-suau); }
.avis-cos { position: absolute; left: 0; right: 0; top: 100%; z-index: 2; background: var(--sec); border-bottom: 1px solid #ebc79d; box-shadow: var(--shadow-up); padding: .7rem max(1.2rem, calc((100% - 73.6rem) / 2)) .8rem; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .4rem 1.4rem; }
.avis-cos p { margin: 0; }
.avis-cos a { color: var(--brand); font-weight: 700; }
.avis-fi { grid-column: 1 / -1; font-weight: 700; text-align: center; }
@media (max-width: 760px) {
  .avis summary { gap: .5rem; padding: .2rem .8rem; }
  .avis-resum { display: none; }
  .avis-cos { grid-template-columns: 1fr; max-height: 70vh; overflow-y: auto; }
}
.web-cap-in { position: relative; max-width: 76rem; margin: 0 auto; padding: .55rem 1.2rem; display: flex; align-items: center; gap: .8rem; }
.logo { font-size: 1.55rem; font-weight: 700; color: #1f1f1f; text-decoration: none; letter-spacing: -.01em; margin-right: .6rem; }
.logo span { color: var(--brand-2); }
.web-nav { display: flex; align-items: center; gap: .15rem; flex: none; margin-left: auto; }
.web-nav > a, .mn-b { text-decoration: none; color: var(--ink); font-weight: 700; font-size: .93rem; padding: .45rem .85rem; border-radius: 999px; transition: background .12s; display: inline-flex; align-items: center; gap: .3rem; }
.web-nav > a:hover, .mn-b:hover, .mn-b[aria-expanded="true"] { background: #fff; box-shadow: var(--shadow); }
.mn-b::after { content: ""; width: .45rem; height: .45rem; border: solid currentColor; border-width: 0 2px 2px 0; transform: rotate(45deg) translateY(-2px); opacity: .7; }
.web-nav > a.nav-troba { background: #e6e0f3; color: #1f1f1f; margin-left: .3rem; } /* el lila de la marca, molt més clar */
.web-nav > a.nav-troba:hover { background: #d6cceb; box-shadow: none; }
.mn { position: static; }
.mn-p { position: absolute; top: calc(100% + .35rem); right: 1.2rem; left: auto; z-index: 40; width: max-content; max-width: calc(100vw - 2rem); background: #fff; border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow-up); padding: .7rem; }
.mn-cursos-g { display: grid; grid-template-columns: repeat(var(--cols, 2), 13.5rem); gap: .3rem; }
.mn-curs { display: flex; align-items: center; gap: .65rem; padding: .5rem .6rem; border-radius: 12px; text-decoration: none; color: var(--ink); }
.mn-curs:hover { background: color-mix(in srgb, var(--c) 10%, #fff); }
.mn-curs b { display: block; font-family: var(--titols); font-weight: 600; line-height: 1.15; }
.mn-curs small { color: #1f1f1f; font-size: .75rem; font-weight: 700; }
.mn-tema-g { display: grid; grid-template-columns: repeat(3, 14rem); gap: .3rem; }
.mn-assig-g { display: grid; grid-template-columns: repeat(2, 15rem); gap: .3rem; }
.mn-tema-g a, .mn-assig-g a { display: flex; align-items: center; gap: .65rem; padding: .5rem .6rem; border-radius: 12px; text-decoration: none; color: var(--ink); }
.mn-tema-g a:hover, .mn-assig-g a:hover { background: var(--acento-suau); }
.mn-tema-g b, .mn-assig-g b { display: block; font-family: var(--titols); font-weight: 600; line-height: 1.15; }
.mn-tema-g small, .mn-assig-g small { color: #1f1f1f; font-size: .75rem; font-weight: 700; }
.mn-ico { display: grid; place-items: center; width: 2.2rem; height: 2.2rem; border-radius: 10px; background: var(--acento-suau); color: var(--acento); flex: none; }
.mn-ico .svg-ico { width: 1.2rem; height: 1.2rem; }
.cap-cerca { flex: 1 1 auto; max-width: 36rem; margin: 0 auto; display: flex; align-items: center; gap: .6rem; font: inherit; font-weight: 700; font-size: .95rem; cursor: pointer; color: #1f1f1f; background: #fff; border: 2px solid var(--line); border-radius: 999px; padding: .5rem .7rem .5rem 1rem; box-shadow: var(--shadow); }
.cap-cerca:hover { border-color: var(--brand-2); color: var(--ink); }
.cap-cerca svg { width: 1.1rem; height: 1.1rem; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; }
.cap-cerca span { flex: 1; text-align: left; }
.cap-cerca kbd { font: inherit; font-size: .75rem; padding: 0 .4rem; border: 1px solid var(--line); border-radius: 6px; background: var(--bg); color: #1f1f1f; }
.cap-menu { display: none; font: inherit; font-weight: 700; cursor: pointer; padding: .42rem .9rem; border-radius: 999px; border: 1.5px solid var(--line); background: #fff; color: var(--ink); margin-left: auto; }
@media (max-width: 860px) {
  .cap-menu { display: inline-block; }
  .cap-cerca kbd { display: none; }
  .cap-cerca { padding: .45rem .9rem; }
  .web-nav { display: none; position: absolute; top: 100%; left: 0; right: 0; flex-direction: column; align-items: stretch; gap: .2rem; padding: .7rem 1.2rem 1rem; background: #fff; border-bottom: 1px solid var(--line); box-shadow: var(--shadow-up); max-height: calc(100vh - 4rem); overflow-y: auto; }
  .web-nav.obert { display: flex; }
  .web-nav > a, .mn-b { padding: .7rem .5rem; justify-content: space-between; }
  .web-nav > a.nav-troba { margin: .3rem 0 0; justify-content: center; }
  .mn-p { position: static; width: auto; max-width: none; box-shadow: none; border: 0; padding: .2rem 0 .6rem; }
  .mn-cursos-g { grid-template-columns: repeat(2, 1fr); }
  .mn-assig-g { grid-template-columns: 1fr; }
  .mn-tema-g { grid-template-columns: repeat(2, 1fr); }
}

