/* ---------------------------------------------------------------
   kaipi.net — design v1
   --------------------------------------------------------------- */

/* ---- @font-face ---- */

@font-face {
  font-family: 'Cormorant Garamond';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('/static/fonts/CormorantGaramond-Medium.woff2') format('woff2');
}
@font-face {
  font-family: 'Cormorant Garamond';
  font-style: italic;
  font-weight: 400;
  font-display: swap;
  src: url('/static/fonts/CormorantGaramond-Italic.woff2') format('woff2');
}
@font-face {
  font-family: 'Spectral';
  font-style: normal;
  font-weight: 300;
  font-display: swap;
  src: url('/static/fonts/Spectral-Light.woff2') format('woff2');
}
@font-face {
  font-family: 'Spectral';
  font-style: italic;
  font-weight: 300;
  font-display: swap;
  src: url('/static/fonts/Spectral-LightItalic.woff2') format('woff2');
}
@font-face {
  font-family: 'IBM Plex Sans';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('/static/fonts/IBMPlexSans-Medium.woff2') format('woff2');
}
@font-face {
  font-family: 'IBM Plex Mono';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/static/fonts/IBMPlexMono-Regular.woff2') format('woff2');
}
@font-face {
  font-family: 'Italiana';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/static/fonts/Italiana-Regular.woff2') format('woff2');
}

/* ---- tokens ---- */

:root {
  --bg: #ECE9DE;
  --text: #3A3A3A;
  --accent: #8B9A66;
  --muted: #7A776F;
  --rule: #C9C4B3;
  --tint: rgba(58, 58, 58, 0.06);
  --accent-tint: rgba(139, 154, 102, 0.15);
  --name: #3D2817;     /* Pantone Espresso — homepage name */

  --serif-display: 'Cormorant Garamond', Georgia, 'Times New Roman', serif;
  --serif-body: 'Spectral', Georgia, 'Times New Roman', serif;
  --sans: 'IBM Plex Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, 'SF Mono', Menlo, monospace;
}

/* ---- reset / base ---- */

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--serif-body);
  font-weight: 300;
  font-size: 17px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

a { color: inherit; text-decoration: none; }

/* ---- container ---- */

.site {
  container-type: inline-size;
  container-name: site;
  max-width: 1100px;
  margin: 0 auto;
  padding: 72px 8vw 56px;
}

/* ---- header (shared) ---- */

header.hero { margin-bottom: 56px; }
header.hero .top {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 28px;
  flex-wrap: wrap;
}
header.hero .name-wrap {
  display: flex;
  align-items: center;
  gap: 22px;
}
header.hero .portrait {
  width: 84px;
  height: 84px;
  flex-shrink: 0;
  display: block;
}
header.hero .name-block {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
header.hero .name {
  font-family: 'Italiana', Georgia, 'Times New Roman', serif;
  font-weight: 400;
  font-size: clamp(44px, 7.5cqw, 62px);
  line-height: 0.95;
  letter-spacing: -0.015em;
  margin: 0;
  color: var(--name);
}
header.hero .name a { color: var(--name); }
header.hero .epigraph {
  font-family: var(--serif-display);
  font-style: italic;
  font-size: 19px;
  color: var(--muted);
  font-weight: 400;
}

header.wordmark {
  border-bottom: 1px solid var(--rule);
  padding-bottom: 18px;
  margin-bottom: 56px;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
}
header.wordmark .name {
  font-family: 'Italiana', Georgia, 'Times New Roman', serif;
  font-size: 26px;
  font-weight: 400;
  letter-spacing: -0.01em;
  margin: 0;
  color: var(--name);
}
header.wordmark .name a { color: var(--name); }
header.wordmark .name a:hover { color: var(--accent); }

/* ---- nav ---- */

nav.main {
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 500;
  display: flex;
  align-items: baseline;
  gap: 22px;
  flex-wrap: wrap;
}
nav.main a { color: var(--muted); }
nav.main a:hover { color: var(--accent); }
nav.main .email-pair {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
}
nav.main .email-pair .lbl {
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 600;
}
nav.main .email-pair .sep { color: var(--rule); }
nav.main .email-pair a { color: var(--text); }
nav.main .email-pair a:hover { color: var(--accent); }

/* ---- homepage body ---- */

.home-grid {
  display: grid;
  grid-template-columns: 1.4fr 1px 1fr;
  gap: 48px;
  align-items: start;
}
.home-grid .divider {
  background: var(--rule);
  align-self: stretch;
  width: 1px;
}
.home-grid .bio p { margin: 0 0 1em; }
.home-grid .bio p:last-child { margin-bottom: 0; }
.home-grid .bio a {
  color: var(--text);
  box-shadow: inset 0 -2px 0 var(--accent);
}
.home-grid .bio a:hover { color: var(--accent); }

/* ---- post list (used on home and /writing/) ---- */

.post-list .section-title {
  font-family: var(--serif-display);
  font-style: italic;
  font-size: 22px;
  font-weight: 500;
  color: var(--accent);
  margin: 0 0 20px;
}
.post-list ul { list-style: none; padding: 0; margin: 0; }
.post-list ul li { padding: 14px 0; }
.post-list ul li + li { border-top: 1px solid var(--rule); }
.post-list ul li a {
  color: var(--text);
  font-family: var(--serif-display);
  font-size: 22px;
  font-weight: 500;
  line-height: 1.2;
  display: block;
}
.post-list ul li a:hover { color: var(--accent); }
.post-list ul li .date {
  font-family: var(--sans);
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  margin-top: 6px;
  display: block;
}

/* The "writing" page (no two-column) lets the list breathe across full width up to a reading max */
.writing-page .post-list { max-width: 720px; }

.empty-state {
  font-family: var(--serif-display);
  font-style: italic;
  font-size: 18px;
  color: var(--muted);
  margin: 0;
}

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

article.post {
  max-width: 720px;
  margin: 0 auto;
}
article.post .meta {
  font-family: var(--sans);
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.16em;
  margin-bottom: 18px;
}
.tag-line a {
  color: var(--accent);
  text-decoration: none;
}
.tag-line a:hover { color: var(--text); }
article.post h1.title {
  font-family: var(--serif-display);
  font-weight: 500;
  font-size: 44px;
  line-height: 1.05;
  letter-spacing: -0.015em;
  margin: 0 0 14px;
}
article.post .subtitle {
  font-family: var(--serif-display);
  font-style: italic;
  font-size: 22px;
  color: var(--muted);
  margin: 0 0 48px;
  font-weight: 400;
  line-height: 1.3;
}

article.post p,
article.post ul,
article.post ol {
  font-weight: 300;
  font-size: 18px;
  line-height: 1.7;
  margin: 0 0 1.1em;
}
article.post p a, article.post li a {
  color: var(--text);
  box-shadow: inset 0 -2px 0 var(--accent);
}
article.post p a:hover, article.post li a:hover { color: var(--accent); }

article.post h2 {
  font-family: var(--serif-display);
  font-weight: 500;
  font-size: 30px;
  letter-spacing: -0.01em;
  line-height: 1.15;
  margin: 2em 0 0.4em;
}
article.post h3 {
  font-family: var(--serif-display);
  font-style: italic;
  font-weight: 500;
  font-size: 22px;
  margin: 1.8em 0 0.4em;
}

article.post blockquote {
  font-style: italic;
  color: var(--muted);
  border-left: 3px solid var(--accent);
  margin: 1.5em 0;
  padding: 0.2em 0 0.2em 1.2em;
  font-size: 19px;
  line-height: 1.55;
}
article.post blockquote p { font-size: inherit; margin: 0 0 0.6em; }
article.post blockquote p:last-child { margin: 0; }

article.post ul, article.post ol { padding-left: 1.4em; }
article.post li { margin-bottom: 0.4em; }
article.post li::marker { color: var(--accent); }

/* Code */
article.post code {
  font-family: var(--mono);
  font-size: 0.86em;
  background: var(--tint);
  padding: 1px 6px;
  border-radius: 3px;
}
article.post pre {
  font-family: var(--mono);
  font-size: 14px;
  background: var(--tint);
  padding: 18px 20px;
  border-radius: 4px;
  overflow-x: auto;
  line-height: 1.5;
  margin: 1.5em 0;
}
article.post pre code { background: none; padding: 0; font-size: inherit; }

/* Figures */
article.post figure { margin: 2em 0; }
article.post figure img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 4px;
  box-shadow: 0 2px 12px rgba(58, 58, 58, 0.12);
}
article.post figure figcaption {
  font-family: var(--sans);
  font-size: 12px;
  color: var(--muted);
  text-align: center;
  margin-top: 10px;
  letter-spacing: 0.04em;
}

/* Section ornament — "diamonds on a line" via SVG background on hr */
article.post hr {
  border: 0;
  background: none;
  margin: 2.6em auto;
  width: 100px;
  height: 14px;
  display: block;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 14' fill='none' stroke='%238B9A66' stroke-width='0.9'><line x1='2' y1='7' x2='98' y2='7'/><polygon points='22,7 28,3 34,7 28,11' fill='%23ECE9DE'/><polygon points='44,7 50,3 56,7 50,11' fill='%23ECE9DE'/><polygon points='66,7 72,3 78,7 72,11' fill='%23ECE9DE'/></svg>");
  background-repeat: no-repeat;
  background-position: center;
}

/* Footnotes (Pandoc emits .footnotes section) */
article.post .footnotes {
  margin-top: 4em;
  padding-top: 2em;
  border-top: 1px solid var(--rule);
  font-size: 14px;
  line-height: 1.6;
  color: var(--muted);
  font-weight: 300;
}
article.post .footnotes ol { padding-left: 1.2em; font-size: 14px; }
article.post .footnotes p { font-size: 14px; margin: 0 0 0.6em; }
article.post .footnotes a { color: var(--accent); }
article.post sup a, article.post a.footnote-ref {
  color: var(--accent);
  font-family: var(--sans);
  font-size: 0.7em;
  font-weight: 500;
  text-decoration: none;
}

/* Math (KaTeX overrides) */
article.post .katex { font-size: 1.04em; color: var(--text); }
article.post .katex-display { margin: 1.5em 0; overflow-x: auto; overflow-y: hidden; }

/* Prev/next nav */
nav.post-nav {
  max-width: 720px;
  margin: 0 auto;
  padding-top: 48px;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 24px;
  flex-wrap: wrap;
  font-family: var(--sans);
  font-size: 12px;
  color: var(--muted);
}
nav.post-nav a { color: var(--text); font-weight: 500; }
nav.post-nav a:hover { color: var(--accent); }

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

footer.site-footer {
  margin-top: 96px;
  padding: 32px 0;
  text-align: center;
  font-family: var(--sans);
  font-size: 11px;
  color: rgba(58, 58, 58, 0.4);
  letter-spacing: 0.02em;
}

/* ---- responsive ---- */

@container site (max-width: 760px) {
  .site { padding: 56px 7cqw 56px; }
  .home-grid { grid-template-columns: 1fr; gap: 20px; }
  .home-grid .divider {
    width: 100px;
    height: 14px;
    background: none;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 14' fill='none' stroke='%238B9A66' stroke-width='0.9'><line x1='2' y1='7' x2='98' y2='7'/><polygon points='22,7 28,3 34,7 28,11' fill='%23ECE9DE'/><polygon points='44,7 50,3 56,7 50,11' fill='%23ECE9DE'/><polygon points='66,7 72,3 78,7 72,11' fill='%23ECE9DE'/></svg>");
    background-repeat: no-repeat;
    background-position: center;
    align-self: center;
    margin: 8px 0;
  }
  header.hero { margin-bottom: 44px; }
  article.post h1.title { font-size: 36px; }
}

@container site (max-width: 520px) {
  .site { padding: 40px 24px 56px; }
  header.hero .top { flex-direction: column; align-items: flex-start; gap: 16px; }
  header.hero nav.main { width: 100%; }
  header.hero .name { font-size: 44px; }
  header.hero .epigraph { font-size: 17px; }
  header.hero .portrait { width: 64px; height: 64px; }
  header.hero .name-wrap { gap: 16px; }
  article.post { font-size: 16px; }
  article.post p, article.post ul, article.post ol { font-size: 16px; }
  article.post h1.title { font-size: 32px; }
  article.post h2 { font-size: 26px; }
  article.post h3 { font-size: 20px; }
  article.post .subtitle { font-size: 19px; }
  .post-list ul li a { font-size: 19px; }
  header.wordmark { padding-bottom: 14px; margin-bottom: 36px; }
  header.wordmark .name { font-size: 20px; }
}
