/* =========================================================
   Quantoviene — foglio di stile
   Rocco Totaro
   ========================================================= */

:root {
  --bg:        #f6f2ec;
  --bg-tint:   #efe8dd;
  --surface:   #fffdfa;
  --surface-2: #f3ede4;
  --ink:       #1c1a17;
  --muted:     #6d655d;
  --line:      rgba(28, 26, 23, .14);
  --line-soft: rgba(28, 26, 23, .07);
  --brand:     #d94f1c;
  --brand-ink: #ffffff;
  --brand-tint:rgba(217, 79, 28, .10);
  --sea:       #10706a;
  --sea-tint:  rgba(16, 112, 106, .12);
  --shadow-sm: 0 1px 2px rgba(28,26,23,.06), 0 2px 8px -4px rgba(28,26,23,.12);
  --shadow-md: 0 2px 4px rgba(28,26,23,.05), 0 18px 40px -24px rgba(28,26,23,.35);

  --r-sm: 8px;
  --r-md: 14px;
  --r-lg: 22px;

  --sans: 'Inter', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  --serif: 'Fraunces', 'Iowan Old Style', Georgia, serif;

  --maxw: 1080px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg:        #131210;
    --bg-tint:   #1a1815;
    --surface:   #1d1b18;
    --surface-2: #24211d;
    --ink:       #f4f0e9;
    --muted:     #a79f96;
    --line:      rgba(244, 240, 233, .16);
    --line-soft: rgba(244, 240, 233, .08);
    --brand:     #ff7a45;
    --brand-ink: #21140d;
    --brand-tint:rgba(255, 122, 69, .14);
    --sea:       #4ec9bd;
    --sea-tint:  rgba(78, 201, 189, .14);
    --shadow-sm: 0 1px 2px rgba(0,0,0,.4);
    --shadow-md: 0 20px 44px -26px rgba(0,0,0,.85);
  }
}

:root[data-theme="dark"] {
  --bg:        #131210;
  --bg-tint:   #1a1815;
  --surface:   #1d1b18;
  --surface-2: #24211d;
  --ink:       #f4f0e9;
  --muted:     #a79f96;
  --line:      rgba(244, 240, 233, .16);
  --line-soft: rgba(244, 240, 233, .08);
  --brand:     #ff7a45;
  --brand-ink: #21140d;
  --brand-tint:rgba(255, 122, 69, .14);
  --sea:       #4ec9bd;
  --sea-tint:  rgba(78, 201, 189, .14);
  --shadow-sm: 0 1px 2px rgba(0,0,0,.4);
  --shadow-md: 0 20px 44px -26px rgba(0,0,0,.85);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  background-image:
    radial-gradient(60rem 30rem at 12% -8%, var(--brand-tint), transparent 60%),
    radial-gradient(50rem 28rem at 92% 4%, var(--sea-tint), transparent 60%);
  background-repeat: no-repeat;
}

h1, h2, h3, h4 { font-family: var(--serif); font-weight: 600; line-height: 1.12; margin: 0; letter-spacing: -.015em; }
p { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }
a { color: inherit; }

.wrap {
  width: 100%;
  max-width: var(--maxw);
  margin-inline: auto;
  padding-inline: 20px;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--ink);
  color: var(--bg);
  padding: 10px 16px;
  border-radius: 0 0 var(--r-sm) 0;
  z-index: 100;
}
.skip-link:focus { left: 0; }

:where(a, button, input, select, [tabindex]):focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
  border-radius: 4px;
}

/* ---------- header ---------- */

.site-head {
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: saturate(140%) blur(10px);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  border-bottom: 1px solid var(--line-soft);
}

.head-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-block: 12px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}
.brand-mark { color: var(--brand); display: inline-flex; }
.brand-name {
  font-family: var(--serif);
  font-size: 21px;
  font-weight: 600;
  letter-spacing: -.02em;
}
.brand-name em { font-style: italic; color: var(--brand); }

.head-nav {
  display: flex;
  align-items: center;
  gap: 6px;
}
.head-nav > a {
  font-size: 14px;
  color: var(--muted);
  text-decoration: none;
  padding: 8px 10px;
  border-radius: var(--r-sm);
}
.head-nav > a:hover { color: var(--ink); background: var(--surface-2); }

.theme-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font: inherit;
  font-size: 14px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 14px;
  cursor: pointer;
  margin-left: 4px;
}
.theme-toggle:hover { border-color: var(--brand); color: var(--brand); }
.theme-icon {
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--brand);
  box-shadow: inset -4px -2px 0 0 var(--surface);
}
:root[data-theme="dark"] .theme-icon,
:root:not([data-theme="light"]) .theme-icon { }
@media (max-width: 620px) {
  .head-nav > a { display: none; }
  .theme-label { display: none; }
  .theme-toggle { padding: 8px; }
}

/* ---------- hero ---------- */

.hero { padding-block: clamp(20px, 3vw, 34px) clamp(12px, 1.6vw, 18px); }



.hero h1 {
  font-size: clamp(23px, 3.2vw, 34px);
  max-width: 26ch;
  margin-bottom: 8px;
}
.hero h1 em { font-style: italic; color: var(--brand); }

.lede {
  font-size: 15px;
  color: var(--muted);
  max-width: 62ch;
}

.hero-points {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 28px;
  margin-top: 26px;
  font-size: 14px;
  color: var(--muted);
}
.hero-points li { display: flex; align-items: center; gap: 8px; }
.hero-points li::before {
  content: '';
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--sea);
}
.hero-points strong { color: var(--ink); font-weight: 600; }

/* ---------- sezioni ---------- */

.section { padding-block: clamp(28px, 5vw, 52px); scroll-margin-top: 76px; }
#cerca { padding-top: 0; }
.band {
  background: var(--bg-tint);
  border-block: 1px solid var(--line-soft);
}

.section-title {
  font-size: clamp(22px, 3.4vw, 30px);
  margin-bottom: 8px;
}
.section-title + .section-note { margin-bottom: 20px; }
.section-note { color: var(--muted); font-size: 15px; margin-bottom: 20px; }

/* ---------- form ---------- */

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-md);
  overflow: hidden;
}

.panel-block { padding: clamp(20px, 3.4vw, 32px); }
.panel-block + .panel-block { border-top: 1px solid var(--line-soft); }

.block-title {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 20px;
  margin-bottom: 22px;
}
.step {
  display: inline-grid;
  place-items: center;
  width: 26px; height: 26px;
  border-radius: 50%;
  background: var(--brand);
  color: var(--brand-ink);
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 600;
}

.grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}
.span-2 { grid-column: span 2; }
@media (max-width: 640px) {
  .grid { grid-template-columns: minmax(0, 1fr); }
  .span-2 { grid-column: span 1; }
}

.field { display: flex; flex-direction: column; gap: 7px; min-width: 0; }
.field label {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .01em;
}

.field input,
.field select {
  font: inherit;
  font-size: 16px;
  width: 100%;
  padding: 12px 14px;
  color: var(--ink);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}
.field select {
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, currentColor 50%),
                    linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position: calc(100% - 19px) calc(50% + 1px), calc(100% - 14px) calc(50% + 1px);
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 38px;
}
.field input::placeholder { color: var(--muted); opacity: .7; }
.field input:focus,
.field select:focus {
  outline: none;
  background: var(--surface);
  border-color: var(--brand);
  box-shadow: 0 0 0 4px var(--brand-tint);
}
.field input[aria-invalid="true"] { border-color: var(--brand); }
.hint { font-size: 12.5px; color: var(--muted); }

.chips {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 20px;
}
.chips-label {
  font-size: 12.5px;
  color: var(--muted);
  margin-right: 2px;
}
.chip {
  font: inherit;
  font-size: 13px;
  padding: 6px 13px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: all .15s ease;
}
.chip:hover {
  border-color: var(--brand);
  color: var(--brand);
  background: var(--brand-tint);
}

.panel-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  padding: clamp(18px, 3vw, 24px) clamp(20px, 3.4vw, 32px);
  background: var(--surface-2);
  border-top: 1px solid var(--line-soft);
}

.btn {
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 13px 22px;
  border-radius: 999px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform .12s ease, background .15s ease, border-color .15s ease, color .15s ease;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--brand); color: var(--brand-ink); }
.btn-primary:hover { background: color-mix(in srgb, var(--brand) 86%, var(--ink)); }
.btn-arrow { transition: transform .15s ease; }
.btn-primary:hover .btn-arrow { transform: translateX(3px); }
.btn-ghost {
  background: transparent;
  color: var(--muted);
  border-color: var(--line);
}
.btn-ghost:hover { color: var(--ink); border-color: var(--ink); }
.btn[disabled] { opacity: .6; cursor: progress; }

.form-error {
  flex-basis: 100%;
  font-size: 14px;
  color: var(--brand);
  font-weight: 500;
}

/* ---------- risultati ---------- */

.results { animation: rise .35s ease both; }
@keyframes rise {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: none; }
}

.summary {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 12px;
  margin-bottom: 34px;
}
.summary-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 12px 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  min-width: 120px;
  flex: 1 1 120px;
}
.summary-item .k {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--muted);
  font-weight: 600;
}
.summary-item .v {
  font-family: var(--serif);
  font-size: 22px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.summary-item.wide { flex: 1 1 190px; min-width: 190px; }
.summary-item.accent { background: var(--brand-tint); border-color: color-mix(in srgb, var(--brand) 40%, transparent); }
.summary-item.accent .v { color: var(--brand); }










.modes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 14px;
}

.mode-card {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 20px;
}
.mode-card.is-best { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-tint); }
.mode-card.is-off { opacity: .62; }

.mode-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 4px;
}
.mode-emoji { font-size: 20px; line-height: 1; }
.mode-name { font-family: var(--serif); font-size: 20px; font-weight: 600; }

.badges { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; min-height: 20px; }
.badge {
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: .07em;
  text-transform: uppercase;
  padding: 3px 9px;
  border-radius: 999px;
}
.badge-cheap { background: var(--brand-tint); color: var(--brand); }
.badge-fast  { background: var(--sea-tint); color: var(--sea); }
.badge-warn  { background: var(--surface-2); color: var(--muted); }

.mode-price {
  font-family: var(--serif);
  font-size: 34px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}
.mode-price small { font-size: 13px; font-family: var(--sans); font-weight: 500; color: var(--muted); }
.mode-price-sub { font-size: 13px; color: var(--muted); margin-top: 4px; }

.mode-stats {
  display: flex;
  gap: 22px;
  margin: 16px 0 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line-soft);
}
.mode-stats div { display: flex; flex-direction: column; gap: 1px; }
.mode-stats .k {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--muted);
  font-weight: 600;
}
.mode-stats .v { font-size: 16px; font-weight: 600; font-variant-numeric: tabular-nums; }

.mode-note { font-size: 12.5px; color: var(--muted); margin-bottom: 14px; }

.mode-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: auto;
}
.mode-link {
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  color: var(--ink);
  padding: 7px 13px;
  border: 1px solid var(--line);
  border-radius: 999px;
  transition: all .15s ease;
}
.mode-link:hover { border-color: var(--brand); color: var(--brand); background: var(--brand-tint); }

.skeleton-card {
  height: 240px;
  border-radius: var(--r-md);
  border: 1px solid var(--line-soft);
  background: linear-gradient(100deg, var(--surface) 30%, var(--surface-2) 50%, var(--surface) 70%);
  background-size: 220% 100%;
  animation: shimmer 1.3s linear infinite;
}
@keyframes shimmer { to { background-position: -220% 0; } }

.state-msg {
  padding: 18px 20px;
  border: 1px dashed var(--line);
  border-radius: var(--r-md);
  color: var(--muted);
  font-size: 14.5px;
  grid-column: 1 / -1;
}
.state-msg.is-error { border-color: var(--brand); color: var(--brand); border-style: solid; }

/* ---------- scelta del portale ---------- */

.stay-picker {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}
.stay-picker label {
  font-size: 13px;
  font-weight: 600;
}
.stay-picker select {
  flex: 1 1 260px;
  min-width: 0;
  font: inherit;
  font-size: 16px;
  padding: 12px 38px 12px 14px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, currentColor 50%),
                    linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position: calc(100% - 19px) calc(50% + 1px), calc(100% - 14px) calc(50% + 1px);
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}
.stay-picker select:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 4px var(--brand-tint);
}
.stay-picker .btn { flex: 0 0 auto; text-decoration: none; }

/* ---------- blocco richiudibile ---------- */

.info {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
}
.info summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 20px;
  cursor: pointer;
  font-family: var(--serif);
  font-size: 18px;
  font-weight: 600;
  list-style: none;
}
.info summary::-webkit-details-marker { display: none; }
.info summary:hover { color: var(--brand); }
.info-chevron {
  width: 8px; height: 8px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg) translate(-2px, -2px);
  transition: transform .18s ease;
  flex: none;
  opacity: .55;
}
.info[open] .info-chevron { transform: rotate(-135deg) translate(-2px, -2px); }

.info-body {
  padding: 0 20px 22px;
  border-top: 1px solid var(--line-soft);
  font-size: 14.5px;
  color: var(--muted);
}
.info-body > p:first-child { padding-top: 18px; }

.info-list { margin: 18px 0 20px; }
.info-list dt {
  font-family: var(--serif);
  font-size: 16px;
  font-weight: 600;
  color: var(--ink);
  margin-top: 14px;
}
.info-list dd { margin: 3px 0 0; }
.info-body strong { color: var(--ink); }

/* ---------- come funziona ---------- */







/* ---------- note ---------- */






.disclaimer {
  font-size: 14px;
  color: var(--muted);
  max-width: 78ch;
  padding: 18px 20px;
  border-left: 3px solid var(--sea);
  background: var(--sea-tint);
  border-radius: 0 var(--r-md) var(--r-md) 0;
}
.disclaimer strong { color: var(--ink); }

/* ---------- footer ---------- */

.site-foot {
  margin-top: clamp(30px, 6vw, 64px);
  border-top: 1px solid var(--line);
  background: var(--bg-tint);
  padding-block: 40px 28px;
}
.foot-inner {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 28px;
}
@media (max-width: 640px) {
  .foot-inner { grid-template-columns: 1fr 1fr; }
  .foot-brand { grid-column: span 2; }
}
.foot-brand p { font-size: 14px; color: var(--muted); margin-top: 6px; max-width: 34ch; }
.foot-col h4 {
  font-family: var(--sans);
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: .12em;
  color: var(--muted);
  margin-bottom: 10px;
}
.foot-col li + li { margin-top: 6px; }
.foot-col a {
  font-size: 14px;
  text-decoration: none;
  color: var(--ink);
  border-bottom: 1px solid transparent;
}
.foot-col a:hover { color: var(--brand); border-color: var(--brand); }

.foot-credit {
  grid-column: 1 / -1;
  padding-top: 22px;
  margin-top: 6px;
  border-top: 1px solid var(--line-soft);
  font-size: 13.5px;
  color: var(--muted);
}
.foot-credit strong { color: var(--ink); font-weight: 600; }
.foot-year::before { content: '· '; }

/* ---------- indicatore dato in tempo reale ---------- */

.badge-live { background: var(--sea-tint); color: var(--sea); }

.tag-live {
  display: inline-block;
  font-family: var(--sans);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  vertical-align: middle;
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--sea-tint);
  color: var(--sea);
}
.info-list dt .tag-live { margin-left: 4px; }
#prezzo-live { line-height: 1.5; }

/* ---------- schermi larghi: la home in una schermata sola ----------
   Sotto i 1200 px il modulo resta impilato. Sopra, i due blocchi vanno
   affiancati: su un 1920 c'e' larghezza in abbondanza e sprecarla in
   altezza costringe a scorrere per arrivare al bottone. */

@media (min-width: 1200px) {
  :root { --maxw: 1320px; }

  .hero { padding-block: 22px 12px; }
  .hero h1 { font-size: 30px; max-width: none; }

  .section { padding-block: 26px; }

  #search-form { display: grid; grid-template-columns: 1fr 1fr; }
  #search-form .panel-block + .panel-block {
    border-top: 0;
    border-left: 1px solid var(--line-soft);
  }
  #search-form .panel-actions { grid-column: 1 / -1; }

  /* footer su una riga sola invece che su due */
  .foot-inner { grid-template-columns: 1.7fr 1fr 1fr auto; gap: 24px; }
  .foot-credit {
    grid-column: auto;
    align-self: end;
    text-align: right;
    border-top: 0;
    padding-top: 0;
    margin-top: 0;
  }
  .site-foot { margin-top: 22px; padding-block: 26px 22px; }
}

/* Su schermi larghi il modulo puo' respirare in orizzontale, quindi si
   stringe in verticale: e' li' che si gioca lo scorrimento. */
@media (min-width: 1200px) {
  .panel-block { padding: 22px 26px; }
  .block-title { font-size: 18px; margin-bottom: 16px; }
  .grid { gap: 14px; }
  .field { gap: 5px; }
  .field input, .field select { padding: 10px 12px; font-size: 15px; }
  .field select { padding-right: 34px; }
  .chips { margin-top: 14px; }
  .panel-actions { padding: 15px 26px; }
  .btn { padding: 11px 20px; font-size: 14px; }

  .section-title { font-size: 24px; }
  .info summary { padding: 14px 20px; font-size: 17px; }
}

/* Nel primo blocco date, ospiti e budget stanno su quattro colonne
   invece che su due righe: e' la riga che costa di piu' in altezza. */
@media (min-width: 1200px) {
  #search-form .panel-block:first-child .grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
  #search-form .panel-block:first-child .span-2 { grid-column: span 4; }

  .hero { padding-block: 14px 8px; }
  .hero h1 { font-size: 27px; }
  #info { padding-block: 14px; }
  .site-foot { margin-top: 12px; padding-block: 16px 12px; }
  .foot-brand p { margin-top: 4px; }
}
