/* Public site styles. The admin panel also loads this file for its tokens and
   for .prose, so the editor preview matches what readers will see. */

/* ---------- Tokens ---------- */

:root {
  color-scheme: light dark;

  --paper: #f7f3ea;
  --paper-deep: #eee8da;
  --ink: #23201c;
  --ink-soft: #5a5349;
  --ink-faint: #81786c;
  --rule: #d8cfbe;
  --accent: #8f2d24;
  --accent-ink: #fff8f0;

  --serif: "Literata", "Iowan Old Style", "Palatino Linotype", Palatino, Georgia,
    "Noto Serif TC", "Songti TC", serif;
  --display: "Cormorant Garamond", "Literata", "Iowan Old Style", Georgia,
    "Noto Serif TC", "Songti TC", serif;
  --mono: ui-monospace, "SFMono-Regular", "Cascadia Mono", Consolas, "Liberation Mono", monospace;

  --measure: 39rem;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #181511;
    --paper-deep: #221e18;
    --ink: #e9e2d5;
    --ink-soft: #b9afa0;
    --ink-faint: #8f8679;
    --rule: #3a342c;
    --accent: #e0907e;
    --accent-ink: #1b1512;
  }
}

/* ---------- Base ---------- */

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

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 1.125rem;
  line-height: 1.7;
  font-optical-sizing: auto;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  overflow-wrap: break-word;
}

::selection {
  background: var(--accent);
  color: var(--accent-ink);
}

a {
  color: var(--accent);
  text-decoration-thickness: 0.06em;
  text-underline-offset: 0.18em;
}

a:hover {
  text-decoration-thickness: 0.12em;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 2px;
}

h1,
h2,
h3 {
  font-family: var(--display);
  font-weight: 600;
  line-height: 1.15;
  text-wrap: balance;
}

.wrap {
  width: 100%;
  max-width: calc(var(--measure) + 3rem);
  margin-inline: auto;
  padding-inline: 1.5rem;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  left: 1rem;
  top: -4rem;
  z-index: 10;
  padding: 0.5rem 1rem;
  background: var(--accent);
  color: var(--accent-ink);
  text-decoration: none;
}

.skip-link:focus {
  top: 1rem;
}

/* Small letterspaced label: dates, "Tagged", page numbers. */
.meta {
  display: block;
  color: var(--ink-faint);
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

/* ---------- Header and footer ---------- */

.site-header {
  padding-block: 4.5rem 2.75rem;
  text-align: center;
}

.site-title {
  margin: 0;
  font-family: var(--display);
  font-size: clamp(2.6rem, 9vw, 3.75rem);
  font-weight: 600;
  line-height: 1;
  letter-spacing: -0.005em;
}

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

.site-tagline {
  margin: 0.9rem auto 0;
  max-width: 28rem;
  color: var(--ink-soft);
  font-style: italic;
  font-size: 1.05rem;
  line-height: 1.5;
}

.site-nav {
  display: flex;
  justify-content: center;
  gap: 2.25rem;
  margin-top: 2.25rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--rule);
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.site-nav a {
  padding-block: 0.25rem;
  color: var(--ink-soft);
  text-decoration: none;
  border-bottom: 1px solid transparent;
}

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

main {
  padding-bottom: 4rem;
}

.site-footer {
  padding-block: 2rem 3.5rem;
  color: var(--ink-faint);
  font-size: 0.85rem;
  text-align: center;
}

.site-footer .wrap > p {
  margin: 0;
  padding-top: 2rem;
  border-top: 1px solid var(--rule);
}

/* ---------- Post lists ---------- */

.page-header {
  padding-block: 0.5rem 1.5rem;
  text-align: center;
}

.page-header h1 {
  margin: 0.35rem 0 0;
  font-size: clamp(2rem, 6vw, 2.6rem);
}

.entry {
  padding-block: 2.5rem;
  border-bottom: 1px solid var(--rule);
}

.entry:first-child {
  padding-top: 1rem;
}

.entry:last-child {
  border-bottom: 0;
}

.entry-title {
  margin: 0.4rem 0 0.7rem;
  font-size: clamp(1.8rem, 5.5vw, 2.3rem);
}

.entry-title a {
  color: var(--ink);
  text-decoration: none;
}

.entry-title a:hover {
  color: var(--accent);
}

.entry-summary {
  margin: 0 0 1rem;
  color: var(--ink-soft);
}

.entry-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem 1.5rem;
}

.more {
  font-style: italic;
  font-size: 1rem;
  text-decoration: none;
}

.more::after {
  content: " \2192";
  font-style: normal;
}

.more:hover {
  text-decoration: underline;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1rem;
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 0.9rem;
  font-style: italic;
}

.tags a {
  color: var(--ink-faint);
  text-decoration: none;
}

.tags a::before {
  content: "#";
  opacity: 0.6;
}

.tags a:hover {
  color: var(--accent);
}

.empty {
  padding-block: 3rem;
  color: var(--ink-soft);
  font-style: italic;
  text-align: center;
}

.pager,
.post-nav {
  display: grid;
  gap: 1.5rem;
  margin-top: 2.5rem;
  padding-top: 2rem;
  border-top: 1px solid var(--rule);
}

.pager {
  grid-template-columns: 1fr auto 1fr;
  align-items: baseline;
}

.pager a {
  font-style: italic;
  text-decoration: none;
}

.pager a:hover {
  text-decoration: underline;
}

.pager-newer::before {
  content: "\2190  ";
  font-style: normal;
}

.pager-older {
  text-align: right;
}

.pager-older::after {
  content: " \2192";
  font-style: normal;
}

/* ---------- A single post ---------- */

.post-header {
  padding-top: 0.5rem;
  text-align: center;
}

.post-header h1 {
  margin: 0.6rem 0 0;
  font-size: clamp(2.3rem, 8vw, 3.3rem);
  line-height: 1.08;
}

.post-header .tags {
  justify-content: center;
  margin-top: 1.1rem;
}

/* A hairline with a small diamond in the middle. */
.ornament {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.9rem;
  margin-block: 2.25rem 2.5rem;
}

.ornament::before,
.ornament::after {
  content: "";
  width: 3.5rem;
  height: 1px;
  background: var(--rule);
}

.ornament span {
  width: 0.4rem;
  height: 0.4rem;
  background: var(--accent);
  transform: rotate(45deg);
}

.prose {
  font-size: 1.1875rem;
  line-height: 1.8;
}

.prose > :first-child {
  margin-top: 0;
}

.prose > :last-child {
  margin-bottom: 0;
}

.prose p,
.prose ul,
.prose ol,
.prose blockquote,
.prose pre,
.prose table {
  margin-block: 0 1.45em;
}

.prose h1,
.prose h2,
.prose h3,
.prose h4 {
  margin-block: 2.2em 0.6em;
}

.prose h1 {
  font-size: 2rem;
}

.prose h2 {
  font-size: 1.8rem;
}

.prose h3 {
  font-size: 1.45rem;
}

.prose h4 {
  font-family: var(--serif);
  font-size: 1rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.prose blockquote {
  margin-inline: 0;
  padding-left: 1.4rem;
  border-left: 2px solid var(--accent);
  color: var(--ink-soft);
  font-style: italic;
}

.prose blockquote em {
  font-style: normal;
}

.prose ul,
.prose ol {
  padding-left: 1.4rem;
}

.prose li + li {
  margin-top: 0.3em;
}

.prose img {
  display: block;
  max-width: 100%;
  height: auto;
  margin-inline: auto;
  border-radius: 2px;
}

.prose hr {
  height: 1rem;
  margin-block: 2.5rem;
  border: 0;
  color: var(--accent);
  text-align: center;
  line-height: 1rem;
}

.prose hr::after {
  content: "\2217\2003\2217\2003\2217";
  font-size: 1.05rem;
  letter-spacing: 0;
}

.prose code {
  padding: 0.1em 0.3em;
  background: var(--paper-deep);
  border-radius: 3px;
  font-family: var(--mono);
  font-size: 0.82em;
}

.prose pre {
  padding: 1rem 1.2rem;
  overflow-x: auto;
  background: var(--paper-deep);
  border-radius: 4px;
  line-height: 1.55;
}

.prose pre code {
  padding: 0;
  background: none;
}

.prose table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95em;
}

.prose th,
.prose td {
  padding: 0.45em 0.6em;
  border-bottom: 1px solid var(--rule);
  text-align: left;
}

.post-nav {
  grid-template-columns: 1fr 1fr;
  margin-top: 3.5rem;
}

.post-nav a {
  text-decoration: none;
}

.post-nav-newer {
  grid-column: 2;
  text-align: right;
}

.post-nav-title {
  display: block;
  margin-top: 0.3rem;
  color: var(--ink);
  font-family: var(--display);
  font-size: 1.4rem;
  font-weight: 600;
  line-height: 1.2;
}

.post-nav a:hover .post-nav-title {
  color: var(--accent);
}

/* ---------- Archive ---------- */

.archive-year h2,
.archive-tags h2 {
  margin: 2.5rem 0 0.75rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--rule);
  font-size: 1.7rem;
}

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

.archive-list li {
  display: grid;
  grid-template-columns: 4.5rem 1fr;
  align-items: baseline;
  gap: 1rem;
  padding-block: 0.4rem;
}

.archive-list a {
  color: var(--ink);
  text-decoration: none;
}

.archive-list a:hover {
  color: var(--accent);
  text-decoration: underline;
}

.tag-index {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1.6rem;
  margin: 0;
  padding: 0;
  list-style: none;
  font-style: italic;
}

.tag-index a {
  text-decoration: none;
}

.tag-index a:hover {
  text-decoration: underline;
}

.tag-index .count {
  color: var(--ink-faint);
  font-size: 0.8rem;
  font-style: normal;
}

/* ---------- 404 and error pages ---------- */

.notice-page {
  padding-block: 2rem 3rem;
  text-align: center;
}

.notice-page h1 {
  margin: 0.5rem 0 1rem;
  font-size: clamp(2rem, 7vw, 2.8rem);
}

.notice-page p {
  color: var(--ink-soft);
}

@media (max-width: 30rem) {
  body {
    font-size: 1.0625rem;
  }

  .site-header {
    padding-block: 3rem 2rem;
  }

  .site-nav {
    gap: 1.5rem;
  }

  .prose {
    font-size: 1.125rem;
  }

  .post-nav {
    grid-template-columns: 1fr;
  }

  .post-nav-newer {
    grid-column: 1;
    text-align: left;
  }
}

@media print {
  .site-nav,
  .post-nav,
  .pager,
  .skip-link {
    display: none;
  }

  body {
    background: #fff;
    color: #000;
  }
}
