/* Wander with Carter
   An unlined journal page: warm paper, dark ink, a lot of space. */

:root {
  --paper: #f5f0e6;
  --ink: #2a2622;
  --ink-soft: #6a6258;
  --rule: #ddd4c4;
  --todo: #b3261e;
  --accent: #4f5d3a;   /* deep olive, for section headings that need to stand out */
  --measure: 34rem;
  --page-width: 54rem;  /* writing column + the list of posts on the right */
  --serif: "EB Garamond", "Iowan Old Style", Palatino, Georgia, serif;
  color-scheme: light;
}

/* Fonts are hosted with the site. Both are SIL Open Font License. */

/* Yuji Syuku, subset to the letters in "Wander with Carter" only.
   If the wordmark text changes, regenerate this file. */
@font-face {
  font-family: "Yuji Syuku Wordmark";
  src: url("/assets/fonts/yuji-syuku-wordmark.woff2") format("woff2");
  font-display: swap;
}

/* EB Garamond, Latin subset. */
@font-face {
  font-family: "EB Garamond";
  src: url("/assets/fonts/eb-garamond-normal-latin.woff2") format("woff2");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: "EB Garamond";
  src: url("/assets/fonts/eb-garamond-italic-latin.woff2") format("woff2");
  font-style: italic;
  font-weight: 400;
  font-display: swap;
}

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

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 1.25rem; /* Garamond runs small; this reads like ~18px in other serifs */
  line-height: 1.65;
  padding: 0 1.25rem;
}

.page {
  max-width: var(--page-width);
  margin: 0 auto;
  padding: 4rem 0 5rem;
}

/* Header and navigation */

.site-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.5rem 1.5rem;
  margin-bottom: 5rem;
}

.site-name {
  font-family: "Yuji Syuku Wordmark", var(--serif);
  font-size: 2rem;
  line-height: 1.1;
  color: var(--ink);
  text-decoration: none;
}

.site-nav {
  display: flex;
  gap: 1.5rem;
  font-size: 0.95rem;
}

.site-nav a {
  color: var(--ink-soft);
  text-decoration: none;
}

.site-nav a:hover,
.site-nav a[aria-current="page"] { color: var(--ink); }

/* Type */

h1, h2, h3 {
  font-weight: normal;
  line-height: 1.3;
  margin: 0 0 1.5rem;
}

h1 { font-size: 1.9rem; }
h2 { font-size: 1.3rem; margin-top: 4rem; }
h3 { font-size: 1.1rem; margin-bottom: 0.25rem; }

p { margin: 0 0 1.4rem; }

a { color: var(--ink); text-decoration-color: var(--rule); text-underline-offset: 0.2em; }
a:hover { text-decoration-color: var(--ink); }

.quiet { color: var(--ink-soft); }
.small { font-size: 0.9rem; }

hr {
  border: 0;
  height: 1px;
  background: var(--rule);
  margin: 4rem 0;
}

/* Images */

figure { margin: 0 0 3rem; }

figure img {
  display: block;
  width: 100%;
  height: auto;
}

figcaption {
  margin-top: 0.75rem;
  font-size: 0.9rem;
  color: var(--ink-soft);
}

.portrait { max-width: 18rem; }

/* Lists of writing and shelf entries */

.entries { list-style: none; margin: 0; padding: 0; }

.entries li { margin-bottom: 2.5rem; }

.entries .date {
  display: block;
  font-size: 0.85rem;
  color: var(--ink-soft);
}

/* A post */

.post-meta {
  font-size: 0.9rem;
  color: var(--ink-soft);
  margin-bottom: 3rem;
}

.post-end {
  margin-top: 4rem;
  font-size: 0.95rem;
}

/* Needs Chris's update. Red, like a correction pen.
   When the text is final, remove class="todo" (or the whole <span>).
   Before launch, this must return nothing:  grep -rn 'class="[^"]*todo' --include='*.html' . */

.todo { color: var(--todo); }

/* Footer */

.site-footer {
  margin-top: 6rem;
  padding-top: 2rem;
  border-top: 1px solid var(--rule);
  font-size: 0.9rem;
  color: var(--ink-soft);
}

.site-footer a { color: var(--ink-soft); }

@media (max-width: 480px) {
  body { font-size: 1.1875rem; }
  .page { padding-top: 2.5rem; }
  .site-header { margin-bottom: 3.5rem; }
  .site-name { font-size: 1.7rem; }
  h1 { font-size: 1.6rem; }
}

/* Editor notes: preview builds only. The live build refuses to run while any remain. */

.editor-notes {
  margin-top: 4rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--rule);
  font-size: 0.95rem;
}

.editor-notes ol { padding-left: 1.25rem; }
.editor-notes li { margin-bottom: 0.75rem; }
.todo a { color: inherit; }

/* Images placed in Markdown posts */
article img { display: block; max-width: 100%; height: auto; margin: 2rem 0; }

/* Home intro: small portrait beside the welcome text. */
.intro { display: grid; grid-template-columns: 7rem 1fr; gap: 1.25rem; align-items: start; margin-bottom: 1rem; }
.intro .portrait { max-width: none; margin: 0.35rem 0 0; }
.intro .intro-text > :last-child { margin-bottom: 0; }
@media (min-width: 40rem) { .intro { grid-template-columns: 9.5rem 1fr; gap: 1.75rem; } }
/* Balance: portrait about 25% larger, welcome text slightly smaller. */
.intro { grid-template-columns: 8.75rem 1fr; }
@media (min-width: 40rem) { .intro { grid-template-columns: 12rem 1fr; gap: 1.75rem; } }
.intro .intro-text { font-size: 1.08rem; line-height: 1.6; }
.intro .intro-text p { margin-bottom: 0.9rem; }

/* Quotes in posts:  > "Quote"  then  >  then  > <cite>Name, Source</cite> */
blockquote {
  margin: 2rem 0;
  padding-left: 1.25rem;
  border-left: 2px solid var(--rule);
  font-style: italic;
}
blockquote p { margin: 0 0 0.4rem; }
blockquote cite {
  display: block;
  font-style: normal;
  font-size: 0.92rem;
  color: var(--ink-soft);
}
blockquote cite em { font-style: italic; }

/* Photos in posts, with the photographer's credit underneath */
article .photo { margin: 2rem 0; }
article .photo img { margin: 0; width: 100%; }
article .photo .credit { font-size: 0.8rem; color: var(--ink-soft); margin-top: 0.4rem; text-align: right; }

/* Shelf: content/shelf.md */
.shelf h2 {
  margin: 3rem 0 1rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--rule);
  color: var(--accent);
  font-size: 1rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.shelf ul { list-style: none; padding: 0; margin: 0 0 2.5rem; }
.shelf li { margin: 0 0 0.9rem; }

/* Page width: text stays at a comfortable measure; writing pages add a
   column on the right listing every post. On phones the list drops below. */
main > :not(.with-sidebar),
.site-footer { max-width: var(--measure); }

.with-sidebar { display: grid; grid-template-columns: minmax(0, 1fr); gap: 3rem; }
.with-sidebar > article { min-width: 0; max-width: var(--measure); }
@media (min-width: 52rem) {
  .with-sidebar { grid-template-columns: minmax(0, var(--measure)) 14rem; justify-content: space-between; }
  .more-writing { position: sticky; top: 2rem; align-self: start; }
}
.with-sidebar > article > h2:first-child { font-size: 1.9rem; margin-top: 0; }

.more-writing { border-top: 1px solid var(--rule); padding-top: 1.5rem; }
@media (min-width: 52rem) { .more-writing { border-top: 0; border-left: 1px solid var(--rule); padding: 0 0 0 1.5rem; } }
.more-writing h2 {
  margin: 0 0 1.25rem;
  color: var(--accent);
  font-size: 0.9rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.more-writing .entries li { margin-bottom: 1.25rem; font-size: 1rem; line-height: 1.4; }
.more-writing a { text-decoration: none; }
.more-writing a:hover { text-decoration: underline; text-decoration-color: var(--rule); }
.more-writing a[aria-current="page"] { color: var(--accent); }

.intro + .with-sidebar { margin-top: 4rem; }
