/* Roquib blog: cool neutrals with a teal accent, system fonts, dark mode via prefers-color-scheme. */

:root {
  --bg: #f7f8fa;
  --surface: #ffffff;
  --text: #17202a;
  --muted: #5b6573;
  --accent: #0d9488;
  --accent-ink: #0f766e;
  --border: #e3e7ee;
  --code-bg: #0f172a;
  --code-text: #e2e8f0;
  --font-body: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, "SFMono-Regular", Menlo, Consolas, "Liberation Mono", monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b1120;
    --surface: #111a2e;
    --text: #e6edf6;
    --muted: #8b98ab;
    --accent: #2dd4bf;
    --accent-ink: #5eead4;
    --border: #1e2a40;
    --code-bg: #070d1a;
    --code-text: #d6e2f0;
  }
}

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 17px/1.7 var(--font-body);
}

img,
svg,
video {
  display: block;
  max-width: 100%;
  height: auto;
}

a {
  color: var(--accent-ink);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.wrap {
  max-width: 760px;
  margin: 0 auto;
  padding: 0 1.25rem;
}

/* Header */

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}

.bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 3.5rem;
}

.brand {
  color: var(--text);
  font-size: 1.1rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.brand::before {
  content: "";
  display: inline-block;
  width: 0.6rem;
  height: 0.6rem;
  margin-right: 0.5rem;
  vertical-align: 0.05em;
  border-radius: 50%;
  background: var(--accent);
}

.brand:hover {
  text-decoration: none;
}

nav {
  display: flex;
  gap: 1.1rem;
  font-size: 0.95rem;
}

nav a {
  color: var(--muted);
}

nav a:hover {
  color: var(--text);
  text-decoration: none;
}

/* Set on main.wrap, after .wrap, so the top and bottom spacing isn't reset by .wrap's padding shorthand. */
main.wrap {
  min-height: 70vh;
  padding-top: 3rem;
  padding-bottom: 4rem;
}

/* Home */

.lede {
  max-width: 36ch;
  margin: 0 0 2.5rem;
  color: var(--muted);
  font-size: 1.15rem;
}

.post-list {
  display: grid;
  gap: 1rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.post-card {
  padding: 1.25rem 1.4rem;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  transition: border-color 0.15s, transform 0.15s;
}

.post-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}

.post-card a {
  color: inherit;
}

.post-card a:hover {
  text-decoration: none;
}

.post-card h2 {
  margin: 0 0 0.35rem;
  font-size: 1.3rem;
  line-height: 1.3;
  letter-spacing: -0.01em;
}

.post-card p {
  margin: 0 0 0.6rem;
  color: var(--muted);
}

/* Post and page content */

time.meta {
  color: var(--muted);
  font-size: 0.9rem;
}

.post-header {
  margin-bottom: 2.25rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
}

.post-header h1 {
  margin: 0 0 0.6rem;
  font-size: clamp(2rem, 5vw, 2.6rem);
  line-height: 1.15;
  letter-spacing: -0.03em;
}

article h1 {
  margin: 0 0 1.5rem;
  font-size: clamp(2rem, 5vw, 2.6rem);
  line-height: 1.15;
  letter-spacing: -0.03em;
}

article h2 {
  margin: 2.5rem 0 0.75rem;
  font-size: 1.6rem;
  letter-spacing: -0.02em;
}

article h3 {
  margin: 2rem 0 0.5rem;
  font-size: 1.25rem;
}

article h4 {
  margin: 1.5rem 0 0.4rem;
  font-size: 1.05rem;
}

article :is(h2, h3, h4) a {
  color: inherit;
  text-decoration: none;
}

article p,
article ul,
article ol {
  margin: 0 0 1.2rem;
}

article ul,
article ol {
  padding-left: 1.4rem;
}

article li + li {
  margin-top: 0.3rem;
}

article a {
  text-decoration: underline;
  text-decoration-color: color-mix(in srgb, var(--accent) 50%, transparent);
  text-underline-offset: 3px;
}

article a:hover {
  text-decoration-color: var(--accent);
}

blockquote {
  margin: 1.5rem 0;
  padding: 0.25rem 1.1rem;
  border-left: 3px solid var(--accent);
  color: var(--muted);
}

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

figure {
  margin: 1.75rem 0;
}

/* Portrait on the About page, floated right so the intro text wraps around it. */
article img.about-ava {
  float: right;
  width: 128px;
  height: 128px;
  margin: 0 0 1rem 1.5rem;
  border-radius: 50%;
  border: 3px solid var(--border);
  object-fit: cover;
}

figure img {
  margin: 0 auto;
  border-radius: 10px;
}

figcaption {
  margin-top: 0.5rem;
  color: var(--muted);
  font-size: 0.85rem;
  text-align: center;
}

figure.code-block figcaption {
  margin: 0 0 0.5rem;
  text-align: left;
}

code {
  padding: 0.1em 0.35em;
  border-radius: 5px;
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  font-family: var(--font-mono);
  font-size: 0.88em;
}

pre {
  margin: 0;
  padding: 1.1rem 1.25rem;
  overflow-x: auto;
  border-radius: 12px;
  background: var(--code-bg);
  color: var(--code-text);
  font-size: 0.88rem;
  line-height: 1.55;
}

pre code {
  padding: 0;
  background: none;
  color: inherit;
  font-size: inherit;
}

/* highlight.js token colours, same on light and dark pages because code blocks stay dark */
.hljs-keyword,
.hljs-selector-tag,
.hljs-built_in {
  color: #f0abfc;
}

.hljs-string,
.hljs-attr {
  color: #86efac;
}

.hljs-comment {
  color: #64748b;
  font-style: italic;
}

.hljs-number,
.hljs-literal {
  color: #fca5a5;
}

.hljs-title,
.hljs-function {
  color: #7dd3fc;
}

.hljs-type,
.hljs-class .hljs-title {
  color: #fde68a;
}

.admonition {
  margin: 1.5rem 0;
  padding: 0.9rem 1.1rem;
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  border-radius: 12px;
  background: var(--surface);
}

.admonition > div > :last-child {
  margin-bottom: 0;
}

.admonition-title {
  margin: 0 0 0.3rem;
  color: var(--accent-ink);
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.admonition.warn {
  border-left-color: #d97706;
}

.admonition.warn .admonition-title {
  color: #b45309;
}

.admonition.quiz {
  border-left-color: #7c3aed;
}

.admonition.quiz .admonition-title {
  color: #6d28d9;
}

.post-footer,
.back {
  margin-top: 2.5rem;
  font-size: 0.95rem;
}

/* Footer */

.site-footer {
  padding: 2rem 0;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.9rem;
}

.site-footer p {
  margin: 0.2rem 0;
}

@media (prefers-reduced-motion: reduce) {
  .post-card {
    transition: none;
  }
}

@media (max-width: 480px) {
  body {
    font-size: 16px;
  }

  .bar {
    flex-direction: column;
    align-items: flex-start;
    padding: 0.75rem 0;
  }
}
