/* ===================================================================
   enricoder.com — design system 2026
   Dark minimale, niente effetti globali. Tipografia ottimizzata per
   la lettura (sezione Pensiero / racconti).
   =================================================================== */

:root {
  /* palette */
  --bg:        #0b0d10;
  --bg-soft:   #12151a;
  --bg-card:   #14181e;
  --line:      rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.16);
  --text:      #e7ebf0;
  --text-dim:  #9aa4b2;
  --text-faint:#6b7480;
  --accent:    #00d4ff;
  --accent-2:  #ffb454;   /* caldo, per la sezione Pensiero/racconti */
  --accent-dim:rgba(0, 212, 255, 0.14);
  --danger:    #ff6b6b;
  --ok:        #51d88a;

  /* misure */
  --maxw:      1080px;
  --readw:     720px;     /* larghezza ideale per testi lunghi */
  --radius:    14px;
  --radius-sm: 9px;
  --gap:       clamp(1rem, 2.5vw, 2rem);

  /* type */
  --font-sans: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-serif:'Iowan Old Style', 'Palatino Linotype', 'Georgia', serif;
  --font-mono: ui-monospace, 'SFMono-Regular', 'Cascadia Code', 'Menlo', monospace;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: clamp(16px, 1.05vw, 17px);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* subtle background texture, NO animation */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(900px 500px at 78% -8%, rgba(0,212,255,0.06), transparent 60%),
    radial-gradient(700px 480px at 8% 108%, rgba(255,180,84,0.05), transparent 60%);
  pointer-events: none;
}

img { max-width: 100%; height: auto; display: block; }

a { color: var(--accent); text-decoration: none; transition: color .18s ease; }
a:hover { color: #7fe7ff; }

::selection { background: var(--accent); color: #03212a; }

/* ---------- layout ---------- */
.wrap { width: 100%; max-width: var(--maxw); margin-inline: auto; padding-inline: clamp(1rem, 4vw, 2rem); }
.section { padding-block: clamp(2.5rem, 7vw, 5rem); }
.read { max-width: var(--readw); }

/* ---------- header / nav ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(11,13,16,0.72);
  backdrop-filter: blur(12px) saturate(140%);
  border-bottom: 1px solid var(--line);
}
.nav {
  display: flex; align-items: center; gap: 1rem;
  max-width: var(--maxw); margin-inline: auto;
  padding: .7rem clamp(1rem, 4vw, 2rem);
}
.brand { font-weight: 700; letter-spacing: -.02em; color: var(--text); font-size: 1.05rem; }
.brand b { color: var(--accent); }
.nav-links { display: flex; gap: .25rem; margin-left: auto; flex-wrap: wrap; }
.nav-links a {
  color: var(--text-dim); padding: .4rem .7rem; border-radius: 8px;
  font-size: .92rem; font-weight: 500;
}
.nav-links a:hover { color: var(--text); background: rgba(255,255,255,0.05); }
.nav-links a[aria-current="page"] { color: var(--accent); background: var(--accent-dim); }
.nav-toggle { display: none; background: none; border: 1px solid var(--line-strong);
  color: var(--text); border-radius: 8px; padding: .35rem .55rem; font-size: 1.1rem; cursor: pointer; }

@media (max-width: 720px) {
  .nav-toggle { display: block; margin-left: auto; }
  .nav-links { display: none; width: 100%; flex-direction: column; margin: 0; padding-top: .5rem; }
  .nav-links.open { display: flex; }
  .nav { flex-wrap: wrap; }
}

/* ---------- hero ---------- */
.hero { padding-block: clamp(3rem, 9vw, 6rem); }
.hero h1 {
  font-size: clamp(2.1rem, 6vw, 3.6rem); line-height: 1.05;
  letter-spacing: -.03em; margin: 0 0 1rem; font-weight: 700;
}
.hero h1 .grad {
  background: linear-gradient(120deg, var(--accent), #7fe7ff 60%, var(--accent-2));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero p.lead { font-size: clamp(1.05rem, 2.2vw, 1.3rem); color: var(--text-dim); max-width: 60ch; margin: 0; }

.eyebrow { font-size: .8rem; text-transform: uppercase; letter-spacing: .18em;
  color: var(--accent); font-weight: 600; margin-bottom: .9rem; }

/* ---------- headings ---------- */
h1, h2, h3 { letter-spacing: -.02em; line-height: 1.2; }
h2 { font-size: clamp(1.5rem, 3.5vw, 2.1rem); margin: 0 0 1rem; }
h3 { font-size: 1.2rem; margin: 0 0 .5rem; }
.section > .wrap > h2 + p, .lead-sub { color: var(--text-dim); }

/* ---------- cards / grid ---------- */
.grid { display: grid; gap: var(--gap);
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.card {
  display: flex; flex-direction: column;
  background: var(--bg-card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 1.5rem;
  transition: transform .2s ease, border-color .2s ease, background .2s ease;
}
.card:hover { transform: translateY(-4px); border-color: var(--line-strong);
  background: #171c23; }
.card .tag { font-size: .78rem; text-transform: uppercase; letter-spacing: .12em;
  color: var(--accent); font-weight: 600; margin-bottom: .55rem; }
.card h3 { color: var(--text); }
.card p { color: var(--text-dim); margin: 0 0 1rem; flex: 1; }
.card .more { color: var(--accent); font-weight: 600; font-size: .92rem; margin-top: auto; }
a.card { color: inherit; }
a.card:hover { color: inherit; }

.card .ico { font-size: 1.6rem; margin-bottom: .8rem; }

/* feature accent variant (Pensiero) */
.card.warm .tag, .card.warm .more { color: var(--accent-2); }
.card.warm:hover { border-color: rgba(255,180,84,0.3); }

/* ---------- prose (articoli / racconti) ---------- */
.prose { max-width: var(--readw); }
.prose.serif { font-family: var(--font-serif); font-size: 1.18rem; line-height: 1.8; }
.prose p { margin: 0 0 1.2rem; }
.prose h2 { margin-top: 2.4rem; }
.prose h3 { margin-top: 1.8rem; color: var(--accent); }
.prose ul, .prose ol { color: var(--text-dim); padding-left: 1.3rem; }
.prose li { margin-bottom: .5rem; }
.prose blockquote {
  margin: 1.6rem 0; padding: .6rem 1.2rem; border-left: 3px solid var(--accent-2);
  color: var(--text-dim); font-style: italic; background: rgba(255,180,84,0.04);
  border-radius: 0 8px 8px 0;
}
.prose code { font-family: var(--font-mono); font-size: .9em;
  background: rgba(255,255,255,0.07); padding: .12em .4em; border-radius: 5px; }
.prose pre { background: var(--bg-soft); border: 1px solid var(--line);
  border-radius: var(--radius-sm); padding: 1rem 1.2rem; overflow-x: auto; }
.prose pre code { background: none; padding: 0; }
.prose hr { border: none; border-top: 1px solid var(--line); margin: 2.5rem 0; }

/* ---------- buttons / chips ---------- */
.btn {
  display: inline-flex; align-items: center; gap: .5rem;
  background: var(--accent); color: #03212a; font-weight: 600;
  padding: .7rem 1.2rem; border-radius: 10px; border: none; cursor: pointer;
  font-size: .95rem; transition: filter .18s ease, transform .18s ease;
}
.btn:hover { filter: brightness(1.1); color: #03212a; transform: translateY(-1px); }
.btn.ghost { background: transparent; color: var(--text);
  border: 1px solid var(--line-strong); }
.btn.ghost:hover { background: rgba(255,255,255,0.05); color: var(--text); }

.chips { display: flex; flex-wrap: wrap; gap: .5rem; margin: 1rem 0; }
.chip { font-size: .82rem; color: var(--text-dim);
  border: 1px solid var(--line); border-radius: 999px; padding: .3rem .8rem; }

/* ---------- breadcrumb ---------- */
.crumb { font-size: .85rem; color: var(--text-faint); margin-bottom: .6rem; }
.crumb a { color: var(--text-dim); }

/* ---------- forms ---------- */
.field { margin-bottom: 1.1rem; }
.field label { display: block; font-size: .9rem; color: var(--text-dim);
  margin-bottom: .4rem; font-weight: 500; }
.field input, .field textarea {
  width: 100%; background: var(--bg-soft); border: 1px solid var(--line-strong);
  color: var(--text); border-radius: 10px; padding: .75rem .9rem;
  font: inherit; transition: border-color .18s ease;
}
.field input:focus, .field textarea:focus { outline: none; border-color: var(--accent); }
.field textarea { resize: vertical; min-height: 150px; }
.hp { position: absolute; left: -9999px; opacity: 0; height: 0; width: 0; }
.form-note { font-size: .85rem; color: var(--text-faint); }
.alert { padding: .8rem 1rem; border-radius: 10px; margin-bottom: 1rem; font-size: .92rem; }
.alert.ok  { background: rgba(81,216,138,0.12); border: 1px solid rgba(81,216,138,0.3); color: var(--ok); }
.alert.err { background: rgba(255,107,107,0.12); border: 1px solid rgba(255,107,107,0.3); color: var(--danger); }

/* ---------- lab gallery ---------- */
.lab-grid { display: grid; gap: var(--gap);
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.lab-card { position: relative; overflow: hidden; border-radius: var(--radius);
  border: 1px solid var(--line); background: var(--bg-card); }
.lab-card .lab-body { padding: 1.2rem 1.3rem; }
.lab-card .lab-lib { font-family: var(--font-mono); font-size: .76rem; color: var(--accent); }
.lab-card h3 { margin: .3rem 0 .4rem; }
.lab-card p { color: var(--text-dim); font-size: .92rem; margin: 0 0 1rem; }
.lab-card .lab-actions { display: flex; gap: .6rem; }
.lab-card .lab-actions a { font-size: .88rem; }

/* ---------- footer ---------- */
.site-footer { border-top: 1px solid var(--line); margin-top: 4rem;
  padding-block: 2.5rem; color: var(--text-faint); font-size: .9rem; }
.site-footer .wrap { display: flex; flex-wrap: wrap; gap: 1rem; justify-content: space-between; align-items: center; }
.site-footer a { color: var(--text-dim); }
.site-footer .foot-links { display: flex; gap: 1rem; flex-wrap: wrap; }

/* ---------- utilities ---------- */
.mt-0 { margin-top: 0; } .mb-0 { margin-bottom: 0; }
.muted { color: var(--text-dim); }
.center { text-align: center; }
.stack > * + * { margin-top: 1rem; }

@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; }
  .card:hover { transform: none; }
}
