/* Font serviti dal nostro dominio (public/fonts/).
   Prima arrivavano da fonts.googleapis.com via @import, che è il modo più
   lento possibile: il browser scaricava critical.css, solo lì scopriva
   l'import, scaricava il CSS di Google e solo allora i font. Tre round trip
   in fila prima di vedere il testo, più l'IP di ogni visitatore spedito a
   Google senza consenso.

   Sono le versioni VARIABILI: un file copre l'intero asse dei pesi. Oltre a
   pesare meno di dieci file statici, rende finalmente i font-weight 750, 760
   e 780 usati negli strumenti, che con i tagli statici 300/400/500/600/700
   venivano arrotondati al peso più vicino.

   Le pagine precaricano i tagli "latin"; "latin-ext" scende solo se in
   pagina compare un carattere che lo richiede. */
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('/fonts/inter-v20-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('/fonts/inter-v20-latin-ext.woff2') format('woff2');
  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;
}

@font-face {
  font-family: 'Plus Jakarta Sans';
  font-style: normal;
  font-weight: 200 800;
  font-display: swap;
  src: url('/fonts/jakarta-v12-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: 'Plus Jakarta Sans';
  font-style: normal;
  font-weight: 200 800;
  font-display: swap;
  src: url('/fonts/jakarta-v12-latin-ext.woff2') format('woff2');
  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;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html body *:focus:not(:focus-visible) {
  outline: none;
  box-shadow: none;
}

html {
  background-color: #0d111a;
  /* Dark native UI from the first paint - kept in sync with main.css. */
  color-scheme: dark;
  --nav-link-hover-color: #0084ff;
  --nav-link-active-color: #7fd1ff;
  overflow-x: clip;
  overscroll-behavior-x: none;
}

body {
  margin: 0;
  background-color: #0d111a;
  color: #f2f2f2;
  font-family: 'Inter', sans-serif;
  line-height: 1.6;
  opacity: 1;
  transition: opacity 0.2s ease;
  overflow-x: clip;
  overscroll-behavior-x: none;
}

h1, h2, h3, h4, h5, h6 {
  font-family: 'Plus Jakarta Sans', sans-serif;
}

/* Content must stay visible even when the JS bundle never runs: hiding the
   whole body until data-page-ready="true" blanked the page for bots and no-JS
   users. The anti-FOUC path only engages when html.js is set. */
html[data-page-ready] body {
  opacity: 1;
}

header {
  position: sticky;
  top: 0;
  z-index: 1000;
  width: 100%;
  background-color: #090d16;
}

.navbar-container {
  display: flex;
  justify-content: flex-start;
  align-items: center;
  gap: 40px;
  padding: 5px 2rem;
  background-color: #090d16;
  max-width: 1900px;
  margin: 0 auto;
}

.logo-link {
  display: block;
  flex: 0 0 auto;
  line-height: 0;
  text-decoration: none;
}

.logo {
  display: block;
  width: 80px;
  max-width: 80px;
  height: auto;
  aspect-ratio: 63.19614 / 28.080055;
  object-fit: contain;
}

h1 {
  margin: 0;
  font-size: 2em;
  white-space: nowrap;
  color: #007bf0;
}

.nav-menu {
  display: flex;
  list-style: none;
  align-items: center;
  justify-content: flex-end;
  margin: 0 0 0 auto;
  padding: 0;
}

.nav-item {
  margin-left: 25px;
}

.nav-link {
  color: #f2f2f2;
  text-decoration: none;
  margin-right: 1rem;
  font-size: 18px;
  font-weight: 500;
}

.nav-link:hover,
.nav-link:focus-visible {
  color: var(--nav-link-hover-color);
}

.nav-link.is-active,
.nav-link[aria-current="page"] {
  color: var(--nav-link-active-color);
}

.nav-link i,
.resize-text > i,
.invisible-text > i {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.25em;
  min-width: 1.25em;
  margin-right: 0.35rem;
}

.menu-icon {
  display: none;
}

main {
  max-width: 1900px;
  margin: 2rem auto;
  padding: 0 2rem;
}

img {
  max-width: 100%;
  height: auto;
  user-select: none;
  -webkit-user-drag: none;
}

@media screen and (max-width: 1230px) {
  h1 {
    font-size: calc(1.2em + 0.8vw);
    white-space: normal;
    word-wrap: break-word;
  }
}

@media screen and (max-width: 860px) {
  .logo {
    width: 48px;
    max-width: 48px;
  }

  .resize-text,
  .invisible-text {
    display: none;
  }
}

@media screen and (max-width: 768px) {
  .navbar-container {
    flex-wrap: wrap;
    justify-content: space-between;
    position: relative;
    padding: 5px var(--mobile-page-gutter);
  }

  h1 {
    order: 1;
    flex-basis: 100%;
    max-width: calc(100% - 40px);
    margin-bottom: 10px;
  }

  .menu-icon {
    display: flex;
    order: 2;
    flex-direction: column;
    justify-content: space-around;
    width: 30px;
    height: 25px;
    margin-left: auto;
  }

  .menu-icon .bar {
    width: 100%;
    height: 4px;
    background-color: #f2f2f2;
  }

  .nav-menu {
    display: flex;
    visibility: hidden;
    opacity: 0;
    transform: translateY(-8px);
    transition:
      opacity 0.25s cubic-bezier(0.16, 1, 0.3, 1),
      transform 0.25s cubic-bezier(0.16, 1, 0.3, 1),
      visibility 0.25s;
    position: absolute;
    top: 100%;
    right: 0;
    width: 210px;
    padding: 12px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    background-color: #161b26;
    box-shadow:
      0 12px 32px rgba(0, 0, 0, 0.35),
      0 0 16px 1px rgba(0, 132, 255, 0.12);
  }

  .nav-link {
    padding: 0.95rem 0.8rem;
    font-size: 18px;
    font-weight: 600;
    background: transparent;
    border: 0;
    border-radius: 8px;
    box-shadow: none;
    outline: none;
    -webkit-tap-highlight-color: transparent;
    transition: background-color 0.2s ease, color 0.2s ease;
  }

  .nav-link:hover,
  .nav-link:focus,
  .nav-link:focus-visible,
  .nav-link:active,
  .nav-link.is-active,
  .nav-link[aria-current="page"] {
    background: rgba(255, 255, 255, 0.06);
    box-shadow: none;
    outline: none;
    text-decoration: none;
  }

  main {
    margin: 1rem auto 1.5rem;
    padding: 0 0.875rem;
  }
}

@media screen and (max-width: 480px) {
  .navbar-container {
    padding: 5px var(--mobile-page-gutter-tight);
  }

  h1 {
    font-size: 1.2em;
  }

  main {
    padding: 0 0.75rem;
  }
}

.button-simple,
.back-link,
.tool-back-link,
.footer-social-link,
.nav-link,
.logo-link,
.clickable-item,
.card,
.tool-card,
.resource-card,
.project-card,
.learning-card,
.copy-btn,
.tool-button,
button {
  transition: transform 0.15s cubic-bezier(0.25, 0.46, 0.45, 0.94), background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
}

/* Cards glide, buttons snap - keep in sync with the card-family override in
   main.css (literal values here: critical.css defines no tokens). */
.card,
.tool-card,
.resource-card,
.project-card,
.learning-card {
  transition: all 0.45s cubic-bezier(0.4, 0, 0.2, 1);
}

/* body prefix bumps specificity above same-element :hover rules (e.g.
   .card:hover in card.css) - see main.css for the full explanation. */
body .button-simple:active,
body .back-link:active,
body .tool-back-link:active,
body .footer-social-link:active,
body .nav-link:active,
body .logo-link:active,
body .clickable-item:active,
body .card:active,
body .tool-card:active,
body .resource-card:active,
body .project-card:active,
body .learning-card:active,
body .copy-btn:active,
body .tool-button:active,
body button:active {
  transform: scale(0.985) translateY(0.5px);
}

*:focus-visible {
  outline: 2px solid var(--color-three, #0084ff);
  outline-offset: 4px;
  box-shadow: 0 0 0 4px rgba(0, 132, 255, 0.25);
}

body.no-scroll {
  overflow: hidden;
}

@media screen and (max-width: 768px) {
  .nav-menu .nav-item {
    opacity: 0;
    transform: translateY(-6px);
    transition: opacity 0.25s cubic-bezier(0.16, 1, 0.3, 1), transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  }

  .nav-menu.active .nav-item {
    opacity: 1;
    transform: translateY(0);
  }

  .nav-menu.active .nav-item:nth-child(1) { transition-delay: 0.05s; }
  .nav-menu.active .nav-item:nth-child(2) { transition-delay: 0.09s; }
  .nav-menu.active .nav-item:nth-child(3) { transition-delay: 0.13s; }
  .nav-menu.active .nav-item:nth-child(4) { transition-delay: 0.17s; }
  .nav-menu.active .nav-item:nth-child(5) { transition-delay: 0.21s; }
  .nav-menu.active .nav-item:nth-child(6) { transition-delay: 0.25s; }
}

/* Anti-FOUC twin of main.css's rule - see there for why :root replaces
   !important. Keep both copies in sync. */
html.js:root body[data-css-ready="pending"] {
  opacity: 0;
}
html.js:root body[data-css-ready="ready"] {
  opacity: 1;
  transition: opacity 0.25s ease;
}

/* Utility: testo accessibile a screen reader e motori di ricerca ma non visibile
   a schermo. Usata per i titoli di pagina il cui titolo visibile vive nella navbar. */
.sr-only {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* Cross-document view transitions: the two language versions are real
   documents, so switching language is a navigation. Declared here — this file
   is a render-blocking link in dev and prod alike — so BOTH documents are
   opted in before first paint; declaring it in the bundled CSS was too late on
   the dev server, where bundle CSS arrives via JS. The language knob
   (view-transition-name in navbar.css) glides across the swap. Browsers
   without support simply navigate. */
@view-transition {
  navigation: auto;
}

::view-transition-old(root),
::view-transition-new(root) {
  animation-duration: 0.22s;
}

@media (prefers-reduced-motion: reduce) {
  @view-transition {
    navigation: none;
  }
}
