/* Värit ja mitat: muuta näitä ensin, jos haluat vaihtaa ilmettä */
:root {
  --paper: #f4f6f9;
  --ink: #1a2230;
  --muted: #566274;
  --rule: #d5dbe4;
  --accent: #2748c9;
  --code-bg: #e8ecf2;
  --measure: 38rem;

  --serif: Charter, "Bitstream Charter", "Sitka Text", Cambria, Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #12161d;
    --ink: #e6eaf0;
    --muted: #97a3b5;
    --rule: #2a3340;
    --accent: #8fa8ff;
    --code-bg: #1c232e;
  }
}

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

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 1.125rem;
  line-height: 1.7;
}

a { color: var(--accent); text-underline-offset: 0.18em; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; border-radius: 2px; }

.skip {
  position: absolute; left: -999px; top: 0;
  background: var(--ink); color: var(--paper); padding: 0.5rem 1rem;
}
.skip:focus { left: 0; z-index: 10; }

/* Rakenne */
.site-header, main, .site-footer {
  width: min(100% - 2.5rem, var(--measure));
  margin-inline: auto;
}

.site-header {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem 1.5rem;
  padding-block: 2rem 1.25rem;
  border-bottom: 1px solid var(--rule);
  font-family: var(--sans);
}

.site-title {
  color: var(--ink);
  font-weight: 700;
  font-size: 1.1rem;
  text-decoration: none;
}

.site-header nav { display: flex; gap: 1.25rem; font-size: 0.95rem; }
.site-header nav a { color: var(--muted); text-decoration: none; }
.site-header nav a:hover { color: var(--ink); text-decoration: underline; }

main { padding-block: 3rem 4rem; }

.site-footer {
  padding-block: 1.5rem 3rem;
  border-top: 1px solid var(--rule);
  color: var(--muted);
  font-family: var(--sans);
  font-size: 0.9rem;
}

/* Etusivu */
.intro h1 {
  margin: 0 0 0.5rem;
  font-size: clamp(2.2rem, 7vw, 3.4rem);
  line-height: 1.1;
  letter-spacing: -0.02em;
}
.intro p { margin: 0 0 3rem; color: var(--muted); font-size: 1.2rem; }

.post-list { list-style: none; margin: 0; padding: 0; }
.post-list li { padding-block: 1.6rem; border-top: 1px solid var(--rule); }
.post-list li:first-child { border-top: 0; padding-top: 0; }
.post-list time { font-family: var(--sans); font-size: 0.875rem; color: var(--muted); }
.post-list h2 { margin: 0.1rem 0 0.35rem; font-size: 1.55rem; line-height: 1.25; }
.post-list h2 a { color: var(--ink); text-decoration: none; }
.post-list h2 a:hover { color: var(--accent); text-decoration: underline; }
.post-list p { margin: 0; color: var(--muted); }

/* Kirjoitus */
.post-header { margin-bottom: 2.5rem; }
.post-header h1 {
  margin: 0 0 0.75rem;
  font-size: clamp(2rem, 6vw, 2.9rem);
  line-height: 1.15;
  letter-spacing: -0.02em;
}
.meta { margin: 0; font-family: var(--sans); font-size: 0.9rem; color: var(--muted); }

.tags { display: flex; flex-wrap: wrap; gap: 0.5rem; list-style: none; margin: 1rem 0 0; padding: 0; font-family: var(--sans); font-size: 0.8rem; }
.tags li { padding: 0.1rem 0.6rem; border: 1px solid var(--rule); border-radius: 999px; color: var(--muted); }

/* Markdownista tuleva sisältö */
.prose > * + * { margin-top: 1.25em; }
.prose h2 { margin-top: 2.2em; font-size: 1.6rem; line-height: 1.25; }
.prose h3 { margin-top: 1.8em; font-size: 1.25rem; line-height: 1.3; }
.prose h2 + *, .prose h3 + * { margin-top: 0.6em; }

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

.prose blockquote {
  margin-inline: 0;
  padding-left: 1.25rem;
  border-left: 3px solid var(--accent);
  color: var(--muted);
  font-style: italic;
}

.prose code {
  padding: 0.12em 0.35em;
  background: var(--code-bg);
  border-radius: 4px;
  font-family: var(--mono);
  font-size: 0.85em;
}
.prose pre {
  overflow-x: auto;
  padding: 1rem 1.25rem;
  background: var(--code-bg);
  border-radius: 6px;
  line-height: 1.5;
}
.prose pre code { padding: 0; background: none; font-size: 0.9rem; }

.prose table { width: 100%; border-collapse: collapse; font-family: var(--sans); font-size: 0.95rem; display: block; overflow-x: auto; }
.prose th, .prose td { padding: 0.5rem 0.75rem; border-bottom: 1px solid var(--rule); text-align: left; }
.prose th { border-bottom-width: 2px; }

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

.prose .footnote { margin-top: 3rem; font-size: 0.9rem; color: var(--muted); }
.prose .footnote hr { margin-block: 1rem; }

/* Edellinen / seuraava */
.pager {
  display: grid;
  gap: 0.75rem;
  margin-top: 4rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--rule);
  font-family: var(--sans);
  font-size: 0.95rem;
}

@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}

@media print {
  .site-header nav, .pager, .skip { display: none; }
  body { background: #fff; color: #000; }
}
