/* ==========================================================================
   Tokens
   ========================================================================== */
:root {
  color-scheme: dark;
  --bg: #111111;
  --surface: #1b1b1b;
  --surface-2: #272727;
  --border: #272727;
  --text: #f5f5f5;
  --text-2: #d2d2d2;
  --muted: #8a8a8a;
  --like: #ff4d6d;
  --radius: 16px;
  --gap: 12px;
  --pad: 24px;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; }
:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
svg { display: block; }

/* ==========================================================================
   Header
   ========================================================================== */
.topbar { position: sticky; top: 0; z-index: 40; background: var(--bg); }

.header {
  display: flex;
  align-items: center;
  gap: 34px;
  height: 72px;
  padding: 0 var(--pad);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex: none;
  font-size: 25px;
  font-weight: 700;
  letter-spacing: -0.035em;
}
.brand-mark { width: 32px; height: 32px; flex: none; }

.nav { display: flex; align-items: center; gap: 28px; }
.nav-link {
  padding: 6px 0;
  border: 0;
  background: none;
  color: var(--text-2);
  font-size: 16px;
  font-weight: 500;
  transition: color .15s;
}
.nav-link:hover { color: #fff; }

.header-right { display: flex; align-items: center; gap: 14px; margin-left: auto; }

/* Search */
.search {
  display: flex;
  align-items: center;
  width: 40px;
  height: 40px;
  overflow: hidden;
  border-radius: 999px;
  transition: width .25s ease, background-color .2s, box-shadow .2s;
}
.search.open {
  width: 260px;
  background: var(--surface);
  box-shadow: inset 0 0 0 1px var(--border);
}
.search-btn {
  display: grid;
  place-items: center;
  flex: none;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 50%;
  background: none;
  color: #e2e2e2;
}
.search-btn svg { width: 21px; height: 21px; }
.search input {
  flex: 1;
  min-width: 0;
  padding: 0 14px 0 0;
  border: 0;
  outline: none;
  background: none;
  color: var(--text);
  font: inherit;
  font-size: 14px;
}
.search input::-webkit-search-cancel-button { display: none; }

/* Account */
.account { position: relative; }
.avatar {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 50%;
  background: #2140b8;
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .02em;
}
.avatar[aria-expanded="true"] { box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px #3a3a3a; }

.login-btn {
  height: 40px;
  padding: 0 18px;
  border: 0;
  border-radius: 999px;
  background: #f2f2f2;
  color: #111;
  font-size: 15px;
  font-weight: 500;
  white-space: nowrap;
  transition: background-color .15s;
}
.login-btn:hover { background: #fff; }

.menu {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
  width: 250px;
  padding: 8px;
  border-radius: 18px;
  background: rgba(30, 30, 30, .82);
  -webkit-backdrop-filter: blur(24px) saturate(140%);
  backdrop-filter: blur(24px) saturate(140%);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, .07), 0 24px 60px rgba(0, 0, 0, .55);
  transform-origin: top right;
  animation: pop-in .14s ease-out;
}
.menu-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  height: 44px;
  padding: 0 12px;
  border: 0;
  border-radius: 12px;
  background: none;
  color: #e6e6e6;
  font-size: 15px;
  text-align: left;
}
.menu-item svg { width: 19px; height: 19px; color: #a0a0a0; flex: none; }
.menu-item:hover, .menu-item:focus-visible { background: rgba(255, 255, 255, .08); outline: none; }
.menu-sep { height: 1px; margin: 6px 4px; background: rgba(255, 255, 255, .07); }
.menu-head { display: flex; flex-direction: column; gap: 2px; min-width: 0; padding: 8px 12px 4px; }
.menu-head strong, .menu-head span { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.menu-head strong { color: #fff; font-size: 15px; font-weight: 600; }
.menu-head span { color: var(--muted); font-size: 13px; }
.menu-head span:empty { display: none; }

/* ==========================================================================
   Filters
   ========================================================================== */
.filters {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 4px var(--pad) 18px;
}
.seg, .chips-wrap {
  padding: 5px;
  border: 1px solid var(--border);
  border-radius: 999px;
}
.seg { display: flex; gap: 2px; flex: none; }
.chips-wrap { position: relative; flex: 1 1 auto; min-width: 0; }
.chips {
  display: flex;
  gap: 2px;
  overflow-x: auto;
  scroll-behavior: smooth;
  scrollbar-width: none;
  overscroll-behavior-x: contain;
  border-radius: 999px;
}
.chips::-webkit-scrollbar { display: none; }

.seg button, .chip {
  flex: none;
  height: 38px;
  padding: 0 19px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--text-2);
  font-size: 15px;
  font-weight: 500;
  white-space: nowrap;
  transition: background-color .15s, color .15s;
}
.seg button:hover, .chip:hover { color: #fff; }
.seg button[aria-pressed="true"], .chip[aria-pressed="true"] { background: var(--surface-2); color: #fff; }

.chips-arrow {
  position: absolute;
  top: 5px;
  bottom: 5px;
  z-index: 1;
  display: flex;
  align-items: center;
  width: 64px;
  border: 0;
  color: #e6e6e6;
}
.chips-arrow svg { width: 20px; height: 20px; }
.chips-arrow--right {
  right: 5px;
  justify-content: flex-end;
  padding-right: 8px;
  border-radius: 0 999px 999px 0;
  background: linear-gradient(90deg, rgba(17, 17, 17, 0), var(--bg) 60%);
}
.chips-arrow--left {
  left: 5px;
  justify-content: flex-start;
  padding-left: 8px;
  border-radius: 999px 0 0 999px;
  background: linear-gradient(270deg, rgba(17, 17, 17, 0), var(--bg) 60%);
}

/* ==========================================================================
   Grid
   ========================================================================== */
.main { padding: 6px var(--pad) 56px; }

.view-bar { display: flex; align-items: baseline; gap: 12px; margin: 4px 0 18px; }
.view-bar h2 { margin: 0; font-size: 22px; font-weight: 700; letter-spacing: -0.02em; }
.view-count { color: var(--muted); }
.view-back { margin-left: auto; color: var(--text-2); font-size: 14px; }
.view-back:hover { color: #fff; }

.grid {
  display: grid;
  grid-template-columns: repeat(var(--cols, 5), minmax(0, 1fr));
  column-gap: var(--gap);
  align-items: start;
}
.col { display: flex; flex-direction: column; gap: var(--gap); min-width: 0; }

.empty { margin: 0; padding: 90px 0; color: var(--muted); text-align: center; }

/* Card */
.card { position: relative; min-width: 0; }
.card-media {
  position: relative;
  display: block;
  overflow: hidden;
  border-radius: var(--radius);
  background: var(--surface);
  container-type: inline-size;
  isolation: isolate;
}
.card-media::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .04);
  pointer-events: none;
}
.card-media > img, .card-media > video,
.detail-media > img, .detail-media > video {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
}
.detail-media--contain > img, .detail-media--contain > video { object-fit: contain; object-position: center; }

.card-meta { display: flex; align-items: baseline; gap: 8px; min-width: 0; padding: 10px 2px 6px; }
.card-title {
  min-width: 0;
  overflow: hidden;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.015em;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.card-cat { flex: none; color: var(--muted); font-size: 13px; white-space: nowrap; }

/* Like pill on hover */
.like-pill {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 12px;
  border: 0;
  border-radius: 999px;
  background: rgba(18, 18, 18, .72);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity .18s, transform .18s;
}
.like-pill svg { width: 19px; height: 19px; }
.card:hover .like-pill, .like-pill:focus-visible { opacity: 1; transform: none; }

[data-like][aria-pressed="true"] svg { color: var(--like); }
[data-like][aria-pressed="true"] svg path { fill: currentColor; }
[data-like] svg { transition: transform .2s; }
[data-like]:active svg { transform: scale(.85); }

/* ==========================================================================
   Detail (sito aperto)
   ========================================================================== */
.detail-group {
  display: flex;
  flex-direction: column;
  gap: var(--gap);
  min-width: 0;
  container: detail / inline-size;
}
.detail-cols {
  display: grid;
  grid-template-columns: repeat(var(--k, 3), minmax(0, 1fr));
  column-gap: var(--gap);
  align-items: start;
}
.detail {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 240px;
  overflow: hidden;
  border-radius: 18px;
  background: var(--surface);
  animation: detail-in .28s ease-out;
}
.detail-media {
  position: relative;
  overflow: hidden;
  aspect-ratio: 16 / 9;
  background: #0a0a0a;
  container-type: inline-size;
}
.detail-back {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 3;
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: 50%;
  background: rgba(15, 15, 15, .78);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  color: #fff;
  transition: background-color .15s;
}
.detail-back:hover { background: rgba(15, 15, 15, .95); }
.detail-back svg { width: 20px; height: 20px; }

.detail-panel { display: flex; flex-direction: column; gap: 16px; padding: 26px 22px; }
.detail-title { margin: 0; font-size: 22px; font-weight: 700; line-height: 1.2; letter-spacing: -0.02em; }
.detail-credit { margin: -8px 0 0; color: var(--muted); font-size: 14px; }
.detail-credit a, .footer a { color: var(--text-2); text-decoration: underline; text-underline-offset: 2px; }
.detail-credit a:hover, .footer a:hover { color: #fff; }

.detail-likes {
  display: inline-flex;
  align-items: center;
  align-self: flex-start;
  gap: 8px;
  padding: 0;
  border: 0;
  background: none;
  color: #bdbdbd;
  font-size: 15px;
}
.detail-likes:hover { color: #fff; }
.detail-likes svg { width: 19px; height: 19px; }

.btn-contact {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  height: 48px;
  margin-top: 4px;
  border: 0;
  border-radius: 14px;
  background: #f2f2f2;
  color: #111;
  font-size: 15px;
  font-weight: 600;
  transition: background-color .15s, transform .1s;
}
.btn-contact:hover { background: #fff; }
.btn-contact:active { transform: scale(.985); }
.btn-contact svg { width: 19px; height: 19px; }

@container detail (max-width: 719px) {
  .detail { grid-template-columns: minmax(0, 1fr); }
  .detail-panel { padding: 20px; }
}

/* ==========================================================================
   Anteprima segnaposto (usata quando un sito non ha image/video)
   ========================================================================== */
.mock {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: linear-gradient(135deg, var(--bg1), var(--bg2));
  color: var(--ink);
}
.mock-nav { position: relative; z-index: 1; display: flex; align-items: center; padding: 3.4cqw 4.4cqw; }
.mock-logo { width: 3.2cqw; height: 3.2cqw; border-radius: 50%; background: currentColor; }
.mock-links { display: flex; gap: 2.2cqw; margin-left: auto; }
.mock-links i { display: block; width: 5cqw; height: .8cqw; border-radius: 1cqw; background: currentColor; opacity: .35; }
.mock-cta { width: 9cqw; height: 3.2cqw; margin-left: 3cqw; border-radius: 3cqw; background: currentColor; opacity: .9; }
.mock-body {
  position: relative;
  z-index: 1;
  display: flex;
  flex: 1;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2.6cqw;
  padding: 0 8cqw 7cqw;
  text-align: center;
}
.detail-media .mock-nav { padding-left: calc(4.4cqw + 52px); } /* lascia spazio al tasto indietro */
.mock--left .mock-body { align-items: flex-start; text-align: left; }
.mock-h { max-width: 15em; font-size: 8cqw; font-weight: 600; line-height: 1; letter-spacing: -0.035em; text-wrap: balance; }
.mock--serif .mock-h { font-family: "Instrument Serif", Georgia, serif; font-size: 9.6cqw; font-weight: 400; letter-spacing: -0.015em; }
.mock--display .mock-h { font-size: 9.4cqw; font-weight: 800; letter-spacing: -0.05em; }
.mock--condensed .mock-h { font-family: "Anton", Impact, sans-serif; font-size: 10.5cqw; font-weight: 400; letter-spacing: 0; text-transform: uppercase; }
.mock--left .mock-h { max-width: 70%; }
.mock-sub { display: flex; flex-direction: column; align-items: inherit; gap: 1.1cqw; }
.mock-sub i { display: block; width: 30cqw; height: .8cqw; border-radius: 1cqw; background: currentColor; opacity: .3; }
.mock-sub i + i { width: 21cqw; }
.mock-btns { display: flex; gap: 1.6cqw; margin-top: .6cqw; }
.mock-btns span { width: 12cqw; height: 3.6cqw; border-radius: 4cqw; background: var(--accent); }
.mock-btns span + span { background: transparent; box-shadow: inset 0 0 0 .25cqw currentColor; opacity: .55; }
.mock-orb {
  position: absolute;
  right: -14cqw;
  bottom: -26cqw;
  width: 62cqw;
  height: 62cqw;
  border-radius: 50%;
  background: radial-gradient(circle, var(--orb), transparent 66%);
  pointer-events: none;
}

/* ==========================================================================
   Contact modal
   ========================================================================== */
.modal {
  width: calc(100% - 32px);
  max-width: 460px;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
}
.modal::backdrop { background: rgba(0, 0, 0, .62); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); }
.modal[open] { animation: pop-in .16s ease-out; }
.modal-card {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 24px;
  border-radius: 20px;
  background: var(--surface);
  box-shadow: 0 0 0 1px var(--border), 0 30px 80px rgba(0, 0, 0, .5);
}
.modal-head { display: flex; align-items: center; justify-content: space-between; }
.modal-head h2 { margin: 0; font-size: 21px; font-weight: 700; letter-spacing: -0.02em; }
.modal-close {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 50%;
  background: var(--surface-2);
  color: #ddd;
}
.modal-close svg { width: 18px; height: 18px; }
.modal-about { margin: -4px 0 2px; color: var(--muted); font-size: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; color: var(--muted); font-size: 13px; font-weight: 500; }
.field input, .field textarea {
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #121212;
  color: var(--text);
  font: inherit;
  font-size: 15px;
  resize: vertical;
}
.field input:focus, .field textarea:focus { border-color: #4a4a4a; outline: none; }

/* Sign up / Log in */
.form-msg {
  margin: 0;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(255, 255, 255, .06);
  color: var(--text-2);
  font-size: 14px;
}
.form-msg[data-tone="error"] { background: rgba(255, 77, 109, .12); color: #ff8fa3; }
.btn-contact:disabled { opacity: .6; cursor: progress; }
.auth-switch { margin: 0; color: var(--muted); font-size: 14px; text-align: center; }
.link-btn {
  padding: 0;
  border: 0;
  background: none;
  color: #fff;
  font-size: inherit;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* ==========================================================================
   Footer
   ========================================================================== */
.footer { padding: 22px var(--pad) 40px; border-top: 1px solid var(--border); color: var(--muted); font-size: 13px; }

/* ==========================================================================
   Animazioni + responsive
   ========================================================================== */
@keyframes pop-in { from { opacity: 0; transform: scale(.96); } to { opacity: 1; transform: none; } }
@keyframes detail-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

@media (hover: none) {
  .like-pill { opacity: 1; transform: none; }
}

@media (max-width: 760px) {
  :root { --pad: 16px; }
  .topbar { position: static; }
  .header { gap: 20px; height: 64px; }
  .brand { font-size: 21px; }
  .brand-mark { width: 28px; height: 28px; }
  .header:has(.search.open) .nav { display: none; }
  .search.open { width: min(220px, 56vw); }
  .filters { flex-wrap: wrap; padding-bottom: 14px; }
  .seg { width: 100%; }
  .seg button { flex: 1; padding: 0 10px; }
  .chips-wrap { flex-basis: 100%; }
}

@media (max-width: 520px) {
  .header { gap: 14px; }
  .nav { display: none; }            /* "Contact us" resta nella pagina di ogni sito e nel menu account */
  .brand { gap: 8px; font-size: 19px; }
  .header-right { gap: 10px; }
}
@media (max-width: 380px) {
  .brand { flex: 0 1 auto; min-width: 0; font-size: 17px; }
  .brand-name { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
  .brand-mark { width: 26px; height: 26px; }
  .login-btn { padding: 0 14px; }
  .search-btn { width: 36px; }
}
@media (max-width: 340px) {
  .brand { font-size: 16px; }
  .header-right { gap: 6px; }
}

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