/* kylejbrill.com
   Calm, editorial. One serif for reading, one sans for small UI text,
   one accent. Light and dark from the same tokens. */

@font-face {
  font-family: "Source Serif 4";
  src: url("/fonts/source-serif-4.woff2") format("woff2");
  font-weight: 200 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Source Serif 4";
  src: url("/fonts/source-serif-4-italic.woff2") format("woff2");
  font-weight: 200 900;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: "Inter";
  src: url("/fonts/inter.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #fbfaf7;
  --surface: #f2efe9;
  --text: #1b1a17;
  --muted: #5e5b55;
  --faint: #736f67;
  --rule: #e4e0d7;
  --accent: #355e3b; /* hunter green */
  --accent-hover: #24432a;
  --selection: #dce8dd;
  --code-bg: #f0ede6;

  --serif: "Source Serif 4", Georgia, "Iowan Old Style", "Times New Roman", serif;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  --measure: 40rem;
  --gutter: 1.25rem;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #141413;
    --surface: #1d1d1b;
    --text: #ebe9e4;
    --muted: #aaa69e;
    --faint: #7d7a73;
    --rule: #2d2c29;
    --accent: #8fc49a;
    --accent-hover: #b4dbbb;
    --selection: #263f2b;
    --code-bg: #1f1f1d;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #141413;
  --surface: #1d1d1b;
  --text: #ebe9e4;
  --muted: #aaa69e;
  --faint: #7d7a73;
  --rule: #2d2c29;
  --accent: #8fc49a;
  --accent-hover: #b4dbbb;
  --selection: #263f2b;
  --code-bg: #1f1f1d;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--serif);
  font-size: 1.125rem;
  line-height: 1.7;
  font-optical-sizing: auto;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}
::selection { background: var(--selection); }

.wrap {
  max-width: calc(var(--measure) + 2 * var(--gutter));
  margin-inline: auto;
  padding-inline: var(--gutter);
}

a {
  color: var(--accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
  transition: color 0.15s ease;
}
a:hover { color: var(--accent-hover); text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 2px; }

.skip {
  position: absolute;
  left: -999px;
  top: 0.5rem;
  padding: 0.5rem 0.75rem;
  background: var(--text);
  color: var(--bg);
  font-family: var(--sans);
  font-size: 0.9rem;
  z-index: 10;
}
.skip:focus { left: 0.5rem; }

/* Header */
.site-header { padding-block: 1.75rem 0; }
.header-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1.5rem;
}
.site-name {
  font-family: var(--serif);
  font-size: 1.2rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text);
  text-decoration: none;
}
.site-name:hover { color: var(--accent); text-decoration: none; }
.site-header nav {
  display: flex;
  align-items: center;
  gap: 1.35rem;
  font-family: var(--sans);
  font-size: 0.9rem;
}
.site-header nav a {
  color: var(--muted);
  text-decoration: none;
  padding-block: 0.25rem;
  border-bottom: 1px solid transparent;
}
.site-header nav a:hover { color: var(--text); }
.site-header nav a[aria-current="page"] { color: var(--text); border-bottom-color: var(--accent); }

.theme-toggle {
  display: inline-grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  margin-left: -0.25rem;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}
.theme-toggle:hover { color: var(--text); background: var(--surface); }
.icon-sun { display: none; }
:root[data-theme="dark"] .icon-sun { display: block; }
:root[data-theme="dark"] .icon-moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .icon-sun { display: block; }
  :root:not([data-theme="light"]) .icon-moon { display: none; }
}

main { padding-block: 3.5rem 2rem; }

/* Type */
h1, h2, h3, h4 {
  font-family: var(--serif);
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.012em;
  text-wrap: balance;
}
h1 { font-size: clamp(2.1rem, 1.6rem + 2.2vw, 2.9rem); margin: 0 0 1rem; letter-spacing: -0.02em; }
h2 { font-size: 1.45rem; margin: 3rem 0 0.75rem; }
h3 { font-size: 1.15rem; margin: 2rem 0 0.25rem; }
p { margin: 0 0 1.15em; }
p, li { text-wrap: pretty; }

.kicker, .meta, .section-title, time, .empty, .more, .post-footer, .site-footer {
  font-family: var(--sans);
}
.kicker {
  margin: 0 0 0.75rem;
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.kicker a { color: inherit; text-decoration: none; }
.kicker a:hover { color: var(--accent); }
.meta { font-size: 0.875rem; color: var(--muted); margin: 0; }
.dek { font-size: 1.25rem; line-height: 1.5; color: var(--muted); margin: 0 0 1.25rem; }
.empty { color: var(--muted); font-size: 0.95rem; }
.more { margin-top: 2rem; font-size: 0.95rem; }
.more a { text-decoration: none; font-weight: 500; }
.more a::after { content: " \2192"; }

/* Home */
.hero { padding-bottom: 1rem; }
.hero h1 { font-size: clamp(2.5rem, 1.8rem + 3vw, 3.6rem); margin-bottom: 1.25rem; }
.lede { font-size: clamp(1.3rem, 1.15rem + 0.6vw, 1.55rem); line-height: 1.45; margin-bottom: 1.5rem; }
.hero-body { color: var(--muted); }
.hero-links {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  margin-top: 1.75rem;
  font-family: var(--sans);
  font-size: 0.95rem;
  font-weight: 500;
}
.hero-links a { text-decoration: none; }
.hero-links a::after { content: " \2192"; }

/* Vision home */
.hero h1 {
  font-size: clamp(1.9rem, 1.4rem + 2.2vw, 2.75rem);
  line-height: 1.18;
  max-width: 34rem;
}
.vision p:first-child { font-size: 1.2rem; line-height: 1.6; }
.vision p:last-child { color: var(--muted); }

.beliefs-intro { margin: 1.25rem 0 0.25rem; color: var(--muted); font-size: 1.05rem; }
.belief-list { list-style: none; padding: 0; margin: 0; counter-reset: belief; }
.belief-list li {
  counter-increment: belief;
  position: relative;
  padding: 1.5rem 0 1.25rem 2.75rem;
  border-bottom: 1px solid var(--rule);
}
.belief-list li::before {
  content: counter(belief, decimal-leading-zero);
  position: absolute;
  left: 0;
  top: 1.7rem;
  font-family: var(--sans);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--accent);
}
.belief-list h3 { margin: 0 0 0.4rem; font-size: 1.2rem; line-height: 1.35; }
.belief-list p { margin: 0; color: var(--muted); }

.lens p:first-of-type { margin-top: 1.25rem; }

.connect {
  padding: 1.75rem 0 0;
  border-top: 2px solid var(--accent);
}
.connect p { margin-bottom: 1rem; }
.button {
  display: inline-block;
  padding: 0.6rem 1.15rem;
  border: 1.5px solid var(--accent);
  border-radius: 999px;
  font-family: var(--sans);
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--accent);
  text-decoration: none;
  transition: background-color 0.15s, color 0.15s;
}
.button:hover, .button:focus-visible { background: var(--accent); color: var(--bg); }

.section { margin-top: 4rem; }
.section-title {
  margin: 0 0 0.25rem;
  padding-bottom: 0.75rem;
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  border-bottom: 1px solid var(--rule);
}

/* Post lists */
.post-list { list-style: none; margin: 0; padding: 0; }
.post-list li {
  display: grid;
  grid-template-columns: 7rem 1fr;
  gap: 0.25rem 1.5rem;
  padding-block: 1.35rem;
  border-bottom: 1px solid var(--rule);
}
.post-list time {
  padding-top: 0.3rem;
  font-size: 0.85rem;
  color: var(--faint);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.post-list a {
  font-size: 1.25rem;
  font-weight: 600;
  line-height: 1.3;
  color: var(--text);
  text-decoration: none;
}
.post-list a:hover { color: var(--accent); }
.post-list p { margin: 0.35rem 0 0; color: var(--muted); font-size: 1.025rem; line-height: 1.5; }

.page-header { margin-bottom: 2rem; }
.page-header .dek { font-size: 1.15rem; }

/* Posts and long pages */
.post-header { margin-bottom: 2.5rem; padding-bottom: 1.75rem; border-bottom: 1px solid var(--rule); }
.post-header h1 { margin-bottom: 0.75rem; }
.post-footer {
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--rule);
  color: var(--muted);
  font-size: 0.95rem;
}
.post-footer p { margin: 0 0 0.75rem; }

.prose > :first-child { margin-top: 0; }
.prose h1 { margin-bottom: 1.5rem; }
.prose h2 { font-size: 1.4rem; }
.prose ul, .prose ol { padding-left: 1.3rem; margin: 0 0 1.25em; }
.prose li { margin-bottom: 0.4em; padding-left: 0.2rem; }
.prose li::marker { color: var(--faint); }
.prose blockquote {
  margin: 1.75rem 0;
  padding: 0.1rem 0 0.1rem 1.25rem;
  border-left: 3px solid var(--accent);
  color: var(--muted);
  font-style: italic;
}
.prose blockquote p:last-child { margin-bottom: 0; }
.prose code {
  font-family: var(--mono);
  font-size: 0.85em;
  padding: 0.12em 0.35em;
  border-radius: 4px;
  background: var(--code-bg);
}
.prose pre {
  margin: 1.75rem 0;
  padding: 1rem 1.15rem;
  overflow-x: auto;
  border: 1px solid var(--rule);
  border-radius: 6px;
  background: var(--code-bg);
  font-size: 0.85rem;
  line-height: 1.6;
}
.prose pre code { padding: 0; background: none; font-size: inherit; }
.prose hr { border: 0; border-top: 1px solid var(--rule); margin: 2.5rem auto; width: 6rem; }
.prose img { max-width: 100%; height: auto; border-radius: 4px; }
.prose figure { margin: 2rem 0; }
.prose figcaption { margin-top: 0.5rem; font-family: var(--sans); font-size: 0.85rem; color: var(--muted); }
.prose table { width: 100%; border-collapse: collapse; margin: 1.75rem 0; font-size: 0.95rem; }
.prose th, .prose td { text-align: left; padding: 0.5rem 0.75rem 0.5rem 0; border-bottom: 1px solid var(--rule); }
.prose th { font-family: var(--sans); font-size: 0.85rem; font-weight: 600; color: var(--muted); }

/* Resume */
.resume h2 {
  margin-top: 3rem;
  padding-bottom: 0.6rem;
  font-family: var(--sans);
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  border-bottom: 1px solid var(--rule);
}
.resume h3 { font-size: 1.2rem; margin-top: 2.25rem; }
.resume .meta { margin: 0.1rem 0 0.75rem; font-size: 0.85rem; color: var(--faint); }
.resume > p:first-of-type { font-family: var(--sans); font-size: 0.95rem; color: var(--muted); }
.resume ul { margin-bottom: 0; }
.resume li { font-size: 1.05rem; }

/* Footer */
.site-footer { margin-top: 3rem; padding-block: 2rem 3rem; border-top: 1px solid var(--rule); }
.footer-inner { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0.75rem 2rem; }
.footer-line { margin: 0; max-width: 24rem; font-size: 0.85rem; line-height: 1.5; color: var(--muted); }
.footer-links { display: flex; gap: 1.25rem; margin: 0; font-size: 0.85rem; color: var(--faint); }
.footer-links a { color: var(--muted); text-decoration: none; }
.footer-links a:hover { color: var(--accent); }

@media (max-width: 560px) {
  body { font-size: 1.0625rem; }
  main { padding-block: 2.5rem 1.5rem; }
  .site-header nav { gap: 1rem; }
  .post-list li { grid-template-columns: 1fr; gap: 0.15rem; }
  .post-list time { padding-top: 0; }
  .section { margin-top: 3rem; }
  .belief-list li { padding-left: 2.25rem; }
}

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

@media print {
  .site-header nav, .site-footer, .skip { display: none; }
  body { background: #fff; color: #000; font-size: 11pt; }
  a { color: inherit; text-decoration: none; }
}
