/* ============================================================
   RESET & BASE
   ============================================================ */

*,
*::before,
*::after {
  box-sizing: border-box;
}

::-moz-selection { background: #b3d4fc; text-shadow: none; }
::selection      { background: #b3d4fc; text-shadow: none; }

hr {
  display: block;
  height: 1px;
  border: 0;
  border-top: 1px solid #ccc;
  margin: 1em 0;
  padding: 0;
}

audio, canvas, iframe, img, svg, video { vertical-align: middle; }
fieldset { border: 0; margin: 0; padding: 0; }
textarea { resize: vertical; }

/* ============================================================
   UTILITY
   ============================================================ */

.hidden, [hidden] { display: none !important; }

.visually-hidden {
  border: 0;
  clip: rect(0, 0, 0, 0);
  height: 1px;
  margin: -1px;
  overflow: hidden;
  padding: 0;
  position: absolute;
  white-space: nowrap;
  width: 1px;
}
.visually-hidden.focusable:active,
.visually-hidden.focusable:focus {
  clip: auto;
  height: auto;
  margin: 0;
  overflow: visible;
  position: static;
  white-space: inherit;
  width: auto;
}

.invisible { visibility: hidden; }

.clearfix::before, .clearfix::after { content: ""; display: table; }
.clearfix::after { clear: both; }

/* ============================================================
   DESIGN TOKENS
   ============================================================ */

:root {
  --bg:           #050505;
  --accent:       #1837a3;
  --accent-light: #5271ff;
  --soft-white:   #f5f5f7;

  /* Spacing scale */
  --space-xs:  8px;
  --space-sm:  16px;
  --space-md:  24px;
  --space-lg:  40px;
  --space-xl:  80px;
  --space-2xl: 120px;

  /* Section padding */
  --section-px: clamp(20px, 5vw, 80px);
  --section-py: clamp(60px, 8vw, 120px);
}

/* ============================================================
   GLOBAL
   ============================================================ */

html { scroll-behavior: smooth; }

body {
  background: black;
  overflow-x: hidden;
  margin: 0;
  padding: 0;
}

section {
  min-height: 100vh;
  background-color: var(--bg);
}

h1 {
  font-family: 'Space Grotesk', sans-serif;
  color: var(--soft-white);
  margin: 0;
}
h2 {
  font-family: 'Space Grotesk', sans-serif;
  color: var(--soft-white);
  margin: 0;
}
p {
  font-family: 'Red Hat Display', sans-serif;
  color: var(--soft-white);
  line-height: 1.5;
  margin: 0;
}

/* ============================================================
   SCROLL REVEAL
   ============================================================ */

.reveal {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.8s ease-out, transform 0.8s ease-out;
  will-change: opacity, transform;
}
.reveal.active {
  opacity: 1;
  transform: translateY(0);
}

/* ============================================================
   SHARED COMPONENTS
   ============================================================ */

/* Pills badge */
.pills {
  color: var(--soft-white);
  background-color: rgba(24, 55, 163, 0.24);
  padding: 5px 12px;
  border-radius: 10px;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.85rem;
  letter-spacing: 0.05em;
  display: inline-block;
}

/* Ghost underline highlight */
.ghost-underline {
  position: relative;
  display: inline-block;
  white-space: nowrap;
  z-index: 1;
}
.ghost-underline::after {
  content: "";
  position: absolute;
  left: -4px;
  bottom: 4px;
  width: calc(100% + 8px);
  height: 0.4em;
  background-color: var(--accent);
  border-radius: 10px;
  z-index: -1;
  pointer-events: none;
}

/* CTA Button */
.cta-btn {
  padding: 10px 20px;
  font-size: 1rem;
  letter-spacing: 1px;
  cursor: pointer;
  transition: box-shadow 0.5s ease-out, color 0.5s ease-out;
  border: 1px solid rgba(141, 141, 141, 0.34);
  border-radius: 15px;
  background-color: var(--accent);
}
.cta-btn a {
  text-decoration: none;
  color: var(--soft-white);
}

button:active {
  transform: scale(0.9);
}

/* Duplicati usati per il loop delle animazioni — visibili solo su desktop */
.dup { display: none; }

@media (min-width: 769px) {
  .dup { display: block; }
}

#home {
  position: relative; /* ancora la branding-bar assoluta */
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: var(--section-py) var(--section-px);
  padding-top: calc(var(--section-py) + 80px); /* compensa l'altezza della branding bar */
}

/* Branding bar */
.branding-bar {
  height: 80px;
  width: 90%;
  max-width: 1200px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 20px;
  position: absolute;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
}

.text-link {
  text-decoration: none;
  color: var(--soft-white);
  font-family: 'Red Hat Display', sans-serif;
  font-size: clamp(1rem, 2vw, 1.3em);
  font-weight: 400;
  cursor: pointer;
}
.text-link span { opacity: 0.6; transition: opacity 0.5s ease-out; }
.text-link:hover span { opacity: 1; }

/* Home content */
.home-inner {
  width: 100%;
  max-width: 1200px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.presentation {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: var(--space-sm);
}
.presentation h1 {
  font-size: clamp(2rem, 5vw, 4em);
  max-width: 800px;
}
.presentation p {
  font-size: clamp(1rem, 2vw, 1.2em);
  max-width: 700px;
}

/* Mouse scroll indicator */
.container-mouse {
  margin-top: var(--space-lg);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}
.container-mouse span {
  color: var(--soft-white);
  font-family: 'Red Hat Display', sans-serif;
  font-size: 0.8em;
}
.mouse-btn {
  width: 20px;
  height: 40px;
  border: 1px solid rgba(122, 122, 124, 0.9);
  border-radius: 20px;
  display: flex;
}
.mouse-scroll {
  display: block;
  width: 10px;
  height: 10px;
  background: linear-gradient(170deg, rgba(122,122,124,0.9), rgb(123,124,124));
  border-radius: 50%;
  margin: auto;
  animation: scrolling13 1.6s linear infinite;
}
@keyframes scrolling13 {
  0%   { opacity: 0; transform: translateY(-15px); }
  100% { opacity: 1; transform: translateY(10px); }
}

/* ============================================================
   SECTION: SKILLS
   ============================================================ */

#skills {
  width: 100%;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  font-family: Inter, sans-serif;
  padding: var(--section-py) var(--section-px);
}

.skills-inner {
  width: 100%;
  max-width: 1200px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-md);
}
.skills-inner h1 {
  font-size: clamp(1.8rem, 4vw, 3.5em);
  max-width: 900px;
  text-align: center;
}

/* Two-column grid */
.skills-content {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 60px;
  margin-top: 40px;
  align-items: center;
  width: 100%;
}

/* --- Skills LEFT --- */
.skills-left {
  position: relative;
  height: 400px;
  padding-left: 40px;
  display: flex;
  align-items: center;
}

.skills-indicators {
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  gap: 12px;
  z-index: 10;
}
.line-indicator {
  width: 3px;
  height: 30px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  transition: all 0.5s ease;
}
.line-indicator.active {
  background: #fff;
  height: 60px;
}

/* Cards */
.card {
  position: absolute;
  width: 100%;
  left: 40px;
  opacity: 0;
  transform: translateY(20px);
  transition: all 0.6s ease;
}
.card.active {
  opacity: 1;
  transform: translateY(0);
  z-index: 2;
}
.card-content {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  padding: 40px 40px 40px 0;
  gap: var(--space-sm);
}
.card-content h2 {
  font-size: clamp(1.5rem, 3vw, 2.7em);
  font-weight: 600;
}
.card-content p {
  font-size: clamp(0.95rem, 1.5vw, 1.4em);
  max-width: 450px;
}

/* --- Skills RIGHT: icon grid --- */
.grid {
  display: grid;
  grid-template-columns: repeat(4, 80px);
  gap: 16px;
  padding: 32px;
  border-radius: 24px;
  background: #0f0f10;
  box-shadow:
    0 0 0 1px rgba(255,255,255,0.05),
    0 20px 40px rgba(30,30,30,0.2);
  overflow: hidden;
  justify-self: center;
}

.col {
  height: 320px;
  overflow: hidden;
  position: relative;
  mask-image: linear-gradient(to bottom, transparent, black 20%, black 80%, transparent);
}

.track {
  display: flex;
  flex-direction: column;
  gap: 16px;
  will-change: transform;
}
.track img {
  width: 56px;
  height: 56px;
  object-fit: contain;
  background: #18181b;
  padding: 10px;
  border-radius: 14px;
  box-shadow: 0 0 0 1px rgba(255,255,255,0.06), 0 10px 20px rgba(0,0,0,0.8);
  transition: transform 0.3s ease;
}
.track img:hover { transform: scale(1.08); }

.up   .track { animation: scrollUp   14s linear infinite; }
.down .track { animation: scrollDown 14s linear infinite; }
.fast .track { animation-duration: 10s; }
.slow .track { animation-duration: 20s; }
.col:hover .track { animation-play-state: paused; }

@keyframes scrollUp   { from { transform: translateY(0); }    to { transform: translateY(-50%); } }
@keyframes scrollDown { from { transform: translateY(-50%); } to { transform: translateY(0); } }

/* ============================================================
   SECTION: PROJECTS
   ============================================================ */

#projects {
  width: 100%;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  padding: var(--section-py) var(--section-px);
}

/* Decorative grid background */
#projects::before {
  content: "";
  position: absolute;
  top: -200px;
  left: -200px;
  width: 1200px;
  height: 1200px;
  background-image:
    linear-gradient(to right, rgba(255,255,255,0.12) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255,255,255,0.12) 1px, transparent 1px);
  background-size: 45px 45px;
  mask-image:
    radial-gradient(circle at top left, black 30%, transparent 75%),
    linear-gradient(to bottom, black 20%, transparent 90%);
  -webkit-mask-image:
    radial-gradient(circle at top left, black 30%, transparent 75%),
    linear-gradient(to bottom, black 20%, transparent 90%);
  mask-composite: intersect;
  -webkit-mask-composite: destination-in;
  pointer-events: none;
  z-index: 0;
}

.project-inner {
  width: 100%;
  max-width: 1200px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-md);
  position: relative;
  z-index: 1;
}

.project-header {
  font-size: clamp(2rem, 5vw, 3.5em);
  text-align: center;
  font-weight: 600;
  font-family: 'Space Grotesk', sans-serif;
}

.project-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  width: 100%;
  margin-top: 20px;
}

.project-card {
  border-radius: 20px;
  overflow: hidden;
  background: radial-gradient(circle at 50% 0%, #1c1c1e 0%, #0f0f10 100%);
  border: 1px solid rgba(255,255,255,0.1);
  box-shadow:
    0 10px 30px rgba(0,0,0,0.5),
    inset 0 1px 1px rgba(255,255,255,0.1);
  transition: all 0.4s cubic-bezier(0.23, 1, 0.32, 1);
}

.card-top {
  position: relative;
  width: 100%;
  height: 250px;
  overflow: hidden;
}
.project-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.8;
  transition: opacity 0.4s ease;
}

.project-description {
  position: absolute;
  inset: 0;
  background-color: var(--accent);
  padding: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  text-align: center;
  font-size: 0.95rem;
  line-height: 1.6;
  opacity: 0;
  transition: opacity 0.4s ease;
}
.project-link img {
  width: 24px;
  height: 24px;
  margin-top: 10px;
}

.project-card:hover .project-description { opacity: 1; }
.project-card:hover .project-img         { opacity: 0; }

.card-bottom { padding: 24px; }

.project-title {
  color: var(--soft-white);
  margin: 0 0 14px 0;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.5rem;
  font-weight: 600;
}

.tags { display: flex; flex-wrap: wrap; gap: 8px; }

.pill {
  background-color: rgba(24, 55, 163, 0.24);
  color: var(--accent-light);
  padding: 3px 10px;
  font-family: 'Red Hat Display', sans-serif;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
}

/* ============================================================
   SECTION: WORKFLOW
   ============================================================ */

#workflow {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--section-py) var(--section-px);
}

/* ============================================================
   SECTION: FAQ
   ============================================================ */

#faq {
  min-height: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--section-py) var(--section-px);
}

.workflow-inner {
  width: 100%;
  max-width: 1200px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-md);
}
.workflow-inner h1 {
  font-size: clamp(1.8rem, 4vw, 3.5em);
  max-width: 950px;
}

.workflow-sequence {
  display: flex;
  justify-content: center;
  align-items: stretch;
  gap: 30px;
  width: 100%;
  flex-wrap: wrap;
}

.workflow-element {
  position: relative;
  overflow: hidden;
  flex: 1 1 260px;
  max-width: 380px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: 40px 24px;
  gap: 16px;
  border-radius: 24px;
  z-index: 1;
  background: rgba(255,255,255,0.02);
  border: 1px solid rgba(255,255,255,0.06);
}
.workflow-element::before {
  position: absolute;
  bottom: -20px;
  right: 10px;
  font-size: 8rem;
  font-weight: 800;
  color: rgba(24, 55, 163, 0.25);
  z-index: -1;
  font-family: 'Space Grotesk', sans-serif;
  pointer-events: none;
  line-height: 1;
}
.workflow-element:nth-child(1)::before { content: "01"; }
.workflow-element:nth-child(2)::before { content: "02"; }
.workflow-element:nth-child(3)::before { content: "03"; }

.workflow-element img { width: 48px; height: 48px; }
.workflow-element h2  { font-size: clamp(1.2rem, 2vw, 1.7em); font-weight: 600; }
.workflow-element p   { font-size: clamp(0.9rem, 1.3vw, 1.1em); }

/* FAQ container */
.faq-container {
  width: 100%;
  max-width: 1200px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: row;
  gap: clamp(40px, 8vw, 160px);
  flex-wrap: wrap;
}

.faq-title {
  max-width: 420px;
  min-width: 240px;
  position: relative;
  border-radius: 24px;
  overflow: hidden;
  flex: 1 1 260px;
}
.faq-title img {
  width: 100%;
  display: block;
  opacity: 0.2;
}
.faq-text {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 30px;
  text-align: center;
  z-index: 2;
}
.faq-text h1 {
  font-size: clamp(1.5rem, 3vw, 2.6em);
  margin-bottom: 10px;
}
.faq-text p {
  font-size: 0.9em;
  max-width: 360px;
}

/* Chat widget */
.chat-container {
  flex: 1 1 300px;
  max-width: 600px;
  min-width: 280px;
  height: 450px;
  backdrop-filter: blur(20px);
  border-radius: 24px;
  background: rgb(15,15,16);
  box-shadow:
    0 0 0 1px rgba(255,255,255,0.05),
    0 20px 40px rgba(30,30,30,0.2);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}

.chat-header {
  padding: 18px 20px;
  font-weight: 500;
  font-size: 15px;
  color: #f5f5f7;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  font-family: 'Red Hat Display', sans-serif;
  display: flex;
  align-items: center;
  flex-shrink: 0;
}
.chat-header img {
  width: 24px;
  height: 24px;
  margin-right: 8px;
}

.intro {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-family: 'Red Hat Display', sans-serif;
  color: rgba(255,255,255,0.6);
  font-size: 1.4em;
  font-weight: 500;
  text-align: center;
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.3s ease;
  width: 80%;
}

.chat-messages {
  padding: 16px 20px;
  flex: 1;
  overflow-y: auto;
  font-family: 'Red Hat Display', sans-serif;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.message {
  max-width: 80%;
  padding: 10px 14px;
  border-radius: 18px;
  font-size: 14px;
  line-height: 1.4;
  animation: fadeIn 0.25s ease;
}
.user { align-self: flex-end; background: #0a84ff; color: white; }
.bot  { align-self: flex-start; background: #2c2c2e; color: #e5e5ea; }

.faq-buttons {
  padding: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  border-top: 1px solid rgba(255,255,255,0.05);
  flex-shrink: 0;
}
.faq-buttons button,
.faq-buttons a {
  flex: 1 1 120px;
  min-width: 0;
  background: #2c2c2e;
  color: #e5e5ea;
  padding: 10px 8px;
  border-radius: 14px;
  font-size: 11px;
  border: none;
  font-family: 'Red Hat Display', sans-serif;
  cursor: pointer;
  display: flex;
  justify-content: center;
  align-items: center;
  text-align: center;
  text-decoration: none;
  transition: background 0.2s ease;
  line-height: 1.3;
}
.faq-buttons button:hover,
.faq-buttons a:hover { background: #3a3a3c; box-shadow: none; }

.faq-buttons a {
  color: #0a84ff;
  background: rgba(10,132,255,0.1);
  flex: 0 1 80px;
}

.fade-out {
  opacity: 0;
  transform: scale(0.9);
  transition: all 0.25s ease;
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ============================================================
   SECTION: CONTACT
   ============================================================ */

#contact {
  width: 100%;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: var(--section-py) var(--section-px);
}

.contact-inner {
  width: 100%;
  max-width: 1200px;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: clamp(40px, 6vw, 100px);
}

.contact-inner .description {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: var(--space-md);
  flex: 1 1 300px;
}

#contact h1 {
  max-width: 560px;
  font-weight: 500;
  font-size: clamp(2rem, 4vw, 4rem);
  text-align: start;
}
#contact p {
  max-width: 520px;
  text-align: start;
}

/* Socials */
.social {
  display: flex;
  gap: 16px;
}
.social-square {
  background-color: rgba(255,255,255,0.05);
  border-radius: 12px;
  transition: transform 0.4s ease;
}
.social-square:hover { transform: translateY(-6px); }
.social-square img {
  width: 30px;
  height: 30px;
  padding: 5px;
  display: block;
}

/* Contact form */
#contact form {
  flex: 1 1 300px;
  max-width: 500px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}
#contact form .nome-email {
  display: flex;
  gap: 16px;
}
#contact form label {
  display: flex;
  flex-direction: column;
  width: 100%;
  color: #ffffff;
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 300;
  gap: 8px;
  font-size: 0.95rem;
}
#contact form input,
#contact form textarea {
  padding: 12px 16px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.2);
  background: rgb(15,15,16);
  color: #ffffff;
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 300;
  outline: none;
  transition: border-color 0.3s;
  font-size: 0.95rem;
}
#contact form input:focus,
#contact form textarea:focus { border-color: var(--accent); }
#contact form textarea {
  min-height: 140px;
  resize: none;
}
#contact form .gradient-button {
  padding: 12px 24px;
  border: 1px solid rgba(255,255,255,0.2);
  background-color: var(--accent);
  color: white;
  height: 50px;
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 400;
  border-radius: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  transition: opacity 0.3s;
  font-size: 1rem;
}
#contact form .gradient-button img {
  width: 20px;
  height: 20px;
  rotate: -45deg;
  transition: rotate 0.4s;
}
#contact form .gradient-button:hover img { rotate: 0deg; }
#contact form .gradient-button:hover { opacity: 0.9; box-shadow: none; }

/* ============================================================
   FOOTER
   ============================================================ */

.site-footer {
  background: var(--bg);
  border-top: 1px solid rgba(255,255,255,0.07);
  padding: 2.5rem 0;
}
.footer-inner {
  width: 90%;
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  flex-wrap: wrap;
}
.footer-left {
  display: flex;
  align-items: center;
  gap: 2rem;
  flex-wrap: wrap;
}

.footer-nav {
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
}
.footer-nav a {
  font-family: 'Red Hat Display', sans-serif;
  font-size: 0.85rem;
  color: #6b6b6b;
  text-decoration: none;
  transition: color 0.2s;
}
.footer-nav a:hover { color: var(--soft-white); }

.footer-right {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.footer-socials {
  display: flex;
  gap: 1rem;
}
.footer-socials a {
  color: #6b6b6b;
  display: flex;
  align-items: center;
  transition: color 0.2s;
}
.footer-socials a:hover { color: var(--soft-white); }

.footer-copy {
  font-family: 'Red Hat Display', sans-serif;
  font-size: 0.78rem;
  color: #4a4a4a;
  margin: 0;
}

/* ============================================================
   EXTRA PAGES (thank-you, privacy-policy)
   ============================================================ */

.thank-you-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: var(--section-py) var(--section-px);
}
.thank-you-section h1 {
  font-size: clamp(2rem, 5vw, 3.5em);
  margin-bottom: 24px;
}
.thank-you-section p {
  font-size: 1.2em;
  max-width: 600px;
}

.privacy-policy {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: clamp(60px, 8vw, 120px) clamp(24px, 6vw, 100px);
  max-width: 800px;
  margin: 0 auto;
}
.privacy-policy h1 {
  font-size: clamp(2rem, 5vw, 3.5em);
  margin-bottom: 32px;
}
.privacy-policy p {
  font-size: 1em;
  text-align: start;
}

/* ============================================================
   RESPONSIVE — TABLET  (max 1024px)
   ============================================================ */

@media (max-width: 1024px) {
  .skills-content {
    grid-template-columns: 1fr;
    gap: 60px;
  }

  .skills-left {
    width: 100%;
    height: auto;
    min-height: 340px;
  }
  .card {
    width: calc(100% - 40px);
  }
  .card-content p {
    max-width: 100%;
  }

  .skills-right {
    display: flex;
    justify-content: center;
  }

  .project-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .faq-container {
    flex-direction: column;
    align-items: center;
    gap: 48px;
  }
  .faq-title {
    max-width: 100%;
    width: 100%;
  }
  .chat-container {
    width: 100%;
    max-width: 100%;
  }
}

/* ============================================================
   RESPONSIVE — MOBILE  (max 768px)
   ============================================================ */

@media (max-width: 768px) {
  /* Branding bar */
  .branding-bar {
    width: calc(100% - 32px);
    padding: 0 16px;
    top: 8px;
  }

  /* Projects: single column */
  .project-grid {
    grid-template-columns: 1fr;
  }

  /* Su mobile la descrizione è sempre visibile: layout diverso */
  .card-top {
    height: auto;
    display: flex;
    flex-direction: column;
  }
  .project-img {
    position: static;
    width: 100%;
    height: 180px;
    object-fit: cover;
    opacity: 0.9;
  }
  .project-description {
    position: static;
    opacity: 1;
    background-color: rgba(24, 55, 163, 0.15);
    padding: 16px;
    font-size: 0.88rem;
    text-align: left;
    align-items: flex-start;
  }
  /* Nasconde hover effects su mobile (non servono) */
  .project-card:hover .project-img { opacity: 0.9; }

  /* Skills: tutte le 18 icone uniche in griglia, senza duplicati */
  .skills-right .grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    padding: 20px;
    width: 100%;
    overflow: visible;
  }
  .skills-right .col {
    height: auto;
    overflow: visible;
    mask-image: none;
    -webkit-mask-image: none;
    display: contents;
  }
  .skills-right .track {
    animation: none !important;
    display: contents;
  }
  .skills-right .track img {
    display: block;
    width: 52px;
    height: 52px;
    padding: 10px;
  }
  .skills-right .track img.dup {
    display: none;
  }

  /* Intro chat: spostata in alto così non si sovrappone ai bottoni */
  .intro {
    top: 30%;
    font-size: 1.1em;
  }

  /* FAQ: abstract non tagliata */
  .faq-title {
    overflow: visible;
    min-height: 220px;
  }
  .faq-title img {
    min-height: 220px;
    object-fit: cover;
  }

  /* Workflow: single column */
  .workflow-sequence {
    flex-direction: column;
    align-items: stretch;
    gap: 20px;
  }
  .workflow-element {
    max-width: 100%;
    flex: 1 1 auto;
  }

  /* Contact: stack vertically */
  .contact-inner {
    flex-direction: column;
    align-items: flex-start;
    gap: 40px;
  }
  #contact form {
    width: 100%;
    max-width: 100%;
  }
  #contact form .nome-email {
    flex-direction: column;
  }

  /* FAQ buttons wrap nicely */
  .faq-buttons {
    flex-wrap: wrap;
  }
  .faq-buttons button {
    flex: 1 1 calc(50% - 8px);
  }
  .faq-buttons a {
    flex: 1 1 100%;
  }

  /* Footer */
  .footer-inner {
    flex-direction: column;
    align-items: flex-start;
    gap: 1.5rem;
  }
  .footer-right {
    justify-content: flex-start;
  }
}

/* ============================================================
   RESPONSIVE — SMALL MOBILE  (max 480px)
   ============================================================ */

@media (max-width: 480px) {
  .faq-buttons button {
    flex: 1 1 100%;
  }
  .chat-container {
    height: auto;
    min-height: 420px;
  }
  .chat-messages {
    min-height: 160px;
  }
  .skills-left {
    min-height: 300px;
  }
  .card-content {
    padding: 20px 16px 20px 0;
  }
}

/* ============================================================
   PRINT
   ============================================================ */

@media print {
  *, *::before, *::after {
    background: #fff !important;
    color: #000 !important;
    box-shadow: none !important;
    text-shadow: none !important;
  }
  a, a:visited { text-decoration: underline; }
  a[href]::after { content: " (" attr(href) ")"; }
  abbr[title]::after { content: " (" attr(title) ")"; }
  a[href^="#"]::after,
  a[href^="javascript:"]::after { content: ""; }
  pre { white-space: pre-wrap !important; }
  pre, blockquote { border: 1px solid #999; page-break-inside: avoid; }
  tr, img { page-break-inside: avoid; }
  p, h2, h3 { orphans: 3; widows: 3; }
  h2, h3 { page-break-after: avoid; }
}
