/* =========================================================
   EVA — HOME (style.css) — CLEAN FINAL (FULL)
========================================================= */

/* =========================================================
   1) ROOT + THEME
========================================================= */
:root {
  --pad: 24px;
  --cols: 12;
  --gutter: 18px;

  --hover: #ff0000;
  --bg: #000;
  --text: #fff;
  --ball-x: 0px;

  --anchor-point: 14vh;
  --projects-anchor-extra: 8vh;

  --pause-start: 18vh;
  --pause-end: 18vh;

  --font-main: "Archivo", sans-serif;

  --space-hero-to-about: 50vh;
  --space-about-to-projects: 30vh;
  --space-title-to-images: 10vh;
  --space-images-to-bar: 4vh;
  --space-bar-to-contact: 16vh;

  /* Reveal system (FAST) */
  --reveal-dur: 480ms;
  --reveal-ease: cubic-bezier(.2, .9, .2, 1);
  --reveal-y: 26px;
  --reveal-scale: .98;
  --reveal-blur: 2px;
}

html.light-mode {
  --bg: #fff;
  --text: #000;
  --ball-x: 16px;
}

/* =========================================================
   2) FONT
========================================================= */
@font-face {
  font-family: "Archivo";
  src: url("./font/Archivo-Regular.ttf") format("truetype");
  font-style: normal;
  font-weight: 400;
}

@font-face {
  font-family: "Archivo";
  src: url("./font/Archivo-Light.ttf") format("truetype");
  font-style: normal;
  font-weight: 300;
}

@font-face {
  font-family: "Archivo";
  src: url("./font/Archivo-ExtraLightItalic.ttf") format("truetype");
  font-style: italic;
  font-weight: 200;
}

/* =========================================================
   3) RESET + GLOBAL
========================================================= */
* {
  box-sizing: border-box;
  cursor: none !important;
}

html {
  scroll-behavior: auto;
  overflow-x: hidden;
  scroll-padding-top: var(--anchor-point);
  scrollbar-width: none;
}

html::-webkit-scrollbar {
  width: 0;
  height: 0;
  display: none;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  overflow-x: hidden;
  font-family: var(--font-main);
  transition: background 0.4s ease, color 0.4s ease;
  -webkit-font-smoothing: antialiased;
  -ms-overflow-style: none;
}

/* =========================================================
   4) CURSOR
========================================================= */
.custom-cursor {
  position: fixed;
  width: 24px;
  height: 24px;
  background: var(--hover);
  border-radius: 50%;
  pointer-events: none;
  z-index: 10000;
  transform: translate(-50%, -50%) scale(1);
  transition: transform 0.12s cubic-bezier(0.23, 1, 0.32, 1);
}

.custom-cursor.hover {
  transform: translate(-50%, -50%) scale(1.8);
}

/* =========================================================
   5) P5 OVERLAY
========================================================= */
#p5-holder {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1000;
  transform: translateZ(0);
  -webkit-transform: translateZ(0);
}

#p5-holder canvas {
  display: block;
  background: transparent !important;
  transform: translateZ(0);
  -webkit-transform: translateZ(0);
}

/* =========================================================
   6) NAV
========================================================= */
.top-menu {
  position: fixed;
  top: var(--pad);
  left: var(--pad);
  right: var(--pad);
  display: grid;
  grid-template-columns: repeat(var(--cols), 1fr);
  column-gap: var(--gutter);
  align-items: center;
  z-index: 9000;
  color: var(--text);
}

.brand {
  grid-column: 1 / span 4;
  font-size: 16px;
}

.brand-link {
  text-decoration: none;
  color: inherit;
  transition: color 0.2s ease;
}

.brand-link:hover {
  color: var(--hover);
}

.menu-projects {
  grid-column: 9;
  position: relative;
  justify-self: start;
}

.projects-trigger {
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  transition: color 0.2s ease;
}

.menu-projects:hover .projects-trigger {
  color: var(--hover);
}

.projects-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  background: transparent;
  padding: 16px 0 8px;
  min-width: 220px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: all 0.3s cubic-bezier(0.23, 1, 0.32, 1);
}

.menu-projects:hover .projects-dropdown {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.project-link {
  display: block;
  text-decoration: none;
  color: var(--text);
  font-size: 16px;
  line-height: 1.4;
  padding: 2px 0;
  transition: color 0.2s ease;
}

.project-link:hover {
  color: var(--hover);
}

.lets-chat {
  grid-column: 10;
  justify-self: end;
  text-decoration: none;
  background: var(--hover);
  color: #fff;
  font-size: 16px;
  line-height: 1;
  padding: 3px 10px;
  transition: opacity 0.2s ease, color 0.2s ease;
}

.lets-chat:hover {
  opacity: 0.9;
  color: #000;
}

.lang-switch {
  grid-column: 11;
  justify-self: end;
  font-size: 16px;
  line-height: 1;
  display: flex;
  align-items: center;
  gap: 4px;
}

.lang-btn {
  cursor: pointer;
  transition: color 0.2s ease;
  color: var(--text);
}

.lang-btn.active {
  color: var(--hover);
}

.lang-btn:not(.active):hover {
  color: var(--hover);
}

.lang-separator {
  color: var(--text);
  pointer-events: none;
}

.theme-switch {
  grid-column: 12;
  justify-self: end;
  width: 36px;
  height: 20px;
  position: relative;
  background: transparent;
  border-radius: 10px;
  border: 1px solid transparent;
  transition: background 0.3s ease, border-color 0.3s ease;
}

.theme-switch:hover {
  background: rgba(128, 128, 128, 0.15);
  border-color: var(--hover);
}

.switch-ball {
  width: 14px;
  height: 14px;
  background: var(--text);
  border-radius: 50%;
  position: absolute;
  top: 2px;
  left: 2px;
  transform: translateX(var(--ball-x));
  transition: transform 0.4s cubic-bezier(0.23, 1, 0.32, 1), background 0.2s ease;
  will-change: transform;
}

.theme-switch:hover .switch-ball {
  background: var(--hover);
}

/* =========================================================
   7) CONTENT WRAPPER
========================================================= */
.content {
  position: relative;
  z-index: 1;
  padding-bottom: var(--anchor-point);
}

/* =========================================================
   8) HERO
========================================================= */
.hero {
  display: grid;
  grid-template-columns: repeat(var(--cols), 1fr);
  padding: var(--pad);
  margin-top: 50px;
}

.intro {
  grid-column: 1 / span 8;
  font-size: 60px;
  line-height: 1;
  font-weight: 300;
  margin: 0;
}

.hero-line {
  grid-column: 1 / -1;
  width: 100vw;
  margin-left: calc(-1 * var(--pad));
  margin-top: 310px;
  height: 1px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: left;
  position: relative;
  animation: lineIn 3.6s cubic-bezier(0.6, 0, 0, 1) 0.4s forwards;
}

.shot {
  position: absolute;
  top: 50%;
  max-width: 320px;
  opacity: 0;
  pointer-events: none;
  animation: fadeIn 0.8s ease-out forwards;
}

/* =========================================================
   9) ABOUT
========================================================= */
.about-section {
  display: flex;
  flex-direction: column;
  gap: 6vh;
  padding: 0 var(--pad);
  margin-top: var(--space-hero-to-about);
}

.about-row {
  display: grid;
  grid-template-columns: repeat(var(--cols), 1fr);
  column-gap: var(--gutter);
  align-items: baseline;
}

.about-title {
  grid-column: 1 / span 2;
  margin: 0;
  font-size: 48px;
  font-weight: 300;
  line-height: 1;
}

.label-edu,
.label-work {
  grid-column: 5 / span 2;
  margin: 0;
  font-size: 19px;
  font-weight: 360;
  line-height: 1;
}

.about-description {
  grid-column: 5 / span 8;
  margin: 0;
  font-size: 38px;
  font-weight: 300;
  line-height: 1.2;
}

.content-edu,
.content-work {
  grid-column: 7 / span 6;
  margin: 0;
  font-size: 19px;
  font-weight: 360;
  line-height: 1.3;
}

/* =========================================================
   10) ACCORDION
========================================================= */
.exp-row {
  padding: 10px 0;
  border-bottom: 0.5px solid currentColor;
}

.exp-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 19px;
  font-weight: 380;
  transition: color 0.3s ease;
  cursor: pointer;
}

.exp-row:hover .exp-header {
  color: var(--hover);
}

.exp-header .icon {
  transition: transform 0.3s cubic-bezier(0.23, 1, 0.32, 1);
  display: inline-block;
}

.exp-row.active .exp-header .icon {
  transform: rotate(45deg);
}

.exp-details {
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  font-size: 15px;
  line-height: 1.5;
  transition: all 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.exp-row.active .exp-details {
  max-height: 900px;
  opacity: 1;
  margin-top: 20px;
}

/* =========================================================
   11) PROJECTS (Horizontal)
========================================================= */
.horizontal-scroll-container {
  position: relative;
  margin-top: var(--space-about-to-projects);
}

.projects-section {
  display: grid;
  grid-template-columns: repeat(var(--cols), 1fr);
  padding: 0 var(--pad);
  margin-bottom: 0;
}

.projects-title {
  grid-column: 1 / -1;
  font-size: 48px;
  font-weight: 300;
  margin: 0;
  line-height: 1;
  white-space: nowrap;
}

#projects {
  scroll-margin-top: calc(var(--anchor-point) + var(--projects-anchor-extra));
}

.sticky-wrapper {
  display: block;
  position: relative;
  background: var(--bg);
  margin-top: var(--space-title-to-images);
}

.projects-wrapper {
  display: flex;
  width: max-content;
  padding-left: var(--pad);
  padding-right: 1.5vw;
  will-change: transform;
  transform: translateZ(0);
  -webkit-transform: translateZ(0);
}

.projects-line-container {
  padding: 0 var(--pad);
  margin-top: var(--space-images-to-bar);
}

/* =========================================================
   PROGRESS BAR ORIZZONTALE
========================================================= */
.projects-line-track {
  width: 100%;
  height: 2px;
  background: rgba(255, 255, 255, 0.2);
  position: relative;
  overflow: hidden;
}

html.light-mode .projects-line-track {
  background: rgba(0, 0, 0, 0.15);
}

.projects-line-progress {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  width: 5%;
  min-width: 60px;
  background: #ff0000;
  transition: width 0.05s linear;
}

/* =========================================================
   PROJECT ITEMS
========================================================= */
.project-item {
  position: relative;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  gap: 28px;
  width: calc(((100vw - (var(--pad)*2) - (var(--gutter)*11)) / 12 * 3) + (var(--gutter)*2));
  margin-right: var(--gutter);
  padding-left: 18px;
  font-weight: 400;
  line-height: 1.2;
}

.project-item:last-child {
  margin-right: 0;
}

.project-item::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 1px;
  background: rgba(255, 255, 255, 0.4);
  pointer-events: none;
}

html.light-mode .project-item::before {
  background: rgba(0, 0, 0, 0.25);
}

.project-top {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.project-title {
  font-size: 24px;
  font-weight: 400;
  text-transform: none;
  margin: 0;
  line-height: 1;
}

.project-desc {
  font-size: 15px;
  font-weight: 300;
  line-height: 1.4;
  margin: 0;
  opacity: 0.75;
}

#projects .project-media {
  width: 100%;
  aspect-ratio: 16 / 10;
  background: rgba(128, 128, 128, 0.18);
  position: relative;
  overflow: hidden;
  margin-bottom: 10px;
}

html.light-mode #projects .project-media {
  background: rgba(0, 0, 0, 0.06);
}

#projects .project-media img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 0.25s ease;
}

#projects .project-media img.is-active {
  opacity: 1;
}

.project-number {
  font-size: 24px;
  font-weight: 400;
  line-height: 1;
  margin-top: auto;
  padding-top: 18px;
}

.project-arrow {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 66px;
}

.project-arrow svg {
  width: 100%;
  height: 100%;
  display: block;
}

.project-arrow path {
  stroke-width: 2px;
  stroke: currentColor;
}

.project-date {
  font-family: "Archivo", sans-serif;
  font-size: 16px;
  font-weight: 300;
  font-style: italic;
  line-height: 1;
  opacity: 0.8;
  margin-bottom: 14px;
}

.project-item:hover .project-arrow path {
  stroke: var(--hover);
}

.project-item:hover .project-title {
  color: var(--hover);
}

.project-link-wrapper {
  text-decoration: none;
  color: inherit;
  display: block;
  width: 100%;
  height: 100%;
  cursor: pointer;
}

/* =========================================================
   12) CONTACT & DOWNLOAD
========================================================= */
#contact {
  scroll-margin-top: var(--anchor-point);
}

.contact-section {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  column-gap: var(--gutter);
  padding: 0 var(--pad);
  margin-top: 12vh;
  color: var(--text);
  align-items: baseline;
}

.contact-title {
  grid-column: 1 / span 4;
  font-size: 48px;
  font-weight: 300;
  line-height: 1;
  margin: 0;
}

.contact-intro {
  grid-column: 1 / span 7;
  font-size: 34px;
  font-weight: 300;
  line-height: 1.1;
  margin-top: 60px;
}

.contact-email {
  color: #9b9b9b;
  text-decoration: none;
  transition: color 0.3s ease;
}

.contact-email:hover {
  color: var(--hover);
}

.download-section {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  column-gap: var(--gutter);
  padding: 0 var(--pad);
  margin-top: 20px;
  margin-bottom: 20vh;
}

/* wrapper reale dei link (assicurati sia presente in HTML) */
.download-list {
  grid-column: 1 / span 7;
  display: flex;
  flex-direction: row;
  align-items: baseline;
  gap: 60px;
}

.download-link {
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
  text-decoration: none;
  color: #9b9b9b;
  font-size: 34px;
  font-weight: 300;
  transition: color 0.3s ease;
  /* hover */
  white-space: nowrap;
}

.download-link:hover {
  color: var(--hover);
}

.download-arrow {
  display: inline-flex;
  width: 22px;
  height: 22px;
  transform: translateY(4px);
  transition: transform 0.3s ease, color 0.3s ease;
}

.download-arrow svg {
  width: 100%;
  height: auto;
  display: block;
  stroke: currentColor;
}

/* =========================================================
   13) ANIMATIONS
========================================================= */
@keyframes lineIn {
  to {
    transform: scaleX(1);
  }
}

@keyframes fadeIn {
  to {
    opacity: 1;
  }
}

/* =========================================================
   REVEAL (single source of truth)
   - JS aggiunge .is-visible al wrapper
   - CSS anima i figli/elementi
========================================================= */

/* stato iniziale */
.about-row>*,
.exp-row,
.project-item,
.projects-title,
.contact-section>*,
.download-section .download-link {
  opacity: 0;
  transform: translateY(var(--reveal-y));
  transition:
    opacity var(--reveal-dur) var(--reveal-ease),
    transform var(--reveal-dur) var(--reveal-ease),
    color 0.3s ease;
  transition-delay: var(--delay, 0ms);
  will-change: opacity, transform;
}

/* stato visibile */
.about-row.is-visible>*,
.exp-row.is-visible,
.project-item.is-visible,
.projects-title.is-visible,
.contact-section.is-visible>*,
.download-section.is-visible .download-link {
  opacity: 1;
  transform: translateY(0);
}

/* Accessibilità */
@media (prefers-reduced-motion: reduce) {

  .about-row>*,
  .exp-row,
  .project-item,
  .projects-title,
  .contact-section>*,
  .download-section .download-link {
    transition: none;
    opacity: 1;
    transform: none;
    filter: none;
  }
}

/* =========================================================
   14) RESPONSIVE — TOUCH DEVICES
========================================================= */
@media (hover: none),
(pointer: coarse) {
  * {
    cursor: auto !important;
  }

  .custom-cursor {
    display: none !important;
  }
}

/* =========================================================
   15) RESPONSIVE — TABLET (≤ 1024px)
========================================================= */
@media (max-width: 1024px) {
  :root {
    --pad: 20px;
    --gutter: 14px;
    --space-hero-to-about: 35vh;
    --space-about-to-projects: 22vh;
  }

  /* Nav — compact */
  .top-menu {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    top: var(--pad);
    left: var(--pad);
    right: var(--pad);
  }

  .brand {
    flex: 1 1 auto;
  }

  .menu-projects {
    order: 2;
  }

  .lets-chat {
    order: 3;
  }

  .lang-switch {
    order: 4;
  }

  .theme-switch {
    order: 5;
  }

  /* Hero */
  .intro {
    font-size: 46px;
    grid-column: 1 / -1;
  }

  .hero-line {
    margin-top: 200px;
  }

  .shot {
    max-width: 240px;
  }

  /* About */
  .about-title {
    grid-column: 1 / span 4;
    font-size: 38px;
  }

  .about-description {
    grid-column: 1 / -1;
    font-size: 30px;
  }

  .label-edu,
  .label-work {
    grid-column: 1 / span 3;
  }

  .content-edu,
  .content-work {
    grid-column: 4 / -1;
  }

  /* Projects */
  .projects-title {
    font-size: 38px;
  }

  .project-item {
    width: calc(40vw);
  }

  /* Contact */
  .contact-title {
    font-size: 38px;
    grid-column: 1 / span 5;
  }

  .contact-intro {
    grid-column: 1 / -1;
    font-size: 28px;
    margin-top: 40px;
  }

  /* Download */
  .download-list {
    grid-column: 1 / -1;
    gap: 40px;
  }

  .download-link {
    font-size: 28px;
  }
}

/* =========================================================
   16) RESPONSIVE — SMALL TABLET (≤ 768px)
========================================================= */
@media (max-width: 768px) {
  :root {
    --pad: 16px;
    --gutter: 12px;
    --space-hero-to-about: 28vh;
    --space-about-to-projects: 18vh;
    --pause-start: 10vh;
    --pause-end: 10vh;
  }

  /* Nav */
  .top-menu {
    gap: 10px;
  }

  .brand {
    font-size: 15px;
  }

  .projects-trigger {
    font-size: 14px;
  }

  .lets-chat {
    font-size: 14px;
    padding: 3px 8px;
  }

  .lang-switch {
    font-size: 14px;
  }

  /* Hero */
  .hero {
    margin-top: 60px;
  }

  .intro {
    font-size: 34px;
  }

  .hero-line {
    margin-top: 150px;
  }

  .shot {
    max-width: 180px;
  }

  /* About */
  .about-row {
    display: flex;
    flex-direction: column;
    gap: 16px;
  }

  .about-title {
    font-size: 32px;
  }

  .about-description {
    font-size: 26px;
  }

  .label-edu,
  .label-work {
    font-size: 17px;
  }

  .content-edu,
  .content-work {
    font-size: 17px;
  }

  /* Accordion */
  .exp-header {
    font-size: 17px;
  }

  .exp-details {
    font-size: 14px;
  }

  /* Projects */
  .projects-title {
    font-size: 32px;
  }

  .project-item {
    width: calc(65vw);
    gap: 20px;
  }

  .project-title {
    font-size: 20px;
  }

  .project-desc {
    font-size: 14px;
  }

  .project-number {
    font-size: 20px;
  }

  .project-arrow {
    width: 28px;
    height: 50px;
  }

  /* Contact */
  .contact-section {
    display: flex;
    flex-direction: column;
    gap: 16px;
  }

  .contact-title {
    font-size: 32px;
  }

  .contact-intro {
    font-size: 24px;
    margin-top: 20px;
  }

  /* Download */
  .download-section {
    display: flex;
    flex-direction: column;
    padding: 0 var(--pad);
  }

  .download-list {
    flex-direction: column;
    gap: 20px;
  }

  .download-link {
    font-size: 24px;
  }
}

/* =========================================================
   17) RESPONSIVE — MOBILE (≤ 480px)
========================================================= */
@media (max-width: 480px) {
  :root {
    --pad: 14px;
    --gutter: 10px;
    --anchor-point: 8vh;
    --space-hero-to-about: 20vh;
    --space-about-to-projects: 14vh;
    --space-title-to-images: 6vh;
    --pause-start: 6vh;
    --pause-end: 6vh;
  }

  /* Nav */
  .top-menu {
    gap: 8px;
  }

  .brand {
    font-size: 14px;
    flex-basis: 100%;
  }

  .projects-trigger {
    font-size: 13px;
  }

  .lets-chat {
    font-size: 13px;
    padding: 2px 7px;
  }

  .lang-switch {
    font-size: 13px;
  }

  .theme-switch {
    width: 32px;
    height: 18px;
  }

  .switch-ball {
    width: 12px;
    height: 12px;
  }

  /* Hero */
  .hero {
    margin-top: 70px;
  }

  .intro {
    font-size: 26px;
  }

  .hero-line {
    margin-top: 100px;
  }

  .shot {
    max-width: 140px;
  }

  /* About */
  .about-title {
    font-size: 26px;
  }

  .about-description {
    font-size: 22px;
  }

  .label-edu,
  .label-work {
    font-size: 15px;
  }

  .content-edu,
  .content-work {
    font-size: 15px;
  }

  /* Accordion */
  .exp-header {
    font-size: 15px;
  }

  .exp-details {
    font-size: 13px;
  }

  /* Projects */
  .projects-title {
    font-size: 26px;
  }

  .project-item {
    width: calc(82vw);
    gap: 16px;
    padding-left: 14px;
  }

  .project-title {
    font-size: 18px;
  }

  .project-desc {
    font-size: 13px;
  }

  .project-number {
    font-size: 18px;
    padding-top: 12px;
  }

  .project-date {
    font-size: 14px;
  }

  .project-arrow {
    width: 24px;
    height: 40px;
  }

  /* Contact */
  .contact-title {
    font-size: 26px;
  }

  .contact-intro {
    font-size: 20px;
  }

  /* Download */
  .download-link {
    font-size: 20px;
  }

  .download-arrow {
    width: 18px;
    height: 18px;
  }
}