/* =========================================================
   Grams – Cycling collective
   Ricostruzione statica del sito Cargo.

   Unità base (1rem) calcolata come Cargo (vedi :root):
   - desktop: 1.44vmin (+ un'aggiunta se la finestra è più alta che larga)
   - mobile: la stessa × 1.3 (mobile-scale di Cargo); a 375×812 = 2.912vw
   Tutte le dimensioni sotto sono in rem, come in Cargo.

   Font sostitutivi gratuiti (SIL OFL):
   - Newsreader  al posto di Marist  (testi)
   - DM Mono     al posto di Diatype Semi-Mono (didascalie)
   ========================================================= */

@font-face {
  font-family: "Newsreader";
  src: url("assets/fonts/newsreader.woff2") format("woff2-variations");
  font-weight: 200 800;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "DM Mono";
  src: url("assets/fonts/dm-mono.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root {
  --serif: "Newsreader", Georgia, "Times New Roman", serif;
  --mono: "DM Mono", ui-monospace, Menlo, monospace;

  --pad: 2rem;                 /* padding pagina */
  --size-cover: 1.55rem;       /* menu home (stile "Cover") */
  --size-body: 1.4rem;         /* testi (bodycopy, Team - Text) */
  --size-caption: 0.9rem;      /* didascalie */
  --logo-width: 22.66rem;      /* 348 px a 1707 px di larghezza */

  --team-text: #c7c7c7;
  --hr: rgba(154, 154, 154, 0.6);
  --ease: cubic-bezier(.4, 0, .2, 1);

  /* Unità base come Cargo (getBaseUnit, --base-size = unità × 0.16):
     0.0144 × lato corto della finestra (1.44vmin); se la finestra è più
     alta che larga si aggiunge fino a 0.8vw, in proporzione a
     (altezza/larghezza − 1) / 0.7778. */
  --base-extra: clamp(0px, 1.0286vh - 1.0286vw, 0.8vw);
  font-size: calc(1.44vmin + var(--base-extra));
}

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

html, body { margin: 0; height: 100%; }

body {
  background: rgba(0, 0, 0, 0.96);
  color: #fff;
  font-family: var(--serif);
  font-size: var(--size-body);
  font-weight: 400;           /* Marist 350 ≈ Newsreader 400 come spessore visivo */
  font-optical-sizing: auto;
  line-height: 1.2;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }
a:active { opacity: .7; }

hr {
  border: 0;
  height: 1px;
  background: var(--hr);
  margin: .8rem 0;
}

p { margin: 0 0 1.2em; }   /* una riga vuota, come i doppi <br> di Cargo */

.caption {
  font-family: var(--mono);
  font-size: var(--size-caption);
  font-weight: 400;
  line-height: 1.2;
  color: rgba(0, 0, 0, .4);
  text-decoration: none;
}

mark {
  background: rgba(255, 214, 0, .35);
  color: inherit;
  padding: 0 .15em;
}

[hidden] { display: none !important; }

/* icone inline (equivalenti alle text-icon di Cargo: 1.2em, sulla linea di base) */
.icon {
  display: inline-block;
  width: 1.2em;
  height: 1.2em;
  margin-top: -1em;            /* non alza la riga, come in Cargo */
  margin-bottom: -.25em;
  vertical-align: baseline;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: square;
}

/* =========================================================
   HOME
   ========================================================= */
.view-home {
  position: relative;
  min-height: 100vh;
  min-height: 100svh;
  overflow: hidden;
}

.video-backdrop {
  position: fixed;
  inset: 0;
  background: #2a2a2a;
  z-index: 0;
}
.video-backdrop__video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: .85;
  display: block;
}
/* trama "retinata" sopra al video (equivalente del checkerboard 16px di Cargo) */
.video-backdrop__pattern {
  position: absolute;
  inset: 0;
  background-image: conic-gradient(rgba(0,0,0,.42) 25%, transparent 0 50%, rgba(0,0,0,.42) 0 75%, transparent 0);
  background-size: 4px 4px;
  pointer-events: none;
}

/* griglia a 12 colonne: logo colonne 1-3, menu colonne 8-12 */
.home-header {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  column-gap: 1rem;
  padding: var(--pad);
  align-items: start;
}

.home-logo { grid-column: 1 / span 3; }
.home-logo img {
  display: block;
  width: var(--logo-width);
  max-width: none;
  height: auto;
}

.cover {
  font-size: var(--size-cover);
  line-height: 1.2;
  color: #fff;
  text-align: left;
}
.cover a {
  text-decoration: underline;
  text-decoration-color: rgba(255, 255, 255, .25);
  transition: text-decoration-color .2s var(--ease);
}
.cover a:hover { text-decoration-color: rgba(255, 255, 255, .9); }

.home-menu {
  grid-column: 8 / span 5;
  /* In Cargo il menu parte esattamente a 7/12 della larghezza utile:
     tolgo la quota di gap (7/12 × 1rem) che la griglia aggiunge. */
  margin-left: calc(-7 / 12 * 1rem);
  padding-top: 1.2em;          /* riga vuota prima del claim */
}
.home-menu__links { margin: 0; }

/* =========================================================
   OVERLAY (Information, Contact)
   ========================================================= */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: flex;
  justify-content: flex-end;
  opacity: 0;
  transition: opacity .4s var(--ease);
}
.overlay.is-open { opacity: 1; }

.overlay__panel {
  width: 50%;
  height: 100%;
  overflow-y: auto;
  padding: var(--pad);
  font-size: var(--size-body);
}
.overlay--light .overlay__panel { background: #fff; color: rgba(0, 0, 0, .85); }
.overlay--dark  .overlay__panel { background: #111; color: #e6e6e6; }

.overlay__close {
  text-align: right;
  margin-bottom: 2.4em;        /* due righe vuote */
}
.overlay__close a { text-decoration: none; }

.body-text { margin-bottom: 0; }

/* "Who are we?": pannello stretto quanto una colonna della galleria Cargo
   (metà di metà schermo, meno il gutter 0.5rem) più il padding.
   Testo e foto riempiono la colonna: stessa dimensione di prima, niente bianco a destra. */
#view-information .overlay__panel { width: calc(25% + var(--pad) - .25rem); }
.info-figure { margin: 2.4em 0 0; }
.info-figure img { display: block; width: 100%; height: auto; }
.info-figure .caption { margin-top: .8em; }

/* =========================================================
   TEAM
   ========================================================= */
.view-team {
  display: flex;
  min-height: 100vh;
  min-height: 100svh;
  background: #1b1b1b;
}

.team-backdrop {
  position: sticky;
  top: 0;
  width: 50%;
  height: 100vh;
  height: 100svh;
  flex: none;
  background: #000;
}
.pixelation { display: block; width: 100%; height: 100%; }

.team-content {
  width: 50%;
  padding: var(--pad);
  display: flex;
  flex-direction: column;
}

/* "(Close)" occupa la riga vuota iniziale (prima: padding-top + 1.2em) */
.team-close {
  margin: 0;
  font-size: var(--size-body);
  line-height: 1.2;
  text-align: right;
  color: var(--team-text);
}
.team-close a { text-decoration: none; }
.team-close a:hover { color: #fff; }

.team-text {
  font-size: var(--size-body);
  color: var(--team-text);
  font-feature-settings: "onum";
}

.team-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  column-gap: 0;               /* Cargo dichiara gutter 1.5rem ma le colonne risultano attaccate */
  align-items: start;
}

.team-photo {
  display: block;
  width: 98%;                  /* Cargo: 333 px su colonna 340 (1440×700), 388 su 396 (1707×1067) */
  height: auto;
  margin-bottom: 6em;          /* cinque righe vuote dopo la foto */
}

.dash-list { list-style: none; margin: 0; padding: 0; }
.dash-list li::before { content: "- "; }
.after-list { margin-top: 0; }

.team-footer {
  margin-top: auto;
  padding-top: 3.6em;          /* tre righe vuote */
  text-align: right;
}
.team-footer .caption { display: block; color: rgba(150, 150, 150, .85); }

/* =========================================================
   CONTACT FORM
   ========================================================= */
.contact-form { display: grid; gap: 1.2em; max-width: 34em; }
.contact-form label { display: grid; gap: .35em; }
.contact-form input,
.contact-form textarea {
  font: inherit;
  color: inherit;
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--hr);
  padding: .3em 0;
  outline: none;
}
.contact-form input:focus,
.contact-form textarea:focus { border-bottom-color: #fff; }
.contact-form button {
  justify-self: start;
  font: inherit;
  color: inherit;
  background: none;
  border: 1px solid var(--hr);
  border-radius: 10em;
  padding: .35em 1.2em;
  cursor: pointer;
}
.contact-form__note { color: #999; min-height: 1.2em; }
.contact-form__trap { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.contact-form button:disabled { opacity: .5; cursor: default; }

/* =========================================================
   MOBILE – stesse condizioni di Cargo: finestra verticale (≤ 4/5)
   oppure orizzontale bassa (≤ 500 px). Unità base × 1.3 (mobile-scale);
   in orizzontale Cargo usa 2.88vmin invece di 1.44vmin.
   A 375×812: 1rem = 10.92 px.
   ========================================================= */
@media (min-aspect-ratio: 2/3) and (max-height: 500px) {
  :root { font-size: calc((2.88vmin + var(--base-extra)) * 1.3); }
}
@media (max-aspect-ratio: 4/5) {
  :root { font-size: calc((1.44vmin + var(--base-extra)) * 1.3); }
}
@media (max-aspect-ratio: 4/5), (min-aspect-ratio: 2/3) and (max-height: 500px) {
  :root {
    --pad: 1rem;
    --logo-width: 25.1rem;     /* 274 px a 375 px */
  }

  .home-header { display: block; }
  .home-menu { margin-top: 5.6rem; margin-left: 0; }

  .overlay__panel,
  #view-information .overlay__panel { width: 100%; }

  .view-team { flex-direction: column; position: relative; }
  /* su mobile il testo parte sotto l'immagine: "(Close)" sopra l'immagine, in alto a destra */
  .team-close {
    position: absolute;
    top: var(--pad);
    right: var(--pad);
    z-index: 1;
    color: #fff;
  }
  .team-content { padding-top: calc(var(--pad) + 1.2em); }
  .team-backdrop { position: relative; width: 100%; height: 60vh; }
  .team-content { width: 100%; }
  .team-columns { grid-template-columns: 1fr; }
  .team-photo { width: 100%; margin-bottom: 2.4em; }
}

@media (prefers-reduced-motion: reduce) {
  .overlay { transition: none; }
}
