/* ============================================================
   michaelzoltak.com — shared stylesheet
   "Researcher's notebook" — light mode only
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Fraunces:ital,opsz,wght@0,9..144,400;0,9..144,500;1,9..144,400;1,9..144,500&family=Inter:wght@400;500&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
  --cream:      #FAF6F0;
  --ink:        #1F1F1F;
  --secondary:  #4A453E;
  --faint:      #6B6258;
  --burgundy:   #7A1F2B;
  --burgundy-d: #5E1620;
  --hairline:   #E5DDD1;
  --code-bg:    #F2EBE0;

  --font-display: 'Fraunces', Georgia, serif;
  --font-body:    'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono:    'JetBrains Mono', ui-monospace, monospace;

  --measure: 33em;       /* ~65ch main text column */
  --sidenote-w: 240px;
  --sidenote-gap: 280px; /* how far notes push into the right margin */
}

/* ---------- reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--cream);
  color: var(--ink);
  font-family: var(--font-body);
  font-weight: 400;
  font-size: 18px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img { max-width: 100%; display: block; }

/* ---------- links ---------- */
a {
  color: var(--burgundy);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-decoration-color: rgba(122, 31, 43, 0.35);
  text-underline-offset: 3px;
  transition: text-decoration-color 0.15s ease, color 0.15s ease;
}
a:hover {
  color: var(--burgundy-d);
  text-decoration-color: var(--burgundy);
}

/* ---------- shared layout shell ---------- */
.shell {
  max-width: 1040px;
  margin: 0 auto;
  padding: 0 2.5rem;
}

/* ============================================================
   Top nav
   ============================================================ */
.site-nav {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1.5rem;
  padding: 1.75rem 0 1.5rem;
  flex-wrap: wrap;
}
.wordmark {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 1.3rem;
  letter-spacing: -0.01em;
  color: var(--ink);
  text-decoration: none;
}
.wordmark:hover { color: var(--ink); }
.wordmark .cred {
  font-style: italic;
  font-weight: 400;
  color: var(--faint);
}

.nav-links {
  display: flex;
  align-items: baseline;
  gap: 1.75rem;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  letter-spacing: 0.01em;
}
.nav-links a {
  color: var(--faint);
  text-decoration: none;
  text-transform: lowercase;
  white-space: nowrap;
  padding: 0.5rem 0;
}
.wordmark { padding: 0.5rem 0; }
.nav-links a:hover { color: var(--burgundy); }
.nav-links a[aria-current="page"] { color: var(--ink); }
.nav-links .ext::after { content: '\2197'; font-size: 0.85em; margin-left: 0.15em; }

/* ============================================================
   Footer
   ============================================================ */
.site-footer {
  margin-top: 6rem;
  border-top: 1px solid var(--hairline);
  padding: 2rem 0 4rem;
}
.site-footer .footer-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem 1.5rem;
  align-items: baseline;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--faint);
}
.site-footer a { color: var(--faint); text-decoration: none; padding: 0.3rem 0; white-space: nowrap; }
.site-footer .copyright { white-space: nowrap; }
.site-footer a:hover { color: var(--burgundy); }
.site-footer .copyright { color: var(--faint); }

/* ============================================================
   Section markers (mono, burgundy, uppercase-ish)
   ============================================================ */
.meta .date, .meta .pill { white-space: nowrap; }

.section-marker {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--burgundy);
  margin: 0 0 1.5rem;
  display: block;
}

/* ============================================================
   Home — hero
   ============================================================ */
.hero {
  padding: 3.5rem 0 1rem;
  max-width: 34em;
}
.tagline {
  margin: 0;
  font-family: var(--font-display);
}
.tagline .line-1 {
  display: block;
  font-weight: 500;
  font-size: clamp(2.1rem, 5.2vw, 3.05rem);
  line-height: 1.12;
  letter-spacing: -0.018em;
  color: var(--ink);
  text-wrap: balance;
}
.tagline .line-2 {
  display: block;
  margin-top: 0.55rem;
  font-style: italic;
  font-weight: 400;
  font-size: clamp(1.25rem, 3vw, 1.6rem);
  line-height: 1.2;
  color: var(--burgundy);
}
.positioning {
  margin: 2rem 0 0;
  max-width: 34em;
  color: var(--secondary);
  font-size: 1.06rem;
  line-height: 1.72;
}
.cta-mono {
  display: inline-block;
  margin-top: 2rem;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--burgundy);
  text-decoration: none;
  letter-spacing: 0.01em;
}
.cta-mono::after { content: ' \2192'; }
.cta-mono:hover { color: var(--burgundy-d); }

/* ============================================================
   Post cards (home + reused)
   ============================================================ */
.recent { padding-top: 5rem; }

.post-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.post-card {
  padding: 2rem 0;
  border-top: 1px solid var(--hairline);
}
.post-card:last-child { border-bottom: 1px solid var(--hairline); }

.post-card .meta {
  display: flex;
  gap: 1.1rem;
  align-items: baseline;
  font-family: var(--font-mono);
  font-size: 0.76rem;
  color: var(--faint);
  margin-bottom: 0.7rem;
  letter-spacing: 0.01em;
}
.pill {
  color: var(--burgundy);
  font-style: italic;
  text-transform: lowercase;
}
.post-card h3 {
  margin: 0 0 0.4rem;
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 1.45rem;
  line-height: 1.22;
  letter-spacing: -0.01em;
}
.post-card h3 .soon { color: var(--ink); }
.post-card h3 a {
  color: var(--ink);
  text-decoration: none;
}
.post-card h3 a:hover { color: var(--burgundy); }
.post-card .dek {
  margin: 0;
  max-width: 40em;
  color: var(--secondary);
  font-size: 1rem;
}

/* ============================================================
   Work With Me teaser (home)
   ============================================================ */
.wwm-teaser {
  padding-top: 5rem;
  max-width: 34em;
}
.wwm-teaser p {
  margin: 0 0 1.25rem;
  color: var(--secondary);
}

/* ============================================================
   Generic page header
   ============================================================ */
.page-head {
  padding: 3rem 0 1rem;
  max-width: var(--measure);
}
.page-head h1 {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(2rem, 4.5vw, 2.7rem);
  line-height: 1.15;
  letter-spacing: -0.018em;
  margin: 0 0 0.5rem;
}
.page-head .lede {
  color: var(--secondary);
  font-size: 1.08rem;
  margin: 0.5rem 0 0;
}

/* ============================================================
   Writing index
   ============================================================ */
.writing-index { padding-top: 2.5rem; }

/* ============================================================
   About
   ============================================================ */
/* about — bio + margin portrait */
.about-layout {
  display: grid;
  grid-template-columns: minmax(0, var(--measure)) 1fr;
  gap: 3rem;
  align-items: start;
}
.about-aside { padding-top: 0.4rem; }
.portrait { width: 200px; margin: 0; }
.portrait img {
  width: 200px;
  height: 200px;
  object-fit: cover;
  border: 1px solid var(--hairline);
  border-radius: 2px;
  background: var(--code-bg);
}
.portrait figcaption {
  margin-top: 0.6rem;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  color: var(--faint);
  line-height: 1.5;
}
@media (max-width: 760px) {
  .about-layout { grid-template-columns: 1fr; gap: 0; }
  .about-aside { order: -1; padding-top: 0; margin-bottom: 2rem; }
  .portrait, .portrait img { width: 150px; }
  .portrait img { height: 150px; }
}

.prose { max-width: var(--measure); }
.prose p {
  color: var(--secondary);
  margin: 0 0 1.3rem;
}
.prose h2 {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 1.5rem;
  letter-spacing: -0.01em;
  color: var(--ink);
  margin: 3rem 0 1.2rem;
}

.cred-list {
  list-style: none;
  margin: 0;
  padding: 0;
  max-width: var(--measure);
}
.cred-list li {
  display: flex;
  gap: 1.25rem;
  align-items: baseline;
  padding: 1rem 0;
  border-top: 1px solid var(--hairline);
}
.cred-list li:last-child { border-bottom: 1px solid var(--hairline); }
.cred-list .cred-label {
  flex: 0 0 9.5rem;
  font-family: var(--font-mono);
  font-size: 0.74rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--faint);
  padding-top: 0.15rem;
}
.cred-list .cred-body { color: var(--ink); }

/* ============================================================
   Work With Me page
   ============================================================ */
.wwm-tagline {
  padding: 3rem 0 0;
  max-width: 34em;
}
.offerings {
  margin-top: 3rem;
  max-width: var(--measure);
}
.offering {
  padding: 2rem 0;
  border-top: 1px solid var(--hairline);
}
.offering:last-of-type { border-bottom: 1px solid var(--hairline); }
.offering h3 {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 1.4rem;
  letter-spacing: -0.01em;
  margin: 0 0 0.7rem;
}
.offering p { margin: 0; color: var(--secondary); }
.offering .case {
  margin-top: 1.1rem;
  font-size: 0.95rem;
  line-height: 1.65;
}
.offering .case-label {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--burgundy);
  margin-right: 0.65rem;
}
.offering .case strong { font-weight: 500; color: var(--ink); }

.start-block { max-width: 34em; margin-top: 3rem; }
.start-block p { color: var(--secondary); }
.disclaimer {
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--hairline);
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--faint);
  max-width: var(--measure);
  line-height: 1.8;
}

/* ============================================================
   Post reading view + Tufte margin sidenotes
   ============================================================ */
.article-wrap {
  max-width: 1040px;
  margin: 0 auto;
  padding: 0 2.5rem;
}
.article-head {
  padding: 2rem 0 0;
  max-width: var(--measure);
}
.back-link {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--faint);
  text-decoration: none;
  display: inline-block;
  margin-bottom: 2.5rem;
}
.back-link::before { content: '\2190 '; }
.back-link:hover { color: var(--burgundy); }

.article-head .meta {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--faint);
  display: flex;
  gap: 1.1rem;
  margin-bottom: 1.1rem;
}
.article-head h1 {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(2rem, 4.6vw, 2.85rem);
  line-height: 1.16;
  letter-spacing: -0.02em;
  margin: 0 0 0.7rem;
  text-wrap: balance;
}
.article-head .dek {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 400;
  font-size: 1.3rem;
  line-height: 1.35;
  color: var(--secondary);
  margin: 0;
}

.article-body {
  counter-reset: sidenote-counter;
  max-width: var(--measure);
  margin-top: 3rem;
  padding-top: 2.5rem;
  border-top: 1px solid var(--hairline);
}
.article-body > p {
  margin: 0 0 1.4rem;
  color: var(--ink);
}
.article-body h2 {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 1.6rem;
  letter-spacing: -0.012em;
  margin: 2.8rem 0 1.1rem;
}

.article-body blockquote {
  margin: 2rem 0;
  padding: 0.25rem 0 0.25rem 1.5rem;
  border-left: 2px solid var(--burgundy);
  font-family: var(--font-display);
  font-style: italic;
  font-size: 1.2rem;
  line-height: 1.45;
  color: var(--secondary);
}

.article-body pre {
  background: var(--code-bg);
  border: 1px solid var(--hairline);
  border-radius: 2px;
  padding: 1.25rem 1.4rem;
  overflow-x: auto;
  margin: 2rem 0;
  font-family: var(--font-mono);
  font-size: 0.84rem;
  line-height: 1.65;
  color: var(--ink);
}
.article-body code {
  font-family: var(--font-mono);
  font-size: 0.88em;
  background: var(--code-bg);
  padding: 0.1em 0.35em;
  border-radius: 2px;
}
.article-body pre code { background: none; padding: 0; font-size: 1em; }

/* ----- sidenotes (Tufte, no-JS toggle) ----- */
.sidenote {
  float: right;
  clear: right;
  width: var(--sidenote-w);
  margin-right: calc(-1 * var(--sidenote-gap));
  margin-top: 0.35rem;
  margin-bottom: 1rem;
  font-size: 0.84rem;
  line-height: 1.5;
  color: var(--secondary);
  position: relative;
}
.sidenote-number {
  counter-increment: sidenote-counter;
}
.sidenote-number::after {
  content: counter(sidenote-counter);
  font-family: var(--font-mono);
  font-size: 0.65em;
  font-weight: 500;
  color: var(--burgundy);
  position: relative;
  top: -0.5em;
  left: 0.08em;
  cursor: pointer;
}
.sidenote::before {
  content: counter(sidenote-counter) '\00a0\00a0';
  font-family: var(--font-mono);
  font-size: 0.78em;
  color: var(--burgundy);
}
.margin-toggle { display: none; }

/* ============================================================
   Responsive — collapse sidenotes inline
   ============================================================ */
@media (max-width: 1000px) {
  .sidenote {
    float: none;
    width: auto;
    margin: 1rem 0;
    display: none;
    padding: 0.9rem 1.1rem;
    background: var(--code-bg);
    border-left: 2px solid var(--burgundy);
  }
  .sidenote-number { display: inline; }
  label.sidenote-number { cursor: pointer; }
  .margin-toggle:checked + .sidenote { display: block; }
}

@media (max-width: 620px) {
  body { font-size: 17px; }
  .shell, .article-wrap { padding: 0 1.4rem; }
  .nav-links { gap: 1.1rem; row-gap: 0.25rem; font-size: 0.9rem; }
  .nav-links a { padding: 0.55rem 0; }
  .cred-list li { flex-direction: column; gap: 0.3rem; }
  .cred-list .cred-label { flex-basis: auto; }
  .site-nav { padding-top: 1.5rem; }
  .site-footer .footer-row { gap: 0.2rem 1.5rem; }
  .site-footer a { padding: 0.45rem 0; }
}
