/* Colors live here. Content lives in index.html.
   Palette: warm paper, ink text, oxblood links.

   Alternatives (swap the values below; all pass WCAG AA):
   - Navy:   light --accent #1f3a68 / hover #13264a   dark --accent #9db5e0 / hover #c5d5f0
   - Forest: light --accent #2f5d3a / hover #1d3d25   dark --accent #93c4a0 / hover #bfdcc7
*/
:root {
  --bg: #f3eee4;
  --text: #1f1c18;
  --muted: #5f5a52;
  --rule: #ddd5c6;
  --accent: #8a2d27;
  --accent-hover: #5e1d19;
  --focus: #8a2d27;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1b1915;
    --text: #ebe5d9;
    --muted: #a9a193;
    --rule: #34302a;
    --accent: #e0998d;
    --accent-hover: #f0c2b9;
    --focus: #e0998d;
  }
}

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

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

body {
  margin: 0 auto;
  max-width: 42rem; /* ~672px */
  padding: 4rem 1.25rem 3rem;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  font-size: 1.0625rem;
  line-height: 1.6;
}

/* Typography */
h1,
h2 {
  line-height: 1.25;
  margin: 0;
}

h1 {
  font-size: 1.75rem;
  font-weight: 650;
  letter-spacing: -0.01em;
}

h2 {
  font-size: 0.9375rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin-bottom: 1rem;
}

p {
  margin: 0 0 1rem;
}

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

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

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

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

/* Skip link: hidden until focused */
.skip-link {
  position: absolute;
  inset-inline-start: 1rem;
  top: -3rem;
  padding: 0.25rem 0.5rem;
  background: var(--bg);
}

.skip-link:focus {
  top: 1rem;
}

/* Header */
.site-header {
  margin-bottom: 3rem;
}

.tagline {
  margin: 0.375rem 0 1.25rem;
  color: var(--muted);
}

nav ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.25rem;
}

/* Sections */
main section {
  margin-bottom: 3rem;
}

ul.projects,
ul.links {
  list-style: none;
  margin: 0;
  padding: 0;
}

.projects li {
  margin-bottom: 1.25rem;
}

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

.projects a {
  font-weight: 600;
}

.projects p {
  margin: 0.125rem 0 0;
}

.links li {
  margin-bottom: 0.375rem;
  overflow-wrap: anywhere;
}

/* Footer */
.site-footer {
  border-top: 1px solid var(--rule);
  padding-top: 1.25rem;
  color: var(--muted);
  font-size: 0.9375rem;
}

/* Small screens */
@media (max-width: 480px) {
  body {
    padding-top: 2.5rem;
    font-size: 1rem;
  }

  h1 {
    font-size: 1.5rem;
  }

  .site-header,
  main section {
    margin-bottom: 2.5rem;
  }
}

/* Writing list on the home page */
ul.posts {
  list-style: none;
  margin: 0;
  padding: 0;
}

.posts li {
  display: flex;
  gap: 1rem;
  margin-bottom: 0.5rem;
}

.posts time {
  flex: 0 0 5.5rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

/* Article pages */
.site-header--small {
  margin-bottom: 2.5rem;
  font-weight: 600;
}

.post h1 {
  margin-bottom: 0.25rem;
}

.post-date {
  color: var(--muted);
  margin-bottom: 2rem;
}

.post h2 {
  font-size: 1.25rem;
  text-transform: none;
  letter-spacing: 0;
  color: var(--text);
  margin: 2.25rem 0 0.75rem;
}

.post h3 {
  font-size: 1.0625rem;
  margin: 1.75rem 0 0.5rem;
}

.post ul,
.post ol {
  margin: 0 0 1rem;
  padding-inline-start: 1.5rem;
}

.post blockquote {
  margin: 0 0 1rem;
  padding-inline-start: 1rem;
  border-inline-start: 3px solid var(--rule);
  color: var(--muted);
}

.post img {
  max-width: 100%;
  height: auto;
}

code,
pre {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  font-size: 0.875em;
}

:not(pre) > code {
  padding: 0.1em 0.3em;
  border-radius: 3px;
  background: var(--rule);
}

pre {
  margin: 0 0 1rem;
  padding: 0.875rem 1rem;
  overflow-x: auto;
  border: 1px solid var(--rule);
  border-radius: 4px;
  line-height: 1.5;
}

@media (max-width: 480px) {
  .posts li {
    flex-direction: column;
    gap: 0;
    margin-bottom: 1rem;
  }

  .posts time {
    flex-basis: auto;
    font-size: 0.875rem;
  }
}

/* Writing page */
main > h1 {
  margin-bottom: 2rem;
}

p.empty {
  color: var(--muted);
  margin-bottom: 3rem;
}
