:root {
  --grey: #f5f5f7;
  --card: #fff;
  --field: #f5f5f7;
  --ink: #1d1d1f;
  --ink-2: #6e6e73;
  --line: #e8e8ed;
  --blue: #0000ff;
  --on-blue: #fff;
  --radius: 18px;
  --radius-sm: 10px;
  --display: 34px;
  --title: 28px;
  --lead: 20px;
  --body: 17px;
  --meta: 15px;
  --small: 13px;
  --pad: 32px;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --grey: #000;
    --card: #1c1c1e;
    --field: #000;
    --ink: #f5f5f7;
    --ink-2: #a1a1a6;
    --line: #2c2c2e;
    --blue: #7b95ff;
    --on-blue: #0b0b0b;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--grey);
  color: var(--ink);
  font: var(--body)/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 0.2em; }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; border-radius: 6px; }
[hidden] { display: none !important; }

.wrap {
  max-width: 1080px;
  margin: 0 auto;
  padding-left: max(16px, env(safe-area-inset-left));
  padding-right: max(16px, env(safe-area-inset-right));
}

/* Header and footer */

.site-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  padding: 28px 4px;
}
.name { color: var(--ink); font-weight: 600; }
.name:hover { text-decoration: none; }
nav { display: flex; gap: 22px; font-size: var(--meta); }
nav a { color: var(--ink-2); }
nav a:hover, nav a[aria-current] { color: var(--ink); text-decoration: none; }

.site-foot { padding: 40px 0 32px; font-size: var(--small); color: var(--ink-2); }
.foot-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px;
  border-top: 1px solid var(--line);
  padding-top: 16px;
}

/* Cards */

.grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.card { background: var(--card); border-radius: var(--radius); padding: var(--pad); min-width: 0; }
.span-3 { grid-column: span 3; }
.span-2 { grid-column: span 2; }
.label { font-size: var(--meta); font-weight: 400; color: var(--ink-2); margin: 0 0 14px; }
.fine { font-size: var(--small); color: var(--ink-2); margin: 12px 0 0; }

.intro h1 { font-size: var(--display); line-height: 1.1; font-weight: 600; letter-spacing: -0.02em; margin: 0 0 12px; }
.intro p { margin: 0; max-width: 36em; font-size: var(--lead); line-height: 1.4; text-wrap: pretty; }

.projects ul { list-style: none; margin: 0; padding: 0; }
.projects li {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  padding: 13px 0;
  border-top: 1px solid var(--line);
}
.projects li:last-child { border-bottom: 1px solid var(--line); }
.what { min-width: 0; }
.what span { display: block; font-size: var(--meta); color: var(--ink-2); }
.projects a { font-size: var(--meta); white-space: nowrap; }

/* Poll */

.poll { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; }
.poll-q { color: var(--ink); }
.opts { display: flex; gap: 6px; }
.opt {
  background: var(--field);
  color: var(--ink);
  border: 0;
  border-radius: var(--radius-sm);
  padding: 4px 14px;
  font: inherit;
  font-size: var(--meta);
  cursor: pointer;
}
.opt:hover { box-shadow: inset 0 0 0 1px var(--line); }
.opt:disabled { cursor: default; opacity: 0.6; }
.poll-status strong { color: var(--ink); font-weight: 600; }
.poll.done .poll-q { display: none; }
.poll.done .poll-status { font-size: var(--body); }

/* Contact */

.contact { display: flex; flex-direction: column; grid-row: span 2; }
.contact form { flex: 1; grid-template-rows: auto 1fr auto; }

form { display: grid; gap: 10px; }
input, select, textarea {
  width: 100%;
  background: var(--field);
  color: var(--ink);
  border: 0;
  border-radius: var(--radius-sm);
  padding: 13px 14px;
  font: inherit;
}
textarea { resize: vertical; min-height: 120px; }
::placeholder { color: var(--ink-2); }
.trap { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 20px; margin-top: 4px; font-size: var(--meta); }
.send {
  justify-self: start;
  background: var(--blue);
  color: var(--on-blue);
  border: 0;
  border-radius: 980px;
  padding: 11px 24px;
  font: inherit;
  font-size: var(--meta);
  font-weight: 600;
  cursor: pointer;
}
.send:disabled { opacity: 0.6; cursor: default; }
.status { font-size: var(--meta); color: var(--ink-2); margin: 0; }
.sent { outline: none; }
.sent-title { font-size: var(--lead); font-weight: 600; margin: 0 0 4px; }
.sent-note { margin: 0; color: var(--ink-2); }
.receipt {
  width: fit-content;
  margin: 14px 0 0;
  padding-top: 10px;
  border-top: 1px dashed var(--line);
  font: var(--small)/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color: var(--ink-2);
}
.busy::after {
  content: "...";
  display: inline-block;
  width: 0;
  overflow: hidden;
  vertical-align: bottom;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  animation: dots 1.2s steps(4) infinite;
}
@keyframes dots { to { width: 4ch; } }

/* Text pages and résumé */

.prose { max-width: 760px; margin: 0 auto; padding: var(--pad); }
.prose h1 { font-size: var(--display); font-weight: 600; letter-spacing: -0.02em; line-height: 1.1; margin: 0 0 16px; }
.prose h2 { font-size: var(--lead); font-weight: 600; margin: 32px 0 8px; }
.prose h3 { font-size: var(--body); font-weight: 600; margin: 24px 0 4px; }
.prose p, .prose ul { margin: 0 0 12px; }
.prose ul { padding-left: 20px; }
.prose li { margin-bottom: 4px; }
.unlock { max-width: 360px; margin-top: 20px; }

@media (max-width: 760px) {
  .grid { grid-template-columns: minmax(0, 1fr); }
  .span-3, .span-2 { grid-column: auto; }
  .contact { grid-row: auto; }
  :root { --pad: 24px; }
  .br { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .busy::after { animation: none; width: auto; }
}

@media print {
  body { background: #fff; }
  .site-head nav, .site-foot, .locked { display: none; }
  .card { padding: 0; }
}
