/* Bacheca sindacale: UniMORE visual identity (Brandbook 2026), web version.
   White pages, Inter, Granato for actions, the Granato→Rosso gradient as a
   thin accent. Components are classes: templates use no inline styles. */

/* ── Fonts ─────────────────────────────────────────────────────────────── */

/* Inter (SIL Open Font License, fonts/LICENSE-Inter.txt): the brandbook's
   font for digital use. Self-hosted, variable weight. */
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url("fonts/inter-latin-wght-normal.8e433c0592f7.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;
}
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url("fonts/inter-latin-ext-wght-normal.ad4eb06671be.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;
}

/* ── Tokens ────────────────────────────────────────────────────────────── */

:root {
  /* Palette primaria UniMORE */
  --granato: #93021f;
  --rosso: #d14124;
  --crema: #f4ebe4;
  --grigio: #63666a;
  --nero: #000;
  --bianco: #fff;

  /* Derived */
  --granato-dark: #6e0117;          /* hover on Granato */
  --crema-soft: #faf6f2;            /* quieter than Crema, for large areas */
  --text: #1b1b1d;
  --text-muted: var(--grigio);      /* 5.9:1 on white */
  --line: #e7e2de;                  /* hairlines, warm like Crema */
  --line-strong: #cfc8c2;
  --ok: #1f7a4a;
  --gradient: linear-gradient(90deg, var(--granato), var(--rosso) 45%);

  --font: 'Inter', 'Helvetica Neue', Arial, system-ui, sans-serif;
  --radius: 8px;
  --radius-sm: 6px;
  --shadow: 0 1px 2px rgb(27 27 29 / 4%), 0 4px 16px rgb(27 27 29 / 4%);
  --page-width: 1080px;
  --gutter: 1.25rem;
}

/* ── Base ──────────────────────────────────────────────────────────────── */

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

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

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bianco);
  color: var(--text);
  font: 400 1rem/1.6 var(--font);
  font-feature-settings: 'cv11', 'ss01';  /* Inter: single-storey a, open digits */
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { line-height: 1.25; letter-spacing: -0.015em; margin: 0 0 .75rem; }
h1 { font-size: 1.875rem; font-weight: 650; }
h2 { font-size: 1.25rem; font-weight: 600; }
h3 { font-size: 1rem; font-weight: 600; }
p { margin: 0 0 .75rem; }

a { color: var(--granato); text-underline-offset: .18em; text-decoration-thickness: 1px; }
a:hover { color: var(--granato-dark); text-decoration-thickness: 2px; }

:focus-visible { outline: 2px solid var(--granato); outline-offset: 2px; border-radius: 2px; }

::selection { background: var(--crema); color: var(--nero); }

/* ── Site header ───────────────────────────────────────────────────────── */

.site-header {
  position: relative;
  background: var(--bianco);
  border-bottom: 1px solid var(--line);
}
/* The UniMORE gradient as a thin line along the top of every page. */
.site-header::before {
  content: '';
  display: block;
  height: 4px;
  background: var(--gradient);
}
.site-header-inner {
  max-width: var(--page-width);
  margin: 0 auto;
  padding: .85rem var(--gutter);
  display: flex;
  align-items: center;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.brand { display: flex; flex-direction: column; text-decoration: none; color: var(--text); line-height: 1.2; }
.brand:hover { color: var(--text); }
.brand-name { font-size: 1.125rem; font-weight: 650; letter-spacing: -0.01em; }
.brand-sub { font-size: .75rem; color: var(--text-muted); letter-spacing: .02em; }

.nav { margin-left: auto; display: flex; align-items: center; gap: 1.25rem; flex-wrap: wrap; }
.nav-link { color: var(--text); text-decoration: none; font-weight: 500; font-size: .9375rem; }
.nav-link:hover { color: var(--granato); }
.nav-link[aria-current] { color: var(--granato); }
.nav-user { color: var(--text-muted); font-size: .875rem; padding-left: 1.25rem; border-left: 1px solid var(--line); }
.nav form { margin: 0; }

@media (max-width: 760px) {
  .site-header-inner { padding: .7rem var(--gutter); gap: .5rem 1rem; }
  .brand-sub { display: none; }
  .nav { margin-left: 0; width: 100%; gap: .5rem 1rem; }
  .nav .btn { min-height: 2.1rem; padding: .35rem .8rem; font-size: .875rem; }
  .nav-user { display: none; }
  .nav form { margin-left: auto; }
}

/* ── Page ──────────────────────────────────────────────────────────────── */

.page { flex: 1; width: 100%; max-width: var(--page-width); margin: 0 auto; padding: 2.5rem var(--gutter) 4rem; }

.page-title { margin-bottom: .25rem; }
.page-lead { color: var(--text-muted); margin-bottom: 2rem; max-width: 60ch; }

.layout { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 3rem; }
@media (max-width: 760px) {
  .page { padding-top: 1.5rem; }
  .layout { grid-template-columns: minmax(0, 1fr); gap: 1.5rem; }
  h1 { font-size: 1.5rem; }
}

/* ── Site footer ───────────────────────────────────────────────────────── */

.site-footer { border-top: 1px solid var(--line); background: var(--crema-soft); }
.site-footer-inner {
  max-width: var(--page-width);
  margin: 0 auto;
  padding: 1.75rem var(--gutter);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  flex-wrap: wrap;
}
/* The logo as supplied, no smaller than the brandbook's 40 mm, with its
   clear space (padding) kept free. */
.footer-logo { display: block; padding: .5rem 0; line-height: 0; }
.footer-logo img { width: 160px; height: auto; }
.footer-note { color: var(--text-muted); font-size: .8125rem; margin: 0; max-width: 46ch; }

/* ── Text helpers ──────────────────────────────────────────────────────── */

.muted { color: var(--text-muted); }
.small { font-size: .875rem; }
.eyebrow {
  font-size: .75rem;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--granato);
}
.ok { color: var(--ok); }
.error { color: var(--rosso); }

/* ── Buttons ───────────────────────────────────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  min-height: 2.5rem;
  padding: .5rem 1.15rem;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--bianco);
  color: var(--text);
  font: 500 .9375rem/1.2 var(--font);
  text-decoration: none;
  cursor: pointer;
  transition: background-color .15s, border-color .15s, color .15s;
}
.btn:hover { border-color: var(--granato); color: var(--granato); text-decoration: none; }
.btn-primary { background: var(--granato); border-color: var(--granato); color: var(--bianco); }
.btn-primary:hover { background: var(--granato-dark); border-color: var(--granato-dark); color: var(--bianco); }
.btn-danger { background: var(--rosso); border-color: var(--rosso); color: var(--bianco); }
.btn-danger:hover { background: #b23519; border-color: #b23519; color: var(--bianco); }
.btn-block { width: 100%; }
/* A button that looks like a link (log out, inside forms). */
.btn-link {
  border: 0; padding: 0; min-height: 0; background: none;
  color: var(--text); font: 500 .9375rem/1.2 var(--font); cursor: pointer;
}
.btn-link:hover { color: var(--granato); }
.link-danger { color: var(--rosso); }
.link-danger:hover { color: #b23519; }

.btn-sso { flex-direction: column; gap: .75rem; padding: 1.25rem; }
.btn-sso img { width: 135px; height: auto; }

.actions { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; margin-top: 1.5rem; }

/* ── Panels and cards ──────────────────────────────────────────────────── */

.card {
  background: var(--bianco);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.75rem 2rem;
  box-shadow: var(--shadow);
}
@media (max-width: 560px) { .card { padding: 1.25rem; } }

/* A narrow centered card: login, confirmations, messages. */
.panel { position: relative; overflow: hidden; max-width: 460px; margin: 1.5rem auto; }
.panel-wide { max-width: 760px; }

/* The circular element of the Visual Identity 2025: a Granato→Rosso ring,
   partly outside the panel's corner. Decoration only. */
.ring {
  position: absolute;
  top: -70px;
  right: -70px;
  width: 190px;
  height: 190px;
  background: var(--gradient);
  -webkit-mask: radial-gradient(circle closest-side, transparent 79%, #000 80%, #000 99%, transparent 100%);
          mask: radial-gradient(circle closest-side, transparent 79%, #000 80%, #000 99%, transparent 100%);
  opacity: .9;
  pointer-events: none;
}
.panel-with-ring > :not(.ring) { position: relative; }
.panel-with-ring h1 { padding-right: 5rem; }

.divider { border: 0; border-top: 1px solid var(--line); margin: 1.5rem 0; }

/* ── Messages ──────────────────────────────────────────────────────────── */

.notice {
  margin: 0 0 1.5rem;
  padding: .75rem 1rem;
  border-radius: var(--radius-sm);
  background: var(--crema);
  border-left: 4px solid var(--granato);
  color: var(--text);
}
.notice-success { border-left-color: var(--ok); }
.notice-error { border-left-color: var(--rosso); }

/* ── Union navigation (sidebar) ────────────────────────────────────────── */

.union-nav-title { margin-bottom: .75rem; }
.union-nav { list-style: none; margin: 0 0 1.5rem; padding: 0; }
.union-nav a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
  padding: .45rem .75rem;
  border-left: 2px solid transparent;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color: var(--text);
  text-decoration: none;
  font-size: .9375rem;
}
.union-nav a:hover { background: var(--crema-soft); color: var(--granato); }
.union-nav a[aria-current] { background: var(--crema); border-left-color: var(--granato); font-weight: 600; }
.subscribed-mark { display: inline-flex; color: var(--granato); }
.icon { width: 1em; height: 1em; flex: none; vertical-align: -0.125em; }

.side-note { font-size: .875rem; color: var(--text-muted); }

/* Small screens: the unions become a row of chips above the posts. */
@media (max-width: 760px) {
  .union-nav-title, .side-note { display: none; }
  .union-nav { display: flex; gap: .5rem; overflow-x: auto; margin: 0; padding-bottom: .25rem; scrollbar-width: none; }
  .union-nav a { white-space: nowrap; border: 1px solid var(--line); border-radius: 999px; padding: .35rem .9rem; gap: .35rem; }
  .union-nav a[aria-current] { border-color: var(--granato); }
}

/* ── Posts ─────────────────────────────────────────────────────────────── */

.post-list { border-top: 1px solid var(--line); }
.post-item { padding: 1.5rem 0; border-bottom: 1px solid var(--line); }
.post-meta { display: flex; align-items: baseline; gap: .6rem; flex-wrap: wrap; margin-bottom: .35rem; }
.post-date { font-size: .8125rem; color: var(--text-muted); }
.post-title { font-size: 1.25rem; font-weight: 600; margin: 0 0 .4rem; }
.post-title a { color: var(--text); text-decoration: none; }
.post-title a:hover { color: var(--granato); text-decoration: underline; }
.post-excerpt { color: #3d3f43; margin: 0; overflow-wrap: anywhere; }

.post-full .post-title { font-size: 2rem; font-weight: 650; margin: .25rem 0 1.5rem; }
.post-body { font-size: 1.0625rem; line-height: 1.7; max-width: 68ch; overflow-wrap: anywhere; }
.post-body p { margin-bottom: 1rem; }
.post-footer { display: flex; align-items: center; gap: 1.25rem; flex-wrap: wrap;
               margin-top: 2rem; padding-top: 1.25rem; border-top: 1px solid var(--line); }

.back-link { display: inline-block; margin-bottom: 1.5rem; font-size: .875rem; text-decoration: none; }
.back-link:hover { text-decoration: underline; }

/* Attachment: a Crema chip. */
.attachment {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  margin-top: .6rem;
  padding: .3rem .7rem;
  border-radius: 999px;
  background: var(--crema);
  color: var(--text);
  font-size: .8125rem;
  text-decoration: none;
}
a.attachment:hover { background: #ecdfd5; color: var(--granato); }
.attachment-large { padding: .6rem 1.1rem; font-size: .9375rem; margin-top: 1rem; }

.empty { padding: 3rem 0; color: var(--text-muted); text-align: center; border-bottom: 1px solid var(--line); }

.pager { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-top: 2rem; font-size: .9375rem; }

/* ── Forms ─────────────────────────────────────────────────────────────── */

.form-stack { display: flex; flex-direction: column; gap: 1.25rem; }
.field { display: flex; flex-direction: column; gap: .35rem; }
.field-label { font-weight: 600; font-size: .9375rem; }
.field-help { color: var(--text-muted); font-size: .8125rem; }
.field-error { color: var(--rosso); font-size: .875rem; margin: 0; }
.field ul { list-style: none; margin: 0; padding: 0; }

.input,
.field input[type=text], .field input[type=password], .field input[type=email],
.field input[type=datetime-local], .field input:not([type]), .field select, .field textarea {
  width: 100%;
  padding: .6rem .75rem;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--bianco);
  color: var(--text);
  font: 400 1rem/1.4 var(--font);
  transition: border-color .15s, box-shadow .15s;
}
.field textarea { resize: vertical; line-height: 1.6; }
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none;
  border-color: var(--granato);
  box-shadow: 0 0 0 3px rgb(147 2 31 / 14%);
}
.field input[type=file] { font: inherit; font-size: .9375rem; }
.field input[type=file]::file-selector-button {
  margin-right: .75rem; padding: .45rem .9rem;
  border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  background: var(--crema-soft); color: var(--text); font: 500 .875rem var(--font); cursor: pointer;
}
/* Django's "currently / clear" widget for an existing attachment. */
.field-file { font-size: .9375rem; }
.field-file input[type=checkbox] { accent-color: var(--granato); }

.check { display: flex; align-items: center; gap: .65rem; cursor: pointer; }
.check input { width: 1.1rem; height: 1.1rem; accent-color: var(--granato); margin: 0; }
.check-all { padding-bottom: .75rem; border-bottom: 1px solid var(--line); font-weight: 600; }
.check-list { display: flex; flex-direction: column; gap: .6rem; }

.errorlist { color: var(--rosso); margin: 0; padding: 0; list-style: none; font-size: .875rem; }

/* Local (administrator) login under the SSO button. */
.local-login { margin-top: 1.5rem; }
.local-login summary { cursor: pointer; color: var(--text-muted); font-size: .875rem; margin-bottom: 1rem; }
.local-login summary:hover { color: var(--granato); }

/* ── Tables and definition lists (SSO debug) ───────────────────────────── */

.data-table { width: 100%; border-collapse: collapse; font-size: .9375rem; margin-bottom: 1rem; }
.data-table th, .data-table td { text-align: left; vertical-align: top; padding: .5rem .75rem; border-bottom: 1px solid var(--line); }
.data-table th { width: 30%; font-weight: 600; background: var(--crema-soft); }
.data-list { display: grid; grid-template-columns: max-content 1fr; gap: .4rem 1.5rem; margin: 0 0 1.5rem; }
.data-list dt { font-weight: 600; }
.data-list dd { margin: 0; }
