/* lancekeay.com — engineer's notebook
   Tokens */
:root {
  --paper: #F4F6F9;      /* cool drafting-paper white */
  --sheet: #FFFFFF;      /* table / raised surface */
  --ink: #18212E;        /* blue-black text */
  --ink-soft: #4A5568;   /* secondary text */
  --keay: #38629F;       /* the old-site blue, kept */
  --keay-deep: #244673;  /* blue for text on paper (AA) */
  --grid: #DCE3EC;       /* graph-paper lines, rules */
  --run: #2E7553;        /* verdict: run it */
  --try: #9A6412;        /* verdict: try it */
  --skip: #9E3434;       /* verdict: skip */

  --serif: "Literata", Georgia, serif;
  --sans: "Jost", "Segoe UI", sans-serif;

  --measure: 66ch;
  --gutter: clamp(1.25rem, 4vw, 3rem);
  --margin-col: 11rem;
}

*, *::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: 1.0625rem;
  line-height: 1.7;
  font-optical-sizing: auto;
  overflow-x: hidden;
}
img, svg { max-width: 100%; display: block; }
a { color: var(--keay-deep); text-decoration-thickness: 1px; text-underline-offset: .2em; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--keay); outline-offset: 3px; border-radius: 2px; }

.skip-link { position: absolute; left: -999px; top: 0; background: var(--ink); color: #fff; padding: .5rem 1rem; z-index: 10; }
.skip-link:focus { left: 1rem; top: 1rem; }

.wrap { max-width: 76rem; margin: 0 auto; padding: 0 var(--gutter); }

/* ---------- Header ---------- */
.site-head { border-bottom: 1px solid var(--grid); }
.site-head .wrap { display: flex; align-items: center; justify-content: space-between; gap: 1rem; min-height: 4.5rem; flex-wrap: wrap; }
.brand { font-family: var(--sans); font-weight: 600; font-size: 1.2rem; letter-spacing: -.01em; color: var(--ink); text-decoration: none; display: flex; align-items: center; gap: .6rem; }
.brand svg { width: 28px; height: 28px; }
.site-nav ul { list-style: none; margin: 0; padding: 0; display: flex; gap: clamp(.9rem, 2.5vw, 2rem); }
.site-nav a { font-family: var(--sans); font-size: 1rem; color: var(--ink-soft); text-decoration: none; padding: .35rem 0; border-bottom: 2px solid transparent; }
.site-nav a:hover { color: var(--ink); }
.site-nav a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--keay); }

/* ---------- Type scale (1.25 ratio, sans for display) ---------- */
h1, h2, h3 { font-family: var(--sans); font-weight: 500; line-height: 1.15; letter-spacing: -.015em; margin: 0; }
h1 { font-size: clamp(2.2rem, 5vw, 3.6rem); }
h2 { font-size: clamp(1.5rem, 2.6vw, 2rem); }
h3 { font-size: 1.25rem; }
p { margin: 0 0 1.1em; }
.lede { font-size: clamp(1.15rem, 1.8vw, 1.35rem); line-height: 1.6; color: var(--ink); max-width: 40ch; }
.meta { font-family: var(--sans); font-size: .9rem; color: var(--ink-soft); }
.num { font-family: var(--sans); font-variant-numeric: tabular-nums lining-nums; }

/* ---------- Graph-paper hero ---------- */
.hero {
  background-color: var(--paper);
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 24px 24px;
  background-position: -1px -1px;
  border-bottom: 1px solid var(--grid);
}
.hero .wrap { padding-top: clamp(3rem, 9vw, 7rem); padding-bottom: clamp(3rem, 7vw, 5.5rem); }
.hero-name {
  font-family: var(--sans);
  font-weight: 300;
  font-size: clamp(3.4rem, 13vw, 10.5rem);
  line-height: .9;
  letter-spacing: -.045em;
  margin: 0 0 clamp(1.5rem, 3vw, 2.5rem) -.05em;
  color: var(--ink);
}
.hero-name span { display: block; font-weight: 600; color: var(--keay); }
.hero-grid { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 2rem 4rem; align-items: end; }
.hero-grid .lede { background: var(--paper); padding: .25rem 0; margin: 0; }
.hero-legend { background: var(--paper); padding: 1rem 1.25rem; border: 1px solid var(--grid); font-family: var(--sans); font-size: .95rem; }
.hero-legend p { margin: 0 0 .6rem; color: var(--ink-soft); }
.hero-legend ul { list-style: none; margin: 0; padding: 0; display: grid; gap: .45rem; }
.hero-legend li { display: flex; align-items: center; gap: .75rem; }

/* ---------- Verdict meter: the signature device ---------- */
.verdict { display: inline-flex; align-items: center; gap: .6rem; font-family: var(--sans); font-weight: 600; font-size: .95rem; white-space: nowrap; }
.meter { display: inline-grid; grid-template-columns: repeat(3, 10px); gap: 3px; }
.meter i { height: 14px; border: 1.5px solid currentColor; border-radius: 1px; }
.v-run { color: var(--run); }
.v-try { color: var(--try); }
.v-skip { color: var(--skip); }
.v-run .meter i, .v-try .meter i:nth-child(-n+2), .v-skip .meter i:first-child { background: currentColor; }
.v-word { letter-spacing: .01em; }

/* ---------- Section frame with margin column ---------- */
.section { padding: clamp(3rem, 7vw, 5rem) 0; }
.section + .section { padding-top: 0; }
.section-head { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; margin-bottom: 1.75rem; flex-wrap: wrap; }
.section-head a { font-family: var(--sans); }

/* ---------- Post log (list) ---------- */
.log { list-style: none; margin: 0; padding: 0; border-top: 2px solid var(--ink); }
.log-item { display: grid; grid-template-columns: var(--margin-col) minmax(0, 1fr) 13rem; gap: .5rem 2rem; padding: 1.5rem 0; border-bottom: 1px solid var(--grid); }
.log-item time { font-family: var(--sans); font-variant-numeric: tabular-nums; color: var(--ink-soft); font-size: .95rem; padding-top: .2rem; }
.log-item h3 { font-size: clamp(1.2rem, 2vw, 1.45rem); font-weight: 500; margin-bottom: .4rem; }
.log-item h3 a { color: var(--ink); text-decoration: none; }
.log-item h3 a:hover { color: var(--keay-deep); text-decoration: underline; }
.log-item .oneline { margin: 0; color: var(--ink-soft); max-width: 60ch; }
.log-item .oneline b { color: var(--ink); font-weight: 600; }
.log-side { display: flex; flex-direction: column; align-items: flex-start; gap: .5rem; padding-top: .2rem; }
.tags { display: flex; gap: .4rem; flex-wrap: wrap; list-style: none; margin: 0; padding: 0; }
.tag { font-family: var(--sans); font-size: .82rem; color: var(--keay-deep); background: #E4EBF4; padding: .05rem .55rem; border-radius: 999px; }
.market-mark { font-family: var(--sans); font-weight: 600; font-size: .95rem; color: var(--keay-deep); }

/* ---------- Hire strip ---------- */
.hire { background: var(--keay); color: #fff; }
.hire .wrap { display: grid; grid-template-columns: minmax(0, 1.3fr) auto; gap: 1.5rem 3rem; align-items: center; padding-top: 2.75rem; padding-bottom: 2.75rem; }
.hire h2 { color: #fff; margin-bottom: .5rem; }
.hire p { margin: 0; max-width: 56ch; color: #E6EDF7; }
.btn-row { display: flex; gap: .75rem; flex-wrap: wrap; }
.btn { display: inline-flex; align-items: center; gap: .5rem; font-family: var(--sans); font-weight: 500; font-size: 1rem; padding: .7rem 1.2rem; border-radius: 3px; text-decoration: none; border: 1.5px solid currentColor; line-height: 1.2; }
.btn svg { width: 18px; height: 18px; }
.btn-solid { background: var(--ink); color: #fff; border-color: var(--ink); }
.btn-solid:hover { background: #000; }
.btn-line { color: var(--ink); }
.btn-line:hover { background: var(--sheet); }
.hire .btn-solid { background: #fff; color: var(--keay-deep); border-color: #fff; }
.hire .btn-solid:hover { background: #E6EDF7; }
.hire .btn-line { color: #fff; }
.hire .btn-line:hover { background: rgba(255,255,255,.12); }
.hire :focus-visible { outline-color: #fff; }

/* ---------- Footer ---------- */
.site-foot { border-top: 1px solid var(--grid); padding: 2rem 0 3rem; font-family: var(--sans); font-size: .92rem; color: var(--ink-soft); }
.site-foot .wrap { display: flex; justify-content: space-between; gap: 1rem 2rem; flex-wrap: wrap; }
.site-foot p { margin: 0; }
.site-foot a { color: var(--ink-soft); }

/* ---------- Posts page ---------- */
.page-head { padding: clamp(2.5rem, 6vw, 4.5rem) 0 2rem; }
.page-head p { max-width: 58ch; margin-top: 1rem; color: var(--ink-soft); }
.filter { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; margin: 0 0 1.5rem; padding: 0; border: 0; }
.filter legend { font-family: var(--sans); font-size: .95rem; color: var(--ink-soft); margin-right: .5rem; float: left; padding: 0; }
.filter button { font-family: var(--sans); font-size: .98rem; background: transparent; color: var(--ink); border: 1.5px solid var(--grid); border-radius: 999px; padding: .35rem 1rem; cursor: pointer; }
.filter button:hover { border-color: var(--keay); }
.filter button[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: #fff; }
.filter-count { font-family: var(--sans); font-size: .92rem; color: var(--ink-soft); margin: 0 0 1rem; }
.log-item[hidden] { display: none; }

/* ---------- Article ---------- */
.article-head { padding: clamp(2.5rem, 6vw, 4.5rem) 0 0; }
.article-head h1 { max-width: 20ch; }
.article-head .standfirst { font-size: clamp(1.15rem, 1.8vw, 1.3rem); max-width: 54ch; margin: 1.25rem 0 0; color: var(--ink-soft); }
.article-head .meta { margin-top: 1.25rem; display: flex; gap: 1.5rem; flex-wrap: wrap; }

.factsheet {
  margin: 2.5rem 0 0;
  background: var(--sheet);
  border: 1px solid var(--grid);
  border-top: 4px solid var(--run);
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) repeat(3, minmax(0, 1fr));
}
.factsheet > div { padding: 1.25rem 1.5rem; border-left: 1px solid var(--grid); }
.factsheet > div:first-child { border-left: 0; }
.factsheet dt { font-family: var(--sans); font-size: .88rem; color: var(--ink-soft); margin-bottom: .35rem; }
.factsheet dd { margin: 0; font-family: var(--sans); font-size: 1.05rem; line-height: 1.45; }
.factsheet .verdict { font-size: 1.35rem; }
.factsheet .meter { grid-template-columns: repeat(3, 14px); }
.factsheet .meter i { height: 20px; }
.factsheet .verdict-line { font-family: var(--serif); font-size: 1rem; margin-top: .5rem; color: var(--ink); }

.article-body { display: grid; grid-template-columns: var(--margin-col) minmax(0, var(--measure)) minmax(0, 1fr); gap: 0 3rem; padding: 3rem 0 2rem; }
.article-body > * { grid-column: 2; }
.article-body h2 { margin: 2.5rem 0 1rem; font-size: 1.6rem; }
.article-body h3 { margin: 1.75rem 0 .5rem; }
.article-body ul, .article-body ol { padding-left: 1.25rem; margin: 0 0 1.2em; }
.article-body li { margin-bottom: .4em; }
.article-body li::marker { color: var(--keay); }
.article-body .note { grid-column: 1; grid-row: span 2; font-family: var(--sans); font-size: .9rem; line-height: 1.5; color: var(--ink-soft); border-top: 2px solid var(--keay); padding-top: .6rem; align-self: start; margin-top: .4rem; }
.article-body .wide { grid-column: 1 / -1; }
.article-body blockquote { margin: 1.5rem 0; padding-left: 1.25rem; border-left: 3px solid var(--grid); color: var(--ink-soft); }
code { font-family: ui-monospace, "Cascadia Code", Consolas, monospace; font-size: .88em; background: #E7ECF3; padding: .08em .35em; border-radius: 3px; }
pre { background: var(--ink); color: #E6EDF7; padding: 1rem 1.25rem; overflow-x: auto; border-radius: 3px; font-size: .9rem; line-height: 1.55; }
pre code { background: none; padding: 0; color: inherit; }

.toc { font-family: var(--sans); font-size: .92rem; position: sticky; top: 1.5rem; }
.toc p { color: var(--ink-soft); margin: 0 0 .5rem; }
.toc ol { list-style: none; padding: 0; margin: 0; display: grid; gap: .35rem; }
.toc a { color: var(--ink); text-decoration: none; }
.toc a:hover { color: var(--keay-deep); text-decoration: underline; }
.toc-col { grid-column: 1; grid-row: 1 / span 40; }

/* ---------- Comparison table ---------- */
.table-wrap { margin: 1.5rem 0 .75rem; overflow-x: auto; background: var(--sheet); border: 1px solid var(--grid); }
.table-wrap:focus-visible { outline-offset: 0; }
table.compare { border-collapse: collapse; width: 100%; min-width: 760px; font-family: var(--sans); font-size: .95rem; line-height: 1.4; font-variant-numeric: tabular-nums lining-nums; }
.compare caption { text-align: left; padding: 1rem 1.25rem .75rem; font-family: var(--serif); font-size: 1rem; color: var(--ink-soft); caption-side: top; }
.compare th, .compare td { padding: .75rem 1rem; text-align: left; vertical-align: top; border-top: 1px solid var(--grid); }
.compare thead th { font-weight: 600; border-top: 2px solid var(--ink); background: var(--sheet); white-space: nowrap; }
.compare tbody th { font-weight: 600; white-space: nowrap; }
.compare th:first-child { position: sticky; left: 0; background: var(--sheet); box-shadow: 1px 0 0 var(--grid); }
.compare .is-subject { background: #EEF3FA; }
.compare tbody th.is-subject, .compare thead th.is-subject { background: #EEF3FA; }
.compare td.r { text-align: right; }
.yes { color: var(--run); font-weight: 600; }
.part { color: var(--try); font-weight: 600; }
.no { color: var(--skip); font-weight: 600; }
.table-note { font-family: var(--sans); font-size: .88rem; color: var(--ink-soft); margin: 0 0 1.5rem; }

.post-end { border-top: 2px solid var(--ink); margin-top: 2rem; padding-top: 1.5rem; }

/* ---------- About / CV ---------- */
.cv-head .wrap { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 2rem 4rem; align-items: end; }
.cv-head h1, .cv-head .lede { background: var(--paper); }
.cv-head h1 { display: inline-block; padding-right: .5rem; }
.cv-download { background: var(--sheet); border: 1px solid var(--grid); border-top: 4px solid var(--keay); padding: 1.5rem; }
.cv-download h2 { font-size: 1.25rem; margin-bottom: .5rem; }
.cv-download p { font-size: .98rem; color: var(--ink-soft); }
.cv-download .btn-row { margin-top: 1rem; }
.cv-grid { display: grid; grid-template-columns: var(--margin-col) minmax(0, 1fr); gap: 1rem 3rem; padding: 2.5rem 0; border-top: 1px solid var(--grid); }
.cv-grid > h2 { font-size: 1.3rem; padding-top: .15rem; }
.cv-grid .prose { max-width: var(--measure); }
.skills { display: grid; grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); gap: 1.5rem 2.5rem; }
.skills h3 { font-size: 1.05rem; font-weight: 600; margin-bottom: .4rem; }
.skills ul { list-style: none; padding: 0; margin: 0; font-family: var(--sans); color: var(--ink-soft); line-height: 1.75; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { display: grid; grid-template-columns: 8.5rem minmax(0, 1fr); gap: .25rem 2rem; padding: 1.25rem 0; border-bottom: 1px solid var(--grid); }
.timeline li:first-child { padding-top: 0; }
.timeline .when { font-family: var(--sans); font-variant-numeric: tabular-nums; color: var(--ink-soft); font-size: .95rem; padding-top: .15rem; }
.timeline h3 { font-size: 1.12rem; margin-bottom: .3rem; }
.timeline p { margin: 0; max-width: 62ch; }
.sample-flag { font-family: var(--sans); font-size: .88rem; color: var(--try); background: #FBF3E4; border-left: 3px solid var(--try); padding: .5rem .8rem; margin: 0 0 1.25rem; max-width: 62ch; }
.contact-list { list-style: none; margin: 0; padding: 0; font-family: var(--sans); display: grid; gap: .5rem; }
.contact-list span { display: inline-block; min-width: 6rem; color: var(--ink-soft); }

/* ---------- Load moment: meters fill once ---------- */
@media (prefers-reduced-motion: no-preference) {
  .hero-legend .meter i, .factsheet .meter i { animation: fill .5s ease-out both; }
  .hero-legend li:nth-child(2) .meter i, .factsheet .meter i:nth-child(2) { animation-delay: .15s; }
  .hero-legend li:nth-child(3) .meter i, .factsheet .meter i:nth-child(3) { animation-delay: .3s; }
  @keyframes fill { from { transform: scaleY(0); transform-origin: bottom; } to { transform: scaleY(1); transform-origin: bottom; } }
}

/* ---------- Responsive ---------- */
@media (max-width: 960px) {
  .log-item { grid-template-columns: 8rem minmax(0, 1fr); }
  .log-side { grid-column: 2; flex-direction: row; flex-wrap: wrap; align-items: center; gap: .75rem 1rem; }
  .factsheet { grid-template-columns: 1fr 1fr; }
  .factsheet > div:first-child { grid-column: 1 / -1; border-bottom: 1px solid var(--grid); }
  .factsheet > div:nth-child(2) { border-left: 0; }
  .factsheet > div:nth-child(4) { grid-column: 1 / -1; border-left: 0; border-top: 1px solid var(--grid); }
  .article-body { grid-template-columns: minmax(0, 1fr); }
  .article-body > *, .article-body .note, .article-body .wide { grid-column: 1; grid-row: auto; }
  .toc-col { display: none; }
  .article-body .note { margin: .5rem 0 1.25rem; }
}
@media (max-width: 720px) {
  body { font-size: 1.02rem; }
  .hero-grid, .hire .wrap, .cv-head .wrap { grid-template-columns: minmax(0, 1fr); }
  .log-item { grid-template-columns: minmax(0, 1fr); gap: .35rem; }
  .log-side { grid-column: 1; }
  .cv-grid { grid-template-columns: minmax(0, 1fr); gap: 1rem; }
  .timeline li { grid-template-columns: minmax(0, 1fr); }
  .factsheet { grid-template-columns: minmax(0, 1fr); }
  .factsheet > div { border-left: 0 !important; border-top: 1px solid var(--grid); grid-column: 1 !important; }
  .factsheet > div:first-child { border-top: 0; }
  .site-head .wrap { padding-top: .75rem; padding-bottom: .5rem; }
  .site-nav ul { gap: 1.1rem; }
}
@media print {
  .site-head, .site-foot, .hire, .filter, .toc-col { display: none; }
  body { background: #fff; }
}
