/* poroto — quiet, single-column, system type */

:root {
  --bg: #fbfbfa;
  --text: #1f1f1f;
  --muted: #6b6b6b;
  --line: #e6e6e3;
  --code-bg: #f2f2ef;
  --link: #1f1f1f;
  --scan: rgba(0, 0, 0, 0.045);
  --vignette: rgba(0, 0, 0, 0.08);
  --glow: transparent;

  --f-body: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --f-mono: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;

  --max: 40rem;
  --gutter: 1.25rem;

  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #151515;
    --text: #e4e4e2;
    --muted: #9a9a97;
    --line: #2a2a29;
    --code-bg: #1e1e1d;
    --link: #e4e4e2;
    --scan: rgba(0, 0, 0, 0.22);
    --vignette: rgba(0, 0, 0, 0.45);
    --glow: rgba(228, 228, 226, 0.18);
  }
}

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

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

body {
  margin: 0 auto;
  max-width: calc(var(--max) + var(--gutter) * 2);
  padding: 0 var(--gutter);
  background: var(--bg);
  color: var(--text);
  font-family: var(--f-body);
  font-size: 1rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-shadow: 0 0 0.35em var(--glow);
}

/* ---------- CRT overlay: scanlines, vignette, faint flicker ---------- */

body::before,
body::after {
  content: "";
  position: fixed; inset: 0; z-index: 1000;
  pointer-events: none;
}
body::before {
  background: repeating-linear-gradient(to bottom, transparent 0 2px, var(--scan) 2px 3px);
  animation: crt-flicker 6s steps(1) infinite;
}
body::after {
  background: radial-gradient(ellipse at center, transparent 60%, var(--vignette) 100%);
}

@keyframes crt-flicker {
  0%, 100% { opacity: 1; }
  47% { opacity: 0.85; }
  48% { opacity: 1; }
  83% { opacity: 0.9; }
  84% { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  body::before { animation: none; }
}

a {
  color: var(--link);
  text-decoration: underline;
  text-decoration-color: var(--line);
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
  transition: text-decoration-color 0.15s;
}
a:hover { text-decoration-color: currentColor; }
:focus-visible { outline: 2px solid currentColor; outline-offset: 2px; }

h1, h2, h3 { font-weight: 600; line-height: 1.3; letter-spacing: -0.01em; }
h1 { font-size: 1.5rem; margin: 0 0 0.5rem; }
h2 { font-size: 1rem; margin: 0 0 1rem; }

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

.muted { color: var(--muted); }

.skip { position: absolute; left: -999px; top: 0; background: var(--text); color: var(--bg); padding: 0.5rem 1rem; }
.skip:focus { left: 1rem; top: 1rem; }

/* ---------- header / footer ---------- */

.header {
  display: flex; justify-content: space-between; align-items: baseline;
  padding: 2.5rem 0 3.5rem;
}
.header a { text-decoration: none; }
.brand { font-weight: 600; }
.header nav { display: flex; gap: 1.25rem; }
.header nav a { color: var(--muted); }
.header nav a:hover,
.header nav a[aria-current="page"] { color: var(--text); }

.footer {
  display: flex; justify-content: space-between; align-items: baseline; flex-wrap: wrap; gap: 1rem;
  margin-top: 5rem; padding: 2rem 0 3rem;
  border-top: 1px solid var(--line);
  color: var(--muted); font-size: 0.875rem;
}
.footer p { margin: 0; }
.footer ul { list-style: none; margin: 0; padding: 0; display: flex; gap: 1.25rem; }
.footer a { color: var(--muted); text-decoration: none; }
.footer a:hover { color: var(--text); }

/* ---------- home ---------- */

.intro p { margin: 0 0 1rem; }
.intro .lead { font-size: 1.125rem; }

.section { margin-top: 3.5rem; }

.work-list,
.post-list { list-style: none; margin: 0; padding: 0; }

.work-list li + li { margin-top: 1.25rem; }
.work-head { display: flex; justify-content: space-between; gap: 1rem; }
.work-list p { margin: 0.15rem 0 0; font-size: 0.9375rem; }

.post-row {
  display: flex; justify-content: space-between; align-items: baseline; gap: 1rem;
  padding: 0.4rem 0;
}
.post-row time { color: var(--muted); font-size: 0.875rem; white-space: nowrap; font-variant-numeric: tabular-nums; }

.more { font-size: 0.9375rem; }

/* ---------- post ---------- */

.post-head { margin-bottom: 2.5rem; }
.post-head p { margin: 0; font-size: 0.9375rem; }

.prose { font-size: 1.0625rem; line-height: 1.75; }
.prose > * + * { margin-top: 1.25em; }
.prose > :first-child { margin-top: 0; }
.prose p, .prose ul, .prose ol, .prose pre, .prose blockquote, .prose table { margin-bottom: 0; }
.prose h2 { font-size: 1.25rem; margin: 2.25em 0 0; }
.prose h3 { font-size: 1.0625rem; margin: 2em 0 0; }
.prose ul, .prose ol { padding-left: 1.25rem; }
.prose li + li { margin-top: 0.35em; }
.prose code { font-family: var(--f-mono); font-size: 0.875em; }
.prose :not(pre) > code { background: var(--code-bg); padding: 0.1em 0.3em; border-radius: 3px; }
.prose pre {
  background: var(--code-bg); padding: 1rem 1.125rem; border-radius: 4px;
  overflow-x: auto; line-height: 1.55; font-size: 0.9375rem;
}
.prose blockquote { margin-inline: 0; padding-left: 1rem; border-left: 2px solid var(--line); color: var(--muted); }
.prose hr { border: 0; border-top: 1px solid var(--line); margin-block: 2.5em; }
.prose table { width: 100%; border-collapse: collapse; font-size: 0.9375rem; display: block; overflow-x: auto; }
.prose th, .prose td { padding: 0.5rem 0.75rem 0.5rem 0; border-bottom: 1px solid var(--line); text-align: left; }
.prose th { font-weight: 600; }
.prose img { border-radius: 4px; }

.post-foot { margin-top: 3.5rem; font-size: 0.9375rem; }

@media (max-width: 480px) {
  .header { padding: 1.75rem 0 2.5rem; }
  .post-row { flex-direction: column; gap: 0; }
}
