/* Plafor SA - site styles (mobile first) */

@font-face {
  font-family: 'Play';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('../Fonts/play-latin-400-normal.woff2') format('woff2');
}
@font-face {
  font-family: 'Play';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('../Fonts/play-latin-700-normal.woff2') format('woff2');
}

:root {
  --green-900: #24522a;
  --green-800: #316e33;
  --green-700: #357538;
  --green-600: #4b844d;
  --green-400: #6e9b70;
  --green-100: #eaf2ea;
  --ochre: #ae7019;
  --text: #1d1d1b;
  --muted: #5b5b57;
  --line: #d9ddd8;
  --bg: #ffffff;
  --radius: 4px;
  --container: 1140px;
  --gutter: 16px;
  --font: 'Play', 'Segoe UI', Roboto, Arial, sans-serif;
}

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

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
}

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

a { color: var(--green-800); text-underline-offset: 2px; }
a:hover, a:focus-visible { color: var(--green-900); }
:focus-visible { outline: 3px solid var(--ochre); outline-offset: 2px; }

h1, h2, h3, h4 { line-height: 1.25; margin: 0 0 .6em; font-weight: 400; }
h1 { font-size: clamp(1.5rem, 1.1rem + 1.6vw, 2.1rem); }
h1 span { color: var(--green-800); }
h2 { font-size: clamp(1.25rem, 1.05rem + .8vw, 1.55rem); }
h3 { font-size: 1.15rem; color: var(--green-800); }
p { margin: 0 0 1em; }

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

.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

.skip-link {
  position: absolute; left: -999px; top: 0; z-index: 100;
  background: #fff; padding: .5rem 1rem;
}
.skip-link:focus { left: var(--gutter); }

/* ---------- Header ---------- */

.site-header {
  background: linear-gradient(to bottom, var(--green-800) 0, var(--green-700) 70%, var(--green-600) 100%);
  color: #fff;
}

.site-header__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 72px;
  padding-top: 8px;
  padding-bottom: 8px;
}

.site-logo img { width: 240px; }

.nav-toggle {
  display: inline-flex; flex-direction: column; justify-content: center; gap: 5px;
  width: 44px; height: 44px; padding: 10px;
  background: transparent; border: 1px solid rgba(255,255,255,.5); border-radius: var(--radius);
  cursor: pointer;
}
.nav-toggle__bar { display: block; height: 2px; background: #fff; transition: transform .2s, opacity .2s; }
.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); }

/* Hero slider */
.hero {
  position: relative;
  aspect-ratio: 985 / 286;
  background: #fff;
  border: 4px solid #fff;
  overflow: hidden;
}
.hero__slide {
  position: absolute; inset: 0; margin: 0;
  opacity: 0; transition: opacity 1.2s ease;
}
.hero__slide.is-active { opacity: 1; }
.hero__slide img { width: 100%; height: 100%; object-fit: cover; }

/* Navigation (mobile: off-canvas panel under the header) */
.site-nav { background: var(--green-700); }
.site-nav .container { padding: 0; }
.site-nav__list { list-style: none; margin: 0; padding: 0; display: none; }
.site-nav.is-open .site-nav__list { display: block; }

.site-nav__item { position: relative; border-top: 1px solid rgba(255,255,255,.15); }
.site-nav__link {
  display: block; padding: 12px var(--gutter);
  color: #fff; text-decoration: none; font-size: 1.1rem;
}
.site-nav__link:hover, .site-nav__link:focus-visible,
.site-nav__item.is-active > .site-nav__link { background: var(--green-900); color: #fff; }

.site-nav__sub-toggle {
  position: absolute; right: 0; top: 0; width: 52px; height: 50px;
  background: transparent; border: 0; color: #fff; cursor: pointer;
}
.site-nav__sub-toggle::before {
  content: ''; display: block; margin: auto; width: 10px; height: 10px;
  border-right: 2px solid #fff; border-bottom: 2px solid #fff;
  transform: rotate(45deg); transition: transform .2s;
}
.site-nav__sub-toggle[aria-expanded="true"]::before { transform: rotate(-135deg); }

.site-nav__sub { list-style: none; margin: 0; padding: 0 0 8px; display: none; background: var(--green-800); }
.site-nav__item.is-expanded > .site-nav__sub { display: block; }
.site-nav__sub a {
  display: block; padding: 9px var(--gutter) 9px calc(var(--gutter) * 2);
  color: #fff; text-decoration: none;
}
.site-nav__sub a:hover, .site-nav__sub .is-active > a { background: var(--green-900); }

/* ---------- Main layout ---------- */

.site-main { padding: 28px 0 48px; }

.layout { display: grid; gap: 32px; }
.layout__main, .layout__sidebar { min-width: 0; }

/* ---------- Content elements ---------- */

.frame { margin-bottom: 28px; }
.frame:last-child { margin-bottom: 0; }

.layout__main .frame > header h2,
.layout__main .frame > header h1 {
  padding-bottom: 6px;
  border-bottom: 3px solid var(--green-700);
  box-shadow: 0 1px 0 var(--line);
}

.frame ul { padding-left: 1.2em; }
.frame li::marker { color: var(--green-700); }
.frame-type-text h2, .ce-bodytext h2 { font-size: 1.15rem; font-weight: 700; margin-top: 1.2em; }

/* Fluid Styled Content image positions and galleries (own minimal implementation) */
.ce-textpic::after, .ce-image::after { content: ''; display: table; clear: both; }
.ce-gallery { margin-bottom: 16px; }
.ce-above .ce-gallery { margin-bottom: 16px; }
.ce-below .ce-gallery { margin-top: 16px; }
.ce-center .ce-outer, .ce-center .ce-inner { float: none; position: static; }
.ce-row { display: flex; flex-wrap: wrap; gap: 16px; margin-bottom: 16px; }
.ce-row:last-child { margin-bottom: 0; }
.ce-column { flex: 1 1 140px; min-width: 0; }
.ce-gallery[data-ce-columns="1"] .ce-column { flex-basis: 100%; }
.ce-gallery[data-ce-columns="2"] .ce-column { flex: 0 1 calc(50% - 8px); }
.ce-gallery[data-ce-columns="3"] .ce-column { flex: 0 1 calc(33.333% - 11px); }
.ce-gallery[data-ce-columns="4"] .ce-column { flex: 0 1 calc(25% - 12px); }
.ce-gallery a.lightbox { display: block; cursor: zoom-in; }
.ce-gallery a.lightbox img { transition: transform .25s ease, opacity .25s; }
.ce-gallery a.lightbox:hover img { opacity: .9; }
.ce-image .ce-gallery[data-ce-columns="3"] img,
.ce-image .ce-gallery[data-ce-columns="4"] img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; }
.ce-gallery figure { margin: 0; }
.ce-gallery img { border-radius: var(--radius); }
.ce-gallery figcaption { font-size: .9rem; color: var(--muted); }

/* Home "cards" (layout 1) */
.frame-layout-1 {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}
.frame-layout-1 .ce-textpic { display: flex; flex-direction: column; }
.frame-layout-1 .ce-gallery { float: none !important; margin: 0 !important; max-width: none; }
.frame-layout-1 .ce-gallery img { width: 100%; border-radius: 0; aspect-ratio: 275 / 200; object-fit: cover; }
.frame-layout-1 .ce-gallery .ce-outer, .frame-layout-1 .ce-gallery .ce-inner { float: none !important; right: auto !important; }
.frame-layout-1 .ce-gallery .ce-column, .frame-layout-1 .ce-gallery .ce-row { float: none; margin: 0; }
.frame-layout-1 .ce-bodytext { padding: 16px 18px 6px; }

/* Multi-column text (layout 2) */
.frame-layout-2 ul { columns: 1; column-gap: 32px; }
.frame-layout-2 li { break-inside: avoid; }
.frame-layout-2 > p { margin-bottom: 1em; }

/* Highlight box (layout 3) */
.frame-layout-3 {
  background: var(--green-100);
  border-left: 4px solid var(--green-700);
  padding: 18px 20px;
  border-radius: var(--radius);
}

/* Paragraph cards (layout 2 with several paragraphs, e.g. team on the contact page) */
.frame-layout-2:has(> p + p) > header { grid-column: 1 / -1; margin-bottom: 0; }
.frame-layout-2:has(> p + p) {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
}
.frame-layout-2:has(> p + p) > p {
  margin: 0; padding: 14px 16px;
  background: var(--green-100); border-radius: var(--radius); line-height: 1.5;
}

/* Responsive embeds (map) */
.embed-map { position: relative; aspect-ratio: 4 / 5; border: 1px solid var(--green-700); }
.embed-map iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

/* Box "I nostri vantaggi" */
.vantaggi { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: #fff; }
.vantaggi__intro { padding: 18px 20px 6px; }
.vantaggi__title {
  margin: -18px -20px 14px; padding: 10px 20px;
  background: linear-gradient(90deg, var(--green-700) 0 18px, var(--green-400) 18px 30px, #fff 30px);
  padding-left: 46px; color: var(--text);
  border-bottom: 1px solid var(--line);
}
.vantaggi__image { margin: 0; }
.vantaggi__image img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; }
.vantaggi__box { background: var(--green-700); color: #fff; padding: 14px 20px 18px; }
.vantaggi__subtitle { color: #fff; font-size: 1.15rem; margin-bottom: 10px; }
.vantaggi__list {
  list-style: none; margin: 0; padding: 0;
  display: grid; grid-template-columns: 1fr 1fr; gap: 6px 14px;
}
.vantaggi__list li { position: relative; padding-left: 14px; }
.vantaggi__list li::before { content: '›'; position: absolute; left: 0; color: rgba(255,255,255,.75); }
.vantaggi__list li::first-letter { font-weight: 700; font-size: 1.15em; }

/* ---------- Form framework ---------- */

.form-group, .form-element { margin-bottom: 14px; }
.form-label, .control-label, label { display: block; font-weight: 700; margin-bottom: 4px; }
.form-check label, .form-check-label { display: inline; font-weight: 400; }
input[type=text], input[type=email], input[type=tel], textarea, select {
  width: 100%; max-width: 100%;
  font: inherit; color: var(--text);
  padding: 10px 12px; border: 1px solid #9aa197; border-radius: var(--radius); background: #fff;
}
input:focus, textarea:focus, select:focus { border-color: var(--green-700); outline: 2px solid var(--green-100); }
textarea { min-height: 140px; resize: vertical; }
.required { color: var(--ochre); }
.error .form-control, .has-error input, .has-error textarea { border-color: #b3261e; }
.error.help-block, .invalid-feedback, .help-block { color: #b3261e; font-size: .9rem; }
button[type=submit], .btn-primary {
  font: inherit; font-weight: 700; color: #fff; cursor: pointer;
  background: var(--green-700); border: 0; border-radius: var(--radius); padding: 11px 26px;
}
button[type=submit]:hover, .btn-primary:hover { background: var(--green-900); }

/* ---------- Footer ---------- */

.site-footer { background: var(--green-700); color: #fff; padding: 32px 0 20px; }
.site-footer a { color: #fff; }
.site-footer__inner { display: grid; gap: 18px; }
.site-footer__brand img { width: 240px; }
.site-footer__address { font-style: normal; line-height: 1.7; }
.site-footer__legal { margin: 0; font-size: .9rem; color: rgba(255,255,255,.8); border-top: 1px solid rgba(255,255,255,.2); padding-top: 14px; }

/* ---------- Lightbox ---------- */

.lightbox-dialog {
  padding: 0; border: 0; background: transparent; max-width: 100vw; max-height: 100vh;
  width: 100vw; height: 100vh;
}
.lightbox-dialog[open] { display: flex; align-items: center; justify-content: center; }
.lightbox-dialog::backdrop { background: rgba(0,0,0,.88); }
.lightbox-dialog img { max-width: 92vw; max-height: 86vh; width: auto; height: auto; }
.lightbox-dialog__close, .lightbox-dialog__nav {
  position: absolute; background: rgba(0,0,0,.4); color: #fff; border: 0; cursor: pointer;
  font-size: 2.4rem; line-height: 1; width: 52px; height: 52px; border-radius: 50%;
}
.lightbox-dialog__close { top: 12px; right: 12px; font-size: 2rem; }
.lightbox-dialog__nav--prev { left: 10px; top: 50%; transform: translateY(-50%); }
.lightbox-dialog__nav--next { right: 10px; top: 50%; transform: translateY(-50%); }

/* ---------- Breakpoints ---------- */

@media (max-width: 899px) {
  /* mobile menu opens right under the logo bar, above the slider */
  .site-header { display: flex; flex-direction: column; }
  .site-header__bar { order: 1; }
  .site-nav { order: 2; }
  .site-header > .container:not(.site-header__bar) { order: 3; padding-bottom: 12px; }
  .frame-layout-1 .ce-gallery img { aspect-ratio: 16 / 9; }
}

@media (max-width: 599px) {
  .ce-gallery[data-ce-columns="3"] .ce-column,
  .ce-gallery[data-ce-columns="4"] .ce-column { flex: 0 1 calc(50% - 8px); }
}

@media (min-width: 600px) {
  .ce-intext.ce-left .ce-gallery { float: left; max-width: 45%; margin: 0 20px 12px 0; }
  .ce-intext.ce-right .ce-gallery { float: right; max-width: 45%; margin: 0 0 12px 20px; }
  .ce-intext.ce-nowrap { display: flex; gap: 20px; align-items: flex-start; }
  .ce-intext.ce-nowrap.ce-right { flex-direction: row-reverse; }
  .ce-intext.ce-nowrap .ce-gallery { float: none; margin: 0; flex: 0 0 auto; max-width: 45%; }
  .ce-intext.ce-nowrap .ce-bodytext { flex: 1 1 auto; min-width: 0; }
  .frame-layout-2 ul { columns: 2; }
  .site-footer__inner { grid-template-columns: auto 1fr; align-items: start; }
  .site-footer__legal { grid-column: 1 / -1; }
}

@media (min-width: 900px) {
  .site-logo img { width: 330px; }
  .site-header__bar { min-height: 104px; }
  .nav-toggle { display: none; }

  .site-nav { background: transparent; padding-bottom: 0; }
  .site-nav .container { padding: 0 var(--gutter); }
  .site-nav__list {
    display: flex !important;
    background: var(--green-700);
    border-top: 4px solid #fff;
  }
  .site-nav__item { flex: 1 1 0; border-top: 0; border-left: 1px solid rgba(255,255,255,.35); }
  .site-nav__item:first-child { border-left: 0; }
  .site-nav__link { text-align: center; padding: 12px 6px; font-size: 1.05rem; white-space: nowrap; }
  .site-nav__sub-toggle { display: none; }
  .site-nav__sub {
    position: absolute; left: 0; top: 100%; min-width: 240px; z-index: 30;
    padding: 6px 0; box-shadow: 0 8px 20px rgba(0,0,0,.2);
  }
  .site-nav__item:hover > .site-nav__sub,
  .site-nav__item:focus-within > .site-nav__sub { display: block; }

  .layout--default { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 40px; }
  .layout--home { grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); gap: 32px; }
  .layout--home .layout__sidebar { order: -1; }

  /* Home cards side by side */
  .layout--home .layout__main { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 20px; align-content: start; }
  .layout--home .layout__main > .frame { margin: 0; }
  .layout--home .layout__main > .frame:not(.frame-layout-1) { grid-column: 1 / -1; }
}
