/*
  Shared styles for the whole site. Linked from every page.
  Colors, fonts, and layout are taken from the STYLE.txt planning doc.
  Light + dark via prefers-color-scheme.
*/

:root {
  /* Fonts */
  --font-serif: "STIX Two Text", Georgia, "Times New Roman", serif;
  --font-sans:  "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono:  "Geist Mono", ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;

  /* Colors — light */
  --bg:            #ffffff;
  --text-copy:     #171717;
  --text-heading:  #000000;
  --text-nav:      #6b7280;
  --text-nav-hover:#000000;
  --muted:         #737373;
  --border:        #e5e5e5;
  --surface:       #f5f5f5;

  --radius: 0.625rem; /* 10px */
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg:            #1a1a1a;
    --text-copy:     #eaeaea;
    --text-heading:  #f2f2f2;
    --text-nav:      #afafaf;
    --text-nav-hover:#f2f2f2;
    --muted:         #a1a1a1;
    --border:        rgba(255, 255, 255, 0.1);
    --surface:       #262626;
  }
}

* { box-sizing: border-box; }

html {
  min-width: 360px;
  scrollbar-gutter: stable;
}

/* Core layout: single narrow centered column with fixed top padding. */
body {
  font-family: var(--font-serif);
  font-size: 17px;      /* his body copy is 17px (.text-copy), not the 16px default */
  background-color: var(--bg);
  color: var(--text-copy);
  max-width: 650px;
  margin: 0 auto;
  padding: 3.5rem 2rem 4rem;   /* 56px top (was 64), 32px sides, 64px bottom */
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Headings — serif (inherited from body). Understated like leerob.com:
   medium weight (500), small sizes, with a responsive bump on the h1. */
h1, h2, h3 {
  color: var(--text-heading);
  font-weight: 500;      /* his headings use font-medium, not semibold */
  line-height: 1.3;
}
h1 { font-size: 1.25rem;  margin: 0 0 0.25rem; }   /* text-xl */
h2 { font-size: 1.125rem; margin: 2.5rem 0 0.75rem; }
h3 { font-size: 1rem;     margin: 2rem 0 0.5rem; }

/* Home content wrapper. Mobile: no extra top margin (his main is mt-0).
   The desktop bump lives in the media query below. */
main { margin-top: 0; }

/* Home title sits in a tall line box, matching his `leading-13` (3.25rem).
   Scoped to `main` so blog-post <h1>s keep their tighter line-height.
   `fit-content` shrink-wraps the box so selecting the name highlights just
   the text, not the full column width. */
main h1 { line-height: 3.25rem; width: fit-content; }

/* Tighten the title -> first-paragraph gap a hair (less than the default
   1.25rem paragraph spacing). */
main h1 + p { margin-top: 0.75rem; }

/* Symmetric 1.25rem paragraph margins (his `my-5`). This also sets the
   gap between the title and the subtitle paragraph. */
p { margin: 1.25rem 0; }

/* Bulleted lists. */
ul { margin: 1.25rem 0; padding-left: 1.5rem; }
li { margin: 0.25rem 0; }

/* His md: breakpoint (768px) — h1 grows text-xl -> text-2xl, and the home
   content block gains a 4rem top margin (his main is mt-0 md:mt-16). */
@media (min-width: 768px) {
  h1 { font-size: 1.5rem; }
  main { margin-top: 4rem; }
}

/* Prose links: subtle underline that darkens on hover. */
a {
  color: var(--text-copy);
  text-decoration: underline;
  text-decoration-color: var(--muted);
  text-underline-offset: 2px;
}
a:hover { text-decoration-color: var(--text-copy); }

/* Writing list on the home page. */
.posts { list-style: none; padding: 0; margin: 0; }
.posts li {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  margin-bottom: 0.75rem;
}
.posts a {
  color: var(--text-heading);
  text-decoration: none;
}
.posts a:hover { text-decoration: underline; text-decoration-color: var(--muted); }
.posts time {
  font-family: var(--font-sans);
  font-size: 0.875rem;
  color: var(--text-nav);
  white-space: nowrap;
}

/* Metadata line under a post title (the date). */
.post-meta {
  font-family: var(--font-sans);
  font-size: 0.875rem;
  color: var(--text-nav);
  margin: 0 0 2.5rem;
}

/* Back link at the top of a post. */
.back {
  font-family: var(--font-sans);
  font-size: 0.875rem;
  color: var(--text-nav);
  text-decoration: none;
  display: inline-block;
  margin-bottom: 2rem;
}
.back:hover { color: var(--text-nav-hover); }

/* Code. */
code {
  font-family: var(--font-mono);
  font-size: 0.875em;
  background: var(--surface);
  padding: 0.15em 0.35em;
  border-radius: 0.3em;
}
pre {
  font-family: var(--font-mono);
  font-size: 0.875rem;
  line-height: 1.5;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  overflow-x: auto;
}
pre code { background: none; padding: 0; font-size: inherit; }

hr { border: none; border-top: 1px solid var(--border); margin: 3rem 0; }

/* Footer. */
footer {
  font-family: var(--font-sans);
  font-size: 0.875rem;
  color: var(--text-nav);
  margin-top: 4rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
}
footer a { color: var(--text-nav); text-decoration: none; }
footer a:hover { color: var(--text-nav-hover); text-decoration: underline; }
