:root {
  --bg: #f4f1ea;
  --fg: #1c1a16;
  --muted: #5e584e;
  --faint: #8a8376;
  --border: #ddd6c8;
  --accent: #e9e4d9;
  --primary: #1c1a16;
  --primary-fg: #f4f1ea;
  --logo-bg: #efece4;
  --highlight: #a8761f;
  --dock-shadow: 0 0 0 1px rgba(28,26,22,.03), 0 2px 4px rgba(28,26,22,.05), 0 12px 24px rgba(28,26,22,.06);
}

html.dark {
  --bg: #121110;
  --fg: #ece7dc;
  --muted: #b3ab9e;
  --faint: #8a8174;
  --border: #2e2a25;
  --accent: #24211d;
  --primary: #ece7dc;
  --primary-fg: #121110;
  --logo-bg: #ece7dc;
  --highlight: #e8b64c;
  --dock-shadow: 0 -20px 80px -20px rgba(236,231,220,.10) inset;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; color-scheme: light; }
html.dark { color-scheme: dark; }

body {
  min-height: 100vh;
  max-width: 672px;
  margin: 0 auto;
  padding: 96px 24px 128px;
  background: var(--bg);
  color: var(--fg);
  font-family: 'Newsreader', 'Iowan Old Style', Palatino, 'Palatino Linotype', serif;
  font-optical-sizing: auto;
  -webkit-font-smoothing: antialiased;
  transition: background-color .2s ease, color .2s ease;
}

a { color: inherit; }

main { display: flex; flex-direction: column; gap: 40px; }

section { display: flex; flex-direction: column; gap: 12px; scroll-margin-top: 48px; }

h2 { font-size: 22px; font-weight: 600; line-height: 1.4; letter-spacing: -0.01em; }

.muted { color: var(--muted); font-size: 16px; }
.tabular { font-variant-numeric: tabular-nums; }

/* Blur-fade reveal */
.js .fade {
  opacity: 0;
  filter: blur(6px);
  transform: translateY(6px);
  transition: opacity .4s ease-out, filter .4s ease-out, transform .4s ease-out;
  transition-delay: var(--d, 0s);
}
.js .fade.in { opacity: 1; filter: blur(0); transform: translateY(-6px); }

/* Hero */
.hero { display: flex; justify-content: space-between; gap: 8px; }
.hero-text { display: flex; flex-direction: column; gap: 6px; flex: 1; }
.hero h1 { font-size: 50px; font-weight: 500; letter-spacing: -0.025em; line-height: 1; }
.hero p { font-size: 16px; }
.hero p a { text-decoration: underline; text-underline-offset: 3px; font-weight: 500; }
.avatar {
  display: flex; width: 112px; height: 112px; flex-shrink: 0;
  border-radius: 50%; overflow: hidden; border: 1px solid var(--border);
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }

/* Prose */
.prose { display: flex; flex-direction: column; gap: 14px; font-size: 17px; line-height: 1.7; color: var(--muted); text-wrap: pretty; }
.prose a { color: var(--fg); font-weight: 500; text-decoration: underline; text-underline-offset: 3px; }

/* Work / education list */
.list { display: flex; flex-direction: column; gap: 12px; }
.item { display: flex; text-decoration: none; border-radius: 8px; }
.logo {
  flex: none; display: flex; align-items: center; justify-content: center;
  width: 48px; height: 48px; border-radius: 50%; overflow: hidden;
  border: 1px solid var(--border); background: var(--logo-bg);
  color: #1c1a16; font-size: 13px; font-weight: 700;
}
.logo img { width: 100%; height: 100%; object-fit: contain; padding: 6px; }
.logo img.cover { object-fit: cover; padding: 0; }
.item-body { flex: 1; margin-left: 16px; display: flex; flex-direction: column; min-width: 0; }
.item-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.item h3, .project h3 {
  display: inline-flex; align-items: center; font-size: 16px; font-weight: 600; line-height: 1;
}
.date { font-size: 15px; color: var(--faint); text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.sub { font-size: 14px; margin-top: 6px; color: var(--muted); }
.chev {
  width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2;
  stroke-linecap: round; stroke-linejoin: round;
  opacity: 0; transform: translateX(0); transition: all .3s ease-out;
}
.item:hover .chev, .item:focus-visible .chev { opacity: 1; transform: translateX(4px); }
.desc {
  font-size: 16px; line-height: 1.6; color: var(--muted);
  max-height: 0; opacity: 0; overflow: hidden;
  transition: max-height .3s ease, opacity .3s ease, margin .3s ease;
}
.item:hover .desc, .item:focus-visible .desc { max-height: 160px; opacity: 1; margin-top: 8px; }

.note { font-size: 15px; color: var(--faint); }
.note a { color: var(--fg); text-decoration: underline; text-underline-offset: 3px; }

/* Projects */
.project {
  display: flex; flex-direction: column; gap: 8px;
  padding: 14px 16px; border: 1px solid var(--border); border-radius: 10px;
  transition: border-color .2s ease;
}
.project:hover { border-color: var(--muted); }
.project h3 a { text-decoration: none; }
.project h3 a:hover { text-decoration: underline; text-underline-offset: 3px; }
.project p { font-size: 16px; line-height: 1.6; color: var(--muted); }
.links { display: flex; flex-wrap: wrap; gap: 6px; }
.links a {
  font-size: 14px; font-weight: 500; text-decoration: none;
  padding: 2px 9px; border-radius: 6px; background: var(--primary); color: var(--primary-fg);
  transition: opacity .15s ease;
}
.links a:hover { opacity: .8; }

/* Writing */
.posts { display: flex; flex-direction: column; }
.post {
  display: flex; justify-content: space-between; align-items: baseline; gap: 16px;
  padding: 10px 0; font-size: 16px; text-decoration: none; border-bottom: 1px dashed var(--border);
}
.post span:first-child { font-weight: 500; }
.post:hover span:first-child { text-decoration: underline; text-underline-offset: 3px; }

/* Newsletter */
.subscribe { display: flex; gap: 8px; margin: 8px 0; max-width: 448px; }
.subscribe input {
  flex: 1; height: 38px; padding: 4px 12px; font: inherit; font-size: 16px;
  color: var(--fg); background: transparent; border: 1px solid var(--border); border-radius: 6px;
  outline: none;
}
.subscribe input::placeholder { color: var(--faint); }
.subscribe input:focus-visible { box-shadow: 0 0 0 1px var(--muted); }
.subscribe button {
  height: 38px; padding: 4px 16px; font: inherit; font-size: 16px; font-weight: 500; cursor: pointer;
  background: var(--primary); color: var(--primary-fg); border: 1px solid var(--primary); border-radius: 6px;
  transition: opacity .15s ease;
}
.subscribe button:hover { opacity: .88; }

/* Books */
.books { list-style: none; display: flex; flex-direction: column; gap: 8px; font-size: 16px; }
.books li { display: flex; justify-content: space-between; gap: 16px; }
.books li span:first-child { font-weight: 500; }

/* Skills */
.badges { display: flex; flex-wrap: wrap; gap: 4px; }
.badge {
  display: inline-flex; align-items: center; padding: 2px 10px; border-radius: 6px;
  font-size: 14px; font-weight: 500; background: var(--primary); color: var(--primary-fg);
  box-shadow: none;
}
.badge.outline { background: transparent; color: var(--muted); border: 1px solid var(--border); box-shadow: none; font-weight: 500; white-space: nowrap; }

/* Contact */
#contact { align-items: center; text-align: center; padding: 48px 0; }
#contact p { font-size: 22px; line-height: 1.6; color: var(--muted); }
.blue { color: var(--highlight); text-decoration: none; }
.blue:hover { text-decoration: underline; }

/* Dock */
.dock-wrap {
  pointer-events: none; position: fixed; inset: auto 0 0 0; z-index: 30;
  display: flex; justify-content: center; height: 56px; margin-bottom: 16px;
}
.dock-fade {
  position: fixed; inset: auto 0 0 0; height: 64px; background: var(--bg);
  backdrop-filter: blur(16px);
  -webkit-mask-image: linear-gradient(to top, black, transparent);
          mask-image: linear-gradient(to top, black, transparent);
}
.dock {
  pointer-events: auto; position: relative; display: flex; align-items: flex-end;
  height: 100%; padding: 8px 4px; border-radius: 999px; background: var(--bg);
  border: 1px solid var(--border); box-shadow: var(--dock-shadow);
}

.dock-item {
  position: relative; display: flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; border-radius: 50%; color: var(--fg);
  background: none; border: none; cursor: pointer; text-decoration: none;
  transition: background .15s ease;
}
.dock-item:hover { background: var(--accent); }
.dock-item svg { width: 16px; height: 16px; }
.dock-item svg.stroke { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.dock-item svg.fill { fill: currentColor; }
.dock-item::after {
  content: attr(data-tip); position: absolute; bottom: calc(100% + 10px); left: 50%;
  transform: translate(-50%, 4px); padding: 4px 10px; border-radius: 6px; white-space: nowrap;
  font-size: 13px; font-weight: 500; background: var(--primary); color: var(--primary-fg);
  opacity: 0; pointer-events: none; transition: opacity .15s ease, transform .15s ease;
}
.dock-item:hover::after, .dock-item:focus-visible::after { opacity: 1; transform: translate(-50%, 0); }
.dock-sep { width: 1px; align-self: stretch; background: var(--border); margin: 0 2px; }

.icon-sun { display: none; }
html.dark .icon-moon { display: none; }
html.dark .icon-sun { display: block; }

/* Mobile */
@media (max-width: 640px) {
  body { padding-top: 48px; }
  .hero h1 { font-size: 34px; letter-spacing: -0.02em; }
  .avatar { width: 88px; height: 88px; }
  .item h3, .project h3, .date { font-size: 14px; }
  .sub, .desc { font-size: 13px; }
  .prose { font-size: 16px; }
  .center-sm { text-align: center; }
  .subscribe { flex-direction: column; margin: 8px auto; width: 100%; }
  .post { flex-direction: column; gap: 2px; }
  .post .date { text-align: left; font-size: 13px; }
  .project .item-row { flex-wrap: wrap; }
  .dock-item { width: 34px; height: 34px; }
}

@media (prefers-reduced-motion: reduce) {
  .js .fade { opacity: 1; filter: none; transform: none; transition: none; }
  html { scroll-behavior: auto; }
}

/* Logo with no image (e.g. stealth startup) */
.logo-dark { display: flex; align-items: center; justify-content: center; width: 100%; height: 100%; background: #1c1a16; color: #b3ab9e; }

.loc { display: inline-flex; align-items: center; gap: 5px; margin-top: 4px; color: var(--muted); }
.age { white-space: nowrap; }
@media (max-width: 380px) { .age { font-size: 14px; } }
