@font-face {
  font-family: "Kaisei Decol";
  src: url("fonts/kaisei-decol.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Zen Old Mincho";
  src: url("fonts/zen-old-mincho.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root {
  --color-paper: #f3f0e8;
  --color-ink: #222522;
  --color-olive: #5d6d5a;
  --color-moss: #3e4d3c;
  --color-line: #ddd6c8;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --color-paper: #171916;
    --color-ink: #e7e9e4;
    --color-olive: #9aab96;
    --color-moss: #c9d6c5;
    --color-line: #2e342e;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100svh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-paper);
  color: var(--color-ink);
  font-family: "Zen Old Mincho", "Yu Mincho", serif;
}

::selection {
  background: var(--color-moss);
  color: var(--color-paper);
}

.mount {
  position: absolute;
  inset: 1.25rem;
  border: 1px solid var(--color-line);
  pointer-events: none;
}

@media (min-width: 768px) {
  .mount { inset: 2rem; }
}

main { position: relative; z-index: 1; }

.enso-stage {
  position: relative;
  /* stretta dalla cornice anche in orizzontale */
  width: min(86vw, calc(100svh - 6rem), 40rem);
  aspect-ratio: 1;
  container-type: inline-size;
}

.brush-svg {
  display: block;
  width: 100%;
  height: auto;
  color: var(--color-ink);
}

.reveal-soft {
  stroke-dasharray: 1000;
  stroke-dashoffset: 986;
  filter: blur(5px);
  animation: draw-enso-soft 7.4s linear 0.2s forwards;
}

.reveal-path {
  stroke-dasharray: 1000;
  stroke-dashoffset: 1000;
  animation: draw-enso 7.4s linear 0.2s forwards;
}

.reveal-tip {
  stroke-dasharray: 100;
  stroke-dashoffset: 100;
  animation: draw-tip 1.7s linear 5.9s forwards;
}

@keyframes draw-enso {
  0% { stroke-dashoffset: 1000; }
  9% { stroke-dashoffset: 930; }
  76% { stroke-dashoffset: 78; }
  100% { stroke-dashoffset: 0; }
}

@keyframes draw-enso-soft {
  0% { stroke-dashoffset: 986; }
  9% { stroke-dashoffset: 916; }
  76% { stroke-dashoffset: 64; }
  100% { stroke-dashoffset: 0; }
}

@keyframes draw-tip {
  to { stroke-dashoffset: 0; }
}

@keyframes rise {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

@keyframes ripple {
  0% { transform: scale(0.78); opacity: 0.28; }
  70% { opacity: 0.08; }
  100% { transform: scale(1.42); opacity: 0; }
}

.enso-copy {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 26%;
}

.enso-kicker {
  margin: 0;
  color: var(--color-olive);
  font-size: clamp(0.6875rem, 2.35cqi, 0.95rem);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  line-height: 1.4;
  white-space: nowrap;
  animation: rise 1.6s cubic-bezier(0.22, 1, 0.36, 1) 0.7s both;
}

.enso-title {
  margin: 0.35em 0 0;
  font-family: "Kaisei Decol", "Zen Old Mincho", serif;
  font-size: clamp(1.75rem, 7.4cqi, 3rem);
  font-weight: 400;
  line-height: 1.05;
  letter-spacing: 0.02em;
  animation: rise 1.6s cubic-bezier(0.22, 1, 0.36, 1) 1.5s both;
}

.enso-lead {
  max-width: 17em;
  margin: 0.8em 0 0;
  color: var(--color-olive);
  font-size: clamp(0.8125rem, 2.7cqi, 1.08rem);
  line-height: 1.55;
  text-wrap: balance;
  animation: rise 1.6s cubic-bezier(0.22, 1, 0.36, 1) 2.2s both;
}

.enso-mail {
  margin-top: 0.9em;
  color: var(--color-moss);
  font-size: clamp(0.8125rem, 2.7cqi, 1.08rem);
  letter-spacing: 0.02em;
  line-height: 1.3;
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: color 0.4s ease, border-color 0.4s ease;
  animation: rise 1.6s cubic-bezier(0.22, 1, 0.36, 1) 3s both;
}

.enso-mail:hover {
  color: var(--color-ink);
  border-bottom-color: currentColor;
}

.enso-mail:focus-visible {
  outline: 1px solid var(--color-olive);
  outline-offset: 5px;
}

.ripples {
  position: absolute;
  inset: 0;
  color: color-mix(in srgb, var(--color-olive) 30%, transparent);
  pointer-events: none;
}

.ripple {
  position: absolute;
  /* proporzionata all'enso, non al viewport */
  inset: 17%;
  border-radius: 9999px;
  border: 1px solid currentColor;
  opacity: 0;
  animation: ripple 11s ease-out 7.8s infinite;
}

.ripple-late { animation-delay: 12.2s; }

/* enso piccolo (telefono in orizzontale, finestre basse) */
@container (max-width: 320px) {
  .enso-copy { padding: 22%; }
  .enso-kicker { font-size: 0.625rem; letter-spacing: 0.14em; }
  .enso-title { font-size: 1.5rem; }
  .enso-lead { font-size: 0.75rem; line-height: 1.45; }
  .enso-mail { font-size: 0.75rem; }
}

@media (prefers-reduced-motion: reduce) {
  .reveal-path, .reveal-soft, .reveal-tip, .ripple,
  .enso-kicker, .enso-title, .enso-lead, .enso-mail {
    animation: none;
  }
  .reveal-path, .reveal-soft, .reveal-tip {
    stroke-dashoffset: 0;
    filter: none;
  }
}
