/* FeedBack OnionRings x UNIMI
   Sistema visivo preso da onionrings.dev: carta crema, inchiostro marrone, crosta dorata,
   Bricolage Grotesque condensato per i titoli, Geist per il testo, pill e card da 28px. */

@font-face { font-family: "Bricolage"; font-style: normal; font-display: swap; font-weight: 200 800; font-stretch: 75% 100%;
  src: url(/fonts/bricolage-latin.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: "Bricolage"; font-style: normal; font-display: swap; font-weight: 200 800; font-stretch: 75% 100%;
  src: url(/fonts/bricolage-latin-ext.woff2) format("woff2-variations");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1E00-1E9F, U+20A0-20AB, U+20AD-20C0, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Geist"; font-style: normal; font-display: swap; font-weight: 100 900;
  src: url(/fonts/geist-latin.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: "Geist"; font-style: normal; font-display: swap; font-weight: 100 900;
  src: url(/fonts/geist-latin-ext.woff2) format("woff2-variations");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1E00-1E9F, U+20A0-20AB, U+20AD-20C0, U+2C60-2C7F, U+A720-A7FF; }

:root {
  color-scheme: light dark;
  --paper: oklch(98.4% .004 80);
  --paper-2: oklch(93.5% .045 85);
  --face: oklch(100% 0 0);
  --ink: oklch(25% .05 52);
  --ink-2: oklch(36% .07 55);
  --muted: oklch(48% .06 58);
  --rule: oklch(25% .05 52 / .14);
  --rule-strong: oklch(25% .05 52 / .28);
  --crust: oklch(77.5% .15 72);
  --crust-hover: oklch(73% .16 66);
  --fried: oklch(70% .165 58);
  --crumb: oklch(92% .07 82);
  --on-crust: oklch(25% .05 52);
  --outline: oklch(36% .08 55);
  --dark: oklch(25% .05 52);
  --on-dark: oklch(97% .015 85);
  --on-dark-2: oklch(86% .04 80);
  --focus: oklch(55% .17 52);
  --ok: oklch(52% .12 150);
  --ok-soft: oklch(94% .05 150);
  --warn-soft: oklch(93% .08 85);
  --danger: oklch(52% .18 30);

  --font-display: "Bricolage", ui-sans-serif, system-ui, sans-serif;
  --font-body: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --text-hero: clamp(3.25rem, 9vw, 7.5rem);
  --text-section: clamp(2rem, 2.5vw + 1rem, 3rem);
  --text-title: clamp(1.25rem, .6vw + 1rem, 1.5rem);
  --radius-card: 28px;
  --radius-field: 18px;
  --radius-pill: 999px;
  --ease-out: cubic-bezier(.16, 1, .3, 1);
  --dur-micro: .12s;
  --dur-short: .22s;
  --gutter: clamp(16px, 4vw, 64px);
  --container: 1200px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: oklch(19% .03 55);
    --paper-2: oklch(25% .045 58);
    --face: oklch(23% .035 56);
    --ink: oklch(96% .015 85);
    --ink-2: oklch(86% .04 80);
    --muted: oklch(76% .05 75);
    --rule: oklch(96% .015 85 / .12);
    --rule-strong: oklch(96% .015 85 / .24);
    --crumb: oklch(32% .06 62);
    --outline: oklch(82% .1 75);
    --dark: oklch(14% .025 55);
    --focus: oklch(82% .14 75);
    --ok: oklch(78% .12 150);
    --ok-soft: oklch(30% .05 150);
    --warn-soft: oklch(32% .06 75);
    --danger: oklch(72% .15 30);
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  caret-color: var(--crust);
}
h1, h2, h3 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 800;
  font-stretch: 75%;
  letter-spacing: -.025em;
  line-height: 1;
  text-wrap: balance;
  overflow-wrap: anywhere;
}
h2 { font-size: var(--text-section); }
h3 { font-size: var(--text-title); letter-spacing: -.015em; line-height: 1.1; }
p { margin: 0; }
.muted { color: var(--muted); }
.small { font-size: .9375rem; }
.hidden { display: none !important; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; border-radius: 6px; }
::selection { background: var(--crust); color: var(--on-crust); }

.skip { position: absolute; left: 16px; top: -80px; z-index: 400; background: var(--ink); color: var(--paper); padding: 12px 18px; border-radius: var(--radius-pill); font-weight: 600; text-decoration: none; }
.skip:focus { top: 12px; }

/* ---------- barra superiore ---------- */
.topbar {
  position: sticky; top: 0; z-index: 300;
  background: color-mix(in oklch, var(--paper) 92%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--rule);
}
.topbar__inner {
  max-width: calc(var(--container) + 2 * var(--gutter)); margin: 0 auto;
  padding: 12px var(--gutter);
  display: flex; align-items: center; gap: 16px; min-height: 72px;
}
.wordmark { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; min-width: 0; }
.wordmark img { width: 34px; height: 34px; flex: none; }
.wordmark__name { font-family: var(--font-display); font-weight: 800; font-stretch: 75%; font-size: 1.6rem; letter-spacing: -.03em; line-height: 1; }
.wordmark__tag { font-size: .875rem; color: var(--muted); white-space: nowrap; padding-left: 12px; border-left: 1px solid var(--rule-strong); }
.spacer { flex: 1; }
.who { display: flex; align-items: center; gap: 10px; min-width: 0; }
.avatar {
  width: 40px; height: 40px; flex: none; border-radius: 50%;
  background: var(--crust); color: var(--on-crust);
  display: grid; place-items: center;
  font-family: var(--font-display); font-weight: 800; font-stretch: 75%; font-size: 1.1rem;
}
#user-name { font-weight: 600; max-width: 28vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- pulsanti ---------- */
.btn, button {
  font: inherit; font-weight: 600; line-height: 1;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 0 22px;
  border-radius: var(--radius-pill); border: 2px solid var(--rule-strong);
  background: transparent; color: var(--ink);
  cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: background-color var(--dur-short) var(--ease-out), color var(--dur-short) var(--ease-out),
    border-color var(--dur-short) var(--ease-out), transform var(--dur-micro) var(--ease-out);
}
button:hover { border-color: var(--ink); transform: translateY(-1px); }
button:active { transform: translateY(1px) scale(.98); }
button.primary { background: var(--crust); border-color: var(--crust); color: var(--on-crust); }
button.primary:hover { background: var(--crust-hover); border-color: var(--crust-hover); }
button.dark { background: var(--ink); border-color: var(--ink); color: var(--paper); }
button.dark:hover { background: var(--ink-2); border-color: var(--ink-2); }
button.danger { color: var(--danger); border-color: color-mix(in oklch, var(--danger) 40%, transparent); }
button.danger:hover { border-color: var(--danger); }
button.link {
  border: 0; min-height: 44px; padding: 0 4px; border-radius: 6px;
  color: var(--ink); text-decoration: underline; text-decoration-thickness: 2px;
  text-underline-offset: 4px; text-decoration-color: var(--crust);
}
button.link:hover { transform: none; text-decoration-color: var(--ink); }
button:disabled { opacity: .55; cursor: default; transform: none; }
.btn svg, button svg { width: 18px; height: 18px; flex: none; }

/* ---------- layout ---------- */
.container { max-width: calc(var(--container) + 2 * var(--gutter)); margin: 0 auto; padding: 0 var(--gutter); }
main.container { padding-bottom: 96px; }
.hero { padding: clamp(40px, 7vw, 88px) 0 clamp(32px, 5vw, 56px); display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 32px; align-items: end; }
.hero__title { font-size: var(--text-hero); line-height: .88; letter-spacing: -.035em; }
.hero__lead { margin-top: 20px; font-size: clamp(1.125rem, .35vw + 1rem, 1.375rem); max-width: 34ch; color: var(--ink-2); }
.hero__mascot { width: clamp(120px, 16vw, 210px); height: auto; }
@media (max-width: 640px) { .hero { grid-template-columns: minmax(0, 1fr); } .hero__mascot { display: none; } }

.grid { display: grid; gap: 20px; }
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.form-split { grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 32px; align-items: start; }
@media (max-width: 860px) { .grid.two, .grid.form-split { grid-template-columns: minmax(0, 1fr); } }
.stack { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row > * { min-width: 0; }
.section-head { display: flex; align-items: end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin: 48px 0 20px; }
.section-head:first-child { margin-top: 0; }

/* ---------- schede (tab) ---------- */
.tabs {
  display: inline-flex; gap: 4px; padding: 5px; margin-bottom: 32px;
  background: var(--paper-2); border-radius: var(--radius-pill); max-width: 100%; overflow-x: auto;
}
.tab { border: 0; min-height: 44px; padding: 0 20px; color: var(--ink-2); background: transparent; }
.tab:hover { transform: none; color: var(--ink); }
.tab[aria-selected="true"] { background: var(--face); color: var(--ink); box-shadow: 0 1px 0 var(--rule), 0 4px 14px oklch(25% .05 52 / .08); }
.tab .count { margin-left: 2px; font-variant-numeric: tabular-nums; background: var(--crust); color: var(--on-crust); border-radius: var(--radius-pill); padding: 3px 8px; font-size: .8125rem; }

/* ---------- card ---------- */
.card {
  background: var(--face);
  border: 1px solid var(--rule);
  border-radius: var(--radius-card);
  padding: clamp(20px, 2.4vw, 28px);
  display: flex; flex-direction: column; gap: 14px;
  min-width: 0; overflow-wrap: anywhere;
}
.card__head { display: flex; align-items: start; gap: 12px; }
.card__head h3 { flex: 1; }
.meta { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: .9375rem; color: var(--muted); }
.meta > span + span::before { content: "·"; margin-right: 14px; color: var(--rule-strong); }

/* banda scura con i numeri (admin) */
.band {
  background: var(--dark); color: var(--on-dark);
  border-radius: var(--radius-card);
  padding: clamp(24px, 3vw, 40px);
  display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 24px 32px;
  margin-bottom: 40px;
}
.stat__value { font-family: var(--font-display); font-weight: 800; font-stretch: 75%; font-size: clamp(3rem, 5vw, 4.5rem); line-height: .9; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.stat__label { margin-top: 8px; color: var(--on-dark-2); font-size: .9375rem; }
.stat--accent .stat__value { color: var(--crust); }

/* ---------- form ---------- */
label { display: flex; flex-direction: column; gap: 8px; font-weight: 600; font-size: .9375rem; }
.field-hint { font-weight: 400; color: var(--muted); }
input[type="text"], input[type="email"], input[type="password"], textarea, select {
  font: inherit; font-weight: 400; color: var(--ink); background: var(--paper);
  border: 2px solid var(--rule-strong); border-radius: var(--radius-field);
  padding: 12px 16px; width: 100%; min-height: 52px;
  transition: border-color var(--dur-short) var(--ease-out), background-color var(--dur-short) var(--ease-out);
}
input:hover, textarea:hover, select:hover { border-color: var(--ink-2); }
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--crust); background: var(--face); box-shadow: 0 0 0 4px color-mix(in oklch, var(--crust) 30%, transparent); }
textarea { min-height: 128px; resize: vertical; line-height: 1.5; }
select { appearance: none; padding-right: 44px; cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, currentColor 50%), linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position: calc(100% - 22px) 50%, calc(100% - 16px) 50%; background-size: 6px 6px; background-repeat: no-repeat; }
.row select { width: auto; min-width: 170px; }
.error { color: var(--danger); font-size: .9375rem; min-height: 1.4em; font-weight: 500; }

/* chip di categoria (radio) */
.chips { display: flex; flex-wrap: wrap; gap: 8px; border: 0; padding: 0; margin: 0; }
.chips legend { font-weight: 600; font-size: .9375rem; margin-bottom: 8px; padding: 0; }
.chip { position: relative; }
.chip input { position: absolute; opacity: 0; pointer-events: none; }
.chip span {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 18px;
  border: 2px solid var(--rule-strong); border-radius: var(--radius-pill);
  font-weight: 600; cursor: pointer; user-select: none;
  transition: background-color var(--dur-short) var(--ease-out), border-color var(--dur-short) var(--ease-out), transform var(--dur-micro) var(--ease-out);
}
.chip span:hover { border-color: var(--ink); transform: translateY(-1px); }
.chip input:checked + span { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.chip input:focus-visible + span { outline: 3px solid var(--focus); outline-offset: 3px; }

.check { flex-direction: row; align-items: center; gap: 12px; font-weight: 500; cursor: pointer; min-height: 44px; }
.check input { width: 22px; height: 22px; accent-color: var(--ink); flex: none; }

/* ---------- sondaggi ---------- */
.options { display: flex; flex-direction: column; gap: 10px; }
.option {
  position: relative; overflow: hidden; isolation: isolate;
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  width: 100%; min-height: 56px; padding: 0 22px;
  text-align: left; white-space: normal; line-height: 1.25;
  border-radius: var(--radius-pill);
}
.option .bar { position: absolute; inset: 0 auto 0 0; background: var(--crumb); z-index: -1; transition: width .6s var(--ease-out); }
.option.mine { border-color: var(--ink); }
.option.mine .bar { background: var(--crust); }
.option .count { font-variant-numeric: tabular-nums; font-weight: 600; color: var(--ink-2); }
button.option:disabled { opacity: 1; cursor: default; }
button.option:disabled:hover { border-color: var(--rule-strong); }
button.option.mine:disabled:hover { border-color: var(--ink); }
.option .tick { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--ink); color: var(--paper); margin-left: 8px; vertical-align: -4px; }
.option .tick svg { width: 14px; height: 14px; }
.survey-foot { font-size: .9375rem; color: var(--muted); }

/* ---------- badge di stato ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 6px; flex: none;
  font-size: .8125rem; font-weight: 600; padding: 6px 12px; border-radius: var(--radius-pill);
  background: var(--paper-2); color: var(--ink-2); white-space: nowrap;
}
.badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.badge.open, .badge.risolto { background: var(--ok-soft); color: var(--ok); }
.badge.nuovo { background: var(--crust); color: var(--on-crust); }
.badge.in_lavorazione { background: var(--warn-soft); color: var(--ink-2); }

.desc { white-space: pre-wrap; overflow-wrap: anywhere; }
/* risposta dello staff come fumetto, come le nuvolette del sito OnionRings */
.reply {
  position: relative; margin-top: 6px;
  background: var(--crumb); color: var(--on-crust);
  border: 3px solid var(--outline); border-radius: 22px;
  padding: 14px 18px;
}
@media (prefers-color-scheme: dark) { .reply { color: var(--ink); } }
.reply__who { font-weight: 700; font-size: .875rem; margin-bottom: 4px; display: flex; align-items: center; gap: 8px; }
.reply__who img { width: 22px; height: 22px; }

.empty {
  display: flex; flex-direction: column; align-items: center; gap: 14px; text-align: center;
  padding: 40px 24px; color: var(--muted);
  border: 2px dashed var(--rule-strong); border-radius: var(--radius-card);
}
.empty img { width: 88px; height: auto; }
.empty strong { color: var(--ink); font-family: var(--font-display); font-weight: 800; font-stretch: 75%; font-size: 1.5rem; letter-spacing: -.02em; }

.toast {
  position: fixed; left: 50%; bottom: 24px; z-index: 500;
  transform: translate(-50%, 12px); opacity: 0; pointer-events: none;
  background: var(--ink); color: var(--paper);
  padding: 14px 22px; border-radius: var(--radius-pill); font-weight: 600;
  transition: opacity var(--dur-short) var(--ease-out), transform var(--dur-short) var(--ease-out);
  max-width: calc(100vw - 32px);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- ingresso ---------- */
.enter {
  min-height: 100svh;
  display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, .9fr); align-items: center; gap: 48px;
  max-width: calc(var(--container) + 2 * var(--gutter)); margin: 0 auto; padding: 40px var(--gutter);
}
.enter__brand { display: inline-flex; align-items: center; gap: 10px; margin-bottom: clamp(32px, 6vw, 64px); }
.enter__title { font-size: var(--text-hero); line-height: .86; letter-spacing: -.04em; }
.enter__title em { font-style: normal; color: var(--fried); }
.enter__lead { margin: 24px 0 32px; font-size: clamp(1.125rem, .35vw + 1rem, 1.375rem); max-width: 30ch; color: var(--ink-2); }
.enter form { max-width: 460px; }
.enter__field { display: flex; gap: 10px; }
.enter__field input { flex: 1; min-width: 0; border-radius: var(--radius-pill); padding: 0 22px; min-height: 56px; }
.enter__field button { min-height: 56px; }
.enter__art { display: grid; place-items: center; }
.enter__art img { width: min(100%, 440px); height: auto; }
@media (max-width: 860px) {
  .enter { grid-template-columns: minmax(0, 1fr); gap: 16px; align-content: start; }
  .enter__art { order: -1; justify-items: start; }
  .enter__art img { width: 120px; }
  .enter__brand { display: none; }
}
@media (max-width: 480px) { .enter__field { flex-direction: column; } .enter__field button { width: 100%; } }

/* ---------- entrata e movimento ---------- */
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes bob { 0%, 100% { transform: translateY(0) rotate(-2deg); } 50% { transform: translateY(-8px) rotate(2deg); } }
[data-enter] > * { animation: rise .7s var(--ease-out) both; }
[data-enter] > *:nth-child(2) { animation-delay: .06s; }
[data-enter] > *:nth-child(3) { animation-delay: .12s; }
[data-enter] > *:nth-child(4) { animation-delay: .18s; }
.mascot-bob { animation: bob 2s ease-in-out 2; transform-origin: 50% 80%; }
.card.linked { transition: transform var(--dur-short) var(--ease-out), box-shadow var(--dur-short) var(--ease-out); }
.card.linked:hover { transform: translateY(-2px); box-shadow: 0 12px 30px oklch(25% .05 52 / .08); }

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

@media (max-width: 640px) {
  .wordmark__tag { display: none; }
  #user-name { display: none; }
  .tabs { display: flex; width: 100%; }
  .tab { flex: 1; padding: 0 12px; }
  .card .row button { flex: 1; }
}
