/* ==========================================================================
   Ecocentro Trieste — main stylesheet
   Single shared stylesheet. Layers, lowest to highest priority:
   tokens → reset → base → layout → components → utilities
   Design rules: docs/design-system.md
   ========================================================================== */

@layer tokens, reset, base, layout, components, utilities;

/* --------------------------------------------------------------------------
   Fonts (self-hosted, SIL OFL — see assets/fonts/OFL-*.txt)
   -------------------------------------------------------------------------- */
@font-face {
  font-family: "Fraunces";
  src: url("../fonts/fraunces-latin.woff2") format("woff2");
  font-weight: 300 800;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Fraunces";
  src: url("../fonts/fraunces-latin-ext.woff2") format("woff2");
  font-weight: 300 800;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Figtree";
  src: url("../fonts/figtree-latin.woff2") format("woff2");
  font-weight: 300 900;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Figtree";
  src: url("../fonts/figtree-latin-ext.woff2") format("woff2");
  font-weight: 300 900;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Figtree";
  src: url("../fonts/figtree-latin-italic.woff2") format("woff2");
  font-weight: 300 900;
  font-style: italic;
  font-display: swap;
}

/* --------------------------------------------------------------------------
   Tokens
   -------------------------------------------------------------------------- */
@layer tokens {
  :root {
    /* Brand palette (from the logo: green #3cba84, brown #5c4b3f) */
    --green-50: #eef8f3;
    --green-100: #e3f4ec;
    --green-400: #3cba84;   /* logo green: decorative, or text on dark only */
    --green-700: #1a7350;   /* primary action; 5.8:1 with white */
    --green-800: #155c40;   /* hover/pressed */
    --brown-900: #2b211b;   /* body text, dark sections */
    --brown-800: #3d3029;
    --brown-700: #5c4b3f;   /* logo brown */
    --brown-500: #8a7666;   /* borders, decorative only */
    --brown-200: #ddd2c4;
    --ochre-400: #d9b54a;   /* highlight on dark backgrounds only */
    --ochre-700: #8a6a12;   /* highlight text on light backgrounds */
    --cream-50: #faf7f2;
    --cream-100: #f3ede3;
    --cream-200: #e9e0d2;
    --white: #ffffff;
    --red-700: #a3261a;     /* errors; 6.6:1 on white */
    --red-50: #fbecea;

    /* Semantic colors */
    --color-bg: var(--cream-50);
    --color-surface: var(--white);
    --color-surface-alt: var(--cream-100);
    --color-text: var(--brown-900);
    --color-text-muted: #5f5249;
    --color-heading: var(--brown-900);
    --color-link: var(--green-700);
    --color-link-hover: var(--green-800);
    --color-border: var(--brown-200);
    --color-border-strong: var(--brown-500);
    --color-primary: var(--green-700);
    --color-primary-hover: var(--green-800);
    --color-on-primary: var(--white);
    --color-accent: var(--ochre-700);
    --color-focus: var(--green-700);
    --color-error: var(--red-700);
    --color-error-bg: var(--red-50);
    --color-success: var(--green-700);
    --color-success-bg: var(--green-50);

    /* Dark sections (footer, CTA bands, hero overlay) */
    --dark-bg: var(--brown-900);
    --dark-surface: var(--brown-800);
    --dark-text: var(--cream-50);
    --dark-text-muted: #d9cfc3;
    --dark-link: var(--green-400);
    --dark-accent: var(--ochre-400);
    --dark-focus: var(--ochre-400);

    /* Typography */
    --font-heading: "Fraunces", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
    --font-body: "Figtree", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;

    --text-xs: 0.8125rem;                                   /* 13px */
    --text-sm: 0.9375rem;                                   /* 15px */
    --text-base: 1.0625rem;                                 /* 17px */
    --text-lg: clamp(1.125rem, 1.05rem + 0.35vw, 1.3125rem);
    --text-xl: clamp(1.25rem, 1.1rem + 0.6vw, 1.5rem);
    --text-2xl: clamp(1.5rem, 1.25rem + 1vw, 2rem);
    --text-3xl: clamp(1.875rem, 1.45rem + 1.8vw, 2.75rem);
    --text-4xl: clamp(2.25rem, 1.6rem + 2.8vw, 3.75rem);

    --leading-tight: 1.15;
    --leading-snug: 1.3;
    --leading-normal: 1.6;

    --weight-regular: 400;
    --weight-medium: 500;
    --weight-semibold: 600;
    --weight-bold: 700;

    --measure: 68ch;

    /* Spacing (4px base) */
    --space-1: 0.25rem;
    --space-2: 0.5rem;
    --space-3: 0.75rem;
    --space-4: 1rem;
    --space-5: 1.5rem;
    --space-6: 2rem;
    --space-7: 3rem;
    --space-8: 4rem;
    --space-9: 6rem;
    --section-y: clamp(3rem, 2rem + 4vw, 6rem);

    /* Layout */
    --container: 72rem;
    --container-narrow: 46rem;
    --gutter: clamp(1rem, 0.5rem + 2.5vw, 2rem);
    --header-h: 4.5rem;

    /* Shape and depth */
    --radius-sm: 0.375rem;
    --radius-md: 0.75rem;
    --radius-lg: 1.25rem;
    --radius-pill: 999px;
    --shadow-sm: 0 1px 2px rgb(43 33 27 / 0.08);
    --shadow-md: 0 6px 20px -6px rgb(43 33 27 / 0.18);
    --shadow-lg: 0 18px 40px -12px rgb(43 33 27 / 0.28);

    /* Motion */
    --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
    --duration: 180ms;

    color-scheme: light;
  }
}

/* --------------------------------------------------------------------------
   Reset
   -------------------------------------------------------------------------- */
@layer reset {
  *, *::before, *::after { box-sizing: border-box; }
  * { margin: 0; }
  html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
  body { min-height: 100vh; }
  img, picture, svg, video { display: block; max-width: 100%; }
  img { height: auto; }
  input, button, textarea, select { font: inherit; color: inherit; }
  button { cursor: pointer; }
  p, h1, h2, h3, h4 { overflow-wrap: break-word; }
  table { border-collapse: collapse; }
  [hidden] { display: none !important; }
  @media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
      animation-duration: 0.01ms !important;
      animation-iteration-count: 1 !important;
      transition-duration: 0.01ms !important;
      scroll-behavior: auto !important;
    }
  }
}

/* --------------------------------------------------------------------------
   Base
   -------------------------------------------------------------------------- */
@layer base {
  html { scroll-padding-top: calc(var(--header-h) + var(--space-4)); }
  @media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }

  body {
    background: var(--color-bg);
    color: var(--color-text);
    font-family: var(--font-body);
    font-size: var(--text-base);
    line-height: var(--leading-normal);
    font-weight: var(--weight-regular);
  }

  h1, h2, h3, h4 {
    font-family: var(--font-heading);
    color: var(--color-heading);
    font-weight: var(--weight-semibold);
    line-height: var(--leading-tight);
    letter-spacing: -0.01em;
    text-wrap: balance;
  }
  h1 { font-size: var(--text-4xl); }
  h2 { font-size: var(--text-3xl); }
  h3 { font-size: var(--text-xl); line-height: var(--leading-snug); }
  h4 { font-size: var(--text-lg); font-family: var(--font-body); font-weight: var(--weight-bold); letter-spacing: 0; }

  p, ul, ol, dl, table { max-width: var(--measure); }
  p { text-wrap: pretty; }
  ul, ol { padding-left: 1.25em; }
  li + li { margin-top: var(--space-1); }
  strong { font-weight: var(--weight-bold); }

  a {
    color: var(--color-link);
    text-decoration-thickness: 1px;
    text-underline-offset: 0.18em;
    transition: color var(--duration) var(--ease);
  }
  a:hover { color: var(--color-link-hover); text-decoration-thickness: 2px; }

  :focus-visible {
    outline: 3px solid var(--color-focus);
    outline-offset: 3px;
    border-radius: var(--radius-sm);
  }

  ::selection { background: var(--green-100); color: var(--brown-900); }

  hr { border: 0; border-top: 1px solid var(--color-border); margin-block: var(--space-6); }

  address { font-style: normal; }
}

/* --------------------------------------------------------------------------
   Layout
   -------------------------------------------------------------------------- */
@layer layout {
  .container {
    width: 100%;
    max-width: calc(var(--container) + 2 * var(--gutter));
    margin-inline: auto;
    padding-inline: var(--gutter);
  }
  .container--narrow { max-width: calc(var(--container-narrow) + 2 * var(--gutter)); }

  .section { padding-block: var(--section-y); }
  .section--alt { background: var(--color-surface-alt); }
  .section--dark {
    background: var(--dark-bg);
    color: var(--dark-text);
    --color-heading: var(--dark-text);
    --color-text-muted: var(--dark-text-muted);
    --color-link: var(--dark-link);
    --color-link-hover: var(--white);
    --color-focus: var(--dark-focus);
    --color-border: var(--brown-700);
    --color-accent: var(--dark-accent);
  }

  .section__head { margin-bottom: var(--space-6); max-width: var(--measure); }
  .section__head > * + * { margin-top: var(--space-3); }
  .section__foot { margin-top: var(--space-6); }
  /* A sub-topic (h3 block) inside a long section, e.g. the phases on compost.html */
  .section__head + .split, .stats + .section__part, .section__part + .section__part, .split + .section__part, .section__foot + .section__part { margin-top: var(--space-8); }

  /* Vertical rhythm for prose blocks */
  .flow > * + * { margin-top: var(--flow-space, var(--space-4)); }
  .flow > :is(h2, h3) { --flow-space: var(--space-6); }
  .flow > :is(h2, h3) + * { --flow-space: var(--space-3); }

  /* Auto-fitting grid */
  .grid {
    display: grid;
    list-style: none;
    padding: 0;
    max-width: none;
    gap: var(--grid-gap, var(--space-5));
    grid-template-columns: repeat(auto-fit, minmax(min(100%, var(--grid-min, 16rem)), 1fr));
  }
  .grid > * { margin: 0; }
  .grid--2 { --grid-min: 22rem; }
  /* Two-column grids stay 2×2 on desktop (auto-fit would give 3 + 1 with four cards) */
  @media (min-width: 48rem) { .grid--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
  .grid--4 { --grid-min: 13rem; }

  /* Two columns: content + aside (stacks on small screens) */
  .split { display: grid; gap: var(--space-7); }
  @media (min-width: 60rem) {
    .split { grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); align-items: start; }
    .split--even { grid-template-columns: 1fr 1fr; }
  }

  .cluster { display: flex; flex-wrap: wrap; gap: var(--space-3); align-items: center; }
}

/* --------------------------------------------------------------------------
   Components
   -------------------------------------------------------------------------- */
@layer components {

  /* Skip link ------------------------------------------------------------ */
  .skip-link {
    position: absolute;
    left: var(--space-4);
    top: -100%;
    z-index: 100;
    padding: var(--space-3) var(--space-4);
    background: var(--brown-900);
    color: var(--white);
    border-radius: var(--radius-sm);
    font-weight: var(--weight-semibold);
  }
  .skip-link:focus { top: var(--space-3); color: var(--white); }

  /* Icons ---------------------------------------------------------------- */
  /* Stroke styles set here (not only inside sprite.svg): Firefox does not apply a <style> block from an
     external sprite to <use> instances, which rendered the icons as filled black shapes. */
  .icon {
    width: 1.25em; height: 1.25em; flex: none;
    fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round;
  }
  .icon--lg { width: 2rem; height: 2rem; }

  /* Buttons -------------------------------------------------------------- */
  .button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    min-height: 2.875rem;           /* ≥ 44px target */
    padding: 0.625rem 1.25rem;
    border: 2px solid transparent;
    border-radius: var(--radius-pill);
    font-family: var(--font-body);
    font-size: var(--text-base);
    font-weight: var(--weight-semibold);
    line-height: 1.2;
    text-decoration: none;
    background: var(--color-primary);
    color: var(--color-on-primary);
    transition: background-color var(--duration) var(--ease), color var(--duration) var(--ease), border-color var(--duration) var(--ease), transform var(--duration) var(--ease);
  }
  .button:hover { background: var(--color-primary-hover); color: var(--color-on-primary); text-decoration: none; }
  .button:active { transform: translateY(1px); }

  .button--secondary {
    background: transparent;
    color: var(--color-primary);
    border-color: currentColor;
  }
  .button--secondary:hover { background: var(--color-primary); color: var(--color-on-primary); border-color: var(--color-primary); }

  .button--ghost { background: transparent; color: var(--color-link); padding-inline: var(--space-2); }
  .button--ghost:hover { background: transparent; color: var(--color-link-hover); text-decoration: underline; }

  /* On dark backgrounds */
  .section--dark .button, .hero .button { --color-primary: var(--green-400); --color-on-primary: var(--brown-900); --color-primary-hover: var(--white); }
  .section--dark .button--secondary, .hero .button--secondary { color: var(--dark-text); }
  .section--dark .button--secondary:hover, .hero .button--secondary:hover { background: var(--dark-text); color: var(--brown-900); border-color: var(--dark-text); }

  .button--sm { min-height: 2.5rem; padding: 0.4rem 0.9rem; font-size: var(--text-sm); }

  /* Eyebrow / kicker ----------------------------------------------------- */
  .eyebrow {
    display: inline-block;
    font-family: var(--font-body);
    font-size: var(--text-sm);
    font-weight: var(--weight-bold);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--color-accent);
  }
  .lead { font-size: var(--text-lg); color: var(--color-text-muted); max-width: 60ch; }

  /* Header --------------------------------------------------------------- */
  .site-header {
    position: sticky;
    top: 0;
    z-index: 50;
    /* Solid background on purpose: backdrop-filter would make the header the containing
       block of the fixed mobile nav panel and collapse it. */
    background: var(--color-bg);
    border-bottom: 1px solid var(--color-border);
  }
  .site-header__inner {
    display: flex;
    align-items: center;
    gap: var(--space-4);
    min-height: var(--header-h);
  }
  .site-header__logo { display: block; flex-shrink: 0; margin-right: auto; padding-block: var(--space-2); }
  .site-header__logo img { width: clamp(8rem, 6rem + 8vw, 12.5rem); }
  .site-header__call { white-space: nowrap; }
  @media (min-width: 72rem) { .site-header__call { order: 3; } }
  .site-header__call-label { display: none; }
  @media (min-width: 30rem) { .site-header__call-label { display: inline; } }

  /* Navigation: mobile-first panel, horizontal from 72rem (1152px, fits the longer English labels) */
  .nav-toggle {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    min-height: 2.75rem;
    padding: 0.4rem 0.75rem;
    border: 1px solid var(--color-border-strong);
    border-radius: var(--radius-pill);
    background: var(--color-surface);
    font-weight: var(--weight-semibold);
  }
  /* Very narrow screens (≤ 384px, e.g. 320px or 400% zoom): icon-only menu button, label kept for screen readers */
  @media (max-width: 23.99rem) {
    .nav-toggle { padding-inline: 0.6rem; }
    .nav-toggle__label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  }
  .nav {
    position: fixed;
    inset: var(--header-h) 0 0 0;
    overflow-y: auto;
    background: var(--color-bg);
    padding: var(--space-5) var(--gutter) var(--space-8);
    border-top: 1px solid var(--color-border);
  }
  /* Without JS the nav is always visible below the header (progressive enhancement) */
  .no-js .nav { position: static; padding: var(--space-3) 0; border: 0; }
  .js .nav:not(.is-open) { display: none; }

  .nav__list { list-style: none; padding: 0; max-width: none; }
  .nav__list > li + li { margin-top: 0; border-top: 1px solid var(--color-border); }
  .nav__link, .nav__disclosure {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-1);
    font-size: var(--text-lg);
    font-weight: var(--weight-semibold);
    color: var(--color-text);
    text-decoration: none;
    background: none;
    border: 0;
    text-align: left;
  }
  .nav__link:hover, .nav__disclosure:hover { color: var(--color-link); }
  .nav__link[aria-current="page"], .nav__item--current > .nav__disclosure { color: var(--color-link); }
  .nav__disclosure .icon { transition: transform var(--duration) var(--ease); }
  .nav__disclosure[aria-expanded="true"] .icon { transform: rotate(180deg); }
  .nav__sub { list-style: none; padding: 0 0 var(--space-3) var(--space-4); }
  .nav__sub a { display: block; padding: var(--space-2) var(--space-1); color: var(--color-text); text-decoration: none; }
  .nav__sub a:hover, .nav__sub a[aria-current="page"] { color: var(--color-link); text-decoration: underline; }
  .nav__sub li + li { margin-top: 0; }

  .lang-switch { display: flex; gap: var(--space-1); list-style: none; padding: 0; margin-top: var(--space-5); }
  .lang-switch a {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 2.75rem; min-height: 2.75rem;
    border-radius: var(--radius-pill);
    font-size: var(--text-sm); font-weight: var(--weight-bold);
    color: var(--color-text); text-decoration: none;
  }
  .lang-switch li + li { margin-top: 0; }
  .lang-switch a[aria-current="true"] { background: var(--brown-900); color: var(--white); }
  .lang-switch a:not([aria-current="true"]):hover { background: var(--cream-200); }

  @media (min-width: 72rem) {
    .nav-toggle { display: none; }
    .js .nav:not(.is-open), .nav, .no-js .nav {
      display: flex;
      align-items: center;
      gap: var(--space-4);
      position: static;
      padding: 0;
      border: 0;
      background: none;
      overflow: visible;
    }
    .nav__list { display: flex; align-items: center; gap: var(--space-1); }
    .nav__list > li { position: relative; }
    .nav__list > li + li { border: 0; }
    .nav__link, .nav__disclosure {
      width: auto;
      padding: var(--space-2) var(--space-2);
      font-size: var(--text-base);
      white-space: nowrap;
      border-radius: var(--radius-pill);
    }
    .nav__link:hover, .nav__disclosure:hover { background: var(--cream-100); }
    .nav__link[aria-current="page"], .nav__item--current > .nav__disclosure { box-shadow: inset 0 -2px 0 var(--color-link); border-radius: 0; }
    .nav__sub {
      position: absolute;
      top: calc(100% + var(--space-2));
      left: 0;
      min-width: 16rem;
      padding: var(--space-2);
      background: var(--color-surface);
      border: 1px solid var(--color-border);
      border-radius: var(--radius-md);
      box-shadow: var(--shadow-lg);
    }
    .nav__sub a { border-radius: var(--radius-sm); padding: var(--space-2) var(--space-3); }
    .nav__sub a:hover { background: var(--cream-100); text-decoration: none; }
    .lang-switch { margin: 0; padding-left: var(--space-3); border-left: 1px solid var(--color-border); }
  }
  /* Small desktops: icon-only call button so the menu fits on one line (label stays for screen readers) */
  @media (min-width: 72rem) and (max-width: 79.99rem) {
    .site-header__call-label { display: none; }
  }

  /* Breadcrumb ----------------------------------------------------------- */
  .breadcrumb ol { display: flex; flex-wrap: wrap; list-style: none; padding: 0; font-size: var(--text-sm); color: var(--color-text-muted); max-width: none; }
  .breadcrumb li + li { margin-top: 0; }
  .breadcrumb li + li::before { content: "›"; margin-inline: var(--space-2); color: var(--brown-500); }
  .breadcrumb a { color: inherit; }
  .breadcrumb [aria-current="page"] { color: var(--color-text); }

  /* Hero ----------------------------------------------------------------- */
  .hero {
    position: relative;
    isolation: isolate;
    display: grid;
    align-items: end;
    min-height: min(82vh, 44rem);
    padding-block: var(--space-9) var(--space-8);
    color: var(--dark-text);
    --color-heading: var(--white);
    --color-focus: var(--dark-focus);
    --color-accent: var(--dark-accent);
  }
  .hero__media { position: absolute; inset: 0; z-index: -2; }
  .hero__media > picture { display: block; height: 100%; }
  .hero__media img { width: 100%; height: 100%; object-fit: cover; }
  .hero::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    background: linear-gradient(180deg, rgb(43 33 27 / 0.45) 0%, rgb(43 33 27 / 0.75) 40%, rgb(43 33 27 / 0.92) 100%);
  }
  .hero__content { max-width: 40rem; }
  .hero__content > * + * { margin-top: var(--space-4); }
  .hero .lead { color: var(--dark-text); }
  /* Ochre is too light over bright photo areas (2.45:1 measured): the hero eyebrow uses cream text. */
  .hero .eyebrow { color: var(--dark-text); }
  .hero .cluster { margin-top: var(--space-5); }

  /* Page header (inner pages) ------------------------------------------- */
  .page-header { padding-block: var(--space-7) var(--space-6); background: var(--color-surface-alt); border-bottom: 1px solid var(--color-border); }
  .page-header > .container > * + * { margin-top: var(--space-3); }

  /* Cards ---------------------------------------------------------------- */
  .card {
    position: relative;
    display: flex;
    flex-direction: column;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: box-shadow var(--duration) var(--ease), transform var(--duration) var(--ease);
  }
  .card__media { aspect-ratio: 4 / 3; overflow: hidden; background: var(--cream-200); }
  .card__media > picture, .gallery__item > picture { height: 100%; }
  .card__media img { width: 100%; height: 100%; object-fit: cover; }
  .card__body { display: flex; flex-direction: column; flex: 1; gap: var(--space-3); padding: var(--space-5); }
  .card__body > :last-child:not(p) { margin-top: auto; } /* links and buttons sit at the bottom; text stays top-aligned */
  .card__title { font-size: var(--text-xl); }
  .card__title a { color: inherit; text-decoration: none; }
  /* Whole card clickable via the title link (keeps one link per card for screen readers) */
  .card--link .card__title a::after { content: ""; position: absolute; inset: 0; border-radius: inherit; }
  .card--link:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
  .card--link:hover .card__title a { color: var(--color-link); }
  .card--link:focus-within { outline: 3px solid var(--color-focus); outline-offset: 3px; }
  .card--link .card__title a:focus-visible { outline: none; }
  .card__more { display: inline-flex; align-items: center; gap: var(--space-2); font-weight: var(--weight-semibold); color: var(--color-link); }

  /* Path card (audience entry points on home) */
  .path-card { border-top: 4px solid var(--green-400); }
  .path-card__icon {
    display: grid; place-items: center;
    width: 3.25rem; height: 3.25rem;
    border-radius: 50%;
    background: var(--green-100);
    color: var(--green-800);
  }

  /* Product card */
  /* Packshots are 5:8 renders: a 2:3 box filled edge to edge trims only ~3% top and bottom (ornaments, never the
     product name) and leaves no empty bands. */
  .product-card .card__media { aspect-ratio: 2 / 3; }
  .product-card .card__media img { object-fit: cover; }

  /* Phones: stacked product card with a centred, narrower portrait image (a full-width 2:3 image would be ~520px tall) */
  @media (max-width: 39.99rem) {
    .product-card .card__media { width: min(64%, 14rem); margin: var(--space-5) auto 0; border-radius: var(--radius-md); }
  }

  /* Side cards (products and services pages): image beside the text from 40rem, in a .card-list that is one column
     until 64rem and 2×2 above. Products keep the 2:3 packshot shape; other cards (landscape photos) fill the card's
     full height, cropped to cover. */
  /* Featured first item (services: "Servizi ambientali e verde", owner feedback 2026-11-03): full row, then the
     other three in one row on desktop */
  @media (min-width: 48rem) { .grid--featured > :first-child { grid-column: 1 / -1; } }
  @media (min-width: 64rem) { .grid--featured { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
  @media (min-width: 40rem) { .grid--featured > .card--row:first-child .card__media { flex-basis: clamp(8.5rem, 42%, 30rem); } }
  .card-list { grid-template-columns: minmax(0, 1fr); }
  @media (min-width: 64rem) { .card-list { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
  @media (min-width: 40rem) {
    .card--row { flex-direction: row; }
    .card--row .card__media { flex: 0 0 clamp(8.5rem, 36%, 14rem); aspect-ratio: auto; min-height: 12rem; }
    .card--row.product-card .card__media { aspect-ratio: 2 / 3; min-height: 0; align-self: flex-start; }
  }

  /* Material cards (products page): small card with a round photo, like the owner's "Materiali checklist" */
  /* Groups: full-width rows of 4 cards; the two small groups share a row on desktop, so every card has the same width */
  .materials-groups { display: grid; gap: var(--space-7) var(--space-4); }
  @media (min-width: 64rem) {
    .materials-groups { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .materials-group--full { grid-column: 1 / -1; }
  }
  .materials-group > h2 { margin: 0; font-size: var(--text-xl); line-height: var(--leading-snug); }
  .materials-group__note { margin: var(--space-1) 0 0; font-size: var(--text-sm); color: var(--color-text-muted); }
  .materials { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-4); list-style: none; padding: 0; margin: var(--space-4) 0 0; max-width: none; }
  @media (min-width: 40rem) { .materials { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
  @media (min-width: 64rem) { .materials-group--half .materials { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
  .material { margin: 0; padding: var(--space-4) var(--space-3); display: flex; flex-direction: column; align-items: center; gap: var(--space-2); text-align: center; background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-md); }
  .material__media { width: 7rem; aspect-ratio: 1; border-radius: 50%; overflow: hidden; border: 3px solid var(--color-heading); background: var(--color-surface-alt); }
  .material__media img { display: block; width: 100%; height: 100%; object-fit: cover; }
  .material__media--empty { display: grid; place-items: center; padding: var(--space-3); border: 2px dashed var(--color-border-strong); color: var(--color-text-muted); font-size: var(--text-xs); line-height: 1.3; }
  .material__media--icon { display: grid; place-items: center; color: var(--color-primary); }
  .material__media--icon .icon { width: 2.75rem; height: 2.75rem; }
  .material__name { margin: 0; font-family: var(--font-body); font-weight: var(--weight-bold); font-size: var(--text-base); line-height: 1.25; color: var(--color-heading); }
  .material p { margin: 0; font-size: var(--text-sm); color: var(--color-text-muted); }
  .product-card__meta { display: grid; gap: var(--space-1); font-size: var(--text-sm); color: var(--color-text-muted); }
  .product-card__meta dt { font-weight: var(--weight-bold); color: var(--color-text); }
  .product-card__meta dd { margin: 0 0 var(--space-2); }

  /* Service row (icon + text) */
  .service-list { list-style: none; padding: 0; display: grid; gap: var(--space-4); max-width: none; }
  @media (min-width: 40rem) { .service-list { grid-template-columns: repeat(2, 1fr); } }
  .service-list li { margin: 0; }
  .service-item {
    display: flex; gap: var(--space-4); align-items: flex-start;
    padding: var(--space-5);
    border-radius: var(--radius-md);
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    text-decoration: none; color: inherit; height: 100%;
  }
  .service-item:hover { border-color: var(--color-primary); color: inherit; }
  .service-item:hover h3 { color: var(--color-link); }
  .service-item .icon { width: 2.25rem; height: 2.25rem; color: var(--green-700); }
  .service-item p { color: var(--color-text-muted); margin-top: var(--space-1); }
  .service-item p + p { margin-top: var(--space-2); }
  @media (min-width: 40rem) { .service-list--featured > :first-child { grid-column: 1 / -1; } }
  @media (min-width: 64rem) { .service-list--featured { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
  /* The featured item spans the row: its text flows in two columns so it fills the width at a readable line length */
  @media (min-width: 64rem) {
    .service-list--featured > :first-child .service-item > div { columns: 2; column-gap: var(--space-7); }
    .service-list--featured > :first-child .service-item h3 { column-span: all; margin-bottom: var(--space-2); }
    .service-list--featured > :first-child .service-item p { break-inside: avoid; }
    .service-list--featured > :first-child .service-item p:first-of-type { margin-top: 0; }
  }

  /* Stats / facts strip -------------------------------------------------- */
  .stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 10rem), 1fr)); gap: var(--space-5); list-style: none; padding: 0; max-width: none; }
  .stats li { margin: 0; padding-left: var(--space-4); border-left: 3px solid var(--color-accent); }
  .stats__value { display: block; font-family: var(--font-heading); font-size: var(--text-2xl); white-space: nowrap; font-weight: var(--weight-semibold); line-height: 1.1; color: var(--color-heading); }
  .stats__label { color: var(--color-text-muted); font-size: var(--text-sm); }

  /* Info list (contacts, hours) ----------------------------------------- */
  .info-list { list-style: none; padding: 0; display: grid; gap: var(--space-3); }
  .info-list li { display: flex; gap: var(--space-3); align-items: flex-start; margin: 0; }
  .info-list .icon { margin-top: 0.2em; color: var(--color-accent); }

  /* Tables --------------------------------------------------------------- */
  .table-wrap { overflow-x: auto; max-width: 100%; border: 1px solid var(--color-border); border-radius: var(--radius-md); background: var(--color-surface); }
  .table { width: 100%; max-width: none; font-size: var(--text-sm); }
  .table caption { text-align: left; padding: var(--space-3) var(--space-4); font-weight: var(--weight-bold); }
  .table th, .table td { padding: var(--space-3) var(--space-4); text-align: left; vertical-align: top; border-top: 1px solid var(--color-border); }
  .table thead th { background: var(--color-surface-alt); border-top: 0; font-weight: var(--weight-bold); }
  .table tbody th { font-weight: var(--weight-semibold); white-space: nowrap; }
  .table .is-closed { color: var(--color-text-muted); }
  .section--dark .table-wrap { background: transparent; }
  .section--dark .table thead th { background: var(--dark-surface); }
  .code { font-variant-numeric: tabular-nums; white-space: nowrap; font-weight: var(--weight-semibold); }

  /* Steps (numbered process) --------------------------------------------- */
  .steps { list-style: none; padding: 0; counter-reset: step; display: grid; gap: var(--space-5); max-width: none; }
  .steps > li { counter-increment: step; position: relative; padding-left: 3.5rem; margin: 0; }
  .steps > li::before {
    content: counter(step);
    position: absolute; left: 0; top: 0;
    display: grid; place-items: center;
    width: 2.5rem; height: 2.5rem; border-radius: 50%;
    background: var(--color-primary); color: var(--color-on-primary);
    font-family: var(--font-heading); font-weight: var(--weight-bold);
  }

  /* Download link -------------------------------------------------------- */
  .download {
    display: inline-flex; align-items: flex-start; gap: var(--space-2);
    font-weight: var(--weight-semibold);
  }
  .download .icon { margin-top: 0.1em; }
  .download small { color: var(--color-text-muted); font-weight: var(--weight-regular); white-space: nowrap; }

  /* CTA band ------------------------------------------------------------- */
  .cta-band { background: var(--dark-surface); }
  .cta-band__inner { display: grid; gap: var(--space-5); align-items: center; }
  @media (min-width: 48rem) { .cta-band__inner { grid-template-columns: 1fr auto; } }
  .cta-band h2 { font-size: var(--text-2xl); }

  /* Forms ---------------------------------------------------------------- */
  .form { display: grid; gap: var(--space-5); max-width: 40rem; }
  .form__row { display: grid; gap: var(--space-5); }
  @media (min-width: 40rem) { .form__row { grid-template-columns: 1fr 1fr; } }
  .field { display: grid; gap: var(--space-2); }
  .field__label { font-weight: var(--weight-semibold); }
  .field__label .req { color: var(--color-error); }
  .field__hint { font-size: var(--text-sm); color: var(--color-text-muted); }
  .field__input {
    width: 100%;
    min-height: 2.875rem;
    padding: 0.625rem 0.875rem;
    border: 1.5px solid var(--color-border-strong);
    border-radius: var(--radius-sm);
    background: var(--color-surface);
    font-size: var(--text-base);
    line-height: 1.4;
  }
  textarea.field__input { min-height: 9rem; resize: vertical; }
  select.field__input { appearance: none; padding-right: 2.5rem; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%232b211b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 0.75rem center; background-size: 1.1rem; }
  .field__input:hover { border-color: var(--brown-700); }
  .field__input:focus-visible { outline-offset: 1px; border-color: var(--color-focus); }
  .field__input[aria-invalid="true"] { border-color: var(--color-error); background: var(--color-error-bg); }
  .field__error { display: flex; gap: var(--space-2); align-items: center; font-size: var(--text-sm); font-weight: var(--weight-semibold); color: var(--color-error); }
  .check { display: flex; gap: var(--space-3); align-items: flex-start; }
  .check input { width: 1.5rem; height: 1.5rem; margin-top: 0.15em; flex: none; accent-color: var(--green-700); }

  /* Alerts / status ------------------------------------------------------ */
  .alert {
    display: flex; gap: var(--space-3); align-items: flex-start;
    padding: var(--space-4) var(--space-5);
    border-radius: var(--radius-md);
    border-left: 4px solid currentColor;
  }
  .alert--success { background: var(--color-success-bg); color: var(--green-800); }
  .alert--error { background: var(--color-error-bg); color: var(--color-error); }
  .alert p { color: var(--color-text); }

  /* Gallery grid ---------------------------------------------------------- */
  .filters { display: flex; flex-wrap: wrap; gap: var(--space-2); margin-bottom: var(--space-5); list-style: none; padding: 0; max-width: none; }
  .filters li { margin: 0; }
  .filter {
    min-height: 2.5rem; padding: 0.4rem 1rem;
    border: 1.5px solid var(--color-border-strong); border-radius: var(--radius-pill);
    background: var(--color-surface); font-size: var(--text-sm); font-weight: var(--weight-semibold);
  }
  .filter[aria-pressed="true"] { background: var(--brown-900); border-color: var(--brown-900); color: var(--white); }
  .gallery { display: grid; gap: var(--space-2); grid-template-columns: repeat(2, 1fr); list-style: none; padding: 0; max-width: none; }
  @media (min-width: 40rem) { .gallery { gap: var(--space-3); grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr)); } }
  @media (max-width: 39.99rem) { .gallery__caption { font-size: var(--text-xs); padding: var(--space-4) var(--space-2) var(--space-1); } }
  .gallery li { margin: 0; }
  .gallery__item { display: block; position: relative; border-radius: var(--radius-md); overflow: hidden; aspect-ratio: 4 / 3; background: var(--cream-200); }
  .gallery__item img { width: 100%; height: 100%; object-fit: cover; transition: transform 400ms var(--ease); }
  .gallery__item:hover img { transform: scale(1.04); }
  .gallery__caption {
    position: absolute; inset: auto 0 0 0;
    padding: var(--space-5) var(--space-3) var(--space-2);
    background: linear-gradient(transparent, rgb(43 33 27 / 0.85));
    color: var(--white); font-size: var(--text-sm); font-weight: var(--weight-semibold);
  }

  /* Cookie banner -------------------------------------------------------- */
  .consent {
    position: fixed;
    inset: auto var(--space-3) var(--space-3) var(--space-3);
    z-index: 60;
    max-width: 34rem;
    margin-left: auto;
    padding: var(--space-5);
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
  }
  .consent:not(.consent--inline) { max-height: calc(100dvh - 2 * var(--space-3)); overflow-y: auto; }
  .consent--inline { position: static; margin: 0; }
  .consent h2 { font-size: var(--text-xl); padding-right: var(--space-7); }
  .consent h2:focus { outline: none; }
  .consent p { font-size: var(--text-sm); margin-top: var(--space-2); }
  .consent .cluster { margin-top: var(--space-4); }
  .consent .button { flex: 1 1 auto; }
  .consent__close {
    position: absolute; top: var(--space-3); right: var(--space-3);
    display: grid; place-items: center; width: 2.75rem; height: 2.75rem;
    border: 0; border-radius: 50%; background: transparent; color: var(--color-text);
  }
  .consent__close:hover { background: var(--cream-100); }
  .consent__prefs { margin-top: var(--space-4); padding-top: var(--space-4); border-top: 1px solid var(--color-border); }
  .consent__prefs fieldset { border: 0; padding: 0; margin: 0; display: grid; gap: var(--space-3); }
  .consent__prefs .check { font-size: var(--text-sm); }
  .consent__prefs .button { margin-top: var(--space-4); }

  /* Map placeholder (before consent) ------------------------------------ */
  .map-placeholder {
    display: grid; place-items: center; text-align: center; gap: var(--space-3);
    aspect-ratio: 4 / 3;
    padding: var(--space-5);
    border-radius: var(--radius-lg);
    background: var(--cream-200);
    border: 1px dashed var(--color-border-strong);
  }
  .map-placeholder .icon { margin-inline: auto; color: var(--color-accent); }
  .map-placeholder .cluster { justify-content: center; }
  .embed { width: 100%; aspect-ratio: 4 / 3; border: 0; border-radius: var(--radius-lg); background: var(--cream-200); }

  /* Lightbox (gallery) --------------------------------------------------- */
  .lightbox {
    margin: auto; /* the global reset removes the dialog's default centring */
    width: fit-content;
    max-width: min(100% - 2 * var(--space-3), 72rem);
    max-height: calc(100dvh - 2 * var(--space-3));
    padding: 0;
    border: 0;
    border-radius: var(--radius-lg);
    background: var(--brown-900);
    color: var(--dark-text);
    --color-focus: var(--dark-focus);
  }
  .lightbox::backdrop { background: rgb(29 23 19 / 0.85); }
  .lightbox__figure { margin: 0; display: grid; gap: var(--space-3); padding: var(--space-4); }
  .lightbox__figure img { width: auto; max-width: 100%; max-height: calc(100dvh - 10rem); margin-inline: auto; object-fit: contain; border-radius: var(--radius-md); }
  .lightbox__figure figcaption { font-size: var(--text-sm); color: var(--dark-text-muted); }
  .lightbox__bar { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); padding: var(--space-3) var(--space-4) 0; }
  .lightbox__count { font-size: var(--text-sm); color: var(--dark-text-muted); font-variant-numeric: tabular-nums; }
  .lightbox__controls { display: flex; gap: var(--space-2); }
  .lightbox__button {
    display: grid; place-items: center; width: 2.75rem; height: 2.75rem;
    border: 1px solid var(--brown-700); border-radius: 50%; background: transparent; color: var(--dark-text);
  }
  .lightbox__button:hover { background: var(--dark-text); color: var(--brown-900); }
  .icon--flip { transform: scaleX(-1); }

  /* Pager (previous / next within a section) ----------------------------- */
  .pager { display: grid; gap: var(--space-3); margin-top: var(--space-7); }
  @media (min-width: 40rem) { .pager { grid-template-columns: 1fr 1fr; } }
  .pager a {
    display: grid; gap: var(--space-1);
    padding: var(--space-4) var(--space-5);
    border: 1px solid var(--color-border); border-radius: var(--radius-md);
    background: var(--color-surface); text-decoration: none; color: var(--color-text);
  }
  .pager a:hover { border-color: var(--color-primary); }
  .pager__label { font-size: var(--text-sm); color: var(--color-text-muted); }
  .pager__title { font-weight: var(--weight-semibold); color: var(--color-link); }
  .pager__next { text-align: right; }
  @media (min-width: 40rem) { .pager__next:only-child { grid-column: 2; } }

  /* Media helpers --------------------------------------------------------- */
  .media-4x3 { aspect-ratio: 4 / 3; width: 100%; object-fit: cover; }

  /* Reflow at 320px / 400% zoom: let grid items shrink and long words (e-mail addresses) wrap */
  .split > *, .grid > *, .form__row > *, .field, .field__input { min-width: 0; }
  .info-list a, .info-list address, .site-footer a { overflow-wrap: anywhere; }

  /* Footer --------------------------------------------------------------- */
  .site-footer { padding-block: var(--space-8) var(--space-5); }
  .site-footer__grid { display: grid; gap: var(--space-6); }
  @media (min-width: 48rem) { .site-footer__grid { grid-template-columns: 1.4fr 1fr 1fr; } }
  .site-footer h2 { font-family: var(--font-body); font-size: var(--text-sm); font-weight: var(--weight-bold); letter-spacing: 0.08em; text-transform: uppercase; color: var(--dark-accent); margin-bottom: var(--space-3); }
  .site-footer__logo { width: 11rem; margin-bottom: var(--space-4); }
  .site-footer .info-list .icon { color: var(--green-400); }
  .site-footer__hours dt { font-weight: var(--weight-semibold); }
  .site-footer__hours dd { margin: 0 0 var(--space-2); color: var(--dark-text-muted); }
  .site-footer__hours span { white-space: nowrap; }
  .social { display: flex; gap: var(--space-2); list-style: none; padding: 0; }
  .social li { margin: 0; }
  .social + p { margin-top: var(--space-4); }
  .social a {
    display: grid; place-items: center; width: 2.75rem; height: 2.75rem;
    border-radius: 50%; border: 1px solid var(--brown-700); color: var(--dark-text);
  }
  .social a:hover { background: var(--green-400); border-color: var(--green-400); color: var(--brown-900); }
  .site-footer__bottom {
    display: flex; flex-wrap: wrap; gap: var(--space-2) var(--space-5);
    margin-top: var(--space-7); padding-top: var(--space-5);
    border-top: 1px solid var(--brown-700);
    font-size: var(--text-sm); color: var(--dark-text-muted);
  }
  .site-footer__bottom a { color: var(--dark-text-muted); }
  .site-footer__bottom a:hover { color: var(--white); }
  .link-button { background: none; border: 0; padding: 0; color: inherit; text-decoration: underline; text-underline-offset: 0.18em; }
}

/* --------------------------------------------------------------------------
   Utilities
   -------------------------------------------------------------------------- */
@layer utilities {
  .visually-hidden {
    position: absolute !important;
    width: 1px; height: 1px;
    padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0 0 0 0);
    white-space: nowrap; border: 0;
  }
  .text-muted { color: var(--color-text-muted); }
  .text-center { text-align: center; }
  .mt-0 { margin-top: 0; }
  .rounded { border-radius: var(--radius-lg); overflow: hidden; }
}
