/* =====================================================================
   Votacions · Festa de la Llana
   Ajusta els colors i tipografies aquí per igualar-los amb festadelallana.cat
   ===================================================================== */
:root {
  --c-primary:   #8a1c2b;   /* color principal (botons, títols) */
  --c-primary-d: #6a1420;
  --c-accent:    #d8a031;   /* accent (destacats, guanyadors) */
  --c-bg:        #faf6f0;   /* fons general (to llana/cru) */
  --c-surface:   #ffffff;
  --c-text:      #2a1f1d;
  --c-muted:     #7a6e69;
  --c-border:    #e8dfd4;
  --c-ok:        #2e7d4f;
  --c-warn:      #b7791f;
  --c-error:     #b3261e;
  --c-info:      #2b5c8a;
  --f-body:      'Montserrat', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --f-title:     'Playfair Display', Georgia, serif;
  --radius:      14px;
  --shadow:      0 2px 6px rgba(42, 31, 29, .06), 0 10px 30px rgba(42, 31, 29, .06);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--f-body); color: var(--c-text); background: var(--c-bg); line-height: 1.55; font-size: 16px; display: flex; flex-direction: column; min-height: 100vh; }
img { max-width: 100%; display: block; }
a { color: var(--c-primary); }
h1, h2, h3 { font-family: var(--f-title); line-height: 1.2; margin: 0 0 .5em; color: var(--c-text); }
h1 { font-size: clamp(1.8rem, 4vw, 2.8rem); }
h2 { font-size: clamp(1.3rem, 2.5vw, 1.7rem); }
code { font-size: .9em; }
.wrap { width: 100%; max-width: 1180px; margin: 0 auto; padding: 0 16px; }
.narrow { max-width: 560px; margin-left: auto; margin-right: auto; }
.narrow-lg { max-width: 760px; margin-left: auto; margin-right: auto; }
.muted { color: var(--c-muted); }
.small { font-size: .86rem; }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
.grow { flex: 1; }
.inline { display: inline; }
.site-main { flex: 1; padding-bottom: 3rem; }

/* ---------- Capçalera ---------- */
.site-header { background: var(--c-primary-d); border-bottom: 3px solid var(--c-accent); position: sticky; top: 0; z-index: 20; }
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 1rem; min-height: 72px; }
.brand { display: flex; align-items: center; gap: .75rem; text-decoration: none; color: #fff; }
.brand-logo { height: 56px; width: auto; }
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-name { font-family: var(--f-title); font-weight: 700; font-size: 1.2rem; }
.brand-sub { font-size: .72rem; text-transform: uppercase; letter-spacing: .14em; color: var(--c-accent); font-weight: 700; }
.header-nav { display: flex; align-items: center; gap: 1.1rem; flex-wrap: wrap; justify-content: flex-end; }
.header-nav > a { text-decoration: none; color: #fff; font-weight: 600; font-size: .9rem; text-transform: uppercase; letter-spacing: .05em; }
.header-nav > a:hover { color: var(--c-accent); }
.lang-switch { display: inline-flex; border: 1px solid rgba(255,255,255,.35); border-radius: 999px; overflow: hidden; }
.lang-switch a { padding: .25rem .6rem; font-size: .75rem; font-weight: 700; text-decoration: none; color: rgba(255,255,255,.75); }
.lang-switch a.active { background: #fff; color: var(--c-primary-d); }
@media (max-width: 640px) { .nav-main { display: none; } .brand-logo { height: 40px; } .brand-name { font-size: 1rem; } }

/* ---------- Hero ---------- */
.hero { background: linear-gradient(135deg, var(--c-primary) 0%, var(--c-primary-d) 100%); color: #fff; padding: 2.5rem 0; margin-bottom: 2rem; position: relative; overflow: hidden; }
.hero::after { content: ''; position: absolute; inset: 0; background: radial-gradient(circle at 85% 20%, rgba(255,255,255,.08) 0, transparent 45%); pointer-events: none; }
.hero h1, .hero .lead { color: #fff; }
.hero-inner { display: grid; grid-template-columns: 260px 1fr; gap: 2rem; align-items: center; position: relative; z-index: 1; }
.hero-poster img { border-radius: 10px; box-shadow: 0 12px 40px rgba(0,0,0,.35); width: 100%; }
.hero .lead { font-size: 1.1rem; opacity: .95; max-width: 60ch; }
.hero-dates { display: flex; gap: 2rem; margin: 1.2rem 0 0; flex-wrap: wrap; }
.hero-dates dt { font-size: .72rem; text-transform: uppercase; letter-spacing: .12em; opacity: .8; }
.hero-dates dd { margin: 0; font-weight: 700; font-size: 1.05rem; }
.hero-compact { padding: 1.4rem 0; }
.hero-compact .hero-inner { grid-template-columns: 90px 1fr; gap: 1.2rem; }
.hero-compact h1 { font-size: clamp(1.4rem, 3vw, 2rem); }
.hero-plain { padding: 2.5rem 0; }
@media (max-width: 720px) {
  .hero-inner { grid-template-columns: 1fr; }
  .hero-poster { max-width: 220px; }
  .hero-compact .hero-inner { grid-template-columns: 70px 1fr; }
}

/* ---------- Components ---------- */
.card { background: var(--c-surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.6rem; margin-bottom: 1.5rem; border: 1px solid var(--c-border); }
.card-center { text-align: center; padding: 2.5rem 1.6rem; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; background: var(--c-primary); color: #fff; border: 2px solid var(--c-primary); border-radius: 999px; padding: .65rem 1.4rem; font: 700 .9rem var(--f-body); text-transform: uppercase; letter-spacing: .05em; text-decoration: none; cursor: pointer; transition: background .15s, transform .1s; }
.btn:hover { background: var(--c-primary-d); border-color: var(--c-primary-d); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-ghost { background: transparent; color: var(--c-primary); }
.btn-ghost:hover { background: rgba(138, 28, 43, .07); color: var(--c-primary-d); }
.btn-danger { background: var(--c-error); border-color: var(--c-error); }
.btn-lg { padding: .9rem 2rem; font-size: 1rem; }
.btn-sm { padding: .4rem .9rem; font-size: .75rem; }
.btn-xs { padding: .15rem .55rem; font-size: .75rem; }
.btn-block { width: 100%; }
.badge { display: inline-block; padding: .2rem .7rem; border-radius: 999px; font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; background: #eee; color: #444; }
.badge-active { background: #e2f3e8; color: var(--c-ok); }
.badge-upcoming { background: #fdf1d8; color: var(--c-warn); }
.badge-expired, .badge-finished { background: #ece7e3; color: #5b4f4a; }
.badge-draft { background: #e7eef6; color: var(--c-info); }
.hero .badge { background: rgba(255,255,255,.18); color: #fff; }
.alert { padding: .85rem 1.1rem; border-radius: 10px; margin: 0 0 1rem; border-left: 4px solid; background: #fff; }
.alert-ok { border-color: var(--c-ok); background: #eef8f1; }
.alert-warn { border-color: var(--c-warn); background: #fdf6e7; }
.alert-error { border-color: var(--c-error); background: #fcecea; }
.alert-info { border-color: var(--c-info); background: #edf3f9; }

/* ---------- Formularis ---------- */
.field { display: block; margin-bottom: 1rem; }
.field > span { display: block; font-weight: 600; font-size: .88rem; margin-bottom: .3rem; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=datetime-local], input:not([type]), select, textarea {
  width: 100%; padding: .7rem .85rem; border: 1.5px solid var(--c-border); border-radius: 10px; font: inherit; background: #fff; color: var(--c-text); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--c-primary); box-shadow: 0 0 0 3px rgba(138, 28, 43, .12); }
.check-line { display: flex; gap: .6rem; align-items: flex-start; margin: .6rem 0; font-size: .92rem; cursor: pointer; }
.check-line input { margin-top: .25rem; accent-color: var(--c-primary); width: 18px; height: 18px; flex: none; }
.err { color: var(--c-error); font-weight: 600; display: block; margin-top: .25rem; }
.validate-form .btn-block { margin-top: 1rem; }

/* ---------- Papereta ---------- */
.ballot-help { text-align: center; font-weight: 600; color: var(--c-muted); }
.question { margin: 2rem 0 2.5rem; }
.question-head { display: flex; gap: 1rem; align-items: flex-start; margin-bottom: 1rem; border-bottom: 2px solid var(--c-border); padding-bottom: .8rem; }
.question-head h2 { margin: 0; }
.question-head p { margin: .2rem 0 0; }
.q-num { flex: none; width: 42px; height: 42px; border-radius: 50%; background: var(--c-primary); color: #fff; display: grid; place-items: center; font-weight: 800; font-size: 1.1rem; }
.cand-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 1.1rem; }
.cand { position: relative; cursor: pointer; display: block; }
.cand input { position: absolute; opacity: 0; pointer-events: none; }
.cand-card { display: flex; flex-direction: column; height: 100%; background: var(--c-surface); border: 2px solid var(--c-border); border-radius: var(--radius); overflow: hidden; transition: border-color .15s, box-shadow .15s, transform .15s; position: relative; }
.cand:hover .cand-card { transform: translateY(-2px); box-shadow: var(--shadow); }
.cand input:checked + .cand-card { border-color: var(--c-primary); box-shadow: 0 0 0 3px rgba(138, 28, 43, .18), var(--shadow); }
.cand input:focus-visible + .cand-card { outline: 3px solid var(--c-accent); outline-offset: 2px; }
.cand-photo { aspect-ratio: 4 / 5; background: #efe7dd; display: block; overflow: hidden; }
.cand-photo img { width: 100%; height: 100%; object-fit: cover; }
.ph { display: grid; place-items: center; width: 100%; height: 100%; font-family: var(--f-title); font-size: 3rem; color: var(--c-primary); opacity: .5; }
.cand-body { padding: .9rem 1rem 1.1rem; display: flex; flex-direction: column; gap: .3rem; }
.cand-name { font-weight: 800; font-size: 1.05rem; }
.cand-claim { font-family: var(--f-title); font-style: italic; color: var(--c-primary); }
.cand-more summary { font-size: .82rem; font-weight: 600; color: var(--c-muted); cursor: pointer; }
.cand-more p { font-size: .9rem; margin: .4rem 0 0; }
.cand-tick { position: absolute; top: 10px; right: 10px; width: 34px; height: 34px; border-radius: 50%; background: var(--c-primary); color: #fff; display: grid; place-items: center; font-weight: 800; opacity: 0; transform: scale(.6); transition: .15s; }
.cand input:checked + .cand-card .cand-tick { opacity: 1; transform: scale(1); }
.cand-grid.readonly .cand { cursor: default; }
.ballot-summary { max-width: 640px; margin: 2rem auto 0; border: 2px solid var(--c-primary); }
.ballot-summary ul { list-style: none; padding: 0; margin: 0 0 .6rem; }
.ballot-summary li { padding: .25rem 0; border-bottom: 1px dashed var(--c-border); }
.ballot-summary li.pending span { color: var(--c-muted); font-style: italic; }
.thanks .check { width: 72px; height: 72px; margin: 0 auto 1rem; border-radius: 50%; background: var(--c-ok); color: #fff; display: grid; place-items: center; font-size: 2.2rem; }

/* ---------- Resultats ---------- */
.stats { display: flex; flex-wrap: wrap; gap: 1rem; margin-bottom: 1.5rem; }
.stat { background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--radius); padding: 1rem 1.4rem; min-width: 150px; box-shadow: var(--shadow); display: flex; flex-direction: column; }
.stat-num { font-family: var(--f-title); font-size: 2rem; font-weight: 700; color: var(--c-primary); line-height: 1.1; }
.stat-lbl { font-size: .78rem; text-transform: uppercase; letter-spacing: .08em; color: var(--c-muted); font-weight: 600; }
.stat-cta { justify-content: center; margin-left: auto; box-shadow: none; border: 0; background: none; }
.bars { list-style: none; padding: 0; margin: 0; display: grid; gap: .8rem; }
.bar-row { display: flex; gap: .9rem; align-items: center; background: var(--c-surface); border: 1px solid var(--c-border); border-radius: 12px; padding: .6rem .9rem; }
.bar-photo { width: 52px; height: 52px; border-radius: 50%; overflow: hidden; flex: none; background: #efe7dd; }
.bar-photo img { width: 100%; height: 100%; object-fit: cover; }
.bar-photo .ph { font-size: 1.4rem; }
.bar-main { flex: 1; display: flex; flex-direction: column; gap: .35rem; }
.bar-label { display: flex; justify-content: space-between; gap: 1rem; font-weight: 700; }
.bar { height: 10px; background: #f0e9e1; border-radius: 999px; overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--c-primary); border-radius: 999px; transition: width .6s; }
.winner { border-color: var(--c-accent); box-shadow: 0 0 0 2px rgba(216, 160, 49, .35); }
.winner .bar > span { background: var(--c-accent); }
.crown { color: var(--c-accent); }

/* ---------- Portada ---------- */
.election-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 1.4rem; }
.election-card { background: var(--c-surface); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); border: 1px solid var(--c-border); display: flex; flex-direction: column; }
.ec-img img { width: 100%; aspect-ratio: 3 / 4; object-fit: cover; }
.ec-body { padding: 1.2rem; display: flex; flex-direction: column; gap: .4rem; }
.ec-actions { display: flex; gap: .5rem; flex-wrap: wrap; margin-top: .5rem; }
.prose p { margin: 0 0 .9rem; }

/* ---------- Peu ---------- */
.site-footer { background: #241a18; color: #d9cfc8; padding: 2rem 0; font-size: .88rem; }
.site-footer a { color: #fff; }
.footer-inner { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.footer-links { display: flex; gap: 1.2rem; align-items: center; }
