/* Tokens. Light is the default; dark applies from data-theme or the OS setting. */
:root {
  --bg: #ffffff; --card: #fbfbfd; --surf: #f5f5f7; --inset: #ffffff; --hover: #eeeef1;
  --text: #1d1d1f; --sec: #6e6e73; --bd: #e8e8ed; --rule: #d2d2d7;
  --link: #0066cc; --accent: #b85c00; --accent-bg: #fdf0e3;
  --blue: #0062cc; --blue-bg: #e9f1fd; --pink: #c2317e; --pink-bg: #fdeaf3;
  --purple: #7145c4; --purple-bg: #f1ecfd; --green: #1a7f4b; --green-bg: #e6f5ed;
  --teal: #0f7a86; --teal-bg: #e4f4f6;
  --kw: #ad3da4; --str: #d12f1b; --cmt: #5d6c79; --num: #272ad8; --fn: #3e8087;
  --lift: 0 6px 20px rgba(0, 0, 0, 0.07);
  --sans: -apple-system, BlinkMacSystemFont, 'SF Pro Text', system-ui, sans-serif;
  --serif: 'Newsreader', Georgia, serif;
  --mono: 'IBM Plex Mono', ui-monospace, Menlo, monospace;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #000000; --card: #1a1a1c; --surf: #121214; --inset: #000000; --hover: #26262a;
  --text: #f5f5f7; --sec: #8e8e93; --bd: #2c2c2e; --rule: #38383c;
  --link: #2997ff; --accent: #ffb26b; --accent-bg: #3a2612;
  --blue: #7fb6ff; --blue-bg: #12243d; --pink: #ff9ec7; --pink-bg: #3a1628;
  --purple: #c3a6ff; --purple-bg: #241a3d; --green: #6fd39b; --green-bg: #102e1f;
  --teal: #6fd0da; --teal-bg: #0f2b2f;
  --kw: #ff7ab2; --str: #ff8170; --cmt: #7f8c98; --num: #d9c97c; --fn: #78c2b3;
  --lift: 0 6px 24px rgba(0, 0, 0, 0.6);
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #000000; --card: #1a1a1c; --surf: #121214; --inset: #000000; --hover: #26262a;
    --text: #f5f5f7; --sec: #8e8e93; --bd: #2c2c2e; --rule: #38383c;
    --link: #2997ff; --accent: #ffb26b; --accent-bg: #3a2612;
    --blue: #7fb6ff; --blue-bg: #12243d; --pink: #ff9ec7; --pink-bg: #3a1628;
    --purple: #c3a6ff; --purple-bg: #241a3d; --green: #6fd39b; --green-bg: #102e1f;
    --teal: #6fd0da; --teal-bg: #0f2b2f;
    --kw: #ff7ab2; --str: #ff8170; --cmt: #7f8c98; --num: #d9c97c; --fn: #78c2b3;
    --lift: 0 6px 24px rgba(0, 0, 0, 0.6);
    color-scheme: dark;
  }
}

/* Base */
html { background: var(--bg); }
body {
  margin: 0; background: var(--bg); color: var(--text); font-family: var(--sans);
  -webkit-font-smoothing: antialiased; transition: background-color .4s ease, color .4s ease;
}
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
a:focus-visible, button:focus-visible { outline: 2px solid var(--link); outline-offset: 3px; border-radius: 6px; }
img { max-width: 100%; height: auto; }
.screen-reader-text {
  position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
}
.screen-reader-text:focus {
  position: fixed; top: 8px; left: 8px; width: auto; height: auto; clip: auto; z-index: 100;
  background: var(--bg); color: var(--text); padding: 10px 14px; border: 1px solid var(--bd); border-radius: 8px;
}

.wrap { width: 100%; max-width: 1020px; margin: 0 auto; padding: 0 20px; box-sizing: border-box; }
.read { width: 100%; max-width: 720px; margin: 0 auto; padding: 0 20px; box-sizing: border-box; }

/* Header */
.bar { position: sticky; top: 0; z-index: 10; border-bottom: 1px solid var(--bd); background: var(--bg);
       transition: background-color .4s ease, border-color .4s ease; }
.bar .wrap { height: 56px; display: flex; align-items: center; justify-content: space-between; }
.brand { display: flex; align-items: center; gap: 11px; text-decoration: none; }
.brand:hover { text-decoration: none; }
.mark { width: 26px; height: 26px; border-radius: 3px; background: var(--text); color: var(--bg);
        font-family: var(--mono); font-size: 10px; font-weight: 500; letter-spacing: -.02em;
        display: flex; align-items: center; justify-content: center; }
.brand .name { font-family: var(--mono); font-size: 13px; letter-spacing: -.01em; color: var(--text); }
.tools { display: flex; align-items: center; }

/* Menu: brackets fade in on hover. They hold their space at zero opacity, so nothing shifts. */
.links { display: flex; gap: 18px; align-items: center; margin: 0; padding: 0; list-style: none; }
.links li { margin: 0; }
.links a { font-family: var(--mono); font-size: 12px; color: var(--text); text-decoration: none;
           line-height: 1; display: inline-block; transition: color .15s ease; }
.links a::before { content: "["; margin-right: 4px; color: var(--accent); opacity: 0; transition: opacity .15s ease; }
.links a::after  { content: "]"; margin-left: 4px; color: var(--accent); opacity: 0; transition: opacity .15s ease; }
.links a:hover { color: var(--text); text-decoration: none; }
.links a:hover::before, .links a:hover::after { opacity: 1; }
.links a.on::before, .links a.on::after,
.links .current-menu-item > a::before, .links .current-menu-item > a::after { opacity: 1; color: var(--sec); }
.links a.on:hover::before, .links a.on:hover::after { color: var(--accent); }
.bar .links { margin-right: 2px; }
.bar .links a { padding: 11px 0; }

.iconbtn { position: relative; width: 44px; height: 44px; padding: 0; background: none; border: none; cursor: pointer;
           display: flex; align-items: center; justify-content: center; color: var(--sec); }
.iconbtn::before { content: ""; position: absolute; width: 36px; height: 36px; border-radius: 980px;
                   background: transparent; transition: background-color .15s ease; }
.iconbtn svg { position: relative; stroke: currentColor; transition: stroke .15s ease; }
.iconbtn:hover { color: var(--text); }
.iconbtn:hover::before { background: var(--hover); }
.toggle { margin-left: 6px; margin-right: -10px; }
.toggle .sun { display: none; }
:root[data-theme="dark"] .toggle .sun { display: block; }
:root[data-theme="dark"] .toggle .moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .toggle .sun { display: block; }
  :root:not([data-theme="light"]) .toggle .moon { display: none; }
  :root:not([data-theme="light"]) .pill:hover { filter: brightness(1.25); }
}
.menu-btn { display: none; margin-right: -10px; color: var(--text); }

/* Home */
.hero { padding: 84px 0 64px; }
.eyebrow { font-family: var(--mono); font-size: 12px; letter-spacing: .02em; color: var(--sec); margin-bottom: 20px; }
.hero h1 { margin: 0 0 22px; font-family: var(--serif); font-size: 60px; font-weight: 400;
           line-height: 1.10; letter-spacing: -.012em; max-width: 840px; }
.hero h1 em { font-style: italic; color: var(--accent); }
.lede { margin: 0; font-size: 19px; line-height: 1.5; letter-spacing: -.009em; color: var(--sec); max-width: 560px; }

.seclabel { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 20px; }
.seclabel h2 { margin: 0; font-family: var(--mono); font-size: 12px; font-weight: 400; letter-spacing: .06em;
               text-transform: uppercase; color: var(--text); }
.seclabel a, .seclabel .count { font-family: var(--mono); font-size: 12px; color: var(--sec); text-decoration: none; }
.seclabel a:hover { color: var(--link); }

/* Chips */
.tags { display: flex; gap: 8px; flex-wrap: wrap; position: relative; z-index: 1; }
.pill { font-family: var(--mono); font-size: 11.5px; line-height: 1; border-radius: 6px; padding: 3px 9px 5px;
        text-decoration: none; display: inline-block; }
.pill:hover { filter: brightness(.94); text-decoration: none; }
:root[data-theme="dark"] .pill:hover { filter: brightness(1.25); }
.p-blue { color: var(--blue); background: var(--blue-bg); }
.p-pink { color: var(--pink); background: var(--pink-bg); }
.p-purple { color: var(--purple); background: var(--purple-bg); }
.p-green { color: var(--green); background: var(--green-bg); }
.p-teal { color: var(--teal); background: var(--teal-bg); }
.p-accent { color: var(--accent); background: var(--accent-bg); }
.feature .pill { color: var(--blue); background: var(--inset); }
.meta { font-family: var(--mono); font-size: 11.5px; color: var(--sec); }
.feature .meta { color: var(--blue); }

/* Cards. The title link stretches over the card, chips sit above it so they stay clickable. */
.feature, .card, .note, .pn { position: relative;
  transition: transform .22s ease, box-shadow .22s ease, background-color .4s ease, border-color .4s ease; }
.feature:hover, .card:hover, .note:hover, .pn:hover { transform: translateY(-2px); box-shadow: var(--lift); }
.stretch { color: var(--text); text-decoration: none; }
.stretch:hover { text-decoration: none; }
.stretch::after { content: ""; position: absolute; inset: 0; border-radius: inherit; }
.feature:focus-within, .card:focus-within, .note:focus-within { outline: 2px solid var(--link); outline-offset: 3px; }
.stretch:focus-visible { outline: none; }

.feature { background: var(--blue-bg); border-radius: 20px; padding: 32px 34px; margin-bottom: 24px; }
.feature h3 { margin: 16px 0 12px; font-family: var(--serif); font-size: 37px; font-weight: 400;
              line-height: 1.15; letter-spacing: -.012em; max-width: 720px; }
.feature p { margin: 0 0 16px; font-size: 17px; line-height: 1.52; letter-spacing: -.008em;
             color: var(--text); opacity: .72; max-width: 680px; }

.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.card { background: var(--card); border: 1px solid var(--bd); border-radius: 18px; padding: 24px 26px; }
.card h3 { margin: 14px 0 10px; font-family: var(--serif); font-size: 25px; font-weight: 400;
           line-height: 1.21; letter-spacing: -.010em; }
.card .tags:empty + h3 { margin-top: 0; }
.card p { margin: 0 0 14px; font-size: 15.5px; line-height: 1.52; letter-spacing: -.006em; color: var(--sec); }

.band { margin-top: 56px; background: var(--surf); padding: 44px 0 50px; transition: background-color .4s ease; }
.note { background: var(--card); border: 1px solid var(--bd); border-radius: 16px; padding: 20px 22px;
        display: flex; flex-direction: column; gap: 12px; align-items: flex-start; }
.band .note { background: var(--inset); border-color: transparent; }
.note .body { flex-grow: 1; font-size: 15.5px; line-height: 1.5; letter-spacing: -.007em; }

/* Listing pages */
.pagehead { padding: 64px 0 0; }
.ptitle { margin: 0 0 16px; font-family: var(--serif); font-size: 50px; font-weight: 400;
          line-height: 1.10; letter-spacing: -.012em; }
.pdesc { margin: 0 0 30px; font-size: 18px; line-height: 1.5; letter-spacing: -.008em; color: var(--sec); max-width: 560px; }
.pdesc p { margin: 0; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; padding-bottom: 32px; border-bottom: 1px solid var(--bd); margin-bottom: 28px; }
.filter { font-family: var(--mono); font-size: 12px; line-height: 1; border-radius: 6px; padding: 4px 11px 6px;
          color: var(--sec); background: var(--surf); text-decoration: none; }
.filter:hover { color: var(--text); text-decoration: none; }
.filter.on { color: var(--bg); background: var(--text); }
.listing { margin-top: 8px; }

.pager { display: flex; justify-content: space-between; gap: 18px; margin-top: 40px; font-family: var(--mono); font-size: 12px; }
.pager .nav-links { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.pager .page-numbers { display: inline-block; min-width: 32px; padding: 8px 10px; box-sizing: border-box; text-align: center;
                       border-radius: 8px; color: var(--sec); text-decoration: none; }
.pager a.page-numbers:hover { background: var(--hover); color: var(--text); }
.pager .page-numbers.current { background: var(--text); color: var(--bg); }

/* Post */
.article { padding: 60px 0 0; }
.back { display: inline-flex; align-items: center; gap: 7px; font-family: var(--mono); font-size: 12px;
        color: var(--link); text-decoration: none; margin-bottom: 32px; }
.back svg { stroke: var(--link); }
.back:hover { text-decoration: underline; text-underline-offset: 4px; }
.article .ptitle { margin: 40px 0 24px; }
.article .tags:empty + .ptitle { margin-top: 0; }
.plede { margin: 0 0 20px; font-family: var(--serif); font-size: 25px; line-height: 1.40; font-style: italic; color: var(--sec); }
.plede p { margin: 0; }
.prule { padding-bottom: 34px; border-bottom: 1px solid var(--bd); margin-bottom: 38px; }

/* Post body: styles for whatever HTML WordPress stores. */
.entry { font-size: 18px; line-height: 1.66; letter-spacing: -.008em; counter-reset: sec; overflow-wrap: break-word; }
.entry > * { margin-top: 0; }
.entry p, .entry ul, .entry ol, .entry table, .entry dl { margin: 0 0 26px; }
.entry ul, .entry ol { padding-left: 1.3em; }
.entry li { margin-bottom: 6px; }
.entry li > ul, .entry li > ol { margin: 6px 0 0; }
.entry h2 { margin: 44px 0 20px; display: flex; align-items: baseline; gap: 14px;
            font-family: var(--serif); font-size: 32px; font-weight: 400; line-height: 1.19; letter-spacing: -.010em; }
.entry h2::before { counter-increment: sec; content: counter(sec, decimal-leading-zero);
                    font-family: var(--mono); font-size: 13px; color: var(--blue); flex-shrink: 0; }
.entry h1 { margin: 44px 0 20px; font-family: var(--serif); font-size: 38px; font-weight: 400; line-height: 1.15; letter-spacing: -.012em; }
.entry h3 { margin: 36px 0 16px; font-family: var(--serif); font-size: 25px; font-weight: 400; line-height: 1.24; letter-spacing: -.010em; }
.entry h4, .entry h5, .entry h6 { margin: 30px 0 12px; font-family: var(--mono); font-size: 13px; font-weight: 500;
                                   letter-spacing: .04em; text-transform: uppercase; color: var(--sec); }
.entry a { text-decoration: underline; text-decoration-color: color-mix(in srgb, var(--link) 35%, transparent); text-underline-offset: 3px; }
.entry a:hover { text-decoration-color: var(--link); }
.entry hr { border: 0; border-top: 1px solid var(--bd); margin: 40px 0; }
.entry img { border-radius: 12px; }
.entry figure { margin: 0 0 32px; }
.entry figcaption, .entry .wp-caption-text { margin-top: 12px; font-family: var(--mono); font-size: 11.5px; color: var(--sec); }
.entry .aligncenter { display: block; margin-left: auto; margin-right: auto; }
.entry .alignleft { float: left; margin: 4px 22px 12px 0; }
.entry .alignright { float: right; margin: 4px 0 12px 22px; }
.entry::after { content: ""; display: table; clear: both; }
.entry :not(pre) > code, .entry kbd, .entry tt {
  font-family: var(--mono); font-size: .89em; background: var(--surf); border-radius: 6px; padding: 2px 6px; }
.entry blockquote { margin: 0 0 44px; background: var(--accent-bg); border-radius: 18px; padding: 24px 28px;
                    font-family: var(--serif); font-size: 21px; line-height: 1.46; }
.entry blockquote > :last-child { margin-bottom: 0; }
.entry blockquote cite { display: block; margin-top: 12px; font-family: var(--mono); font-size: 11px; font-style: normal;
                         letter-spacing: .06em; text-transform: uppercase; color: var(--accent); }
.entry table { width: 100%; border-collapse: collapse; font-size: 15px; display: block; overflow-x: auto; }
.entry th, .entry td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--bd); vertical-align: top; }
.entry th { font-family: var(--mono); font-size: 11.5px; font-weight: 500; letter-spacing: .04em; text-transform: uppercase; color: var(--sec); }

/* Code boxes. main.js wraps each <pre> in .codebox with a header; without JS the <pre> still gets the box. */
.entry pre, .codebox { background: var(--surf); border-radius: 16px; transition: background-color .4s ease; }
.entry pre { margin: 0 0 32px; padding: 18px 20px 20px; overflow-x: auto; }
.codebox { margin: 0 0 32px; overflow: hidden; }
.codebox pre { margin: 0; border-radius: 0; background: none; }
.codehead { display: flex; align-items: center; justify-content: space-between; padding: 11px 20px; border-bottom: 1px solid var(--bd); }
.codehead span { font-family: var(--mono); font-size: 11px; letter-spacing: .04em; text-transform: uppercase; color: var(--sec); }
.copy { width: 44px; height: 30px; margin-right: -12px; }
.copy::before { width: 28px; height: 26px; border-radius: 7px; }
.copy .done { display: none; }
.copy.copied .done { display: block; }
.copy.copied .idle { display: none; }
pre, pre code { font-family: var(--mono); font-size: 13.5px; line-height: 1.65; color: var(--text); }
pre code { background: none; padding: 0; }
.hljs-keyword, .hljs-built_in, .hljs-literal, .hljs-selector-tag, .hljs-meta .hljs-keyword { color: var(--kw); }
.hljs-string, .hljs-regexp, .hljs-attr .hljs-string, .hljs-template-string { color: var(--str); }
.hljs-comment, .hljs-quote, .hljs-meta { color: var(--cmt); }
.hljs-number, .hljs-symbol, .hljs-variable.constant_ { color: var(--num); }
.hljs-title, .hljs-title.function_, .hljs-title.class_, .hljs-attr, .hljs-attribute, .hljs-name, .hljs-type { color: var(--fn); }

.prevnext { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px;
            margin-top: 48px; padding-top: 36px; border-top: 1px solid var(--bd); }
.pn { background: var(--card); border: 1px solid var(--bd); border-radius: 16px; padding: 18px 20px;
      display: flex; flex-direction: column; gap: 8px; text-decoration: none; }
.pn:hover { text-decoration: none; }
.pn.next { text-align: right; grid-column: 2; }
.pn .t { font-family: var(--serif); font-size: 21px; line-height: 1.26; color: var(--text); }
.pn .t.mono { font-family: var(--mono); font-size: 14px; }

/* About */
.about { padding: 60px 0 0; }
.abouthead { display: flex; align-items: flex-start; gap: 30px; margin-bottom: 44px; }
.portrait { width: 200px; height: 200px; flex-shrink: 0; border-radius: 18px; object-fit: cover; border: 1px solid var(--bd); }
.about .ptitle { margin: 0 0 14px; }
.arole { margin: 0 0 16px; font-family: var(--serif); font-size: 23px; line-height: 1.40; font-style: italic; color: var(--sec); }
.arole p { margin: 0; }
.elsewhere { margin-top: 44px; }

/* Footer */
.foot { border-top: 1px solid var(--bd); padding: 24px 0; margin-top: 64px; }
.foot .wrap { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.foot .c { font-family: var(--mono); font-size: 11.5px; color: var(--sec); }
.foot .links a { font-size: 11.5px; padding: 6px 0; color: var(--sec); }
.foot .links a:hover { color: var(--text); }

.empty { padding: 40px 0; color: var(--sec); }

@media (max-width: 760px) {
  .hero { padding: 44px 0 34px; }
  .hero h1 { font-size: 38px; }
  .lede { font-size: 17px; }
  .grid2, .grid3, .prevnext { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  .pn.next { grid-column: auto; }
  .feature { padding: 22px; }
  .feature h3 { font-size: 27px; }
  .card { padding: 20px 22px; }
  .card h3 { font-size: 22px; }
  .ptitle { font-size: 34px; }
  .plede, .arole { font-size: 21px; }
  .entry h2 { font-size: 27px; }
  .abouthead { flex-direction: column; gap: 22px; }
  pre, pre code { font-size: 12.5px; }
  .entry .alignleft, .entry .alignright { float: none; margin: 0 0 20px; }

  /* Phone menu: a hamburger opens the links as a panel under the bar. */
  .menu-btn { display: flex; }
  .toggle { margin-right: 0; }
  .bar .links { display: none; position: absolute; top: 56px; left: 0; right: 0; margin: 0;
                flex-direction: column; align-items: stretch; gap: 0; padding: 8px 20px 14px;
                background: var(--bg); border-bottom: 1px solid var(--bd); }
  .bar.open .links { display: flex; }
  .bar .links a { display: block; padding: 14px 0; font-size: 14px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }
  .feature:hover, .card:hover, .note:hover, .pn:hover { transform: none; }
}
