:root {
  --bg: #ffffff;
  --mono4: #e8e8e8;
  --mono5: #e2e2e2;
  --mono8: #c7c7c7;
  --mono9: #8f8f8f;
  --mono11: #6f6f6f;
  --mono12: #171717;
  --transparent: rgba(255, 255, 255, 0);

  --font-sans: "Inter", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  --font-serif: "Newsreader", "Times", serif;
  --content-width: 640px;
  --page-top: 128px;
  --gutter: max(24px, env(safe-area-inset-left));
  --footer-height: 48px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #1a1a1a;
    --mono4: #282828;
    --mono5: #2e2e2e;
    --mono8: #505050;
    --mono9: #707070;
    --mono11: #a0a0a0;
    --mono12: #ededed;
    --transparent: rgba(26, 26, 26, 0);
  }
}
:root[data-theme="dark"] {
  --bg: #1a1a1a;
  --mono4: #282828;
  --mono5: #2e2e2e;
  --mono8: #505050;
  --mono9: #707070;
  --mono11: #a0a0a0;
  --mono12: #ededed;
  --transparent: rgba(26, 26, 26, 0);
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  background: var(--bg);
  color: var(--mono12);
  font: 400 15px/1.7 var(--font-sans);
  font-feature-settings: "cv11", "ss01";
  -webkit-font-smoothing: antialiased;
  padding: 0 var(--gutter);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

::selection { background: var(--mono5); }

/* Soft blur under the top edge while scrolling */
.blur {
  position: sticky;
  top: 0;
  height: min(96px, var(--page-top));
  margin: 0 calc(-1 * var(--gutter)) calc(-1 * min(96px, var(--page-top)));
  z-index: 1;
  pointer-events: none;
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  mask-image: linear-gradient(to bottom, #000 25%, transparent);
  -webkit-mask-image: linear-gradient(to bottom, #000 25%, transparent);
}
.blur::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, var(--bg), var(--transparent));
}

main {
  flex: 1;
  min-width: 0;
  width: 100%;
  max-width: var(--content-width);
  margin: 0 auto;
  padding: var(--page-top) 0;
}

article > * + * { margin-top: 48px; }

h1, h2 {
  font-size: 15px;
  font-weight: 500;
  line-height: 1.7;
}

.prose > * + * { margin-top: 16px; }
.prose h1 + p, .prose h2 + p { margin-top: 12px; }

em {
  font: italic 400 calc(1em + 1px) / 1 var(--font-serif);
}

a {
  color: inherit;
  text-decoration: underline;
  text-decoration-color: var(--mono8);
  text-decoration-thickness: 1px;
  text-underline-offset: 2.5px;
  transition: text-decoration-color 0.15s ease;
}
a:hover { text-decoration-color: var(--mono12); }
a:focus-visible { outline: 2px solid var(--mono9); outline-offset: 2px; border-radius: 2px; }

.handle { font-feature-settings: "tnum"; }

/* Project columns */
.stack { display: flex; gap: 32px; }
.column { width: 192px; }
.label { color: var(--mono11); font-size: 13px; font-weight: 400; }
.list { margin-top: 12px; }
.list > * + * { margin-top: 24px; }
.item { min-height: 84px; }

.title {
  display: flex;
  align-items: center;
  gap: 4px;
}
.title a { color: var(--mono12); }

.arrow {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: var(--mono9);
  stroke-width: 1.25;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform 0.15s ease, stroke 0.15s ease;
}
.title:hover .arrow { transform: translate(1px, -1px); stroke: var(--mono12); }

.badge {
  margin-left: 4px;
  padding: 0 6px;
  border: 1px solid var(--mono5);
  border-radius: 999px;
  font-size: 11px;
  line-height: 18px;
  color: var(--mono11);
}

.dim { color: var(--mono11); }
.meta { color: var(--mono9); font-size: 13px; margin-top: 2px; }

/* Footer */
footer {
  height: var(--footer-height);
  border-top: 1px solid var(--mono5);
  margin: 0 calc(-1 * var(--gutter));
  padding: 0 var(--gutter);
  background: var(--bg);
}
footer > div {
  max-width: var(--content-width);
  height: 100%;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 16px;
  white-space: nowrap;
}
footer > div > :first-child { margin-right: auto; }
.small { font-size: 13px; }
.low { color: var(--mono9); }
.tnum { font-variant-numeric: tabular-nums; }

.clock {
  --seconds-deg: calc(var(--now-s, 0) / 60 * 360);
  --minutes-deg: calc(var(--now-m, 0) / 60 * 360 + var(--now-s, 0) / 60 * 6);
  --hours-deg: calc(var(--now-h, 0) / 12 * 360 + var(--now-m, 0) / 60 * 30);
  --color: var(--mono9);
  position: relative;
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  border: 1px solid var(--mono8);
  border-radius: 50%;
  transform: rotate(180deg);
}
.clock > * {
  --width: 1px;
  position: absolute;
  top: 50%;
  left: calc(50% - var(--width) / 2);
  width: var(--width);
  height: var(--height);
  background: var(--color);
  border-radius: 1px;
  transform-origin: 50% 0;
}
.clock .hour { --height: 5px; transform: rotate(calc(var(--hours-deg) * 1deg)); }
.clock .minute { --height: 7px; transform: rotate(calc(var(--minutes-deg) * 1deg)); }
.clock .second { --height: 8px; --width: 0.5px; transform: rotate(calc(var(--seconds-deg) * 1deg)); }

/* Staggered entrance */
[data-animate] {
  --stagger: 0;
  animation: enter 0.6s both;
  animation-delay: calc(var(--stagger) * 0.12s);
}
@keyframes enter {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  [data-animate] { animation: none; }
}

@media (max-width: 768px) {
  :root { --page-top: 64px; }
}
@media (max-width: 560px) {
  .stack { flex-direction: column; gap: 40px; }
  .column { width: auto; }
}
