/* so-simple-modern — the So Simple identity on modern CSS.
   No framework, no build step, no external fonts: system stacks carry the
   typography the 2016 theme got from Source Sans Pro + Volkhov.

   Structure borrowed from mmistakes/so-simple-theme: small-caps nav, centred
   masthead with the site logo, serif italic titles and dates, sans body. */

:root {
  --bg: #fff;
  --text: #2b2b2b;
  --text-soft: #6d6d6d;
  --rule: #e6e6e6;
  --accent: #2b6cb0;
  --masthead-bg: #fafafa;
  --measure: 46rem;

  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, "Times New Roman", serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

html[data-theme="dark"] {
  --bg: #14161a;
  --text: #dcdcdc;
  --text-soft: #9a9a9a;
  --rule: #2a2e35;
  --accent: #7fb0e8;
  --masthead-bg: #101216;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 1.0625rem;
  line-height: 1.7;
  text-rendering: optimizeLegibility;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: .15em; }

.wrap {
  max-width: var(--measure);
  margin: 0 auto;
  padding: 0 1.25rem;
}

/* ---------- navigation: small caps, right aligned, like the original ---------- */

.navigation-wrapper {
  border-bottom: 1px solid var(--rule);
  background: var(--bg);
}

.site-nav {
  max-width: var(--measure);
  margin: 0 auto;
  padding: .9rem 1.25rem;
  display: flex;
  gap: 1.4rem;
  justify-content: flex-end;
  align-items: center;
  flex-wrap: wrap;
}

.site-nav a {
  font-size: .78rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--text-soft);
}

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

.theme-toggle {
  border: 1px solid var(--rule);
  background: none;
  color: var(--text-soft);
  border-radius: 999px;
  width: 1.9rem;
  height: 1.9rem;
  line-height: 1;
  cursor: pointer;
  font-size: .85rem;
}
.theme-toggle:hover { color: var(--accent); border-color: var(--accent); }

/* ---------- masthead: logo, title, description ---------- */

.masthead {
  background: var(--masthead-bg);
  border-bottom: 1px solid var(--rule);
  padding: 2.75rem 0 2.5rem;
  text-align: center;
}

.site-logo { display: inline-block; margin-bottom: 1rem; }

.site-logo img {
  display: block;
  width: 180px;
  height: 180px;
  object-fit: contain;
}

html[data-theme="dark"] .site-logo img { filter: invert(1) hue-rotate(180deg); }

.site-title {
  font-family: var(--serif);
  font-size: clamp(1.5rem, 3.4vw, 2rem);
  font-weight: 700;
  letter-spacing: -.01em;
  margin: 0;
}

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

.site-description {
  font-family: var(--serif);
  font-style: italic;
  color: var(--text-soft);
  margin: .5rem 0 0;
  font-size: 1.02rem;
}

/* ---------- entries ---------- */

main { display: block; padding: 2.75rem 0 3rem; }

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

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

.entry-title {
  font-family: var(--serif);
  font-style: italic;
  font-weight: 700;
  letter-spacing: -.015em;
  line-height: 1.25;
  font-size: clamp(1.3rem, 2.6vw, 1.6rem);
  margin: 0 0 .35rem;
  text-wrap: pretty;
}

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

.entry--single .entry-title { font-size: clamp(1.6rem, 3.6vw, 2.1rem); }

.entry-meta {
  font-family: var(--serif);
  font-style: italic;
  color: var(--text-soft);
  font-size: .92rem;
  margin: 0 0 .9rem;
}

.entry-meta a { color: var(--text-soft); }

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

/* ---------- page titles & prose ---------- */

.page-title {
  font-family: var(--serif);
  font-style: italic;
  font-size: clamp(1.5rem, 3.2vw, 1.9rem);
  letter-spacing: -.015em;
  margin: 0 0 1.5rem;
}

.entry-content, .page-content { font-size: 1.05rem; }

.entry-content > :first-child, .page-content > :first-child { margin-top: 0; }

.entry-content h1, .page-content h1 { font-family: var(--serif); font-size: 1.55rem; margin-top: 2.6rem; }
.entry-content h2, .page-content h2 { font-family: var(--serif); font-size: 1.4rem; margin-top: 2.4rem; }
.entry-content h3, .page-content h3 { font-family: var(--serif); font-size: 1.15rem; margin-top: 2rem; }

.entry-content img, .page-content img { max-width: 100%; height: auto; border-radius: 3px; }

.entry-content figure { margin: 2rem 0; }
.entry-content figcaption {
  font-family: var(--serif);
  font-style: italic;
  font-size: .9rem;
  color: var(--text-soft);
  margin-top: .5rem;
}

.entry-content blockquote {
  margin: 1.75rem 0;
  padding: .25rem 0 .25rem 1.1rem;
  border-left: 3px solid var(--accent);
  color: var(--text-soft);
  font-family: var(--serif);
  font-style: italic;
}

.entry-content pre {
  background: var(--masthead-bg);
  border: 1px solid var(--rule);
  border-radius: 4px;
  padding: .9rem 1rem;
  overflow-x: auto;
  font-family: var(--mono);
  font-size: .88rem;
  line-height: 1.6;
}

.entry-content :not(pre) > code {
  background: var(--masthead-bg);
  border: 1px solid var(--rule);
  border-radius: 3px;
  padding: .08em .3em;
  font-family: var(--mono);
  font-size: .88em;
}

hr { border: 0; border-top: 1px solid var(--rule); margin: 2.4rem 0; }

/* ---------- post list (archive, tag index) ---------- */

.post-list { list-style: none; margin: 0 0 1.5rem; padding: 0; }

.post-list li {
  display: flex;
  gap: 1rem;
  align-items: baseline;
  justify-content: space-between;
  padding: .45rem 0;
  border-bottom: 1px solid var(--rule);
}

.post-list a { color: var(--text); }
.post-list time {
  flex: 0 0 auto;
  font-family: var(--serif);
  font-style: italic;
  font-size: .85rem;
  color: var(--text-soft);
}

.tag-group { margin-bottom: 2rem; }

.tag-name {
  font-family: var(--serif);
  font-size: 1.05rem;
  margin: 0 0 .5rem;
}
.tag-name a { color: var(--text); }
.tag-count { color: var(--text-soft); font-weight: normal; font-size: .85rem; }

/* ---------- author bio, neighbours, pagination ---------- */

.author-bio {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  border-top: 1px solid var(--rule);
  padding-top: 1.5rem;
  margin-top: 2.5rem;
  font-size: .95rem;
  color: var(--text-soft);
}

.bio-photo { border-radius: 50%; flex: 0 0 auto; }

.author-bio p { margin: 0; }

.post-neighbours {
  display: grid;
  gap: .75rem;
  grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr));
  margin-top: 2rem;
}

.post-neighbours a {
  display: block;
  border: 1px solid var(--rule);
  border-radius: 4px;
  padding: .7rem .85rem;
  color: var(--text);
  font-size: .92rem;
  line-height: 1.35;
}

.post-neighbours a:hover { border-color: var(--accent); text-decoration: none; }

.post-neighbours span {
  display: block;
  font-size: .72rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--text-soft);
  margin-bottom: .2rem;
}

.pagination {
  display: flex;
  gap: 1rem;
  justify-content: space-between;
  align-items: center;
  border-top: 1px solid var(--rule);
  padding-top: 1.25rem;
  margin-top: 2rem;
  font-size: .88rem;
  color: var(--text-soft);
}

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

.site-footer {
  border-top: 1px solid var(--rule);
  background: var(--masthead-bg);
  padding: 1.75rem 0;
  text-align: center;
  font-size: .85rem;
  color: var(--text-soft);
}

.site-footer p { margin: 0; }
.site-footer .credit { margin-top: .35rem; font-size: .8rem; }

/* ---------- accessibility ---------- */

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

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

@media (max-width: 34rem) {
  .site-nav { justify-content: center; gap: 1rem; }
  .masthead { padding: 2rem 0 1.75rem; }
  .site-logo img { width: 132px; height: 132px; }
  main { padding: 2rem 0 2.5rem; }
  .post-list li { flex-direction: column; gap: .1rem; }
}

/* ---------- code highlighting ----------
   Hexo runs highlight.js server-side, so the markup arrives as
   <figure class="highlight lang"><table><td class="code"><pre><span class="line">
   <span class="keyword">…</span>. Token colours are defined here: the original theme loaded a
   CDN stylesheet for this, which is exactly the kind of dependency we dropped. */

figure.highlight {
  margin: 1.9rem 0;
  background: var(--masthead-bg);
  border: 1px solid var(--rule);
  border-radius: 4px;
  overflow-x: auto;
}

/* Hexo emits a two-cell table for code; blockifying the table lets the <pre>
   own the horizontal scroll instead of letting long lines bleed past the box. */
figure.highlight table,
figure.highlight tbody,
figure.highlight tr,
figure.highlight td { display: block; width: auto; border: 0; padding: 0; margin: 0; }
figure.highlight td.gutter { display: none; }

figure.highlight pre {
  margin: 0;
  max-width: 100%;
  /* Wrap instead of scrolling: these posts contain very long single lines
     (URLs, query strings) and a horizontal scrollbar inside a bordered box is
     worse than a wrapped continuation line. overflow-x is kept as a fallback. */
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  tab-size: 4;
  overflow-x: auto;
  border: 0;
  background: none;
  padding: .9rem 1rem;
  font-family: var(--mono);
  font-size: .86rem;
  line-height: 1.65;
}

figure.highlight .line { display: inline; }

/* light palette: GitHub-ish, low saturation to match the theme's calm tone */
figure.highlight .comment,
figure.highlight .quote { color: #6a737d; font-style: italic; }
figure.highlight .keyword,
figure.highlight .selector-tag,
figure.highlight .doctag { color: #d73a49; }
figure.highlight .string,
figure.highlight .regexp,
figure.highlight .meta .string { color: #032f62; }
figure.highlight .number,
figure.highlight .literal,
figure.highlight .built_in,
figure.highlight .symbol { color: #005cc5; }
figure.highlight .title,
figure.highlight .title.function_,
figure.highlight .section,
figure.highlight .name { color: #6f42c1; }
figure.highlight .attribute,
figure.highlight .property,
figure.highlight .variable,
figure.highlight .template-variable { color: #24292e; }
figure.highlight .type,
figure.highlight .class .title,
figure.highlight .tag { color: #22863a; }
figure.highlight .meta,
figure.highlight .params { color: #6a737d; }
figure.highlight .emphasis { font-style: italic; }
figure.highlight .strong { font-weight: 600; }

/* dark palette */
html[data-theme="dark"] figure.highlight .comment,
html[data-theme="dark"] figure.highlight .quote { color: #8b949e; }
html[data-theme="dark"] figure.highlight .keyword,
html[data-theme="dark"] figure.highlight .selector-tag,
html[data-theme="dark"] figure.highlight .doctag { color: #ff7b72; }
html[data-theme="dark"] figure.highlight .string,
html[data-theme="dark"] figure.highlight .regexp { color: #a5d6ff; }
html[data-theme="dark"] figure.highlight .number,
html[data-theme="dark"] figure.highlight .literal,
html[data-theme="dark"] figure.highlight .built_in,
html[data-theme="dark"] figure.highlight .symbol { color: #79c0ff; }
html[data-theme="dark"] figure.highlight .title,
html[data-theme="dark"] figure.highlight .title.function_,
html[data-theme="dark"] figure.highlight .section,
html[data-theme="dark"] figure.highlight .name { color: #d2a8ff; }
html[data-theme="dark"] figure.highlight .type,
html[data-theme="dark"] figure.highlight .class .title,
html[data-theme="dark"] figure.highlight .tag { color: #7ee787; }
