/* ===========================================================================
   Claude Design Sharing — design system
   Ispirato alla palette Anthropic/Claude: avorio caldo, argilla (clay) coral,
   inchiostro caldo, serif per i display. Light + dark automatici.
   ======================================================================== */

:root {
  /* superfici */
  --bg:        #F0EEE6;   /* avorio Anthropic */
  --bg-soft:   #FAF9F5;
  --surface:   #FFFFFF;
  --surface-2: #F6F4EE;
  --sunken:    #EFECE3;

  /* testo */
  --ink:   #141413;       /* near-black caldo */
  --ink-2: #3B382F;
  --muted: #75726B;
  --faint: #A5A199;

  /* bordi / linee */
  --border:  #E4E0D6;
  --border-2:#D8D3C7;

  /* accento — Claude clay */
  --clay:      #D97757;
  --clay-600:  #C15F3C;
  --clay-700:  #A44B2E;
  --clay-tint: #F7E9E1;
  --clay-tint2:#FBF2EC;

  /* stati */
  --green:  #4F7A55;
  --green-tint: #E6EFE5;
  --red:    #C0483B;
  --red-tint:#F6E4E1;
  --amber:  #C98A2E;

  /* effetti */
  --ring:   0 0 0 3px rgba(217,119,87,.28);
  --shadow-sm: 0 1px 2px rgba(20,20,19,.05);
  --shadow:    0 1px 2px rgba(20,20,19,.04), 0 10px 30px -12px rgba(20,20,19,.18);
  --shadow-lg: 0 24px 60px -20px rgba(20,20,19,.30);

  /* raggi */
  --r-sm: 8px;  --r: 12px;  --r-lg: 18px;  --r-xl: 28px;

  /* tipografia */
  --font-serif: "Fraunces", Georgia, "Times New Roman", serif;
  --font-sans:  "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono:  "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;

  /* Il brand è l'avorio caldo di Claude: teniamo il tema chiaro ovunque,
     anche con OS in dark mode (evita inversioni di contrasto sui controlli). */
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3 { font-family: var(--font-serif); font-weight: 500; letter-spacing: -.01em; line-height: 1.12; color: var(--ink); margin: 0; }
p { margin: 0; }
a { color: var(--clay-600); text-decoration: none; }
a:hover { color: var(--clay-700); }

.serif { font-family: var(--font-serif); }
.muted { color: var(--muted); }
.center { text-align: center; }

/* ---------------- bottoni ---------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: inherit; font-weight: 600; line-height: 1;
  padding: 11px 18px; border-radius: var(--r-sm);
  border: 1px solid transparent; cursor: pointer;
  transition: transform .04s ease, background .15s ease, border-color .15s ease, box-shadow .15s ease;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: none; box-shadow: var(--ring); }
.btn-primary { background: var(--clay); color: #fff; }
.btn-primary:hover { background: var(--clay-600); color: #fff; }
.btn-ghost { background: var(--surface); color: var(--ink); border-color: var(--border-2); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-subtle { background: transparent; color: var(--ink-2); }
.btn-subtle:hover { background: var(--surface-2); }
.btn-danger { background: transparent; color: var(--red); border-color: var(--border-2); }
.btn-danger:hover { background: var(--red-tint); border-color: var(--red); }
.btn-sm { padding: 7px 12px; font-size: 13px; border-radius: 7px; }
.btn[disabled] { opacity: .55; cursor: default; }

/* ---------------- form ---------------- */
label.field { display: block; font-weight: 600; font-size: 13px; color: var(--ink-2); margin: 0 0 6px; }
.input {
  width: 100%; padding: 11px 13px; font: inherit; color: var(--ink);
  background: var(--surface); border: 1px solid var(--border-2); border-radius: var(--r-sm);
  transition: border-color .15s ease, box-shadow .15s ease;
}
.input::placeholder { color: var(--faint); }
.input:focus { outline: none; border-color: var(--clay); box-shadow: var(--ring); }
textarea.input { resize: vertical; }

/* ---------------- card ---------------- */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-lg); box-shadow: var(--shadow-sm);
}

/* ---------------- badge / chip ---------------- */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 600; padding: 3px 9px; border-radius: 999px;
  background: var(--clay-tint); color: var(--clay-700);
}
.badge-muted { background: var(--sunken); color: var(--muted); }
.eyebrow { font-size: 12px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--clay-600); }

/* ---------------- brand mark ---------------- */
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 700; color: var(--ink); }
.brand .spark { width: 26px; height: 26px; color: var(--clay); flex: 0 0 auto; }
.brand .spark svg, .brand .spark img { display: block; width: 100%; height: 100%; }

/* ---------------- toast ---------------- */
#toasts { position: fixed; bottom: 20px; right: 20px; z-index: 200; display: flex; flex-direction: column; gap: 10px; }
.toast {
  min-width: 240px; max-width: 360px; padding: 12px 15px; border-radius: var(--r);
  background: var(--ink); color: var(--bg-soft); box-shadow: var(--shadow-lg);
  font-size: 14px; display: flex; align-items: flex-start; gap: 10px;
  animation: toastIn .22s cubic-bezier(.2,.8,.2,1);
}
.toast.ok    { background: #223A28; color: #E6F1E7; }
.toast.error { background: #3A211D; color: #F7E0DB; }
@keyframes toastIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* ---------------- modal ---------------- */
.modal-scrim {
  position: fixed; inset: 0; z-index: 300; background: rgba(20,20,19,.45);
  display: none; align-items: center; justify-content: center; padding: 20px;
  backdrop-filter: blur(2px);
}
.modal-scrim.show { display: flex; }
.modal {
  width: 100%; max-width: 420px; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-lg); box-shadow: var(--shadow-lg); padding: 24px;
  animation: modalIn .2s cubic-bezier(.2,.8,.2,1);
}
@keyframes modalIn { from { opacity: 0; transform: scale(.97) translateY(6px); } to { opacity: 1; transform: none; } }

/* ---------------- misc ---------------- */
.link-inline { color: var(--clay-600); font-weight: 600; word-break: break-all; }
code, .mono { font-family: var(--font-mono); font-size: .92em; }
.kbd { font-family: var(--font-mono); font-size: 12px; background: var(--sunken); border: 1px solid var(--border-2); border-bottom-width: 2px; border-radius: 6px; padding: 1px 6px; color: var(--ink-2); }
hr.rule { border: none; border-top: 1px solid var(--border); margin: 0; }
::selection { background: var(--clay-tint); color: var(--clay-700); }
