:root {
  --paper: #edf0e6;
  --surface: #ffffff;
  --ink: #18221a;
  --muted: #4f5b4b;
  --rule: #c8d0bf;
  --accent: #3f5b36;
  --on-accent: #ffffff;
  --band: #5d7650;
  --band-ink: #ffffff;
  --band-muted: #eaf0e4;
  --band-tint: rgb(255 255 255 / 12%);
  --band-line: rgb(255 255 255 / 35%);
  --band-dot: rgb(255 255 255 / 7%);
  --radius: 3px;
  --serif: "Newsreader", Georgia, "Times New Roman", serif;
  --sans: "Hanken Grotesk", system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --paper: #121611;
  --surface: #1a2018;
  --ink: #e7ebe2;
  --muted: #9aa691;
  --rule: #2a3226;
  --accent: #a9c08f;
  --on-accent: #141a10;
  --band: #3a4a33;
  --band-ink: #eef2e8;
  --band-muted: #b9c6ac;
  --band-tint: rgb(255 255 255 / 10%);
  --band-line: rgb(238 242 232 / 28%);
  --band-dot: rgb(255 255 255 / 7%);
  color-scheme: dark;
}
*, *::before, *::after { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--paper);
  color: var(--ink);
  font: 400 1.0625rem/1.65 var(--sans);
}
a { color: var(--accent); text-underline-offset: 0.18em; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 2px; }
.wrap { width: 100%; max-width: 62rem; margin: 0 auto; padding: 0 max(1.5rem, env(safe-area-inset-right)) 0 max(1.5rem, env(safe-area-inset-left)); }
.section { padding-top: 3.5rem; padding-bottom: 5rem; }

/* header: a dark band that carries into the About hero */
.site-header { background: var(--band); color: var(--band-ink); }
@media (min-width: 641px) { .site-header { position: sticky; top: 0; z-index: 10; } }
.bar { display: flex; align-items: center; gap: 1rem; min-height: 4.5rem; }
.brand { margin-right: auto; font: 500 1.35rem/1 var(--serif); white-space: nowrap; }
.tabs { display: flex; gap: 0.3rem; }
.tab {
  padding: 0.5rem 1rem;
  border: 0;
  border-radius: var(--radius);
  background: none;
  color: var(--band-muted);
  font: 500 0.95rem/1 var(--sans);
  cursor: pointer;
  transition: background-color 0.15s, color 0.15s;
}
.tab:hover { color: var(--band-ink); background: var(--band-tint); }
.tab[aria-selected="true"] { background: var(--band-ink); color: var(--band); }
.site-header :focus-visible { outline-color: var(--band-ink); }
.theme-toggle {
  display: grid;
  place-items: center;
  width: 2.5rem;
  height: 2.5rem;
  padding: 0;
  border: 1px solid var(--band-line);
  border-radius: var(--radius);
  background: none;
  color: var(--band-ink);
  cursor: pointer;
  touch-action: manipulation;
  transition: background-color 0.15s;
}
.theme-toggle:hover { background: var(--band-tint); }
.theme-toggle svg { width: 1.15rem; height: 1.15rem; }
.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; }

/* panels */
main { flex: 1; }
.panel:not([hidden]) { animation: panel-in 0.18s ease-out; }
@keyframes panel-in { from { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .panel:not([hidden]) { animation: none; } }
.panel-title { margin: 0 0 0.5rem; font: 400 2.5rem/1.15 var(--serif); letter-spacing: -0.01em; }
.panel-lede { margin: 0 0 2.5rem; max-width: 36rem; color: var(--muted); }

/* about */
.hero {
  background: var(--band) radial-gradient(var(--band-dot) 1px, transparent 1.5px) 0 0 / 22px 22px;
  color: var(--band-ink);
  padding: 3rem 0 4.5rem;
}
.hero h1 { margin: 0; font: 500 clamp(3rem, 9vw, 5.75rem)/1 var(--serif); letter-spacing: -0.03em; }
.hero p { margin: 1.4rem 0 0; max-width: 32rem; font-size: 1.25rem; line-height: 1.5; color: var(--band-muted); }
.facts { display: grid; grid-template-columns: repeat(3, auto); justify-content: start; margin: 3.25rem 0 0; border-top: 1px solid var(--band-line); }
.fact { padding: 1rem 2.5rem 0 0; margin-right: 2.5rem; border-right: 1px solid var(--band-line); }
.fact:last-child { margin-right: 0; padding-right: 0; border-right: 0; }
.fact dt { font-size: 0.85rem; color: var(--band-muted); }
.fact dd { margin: 0.2rem 0 0; font-size: 1.05rem; font-weight: 500; }
.fact-links { display: flex; gap: 0.9rem; min-height: 1.6rem; }
.fact-links a { display: grid; place-items: center; width: 1.6rem; height: 1.6rem; }
.fact-links img { width: 1.35rem; height: 1.35rem; object-fit: contain; }
.actions { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-top: 2.25rem; }
.btn {
  min-height: 2.75rem;
  touch-action: manipulation;
  padding: 0.75rem 1.4rem;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: transparent;
  color: var(--ink);
  font: 500 0.98rem/1.2 var(--sans);
  cursor: pointer;
}
.btn:hover { border-color: var(--ink); }
.hero .btn { border-color: var(--band-muted); color: var(--band-ink); }
.hero .btn:hover { border-color: var(--band-ink); }
.hero .btn.primary { background: var(--band-ink); border-color: var(--band-ink); color: var(--band); }
.hero .btn.primary:hover { filter: brightness(0.93); }
.hero :focus-visible { outline-color: var(--band-ink); }

.prose { max-width: 38rem; font: 400 1.18rem/1.72 var(--serif); }
.prose h3, .prose h4, .prose h5, .prose h6 { margin: 2.2rem 0 0.5rem; font: 500 1.4rem/1.3 var(--serif); }
.prose h3:first-child { margin-top: 0; }
.prose p, .prose ul, .prose ol, .prose pre, .prose blockquote { margin: 0 0 1.15rem; }
.prose ul, .prose ol { padding-left: 1.3rem; }
.prose li { margin-bottom: 0.3rem; }
.prose blockquote { padding-left: 1rem; border-left: 3px solid var(--accent); color: var(--muted); }
.prose hr { border: 0; border-top: 1px solid var(--rule); margin: 2rem 0; }
.prose code { font: 0.88em ui-monospace, Menlo, Consolas, monospace; }
.prose pre { overflow-x: auto; padding: 0.9rem 1rem; background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); }

/* projects */
.project-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 17rem), 1fr)); gap: 1.25rem; list-style: none; margin: 0; padding: 0; }
.project {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  text-decoration: none;
  transition: border-color 0.15s;
}
.project:hover { border-color: var(--accent); }
.project-img { display: grid; place-items: center; aspect-ratio: 16 / 9; background: var(--paper); border-bottom: 1px solid var(--rule); }
.project-img img { width: 100%; height: 100%; object-fit: cover; }
.project-img.logo img { width: 4rem; height: 4rem; object-fit: contain; }
.project-body { padding: 1.1rem 1.25rem 1.3rem; }
.project h3 { margin: 0 0 0.3rem; font: 500 1.3rem/1.25 var(--serif); }
.project:hover h3 { color: var(--accent); }
.project p { margin: 0; color: var(--muted); font-size: 0.98rem; line-height: 1.55; }

/* posts: LinkedIn only loads after a click */
.posts-tools { margin-bottom: 1.5rem; }
.posts { display: grid; gap: 1.5rem; max-width: 504px; }
.post-note { margin: 0 0 0.4rem; color: var(--muted); font-size: 0.9rem; }
.post-gate { padding: 1.4rem; border: 1px solid var(--rule); border-radius: var(--radius); background: var(--surface); }
.post-gate p { margin: 0 0 1rem; color: var(--muted); font-size: 0.95rem; }
.post-gate .row { display: flex; flex-wrap: wrap; align-items: center; gap: 1rem; }
.post-gate .btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.post iframe { display: block; width: 100%; border: 1px solid var(--rule); border-radius: var(--radius); background: #fff; }

/* contact */
.contacts { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 15rem), 1fr)); gap: 1rem; max-width: 46rem; list-style: none; margin: 0; padding: 0; }
.contacts a {
  display: flex;
  align-items: center;
  gap: 1rem;
  height: 100%;
  padding: 1.1rem 1.25rem;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  font-weight: 500;
  text-decoration: none;
  transition: border-color 0.15s;
}
.contacts a:hover { border-color: var(--accent); }
.contacts a:hover span { color: var(--accent); }
.contacts img { width: 1.75rem; height: 1.75rem; object-fit: contain; flex: none; }
.logo-dark { display: none; }
:root[data-theme="dark"] .logo-light { display: none; }
:root[data-theme="dark"] .logo-dark { display: block; }

.status { margin: 0; color: var(--muted); }
.site-footer { border-top: 1px solid var(--rule); color: var(--muted); font-size: 0.92rem; }
.site-footer .wrap { padding-top: 1.25rem; padding-bottom: 1.25rem; }

@media (max-width: 640px) {
  .wrap { padding: 0 max(1.1rem, env(safe-area-inset-right)) 0 max(1.1rem, env(safe-area-inset-left)); }
  .bar { flex-wrap: wrap; gap: 0.6rem 1rem; min-height: 0; padding-top: 0.9rem; padding-bottom: 0.9rem; }
  .theme-toggle { order: 2; }
  .tabs { order: 3; width: 100%; gap: 0.2rem; padding: 0.2rem; border-radius: var(--radius); background: var(--band-tint); }
  .tab { flex: 1; min-height: 2.6rem; padding: 0.5rem 0.25rem; font-size: 0.92rem; }
  .hero { padding: 1.75rem 0 3rem; }
  .hero p { font-size: 1.12rem; }
  .facts { grid-template-columns: 1fr; margin-top: 2.25rem; }
  .fact { margin: 0; padding: 0.85rem 0; border-right: 0; border-bottom: 1px solid var(--band-line); }
  .fact:last-child { border-bottom: 0; padding-bottom: 0; }
  .actions .btn { flex: 1 1 100%; }
  .section { padding-top: 2.25rem; padding-bottom: 3.5rem; }
  .panel-title { font-size: 2.1rem; }
  .prose { font-size: 1.1rem; line-height: 1.7; }
  .posts-tools .btn, .post-gate .btn { width: 100%; }
  .post-gate .row { flex-direction: column; align-items: stretch; gap: 0.5rem; }
  .post-gate .row a { padding: 0.6rem; text-align: center; }
}