@font-face {
  font-family: "Outfit";
  src: url("/assets/fonts/outfit-latin-wght-normal.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Outfit";
  src: url("/assets/fonts/outfit-latin-ext-wght-normal.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  --bg: #ffffff;
  --fg: #20232b;
  --muted: #5a606c;
  --line: #20232b;
  --panel: #ffffff;
  --panel-fg: #20232b;
  --panel-line: #d9dce3;
}
:root.dark {
  --fg: #f4f5f7;
  --muted: #c3c8d1;
  --line: #f4f5f7;
}

* { box-sizing: border-box; }

html {
  background-color: var(--bg);
  background-image: var(--wallpaper, none);
  background-size: cover;
  background-position: center;
  background-attachment: fixed;
  min-height: 100%;
}
body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  color: var(--fg);
  font-family: "Outfit", system-ui, -apple-system, "Segoe UI", "Noto Sans", sans-serif;
  font-size: 16px;
  line-height: 1.5;
}
a { color: inherit; }

.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0; padding: 0; margin: -1px;
}

/* ---- Barra in alto: sfondo e nazione ---- */

.topbar {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 16px 0;
}
.menu { position: relative; }
.menu summary {
  list-style: none;
  width: 44px; height: 44px;
  display: grid; place-items: center;
  border-radius: 22px;
  cursor: pointer;
}
.menu summary::-webkit-details-marker { display: none; }
.menu summary:hover, .menu[open] summary { background: rgba(127, 127, 127, 0.18); }
.menu summary:focus-visible, a:focus-visible, button:focus-visible { outline: 3px solid #3b6fe0; outline-offset: 2px; }
.menu summary img { border-radius: 50%; display: block; }

.panel {
  position: absolute;
  top: 50px;
  inset-inline-end: 0;
  z-index: 10;
  background: var(--panel);
  color: var(--panel-fg);
  border: 1px solid var(--panel-line);
  border-radius: 16px;
  box-shadow: 0 12px 32px rgba(20, 24, 40, 0.18);
  padding: 12px;
}
.panel-colors { width: 268px; }
.swatches { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.swatch { aspect-ratio: 1; border-radius: 8px; border: 1px solid rgba(0, 0, 0, 0.18); }
.swatch.is-current { outline: 3px solid #20232b; outline-offset: 1px; }
.wallpapers { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px; margin-top: 12px; }
.wallpapers img { width: 100%; height: 66px; object-fit: cover; border-radius: 8px; display: block; }
.wallpaper-actions { display: flex; gap: 8px; margin-top: 8px; }
.wallpaper-actions a { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 10px; }
.wallpaper-actions a:hover { background: #eef0f4; }

.panel-countries { width: 260px; max-height: min(70vh, 560px); overflow-y: auto; padding: 6px; }
.panel-countries ul { list-style: none; margin: 0; padding: 6px 0; }
.panel-countries ul + ul { border-top: 1px solid var(--panel-line); }
.panel-countries a {
  display: flex; align-items: center; gap: 10px;
  min-height: 40px; padding: 4px 10px;
  border-radius: 10px;
  text-decoration: none;
  font-size: 15px;
}
.panel-countries a:hover { background: #eef0f4; }
.panel-countries a[aria-current] { font-weight: 600; background: #eef0f4; }
.panel-countries img { border-radius: 50%; flex: none; }

/* ---- Logo e ricerca ---- */

main {
  flex: 1;
  width: 100%;
  max-width: 1040px;
  margin: 0 auto;
  padding: 24px 16px 48px;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.logo { margin: 8px 0 20px; line-height: 0; }
.logo img { max-width: 100%; height: auto; }

.search { width: 100%; display: flex; flex-direction: column; align-items: center; }
.search-box {
  width: min(100%, 580px);
  height: 52px;
  display: flex; align-items: center; gap: 10px;
  padding: 0 20px;
  border: 2px solid var(--line);
  border-radius: 26px;
  background: var(--panel);
  color: var(--panel-fg);
  cursor: text;
}
.search-box:focus-within { box-shadow: 0 0 0 4px rgba(59, 111, 224, 0.28); }
.search-box svg { flex: none; }
.search-box input {
  flex: 1; min-width: 0;
  border: 0; outline: 0; background: transparent;
  font: inherit; font-size: 18px; color: inherit;
  -webkit-appearance: none; appearance: none;
}
.search-box input::-webkit-search-cancel-button { -webkit-appearance: none; }

.promo { margin: 10px 0 0; font-size: 15px; color: var(--muted); text-align: center; }
.promo a { text-decoration: none; }
.promo a:hover { text-decoration: underline; }

/* ---- Categorie e motori ---- */

.categories {
  display: flex; flex-wrap: wrap; justify-content: center;
  gap: 12px;
  margin-top: 36px;
}
.category {
  background: var(--tint);
  border-radius: 16px;
  padding: 6px 8px 8px;
  transition: box-shadow 0.25s ease;
}
.category:hover, .category:focus-within { box-shadow: 0 0 18px var(--tint); }
.category h2 {
  margin: 0 0 6px;
  font-size: 12px; font-weight: 600; letter-spacing: 0.3px;
  text-align: center;
  color: #20232b;
  white-space: nowrap;
}
.engines { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; }
.engine {
  width: 48px; height: 48px;
  padding: 2px;
  border: 0; border-radius: 12px;
  background: transparent;
  cursor: pointer;
  transition: transform 0.15s ease;
}
.engine:hover { transform: scale(1.12); }
.engine:active { transform: scale(0.96); }
.engine img { width: 44px; height: 44px; border-radius: 10px; display: block; }
.engine-letter {
  width: 44px; height: 44px; border-radius: 10px;
  display: grid; place-items: center;
  background: #ffffff; color: #20232b;
  font-size: 22px; font-weight: 700;
}

/* ---- Pubblicità, estensione, presentazione ---- */

.ad { margin-top: 48px; max-width: 100%; overflow: hidden; display: flex; justify-content: center; }

.store {
  margin-top: 48px;
  display: flex; align-items: center; gap: 16px;
  padding: 12px 20px;
  border: 1px solid var(--panel-line);
  border-radius: 16px;
  background: var(--panel); color: var(--panel-fg);
  text-decoration: none;
  transition: transform 0.2s ease;
}
.store:hover { transform: scale(1.04); }
.store span { display: flex; flex-direction: column; line-height: 1.2; }
.store small { font-size: 16px; color: #5a606c; }
.store strong { font-size: 24px; font-weight: 600; }

.has-wallpaper .promo {
  background: rgba(255, 255, 255, 0.86); color: #20232b;
  padding: 6px 14px; border-radius: 16px;
}

.footer { padding: 12px 16px; font-size: 13px; color: var(--muted); }
.footer a { text-decoration: none; }
.footer a:hover { text-decoration: underline; }
.has-wallpaper .footer { background: rgba(255, 255, 255, 0.86); color: #20232b; }

/* ---- Guida pagina iniziale ---- */

.guide { max-width: 640px; align-items: stretch; gap: 16px; }
.guide .logo { align-self: center; margin: 0 0 4px; }
.guide h1 { margin: 0; font-size: 28px; line-height: 1.2; font-weight: 700; text-align: center; text-wrap: balance; }
.guide .lead { margin: 0 0 8px; color: var(--muted); text-align: center; text-wrap: pretty; }
.card {
  background: var(--panel); color: var(--panel-fg);
  border: 1px solid var(--panel-line); border-radius: 16px;
  padding: 20px;
}
.card h2 { margin: 0 0 12px; font-size: 20px; font-weight: 600; }
.card .eyebrow { margin: 0 0 2px; font-size: 13px; font-weight: 600; letter-spacing: 0.4px; text-transform: uppercase; color: #5a606c; }
.copy-row { display: flex; gap: 8px; }
.copy-row input {
  flex: 1; min-width: 0; height: 44px; padding: 0 12px;
  border: 1px solid #b9bec9; border-radius: 10px;
  background: #f6f7f9; color: #20232b;
  font: inherit; font-size: 15px;
}
.copy {
  height: 44px; padding: 0 18px; min-width: 88px;
  border: 1px solid #20232b; border-radius: 10px;
  background: #ffffff; color: #20232b;
  font: inherit; font-weight: 600; cursor: pointer;
}
.copy.primary { background: #20232b; color: #ffffff; }
.steps { margin: 0; padding-inline-start: 22px; display: grid; gap: 8px; }
.shortcut { margin: 16px 0 8px; font-size: 14px; color: #5a606c; }
.alt { margin: 16px 0 0; font-size: 15px; }
.other { border-top: 1px solid var(--panel-line); }
.other summary { min-height: 44px; display: flex; align-items: center; cursor: pointer; font-weight: 500; }
.other[open] { padding-bottom: 16px; }
.guide > p { text-align: center; margin: 8px 0 0; }

/* ---- Note legali ---- */

.legal { max-width: 720px; align-items: stretch; }
.legal .logo { align-self: center; margin: 0 0 16px; }
.legal section { scroll-margin-top: 16px; padding: 20px 0; border-top: 1px solid rgba(127, 127, 127, 0.35); }
.legal section:target h2 { text-decoration: underline; text-underline-offset: 6px; }
.legal h2 { margin: 0 0 8px; font-size: 20px; font-weight: 600; }
.legal p { margin: 0; text-wrap: pretty; }

/* ---- Pagina hashtag Instagram ---- */

.tags-page { background: #ffffff; }
.tags { flex-direction: row; flex-wrap: wrap; justify-content: center; align-content: center; gap: 16px; }
.tags a {
  padding: 12px 24px; border-radius: 16px;
  background: var(--tint); color: #20232b;
  font-size: clamp(24px, 5vw, 40px); font-weight: 700;
  text-decoration: none;
}

@media (max-width: 600px) {
  main { padding-top: 8px; }
  .logo img { width: 220px; }
  .categories { margin-top: 24px; gap: 10px; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
