* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --bg: #0a0a0b;
  --text: #e8e6e1;
  --dim: #7c7a74;
  --faint: #4a4844;
  --hair: #1d1d1b;
  --accent: #d9a441;   
  --accent-soft: rgba(217, 164, 65, 0.14);
  --serif: "Charter", "Iowan Old Style", "Sitka Text", Georgia, "Times New Roman", serif;
  --mono: ui-monospace, "Cascadia Mono", "SFMono-Regular", Consolas, "Courier New", monospace;
}

::selection { background: var(--accent-soft); color: #fff; }

html { scroll-behavior: smooth; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--serif);
  font-size: 19px;
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}


.progress {
  position: fixed; top: 0; left: 0; height: 2px; width: 0;
  background: var(--accent);
  z-index: 50; transition: width 0.1s linear;
}
@media (prefers-reduced-motion: reduce) { .progress { transition: none; } }

header, main, footer { max-width: 680px; margin: 0 auto; padding: 0 24px; }


header.blog-head {
  padding-top: 84px;
  display: flex; flex-direction: column; gap: 6px;
}
.wordmark {
  font-family: var(--mono);
  font-size: 0.78em;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--dim);
}
.wordmark a { color: var(--dim); text-decoration: none; }
.wordmark a:hover { color: var(--accent); }
.blog-head h1 {
  font-weight: 400; font-size: 1.85em; letter-spacing: -0.01em;
  margin-top: 2px;
}
.rule { height: 1px; background: var(--hair); margin: 28px 0 8px; }


main { padding-top: 44px; }
.posts { list-style: none; }
.posts li {
  display: grid;
  grid-template-columns: 96px 1fr;
  gap: 22px;
  align-items: baseline;
  padding: 18px 4px;
  border-bottom: 1px solid var(--hair);
  transition: padding-left 0.18s ease, background 0.18s ease;
}
.posts li:hover { padding-left: 16px; background: rgba(255,255,255,0.012); }
.posts time {
  font-family: var(--mono); font-size: 0.74em; color: var(--dim);
  letter-spacing: 0.02em;
}
.posts a {
  text-decoration: none; color: var(--text);
  font-size: 1.18em; line-height: 1.35;
  transition: color 0.15s;
}
.posts a:hover { color: var(--accent); }
.posts a::after {
  content: "→"; opacity: 0; margin-left: 10px;
  font-family: var(--mono); color: var(--accent);
  transition: opacity 0.15s, margin-left 0.15s;
}
.posts a:hover::after { opacity: 1; margin-left: 14px; }

.empty { color: var(--faint); font-style: italic; padding: 24px 4px; }


.post-head {
  padding-top: 80px;
}
.post-head .back {
  font-family: var(--mono); font-size: 0.78em;
  color: var(--dim); text-decoration: none; letter-spacing: 0.04em;
  display: inline-block; margin-bottom: 26px;
  transition: color 0.15s, transform 0.15s;
}
.post-head .back:hover { color: var(--accent); transform: translateX(-3px); }
.post-head h1 {
  font-weight: 400; font-size: 2.1em; line-height: 1.2; letter-spacing: -0.015em;
  margin-bottom: 14px;
}
.meta-rail {
  display: flex; flex-wrap: wrap; gap: 8px 18px; align-items: center;
  font-family: var(--mono); font-size: 0.74em; color: var(--dim);
  letter-spacing: 0.02em; margin-bottom: 36px;
  padding-bottom: 22px; border-bottom: 1px solid var(--hair);
}
.meta-rail .sep { color: var(--faint); }
.meta-rail .reading-time::before { content: "✦"; color: var(--accent); margin-right: 8px; }

main.article { padding-top: 0; }

main.article > p:first-of-type::first-letter {
  font-family: var(--serif);
  float: left;
  font-size: 3.4em;
  line-height: 0.82;
  padding: 6px 12px 0 0;
  color: var(--accent);
  font-weight: 400;
}
main.article > p:first-of-type { margin-top: 0; }


footer {
  padding: 72px 24px 56px;
  font-family: var(--mono); font-size: 0.74em; color: var(--dim);
  letter-spacing: 0.04em;
}
footer a {
  color: var(--dim); text-decoration: none;
  border-bottom: 1px solid var(--faint);
  padding-bottom: 2px; transition: color 0.15s, border-color 0.15s;
}
footer a:hover { color: var(--accent); border-color: var(--accent); }
.foot-nav { display: flex; gap: 22px; }


body.error-page {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh; text-align: center; flex-direction: column; gap: 14px;
}
body.error-page .code {
  font-family: var(--mono); color: var(--accent); font-size: 1.3em; letter-spacing: 0.1em;
}

@media (max-width: 560px) {
  body { font-size: 17.5px; }
  .posts li { grid-template-columns: 1fr; gap: 4px; }
  .posts time { font-size: 0.72em; }
  .post-head h1 { font-size: 1.7em; }
}


.carousel { position: relative; margin: 30px 0; }
.carousel .slide img,
.carousel .slide video { width: 100%; height: auto; display: block; border: 1px solid var(--hair); }
/* Without JS every slide stacks, so content is still visible and accessible.
   With JS, only the active slide is shown and the others are hidden. */
.carousel.js .slide:not(.active) { display: none; }
.cr-nav {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 34px; height: 34px; border-radius: 50%;
  background: rgba(10, 10, 11, 0.82); color: var(--text);
  border: 1px solid var(--hair); cursor: pointer;
  font-family: var(--mono); font-size: 1.2em; line-height: 1;
  display: flex; align-items: center; justify-content: center;
  transition: color 0.15s, border-color 0.15s;
}
.cr-nav:hover { color: var(--accent); border-color: var(--accent); }
.cr-prev { left: 10px; }
.cr-next { right: 10px; }
.cr-count {
  position: absolute; bottom: 8px; left: 50%; transform: translateX(-50%);
  font-family: var(--mono); font-size: 0.7em; color: var(--dim);
  background: rgba(10, 10, 11, 0.82); padding: 2px 8px; border-radius: 2px;
}
.carousel:focus { outline: none; }
.carousel:focus .cr-nav { border-color: var(--accent); }


.video-wrap { margin: 30px 0; }
.video-wrap video { width: 100%; height: auto; display: block; border: 1px solid var(--hair); }
