/* ==========================================================================
   CoRi Academy — stile del sito
   Valori ricavati dal sito originale: griglia a 24 colonne, tipografia
   fluida (Georgia per i titoli, Times New Roman per il testo), palette b/n.
   ========================================================================== */

:root {
  --black: #000;
  --white: #fff;
  --light: hsl(0, 0%, 96.08%);
  --arrow-bg: rgba(0, 0, 0, 0.7);
  --muted: rgba(0, 0, 0, 0.7);
  --error: #c4200c;

  --font-heading: Georgia, serif;
  --font-body: "Times New Roman", Times, serif;

  --max-width: 2000px;
  --gutter: 4vw;
  --gap: 11px;
  --container-width: min(var(--max-width), calc(100vw - var(--gutter) * 2));
  --row: calc(var(--container-width) * 0.0215);
}

@media (max-width: 767px) {
  :root {
    --gutter: 6vw;
  }
}

/* --------------------------------------------------------------------------
   Base
   -------------------------------------------------------------------------- */

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

html {
  font-size: 13px;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--white);
  color: var(--black);
  font-family: var(--font-body);
  font-weight: 400;
  line-height: 1.8;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

html.menu-open,
html.menu-open body {
  overflow: hidden;
}

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

a {
  color: inherit;
}

button {
  font: inherit;
  color: inherit;
}

/* Dimensioni fluide: stessa formula del sito originale.
   --s è il "valore" della dimensione (es. 4.2 per H1). */
h1,
h2,
h3,
h4,
p,
.fluid,
.btn,
.header__nav a,
.form__title,
.form input,
.form textarea {
  font-size: min(
    calc((var(--s) - 1) * 1.2vw + 1rem),
    max(calc((var(--s) - 1) * 24px + 1rem), calc(var(--s) * 1rem))
  );
}

@media (max-width: 767px) and (orientation: portrait) {
  h1,
  h2,
  h3,
  h4,
  p,
  .fluid,
  .btn,
  .header__nav a,
  .form__title,
  .form input,
  .form textarea {
    font-size: calc((var(--s) - 1) * min(1.2vh, 10.8px) + 1rem);
  }
}

h1 { --s: 4.2; }
h2 { --s: 2.8; }
h3 { --s: 2.2; }
h4 { --s: 1.2; }
p,
.fluid,
.form__title { --s: 1.2; }

/* Aspetto separato dal livello del titolo: <h1 class="as-h3"> resta un h1
   per motori di ricerca e screen reader, ma appare come un h3.
   Su un <p> danno l'aspetto di titolo senza crearne uno. */
.as-h1 { --s: 4.2; }
.as-h2 { --s: 2.8; }
.as-h3 { --s: 2.2; }
.as-h4 { --s: 1.2; }

h1,
h2,
h3,
h4,
.as-h1,
.as-h2,
.as-h3,
.as-h4 {
  font-family: var(--font-heading);
  font-weight: 400;
  font-style: normal;
  letter-spacing: 0.02em;
  line-height: calc(1.4em * (1 + (1 - var(--s)) / 25));
  margin: 2rem 0;
}

p {
  line-height: 1.8em;
  margin: 1rem 0;
}

.text > :first-child { margin-top: 0; }
.text > :last-child { margin-bottom: 0; }

.text a:not(.plain-link):not(.btn),
.link {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
}

.plain-link {
  text-decoration: none;
}

.plain-link:hover {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
}

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

.skip-link {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 200;
  padding: 0.8em 1.2em;
  background: var(--black);
  color: var(--white);
  font-size: 1rem;
  text-decoration: none;
  transform: translateY(-200%);
}

.skip-link:focus {
  transform: none;
}

:focus-visible {
  outline: 2px solid var(--black);
  outline-offset: 3px;
}

/* --------------------------------------------------------------------------
   Pulsanti
   -------------------------------------------------------------------------- */

.btn {
  --s: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 1.3em 1.67em;
  border: 1px solid currentColor;
  border-radius: 300px;
  background: transparent;
  color: inherit;
  font-family: var(--font-heading);
  font-weight: 700;
  letter-spacing: 0.04em;
  line-height: 1.2em;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition: opacity 0.1s linear;
}

.btn:hover {
  opacity: 0.8;
}

.btn:disabled {
  cursor: progress;
  opacity: 0.5;
}

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

.header {
  position: relative;
  z-index: 20;
  background: var(--white);
  border-top: 1px solid var(--black);
  border-bottom: 1px solid var(--black);
  box-shadow: 0 12px 12px rgba(0, 0, 0, 0.25);
}

.header__inner {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 0.1vw var(--gutter);
}

.header__nav {
  display: flex;
  flex-wrap: wrap;
  justify-self: start;
}

.header__nav a:not(:last-child) {
  margin-right: 1.5em;
}

.header__nav a {
  --s: 1.2;
  line-height: 1.8em;
  text-decoration: none;
  background-image: linear-gradient(currentColor, currentColor);
  background-repeat: no-repeat;
  background-position: 0 calc(100% - 0.1em);
  background-size: 0 1px;
  transition: background-size 0.3s ease;
}

.header__nav a:hover,
.header__nav a[aria-current="page"] {
  background-size: 100% 1px;
}

.header__logo {
  justify-self: center;
}

.header__logo img {
  width: auto;
  height: 119px;
}

.header__actions {
  justify-self: end;
}

.btn--header {
  --s: 0.9;
}

.burger {
  display: none;
  position: relative;
  width: 44px;
  height: 44px;
  margin-right: -8px;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
}

.burger span {
  position: absolute;
  left: 8px;
  right: 8px;
  height: 1px;
  background: currentColor;
}

.burger span:nth-child(1) { top: 15px; }
.burger span:nth-child(2) { top: 22px; }
.burger span:nth-child(3) { top: 29px; }

@media (max-width: 799px) {
  .header__inner {
    grid-template-columns: 1fr auto;
    padding: 1vw 6vw;
  }

  .header__nav,
  .header__actions {
    display: none;
  }

  .header__logo {
    justify-self: start;
  }

  .header__logo img {
    height: 76px;
  }

  .burger {
    display: block;
  }
}

/* Menu mobile (overlay) */
.menu {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  flex-direction: column;
  background: var(--light);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0s linear 0.3s;
}

.menu.is-open {
  opacity: 1;
  visibility: visible;
  transition: opacity 0.3s ease;
}

.menu__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1vw 6vw;
  border-top: 1px solid transparent;
}

.menu__top img {
  width: auto;
  height: 76px;
}

.menu__close {
  position: relative;
  width: 44px;
  height: 44px;
  margin-right: -8px;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
}

.menu__close::before,
.menu__close::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 7px;
  right: 7px;
  height: 1px;
  background: currentColor;
}

.menu__close::before { transform: rotate(45deg); }
.menu__close::after { transform: rotate(-45deg); }

.menu__nav {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0 6vw;
}

.menu__nav a {
  padding: 0.05em 0;
  font-size: 3.45rem;
  line-height: 1.8;
  text-decoration: none;
}

.menu__nav a[aria-current="page"] {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.15em;
}

.menu__cta {
  padding: 0 6vw 40px;
  text-align: center;
}

.menu__cta .btn {
  --s: 1.2;
  padding: 0.85em 1.2em;
}

/* --------------------------------------------------------------------------
   Sezioni
   -------------------------------------------------------------------------- */

.section {
  position: relative;
  isolation: isolate;
}

.section--light { background: var(--light); }
.section--bright,
.section--white { background: var(--white); }

.section--black {
  background: var(--black);
  color: var(--white);
}

.section--small {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 33vh;
  padding: 3.3vmax 0;
}

.section--medium {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 66vh;
  padding: 6.6vmax 0;
}

/* Divisore curvo in fondo alla sezione (home) */
.section--divider {
  padding-bottom: calc(3.3vmax + 6vw);
  background: transparent;
}

.section--divider::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: var(--light);
  border-radius: 0 0 50% 50% / 0 0 6vw 6vw;
}

/* Sfondo immagine a tutta larghezza (pagina servizi) */
.section__bg {
  position: absolute;
  inset: 0;
  z-index: -1;
  overflow: hidden;
}

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

.section__bg::after {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--black);
  opacity: 0.15;
}

.spacer {
  height: calc(2 * 24px + var(--gap));
}

@media (min-width: 768px) {
  .spacer {
    height: calc(6 * var(--row) + 5 * var(--gap));
  }
}

/* --------------------------------------------------------------------------
   Griglia (8 colonne su mobile, 24 su desktop, più due colonne di margine)
   Ogni blocco riceve --am (area mobile) e --a (area desktop).
   -------------------------------------------------------------------------- */

.grid {
  display: grid;
  position: relative;
  grid-template-columns:
    minmax(calc(6vw - var(--gap)), 1fr)
    repeat(8, minmax(0, calc((var(--max-width) - var(--gap) * 7) / 8)))
    minmax(calc(6vw - var(--gap)), 1fr);
  grid-template-rows: repeat(var(--rows-m), minmax(24px, auto));
  gap: var(--gap);
  overflow-x: clip;
}

.grid > .block {
  grid-area: var(--am);
  min-width: 0;
}

.grid > .block--end {
  align-self: end;
}

@media (min-width: 768px) {
  .grid {
    grid-template-columns:
      minmax(calc(4vw - var(--gap)), 1fr)
      repeat(24, minmax(0, calc((var(--max-width) - var(--gap) * 23) / 24)))
      minmax(calc(4vw - var(--gap)), 1fr);
    grid-template-rows: repeat(var(--rows), minmax(var(--row), auto));
  }

  .grid > .block {
    grid-area: var(--a);
  }
}

/* Blocchi immagine */
.media {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 100%;
  overflow: hidden;
}

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

.media--contain img {
  object-fit: contain;
}

.media--dim::after {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.51);
}

/* --------------------------------------------------------------------------
   Accordion
   -------------------------------------------------------------------------- */

.accordion {
  margin: 0;
  padding: 0;
  list-style: none;
}

.accordion__item {
  border-bottom: 1px solid var(--black);
}

.accordion__item:first-child {
  border-top: 1px solid var(--black);
}

.accordion__heading {
  margin: 0;
}

.accordion__btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 28px 0;
  border: 0;
  background: none;
  font: inherit;
  letter-spacing: inherit;
  line-height: inherit;
  text-align: left;
  cursor: pointer;
}

.accordion__icon {
  position: relative;
  flex: 0 0 15px;
  width: 15px;
  height: 15px;
  margin-left: 1em;
}

.accordion__icon::before,
.accordion__icon::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 0;
  width: 100%;
  height: 1px;
  background: currentColor;
  transition: transform 0.3s ease;
}

.accordion__icon::after {
  transform: rotate(90deg);
}

.accordion__item.is-open .accordion__icon::after {
  transform: rotate(0deg);
}

.js .accordion__panel {
  height: 0;
  overflow: hidden;
  visibility: hidden;
  transition: height 0.3s ease, visibility 0s linear 0.3s;
}

.js .accordion__item.is-open .accordion__panel {
  visibility: visible;
  transition: height 0.3s ease;
}

.accordion__panel p {
  max-width: 70%;
  margin: 0;
  padding-bottom: 28px;
}

@media (max-width: 767px) {
  .accordion__panel p {
    max-width: 100%;
  }
}

/* --------------------------------------------------------------------------
   Recensioni
   -------------------------------------------------------------------------- */

.quote,
.quote blockquote,
.quote blockquote p {
  margin: 0;
}

.quote figcaption {
  margin-top: 1rem;
  font-style: italic;
}

/* --------------------------------------------------------------------------
   Modulo di contatto
   -------------------------------------------------------------------------- */

.form fieldset {
  min-width: 0;
  padding: 0;
  border: 0;
}

.form__field {
  margin: 0 0 24px;
}

.form__title {
  display: block;
  margin: 0 0 6px;
  padding: 0;
  line-height: 1.6;
}

.form__row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.form__sublabel {
  display: block;
  margin-bottom: 2px;
  font-size: 1rem;
  line-height: 1.6;
}

.form__req {
  margin-left: 0.3em;
  font-size: 1rem;
  opacity: 0.7;
}

.form input,
.form textarea {
  --s: 1.2;
  display: block;
  width: 100%;
  margin: 0;
  padding: 13px 1.1em;
  border: 1px solid var(--black);
  border-radius: 300px;
  background: transparent;
  color: var(--black);
  font-family: var(--font-body);
  line-height: normal;
  appearance: none;
  -webkit-appearance: none;
  transition: box-shadow 0.15s ease;
}

.form textarea {
  min-height: 100px;
  border-radius: 30px;
  resize: vertical;
}

.form input:hover,
.form textarea:hover,
.form input:focus,
.form textarea:focus {
  outline: none;
  box-shadow: 0 0 0 1px var(--black);
}

.form [aria-invalid="true"] {
  border-color: var(--error);
  box-shadow: 0 0 0 1px var(--error);
}

.form__error {
  --s: 1;
  margin: 0 0 6px;
  color: var(--error);
  line-height: 1.5;
}

.btn--submit {
  --s: 1;
  padding: 1.05em 1.35em;
  text-transform: uppercase;
}

.form__status {
  --s: 1;
  margin: 1rem 0 0;
}

.form__status:empty {
  display: none;
}

.form__status.is-error {
  color: var(--error);
}

.form__success {
  padding: 2em 0;
}

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

/* --------------------------------------------------------------------------
   Elenco servizi (carosello)
   -------------------------------------------------------------------------- */

.list-section {
  overflow: hidden;
  padding: 6.6vmax 0;
}

.list-section__title {
  margin: 0;
  padding: 0 var(--gutter) 70px;
}

.carousel {
  position: relative;
}

.carousel__viewport {
  touch-action: pan-y;
}

.carousel__track {
  display: flex;
  gap: 20px;
  margin: 0;
  padding: 0 var(--gutter);
  list-style: none;
  will-change: transform;
}

.carousel__slide {
  flex: 0 0 calc((100% - 80px) / 3);
  min-width: 0;
  text-align: center;
}

.carousel__title {
  --s: 2.5;
  margin: 0 0 0.15em;
}

.carousel__slide p {
  --s: 1;
  margin: 0 0 1em;
}

.carousel__arrow {
  position: absolute;
  bottom: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 60px;
  height: 60px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--arrow-bg);
  color: var(--white);
  cursor: pointer;
  transition: opacity 0.1s linear;
}

.carousel__arrow:hover {
  opacity: 0.8;
}

.carousel__arrow svg {
  width: 36px;
  height: 18px;
}

.carousel__arrow--prev { left: calc(var(--gutter) + 20px); }
.carousel__arrow--next { right: calc(var(--gutter) + 20px); }

/* Senza JavaScript il carosello diventa un elenco scorrevole */
html:not(.js) .carousel__viewport {
  overflow-x: auto;
}

html:not(.js) .carousel__arrow {
  display: none;
}

@media (max-width: 767px) {
  .carousel {
    padding-bottom: 80px;
  }

  .carousel__slide {
    flex-basis: 100%;
  }

  .carousel__arrow {
    width: 50px;
    height: 50px;
  }

  .carousel__arrow svg {
    width: 30px;
  }

  .carousel__arrow--prev { left: var(--gutter); }
  .carousel__arrow--next { right: var(--gutter); }
}

/* --------------------------------------------------------------------------
   Animazioni in entrata (dissolvenza + scorrimento)
   -------------------------------------------------------------------------- */

.js [data-anim] {
  opacity: 0;
  transform: translateY(40px);
  transition:
    opacity 0.6s ease var(--delay, 0s),
    transform 0.6s ease var(--delay, 0s);
}

.js [data-anim].is-in {
  opacity: 1;
  transform: none;
}

@media (prefers-reduced-motion: reduce) {
  .js [data-anim] {
    opacity: 1;
    transform: none;
    transition: none;
  }

  .menu,
  .menu.is-open,
  .js .accordion__panel,
  .accordion__icon::after {
    transition: none;
  }
}
