/* ==========================================================================
   romain.page — shared stylesheet (used by every page)
   ========================================================================== */

:root {
  --bg: #000;
  --fg: #e6e6e6;
  --muted: #9a9a9a;
  --faint: #555;
  --link: #4ea1ff;
  --panel: #0b0b0b;
  --border: #222;

  /* syntax colors for code blocks */
  --code-keyword: #f5a35b;
  --code-type: #4fc1ff;
  --code-string: #a6e22e;
  --code-punct: #bdbdbd;

  --font-mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  color-scheme: dark;
}

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 400 16px/1.8 var(--font-mono);
}

/* ---------- layout ---------- */

.container {
  max-width: 760px;
  margin: 0 auto;
  padding: 32px 16px 64px;
}

.site-header { margin-bottom: 72px; }

.site-nav ul {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 24px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.site-nav a { color: var(--muted); }
.site-nav a[aria-current="page"] { color: var(--fg); }

.site-footer {
  margin-top: 72px;
  font-size: 13px;
}

.site-footer p { color: var(--faint); }

/* ---------- typography ---------- */

h1 {
  margin: 0 0 16px;
  font-size: 28px;
  font-weight: 600;
  line-height: 1.3;
}

p {
  margin: 0 0 12px;
  color: var(--muted);
}

p strong {
  color: var(--fg);
  font-weight: 400;
}

a {
  color: var(--link);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 5px;
}

a:hover { color: var(--fg); }

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

/* ---------- code block ---------- */

.code {
  margin: 40px 0 0;
  padding: 20px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 6px;
  font: inherit;
  /* Zooms out on narrow screens so the longest line (~55 chars) always fits:
     available width = 100vw - page gutters - block padding; 1 char ≈ 0.6em. */
  font-size: min(15px, calc((100vw - 64px) / 34));
  line-height: 1.7;
  white-space: pre;
  overflow-x: auto; /* safety net only, should never be needed */
}

.code .k { color: var(--code-keyword); }
.code .t { color: var(--code-type); }
.code .s { color: var(--code-string); }
.code .p { color: var(--code-punct); }

/* ---------- small screens ---------- */

@media (max-width: 600px) {
  body { font-size: 14px; line-height: 1.7; }
  .container { padding: 20px 16px 40px; }
  .site-header { margin-bottom: 40px; }
  h1 { font-size: 22px; margin-bottom: 12px; }
  .code { margin-top: 28px; padding: 14px 12px; }
  .site-footer { margin-top: 48px; font-size: 12px; }
}
