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

:root {
  --bg: #ffffff;
  --ink: #111111;
  --muted: #4a4a4a;
  --border: #dddddd;
  --code-bg: #f2f2f2;
  --quote: #555555;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d0d0c;
    --ink: #f3f2ee;
    --muted: #b3b0a6;
    --border: #333229;
    --code-bg: #232019;
    --quote: #9a9a94;
  }
}

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

body {
  font-family: Georgia, "Noto Serif SC", "Songti SC", "STSong", serif;
  font-size: 19px;
  line-height: 1.9;
  color: var(--ink);
  background: var(--bg);
  max-width: 640px;
  margin: 100px auto 160px;
  padding: 0 24px;
}

a {
  color: var(--ink);
  text-decoration: none;
  background-image: linear-gradient(currentColor, currentColor);
  background-position: 0 100%;
  background-repeat: no-repeat;
  background-size: 0% 1px;
  transition: background-size 0.35s ease;
}

a:hover,
a:focus-visible {
  background-size: 100% 1px;
}

p {
  margin: 0 0 1.6em;
  color: var(--muted);
}

h1, h2, h3, h4, h5, h6 {
  font-weight: bold;
  line-height: 1.4;
  margin: 1.4em 0 0.8em;
  color: var(--ink);
  text-wrap: balance;
  -webkit-text-stroke: 0.4px currentColor;
}

h1 { font-size: 1.5em; }
h2 { font-size: 1.3em; }
h3 { font-size: 1.15em; }
h4, h5, h6 { font-size: 1em; }

ul, ol {
  margin: 0 0 1.6em;
  padding-left: 1.4em;
}

li {
  margin-bottom: 0.4em;
}

blockquote {
  margin: 0 0 1.6em;
  padding-left: 1em;
  border-left: 3px solid var(--border);
  color: var(--quote);
  font-style: italic;
}

blockquote p {
  margin: 0;
  color: inherit;
}

code {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 0.85em;
  background: var(--code-bg);
  padding: 0.15em 0.35em;
  border-radius: 4px;
}

pre {
  background: var(--code-bg);
  border-radius: 6px;
  padding: 1em;
  margin: 0 0 1.6em;
  overflow-x: auto;
}

pre code {
  background: none;
  padding: 0;
  font-size: 0.85em;
}

hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 2em 0;
}

img,
video {
  max-width: 100%;
  height: auto;
  display: block;
  border-radius: 6px;
  margin: 0 0 1.6em;
}

.video-embed {
  position: relative;
  width: 100%;
  padding-top: 56.25%; /* 16:9 */
  margin: 0 0 1.6em;
  border-radius: 6px;
  overflow: hidden;
}

.video-embed iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: none;
}

.embed-block {
  margin: 0 0 1.6em;
}

gpx-viewer {
  display: block;
  margin: 0 0 1.6em;
}

.embed-block img,
.embed-block video {
  margin: 0;
}

.post-title {
  font-size: 1.6em;
  font-weight: bold;
  line-height: 1.4;
  text-wrap: balance;
  color: var(--ink);
  margin-bottom: 1em;
  -webkit-text-stroke: 0.4px currentColor;
}

.post-title-link {
  color: inherit;
  text-decoration: none;
  background-image: none;
  transition: opacity 0.3s ease, letter-spacing 0.3s ease;
}

.post-title-link:hover,
.post-title-link:focus-visible {
  opacity: 0.6;
  letter-spacing: 0.01em;
}

.index-title {
  font-weight: bold;
  margin-top: 4em;
  margin-bottom: 1.6em;
  -webkit-text-stroke: 0.4px currentColor;
}

.site-nav {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1em;
}

.category {
  font-weight: bold;
  margin-top: 2.6em;
  margin-bottom: 0.6em;
  -webkit-text-stroke: 0.4px currentColor;
}

.post-list {
  margin: 0 0 0.2em;
}

.post-year {
  font-style: italic;
}

.divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 3.5em 0;
}

.progress-bar {
  position: fixed;
  top: 0;
  left: 0;
  height: 2px;
  width: 0%;
  background: var(--ink);
  z-index: 50;
  transition: width 0.08s linear;
}

.reveal-group > *.reveal {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.7s ease, transform 0.7s ease;
}

.reveal-group > *.reveal.in-view {
  opacity: 1;
  transform: translateY(0);
}

img.zoomable {
  cursor: zoom-in;
}

.zoom-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  pointer-events: none;
  transition: background 0.35s ease;
}

.zoom-overlay.open {
  background: rgba(0, 0, 0, 0.82);
  pointer-events: auto;
}

.zoom-overlay img {
  max-width: 90vw;
  max-height: 90vh;
  border-radius: 4px;
  margin: 0;
  transform: scale(0.92);
  opacity: 0;
  transition: transform 0.35s cubic-bezier(0.2, 0.8, 0.2, 1), opacity 0.35s ease;
  cursor: zoom-out;
}

.zoom-overlay.open img {
  transform: scale(1);
  opacity: 1;
}

@media (prefers-reduced-motion: reduce) {
  a,
  .post-title-link,
  .reveal-group > *.reveal,
  .zoom-overlay,
  .zoom-overlay img,
  .progress-bar {
    transition: none !important;
  }
}

@media (max-width: 480px) {
  body {
    margin: 60px auto 100px;
    font-size: 17px;
  }
}

.site-footer {
  margin-top: 100px;
  text-align: center;
  font-size: 13px;
  color: var(--muted);
}
