/* =============================================================
   styles.css — single stylesheet for the entire site.
   Read top-to-bottom: variables, base, layout, components, motion.
   ============================================================= */


/* -------------------------------------------------------------
   1. DESIGN TOKENS
   Change a value here and it cascades everywhere.
   ------------------------------------------------------------- */
:root {
  /* Color — dark mode, Apple palette. No accents on purpose. */
  --bg:        #0a0a0a;   /* near-black canvas; gentler than pure #000 on OLED */
  --text:      #f5f5f7;   /* soft off-white; Apple's primary text */
  --muted:     #86868b;   /* medium gray; dates, meta, secondary copy */
  --border:    #1d1d1f;   /* hairline rules and dividers */
  --code-bg:   #141416;   /* subtle lift for inline code and code blocks */

  /* Type — Inter for prose, JetBrains Mono for code. */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;

  /* Spacing scale — multiples of 8px. Use sparingly; consistency > novelty. */
  --space-1:  8px;
  --space-2:  16px;
  --space-3:  24px;
  --space-4:  32px;
  --space-5:  48px;
  --space-6:  64px;
  --space-7:  80px;
  --space-8:  120px;

  /* Layout */
  --max-width: 680px;     /* readable measure; ~70 characters at body size */
  --pad-x:     24px;      /* mobile gutter */

  /* Motion — one easing curve, used everywhere. easeOutExpo. */
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}


/* -------------------------------------------------------------
   2. RESET + BASE
   Strip browser defaults, set the page background and type.
   ------------------------------------------------------------- */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  /* Smoother resize on mobile rotation, no font inflation surprises. */
  -webkit-text-size-adjust: 100%;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 16px;                /* mobile default; bumped on desktop below */
  line-height: 1.5;
  font-weight: 400;
  letter-spacing: -0.005em;       /* very slight tightening for body */
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}


/* -------------------------------------------------------------
   3. PAGE FRAME
   Every page is a single centered column with generous gutters.
   ------------------------------------------------------------- */
.wrap {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--pad-x);
}


/* -------------------------------------------------------------
   4. HEADER + NAV
   Single-line bar: brand left, nav right.
   ------------------------------------------------------------- */
.site-header {
  padding: var(--space-3) 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
  margin-bottom: var(--space-6);
}

.brand {
  font-weight: 600;
  font-size: 17px;
  letter-spacing: -0.02em;
  color: var(--text);
  text-decoration: none;
}

.site-nav {
  display: flex;
  gap: var(--space-3);
}

.site-nav a {
  color: var(--muted);
  text-decoration: none;
  font-size: 15px;
  transition: color 150ms var(--ease);
}

.site-nav a:hover {
  color: var(--text);
}


/* -------------------------------------------------------------
   5. TYPOGRAPHY
   Apple-tight headings; comfortable body.
   ------------------------------------------------------------- */
h1, h2, h3 {
  font-weight: 600;
  color: var(--text);
}

h1 {
  font-size: 36px;
  line-height: 1.1;
  letter-spacing: -0.025em;
  margin-bottom: var(--space-3);
}

h2 {
  font-size: 24px;
  line-height: 1.2;
  letter-spacing: -0.02em;
  margin-top: var(--space-5);
  margin-bottom: var(--space-2);
}

h3 {
  font-size: 19px;
  line-height: 1.3;
  letter-spacing: -0.015em;
  margin-top: var(--space-4);
  margin-bottom: var(--space-2);
}

p {
  margin-bottom: var(--space-3);
  color: var(--text);
}

.intro {
  /* Hero intro paragraph — slightly larger, slightly muted. */
  font-size: 19px;
  color: var(--muted);
  max-width: 560px;
  margin-bottom: var(--space-7);
}

.lede {
  /* Optional one-liner under page h1s. */
  color: var(--muted);
  margin-bottom: var(--space-6);
}


/* -------------------------------------------------------------
   6. LINKS (in prose)
   Underline only on hover, fading in via decoration-color.
   ------------------------------------------------------------- */
.prose a,
.text-link {
  color: var(--text);
  text-decoration: underline;
  text-decoration-color: var(--border);   /* nearly invisible at rest */
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
  transition: text-decoration-color 150ms var(--ease);
}

.prose a:hover,
.text-link:hover {
  text-decoration-color: var(--text);
}


/* -------------------------------------------------------------
   7. POST LIST
   Used on homepage and notes archive — same component, same look.
   Date on the left (muted), title on the right (white).
   ------------------------------------------------------------- */
.post-list {
  list-style: none;
  border-top: 1px solid var(--border);
}

.post-list li {
  border-bottom: 1px solid var(--border);
}

.post-list a {
  display: flex;
  align-items: baseline;
  gap: var(--space-3);
  padding: var(--space-3) 0;
  text-decoration: none;
  color: var(--text);
  /* The hover shift moves the row 4px to the right. */
  transition: padding-left 200ms var(--ease);
  padding-left: 0;
}

.post-list a:hover {
  padding-left: 4px;
}

.post-list time {
  flex-shrink: 0;
  width: 96px;
  color: var(--muted);
  font-size: 14px;
  font-variant-numeric: tabular-nums;   /* dates align in a tidy column */
}

.post-list .post-title {
  font-size: 16px;
  font-weight: 400;
  text-decoration: underline;
  text-decoration-color: transparent;
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
  transition: text-decoration-color 200ms var(--ease);
}

.post-list a:hover .post-title {
  text-decoration-color: var(--text);
}


/* -------------------------------------------------------------
   8. NEWSLETTER BLOCK (homepage)
   Just a label + a slot you'll paste an embed into later.
   ------------------------------------------------------------- */
.newsletter {
  margin-top: var(--space-7);
}

.newsletter-label {
  color: var(--muted);
  font-size: 14px;
  margin-bottom: var(--space-2);
}


/* -------------------------------------------------------------
   9. ARTICLE (blog post body)
   Long-form reading: blockquote, list, code, hr.
   ------------------------------------------------------------- */
.post-meta {
  color: var(--muted);
  font-size: 14px;
  margin-bottom: var(--space-2);
  font-variant-numeric: tabular-nums;
}

.back-link {
  display: inline-block;
  color: var(--muted);
  text-decoration: none;
  font-size: 14px;
  margin-bottom: var(--space-5);
  transition: color 150ms var(--ease);
}

.back-link:hover {
  color: var(--text);
}

.prose {
  /* All long-form content lives inside .prose for tight scoping. */
  font-size: 17px;
}

.prose p,
.prose ul,
.prose ol,
.prose blockquote,
.prose pre {
  margin-bottom: var(--space-3);
}

.prose ul,
.prose ol {
  padding-left: var(--space-3);
}

.prose li {
  margin-bottom: var(--space-1);
}

.prose blockquote {
  border-left: 2px solid var(--border);
  padding-left: var(--space-3);
  color: var(--muted);
  font-style: italic;
}

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

/* Inline code — small lifted chip. */
.prose code {
  font-family: var(--font-mono);
  font-size: 0.875em;          /* match surrounding text size optically */
  background: var(--code-bg);
  border: 1px solid var(--border);
  padding: 1px 6px;
  border-radius: 4px;
}

/* Code block — full-width, scrolls on overflow. */
.prose pre {
  font-family: var(--font-mono);
  font-size: 14px;
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: var(--space-3);
  overflow-x: auto;
  line-height: 1.5;
}

.prose pre code {
  /* Reset chip styling when code lives inside a pre block. */
  background: none;
  border: 0;
  padding: 0;
  border-radius: 0;
  font-size: inherit;
}


/* -------------------------------------------------------------
   10. FOOTER
   Muted, single line, generous top space.
   ------------------------------------------------------------- */
.site-footer {
  margin-top: var(--space-8);
  padding: var(--space-4) 0;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 13px;
}


/* -------------------------------------------------------------
   11. MAIN CONTENT WRAPPER
   Bottom padding to keep the footer separated even on short pages.
   ------------------------------------------------------------- */
main {
  min-height: 60vh;
}


/* =============================================================
   12. DESKTOP — bump type, widen gutters, more vertical air.
   Single breakpoint at 720px keeps things simple.
   ============================================================= */
@media (min-width: 720px) {
  :root {
    --pad-x: 32px;
  }

  body {
    font-size: 17px;
  }

  h1 {
    font-size: 56px;
  }

  h2 {
    font-size: 28px;
  }

  h3 {
    font-size: 21px;
  }

  .intro {
    font-size: 21px;
  }

  .prose {
    font-size: 18px;
  }

  .site-header {
    padding: var(--space-4) 0;
    margin-bottom: var(--space-7);
  }

  .post-list time {
    width: 120px;
  }

  .site-footer {
    margin-top: var(--space-8);
  }
}


/* =============================================================
   13. MOTION
   One easing curve, one duration family. Always opt-out friendly.
   ============================================================= */

/* Page load: each top-level chunk fades + slides up 8px. */
@keyframes rise {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.site-header,
main > * {
  animation: rise 400ms var(--ease) both;
}

/* Stagger the post list items so they arrive after the surrounding chrome. */
.post-list li {
  animation: rise 400ms var(--ease) both;
}
.post-list li:nth-child(1) { animation-delay: 150ms; }
.post-list li:nth-child(2) { animation-delay: 200ms; }
.post-list li:nth-child(3) { animation-delay: 250ms; }
.post-list li:nth-child(4) { animation-delay: 300ms; }
.post-list li:nth-child(5) { animation-delay: 350ms; }
.post-list li:nth-child(6) { animation-delay: 400ms; }
.post-list li:nth-child(7) { animation-delay: 450ms; }
.post-list li:nth-child(8) { animation-delay: 500ms; }
.post-list li:nth-child(9) { animation-delay: 550ms; }
.post-list li:nth-child(n + 10) { animation-delay: 600ms; }

/* Respect users who turn motion off at the OS level. */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
