/* ---------- themes: pick with the dropdown; add your own block to make more ---------- */
/* Add your own: copy a block, change the id, then add a matching <option> in index.html. */
:root, :root[data-theme="light"] {
  --bg:#ffffff; --fg:#1c1c1f; --muted:#6b6b76; --line:#e4e4e9; --panel:#f6f6f8; --accent:#4000ff; --code:#f1f1f5;
  color-scheme: light;
}
/* light */
:root[data-theme="paper"]            { --bg:#f8f5ee; --fg:#2b2a26; --muted:#7a7468; --line:#e5dfd0; --panel:#f0ebdf; --accent:#a4401a; --code:#ece6d8; color-scheme: light; }
:root[data-theme="sepia"]            { --bg:#f4ecd8; --fg:#5b4636; --muted:#8a7560; --line:#e3d6b8; --panel:#ebe0c6; --accent:#b5651d; --code:#e8dcc0; color-scheme: light; }
:root[data-theme="solarized-light"]  { --bg:#fdf6e3; --fg:#586e75; --muted:#93a1a1; --line:#eee8d5; --panel:#f5efdc; --accent:#268bd2; --code:#eee8d5; color-scheme: light; }
:root[data-theme="gruvbox-light"]    { --bg:#fbf1c7; --fg:#3c3836; --muted:#7c6f64; --line:#ebdbb2; --panel:#f2e5bc; --accent:#af3a03; --code:#ebdbb2; color-scheme: light; }
:root[data-theme="catppuccin-latte"] { --bg:#eff1f5; --fg:#4c4f69; --muted:#6c6f85; --line:#ccd0da; --panel:#e6e9ef; --accent:#8839ef; --code:#dce0e8; color-scheme: light; }
:root[data-theme="rose-pine-dawn"]   { --bg:#faf4ed; --fg:#575279; --muted:#797593; --line:#dfdad9; --panel:#fffaf3; --accent:#b4637a; --code:#f2e9e1; color-scheme: light; }
:root[data-theme="github-light"]     { --bg:#ffffff; --fg:#1f2328; --muted:#59636e; --line:#d1d9e0; --panel:#f6f8fa; --accent:#0969da; --code:#eff1f3; color-scheme: light; }
:root[data-theme="tokyo-night-day"]  { --bg:#e1e2e7; --fg:#3760bf; --muted:#6172b0; --line:#c4c8da; --panel:#d5d6db; --accent:#2e7de9; --code:#d0d5e3; color-scheme: light; }
/* dark */
:root[data-theme="dark"]             { --bg:#0d0d10; --fg:#e8e8ec; --muted:#9a9aa6; --line:#26262c; --panel:#16161a; --accent:#8b85ff; --code:#1b1b21; color-scheme: dark; }
:root[data-theme="dracula"]          { --bg:#282a36; --fg:#f8f8f2; --muted:#9aa0c0; --line:#3a3d4f; --panel:#21222c; --accent:#bd93f9; --code:#1e1f29; color-scheme: dark; }
:root[data-theme="nord"]             { --bg:#2e3440; --fg:#eceff4; --muted:#a3adbf; --line:#3b4252; --panel:#343b4a; --accent:#88c0d0; --code:#272c37; color-scheme: dark; }
:root[data-theme="solarized-dark"]   { --bg:#002b36; --fg:#93a1a1; --muted:#657b83; --line:#0a3a46; --panel:#073642; --accent:#2aa198; --code:#00232c; color-scheme: dark; }
:root[data-theme="gruvbox"]          { --bg:#282828; --fg:#ebdbb2; --muted:#a89984; --line:#3c3836; --panel:#32302f; --accent:#fabd2f; --code:#1d2021; color-scheme: dark; }
:root[data-theme="tokyo-night"]      { --bg:#1a1b26; --fg:#c0caf5; --muted:#787c99; --line:#292e42; --panel:#16161e; --accent:#7aa2f7; --code:#1f2335; color-scheme: dark; }
:root[data-theme="catppuccin"]       { --bg:#1e1e2e; --fg:#cdd6f4; --muted:#9399b2; --line:#313244; --panel:#181825; --accent:#cba6f7; --code:#11111b; color-scheme: dark; }
:root[data-theme="rose-pine"]        { --bg:#191724; --fg:#e0def4; --muted:#908caa; --line:#26233a; --panel:#1f1d2e; --accent:#ebbcba; --code:#16141f; color-scheme: dark; }
:root[data-theme="one-dark"]         { --bg:#282c34; --fg:#abb2bf; --muted:#7f8796; --line:#3a3f4b; --panel:#21252b; --accent:#61afef; --code:#1e2227; color-scheme: dark; }
:root[data-theme="monokai"]          { --bg:#272822; --fg:#f8f8f2; --muted:#a6a68a; --line:#3e3d32; --panel:#1e1f1c; --accent:#a6e22e; --code:#1c1d19; color-scheme: dark; }

/* reading font: CMU Serif = Computer Modern, the TeX font (SIL OFL, see fonts/OFL.txt) */
@font-face { font-family: "CMU Serif"; src: url(fonts/CMUSerif-500-roman.woff2)  format("woff2"); font-weight: 400 500; font-style: normal; font-display: swap; }
@font-face { font-family: "CMU Serif"; src: url(fonts/CMUSerif-500-italic.woff2) format("woff2"); font-weight: 400 500; font-style: italic; font-display: swap; }
@font-face { font-family: "CMU Serif"; src: url(fonts/CMUSerif-700-roman.woff2)  format("woff2"); font-weight: 600 900; font-style: normal; font-display: swap; }
@font-face { font-family: "CMU Serif"; src: url(fonts/CMUSerif-700-italic.woff2) format("woff2"); font-weight: 600 900; font-style: italic; font-display: swap; }

/* headings, titles and the side nav: Cormorant Garamond (SIL OFL, see fonts/OFL-CormorantGaramond.txt) */
@font-face { font-family: "Cormorant Garamond"; src: url(fonts/CormorantGaramond-latin-500.woff2) format("woff2"); font-weight: 500; font-style: normal; font-display: swap; unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: "Cormorant Garamond"; src: url(fonts/CormorantGaramond-latin-ext-500.woff2) format("woff2"); font-weight: 500; font-style: normal; font-display: swap; unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }
@font-face { font-family: "Cormorant Garamond"; src: url(fonts/CormorantGaramond-latin-600.woff2) format("woff2"); font-weight: 600; font-style: normal; font-display: swap; unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: "Cormorant Garamond"; src: url(fonts/CormorantGaramond-latin-ext-600.woff2) format("woff2"); font-weight: 600; font-style: normal; font-display: swap; unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }
@font-face { font-family: "Cormorant Garamond"; src: url(fonts/CormorantGaramond-latin-700.woff2) format("woff2"); font-weight: 700; font-style: normal; font-display: swap; unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: "Cormorant Garamond"; src: url(fonts/CormorantGaramond-latin-ext-700.woff2) format("woff2"); font-weight: 700; font-style: normal; font-display: swap; unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }
:root { --head: "Cormorant Garamond", "EB Garamond", Garamond, "Times New Roman", serif; }

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0; background: var(--bg); color: var(--fg);
  font: 16px/1.7 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* top bar */
.top {
  position: sticky; top: 0; z-index: 10; height: 56px;
  display: flex; align-items: center; gap: 16px; padding: 0 20px;
  background: var(--bg); border-bottom: 1px solid var(--line);
}
.brand { font: 600 16px ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; color: var(--fg); white-space: nowrap; }
.brand:hover { text-decoration: none; }
.brand .mark { color: var(--accent); }
.cursor { display: inline-block; width: 9px; height: 1.1em; margin-left: 4px; vertical-align: text-bottom; background: var(--accent); animation: blink 1.1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.search-btn {
  margin: 0 auto; width: min(420px, 100%); text-align: left;
  display: flex; justify-content: space-between; align-items: center;
  padding: 7px 12px; border: 1px solid var(--line); border-radius: 8px;
  background: var(--panel); color: var(--muted); font: inherit; font-size: 14px; cursor: pointer;
}
kbd { font: 12px monospace; border: 1px solid var(--line); border-radius: 4px; padding: 0 6px; }
.top-links { display: flex; align-items: center; gap: 16px; font-size: 14px; }
.top-links a { color: var(--fg); }
#theme-select {
  font: inherit; font-size: 14px; color: var(--fg); background: var(--panel);
  border: 1px solid var(--line); border-radius: 8px; padding: 5px 8px; cursor: pointer;
}
#menu-btn { display: none; background: none; border: 0; color: var(--fg); font-size: 18px; cursor: pointer; }

/* layout */
.layout { display: flex; max-width: 1200px; margin: 0 auto; }
aside {
  width: 280px; flex-shrink: 0; position: sticky; top: 56px; align-self: flex-start;
  height: calc(100vh - 56px); overflow-y: auto; padding: 20px 16px; border-right: 1px solid var(--line);
}
aside a { display: block; padding: 3px 10px; border-radius: 6px; color: var(--fg); font-family: var(--head); font-size: 18.5px; font-weight: 500; line-height: 1.25; margin: 1px 0; }
aside a:hover { background: var(--panel); text-decoration: none; }
aside a.active { background: var(--panel); color: var(--accent); font-weight: 700; }
aside a.group { margin-top: 18px; font-size: 15px; text-transform: uppercase; letter-spacing: .12em; color: var(--muted); font-weight: 700; }
aside a.group.active { color: var(--accent); }

main { flex: 1; min-width: 0; padding: 40px 48px 24px; }
#content, #pager, footer { max-width: 760px; }
h1, h2, .card b, .year, #pager a, .posts .t { font-family: var(--head); }
h1 { font-size: 2.9rem; font-weight: 700; line-height: 1.1; margin: 0 0 .35em; letter-spacing: -.01em; }
h2 { margin: 1.8em 0 .45em; font-size: 1.95rem; font-weight: 600; line-height: 1.15; padding-top: .45em; border-top: 1px solid var(--line); }
.prose > h2:first-child { border-top: 0; margin-top: 0; padding-top: 0; }
.lead { font-size: 1.15rem; color: var(--muted); }
.muted { color: var(--muted); }
.meta { color: var(--muted); font-size: 14px; margin-bottom: 1.6em; display: flex; gap: 14px; flex-wrap: wrap; }
.rating { font-family: ui-monospace, Menlo, Consolas, monospace; letter-spacing: 1px; color: var(--accent); }
.portrait { width: 160px; height: 160px; object-fit: cover; border-radius: 50%; margin-bottom: 12px; }

.prose { font-family: "CMU Serif", "Latin Modern Roman", "Computer Modern", Georgia, "Times New Roman", "Noto Naskh Arabic", "Geeza Pro", serif; font-size: 1.28rem; line-height: 1.62; font-feature-settings: "liga", "kern"; text-rendering: optimizeLegibility; -webkit-font-smoothing: antialiased; }
.prose img { max-width: 100%; height: auto; }
.prose blockquote { margin: 1em 0; padding: .2em 1em; border-left: 3px solid var(--accent); color: var(--muted); }
.prose hr { border: 0; border-top: 1px solid var(--line); margin: 2em 0; }
.prose table { border-collapse: collapse; width: 100%; display: block; overflow-x: auto; }
.prose th, .prose td { border: 1px solid var(--line); padding: 6px 10px; }
code { background: var(--code); padding: 2px 6px; border-radius: 4px; font-size: .9em; }
pre { background: var(--code); padding: 16px; border-radius: 8px; overflow-x: auto; border: 1px solid var(--line); }
pre code { background: none; padding: 0; }

.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; }
.card { display: block; padding: 16px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); color: var(--fg); }
.card:hover { border-color: var(--accent); text-decoration: none; }
.card b { display: block; margin-bottom: 2px; font-size: 1.45rem; font-weight: 700; line-height: 1.2; }
.card span { color: var(--muted); font-size: 14px; }

.year { margin: 1.4em 0 .2em; font-weight: 700; font-size: 1.5rem; color: var(--muted); }
.posts { list-style: none; margin: 0; padding: 0; }
.posts a { display: flex; gap: 12px; align-items: baseline; padding: 6px 0; color: var(--fg); border-bottom: 1px solid var(--line); }
.posts a:hover { color: var(--accent); text-decoration: none; }
.posts .t { flex: 1; font-size: 1.3rem; font-weight: 600; line-height: 1.25; }
.posts .d { flex: 0 0 7.6em; color: var(--muted); font-size: 14px; white-space: nowrap; font-variant-numeric: tabular-nums; }

#pager { display: flex; justify-content: space-between; gap: 12px; margin-top: 48px; }
#pager a { flex: 1; padding: 12px 16px; border: 1px solid var(--line); border-radius: 8px; color: var(--fg); font-size: 1.25rem; font-weight: 600; line-height: 1.25; }
#pager a small { display: block; color: var(--muted); font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; font-size: 12px; font-weight: 400; }
#pager a:last-child { text-align: right; }
footer { margin-top: 40px; padding-top: 16px; border-top: 1px solid var(--line); display: flex; justify-content: space-between; color: var(--muted); font-size: 14px; }

/* search modal */
#modal { position: fixed; inset: 0; background: rgba(0,0,0,.5); display: flex; justify-content: center; padding-top: 12vh; z-index: 50; }
#modal[hidden] { display: none; }
.modal-box { width: min(560px, 92vw); max-height: 70vh; overflow: auto; background: var(--bg); border: 1px solid var(--line); border-radius: 12px; align-self: flex-start; }
#q { width: 100%; padding: 16px; border: 0; border-bottom: 1px solid var(--line); background: transparent; color: var(--fg); font: inherit; outline: none; }
#results { list-style: none; margin: 0; padding: 6px; }
#results a { display: block; padding: 10px 12px; border-radius: 8px; color: var(--fg); }
#results a:hover { background: var(--panel); text-decoration: none; }
#results small { display: block; color: var(--muted); }

/* mobile */
@media (max-width: 800px) {
  .posts .d { flex-basis: 6.8em; font-size: 13px; }
  .top { gap: 10px; padding: 0 12px; }
  .search-btn { flex: 1; min-width: 0; width: auto; margin: 0; }
  #theme-select { max-width: 104px; }
  #menu-btn { display: block; }
  .top-links a, .brand .cursor, .search-btn kbd { display: none; }
  aside { position: fixed; top: 56px; left: 0; background: var(--bg); z-index: 9; transform: translateX(-100%); transition: transform .2s; }
  aside.open { transform: none; }
  main { padding: 24px 20px; }
}

/* landing-page stars (drawn by app.js; only runs on the home page) */
#stars { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 0; pointer-events: none; }
main { position: relative; z-index: 1; }   /* keeps text above the stars canvas */
a.ext::after { content: " \2197"; font-size: .85em; opacity: .7; }
