/* Palette: light grey page, white cards, slate ink and an oxidised teal
   accent taken from weathered metal in the AEZ art. */
:root {
  --bg: #f1f3f4;
  --surface: #ffffff;
  --fg: #1d2629;
  --muted: #4d5a5f;
  --faint: #5f6b70;
  --line: #e1e5e7;
  --accent: #146f62;
  --accent-hover: #0f5a50;
  --accent-soft: #e3f0ec;
  --code-bg: #f3f5f6;
  --shadow: 0 1px 2px rgba(20, 30, 35, .05), 0 4px 16px rgba(20, 30, 35, .04);
  --main: 46rem;
  --side: 15.5rem;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1416;
    --surface: #172024;
    --fg: #e5e8e9;
    --muted: #a3adb0;
    --faint: #8a9497;
    --line: #253035;
    --accent: #4cc2ad;
    --accent-hover: #7fd8c8;
    --accent-soft: #1b3330;
    --code-bg: #1f2a2e;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3);
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 16px/1.65 ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); text-decoration: underline; text-underline-offset: 2px; }

/* top bar */
.topbar {
  position: sticky; top: 0; z-index: 10;
  background: var(--surface); border-bottom: 1px solid var(--line);
}
.topbar-inner {
  max-width: calc(var(--side) + var(--main) + 6rem); margin: 0 auto; padding: 0 1rem;
  height: 3.5rem; display: flex; align-items: center; justify-content: space-between; gap: 1rem;
}
.site-title { color: var(--fg); font-weight: 700; font-size: 1.05rem; display: flex; align-items: center; gap: .5rem; }
.site-title::before { content: ""; width: .7rem; height: .7rem; border-radius: 2px; background: var(--accent); }
.site-title:hover { color: var(--fg); text-decoration: none; }
.topbar nav { display: flex; align-items: center; gap: 1.1rem; font-size: .95rem; }
.topbar nav a { color: var(--fg); }
.topbar nav a:hover { color: var(--accent); text-decoration: none; }
.topbar svg { display: block; }

/* two columns */
.layout {
  max-width: calc(var(--side) + var(--main) + 6rem); margin: 0 auto; padding: 0 1rem;
  display: grid; grid-template-columns: var(--side) minmax(0, var(--main)); gap: 3rem;
}
main { margin: 2rem 0 3rem; min-width: 0; overflow-wrap: break-word; }

/* paper panels on the stone page */
main.panel, .card {
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
  box-shadow: var(--shadow); padding: 2.25rem 2.5rem;
}

.sidebar {
  position: sticky; top: 3.5rem; align-self: start;
  max-height: calc(100vh - 3.5rem); overflow-y: auto;
  padding: 2rem .5rem 2rem 0;
  font-size: .85rem; line-height: 1.4; scrollbar-width: thin;
}
.recent-title { font-weight: 700; font-size: 1rem; margin-bottom: 1rem; }
.recent-year { font-weight: 700; margin: 1rem 0 .5rem; }
.recent ul { list-style: none; margin: 0; padding: 0; }
.recent li { margin: 0 0 .7rem; }
.recent li a { color: var(--muted); display: block; border-left: 2px solid transparent; padding-left: .6rem; margin-left: -.6rem; }
.recent li a:hover, .recent li a.current { color: var(--accent); text-decoration: none; }
.recent li a.current { font-weight: 600; border-left-color: var(--accent); }
.recent-all { display: inline-block; margin-top: .5rem; font-weight: 600; }

.site-footer {
  padding: .5rem 1rem 2.5rem;
  text-align: center; color: var(--faint); font-size: .85rem;
}

/* home */
.hero {
  display: block; width: 100%; height: auto; aspect-ratio: 5 / 2;
  margin: 0 0 1.25rem; object-fit: cover; border-radius: 6px;
}
.intro { font-size: 1.05rem; color: var(--muted); margin: 0 .25rem 1.75rem; }
.intro p { margin: 0 0 .75rem; }

.card { margin-bottom: 1.5rem; }
.post-title { font-size: 2.1rem; line-height: 1.2; font-weight: 750; margin: 0 0 .5rem; letter-spacing: -.015em; color: var(--fg); }
.post-title a { color: var(--fg); }
.post-title a:hover { color: var(--accent); text-decoration: none; }
.card .post-title { font-size: 1.85rem; }
.meta { color: var(--muted); font-size: .9rem; margin: 0 0 1.25rem; }
.subtitle { color: var(--muted); font-size: 1.15rem; margin: -.25rem 0 .5rem; }
.card-footer, .post-footer {
  display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: .75rem;
  margin-top: 1.25rem;
}
.tags { font-size: .85rem; color: var(--muted); display: flex; flex-wrap: wrap; align-items: center; gap: .35rem; }
.tags b { color: var(--fg); margin-right: .15rem; }
.tag {
  display: inline-block; font-size: .8rem; color: var(--accent);
  background: var(--accent-soft); border-radius: 999px; padding: .1rem .6rem;
}
.tag:hover { color: var(--bg); background: var(--accent); text-decoration: none; }
.read-more {
  margin-left: auto; font-weight: 600; font-size: .9rem; color: var(--accent);
  border: 1px solid var(--accent); border-radius: 999px; padding: .3rem .9rem;
}
.read-more::after { content: " \2192"; }
.read-more:hover { color: var(--bg); background: var(--accent); text-decoration: none; }

.pager { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: .5rem .25rem 0; font-weight: 600; }
.pager-count { color: var(--faint); font-weight: 400; font-size: .9rem; }

/* archive and tags */
h1 { font-size: 2.1rem; line-height: 1.2; margin: 0 0 .5rem; }
.lede { color: var(--muted); margin-top: 0; }
.year h2 { font-size: 1rem; color: var(--muted); margin: 2rem 0 .5rem; font-variant-numeric: tabular-nums; }
.post-list { list-style: none; padding: 0; margin: 0; }
.post-list li { display: grid; grid-template-columns: 4.25rem 1fr; gap: .75rem; padding: .4rem 0; }
.post-list time { color: var(--faint); font-size: .875rem; padding-top: .1rem; font-variant-numeric: tabular-nums; }
.post-list a { color: var(--fg); font-weight: 600; }
.post-list a:hover { color: var(--accent); text-decoration: none; }
.post-list p { margin: .1rem 0 0; color: var(--muted); font-size: .9rem; line-height: 1.5; }
.tag-cloud { display: flex; flex-wrap: wrap; gap: .4rem; }
.tag small { color: var(--faint); }

/* post body */
.post header { margin-bottom: .5rem; }
.post h2, .post h3, .excerpt h2, .excerpt h3 { line-height: 1.3; margin: 2rem 0 .5rem; }
.post h2, .excerpt h2 { font-size: 1.4rem; }
.post h3, .excerpt h3 { font-size: 1.2rem; }
.post img, .card img, .post iframe, .card iframe { max-width: 100%; height: auto; border-radius: 6px; }
.card p > a > img, .card p > img { display: block; }
.post p > img:only-child, .post p > a:only-child > img { display: block; margin: 0 auto; }
.post blockquote { margin: 1.25rem 0; padding: 0 1rem; border-left: 3px solid var(--line); color: var(--muted); }
.post hr { border: 0; border-top: 1px solid var(--line); margin: 2rem 0; }
.post table { border-collapse: collapse; width: 100%; font-size: .95rem; }
.post th, .post td { border-bottom: 1px solid var(--line); padding: .35rem .5rem; text-align: left; }

code { font: .875em/1.5 ui-monospace, "Cascadia Code", Consolas, monospace; background: var(--code-bg); padding: .1em .3em; border-radius: 3px; }
pre { background: var(--code-bg); padding: .9rem 1rem; overflow-x: auto; border-radius: 6px; }
pre code { background: none; padding: 0; }
.highlight .c, .highlight .c1, .highlight .cm, .highlight .cp { color: var(--faint); font-style: italic; }
.highlight .k, .highlight .kd, .highlight .kt, .highlight .kr { color: #9333ea; }
.highlight .s, .highlight .s1, .highlight .s2 { color: #15803d; }
.highlight .mi, .highlight .mf { color: #b45309; }
.highlight .nf { color: #2563eb; }
@media (prefers-color-scheme: dark) {
  .highlight .k, .highlight .kd, .highlight .kt, .highlight .kr { color: #c084fc; }
  .highlight .s, .highlight .s1, .highlight .s2 { color: #86efac; }
  .highlight .mi, .highlight .mf { color: #fbbf24; }
  .highlight .nf { color: #93c5fd; }
}

.video { margin: 1.25rem 0; }
.video a, .video iframe { position: relative; display: block; width: 100%; aspect-ratio: 16 / 9; border: 0; border-radius: 6px; overflow: hidden; background: #000; }
.video img { width: 100%; height: 100%; object-fit: cover; margin: 0; border-radius: 0; opacity: .92; }
.video .play {
  position: absolute; inset: 50% auto auto 50%; width: 68px; height: 48px; transform: translate(-50%, -50%);
  background: rgba(0,0,0,.7); border-radius: 12px;
}
.video .play::after {
  content: ""; position: absolute; left: 27px; top: 14px;
  border-style: solid; border-width: 10px 0 10px 17px; border-color: transparent transparent transparent #fff;
}
.video a:hover .play { background: #c4302b; }

.post-nav { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; border-top: 1px solid var(--line); margin-top: 2rem; padding-top: 1.25rem; }
.post-nav a { color: var(--fg); font-weight: 600; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: .75rem 1rem; }
.post-nav a:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }
.post-nav small { display: block; color: var(--muted); font-weight: 400; font-size: .8rem; }
.post-nav .next { text-align: right; }

@media (max-width: 996px) {
  .layout { grid-template-columns: minmax(0, 1fr); gap: 0; max-width: calc(var(--main) + 2rem); }
  .sidebar { display: none; }
}
@media (max-width: 560px) {
  .post-title, h1 { font-size: 1.7rem; }
  .card .post-title { font-size: 1.5rem; }
  .post-list li { grid-template-columns: 1fr; gap: 0; }
  .post-nav { grid-template-columns: 1fr; }
  .post-nav .next { text-align: left; }
  .topbar nav { gap: .8rem; font-size: .9rem; }
  main.panel, .card { padding: 1.4rem 1.25rem; border-radius: 10px; }
  .layout { padding: 0 .75rem; }
}
