:root {
  --ink: #1b1b1f;
  --muted: #6b6b76;
  --accent: #1f6feb;
  --line: #e6e6ea;
  --bg: #fbfbfd;
  --panel: #fff;
  --code: #f0f0f4;
  --maxw: 62rem;
  --readw: 42rem;
}

html[data-theme="dark"] {
  --ink: #e9e9ec;
  --muted: #9b9ba6;
  --accent: #6aa8ff;
  --line: #2b2b33;
  --bg: #17171b;
  --panel: #1e1e24;
  --code: #26262e;
}

* { box-sizing: border-box; }

/* Theme switch: circular reveal of the new theme from the toggle button.
   Falls back to an instant swap where the View Transitions API is absent. */
::view-transition-old(root),
::view-transition-new(root) { animation: none; mix-blend-mode: normal; }
::view-transition-old(root) { z-index: 0; }
::view-transition-new(root) {
  z-index: 1;
  animation: theme-reveal .45s ease-in;
}
@keyframes theme-reveal {
  from { clip-path: circle(0 at var(--vt-x, 50%) var(--vt-y, 0)); }
  to   { clip-path: circle(var(--vt-r, 150%) at var(--vt-x, 50%) var(--vt-y, 0)); }
}
@media (prefers-reduced-motion: reduce) {
  ::view-transition-new(root) { animation: none; }
}

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

body {
  margin: 0;
  font: 18px/1.7 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
  transition: background-color .2s ease, color .2s ease;
}

header.site, footer.site {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 1.5rem 1.25rem;
}

header.site {
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.header-actions { display: flex; align-items: center; gap: .5rem; }

.theme-toggle, .rss-link, .search-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: .4rem .5rem;
  line-height: 0;
  cursor: pointer;
  color: var(--ink);
}
.theme-toggle:hover, .rss-link:hover, .search-toggle:hover { color: var(--accent); border-color: var(--accent); }

/* The search border lives on the container: clicking the magnifier grows the
   pill leftward around the borderless inline input while the icon stays put. */
.site-search {
  position: relative;
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
}
.site-search:hover, .site-search:focus-within { border-color: var(--accent); }
.site-search .search-toggle { border: none; }
.site-search .search-toggle:hover { border: none; }
.search-input {
  width: 0;
  padding: .4rem 0;
  opacity: 0;
  font: inherit;
  font-size: .9rem;
  line-height: 18px; /* match the 18px icons so the pill equals the buttons */
  color: var(--ink);
  background: none;
  border: none;
  transition: width .25s ease, padding .25s ease, opacity .2s ease;
}
.search-input:focus { outline: none; }
.site-search.open .search-input {
  width: 14rem;
  max-width: 45vw;
  padding: .4rem 0 .4rem .6rem;
  opacity: 1;
}
.search-results {
  position: absolute;
  top: calc(100% + .5rem);
  right: 0;
  z-index: 20;
  width: 22rem;
  max-width: 90vw;
  max-height: 60vh;
  overflow-y: auto;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .15);
}
.search-results a {
  display: block;
  padding: .6rem .8rem;
  text-decoration: none;
  color: var(--ink);
  border-bottom: 1px solid var(--line);
}
.search-results a:last-child { border-bottom: none; }
.search-results a:hover { background: var(--line); }
.search-results strong { display: block; font-size: .95rem; }
.search-results time { color: var(--muted); font-size: .75rem; }
.search-results .snippet { display: block; color: var(--muted); font-size: .8rem; line-height: 1.4; }
.search-results mark { background: var(--accent); color: var(--bg); border-radius: 2px; padding: 0 .1em; }
.search-empty { margin: 0; padding: .6rem .8rem; color: var(--muted); font-size: .85rem; }
.theme-toggle .icon-sun { display: none; }
html[data-theme="dark"] .theme-toggle .icon-moon { display: none; }
html[data-theme="dark"] .theme-toggle .icon-sun { display: inline; }

.menu-toggle {
  display: none;
  background: none;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 1.25rem;
  line-height: 1;
  padding: .35rem .55rem;
  cursor: pointer;
  color: var(--ink);
}
footer.site {
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: .9rem;
  margin-top: 4rem;
}

.brand {
  font-weight: 700;
  font-size: 1.25rem;
  letter-spacing: -.01em;
  color: var(--ink);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: .4rem;
}
.brand-shark { width: 20px; height: 20px; display: block; }

.layout {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 2rem 1.25rem;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 14rem;
  gap: 3rem;
  align-items: start;
}

main { min-width: 0; max-width: var(--readw); }

.sidebar { font-size: .95rem; }
.sidebar h2 {
  font-size: .8rem;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--muted);
  margin: 0 0 .6rem;
}
.sidebar ul { list-style: none; margin: 0 0 2rem; padding: 0; }
.sidebar .side-latest li { margin-bottom: .8rem; line-height: 1.35; }
.sidebar .side-latest time { display: block; color: var(--muted); font-size: .78rem; }
.sidebar .side-archive li { margin-bottom: .3rem; }
.sidebar .side-archive .count { color: var(--muted); font-size: .85em; }
.sidebar h2 a { color: inherit; text-decoration: none; }
.sidebar h2 a:hover { color: var(--accent); }
.side-cloud { line-height: 1.9; margin: 0 0 2rem; }
.side-cloud a { color: var(--ink); margin-right: .4rem; white-space: nowrap; }
.side-cloud a.on { color: var(--accent); }
.side-cloud a.off { color: var(--muted); }
.side-cloud a:hover { color: var(--accent); text-decoration: none; }

@media (max-width: 46rem) {
  .layout { grid-template-columns: 1fr; gap: 2rem; }
  main { max-width: none; }
  .menu-toggle { display: block; }
  .sidebar {
    position: fixed;
    top: 4rem;
    right: 1rem;
    width: 16rem;
    max-width: calc(100vw - 2rem);
    max-height: calc(100vh - 5rem);
    overflow-y: auto;
    margin: 0;
    padding: 1rem 1.25rem .25rem;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, .12);
    display: none;
    z-index: 20;
  }
  .sidebar.open { display: block; }
}

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

.intro p {
  font-size: 1.15rem;
  color: var(--muted);
  margin: 0 0 2.5rem;
}

.entries { list-style: none; margin: 0; padding: 0; }
.entry { padding: 1.5rem 0; border-bottom: 1px solid var(--line); }
.entry-title {
  font-size: 1.4rem;
  font-weight: 650;
  letter-spacing: -.01em;
  color: var(--ink);
}
.entry time { display: block; color: var(--muted); font-size: .85rem; margin: .25rem 0 .5rem; }
.entry .hook { margin: 0; color: var(--muted); }
.entry .read-more { display: block; text-align: right; margin-top: .5rem; font-size: .9rem; font-weight: 600; }

.post h1 {
  font-size: 2.1rem;
  line-height: 1.2;
  letter-spacing: -.02em;
  margin: 0 0 .5rem;
}
.post-tags {
  margin: 0 0 2rem;
  font-size: .85rem;
}
.post-tags a { color: var(--muted); margin-right: .5rem; }
.post-tags a:hover { color: var(--accent); }

.tag-cloud { line-height: 2.1; }
.tag-cloud a {
  margin-right: .7rem;
  white-space: nowrap;
  color: var(--ink);
  font-weight: 600;
}
.tag-cloud a:hover { color: var(--accent); text-decoration: none; }
.post h2 { font-size: 1.4rem; margin: 2.5rem 0 .75rem; letter-spacing: -.01em; }
.post h3 { font-size: 1.15rem; margin: 2rem 0 .5rem; }
.post p { margin: 0 0 1.25rem; }
.post img { max-width: 100%; height: auto; border-radius: 8px; display: block; margin: 1.5rem auto; }
.post blockquote {
  margin: 1.5rem 0;
  padding: .25rem 0 .25rem 1.25rem;
  border-left: 3px solid var(--line);
  color: var(--muted);
}
.post pre {
  background: #1b1b1f;
  color: #f5f5f7;
  padding: 1rem 1.25rem;
  border-radius: 8px;
  overflow-x: auto;
  font-size: .85rem;
  line-height: 1.5;
}
.post code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: .9em;
  background: var(--code);
  padding: .1em .35em;
  border-radius: 4px;
}
.post pre code { background: none; padding: 0; }
.post table { border-collapse: collapse; width: 100%; margin: 1.5rem 0; font-size: .95rem; }
.post th, .post td { border: 1px solid var(--line); padding: .5rem .75rem; text-align: left; }

.post-nav {
  display: flex;
  justify-content: space-between;
  gap: 1.5rem;
  margin-top: 3.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--line);
  font-size: .9rem;
}
.post-nav a { max-width: 47%; color: var(--accent); }
.post-nav .next { margin-left: auto; text-align: right; }
