/* ============================================================
   enespaker.com — design tokens + components
   Type scale: 6 sizes, ~1.25 ratio
   Spacing scale: 8px base, doubling
   Colors: 5 grayscale tones, all WCAG AA on white
   Layout: fluid container 640–1040px, breakpoints at 640/1024
   ============================================================ */

/* ---------- Tokens --------------------------------------- */
:root {
  /* Color (all body-text tones meet WCAG AA on white) */
  --bg:        #ffffff;
  --ink:       #0a0a0a;   /* primary text     19.5:1 */
  --body:      #2a2a2a;   /* body text        13.7:1 */
  --mute:      #5a5a5a;   /* secondary text    7.4:1 */
  --soft:      #767676;   /* tertiary / dates  4.6:1 ✓ AA */
  --faint:     #c2c2c2;   /* decorative only — never body text */
  --rule:      #e6e6e6;
  --rule-soft: #f3f3f3;
  --focus:     #0a66ff;   /* keyboard focus ring */

  /* Type families */
  --sans: 'Geist', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'Geist Mono', ui-monospace, 'SF Mono', Menlo, monospace;

  /* Type scale — 6 steps, ~1.25 ratio (fluid via clamp on hero) */
  --t-meta:  12px;   /* dates, mono labels */
  --t-small: 14px;   /* descriptions, secondary */
  --t-body:  16px;   /* default reading text */
  --t-lede:  20px;   /* lead paragraphs, post body */
  --t-h2:    28px;   /* section heading */
  --t-h1:    clamp(32px, 4vw, 44px); /* page title — fluid */

  /* Line heights pinned to type role */
  --lh-tight:  1.15;
  --lh-snug:   1.45;
  --lh-normal: 1.55;
  --lh-loose:  1.7;
  --lh-prose:  1.75;

  /* Spacing — 8px scale */
  --s-1: 4px;
  --s-2: 8px;
  --s-3: 16px;
  --s-4: 24px;
  --s-5: 32px;
  --s-6: 48px;
  --s-7: 64px;
  --s-8: 96px;
  --s-9: 128px;

  /* Layout */
  --container-max: 1040px;
  --container-pad: clamp(20px, 4vw, 56px);
  --prose-max: 64ch;     /* comfortable reading line length */
  --label-col: 140px;    /* about page section label column */
  --date-col:  110px;    /* notes/posts margin date column */
  --col-gap:   var(--s-5);
}

@media (max-width: 1024px) {
  :root { --label-col: 120px; --date-col: 96px; --col-gap: var(--s-4); }
}

/* ---------- Reset & base --------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { background: var(--bg); }
body {
  font-family: var(--sans);
  font-size: var(--t-body);
  line-height: var(--lh-loose);
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  font-feature-settings: 'kern', 'liga', 'calt';
}
h1, h2, h3, h4, h5, p, ul, ol { margin: 0; padding: 0; font-weight: 400; }
ul, ol { list-style: none; }
img { max-width: 100%; height: auto; display: block; }
a {
  color: inherit;
  text-decoration: none;
  transition: color 0.18s ease, border-color 0.18s ease;
}
::selection { background: var(--ink); color: var(--bg); }

/* ---------- Accessibility -------------------------------- */
.skip-link {
  position: absolute;
  top: -40px;
  left: var(--s-3);
  background: var(--ink);
  color: var(--bg);
  padding: var(--s-2) var(--s-3);
  font-size: var(--t-meta);
  font-weight: 500;
  z-index: 100;
  transition: top 0.18s ease;
}
.skip-link:focus { top: var(--s-3); }

a:focus-visible,
button:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 3px;
  border-radius: 2px;
}

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

/* ---------- Container ------------------------------------ */
.container {
  max-width: var(--container-max);
  margin: 0 auto;
  padding: var(--s-5) var(--container-pad) var(--s-7);
}
@media (max-width: 640px) {
  .container { padding: var(--s-4) var(--container-pad) var(--s-6); }
}

/* ---------- Navigation ----------------------------------- */
.nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: var(--s-3);
  margin-bottom: 40px;
  border-bottom: 1px solid var(--rule);
}
.nav__brand {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.005em;
  color: var(--ink);
}
.nav__links {
  display: flex;
  gap: var(--s-5);
  align-items: center;
}
.nav__links a {
  font-family: var(--sans);
  font-size: var(--t-small);
  font-weight: 500;
  color: var(--mute);
  letter-spacing: -0.005em;
  position: relative;
}
.nav__links a::after {
  content: '';
  position: absolute;
  left: 0; right: 0; bottom: -4px;
  height: 1px;
  background: var(--ink);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.22s ease;
}
.nav__links a:hover, .nav__links a.is-active { color: var(--ink); }
.nav__links a:hover::after, .nav__links a.is-active::after { transform: scaleX(1); }

@media (max-width: 640px) {
  .nav { margin-bottom: var(--s-6); }
  .nav__links { gap: var(--s-4); }
  .nav__links a { font-size: 13px; }
}

/* ---------- Row primitive (margin column + main) -------- */
.row {
  display: grid;
  grid-template-columns: var(--date-col) 1fr;
  column-gap: var(--col-gap);
}
.row__margin {
  font-family: var(--mono);
  font-size: var(--t-meta);
  line-height: var(--lh-snug);
  color: var(--soft);
  font-variant-numeric: tabular-nums;
}
.row__main { min-width: 0; }

@media (max-width: 640px) {
  .row {
    grid-template-columns: 1fr;
    row-gap: var(--s-2);
  }
}

/* ---------- Hero (homepage / blog index) ----------------- */
.hero {
  margin-top: var(--s-2);
  margin-bottom: var(--s-6);
  animation: fadeUp 0.5s ease both;
}
/* Identity: title + small mono byline, tight pair */
.hero__title {
  font-size: var(--t-h1);
  font-weight: 500;
  letter-spacing: -0.03em;
  line-height: 1;
  color: var(--ink);
  margin: 0 0 var(--s-2) 0;
}
.hero__role {
  font-family: var(--mono);
  font-size: var(--t-meta);
  font-weight: 500;
  line-height: 1.5;
  letter-spacing: 0.01em;
  color: var(--mute);
  margin: 0 0 var(--s-5) 0;
}
/* Statement: intro + secondary explanation, tight pair */
.hero__intro {
  font-size: var(--t-lede);
  font-weight: 500;
  line-height: var(--lh-snug);
  letter-spacing: -0.005em;
  color: var(--ink);
  margin: 0 0 var(--s-3) 0;
}
.hero__intro:last-child { margin-bottom: 0; }
.hero__intro--secondary {
  font-size: var(--t-body);
  font-weight: 400;
  line-height: 1.65;
  color: var(--mute);
  margin: 0;
}

/* ---------- Section label -------------------------------- */
.section-label {
  font-family: var(--mono);
  font-size: var(--t-meta);
  font-weight: 500;
  color: var(--ink);
  letter-spacing: 0.02em;
  text-transform: uppercase;
  margin-bottom: var(--s-3);
}

/* ---------- Notes (full inline) -------------------------- */
.notes { display: flex; flex-direction: column; }
.note {
  border-top: 1px solid var(--rule);
  padding: var(--s-5) 0;
  animation: fadeUp 0.5s ease both;
}
.note:nth-child(1) { animation-delay: 0.04s; }
.note:nth-child(2) { animation-delay: 0.10s; }
.note:nth-child(3) { animation-delay: 0.16s; }
.note:nth-child(4) { animation-delay: 0.22s; }
.note:nth-child(5) { animation-delay: 0.28s; }
.note:last-child { border-bottom: 1px solid var(--rule); }

.note__date {
  font-family: var(--mono);
  font-size: var(--t-meta);
  color: var(--soft);
  font-variant-numeric: tabular-nums;
  display: inline-block;
  padding-top: 4px;
}
.note__date:hover { color: var(--ink); }
.note__date:focus-visible { color: var(--ink); }

.note__body {
  font-size: var(--t-body);
  line-height: var(--lh-loose);
  color: var(--body);
}
.note__body p { margin: 0 0 1em 0; }
.note__body p:last-child { margin-bottom: 0; }
.note__share {
  display: inline-block;
  margin-top: var(--s-4);
  font-family: var(--mono);
  font-size: var(--t-meta);
  color: var(--soft);
}
.note__share:hover { color: var(--ink); }

@media (max-width: 640px) {
  .note { padding: var(--s-5) 0; }
  .note__body p:first-child { font-size: 18px; }
}

/* ---------- Single post page ---------------------------- */
.post-header { margin-bottom: var(--s-6); animation: fadeUp 0.5s ease both; }
.post-meta {
  display: flex;
  flex-direction: column;
  gap: var(--s-1);
  font-family: var(--mono);
  font-size: var(--t-meta);
  line-height: var(--lh-snug);
  color: var(--soft);
  font-variant-numeric: tabular-nums;
}
.post-meta__date { color: var(--mute); }

.post-body {
  font-size: var(--t-lede);
  line-height: var(--lh-prose);
  color: var(--body);
  animation: fadeUp 0.5s 0.06s ease both;
}
.post-body p { margin: 0 0 1.15em 0; }
.post-body p:last-child { margin-bottom: 0; }
.post-body img { margin: 1.6em 0; }
.post-body a {
  color: var(--ink);
  border-bottom: 1px solid var(--mute);
  padding-bottom: 1px;
}
.post-body a:hover { border-bottom-color: var(--ink); }
.post-body em, .post-body i { font-style: italic; }

.post-footer {
  margin-top: var(--s-6);
  padding-top: var(--s-3);
  border-top: 1px solid var(--rule);
}
.post-footer__links {
  display: flex;
  justify-content: space-between;
  font-family: var(--mono);
  font-size: var(--t-meta);
  color: var(--mute);
}
.post-footer a:hover { color: var(--ink); }

@media (max-width: 640px) {
  .post-meta { flex-direction: row; gap: var(--s-3); flex-wrap: wrap; }
  .post-body { font-size: var(--t-body); line-height: var(--lh-loose); }
}

/* ---------- About page ---------------------------------- */
.about__hero {
  margin-top: var(--s-2);
  margin-bottom: var(--s-6);
  animation: fadeUp 0.5s ease both;
}
.about__title {
  font-size: var(--t-h1);
  font-weight: 500;
  letter-spacing: -0.03em;
  line-height: 1;
  color: var(--ink);
  margin: 0 0 var(--s-4) 0;
}
.about__lede {
  font-size: var(--t-lede);
  font-weight: 500;
  line-height: var(--lh-snug);
  letter-spacing: -0.005em;
  color: var(--ink);
  margin: 0 0 var(--s-4) 0;
}
.about__bio {
  font-size: var(--t-body);
  line-height: 1.65;
  color: var(--mute);
  margin: 0 0 1.1em 0;
}
.about__bio:last-child { margin-bottom: 0; }
.about__bio em { color: var(--ink); font-style: italic; }

/* CMS-rendered bio body matches .about__bio paragraph treatment */
.about__bio-content p {
  font-size: var(--t-body);
  line-height: 1.65;
  color: var(--mute);
  margin: 0 0 1.1em 0;
}
.about__bio-content p:last-child { margin-bottom: 0; }
.about__bio-content em { color: var(--ink); font-style: italic; }

/* About sections — simple stacked, left-aligned, no label column */
.about__section {
  margin-top: var(--s-6);
}
.about__heading {
  font-size: 18px;
  font-weight: 500;
  letter-spacing: -0.005em;
  color: var(--ink);
  padding-bottom: var(--s-2);
  border-bottom: 1px solid var(--rule);
  margin-bottom: var(--s-4);
}

/* Roles — title + org · year on one line, description below */
.role-list { display: flex; flex-direction: column; gap: var(--s-5); }
.role { min-width: 0; }
.role__head {
  display: flex;
  align-items: baseline;
  gap: var(--s-3);
  margin-bottom: 6px;
  font-size: var(--t-body);
  line-height: var(--lh-snug);
}
.role__head-text {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px;
  min-width: 0;
}
.role__title { font-weight: 500; color: var(--ink); }
.role__org { color: var(--mute); font-weight: 400; }
.role__year {
  margin-left: auto;
  font-family: var(--mono);
  font-size: var(--t-meta);
  color: var(--soft);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.01em;
  white-space: nowrap;
}
.role__desc {
  font-size: var(--t-small);
  line-height: var(--lh-snug);
  color: var(--mute);
}

/* Awards — single column, year + title on one row, all aligned */
.award-list { display: flex; flex-direction: column; gap: var(--s-3); }
.award-list li {
  display: flex;
  align-items: baseline;
  gap: var(--s-4);
  font-size: var(--t-body);
  line-height: var(--lh-snug);
  color: var(--body);
}
.award-list .year {
  font-family: var(--mono);
  font-size: var(--t-meta);
  color: var(--soft);
  font-variant-numeric: tabular-nums;
  flex: 0 0 56px;
}

/* Interests */
.interests {
  font-size: var(--t-body);
  line-height: var(--lh-loose);
  color: var(--body);
}

/* Elsewhere */
.elsewhere {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-3) var(--s-5);
  font-size: var(--t-body);
}
.elsewhere a {
  color: var(--ink);
  border-bottom: 1px solid var(--rule);
  padding-bottom: 2px;
}
.elsewhere a:hover { border-bottom-color: var(--ink); }

/* About — small viewports */
@media (max-width: 640px) {
  .about__hero { margin-bottom: var(--s-6); }
  .about__section { margin-top: var(--s-6); }

  .role__head {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }
  .role__year { margin-left: 0; }

  .award-list li { gap: var(--s-3); }
  .award-list .year { flex: 0 0 48px; }
}

/* ---------- Animations ---------------------------------- */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ---------- Print --------------------------------------- */
@media print {
  body { background: white; color: black; }
  .nav, .post-footer, .elsewhere, .skip-link { display: none; }
  .container { max-width: 100%; padding: 0; }
  a { color: black; text-decoration: underline; }
  .post-body, .note__body, .about__bio {
    font-size: 11pt;
    line-height: 1.5;
    color: black;
  }
  .row, .about__section {
    display: block;
  }
}

/* ---------- Subscribe (Ghost members portal) ------------ */
/* Coherent with .note__share / .post-footer treatment:
   underline-style input, mono caption + arrow link, no box.
   .note:last-child already provides the separator rule, so
   the subscribe section adds no top border — just spacing. */
.subscribe {
  margin: var(--s-5) 0 0;
  padding-top: 0;
  border-top: 0;
}
.subscribe__lede {
  font-family: var(--mono);
  font-size: var(--t-meta);
  color: var(--mute);
  margin: 0 0 var(--s-3) 0;
}
.subscribe__form {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: end;
  gap: var(--s-5);
}
.subscribe__input {
  font: inherit;
  font-size: var(--t-body);
  color: var(--ink);
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--rule);
  padding: var(--s-3) 0;
  min-width: 0;
}
.subscribe__input::placeholder { color: var(--mute); }
.subscribe__input:focus-visible {
  outline: none;
  border-bottom-color: var(--ink);
}
.subscribe__button {
  font: inherit;
  font-family: var(--mono);
  font-size: var(--t-meta);
  color: var(--mute);
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--rule);
  padding: var(--s-3) 0;
  cursor: pointer;
  transition: color 120ms ease, border-color 120ms ease;
}
.subscribe__button:hover {
  color: var(--ink);
  border-bottom-color: var(--ink);
}
.subscribe__button:focus-visible {
  outline: none;
  color: var(--ink);
  border-bottom-color: var(--ink);
}
.subscribe__msg {
  grid-column: 1 / -1;
  display: none;
  margin: var(--s-2) 0 0 0;
  font-family: var(--mono);
  font-size: var(--t-meta);
}
.subscribe__form.success .subscribe__msg--success { display: block; color: var(--ink); }
.subscribe__form.error   .subscribe__msg--error   { display: block; color: #b3261e; }
.subscribe__form.loading .subscribe__button { opacity: 0.6; pointer-events: none; }

@media (max-width: 640px) {
  .subscribe__form { grid-template-columns: 1fr; gap: var(--s-3); }
  .subscribe__button { text-align: left; }
}

/* ---------- Koenig editor cards -------------------------- */
/* Required by Ghost. Width helpers extend images/embeds beyond
   the post-body column without breaking the page container. */
.kg-width-wide {
  position: relative;
  width: min(95vw, 1100px);
  max-width: 1100px;
  margin-left: 50%;
  transform: translateX(-50%);
}
.kg-width-full {
  position: relative;
  width: 100vw;
  max-width: none;
  margin-left: 50%;
  transform: translateX(-50%);
}
.kg-image,
.kg-card img {
  display: block;
  height: auto;
  max-width: 100%;
}
figure.kg-card {
  margin: var(--s-7) 0;
}
figure.kg-card figcaption {
  margin-top: var(--s-3);
  font-family: var(--mono);
  font-size: var(--t-meta);
  color: var(--mute);
  text-align: center;
}
.kg-bookmark-card,
.kg-embed-card,
.kg-gallery-card,
.kg-callout-card,
.kg-toggle-card {
  margin: var(--s-7) 0;
}

/* ---------- Book detail header --------------------------- */
.book-header {
  margin-bottom: var(--s-5);
}
.book-header .hero__title {
  margin-bottom: var(--s-2);
}
.book-header__author {
  font-family: var(--mono);
  font-size: var(--t-meta);
  color: var(--mute);
  margin: 0;
}

/* ---------- Reading (books) ------------------------------ */
.reading-controls {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-2);
  margin-bottom: var(--s-4);
}
.reading-controls__search,
.reading-controls__select {
  font-family: var(--sans);
  font-size: var(--t-small);
  color: var(--ink);
  background: var(--bg);
  border: 1px solid var(--rule);
  border-radius: 6px;
  padding: 8px 12px;
  line-height: 1.2;
  transition: border-color 120ms ease;
}
.reading-controls__search {
  flex: 1 1 240px;
  min-width: 0;
}
.reading-controls__select {
  flex: 0 0 auto;
  background-image: linear-gradient(45deg, transparent 50%, var(--soft) 50%),
                    linear-gradient(135deg, var(--soft) 50%, transparent 50%);
  background-position: calc(100% - 16px) 50%, calc(100% - 11px) 50%;
  background-size: 5px 5px;
  background-repeat: no-repeat;
  appearance: none;
  -webkit-appearance: none;
  padding-right: 32px;
  cursor: pointer;
}
.reading-controls__search:focus,
.reading-controls__select:focus {
  outline: none;
  border-color: var(--ink);
}

.reading-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--t-small);
}
.reading-table thead th {
  font-family: var(--mono);
  font-size: var(--t-meta);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--soft);
  text-align: left;
  padding: var(--s-2) var(--s-3) var(--s-2) 0;
  border-bottom: 1px solid var(--rule);
}
.reading-table thead th.reading-table__date { width: 120px; }
.reading-table thead th.reading-table__topic { width: 200px; }

.reading-table tbody td {
  padding: var(--s-3) var(--s-3) var(--s-3) 0;
  border-bottom: 1px solid var(--rule-soft);
  vertical-align: top;
  color: var(--body);
}
.reading-table tbody tr:last-child td { border-bottom: none; }

.reading-row__title a {
  color: var(--ink);
  font-weight: 500;
  text-decoration: none;
  border-bottom: 1px solid var(--mute);
  transition: border-color 120ms ease;
}
.reading-row__title a:hover { border-bottom-color: var(--ink); }

.reading-row__author { color: var(--mute); }
.reading-row__date {
  font-family: var(--mono);
  font-size: var(--t-meta);
  color: var(--soft);
  white-space: nowrap;
}
.reading-row__placeholder { color: var(--faint); }

.reading-row__chip {
  display: inline-block;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.02em;
  color: var(--mute);
  background: var(--rule-soft);
  padding: 2px 8px;
  border-radius: 999px;
  margin: 0 4px 4px 0;
}

.reading-empty {
  margin-top: var(--s-5);
  font-size: var(--t-small);
  color: var(--soft);
  text-align: center;
}

.reading-count {
  margin-top: var(--s-4);
  font-size: var(--t-small);
  color: var(--soft);
  text-align: right;
}

@media (max-width: 720px) {
  .reading-table thead { display: none; }
  .reading-table,
  .reading-table tbody,
  .reading-table tr,
  .reading-table td { display: block; width: 100%; }
  .reading-table tbody tr {
    padding: var(--s-3) 0;
    border-bottom: 1px solid var(--rule);
  }
  .reading-table tbody tr:last-child { border-bottom: none; }
  .reading-table tbody td {
    padding: 2px 0;
    border: none;
  }
  .reading-row__title { font-size: var(--t-body); }
  .reading-row__author::before { content: "by "; color: var(--soft); }
  .reading-row__date::before { content: "Added "; color: var(--soft); }
}

