:root {
  --c-ink: #141212;
  --c-slate: #5a656f;
  --c-red: #df231d;
  --c-blue: #1d5793;
  --c-white: #ffffff;
  --font-body: 'Jost', sans-serif;
  --font-heading: 'Satoshi', 'Jost', sans-serif;
  --max-width: 1200px;
}

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

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--c-white);
  color: var(--c-ink);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--c-ink); text-decoration: underline; text-underline-offset: 4px; }
a:hover { color: var(--c-red); }

img { display: block; max-width: 100%; height: auto; }

.container { max-width: var(--max-width); margin: 0 auto; }

/* Hidden visually, still read by search engines and screen readers */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* Logo rendered as a mask so its colour can change with the background */
.logo-mask {
  background-color: var(--c-white);
  -webkit-mask: url(../assets/logo-artecasa.svg) center / contain no-repeat;
          mask: url(../assets/logo-artecasa.svg) center / contain no-repeat;
}

/* ---------- Navbar ---------- */
.navbar {
  position: absolute;
  top: 0; left: 0; right: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 20px max(32px, calc((100% - var(--max-width)) / 2));
  background: transparent;
}
.navbar__logo-link { display: block; text-decoration: none; }
.navbar__logo { width: 200px; height: 64px; }

.nav { display: flex; align-items: center; gap: 28px; }
.nav__link {
  --ease-out: cubic-bezier(.22, 1, .36, 1);
  position: relative;
  z-index: 0;
  /* 3px box around the glyphs; the right side drops the trailing letter-spacing */
  padding: 3px calc(3px - .14em) 3px 3px;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.2;
  letter-spacing: .14em;
  text-transform: uppercase;
  white-space: nowrap;
  color: var(--c-white);
  text-decoration: none;
  transition: color .45s var(--ease-out);
}
/* White box: wipes in from the left, wipes out to the right */
.nav__link::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  background: var(--c-white);
  transform: scaleX(0);
  transform-origin: right center;
  transition: transform .45s var(--ease-out);
}
.nav__link:hover,
.nav__link:focus-visible,
.nav__link[aria-current="page"] { color: var(--c-ink); }
.nav__link:hover::before,
.nav__link:focus-visible::before,
.nav__link[aria-current="page"]::before { transform: scaleX(1); transform-origin: left center; }
.nav__link:focus-visible { outline: 1px solid var(--c-white); outline-offset: 3px; }

/* Hamburger button (mobile only) */
.nav-toggle {
  display: none;
  position: relative;
  z-index: 2;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--c-white);
  cursor: pointer;
}
.nav-toggle__bar {
  position: absolute;
  left: 10px;
  width: 24px;
  height: 2px;
  background: currentColor;
  transition: transform .35s cubic-bezier(.22, 1, .36, 1), opacity .2s;
}
.nav-toggle__bar:nth-child(1) { top: 14px; }
.nav-toggle__bar:nth-child(2) { top: 21px; }
.nav-toggle__bar:nth-child(3) { top: 28px; }
.nav-toggle[aria-expanded="true"] .nav-toggle__bar:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] .nav-toggle__bar:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] .nav-toggle__bar:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }
.nav-toggle:focus-visible { outline: 1px solid var(--c-white); outline-offset: 2px; }

@media (max-width: 720px) {
  .navbar { padding: 16px; }
  .navbar__logo-link { position: relative; z-index: 2; }
  .navbar__logo { width: 140px; height: 45px; }

  /* With JS: links collapse into a full-screen panel behind the logo + button */
  .js .nav-toggle { display: block; }
  .js .nav {
    position: fixed;
    inset: 0;
    z-index: 1;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    gap: 28px;
    padding: 96px 32px;
    background: var(--c-slate);
    opacity: 0;
    visibility: hidden;
    transition: opacity .35s ease, visibility 0s linear .35s;
  }
  .js .nav.is-open { opacity: 1; visibility: visible; transition: opacity .35s ease; }
  .js .nav__link { font-size: 22px; }
  .nav-open { overflow: hidden; }

  /* Without JS: keep the inline links, just smaller */
  html:not(.js) .nav { gap: 14px; }
  html:not(.js) .nav__link { font-size: 12px; }
}

/* ---------- Page hero (inner pages) ---------- */
.page-hero { background: var(--c-slate); color: var(--c-white); padding: 190px 32px 100px; }
.page-hero__inner { display: flex; flex-direction: column; gap: 20px; }
.page-hero .body-text { max-width: 640px; color: var(--c-white); }

@media (max-width: 560px) {
  .page-hero { padding: 140px 16px 72px; }
  .page-hero .heading--lg { font-size: 36px; }
}

/* ---------- Hero ---------- */
.hero {
  position: relative;
  height: 100vh;
  min-height: 520px;
  background: radial-gradient(ellipse 80% 70% at 50% 45%, #66717b 0%, var(--c-slate) 60%, #4d575f 100%);
  overflow: hidden;
}
/* 3D room line drawing, drawn by js/hero-room.js; fades in after the first frame */
.hero__canvas {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  pointer-events: none;
  opacity: 0;
  transition: opacity 1.4s ease;
}
.hero__canvas.is-ready { opacity: 1; }

/* Title: one line in a white box, centred. On mouse devices js/hero-title.js splits it into
   .hero__letter spans that snake after the mouse; js/hero-room.js draws the box as a ribbon. */
.hero__title {
  position: absolute;
  left: 50%;
  bottom: 350px;
  z-index: 1;
  width: max-content;
  margin: 0;
  padding: 4px;
  transform: translateX(-50%);
  background: var(--c-white);
  color: var(--c-ink);
  font-family: "ofelia-display", var(--font-heading);
  font-weight: 700;
  font-style: normal;
  text-transform: uppercase;
  font-size: clamp(18px, 4.4vw, 64px);
  line-height: 1;
  letter-spacing: -.01em;
  white-space: nowrap;
}
.hero__title.is-lifted { background: none; } /* while it moves, the ribbon on the canvas is the box */
.hero__letter {
  display: inline-block;
  white-space: pre;
  will-change: transform;
}
@media (max-width: 720px) {
  .hero__title { bottom: 104px; }
}

.hero__scroll {
  position: absolute;
  bottom: 32px;
  left: 50%;
  margin-left: -28px;
  width: 56px;
  height: 56px;
  padding: 0;
  border: none;
  background: transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--c-white);
  animation: bob 2s ease-in-out infinite;
  transition: opacity .2s;
}
.hero__scroll:hover { opacity: .7; }

/* ---------- Back to top ---------- */
.back-to-top {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 20;
  width: 52px;
  height: 52px;
  padding: 0;
  border: none;
  background: var(--c-red);
  color: var(--c-white);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transform: translateY(12px);
  transition: opacity .3s ease, transform .3s ease, visibility .3s, background-color .2s;
}
.back-to-top.is-visible { opacity: 1; visibility: visible; transform: none; }
.back-to-top:hover { background: var(--c-ink); }

@keyframes bob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(6px); }
}

/* ---------- Shared typography ---------- */
.eyebrow {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: .16em;
  color: var(--c-slate);
}
.eyebrow__line { width: 28px; height: 2px; background: var(--c-red); }
.eyebrow--light { color: var(--c-white); }
.eyebrow--light .eyebrow__line { background: var(--c-white); }
.eyebrow--blue .eyebrow__line { background: var(--c-blue); }

.heading {
  margin: 0;
  font-family: var(--font-heading);
  font-weight: 700;
  letter-spacing: -.01em;
  color: var(--c-ink);
  text-wrap: pretty;
}
.heading--lg { font-size: 48px; line-height: 1.08; }
.heading--md { font-size: 44px; line-height: 1.1; }
.heading--light { color: var(--c-white); }

.body-text {
  margin: 0;
  font-size: 18px;
  line-height: 1.65;
  color: var(--c-ink);
  text-wrap: pretty;
}

.text-link {
  align-self: flex-start;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 15px;
  font-weight: 500;
  letter-spacing: .12em;
  color: var(--c-red);
  text-decoration: none;
  border-bottom: 1.5px solid var(--c-red);
  padding-bottom: 4px;
}
.text-link:hover { color: var(--c-ink); border-color: var(--c-ink); }
.text-link--blue { color: var(--c-blue); border-color: var(--c-blue); }

.image-placeholder {
  background: var(--c-slate);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  letter-spacing: .16em;
  color: var(--c-white);
}
.image-placeholder--4x3 { aspect-ratio: 4 / 3; }

/* Image box: the whole box grows a little on hover (every photo / image placeholder on the site) */
.media { display: block; position: relative; transition: transform .7s cubic-bezier(.22, 1, .36, 1); }
.media > * { width: 100%; }
.media:hover,
.media:focus-visible,
.product-card:hover .media,
.product-card:focus-visible .media { z-index: 1; transform: scale(1.04); }

/* Photo in a split section: same 4:3 frame as the placeholder, cropped to fill */
.split__image { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; }

/* ---------- Split sections (Chi siamo / Cosa facciamo) ---------- */
.split {
  max-width: var(--max-width);
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 380px), 1fr));
  gap: 72px;
  align-items: center;
}
.split--top { padding: 140px 32px 80px; }
.split--bottom { padding: 80px 32px 140px; }
.split__text { display: flex; flex-direction: column; gap: 22px; max-width: 480px; }

/* Fade-in on scroll (only when JS is running) */
.js [data-fade] {
  opacity: 0;
  transform: translateY(40px);
  transition: opacity .9s ease, transform .9s ease;
}
.js [data-fade].is-visible { opacity: 1; transform: none; }

/* Slide-in from the left, staggered per child (--i is set in main.js).
   `backwards` fill holds the start state during the delay, then lets go,
   so hover styles on the children keep working afterwards. */
.js [data-slide]:not(.is-visible) > * { opacity: 0; }
.js [data-slide].is-visible > * {
  animation: slide-in 1s cubic-bezier(.22, 1, .36, 1) backwards;
  animation-delay: calc(var(--i, 0) * .12s);
}
@keyframes slide-in {
  from { opacity: 0; transform: translateX(-120px); }
  to { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .hero__scroll { animation: none; }
  .hero__canvas { transition: none; }
  .js [data-fade] { opacity: 1; transform: none; transition: none; }
  .js [data-slide] > * { opacity: 1 !important; animation: none !important; }
  .nav__link, .nav__link::before { transition: none; }
  .media { transition: none; }
  .lightbox__media { animation: none; }
}

/* ---------- Products ---------- */
.products { background: var(--c-slate); color: var(--c-white); padding: 110px 32px; overflow: hidden; }
.products__inner { display: flex; flex-direction: column; gap: 56px; }
.section-head {
  display: flex;
  flex-direction: column;
  gap: 14px;
  align-items: center;
  text-align: center;
}
.products__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 20px;
}
.product-card {
  display: flex;
  flex-direction: column;
  gap: 16px;
  text-decoration: none;
  color: var(--c-white);
}
.product-card:hover { color: var(--c-white); opacity: .85; }
.product-card__image {
  aspect-ratio: 3 / 4;
  background: var(--c-white);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  letter-spacing: .16em;
  color: var(--c-slate);
}
.product-card__label {
  margin: 0;
  font-size: 15px;
  font-weight: 500;
  letter-spacing: .08em;
  text-transform: uppercase;
  text-align: center;
}

/* ---------- Catalog ---------- */
.catalog { padding: 120px 32px; border-bottom: 1px solid var(--c-slate); }
.catalog__inner {
  max-width: 720px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 22px;
  text-align: center;
}
.button {
  margin-top: 10px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 18px 36px;
  border: none;
  background: var(--c-slate);
  color: var(--c-white);
  font-family: var(--font-body);
  font-size: 15px;
  font-weight: 500;
  letter-spacing: .12em;
  cursor: pointer;
}
.button span { font-size: 14px; }
.button:disabled { opacity: .45; cursor: not-allowed; }
.catalog__note { font-size: 13px; color: var(--c-slate); }

/* ---------- Brand ---------- */
.brand { background: var(--c-white); }
.brand__inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 140px 32px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr));
  gap: 72px;
  align-items: center;
}
.brand__logo-wrap {
  aspect-ratio: 16 / 10;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px;
}
.brand__logo { width: 100%; max-width: 440px; }

/* ---------- Footer ---------- */
.footer { background: var(--c-slate); color: var(--c-white); padding: 80px 32px 32px; }
.footer__inner { display: flex; flex-direction: column; gap: 60px; }
.footer__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 40px;
}
.footer__logo {
  display: block;
  width: 170px;
  height: 55px;
  -webkit-mask-position: left center;
          mask-position: left center;
}
.footer__col { display: flex; flex-direction: column; gap: 12px; }
.footer__title {
  font-size: 13px;
  font-weight: 500;
  letter-spacing: .16em;
  color: var(--c-white);
}
.footer__text { font-size: 16px; line-height: 1.6; color: var(--c-white); }
.footer__text--spaced { margin-top: 12px; }
.footer__link { color: var(--c-white); text-decoration: none; }
a.footer__title { display: flex; gap: 8px; }
.footer__link:hover { color: var(--c-white); text-decoration: underline; }
.footer__bottom {
  border-top: 1px solid var(--c-white);
  padding-top: 24px;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px;
  font-size: 13px;
}

/* ---------- Chi siamo page ---------- */
.split--page { padding: 120px 32px; }
.split--page + .split--page { padding-top: 0; }

.values { background: var(--c-slate); color: var(--c-white); padding: 110px 32px; }
.values__inner { display: flex; flex-direction: column; gap: 56px; }
.values__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 40px;
}
.value { display: flex; flex-direction: column; gap: 14px; border-top: 2px solid var(--c-white); padding-top: 24px; }
.value__title { margin: 0; font-family: var(--font-heading); font-size: 24px; font-weight: 700; }
.value .body-text { color: var(--c-white); font-size: 17px; }

.cta { padding: 120px 32px; }
.cta__inner {
  max-width: 720px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 22px;
  text-align: center;
}
a.button { text-decoration: none; }
a.button:hover { color: var(--c-white); background: var(--c-ink); }

/* ---------- Lavori page (photo gallery) ---------- */
.gallery { padding: 120px 32px 0; }
.gallery__grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-auto-rows: 280px;
  grid-auto-flow: dense;
  gap: 16px;
}
.gallery__item { margin: 0; }
.gallery__item--tall { grid-row: span 2; }
.gallery__item--wide { grid-column: span 2; }
/* .gallery__link is a .media frame linking to the full-size photo (opened by js/lightbox.js) */
.gallery__link { width: 100%; height: 100%; text-decoration: none; cursor: zoom-in; }
.gallery__link > img,
.gallery__link > .image-placeholder { height: 100%; object-fit: cover; }
.gallery__link:focus-visible { outline: 2px solid var(--c-red); outline-offset: 3px; }

@media (max-width: 900px) {
  .gallery__grid { grid-template-columns: repeat(2, 1fr); grid-auto-rows: 240px; }
}
@media (max-width: 560px) {
  .gallery { padding: 72px 16px 0; }
  .gallery__grid { grid-template-columns: 1fr; grid-auto-rows: 260px; gap: 12px; }
  .gallery__item--wide { grid-column: auto; }
  .gallery__item--tall { grid-row: auto; }
}

/* ---------- Lightbox (lavori.html, js/lightbox.js) ---------- */
.lightbox {
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 80px 96px;
  border: 0;
  background: rgba(20, 18, 18, .97);
  color: var(--c-white);
}
.lightbox::backdrop { background: transparent; }
.lightbox__stage {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}
.lightbox__media {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  animation: lightbox-in .35s ease;
}
.lightbox__placeholder { width: min(100%, (100vh - 160px) * 4 / 3); aspect-ratio: 4 / 3; }
.lightbox__count {
  position: absolute;
  left: 50%;
  bottom: 28px;
  margin: 0;
  transform: translateX(-50%);
  font-size: 13px;
  letter-spacing: .16em;
}
.lightbox__btn {
  position: absolute;
  width: 52px;
  height: 52px;
  padding: 0;
  border: none;
  background: var(--c-red);
  color: var(--c-white);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .2s, color .2s;
}
.lightbox__btn:hover { background: var(--c-white); color: var(--c-ink); }
.lightbox__btn:focus-visible { outline: 2px solid var(--c-white); outline-offset: 3px; }
.lightbox__close { top: 16px; right: 16px; }
.lightbox__prev,
.lightbox__next { top: 50%; margin-top: -26px; }
.lightbox__prev { left: 24px; }
.lightbox__next { right: 24px; }
.lightbox__prev svg { transform: rotate(-90deg); }
.lightbox__next svg { transform: rotate(90deg); }
.lightbox-open { overflow: hidden; }
@keyframes lightbox-in {
  from { opacity: 0; transform: scale(.97); }
  to { opacity: 1; transform: none; }
}
@media (max-width: 560px) {
  .lightbox { padding: 80px 16px 96px; }
  .lightbox__prev,
  .lightbox__next { top: auto; bottom: 16px; margin-top: 0; }
  .lightbox__prev { left: 16px; }
  .lightbox__next { right: 16px; }
}

/* ---------- Contatti page ---------- */
.contact {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 120px 32px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 380px), 1fr));
  gap: 72px;
  align-items: start;
}
.contact__list { margin: 0; display: flex; flex-direction: column; gap: 36px; }
.contact__item { display: flex; flex-direction: column; gap: 10px; }
.contact__item dt { margin: 0; }
.contact__item dd { margin: 0; font-size: 18px; line-height: 1.65; }
.contact__item dd a { color: var(--c-ink); text-decoration: none; }
.contact__item dd a:hover { color: var(--c-red); }
.contact__item .text-link { width: fit-content; margin-top: 16px; }
.contact__map { aspect-ratio: 4 / 3; background: var(--c-slate); }
.contact__map iframe { display: block; width: 100%; height: 100%; border: 0; }

/* Contact form (contatti.html) — posts to contact.php */
.contact__main { display: flex; flex-direction: column; gap: 72px; }
.contact-form { display: flex; flex-direction: column; gap: 22px; }
.contact-form__row { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr)); gap: 22px; }
.contact-form__field { display: flex; flex-direction: column; gap: 8px; }
.contact-form label { font-size: 14px; font-weight: 500; letter-spacing: .04em; }
.contact-form label span { font-weight: 400; color: var(--c-slate); }
.contact-form input[type="text"],
.contact-form input[type="email"],
.contact-form input[type="tel"],
.contact-form textarea {
  width: 100%;
  padding: 14px 16px;
  border: 1px solid var(--c-slate);
  border-radius: 0;
  background: transparent;
  color: var(--c-ink);
  font: inherit;
  font-size: 16px;
}
.contact-form textarea { resize: vertical; min-height: 140px; }
.contact-form input:focus-visible,
.contact-form textarea:focus-visible { outline: 2px solid var(--c-red); outline-offset: 2px; }
.contact-form__check { display: flex; gap: 12px; align-items: flex-start; font-weight: 400 !important; letter-spacing: 0 !important; line-height: 1.5; cursor: pointer; }
.contact-form__check input { margin-top: 3px; accent-color: var(--c-red); flex: none; }
.contact-form__trap { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.contact-form .button { align-self: flex-start; margin-top: 0; }
.contact-form__status { margin: 0; padding: 14px 16px; font-size: 15px; border-left: 3px solid var(--c-slate); background: rgba(90, 101, 111, .1); }
.contact-form__status.is-error { border-color: var(--c-red); }

/* Privacy Policy page */
.legal { padding: 100px 32px 140px; }
.legal__inner { max-width: 760px; margin: 0 auto; font-size: 17px; line-height: 1.7; }
.legal h2 { margin: 48px 0 12px; font-family: var(--font-heading); font-size: 26px; line-height: 1.2; }
.legal h2:first-child { margin-top: 0; }
.legal p, .legal ul { margin: 0 0 14px; }
.legal ul { padding-left: 22px; }
.legal li { margin-bottom: 8px; }
.legal a { color: var(--c-ink); text-decoration: underline; text-underline-offset: 3px; }
.legal a:hover { color: var(--c-red); }
.legal__date { color: var(--c-slate); font-size: 15px; margin-top: 32px; }
.contact-form__check a { color: var(--c-ink); text-decoration: underline; text-underline-offset: 3px; }
@media (max-width: 720px) {
  .legal { padding: 64px 16px 96px; }
  .legal h2 { font-size: 22px; }
}
