@font-face { font-family: "IBM Plex Mono"; src: url("/fonts/ibm-plex-mono-latin-400-normal.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Inter"; src: url("/fonts/inter-latin-400-italic.woff2") format("woff2"); font-weight: 400; font-style: italic; font-display: swap; }
@font-face { font-family: "Inter"; src: url("/fonts/inter-latin-400-normal.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Inter"; src: url("/fonts/inter-latin-500-normal.woff2") format("woff2"); font-weight: 500; font-style: normal; font-display: swap; }
@font-face { font-family: "Inter"; src: url("/fonts/inter-latin-600-italic.woff2") format("woff2"); font-weight: 600; font-style: italic; font-display: swap; }
@font-face { font-family: "Inter"; src: url("/fonts/inter-latin-600-normal.woff2") format("woff2"); font-weight: 600; font-style: normal; font-display: swap; }
/* ---------------------------------------------------------------- tokens */
:root {
  --bg: #fbfaf8; --fg: #1b1c1e; --muted: #64676d; --rule: #e4e2de;
  --panel: #ffffff; --chip: #f1efeb; --shadow: 0 -12px 40px rgb(20 20 25 / .14);
  --accent: #36598f;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --ease: cubic-bezier(.22, .8, .24, 1);
  color-scheme: light;
}

/* dark: follow the device unless a theme was chosen with the toggle */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #141517; --fg: #e9e7e3; --muted: #9b9ea4; --rule: #2a2c30;
    --panel: #1b1d20; --chip: #24262a; --shadow: 0 -12px 40px rgb(0 0 0 / .5);
    --accent: #9bb8ea; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #141517; --fg: #e9e7e3; --muted: #9b9ea4; --rule: #2a2c30;
  --panel: #1b1d20; --chip: #24262a; --shadow: 0 -12px 40px rgb(0 0 0 / .5);
  --accent: #9bb8ea; color-scheme: dark;
}

/* ---------------------------------------------------------------- base */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100dvh; display: flex; flex-direction: column;
  background: var(--bg); color: var(--fg);
  font: 400 1rem/1.65 var(--sans); font-feature-settings: "ss01" 0;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
  transition: background-color .25s, color .25s;
}
a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: .18em; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }
svg { width: 1.25rem; height: 1.25rem; flex: none; }

/* ---------------------------------------------------------------- landing */
.home {
  flex: 1; width: 100%; max-width: 36rem; margin: 0 auto;
  padding: clamp(3.5rem, 9vh, 7rem) 1.5rem 1.5rem;
  display: flex; flex-direction: column; align-items: center; text-align: center;
}
.photo {
  width: 8.5rem; height: 8.5rem; border-radius: 50%; object-fit: cover;
  box-shadow: 0 0 0 1px var(--rule), 0 8px 24px rgb(0 0 0 / .08);
}
.intro { width: 100%; }
h1 { font-size: 1.85rem; font-weight: 600; letter-spacing: -.02em; line-height: 1.2; margin: 1.4rem 0 .45rem; }
.tagline { color: var(--muted); font-size: .95rem; line-height: 1.5; margin: 0 auto 1.6rem; max-width: 30rem; text-wrap: balance; }
.bio { text-align: left; font-size: 1.02rem; }
.bio p { margin: 0 0 1em; }

.links { display: flex; justify-content: center; gap: .35rem; margin: 1.6rem 0 0; }
.links a {
  display: grid; place-items: center; width: 2.6rem; height: 2.6rem; border-radius: 50%;
  color: var(--muted); transition: transform .18s var(--ease), color .18s, background-color .18s;
}
.links a:hover, .links a:focus-visible { color: var(--fg); background: var(--chip); transform: scale(1.12); }
.links svg { width: 1.3rem; height: 1.3rem; }

.cv-pill {
  display: inline-flex; align-items: center; gap: .5rem; margin-top: 1.6rem;
  padding: .55rem 1.15rem; border-radius: 999px; border: 1px solid var(--rule);
  color: var(--fg); background: var(--panel); font-size: .9rem; font-weight: 500; text-decoration: none;
  transition: transform .18s var(--ease), border-color .18s, box-shadow .18s;
}
.cv-pill:hover { transform: translateY(-2px); border-color: var(--accent); box-shadow: 0 6px 18px rgb(0 0 0 / .08); text-decoration: none; }


.foot { text-align: center; padding: 1.5rem 1rem calc(1.5rem + env(safe-area-inset-bottom)); }
.key { font: .68rem/1.4 var(--mono); color: var(--muted); text-decoration: none; letter-spacing: .02em; opacity: .75; }
.key:hover { opacity: 1; color: var(--fg); }

.theme-toggle {
  position: fixed; top: max(1rem, env(safe-area-inset-top)); right: 1rem; z-index: 5;
  width: 2.5rem; height: 2.5rem; display: grid; place-items: center; cursor: pointer;
  border: 1px solid transparent; border-radius: 50%; background: transparent; color: var(--muted);
  transition: transform .18s var(--ease), color .18s, background-color .18s;
}
.theme-toggle:hover { color: var(--fg); background: var(--chip); transform: rotate(-12deg) scale(1.08); }
.theme-toggle .icon-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-sun { display: block; }
:root[data-theme="dark"] .theme-toggle .icon-moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .icon-sun { display: block; }
  :root:not([data-theme="light"]) .theme-toggle .icon-moon { display: none; }
}
.theme-toggle span { display: contents; }

/* ---------------------------------------------------------------- CV panel */
/* without JavaScript the CV is an ordinary section below the landing page */
.sheet { background: var(--panel); border-top: 1px solid var(--rule); }
.backdrop { display: none; }
.js .sheet {
  position: fixed; inset: auto 0 0 0; z-index: 10; height: calc(100dvh - 2.5rem);
  display: flex; flex-direction: column; border: 1px solid var(--rule); border-bottom: 0;
  border-radius: 1.1rem 1.1rem 0 0; box-shadow: var(--shadow);
  max-width: 54rem; margin: 0 auto;
  transform: translateY(105%); visibility: hidden;
  transition: transform .5s var(--ease), visibility 0s linear .5s;
}
.js .backdrop {
  display: block; position: fixed; inset: 0; z-index: 9; background: rgb(10 10 12 / .38);
  opacity: 0; pointer-events: none; transition: opacity .4s;
  backdrop-filter: blur(2px); -webkit-backdrop-filter: blur(2px);
}
.cv-open .sheet { transform: none; visibility: visible; transition: transform .5s var(--ease); }
.cv-open .backdrop { opacity: 1; pointer-events: auto; }
.cv-open body { overflow: hidden; }
.no-anim .sheet, .no-anim .backdrop { transition: none !important; }
@media (max-width: 40rem) {
  .js .sheet { height: 100dvh; border-radius: 0; border: 0; }
}

.sheet-head {
  display: flex; align-items: center; gap: .5rem; padding: 1rem 1rem .9rem 1.6rem;
  border-bottom: 1px solid var(--rule); position: sticky; top: 0; background: var(--panel); border-radius: inherit;
}
.js .sheet-head { touch-action: none; cursor: grab; user-select: none; -webkit-user-select: none; }
.js .sheet-head.dragging { cursor: grabbing; }
.sheet-head a { cursor: pointer; }
.js .sheet-head::before {
  content: ""; position: absolute; top: .45rem; left: 50%; width: 2.4rem; height: .25rem;
  margin-left: -1.2rem; border-radius: 1rem; background: var(--rule);
}
.sheet-title { flex: 1; min-width: 0; }
.sheet-title h2 { font-size: 1.05rem; font-weight: 600; margin: 0; letter-spacing: -.01em; }
.sheet-title p { margin: 0; font-size: .78rem; color: var(--muted); }
.btn {
  display: inline-flex; align-items: center; gap: .4rem; height: 2.3rem; padding: 0 .85rem;
  border: 1px solid var(--rule); border-radius: 999px; color: var(--fg); text-decoration: none;
  font-size: .85rem; font-weight: 500; transition: border-color .18s, background-color .18s, transform .18s var(--ease);
}
.btn:hover { border-color: var(--accent); background: var(--chip); text-decoration: none; }
.btn svg { width: 1rem; height: 1rem; }
.btn.close { width: 2.3rem; padding: 0; justify-content: center; }
.no-js .btn.close { display: none; }

.sheet-body { overflow-y: auto; overscroll-behavior: contain; padding: .5rem 1.6rem 4rem; font-size: .92rem; line-height: 1.55; }
.sheet-body > section { max-width: 46rem; margin: 0 auto; }
.sheet-body h3 {
  font-size: .72rem; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--accent);
  margin: 2.2rem 0 .9rem; padding-bottom: .45rem; border-bottom: 1px solid var(--rule);
}
.sheet-body h4.sub { font-size: .8rem; font-weight: 600; color: var(--muted); margin: 1.4rem 0 .6rem; }
.sheet-body p { margin: 0 0 .6rem; }
.expertise { list-style: none; padding: 0; margin: .9rem 0 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(13rem, 1fr)); gap: .35rem 1rem; font-size: .82rem; }
.expertise li::before { content: "▪"; color: var(--accent); margin-right: .45rem; }

.row-head { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; }
.when, .where, .when-inline { color: var(--muted); font-size: .8rem; white-space: nowrap; font-variant-numeric: tabular-nums; }
.matter { padding: .2rem 0 1.1rem; }
.matter + .matter { border-top: 1px dashed var(--rule); padding-top: 1rem; }
.matter h4 { margin: 0; font-size: .95rem; font-weight: 600; font-style: italic; }
.matter.confidential h4 { font-weight: 400; color: var(--muted); }
.subtitle { font-style: italic; margin: .1rem 0 0 !important; }
.matter dl { display: grid; grid-template-columns: 8rem 1fr; gap: .3rem .9rem; margin: .55rem 0 0; }
.matter dt { color: var(--muted); font-size: .75rem; padding-top: .12rem; }
.matter dd { margin: 0; }

.entries { list-style: none; padding: 0; margin: 0; }
.entries > li { display: grid; grid-template-columns: 6.2rem 1fr; gap: .9rem; padding: .4rem 0; }
.entries .when { padding-top: .12rem; }
.entries em { display: block; }
.detail { color: var(--muted); font-size: .85rem; margin: .1rem 0 0 !important; }
.pub-title { font-weight: 500; }
.award { color: var(--accent); font-size: .8rem; font-weight: 600; margin: .15rem 0 0 !important; }
.reviewing { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: .35rem .5rem; }
.reviewing li { background: var(--chip); border-radius: 999px; padding: .15rem .65rem; font-size: .82rem; }

@media (max-width: 40rem) {
  .sheet-body { padding: .25rem 1.1rem 4rem; }
  .sheet-head { padding-left: 1.1rem; }
  .matter dl { grid-template-columns: 1fr; gap: 0; }
  .matter dd { margin-bottom: .35rem; }
  .entries > li { grid-template-columns: 1fr; gap: 0; }
  .row-head { flex-wrap: wrap; gap: 0 1rem; }
}

/* ---------------------------------------------------------------- 404 */
.not-found h1 { margin-top: 0; }

/* ---------------------------------------------------------------- motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .01ms !important; }
  .links a:hover, .cv-pill:hover, .theme-toggle:hover { transform: none; }
}

