/* ------------------------------------------------------------------
   zmunro.dev — site styles
   Plain CSS, no framework. Light and dark via prefers-color-scheme.
   ------------------------------------------------------------------ */

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

  --bg: #ffffff;
  --bg-subtle: #f5f6f8;
  --text: #15181d;
  --text-2: #4a5160;
  --text-3: #737a88;
  --border: #e5e7eb;
  --accent: #0b7ea6;
  --accent-hover: #075f7f;
  --accent-soft: #e7f4f9;

  --max: 46rem;
  --gutter: 1.25rem;
  --col: 10rem;
  --radius: 10px;
  --nav-h: 3.5rem;

  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1114;
    --bg-subtle: #171a1f;
    --text: #e9eaee;
    --text-2: #b5bac4;
    --text-3: #868d9a;
    --border: #262a32;
    --accent: #5ec6ec;
    --accent-hover: #8ad7f2;
    --accent-soft: #13303c;
  }
}

/* Base ------------------------------------------------------------- */

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

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

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  *,
  *::before,
  *::after {
    transition: none !important;
  }
}

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

img {
  display: block;
  max-width: 100%;
  height: auto;
}

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

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

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

h1,
h2,
h3,
h4 {
  margin: 0;
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: -0.01em;
  color: var(--text);
}

p {
  margin: 0 0 1rem;
}

ul,
ol {
  margin: 0 0 1rem;
  padding-left: 1.25rem;
}

li {
  margin-bottom: 0.4rem;
}

li:last-child {
  margin-bottom: 0;
}

/* Layout ----------------------------------------------------------- */

.wrap {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

.skip {
  position: absolute;
  left: 1rem;
  top: -3rem;
  padding: 0.5rem 0.75rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  z-index: 100;
}

.skip:focus {
  top: 0.5rem;
}

/* Nav -------------------------------------------------------------- */

.nav {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--bg);
  background: color-mix(in srgb, var(--bg) 84%, transparent);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--border);
}

.nav .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  height: var(--nav-h);
}

.nav-brand {
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  letter-spacing: -0.01em;
}

.nav-brand:hover {
  color: var(--accent);
  text-decoration: none;
}

.nav-links {
  display: flex;
  gap: 0.15rem;
  margin: 0;
  padding: 0;
  list-style: none;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 1.5rem), transparent);
  mask-image: linear-gradient(to right, #000 calc(100% - 1.5rem), transparent);
  padding-right: 1.5rem;
}

.nav-links::-webkit-scrollbar {
  display: none;
}

.nav-links li {
  margin: 0;
}

.nav-links a {
  display: inline-block;
  padding: 0.35rem 0.6rem;
  border-radius: 6px;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-2);
  white-space: nowrap;
  transition: background-color 120ms ease, color 120ms ease;
}

.nav-links a:hover {
  color: var(--text);
  background: var(--bg-subtle);
  text-decoration: none;
}

.nav-links a[aria-current] {
  color: var(--accent);
  background: var(--accent-soft);
}

@media (min-width: 640px) {
  .nav-links {
    -webkit-mask-image: none;
    mask-image: none;
    padding-right: 0;
  }
}

/* Hero ------------------------------------------------------------- */

.hero {
  padding-top: 4rem;
  padding-bottom: 3rem;
}

.hero-top {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}

.avatar {
  width: 6rem;
  height: 6rem;
  flex-shrink: 0;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--border);
}

.hero h1 {
  font-size: clamp(1.75rem, 6vw, 2.75rem);
  letter-spacing: -0.025em;
}

.hero .role {
  margin-top: 0.3rem;
  font-size: 1.05rem;
  color: var(--text-2);
}

.hero .lead {
  max-width: 40rem;
  font-size: 1.125rem;
  line-height: 1.65;
  color: var(--text-2);
}

@media (max-width: 479px) {
  .hero-top {
    gap: 1.1rem;
  }
  .avatar {
    width: 5rem;
    height: 5rem;
  }
}

/* Pill links ------------------------------------------------------- */

.links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 1.25rem 0 0;
  padding: 0;
  list-style: none;
}

.links li {
  margin: 0;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.45rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text);
  background: var(--bg);
  transition: border-color 120ms ease, color 120ms ease;
}

a.pill:hover {
  border-color: var(--accent);
  color: var(--accent);
  text-decoration: none;
}

.pill svg {
  width: 1rem;
  height: 1rem;
  flex-shrink: 0;
}

/* Sections --------------------------------------------------------- */

.section {
  padding: 3rem 0;
  border-top: 1px solid var(--border);
  scroll-margin-top: calc(var(--nav-h) + 1rem);
}

.section h2 {
  margin-bottom: 1.75rem;
  font-size: 1.5rem;
  letter-spacing: -0.02em;
}

.section-note {
  margin: -1rem 0 1.5rem;
  color: var(--text-2);
}

/* Entries: two-column label / body grid ---------------------------- */

.entry {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.25rem 2rem;
  padding: 1.5rem 0;
}

.entry + .entry {
  border-top: 1px solid var(--border);
}

.entries > .entry:first-child {
  padding-top: 0;
}

.entries > .entry:last-child {
  padding-bottom: 0;
}

.entry-when {
  font-size: 0.875rem;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.entry h3 {
  font-size: 1.1rem;
}

.entry h3 a {
  color: var(--text);
}

.entry h3 a:hover {
  color: var(--accent);
  text-decoration: none;
}

.entry .org {
  margin-bottom: 0.6rem;
  color: var(--text-2);
}

.entry .meta {
  margin-bottom: 0.6rem;
}

.entry p,
.entry ul {
  font-size: 0.95rem;
}

.entry ul {
  padding-left: 1.1rem;
  margin-bottom: 0.9rem;
}

.entry ul li::marker {
  color: var(--text-3);
}

.entry-body > :last-child {
  margin-bottom: 0;
}

.entry.compact {
  padding: 0.9rem 0;
}

@media (min-width: 720px) {
  .entry {
    grid-template-columns: var(--col) 1fr;
  }
  .entry-when {
    padding-top: 0.2rem;
  }
  .entry.compact .entry-when {
    padding-top: 0.1rem;
  }
}

/* Tags ------------------------------------------------------------- */

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.tags li {
  margin: 0;
  padding: 0.2rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-subtle);
  font-size: 0.8rem;
  color: var(--text-2);
  line-height: 1.5;
}

.label {
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-3);
}

/* Meta line -------------------------------------------------------- */

.meta {
  font-size: 0.875rem;
  color: var(--text-3);
}

.meta span + span::before {
  content: "·";
  margin: 0 0.5rem;
}

/* Details / abstract ----------------------------------------------- */

details {
  margin-top: 0.25rem;
}

summary {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--accent);
  list-style: none;
  user-select: none;
}

summary::-webkit-details-marker {
  display: none;
}

summary::before {
  content: "";
  width: 0.45rem;
  height: 0.45rem;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(-45deg);
  transition: transform 150ms ease;
  margin-left: 0.1rem;
}

details[open] summary::before {
  transform: rotate(45deg);
}

summary:hover {
  color: var(--accent-hover);
}

details .details-body {
  margin-top: 0.85rem;
  padding-left: 1rem;
  border-left: 2px solid var(--border);
  color: var(--text-2);
}

details .details-body > :last-child {
  margin-bottom: 0;
}

/* Simple list (focus areas) ---------------------------------------- */

.plain-list {
  padding-left: 1.1rem;
}

/* Page header (blog, posts) ---------------------------------------- */

.page-header {
  padding: 3.5rem 0 2rem;
}

.page-header h1 {
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  letter-spacing: -0.025em;
  margin-bottom: 0.6rem;
}

.page-header .lead {
  font-size: 1.1rem;
  color: var(--text-2);
  max-width: 40rem;
}

/* Prose (long-form post body) -------------------------------------- */

.prose {
  font-size: 1.0625rem;
  line-height: 1.75;
}

.prose p {
  margin-bottom: 1.25rem;
}

.prose h2 {
  margin: 2.25rem 0 0.75rem;
  font-size: 1.4rem;
  letter-spacing: -0.02em;
}

.prose h3 {
  margin: 1.75rem 0 0.5rem;
  font-size: 1.15rem;
}

.prose ul,
.prose ol {
  margin-bottom: 1.25rem;
}

.prose a {
  text-decoration: underline;
}

.prose blockquote {
  margin: 1.5rem 0;
  padding-left: 1rem;
  border-left: 3px solid var(--accent);
  color: var(--text-2);
}

.prose code {
  font-family: var(--font-mono);
  font-size: 0.9em;
  padding: 0.1em 0.35em;
  border-radius: 4px;
  background: var(--bg-subtle);
}

.prose pre {
  margin: 1.5rem 0;
  padding: 1rem 1.15rem;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-subtle);
  font-size: 0.875rem;
  line-height: 1.6;
}

.prose pre code {
  padding: 0;
  background: none;
}

.prose img {
  border-radius: var(--radius);
}

.prose hr {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 2rem 0;
}

.post-footer {
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

.back {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-weight: 500;
}

.back svg,
.more svg {
  width: 1rem;
  height: 1rem;
}

.more {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin-top: 1.5rem;
  font-weight: 500;
}

/* Footer ----------------------------------------------------------- */

.footer {
  margin-top: 2rem;
  padding: 2rem 0 3rem;
  border-top: 1px solid var(--border);
  font-size: 0.875rem;
  color: var(--text-3);
}

.footer .wrap {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.5rem 1.5rem;
}

.footer a {
  color: inherit;
}

.footer a:hover {
  color: var(--accent);
}

/* Snake easter egg (js/snake.js) ----------------------------------- */

.snake {
  position: fixed;
  z-index: 5;
}

.snake canvas {
  display: block;
  background: var(--bg-subtle);
  border-radius: 4px;
  box-shadow: 0 0 0 1px var(--border);
}

.snake-status {
  margin: 0.5rem 0 0;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  line-height: 1.4;
  color: var(--text-3);
}

/* Print ------------------------------------------------------------ */

@media print {
  .nav,
  .footer,
  .skip,
  .snake,
  .more {
    display: none;
  }
  .section {
    padding: 1.25rem 0;
    break-inside: avoid;
  }
  a {
    color: inherit;
    text-decoration: none;
  }
}
