/* Giardino Infinito — erbario ad acquerello */
@font-face {
  font-family: 'Cormorant'; font-style: normal; font-weight: 400; font-display: swap;
  src: url('vendor/fonts/cormorant-v24-latin-regular.woff2') format('woff2');
}
@font-face {
  font-family: 'Cormorant'; font-style: italic; font-weight: 400; font-display: swap;
  src: url('vendor/fonts/cormorant-v24-latin-italic.woff2') format('woff2');
}
@font-face {
  font-family: 'Cormorant'; font-style: normal; font-weight: 600; font-display: swap;
  src: url('vendor/fonts/cormorant-v24-latin-600.woff2') format('woff2');
}
@font-face {
  font-family: 'Cormorant'; font-style: italic; font-weight: 600; font-display: swap;
  src: url('vendor/fonts/cormorant-v24-latin-600italic.woff2') format('woff2');
}
@font-face {
  font-family: 'Karla'; font-style: normal; font-weight: 400; font-display: swap;
  src: url('vendor/fonts/karla-v33-latin-regular.woff2') format('woff2');
}
@font-face {
  font-family: 'Karla'; font-style: normal; font-weight: 700; font-display: swap;
  src: url('vendor/fonts/karla-v33-latin-700.woff2') format('woff2');
}

:root {
  --carta: #f4ecd6;
  --carta-scura: #e9dfc3;
  --inchiostro: #3d3a2e;
  --salvia: #7d9364;
  --oliva: #5f7048;
  --terracotta: #c07856;
  --malva: #9c7ba6;
  --notte: #232b45;
  --bordo: rgba(84, 74, 50, 0.35);
}

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

html, body { height: 100%; overflow: hidden; }

body {
  font-family: 'Karla', sans-serif;
  color: var(--inchiostro);
  background: var(--carta);
}

#scene {
  position: fixed; inset: 0; width: 100vw; height: 100vh; display: block;
  cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='28' height='28' viewBox='0 0 28 28'%3E%3Ccircle cx='14' cy='19' r='4.5' fill='%23795c3a' stroke='%23f4ecd6' stroke-width='1.4'/%3E%3Cpath d='M14 15 V8' stroke='%235f7048' stroke-width='2' stroke-linecap='round'/%3E%3Cpath d='M14 10 C10 9.5 8 6.5 7.6 4 C11 4.4 13.6 6.6 14 10 Z' fill='%237d9364' stroke='%23f4ecd6' stroke-width='0.8'/%3E%3C/svg%3E") 14 22, crosshair;
}

/* ---------- pannelli di carta ---------- */
.panel {
  position: fixed;
  background: linear-gradient(160deg, rgba(249, 243, 227, 0.94), rgba(240, 230, 204, 0.94));
  border: 1px solid var(--bordo);
  border-radius: 14px 20px 12px 18px;
  box-shadow: 0 3px 14px rgba(61, 50, 30, 0.16), inset 0 0 24px rgba(200, 182, 140, 0.18);
  backdrop-filter: blur(3px);
}

.head {
  top: 22px; left: 26px;
  padding: 12px 22px 13px;
  pointer-events: none;
  transform: rotate(-0.5deg);
}
.head h1 {
  font-family: 'Cormorant', serif;
  font-style: italic; font-weight: 600;
  font-size: 31px; line-height: 1.05;
  letter-spacing: 0.02em;
  color: var(--oliva);
}
.head .sub {
  font-size: 11.5px; letter-spacing: 0.06em;
  color: rgba(61, 58, 46, 0.72);
  margin-top: 3px;
}

/* ---------- controlli ---------- */
.controls {
  top: 22px; right: 26px;
  padding: 10px 14px;
  display: flex; flex-direction: column; gap: 8px;
  transform: rotate(0.4deg);
}
.seasons { display: flex; gap: 5px; }
.seasons button, .tools button, .chips button, .code-row button, .card-actions button {
  font-family: 'Karla', sans-serif;
  font-size: 11.5px;
  color: var(--inchiostro);
  background: rgba(255, 252, 242, 0.65);
  border: 1px solid rgba(84, 74, 50, 0.3);
  border-radius: 9px 13px 8px 12px;
  padding: 5px 10px;
  cursor: pointer;
  transition: transform 0.16s cubic-bezier(0.34, 1.56, 0.64, 1), background 0.16s, box-shadow 0.16s;
}
.seasons button:hover, .tools button:hover, .chips button:hover, .code-row button:hover, .card-actions button:hover {
  transform: translateY(-1.5px) rotate(-0.8deg);
  background: #fffdf4;
  box-shadow: 0 2px 8px rgba(61, 50, 30, 0.18);
}
.seasons button.sel, .chips button.sel {
  background: var(--oliva);
  color: #f6f1de;
  border-color: var(--oliva);
  font-weight: 700;
}
.tools { display: flex; gap: 5px; justify-content: flex-end; }
.tools button {
  display: inline-flex; align-items: center; gap: 5px;
}
.tools button svg { opacity: 0.8; }
.tools button[aria-pressed="true"] {
  background: var(--terracotta); color: #fdf6ea; border-color: var(--terracotta);
}
.tools button[aria-pressed="true"] svg { opacity: 1; }

/* ---------- vassoio dei semi ---------- */
.tray {
  left: 26px; bottom: 24px;
  padding: 11px 16px 13px;
  max-width: 320px;
  transform: rotate(0.5deg);
}
.tray-label {
  font-family: 'Cormorant', serif; font-style: italic; font-weight: 600;
  font-size: 16px; color: var(--oliva);
  margin-bottom: 6px; letter-spacing: 0.05em;
}
.chips { display: flex; flex-wrap: wrap; gap: 5px; }
.code-row { display: flex; gap: 5px; margin-top: 8px; }
.code-row input {
  flex: 1; min-width: 0;
  font-family: 'Karla', sans-serif; font-size: 11.5px;
  padding: 5px 9px;
  color: var(--inchiostro);
  background: rgba(255, 252, 242, 0.8);
  border: 1px dashed rgba(84, 74, 50, 0.4);
  border-radius: 8px 12px 8px 12px;
}
.code-row input::placeholder { color: rgba(61, 58, 46, 0.45); font-style: italic; }

/* ---------- etichetta erbario (hover) ---------- */
.card {
  padding: 12px 16px 12px;
  min-width: 190px; max-width: 250px;
  z-index: 10;
  transform: rotate(-1deg);
  animation: cardin 0.22s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes cardin {
  from { opacity: 0; transform: rotate(-1deg) translateY(6px) scale(0.96); }
  to { opacity: 1; transform: rotate(-1deg) translateY(0) scale(1); }
}
.card-name {
  font-family: 'Cormorant', serif; font-style: italic; font-weight: 600;
  font-size: 19px; color: var(--oliva); line-height: 1.1;
}
.card-meta {
  font-size: 10.5px; letter-spacing: 0.08em; text-transform: uppercase;
  color: rgba(61, 58, 46, 0.6); margin-top: 3px;
}
.card-code { font-size: 11px; margin-top: 7px; color: rgba(61, 58, 46, 0.8); }
.card-code code {
  font-family: 'Karla', monospace; font-weight: 700;
  background: rgba(125, 147, 100, 0.16);
  padding: 1px 6px; border-radius: 5px;
  letter-spacing: 0.06em;
}
.card-actions { display: flex; gap: 5px; margin-top: 9px; }
.card-actions .danger { border-color: rgba(160, 70, 50, 0.5); color: #9a4a32; }
.card-actions .danger:hover { background: #f7e2d8; }

/* ---------- toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 34px; transform: translateX(-50%);
  font-family: 'Cormorant', serif; font-style: italic; font-size: 17px;
  color: var(--inchiostro);
  background: rgba(249, 243, 227, 0.95);
  border: 1px solid var(--bordo);
  border-radius: 12px 18px 12px 16px;
  padding: 8px 20px;
  box-shadow: 0 3px 12px rgba(61, 50, 30, 0.2);
  z-index: 20; pointer-events: none;
  animation: cardin 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ---------- footer ---------- */
.foot {
  position: fixed; right: 26px; bottom: 22px;
  display: flex; align-items: baseline; gap: 12px;
  font-size: 11.5px;
  padding: 4px 12px 6px;
  border-radius: 10px 14px 9px 13px;
  background: rgba(249, 243, 227, 0.55);
  backdrop-filter: blur(2.5px);
  transition: background 0.6s;
}
.foot a {
  color: rgba(61, 58, 46, 0.75); text-decoration: none;
  border-bottom: 1px dashed rgba(61, 58, 46, 0.4);
  padding-bottom: 1px;
  transition: color 0.15s;
}
.foot a:hover { color: var(--oliva); }
.sig {
  font-family: 'Cormorant', serif; font-style: italic; font-weight: 600;
  font-size: 13px; color: rgba(61, 58, 46, 0.55);
}

/* notte: i pannelli si scaldano di lume di candela */
body.notte .panel {
  background: linear-gradient(160deg, rgba(242, 233, 210, 0.9), rgba(228, 214, 182, 0.9));
  box-shadow: 0 3px 18px rgba(10, 12, 28, 0.45), inset 0 0 24px rgba(200, 182, 140, 0.2);
}
body.notte .foot { background: rgba(22, 28, 50, 0.45); }
body.notte .foot a, body.notte .sig { color: rgba(240, 234, 214, 0.8); }
body.notte .foot a { border-bottom-color: rgba(240, 234, 214, 0.4); }

button:focus-visible, input:focus-visible, a:focus-visible {
  outline: 2px dashed var(--oliva); outline-offset: 2px;
}

@media (max-width: 1100px) {
  .head h1 { font-size: 25px; }
  .tray { max-width: 280px; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
