/* "In arrivo": the living window and one field. Same tokens as the full site (style.css). */
@font-face {
  font-family: "Manrope";
  src: url("assets/Manrope.ttf") format("truetype");
  font-weight: 200 800;
  font-display: swap;
}

/* Notte (default) */
:root {
  color-scheme: dark;
  --wall: #0b0d10;
  --wall-raised: #14171c;
  --ink: #ece9e3;
  --ink-soft: #a19c94;
  --line: rgb(236 233 227 / 0.12);
  --amber: #f0a347;
  --amber-ink: #f3b061;
  --on-amber: #1b1206;
  --poster: url("assets/lago.jpg");
  --pane-shadow: 0 30px 80px -40px rgb(0 0 0 / 0.9);

  --gutter: max(16px, 5vw);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

/* Alba: from the system */
@media (prefers-color-scheme: light) {
  :root {
    color-scheme: light;
    --wall: #e8e9e7;
    --wall-raised: #f4f4f2;
    --ink: #15171a;
    --ink-soft: #565a5f;
    --line: rgb(21 23 26 / 0.14);
    --amber: #e5922f;
    --amber-ink: #8f4f0c;
    --poster: url("assets/nebbia.jpg");
    --pane-shadow: 0 2px 6px rgb(20 22 26 / 0.08), 0 34px 60px -30px rgb(20 22 26 / 0.4);
  }
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100svh;
  background: var(--wall);
  color: var(--ink);
  font-family: "Manrope", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 1rem;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ---------- the page ---------- */

body.presto {
  display: grid;
  grid-template-rows: 1fr auto;
}

.scena {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(18px, 3.2svh, 32px);
  padding: max(28px, env(safe-area-inset-top)) var(--gutter) 8px;
}

.goccia {
  display: block;
  width: 40px;
  height: 40px;
  border-radius: 22.5%; /* the app icon's corners */
}

/* The window: vertical, as tall as the screen allows (leaving room for the icon, the field and
   the privacy link, so a small phone does not scroll), never wider than the phone. */
.vetro {
  --h: min(64svh, calc(100svh - 264px), calc((100vw - 2 * var(--gutter)) * 16 / 9), 760px);
  position: relative;
  height: var(--h);
  aspect-ratio: 9 / 16;
  border-radius: clamp(20px, calc(var(--h) * 0.045), 30px);
  overflow: hidden;
  background: var(--wall-raised) var(--poster) center / cover no-repeat;
  box-shadow: var(--pane-shadow);
}

.vetro::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  box-shadow: inset 0 0 0 1px var(--line);
  pointer-events: none;
}

.vetro__video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 1.4s var(--ease-out);
}

.vetro__video.is-playing {
  opacity: 1;
}

/* ---------- the field ---------- */

.modulo {
  display: grid;
  grid-template-rows: auto 2.25rem;
  width: min(100%, 360px);
}

.campo {
  grid-area: 1 / 1;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--wall-raised);
  transition: border-color 0.3s var(--ease-out), opacity 0.45s var(--ease-out), visibility 0.45s;
}

.campo:focus-within {
  border-color: color-mix(in srgb, var(--amber) 70%, transparent);
}

.campo:has(input:focus-visible) {
  outline: 2px solid var(--amber);
  outline-offset: 3px;
}

.campo:has(input[aria-invalid="true"]) {
  border-color: var(--amber);
}

.campo input {
  flex: 1;
  min-width: 0;
  height: 46px;
  padding: 0 6px 0 16px;
  border: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 1rem; /* 16px: iOS does not zoom in */
}

.campo input:focus-visible {
  outline: none;
}

.campo input::placeholder {
  color: var(--ink-soft);
  opacity: 1;
}

.miele {
  position: absolute;
  left: -10000px;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.campo button {
  position: relative;
  flex: none;
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--amber);
  color: var(--on-amber);
  cursor: pointer;
  transition: filter 0.2s var(--ease-out), transform 0.2s var(--ease-out);
  -webkit-tap-highlight-color: transparent;
}

.campo button:hover {
  filter: brightness(1.07);
}

.campo button:active {
  transform: scale(0.94);
}

.campo button:focus-visible {
  outline: 2px solid var(--amber);
  outline-offset: 3px;
}

.icona,
.giro {
  grid-area: 1 / 1;
  transition: opacity 0.2s var(--ease-out);
}

.giro {
  width: 18px;
  height: 18px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  opacity: 0;
}

.modulo.is-sending .icona {
  opacity: 0;
}

.modulo.is-sending .giro {
  opacity: 1;
  animation: giro 0.8s linear infinite;
}

.modulo.is-sending button {
  cursor: progress;
}

@keyframes giro {
  to {
    transform: rotate(1turn);
  }
}

.esito {
  grid-area: 2 / 1;
  margin: 0;
  padding-top: 12px;
  color: var(--ink-soft);
  font-size: 0.875rem;
  text-align: center;
}

.esito.is-error {
  color: var(--amber-ink);
}

/* Done: the field fades and the thanks takes its place, with no jump. */
.modulo.is-done .campo {
  opacity: 0;
  visibility: hidden;
}

.modulo.is-done .esito {
  grid-area: 1 / 1;
  align-self: center;
  padding-top: 0;
  color: var(--ink);
  font-size: 1.0625rem;
  font-weight: 500;
  animation: arriva 0.6s var(--ease-out) both;
}

.modulo.is-done .esito:focus {
  outline: none;
}

@keyframes arriva {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
}

.privacy {
  justify-self: center;
  padding: 14px 18px max(14px, env(safe-area-inset-bottom));
  color: var(--ink-soft);
  font-size: 0.75rem;
  letter-spacing: 0.02em;
  text-decoration: none;
  transition: color 0.2s var(--ease-out);
}

.privacy:hover,
.privacy:focus-visible {
  color: var(--ink);
}

.privacy:focus-visible {
  outline: 2px solid var(--amber);
  outline-offset: -4px;
  border-radius: 8px;
}

/* A quiet arrival, one piece after the other. */
@media (prefers-reduced-motion: no-preference) {
  .goccia,
  .vetro,
  .modulo {
    animation: sale 1.1s var(--ease-out) both;
  }

  .vetro {
    animation-delay: 0.08s;
  }

  .modulo {
    animation-delay: 0.22s;
  }

  @keyframes sale {
    from {
      opacity: 0;
      transform: translateY(10px);
    }
  }
}

@media (prefers-reduced-motion: reduce) {
  .modulo.is-sending .giro {
    animation: none;
    border-right-color: currentColor;
    opacity: 0.6;
  }
}

/* ---------- the privacy notice ---------- */

.foglio {
  width: min(100% - 2 * var(--gutter), 38rem);
  margin: 0 auto;
  padding: max(28px, env(safe-area-inset-top)) 0 max(48px, env(safe-area-inset-bottom));
}

.foglio__torna {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  color: var(--ink-soft);
  font-size: 0.875rem;
  text-decoration: none;
}

.foglio__torna:hover,
.foglio__torna:focus-visible {
  color: var(--ink);
}

.foglio h1 {
  margin: 28px 0 6px;
  font-size: 1.625rem;
  font-weight: 500;
  letter-spacing: -0.01em;
  line-height: 1.25;
}

.foglio .data {
  margin: 0 0 32px;
  color: var(--ink-soft);
  font-size: 0.875rem;
}

.foglio h2 {
  margin: 32px 0 8px;
  font-size: 1rem;
  font-weight: 600;
}

.foglio p,
.foglio li {
  color: color-mix(in srgb, var(--ink) 86%, var(--wall));
  line-height: 1.65;
}

.foglio p {
  margin: 0 0 12px;
}

.foglio ul {
  margin: 0 0 12px;
  padding-left: 1.2em;
}

.foglio a {
  color: var(--amber-ink);
  text-underline-offset: 3px;
}

.foglio hr {
  margin: 48px 0 0;
  border: 0;
  border-top: 1px solid var(--line);
}
