/* Blog styles: same tokens and rhythm as static/index.html (kept in sync by hand). */
@font-face {
  font-family: 'Montserrat';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('/fonts/montserrat.woff2') format('woff2');
}
@font-face {
  font-family: 'Montserrat';
  font-style: italic;
  font-weight: 100 900;
  font-display: swap;
  src: url('/fonts/montserrat-italic.woff2') format('woff2');
}
:root {
  /* Colour tokens. One name per role, resolved for light or dark by the OS
     scheme (prefers-color-scheme), no toggle: the light palette is the
     original one, the dark one keeps the same hues lifted for a #151515
     canvas so every text colour stays >= 7:1 (AAA) and inputs >= 3:1.
     light-dark() is used where supported so that a component can still pin
     its own colour-scheme; the media query is the fallback for older
     browsers. See the contrast table in the commit that introduced this. */
  --green-l: #2f7a2f;      /* AA on white (5.3:1) and for white text on top */
  --green-dark-l: #2f6b2f;
  --ink-l: #333;
  --muted-l: #5f5f5f;
  --rule-l: #d9d9d9;
  --bg-l: #fff;
  --panel-l: #fff;         /* dialog */
  --surface-l: #f3f3f3;    /* code, small raised controls */
  --border-l: #c9c9c9;     /* inputs */
  --err-l: #a33;
  --on-green-l: #fff;      /* text on a green button */
  --green-d: #7ed07e;      /* 9.8:1 on the dark canvas, 10:1 for #111 text on top */
  --green-dark-d: #8fd88f; /* 10.8:1 */
  --ink-d: #e4e4e4;        /* 14.4:1 */
  --muted-d: #a3a3a3;      /* 7.2:1 */
  --rule-d: #3a3a3a;
  --bg-d: #151515;
  --panel-d: #242424;
  --surface-d: #2a2a2a;
  --border-d: #6b6b6b;     /* 3.4:1 */
  --err-d: #f28b8b;        /* 7.7:1 */
  --on-green-d: #111;
  --green: var(--green-l);
  --green-dark: var(--green-dark-l);
  --ink: var(--ink-l);
  --muted: var(--muted-l);
  --rule: var(--rule-l);
  --bg: var(--bg-l);
  --panel: var(--panel-l);
  --surface: var(--surface-l);
  --border: var(--border-l);
  --err: var(--err-l);
  --on-green: var(--on-green-l);
  @media (prefers-color-scheme: dark) {
    --green: var(--green-d);
    --green-dark: var(--green-dark-d);
    --ink: var(--ink-d);
    --muted: var(--muted-d);
    --rule: var(--rule-d);
    --bg: var(--bg-d);
    --panel: var(--panel-d);
    --surface: var(--surface-d);
    --border: var(--border-d);
    --err: var(--err-d);
    --on-green: var(--on-green-d);
  }
  @supports (color: light-dark(white, black)) {
    --green: light-dark(var(--green-l), var(--green-d));
    --green-dark: light-dark(var(--green-dark-l), var(--green-dark-d));
    --ink: light-dark(var(--ink-l), var(--ink-d));
    --muted: light-dark(var(--muted-l), var(--muted-d));
    --rule: light-dark(var(--rule-l), var(--rule-d));
    --bg: light-dark(var(--bg-l), var(--bg-d));
    --panel: light-dark(var(--panel-l), var(--panel-d));
    --surface: light-dark(var(--surface-l), var(--surface-d));
    --border: light-dark(var(--border-l), var(--border-d));
    --err: light-dark(var(--err-l), var(--err-d));
    --on-green: light-dark(var(--on-green-l), var(--on-green-d));
  }
  /* tells the browser both schemes are supported: canvas, scrollbars and
     native form controls follow the OS setting on their own */
  color-scheme: light dark;
  accent-color: var(--green);
  /* Tag colours: Open Props tokens (open-props.style), copied verbatim, not reinvented */
  --purple-7: #ae3ec9;
  --gray-9: #212529;
  --gray-3: #dee2e6;
  --yellow-4: #ffd43b;
  --blue-7: #1c7ed6;
  --teal-7: #0ca678;
  --green-7: #37b24d;
  /* the "work" tag is near-black: on the dark canvas it flips to light grey */
  --tag-work: var(--gray-9);
  @media (prefers-color-scheme: dark) { --tag-work: var(--gray-3); }
  @supports (color: light-dark(white, black)) { --tag-work: light-dark(var(--gray-9), var(--gray-3)); }
}
* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: 'Montserrat', system-ui, -apple-system, sans-serif;
  font-size: 1rem;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
.page {
  max-width: 46rem;
  margin: 0 auto;
  padding: clamp(2rem, 6vw, 4rem) clamp(1.25rem, 5vw, 2rem) 4rem;
}

/* ── Header ─────────────────────────── */
header { text-align: center; }
h1 {
  margin: 0;
  color: var(--green);
  font-size: clamp(2rem, 7vw, 3rem);
  font-weight: 400;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
h1 a { color: inherit; text-decoration: none; }
h1 a:hover, h1 a:focus-visible { text-decoration: underline; }
.role {
  margin: 0.4rem 0 0.9rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-size: 0.85rem;
  color: var(--muted);
}
.contacts {
  margin: 0;
  font-size: 0.95rem;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.35rem 0.6rem;
}
.contacts .sep { color: var(--muted); }
a { color: var(--green-dark); text-decoration: underline; }
a:focus-visible { outline: 2px solid var(--green-dark); outline-offset: 2px; }
.btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
  font: inherit;
  font-weight: 600;
  font-size: 0.8rem;
  line-height: 1.2;
  min-block-size: 1.75rem; /* 28px target, comfortably above the WCAG 24px minimum */
  padding: 0.25rem 0.75rem;
  border-radius: 999px;
  border: 1.5px solid var(--green);
  background: var(--green);
  color: var(--on-green);
  text-decoration: none;
  cursor: pointer;
}
@media (prefers-reduced-motion: no-preference) {
  .btn { transition: transform 0.15s ease, background-color 0.15s ease; }
  .btn:hover { transform: translateY(-2px); }
}
.btn:focus-visible { outline: 2px solid var(--green-dark); outline-offset: 3px; }
.btn-secondary { background: transparent; color: var(--green-dark); }
.btn-secondary:hover { background: color-mix(in srgb, var(--green) 12%, transparent); }
.btn-secondary[aria-pressed="true"] { background: var(--green); color: var(--on-green); }

/* ── Sections ───────────────────────── */
hr {
  border: 0;
  border-top: 1px solid var(--rule);
  margin: 2.5rem 0;
}
h2 {
  color: var(--ink);
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin: 0 0 1rem;
}
.job { margin-bottom: 1.5rem; }
.job:last-child { margin-bottom: 0; }
.job-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.25rem 1rem;
  flex-wrap: wrap;
}
/* the heading's bottom margin belongs to the row, not to the heading:
   otherwise a wrapped date gets pushed away from the title on narrow screens */
.job-head h2 { margin-bottom: 0; }
.post > .job-head { margin-bottom: 0.5rem; }
.comments > .job-head, section > .job-head { margin-bottom: 1rem; }
h3 {
  margin: 0;
  color: var(--green);
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
h3 a { color: inherit; }
.dates {
  font-weight: 700;
  font-size: 0.95rem;
  white-space: nowrap;
  display: block;
  text-align: end;
  flex: 1;
}
.org { margin: 0.1rem 0 0.4rem; font-style: italic; color: var(--muted); }
ul, ol { margin: 0.3rem 0 0; padding-left: 1.3rem; }
li { margin-bottom: 0.35rem; }

/* ── Tags ───────────────────────────── */
.tags {
  list-style: none;
  margin: 0 0 0.4rem; /* tags sit above the title */
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}
.tag {
  margin: 0;
  font-size: 0.7rem;
  font-weight: 700;
  font-style: italic;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  line-height: 1.2;
  /* trims the leading above the cap height and below the baseline, so the
     text sits centred in the pill without eyeballed paddings */
  text-box: trim-both cap alphabetic;
  padding: 0.35rem 0.6rem;
  border: 0;
  background: var(--tag-bg, var(--muted));
  /* Automatic contrast: the lightness of the background, pushed to ±infinity,
     clamps to 0 or 100, so the text becomes black on light tags and white on
     dark ones without a hand-written text colour. */
  color: lch(from var(--tag-bg, var(--muted)) calc((60 - l) * infinity) 0 h);
}
.tag::before { content: '#'; } /* hashtag sign lives in CSS only, not in the markup or the feed */
.tag[data-tag="meta"] { --tag-bg: var(--purple-7); }
.tag[data-tag="work"] { --tag-bg: var(--tag-work); }
.tag[data-tag="tech"] { --tag-bg: var(--yellow-4); }
.tag[data-tag="life"] { --tag-bg: var(--blue-7); }
.tag[data-tag="geek"] { --tag-bg: var(--teal-7); }
.tag[data-tag="finance"] { --tag-bg: var(--green-7); }
.post > .tags { margin-bottom: 0.6rem; }

/* ── Post body ──────────────────────── */
.post-body {
  margin-top: 1.5rem;
  font-size: 1.125rem; /* 18px: long-form reading size, also on phones */
  line-height: 1.65;
}
.post-body h3 { margin: 1.75rem 0 0.5rem; }
.post-body h4 {
  margin: 1.25rem 0 0.4rem;
  font-size: 1rem;
  font-weight: 700;
  color: var(--ink);
}
.post-body p { margin: 0 0 1rem; }
.post-body img { display: block; max-width: 100%; height: auto; border-radius: 8px; }
.post-body ul, .post-body ol { margin-bottom: 1rem; }
.post-body blockquote {
  margin: 0 0 1rem;
  padding-left: 1rem;
  border-left: 3px solid var(--green);
  color: var(--muted);
  font-style: italic;
}
.post-body code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.9em;
  background: var(--surface);
  padding: 0.1em 0.35em;
  border-radius: 4px;
}
.post-body pre {
  margin: 0 0 1rem;
  padding: 0.9rem 1rem;
  background: var(--surface);
  border-radius: 8px;
  overflow-x: auto;
  line-height: 1.45;
}
.post-body pre code { background: none; padding: 0; font-size: 0.9rem; }
.post-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.5rem;
  margin: 1rem 0 0;
}
.post-body + .post-actions { margin-top: 1.5rem; }
.post-date { font-weight: 400; color: var(--muted); }
.feed-link { font-weight: 400; font-size: 0.9rem; margin-bottom: 1rem; }
.post-footer { margin: 2rem 0 0; }
.status { margin: 1rem 0 0; font-weight: 600; }
.status.ok { color: var(--green-dark); }
.status.err { color: var(--err); }
.status input {
  font: inherit;
  font-weight: 400;
  padding: 0.35rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  inline-size: 100%;
  margin-top: 0.3rem;
  background: var(--bg);
  color: var(--ink);
}

/* ── Comments ───────────────────────── */
.comment { margin: 0 0 1.25rem; padding-bottom: 1.25rem; border-bottom: 1px solid var(--rule); }
.comment-head { margin: 0 0 0.35rem; font-size: 0.95rem; }
.comment-head time { color: var(--muted); margin-left: 0.5rem; font-size: 0.85rem; }
.comment-body { font-size: 1.0625rem; line-height: 1.6; }
.comment-body p { margin: 0 0 0.6rem; }
.comment-body p:last-child { margin-bottom: 0; }
.comment-form { display: grid; gap: 0.9rem; margin-top: 1.5rem; }
.comment-form label { display: grid; gap: 0.3rem; font-size: 0.9rem; font-weight: 600; }
.comment-form input[type="text"], .comment-form textarea {
  font: inherit;
  font-weight: 400;
  padding: 0.6rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  inline-size: 100%;
  background: var(--bg);
  color: var(--ink);
}
.comment-form input:focus-visible, .comment-form textarea:focus-visible {
  outline: 2px solid var(--green);
  outline-offset: 1px;
  border-color: transparent;
}
.comment-form textarea { resize: vertical; min-block-size: 6rem; }
.comment-form .org { margin: 0; }
.comment-submit { margin: 0; display: flex; justify-content: flex-end; }
.comment-form .status { margin: 0; }
[hidden] { display: none !important; }
