/* ==========================================================================
   MASTER TEMPLATE
   Shared by every page: Présentation / Réalisations (index.html), Tramway de Nantes
   and BHNS Tzen 5. Type scale, colours and grid were measured on the master page
   ("Présentation / Réalisations", 1232 px wide canvas) and are expressed relative to the
   viewport, so the pages scale the same way the master does.
   ========================================================================== */

/* Open Sans, self-hosted (SIL OFL, see fonts/OFL-LICENSE.txt). One variable file covers
   Regular 400, Semi-bold 600, Bold 700, and the condensed width (75%) used by the titles. */
@font-face {
  font-family: "Open Sans Variable";
  font-style: normal;
  font-display: swap;
  font-weight: 300 800;
  font-stretch: 75% 100%;
  src: url("fonts/open-sans-latin-wdth-normal.woff2") format("woff2-variations"),
       url("fonts/open-sans-latin-wdth-normal.woff2") format("woff2");
}

:root {
  --ink: #000;
  --accent: #eb4a1a;                       /* orange of the "k" in the logo */
  --placeholder: #ececec;
  --placeholder-light: #f6f6f6;

  --fs: clamp(12.5px, 0.845vw, 17px);      /* body text: 10.4 px on the 1232 px master canvas */
  --lh: 1.57;                              /* 16.3 px line pitch on the master */
  --page-w: min(79.7%, 1800px);            /* content column: x 125 -> 1107 on the master */
  --pres-a: 60fr;                          /* Présentation page: left 60 % ...               */
  --pres-b: 40fr;                          /* ... right 40 %                                 */
  --info-a: 40fr;                          /* project pages: credits 40 % ...                */
  --info-b: 60fr;                          /* ... text 60 %                                  */
  --col-gap: 3.97%;
  --gap: clamp(28px, 5vw, 80px);           /* space between gallery blocks */
  --header-h: clamp(54px, 5.6vw, 84px);
}

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-padding-top: calc(var(--header-h) + 16px);
}

body {
  margin: 0;
  background: #fff;
  color: var(--ink);
  font: 400 var(--fs) / var(--lh) "Open Sans Variable", "Open Sans", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

p { margin: 0 0 1.57em; }
b, strong { font-weight: 600; }          /* Semi-bold */
a { color: inherit; text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: .22em; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

.sr-only {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip {
  position: fixed; left: 12px; top: -60px; z-index: 200;
  background: #fff; padding: .6em 1em; font-weight: 600;
}
.skip:focus { top: 12px; }

/* ---------- Titles (master: Open Sans Condensed Bold) ---------- */
.title {
  margin: 0;
  font-size: 3.03em;                     /* 31.5 px on the master */
  font-weight: 700;                      /* Bold */
  font-stretch: 75%;                     /* condensed */
  line-height: 1.05;
}

/* Sub-headings: uppercase Semi-bold, 12.9 px on the master */
.sub {
  margin: 3.2em 0 1.9em;
  font-size: 1.24em;
  font-weight: 600;
  line-height: 1.3;
  text-transform: uppercase;
}

/* ---------- Fixed header: transparent at rest, white once the page is scrolled ---------- */
.site-header {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 100;
  background-color: #fff;                 /* always white */
  box-shadow: 0 1px 0 rgba(0, 0, 0, .08);
}
.site-header__inner {
  width: var(--page-w);
  margin-inline: auto;
  min-height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1em 2.5em;
}
.logo { display: block; line-height: 0; }
.logo img { display: block; width: clamp(83px, 9.36vw, 184px); height: auto; }

/* ---------- Navigation (header + footer) ---------- */
.nav ul {
  display: flex;
  flex-wrap: wrap;
  gap: .4em 2.2em;
  margin: 0;
  padding: 0;
  list-style: none;
}
.nav a {
  font-size: 1.05em;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  white-space: nowrap;
}
.nav a[aria-current="page"] {
  font-weight: 700;
  text-decoration: underline;
  text-decoration-color: var(--accent);
  text-decoration-thickness: 2px;
  text-underline-offset: .4em;
}

/* ---------- Footer ---------- */
.site-footer {
  margin-top: clamp(64px, 9vw, 160px);
  border-top: 1px solid rgba(0, 0, 0, .14);
}
.site-footer__inner {
  width: var(--page-w);
  margin-inline: auto;
  padding: 2.4em 0 3.2em;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 1.4em 3em;
}
.site-footer__meta { display: flex; flex-wrap: wrap; gap: .4em 2.2em; font-size: .95em; }
.site-footer__meta a { font-weight: 600; }

/* ---------- Images ---------- */
.img {
  position: relative;
  margin: 0;
  background: var(--placeholder);
  overflow: hidden;
  aspect-ratio: calc(var(--w) / var(--h));
}
.img.light { background: var(--placeholder-light); }
.img img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.img.drawing img { object-fit: contain; }     /* technical drawings: never cropped */

/* ==========================================================================
   Home: Présentation / Réalisations
   ========================================================================== */
.home-top,
.home-cols {
  display: grid;
  grid-template-columns: var(--pres-a) var(--pres-b);
  column-gap: var(--col-gap);
  width: var(--page-w);
  margin-inline: auto;
}
.home-top .img { width: 90.3%; }                     /* portrait keeps its size inside the wider left column */
.home-top { padding-top: clamp(120px, 15vw, 270px); }
.contact { align-self: end; margin: 0 0 -.3em; font-weight: 600; }

.home-cols { margin-top: 6.9em; }
.home-cols .col-a .text { max-width: 92%; }          /* master text box: ~470 px of the 511 px column */
.home-cols .realisations { margin-top: 6.9em; }
.home-cols .title { margin-bottom: .5em; }
.home-cols .col-b .sub { margin-top: 0; }
.home-cols .realisations .sub:first-of-type { margin-top: 0; }

.entry { margin: 0 0 1.57em; }
.entry b { font-weight: 600; }
.year-block { margin: 0 0 1.57em; }

/* ==========================================================================
   Project pages: full-width hero, credits + text, gallery
   ========================================================================== */
/* The first image spans the full page width and is never taller than 70 % of the window. */
.hero {
  width: 100%;
  aspect-ratio: auto;
  margin-top: var(--header-h);           /* sits right under the fixed white header */
  height: min(calc(100vw * var(--h) / var(--w)), 80vh);
  height: min(calc(100vw * var(--h) / var(--w)), 80dvh);
}
.hero img { object-position: 50% var(--pos, 22%); }   /* vertical focus when the hero is cropped by the 80vh cap */

.info {
  display: grid;
  grid-template-columns: var(--info-a) var(--info-b);
  grid-template-areas:
    ".       title"
    "credits text";
  column-gap: var(--col-gap);
  row-gap: 1.6em;
  width: var(--page-w);
  margin: 4em auto 0;
}
.info .title { grid-area: title; }
.credits { grid-area: credits; margin: 0; padding-right: 8%; font-size: .85em; line-height: 1.5; }
.credits > div { margin-bottom: 1.35em; }
.credits dt { margin: 0; font-weight: 400; }                  /* Regular */
.credits dd { margin: 0; font-weight: 600; }                  /* Semi-bold */
.credits dd .regular { font-weight: 400; }
.text { grid-area: text; }
.text .lead { font-weight: 600; }
.text p:last-child { margin-bottom: 0; }

.gallery {
  display: flex;
  flex-direction: column;
  gap: var(--gap);
  width: var(--page-w);
  margin: 8.6em auto 0;
}
.row { display: flex; gap: 3.1%; }
.row .img { flex: var(--w) 1 0; min-width: 0; }
.img.wide { width: 121%; margin-inline: -10.5%; max-width: none; }   /* drawings wider than the text column */

/* ---------- Mobile ---------- */
@media (max-width: 720px) {
  :root { --fs: 13.5px; --page-w: 88%; --header-h: 96px; }

  .site-header__inner { flex-wrap: wrap; align-content: center; row-gap: 6px; padding-block: 10px; }
  .nav { width: 100%; }
  .nav ul { gap: .3em 1.4em; }
  .nav a { font-size: .9em; letter-spacing: .02em; }

  .home-top, .home-cols, .info { grid-template-columns: 1fr; }
  .home-top { padding-top: 104px; row-gap: 1.2em; }
  .contact { margin: 0; }
  .home-cols { margin-top: 3.6em; row-gap: 3.6em; }
  .home-cols .col-a .text { max-width: none; }
  .home-cols .realisations { margin-top: 3.6em; }

  .info { grid-template-areas: "title" "text" "credits"; margin-top: 2.4em; }
  .credits { padding-right: 0; margin-top: 1.4em; font-size: .9em; }
  .gallery { margin-top: 4em; }
  .img.wide { width: 100%; margin-inline: 0; }
  .site-footer__inner { flex-direction: column; align-items: flex-start; }
}

