/*
 * Feedbook — two marks on paper.
 *   highlighter  (--hl)  : what the author said that mattered
 *   ink          (--ink) : what you thought about it
 * Everything else stays neutral so those two stand out.
 */

/* Type: Source Serif for reading, bundled so it looks the same everywhere; the system's own
   sans for the interface (San Francisco, where there is one), else Inter. Both OFL, in fonts/. */
@font-face { font-family: "Source Serif"; font-style: normal; font-weight: 200 900; font-display: swap; src: url(fonts/source-serif-4-latin-opsz-normal.woff2) format("woff2"); 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: "Source Serif"; font-style: normal; font-weight: 200 900; font-display: swap; src: url(fonts/source-serif-4-latin-ext-opsz-normal.woff2) format("woff2"); 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: "Source Serif"; font-style: italic; font-weight: 200 900; font-display: swap; src: url(fonts/source-serif-4-latin-opsz-italic.woff2) format("woff2"); 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: "Source Serif"; font-style: italic; font-weight: 200 900; font-display: swap; src: url(fonts/source-serif-4-latin-ext-opsz-italic.woff2) format("woff2"); 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: "Inter"; font-style: normal; font-weight: 100 900; font-display: swap; src: url(fonts/inter-latin-wght-normal.woff2) format("woff2"); 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: "Inter"; font-style: normal; font-weight: 100 900; font-display: swap; src: url(fonts/inter-latin-ext-wght-normal.woff2) format("woff2"); 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 {
  --paper: #fffefc;
  --bg: #faf9f6;
  --side: #f4f2ee;
  --hover: rgb(40 30 10 / .045);
  --active: rgb(40 30 10 / .085);
  --line: #e9e5dd;
  --text: #1c1b19;
  --text-2: #57534b;
  --text-3: #938d82;
  --accent: #b75a1e;
  --ink: #2e5a88;
  --ink-rule: rgb(46 90 136 / .28);
  --ink-wash: rgb(46 90 136 / .06);
  --hl: #faeaa2;
  --hl-strong: #f5d95e;
  --shadow: 0 1px 1px rgb(0 0 0 / .04), 0 6px 20px rgb(0 0 0 / .09);
  --ui: -apple-system, BlinkMacSystemFont, Inter, "Segoe UI", Roboto, sans-serif;
  --serif: "Source Serif", "Iowan Old Style", Charter, Georgia, serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --side-w: 220px;
  --list-w: 340px;
  --measure: 36rem;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #1c1b1a;
    --bg: #181716;
    --side: #151413;
    --hover: rgb(255 250 240 / .04);
    --active: rgb(255 250 240 / .08);
    --line: #2b2927;
    --text: #e9e5de;
    --text-2: #aca69c;
    --text-3: #736e67;
    --accent: #e08a52;
    --ink: #92b6dd;
    --ink-rule: rgb(146 182 221 / .3);
    --ink-wash: rgb(146 182 221 / .07);
    --hl: rgb(222 184 60 / .26);
    --hl-strong: rgb(222 184 60 / .45);
    --shadow: 0 1px 1px rgb(0 0 0 / .3), 0 8px 24px rgb(0 0 0 / .45);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 14px/1.45 var(--ui);
  touch-action: manipulation; /* no double-tap zoom, so taps respond at once */
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
input, textarea { font: inherit; color: inherit; }
a { color: inherit; }
svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--ink-rule); outline-offset: 2px; border-radius: 4px; }
kbd { font: 11px/1 var(--mono); padding: 2px 5px; border: 1px solid var(--line); border-radius: 4px; color: var(--text-2); }

.layout {
  display: grid;
  grid-template-columns: var(--side-w) var(--list-w) 1fr;
  height: 100vh;
  height: 100dvh;
}
/* The Notebook and Suggestions are pages of their own: no list pane. */
body.page .layout { grid-template-columns: var(--side-w) 1fr; }
body.page .list { display: none; }

.icon-btn {
  display: inline-grid; place-items: center; flex: none;
  width: 28px; height: 28px; border-radius: 6px; color: var(--text-3);
}
.icon-btn:hover { background: var(--hover); color: var(--text); }
.icon-btn.busy svg { animation: spin .9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- sidebar ------------------------------------------------------------ */

.sidebar {
  background: var(--side);
  border-right: 1px solid var(--line);
  display: flex; flex-direction: column; min-height: 0;
  padding: 16px 10px;
}
.nav { display: grid; gap: 1px; margin-bottom: 22px; }
.row {
  display: flex; align-items: center; gap: 9px; min-width: 0;
  padding: 5px 8px; border-radius: 6px;
  color: var(--text-2); text-decoration: none; cursor: pointer; user-select: none;
}
.row:hover { background: var(--hover); }
.row.active { background: var(--active); color: var(--text); }
.row .label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .count { font-size: 12px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.row > svg { color: var(--text-3); }
.row.active > svg { color: var(--text); }
.row .fav { width: 16px; height: 16px; flex: none; border-radius: 4px; overflow: hidden; display: grid; place-items: center; background: var(--active); color: var(--text-3); font-size: 9.5px; font-weight: 650; }
.row .fav img { width: 16px; height: 16px; grid-area: 1 / 1; background: var(--side); }
.row .fav span { grid-area: 1 / 1; }
.row .err { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); flex: none; }
.row .edit { display: none; color: var(--text-3); margin: -4px -4px -4px 0; width: 22px; height: 22px; place-items: center; border-radius: 4px; }
.row .edit:hover { color: var(--text); background: var(--hover); }
.row:hover .edit { display: grid; }
.row:hover .edit ~ .count, .row:hover .count:has(~ .edit) { display: none; }
.folder > .row .caret { transition: transform .15s; }
.folder.collapsed > .row .caret { transform: rotate(-90deg); }
.folder.collapsed > .children { display: none; }
.children { padding-left: 16px; display: grid; gap: 1px; }
.section-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 2px 4px 8px; color: var(--text-3); font-size: 12px;
}
.feeds { flex: 1; overflow-y: auto; min-height: 0; display: grid; align-content: start; gap: 1px; }
.row .toggle { display: grid; }
.offline { margin: 8px 8px 0; font-size: 12px; color: var(--text-3); }

/* ---- entry list --------------------------------------------------------- */

.list { display: flex; flex-direction: column; min-height: 0; background: var(--bg); border-right: 1px solid var(--line); }
.list-head { display: flex; align-items: center; gap: 2px; padding: 14px 12px 6px 20px; }
.list-head h2 { flex: 1; margin: 0; font-size: 15px; font-weight: 600; letter-spacing: -.01em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.search { display: flex; align-items: center; gap: 7px; margin: 2px 12px 8px; padding: 0 10px; height: 30px; border-radius: 7px; background: var(--hover); color: var(--text-3); }
.search:focus-within { background: var(--paper); box-shadow: inset 0 0 0 1px var(--line); }
.search svg { width: 14px; height: 14px; flex: none; }
.search input { flex: 1; min-width: 0; border: 0; outline: none; background: none; color: var(--text); }
.search input::placeholder { color: var(--text-3); }
.search input::-webkit-search-cancel-button { display: none; }
.entries { list-style: none; margin: 0; padding: 0 0 48px; overflow-y: auto; flex: 1; min-height: 0; }

.entry { position: relative; padding: 12px 20px 13px; cursor: pointer; }
.entry + .entry::before { content: ""; position: absolute; top: 0; left: 20px; right: 20px; border-top: 1px solid var(--line); }
.entry:hover { background: var(--hover); }
.entry.active { background: var(--active); }
.entry:hover::before, .entry.active::before, .entry:hover + .entry::before, .entry.active + .entry::before { opacity: 0; }
.entry .meta { display: flex; align-items: baseline; gap: 8px; font-size: 12px; color: var(--text-3); margin-bottom: 2px; }
.entry .meta .src { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.entry .meta .ink { color: var(--ink); }
.entry .title { font-size: 14px; line-height: 1.35; font-weight: 500; color: var(--text-2); }
.entry.unread .title { color: var(--text); font-weight: 600; }
.entry.unread .meta .src::before { content: ""; display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); margin-right: 6px; vertical-align: 1px; }
.entry .excerpt { font-size: 13px; line-height: 1.45; color: var(--text-3); margin-top: 3px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.list-empty { padding: 48px 28px; text-align: center; color: var(--text-3); line-height: 1.6; }

/* ---- reader ------------------------------------------------------------- */

.reader { overflow-y: auto; min-height: 0; background: var(--paper); position: relative; }

/* an article, and your note beside it when you're writing */
.reader.split { overflow: hidden; }
.read-split { display: grid; grid-template-columns: minmax(0, 1fr); height: 100%; }
.article-scroll { overflow-y: auto; min-height: 0; position: relative; }
.note-pane { display: none; }
body.writing .layout { grid-template-columns: 1fr; }
body.writing .sidebar, body.writing .list { display: none; }
body.writing .read-split { grid-template-columns: minmax(0, 1fr) minmax(360px, 44%); }
body.writing .note-pane { display: flex; }
body.writing .art-actions .back { display: inline !important; }
.reader-empty { min-height: 100%; display: grid; place-items: center; padding: 32px; color: var(--text-3); font-size: 13.5px; line-height: 1.9; text-align: center; }

.article { max-width: calc(var(--measure) + 96px); margin: 0 auto; padding: 12px 48px 30vh; position: relative; }
.art-actions { display: flex; justify-content: flex-end; align-items: center; gap: 20px; height: 30px; margin-bottom: 52px; font-size: 13px; }
.art-actions button, .art-actions a { color: var(--text-3); text-decoration: none; white-space: nowrap; transition: color .12s; }
.art-actions button:hover, .art-actions a:hover { color: var(--text); }
.art-actions .on { color: var(--text); }
.art-actions .back { margin-right: auto; }
.art-meta { margin: 0 0 10px; font-size: 13px; line-height: 22px; color: var(--text-3); }
.art-meta a { text-decoration: none; color: var(--text-2); }
.art-meta a:hover { color: var(--text); }
.article h1 { font: 600 34px/1.16 var(--serif); letter-spacing: -.016em; margin: 0 0 32px; text-wrap: balance; }
.article h1 a { text-decoration: none; }

.art-body { font: 18.5px/1.62 var(--serif); overflow-wrap: break-word; hanging-punctuation: first; }
.art-body > :first-child { margin-top: 0; }
.art-body p, .art-body ul, .art-body ol, .art-body dl, .art-body blockquote, .art-body pre, .art-body figure, .art-body table, .art-body details { margin: 0 0 1.1em; }
.art-body ul, .art-body ol { padding-left: 1.4em; }
.art-body li { margin: .2em 0; }
.art-body h1, .art-body h2, .art-body h3, .art-body h4, .art-body h5 { font-family: var(--serif); font-weight: 600; line-height: 1.3; margin: 1.7em 0 .55em; }
.art-body h1, .art-body h2 { font-size: 1.3em; } .art-body h3 { font-size: 1.12em; } .art-body h4, .art-body h5 { font-size: 1em; }
.art-body img, .art-body video { max-width: 100%; height: auto; border-radius: 3px; }
.art-body video { width: 100%; background: #000; }
.art-body audio { width: 100%; }
.art-body iframe { display: block; width: 100%; border: 0; border-radius: 6px; background: var(--bg); }
.art-body iframe.video { aspect-ratio: 16 / 9; height: auto; }
.art-body figure { margin-left: 0; margin-right: 0; }
.art-body figcaption { font: 13px/1.45 var(--ui); color: var(--text-3); margin-top: 8px; }
.art-body blockquote { margin-left: 0; padding-left: 20px; border-left: 2px solid var(--line); color: var(--text-2); }
.art-body pre { font: 13.5px/1.55 var(--mono); background: var(--bg); padding: 14px 16px; border-radius: 6px; overflow-x: auto; }
.art-body code { font-family: var(--mono); font-size: .82em; }
.art-body a { color: inherit; text-decoration-color: var(--text-3); text-decoration-thickness: 1px; text-underline-offset: 3px; }
.art-body a:hover { text-decoration-color: currentColor; }
.art-body table { border-collapse: collapse; font: 14px/1.45 var(--ui); display: block; overflow-x: auto; }
.art-body td, .art-body th { border-bottom: 1px solid var(--line); padding: 6px 10px 6px 0; text-align: left; }
.art-body hr { border: 0; text-align: center; margin: 2em 0; }
.art-body hr::after { content: "· · ·"; color: var(--text-3); letter-spacing: .4em; }
.art-body ::selection { background: var(--hl); }

/* highlighter */
mark.fb-hl {
  background: var(--hl); color: inherit; padding: 0 1px; border-radius: 2px; cursor: pointer;
  box-decoration-break: clone; -webkit-box-decoration-break: clone; transition: background .15s;
}
mark.fb-hl.lit { background: var(--hl-strong); }

mark.fb-hl.responded { text-decoration: underline 1.5px var(--ink-rule); text-underline-offset: 4px; }
mark.fb-hl.flash { animation: flash 1.2s ease; }
@keyframes flash { 25% { background: var(--hl-strong); box-shadow: 0 0 0 3px var(--hl-strong); } }

/* ---- the note: their words quoted in the highlighter, yours in ink ------------ */

.note-pane { flex-direction: column; min-height: 0; background: var(--bg); border-left: 1px solid var(--line); }
.np-head { display: flex; align-items: center; gap: 16px; height: 54px; padding: 12px 16px 12px 32px; font-size: 13px; color: var(--text-3); flex: none; }
.np-head .np-status { transition: opacity .3s; }
.np-head .np-status { flex: 1; }
.np-head button { color: var(--text-3); }
.np-head button:hover { color: var(--text); }
.np-head .np-close { font-size: 20px; line-height: 1; }
.np-body { flex: 1; overflow-y: auto; padding: 50px 40px 30vh 32px; }
.read-split .np-kicker, .read-split .np-title { display: none; }
.np-kicker { font-size: 12px; color: var(--text-3); margin-bottom: 2px; }
.np-title { font: 600 20px/1.3 var(--serif); margin: 0 0 22px; color: var(--text-2); }
.np-title-input { display: block; width: 100%; border: 0; outline: none; background: none; padding: 0; margin: 0 0 24px; font: 600 30px/1.2 var(--serif); letter-spacing: -.014em; color: var(--text); }
.np-title-input::placeholder { color: var(--text-3); }
.np-doc { display: grid; gap: 16px; font: 15.5px/1.62 var(--ui); color: var(--ink); }
.np-quote { position: relative; margin: 0; }
.np-quote blockquote { margin: 0; font: 16.5px/1.6 var(--serif); color: var(--text); }
.np-quote blockquote { display: inline; background: var(--hl); padding: 1px 2px; border-radius: 2px; box-decoration-break: clone; -webkit-box-decoration-break: clone; }
.np-quote.linked { cursor: pointer; }
.np-quote.linked:hover blockquote, .np-quote.lit blockquote { background: var(--hl-strong); }
.np-quote.flash blockquote { animation: flash 1.2s ease; }
.np-x { position: absolute; right: -24px; top: 0; width: 20px; height: 20px; border-radius: 50%; color: var(--text-3); opacity: 0; font-size: 15px; line-height: 1; }
.np-quote:hover .np-x { opacity: 1; }
.np-x:hover { color: var(--text); background: var(--hover); }
.np-text { min-height: 0; }
.np-text .md { cursor: text; }
.np-text textarea {
  display: block; width: 100%; padding: 0; border: 0; outline: none; resize: none; overflow: hidden;
  background: transparent; color: var(--ink); font: inherit; line-height: inherit;
}
.np-text textarea::placeholder { color: var(--text-3); opacity: 1; }
.np-text .respond { color: var(--text-3); font-size: 13.5px; opacity: 0; margin-top: -8px; transition: opacity .12s; }
.np-quote:hover + .np-text .respond, .np-text:hover .respond, .respond:focus { opacity: 1; }
.np-foot { margin-top: 40px; padding-top: 14px; border-top: 1px solid var(--line); font-size: 13px; color: var(--text-3); }
.np-foot a { color: var(--ink); }
/* a note of your own: the whole reading pane */
.note-pane.own { display: flex; height: 100%; border: 0; background: var(--paper); }
.note-pane.own .np-body { width: 100%; max-width: calc(var(--measure) + 96px); margin: 0 auto; padding: 44px 48px 30vh; }
.note-pane.own .np-doc { font-size: 16.5px; }

.md > :first-child { margin-top: 0; } .md > :last-child { margin-bottom: 0; }
.md p, .md ul, .md ol, .md blockquote, .md pre { margin: 0 0 .55em; }
.md ul, .md ol { padding-left: 1.25em; }
.md blockquote { margin-left: 0; padding-left: 10px; border-left: 2px solid var(--ink-rule); }
.md code { font-family: var(--mono); font-size: .88em; }
.md pre { background: var(--ink-wash); padding: 8px 10px; border-radius: 5px; overflow-x: auto; }
.md a { color: inherit; text-underline-offset: 2px; }
.md h3, .md h4, .md h5, .md h6 { font-size: 1em; margin: .5em 0 .25em; }
.md .tag { font-weight: 550; text-decoration: none; }
.md .tag:hover { text-decoration: underline; text-underline-offset: 2px; }
/* a link from your writing to another article in your library */
a.entry-link { color: var(--ink); text-decoration: underline dotted; text-underline-offset: 3px; text-decoration-thickness: 1.5px; }
a.entry-link:hover { text-decoration-style: solid; }
.md mark { background: var(--hl); color: inherit; }

/* the end of an article: where you were thinking about it elsewhere, and a way into your note */
.art-end { margin-top: 64px; padding-top: 22px; border-top: 1px solid var(--line); font: 15px/1.55 var(--ui); }
.art-end .mentioned { color: var(--text-3); font-size: 13.5px; margin: 0 0 14px; }
.art-end .mentioned a { color: var(--ink); }
.compose { display: block; text-align: left; color: var(--text-3); font: italic 17px/1.5 var(--serif); transition: color .12s; }
.compose:hover { color: var(--ink); }
body.writing .art-end .compose { display: none; }
.art-actions .write { color: var(--ink); }
.art-actions .write.on { color: var(--text-3); }

/* labels on an article, and the menu to change them */
.art-labels { display: inline-flex; gap: 5px; margin-left: 10px; vertical-align: 1px; }
.art-labels:empty { display: none; }
.label-chip { padding: 0 8px; border-radius: 99px; background: var(--hover); color: var(--text-2) !important; font-size: 11.5px; line-height: 19px; }
.label-chip:hover { background: var(--active); }
.popover-light {
  position: fixed; z-index: 60; min-width: 220px; padding: 4px;
  background: var(--paper); border: 1px solid var(--line); border-radius: 9px; box-shadow: var(--shadow); font: 13.5px/1.35 var(--ui);
}
.label-menu button { display: flex; align-items: center; gap: 8px; width: 100%; padding: 7px 10px; border-radius: 6px; text-align: left; }
.label-menu button:hover { background: var(--hover); }
.label-menu .check { width: 12px; color: var(--ink); }
.label-menu .name { flex: 1; }
.label-menu kbd { font-size: 10.5px; }
.label-menu form { padding: 4px; border-top: 1px solid var(--line); margin-top: 4px; }
.label-menu input { width: 100%; height: 30px; padding: 0 8px; border: 0; outline: none; background: none; }

/* the [[ picker */
.linker {
  position: fixed; z-index: 60; max-height: 280px; overflow-y: auto; padding: 4px;
  background: var(--paper); border: 1px solid var(--line); border-radius: 9px; box-shadow: var(--shadow); font: 13.5px/1.35 var(--ui);
}
.linker .option { display: grid; padding: 7px 10px; border-radius: 6px; cursor: pointer; }
.linker .option.active, .linker .option:hover { background: var(--hover); }
.linker .option .t { color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.linker .option .s { color: var(--text-3); font-size: 12px; }
.linker .none { padding: 8px 10px; color: var(--text-3); }

/* popovers */
.popover {
  position: fixed; z-index: 50; display: flex; padding: 3px;
  background: var(--text); color: var(--paper); border-radius: 8px; box-shadow: var(--shadow);
  font: 13px/1 var(--ui);
}
.popover button { padding: 7px 10px; border-radius: 5px; }
.popover button:hover { background: rgb(128 128 128 / .25); }

/* ---- notebook ----------------------------------------------------------- */

.notebook-page { max-width: calc(var(--measure) + 96px); margin: 0 auto; padding: 44px 48px 30vh; }
.nb-head { display: flex; align-items: center; gap: 16px; margin-bottom: 36px; }
.nb-head h1 { font: 600 32px/1.2 var(--serif); margin: 0; flex: 1; letter-spacing: -.016em; }
.nb-head .search { margin: 0; width: 200px; }
.nb-head a { font-size: 13px; color: var(--text-3); text-decoration: none; white-space: nowrap; }
.nb-head a:hover { color: var(--text); }
.nb-tags { display: flex; flex-wrap: wrap; gap: 6px 14px; margin: -18px 0 34px; font-size: 13px; }
.nb-tags .tag { color: var(--ink); text-decoration: none; }
.nb-tags .tag span { color: var(--text-3); margin-left: 3px; font-size: 11.5px; }
.nb-tags .tag:hover, .nb-tags .tag.on { text-decoration: underline; text-underline-offset: 3px; }
.nb-tags .clear { color: var(--text-3); font-size: 12.5px; }
.nb-tags .clear:hover { color: var(--text); }
.nb-list { list-style: none; margin: 0; padding: 0; }
.nb-note { display: grid; gap: 3px; padding: 16px 0 18px; border-bottom: 1px solid var(--line); text-decoration: none; }
.nb-note:hover .nb-title { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 4px; }
.nb-meta { font-size: 12.5px; color: var(--text-3); display: flex; gap: 6px; }
.nb-title { font: 600 19.5px/1.3 var(--serif); letter-spacing: -.005em; color: var(--text); }
.nb-excerpt { font-size: 14.5px; line-height: 1.5; color: var(--ink); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.nb-head .btn { height: 30px; }
.nb-empty { color: var(--text-3); line-height: 1.7; max-width: 30rem; padding: 12px 0; }

/* ---- suggestions -------------------------------------------------------- */

.sg-kind + .sg-kind { margin-top: 40px; }
.sg-kind h2 { font-size: 13px; font-weight: 500; color: var(--text-3); margin: 0 0 2px; }
.sg { display: grid; gap: 4px; padding: 18px 0 20px; border-bottom: 1px solid var(--line); }
.sg .nb-title { text-decoration: none; justify-self: start; }
.sg .nb-title:hover { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 4px; }
.sg-reason { margin: 2px 0 0; font-size: 15px; line-height: 1.55; color: var(--text-2); max-width: 36rem; }
.sg-example { margin: 0; font-size: 13.5px; color: var(--text-3); }
.sg-example a { color: var(--text-2); }
.sg-acts { display: flex; gap: 6px; margin-top: 10px; }
.sg-acts .btn { height: 28px; font-size: 12.5px; }
.sg-empty { color: var(--text-3); line-height: 1.7; max-width: 34rem; }
.sg-empty p { margin: 0 0 14px; }
.sg-empty a { color: var(--text-2); }
.sg-empty .hint { font-size: 13px; }
.sg-empty code { font-size: 12.5px; background: var(--hover); padding: 1px 5px; border-radius: 4px; }
.more-btn { display: block; margin: 0 auto; padding: 6px 14px; color: var(--text-3); }
.more-btn:hover { color: var(--text); }

/* ---- first run --------------------------------------------------------------- */

.welcome h1 { font: 600 36px/1.2 var(--serif); color: var(--text); margin: 0 0 8px; letter-spacing: -.012em; }
.welcome .lede { font: 18px/1.5 var(--serif); color: var(--text-2); margin: 0 0 26px; }
.welcome-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }

/* ---- dialogs & toasts --------------------------------------------------- */

.modal-back { position: fixed; inset: 0; z-index: 100; display: grid; place-items: start center; padding: 14vh 16px 0; background: rgb(20 15 10 / .25); }
.modal { width: min(460px, 100%); background: var(--paper); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); padding: 22px; }
.modal h3 { margin: 0 0 16px; font-size: 15px; font-weight: 600; }
.modal label { display: block; font-size: 12.5px; color: var(--text-2); margin: 12px 0 5px; }
.modal label .opt { color: var(--text-3); }
.modal input[type=text] { width: 100%; height: 34px; padding: 0 10px; border: 1px solid var(--line); border-radius: 7px; background: var(--bg); outline: none; }
.modal input[type=text]:focus, .modal input[type=password]:focus { border-color: var(--text-3); background: var(--paper); }
.modal .sub { font-size: 12.5px; color: var(--text-3); margin: 10px 0 0; line-height: 1.5; word-break: break-all; }
.modal .sub.err, .modal .sub.warn { color: var(--accent); }
.modal .actions { display: flex; align-items: center; gap: 8px; margin-top: 22px; }
.modal .actions .left { margin-right: auto; display: flex; gap: 14px; }
.modal .actions .left button, .modal .actions .left a, .modal .actions .left label { margin: 0; font-size: 12.5px; color: var(--text-3); text-decoration: none; cursor: pointer; }
.modal .actions .left :is(button, a, label):hover { color: var(--text); }
.modal dl { display: grid; grid-template-columns: max-content 1fr; gap: 8px 16px; margin: 0; font-size: 13px; }
.modal dt { text-align: right; white-space: nowrap; }
.modal dd { margin: 0; color: var(--text-2); }
.btn { height: 32px; padding: 0 14px; border-radius: 7px; font-size: 13px; color: var(--text-2); }
.btn:hover { background: var(--hover); color: var(--text); }
.btn.primary { background: var(--text); color: var(--paper); }
.btn.primary:hover { opacity: .88; }
.btn.danger:hover { color: var(--accent); }
.btn:disabled { opacity: .55; cursor: default; }
.btn.outline { border: 1px solid var(--line); }
.btn.outline:disabled { opacity: 1; border-color: transparent; color: var(--text-3); }

/* subscribe: search and results */
.find-row { display: flex; gap: 8px; }
.find-row input { flex: 1; min-width: 0; }
.results { list-style: none; margin: 14px -22px 0; padding: 0; max-height: min(52vh, 440px); overflow-y: auto; border-top: 1px solid var(--line); }
.results:empty { display: none; }
.result { display: flex; gap: 14px; align-items: flex-start; padding: 12px 22px; border-bottom: 1px solid var(--line); }
.result .what { flex: 1; min-width: 0; }
.result .name { font-weight: 600; font-size: 14px; }
.result .meta { font-size: 12px; color: var(--text-3); margin-top: 1px; }
.result .desc { font-size: 13px; color: var(--text-2); margin-top: 4px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.result .btn { flex: none; }
.results .none { padding: 14px 22px; color: var(--text-3); font-size: 13px; }
.modal .folder-label { margin-top: 14px; }

/* import */
.import-from { padding: 2px 0 18px; }
.import-from + .import-from { border-top: 1px solid var(--line); padding-top: 16px; }
.import-from h4 { margin: 0 0 4px; font-size: 13.5px; font-weight: 600; }
.import-from .sub { margin: 0 0 12px; word-break: normal; }
.import-from form { display: grid; gap: 8px; }
.import-from form .btn { justify-self: start; }
.modal label.file-btn { display: inline-flex; align-items: center; margin: 0; border: 1px solid var(--line); cursor: pointer; color: var(--text-2); font-size: 13px; }
.modal .sub.done { color: var(--ink); word-break: normal; }
.feed-links { display: flex; gap: 16px; word-break: normal; }
.feed-links button, .feed-links a { color: var(--text-3); text-decoration: none; font-size: 12.5px; }
.feed-links button:hover, .feed-links a:hover { color: var(--text); }
.modal input[type=password] { width: 100%; height: 34px; padding: 0 10px; border: 1px solid var(--line); border-radius: 7px; background: var(--bg); outline: none; }

.toasts { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); display: grid; gap: 6px; z-index: 200; pointer-events: none; }
.toast { background: var(--text); color: var(--paper); padding: 8px 14px; border-radius: 8px; font-size: 13px; box-shadow: var(--shadow); animation: rise .18s ease; }
@keyframes rise { from { transform: translateY(6px); opacity: 0; } }

/* ---- installed app: keep clear of notches and home indicators ------------- */

.sidebar { padding-top: max(16px, env(safe-area-inset-top)); padding-bottom: max(10px, env(safe-area-inset-bottom)); padding-left: max(10px, env(safe-area-inset-left)); }
.list-head { padding-top: max(14px, env(safe-area-inset-top)); }
.entries { padding-bottom: max(48px, env(safe-area-inset-bottom)); }
.toasts { bottom: max(20px, env(safe-area-inset-bottom)); }

/* ---- small screens: one pane at a time ------------------------------------ */

.mobile-only { display: none !important; }

@media (max-width: 1080px) { :root { --side-w: 200px; --list-w: 300px; } }

@media (max-width: 820px) {
  .layout, body.page .layout { display: block; }
  .sidebar, .list, .reader { height: 100vh; height: 100dvh; }
  body:not([data-pane=sidebar]) .sidebar,
  body:not([data-pane=list]) .list,
  body:not([data-pane=reader]) .reader { display: none; }
  .mobile-only { display: inline-grid !important; }
  .article, .notebook-page { padding: max(16px, env(safe-area-inset-top)) max(22px, env(safe-area-inset-right)) 40vh max(22px, env(safe-area-inset-left)); }
  .article { padding-top: 0; }
  /* the actions stay at hand while you read; back first, the rest slide sideways if they don't fit */
  .art-actions {
    position: sticky; top: 0; z-index: 5; justify-content: flex-start; gap: 18px;
    height: auto; margin: 0 -22px 24px; padding: max(10px, env(safe-area-inset-top)) 22px 10px;
    background: var(--paper); box-shadow: 0 1px 0 var(--line);
    overflow-x: auto; scrollbar-width: none; font-size: 14px;
  }
  .art-actions::-webkit-scrollbar { display: none; }
  .art-actions > * { padding: 4px 0; }
  .art-actions .back { flex: none; max-width: 40vw; overflow: hidden; text-overflow: ellipsis; }
  /* 16px keeps iOS from zooming the page when a field is focused */
  input, textarea, .search input { font-size: 16px; }
  .sidebar, .entries, .article-scroll, .reader, .np-body { overscroll-behavior-y: contain; }
  .art-actions .back { color: var(--text-2); }
  .art-actions .original { display: none; } /* the title opens the original */
  .article h1, .nb-head h1 { font-size: 28px; }
  .art-body { font-size: 18px; }
  .read-split .np-title { display: block; }
  .art-labels { display: flex; margin: 6px 0 0; }
  .nb-head { flex-wrap: wrap; }
  /* writing on a phone: the article or the note, switched from the note's header */
  body.writing .layout { display: block; }
  body.writing .read-split { grid-template-columns: minmax(0, 1fr); }
  .read-split[data-show=note] .article-scroll, .read-split[data-show=article] .note-pane { display: none; }
  .note-pane { border-left: 0; }
  .np-head { height: auto; padding: max(10px, env(safe-area-inset-top)) 16px 10px 22px; }
  .np-body, .note-pane.own .np-body { padding: 16px 22px 40vh; }
  .np-x { right: -6px; opacity: 1; }
  .np-switch { display: inline-flex !important; background: var(--hover); border-radius: 7px; padding: 2px; }
  .np-switch button { padding: 4px 10px; border-radius: 5px; }
  .np-switch button.on { background: var(--paper); color: var(--text); }
  .nb-head .search { order: 3; width: 100%; }
  .row { padding: 8px; }
}
