/* ==========================================================================
   ALBINI E CASTELLI — Base: fonts, reset, type utilities, layout primitives
   ========================================================================== */

/* --- Roboto, self-hosted -------------------------------------------------
   Roboto v51 is a variable font: one file covers 100–900, so each subset
   needs a single @font-face with a weight *range*. Two files, 72 KB total. */
@font-face {
  font-family: "Roboto";
  font-style: normal;
  font-weight: 100 900;
  font-stretch: 100%;
  font-display: swap;
  src: url("../fonts/roboto-latin-ext.woff2") format("woff2");
  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: "Roboto";
  font-style: normal;
  font-weight: 100 900;
  font-stretch: 100%;
  font-display: swap;
  src: url("../fonts/roboto-latin.woff2") format("woff2");
  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;
}

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  /* The closed mobile drawer parks off-screen at translateX(100%); Chrome
     counts that toward document scrollWidth. `clip` suppresses the phantom
     horizontal scroll without creating a scroll container the way
     `overflow: hidden` would (which breaks position: sticky). */
  overflow-x: clip;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  font-weight: var(--fw-body-sm-light);
  font-size: var(--fs-body-sm-light);
  line-height: var(--lh-body-sm-light);
  color: var(--c-text);
  background: var(--c-surface);
  font-variation-settings: "wdth" 100;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5, h6, p, figure, blockquote { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }
img, svg, video { display: block; max-width: 100%; }
img { height: auto; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
input, textarea, select { font: inherit; color: inherit; }

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

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}

/* --- Layout primitives ----------------------------------------------------
   .container is the 1280px centred content column (80px gutter at 1440).
   .bleed is a full-width band whose *inner* content still respects it. */
.container,
.site-header__inner,
.cta-band__inner,
.site-footer__inner {
  width: 100%;
  max-width: calc(var(--container) + var(--pad-x) * 2);
  margin-inline: auto;
  padding-inline: var(--pad-x);
}

.bleed { width: 100%; }

/* Below the design width the gutter has to become real or bands go flush
   to the viewport edge. Set once here; every band above inherits it. */
@media (max-width: 1440px) { :root { --pad-x: 40px; } }
@media (max-width: 1024px) { :root { --pad-x: 25px; } }

/* The block-rhythm scale (section padding, kicker/copy gaps — see tokens.css)
   is tuned for the 1440 design. Every section's mobile/tablet spacing reads
   as too loose if it's left at full size, so it's scaled down once here
   rather than overridden per section. Figma has no tablet frame and only a
   partial 402 mobile frame, so these ratios are a judgement call (~40%
   tighter at tablet, ~55% at mobile), not a measurement. */
@media (max-width: 1024px) {
  :root {
    --space-120: 72px;
    --space-100: 60px;
    --space-40: 30px;
    --space-14: 12px;
  }
}
@media (max-width: 768px) {
  :root {
    --space-120: 54px;
    --space-100: 46px;
    --space-40: 24px;
    --space-14: 10px;
  }
}

/* --- Grids ----------------------------------------------------------------
   Fixed track widths reproduce Figma exactly at >=1440; below that they
   become equal fractions so the columns stay flush with the container. */
.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, var(--col-3));
  gap: var(--gap-3);
  justify-content: space-between;
}
.grid-projects {
  display: grid;
  grid-template-columns: repeat(3, var(--col-proj));
  gap: var(--gap-proj);
  justify-content: space-between;
}
.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, var(--col-2));
  gap: var(--gap-2);
  justify-content: space-between;
}
/* Asymmetric text split: 413px rail + 628px body, flush to container edges. */
.grid-split {
  display: grid;
  grid-template-columns: var(--col-narrow) var(--col-2);
  justify-content: space-between;
}

@media (max-width: 1440px) {
  .grid-3, .grid-projects { grid-template-columns: repeat(3, 1fr); }
  .grid-2 { grid-template-columns: repeat(2, 1fr); }
  .grid-split { grid-template-columns: 1fr 1.52fr; gap: var(--gap-2); }
}
@media (max-width: 1024px) {
  .grid-3, .grid-projects { grid-template-columns: repeat(2, 1fr); }
  .grid-2, .grid-split { grid-template-columns: 1fr; gap: var(--space-40); }
}
@media (max-width: 768px) {
  .grid-3, .grid-projects { grid-template-columns: 1fr; }
}

/* --- Type utilities -------------------------------------------------------
   One class per Figma token. Sizes use clamp() so they scale down cleanly
   but land on the exact Figma value at >= the design width. */
/* Floor is 40px, not an arbitrary small value: the mobile frame 104:1380 draws
   a 2-line hero title 94px tall, i.e. ~47px line-height → ~42px type. 40 keeps
   "Costruire Valore" inside the 402 gutter while staying true to that. */
.t-h1-hero {
  font-weight: var(--fw-h1-hero);
  font-size: clamp(40px, 3.89vw, var(--fs-h1-hero));
  line-height: 1.107;
}
.t-cta-big {
  font-weight: var(--fw-cta-big);
  font-size: clamp(28px, 2.78vw, var(--fs-cta-big));
  line-height: 1.1;
}
.t-h2-large {
  font-weight: var(--fw-h2-large);
  font-size: clamp(28px, 2.78vw, var(--fs-h2-large));
  line-height: 1.125;
}
.t-h2-small {
  font-weight: var(--fw-h2-small);
  font-size: clamp(26px, 2.43vw, var(--fs-h2-small));
  line-height: 1.2;
}
.t-h3 {
  font-weight: var(--fw-h3);
  font-size: clamp(22px, 2.01vw, var(--fs-h3));
  line-height: 1.207;
}
.t-titoletti {
  font-weight: var(--fw-titoletti);
  font-size: clamp(21px, 1.88vw, var(--fs-titoletti));
  line-height: 1.407;
}
.t-body-lg {
  font-weight: var(--fw-body-lg);
  font-size: clamp(18px, 1.53vw, var(--fs-body-lg));
  line-height: 1.364;
}
/* Distinct from Body Large (22/30) — a slightly larger unnamed intro-copy
   style, first seen on Servizi hub and reused verbatim on the General
   Contractor detail page's intro paragraph. */
.t-copy {
  font-weight: var(--fw-copy);
  font-size: clamp(18px, 1.67vw, var(--fs-copy));
  line-height: 1.208;
}
.t-body-sm {
  font-weight: var(--fw-body-sm-light);
  font-size: var(--fs-body-sm-light);
  line-height: var(--lh-body-sm-light);
}
.t-body-sm-med {
  font-weight: var(--fw-body-sm-med);
  font-size: var(--fs-body-sm-med);
  line-height: var(--lh-body-sm-med);
}
.t-micro {
  font-weight: var(--fw-micro);
  font-size: var(--fs-micro);
  line-height: var(--lh-micro);
  text-transform: uppercase;
}

@media (max-width: 768px) {
  .t-body-sm { font-size: 16px; }
  .t-titoletti { font-size: 20px; }
  .t-h2-small { font-size: 24px; }
}

/* --- Helpers -------------------------------------------------------------- */
.u-accent  { color: var(--c-accent); }
.u-muted   { color: var(--c-text-muted); }
.u-invert  { color: var(--c-text-invert); }
.u-upper   { text-transform: uppercase; }
.u-rule    { height: 1px; background: var(--c-rule); border: 0; margin: 0; }

.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* Arrow glyph. One SVG, recoloured via mask + currentColor, so the same
   asset serves white-on-red, red-on-white and tortora-on-hover. */
.icon-arrow {
  display: inline-block;
  width: var(--arrow-w);
  height: 11px;
  flex: none;
  background-color: currentColor;
  -webkit-mask: url("../icons/arrow-right.svg") no-repeat center / contain;
          mask: url("../icons/arrow-right.svg") no-repeat center / contain;
}
