:root {
  color-scheme: light;
  font-family: 'Familjen Grotesk', sans-serif;
  background: #f7f6f2;
  color: #111110;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  min-height: 100%;
  scroll-behavior: smooth;
}

body {
  background: #f7f6f2;
  color: #111110;
  overflow-x: hidden;
}

a {
  color: #111110;
  text-decoration: none;
}

a:hover {
  color: #6f6b63;
}

img, video {
  display: block;
  max-width: 100%;
}

::selection {
  background: #111110;
  color: #f7f6f2;
}

/* ---------- Top nav ---------- */

.topnav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 90;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 22px clamp(20px, 4vw, 56px);
  background: rgba(247, 246, 242, 0.9);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(17, 17, 16, 0.1);
}

.brand {
  font-weight: 700;
  letter-spacing: -0.01em;
  font-size: clamp(14px, 1.2vw, 16px);
}

.navlinks {
  display: flex;
  gap: clamp(18px, 2.4vw, 40px);
  font-weight: 500;
  font-size: clamp(12px, 1vw, 14px);
}

.navToggle {
  display: none;
}

.hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  cursor: pointer;
  padding: 4px;
}

.hamburger span {
  display: block;
  width: 22px;
  height: 2px;
  background: #111110;
}

.navRight {
  display: flex;
  align-items: center;
  gap: clamp(14px, 2vw, 24px);
}

.langToggle {
  appearance: none;
  border: 1px solid rgba(17, 17, 16, 0.25);
  border-radius: 999px;
  background: transparent;
  color: #111110;
  padding: 6px 13px;
  font-family: 'Familjen Grotesk', sans-serif;
  font-weight: 700;
  font-size: 11px;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
}

.langToggle:hover {
  background: #111110;
  color: #f7f6f2;
}

/* ---------- Hero ---------- */

.hero {
  min-height: 100vh;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: clamp(120px, 18vh, 190px) clamp(20px, 4vw, 56px) clamp(60px, 10vh, 100px);
  background: #ffffff;
}

.hero h1 {
  margin: 0 0 clamp(30px, 5vh, 54px);
  font-weight: 700;
  line-height: 0.95;
  letter-spacing: -0.03em;
  font-size: clamp(38px, 8.6vw, 140px);
  max-width: 15ch;
}

.fontCycle {
  display: inline-block;
  animation: fontCycle 7s steps(1) infinite;
}

@keyframes fontCycle {
  0%    { font-family: 'Familjen Grotesk', sans-serif; font-style: normal; }
  16.6% { font-family: 'Playfair Display', serif; font-style: italic; }
  33.3% { font-family: 'Space Mono', monospace; font-style: normal; }
  50%   { font-family: 'Bebas Neue', sans-serif; letter-spacing: 0.03em; }
  66.6% { font-family: 'Unbounded', sans-serif; letter-spacing: -0.02em; }
  83.3% { font-family: 'Caveat', cursive; }
  100%  { font-family: 'Familjen Grotesk', sans-serif; font-style: normal; }
}

.heroFoot {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 20px;
  flex-wrap: wrap;
}

.heroFoot p {
  margin: 0;
  font-size: clamp(15px, 1.3vw, 20px);
  line-height: 1.5;
  color: #4a473f;
  max-width: 44ch;
}

.cta-btn {
  text-decoration: none;
  padding: 15px 30px;
  background: #111110;
  color: #f7f6f2;
  font-weight: 600;
  font-size: 13px;
  letter-spacing: 0.02em;
  white-space: nowrap;
  transition: background 0.2s ease, color 0.2s ease;
}

.cta-btn:hover {
  background: #4a473f;
  color: #f7f6f2;
}

/* ---------- Servizi ---------- */

.section-servizi {
  padding: clamp(90px, 12vh, 140px) clamp(20px, 4vw, 56px) clamp(40px, 6vh, 60px);
}

.section-servizi h2,
.section-clienti h2,
.section-progetti h2,
.section-portfolio h2 {
  margin: 0 0 clamp(50px, 7vh, 80px);
  font-weight: 700;
  letter-spacing: -0.02em;
  font-size: clamp(28px, 4vw, 52px);
}

.svcRow {
  border-top: 1px solid rgba(17, 17, 16, 0.12);
}

.svcRow:last-child {
  border-bottom: 1px solid rgba(17, 17, 16, 0.12);
}

.svcRow summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 24px;
  padding: clamp(18px, 2.6vh, 26px) 0;
  transition: opacity 0.2s ease;
}

.svcRow summary::-webkit-details-marker {
  display: none;
}

.svcRow summary:hover {
  opacity: 0.55;
}

.svcTitle {
  font-weight: 500;
  font-size: clamp(17px, 1.8vw, 24px);
  letter-spacing: -0.005em;
}

.svcPlus {
  font-weight: 400;
  font-size: clamp(16px, 1.8vw, 22px);
  color: #6f6b63;
  transition: transform 0.25s ease;
  flex-shrink: 0;
  display: inline-block;
}

.svcRow[open] .svcPlus {
  transform: rotate(45deg);
}

.svcDesc {
  margin: 0;
  padding: 0 0 clamp(18px, 2.6vh, 26px);
  font-size: 14px;
  line-height: 1.5;
  color: #6f6b63;
  max-width: 46ch;
}

/* ---------- Clienti ---------- */

.section-clienti {
  padding: clamp(80px, 11vh, 120px) clamp(20px, 4vw, 56px);
}

.clientRow {
  display: flex;
  flex-wrap: wrap;
  gap: clamp(14px, 2vw, 26px);
  justify-content: center;
  align-items: center;
}

.logoTile {
  position: relative;
  flex: 0 0 auto;
}

.logoTile img {
  width: clamp(96px, 14vw, 150px);
  height: clamp(96px, 14vw, 150px);
  border-radius: 50%;
  object-fit: cover;
  filter: grayscale(1) contrast(1.05);
  opacity: 0.85;
  transition: opacity 0.25s ease, filter 0.25s ease;
}

.logoTile:hover img {
  opacity: 1;
  filter: grayscale(0) contrast(1.05);
}

.clName {
  position: absolute;
  left: 50%;
  top: 100%;
  transform: translate(-50%, 6px);
  white-space: nowrap;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: #111110;
  background: #f7f6f2;
  padding: 4px 10px;
  border: 1px solid rgba(17, 17, 16, 0.14);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.logoTile:hover .clName {
  opacity: 1;
  transform: translate(-50%, 10px);
}

.clientTags {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px 8px;
  margin-top: clamp(30px, 4vh, 44px);
}

.clientTags .tagLabel {
  font-weight: 600;
  font-size: 13px;
  color: #6f6b63;
  margin-right: 8px;
}

.clientTags span:not(.tagLabel) {
  font-size: 13px;
  color: #4a473f;
}

/* ---------- Progetti selezionati ---------- */

.section-progetti {
  padding: clamp(80px, 11vh, 120px) clamp(20px, 4vw, 56px);
}

.caseRow {
  border-top: 1px solid rgba(17, 17, 16, 0.14);
}

.caseRow.caseRowLast {
  border-bottom: 1px solid rgba(17, 17, 16, 0.14);
}

.caseGrid {
  display: grid;
  gap: clamp(24px, 4vw, 60px);
  padding: clamp(40px, 6vh, 64px) 0;
  align-items: center;
}

.caseGrid.imgRight {
  grid-template-columns: 1.1fr 0.9fr;
}

.caseGrid.imgLeft {
  grid-template-columns: 0.9fr 1.1fr;
}

.caseLink {
  text-decoration: none;
  color: inherit;
  display: block;
  transition: opacity 0.2s ease;
}

.caseLink:hover {
  opacity: 0.6;
  color: inherit;
}

.caseEyebrow {
  margin: 0 0 10px;
  font-size: 13px;
  color: #6f6b63;
}

.caseTitle {
  margin: 0;
  font-size: clamp(16px, 1.6vw, 22px);
  line-height: 1.4;
  max-width: 34ch;
}

.caseImg {
  aspect-ratio: 4 / 3;
  overflow: hidden;
  position: relative;
}

.caseImg img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  position: absolute;
  inset: 0;
  opacity: 0;
}

.caseImg img.slide4 { animation: caseSlideFade 16s infinite; }
.caseImg img.slide6 { animation: caseSlideFade6 24s infinite; }
.caseImg img.slide5 { animation: caseSlideFade5 20s infinite; }

@keyframes caseSlideFade {
  0%   { opacity: 1; }
  20%  { opacity: 1; }
  25%  { opacity: 0; }
  95%  { opacity: 0; }
  100% { opacity: 1; }
}

@keyframes caseSlideFade6 {
  0%   { opacity: 1; }
  14%  { opacity: 1; }
  17%  { opacity: 0; }
  99%  { opacity: 0; }
  100% { opacity: 1; }
}

@keyframes caseSlideFade5 {
  0%   { opacity: 1; }
  16%  { opacity: 1; }
  20%  { opacity: 0; }
  99%  { opacity: 0; }
  100% { opacity: 1; }
}

/* ---------- Portfolio (envelope) ---------- */

.section-portfolio {
  padding: clamp(80px, 11vh, 120px) clamp(20px, 4vw, 56px);
}

.portfolioBox {
  position: relative;
  overflow: hidden;
  height: 420px;
  transition: height 0.7s cubic-bezier(.2, .8, .2, 1);
  cursor: pointer;
}

.portfolioBox.open {
  overflow: visible;
  height: auto;
  cursor: default;
  padding: 16px 0;
}

.portfolioGrid {
  column-count: 4;
  column-gap: 10px;
}

.pfTile {
  display: block;
  break-inside: avoid;
  margin-bottom: 10px;
  overflow: hidden;
  will-change: transform;
  transform-origin: center center;
}

.pfTile img,
.pfTile video {
  width: 100%;
  height: auto;
  display: block;
}

@media (max-width: 900px) {
  .portfolioGrid {
    column-count: 3;
  }
}

@media (max-width: 640px) {
  .portfolioGrid {
    column-count: 2;
  }
}

.envelopeWrap {
  position: absolute;
  left: 50%;
  top: 110px;
  width: 280px;
  height: 180px;
  transform: translateX(-50%);
  z-index: 6;
  opacity: 1;
  transition: opacity 0.5s ease;
  transition-delay: 0s;
  pointer-events: none;
  perspective: 900px;
}

.portfolioBox.open .envelopeWrap {
  opacity: 0;
  transition-delay: 0.35s;
}

.envelopeBody {
  position: absolute;
  left: 0;
  top: 0;
  width: 280px;
  height: 180px;
  background: #111110;
  border-radius: 4px;
  box-shadow: 0 16px 34px rgba(17, 17, 16, 0.28);
  z-index: 1;
}

.envelopeBackTri {
  position: absolute;
  left: 0;
  top: 0;
  width: 0;
  height: 0;
  border-left: 140px solid transparent;
  border-right: 140px solid transparent;
  border-top: 88px solid #111110;
  z-index: 1;
}

.envelopeFlap {
  position: absolute;
  left: 0;
  top: 0;
  width: 280px;
  height: 92px;
  transform-origin: top center;
  transform: rotateX(0deg);
  transition: transform 0.75s cubic-bezier(.3, .9, .3, 1);
  z-index: 2;
}

.portfolioBox.open .envelopeFlap {
  transform: rotateX(-165deg);
}

.envelopeFlapInner {
  width: 0;
  height: 0;
  border-left: 140px solid transparent;
  border-right: 140px solid transparent;
  border-top: 92px solid #1d1d1a;
}

.portfolioHint {
  position: absolute;
  left: 0;
  right: 0;
  top: 350px;
  text-align: center;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: #6f6b63;
  opacity: 1;
  transition: opacity 0.4s;
  pointer-events: none;
}

.portfolioBox.open .portfolioHint {
  opacity: 0;
}

/* ---------- Contatto ---------- */

.section-contatto {
  padding: clamp(90px, 13vh, 150px) clamp(20px, 4vw, 56px) clamp(34px, 5vh, 56px);
  border-top: 1px solid rgba(17, 17, 16, 0.12);
}

.contact-intro {
  margin: 0 0 clamp(20px, 3vh, 28px);
  font-weight: 600;
  font-size: clamp(13px, 1.2vw, 16px);
  color: #6f6b63;
}

.section-contatto h2 {
  margin: 0 0 clamp(40px, 6vh, 60px);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 0.95;
  font-size: clamp(38px, 8vw, 120px);
  max-width: 16ch;
}

.contact-actions {
  display: flex;
  flex-wrap: wrap;
  gap: clamp(16px, 3vw, 32px);
  align-items: center;
  margin-bottom: clamp(50px, 7vh, 70px);
}

.contact-actions a {
  font-weight: 600;
  font-size: clamp(16px, 2vw, 24px);
  border-bottom: 2px solid #111110;
  padding-bottom: 4px;
}

.contact-links {
  display: flex;
  gap: 24px;
  font-weight: 600;
  font-size: 13px;
  margin-bottom: clamp(50px, 7vh, 70px);
}

.contact-footer {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 12px;
  color: #6f6b63;
  padding-top: 18px;
  border-top: 1px solid rgba(17, 17, 16, 0.12);
}

.section-contatto.contactProj h2 {
  font-size: clamp(34px, 6vw, 90px);
}

.section-contatto.contactProj .contact-footer {
  margin-top: clamp(50px, 7vh, 70px);
}

/* ---------- Project detail pages ---------- */

.projnav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 90;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 22px clamp(20px, 4vw, 56px);
  background: rgba(247, 246, 242, 0.9);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(17, 17, 16, 0.1);
}

.projnav .backlink {
  font-weight: 500;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.projnav .contactBtn {
  padding: 11px 20px;
  background: #111110;
  color: #f7f6f2;
  font-weight: 600;
  font-size: 12px;
}

.projHero {
  padding: clamp(120px, 18vh, 180px) clamp(20px, 4vw, 56px) clamp(50px, 8vh, 80px);
}

.projEyebrow {
  margin: 0 0 16px;
  font-weight: 600;
  font-size: 13px;
  letter-spacing: 0.04em;
  color: #6f6b63;
}

.projHero h1 {
  margin: 0 0 clamp(24px, 3vh, 36px);
  font-weight: 700;
  line-height: 0.98;
  letter-spacing: -0.03em;
  font-size: clamp(34px, 6.2vw, 88px);
  max-width: 18ch;
}

.projIntro {
  margin: 0;
  font-size: clamp(15px, 1.3vw, 19px);
  line-height: 1.6;
  color: #4a473f;
  max-width: 52ch;
}

.projMainImg {
  padding: 0 clamp(20px, 4vw, 56px) clamp(70px, 10vh, 100px);
}

.projMainImg .frame {
  aspect-ratio: 16 / 9;
  overflow: hidden;
}

.projMainImg img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.projSection {
  padding: clamp(60px, 8vh, 90px) clamp(20px, 4vw, 56px);
  border-top: 1px solid rgba(17, 17, 16, 0.12);
}

.twoCol {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(30px, 5vw, 80px);
}

.twoCol h2 {
  margin: 0;
  font-weight: 700;
  letter-spacing: -0.02em;
  font-size: clamp(24px, 2.6vw, 36px);
}

.twoCol p {
  margin: 0;
  font-size: clamp(15px, 1.3vw, 18px);
  line-height: 1.65;
  color: #4a473f;
  max-width: 48ch;
}

.projGallery {
  padding: 0 clamp(20px, 4vw, 56px) clamp(30px, 4vh, 40px);
}

.projGallery .galGrid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.projGallery .frame {
  aspect-ratio: 4 / 5;
  overflow: hidden;
}

.projGallery img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.studiList {
  padding: 0 clamp(20px, 4vw, 56px) clamp(90px, 12vh, 130px);
}

.studiRow {
  border-top: 1px solid rgba(17, 17, 16, 0.14);
  padding: clamp(22px, 3.2vh, 32px) 0;
}

.studiRow:last-child {
  border-bottom: 1px solid rgba(17, 17, 16, 0.14);
}

.studiInst {
  margin: 0 0 8px;
  font-weight: 600;
  font-size: 13px;
  color: #6f6b63;
  letter-spacing: 0.02em;
}

.studiCourse {
  margin: 0;
  font-weight: 500;
  font-size: clamp(18px, 2vw, 26px);
  letter-spacing: -0.005em;
}

.studiCourse.wide {
  max-width: 46ch;
}

/* ---------- Responsive ---------- */

@media (max-width: 900px) {
  .caseGrid {
    grid-template-columns: 1fr !important;
  }

  .caseGrid .caseImg {
    order: -1;
  }

  .svcTitle {
    font-size: clamp(15px, 4.4vw, 18px) !important;
  }

  .twoCol {
    grid-template-columns: 1fr !important;
  }
}

@media (max-width: 640px) {
  .topnav,
  .projnav {
    padding: 16px 18px !important;
  }

  .navlinks {
    display: none !important;
    position: absolute;
    top: 100%;
    right: 0;
    left: 0;
    flex-direction: column;
    align-items: flex-start;
    gap: 14px !important;
    background: #f7f6f2;
    padding: 18px 22px;
    border-bottom: 1px solid rgba(17, 17, 16, 0.12);
  }

  .navToggle:checked ~ .navlinks {
    display: flex !important;
  }

  .hamburger {
    display: flex !important;
  }

  .clientRow {
    row-gap: 46px !important;
  }
}
