/* ---------------------------------------------------------------------------
   Design tokens. Light is the base; dark redefines only what changes, so no
   colour has its ONLY definition inside a media query.
   --------------------------------------------------------------------------- */
:root {
  --bg:        #fbfbfa;
  --bg-raised: #ffffff;
  --fg:        #16181d;
  --fg-muted:  #5c6270;
  --fg-faint:  #8b909c;
  --rule:      #e4e4e1;
  --rule-soft: #eeeeec;
  --accent:    #0f7a5a;
  --accent-fg: #ffffff;
  --code-bg:   #f4f4f2;
  --quote-bar: #d3d3cf;

  --measure: 42rem;
  --wrap: 46rem;
  --radius: 8px;

  --sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Inter, Roboto,
          "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", "Cascadia Mono", Menlo,
          Consolas, "Liberation Mono", monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg:        #0f1114;
    --bg-raised: #16191e;
    --fg:        #e8e9ec;
    --fg-muted:  #a2a8b4;
    --fg-faint:  #6f7683;
    --rule:      #262a31;
    --rule-soft: #1d2127;
    --accent:    #4ec99b;
    --accent-fg: #0f1114;
    --code-bg:   #171b21;
    --quote-bar: #2f353e;
  }
}

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.65;
  font-feature-settings: "kern" 1, "liga" 1;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.wrap {
  width: 100%;
  max-width: var(--wrap);
  margin-inline: auto;
  padding-inline: 1.25rem;
}

.skip {
  position: absolute;
  left: -9999px;
}
.skip:focus {
  left: 1rem;
  top: 1rem;
  z-index: 10;
  background: var(--accent);
  color: var(--accent-fg);
  padding: 0.5rem 0.9rem;
  border-radius: var(--radius);
}

/* ------------------------------------------------------------------- chrome */

.site-header {
  border-bottom: 1px solid var(--rule);
  background: var(--bg);
  position: sticky;
  top: 0;
  z-index: 5;
  backdrop-filter: saturate(180%) blur(8px);
}
.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 3.75rem;
  flex-wrap: wrap;
}
.brand {
  font-weight: 640;
  letter-spacing: -0.012em;
  color: var(--fg);
  text-decoration: none;
  font-size: 1rem;
}
.site-header nav {
  display: flex;
  gap: 1.25rem;
}
.site-header nav a {
  color: var(--fg-muted);
  text-decoration: none;
  font-size: 0.9375rem;
  padding-block: 0.25rem;
  border-bottom: 2px solid transparent;
}
.site-header nav a:hover { color: var(--fg); }
.site-header nav a[aria-current="page"] {
  color: var(--fg);
  border-bottom-color: var(--accent);
}

main { padding-block: 3rem 4rem; }

.site-footer {
  border-top: 1px solid var(--rule);
  padding-block: 2rem 3rem;
  color: var(--fg-faint);
  font-size: 0.875rem;
}
.site-footer p { margin: 0 0 0.5rem; max-width: var(--measure); }
.site-footer a { color: var(--fg-muted); }

/* --------------------------------------------------------------------- home */

.intro { margin-bottom: 3rem; }
.intro h1 {
  font-size: clamp(1.9rem, 5vw, 2.6rem);
  line-height: 1.15;
  letter-spacing: -0.028em;
  margin: 0 0 0.5rem;
}
.tagline {
  margin: 0;
  color: var(--fg-muted);
  font-size: 1.0625rem;
  max-width: var(--measure);
}

.post-list { list-style: none; margin: 0; padding: 0; }
.post-item + .post-item { border-top: 1px solid var(--rule-soft); }

.post-link {
  display: block;
  text-decoration: none;
  color: inherit;
  padding-block: 1.6rem;
  border-radius: var(--radius);
  transition: background 120ms ease;
}
.post-link:hover { background: var(--bg-raised); }
.post-link time {
  display: block;
  font-family: var(--mono);
  font-size: 0.75rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--fg-faint);
  margin-bottom: 0.4rem;
}
.post-link h2 {
  margin: 0 0 0.4rem;
  font-size: 1.3125rem;
  line-height: 1.3;
  letter-spacing: -0.018em;
  font-weight: 620;
}
.post-link:hover h2 { color: var(--accent); }
.post-link p {
  margin: 0;
  color: var(--fg-muted);
  font-size: 0.9688rem;
  max-width: var(--measure);
}

.empty { color: var(--fg-faint); }

/* -------------------------------------------------------------------- posts */

.post { max-width: var(--measure); }
.post > header { margin-bottom: 2.25rem; }
.post h1 {
  font-size: clamp(1.7rem, 4.4vw, 2.25rem);
  line-height: 1.2;
  letter-spacing: -0.024em;
  margin: 0.35rem 0 0.6rem;
}
.post .meta {
  margin: 0;
  color: var(--fg-faint);
  font-size: 0.8125rem;
  font-family: var(--mono);
  letter-spacing: 0.02em;
}
.post .meta a { color: var(--fg-muted); text-decoration: none; }
.post .meta a:hover { color: var(--accent); }
.tag {
  display: inline-block;
  color: var(--fg-muted);
}

.post h2 {
  margin: 2.75rem 0 0.75rem;
  font-size: 1.375rem;
  line-height: 1.3;
  letter-spacing: -0.018em;
  font-weight: 640;
}
.post h3 {
  margin: 2rem 0 0.6rem;
  font-size: 1.0938rem;
  letter-spacing: -0.008em;
  font-weight: 640;
}
.post p { margin: 0 0 1.15rem; }
.post ul, .post ol { margin: 0 0 1.15rem; padding-left: 1.35rem; }
.post li { margin-bottom: 0.45rem; }
.post li > ul, .post li > ol { margin-top: 0.45rem; }

a { color: var(--accent); text-underline-offset: 0.18em; }
a:hover { text-decoration-thickness: 2px; }

hr {
  border: 0;
  border-top: 1px solid var(--rule);
  margin: 2.5rem 0;
}

blockquote {
  margin: 1.5rem 0;
  padding: 0.15rem 0 0.15rem 1.15rem;
  border-left: 3px solid var(--quote-bar);
  color: var(--fg-muted);
}
blockquote p:last-child { margin-bottom: 0; }

code {
  font-family: var(--mono);
  font-size: 0.875em;
  background: var(--code-bg);
  padding: 0.14em 0.36em;
  border-radius: 4px;
  word-break: break-word;
}

pre {
  background: var(--code-bg);
  border: 1px solid var(--rule-soft);
  border-radius: var(--radius);
  padding: 0.95rem 1.05rem;
  overflow-x: auto;
  margin: 0 0 1.4rem;
  line-height: 1.55;
}
pre code {
  background: none;
  padding: 0;
  font-size: 0.8125rem;
  word-break: normal;
}

.table-wrap {
  overflow-x: auto;
  margin: 0 0 1.5rem;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
}
table {
  border-collapse: collapse;
  width: 100%;
  font-size: 0.9062rem;
}
th, td {
  padding: 0.6rem 0.85rem;
  border-bottom: 1px solid var(--rule-soft);
  vertical-align: top;
}
th {
  font-weight: 620;
  color: var(--fg);
  background: var(--bg-raised);
  white-space: nowrap;
}
tbody tr:last-child td { border-bottom: 0; }

img, video { max-width: 100%; height: auto; border-radius: var(--radius); }

/* ------------------------------------------------------------- small screens */

@media (max-width: 34rem) {
  body { font-size: 16px; }
  main { padding-block: 2rem 3rem; }
  .site-header .wrap { min-height: 3.25rem; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

/* ------------------------------------------------------- brand byline + sections */

.brand {
  display: inline-flex;
  align-items: baseline;
  gap: 0.55rem;
  flex-wrap: wrap;
}
.brand-byline {
  font-weight: 420;
  font-size: 0.8125rem;
  color: var(--fg-faint);
  letter-spacing: 0;
}

.section { margin-bottom: 3.25rem; }
.section:last-child { margin-bottom: 0; }
.section-title {
  font-size: 0.75rem;
  font-family: var(--mono);
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--fg-faint);
  font-weight: 500;
  margin: 0 0 0.5rem;
  padding-bottom: 0.6rem;
  border-bottom: 1px solid var(--rule);
}

/* -------------------------------------------------------------- project cards */

.project-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.75rem;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 17rem), 1fr));
  padding-top: 1.25rem;
}
.project-link {
  display: block;
  height: 100%;
  text-decoration: none;
  color: inherit;
  background: var(--bg-raised);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 1.1rem 1.15rem;
  transition: border-color 120ms ease, transform 120ms ease;
}
.project-link:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
}
.project-link h3 {
  margin: 0 0 0.45rem;
  font-size: 1.125rem;
  letter-spacing: -0.014em;
  font-weight: 640;
}
.project-link p {
  margin: 0 0 0.55rem;
  color: var(--fg-muted);
  font-size: 0.9062rem;
  line-height: 1.55;
}
.project-link .meta {
  margin: 0;
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--fg-faint);
}

.badge {
  display: inline-block;
  vertical-align: 0.14em;
  font-family: var(--mono);
  font-size: 0.625rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-weight: 500;
  color: var(--accent);
  border: 1px solid currentColor;
  border-radius: 999px;
  padding: 0.1rem 0.45rem;
}

/* ------------------------------------------------------- post cards (updated) */

.post-kicker {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin: 0 0 0.4rem;
  font-family: var(--mono);
  font-size: 0.75rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--fg-faint);
}
.post-project {
  color: var(--accent);
}
.post-project::before {
  content: "";
  display: inline-block;
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--fg-faint);
  vertical-align: 0.22em;
  margin-right: 0.6rem;
}
.post-link h3 {
  margin: 0 0 0.4rem;
  font-size: 1.25rem;
  line-height: 1.3;
  letter-spacing: -0.018em;
  font-weight: 620;
}
.post-link:hover h3 { color: var(--accent); }

.project-header { margin-bottom: 3rem; }
.project-header .tagline {
  font-size: 1.0312rem;
  margin-bottom: 1.5rem;
}
