/* theme/static/css/site.css */
@import url('./colors_and_type.css');

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { background: var(--paper); color: var(--ink); }

/* Layout shell */
.lm-shell { min-height: 100vh; display: flex; flex-direction: column; }
.lm-main  { flex: 1; }

/* Header */
.lm-header {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center;
  padding: 16px 32px;
  background: var(--header-bg);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--rule);
}
.lm-header .wordmark {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  border: 0;
  color: var(--ink);
  white-space: nowrap;
}
.lm-header .wordmark svg { display: block; height: 26px; width: auto; }
.lm-nav { margin-left: auto; display: flex; gap: 24px; align-items: center; }
.lm-nav a {
  font-family: var(--font-sans); font-size: 13px; color: var(--ink-2);
  text-decoration: none; border: 0;
  text-transform: uppercase; letter-spacing: 0.08em; font-weight: 700;
}
.lm-nav a:hover { color: var(--ink); background: transparent; }
.lm-nav a.active { color: var(--ink); }

/* Theme toggle */
.lm-theme-toggle {
  background: transparent; border: 0; cursor: pointer; color: var(--ink-2);
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--font-sans); font-size: 12px;
  padding: 4px 8px;
}
.lm-theme-toggle:hover { color: var(--ink); }

/* Page containers */
.lm-page { padding: 64px 32px 96px; }
.lm-col  { max-width: var(--measure); margin: 0 auto; }
.lm-col-wide { max-width: var(--measure-wide); margin: 0 auto; }

/* Index page */
.lm-hero { max-width: var(--measure); margin: 0 auto var(--s-9); }
.lm-hero .eyebrow {
  font-family: var(--font-sans); font-size: 11px; text-transform: uppercase;
  letter-spacing: 0.08em; color: var(--ink-3); font-weight: 700;
  margin-bottom: var(--s-4);
}
.lm-hero h1 {
  font-family: var(--font-display); font-size: 64px; line-height: 1.15;
  letter-spacing: -0.025em; font-weight: 500; margin: 0 0 var(--s-8);
  color: var(--ink);
}
.lm-hero .dek {
  font-family: var(--font-serif); font-size: 22px; line-height: 1.5;
  font-style: italic; color: var(--ink-2); margin: 0;
  text-wrap: pretty;
}

/* Essay list */
.lm-list-section { max-width: var(--measure); margin: 0 auto var(--s-8); }
.lm-list-head {
  font-family: var(--font-sans); font-size: 11px; text-transform: uppercase;
  letter-spacing: 0.08em; color: var(--ink-3); font-weight: 700;
  border-bottom: 1px solid var(--rule-strong);
  padding-bottom: var(--s-2);
  display: flex; align-items: baseline; gap: var(--s-3);
}
.lm-list-head .count { color: var(--ink-4); }

.lm-row {
  display: grid;
  grid-template-columns: 80px 1fr 80px 60px;
  gap: var(--s-4);
  padding: var(--s-4) 0;
  border-bottom: 1px solid var(--rule);
  cursor: pointer;
  align-items: baseline;
  transition: background var(--t-fast) var(--ease);
}
.lm-row:hover { background: var(--paper-2); }
.lm-row .year { font-family: var(--font-mono); font-size: 12px; color: var(--ink-3); }
.lm-row .title {
  font-family: var(--font-serif); font-size: 20px; line-height: 1.3;
  color: var(--ink); font-weight: 500;
}
.lm-row .title em { font-style: italic; }
.lm-row .min { font-family: var(--font-sans); font-size: 12px; color: var(--ink-3); text-align: right; }
.lm-row .dot {
  font-family: var(--font-sans); font-size: 10px; color: var(--ink-3);
  text-align: right; text-transform: uppercase; letter-spacing: 0.08em;
}
.lm-row .dot.finished  { color: var(--success); }
.lm-row .dot.progress  { color: var(--amber); }
.lm-row .dot.draft     { color: var(--ink-3); }

/* Essay page */
.lm-essay-header { max-width: var(--measure); margin: 0 auto var(--s-7); }
.lm-meta-strip {
  display: flex; gap: var(--s-3) var(--s-4); align-items: center;
  flex-wrap: wrap;
  font-family: var(--font-sans); font-size: 11px; text-transform: uppercase;
  letter-spacing: 0.08em; color: var(--ink-3); font-weight: 700;
  border-top: 1px solid var(--rule-strong);
  border-bottom: 1px solid var(--rule);
  padding: var(--s-2) 0;
}
.lm-meta-strip > * { white-space: nowrap; }
.lm-meta-strip .sep { color: var(--rule-strong); }
.lm-meta-strip .right { margin-left: auto; }
.lm-essay-header h1 {
  font-family: var(--font-display); font-size: 56px; line-height: 1.05;
  letter-spacing: -0.025em; font-weight: 500; margin: var(--s-5) 0 var(--s-3);
}
.lm-essay-header .dek {
  font-family: var(--font-serif); font-size: 22px; line-height: 1.5;
  font-style: italic; color: var(--ink-2); margin: 0;
  text-wrap: pretty;
}

/* Prose container — CSS grid: prose column + sidenote column.
   The grid is centered as a whole; the sidenote column sits to the
   right of the prose column at desktop, and disappears below 1100px
   (sidenotes flow inline beneath their paragraphs). */
.lm-prose {
  max-width: var(--measure);
  margin: 0 auto;
  position: relative;
}
.lm-prose-inner { position: relative; }

@media (min-width: 1100px) {
  .lm-prose {
    max-width: none;
    display: grid;
    grid-template-columns: var(--measure) var(--sidenote-w);
    column-gap: 32px;
    justify-content: center;
    align-items: start;
  }
  .lm-prose-inner {
    grid-column: 1 / 2;
    min-width: 0;
  }
  /* Sidenotes flow into the right column at the row of their preceding
     paragraph. They are still positioned absolutely against the inner
     column so they align vertically with the marker. */
}
.lm-prose p { font-family: var(--font-serif); font-size: 18px; line-height: 1.55; color: var(--ink); margin: 0 0 var(--rhythm); text-wrap: pretty; hyphens: auto; }
.lm-prose p.lead { font-size: 22px; line-height: 1.45; color: var(--ink-2); font-style: italic; }
.lm-prose .dropcap::first-letter {
  font-family: var(--font-display); font-size: 4.5em; line-height: 0.85;
  float: left; padding: 0.06em 0.1em 0 0; font-weight: 500; color: var(--ink);
}
.lm-prose h2 { font-family: var(--font-display); font-size: 30px; line-height: 1.2; letter-spacing: -0.01em; font-weight: 500; margin: var(--s-7) 0 var(--s-3); }
.lm-prose h3 { font-family: var(--font-serif); font-size: 22px; font-style: italic; font-weight: 600; margin: var(--s-6) 0 var(--s-2); }
.lm-prose blockquote { margin: var(--rhythm) 0; padding-left: var(--s-5); border-left: 2px solid var(--rule-strong); font-style: italic; color: var(--ink-2); }
.lm-prose pre { font-family: var(--font-mono); font-size: 14px; line-height: 1.6; background: var(--paper-2); border-left: 2px solid var(--rule-strong); padding: 16px 20px; overflow-x: auto; margin: var(--rhythm) 0; font-feature-settings: 'calt' 0; }
.lm-prose :not(pre) > code { font-family: var(--font-mono); font-size: 0.9em; background: var(--paper-2); padding: 0.05em 0.35em; border-radius: 2px; }
.lm-prose hr.ornament { border: 0; text-align: center; margin: var(--s-7) 0; color: var(--ink-3); letter-spacing: 1em; font-family: var(--font-serif); }
.lm-prose hr.ornament::before { content: "·  ·  ·"; }

.lm-prose a {
  color: var(--led); text-decoration: none;
  border-bottom: 1px solid currentColor;
  transition: background var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
  position: relative;
  cursor: pointer;
}
.lm-prose a:hover { color: var(--led-bright); background: var(--led-wash); }

.lm-prose .marker {
  font-family: var(--font-sans); font-size: 0.65em;
  vertical-align: super; color: var(--amber);
  font-weight: 700; margin-left: 0.05em;
  text-decoration: none; border: 0; cursor: pointer;
}
.lm-prose .marker:hover { color: var(--led); background: transparent; }

/* Sidenote */
.lm-sidenote {
  font-family: var(--font-sans); font-size: 13px; line-height: 1.5;
  color: var(--ink-2);
  margin: 0 0 var(--rhythm) 0;
}
@media (min-width: 1100px) {
  .lm-sidenote {
    position: absolute;
    width: var(--sidenote-w);
    /* project past the right edge of the prose column into the gap */
    left: calc(100% + 32px);
    margin-top: -0.2em;
  }
}
.lm-sidenote .num {
  color: var(--amber); font-weight: 700; font-size: 0.85em;
  vertical-align: super; margin-right: 4px;
}

/* Interactive figure */
.lm-figure {
  margin: var(--s-7) 0;
  padding: 0;
}
.lm-figure .frame {
  background: var(--paper-2);
  border-radius: 8px;
  padding: 24px;
  position: relative;
}
.lm-figure figcaption {
  font-family: var(--font-sans); font-size: 13px; line-height: 1.5;
  color: var(--ink-3); margin-top: var(--s-2);
}
.lm-figure figcaption strong { color: var(--ink-2); font-weight: 600; }

/* Link popup */
.lm-popup {
  position: absolute;
  background: var(--paper);
  border-radius: 4px;
  padding: 14px 16px;
  width: 320px;
  box-shadow: 0 1px 2px rgba(26,26,26,0.06), 0 8px 24px rgba(26,26,26,0.10);
  font-family: var(--font-sans); font-size: 13px; line-height: 1.5;
  color: var(--ink-2);
  z-index: 100;
  pointer-events: none;
}
[data-theme="dark"] .lm-popup,
.theme-dark .lm-popup { box-shadow: 0 1px 2px rgba(0,0,0,0.4), 0 8px 24px rgba(0,0,0,0.5); }
.lm-popup .src {
  font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--ink-3); font-weight: 700; margin-bottom: 6px;
}

/* Footer */
.lm-footer {
  border-top: 1px solid var(--rule);
  padding: var(--s-7) 32px var(--s-6);
  margin-top: var(--s-9);
}
.lm-footer-inner {
  max-width: var(--measure-wide); margin: 0 auto;
  display: flex; gap: var(--s-7); flex-wrap: wrap;
  font-family: var(--font-sans); font-size: 12px; color: var(--ink-3);
  line-height: 1.6;
}
.lm-footer h4 {
  font-family: var(--font-sans); font-size: 11px; text-transform: uppercase;
  letter-spacing: 0.08em; font-weight: 700; color: var(--ink-3);
  margin: 0 0 var(--s-2);
}
.lm-footer a { color: var(--ink-2); border-bottom: 1px solid var(--rule); }
.lm-footer a:hover { color: var(--ink); background: transparent; }

/* Buttons — hover italicizes the label (220ms ease-out).
   Width is pre-reserved with a hidden italic ghost so the button
   doesn't reflow on hover; data-label="…" must mirror the visible text. */
.lm-btn {
  font-family: var(--font-sans); font-size: 14px; font-weight: 600;
  padding: 10px 18px; background: var(--ink); color: var(--paper);
  border: 0; border-radius: 4px; cursor: pointer;
  position: relative;
  font-style: normal;
  transition: font-style 220ms cubic-bezier(.2,.7,.2,1),
              background var(--t-fast) var(--ease),
              color var(--t-fast) var(--ease),
              transform var(--t-fast) var(--ease);
}
.lm-btn::after {
  content: attr(data-label);
  font-style: italic;
  visibility: hidden;
  height: 0;
  display: block;
  overflow: hidden;
  pointer-events: none;
}
.lm-btn:hover { font-style: italic; }
.lm-btn:active { transform: translateY(1px); }

.lm-btn-secondary {
  background: transparent; color: var(--ink);
  border: 1px solid var(--ink); padding: 9px 17px;
}
.lm-btn-secondary:hover { background: var(--paper-2); }

/* Back link */
.lm-back {
  font-family: var(--font-sans); font-size: 12px;
  color: var(--ink-3); text-decoration: none; border: 0;
  text-transform: uppercase; letter-spacing: 0.08em; font-weight: 700;
  cursor: pointer;
  background: transparent;
  padding: 0; margin-bottom: var(--s-5); display: inline-block;
  white-space: nowrap;
  font-style: normal;
  transition: font-style 220ms cubic-bezier(.2,.7,.2,1),
              color var(--t-fast) var(--ease);
}
.lm-back:hover { color: var(--ink); font-style: italic; }
.lm-back:hover { color: var(--ink); }

/* Prose tables — hairline rows, sans column headers, mono lining figures. */
.lm-prose table {
  width: 100%;
  border-collapse: collapse;
  margin: var(--rhythm) 0;
  font-family: var(--font-serif);
  font-size: 16px;
  line-height: 1.5;
  color: var(--ink);
}
.lm-prose thead th {
  font-family: var(--font-sans);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 700;
  color: var(--ink-3);
  text-align: left;
  padding: var(--s-2) var(--s-3) var(--s-2) 0;
  border-bottom: 1px solid var(--rule-strong);
  white-space: nowrap;
}
.lm-prose tbody td {
  padding: var(--s-2) var(--s-3) var(--s-2) 0;
  border-bottom: 1px solid var(--rule);
  vertical-align: baseline;
}
.lm-prose tbody tr:last-child td { border-bottom: 0; }
.lm-prose tbody td:nth-child(2) {
  font-family: var(--font-mono);
  font-size: 13px;
  font-variant-numeric: lining-nums tabular-nums;
  color: var(--ink-2);
  width: 4em;
}

/* Markdown lists, in case future essays use them. */
.lm-prose ul, .lm-prose ol {
  font-family: var(--font-serif);
  font-size: 18px;
  line-height: 1.55;
  margin: 0 0 var(--rhythm);
  padding-left: 1.5em;
}
.lm-prose li { margin-bottom: var(--s-2); }

/* Plain markdown horizontal rule (without .ornament class). */
.lm-prose hr {
  border: 0;
  border-top: 1px solid var(--rule);
  margin: var(--s-7) 0;
}

/* Strong inside prose — semibold Garamond, not bolder than necessary. */
.lm-prose strong { font-weight: 600; color: var(--ink); }

/* Inline em-dash labels (e.g. "When — ...") sit a tick tighter. */
.lm-prose p strong { letter-spacing: 0; }

/* Landing-page modifier: prose without a reserved sidenote column.
   Used on pages that don't carry marginalia (e.g. the meetup index). */
@media (min-width: 1100px) {
  .lm-prose.lm-prose--solo {
    display: block;
    max-width: var(--measure);
    margin: 0 auto;
    grid-template-columns: none;
  }
  .lm-prose.lm-prose--solo .lm-prose-inner {
    grid-column: auto;
  }
}

/* Page padding tightens on narrow viewports. The design system's 32px
   horizontal padding is generous on phones; ease it down. */
@media (max-width: 600px) {
  .lm-page { padding: 32px 20px 64px; }
  .lm-header { padding: 14px 20px; }
  .lm-footer { padding: var(--s-6) 20px var(--s-5); }
  .lm-hero h1 { font-size: 48px; }
}
