/* ===================================================
   VARIABILI E RESET
   =================================================== */
:root {
  --navy: #1a3a6b;
  --yellow: #d4a800;
  --cream: #f9f6ec;
  --font:
    "JetBrains Mono", "Fira Code", "IBM Plex Mono", Menlo, Consolas, monospace;
  --header-h: 60px;
  --drawer-w: 280px;
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
}

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font);
  color: var(--navy);
  background-color: var(--cream);
  /* sfondo a quadretti stile quaderno */
  background-image:
    linear-gradient(rgba(26, 58, 107, 0.07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(26, 58, 107, 0.07) 1px, transparent 1px);
  background-size: 28px 28px;
  min-height: 100vh;
  overflow-x: hidden;
}

/* ===================================================
   OVERLAY (sfondo scuro quando il drawer è aperto)
   =================================================== */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(26, 58, 107, 0.3);
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s var(--ease);
}

.overlay.is-visible {
  opacity: 1;
  pointer-events: all;
}

/* ===================================================
   DRAWER
   =================================================== */
.drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: var(--drawer-w);
  height: 100%;
  background: var(--cream);
  border-left: 2px solid rgba(26, 58, 107, 0.2);
  z-index: 200;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 2rem 2.5rem;
  transform: translateX(100%);
  transition: transform 0.35s var(--ease);
}

.drawer.is-open {
  transform: translateX(0);
}

.drawer__nav {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 2.25rem;
}

.drawer__nav a {
  color: var(--navy);
  text-decoration: none;
  font-size: 1.5rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  position: relative;
  display: inline-block;
}

/* sottolineatura gialla animata al hover */
.drawer__nav a::after {
  content: "";
  position: absolute;
  bottom: -3px;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--yellow);
  transition: width 0.25s ease;
}

.drawer__nav a:hover::after {
  width: 100%;
}

.drawer__footer {
  margin-top: auto;
  padding-top: 2rem;
  font-size: 0.7rem;
  opacity: 0.4;
}

/* ===================================================
   HEADER
   =================================================== */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.25rem;
  z-index: 50;
  background: rgba(249, 246, 236, 0.88);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid rgba(26, 58, 107, 0.1);
}

.site-header__logo {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--navy);
  text-decoration: none;
  letter-spacing: 0.08em;
  /* punto giallo decorativo dopo le iniziali */
  display: flex;
  align-items: center;
  gap: 3px;
}

.site-header__logo::after {
  content: "";
  display: inline-block;
  width: 7px;
  height: 7px;
  background: var(--yellow);
  border-radius: 50%;
  flex-shrink: 0;
}

/* ===================================================
   HAMBURGER
   =================================================== */
.hamburger {
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
  color: var(--navy);
  display: flex;
  align-items: center;
  justify-content: center;
  /* z-index alto: sopra il drawer per poter sempre chiuderlo */
  z-index: 300;
  position: relative;
}

.ham-svg {
  width: 30px;
  height: 22px;
  display: block;
}

.ham-line {
  /* transform-box: fill-box fa sì che transform-origin punti al centro del singolo elemento */
  transform-box: fill-box;
  transform-origin: center;
  transition:
    transform 0.35s var(--ease),
    opacity 0.25s ease;
}

/* Animazione hamburger → X */
.hamburger.is-active .ham-top {
  transform: translateY(7px) rotate(45deg);
}
.hamburger.is-active .ham-mid {
  opacity: 0;
  transform: scaleX(0.2);
}
.hamburger.is-active .ham-bot {
  transform: translateY(-7px) rotate(-45deg);
}

/* ===================================================
   HERO
   =================================================== */
.hero {
  min-height: 100vh;
  display: flex;
  align-items: center;
  padding: calc(var(--header-h) + 2.5rem) 1.25rem 2.5rem;
  position: relative;
}

.hero__content {
  max-width: 640px;
}

/* Badge / etichetta ruolo */
.hero__label {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--yellow);
  border: 1.5px solid var(--yellow);
  padding: 0.3em 0.8em;
  margin-bottom: 1.5rem;
  border-radius: 2px;
  /* leggera rotazione per look hand-made */
  transform: rotate(-0.6deg);
  animation: fadeUp 0.55s ease both 0.1s;
}

/* Nome grande */
.hero__name {
  display: flex;
  flex-direction: column;
  font-size: clamp(2.6rem, 11vw, 5.5rem);
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.02em;
  margin-bottom: 1.5rem;
  animation: fadeUp 0.55s ease both 0.25s;
}

.hero__name-last {
  position: relative;
  display: inline-block;
  width: fit-content;
}

/* sottolineatura gialla semitrasparente sotto il cognome */
.hero__name-last::after {
  content: "";
  position: absolute;
  bottom: 5px;
  left: -2px;
  width: calc(100% + 4px);
  height: 8px;
  background: var(--yellow);
  opacity: 0.35;
  z-index: -1;
  transform: rotate(-0.4deg);
}

.hero__tagline {
  font-size: 0.9rem;
  line-height: 1.85;
  opacity: 0.6;
  font-weight: 300;
  margin-bottom: 2.5rem;
  animation: fadeUp 0.55s ease both 0.4s;
}

.hero__cta {
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
  color: var(--navy);
  text-decoration: none;
  font-size: 0.82rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  border-bottom: 2px solid var(--yellow);
  padding-bottom: 2px;
  transition: gap 0.2s ease;
  animation: fadeUp 0.55s ease both 0.52s;
}

.hero__cta::before {
  content: "→";
  transition: transform 0.2s ease;
}

.hero__cta:hover::before {
  transform: translateX(4px);
}

/* Notepad decorativo hero */
.hero__notepad {
  position: absolute;
  bottom: 2rem;
  right: 1.25rem;
  width: 162px;
  position: absolute;
  background-color: rgba(255, 253, 248, 0.97);
  background-image: repeating-linear-gradient(
    transparent,
    transparent 20px,
    rgba(26, 58, 107, 0.08) 20px,
    rgba(26, 58, 107, 0.08) 21px
  );
  border: 1px solid rgba(26, 58, 107, 0.13);
  padding: 1.6rem 1rem 1.1rem;
  box-shadow:
    3px 5px 20px rgba(26, 58, 107, 0.13),
    1px 1px 4px rgba(26, 58, 107, 0.06);
  animation: notepadIn 0.55s ease both 0.7s;
}

@keyframes notepadIn {
  from {
    opacity: 0;
    transform: rotate(2deg) translateY(18px);
  }
  to {
    opacity: 1;
    transform: rotate(2deg) translateY(0);
  }
}

.hero__notepad-tape {
  position: absolute;
  top: -10px;
  left: 50%;
  transform: translateX(-50%) rotate(-1.2deg);
  width: 48px;
  height: 19px;
  background-color: rgba(240, 228, 188, 0.72);
  background-image: repeating-linear-gradient(
    90deg,
    transparent,
    transparent 3px,
    rgba(255, 255, 255, 0.22) 3px,
    rgba(255, 255, 255, 0.22) 4px
  );
  border: 0.5px solid rgba(200, 180, 120, 0.28);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.07);
}

.hero__notepad-code {
  display: flex;
  flex-direction: column;
  gap: 0.18rem;
  font-family: var(--font);
  font-size: 0.63rem;
  line-height: 1.65;
}

.hero__notepad-line {
  display: flex;
  align-items: baseline;
  flex-wrap: nowrap;
}

.hero__notepad-indent {
  padding-left: 1.1em;
}

.hero__notepad-kw {
  color: var(--yellow);
  font-weight: 600;
}

.hero__notepad-var {
  color: var(--navy);
  opacity: 0.8;
}

.hero__notepad-prop {
  color: var(--navy);
  opacity: 0.65;
}

.hero__notepad-str {
  color: var(--navy);
  opacity: 0.4;
}

.hero__notepad-punc {
  color: var(--navy);
  opacity: 0.35;
}

/* ===================================================
   ANIMAZIONE ENTRATA
   =================================================== */
@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(18px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* l'etichetta ha già una rotate propria: la combiniamo */
.hero__label {
  animation-name: fadeUpRotate;
}

@keyframes fadeUpRotate {
  from {
    opacity: 0;
    transform: translateY(18px) rotate(-0.6deg);
  }
  to {
    opacity: 1;
    transform: translateY(0) rotate(-0.6deg);
  }
}

/* ===================================================
   TABLET (≥ 768px)
   =================================================== */
@media (min-width: 768px) {
  :root {
    --header-h: 68px;
    --drawer-w: 320px;
  }

  .site-header {
    padding: 0 2.5rem;
  }

  .hero {
    padding: calc(var(--header-h) + 3.5rem) 2.5rem 3rem;
  }

  .hero__notepad {
    width: 185px;
    bottom: 2.5rem;
    right: 2.5rem;
  }
}

/* ===================================================
   DESKTOP (≥ 1100px)
   =================================================== */
@media (min-width: 1100px) {
  .site-header {
    padding: 0 4rem;
  }

  .hero {
    padding: calc(var(--header-h) + 4rem) 4rem 4rem;
  }

  .hero__notepad {
    width: 200px;
    right: 4rem;
    bottom: 3rem;
  }
}

/* ===================================================
   ABOUT
   =================================================== */
.about {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: calc(var(--header-h) + 2rem) 1.25rem 2.5rem;
}

.about__card {
  position: relative;
  width: 92%;
  min-height: 88vh;
  display: flex;
  flex-direction: column;
  background: #fefcf7;
  border: 1px solid rgba(26, 58, 107, 0.1);
  box-shadow:
    0 8px 40px rgba(26, 58, 107, 0.1),
    0 2px 8px rgba(26, 58, 107, 0.05);
  border-radius: 2px;
  padding: 3.5rem 2rem 2rem;
  margin-top: 16px;
  /* stato iniziale per animazione scroll */
  opacity: 0;
  transform: rotate(-0.4deg) translateY(28px);
  transition:
    opacity 0.65s var(--ease),
    transform 0.65s var(--ease);
}

.about__card.is-visible {
  opacity: 1;
  transform: rotate(-0.4deg) translateY(0);
}

/* Pezzi di scotch */
.about__tape {
  position: absolute;
  top: -13px;
  width: 62px;
  height: 24px;
  background-color: rgba(240, 228, 188, 0.68);
  background-image: repeating-linear-gradient(
    90deg,
    transparent,
    transparent 3px,
    rgba(255, 255, 255, 0.24) 3px,
    rgba(255, 255, 255, 0.24) 4px
  );
  border: 0.5px solid rgba(200, 180, 120, 0.3);
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.08);
}

.about__tape--left {
  left: 14%;
  transform: rotate(-2.8deg);
}

.about__tape--right {
  right: 14%;
  transform: rotate(2.5deg);
}

/* Label sezione stile IDE */
.section-comment {
  display: block;
  font-size: 0.68rem;
  color: var(--yellow);
  opacity: 0.85;
  margin-bottom: 1.4rem;
  letter-spacing: 0.06em;
}

.about__heading {
  font-size: clamp(1.5rem, 6vw, 2.4rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 1.25rem;
  position: relative;
  display: inline-block;
}

.about__heading::after {
  content: "";
  position: absolute;
  bottom: 4px;
  left: -2px;
  width: calc(100% + 4px);
  height: 6px;
  background: var(--yellow);
  opacity: 0.28;
  z-index: -1;
  transform: rotate(-0.3deg);
}

.about__bio {
  font-size: 0.87rem;
  line-height: 1.95;
  opacity: 0.6;
  font-weight: 300;
  margin-bottom: 1rem;
  max-width: 55ch;
}

.about__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1.75rem;
}

.about__tag {
  font-size: 0.63rem;
  letter-spacing: 0.1em;
  color: var(--navy);
  opacity: 0.5;
  border: 1px solid rgba(26, 58, 107, 0.22);
  padding: 0.28em 0.75em;
  border-radius: 2px;
}

/* Placeholder foto */
.about__photo {
  flex: 1;
  min-height: 200px;
  margin-top: 2rem;
  background: rgba(26, 58, 107, 0.05);
  border: 1px dashed rgba(26, 58, 107, 0.18);
  border-radius: 2px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.about__photo-label {
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  opacity: 0.3;
}

@media (prefers-reduced-motion: reduce) {
  .about__card {
    opacity: 1;
    transform: rotate(-0.4deg);
    transition: none;
  }
}

/* ABOUT — Tablet (≥ 768px) */
@media (min-width: 768px) {
  .about {
    padding: calc(var(--header-h) + 3.5rem) 2.5rem 3rem;
  }

  .about__card {
    width: 88%;
    padding: 4rem 3rem 2.5rem;
  }

  .about__photo {
    min-height: 280px;
  }
}

/* ABOUT — Desktop (≥ 1100px) */
@media (min-width: 1100px) {
  .about {
    padding: calc(var(--header-h) + 4rem) 4rem 4rem;
  }

  .about__card {
    width: 80%;
    max-width: 1000px;
    padding: 4.5rem 4rem 3rem;
  }

  .about__photo {
    min-height: 360px;
  }
}

/* ===================================================
   WORKS
   =================================================== */
.works {
  padding: calc(var(--header-h) + 2.5rem) 1.25rem 4rem;
}

.works .section-comment {
  display: block;
  margin-bottom: 2rem;
}

.works__list {
  list-style: none;
}

.works__item {
  padding: 2.5rem 0;
  opacity: 0;
  transform: translateY(20px);
  transition:
    opacity 0.55s var(--ease),
    transform 0.55s var(--ease);
}

.works__item.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.works__item-inner {
  display: flex;
  flex-direction: column;
  gap: 1.75rem;
  position: relative;
  background-color: #1f2e22;
  background-image: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 5px,
    rgba(255, 255, 255, 0.006) 5px,
    rgba(255, 255, 255, 0.006) 6px
  );
  border: 9px solid #5a3b18;
  border-radius: 2px;
  padding: 2rem 1.75rem;
  box-shadow:
    inset 0 0 55px rgba(0, 0, 0, 0.3),
    inset 0 2px 8px rgba(0, 0, 0, 0.2),
    0 8px 30px rgba(0, 0, 0, 0.18);
}

/* Numero + slug */
.works__meta {
  display: flex;
  align-items: baseline;
  gap: 0.45rem;
  margin-bottom: 0.9rem;
}

.works__number {
  font-size: clamp(2.2rem, 8vw, 3.2rem);
  font-weight: 700;
  color: var(--yellow);
  line-height: 1;
  letter-spacing: -0.02em;
}

.works__sep {
  font-size: 0.78rem;
  opacity: 0.3;
}

.works__slug {
  font-size: 0.7rem;
  opacity: 0.38;
  letter-spacing: 0.08em;
}

.works__title {
  font-size: clamp(1.25rem, 4vw, 1.85rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.15;
  margin-bottom: 0.9rem;
}

.works__desc {
  font-size: 0.86rem;
  line-height: 1.9;
  opacity: 0.6;
  font-weight: 300;
  margin-bottom: 1.25rem;
  max-width: 52ch;
}

.works__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-bottom: 1.5rem;
}

.works__tag {
  font-size: 0.62rem;
  letter-spacing: 0.1em;
  color: var(--navy);
  opacity: 0.5;
  border: 1px solid rgba(26, 58, 107, 0.22);
  padding: 0.26em 0.72em;
  border-radius: 2px;
}

.works__link {
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
  color: var(--navy);
  text-decoration: none;
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  border-bottom: 1.5px solid var(--yellow);
  padding-bottom: 1px;
  transition:
    gap 0.2s ease,
    opacity 0.2s ease;
}

.works__link::after {
  content: "→";
  transition: transform 0.2s ease;
}

.works__link:hover::after {
  transform: translateX(4px);
}

/* Screenshot placeholder */
.works__screenshot {
  width: 100%;
  min-height: 210px;
  background: rgba(26, 58, 107, 0.05);
  border: 1px dashed rgba(26, 58, 107, 0.18);
  border-radius: 2px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.works__screenshot-label {
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  opacity: 0.3;
}

/* Override colori per lo stile lavagna */
.works__item-inner .works__sep,
.works__item-inner .works__slug {
  color: rgba(240, 235, 220, 0.32);
  opacity: 1;
}

.works__item-inner .works__title {
  color: rgba(240, 235, 220, 0.9);
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5), 0 0 8px rgba(240, 235, 220, 0.07);
}

.works__item-inner .works__desc {
  color: rgba(240, 235, 220, 0.55);
  opacity: 1;
}

.works__item-inner .works__tag {
  color: rgba(240, 235, 220, 0.5);
  border-color: rgba(240, 235, 220, 0.18);
  opacity: 1;
}

.works__item-inner .works__link {
  color: rgba(240, 235, 220, 0.8);
}

.works__item-inner .works__screenshot {
  background: rgba(0, 0, 0, 0.18);
  border: 2px dashed rgba(240, 235, 220, 0.22);
  box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.15);
}

.works__item-inner .works__screenshot-label {
  color: rgba(240, 235, 220, 0.3);
  opacity: 1;
}

@media (prefers-reduced-motion: reduce) {
  .works__item {
    opacity: 1;
    transform: none;
    transition: none;
  }
}

/* WORKS — Tablet (≥ 768px) */
@media (min-width: 768px) {
  .works {
    padding: calc(var(--header-h) + 3.5rem) 2.5rem 5rem;
  }

  .works__screenshot {
    min-height: 270px;
  }
}

/* WORKS — Desktop (≥ 1100px) */
@media (min-width: 1100px) {
  .works {
    padding: calc(var(--header-h) + 4rem) 4rem 6rem;
  }

  .works__item-inner {
    flex-direction: row;
    align-items: flex-start;
    gap: 4rem;
  }

  .works__info {
    flex: 1;
  }

  .works__screenshot {
    flex: 0 0 42%;
    min-height: 290px;
  }
}

/* ===================================================
   CONTACT / FOOTER
   =================================================== */
.contact {
  background: var(--navy);
  padding: 3rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.contact__inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  text-align: center;
}

.contact__links {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem 0.4rem;
}

.contact__link {
  font-size: 0.8rem;
  color: rgba(249, 246, 236, 0.58);
  text-decoration: none;
  letter-spacing: 0.04em;
  transition: color 0.2s ease;
}

.contact__link:hover {
  color: var(--yellow);
}

.contact__sep {
  color: rgba(249, 246, 236, 0.18);
  font-size: 0.8rem;
  user-select: none;
}

.contact__copy {
  font-size: 0.63rem;
  color: rgba(249, 246, 236, 0.2);
  letter-spacing: 0.1em;
}

@media (min-width: 768px) {
  .contact {
    padding: 3.5rem 2.5rem;
  }

  .contact__links {
    gap: 0.5rem 1.5rem;
  }

  .contact__link {
    font-size: 0.85rem;
  }
}
