/* djoubert.co.uk: one stylesheet, two skins.
   Light (the default) follows design A: teal banner, plain headings, pills.
   Dark follows design B: terminal prompts, amber tags.
   prefers-color-scheme picks the skin. There is no toggle: remembering a manual choice
   would need a script, and this site has none. Order matters: shared rules, then
   light-only, then dark-only, then the phone layout, then dark phone tweaks. */

:root {
  color-scheme: light dark;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  --bg: #ffffff;
  --ink: #1d2021;
  --muted: #5f5750;
  --rule: #d9d4cc;
  --accent: #2CB494; /* StarCraft 1 teal */
  --on-accent: #0b1f1a;
  --link: #1F7E68;
  --link-hover: #145c4b;
  --chip-bg: #dff3ed;
  --chip-ink: #145c4b;
  --panel: #f3f7f5;
  --prompt: #1F7E68;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e1719;
    --ink: #d5e3df;
    --muted: #8ea39d;
    --rule: #24373b;
    --link: #4fd0ae;
    --link-hover: #8fe3cb;
    --chip-bg: transparent;
    --chip-ink: #e3b04b;
    --panel: #132226;
    --prompt: #2CB494;
  }
}

/* Copy that differs between skins is in the HTML twice; CSS shows one. display:none
   also keeps screen readers to the visible version. */
@media not all and (prefers-color-scheme: dark) {
  .dark-only { display: none !important; }
}
@media (prefers-color-scheme: dark) {
  .light-only { display: none !important; }
}

/* ── shared ─────────────────────────────────────────────────────────────── */

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; font-family: var(--mono); font-size: 16px; line-height: 1.65; background: var(--bg); color: var(--ink); -webkit-text-size-adjust: 100%; overflow-wrap: anywhere; } /* long identifiers in titles must wrap, not scroll the page */
a { color: var(--link); text-decoration: none; }
a:hover { color: var(--link-hover); text-decoration: underline; }

.site-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 4px 24px; padding: 10px 32px; }
.brand { display: flex; align-items: center; gap: 14px; font-weight: 700; font-size: 18px; }
.brand img { width: 44px; height: 44px; border-radius: 50%; border: 2px solid var(--on-accent); object-fit: cover; }
.nav { display: flex; flex-wrap: wrap; align-items: center; gap: 22px; }
.icons { display: flex; align-items: center; gap: 2px; margin-left: 8px; }
.icons a { display: flex; padding: 10px; }
.icons svg { width: 21px; height: 21px; fill: currentColor; }

.page { width: min(920px, calc(100% - 64px)); margin: 0 auto; padding-top: 56px; display: flex; flex-direction: column; gap: 56px; }
.page.post { gap: 32px; }
.block { display: flex; flex-direction: column; gap: 18px; }
.block p { margin: 0; }
.sec { margin: 0; font-size: 22px; line-height: 1.3; }
.more { align-self: flex-start; }

.hero-row { display: flex; align-items: center; gap: 24px; }
.hero-avatar { width: 72px; height: 72px; border: 1px solid var(--accent); object-fit: cover; }
.hero-id { display: flex; flex-direction: column; gap: 4px; }
.hero h1 { margin: 0; font-size: 34px; line-height: 1.2; letter-spacing: -0.01em; }
.hero.not-found h1 { font-size: 28px; }
.tagline { color: var(--muted); }
.lede { font-size: 19px; line-height: 1.65; }

.chip { display: inline-block; font-size: 13px; line-height: 1.6; border-radius: 10px; padding: 0 8px; background: var(--chip-bg); color: var(--chip-ink); white-space: nowrap; }

.tools { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 18px; }
.tools li { display: grid; grid-template-columns: max-content minmax(0, 1fr); grid-template-areas: "name status" "desc desc"; column-gap: 12px; row-gap: 2px; align-items: center; }
.tool-name { grid-area: name; font-weight: 700; }
.tools .status { grid-area: status; justify-self: start; }
.tools .tool-desc { grid-area: desc; margin: 0; color: var(--muted); }

.man-head { display: flex; justify-content: space-between; color: var(--muted); }
.caps { margin: 0; display: grid; grid-template-columns: 180px minmax(0, 1fr); column-gap: 32px; row-gap: 14px; }
.caps dt { font-weight: 700; }
.caps dd { margin: 0; }

.posts { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.posts li { display: grid; grid-template-columns: 130px minmax(0, 1fr) max-content; column-gap: 20px; align-items: baseline; }
.date { color: var(--muted); }
.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.empty { color: var(--muted); }

.archive { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.archive li { display: grid; grid-template-columns: 130px minmax(0, 1fr); column-gap: 20px; }
.archive a { font-weight: 700; }
.archive span { color: var(--muted); }

.timeline { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 22px; }
.timeline li { display: grid; grid-template-columns: 150px minmax(0, 1fr); column-gap: 24px; }
.years { color: var(--muted); white-space: nowrap; }
.role { font-weight: 700; }
.at::before { content: ", "; color: var(--ink); }
.timeline .job-desc { margin: 2px 0 0; color: var(--muted); }

.cursor { display: flex; align-items: center; gap: 8px; color: var(--prompt); }
.cursor i { display: inline-block; width: 10px; height: 20px; background: var(--accent); }

.site-foot { width: min(920px, calc(100% - 64px)); margin: 72px auto 0; padding: 20px 0 32px; border-top: 1px solid var(--rule); display: flex; justify-content: space-between; gap: 8px; color: var(--muted); font-size: 14px; }

/* post */
.back { align-self: flex-start; font-size: 14px; }
.post-head { display: flex; flex-direction: column; gap: 10px; }
.post-title { margin: 8px 0 0; font-size: 34px; line-height: 1.2; letter-spacing: -0.01em; }
.meta { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.toc { border: 1px solid var(--rule); border-radius: 4px; padding: 16px 24px; }
.toc-title { font-weight: 700; margin-bottom: 6px; }
.toc ol { margin: 0; padding-left: 28px; display: flex; flex-direction: column; gap: 3px; }
.article { display: flex; flex-direction: column; gap: 18px; line-height: 1.75; }
.article p, .article ul, .article ol { margin: 0; }
.article h2 { margin: 24px 0 0; font-size: 22px; line-height: 1.3; }
.article h3 { margin: 16px 0 0; font-size: 18px; line-height: 1.3; }
.article :not(pre) > code { background: var(--panel); padding: 1px 4px; }
.article hr { width: 30%; border: 0; border-top: 1px solid var(--rule); margin: 24px auto; }
.image { margin: 8px 0; }
.image img { display: block; max-width: 100%; height: auto; margin: 0 auto; }
.code { margin: 8px 0; border: 1px solid var(--rule); border-radius: 4px; overflow: hidden; }
.code figcaption { display: flex; justify-content: space-between; padding: 4px 12px; font-size: 13px; background: var(--chip-bg); color: var(--chip-ink); }
.code pre { margin: 0; padding: 12px 16px 12px 0; background: var(--panel); font-size: 14px; line-height: 1.6; overflow-x: auto; overflow-wrap: normal; tab-size: 4; }
.code code { counter-reset: ln; font-family: inherit; }
/* Line numbers are generated content, so copying code never copies them. */
.ln::before { counter-increment: ln; content: counter(ln); display: inline-block; width: 44px; padding-right: 12px; margin-right: 16px; text-align: right; color: var(--muted); border-right: 1px dotted var(--muted); }
.quote { margin: 24px auto; max-width: 80%; padding: 12px 0; border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); color: var(--muted); text-align: center; }
.quote p + p { margin-top: 12px; }

/* ── light only (design A) ──────────────────────────────────────────────── */

@media not all and (prefers-color-scheme: dark) {
  .site-head { background: var(--accent); color: var(--on-accent); }
  .site-head a, .site-head a:hover { color: var(--on-accent); }
  .meta .date { font-style: italic; }
}

/* ── dark only (design B) ───────────────────────────────────────────────── */

@media (prefers-color-scheme: dark) {
  .site-head { padding: 8px 32px; border-bottom: 1px solid var(--rule); }
  .site-head .brand { color: var(--prompt); font-size: 16px; }
  .nav-link { text-transform: lowercase; }
  .nav-link::before { content: "["; }
  .nav-link::after { content: "]"; }
  .icons a { color: var(--muted); }

  .sec { font-size: 16px; font-weight: 400; color: var(--muted); }
  .sec .cmd::before { content: "$ "; color: var(--prompt); }
  .hero h1 { font-size: 44px; letter-spacing: -0.02em; }
  .tagline { text-transform: lowercase; }
  .lede { font-size: 18px; line-height: 1.7; }

  .chip { font-size: 15px; padding: 0; }
  .status::before { content: "["; }
  .status::after { content: "]"; }
  .tag::before { content: "#"; }
  .tags { gap: 10px; }

  .tools { background: var(--panel); border: 1px solid var(--rule); padding: 16px 20px; gap: 14px; }
  .tools li { grid-template-columns: 200px minmax(0, 1fr) 150px; grid-template-areas: "name desc status"; column-gap: 24px; align-items: start; }
  .tools .status { justify-self: end; }
  .tools .tool-desc { color: var(--ink); }
  .tool-name { text-transform: lowercase; }
  .tool-name::after { content: "/"; }
  span.tool-name { color: var(--muted); }

  .caps { display: block; }
  .caps dt { text-transform: uppercase; }
  .caps dd { margin: 0 0 14px 48px; }

  .archive a::after { content: "/"; }
  .at { color: var(--prompt); }
  .at::before { content: " @ "; color: var(--muted); }
  .timeline .job-desc { color: var(--ink); }

  .site-foot { text-transform: lowercase; }

  .post-title { font-size: 38px; letter-spacing: -0.02em; }
  .post-title::before { content: "# "; color: var(--prompt); }
  .toc { background: var(--panel); border-radius: 0; }
  .toc-title { font-weight: 400; color: var(--muted); text-transform: lowercase; }
  .toc-title::before { content: "## "; }
  .article h2::before { content: "## "; color: var(--prompt); }
  .article h3::before { content: "### "; color: var(--prompt); }
  .article :not(pre) > code { background: none; padding: 0; color: var(--chip-ink); }
  .code { background: var(--panel); border-radius: 0; }
  .code figcaption { background: none; color: var(--muted); border-bottom: 1px solid var(--rule); padding: 6px 16px; }
  .code figcaption > :first-child::before { content: "── "; }
  .code figcaption > :first-child::after { content: " ──"; }
  .code .file + .lang { display: none; }
  .ln::before { border-right: none; }
  .quote { margin: 16px 0; max-width: none; padding: 0; border: none; text-align: left; font-style: italic; }
  .quote p::before { content: "> "; color: var(--prompt); font-style: normal; }
}

/* ── phone ──────────────────────────────────────────────────────────────── */

@media (max-width: 720px) {
  .site-head { padding: 10px 16px; }
  .nav { gap: 14px; }
  .icons { margin-left: 0; }
  .page { width: calc(100% - 32px); padding-top: 36px; gap: 44px; }
  .site-foot { width: calc(100% - 32px); margin-top: 56px; flex-direction: column; }
  .hero h1 { font-size: 28px; }
  .hero-avatar { width: 56px; height: 56px; }
  .lede { font-size: 17px; }
  .tools li { grid-template-columns: max-content minmax(0, 1fr); grid-template-areas: "name status" "desc desc"; column-gap: 12px; row-gap: 4px; }
  .caps { display: block; }
  .caps dd { margin: 0 0 14px; }
  .posts { gap: 16px; }
  .posts li { grid-template-columns: max-content minmax(0, 1fr); grid-template-areas: "date tags" "title title"; column-gap: 12px; row-gap: 2px; }
  .posts .date { grid-area: date; }
  .posts .title { grid-area: title; }
  .posts .tags { grid-area: tags; }
  .archive li { grid-template-columns: 64px minmax(0, 1fr); column-gap: 12px; }
  .timeline li { grid-template-columns: minmax(0, 1fr); row-gap: 2px; }
  .post-title { font-size: 26px; }
  .quote { max-width: none; }
}

@media (max-width: 720px) and (prefers-color-scheme: dark) {
  .site-head { padding: 8px 16px; }
  .hero h1 { font-size: 32px; }
  .tools { padding: 12px 14px; }
  .tools .status { justify-self: start; }
  .caps dd { margin: 0 0 14px 24px; }
  .post-title { font-size: 28px; }
}
