/* philippefontaine.eu — self-hosted fonts, two themes, responsive layout. */

/* 1. Fonts — self-hosted, subset to Latin (no third-party request) --------- */

@font-face {
  font-family: 'Inter var';
  src: url('../fonts/inter-var-latin.woff2') format('woff2-variations');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-024F, U+0259, U+1E00-1E9F, U+2000-20AC, U+2122, U+2212, U+FEFF, U+FFFD;
}

@font-face {
  font-family: 'Source Serif var';
  src: url('../fonts/source-serif-4-var-latin.woff2') format('woff2-variations');
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-024F, U+0259, U+1E00-1E9F, U+2000-20AC, U+2122, U+2212, U+FEFF, U+FFFD;
}

/* 2. Design tokens --------------------------------------------------------- */

:root {
  color-scheme: dark;

  --bg: #0b0f14;
  --bg-grad-a: #0d2620;
  --bg-grad-b: #0b1a24;
  --surface: #111821;
  --surface-2: #16202b;
  --surface-3: #1b2734;
  --border: #1f2b38;
  --border-strong: #314354;

  --text: #e8eef4;
  --text-muted: #a3b4c2;
  --text-subtle: #8296a5;

  --accent: #2fbf8f;
  --accent-strong: #5bd9ad;
  --accent-soft: rgba(47, 191, 143, 0.14);
  --accent-line: rgba(47, 191, 143, 0.34);
  --on-accent: #05221a;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow-md: 0 12px 28px -18px rgba(0, 0, 0, .85);
  --shadow-lg: 0 28px 60px -30px rgba(0, 0, 0, .9);

  --r-xs: 6px;
  --r-sm: 10px;
  --r-md: 14px;
  --r-lg: 20px;
  --r-full: 999px;

  /* Fluid type scale */
  --step--2: clamp(.6875rem, .67rem + .08vw, .75rem);
  --step--1: clamp(.8125rem, .79rem + .11vw, .875rem);
  --step-0:  clamp(.9375rem, .91rem + .14vw, 1rem);
  --step-1:  clamp(1.0625rem, 1.02rem + .22vw, 1.1875rem);
  --step-2:  clamp(1.1875rem, 1.1rem + .38vw, 1.4375rem);
  --step-3:  clamp(1.4375rem, 1.28rem + .78vw, 1.9375rem);
  --step-4:  clamp(1.875rem, 1.5rem + 1.7vw, 2.75rem);

  --font-sans: 'Inter var', system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --font-serif: 'Source Serif var', Georgia, 'Times New Roman', serif;

  --gutter: clamp(1.25rem, 4vw, 3rem);
  --sidebar-w: 21.5rem;
  --ease: cubic-bezier(.22, .61, .36, 1);
  --speed: 220ms;
}

:root[data-theme='light'] {
  color-scheme: light;

  --bg: #f5f8f8;
  --bg-grad-a: #e6f2ed;
  --bg-grad-b: #e7eff3;
  --surface: #ffffff;
  --surface-2: #f1f5f6;
  --surface-3: #e8eef0;
  --border: #dde5e8;
  --border-strong: #bccad1;

  --text: #0d1a21;
  --text-muted: #4c5f6b;
  --text-subtle: #5d6f7c;

  --accent: #0a7a5a;
  --accent-strong: #065f46;
  --accent-soft: rgba(10, 122, 90, .10);
  --accent-line: rgba(10, 122, 90, .26);
  --on-accent: #ffffff;

  --shadow-sm: 0 1px 2px rgba(13, 26, 33, .06);
  --shadow-md: 0 10px 24px -16px rgba(13, 26, 33, .32);
  --shadow-lg: 0 24px 48px -28px rgba(13, 26, 33, .36);
}

/* Base ------------------------------------------------------------------ */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 5rem; }
body {
  min-height: 100svh;
  color: var(--text);
  background: radial-gradient(60rem 38rem at 0 0, var(--bg-grad-a), transparent 70%), var(--bg);
  font-family: var(--font-sans);
  font-size: var(--step-0);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}
img, svg { display: block; max-width: 100%; }
img { height: auto; }
ul, ol { padding: 0; list-style: none; }
h1, h2, h3, h4 { font-family: var(--font-serif); font-weight: 600; line-height: 1.2; text-wrap: balance; }
p { text-wrap: pretty; }
a { color: inherit; text-underline-offset: .2em; text-decoration-color: var(--accent-line); }
a:hover { color: var(--accent-strong); }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
:focus-visible { outline: 2px solid var(--accent-strong); outline-offset: 4px; border-radius: 3px; }
::selection { color: var(--on-accent); background: var(--accent); }
.icon-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
.skip-link { position: fixed; z-index: 100; top: .75rem; left: .75rem; padding: .6rem 1rem; color: var(--on-accent); background: var(--accent); transform: translateY(-180%); }
.skip-link:focus { transform: none; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .6rem; min-height: 44px; padding: .7rem 1.1rem; border: 1px solid var(--border-strong); border-radius: var(--r-xs); font-size: var(--step--1); font-weight: 600; line-height: 1.3; text-decoration: none; }
.btn svg { width: 1.05em; height: 1.05em; }
.btn--primary { color: var(--on-accent); background: var(--accent); border-color: var(--accent); }
.btn--primary:hover { color: var(--on-accent); background: var(--accent-strong); border-color: var(--accent-strong); }
.btn--ghost:hover { background: var(--accent-soft); border-color: var(--accent-line); }
.btn__format { font-size: .65rem; opacity: .75; }
.eyebrow { display: block; font-size: .6875rem; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--accent-strong); }
.shell { width: 100%; max-width: 88rem; margin: auto; padding-inline: var(--gutter); }
.sidebar { display: contents; }
.main { min-width: 0; }
.profile { position: relative; display: grid; grid-template-columns: 3.75rem minmax(0, 1fr); align-items: center; gap: .85rem 1rem; padding-block: 1.5rem 1rem; }
.profile__photo { width: 3.75rem; aspect-ratio: 1; }
.profile__photo img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; border: 1px solid var(--border-strong); }
.profile__identity { min-width: 0; }
.profile__name { font-size: clamp(1.25rem, 3.7vw, 1.6rem); letter-spacing: -.03em; }
.profile__role { font-size: .8125rem; color: var(--accent-strong); margin-top: .2rem; }
.profile__meta { display: flex; flex-wrap: wrap; gap: .3rem; color: var(--text-subtle); font-size: .6875rem; }
.profile__meta svg { display: none; }
.profile__actions { display: flex; flex-wrap: wrap; gap: .6rem; grid-column: 1 / -1; }
.profile__actions .btn { min-height: 40px; padding: .45rem .85rem; }
.profile > .profile__actions .btn { background: transparent; color: var(--text-muted); border-color: var(--border-strong); }
.profile > .profile__actions .btn:hover { color: var(--text); background: var(--surface-2); }
.utilbar { position: absolute; bottom: 1rem; right: 0; display: flex; gap: .25rem; }
.utilbar__btn { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; border: 1px solid var(--border); border-radius: var(--r-xs); color: var(--text-muted); font-size: .6875rem; font-weight: 600; text-decoration: none; }
.utilbar__btn:hover { color: var(--text); background: var(--surface-2); }
.utilbar__btn svg { width: 1rem; height: 1rem; }
.theme-toggle .theme-toggle__moon { display: none; }
:root[data-theme='light'] .theme-toggle .theme-toggle__moon { display: block; }
:root[data-theme='light'] .theme-toggle .theme-toggle__sun { display: none; }
.socials { display: none; }
.nav { position: sticky; top: 0; z-index: 50; margin-inline: calc(-1 * var(--gutter)); padding-inline: var(--gutter); background: var(--bg); border-block: 1px solid var(--border); }
.nav__list { position: relative; display: grid; grid-template-columns: repeat(5, 1fr); gap: .15rem; }
.nav__list a { display: flex; align-items: center; justify-content: center; gap: .65rem; min-height: 48px; font-size: .75rem; color: var(--text-muted); text-decoration: none; border-bottom: 2px solid transparent; }
.nav__list a svg { display: none; }
.nav__list a:hover { color: var(--text); }
.nav__list a[aria-current] { color: var(--accent-strong); border-color: var(--accent); }

/* Introduction ---------------------------------------------------------- */
.section { padding-block: clamp(2.5rem, 6vw, 4rem); border-top: 1px solid var(--border); }
.section__head { margin-bottom: 1.75rem; }
.section__title { font-size: clamp(1.6rem, 2.4vw, 2rem); letter-spacing: -.025em; margin-top: .4rem; }
.section__lede { max-width: 56ch; margin-top: 1rem; color: var(--text-muted); font-size: var(--step-1); line-height: 1.65; }
.hero { border: 0; padding-block: clamp(2.25rem, 5vw, 4rem) 2rem; }
.hero .section__head { margin-bottom: .75rem; }
.hero h2 { font-size: clamp(2.25rem, 4.4vw, 3.75rem); letter-spacing: -.045em; line-height: 1.1; margin-top: 1rem; }
.hero__note { max-width: 55ch; color: var(--text-muted); font-size: var(--step--1); }
.hero__actions { display: flex; flex-wrap: wrap; gap: .7rem; margin-top: 1.5rem; }
.hero__actions .btn--primary span { font-size: 1.1rem; }
.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .85rem; margin-top: 2rem; padding-top: 1.5rem; border-top: 1px solid var(--border); }
.stats li { display: flex; flex-direction: column; gap: .35rem; }
.stats strong { color: var(--text); font-size: clamp(1.5rem, 3vw, 2rem); font-family: var(--font-serif); font-weight: 600; line-height: 1; font-variant-numeric: tabular-nums; }
.stats span { color: var(--text-subtle); font-size: clamp(.65rem, 1.4vw, .75rem); max-width: 18ch; }
.section__intro { margin-bottom: 1.25rem; }
.section__intro h3 { font-size: 1.25rem; }
.section__intro p { margin-top: .4rem; font-size: var(--step--1); color: var(--text-muted); }

/* Work ------------------------------------------------------------------ */
.project-grid, .grid--2 { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1.1rem; }
.project { display: flex; flex-direction: column; align-items: flex-start; min-width: 0; padding: 1.35rem; border: 1px solid var(--border); border-radius: var(--r-sm); background: var(--surface); }
.project--live { border-top: 2px solid var(--accent); }
.project--live:nth-child(2) { border-top-color: #6a9dc7; }
.project__top { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .6rem; width: 100%; margin-bottom: 1.15rem; }
.project h3 { font-size: 1.5rem; margin-bottom: .65rem; letter-spacing: -.02em; }
.project p { font-size: var(--step--1); color: var(--text-muted); }
.project__actions { display: flex; flex-wrap: wrap; align-items: center; gap: .25rem 1.25rem; margin-top: auto; padding-top: 1.25rem; }
.project__link { display: inline-flex; gap: .65rem; align-items: center; min-height: 44px; font-size: var(--step--1); font-weight: 600; text-decoration: none; color: var(--accent-strong); }
.project__link:hover { text-decoration: underline; }
.project__link svg { width: .9rem; height: .9rem; flex: none; }
.project__source { display: inline-flex; align-items: center; min-height: 44px; font-size: .75rem; color: var(--text-muted); }
.publications { margin-top: 3rem; }
.publications .section__title { font-size: 1.5rem; }
.publications .section__lede { font-size: var(--step--1); }
.block-title { margin-bottom: .85rem; font-family: var(--font-sans); font-size: .8125rem; font-weight: 600; }
.pubs li { border-bottom: 1px solid var(--border); }
.pubs a { display: grid; grid-template-columns: 2.5rem minmax(0, 1fr) 1rem; align-items: start; gap: .6rem; padding-block: .9rem; font-size: var(--step--1); text-decoration: none; color: var(--text-muted); }
.pubs a:hover { color: var(--text); }
.pubs .year { font-size: .6875rem; color: var(--accent-strong); font-variant-numeric: tabular-nums; }
.pubs .cue svg { width: .8rem; height: .8rem; margin-top: .3rem; color: var(--text-subtle); }
details { border-top: 1px solid var(--border); }
summary { padding-block: 1rem; cursor: pointer; color: var(--text); font-size: var(--step--1); font-weight: 500; }
summary::marker { color: var(--accent); }
summary:hover { color: var(--accent-strong); }
.more-publications { border: 0; }
.more-publications summary { font-size: .75rem; color: var(--accent-strong); }

/* Expertise and career -------------------------------------------------- */
.expertise { gap: 1.75rem; }
.expertise__item { padding-top: 1.2rem; border-top: 1px solid var(--border-strong); }
.expertise__icon { display: block; width: 1.35rem; color: var(--accent-strong); margin-bottom: .85rem; }
.expertise__icon svg { width: 1.35rem; height: 1.35rem; }
.expertise h3 { font-size: 1.25rem; margin-bottom: .5rem; }
.expertise p { font-size: var(--step--1); color: var(--text-muted); }
.skills-details { margin-top: 2rem; }
.skillset { margin-top: 1rem; }
.skillset + .skillset { margin-top: 1.75rem; }
.skills { display: grid; grid-template-columns: minmax(0, 1fr); column-gap: 2rem; }
.skill { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: .75rem; align-items: center; padding-block: .7rem; border-bottom: 1px solid var(--border); }
.skill__name { font-size: var(--step--1); }
.skill__meta { font-size: .6875rem; text-align: right; color: var(--text-subtle); }
.prose { max-width: 65ch; color: var(--text-muted); font-size: var(--step--1); }
.prose p + p { margin-top: .85rem; }
.career-intro { margin-bottom: 2rem; }
.timeline { position: relative; padding-left: 1.5rem; border-left: 1px solid var(--border-strong); margin-left: .3rem; }
.timeline__item { position: relative; padding-bottom: 1.75rem; }
.timeline__item:last-child { padding-bottom: 0; }
.timeline__item::before { content: ''; position: absolute; width: .5rem; height: .5rem; border-radius: 50%; background: var(--accent); top: .55rem; left: -1.78rem; box-shadow: 0 0 0 5px var(--bg); }
.timeline__period { font-size: .6875rem; color: var(--accent-strong); font-weight: 600; }
.timeline__role { margin-top: .3rem; font-size: 1.2rem; }
.timeline__org { display: block; margin-top: .25rem; margin-bottom: .6rem; color: var(--text-subtle); font-size: var(--step--1); }
.timeline__item p:not(.timeline__period) { font-size: var(--step--1); color: var(--text-muted); }
.education { margin-top: 2rem; }
.education .timeline { margin-top: .75rem; }

/* Contact --------------------------------------------------------------- */
.contact-card { display: grid; gap: 1.5rem; padding: clamp(1.25rem, 3vw, 2rem); border: 1px solid var(--accent-line); border-radius: var(--r-sm); background: linear-gradient(130deg, var(--accent-soft), transparent 75%), var(--surface); }
.contact-card h2 { margin-top: .4rem; font-size: 2rem; }
.contact-card p { color: var(--text-muted); max-width: 52ch; margin-top: .75rem; font-size: var(--step--1); }
.contact-list { display: grid; gap: .5rem; }
.contact-list a, .contact-list > li > span { display: inline-flex; align-items: center; gap: .6rem; max-width: 100%; min-height: 32px; font-size: var(--step--1); color: var(--text-muted); text-decoration: none; }
.contact-list a:hover { color: var(--accent-strong); text-decoration: underline; }
.contact-list svg { width: 1rem; height: 1rem; flex: none; color: var(--accent-strong); }
.email-address { min-width: 0; overflow-wrap: anywhere; }
.contact__languages { font-size: .75rem; color: var(--text-subtle); margin-left: 1.6rem; }
.site-footer { display: flex; flex-wrap: wrap; gap: .75rem; justify-content: space-between; padding-block: 1.5rem 5rem; border-top: 1px solid var(--border); font-size: .6875rem; color: var(--text-subtle); }
.to-top { position: fixed; z-index: 55; right: 1rem; bottom: 1rem; width: 44px; height: 44px; display: flex; align-items: center; justify-content: center; color: var(--text-muted); background: var(--surface); border: 1px solid var(--border-strong); border-radius: 50%; visibility: hidden; }
.to-top svg { width: 1.1rem; height: 1.1rem; }
.to-top.is-visible { visibility: visible; }

/* Responsive ------------------------------------------------------------ */
@media (min-width: 42rem) {
  .project-grid, .grid--2, .skills { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stats li { flex-direction: row; align-items: center; gap: 1rem; }
}
@media (min-width: 64rem) {
  .shell { display: grid; grid-template-columns: 15rem minmax(0, 1fr); gap: clamp(2.5rem, 5vw, 5rem); }
  .sidebar { display: flex; flex-direction: column; position: sticky; top: 0; align-self: start; max-height: 100svh; overflow-y: auto; scrollbar-width: thin; padding-block: 3rem 1.5rem; }
  .profile { display: flex; flex-direction: column; align-items: flex-start; gap: 1rem; padding: 0 0 1.5rem; }
  .profile__photo { width: 5rem; }
  .profile__name { font-size: 1.6rem; }
  .profile__role { font-size: .875rem; margin-top: .4rem; }
  .profile__meta { font-size: .75rem; margin-top: .3rem; }
  .profile__actions { margin-top: .4rem; }
  .utilbar { position: static; order: 5; padding-top: .25rem; }
  .socials { display: flex; gap: .35rem; }
  .socials a { display: flex; align-items: center; justify-content: center; width: 36px; height: 36px; border: 1px solid var(--border); border-radius: var(--r-xs); color: var(--text-subtle); }
  .socials a:hover { color: var(--accent-strong); border-color: var(--accent-line); }
  .socials svg { width: 1rem; height: 1rem; }
  .nav { position: static; margin: 0; padding: 1rem 0 0; background: none; border-bottom: 0; }
  .nav__list { display: flex; flex-direction: column; }
  .nav__list a { justify-content: flex-start; font-size: .8125rem; min-height: 42px; padding-left: .9rem; border-bottom: 0; border-left: 2px solid transparent; }
  .nav__list a svg { display: block; width: 1rem; height: 1rem; }
  .nav__list a[aria-current] { background: var(--accent-soft); border-color: var(--accent); }
  .hero { padding-top: 3rem; }
  .hero h2 { font-size: clamp(2.75rem, 4vw, 3.75rem); }
  .site-footer { padding-bottom: 2rem; }
}
@media (min-width: 64rem) and (max-height: 46rem) {
  .sidebar { padding-top: 1.5rem; }
  .profile { gap: .65rem; padding-bottom: 1rem; }
  .profile__photo { width: 3.5rem; }
  .profile__name { font-size: 1.4rem; }
  .nav { padding-top: .65rem; }
  .nav__list a { min-height: 36px; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { scroll-behavior: auto !important; }
}
@media print {
  :root, :root[data-theme] { color-scheme: light; --bg: #fff; --surface: #fff; --text: #000; --text-muted: #222; --text-subtle: #444; --accent: #065f46; --accent-strong: #065f46; --border: #ccc; --border-strong: #aaa; --accent-soft: transparent; }
  body { font-size: 10pt; background: #fff; }
  .shell { display: block; padding: 0; }
  .sidebar { position: static; max-height: none; padding: 0; }
  .profile { display: flex; flex-direction: row; padding-bottom: 1rem; }
  .profile__photo { width: 4rem; }
  .nav, .utilbar, .socials, .profile__actions, .hero__actions, .to-top, .skip-link { display: none !important; }
  .section { padding-block: 1rem; }
  .hero h2 { font-size: 24pt; }
  .section__head { margin-bottom: 1rem; }
  .project, .timeline__item { break-inside: avoid; }
  .project-grid, .grid--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .contact-card { background: #fff; }
  details > * { display: block !important; }
  .site-footer { padding-bottom: 0; }
}
