/* ---------- tokens ---------- */
:root {
  --orange: #f4900c;          /* the favicon */
  --orange-ink: #a85600;      /* readable orange for text on light bg */
  --orange-soft: #fde9cf;
  --bg: #fbf8f3;
  --surface: #ffffff;
  --ink: #1f1b16;
  --muted: #6b645b;
  --line: #e7e0d5;

  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --max: 46rem;
}

@media (prefers-color-scheme: dark) {
  :root {
    --orange-ink: #f4a23a;
    --orange-soft: #3a2a14;
    --bg: #17140f;
    --surface: #201c16;
    --ink: #f1ebe2;
    --muted: #a59d91;
    --line: #342e25;
  }
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; scroll-padding-top: 5rem; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 1.0625rem/1.65 var(--sans);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--orange-ink); text-underline-offset: 0.2em; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--orange); outline-offset: 3px; border-radius: 4px; }

.mono { font-family: var(--mono); }

.skip {
  position: absolute; left: -999px; top: 0.5rem;
  background: var(--ink); color: var(--bg); padding: 0.5rem 0.75rem; border-radius: 6px;
}
.skip:focus { left: 0.5rem; z-index: 10; }

/* ---------- header ---------- */
.top {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  max-width: var(--max); margin: 0 auto; padding: 1rem;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(8px);
}
.logo {
  display: inline-flex; align-items: center; gap: 0.55rem;
  color: var(--ink); font-weight: 600; text-decoration: none; letter-spacing: 0.01em; white-space: nowrap;
}
.dot {
  width: 0.9rem; height: 0.9rem; border-radius: 50%; background: var(--orange);
  transition: transform 0.3s ease;
}
.logo:hover .dot { transform: scale(1.25); }
.top nav { display: flex; gap: 1.1rem; font-size: 0.95rem; }
.top nav a { color: var(--muted); text-decoration: none; }
.top nav a:hover { color: var(--ink); }

/* ---------- layout ---------- */
main { max-width: var(--max); margin: 0 auto; padding: 0 1rem; }

.block { padding: 3.5rem 0 0; }

h1, h2 { line-height: 1.1; margin: 0; }

h2 {
  display: flex; align-items: center; gap: 0.75rem;
  font-size: 1.5rem; font-weight: 650; margin-bottom: 1.25rem;
}
h2::before {
  content: ""; flex: none;
  width: 0.7rem; height: 0.7rem; border-radius: 50%; background: var(--orange);
}
.num { order: 2; font: 500 0.8rem var(--mono); color: var(--muted); margin-left: auto; }

.intro { margin-top: 0; color: var(--muted); }

/* ---------- hero ---------- */
.hero {
  display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 3rem;
  padding: 3rem 0 1rem;
}
.kicker { font: 0.85rem var(--mono); color: var(--muted); margin: 0 0 0.75rem; }
.hero h1 { font-size: clamp(3rem, 9vw, 4.75rem); font-weight: 750; letter-spacing: -0.03em; }
.lede { font-size: 1.15rem; margin: 1.25rem 0 0; max-width: 30rem; }
mark {
  background: linear-gradient(transparent 60%, var(--orange-soft) 60%);
  color: inherit; padding: 0 0.1em;
}
.lede a { color: inherit; text-decoration: none; }
.lede a mark { transition: background-size 0.2s ease; }
.lede a:hover mark { background: var(--orange-soft); }

.hero-photo { margin: 0; text-align: center; }
.hero-photo a { display: inline-block; vertical-align: top; border-radius: 50%; }
.hero-photo img {
  display: block; width: 13rem; height: 13rem; margin: 0 auto;
  object-fit: cover;
  border-radius: 50%;
  box-shadow: 0 0 0 6px var(--bg), 0 0 0 9px var(--orange);
}
.hero-photo figcaption { font: 0.75rem var(--mono); color: var(--muted); margin-top: 1rem; }

/* ---------- closing photo ---------- */
.wide { margin: 4rem 0 0; }
.wide img { display: block; width: 100%; height: auto; border-radius: 18px; }
.wide figcaption { font: 0.75rem var(--mono); color: var(--muted); margin-top: 0.75rem; }

/* ---------- work ---------- */
.cols { display: grid; grid-template-columns: 1fr 13.5rem; gap: 2.5rem; align-items: start; }
.cols p:first-child { margin-top: 0; }
#writing .cols { margin-bottom: 1.5rem; }
.lead-in { margin: 0 0 0.25rem; }
.links { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.links a {
  display: flex; justify-content: space-between; align-items: center; gap: 0.75rem; padding: 0.7rem 0.1rem;
  border-bottom: 1px solid var(--line); color: var(--ink); text-decoration: none; font-weight: 500;
}
.links a:hover { color: var(--orange-ink); }
.links .label { display: inline-flex; align-items: center; gap: 0.55rem; }
.links .icon { width: 0.75rem; height: 0.75rem; flex: none; color: var(--orange-ink); }
.links .arrow { color: var(--orange-ink); }

.arrow { transition: transform 0.2s ease; }
.links a:hover .arrow { transform: translate(2px, -2px); }

/* ---------- writing ---------- */
.posts { list-style: none; margin: 0; padding: 0; counter-reset: post; }
.posts li { counter-increment: post; }
.posts a {
  display: flex; align-items: baseline; column-gap: 0.75rem;
  padding: 0.6rem 0; border-bottom: 1px solid var(--line); text-decoration: none; color: var(--ink);
}
.posts a::before {
  content: counter(post, decimal-leading-zero);
  flex: none; width: 1.75rem; font: 0.75rem var(--mono); color: var(--muted);
}
.posts .title { font-weight: 600; }
.posts .gloss { color: var(--muted); font-size: 0.9rem; margin-left: 0.5rem; }
.posts a:hover .title { color: var(--orange-ink); }
.more { margin-top: 1.25rem; font-size: 0.95rem; }
.sep { color: var(--muted); margin: 0 0.4rem; }

/* ---------- life ---------- */
.hobbies { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0.6rem; }
.hobbies li {
  display: inline-flex; align-items: center; gap: 0.5rem;
  background: var(--surface); border: 1px solid var(--line); border-radius: 999px;
  padding: 0.5rem 1rem 0.5rem 0.75rem; font-weight: 500;
  transition: border-color 0.2s ease, transform 0.2s ease;
}
.hobbies li:hover { border-color: var(--orange); transform: translateY(-2px); }
.hobbies .ico { font-size: 1.2rem; line-height: 1; }
.hobbies a { display: inline-flex; align-items: center; gap: 0.5rem; color: inherit; text-decoration: none; }
.hobbies a .arrow { color: var(--orange-ink); font-size: 0.85em; transition: transform 0.2s ease; }
.hobbies li:has(a):hover .arrow { transform: translate(2px, -2px); }

/* ---------- known issues ---------- */
.issues { width: 100%; border-collapse: collapse; font-size: 0.95rem; }
.issues th {
  text-align: left; font: 600 0.75rem var(--mono); text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--muted); padding: 0 0.5rem 0.5rem 0; border-bottom: 1px solid var(--line);
}
.issues td { padding: 0.75rem 0.75rem 0.75rem 0; border-bottom: 1px solid var(--line); vertical-align: top; }
.issues td:first-child { color: var(--muted); font-size: 0.85rem; white-space: nowrap; }
.issues td:last-child { text-align: right; padding-right: 0; white-space: nowrap; }
.issues th:last-child { text-align: right; padding-right: 0; }
.tag {
  display: inline-block; font: 600 0.7rem/1 var(--mono); padding: 0.35rem 0.55rem; border-radius: 999px;
  border: 1px solid currentColor;
}
.tag.open { color: var(--orange-ink); }
.tag.flaky { color: var(--muted); border-style: dashed; }
.tag.wontfix { color: var(--muted); }

/* ---------- contact ---------- */
.contact { padding-bottom: 1rem; }
.contact .invite { margin: 0 0 1.25rem; max-width: 34rem; }
.contact .big { font-size: clamp(1.4rem, 5vw, 2.25rem); font-weight: 650; margin: 0; letter-spacing: -0.01em; }

/* ---------- footer ---------- */
.foot {
  max-width: var(--max); margin: 3rem auto 0; padding: 1.5rem 1rem 2.5rem;
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0.5rem 1.5rem;
  border-top: 1px solid var(--line); font-size: 0.75rem; color: var(--muted);
}

/* ---------- small screens ---------- */
@media (max-width: 640px) {
  .top nav { gap: 0.8rem; font-size: 0.9rem; }
  .hero { grid-template-columns: 1fr; gap: 1.75rem; padding-top: 1rem; }
  .hero-photo { text-align: left; padding-left: 9px; }
  .hero-photo img { width: 8.5rem; height: 8.5rem; margin: 0; }
  .hero-photo figcaption { display: none; }
  .cols { grid-template-columns: 1fr; gap: 1.25rem; }
  /* Writing: on phones the links go to the very bottom, after the posts */
  #writing { display: flex; flex-direction: column; }
  #writing .cols { display: contents; }
  #writing .links { order: 1; margin-top: 1.5rem; }
  #writing .lead-in { margin-top: 1rem; }
  .issues td:first-child, .issues th:first-child { display: none; }
}

/* ---------- 404 ---------- */
.notfound { padding-top: 20vh; }
.notfound h1 { font-size: 5rem; font-weight: 750; letter-spacing: -0.03em; }
.notfound h1::after {
  content: ""; display: inline-block; width: 0.35em; height: 0.35em; margin-left: 0.1em;
  border-radius: 50%; background: var(--orange);
}
.notfound .mono { color: var(--muted); }

/* ---------- language switch ---------- */
.top nav a.lang {
  font: 600 0.75rem/1 var(--mono); color: var(--ink);
  padding: 0.35rem 0.5rem; border: 1px solid var(--line); border-radius: 999px; align-self: center;
}
.top nav a.lang:hover { border-color: var(--orange); }

/* ---------- prose ---------- */
.prose { margin-bottom: 0.5rem; }
.prose p:first-child { margin-top: 0; }

@media (max-width: 420px) {
  .top nav a:not(.lang) { display: none; }
}
