/* Swiss typographic index — one objective grid, one signal mark.
   Light: poster white ground, black akzidenz ink, one red.
   Dark:  true black ground, white ink, one red. */

:root {
  --white: #ffffff;
  --ink: #0a0a0a;
  --red: #e31e24;
  --rule: #0a0a0a;
  --muted: #6b6b6b;
  --code-bg: #f1f1f1;
  --font: "Source Sans Pro", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}

[data-theme="dark"] {
  --white: #0a0a0a;
  --ink: #f5f5f5;
  --red: #ff454b;
  --rule: #f5f5f5;
  --muted: #9a9a9a;
  --code-bg: #1c1c1c;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  font-family: var(--font);
  font-weight: 400;
  font-size: 16px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--white);
  transition: background 0.15s ease, color 0.15s ease;
}

/* ---- Grid shell ---- */
header {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: baseline;
  gap: 1rem;
  padding: 1.25rem 2rem;
  border-bottom: 2px solid var(--rule);
  max-width: 88ch;
  margin: 0 auto;
}
header a { color: var(--ink); text-decoration: none; }
.name {
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}
.theme-toggle {
  background: none;
  border: none;
  cursor: pointer;
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  color: var(--muted);
  padding: 0;
}
.theme-toggle:hover { color: var(--ink); }

main {
  max-width: 88ch;
  margin: 0 auto;
  padding: 4rem 2rem 7rem;
}

/* ---- Post page ---- */
main h1 {
  font-size: clamp(2.4rem, 6vw, 4.4rem);
  font-weight: 700;
  line-height: 1.02;
  letter-spacing: -0.02em;
  margin: 0 0 0.5rem;
}
.post-date {
  font-family: var(--mono);
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin: 0 0 2.5rem;
  display: block;
}

.content { font-size: 1.05rem; line-height: 1.7; }
.content > *:first-child { margin-top: 0; }
.content p { margin: 0 0 1.25em; }
.content h2 {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: 2.5rem 0 0.75rem;
  padding-bottom: 0.35rem;
  border-bottom: 1px solid var(--rule);
}
.content h3 {
  font-size: 1.2rem;
  font-weight: 600;
  margin: 2rem 0 0.5rem;
}
.content ul, .content ol {
  margin: 0 0 1.25em;
  padding-left: 1.4em;
}
.content li { margin-bottom: 0.35em; }
.content a { color: var(--red); text-decoration: none; }
.content a:hover { text-decoration: underline; }
.content code {
  font-family: var(--mono);
  font-size: 0.88em;
  background: var(--code-bg);
  padding: 0.1em 0.35em;
  border-radius: 2px;
}
.content pre {
  background: var(--code-bg);
  padding: 1rem 1.1rem;
  overflow-x: auto;
  border-radius: 3px;
  margin: 0 0 1.5em;
}
.content pre code { background: none; padding: 0; }
.content blockquote {
  margin: 0 0 1.5em;
  padding: 0.4rem 0 0.4rem 1rem;
  border-top: 1px solid var(--red);
  border-bottom: 1px solid var(--rule);
  color: var(--muted);
  font-style: normal;
}
.content img { max-width: 100%; }

/* ---- Index ---- */
.list { list-style: none; margin: 0; padding: 0; }
.list li {
  display: grid;
  grid-template-columns: 9ch 1fr;
  gap: 1.5rem;
  align-items: baseline;
  padding: 1.1rem 0;
  border-top: 1px solid var(--rule);
}
.list li > h2,
.list li > p { grid-column: 2; }
.list li > time { grid-column: 1; text-align: right; }
.list h2 { margin: 0; font-size: 1.35rem; font-weight: 600; letter-spacing: -0.01em; }
.list h2 a { color: var(--ink); text-decoration: none; }
.list h2 a:hover { color: var(--red); }
.list time {
  font-family: var(--mono);
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  color: var(--muted);
}
.list p { margin: 0.25rem 0 0; color: var(--muted); font-size: 0.95rem; }

@media (max-width: 600px) {
  header { padding: 1rem 1.25rem; }
  main { padding: 2.5rem 1.25rem 5rem; }
  .list li { grid-template-columns: 1fr; gap: 0.1rem; padding: 0.9rem 0; }
  .list li > h2,
  .list li > p { grid-column: 1; }
  .list li > time { grid-column: 1; text-align: left; }
  .list h2 { font-size: 1.15rem; }
  .list p { font-size: 0.88rem; }
}

/* ---- Browser surfaces ---- */
::selection { background: var(--red); color: var(--white); }
:focus-visible { outline: 2px solid var(--red); outline-offset: 2px; }