/* ---------- palette: sea mist by day, storm-dark slate by night ---------- */
:root {
  --bg: #dfe3e8;
  --fg: #1c2530;
  --muted: #5f6c7a;
  --faint: #a9b2bd;
  --rule: #c9d0d8;
  --code-bg: #d3d9e0;
  --accent: #3f6680;
  --live: #4f7f86;
  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg: #0d1117;
  --fg: #d5dde6;
  --muted: #7e8b9a;
  --faint: #3a4552;
  --rule: #1b232d;
  --code-bg: #141b23;
  --accent: #9fc1d6;
  --live: #8fbcc0;
  color-scheme: dark;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0d1117;
    --fg: #d5dde6;
    --muted: #7e8b9a;
    --faint: #3a4552;
    --rule: #1b232d;
    --code-bg: #141b23;
    --accent: #9fc1d6;
    --live: #8fbcc0;
    color-scheme: dark;
  }
}

/* one font everywhere (code blocks stay monospace). swap --font to change the whole site */
:root {
  --font: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", "SF Mono", Menlo, Consolas, monospace;
}

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.3s ease, color 0.3s ease;
}

::selection {
  background: color-mix(in srgb, var(--accent) 25%, transparent);
}

main {
  max-width: 640px;
  margin: 0 auto;
  padding: 56px 28px 72px;
}

p {
  margin: 0 0 1.1em;
}

a {
  color: inherit;
  text-decoration: underline;
  text-decoration-color: var(--faint);
  text-decoration-thickness: 1px;
  text-underline-offset: 4px;
  transition: color 0.15s ease, text-decoration-color 0.15s ease;
}

a:hover {
  color: var(--accent);
  text-decoration-color: var(--accent);
}

/* ---------- top bar: a shell path instead of a name + nav ---------- */
.bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12.5px;
  color: var(--muted);
  margin-bottom: 72px;
}

.path a {
  text-decoration: none;
  color: var(--muted);
}

.path a:hover {
  color: var(--accent);
}

.path .here {
  color: var(--fg);
}

.path .sep {
  color: var(--faint);
  margin: 0 1px;
}

.cursor {
  display: inline-block;
  width: 7px;
  height: 14px;
  margin-left: 4px;
  vertical-align: -2px;
  background: var(--accent);
  animation: blink 1.1s steps(1) infinite;
}

@keyframes blink {
  50% { opacity: 0; }
}

.tools {
  display: flex;
  align-items: center;
  gap: 18px;
}

.tools a {
  text-decoration: none;
  color: var(--muted);
}

.tools a[aria-current="page"] {
  color: var(--fg);
}

#theme,
#sharks-toggle {
  display: inline-flex;
  background: none;
  border: 0;
  padding: 0;
  color: var(--muted);
  cursor: pointer;
}

#theme:hover,
#sharks-toggle:hover {
  color: var(--accent);
}

/* ---------- hero ---------- */
.hero {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 10px;
}

.hero h1 {
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.3px;
  margin: 0;
}

.ring {
  width: 30px;
  height: 30px;
  flex: none;
}

.ring circle {
  fill: transparent;
  stroke: var(--faint);
  stroke-width: 1.2;
  transition: fill 0.25s ease, stroke 0.25s ease;
}

.ring circle.full {
  fill: var(--accent);
  stroke: var(--accent);
}

.status {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 40px;
}

.dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--live);
  animation: breathe 3s ease-in-out infinite;
}

@keyframes breathe {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}

.intro {
  font-size: 16px;
  margin-bottom: 56px;
}

.intro em {
  color: var(--accent);
  font-style: normal;
}

/* ---------- labelled rows ---------- */
.row {
  display: grid;
  grid-template-columns: 104px 1fr;
  gap: 0 8px;
  padding: 18px 0;
  border-top: 1px dashed var(--rule);
}

.label {
  font-size: 12px;
  color: var(--accent);
}

.label::before {
  content: "# ";
  color: var(--faint);
}

.entry {
  margin-bottom: 14px;
}

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

.entry.pinned-entry {
  margin-left: -12px;
  padding: 8px 10px 8px 12px;
  border-left: 2px solid var(--accent);
  border-radius: 0 4px 4px 0;
  background: color-mix(in srgb, var(--accent) 8%, transparent);
}

.pin {
  font-size: 10px;
  line-height: 1.4;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  white-space: nowrap;
}

.line {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.leader {
  flex: 1;
  min-width: 16px;
  border-bottom: 1px dotted var(--faint);
  transform: translateY(-5px);
}

.stat,
time {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}

.desc {
  color: var(--muted);
  font-size: 13px;
  margin: 2px 0 0;
}

.elsewhere {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 20px;
}

.org img {
  width: 14px;
  height: 14px;
  border-radius: 3px;
  vertical-align: -2px;
  margin-right: 5px;
}

.aside {
  color: var(--muted);
  font-size: 13px;
  margin: -36px 0 40px;
}

/* ---------- footer ---------- */
footer {
  margin-top: 64px;
  font-size: 11.5px;
  color: var(--muted);
  display: flex;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

footer a {
  color: var(--muted);
  text-decoration: none;
}

/* ---------- post ---------- */
article h1 {
  font-size: 21px;
  line-height: 1.35;
  font-weight: 600;
  letter-spacing: -0.3px;
  margin: 0 0 6px;
}

.byline {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 40px;
}

.opener {
  border-left: 2px solid var(--accent);
  padding-left: 16px;
  margin-bottom: 40px;
}

article h2 {
  font-size: 15px;
  font-weight: 600;
  margin: 52px 0 14px;
}

article h2::before {
  content: "## ";
  color: var(--accent);
}

article h3 {
  font-size: 14px;
  font-weight: 600;
  margin: 30px 0 8px;
}

article h3::before {
  content: "### ";
  color: var(--faint);
}

article ul,
article ol {
  padding-left: 22px;
  margin: 0 0 1.1em;
}

article li {
  margin-bottom: 6px;
}

article li::marker {
  color: var(--accent);
}

ul.todo {
  list-style: none;
  padding-left: 0;
}

ul.todo li::before {
  content: "[ ] ";
  color: var(--accent);
}

code,
pre {
  font-family: var(--mono);
}

code {
  font-size: 0.86em;
  background: var(--code-bg);
  padding: 1px 5px;
  border-radius: 4px;
}

pre {
  background: var(--code-bg);
  border-radius: 10px;
  padding: 16px 18px;
  overflow-x: auto;
  font-size: 12.5px;
  line-height: 1.65;
  margin: 0 0 1.3em;
}

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

.table-wrap {
  overflow-x: auto;
  margin: 4px 0 1.3em;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
}

th,
td {
  text-align: left;
  padding: 8px 14px 8px 0;
  border-bottom: 1px solid var(--rule);
  vertical-align: top;
}

th {
  font-weight: 400;
  color: var(--muted);
}

.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.sign-off {
  margin-top: 48px;
  color: var(--muted);
}

/* ---------- figures (drawn in svg, follow the theme) ---------- */
figure {
  margin: 8px 0 28px;
}

figure svg {
  width: 100%;
  height: auto;
  display: block;
  font-family: var(--font);
}

figure img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 8px;
  border: 1px solid var(--rule);
}

.strip {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  padding-bottom: 8px;
}

.strip a {
  flex: 0 0 86%;
  scroll-snap-align: start;
}

.strip::-webkit-scrollbar {
  height: 6px;
}

.strip::-webkit-scrollbar-thumb {
  background: var(--faint);
  border-radius: 3px;
}

figcaption {
  font-size: 12px;
  color: var(--muted);
  margin-top: 10px;
}

figcaption b {
  color: var(--fg);
  font-weight: 600;
}

.fig text { fill: var(--fg); }
.fig .muted { fill: var(--muted); }
.fig .faint { fill: var(--faint); }
.fig .bold { font-weight: 600; }
.fig .rule { stroke: var(--rule); fill: none; }
.fig .bar { fill: var(--faint); }
.fig .bar.hot { fill: var(--accent); }
.fig .bar.ref { opacity: 0.55; }
.fig .box { fill: none; stroke: var(--faint); stroke-width: 1.25; }
.fig .box.ro { fill: var(--code-bg); }
.fig .box.shared { fill: color-mix(in srgb, var(--accent) 13%, transparent); stroke: var(--accent); stroke-width: 2; }
.fig .link { stroke: var(--muted); stroke-width: 1.25; fill: none; }
.fig .head { fill: var(--muted); }

/* ---------- small screens ---------- */
@media (max-width: 560px) {
  body {
    font-size: 14.5px;
  }

  main {
    padding: 36px 20px 52px;
  }

  .bar {
    margin-bottom: 52px;
  }

  .row {
    grid-template-columns: 1fr;
  }

  .label {
    padding-bottom: 6px;
  }

  .aside {
    margin-top: -28px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .dot, .cursor { animation: none; }
  body, a, .ring circle { transition: none; }
}

.aside-note {
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 32px;
}

/* ---------- ascii sharks, faded in at the bottom of the home page ----------
   engine: ascii sharks by drewdi (MIT), https://github.com/stackedlol/ascii-sharks */
body.home {
  position: relative;
  min-height: 100vh;
  padding-bottom: 140px;
}

.sharks {
  /* fixed to the viewport so the sharks are in view without scrolling */
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  height: 62vh;
  z-index: -1;
  pointer-events: none;
  font-family: var(--mono);
  opacity: 0.4;
  -webkit-mask-image: linear-gradient(to bottom, transparent 0%, #000 45%);
  mask-image: linear-gradient(to bottom, transparent 0%, #000 45%);
  mix-blend-mode: screen;
}

/* on the light theme the engine draws on paper, so multiply lets the paper vanish */
.sharks[data-theme="light"] {
  mix-blend-mode: multiply;
  opacity: 0.22;
}

@media (max-width: 560px) {
  .sharks {
    height: 50vh;
  }
}

#sharks-toggle {
  margin-left: 10px;
}

:root[data-sharks="off"] #sharks-toggle {
  opacity: 0.45;
}

:root[data-sharks="off"] .sharks {
  display: none;
}
/* reading: the aside only shows on hover or keyboard focus */
.reading-note {
  color: var(--faint);
  font-style: italic;
  opacity: 0;
  transition: opacity 0.25s ease;
}

.reading:hover .reading-note,
.reading:focus-within .reading-note {
  opacity: 1;
}

/* bloom: a blurred, low-res copy of the sharks laid over them, like sun glare through water.
   raise opacity or blur for more glow */
.sharks.sharks-bloom {
  filter: blur(6px) brightness(1.3);
  opacity: 0.18;
}

.sharks.sharks-bloom[data-theme="light"] {
  opacity: 0.12;
}
