/* VaultLab blog styles.
 * All colours are variables in :root, so you can change the theme in one place.
 */
:root {
  color-scheme: dark;
  --bg: #1e1f23;          /* light black page background */
  --surface: #27292e;     /* cards */
  --surface-2: #2f3237;   /* hover, code blocks */
  --text: #e9e9eb;
  --muted: #a3a7ae;
  --line: #3a3d44;
  --accent: #5cc8b0;
  --accent-soft: rgba(92, 200, 176, 0.14);
  --error: #ff8a7a;
  --error-soft: rgba(255, 138, 122, 0.12);
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, Helvetica, Arial, sans-serif;
  --page: 100%;           /* full screen width */
  --gutter: clamp(20px, 4vw, 72px);  /* side space grows with the screen */
}

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

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

/* Header, content, footer stacked; main grows so the footer sits at the bottom */
body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font: 17px/1.65 var(--sans);
}
main { flex: 1; }

a { color: var(--accent); }

.wrap {
  width: 100%;
  max-width: var(--page);
  margin: 0 auto;
  padding: 0 var(--gutter) 72px;
}

/* Posts keep a comfortable reading width */
.wrap.reading { max-width: var(--page); }  /* posts and About use the full width too */

/* ---------- Header and footer ---------- */
.site-header {
  width: 100%;
  max-width: var(--page);
  margin: 0 auto;
  padding: 24px var(--gutter);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand {
  font: 600 17px var(--mono);
  color: var(--text);
  text-decoration: none;
}
.brand .prompt { color: var(--accent); margin-right: 4px; }
.brand .cursor { animation: blink 1.1s steps(1) infinite; color: var(--accent); }
@keyframes blink { 50% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .brand .cursor { animation: none; } }

.site-header nav { display: flex; gap: 22px; }
.site-header nav a { color: var(--muted); text-decoration: none; font-size: 15px; }
.site-header nav a:hover { color: var(--text); }

.site-footer {
  width: 100%;
  max-width: var(--page);
  margin: 0 auto;
  padding: 28px var(--gutter) 40px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 14px;
}

/* ---------- Home: intro ---------- */
.hero { padding: 36px 0 44px; }
.hero h1, .hero .lede { max-width: none; }

.eyebrow {
  margin: 0 0 10px;
  font: 600 13px var(--mono);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
}

.hero h1 {
  margin: 0 0 16px;
  font-size: clamp(30px, 5vw, 48px);
  line-height: 1.12;
  letter-spacing: -0.02em;
}

.lede { margin: 0 0 30px; color: var(--muted); font-size: 19px; }

.progress-label {
  display: flex;
  justify-content: space-between;
  font: 13px var(--mono);
  color: var(--muted);
  margin-bottom: 8px;
}
.progress-bar { height: 8px; border-radius: 99px; background: var(--line); overflow: hidden; }
#progress-fill { height: 100%; width: 0; background: var(--accent); border-radius: 99px; transition: width 0.6s ease; }

.list-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 28px;
}
.list-head h2 { margin: 0; font-size: 22px; }

#search {
  flex: 1 1 220px;
  max-width: 320px;
  padding: 9px 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 15px;
}
#search::placeholder { color: var(--muted); }
#search:focus { outline: 2px solid var(--accent); outline-offset: 1px; }

/* ---------- Home: zigzag timeline ----------
 * Two columns with a line down the middle.
 * Cards with class "left" sit in column 1, "right" in column 2,
 * each on its own row, so they alternate down the page.
 */
.post-list, .timeline { list-style: none; padding: 0; }

.timeline {
  --gap: 72px;                 /* space between the two columns */
  position: relative;
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  column-gap: var(--gap);
  row-gap: 8px;
}

/* the vertical line */
.timeline::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 2px;
  transform: translateX(-50%);
  background: var(--line);
}

.timeline > li { position: relative; }
.timeline > li.left  { grid-column: 1; }
.timeline > li.right { grid-column: 2; margin-top: 56px; } /* right cards drop a little, for a staggered look */

/* the dot on the line, plus a short connector to the card */
.timeline > li::before,
.timeline > li::after {
  content: "";
  position: absolute;
  top: 30px;
}
.timeline > li::before {         /* connector */
  height: 2px;
  width: calc(var(--gap) / 2);
  background: var(--line);
}
.timeline > li::after {          /* dot */
  width: 14px;
  height: 14px;
  margin-top: -6px;
  border-radius: 50%;
  background: var(--bg);
  border: 3px solid var(--accent);
}
.timeline > li.left::before  { left: 100%; }
.timeline > li.left::after   { left: calc(100% + var(--gap) / 2 - 7px); }
.timeline > li.right::before { right: 100%; }
.timeline > li.right::after  { right: calc(100% + var(--gap) / 2 - 7px); }

.post-link {
  display: block;
  padding: 20px 22px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  color: inherit;
  text-decoration: none;
  transition: border-color 0.15s, transform 0.15s, background 0.15s;
}
.post-link:hover { border-color: var(--accent); background: var(--surface-2); transform: translateY(-2px); }
.timeline > li:hover::after { background: var(--accent); }

.post-top { display: flex; align-items: center; gap: 10px; }
.post-title { margin: 10px 0 6px; font-size: 20px; line-height: 1.35; }
.post-summary { margin: 0; color: var(--muted); font-size: 15px; }

.day-badge {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 6px;
  background: var(--accent-soft);
  color: var(--accent);
  font: 600 12px var(--mono);
}
.post-date { color: var(--muted); font-size: 13px; }

.tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.tag {
  padding: 1px 9px;
  border: 1px solid var(--line);
  border-radius: 99px;
  font: 12px var(--mono);
  color: var(--muted);
}

.status { color: var(--muted); }
.status.error {
  padding: 12px 14px;
  border-radius: 8px;
  background: var(--error-soft);
  color: var(--error);
  font-size: 15px;
}

/* Tablets and phones: one column, line on the left */
@media (max-width: 820px) {
  .timeline { grid-template-columns: 1fr; padding-left: 30px; --gap: 30px; }
  .timeline::before { left: 7px; transform: none; }
  .timeline > li.left,
  .timeline > li.right { grid-column: 1; margin-top: 0; }
  .timeline > li { margin-bottom: 8px; }
  .timeline > li.left::before,
  .timeline > li.right::before { left: auto; right: 100%; width: 16px; }
  .timeline > li.left::after,
  .timeline > li.right::after { left: auto; right: calc(100% + 16px); }
}

/* ---------- Post page ---------- */
.back {
  display: inline-block;
  margin: 8px 0 20px;
  color: var(--muted);
  text-decoration: none;
  font-size: 15px;
}
.back:hover { color: var(--text); }

.post-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-bottom: 6px; }

.prose h1 { font-size: clamp(28px, 4.5vw, 38px); line-height: 1.2; letter-spacing: -0.02em; margin: 6px 0 20px; }
.prose h2 { font-size: 24px; margin: 44px 0 12px; padding-top: 20px; border-top: 1px solid var(--line); }
.prose h3 { font-size: 20px; margin: 30px 0 8px; }
.prose p, .prose ul, .prose ol { margin: 0 0 16px; }
.prose li { margin: 4px 0; }
.prose img { max-width: 100%; border-radius: 8px; border: 1px solid var(--line); }
.prose hr { border: 0; border-top: 1px solid var(--line); margin: 32px 0; }
.prose strong { color: #fff; }

.prose blockquote {
  margin: 0 0 18px;
  padding: 12px 18px;
  border-left: 3px solid var(--accent);
  background: var(--accent-soft);
  border-radius: 0 8px 8px 0;
}
.prose blockquote p:last-child { margin-bottom: 0; }

.prose :not(pre) > code {
  padding: 1px 6px;
  border-radius: 4px;
  background: var(--surface-2);
  font: 0.88em var(--mono);
}

.prose pre {
  position: relative;
  margin: 0 0 20px;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #16171a;
  overflow-x: auto;
  font: 14px/1.6 var(--mono);
}
.prose pre code.hljs { padding: 0; background: transparent; }

.copy {
  position: absolute;
  top: 8px;
  right: 8px;
  padding: 3px 9px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--muted);
  font: 12px var(--sans);
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s;
}
.prose pre:hover .copy, .copy:focus { opacity: 1; }
@media (hover: none) { .copy { opacity: 1; } }

.prose table {
  width: 100%;
  margin: 0 0 20px;
  border-collapse: collapse;
  font-size: 15px;
  display: block;
  overflow-x: auto;
}
.prose th, .prose td { padding: 8px 10px; border: 1px solid var(--line); text-align: left; vertical-align: top; }
.prose th { background: var(--surface); }

.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 52px; }
.pager-link {
  display: block;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  text-decoration: none;
  color: inherit;
}
.pager-link:hover { border-color: var(--accent); }
.pager-link.next { grid-column: 2; text-align: right; }
.pager-label { display: block; font-size: 13px; color: var(--muted); }
.pager-title { display: block; font-weight: 600; font-size: 15px; }

@media (max-width: 520px) {
  body { font-size: 16px; }
  .pager { grid-template-columns: 1fr; }
  .pager-link.next { grid-column: 1; }
}
