/* ryan-peng.com — Frontispiece
   One typeface, warm paper, a single accent used sparingly. */

:root {
  --paper: #FAF7F1;
  --mat: #F2EDE3;
  --ink: #2A2622;
  --ink-soft: #3D3731;
  --muted: #6B635A;
  --rule: #DED6CA;
  --frame: #B9AE9F;
  --frame-inner: #D8CFC2;
  --placeholder: #DDD5C8;
  --accent: #6E2A20;
  --measure: 800px;
  --reading: 700px;  /* essay text stays at a comfortable line length */
}

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

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: "EB Garamond", Garamond, Georgia, serif;
  font-size: 18px;
  line-height: 1.6;
  font-variant-numeric: oldstyle-nums;
  padding: 36px 24px 96px;
}

a {
  color: var(--ink);
  text-decoration: underline dotted #9C9286;
  text-underline-offset: 3px;
}
a:hover { color: var(--accent); text-decoration: underline solid var(--accent); }

::selection { background: #E8DCCB; }

/* ----- Masthead ------------------------------------------------------- */

.masthead {
  max-width: var(--measure);
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px 24px;
}
.masthead a { text-decoration: none; }
.masthead-name {
  font-variant-caps: all-small-caps;
  letter-spacing: 0.08em;
  font-weight: 500;
}
.masthead nav {
  display: flex;
  flex-wrap: wrap;
  column-gap: 18px;
  row-gap: 2px;
  font-variant-caps: all-small-caps;
  letter-spacing: 0.06em;
  font-size: 16px;
}
.masthead nav a { color: var(--muted); }
.masthead nav a:hover { color: var(--accent); }
.masthead nav a[aria-current="page"] { color: var(--ink); }

/* ----- Column ----------------------------------------------------------- */

.column {
  max-width: var(--measure);
  margin: 0 auto;
  padding-top: 88px;
  display: flex;
  flex-direction: column;
  gap: 52px;
}

.meta { font-size: 14px; color: var(--muted); }
.meta a { color: var(--muted); }
.sep { padding: 0 0.15em; }

/* ----- Frontispiece (homepage intro) ------------------------------------ */

.intro {
  display: flex;
  flex-wrap: wrap;
  gap: 32px 40px;
  align-items: flex-start;
}
.intro-text {
  flex: 1 1 300px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.intro-text p { margin: 0; }
.intro h1 {
  margin: 0;
  font-size: 30px;
  line-height: 1.1;
  font-weight: 400;
  font-variant-caps: small-caps;
  letter-spacing: 0.03em;
}

.frontispiece {
  flex: 0 0 196px;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.frame { border: 1px solid var(--frame); padding: 4px; }
.frame-inner { border: 1px solid var(--frame-inner); padding: 12px; background: var(--mat); }
.frontispiece img, .frontispiece .placeholder {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 5;
  object-fit: cover;
}
.placeholder {
  background: var(--placeholder);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 8px;
  font-style: italic;
  font-size: 12px;
  line-height: 1.3;
  color: #5A5249;
  text-align: center;
}
.frontispiece figcaption {
  text-align: center;
  font-size: 13px;
  line-height: 1.35;
  color: var(--muted);
  font-style: italic;
}

/* ----- Sections ----------------------------------------------------------- */

.section { display: flex; flex-direction: column; gap: 16px; }
.section > p { margin: 0; }
.section-title {
  margin: 0;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--rule);
  font-size: 18px;
  font-weight: 500;
  font-variant-caps: all-small-caps;
  letter-spacing: 0.08em;
}
.num { color: var(--accent); margin-right: 8px; }

.entry { display: flex; flex-direction: column; }
.entry-line { margin: 0; }

.links { display: flex; flex-wrap: wrap; column-gap: 18px; row-gap: 2px; }

.colophon {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding-top: 12px;
  border-top: 1px solid var(--rule);
  font-size: 13px;
  line-height: 1.5;
  color: var(--muted);
  font-style: italic;
}

/* ----- Essay page -------------------------------------------------------- */

.essay-head { display: flex; flex-direction: column; gap: 12px; }
.essay-head h1 {
  margin: 0;
  font-size: 34px;
  line-height: 1.15;
  font-weight: 400;
}
.essay-head .abstract { margin: 0; font-style: italic; font-size: 20px; line-height: 1.5; color: var(--ink-soft); }

.prose { font-size: 19px; line-height: 1.65; hyphens: auto; -webkit-hyphens: auto; max-width: var(--reading); }
.prose > :first-child { margin-top: 0; }
.prose p { margin: 0 0 1.1em; }
.prose h2 {
  margin: 2em 0 0.6em;
  font-size: 19px;
  font-weight: 500;
  font-variant-caps: all-small-caps;
  letter-spacing: 0.08em;
}
.prose h3 { margin: 1.6em 0 0.4em; font-size: 19px; font-weight: 400; font-style: italic; }
.prose blockquote {
  margin: 1.4em 0;
  padding: 0 0 0 1.4em;
  font-style: italic;
  color: var(--ink-soft);
}
.prose hr { border: 0; text-align: center; margin: 2em 0; }
.prose hr::after { content: "⁂"; color: var(--muted); }
.prose img { max-width: 100%; height: auto; display: block; margin: 1.6em auto; }
.prose ul, .prose ol { padding-left: 1.4em; margin: 0 0 1.1em; }

.footnote-ref a, .footnote-backref { text-decoration: none; color: var(--accent); }
.footnote-ref { font-size: 0.7em; line-height: 0; }
.prose hr.footnotes-sep { border: 0; border-top: 1px solid var(--rule); margin: 2.4em 0 1em; width: 120px; text-align: left; }
.prose hr.footnotes-sep::after { content: none; }
.footnotes { font-size: 15px; line-height: 1.55; color: var(--ink-soft); }
.footnotes-list { padding-left: 1.4em; margin: 0; }
.footnotes-list p { margin: 0 0 0.6em; }

.essay-foot {
  border-top: 1px solid var(--rule);
  padding-top: 14px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  gap: 8px 24px;
  font-size: 15px;
}
.essay-foot > :last-child { text-align: right; }
@media (max-width: 520px) {
  .essay-foot { grid-template-columns: 1fr; }
  .essay-foot > :last-child { text-align: left; }
}

/* ----- Interests (beside the portrait) ---------------------------------- */

.interests { display: flex; flex-direction: column; gap: 14px; }
.interests-label {
  display: flex;
  align-items: center;
  gap: 12px;
  font-variant-caps: all-small-caps;
  letter-spacing: 0.08em;
  font-size: 16px;
  color: var(--muted);
}
.interests-label::after { content: ""; flex: 1; border-top: 1px solid var(--rule); }
.interests ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.interests li { line-height: 1.45; }
.interests em { display: block; font-style: italic; color: var(--ink-soft); }

/* ----- Rolling pages: Writing and Art ------------------------------------- */

.page-head { display: flex; flex-direction: column; gap: 6px; }
.page-head h1 {
  margin: 0;
  font-size: 30px;
  line-height: 1.1;
  font-weight: 400;
  font-variant-caps: small-caps;
  letter-spacing: 0.03em;
}

.toc { border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); padding: 14px 0 16px; }
.toc-label {
  font-variant-caps: all-small-caps;
  letter-spacing: 0.08em;
  font-size: 16px;
  color: var(--muted);
  margin-bottom: 6px;
}
.toc ol { margin: 0; padding-left: 1.6em; display: flex; flex-direction: column; gap: 2px; }
.toc li::marker { color: var(--muted); font-size: 0.9em; }

.post { display: flex; flex-direction: column; gap: 20px; scroll-margin-top: 24px; }
.post + .post::before {
  content: "⁂";
  display: block;
  text-align: center;
  color: var(--muted);
  margin: 4px 0 28px;
}
.post-head { display: flex; flex-direction: column; gap: 8px; }
.post-head h2 { margin: 0; font-size: 26px; line-height: 1.2; font-weight: 400; }
.post-head h2 a { text-decoration: none; }
.post-head h2 a:hover { text-decoration: underline solid var(--accent); }
.post-head .abstract { margin: 0; font-style: italic; color: var(--ink-soft); }
.post-end { font-size: 14px; }
.post-end a { color: var(--muted); text-decoration: none; }

.work .frame { align-self: flex-start; width: fit-content; }
.work img { display: block; width: auto; height: auto; max-width: min(520px, calc(100vw - 90px)); max-height: 75vh; }

@media (max-width: 520px) {
  body { font-size: 17px; padding-top: 24px; }
  .column { padding-top: 48px; gap: 44px; }
  .frontispiece { flex-basis: 150px; }
  .prose { font-size: 18px; }
}
