/* Visual refresh: warm Italian palette, glass UI, dark mode, micro-motion. */

:root {
  --ink: #1c2430;
  --muted: #667084;
  --paper: #f7f1e8;
  --paper-2: #fffaf3;
  --white: #ffffff;
  --line: #e7ddd0;
  --coral: #e56a52;
  --coral-dark: #c24738;
  --olive: #5f7d62;
  --gold: #e2b657;
  --sky: #7ea7c5;
  --shadow: 0 18px 50px rgba(48, 34, 20, 0.12);
  --shadow-soft: 0 10px 28px rgba(48, 34, 20, 0.08);
  --radius-lg: 24px;
  --radius-md: 16px;
  --radius-sm: 12px;
  --header-bg: rgba(247, 241, 232, 0.82);
  --card-bg: #fffdf9;
  --chip-bg: rgba(255, 255, 255, 0.72);
  --hero-glow-a: rgba(229, 106, 82, 0.28);
  --hero-glow-b: rgba(95, 125, 98, 0.22);
  --hero-glow-c: rgba(226, 182, 87, 0.24);
}

html[data-theme="dark"] {
  color-scheme: dark;
  --ink: #f3eee6;
  --muted: #b7b0a5;
  --paper: #141820;
  --paper-2: #1b222d;
  --white: #1e2633;
  --line: #2e3746;
  --coral: #ff8b73;
  --coral-dark: #ffb09f;
  --olive: #9cbc9a;
  --gold: #f0c86a;
  --sky: #8fb7d4;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
  --shadow-soft: 0 10px 28px rgba(0, 0, 0, 0.28);
  --header-bg: rgba(20, 24, 32, 0.84);
  --card-bg: #1b2230;
  --chip-bg: rgba(30, 38, 51, 0.9);
  --hero-glow-a: rgba(255, 139, 115, 0.18);
  --hero-glow-b: rgba(156, 188, 154, 0.14);
  --hero-glow-c: rgba(240, 200, 106, 0.12);
}

html, body {
  background:
    radial-gradient(1200px 500px at 10% -10%, var(--hero-glow-a), transparent 60%),
    radial-gradient(900px 420px at 90% 0%, var(--hero-glow-b), transparent 55%),
    var(--paper);
  color: var(--ink);
}

body { min-height: 100vh; }
.app-shell { max-width: 1280px; }

.site-header {
  height: auto;
  min-height: 72px;
  padding: 12px 4vw;
  border-bottom: 1px solid color-mix(in srgb, var(--line) 80%, transparent);
  background: var(--header-bg);
  backdrop-filter: blur(16px) saturate(1.2);
  justify-content: space-between;
  gap: 12px;
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
}

.brand-mark-new {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 16px 8px 16px 8px;
  background: linear-gradient(145deg, var(--coral), #f0a070 55%, var(--gold));
  color: #fff;
  font-size: 22px;
  box-shadow: var(--shadow-soft);
  transform: rotate(-6deg);
}

.brand-lockup strong {
  display: block;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.15rem;
  letter-spacing: -0.03em;
  line-height: 1;
}

.brand-lockup em {
  display: block;
  margin-top: 4px;
  font-style: normal;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--coral-dark);
}

.header-tools {
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.app-open-button,
.theme-toggle,
.tool-button {
  min-height: 44px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--chip-bg);
  color: var(--ink);
  padding: 0 14px;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease, background .18s ease;
}

.theme-toggle {
  width: 44px;
  padding: 0;
  display: inline-grid;
  place-items: center;
  font-size: 18px;
}

.app-open-button:hover,
.theme-toggle:hover,
.tool-button:hover,
.chip:hover,
.saved-toggle:hover,
.assistant-toggle:hover,
.reset-button:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-soft);
  border-color: color-mix(in srgb, var(--coral) 45%, var(--line));
}

.brand-mark-rc88 {
  width: auto;
  min-width: 52px;
  height: 34px;
  padding: 0 8px;
  border-radius: 6px 6px 6px 6px;
  background: #0b0b0b;
  color: #fff;
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 800;
  font-size: 15px;
  letter-spacing: -0.02em;
  transform: none;
  box-shadow: inset 0 -6px 0 0 #e21f1f;
}

.brand-mark-rc88 em {
  font-style: normal;
  font-weight: 800;
}

.hero {
  position: relative;
  overflow: hidden;
  min-height: 260px;
  margin: 18px 4vw 0;
  padding: 34px 36px 72px;
  border-radius: calc(var(--radius-lg) + 8px);
  background: linear-gradient(135deg, color-mix(in srgb, var(--paper-2) 82%, #fff) 0%, color-mix(in srgb, var(--paper) 70%, #f3e2d2) 100%);
  border: 1px solid color-mix(in srgb, var(--line) 80%, transparent);
  box-shadow: var(--shadow);
}

.hero:before,
.hero:after {
  content: "";
  position: absolute;
  border-radius: 50%;
  filter: blur(8px);
  pointer-events: none;
}

.hero:before {
  width: 280px;
  height: 280px;
  right: -40px;
  top: -60px;
  background: var(--hero-glow-a);
  animation: floaty 9s ease-in-out infinite;
}

.hero:after {
  width: 220px;
  height: 220px;
  left: 8%;
  bottom: -80px;
  background: var(--hero-glow-b);
  animation: floaty 11s ease-in-out infinite reverse;
}

.hero-copy {
  position: relative;
  z-index: 1;
  max-width: 720px;
}

.hero-kicker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--coral) 14%, transparent);
  color: var(--coral-dark);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.hero h1 {
  margin: 16px 0 12px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2.4rem, 7vw, 4.4rem);
  line-height: 0.95;
  letter-spacing: -0.05em;
  font-weight: 500;
}

.hero-subtitle {
  max-width: 54ch;
  margin: 0;
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.55;
}

.hero-cta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 22px;
}

.hero-split {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
  flex-wrap: wrap;
}

.hero-split .hero-copy {
  display: flex;
  flex: 1 1 560px;
  max-width: 700px;
  flex-direction: column;
  align-items: flex-start;
}

.hero-logo-mark {
  position: relative;
  z-index: 1;
  display: block;
  width: min(300px, 100%);
  height: auto;
  overflow: visible;
  background: none !important;
}

.rc88-logo-link {
  display: block;
  width: min(690px, 100%);
  max-width: 100%;
  line-height: 0;
  background: none !important;
  border-radius: 0;
  overflow: hidden;
  box-shadow: none;
  transition: transform .2s ease, box-shadow .2s ease;
}

.rc88-logo-link .rc88-logo-svg {
  display: block;
  background: none !important;
}

.rc88-logo-link:not(.rc88-logo-static):hover {
  transform: translateY(-2px);
  box-shadow: none;
}

.rc88-logo-link:not(.rc88-logo-static):focus-visible {
  outline: 3px solid #ff0909;
  outline-offset: 4px;
}

.rc88-logo-static {
  cursor: default;
}

.rc88-logo-svg {
  display: block;
  width: 100%;
  height: auto;
}

.hero-brand-row {
  display: flex;
  align-items: flex-end;
  gap: 18px;
  flex-wrap: wrap;
  width: 100%;
}

.hero-channel-note {
  margin-left: auto;
  padding-bottom: 30px;
  max-width: 300px;
  text-align: right;
  font-size: 0.92rem;
  font-weight: 900;
  line-height: 1.3;
  letter-spacing: 0.05em;
  color: #050505;
}

.hero-orbit {
  z-index: 1;
  right: 4%;
  bottom: 8%;
  opacity: 0.95;
  filter: drop-shadow(0 12px 24px rgba(0,0,0,.12));
  animation: spin-slow 18s linear infinite;
}

.hero-orbit span { animation: bob 3.4s ease-in-out infinite; }
.hero-orbit span:nth-child(2) { animation-delay: .4s; }
.hero-orbit span:nth-child(3) { animation-delay: .8s; }
.hero-orbit span:nth-child(4) { animation-delay: 1.2s; }

.search-panel {
  position: relative;
  z-index: 2;
  margin: -42px 4vw 0;
  padding: 18px;
  border-radius: var(--radius-lg);
  border: 1px solid color-mix(in srgb, var(--line) 85%, transparent);
  background: color-mix(in srgb, var(--paper-2) 88%, transparent);
  backdrop-filter: blur(18px) saturate(1.15);
  box-shadow: var(--shadow);
}

.search-field,
.select-field {
  border-radius: 14px;
  border-color: var(--line);
  background: var(--white);
  box-shadow: none;
  transition: border-color .18s ease, box-shadow .18s ease;
}

.search-field:focus-within,
.select-field:focus-within {
  border-color: color-mix(in srgb, var(--coral) 55%, var(--line));
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--coral) 16%, transparent);
}

.browse-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.language-picker,
.saved-toggle,
.assistant-toggle,
.reset-button,
#itineraryButton,
#mapToggle {
  border-radius: 999px !important;
  border: 1px solid var(--line) !important;
  background: var(--chip-bg) !important;
  color: var(--ink) !important;
  box-shadow: none !important;
  min-height: 44px;
}

.saved-toggle.active,
.assistant-toggle.active,
#mapToggle.active,
#itineraryButton.active {
  background: linear-gradient(135deg, color-mix(in srgb, var(--coral) 18%, var(--white)), var(--white)) !important;
  border-color: color-mix(in srgb, var(--coral) 50%, var(--line)) !important;
  color: var(--coral-dark) !important;
}

.collections-panel {
  margin: 18px 4vw 0;
  padding: 16px 18px 8px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--paper-2) 90%, transparent);
  box-shadow: var(--shadow-soft);
}

.collections-hint {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.chip-row {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 12px 0;
  scrollbar-width: thin;
}

.chip {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--chip-bg);
  color: var(--ink);
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
  transition: transform .16s ease, background .16s ease, border-color .16s ease, box-shadow .16s ease;
}

.chip.is-active {
  background: linear-gradient(135deg, var(--coral), #f0a070);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 10px 24px color-mix(in srgb, var(--coral) 35%, transparent);
}

.chip-collection.is-active {
  background: linear-gradient(135deg, var(--olive), #8faf8c);
}

.results-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 18px 4vw 0;
}

.results-toolbar h2 {
  margin: 0;
  font-family: Georgia, serif;
  font-size: 1.35rem;
  font-weight: 500;
  letter-spacing: -0.03em;
}

.content-section { padding: 18px 4vw 72px; }

#mapPanel {
  margin: 12px 4vw 0;
  padding: 14px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  background: var(--card-bg);
  box-shadow: var(--shadow-soft);
  overflow: hidden;
}

#mapPanel[hidden] { display: none !important; }

.map-panel-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 10px;
}

.map-panel-note,
.map-panel-count {
  color: var(--muted);
  font-size: 12px;
}

.results-map {
  height: min(52vh, 420px);
  min-height: 280px;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--line);
}

.results-map.is-empty { display: none; }

.map-panel-empty {
  display: grid;
  place-items: center;
  gap: 8px;
  min-height: 180px;
  color: var(--muted);
  text-align: center;
}

.cards-grid { gap: 16px; }

.place-card {
  position: relative;
  overflow: hidden;
  border-radius: 22px;
  background: var(--card-bg);
  border: 1px solid color-mix(in srgb, var(--line) 90%, transparent);
  box-shadow: var(--shadow-soft);
  transform: translateY(0);
  transition: transform .22s ease, box-shadow .22s ease, border-color .22s ease;
  animation: rise-in .45s ease both;
}

.place-card:nth-child(1) { animation-delay: .02s; }
.place-card:nth-child(2) { animation-delay: .05s; }
.place-card:nth-child(3) { animation-delay: .08s; }
.place-card:nth-child(4) { animation-delay: .11s; }
.place-card:nth-child(5) { animation-delay: .14s; }
.place-card:nth-child(6) { animation-delay: .17s; }

.place-card:hover,
.place-card:focus-within {
  transform: translateY(-6px);
  box-shadow: var(--shadow);
  border-color: color-mix(in srgb, var(--coral) 35%, var(--line));
}

.place-card:after {
  content: "";
  position: absolute;
  inset: auto -30% 0 auto;
  width: 55%;
  height: 40%;
  background: linear-gradient(120deg, transparent, color-mix(in srgb, var(--gold) 18%, transparent), transparent);
  transform: translateX(20%) rotate(12deg);
  pointer-events: none;
  opacity: 0;
  transition: opacity .25s ease;
}

.place-card:hover:after { opacity: 1; }
.card-image { position: relative; }
.card-image img { transition: transform .45s ease; }
.place-card:hover .card-image img { transform: scale(1.04); }
.place-kind {
  backdrop-filter: blur(8px);
  background: color-mix(in srgb, #1c2430 55%, transparent) !important;
}

.save-button {
  backdrop-filter: blur(8px);
  transition: transform .18s ease, background .18s ease;
}

.save-button.is-saved,
.save-button:hover { transform: scale(1.06); }

.empty {
  grid-column: 1 / -1;
  display: grid;
  justify-items: center;
  gap: 10px;
  padding: 48px 22px;
  border-radius: var(--radius-lg);
  border: 1px dashed color-mix(in srgb, var(--coral) 35%, var(--line));
  background:
    radial-gradient(400px 160px at 50% 0%, color-mix(in srgb, var(--coral) 12%, transparent), transparent 70%),
    var(--card-bg);
  text-align: center;
}

.empty-icon {
  font-size: 42px;
  animation: bob 2.8s ease-in-out infinite;
}

.empty h3 {
  margin: 0;
  font-family: Georgia, serif;
  font-size: 1.6rem;
  font-weight: 500;
}

.empty p {
  margin: 0;
  max-width: 42ch;
  color: var(--muted);
}

.empty-suggestions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: 8px;
}

.button,
.button-primary,
.button-soft,
.button-dark {
  border-radius: 999px !important;
  min-height: 44px;
  transition: transform .16s ease, box-shadow .16s ease, filter .16s ease;
}

.button-primary {
  background: linear-gradient(135deg, var(--coral), #f08a62) !important;
  border: 0 !important;
  color: #fff !important;
  box-shadow: 0 12px 24px color-mix(in srgb, var(--coral) 30%, transparent);
}

.button:hover,
.button-primary:hover,
.button-soft:hover { transform: translateY(-1px); }

#detailDialog,
.assistant-dialog,
.embed-dialog,
#itineraryDialog {
  border: 0;
  border-radius: 24px;
  background: var(--paper-2);
  color: var(--ink);
  box-shadow: var(--shadow);
}

#detailDialog { width: min(920px, calc(100% - 24px)); }

#itineraryDialog {
  width: min(720px, calc(100% - 24px));
  padding: 0;
  border: 0;
  max-height: min(90vh, 860px);
}

#itineraryDialog::backdrop,
#detailDialog::backdrop,
.assistant-dialog::backdrop,
.embed-dialog::backdrop {
  background: rgba(12, 14, 18, 0.55);
  backdrop-filter: blur(6px);
}

.travel-dialog-card { padding: 28px 24px 24px; }

.travel-dialog-card h2 {
  margin: 8px 0 10px;
  font-family: Georgia, serif;
  font-size: clamp(1.8rem, 4vw, 2.4rem);
  font-weight: 500;
  letter-spacing: -0.04em;
}

.travel-dialog-lead {
  margin: 0 0 18px;
  color: var(--muted);
  line-height: 1.5;
}

.itinerary-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 10px;
}

.itinerary-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: var(--card-bg);
}

.itinerary-index {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: color-mix(in srgb, var(--coral) 16%, transparent);
  color: var(--coral-dark);
  font-weight: 900;
}

.itinerary-body {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.itinerary-body strong { font-size: 1rem; }
.itinerary-body span { color: var(--muted); font-size: 12px; }

.itinerary-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-end;
}

.ghost-button {
  min-height: 36px;
  min-width: 36px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
  font-size: 12px;
  font-weight: 800;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.ghost-button:disabled { opacity: 0.4; cursor: not-allowed; }
.itinerary-remove-button { color: var(--coral); border-color: color-mix(in srgb, var(--coral) 45%, var(--line)); }
.itinerary-remove-button:hover, .itinerary-remove-button:focus-visible { background: color-mix(in srgb, var(--coral) 10%, transparent); outline: 3px solid color-mix(in srgb, var(--coral) 22%, transparent); outline-offset: 2px; }
.route-single-place { gap: 5px; }
.route-single-place span { white-space: nowrap; }

.itinerary-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}

.itinerary-status {
  margin: 12px 0 0;
  color: var(--olive);
  font-size: 13px;
  font-weight: 700;
}

.stats span {
  background: var(--chip-bg);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 10px;
}

.pagination-button { border-radius: 999px !important; }
.leaflet-container { font: inherit; background: var(--paper); }

.map-popup-open {
  margin-top: 8px;
  min-height: 34px;
  border: 0;
  border-radius: 999px;
  padding: 0 12px;
  background: var(--coral);
  color: #fff;
  font-weight: 800;
  cursor: pointer;
}

html[data-theme="dark"] .place-kind { background: rgba(0, 0, 0, 0.45) !important; }

html[data-theme="dark"] .fact-tile,
html[data-theme="dark"] .overview-tile,
html[data-theme="dark"] .event-summary,
html[data-theme="dark"] .travel-link {
  background: var(--card-bg);
  border-color: var(--line);
  color: var(--ink);
}

@keyframes floaty {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(18px); }
}

@keyframes bob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

@keyframes spin-slow {
  from { transform: rotate(-14deg); }
  to { transform: rotate(346deg); }
}

@keyframes rise-in {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 700px) {
  .site-header { padding: 10px 14px; }
  .brand-lockup strong { font-size: 1rem; }
  .hero {
    margin: 12px 14px 0;
    padding: 26px 20px 64px;
    min-height: 220px;
  }
  .hero-split {
    flex-direction: column;
    align-items: flex-start;
    gap: 18px;
  }
  .hero-split .hero-copy {
    width: 100%;
    flex-basis: auto;
  }
  .hero-logo-mark {
    width: min(215px, 100%);
  }
  .rc88-logo-svg.hero-logo-mark {
    width: 100%;
  }
  .search-panel,
  .collections-panel,
  .results-toolbar,
  #mapPanel,
  .content-section {
    margin-left: 14px;
    margin-right: 14px;
  }
  .content-section {
    padding-left: 0;
    padding-right: 0;
  }
  .itinerary-item { grid-template-columns: auto 1fr; }
  .itinerary-actions {
    grid-column: 1 / -1;
    justify-content: flex-start;
  }
  .route-single-place span { display: inline; }
  .hero-orbit {
    right: 12px;
    bottom: -20px;
    transform: scale(0.72) rotate(-14deg);
    animation: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
  }
}

/* CTA secondarie sotto il logo: più visibili del bianco, senza rubare spazio al CTA principale. */
.hero-cta-row .button-soft {
  background: #fff0e8 !important;
  border: 1px solid #efb39d !important;
  color: #7d3828 !important;
  box-shadow: 0 8px 18px rgba(125, 56, 40, 0.12);
}

.hero-cta-row .button-soft:hover,
.hero-cta-row .button-soft:focus-visible {
  background: #ffe1d4 !important;
  border-color: #df8f75 !important;
  color: #682818 !important;
}
