/* Layout concept: a wide cream sheet with a narrow reading column, a left-aligned
   masthead, and a mono "data" voice for anything numeric. Magazine, not brochure. */
:root {
  --paper: #f6f1e7;
  --paper-2: #ede6d8;
  --ink: #1d1b16;
  --ink-2: #5a554a;
  --rule: #d6cdbb;
  --accent: #0f5c5a;
  --accent-2: #b8672b;
  --display: "Fraunces", "Iowan Old Style", Georgia, serif;
  --body: "Source Sans 3", "Helvetica Neue", Arial, sans-serif;
  --mono: "IBM Plex Mono", "SFMono-Regular", Menlo, monospace;
  --plate: transparent;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #17150f;
    --paper-2: #221f17;
    --ink: #efe8d8;
    --ink-2: #b3ab98;
    --rule: #3b362a;
    --accent: #6fc4bd;
    --accent-2: #e09a60;
    --plate: #efe9dc;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #17150f;
  --paper-2: #221f17;
  --ink: #efe8d8;
  --ink-2: #b3ab98;
  --rule: #3b362a;
  --accent: #6fc4bd;
  --accent-2: #e09a60;
  --plate: #efe9dc;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { height: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--body);
  font-size: 1.0625rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
a:focus-visible, button:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 3px; }
img { max-width: 100%; display: block; }
.wrap { max-width: 1120px; margin-inline: auto; padding-inline: clamp(16px, 4vw, 40px); }

/* Masthead */
.masthead {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 10;
  background: var(--paper); border-bottom: 1px solid var(--rule);
}
.masthead .wrap {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding-block: 14px; flex-wrap: wrap;
}
.brand { font-family: var(--display); font-weight: 600; font-size: 1.15rem; letter-spacing: .01em; color: var(--ink); }
.brand small { display: block; font-family: var(--mono); font-weight: 400; font-size: .68rem; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-2); }
.nav { display: flex; gap: clamp(12px, 2.5vw, 28px); flex-wrap: wrap; }
.nav a { font-family: var(--mono); font-size: .78rem; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-2); padding-block: 4px; border-bottom: 1px solid transparent; }
.nav a:hover { text-decoration: none; color: var(--ink); }
.nav a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--accent-2); }

/* Type scale */
.eyebrow { font-family: var(--mono); font-size: .72rem; letter-spacing: .14em; text-transform: uppercase; color: var(--accent); margin: 0 0 10px; }
h1, h2, h3 { font-family: var(--display); font-weight: 500; line-height: 1.1; text-wrap: balance; margin: 0; }
h1 { font-size: clamp(2.4rem, 5.5vw, 4.4rem); letter-spacing: -.015em; font-variation-settings: "SOFT" 60, "WONK" 1; }
h2 { font-size: clamp(1.7rem, 3vw, 2.4rem); }
h3 { font-size: 1.25rem; font-weight: 600; }
p { margin: 0; }
.lede { font-size: 1.25rem; line-height: 1.5; color: var(--ink); max-width: 38ch; }
.prose { max-width: 66ch; display: grid; gap: 1em; }
.prose p + p { }
.muted { color: var(--ink-2); }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.num { font-family: var(--mono); font-variant-numeric: tabular-nums; }

/* Sections */
section { padding-block: clamp(40px, 7vw, 88px); border-top: 1px solid var(--rule); }
section:first-of-type { border-top: 0; }
.sec-head { display: grid; gap: 8px; margin-bottom: clamp(24px, 4vw, 40px); }
.two-col { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); gap: clamp(24px, 5vw, 72px); align-items: start; }
@media (max-width: 760px) { .two-col { grid-template-columns: 1fr; } }
.two-col > * { min-width: 0; }

/* Hero */
.hero { padding-block: clamp(40px, 8vw, 96px); border-top: 0; }
.hero-grid { display: grid; grid-template-columns: minmax(0, 3fr) minmax(220px, 2fr); gap: clamp(28px, 6vw, 80px); align-items: end; }
@media (max-width: 760px) { .hero-grid { grid-template-columns: 1fr; align-items: start; } }
.hero-grid > * { min-width: 0; }
.hero .lede { margin-top: 22px; }
.links-row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 26px; }
.hero-meta { margin-top: 28px; display: grid; gap: 6px; font-family: var(--mono); font-size: .82rem; color: var(--ink-2); }
.hero-meta span b { color: var(--ink); font-weight: 500; }
.portrait {
  aspect-ratio: 4 / 5; max-width: 100%; width: 100%;
  background: var(--paper-2); border: 1px solid var(--rule);
  display: grid; place-items: center; position: relative; overflow: hidden;
}
.portrait img { width: 100%; height: 100%; object-fit: cover; }
.portrait .mark { font-family: var(--display); font-size: clamp(4rem, 9vw, 7rem); font-weight: 300; color: var(--accent); line-height: 1; font-variation-settings: "SOFT" 100, "WONK" 1; }
.portrait figcaption { position: absolute; bottom: 10px; left: 12px; right: 12px; font-family: var(--mono); font-size: .68rem; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-2); }

/* Lists with rules */
.ruled { list-style: none; margin: 0; padding: 0; }
.ruled li { display: grid; grid-template-columns: 7.5rem minmax(0, 1fr); gap: 16px; padding-block: 14px; border-top: 1px solid var(--rule); }
.ruled li:last-child { border-bottom: 1px solid var(--rule); }
.ruled .when { font-family: var(--mono); font-size: .8rem; color: var(--ink-2); padding-top: 4px; font-variant-numeric: tabular-nums; }
@media (max-width: 520px) { .ruled li { grid-template-columns: 1fr; gap: 4px; } }

/* Research threads */
.threads { display: grid; gap: 0; counter-reset: thread; }
.thread { display: grid; grid-template-columns: 4rem minmax(0, 1fr); gap: 20px; padding-block: 28px; border-top: 1px solid var(--rule); }
.thread:last-child { border-bottom: 1px solid var(--rule); }
.thread .idx { font-family: var(--display); font-size: 2rem; font-weight: 300; color: var(--accent-2); line-height: 1; font-variation-settings: "WONK" 1; }
.thread .body { display: grid; gap: 10px; max-width: 66ch; }
.thread .tags { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.tag { font-family: var(--mono); font-size: .7rem; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-2); border: 1px solid var(--rule); padding: 3px 8px; border-radius: 999px; }
.tags { display: flex; flex-wrap: wrap; gap: 8px; }
.tags-lg .tag { font-size: .78rem; padding: 8px 14px; color: var(--ink); }
@media (max-width: 520px) { .thread { grid-template-columns: 1fr; gap: 8px; } }

/* Testbed spec table */
.spec { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 1px; background: var(--rule); border: 1px solid var(--rule); }
.spec div { background: var(--paper); padding: 18px 16px; display: grid; gap: 6px; }
.spec .val { font-family: var(--mono); font-size: 1.35rem; font-variant-numeric: tabular-nums; color: var(--ink); }
.spec .lbl { font-size: .85rem; color: var(--ink-2); }

/* Publications */
.pubs { list-style: none; margin: 0; padding: 0; }
.pub { display: grid; gap: 6px; padding-block: 20px; border-top: 1px solid var(--rule); max-width: 78ch; }
.pub:last-child { border-bottom: 1px solid var(--rule); }
.pub .title { font-family: var(--display); font-size: 1.2rem; font-weight: 500; line-height: 1.25; text-wrap: pretty; }
.pub .authors { font-size: .95rem; }
.pub .authors b { font-weight: 600; color: var(--ink); }
.pub .venue { font-family: var(--mono); font-size: .78rem; color: var(--ink-2); display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; }
.status { font-family: var(--mono); font-size: .68rem; letter-spacing: .1em; text-transform: uppercase; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--rule); color: var(--ink-2); }
.status.pub { color: var(--accent); border-color: var(--accent); }
.status.rev { color: var(--accent-2); border-color: var(--accent-2); }
.pub .links { display: flex; gap: 14px; font-family: var(--mono); font-size: .78rem; }

/* Skills grid */
.grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: clamp(20px, 3vw, 36px); }
.grid-3 > div { min-width: 0; display: grid; gap: 8px; align-content: start; }
.grid-3 h3 { padding-bottom: 8px; border-bottom: 1px solid var(--rule); }
.grid-3 ul { margin: 0; padding-left: 1.1em; color: var(--ink-2); }

/* Timeline (CV) */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { display: grid; grid-template-columns: 9rem minmax(0, 1fr); gap: 16px; padding-block: 18px; border-top: 1px solid var(--rule); }
.timeline li:last-child { border-bottom: 1px solid var(--rule); }
.timeline .when { font-family: var(--mono); font-size: .8rem; color: var(--ink-2); padding-top: 4px; font-variant-numeric: tabular-nums; }
.timeline .what { display: grid; gap: 4px; }
.timeline .what b { font-weight: 600; }
.timeline .what span { color: var(--ink-2); }
@media (max-width: 520px) { .timeline li { grid-template-columns: 1fr; gap: 4px; } }

/* Buttons and contact */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--mono); font-size: .78rem; letter-spacing: .1em; text-transform: uppercase;
  color: var(--paper); background: var(--ink); padding: 12px 18px; border: 1px solid var(--ink);
  cursor: pointer; text-decoration: none;
}
.btn:hover { background: var(--accent); border-color: var(--accent); text-decoration: none; }
.btn.ghost { background: transparent; color: var(--ink); }
.btn.ghost:hover { background: var(--paper-2); }
.contact-row { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.contact-row code { font-family: var(--mono); font-size: 1rem; color: var(--ink); background: var(--paper-2); padding: 8px 12px; border: 1px solid var(--rule); user-select: all; }
.note { font-family: var(--mono); font-size: .78rem; color: var(--ink-2); }
.callout { border-left: 3px solid var(--accent-2); padding: 12px 16px; background: var(--paper-2); font-size: .95rem; color: var(--ink-2); max-width: 66ch; }

/* Footer */
footer { border-top: 1px solid var(--rule); padding-block: 28px 40px; }
footer .wrap { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; font-family: var(--mono); font-size: .75rem; color: var(--ink-2); }

@media (prefers-reduced-motion: no-preference) {
  .hero h1 { animation: rise .7s cubic-bezier(.2,.7,.2,1) both; }
  .hero .lede, .hero .hero-meta { animation: rise .7s .12s cubic-bezier(.2,.7,.2,1) both; }
  @keyframes rise { from { opacity: .001; transform: translateY(10px); } to { opacity: 1; transform: none; } }
}

/* ===== Editorial pass ===== */
/* Paper grain */
body { position: relative; }
body::before {
  content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 0;
  opacity: var(--grain, .07); mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --grain: .04; } }
:root[data-theme="dark"] { --grain: .04; }
header, main, footer { position: relative; z-index: 1; }

/* Alternating section tones */
main > section:nth-child(even) { background: var(--paper-2); }
main > section:nth-child(even) .spec div { background: var(--paper-2); }
main > section:nth-child(even) .callout, main > section:nth-child(even) .contact-row code { background: var(--paper); }

/* Masthead current-page marker */
.nav a { position: relative; border-bottom: 0; }
.nav a[aria-current="page"]::after { content: ""; position: absolute; left: 0; bottom: -2px; width: 18px; height: 2px; background: var(--accent); }

/* Hero: ambient curve and drawn rule */
.hero { position: relative; overflow: hidden; }
.hero-curve { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 0; }
.hero-curve svg { width: 100%; height: 100%; display: block; }
.hero-curve path { fill: none; stroke: var(--ink); stroke-width: 1.2; opacity: .14; }
.hero-curve .soc { stroke: var(--accent); stroke-dasharray: 4 6; opacity: .28; }
.hero-curve .grid { stroke: var(--ink); opacity: .06; stroke-width: 1; }
.hero .wrap { position: relative; z-index: 1; }
.hero h1 { font-weight: 400; letter-spacing: -.02em; }
.hero h1::after { content: ""; display: block; width: 2.4em; height: 3px; background: var(--accent); margin-top: 18px; transform-origin: left; }
@media (prefers-reduced-motion: no-preference) {
  .hero h1::after { animation: draw .9s .45s cubic-bezier(.2,.7,.2,1) both; }
  @keyframes draw { from { transform: scaleX(0); } to { transform: scaleX(1); } }
  body { animation: fade .5s ease both; }
  @keyframes fade { from { opacity: .001; } to { opacity: 1; } }
}
.pin { display: inline-flex; align-items: center; gap: 8px; }
.pin svg { width: 14px; height: 14px; stroke: var(--accent); fill: none; stroke-width: 1.8; }

/* Mounted-print portrait */
.portrait { position: relative; border: 0; background: transparent; overflow: visible; margin: 0; }
.portrait img { border: 1px solid var(--rule); position: relative; z-index: 1; }
.portrait::before { content: ""; position: absolute; inset: 14px -14px -14px 14px; border: 1px solid var(--accent); z-index: 0; }
@media (min-width: 900px) { .hero-grid .portrait { transform: translateX(6%) scale(1.06); transform-origin: right center; } }

/* Pull quote */
.pull { font-family: var(--display); font-style: italic; font-weight: 300; font-size: clamp(1.6rem, 3.4vw, 2.6rem); line-height: 1.2; text-wrap: balance; max-width: 26ch; color: var(--ink); font-variation-settings: "SOFT" 80, "WONK" 1; }
.pull::before { content: "\201C"; color: var(--accent-2); margin-right: .05em; }
.pull::after { content: "\201D"; color: var(--accent-2); }

/* Hanging-year publication list */
.pub { grid-template-columns: 4.5rem minmax(0, 1fr); column-gap: 18px; row-gap: 0; max-width: 84ch; }
.pub .yr { font-family: var(--mono); font-size: .8rem; color: var(--ink-2); padding-top: 6px; font-variant-numeric: tabular-nums; grid-row: 1 / span 4; }
.pub .yr small { display: block; font-size: .62rem; letter-spacing: .1em; text-transform: uppercase; color: var(--accent-2); margin-top: 4px; }
.pub .title, .pub .authors, .pub .venue, .pub .links { grid-column: 2; }
.pub .authors, .pub .venue { margin-top: 6px; }
@media (max-width: 520px) { .pub { grid-template-columns: 1fr; } .pub .yr { grid-row: auto; } .pub .title, .pub .authors, .pub .venue, .pub .links { grid-column: 1; } }

/* Compact CV timeline strip */
.strip { position: relative; margin-top: 40px; padding-block: 64px; }
.strip .track { position: absolute; left: 0; right: 0; top: 50%; height: 1px; background: var(--rule); }
.strip .yr-lbl { position: absolute; top: calc(50% + 10px); font-family: var(--mono); font-size: .68rem; color: var(--ink-2); transform: translateX(-50%); font-variant-numeric: tabular-nums; }
.strip .dot { position: absolute; top: 50%; width: 10px; height: 10px; border-radius: 50%; background: var(--paper); border: 2px solid var(--accent); transform: translate(-50%, -50%); }
.strip .dot.now { background: var(--accent); }
.strip .lbl { position: absolute; transform: translateX(-50%); font-family: var(--mono); font-size: .68rem; letter-spacing: .04em; color: var(--ink); white-space: nowrap; text-align: center; }
.strip .lbl.up { bottom: calc(50% + 14px); }
.strip .lbl.down { top: calc(50% + 28px); }
.strip .lbl span { display: block; color: var(--ink-2); font-size: .62rem; }
@media (max-width: 700px) { .strip { display: none; } }

/* Footer columns */
footer .wrap { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 24px; font-family: var(--body); font-size: .9rem; color: var(--ink-2); }
footer h4 { font-family: var(--mono); font-size: .68rem; letter-spacing: .12em; text-transform: uppercase; color: var(--accent); margin: 0 0 8px; font-weight: 500; }
footer ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
footer .fine { font-family: var(--mono); font-size: .72rem; }

/* Expertise icons */
.grid-3 .ico { width: 28px; height: 28px; fill: none; stroke: var(--accent); stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; margin-bottom: 4px; }

/* Portrait hover crossfade */
.portrait img.alt { position: absolute; inset: 0; z-index: 2; opacity: 0; transition: opacity .6s ease; }
.portrait:hover img.alt, .portrait:focus-within img.alt { opacity: 1; }
@media (prefers-reduced-motion: reduce) { .portrait img.alt { transition: none; } }

/* Institutions */
.inst { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 1px; background: var(--rule); border: 1px solid var(--rule); }
.inst li { background: var(--paper); padding: 22px 20px; display: grid; gap: 6px; min-width: 0; }
main > section:nth-child(even) .inst li { background: var(--paper-2); }
.inst .name { font-family: var(--display); font-size: 1.3rem; font-weight: 500; line-height: 1.15; text-wrap: balance; }
.inst .role { font-size: .92rem; color: var(--ink-2); }
.inst .where { font-family: var(--mono); font-size: .7rem; letter-spacing: .1em; text-transform: uppercase; color: var(--accent); margin-top: 4px; }

/* Masthead logo, left of the name */
.brand { display: flex; align-items: center; gap: 14px; }
.brand .logo { width: 52px; height: 52px; border-radius: 10px; flex: none; }
.brand .brand-text { display: block; line-height: 1.15; }
.masthead .wrap { padding-block: 10px; }
/* Timeline strip: phone fallback list */
.strip-list { display: none; list-style: none; margin: 0; padding: 0; }
.strip-list li { display: grid; grid-template-columns: 3.5rem minmax(0, 1fr); gap: 12px; padding-block: 10px; border-top: 1px solid var(--rule); }
.strip-list li:last-child { border-bottom: 1px solid var(--rule); }
.strip-list .when { font-family: var(--mono); font-size: .8rem; color: var(--accent); font-variant-numeric: tabular-nums; }
@media (max-width: 700px) { .strip-list { display: grid; } }
.strip { margin-top: 0; }

/* Nav tiles, same family as the tab icon */
.nav a { display: inline-flex; align-items: center; gap: 8px; }
.nav a .tile { width: 20px; height: 20px; flex: none; }
.nav a .tile rect { fill: var(--ink); }
.nav a .tile path { fill: var(--paper); }
.nav a[aria-current="page"] .tile path { fill: #e9772c; }
.nav a:hover .tile path { fill: #e9772c; }

/* Institution logos */
.inst a.plate:hover { border-color: var(--accent); }
.inst .plate { display: flex; align-items: center; justify-content: center; height: 124px; background: #ffffff; border: 1px solid var(--rule); border-radius: 6px; padding: 12px 16px; margin-bottom: 12px; overflow: hidden; }
.inst .plate img { max-height: 96px; max-width: 100%; width: auto; height: auto; object-fit: contain; }
.inst .plate img[src*="polymtl"], .inst .plate img[src*="upm"], .inst .plate img[src*="polimi"] { max-width: 84%; }
.inst .plate img[src*="uowm"] { max-height: 60px; }

/* Services grid */
.services { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.services > div { padding: 22px; border: 1px solid var(--rule); background: var(--paper); }
main > section:nth-child(even) .services > div { background: var(--paper-2); }
.services h3 { border-bottom: 0; padding-bottom: 0; }
.nav { gap: clamp(10px, 2vw, 22px); }

/* Offer card on the home page */
.offer { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 24px; align-items: center; padding: clamp(22px, 4vw, 40px); border: 1px solid var(--accent); background: var(--paper); color: var(--ink); text-decoration: none; }
.offer:hover { text-decoration: none; background: var(--paper-2); }
.offer h2 { font-size: clamp(1.4rem, 2.6vw, 2rem); margin-bottom: 8px; }
.offer .btn { white-space: nowrap; }
@media (max-width: 640px) { .offer { grid-template-columns: 1fr; } }

/* Language switcher */
.lang { display: flex; gap: 6px; align-items: center; }
.lang a { display: inline-flex; align-items: center; gap: 6px; font-family: var(--mono); font-size: .72rem; letter-spacing: .08em; padding: 5px 8px; border: 1px solid transparent; border-radius: 999px; color: var(--ink-2); }
.lang a svg { width: 18px; height: 12px; border-radius: 2px; box-shadow: 0 0 0 1px var(--rule); }
.lang a:hover { text-decoration: none; color: var(--ink); border-color: var(--rule); }
.lang a[aria-current="true"] { color: var(--ink); border-color: var(--accent); }

/* Phones and tablets */
@media (max-width: 900px) {
  .masthead .wrap { flex-wrap: wrap; gap: 10px 16px; }
  .brand { flex: 1 1 100%; }
  .lang { margin-left: auto; }
  .nav { flex: 1 1 100%; flex-wrap: nowrap; overflow-x: auto; gap: 14px; padding-bottom: 6px; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
  .nav::-webkit-scrollbar { display: none; }
  .nav a { white-space: nowrap; }
}
@media (max-width: 520px) {
  .brand .logo { width: 44px; height: 44px; }
  .brand { font-size: 1.05rem; }
  .lang a span { display: none; }
  .lang a { padding: 6px; }
  .hero .lede { font-size: 1.1rem; }
  .links-row .btn { padding: 11px 14px; font-size: .72rem; }
  .portrait::before { inset: 10px -10px -10px 10px; }
  .hero-grid { gap: 28px; }
}

/* Brand wordmark in the offer card */
.offer .wordmark { width: min(100%, 360px); height: auto; display: block; margin-bottom: 18px; }

.hero .hero-wordmark { width: min(100%, 300px); height: auto; display: block; margin: 0 0 28px; }
@media (prefers-reduced-motion: no-preference) { .hero .hero-wordmark { animation: rise .7s .06s cubic-bezier(.2,.7,.2,1) both; } }
/* Hero wordmark: full-strength tagline so it reads over the ambient curve */
/* tagline colour is set in the SVG itself */


/* Header grid: name and wordmark on the first row, tiles and flags on the second */
.masthead .wrap { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-rows: auto auto; align-items: center; row-gap: 2px; column-gap: 24px; padding-block: 8px 8px; }
.brand { grid-area: 1 / 1; }
.masthead .head-wordmark { grid-area: 1 / 2; width: 150px; height: auto; display: block; justify-self: end; }
.nav { grid-area: 2 / 1; }
.lang { grid-area: 2 / 2; justify-self: end; }
.brand .logo { width: 48px; height: 48px; border-radius: 8px; }
@media (max-width: 900px) {
  .masthead .wrap { grid-template-columns: minmax(0, 1fr) auto; }
  .nav { grid-area: 3 / 1 / 4 / 3; }
  .lang { grid-area: 2 / 1 / 3 / 3; justify-self: start; }
  .masthead .head-wordmark { width: 130px; }
}
@media (max-width: 520px) { .masthead .head-wordmark { width: 110px; } }

/* Footer wordmark */
footer .foot-wordmark { width: 130px; height: auto; display: block; margin: 2px 0 10px; }

/* CV download held back for now */
.soon { cursor: default; opacity: .55; }
.soon:hover { text-decoration: none; background: inherit; }
.btn.soon:hover { background: var(--ink); border-color: var(--ink); }
.btn.ghost.soon:hover { background: transparent; }

/* Theme switch */
.lang .theme { display: inline-grid; place-items: center; width: 30px; height: 30px; margin-left: 4px; border: 1px solid var(--rule); border-radius: 999px; background: transparent; color: var(--ink-2); cursor: pointer; padding: 0; }
.lang .theme:hover { color: var(--ink); border-color: var(--accent); }
.lang .theme svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.lang .theme .moon { display: none; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .lang .theme .sun { display: none; } :root:not([data-theme="light"]) .lang .theme .moon { display: block; } }
:root[data-theme="dark"] .lang .theme .sun { display: none; }
:root[data-theme="dark"] .lang .theme .moon { display: block; }
:root[data-theme="light"] .lang .theme .sun { display: block; }
:root[data-theme="light"] .lang .theme .moon { display: none; }

/* Graphics */
.hero-curve canvas { width: 100%; height: 100%; display: block; }
.graphic { margin: 0; min-width: 0; }
.graphic canvas { width: 100%; height: 300px; display: block; }
canvas[data-graphic="network"] { height: 340px; }
.graphic figcaption { margin-top: 8px; }
@media (max-width: 520px) { .graphic canvas { height: 240px; } canvas[data-graphic="network"] { height: 300px; } }
