/* ===== ATLANTE DELLE MEDICINE PERDUTE — Corpus Vivens ===== */
/* Tema: erbario luminoso · verdi foresta + marroni corteccia */
:root {
  --bg: #f3eedd;
  --panel: #fcf9f1;
  --panel-2: #f7f1e2;
  --ink: #2f2618;          /* testo principale (corteccia scura) */
  --ink-soft: #5b4d39;     /* testo secondario */
  --muted: #94856b;        /* note, label */
  --forest: #2f5d3a;       /* verde foresta profondo */
  --moss: #4f7a45;         /* verde muschio */
  --sage: #87a06d;         /* salvia chiara */
  --bark: #6b4f34;         /* corteccia */
  --bark-soft: #8a6b46;    /* corteccia chiara */
  --gold: #b0823a;         /* ambra/resina */
  --line: rgba(107,79,52,0.20);
  --line-soft: rgba(107,79,52,0.12);
  --shadow: rgba(74,56,28,0.16);
  --display: "IM Fell English", "Cormorant Garamond", Georgia, serif; /* torchio antico */
  --serif: "Cormorant Garamond", Georgia, serif;
  --sans: "Inter", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: var(--sans);
  color: var(--ink);
  background:
    radial-gradient(1100px 640px at 50% -8%, rgba(79,122,69,0.18), transparent 60%),
    radial-gradient(820px 560px at 8% 110%, rgba(135,160,109,0.15), transparent 60%),
    radial-gradient(760px 520px at 100% 120%, rgba(176,130,58,0.12), transparent 60%),
    var(--bg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  position: relative;
}

/* grana di carta antica */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  opacity: 0.5;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.06'/%3E%3C/svg%3E");
}
/* vignettatura ai bordi (carta invecchiata) */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  background: radial-gradient(120% 100% at 50% 40%, transparent 62%, rgba(74,56,28,0.10) 100%);
}
/* cornice sottile dell'erbario */
.frame {
  position: fixed;
  inset: 14px;
  pointer-events: none;
  z-index: 2;
  border: 1px solid rgba(107,79,52,0.30);
  border-radius: 6px;
  box-shadow: inset 0 0 0 4px rgba(252,249,241,0.5), inset 0 0 0 5px rgba(107,79,52,0.18);
}
.hero, .controls, .breadcrumb, .lead, .organ-meta, .disturbi, .grid, footer { position: relative; z-index: 3; }

/* ---------- Hero ---------- */
.hero {
  text-align: center;
  padding: 84px 24px 44px;
}
.hero .glyph {
  font-size: 58px;
  color: var(--moss);
  line-height: 1;
  opacity: .9;
}
.hero h1 {
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(38px, 6.6vw, 80px);
  line-height: 1.02;
  letter-spacing: .5px;
  color: var(--bark);
  margin: 14px 0 10px;
}
.hero h1 .accent { color: var(--forest); font-style: italic; }
.hero .eyebrow {
  font-family: var(--display);
  font-style: italic;
  font-size: clamp(30px, 4.6vw, 46px);
  color: var(--forest);
  letter-spacing: 1px;
  line-height: 1;
  margin: 8px 0 8px;
}
.hero .sub {
  font-family: var(--serif);
  font-size: clamp(15px, 1.8vw, 18px);
  color: var(--ink-soft);
  font-style: italic;
  max-width: 600px;
  margin: 6px auto 0;
}
.hero .matrix-line {
  margin: 24px auto 0;
  max-width: 760px;
  font-size: 12px;
  letter-spacing: 1.6px;
  text-transform: uppercase;
  color: var(--muted);
}
.hero .matrix-line span { color: var(--sage); margin: 0 6px; }

/* ---------- Targhetta "Il metodo · La Matrice" ---------- */
.hero .method { margin-top: 24px; }
.method-badge {
  display: inline-block;
  font-family: var(--sans);
  font-size: 12px; letter-spacing: 2.5px; text-transform: uppercase;
  color: var(--forest);
  border: 1px solid rgba(79,122,69,0.40);
  background: rgba(79,122,69,0.07);
  border-radius: 999px; padding: 8px 18px;
}
.method-claim {
  font-family: var(--serif); font-style: italic;
  font-size: clamp(16px, 2vw, 20px); color: var(--ink-soft);
  max-width: 600px; margin: 14px auto 0;
}

/* ---------- Hero compatto (dopo la home) ---------- */
body.compact .hero { padding: 38px 24px 18px; }
body.compact .hero .glyph,
body.compact .hero .eyebrow,
body.compact .hero .sub,
body.compact .hero .matrix-line,
body.compact .hero .method { display: none; }
body.compact .hero h1 {
  font-size: clamp(20px, 3.4vw, 28px);
  margin: 0; cursor: pointer; display: inline-block;
}
body.compact .hero h1 .accent { font-style: italic; }

/* ---------- Controls / search ---------- */
.controls {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  justify-content: center;
}
.search { flex: 1 1 320px; max-width: 480px; position: relative; }
.search input {
  width: 100%;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink);
  padding: 14px 20px 14px 46px;
  font-size: 15px;
  font-family: var(--sans);
  outline: none;
  box-shadow: 0 6px 18px var(--shadow);
  transition: border-color .2s, box-shadow .2s;
}
.search input:focus { border-color: var(--forest); box-shadow: 0 8px 22px var(--shadow); }
.search input::placeholder { color: var(--muted); }
.search::before {
  content: "⌕";
  position: absolute; left: 18px; top: 50%;
  transform: translateY(-50%);
  color: var(--moss); font-size: 18px;
}

/* ---------- Breadcrumb ---------- */
.breadcrumb {
  max-width: 1080px;
  margin: 28px auto 4px;
  padding: 0 24px;
  font-size: 13px;
  letter-spacing: .4px;
  color: var(--muted);
}
.breadcrumb a { color: var(--forest); cursor: pointer; text-decoration: none; }
.breadcrumb a:hover { color: var(--moss); text-decoration: underline; }
.breadcrumb .sep { margin: 0 9px; color: var(--sage); }
.breadcrumb .cur { color: var(--bark); }

.lead {
  max-width: 1080px;
  margin: 16px auto 6px;
  padding: 0 24px;
  font-family: var(--serif);
  font-style: italic;
  font-size: 21px;
  color: var(--ink-soft);
}

/* ---------- Organ meta ---------- */
.organ-meta {
  max-width: 1080px;
  margin: 10px auto 4px;
  padding: 0 24px;
  display: flex; flex-wrap: wrap; gap: 22px;
  font-size: 13px; color: var(--ink-soft);
}
.organ-meta b { color: var(--forest); font-weight: 600; }

/* ---------- Lista disturbi ---------- */
.disturbi {
  max-width: 1080px;
  margin: 18px auto 80px;
  padding: 0 24px;
  display: flex; flex-direction: column; gap: 12px;
}
.disturbo-row {
  display: flex; align-items: center; gap: 16px;
  width: 100%; text-align: left;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 18px 20px;
  cursor: pointer;
  font-family: var(--sans); color: var(--ink);
  box-shadow: 0 4px 14px var(--shadow);
  transition: transform .2s, border-color .2s, box-shadow .2s;
}
.disturbo-row:hover { transform: translateX(4px); border-color: var(--forest); box-shadow: 0 12px 26px var(--shadow); }
.disturbo-row .bullet { width: 11px; height: 11px; border-radius: 50%; flex: none; }
.disturbo-row .dz { display: flex; flex-direction: column; flex: 1; }
.disturbo-row .dn { font-family: var(--display); font-size: 25px; line-height: 1.1; color: var(--bark); }
.disturbo-row .ds { font-size: 13.5px; color: var(--ink-soft); margin-top: 2px; }
.disturbo-row .arrow { font-size: 12px; letter-spacing: 1.5px; text-transform: uppercase; color: var(--forest); white-space: nowrap; }
@media (max-width: 600px) { .disturbo-row .arrow { display: none; } }

/* ---------- Grid di card ---------- */
.grid {
  max-width: 1080px;
  margin: 14px auto 80px;
  padding: 0 24px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}
.card {
  position: relative;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 28px 24px 24px;
  cursor: pointer;
  overflow: hidden;
  box-shadow: 0 6px 18px var(--shadow);
  transition: transform .25s ease, border-color .25s ease, box-shadow .25s ease;
}
.card:hover { transform: translateY(-4px); border-color: var(--forest); box-shadow: 0 18px 38px var(--shadow); }
.card .ribbon { position: absolute; top: 0; left: 0; width: 100%; height: 4px; }
.card .el {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 11px; letter-spacing: 1.5px; text-transform: uppercase;
  color: var(--muted); margin-bottom: 12px;
}
.card .el .dot { width: 9px; height: 9px; border-radius: 50%; }
.card h3 { font-family: var(--display); font-weight: 400; font-size: 31px; line-height: 1.08; color: var(--bark); }
.card .app { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.card .desc { font-family: var(--serif); font-style: italic; color: var(--ink-soft); margin-top: 14px; font-size: 16px; }
.card .tags { margin-top: 16px; display: flex; flex-wrap: wrap; gap: 7px; }
.tag {
  font-size: 11px; letter-spacing: .5px; color: var(--forest);
  border: 1px solid var(--line); border-radius: 999px; padding: 4px 10px;
  background: rgba(79,122,69,0.06);
}
.card .more { margin-top: 18px; font-size: 12px; letter-spacing: 2px; text-transform: uppercase; color: var(--forest); }
.card .botanico { font-family: var(--serif); font-style: italic; font-size: 17px; color: var(--moss); margin-top: 6px; }
.card-erbario { background: linear-gradient(180deg, #f0f4e8, var(--panel)); border-color: rgba(79,122,69,0.35); }
.card-erbario h3 { color: var(--forest); }

.empty {
  grid-column: 1 / -1;
  text-align: center; color: var(--muted);
  font-family: var(--serif); font-style: italic; font-size: 20px;
  padding: 60px 0;
}
.empty small { font-style: normal; font-family: var(--sans); font-size: 13px; }

/* ---------- Modal / matrice ---------- */
.overlay {
  position: fixed; inset: 0;
  background: rgba(47,37,24,0.42);
  backdrop-filter: blur(4px);
  display: none; z-index: 50;
  padding: 40px 16px; overflow-y: auto;
}
.overlay.open { display: block; }
.sheet {
  max-width: 860px; margin: 0 auto;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 22px; overflow: hidden;
  box-shadow: 0 30px 70px rgba(47,37,24,0.30);
  animation: rise .35s ease;
}
@keyframes rise { from { opacity:0; transform: translateY(24px);} to {opacity:1; transform:none;} }

.sheet-head {
  padding: 34px 36px 28px;
  border-bottom: 1px solid var(--line);
  position: relative;
  background: var(--panel-2);
}
.sheet-head .bar { position:absolute; top:0; left:0; width:100%; height:5px; }
.sheet-head .close {
  position: absolute; top: 20px; right: 22px;
  background: var(--panel); border: 1px solid var(--line);
  color: var(--ink-soft); width: 38px; height: 38px;
  border-radius: 50%; font-size: 16px; cursor: pointer; line-height: 1;
}
.sheet-head .close:hover { border-color: var(--forest); color: var(--forest); }
.sheet-head .el { font-size: 11px; letter-spacing: 1.5px; text-transform: uppercase; color: var(--muted); display:flex; align-items:center; gap:8px; }
.sheet-head .el .dot { width:10px; height:10px; border-radius:50%; }
.sheet-head h2 { font-family: var(--display); font-size: 50px; font-weight: 400; line-height:1.05; margin: 8px 0 6px; color: var(--bark); }
.sheet-head .app { color: var(--ink-soft); font-size: 14px; font-style: italic; font-family: var(--serif); }

.matrix { padding: 12px 36px 8px; }
.row {
  display: grid; grid-template-columns: 200px 1fr; gap: 20px;
  padding: 22px 0; border-bottom: 1px solid var(--line-soft);
}
.row:last-child { border-bottom: none; }
.row .label { display: flex; gap: 12px; align-items: flex-start; }
.row .num { font-family: var(--serif); font-size: 26px; color: var(--moss); line-height: 1; width: 34px; flex: none; }
.row .label .t .k { font-size: 11px; letter-spacing: 1.5px; text-transform: uppercase; color: var(--muted); }
.row .label .t .h { font-family: var(--display); font-size: 20px; color: var(--bark); line-height: 1.15; margin-top: 3px; }
.row .body { color: var(--ink-soft); font-size: 15px; }
.row .body .todo { color: var(--muted); font-style: italic; }

.badge-todo {
  display: inline-block;
  font-size: 10.5px; letter-spacing: 1px; text-transform: uppercase;
  color: var(--gold); border: 1px solid rgba(176,130,58,0.45);
  background: rgba(176,130,58,0.10);
  border-radius: 999px; padding: 2px 9px;
}
.notion-link {
  display: inline-block; margin-top: 14px;
  font-size: 12.5px; letter-spacing: .5px;
  color: var(--forest); text-decoration: none;
  border-bottom: 1px solid var(--line);
}
.notion-link:hover { color: var(--moss); border-color: var(--moss); }

@media (max-width: 640px) {
  .row { grid-template-columns: 1fr; gap: 8px; }
  .sheet-head h2 { font-size: 40px; }
}

/* ---------- Disclaimer / footer ---------- */
.disclaimer {
  margin: 26px 36px 8px;
  padding: 16px 18px;
  border: 1px dashed var(--line);
  border-radius: 12px;
  font-size: 12.5px; color: var(--ink-soft);
  background: rgba(79,122,69,0.06);
}
.disclaimer b { color: var(--bark); }

/* ---------- Richiesta patologia ---------- */
.request {
  max-width: 1080px; margin: 22px auto 80px; padding: 24px 24px;
  border: 1px dashed var(--line); border-radius: 16px;
  background: rgba(79,122,69,0.05);
}
.request .req-h { font-family: var(--display); font-size: 24px; color: var(--bark); }
.request .req-sub { font-size: 13.5px; color: var(--ink-soft); margin: 4px 0 14px; }
.req-form { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.req-in {
  flex: 1 1 220px; background: var(--panel); border: 1px solid var(--line);
  border-radius: 999px; padding: 12px 16px; font-size: 14px; font-family: var(--sans);
  color: var(--ink); outline: none;
}
.req-in:focus { border-color: var(--forest); }
.req-btn {
  display: inline-block; text-decoration: none;
  font-family: var(--display); font-size: 17px; letter-spacing: .5px;
  background: var(--forest); color: #f3eedd; border: none; border-radius: 999px;
  padding: 12px 24px; cursor: pointer; transition: background .2s;
}
.req-btn:hover { background: var(--moss); }
.req-frame {
  width: 100%; min-height: 460px; border: none;
  border-radius: 12px; background: var(--panel);
  margin-top: 4px;
}
.hp { position: absolute; left: -9999px; }
.req-ok {
  max-width: 1080px; margin: 22px auto 80px; padding: 22px 24px;
  border: 1px solid var(--forest); border-radius: 16px; background: rgba(79,122,69,0.10);
  color: var(--bark); font-size: 15px;
}
.req-ok small { color: var(--muted); font-size: 12.5px; }

/* ---------- Porta d'ingresso (disclaimer) ---------- */
.gate {
  position: fixed; inset: 0; z-index: 100;
  background: radial-gradient(900px 600px at 50% 0%, rgba(79,122,69,0.18), transparent 60%), rgba(30,24,16,0.55);
  backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center;
  padding: 28px 16px; overflow-y: auto;
}
.gate[hidden] { display: none; }
.gate-card {
  max-width: 620px; width: 100%;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: 0 30px 80px rgba(30,24,16,0.40);
  padding: 38px 40px 30px;
  margin: auto;
}
.gate-glyph { text-align: center; color: var(--moss); font-size: 44px; line-height: 1; }
.gate-card h2 {
  font-family: var(--display); font-weight: 400;
  font-size: clamp(30px, 5vw, 42px); color: var(--bark);
  text-align: center; margin: 8px 0 16px;
}
.gate-lead { font-family: var(--serif); font-size: 18px; color: var(--ink-soft); text-align: center; margin-bottom: 18px; }
.gate-points { list-style: none; display: flex; flex-direction: column; gap: 12px; margin: 0 0 22px; }
.gate-points li {
  position: relative; padding-left: 20px;
  font-size: 13.5px; color: var(--ink-soft); line-height: 1.55;
}
.gate-points li::before { content: "❧"; position: absolute; left: 0; top: 0; color: var(--sage); font-size: 12px; }
.gate-points b { color: var(--bark); }
.gate-check {
  display: flex; gap: 11px; align-items: flex-start;
  font-size: 13px; color: var(--ink); cursor: pointer;
  background: rgba(79,122,69,0.06); border: 1px solid var(--line);
  border-radius: 12px; padding: 14px 16px; margin-bottom: 18px;
}
.gate-check input { margin-top: 3px; width: 17px; height: 17px; accent-color: var(--forest); flex: none; cursor: pointer; }
.gate-btn {
  display: block; width: 100%;
  font-family: var(--display); font-size: 19px; letter-spacing: .5px;
  background: var(--forest); color: #f3eedd; border: none;
  border-radius: 999px; padding: 14px; cursor: pointer;
  transition: background .2s, opacity .2s;
}
.gate-btn:hover:not(:disabled) { background: var(--moss); }
.gate-btn:disabled { opacity: .45; cursor: not-allowed; }
.gate-note { text-align: center; font-size: 11.5px; color: var(--muted); margin-top: 14px; font-style: italic; }

footer {
  text-align: center;
  padding: 40px 24px 60px;
  color: var(--muted); font-size: 12.5px;
  border-top: 1px solid var(--line);
}
footer .glyph { color: var(--moss); font-size: 30px; display:block; margin-bottom: 12px; opacity:.85; }
.footer-links { margin-top: 14px; font-size: 12.5px; }
.footer-links a { color: var(--forest); text-decoration: none; }
.footer-links a:hover { color: var(--moss); text-decoration: underline; }
.footer-links span { color: var(--sage); margin: 0 10px; }

/* ---------- Pagine legali (privacy / cookie) ---------- */
.legal { max-width: 760px; margin: 0 auto; padding: 70px 24px 90px; }
.legal .back { font-size: 13px; color: var(--forest); text-decoration: none; letter-spacing: .5px; }
.legal .back:hover { color: var(--moss); text-decoration: underline; }
.legal h1 { font-family: var(--display); font-weight: 400; font-size: clamp(34px, 6vw, 52px); color: var(--bark); margin: 18px 0 4px; }
.legal .updated { font-size: 12.5px; color: var(--muted); margin-bottom: 28px; }
.legal h2 { font-family: var(--display); font-weight: 400; font-size: 24px; color: var(--forest); margin: 30px 0 8px; }
.legal p, .legal li { font-size: 15px; color: var(--ink-soft); line-height: 1.65; }
.legal ul { margin: 8px 0 8px 20px; }
.legal a { color: var(--forest); }
.legal .note { font-size: 12.5px; color: var(--muted); font-style: italic; border-top: 1px solid var(--line); margin-top: 36px; padding-top: 16px; }
.legal .ph { background: rgba(176,130,58,0.14); border-radius: 4px; padding: 0 4px; color: var(--bark); }

/* ---------- Banner cookie ---------- */
.cookie-bar {
  position: fixed; left: 50%; bottom: 16px; transform: translateX(-50%);
  z-index: 90; width: calc(100% - 32px); max-width: 720px;
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 14px; padding: 14px 18px;
  box-shadow: 0 14px 40px rgba(47,37,24,0.22);
}
.cookie-bar[hidden] { display: none; }
.cookie-txt { flex: 1 1 240px; font-size: 13px; color: var(--ink-soft); line-height: 1.5; }
.cookie-txt a { color: var(--forest); }
.cookie-btn {
  flex: none; font-family: var(--display); font-size: 16px;
  background: var(--forest); color: #f3eedd; border: none;
  border-radius: 999px; padding: 10px 22px; cursor: pointer; transition: background .2s;
}
.cookie-btn:hover { background: var(--moss); }

/* ---------- Ottimizzazione mobile ---------- */
@media (max-width: 700px) {
  .frame { display: none; }                 /* la cornice fissa dava fastidio nello scroll */
  body::after { display: none; }            /* via la vignettatura pesante */
  .hero { padding: 54px 18px 28px; }
  body.compact .hero { padding: 14px 18px 8px; }
  .controls, .breadcrumb, .lead, .organ-meta, .grid, .disturbi, .request, .req-ok { padding-left: 16px; padding-right: 16px; }
  .grid { gap: 16px; }
  .matrix { padding-left: 20px; padding-right: 20px; }
  .disclaimer { margin-left: 16px; margin-right: 16px; padding: 14px 15px; }
  .overlay, .gate { padding: 16px 8px; }
  .sheet { border-radius: 16px; }
  .gate-card { padding: 28px 22px 24px; }

  /* intestazione scheda: più aria */
  .sheet-head { padding: 22px 20px 20px; }
  .sheet-head .el { padding-right: 46px; margin-bottom: 2px; }   /* non finisce sotto la × */
  .sheet-head h2 { font-size: 30px; line-height: 1.12; margin: 10px 0 10px; }
  .sheet-head .close { top: 14px; right: 14px; width: 34px; height: 34px; font-size: 15px; }
  .sheet-head .app { font-size: 13.5px; }
  .notion-link { margin-top: 12px; }
  .row { padding: 18px 0; }
}
