/* ============================================================
   Adèle Sardent — Portfolio
   White ground · Instrument Serif (titles, ≈ Kalice/Salsify)
   · Satoshi (body) · blue accent (#3d6ed7)
============================================================ */

:root {
  --paper: #ffffff;
  --ink: #191712;
  --blue: #3d6ed7;
  --line: #e9e7e1;
  --serif: "Instrument Serif", "Times New Roman", Georgia, serif;
  --sans: "Satoshi", -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;
  --maxw: 1440px;
  --gutter: clamp(18px, 4vw, 56px);
  --header-h: 62px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }

body {
  font-family: var(--sans);
  background: var(--paper);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.5;
  font-weight: 400;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: inherit; text-decoration: none; }
img, video { display: block; max-width: 100%; }
::selection { background: var(--blue); color: #fff; }

/* ---------------- Header ---------------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  min-height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px var(--gutter);
  background: color-mix(in srgb, var(--paper) 86%, transparent);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.4s var(--ease);
}
.site-header.scrolled { border-color: var(--line); }

/* brand shares the nav font (sans), per request */
.brand {
  font-family: var(--sans);
  font-weight: 500;
  font-size: 15px;
  letter-spacing: 0.01em;
  color: var(--ink);
}

.site-nav { display: flex; gap: clamp(18px, 2.6vw, 38px); }
.site-nav a {
  font-family: var(--sans);
  font-size: 13.5px;
  font-weight: 500;
  letter-spacing: 0.01em;
  color: var(--blue);
  position: relative;
  padding-bottom: 2px;
}
.site-nav a::after {
  content: "";
  position: absolute;
  left: 0; bottom: 0;
  width: 100%; height: 1px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.35s var(--ease);
}
.site-nav a:hover::after, .site-nav a.active::after { transform: scaleX(1); }

.nav-toggle {
  display: none;
  background: none; border: none;
  font-family: var(--sans);
  font-size: 13.5px;
  font-weight: 500;
  color: var(--blue);
  cursor: pointer;
}

/* ---------------- Layout ---------------- */
#app { flex: 1 0 auto; }
.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 var(--gutter); }

.page { animation: fade 0.5s var(--ease) both; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.eyebrow {
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--blue);
}

/* ================= HOME (scroll-driven horizontal + CTA) ================= */
body.route-home .site-footer { display: none; }

.home { position: relative; }
.home-intro {
  text-align: right;
  color: var(--blue);
  font-family: var(--serif);
  font-size: clamp(14px, 1.35vw, 17px);
  line-height: 1.35;
  padding: clamp(52px, 20vh, 175px) var(--gutter) 0;
}
.home-viewport {
  margin-top: clamp(50px, 11vh, 120px);
  display: flex;
  align-items: flex-start;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
}
.home-viewport::-webkit-scrollbar { display: none; }
.home-track {
  display: flex;
  align-items: flex-start;   /* align tiles at the top so wrapped titles don't shift them */
  gap: clamp(18px, 2.4vw, 40px);
  padding: 0 var(--gutter);
}
.home-item {
  flex: 0 0 auto;
  width: clamp(142px, 14.25vw, 209px);
  display: flex;
  flex-direction: column;
}
.home-item figure {
  height: clamp(218px, 43.7vh, 408px);
  width: 100%;
  overflow: hidden;
  background: #f2f0ea;
}
.home-item img {
  height: 100%; width: 100%;
  object-fit: cover;
  transition: filter 0.5s var(--ease), transform 0.9s var(--ease);
  filter: saturate(0.98);
}
.home-item:hover img { transform: scale(1.03); filter: saturate(1.05); }
.home-title {
  margin-top: 0.6em;
  font-family: var(--serif);
  font-size: clamp(13px, 1.2vw, 16px);
  line-height: 1.1;
  color: var(--ink);
}
/* scroll-down contact CTA (below the project strip) — small text, set low with
   lots of white above so you scroll down to reach it */
.home-cta {
  display: block;
  max-width: 40ch;
  margin: 32vh 0 12vh;
  padding: 0 var(--gutter);
  font-family: var(--serif);
  font-size: clamp(18px, 2vw, 26px);
  line-height: 1.25;
  color: var(--blue);
}
.home-cta em { font-style: italic; color: var(--blue); }
.home-cta:hover em { text-decoration: underline; }

/* ================= PROJECTS GRID ================= */
.grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: clamp(26px, 3vw, 52px) clamp(16px, 2vw, 30px);
  padding-bottom: clamp(50px, 8vw, 100px);
}
.projects-grid { padding-top: clamp(30px, 6vw, 60px); }
.card { display: block; }
.card-media {
  overflow: hidden;
  background: #f2f0ea;
  aspect-ratio: 4 / 3;
}
.card-media img {
  width: 100%; height: 100%;
  object-fit: cover;
  transition: transform 0.9s var(--ease), filter 0.5s var(--ease);
  filter: saturate(0.98);
}
.card:hover .card-media img { transform: scale(1.04); }
.card-media.empty {
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #f4f1ea, #e9e5dd);
}
.card-media.empty span {
  font-family: var(--serif);
  font-size: clamp(18px, 2.4vw, 26px);
  color: #c3bdb1; padding: 0 8%; text-align: center;
}
.card-title {
  margin-top: 10px;
  font-family: var(--serif);
  font-weight: 400;
  font-size: 15px;
  line-height: 1.15;
  letter-spacing: 0.005em;
}
.card-title .client { color: var(--blue); }

/* ================= PROJECT DETAIL ================= */
.project {
  display: grid;
  grid-template-columns: minmax(280px, 32%) 1fr;
  gap: clamp(28px, 4vw, 66px);
  align-items: start;
  padding: clamp(26px, 4vw, 52px) 0 clamp(30px, 4vw, 50px);
}
.project-info { position: sticky; top: calc(var(--header-h) + 22px); }
.back {
  font-size: 12.5px;
  color: var(--blue);
  display: inline-flex; gap: 7px; align-items: center;
  margin-bottom: clamp(22px, 3vw, 40px);
}
.back .arrow { transition: transform 0.3s var(--ease); }
.back:hover .arrow { transform: translateX(-4px); }

.project-info h1 {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(28px, 3.4vw, 46px);
  line-height: 1;
  letter-spacing: -0.005em;
}
.project-info h1 .client {
  display: block;
  color: var(--ink);
  font-size: 0.5em;
  margin-top: 0.5em;
}
.project-discipline {
  margin-top: 14px;
  font-size: 12.5px;
  color: var(--ink);
  letter-spacing: 0.02em;
  text-transform: lowercase;
}

.project-text { margin-top: 26px; }
.project-text .en { font-size: 14px; line-height: 1.55; }
.project-text .en p + p { margin-top: 0.9em; }
.project-text .fr {
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  color: var(--blue);
  font-size: 12.5px;
  line-height: 1.55;
}
.project-text .fr p + p { margin-top: 0.8em; }

.credits { margin-top: 26px; }
.credits dl {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 5px 18px;
  font-size: 12px;
}
.credits dt { color: var(--ink); }
.credits dd { text-align: right; color: var(--ink); font-weight: 700; }
.project-link {
  display: inline-flex; gap: 7px;
  margin-top: 24px;
  font-size: 12.5px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 3px;
  transition: border-color 0.3s var(--ease);
}
.project-link:hover { border-color: var(--ink); }

/* lead visual shown between subtitle and text on phones only */
.project-lead { display: none; }

/* media column */
.project-media {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: clamp(14px, 1.6vw, 26px);
}
.media-item { width: 100%; background: #f2f0ea; }
.media-item img { width: 100%; height: auto; }
.media-item.small { width: 60%; align-self: flex-start; }
.media-item.video {
  background: #0f0e0b;
  display: flex;
  justify-content: center;
}
.media-item.video video {
  width: auto;
  max-width: 100%;
  max-height: 90vh;
  margin: 0 auto;
}
/* bottom-cropped video (hides an in-frame watermark); container aspect-ratio set inline */
.media-item.video.crop-bottom { display: block; overflow: hidden; max-width: 560px; margin: 0 auto; }
.media-item.video.crop-bottom video {
  width: 100%;
  height: auto;
  max-height: none;
  margin: 0;
  display: block;
}
/* a row of side-by-side visuals */
.media-row {
  display: flex;
  gap: clamp(12px, 1.4vw, 24px);
  align-items: flex-start;
}
.media-row > .media-item { flex: 1 1 0; width: auto; min-width: 0; }
.media-row > .media-item.video { align-self: stretch; }
.media-row > .media-item.video video { max-height: 70vh; }
/* once JS has equalised a row, each cell has a fixed height — fill & crop */
.media-row > .media-item.aligned { overflow: hidden; }
.media-row > .media-item.aligned img,
.media-row > .media-item.aligned video {
  width: 100%; height: 100%; object-fit: cover; max-height: none; margin: 0;
}
.gallery-empty {
  padding: 60px 0;
  text-align: center;
  color: var(--blue);
  font-size: 13px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

/* prev / next */
.project-nav {
  display: flex;
  justify-content: space-between;
  border-top: 1px solid var(--line);
  padding: 24px 0 clamp(50px, 8vw, 100px);
  font-size: 12.5px;
}
.project-nav a { color: var(--blue); }
.project-nav .lbl { display: block; font-size: 10px; letter-spacing: 0.12em; text-transform: uppercase; margin-bottom: 5px; }
.project-nav .nm { font-family: var(--serif); font-size: 16px; color: var(--ink); }
.project-nav .next { text-align: right; }

/* ================= ABOUT (inverted: blue ground, white text) ================= */
body.route-about { background: var(--blue); color: #fff; }
body.route-about .site-header { background: transparent; border-color: transparent; }
body.route-about .brand,
body.route-about .site-nav a,
body.route-about .nav-toggle { color: #fff; }
body.route-about .site-footer { color: rgba(255, 255, 255, 0.85); border-color: rgba(255, 255, 255, 0.25); }

.about {
  display: grid;
  grid-template-columns: minmax(200px, 300px) 1fr;
  gap: clamp(30px, 5vw, 80px);
  padding: clamp(50px, 9vw, 120px) 0 clamp(70px, 11vw, 140px);
  align-items: start;
}
.about-portrait { position: sticky; top: calc(var(--header-h) + 30px); }
.about-portrait img { width: 100%; max-width: 300px; background: rgba(255, 255, 255, 0.1); }
.about h1 {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(24px, 3vw, 38px);
  line-height: 1;
  letter-spacing: -0.005em;
  margin-bottom: 26px;
  color: #fff;
}
.about .en { max-width: 58ch; }
.about .en p { font-size: 14.5px; }
.about .en p + p { margin-top: 1em; }
.about .fr {
  margin-top: 30px;
  padding-top: 26px;
  border-top: 1px solid rgba(255, 255, 255, 0.3);
  color: rgba(255, 255, 255, 0.8);
  max-width: 58ch;
  font-size: 13px;
  line-height: 1.55;
}
.about .fr p + p { margin-top: 0.9em; }
/* closing line in the title font, italic, same size */
.about .en p:last-child,
.about .fr p:last-child {
  font-family: var(--serif);
  font-style: italic;
}
body.route-about ::selection { background: #fff; color: var(--blue); }

/* ================= CONTACT ================= */
.contact { padding: clamp(56px, 11vw, 140px) 0; }
.contact h1 {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(24px, 3.4vw, 44px);
  line-height: 1;
  letter-spacing: -0.005em;
  margin-bottom: clamp(44px, 6vw, 72px);
  max-width: 14ch;
}
.contact-list { display: grid; gap: 6px; max-width: 640px; }
.contact-list a {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 20px;
  padding: 10px 0;
  font-size: clamp(15px, 1.7vw, 19px);
  transition: padding 0.35s var(--ease);
}
.contact-list a .k {
  font-family: var(--sans);
  font-size: 11px; font-weight: 500;
  letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--blue);
}
.contact-list a .v { font-family: var(--serif); }
.contact-list a:hover { padding-left: 12px; }

/* ================= Footer ================= */
.site-footer {
  flex-shrink: 0;
  display: flex;
  justify-content: space-between;
  gap: 20px; flex-wrap: wrap;
  padding: 22px var(--gutter);
  border-top: 1px solid var(--line);
  font-size: 11.5px;
  color: var(--blue);
  letter-spacing: 0.02em;
}

/* ================= Lightbox ================= */
.lightbox {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(20, 18, 13, 0.95);
  display: flex; align-items: center; justify-content: center;
  opacity: 0; pointer-events: none;
  transition: opacity 0.35s var(--ease);
}
.lightbox.open { opacity: 1; pointer-events: auto; }
.lightbox img { max-width: 92vw; max-height: 88vh; object-fit: contain; }
.lightbox button {
  position: absolute; background: none; border: none;
  color: #fff; cursor: pointer;
  font-family: var(--sans); font-size: 14px;
  opacity: 0.7; transition: opacity 0.25s var(--ease); padding: 16px;
}
.lightbox button:hover { opacity: 1; }
.lb-close { top: 12px; right: 18px; }
.lb-prev { left: 6px; top: 50%; transform: translateY(-50%); font-size: 30px; }
.lb-next { right: 6px; top: 50%; transform: translateY(-50%); font-size: 30px; }
.lb-count { position: absolute; bottom: 18px; left: 50%; transform: translateX(-50%); color: #fff; opacity: 0.6; font-size: 11px; letter-spacing: 0.1em; }

/* ================= Responsive ================= */
@media (max-width: 900px) {
  .grid { grid-template-columns: repeat(2, 1fr); }
  .project { grid-template-columns: 1fr; gap: 26px; }
  .project-info { position: static; }
  .about { grid-template-columns: 1fr; }
  .about-portrait { position: static; }
  .about-portrait img { max-width: 260px; }
}

@media (max-width: 620px) {
  /* backdrop-filter would make the header the containing block for the fixed
     menu overlay (trapping it); use an opaque header instead */
  .site-header { background: var(--paper); backdrop-filter: none; }
  body.route-about .site-header { background: var(--blue); }
  .site-nav { display: none; }
  .site-nav.open {
    display: flex;
    position: fixed;
    top: var(--header-h); left: 0; right: 0; bottom: 0;
    z-index: 60;
    flex-direction: column; justify-content: center; gap: 18px;
    background: var(--paper); padding: 30px var(--gutter);
  }
  .site-nav.open a { font-family: var(--serif); font-size: 32px; color: var(--ink); }
  body.route-about .site-nav.open { background: var(--blue); }
  body.route-about .site-nav.open a { color: #fff; }
  .nav-toggle { display: block; }
  .grid { grid-template-columns: 1fr; gap: 26px; }
  .media-item.small { width: 100%; align-self: stretch; }
  .media-row { flex-direction: column; gap: 14px; }
  .media-row > .media-item { width: 100%; }
  /* on mobile a stacked "row" cell must show the full image, not a cropped tile */
  .media-row > .media-item.aligned { height: auto !important; overflow: visible; }
  .media-row > .media-item.aligned img,
  .media-row > .media-item.aligned video { height: auto; object-fit: contain; }
  .home-track { gap: 10px; }
  .home-item { width: clamp(84px, 26vw, 120px); }   /* ~3.5 tiles visible */
  .home-item figure { height: clamp(150px, 24vh, 220px); }
  .home-item .home-title { font-size: 12px; }
  .home-intro { text-align: right; max-width: none; padding-top: clamp(75px, 20vh, 190px); }
  .home-viewport { margin-top: clamp(80px, 17vh, 150px); }
  .home-cta { margin: 20vh 0 14vh; max-width: none; font-size: clamp(19px, 5.4vw, 24px); }
  .project { padding-top: 20px; }
  .project-info h1 { font-size: clamp(30px, 9vw, 44px); }
  .contact h1 { font-size: clamp(30px, 9vw, 44px); }
  /* lead visual between subtitle and text; hide its duplicate in the gallery */
  .project-lead { display: block; margin: 22px 0 6px; }
  .project-lead .media-item { width: 100%; }
  .project-media > .media-item:first-child,
  .project-media > .media-row:first-child > .media-item:first-child { display: none; }
  /* a first row that is now a single visible item shouldn't keep a big gap */
  .project-media > .media-row:first-child { gap: 0; }
}
