/* =========================================================================
   Higinio Martí — "Paper"
   An alternative to the dark build. White ground, one typeface, hierarchy
   carried by size and weight. Structure comes from a hanging margin that
   holds every section name, not from rules, cards or accent colour.
   ========================================================================= */

:root {
  --paper:  #ffffff;
  --ink:    #111111;
  --text:   #1f1f1f;
  --mute:   #767676;
  --rule:   #e6e6e6;
  --signal: #123fcb;

  --serif: "Literata", Charter, Georgia, serif;

  --margin:  7.5rem;   /* hanging column: section names */
  --gutter:  2.75rem;
  --measure: 34rem;    /* reading column: ~62 characters */

  color-scheme: light;
}

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

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

body {
  background: var(--paper);
  color: var(--text);
  font-family: var(--serif);
  font-size: 1.125rem;
  line-height: 1.68;
  font-weight: 400;
  font-optical-sizing: auto;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }

:focus-visible { outline: 2px solid var(--signal); outline-offset: 3px; }

::selection { background: #dfe6ff; }

/* ---------- the two-axis shell ---------------------------------------- */

.shell {
  max-width: calc(var(--margin) + var(--gutter) + var(--measure));
  margin-inline: auto;
  padding-inline: clamp(1.25rem, 5vw, 2rem);
}

.row {
  display: grid;
  grid-template-columns: var(--margin) minmax(0, 1fr);
  column-gap: var(--gutter);
  align-items: baseline;
  padding-bottom: clamp(3.25rem, 7vw, 5.25rem);
}

.label {
  font-size: 0.8125rem;
  line-height: 1.5;
  color: var(--mute);
  font-weight: 400;
}

/* ---------- masthead --------------------------------------------------- */

.masthead { border-bottom: 1px solid var(--rule); }

.masthead-in {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1.5rem;
  padding-block: 1.4rem;
}

.name { font-size: 1rem; text-decoration: none; }

.masthead-nav { display: flex; gap: 1.5rem; }

.masthead-nav a {
  font-size: 0.9375rem;
  color: var(--mute);
  text-decoration: none;
  transition: color .15s;
}
.masthead-nav a:hover { color: var(--ink); }

/* ---------- opening ---------------------------------------------------- */

.opening {
  display: grid;
  grid-template-columns: var(--margin) minmax(0, 1fr);
  column-gap: var(--gutter);
  padding-top: clamp(4rem, 10vw, 7.5rem);
  padding-bottom: clamp(3.75rem, 8vw, 6rem);
}
.opening > * { grid-column: 2; }

/* the single place the margin gives way */
.opening h1 {
  grid-column: 1 / -1;
  font-size: clamp(2.2rem, 6.1vw, 3.85rem);
  font-weight: 300;
  line-height: 1.1;
  letter-spacing: -0.024em;
  color: var(--ink);
  max-width: 19ch;
  text-wrap: balance;
}

.lede {
  margin-top: 1.9rem;
  font-size: 1.1875rem;
  line-height: 1.6;
  color: var(--mute);
  max-width: 36ch;
}

/* ---------- prose ------------------------------------------------------ */

.prose p + p { margin-top: 1.15rem; }
.prose strong { font-weight: 500; color: var(--ink); }

.prose a,
.aside a,
.contacts a {
  color: var(--signal);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.17em;
  transition: text-decoration-thickness .12s;
}
.prose a:hover,
.aside a:hover,
.contacts a:hover { text-decoration-thickness: 2px; }

/* ---------- what I work on --------------------------------------------- */

.defs > div + div { margin-top: 1.7rem; }

.defs dt {
  font-size: 1.375rem;
  font-weight: 400;
  line-height: 1.3;
  letter-spacing: -0.012em;
  color: var(--ink);
}

.defs dd {
  margin: 0.25rem 0 0;
  color: var(--mute);
  font-size: 1.0625rem;
  line-height: 1.6;
}

/* ---------- writing ----------------------------------------------------- */

.pieces { list-style: none; padding: 0; }
.pieces li + li { margin-top: 1.7rem; }

.pieces a {
  font-size: 1.4375rem;
  line-height: 1.28;
  letter-spacing: -0.014em;
  color: var(--ink);
  text-decoration: underline;
  text-decoration-color: var(--rule);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.17em;
  transition: text-decoration-color .15s;
}
.pieces a:hover { text-decoration-color: var(--ink); }

.meta {
  margin-top: 0.3rem;
  font-size: 0.9375rem;
  line-height: 1.5;
  color: var(--mute);
}

.aside {
  margin-top: 2.5rem;
  font-size: 1.0625rem;
  color: var(--mute);
  max-width: 46ch;
}

/* ---------- path -------------------------------------------------------- */

.path { list-style: none; padding: 0; }
.path li {
  display: grid;
  grid-template-columns: 5.25rem minmax(0, 1fr);
  column-gap: 1.25rem;
  align-items: baseline;
}
.path li + li { margin-top: 1.15rem; }

.year {
  font-size: 0.9375rem;
  color: var(--mute);
  font-variant-numeric: tabular-nums lining-nums;
}

.path .post { display: block; }
.role { display: block; color: var(--ink); line-height: 1.4; }
.org  { display: block; color: var(--mute); font-size: 1rem; line-height: 1.45; }

/* ---------- contact ------------------------------------------------------ */

.invite {
  font-size: clamp(1.5rem, 3.4vw, 2rem);
  font-weight: 300;
  line-height: 1.24;
  letter-spacing: -0.018em;
  color: var(--ink);
  max-width: 20ch;
  text-wrap: balance;
}

.contacts {
  list-style: none;
  padding: 0;
  margin-top: 1.75rem;
  font-size: 1.1875rem;
}
.contacts li + li { margin-top: 0.5rem; }

/* =========================================================================
   ARTICLE
   Prose keeps to the measure. Headings, figures and pull quotes reach out
   to the left axis, the same move the home page headline makes.
   ========================================================================= */

.art-head,
.art-body,
.art-foot {
  display: grid;
  grid-template-columns: var(--margin) minmax(0, 1fr);
  column-gap: var(--gutter);
  align-items: baseline;
}

.art-head {
  padding-top: clamp(3.25rem, 8vw, 5.5rem);
  padding-bottom: clamp(2.25rem, 5vw, 3.25rem);
}

.art-head h1 {
  grid-column: 1 / -1;
  font-size: clamp(1.85rem, 4.3vw, 2.8rem);
  font-weight: 300;
  line-height: 1.13;
  letter-spacing: -0.022em;
  color: var(--ink);
  max-width: 24ch;
  text-wrap: balance;
  margin-bottom: 1.9rem;
}

.art-when {
  font-size: 0.8125rem;
  line-height: 1.6;
  color: var(--mute);
}

.art-dek {
  font-size: 1.1875rem;
  line-height: 1.58;
  color: var(--mute);
  max-width: 44ch;
  text-wrap: pretty;
}

/* ---------- body flow ----------------------------------------------------- */

.art-body > * { grid-column: 2; }
.art-body > * + * { margin-top: 1.3rem; }

.art-body p { text-wrap: pretty; }
.art-body strong { font-weight: 600; color: var(--ink); }
.art-body a strong { color: inherit; }
.art-body em { font-style: italic; }

.art-body a {
  color: var(--signal);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.17em;
  transition: text-decoration-thickness .12s;
}
.art-body a:hover { text-decoration-thickness: 2px; }

/* ---------- the three elements that reach left ----------------------------- */

.art-body > h2 {
  grid-column: 1 / -1;
  font-size: clamp(1.3rem, 2.4vw, 1.6rem);
  font-weight: 500;
  line-height: 1.26;
  letter-spacing: -0.014em;
  color: var(--ink);
  max-width: 36ch;
  text-wrap: balance;
  margin-top: clamp(2.75rem, 5.5vw, 4rem);
}

.art-body > figure {
  grid-column: 1 / -1;
  margin-block: clamp(2.5rem, 5vw, 3.5rem);
}
.art-body figure img { width: 100%; height: auto; }
.art-body figcaption {
  margin-top: 0.8rem;
  font-size: 0.9375rem;
  line-height: 1.55;
  color: var(--mute);
  max-width: 60ch;
}

.art-body > blockquote {
  grid-column: 1 / -1;
  margin-block: clamp(2.75rem, 5.5vw, 4rem);
  font-size: clamp(1.45rem, 3.1vw, 1.95rem);
  font-weight: 300;
  line-height: 1.26;
  letter-spacing: -0.017em;
  color: var(--ink);
  max-width: 24ch;
  text-wrap: balance;
}

/* ---------- lists ----------------------------------------------------------- */

.art-body ol,
.art-body ul { padding-left: 1.45em; }

/* wide enough for the gutter to hold them: markers hang, prose keeps its axis */
@media (min-width: 52.0625rem) {
  .art-body > ol,
  .art-body > ul { padding-left: 0; }
}

.art-body li + li { margin-top: 0.85rem; }
.art-body li > p,
.art-body li > ul,
.art-body li > ol { margin-top: 0.75rem; }
.art-body li > ul li + li { margin-top: 0.45rem; }
.art-body li::marker { color: var(--mute); }

/* ---------- code ------------------------------------------------------------ */

.art-body code {
  font-family: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, monospace;
  font-size: 0.855em;
  background: #f3f3f4;
  padding: 0.1em 0.35em;
  border-radius: 3px;
}

.art-body > pre {
  grid-column: 1 / -1;
  margin-block: clamp(1.75rem, 3.5vw, 2.5rem);
}
.art-body pre {
  background: #f7f7f8;
  padding: 1.1rem 1.35rem;
  border-radius: 4px;
  overflow-x: auto;
}
.art-body pre code {
  background: none;
  padding: 0;
  font-size: 0.84rem;
  line-height: 1.65;
}

/* ---------- article footer --------------------------------------------------- */

.art-foot {
  margin-top: clamp(3.5rem, 7vw, 5.5rem);
  padding-top: 1.75rem;
  padding-bottom: 3rem;
  border-top: 1px solid var(--rule);
}
.art-foot > * { grid-column: 2; }
.art-foot ul {
  list-style: none;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1.75rem;
  font-size: 1.0625rem;
}
.art-foot a {
  color: var(--signal);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.17em;
}

/* ---------- colophon ------------------------------------------------------ */

.colophon {
  border-top: 1px solid var(--rule);
  padding-block: 1.75rem 3rem;
}
.colophon p { font-size: 0.9375rem; color: var(--mute); }

/* ---------- narrow -------------------------------------------------------- */

@media (max-width: 52rem) {
  body { font-size: 1.0625rem; }

  .row,
  .opening,
  .art-head,
  .art-body,
  .art-foot {
    grid-template-columns: minmax(0, 1fr);
    column-gap: 0;
  }
  .opening > *,
  .art-head > *,
  .art-body > *,
  .art-foot > * { grid-column: auto; }

  .label { margin-bottom: 0.85rem; }

  .art-head h1 { margin-bottom: 1.5rem; }
  .art-when { margin-bottom: 1.1rem; }

  .path li { grid-template-columns: 4.5rem minmax(0, 1fr); column-gap: 1rem; }
}

@media (max-width: 26rem) {
  .path li { grid-template-columns: minmax(0, 1fr); row-gap: 0.1rem; }
  .year { order: 2; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
