/* Updated: 2026-10-07 23:09 (Europe/Zurich) */

/* ===========================
   Design tokens
=========================== */
:root {
  /* Colour: CP brand red with the slate tones of the original overlay */
  --ink: #1f2430;
  --text: #363636;
  --muted: #5b6475;
  --brand: #dd3333;
  --brand-ink: #b8262a;
  --brand-soft: #fbe5e5;
  --slate: #292e49;
  --slate-2: #536976;
  --bg: #fff;
  --surface: #f6f7f9;
  --line: #e3e6ec;
  --frame: #d5dae3;
  --ring: #e57373;

  /* Type: system fonts only, no downloads */
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

  /* Layout */
  --maxw: 1140px;
  --gutter: clamp(1rem, 4vw, 2rem);
  --radius: 12px;
  --radius-sm: 8px;
  --header-h: 77px;
  --header-h-scrolled: 61px;
  --section-pad: clamp(3.5rem, 8vw, 6.5rem);
  /* Space kept between the header and an anchored section title */
  --anchor-gap: 1.5rem;

  /* Photo treatment shared by the banner and body images: more contrast, saturation, slightly darker */
  --photo-filter: contrast(1.18) saturate(1.3) brightness(.82);

  /* Elevation and motion */
  --shadow-sm: 0 1px 2px rgba(31, 36, 48, .06), 0 1px 3px rgba(31, 36, 48, .05);
  --shadow-md: 0 8px 24px -8px rgba(31, 36, 48, .16), 0 2px 6px rgba(31, 36, 48, .05);
  --shadow-lg: 0 20px 40px -16px rgba(41, 46, 73, .28);
  --ease: cubic-bezier(.22, .61, .36, 1);
  --ease-out: cubic-bezier(.16, 1, .3, 1);
  --t-fast: .2s;
  --t: .35s;
  --t-slow: .7s;
}

/* ===========================
   Reset & base
=========================== */
*, *::before, *::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: var(--header-h-scrolled);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  padding-top: var(--header-h);
  font-family: var(--font);
  font-size: 1.0625rem;
  line-height: 1.7;
  color: var(--text);
  background: var(--bg);
  overflow-wrap: break-word;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4 {
  font-family: var(--font);
  font-weight: 600;
  line-height: 1.25;
  color: var(--ink);
  letter-spacing: -.01em;
}

p {
  margin: 0 0 1rem;
}

p:last-child {
  margin-bottom: 0;
}

img,
iframe {
  max-width: 100%;
}

img {
  height: auto;
  display: block;
}

svg {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

a {
  color: var(--brand-ink);
  text-decoration: underline;
  text-decoration-color: transparent;
  text-underline-offset: .2em;
  text-decoration-thickness: 1px;
  transition: color var(--t-fast) var(--ease), text-decoration-color var(--t-fast) var(--ease);
}

a:hover {
  color: var(--brand);
  text-decoration-color: currentColor;
}

address {
  font-style: normal;
}

::selection {
  background: var(--brand-soft);
  color: var(--ink);
}

:focus-visible {
  outline: 2px solid var(--ring);
  outline-offset: 3px;
  border-radius: 4px;
}

.skip-link {
  position: absolute;
  left: 1rem;
  top: -100px;
  z-index: 200;
  padding: .6rem 1rem;
  background: var(--slate);
  color: #fff;
  border-radius: var(--radius-sm);
  transition: top var(--t-fast) var(--ease);
}

.skip-link:focus {
  top: .75rem;
  color: #fff;
}

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

/* ===========================
   Header (fixed: shrinking it never shifts the page content)
=========================== */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: rgba(255, 255, 255, .94);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid transparent;
  transition: box-shadow var(--t) var(--ease), border-color var(--t) var(--ease);
  view-transition-name: site-header;
}

.site-header.is-scrolled {
  border-color: var(--line);
  box-shadow: 0 6px 20px -12px rgba(31, 36, 48, .25);
}

.header-inner {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  min-height: calc(var(--header-h) - 1px);
  transition: min-height var(--t) var(--ease);
}

.is-scrolled .header-inner {
  min-height: calc(var(--header-h-scrolled) - 1px);
}

.brand a {
  display: block;
}

.brand img {
  width: 220px;
  height: auto;
  transition: width var(--t) var(--ease);
}

.is-scrolled .brand img {
  width: 190px;
}

/* ===========================
   Navigation
=========================== */
.nav {
  margin-left: auto;
}

.nav ul {
  display: flex;
  align-items: center;
  gap: .25rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav a {
  position: relative;
  display: inline-block;
  padding: .5rem .75rem;
  font-size: .9375rem;
  font-weight: 500;
  letter-spacing: .01em;
  color: var(--ink);
  text-decoration: none;
}

/* Animated underline */
.nav a::after {
  content: "";
  position: absolute;
  left: .75rem;
  right: .75rem;
  bottom: .3rem;
  height: 2px;
  background: var(--brand);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform var(--t) var(--ease-out);
}

.nav a:hover,
.nav a.is-active {
  color: var(--brand-ink);
}

.nav a:hover::after,
.nav a.is-active::after {
  transform: scaleX(1);
}

/* ===========================
   Mobile menu
=========================== */
.menu-toggle {
  display: none;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--bg);
  cursor: pointer;
  transition: border-color var(--t-fast) var(--ease);
}

.menu-toggle:hover {
  border-color: var(--brand);
}

.menu-toggle span {
  display: block;
  width: 20px;
  height: 1.5px;
  margin: 5px auto;
  background: var(--ink);
  border-radius: 2px;
  transition: transform var(--t) var(--ease-out), opacity var(--t-fast) var(--ease);
}

.menu-toggle.open span:nth-child(1) {
  transform: translateY(6.5px) rotate(45deg);
}

.menu-toggle.open span:nth-child(2) {
  opacity: 0;
}

.menu-toggle.open span:nth-child(3) {
  transform: translateY(-6.5px) rotate(-45deg);
}

@media (max-width: 920px) {
  :root {
    --header-h: 69px;
    --header-h-scrolled: 61px;
  }

  .menu-toggle {
    display: block;
    margin-left: auto;
  }

  .brand img {
    width: 190px;
  }

  .is-scrolled .brand img {
    width: 170px;
  }

  .nav {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin: 0;
    max-height: calc(100vh - var(--header-h));
    max-height: calc(100dvh - var(--header-h));
    overflow-y: auto;
    background: var(--bg);
    border-bottom: 1px solid var(--line);
    box-shadow: var(--shadow-lg);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: opacity var(--t) var(--ease), transform var(--t) var(--ease-out), visibility 0s linear var(--t);
  }

  .nav.open {
    opacity: 1;
    visibility: visible;
    transform: none;
    transition: opacity var(--t) var(--ease), transform var(--t) var(--ease-out);
  }

  .nav ul {
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: .5rem var(--gutter) 1.25rem;
  }

  .nav li {
    border-bottom: 1px solid var(--line);
    opacity: 0;
    transform: translateY(-6px);
    transition: opacity var(--t) var(--ease), transform var(--t) var(--ease-out);
  }

  .nav.open li {
    opacity: 1;
    transform: none;
  }

  .nav.open li:nth-child(2) { transition-delay: .04s; }
  .nav.open li:nth-child(3) { transition-delay: .08s; }
  .nav.open li:nth-child(4) { transition-delay: .12s; }
  .nav.open li:nth-child(5) { transition-delay: .16s; }

  .nav a {
    display: block;
    padding: 1rem 0;
    font-size: 1.1875rem;
  }

  .nav a::after {
    left: 0;
    right: auto;
    width: 2rem;
    bottom: .6rem;
  }
}

/* Locks page scroll while the mobile menu is open */
body.menu-open {
  overflow: hidden;
}

/* ===========================
   Hero
=========================== */
.hero {
  position: relative;
  display: grid;
  place-items: center;
  min-height: clamp(380px, 70vh, 680px);
  overflow: hidden;
  text-align: center;
  color: #fff;
  background: var(--slate);
  isolation: isolate;
}

/* Photo layer: more contrast and saturation, slightly darker */
.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -2;
  background: url("../images/intro-bg.webp") center / cover no-repeat;
  filter: var(--photo-filter);
}

/* Light shade for text legibility, kept thin so the photo keeps its contrast */
.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(110deg, rgba(20, 24, 42, .55) 0%, rgba(20, 24, 42, .2) 100%);
}

@media (max-width: 760px) {
  .hero::before {
    background-image: url("../images/intro-bg-960.webp");
  }
}

.hero .inner {
  padding-top: 4rem;
  padding-bottom: 5.5rem;
}

.hero h1 {
  margin: 0;
  font-size: clamp(1.25rem, .95rem + 1.3vw, 1.875rem);
  font-weight: 500;
  letter-spacing: .06em;
  line-height: 1.45;
  color: #fff;
  text-shadow: 0 2px 18px rgba(0, 0, 0, .25);
  animation: fade-left 1.1s var(--ease-out) .2s both;
}

.scroll-cue {
  position: absolute;
  left: 50%;
  bottom: 1.5rem;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  margin-left: -22px;
  border: 1px solid rgba(255, 255, 255, .5);
  border-radius: 50%;
  color: #fff;
  transition: border-color var(--t) var(--ease), background var(--t) var(--ease);
  animation: drop 1s var(--ease-out) 1s both;
}

.scroll-cue svg {
  animation: nudge 2.4s var(--ease) 2s infinite;
}

.scroll-cue:hover {
  color: #fff;
  border-color: var(--brand);
  background: rgba(221, 51, 51, .2);
}

/* Title slides in from the left; the hero clips overflow so no sideways scroll */
@keyframes fade-left {
  from { opacity: 0; transform: translateX(-40px); }
  to { opacity: 1; transform: none; }
}

@keyframes drop {
  from { opacity: 0; transform: translateY(-18px); }
  to { opacity: 1; transform: none; }
}

@keyframes nudge {
  0%, 60%, 100% { transform: none; }
  30% { transform: translateY(4px); }
}

/* ===========================
   Sections
=========================== */
section.wrapper {
  padding: var(--section-pad) 0;
  background: var(--bg);
}

/* Anchor links stop at the section title, not at the top of the padding */
section.wrapper[id] {
  scroll-margin-top: calc(var(--anchor-gap) - var(--section-pad));
}

/* Last home section: smaller gap before the footer */
main > section.wrapper[id]:last-child {
  padding-bottom: clamp(2.5rem, 5vw, 4rem);
}

section.wrapper:nth-of-type(even) {
  background: var(--surface);
}

.major {
  position: relative;
  margin: 0 0 clamp(1.5rem, 3vw, 2.5rem);
  font-size: clamp(1.75rem, 1.3rem + 1.8vw, 2.5rem);
  font-weight: 600;
}

/* Accent rule before home section titles, centred on the text line */
section[id] .major {
  display: flex;
  align-items: center;
  gap: 1rem;
}

section[id] .major::before {
  content: "";
  flex: none;
  width: 3rem;
  height: 2px;
  background: var(--brand);
  transform-origin: left center;
  transition: transform var(--t-slow) var(--ease-out) .2s;
}

/* The rule draws in when the title drops into view */
.reveal-ready section[id] .major.reveal::before {
  transform: scaleX(0);
}

.reveal-ready section[id] .major.reveal.is-visible::before {
  transform: scaleX(1);
}

.box {
  position: relative;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: clamp(1.5rem, 3vw, 2.5rem);
  box-shadow: var(--shadow-sm);
}

.box-title {
  margin: 0 0 1rem;
  font-size: 1.1875rem;
  font-weight: 600;
  line-height: 1.3;
  color: var(--ink);
}

.box-title strong {
  font-weight: inherit;
}

/* Chi Siamo: framed text beside the Lugano photo */
.chi-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
  gap: clamp(1.5rem, 3vw, 2.5rem);
  align-items: stretch;
}

/* Text column centred vertically within the shared row height */
.chi-grid .intro {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

/* Right column: photo fills the space left above the list */
.chi-aside {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  min-width: 0;
}

.intro {
  border: 1px solid var(--frame);
  border-left: 3px solid var(--brand);
  border-radius: var(--radius);
}

.intro p:first-child {
  font-size: clamp(1.0625rem, 1rem + .3vw, 1.1875rem);
  color: var(--ink);
}

.checklist {
  margin: 0;
  padding: 1.25rem 1.5rem;
  list-style: none;
  border: 1px solid var(--frame);
  border-left: 3px solid var(--brand);
}

.checklist li {
  position: relative;
  padding-left: 1.75rem;
  margin-bottom: .5rem;
  font-weight: 500;
  color: var(--ink);
}

.checklist li:last-child {
  margin-bottom: 0;
}

.checklist li::before {
  content: "";
  position: absolute;
  left: .2rem;
  top: .45em;
  width: .5rem;
  height: .85rem;
  border: solid var(--brand);
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.chi-image {
  flex: 1 1 auto;
  width: 100%;
  height: 0;
  min-height: 200px;
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  object-fit: cover;
  filter: var(--photo-filter);
}

@media (max-width: 860px) {
  .chi-grid {
    grid-template-columns: 1fr;
  }

  .chi-image {
    flex: none;
    height: auto;
    aspect-ratio: 16 / 10;
  }
}

/* Servizi: two framed cards with photo */
.services {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(1rem, 2vw, 1.5rem);
}

.service-card {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg);
  border: 1px solid var(--frame);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  transition: transform var(--t) var(--ease-out), box-shadow var(--t) var(--ease), border-color var(--t) var(--ease);
}

.service-card:hover {
  transform: translateY(-4px);
  border-color: var(--brand);
  box-shadow: var(--shadow-md);
}

.service-card img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  filter: var(--photo-filter);
  transition: transform var(--t-slow) var(--ease-out);
}

.service-card:hover img {
  transform: scale(1.04);
}

.service-body {
  position: relative;
  flex: 1;
  padding: clamp(1.5rem, 3vw, 2.25rem);
  background: var(--bg);
  border-top: 3px solid var(--brand);
}

.service-body h3 {
  margin: 0 0 1rem;
  font-size: clamp(1.25rem, 1.1rem + .6vw, 1.5rem);
  color: var(--brand-ink);
}

@media (max-width: 760px) {
  .services {
    grid-template-columns: 1fr;
  }
}

/* Dove Siamo: framed map */
.map {
  overflow: hidden;
  border: 1px solid var(--frame);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.map iframe {
  display: block;
  width: 100%;
  height: 460px;
  border: 0;
  filter: grayscale(.85) contrast(1.05);
  transition: filter var(--t-slow) var(--ease);
}

.map:hover iframe,
.map:focus-within iframe {
  filter: none;
}

@media (max-width: 760px) {
  .map iframe {
    height: 340px;
  }
}

/* Contatto: address left, phone and e-mail right */
.contact-card {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(1.5rem, 4vw, 3rem);
  align-items: end;
  border: 1px solid var(--frame);
  border-left: 3px solid var(--brand);
}

.contact-card p {
  line-height: 1.9;
}

@media (max-width: 640px) {
  .contact-card {
    grid-template-columns: 1fr;
  }
}

/* ===========================
   Legal pages
=========================== */
.legal .container {
  max-width: 880px;
}

.legal .major {
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--line);
}

.legal .major::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -1px;
  width: 3rem;
  height: 2px;
  background: var(--brand);
}

.legal .box {
  padding: clamp(1.25rem, 4vw, 3rem);
}

.legal h3 {
  margin: 2.5rem 0 .75rem;
  font-size: 1.25rem;
  color: var(--brand-ink);
}

.legal h4 {
  margin: 1.75rem 0 .5rem;
  font-size: 1.0625rem;
}

.legal ul {
  margin: 0 0 1rem;
  padding-left: 1.25rem;
}

.legal li {
  margin-bottom: .35rem;
}

.legal li::marker {
  color: var(--brand);
}

/* ===========================
   Footer
=========================== */
footer {
  background: var(--slate);
  border-top: 3px solid var(--brand);
  color: rgba(255, 255, 255, .66);
  font-size: .8125rem;
  letter-spacing: .04em;
}

.footer-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1.25rem 2rem;
  padding-top: 2.5rem;
  padding-bottom: 2.5rem;
}

.footer-legal {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .5rem 1.5rem;
}

.footer-title {
  margin: 0;
  font-size: .75rem;
  font-weight: 600;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: #fff;
}

.footer-legal ul {
  display: flex;
  flex-wrap: wrap;
  gap: .25rem 1.25rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.footer-legal a {
  color: rgba(255, 255, 255, .8);
  text-decoration: underline;
  text-decoration-color: transparent;
}

.footer-legal a:hover,
.footer-legal a[aria-current] {
  color: #fff;
  text-decoration-color: var(--brand);
}

.footer-copy {
  margin: 0;
}

@media (max-width: 760px) {
  .footer-inner,
  .footer-legal {
    flex-direction: column;
    text-align: center;
  }

  .footer-legal ul {
    justify-content: center;
  }

  /* Room for the back to top button */
  .footer-inner {
    padding-bottom: 5rem;
  }
}

/* ===========================
   Scroll reveal (drop down)
   Hidden state applies only once JS has marked the page as ready
=========================== */
.reveal-ready .reveal {
  opacity: 0;
  transform: translateY(-24px);
  transition: opacity var(--t-slow) var(--ease), transform var(--t-slow) var(--ease-out);
  transition-delay: var(--reveal-delay, 0s);
}

.reveal-ready .reveal.is-visible {
  opacity: 1;
  transform: none;
}

/* ===========================
   Back to top
=========================== */
.back-to-top {
  position: fixed;
  right: clamp(1rem, 3vw, 1.75rem);
  bottom: clamp(1rem, 3vw, 1.75rem);
  z-index: 90;
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, .15);
  border-radius: 50%;
  background: var(--slate);
  color: #fff;
  box-shadow: var(--shadow-md);
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transform: translateY(12px) scale(.92);
  transition: opacity var(--t) var(--ease), transform var(--t) var(--ease-out), visibility 0s linear var(--t), background var(--t-fast) var(--ease);
}

.back-to-top.is-visible {
  opacity: 1;
  visibility: visible;
  transform: none;
  transition: opacity var(--t) var(--ease), transform var(--t) var(--ease-out), background var(--t-fast) var(--ease);
}

.back-to-top:hover {
  background: var(--brand);
}

/* ===========================
   Page transitions (progressive enhancement)
=========================== */
@view-transition {
  navigation: auto;
}

::view-transition-old(root) {
  animation: vt-out .25s var(--ease) both;
}

::view-transition-new(root) {
  animation: vt-in .4s var(--ease-out) both;
}

@keyframes vt-out {
  to { opacity: 0; }
}

@keyframes vt-in {
  from { opacity: 0; transform: translateY(8px); }
}

/* ===========================
   Reduced motion
=========================== */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *, *::before, *::after,
  ::view-transition-old(root),
  ::view-transition-new(root) {
    animation: none !important;
    transition-duration: .01ms !important;
    transition-delay: 0s !important;
  }

  .reveal-ready .reveal {
    opacity: 1;
    transform: none;
  }
}

/* ===========================
   Print
=========================== */
@media print {
  body {
    padding-top: 0;
  }

  .site-header,
  .back-to-top,
  .scroll-cue,
  .map {
    display: none;
  }

  .hero {
    min-height: 0;
    background: none;
  }

  .hero h1 {
    color: #000;
    text-shadow: none;
  }

  .box,
  .service-card {
    box-shadow: none;
  }

  .reveal-ready .reveal {
    opacity: 1;
    transform: none;
  }
}
