:root {
  --paper: #F4F4F0;
  --paper-hi: #FBFBF8;
  --ink: #141414;
  --line: #cfcdc6;
  --red: #D41515;
  --mute: #55544f;
  --mono: 'JetBrains Mono', ui-monospace, monospace;
}

* { box-sizing: border-box; margin: 0; }
html { scroll-behavior: smooth; }
body { background: var(--paper); color: var(--ink); font: 400 16px/1.55 Rubik, system-ui, sans-serif; -webkit-font-smoothing: antialiased; }
a { color: inherit; }
img { display: block; max-width: 100%; height: auto; }
:focus-visible { outline: 2px solid var(--red); outline-offset: 3px; }
::selection { background: var(--ink); color: var(--paper); }

/* Language: both versions are in the markup, the inactive one is hidden */
html[data-lang="fr"] .en, html[data-lang="en"] .fr { display: none !important; }

.wrap { max-width: 1200px; margin: 0 auto; padding: 0 24px; }
.m { font: 500 12px/1.4 Rubik, system-ui, sans-serif; text-transform: uppercase; letter-spacing: .04em; color: var(--mute); }
.num { font: 800 2.6rem/.8 Rubik; letter-spacing: -.04em; color: var(--red); }

/* Nav */
nav { display: flex; justify-content: space-between; align-items: stretch; gap: 16px; margin: 0 -10px 0 -14px; border-bottom: 1px solid var(--ink); font-size: 14px; }
nav .links, .lang { display: flex; align-items: stretch; }
/* Each item fills the nav height; the red hover box spans it top to bottom */
nav a, .lang button { display: flex; align-items: center; padding: 18px 14px; text-decoration: none; transition: background .2s, color .2s; }
nav .brand { font-weight: 800; letter-spacing: -.01em; }
.lang button { font: 500 12px Rubik, system-ui, sans-serif; letter-spacing: .04em; background: none; border: 0; padding: 18px 10px; color: var(--mute); cursor: pointer; }
.lang button[aria-pressed="true"] { color: var(--ink); text-decoration: underline; text-decoration-color: var(--red); text-underline-offset: 3px; }
nav a:hover, .lang button:hover { background: var(--red); color: var(--paper); text-decoration-color: var(--paper); }

/* Home hero */
.hero { display: grid; grid-template-columns: repeat(12, 1fr); align-items: center; padding: 56px 0 48px; border-bottom: 1px solid var(--ink); }
.hero-text { grid-column: 1 / 7; display: flex; flex-direction: column; gap: 16px; }
.hero h1 { font: 800 clamp(2.8rem, 6vw, 5.2rem)/.95 Rubik; letter-spacing: -.035em; margin-top: 4px; }
.r { color: var(--red); }
.hero .role { font: 700 clamp(1.3rem, 2.2vw, 1.9rem)/1.2 Rubik; letter-spacing: -.02em; color: var(--mute); text-wrap: balance; }
.hero .intro { font-size: 18px; line-height: 1.5; max-width: 52ch; text-wrap: pretty; }
.hero-3d { grid-column: 7 / -1; width: 100%; height: clamp(320px, 36vw, 440px); display: block; }
.dot { display: inline-block; width: 7px; height: 7px; background: var(--red); margin-right: 6px; }

/* Section heads */
.sec { display: flex; justify-content: space-between; align-items: end; gap: 16px; padding: 64px 0 14px; border-bottom: 1px solid var(--ink); }
.sec h2 { font: 800 clamp(2rem, 4vw, 3rem)/1 Rubik; letter-spacing: -.035em; }

/* Project grid: 1px gaps on a grey background draw the lines */
.grid { display: grid; grid-template-columns: repeat(12, 1fr); gap: 1px; background: var(--line); border-bottom: 1px solid var(--line); }
.grid > a { background: var(--paper); padding: 24px; text-decoration: none; display: flex; flex-direction: column; gap: 14px; transition: background .2s, color .2s; }
.grid img { width: 100%; aspect-ratio: 16 / 10; object-fit: cover; object-position: top; border: 1px solid var(--line); }
.grid img.term { background: #111; object-fit: contain; }
.grid h3 { font: 800 1.9rem/1 Rubik; letter-spacing: -.03em; }
.grid p { color: var(--mute); max-width: 52ch; }
.row { display: flex; justify-content: space-between; align-items: start; gap: 12px; }
.row .m { text-align: right; }
.p1 { grid-column: span 7; }
.p2 { grid-column: span 5; }
.p3 { grid-column: span 12; flex-direction: row !important; align-items: center; gap: 32px !important; }
.grid .p3 img { width: 55%; flex: none; }
.p3 > div { flex: 1; display: flex; flex-direction: column; gap: 14px; }
.poc > a { grid-column: span 6; }
.link { font-size: 14px; font-weight: 500; margin-top: auto; }
.link::after { content: " →"; color: var(--red); }

/* Other projects */
.list { width: 100%; border-collapse: collapse; }
.list td { padding: 16px 12px 16px 0; border-bottom: 1px solid var(--line); vertical-align: top; }
.list td:first-child { width: 34%; font: 800 1.15rem Rubik; letter-spacing: -.02em; }
.list td:nth-child(2) { color: var(--mute); }
.list td:last-child { text-align: right; padding-right: 0; }

.others a { display: grid; grid-template-columns: 34% 1fr auto; gap: 12px; align-items: baseline; padding: 16px 12px; margin: 0 -12px; border-bottom: 1px solid var(--line); text-decoration: none; transition: background .2s, color .2s; }
.others strong { font: 800 1.15rem Rubik; letter-spacing: -.02em; }
.others span:not(.m) { color: var(--mute); }

/* Inverted hover: red background, white text, red accents turn black */
.grid > a:hover, .others a:hover, .contact a:hover { background: var(--red); color: var(--paper); }
:is(.grid > a, .others a, .contact a):hover :is(p, span, .m) { color: var(--paper); }
:is(.grid > a, .others a, .contact a):hover .num,
.grid > a:hover .link::after { color: var(--ink); }
:is(.grid > a, .others a, .contact a) :is(p, span, .num), .link::after { transition: color .2s; }

/* About / contact */
.cols { display: grid; grid-template-columns: repeat(12, 1fr); padding: 32px 0 0; row-gap: 32px; }
.cols .text { grid-column: 1 / 7; display: flex; flex-direction: column; gap: 14px; font-size: 18px; line-height: 1.5; }
.cols .text p { max-width: 60ch; }
.stack { grid-column: 8 / -1; }
.stack div { display: grid; grid-template-columns: 130px 1fr; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.stack div:first-child { border-top: 1px solid var(--line); }
.stack dd { margin: 0; }
.contact { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; background: var(--line); border-bottom: 1px solid var(--line); }
.contact a { background: var(--paper); padding: 24px; text-decoration: none; display: flex; flex-direction: column; gap: 8px; }
.contact strong { font: 800 1.4rem/1.1 Rubik; letter-spacing: -.02em; overflow-wrap: anywhere; }

footer { display: flex; justify-content: space-between; gap: 16px; padding: 40px 0; }
footer a { text-decoration: none; }
footer a:hover { color: var(--red); }

/* Case study pages */
.case-head { display: grid; grid-template-columns: repeat(12, 1fr); row-gap: 28px; padding: 56px 0 40px; border-bottom: 1px solid var(--ink); }
.case-head .back { grid-column: 1 / -1; text-decoration: none; }
.case-head .back:hover { color: var(--red); }
.case-head h1 { grid-column: 1 / -1; font: 800 clamp(3.2rem, 10vw, 8.5rem)/.85 Rubik; letter-spacing: -.05em; display: flex; align-items: baseline; gap: .15em; }
.case-head h1 .num { font-size: clamp(1.2rem, 3.5vw, 3rem); }
.case-head .lede { grid-column: 1 / 8; font-size: 22px; line-height: 1.35; text-wrap: pretty; }
.facts { grid-column: 9 / -1; }
.facts div { display: grid; grid-template-columns: 90px 1fr; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 15px; }
.facts div:first-child { border-top: 1px solid var(--line); }
.facts dd { margin: 0; }
.facts a { text-decoration-color: var(--red); text-underline-offset: 3px; }
.shot { padding: 32px 0; border-bottom: 1px solid var(--line); }
.shot img { width: 100%; border: 1px solid var(--line); }
.shot img.term { background: #111; }
.shot figcaption { margin-top: 10px; }
.block { display: grid; grid-template-columns: repeat(12, 1fr); padding: 40px 0; border-bottom: 1px solid var(--line); row-gap: 16px; }
.block h2 { grid-column: 1 / 4; font: 800 1.6rem/1.1 Rubik; letter-spacing: -.03em; }
.block .body { grid-column: 5 / -1; display: flex; flex-direction: column; gap: 14px; font-size: 17px; line-height: 1.6; }
.block .body p, .block .body ul { max-width: 64ch; }
.block ul { padding-left: 0; list-style: none; display: flex; flex-direction: column; gap: 8px; }
.block li { padding-left: 20px; position: relative; }
.block li::before { content: ""; position: absolute; left: 0; top: .7em; width: 8px; height: 1px; background: var(--red); }
.block strong { font-weight: 700; }
code { font: 400 .88em var(--mono); background: var(--paper-hi); border: 1px solid var(--line); padding: 0 4px; }
pre { font: 400 13px/1.6 var(--mono); background: var(--ink); color: #e8e6df; padding: 20px; overflow-x: auto; max-width: 100%; }
code, pre { font-variant-ligatures: none; }
pre code { background: none; border: 0; padding: 0; font-size: inherit; }
pre .c { color: #8f8d86; }
.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.pair img { border: 1px solid var(--line); }
.next { display: flex; justify-content: space-between; align-items: end; padding: 40px 0; border-bottom: 1px solid var(--ink); text-decoration: none; }
.next strong { font: 800 clamp(2rem, 5vw, 3.5rem)/1 Rubik; letter-spacing: -.04em; }
.next:hover strong { color: var(--red); }

@media (max-width: 760px) {
  nav { margin: 0 -10px; }
  nav a { padding: 18px 10px; }
  nav .links .hide-sm { display: none; }
  .hero-text, .cols .text, .stack, .case-head .lede, .facts, .block h2, .block .body { grid-column: 1 / -1; }
  .grid > a, .poc > a { grid-column: 1 / -1; }
  .hero-3d { grid-column: 1 / -1; height: 260px; margin-top: 24px; }
  .p3 { flex-direction: column !important; align-items: stretch; }
  .grid .p3 img { width: 100%; }
  .contact { grid-template-columns: 1fr; }
  .others a { grid-template-columns: 1fr; gap: 4px; }
  .others a .m { display: none; }
  .pair { grid-template-columns: 1fr; }
  .stack div { grid-template-columns: 100px 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .zoom img, .zoom::backdrop { animation: none !important; }
}

/* Click to zoom (case pages) */
.zoomable { cursor: zoom-in; }
.zoom { width: 100vw; height: 100vh; max-width: none; max-height: none; margin: 0; padding: 0; border: 0; background: none; cursor: zoom-out; }
.zoom[open] { display: grid; place-items: center; }
.zoom::backdrop { background: rgba(20, 20, 20, .85); }
.zoom img { max-width: min(1100px, 88vw); max-height: 80vh; width: auto; height: auto; border: 0; }
.zoom[open] img { animation: zoom-in .25s cubic-bezier(.2, .8, .2, 1); }
.zoom[open]::backdrop { animation: fade-in .25s ease-out; }
.zoom.closing img { animation: zoom-out .18s ease-in forwards; }
.zoom.closing::backdrop { animation: fade-out .18s ease-in forwards; }
@keyframes zoom-in { from { opacity: 0; transform: scale(.92); } }
@keyframes zoom-out { to { opacity: 0; transform: scale(.95); } }
@keyframes fade-in { from { opacity: 0; } }
@keyframes fade-out { to { opacity: 0; } }
