/* lancekeay.com — "blue ink notebook" system
   Structure adapted from editorial (serif long-form, story rows, byline)
   and docs (3-column reading layout, comparison tables, code) references. */

:root {
  --paper: #f4f6f9;
  --sheet: #ffffff;
  --ink: #15233d;
  --ink-soft: #46546d;
  --ink-faint: #6b7890;
  --keay: #38629f;
  --keay-deep: #2a4c7f;
  --keay-wash: #e3eaf4;
  --rule: #d3dbe6;
  --mark: #f6e46b;
  --good: #2e7a4f;
  --mixed: #9a6a12;
  --skip: #a83f36;

  --sans: "Jost", "Futura", "Century Gothic", system-ui, sans-serif;
  --serif: "Literata", "Georgia", serif;
  --mono: "JetBrains Mono", ui-monospace, "Cascadia Code", Consolas, monospace;

  /* type scale: 1.25 ratio from 17px body */
  --t-xs: 0.8125rem;   /* 13 */
  --t-sm: 0.9375rem;   /* 15 */
  --t-md: 1.0625rem;   /* 17 */
  --t-lg: 1.3125rem;   /* 21 */
  --t-xl: 1.625rem;    /* 26 */
  --t-2xl: 2.0625rem;  /* 33 */
  --t-3xl: clamp(2.25rem, 4.6vw, 3.5rem);
  --t-4xl: clamp(2.75rem, 7.4vw, 6rem);

  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px;
  --s6: 32px; --s7: 48px; --s8: 64px; --s9: 96px;

  --wrap: 1240px;
  --measure: 40rem;
  --radius: 6px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  font-size: var(--t-md);
  line-height: 1.65;
  overflow-x: hidden;
}
img, svg { max-width: 100%; display: block; }
a { color: var(--keay); text-decoration-thickness: 1px; text-underline-offset: 0.18em; }
a:hover { color: var(--keay-deep); text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--keay); outline-offset: 3px; border-radius: 2px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link { position: absolute; left: var(--s4); top: -60px; background: var(--ink); color: #fff; padding: var(--s2) var(--s4); font-family: var(--sans); z-index: 10; }
.skip-link:focus { top: var(--s4); color: #fff; }

.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 var(--s6); }
@media (max-width: 640px) { .wrap { padding: 0 var(--s5); } }

/* ---------- masthead ---------- */
.masthead { border-bottom: 1px solid var(--rule); background: var(--paper); }
.masthead .wrap { display: flex; align-items: center; justify-content: space-between; gap: var(--s5); min-height: 72px; flex-wrap: wrap; }
.wordmark { font-family: var(--sans); font-weight: 500; font-size: var(--t-lg); letter-spacing: -0.01em; color: var(--ink); text-decoration: none; display: inline-flex; align-items: center; gap: var(--s3); }
.wordmark:hover { color: var(--ink); }
.wordmark svg { width: 28px; height: 28px; flex: none; }
.nav { display: flex; gap: var(--s1); font-family: var(--sans); font-size: var(--t-sm); }
.nav a { color: var(--ink-soft); text-decoration: none; padding: var(--s2) var(--s3); border-radius: var(--radius); }
.nav a:hover { color: var(--ink); background: var(--keay-wash); }
.nav a[aria-current="page"] { color: var(--ink); box-shadow: inset 0 -2px 0 var(--keay); border-radius: 0; }
@media (max-width: 520px) {
  .masthead .wrap { padding-top: var(--s3); padding-bottom: var(--s2); min-height: 0; }
  .nav { width: 100%; margin-left: calc(var(--s3) * -1); }
}

/* ---------- shared type ---------- */
h1, h2, h3, h4 { font-family: var(--sans); font-weight: 500; color: var(--ink); letter-spacing: -0.015em; line-height: 1.15; margin: 0; }
.section-title { font-size: var(--t-xl); margin-bottom: var(--s5); }
.lede { font-size: var(--t-lg); line-height: 1.55; color: var(--ink-soft); max-width: 36em; }
.small { font-family: var(--sans); font-size: var(--t-sm); color: var(--ink-faint); }
.note { font-family: var(--sans); font-size: var(--t-xs); color: var(--ink-faint); }

/* the highlighter: used only for verdicts */
.mark {
  background-image: linear-gradient(transparent 52%, var(--mark) 52%, var(--mark) 92%, transparent 92%);
  background-repeat: no-repeat;
  background-size: 100% 100%;
  -webkit-box-decoration-break: clone; box-decoration-break: clone;
  padding: 0 0.12em;
}

/* verdict marker */
.verdict-tag { display: inline-flex; align-items: center; gap: 0.45em; font-family: var(--sans); font-size: var(--t-sm); font-weight: 500; white-space: nowrap; }
.verdict-tag::before { content: ""; width: 0.7em; height: 0.7em; border-radius: 50%; background: currentColor; }
.verdict-tag.is-good { color: var(--good); }
.verdict-tag.is-mixed { color: var(--mixed); }
.verdict-tag.is-mixed::before { background: linear-gradient(90deg, currentColor 50%, transparent 50%); box-shadow: inset 0 0 0 1.5px currentColor; }
.verdict-tag.is-skip { color: var(--skip); }
.verdict-tag.is-skip::before { background: transparent; box-shadow: inset 0 0 0 1.5px currentColor; }
.verdict-tag.is-summary { color: var(--keay); }
.verdict-tag.is-summary::before { border-radius: 1px; width: 0.75em; height: 0.15em; }

.tag { font-family: var(--sans); font-size: var(--t-xs); color: var(--ink-soft); background: var(--keay-wash); padding: 2px 9px; border-radius: 99px; text-decoration: none; white-space: nowrap; }

/* buttons */
.btn { display: inline-flex; align-items: center; gap: var(--s2); font-family: var(--sans); font-size: var(--t-md); font-weight: 500; text-decoration: none; padding: 12px 22px; border-radius: var(--radius); border: 1.5px solid var(--ink); color: var(--ink); background: transparent; cursor: pointer; }
.btn:hover { background: var(--ink); color: #fff; }
.btn-solid { background: var(--ink); color: #fff; }
.btn-solid:hover { background: var(--keay-deep); border-color: var(--keay-deep); color: #fff; }
.btn svg { width: 18px; height: 18px; }
.btn .fmt { font-weight: 400; opacity: 0.75; font-size: var(--t-sm); }

/* ---------- home ---------- */
.intro { padding-top: var(--s9); padding-bottom: var(--s8); }
.intro h1 { font-size: var(--t-4xl); font-weight: 500; letter-spacing: -0.035em; line-height: 0.95; }
.intro h1 span { display: block; }
.intro h1 .surname { color: var(--keay); }
.intro .who { margin-top: var(--s6); font-size: var(--t-xl); line-height: 1.45; max-width: 30em; color: var(--ink); }
.intro .who + .who { margin-top: var(--s3); color: var(--ink-soft); font-size: var(--t-lg); }
@media (max-width: 640px) {
  .intro { padding-top: var(--s7); padding-bottom: var(--s7); }
  .intro .who { font-size: var(--t-lg); }
  .intro .who + .who { font-size: var(--t-md); }
}

.latest { padding-bottom: var(--s8); }
.latest-head { display: flex; justify-content: space-between; align-items: baseline; gap: var(--s4); border-top: 2px solid var(--ink); padding-top: var(--s4); margin-bottom: var(--s2); }
.latest-head h2 { font-size: var(--t-xl); }
.latest-head a { font-family: var(--sans); font-size: var(--t-sm); }

/* post rows (home + posts list) */
.post-list { list-style: none; margin: 0; padding: 0; }
.post-row { display: grid; grid-template-columns: 9rem minmax(0, 1fr) 11rem; gap: var(--s3) var(--s6); padding: var(--s5) 0; border-bottom: 1px solid var(--rule); align-items: start; }
.post-row time { font-family: var(--sans); font-size: var(--t-sm); color: var(--ink-faint); padding-top: 0.35em; font-variant-numeric: tabular-nums; }
.post-row h3 { font-size: var(--t-xl); line-height: 1.2; }
.post-row h3 a { color: var(--ink); text-decoration: none; }
.post-row h3 a:hover { color: var(--keay); text-decoration: underline; text-decoration-thickness: 2px; }
.post-row .verdict-line { margin: var(--s3) 0 0; font-size: var(--t-md); max-width: 44em; }
.post-row .meta { display: flex; flex-direction: column; align-items: flex-start; gap: var(--s2); padding-top: 0.35em; }
.post-row .meta .tags { display: flex; gap: var(--s1); flex-wrap: wrap; }
.post-row .preview { font-family: var(--sans); font-size: var(--t-xs); color: var(--ink-faint); margin-top: var(--s2); }
@media (max-width: 860px) {
  .post-row { grid-template-columns: minmax(0, 1fr); gap: var(--s2); }
  .post-row time { padding: 0; }
  .post-row h3 { font-size: var(--t-lg); }
  .post-row .meta { flex-direction: row; flex-wrap: wrap; align-items: center; gap: var(--s3); order: 3; padding: 0; }
}

/* highlighter swipe — the one orchestrated motion */
@media (prefers-reduced-motion: no-preference) {
  .js .swipe .mark { background-size: 0% 100%; animation: swipe 0.7s cubic-bezier(.6,.05,.3,1) forwards; }
  .js .swipe li:nth-child(1) .mark { animation-delay: 0.25s; }
  .js .swipe li:nth-child(2) .mark { animation-delay: 0.55s; }
  .js .swipe li:nth-child(3) .mark { animation-delay: 0.85s; }
  .js .swipe li:nth-child(4) .mark { animation-delay: 1.15s; }
  @keyframes swipe { to { background-size: 100% 100%; } }
}

.hire { background: var(--keay); color: #fff; }
.hire .wrap { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: var(--s6); align-items: center; padding-top: var(--s7); padding-bottom: var(--s7); }
.hire h2 { color: #fff; font-size: var(--t-2xl); }
.hire p { margin: var(--s3) 0 0; color: #e6edf7; max-width: 34em; }
.hire .actions { display: flex; gap: var(--s3); flex-wrap: wrap; justify-content: flex-end; }
.hire .btn { border-color: #fff; color: #fff; }
.hire .btn:hover { background: #fff; color: var(--keay-deep); }
.hire .btn-solid { background: #fff; color: var(--keay-deep); }
.hire .btn-solid:hover { background: var(--ink); border-color: var(--ink); color: #fff; }
.hire a:focus-visible, .site-foot a:focus-visible { outline-color: #fff; }
@media (max-width: 860px) {
  .hire .wrap { grid-template-columns: minmax(0, 1fr); }
  .hire .actions { justify-content: flex-start; }
}

/* ---------- footer ---------- */
.site-foot { background: var(--ink); color: #c9d2e0; font-family: var(--sans); font-size: var(--t-sm); }
.site-foot .wrap { display: flex; justify-content: space-between; gap: var(--s5); flex-wrap: wrap; padding-top: var(--s6); padding-bottom: var(--s6); }
.site-foot a { color: #fff; }
.site-foot p { margin: 0; max-width: 40em; }

/* ---------- posts page ---------- */
.page-head { padding: var(--s8) 0 var(--s6); }
.page-head h1 { font-size: var(--t-3xl); letter-spacing: -0.025em; }
.page-head .lede { margin: var(--s4) 0 0; }

.filters { display: flex; gap: var(--s2); flex-wrap: wrap; align-items: center; padding: var(--s4) 0; border-top: 2px solid var(--ink); border-bottom: 1px solid var(--rule); font-family: var(--sans); }
.filters .label { font-size: var(--t-sm); color: var(--ink-faint); margin-right: var(--s2); }
.filter-btn { font-family: var(--sans); font-size: var(--t-sm); color: var(--ink); background: var(--sheet); border: 1px solid var(--rule); border-radius: 99px; padding: 6px 16px; cursor: pointer; }
.filter-btn:hover { border-color: var(--keay); }
.filter-btn[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: #fff; }
.filter-btn .count { color: var(--ink-faint); margin-left: 4px; font-variant-numeric: tabular-nums; }
.filter-btn[aria-pressed="true"] .count { color: #b9c4d6; }
.filter-status { margin-left: auto; font-size: var(--t-sm); color: var(--ink-faint); }
@media (max-width: 640px) { .filter-status { margin-left: 0; width: 100%; } }
.year { font-size: var(--t-lg); color: var(--ink-faint); padding-top: var(--s6); padding-bottom: var(--s1); border-bottom: 1px solid var(--rule); }
.post-row[hidden] { display: none; }
.empty { padding: var(--s7) 0; font-family: var(--sans); }

/* ---------- article ---------- */
.article-head { padding: var(--s8) 0 var(--s6); max-width: 54rem; }
.article-head .crumbs { font-family: var(--sans); font-size: var(--t-sm); color: var(--ink-faint); margin-bottom: var(--s4); display: flex; gap: var(--s3); flex-wrap: wrap; align-items: center; }
.article-head h1 { font-size: var(--t-3xl); letter-spacing: -0.025em; line-height: 1.05; }
.article-head .standfirst { margin: var(--s5) 0 0; font-size: var(--t-lg); color: var(--ink-soft); line-height: 1.55; }

.article-grid { display: grid; grid-template-columns: 16rem minmax(0, var(--measure)) minmax(0, 1fr); gap: var(--s7); align-items: start; padding-bottom: var(--s8); }
.factsheet { position: sticky; top: var(--s5); background: var(--sheet); border: 1px solid var(--rule); border-top: 4px solid var(--keay); border-radius: 0 0 var(--radius) var(--radius); padding: var(--s5); font-family: var(--sans); font-size: var(--t-sm); line-height: 1.45; }
.factsheet h2 { font-size: var(--t-md); margin-bottom: var(--s4); }
.factsheet dl { margin: 0; display: grid; gap: var(--s4); }
.factsheet dt { color: var(--ink-faint); font-size: var(--t-xs); margin-bottom: 2px; }
.factsheet dd { margin: 0; color: var(--ink); }
.factsheet .verdict-big { font-family: var(--serif); font-size: var(--t-md); line-height: 1.5; }
.toc { font-family: var(--sans); font-size: var(--t-sm); border-left: 1px solid var(--rule); padding-left: var(--s4); }
.toc h2 { font-size: var(--t-sm); color: var(--ink-faint); font-weight: 400; margin-bottom: var(--s2); }
.toc ol { list-style: none; padding: 0; margin: 0; display: grid; gap: var(--s2); }
.toc a { color: var(--ink-soft); text-decoration: none; }
.toc a:hover, .toc a.is-active { color: var(--keay); }
.toc a.is-active { font-weight: 500; }
@media (max-width: 1180px) {
  .article-grid { grid-template-columns: 15rem minmax(0, 1fr); }
  .toc { display: none; }
}
@media (max-width: 860px) {
  .article-grid { grid-template-columns: minmax(0, 1fr); gap: var(--s6); }
  .factsheet { position: static; }
}

.prose { min-width: 0; }
.prose > * + * { margin-top: 1.1em; }
.prose p, .prose li { hyphens: auto; }
.prose h2 { font-size: var(--t-2xl); margin-top: 2em; scroll-margin-top: var(--s5); }
.prose h3 { font-size: var(--t-lg); margin-top: 1.6em; }
.prose ul, .prose ol { padding-left: 1.3em; }
.prose li + li { margin-top: 0.4em; }
.prose code { font-family: var(--mono); font-size: 0.86em; background: var(--keay-wash); padding: 0.1em 0.35em; border-radius: 4px; }
.prose pre { background: var(--ink); color: #dfe6f2; padding: var(--s5); border-radius: var(--radius); overflow-x: auto; font-size: var(--t-sm); line-height: 1.6; }
.prose pre code { background: none; padding: 0; color: inherit; font-size: inherit; }
.prose pre .c { color: #8fa0bb; }
.prose blockquote { margin-left: 0; padding-left: var(--s5); border-left: 3px solid var(--mark); font-style: italic; color: var(--ink-soft); }
.callout { background: var(--sheet); border: 1px solid var(--rule); border-radius: var(--radius); padding: var(--s4) var(--s5); font-family: var(--sans); font-size: var(--t-sm); line-height: 1.55; }
.callout strong { font-weight: 500; }

/* wide comparison table: breaks out of the measure to the right */
.table-block { margin-top: var(--s6); }
.table-block figcaption { font-family: var(--sans); font-size: var(--t-sm); color: var(--ink-soft); margin-bottom: var(--s3); }
.table-scroll { overflow-x: auto; background: var(--sheet); border: 1px solid var(--rule); border-radius: var(--radius); }
@media (min-width: 1181px) { .table-block { width: calc(100% + min(232px, 100vw - 1040px)); position: relative; } }
.compare { border-collapse: collapse; width: 100%; min-width: 760px; font-family: var(--sans); font-size: var(--t-sm); line-height: 1.45; font-variant-numeric: tabular-nums; }
.compare th, .compare td { text-align: left; vertical-align: top; padding: 12px 16px; border-bottom: 1px solid var(--rule); }
.compare thead th { font-weight: 500; color: var(--ink); background: var(--keay-wash); border-bottom: 1px solid var(--keay); }
.compare thead th.is-subject { background: var(--keay); color: #fff; }
.compare tbody th { font-weight: 500; color: var(--ink-soft); width: 11rem; position: sticky; left: 0; background: var(--sheet); }
.compare thead th:first-child { position: sticky; left: 0; z-index: 1; }
.compare td.is-subject { background: #f7f9fc; }
.compare tbody tr:last-child > * { border-bottom: 0; }
.compare .num { text-align: right; }
.yes { color: var(--good); } .part { color: var(--mixed); } .no { color: var(--skip); }
.table-block .note { margin-top: var(--s2); }
.scroll-hint { display: none; }
@media (max-width: 860px) { .scroll-hint { display: block; } }

.verdict-final { margin-top: var(--s7); padding: var(--s5); background: var(--sheet); border: 1px solid var(--rule); border-left: 4px solid var(--good); border-radius: 0 var(--radius) var(--radius) 0; }
.verdict-final h2 { margin-top: 0; font-size: var(--t-xl); }
.verdict-final p { font-size: var(--t-lg); line-height: 1.5; margin: var(--s3) 0 0; }

/* ---------- about / CV ---------- */
.cv-head { padding: var(--s8) 0 var(--s7); display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: var(--s7); align-items: end; }
.cv-head h1 { font-size: var(--t-3xl); letter-spacing: -0.025em; }
.cv-head .lede { margin: var(--s4) 0 0; }
.download { background: var(--sheet); border: 1px solid var(--rule); border-top: 4px solid var(--keay); border-radius: 0 0 var(--radius) var(--radius); padding: var(--s5); }
.download h2 { font-size: var(--t-lg); }
.download p { font-family: var(--sans); font-size: var(--t-sm); color: var(--ink-soft); margin: var(--s2) 0 var(--s4); }
.download .actions { display: flex; gap: var(--s3); flex-wrap: wrap; }
@media (max-width: 860px) { .cv-head { grid-template-columns: minmax(0, 1fr); align-items: start; gap: var(--s6); } }

.cv-section { display: grid; grid-template-columns: 16rem minmax(0, 1fr); gap: var(--s7); padding: var(--s7) 0; border-top: 1px solid var(--rule); }
.cv-section > h2 { font-size: var(--t-xl); }
.cv-section .body { max-width: 46rem; }
.cv-section .body > p:first-child { margin-top: 0; }
@media (max-width: 860px) { .cv-section { grid-template-columns: minmax(0, 1fr); gap: var(--s4); padding: var(--s6) 0; } }

.skills { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s5) var(--s6); margin: 0; }
.skills dt { font-family: var(--sans); font-weight: 500; margin-bottom: var(--s1); }
.skills dd { margin: 0; color: var(--ink-soft); font-size: var(--t-sm); line-height: 1.6; font-family: var(--sans); }
@media (max-width: 640px) { .skills { grid-template-columns: minmax(0, 1fr); } }

.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { display: grid; grid-template-columns: 8rem minmax(0, 1fr); gap: var(--s5); padding: var(--s4) 0; border-bottom: 1px solid var(--rule); }
.timeline li:first-child { padding-top: 0; }
.timeline .when { font-family: var(--sans); font-size: var(--t-sm); color: var(--ink-faint); padding-top: 0.2em; font-variant-numeric: tabular-nums; }
.timeline h3 { font-size: var(--t-lg); }
.timeline p { margin: var(--s2) 0 0; color: var(--ink-soft); }
@media (max-width: 520px) { .timeline li { grid-template-columns: minmax(0, 1fr); gap: var(--s1); } }

.prose .contact-list { list-style: none; padding: 0; margin: var(--s4) 0 0; font-family: var(--sans); display: grid; gap: var(--s2); }
.sample-flag { display: inline-block; font-family: var(--sans); font-size: var(--t-xs); color: var(--mixed); border: 1px solid currentColor; border-radius: 99px; padding: 1px 9px; margin-bottom: var(--s3); }
@media (max-width: 640px) {
  .compare { min-width: 620px; }
  .compare tbody th { width: 7.5rem; box-shadow: 1px 0 0 var(--rule); }
  .compare th, .compare td { padding: 10px 12px; }
}
