/* ==========================================================================
   POSA — Crea il tuo Rilievo Social (configurator)
   Desktop: question left, sticky drawing sheet right.
   Mobile: compact sheet on top, question below, sticky Indietro/Avanti bar.
   ========================================================================== */
.rl { padding-top: clamp(1.5rem, 1rem + 2.5vw, 3.5rem); }
.rl__grid { display: grid; gap: clamp(1.25rem, 1rem + 2vw, 3rem); align-items: start; }
.rl__panel { display: grid; gap: clamp(1.1rem, .9rem + 1vw, 1.75rem); min-width: 0; }
.rl__head { display: grid; justify-items: start; gap: .6rem; }
.rl__title { font-family: var(--font-serif); font-weight: 500; font-size: clamp(2.3rem, 1.4rem + 3.6vw, 4.6rem); line-height: 1; letter-spacing: -.025em; color: var(--chianti); }
.rl__title .script { font-size: 1.12em; }
.rl__lead { max-width: 30em; }

/* progress: "03 / 09" + construction line */
.rl__progress { display: flex; align-items: center; gap: 1rem; }
.rl__count { font-size: .75rem; letter-spacing: .1em; color: var(--chianti); white-space: nowrap; }
.rl__bar { position: relative; flex: 1; height: 1px; background: var(--chianti-12); }
.rl__bar span { position: absolute; inset: 0; background: var(--chianti); transform-origin: 0 50%; transform: scaleX(.11); transition: transform .7s cubic-bezier(.22, 1, .36, 1); }

/* question */
.rl-q { border: 0; padding: 0; margin: 0; min-width: 0; display: grid; gap: .6rem; }
.rl-q__title { font-family: var(--font-serif); font-weight: 400; font-size: clamp(1.7rem, 1.3rem + 1.6vw, 2.6rem); line-height: 1.1; color: var(--chianti); padding: 0; outline: none; }
.rl-q__hint { font-size: .6875rem; letter-spacing: .1em; text-transform: uppercase; color: var(--chianti-60); margin-bottom: .4rem; }
.rl-opts { display: grid; gap: .6rem; }
@media (min-width: 560px) { .rl-opts--many { grid-template-columns: 1fr 1fr; } }
.rl-opt { position: relative; cursor: pointer; }
.rl-opt input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.rl-opt__box {
  display: flex; align-items: center; gap: .9rem;
  padding: .95rem 1.1rem; min-height: 3.4rem;
  border: 1px solid var(--chianti-12); border-radius: .9rem; background: var(--white);
  transition: border-color .3s, background-color .3s, translate .4s var(--ease-soft);
}
.rl-opt__n { flex: none; display: grid; place-items: center; width: 1.7rem; height: 1.7rem; border: 1px solid var(--chianti-12); border-radius: 50%; font-size: .7rem; color: var(--chianti-60); transition: background-color .3s, color .3s, border-color .3s; }
.rl-opt__t { font-size: 1.02rem; color: var(--chianti); line-height: 1.3; }
.rl-opt input[type=checkbox] + .rl-opt__box .rl-opt__n { border-radius: .35rem; }
@media (hover: hover) { .rl-opt:hover .rl-opt__box { border-color: var(--chianti); translate: 3px 0; } }
.rl-opt input:checked + .rl-opt__box { border-color: var(--chianti); background: var(--pink-soft); }
.rl-opt input:checked + .rl-opt__box .rl-opt__n { background: var(--chianti); border-color: var(--chianti); color: var(--white); }
.rl-opt input:focus-visible + .rl-opt__box { outline: 2px solid var(--chianti); outline-offset: 3px; }

/* contact form */
.rl-fields { display: grid; gap: 1rem 1.1rem; }
@media (min-width: 560px) { .rl-fields { grid-template-columns: 1fr 1fr; } .rl-field--wide { grid-column: 1 / -1; } }
.rl-field { display: grid; gap: .35rem; }
.rl-field label { font-family: var(--font-mono); font-size: .7rem; letter-spacing: .08em; text-transform: uppercase; color: var(--chianti); }
.rl-field__opt { text-transform: none; letter-spacing: 0; color: var(--chianti-60); }
.rl-field input, .rl-field textarea {
  width: 100%; font: inherit; font-size: 1rem; color: var(--chianti);
  padding: .8rem .95rem; border: 1px solid var(--chianti-12); border-radius: .7rem; background: var(--white);
  transition: border-color .3s;
}
.rl-field textarea { resize: vertical; min-height: 5.5rem; }
.rl-field input:focus-visible, .rl-field textarea:focus-visible { outline: 2px solid var(--chianti); outline-offset: 1px; border-color: var(--chianti); }
.rl-field [aria-invalid=true] { border-color: var(--chianti); background: var(--pink-soft); }
.rl-field__err { min-height: 0; font-size: .82rem; color: var(--chianti); }
.rl-field__err:empty { display: none; }
.rl-field .rl-check { display: flex; gap: .7rem; align-items: flex-start; cursor: pointer; font-family: var(--font-sans); font-size: .95rem; text-transform: none; letter-spacing: 0; color: var(--chianti-80); }
.rl-field .rl-check input { width: 1.15rem; height: 1.15rem; margin-top: .15rem; accent-color: var(--chianti); flex: none; }
.rl-field .rl-check a { color: var(--chianti); text-decoration: underline; text-underline-offset: 2px; }
.rl-hp { position: absolute !important; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.rl-send-err { padding: .9rem 1rem; border: 1px solid var(--chianti); border-radius: .7rem; background: var(--pink-soft); color: var(--chianti); }
.rl-send-err a { text-decoration: underline; }

/* nav */
.rl__nav { display: flex; gap: .75rem; justify-content: space-between; align-items: center; padding-top: .4rem; }
.rl__next { margin-left: auto; }
.rl__next:disabled { opacity: .35; cursor: not-allowed; }
.is-sending .rl__next { cursor: progress; }

/* done */
.rl__done { display: grid; gap: 1rem; justify-items: start; }
.rl__thanks { font-family: var(--font-serif); font-size: clamp(2.2rem, 1.6rem + 2.4vw, 3.6rem); line-height: 1; color: var(--chianti); outline: none; }
.rl__done-actions { display: flex; flex-wrap: wrap; gap: .75rem; margin-top: .4rem; }
.rl__restart { margin-top: .4rem; background: none; border: 0; padding: 0; cursor: pointer; font: inherit; color: var(--chianti); }

/* sheet */
.rl__sheet { margin: 0; display: grid; gap: .5rem; min-width: 0; }
.rl__sheet-bar {
  display: flex; justify-content: space-between; padding: .55rem .9rem;
  border: 1px solid var(--chianti-12); border-bottom: 0; border-radius: var(--radius-card) var(--radius-card) 0 0; background: var(--white);
  font-family: var(--font-mono); font-size: .625rem; letter-spacing: .12em; text-transform: uppercase; color: var(--chianti-60);
}
.rl__svg { display: block; width: 100%; height: auto; border: 1px solid var(--chianti-12); border-radius: 0 0 var(--radius-card) var(--radius-card); background: #fff; box-shadow: 0 30px 70px -40px rgba(85, 18, 18, .45); }
.rl__cap { font-size: .6875rem; letter-spacing: .1em; text-transform: uppercase; color: var(--chianti-60); }

/* pencil draw-on (only freshly added layers; --d = per-line delay) */
@keyframes sk-draw { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }
@keyframes sk-fade { from { opacity: 0; } }
.sk-new path.mask { animation: sk-fade .5s both; }
.sk-new path:not(.mask) { stroke-dasharray: 1 1; stroke-dashoffset: 1; animation: sk-draw .85s cubic-bezier(.45, 0, .2, 1) var(--d, 0ms) forwards; }
.sk-new path.dash { stroke-dasharray: 1 1; }
.sk-new text { animation: sk-fade .8s .9s both; }

@media (min-width: 1080px) {
  .rl__grid { grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr); column-gap: clamp(2.5rem, 5vw, 6rem); }
  .rl__sheet { position: sticky; top: calc(var(--header-h) + 1.5rem); }
}
@media (max-width: 1079px) {
  /* small screens: title → drawing → question */
  .rl__panel { display: contents; }
  .rl__head { order: -2; }
  .rl__sheet { order: -1; max-width: 40rem; width: 100%; justify-self: center; }
}
@media (max-width: 767px) {
  .rl { padding-top: .75rem; }
  .rl__grid { gap: 1rem; }
  .rl__head { gap: .35rem; }
  .rl__lead { font-size: .98rem; }
  .rl__cap { display: none; }
  /* sticky action bar */
  .rl__nav {
    position: sticky; bottom: 0; z-index: 5;
    margin-inline: calc(var(--gutter) * -1); padding: .8rem var(--gutter) calc(.8rem + env(safe-area-inset-bottom));
    background: rgba(255, 255, 255, .97); border-top: 1px solid var(--chianti-12);
  }
  .rl__nav .btn { padding-inline: 1.2rem; }
}
@media (prefers-reduced-motion: reduce) {
  .sk-new path, .sk-new text { animation: none !important; stroke-dashoffset: 0; }
  .rl__bar span { transition: none; }
}

/* `hidden` must always win over the display rules above */
.rl [hidden] { display: none !important; }

/* small phones: keep the first question on the first screen */
@media (max-width: 767px) {
  .rl__sheet-bar { display: none; }
  .rl__svg { border-radius: var(--radius-card); max-height: 30svh; width: auto; max-width: 100%; justify-self: center; }
  .rl__sheet { justify-items: center; }
  .rl__title { font-size: clamp(2rem, 1.4rem + 3vw, 2.6rem); }
}
