@font-face {
  font-family: 'Century Gothic';
  src: url('../font/CenturyGothic-Bold.woff2') format('woff2'),
    url('../font/CenturyGothic-Bold.woff') format('woff');
  font-weight: bold;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Century Gothic';
  src: url('../font/CenturyGothic.woff2') format('woff2'),
    url('../font/CenturyGothic.woff') format('woff');
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

/* space-grotesk-regular - latin */
@font-face {
  font-display: swap; /* Check https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/font-display for other options. */
  font-family: 'Space Grotesk';
  font-style: normal;
  font-weight: 400;
  src: url('../fonts/space-grotesk-v22-latin-regular.woff2') format('woff2'); /* Chrome 36+, Opera 23+, Firefox 39+, Safari 12+, iOS 10+ */
}

:root {
  color-scheme: light;
  --bg: #f7f1e8;
  --paper: #f8f8f0;
  --paper2: #faf9f4;
  --ink: #323a3e;
  --ink2: #677073;
  --btn: #edede6;
  --pink: #e88271;
  --ruota: #fefef2;

  --muted: #6f5c4f;
  --accent: #e88271;
  --accent-soft: #ffd2b5;
  --surface: #faf9f4;
  --surface-strong: #f0e2d3;
  --shadow: 0 20px 60px rgba(24, 20, 15, 0.16);
  --radius: 26px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  line-height: 1.2em;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Space Grotesk', system-ui, sans-serif;
  background: linear-gradient(0, var(--paper2), var(--paper));
  color: var(--ink);
  line-height: 1.6;
  min-height: 100vh;

  &.gallery-open {
    overflow: hidden;
  }
}

button {
  border: 0;
  background: transparent;
}

.t-right {
  text-align: right;
}

h3 {
  font-family: 'Century Gothic', serif;
  text-transform: uppercase;
  font-size: 1.4rem;
}

.site-noise {
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0;
  background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="120" height="120" viewBox="0 0 120 120"><filter id="n"><feTurbulence type="fractalNoise" baseFrequency="0.8" numOctaves="2"/></filter><rect width="120" height="120" filter="url(%23n)" opacity="0.4"/></svg>');
  mix-blend-mode: multiply;
  z-index: 1;
}

main {
  z-index: 2;
}


.hero {
  position: relative;
  padding: 80px 6vw;
  background-color: var(--paper);
  background-image: url(../img/paper.jpg);
  background-repeat: no-repeat;
  background-position: bottom right;
  background-size: cover;

  .hero-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 40px;
    max-width: 1200px;
    margin: 0 auto;
    align-items: center;
    position: relative;
  }

  .eyebrow {
    font-family: 'Century Gothic', serif;
    font-size: 1rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--pink);
    margin-bottom: 14px;
    text-align: left;
    margin-left: 8px;
  }

  &:after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    height: 20%;
    width: 100%;
    background: linear-gradient(0deg, var(--paper), transparent);
    pointer-events: none;
  }


  .hero-text {
    h1 {
      margin: 20px 0;
      position: relative;
      display: block;
    }
  }

  .hero-bkg {
    width: 100%;
  }


  .logo {
    font-family: 'Century Gothic', serif;
    font-size: 1.1rem;
    color: var(--ink);
    text-decoration: none;
  }
}

.nav {
  font-family: 'Century Gothic', serif;
  font-size: 1rem;
  letter-spacing: 0.1em;
  color: var(--ink);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  text-transform: uppercase;
  margin: 0 auto;
  max-width: 1200px;
  z-index: 10;
  position: relative;

  a {
    color: var(--ink);
    text-decoration: none;
    transition: color 0.2s ease;
    position: relative;

    &.is-selected {
      color: var(--pink);
    }

    &:hover,
    &.is-selected {
      color: var(--accent);


      &::after {
        content: '';
        position: absolute;
        left: 0;
        bottom: -6px;
        width: 100%;
        height: 1px;
        background: var(--accent);
        border-radius: 999px;
      }
    }
  }


  .nav-links {
    display: flex;
    gap: 18px;
    flex-wrap: wrap;
  }

}


.section {
  padding: 140px 6vw 100px;

  .section-title {
    display: flex;
    align-items: baseline;
    margin-bottom: 48px;
    flex-direction: column;
    font-family: 'Century Gothic', serif;
    max-width: 1200px;
    margin: 0 auto;

    p {
      text-transform: uppercase;
      letter-spacing: 0.1em;
      font-size: 1rem;
      color: var(--pink);
    }

    h2 {

      font-size: clamp(1.8rem, 3vw, 2.6rem);
      text-transform: uppercase;
      margin-bottom: 48px;
    }

    h2::after {
      content: "";
      display: block;
      width: 90px;
      height: 1px;
      background: var(--accent);
      margin-top: 10px;
    }
  }

  .section-content {
    max-width: 1200px;
    margin: 0 auto;
  }
}


.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 41px;
  margin: 0 auto;
}

.project-card {
  padding: 22px;
  display: grid;
  gap: 16px;
  position: relative;
  cursor: pointer;
  transition: .3s;

  h3 {
    display: flex;
    align-items: center;
    gap: 8px;
  }


  .thumb {
    position: relative;
    width: calc(100% + 44px);
    margin-top: -22px;
    margin-left: -22px;
    height: 260px;

    img {
      width: 100%;
      height: 100%;

      object-fit: cover;
      border-radius: var(--radius);
      box-shadow: var(--shadow);
    }


    .plus {
      position: absolute;
      bottom: 16px;
      right: 16px;
      width: 32px;
      height: 32px;
      background-color: var(--pink);
      color: var(--paper);
      border-radius: 100%;
      padding: 8px;
      cursor: pointer;
    }

  }

  span {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--muted);
  }

  &:hover {
    transform: translateY(-8px);
  }
}


.box-wrapper {
  display: flex;
  position: relative;

  .box-note {
    padding: 80px;
    top: 40px;
    left: 60%;
    height: 100%;
    width: 30%;
    z-index: -1;
  }
}


.box-row {
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 0 auto;

  &+.box-row {
    margin-top: 40px;
  }
}

.esplorazioni-urbane {
  h2 {
    position: relative;
    color: #000;

    .esplorazioni-urbane-title {
      position: absolute;
      width: 130px;
      right: 109px;
      bottom: -26px;
    }
  }

  .slider {
    position: relative;
    width: 100%;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    display: block;
  }


  .box-1 {
    z-index: 1;
    width: 60%;
    aspect-ratio: 1;
  }

  .box-2 {
    width: 40%;
    position: relative;
    padding: 40px;
    border-radius: 0 40px 40px 0;
  }

  .box-3 {
    width: 40%;
    z-index: 0;
    padding: 40px;
    border-radius: 40px 0 0 40px;
  }

  .box-4 {
    z-index: 1;
    width: 60%;
    aspect-ratio: 1200 / 930;
  }
}

.illustrazione-scientifica {
  background: linear-gradient(0deg, var(--ruota), var(--paper2));

  h2 {
    position: relative;

    .illustrazione-scientifica-title {
      position: absolute;
      width: 100px;
      right: -68px;
      bottom: -6px;
    }
  }

  .box-row {
    gap: 40px;

    .slider {
      width: 50%;
      aspect-ratio: 850 / 1200;
      border-radius: var(--radius);
      box-shadow: var(--shadow);
      display: block;
    }
  }

  .farfalla-container {
    display: flex;
    flex-wrap: wrap;
    gap: 40px;
    justify-content: flex-start;
    align-content: flex-start;
    flex: 1;

    .farfalla {
      width: calc(50% - 20px);
      aspect-ratio: 1;
      background-size: cover;
      background-position: center;
      border-radius: 16px;
      box-shadow: var(--shadow);
      transition: transform 0.3s ease, box-shadow 0.3s ease;
    }
  }
}

.scaranocchio {
  color: #000;

  h2 {
    position: relative;
    color: #000;

    .scaranocchio-title {
      position: absolute;
      width: 140px;
      right: -70px;
      bottom: 10px;
    }
  }

  .slider {
    position: relative;
    width: 100%;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    display: block;
  }


  .box-1 {
    z-index: 1;
    width: 60%;
    aspect-ratio: 1135 / 680;
  }

  .box-2 {
    width: 40%;
    position: relative;
    padding: 40px;
    border-radius: 0 40px 40px 0;
  }

  .box-3 {
    width: 30%;
    z-index: 0;
    padding: 40px;
    border-radius: 40px 0 0 40px;
  }

  .box-4 {
    z-index: 1;
    aspect-ratio: 1135 / 680;
    width: 70%;
  }
}

.ruota-stagioni {
  background-color: var(--ruota);
}

.ruota-container {
  margin: 0 auto;
  display: flex;
  justify-content: center;
}

.ruota-viewer {
  position: relative;
  max-width: 1000px;
  width: 100%;
  aspect-ratio: 1;
  background: var(--bg);
  border-radius: 100%;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ruota-image {
  width: 100%;
  height: 100%;
  object-fit: contain;
  transition: transform 0.1s ease-out;
  user-select: none;
  -webkit-user-drag: none;
}

.ruota-text {
  display: flex;
  margin: 56px auto 0;
  justify-content: center;

  img {
    width: 80%;
  }
}

.collaborazioni {
  background: linear-gradient(0deg, var(--paper2), var(--ruota));
}

.slider {
  position: relative;
  overflow: hidden;
  height: 100%;

  .slider-track {
    display: flex;
    height: 100%;
    transition: transform 0.4s ease;
  }

  .slider-slide {
    flex: 0 0 100%;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
  }

  .slider-controls {
    position: absolute;
    right: 0;
    bottom: 0;
    display: flex;
    gap: 4px;
    padding: 12px 12px;

    &.top {
      bottom: auto;
      top: 0;
    }

    button {
      width: 32px;
      height: 32px;
      background-color: var(--pink);
      border-radius: 100%;
      padding: 8px;
      margin-top: 4px;
      margin-right: 4px;
      cursor: pointer;

    }
  }
}

.box-note {
  margin: 0;
  font-size: 1.02rem;
  line-height: 1.7;
  color: var(--ink);

  .en {
    line-height: 1.7;
  }
}

.en {
  display: inline-block;
  font-style: italic;
  margin-top: 8px;
  opacity: .6;
}

.cv {
  h3 {
    margin-bottom: 16px;
  }
}

.cv-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 26px;
}

.cv-timeline {
  position: relative;
  /* padding-left: 26px; */
  margin-bottom: 40px;

  /* &::before {
    content: '';
    position: absolute;
    top: 10px;
    bottom: 6px;
    left: 12px;
    width: 2px;
    background: rgba(20, 22, 24, 0.12);
  } */
}

.cv-item {
  position: relative;
  display: flex;
  gap: 6px;
  margin-bottom: 16px;

  /* &::before {
    content: '';
    position: absolute;
    left: -17px;
    top: 9px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 0 4px rgba(184, 150, 92, 0.25);
  } */

  p {
    margin: 0;
    color: var(--ink);
  }
}

.cv-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.cv-year {
  align-self: flex-start;
  justify-self: start;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--pink);
  color: var(--paper);
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.cv-en {
  color: var(--muted);
  font-style: italic;
}

.gallery-modal {
  position: fixed;
  inset: 0;
  background: rgba(10, 10, 10, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 999;
  opacity: 0;
  pointer-events: none;
  transition: opacity 240ms ease;

  &[hidden] {
    display: none;
  }

  &.is-open {
    opacity: 1;
    pointer-events: auto;
  }

  &.is-closing {
    opacity: 0;
    pointer-events: none;
  }
}

.gallery-dialog {
  background: var(--paper);
  width: min(96vw, 980px);
  border-radius: var(--radius);
  overflow: hidden;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
  box-shadow: none;
  height: 95vh;
  transform: translateY(18px) scale(0.98);
  opacity: 0;
  transition: transform 260ms ease, opacity 260ms ease;
  will-change: transform, opacity;
}

.gallery-modal.is-open .gallery-dialog {
  transform: translateY(0) scale(1);
  opacity: 1;
}

.gallery-modal.is-closing .gallery-dialog {
  transform: translateY(10px) scale(0.98);
  opacity: 0;
}

@media (prefers-reduced-motion: reduce) {

  .gallery-modal,
  .gallery-dialog,
  .gallery-main {
    transition: none;
  }
}

.gallery-footer {
  display: flex;
  justify-content: center;
  flex-direction: column;
  padding: 0 40px 32px;
}

.gallery-title {
  font-family: 'Century Gothic', serif;
  font-size: 2rem;
  margin-bottom: 24px;
  margin-right: 40px;
}

.gallery-title::after {
  content: "";
  display: block;
  width: 90px;
  height: 1px;
  background: var(--accent);
  margin-top: 10px;
}

.gallery-title-container {
  display: flex;
  align-items: flex-start;

  img {
    width: 32px;
    height: 32px;
    background-color: var(--pink);
    border-radius: 100%;
    padding: 8px;
    margin-top: 4px;
    margin-right: 4px;
    cursor: pointer;
  }
}

.gallery-desc {
  font-size: 1rem;
  max-height: 300px;
  overflow-y: scroll;
}

.gallery-main {
  align-items: center;
  gap: 12px;
  flex: 1;
  position: relative;
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  filter: drop-shadow(var(--shadow));
  margin: 40px;
  transition: transform 160ms ease;
  will-change: opacity, transform;
}

.gallery-main.is-transitioning {
  opacity: 1;
  transform: translateX(2px);
}

.footer {
  background-color: var(--paper2);
  padding: 70px;
  max-width: 1240px;
  margin: 160px auto 0;
  color: var(--ink);
  position: relative;
  overflow: hidden;



  &.section{
    .section-title {
    margin-bottom: 0px;
    z-index: 1;
    position: relative;

    h2::after {
        background-color: var(--ink);
      }

    p {
      color: var(--ink);
    }
  }

  }


  a {
    color: var(--ink);
    text-decoration: underline;
  }

  .footer-background {
    position: absolute;
    pointer-events: none;
    width: 100%;
    height: 100%;
    margin: 0 auto;
    left: 0;
    right: 0;
    top: 0;
    background-image: url(../img/footer-background.jpg);
    background-position: top center;
    background-repeat: no-repeat;
    background-size: cover;

    mix-blend-mode: darken;
    z-index: 0;
  }

  .footer-profile {
    display: flex;
    align-items: center;
    gap: 20px;
    z-index: 1;
    position: relative;
  }

  .footer-profile-img {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    z-index: 1;
  }

  .footer-note {
    font-size: 0.95rem;
    color: var(--ink);
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
            width: 50%;
  }


  .footer-grid {
    display: flex;
    justify-content: space-between;
    gap: 26px;
  }

}

@media (max-width: 1440px) {
  .section {
    padding-top: 160px;
  }
}

@media (max-width: 1024px) {

  .t-right{
    text-align: left;
  }

  .section {
    padding-top: 56px;
    padding-bottom: 24px;
  }

  .hero {
    padding-top: 40px;
    padding-bottom: 80px;
  }

  .box-row {
    flex-direction: column;
    margin-bottom: 56px;

    .box {
      width: 100%;
      padding: 0;
    }

    .box-note {
      margin-top: 56px;
    }
  }

  .box-row+.box-row {
    margin-top: 0px;
  }

  .esplorazioni-urbane {
    .box-3 {
      order: 2;
    }
  }

  .scaranocchio {
    .box-3 {
      order: 2;
    }
  }

  .illustrazione-scientifica {
    .box-row {
      flex-direction: row;
    }
  }
      .footer {
      padding: 70px 6vw;
      }
}

@media (max-width: 768px) {
  .hero {
    .eyebrow {
      text-align: center;
    }

    .hero-bkg {
      width: calc(100% + 12vw);
      margin: 0 -6vw;
    }
  }

  .nav {

    align-items: flex-start;

    .nav-links {
      width: 100%;
      flex-direction: column;
      align-items: center;
      margin-top: 32px;
    }
  }

  .illustrazione-scientifica {
    .box-row {
      width: 100%;
      flex-direction: column;

      .slider {
        width: 100%;
      }
    }

    .farfalla-container {
      width: 100%;
    }



    .gallery-dialog {
      padding: 0;
    }

    .gallery-nav {
      width: 32px;
      height: 32px;
      font-size: 1.2rem;
    }
  }

  .gallery-dialog{
    gap: 0;
  }

  .gallery-main{
    margin: 24px;
  }

  .gallery-footer{
    padding: 0 24px 24px;
  }

  .gallery-title-container{
    flex-wrap: wrap;

    .gallery-title{
      font-size: 1.2rem;
      margin-top: 8px;
      margin-bottom: 16px;
      margin-right: 0;
      width: 100%;
      order: 10;
    }
  }
  .gallery-desc{
      max-height: 20vh;
  }


    .footer {

      .footer-grid {
        flex-direction: column;
      }
      .footer-profile{
        justify-content: flex-start;
      }
      .footer-note{
        justify-content: flex-start;
      }
    }
}

@media (max-width: 425px) {
  .box-row {
    gap: 24px;
  }

  .illustrazione-scientifica {
    .box-row {
      gap: 24px;
    }

    .farfalla-container {
      flex-direction: column;
      gap: 24px;

      .farfalla {
        width: 100%;
      }
    }
  }
}