/* johnfallsopp.com — web-standards minimalist, light + dark */

:root {
  --bg: #ffffff;
  --text: #15171a;
  --secondary: #3d4146;
  --muted: #6b7178;
  --hairline: #ededed;
  --hairline-soft: #f4f4f4;
  --accent: #1554d1;
  --bar: #fafafa;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
  --measure: 36rem;
  --page: 44rem;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1318;
    --text: #e9edf1;
    --secondary: #aab2bb;
    --muted: #7e8893;
    --hairline: #212931;
    --hairline-soft: #1a2127;
    --accent: #5b9bff;
    --bar: #141a1f;
  }
}

:root[data-theme="dark"] {
  --bg: #0f1318;
  --text: #e9edf1;
  --secondary: #aab2bb;
  --muted: #7e8893;
  --hairline: #212931;
  --hairline-soft: #1a2127;
  --accent: #5b9bff;
  --bar: #141a1f;
}

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

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

body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.wrap { max-width: var(--page); margin: 0 auto; padding: 2.4rem 1.6rem 4rem; }

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

/* --- nav --- */
.site-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 3rem;
}
.site-nav .brand {
  font-family: var(--mono);
  font-size: 0.84rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.01em;
}
.site-nav .links { font-family: var(--mono); font-size: 0.78rem; }
.site-nav .links a { color: var(--muted); margin-left: 1rem; }
.site-nav .links a:first-child { margin-left: 0; }
.site-nav .links a.active { color: var(--text); }
.site-nav .links a:hover { color: var(--text); text-decoration: none; }
.theme-toggle {
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--muted);
  background: none;
  border: none;
  cursor: pointer;
  margin-left: 1rem;
  padding: 0;
}
.theme-toggle:hover { color: var(--text); }

/* --- hero --- */
.hero h1 {
  font-weight: 500;
  font-size: clamp(1.6rem, 4.5vw, 2rem);
  line-height: 1.22;
  letter-spacing: -0.02em;
  max-width: 26ch;
  margin-bottom: 1rem;
}
.hero .sub {
  font-size: 1.0rem;
  line-height: 1.6;
  color: var(--secondary);
  max-width: var(--measure);
  margin-bottom: 2.6rem;
}

/* --- section headers (mono kicker) --- */
.shead {
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  padding-top: 1.2rem;
  margin: 2.4rem 0 0.9rem;
  border-top: 1px solid var(--hairline);
}
.shead:first-child { margin-top: 0; }

/* --- entry list (writing) --- */
.entry {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  padding: 0.55rem 0;
  border-bottom: 1px solid var(--hairline-soft);
}
.entry a { font-size: 1.0rem; color: var(--text); }
.entry a:hover { color: var(--accent); }
.entry .date { font-family: var(--mono); font-size: 0.74rem; color: var(--muted); white-space: nowrap; }
.entry .ex { color: var(--secondary); font-size: 0.88rem; margin: 0.1rem 0 0; }
.more { font-family: var(--mono); font-size: 0.78rem; display: inline-block; margin-top: 0.9rem; }

/* --- now grid --- */
.now { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem 1.6rem; }
.now .t { font-size: 0.94rem; font-weight: 500; margin-bottom: 0.15rem; }
.now .t a { color: var(--text); }
.now .t a:hover { color: var(--accent); }
.now .n { font-size: 0.84rem; line-height: 1.5; color: var(--secondary); }
@media (max-width: 34rem) { .now { grid-template-columns: 1fr; } }

/* --- long view --- */
.longview { font-size: 0.92rem; line-height: 1.7; color: var(--secondary); max-width: var(--measure); }

/* --- footer --- */
.site-foot {
  font-family: var(--mono);
  font-size: 0.74rem;
  color: var(--muted);
  margin-top: 3rem;
  padding-top: 1.2rem;
  border-top: 1px solid var(--hairline);
  display: flex;
  gap: 1.1rem;
  flex-wrap: wrap;
}
.site-foot a { color: var(--muted); }
.site-foot a:hover { color: var(--text); text-decoration: none; }

/* --- article / prose --- */
.post-header { margin-bottom: 2rem; }
.post-header h1 {
  font-weight: 500;
  font-size: clamp(1.7rem, 5vw, 2.1rem);
  line-height: 1.2;
  letter-spacing: -0.02em;
  margin-bottom: 0.6rem;
}
.post-header .subtitle { font-size: 1.1rem; color: var(--secondary); line-height: 1.4; margin-bottom: 0.9rem; }
.post-meta {
  font-family: var(--mono);
  font-size: 0.74rem;
  color: var(--muted);
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}
.canonical-note { font-size: 0.8rem; color: var(--muted); margin-top: 0.8rem; }

.prose { max-width: var(--measure); font-size: 1.05rem; line-height: 1.75; }
.prose > * + * { margin-top: 1.3rem; }
.prose h2 { font-weight: 500; font-size: 1.3rem; letter-spacing: -0.01em; margin-top: 2.4rem; line-height: 1.3; }
.prose h3 { font-weight: 500; font-size: 1.1rem; margin-top: 2rem; }
.prose a { text-decoration: underline; text-underline-offset: 2px; text-decoration-thickness: 1px; }
.prose blockquote {
  border-left: 2px solid var(--accent);
  padding-left: 1.1rem;
  color: var(--secondary);
  font-style: italic;
}
.prose code {
  font-family: var(--mono);
  font-size: 0.86em;
  background: var(--bar);
  padding: 0.1em 0.35em;
  border-radius: 3px;
}
.prose pre {
  font-family: var(--mono);
  font-size: 0.82rem;
  line-height: 1.55;
  background: var(--bar);
  border: 1px solid var(--hairline);
  border-radius: 6px;
  padding: 1rem 1.1rem;
  overflow-x: auto;
}
.prose pre code { background: none; padding: 0; font-size: inherit; }
.prose ul, .prose ol { padding-left: 1.4rem; }
.prose li + li { margin-top: 0.4rem; }
.prose img { max-width: 100%; height: auto; border-radius: 6px; }
.prose hr { border: none; border-top: 1px solid var(--hairline); margin: 2.4rem 0; }
.prose table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
.prose th, .prose td { text-align: left; padding: 0.5rem 0.6rem; border-bottom: 1px solid var(--hairline); }

.tag { font-family: var(--mono); font-size: 0.72rem; color: var(--muted); }
.post-tags { margin-top: 2.4rem; padding-top: 1.2rem; border-top: 1px solid var(--hairline); display: flex; gap: 0.8rem; flex-wrap: wrap; }

/* --- page (standing markdown pages) --- */
.page-title { font-weight: 500; font-size: clamp(1.7rem, 5vw, 2.1rem); letter-spacing: -0.02em; margin-bottom: 0.4rem; }
.page-subtitle { font-size: 1.1rem; color: var(--secondary); margin-bottom: 2rem; }

.post-nav { margin-top: 2.6rem; font-family: var(--mono); font-size: 0.78rem; }
