/* Design system shared with ghanithan.com. The main site generates this from
   Tailwind tokens; here it is written out by hand. Keep the two in step. */

:root {
  /* Instrument-panel face: cool, not cream. */
  --ground: #f2f3f5;
  --ink: #16181d;
  --muted: #5c6470;
  --signal: #1b3fe0;
  --anomaly: #c8761b;
  --rule: #dde0e4;

  --measure: 68ch;
  --page: 48rem;
  --gutter: 1.25rem;

  --sans: 'IBM Plex Sans', ui-sans-serif, system-ui, -apple-system, sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --ground: #101216;
    --ink: #e6e8ec;
    --muted: #98a0ae;
    --signal: #8098ff;
    --anomaly: #e0a050;
    --rule: #262a31;
  }
}

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

html {
  background: var(--ground);
  color-scheme: light dark;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--ground);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.wrapper {
  width: 100%;
  max-width: var(--page);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

/* Links: underlined in prose, quiet in chrome. */
a {
  color: inherit;
  text-decoration-line: underline;
  text-decoration-color: color-mix(in srgb, var(--signal) 45%, transparent);
  text-underline-offset: 0.2em;
  text-decoration-thickness: 1px;
}

a:hover {
  text-decoration-color: var(--signal);
}

:focus-visible {
  outline: 2px solid var(--signal);
  outline-offset: 3px;
  border-radius: 1px;
}

/* ---------- header ---------- */

.site-header {
  padding-block: 2rem 1rem;
}

.site-header .wrapper {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.5rem 1.25rem;
  font-size: 0.875rem;
}

.site-title {
  font-weight: 500;
  text-decoration: none;
}

.site-nav {
  margin-left: auto;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.25rem;
}

.site-nav a {
  color: var(--muted);
  text-decoration: none;
}

.site-nav a:hover,
.site-nav a[aria-current='page'] {
  text-decoration: underline;
}

.site-nav a[aria-current='page'] {
  color: var(--ink);
}

/* ---------- main ---------- */

.page-content {
  flex: 1;
  padding-bottom: 4rem;
}

.post-header {
  padding-block: 1.5rem 2rem;
}

.post-title {
  margin: 0;
  font-size: 1.875rem;
  line-height: 1.2;
  font-weight: 600;
  letter-spacing: -0.025em;
}

.post-meta {
  display: block;
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--muted);
}

.post-header .post-meta {
  margin-top: 0.6rem;
}

/* Sans, not mono: this is a sentence, not a datum. */
.page-lead {
  margin: 0.75rem 0 0;
  max-width: var(--measure);
  font-size: 0.9375rem;
  color: var(--muted);
}

/* ---------- post body: deliberately plain ---------- */

.post-body {
  max-width: var(--measure);
  font-size: 1rem;
  line-height: 1.65;
}

.post-body > * + * {
  margin-top: 0.9em;
}

.post-body h2,
.post-body h3 {
  margin-top: 2em;
  margin-bottom: 0.6em;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.post-body h2 {
  font-size: 1.15rem;
}

.post-body h3 {
  font-size: 1rem;
}

.post-body ul,
.post-body ol {
  padding-left: 1.2em;
}

.post-body li + li {
  margin-top: 0.35em;
}

.post-body img {
  max-width: 100%;
  height: auto;
  display: block;
  margin-block: 1.5em;
  border: 1px solid var(--rule);
}

.post-body code {
  font-family: var(--mono);
  font-size: 0.875em;
  padding: 0.1em 0.3em;
  background: color-mix(in srgb, var(--rule) 55%, transparent);
  border-radius: 2px;
}

.post-body pre {
  overflow-x: auto;
  padding: 1rem;
  border: 1px solid var(--rule);
  font-family: var(--mono);
  font-size: 0.85rem;
  line-height: 1.55;
}

.post-body pre code {
  padding: 0;
  background: none;
}

.post-body blockquote {
  margin-inline: 0;
  padding-left: 1rem;
  border-left: 2px solid var(--rule);
  color: var(--muted);
}

.post-body hr {
  margin-block: 2.5em;
  border: 0;
  border-top: 1px solid var(--rule);
}

/* ---------- index: date and title, one row each ---------- */

.post-list-heading {
  margin: 0 0 1rem;
  font-size: 0.875rem;
  font-weight: 500;
}

.post-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.post-list > li {
  padding-block: 1rem;
  border-top: 1px solid var(--rule);
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.25rem 1rem;
}

.post-list .post-meta {
  order: 2;
  margin-left: auto;
}

.post-link {
  margin: 0;
  order: 1;
  font-size: 1rem;
  font-weight: 500;
}

/* ---------- footer ---------- */

.site-footer {
  border-top: 1px solid var(--rule);
  padding-block: 2rem;
  font-size: 0.875rem;
  color: var(--muted);
}

.site-footer .wrapper {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.25rem;
}

.site-footer a {
  text-decoration: none;
}

.site-footer a:hover {
  text-decoration: underline;
}

/* ---------- forward stubs ---------- */

.forward {
  max-width: var(--measure);
  padding-block: 3rem;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
