/* ============================================================
   nicolos-notes — Ghost theme stylesheet
   Ported from the nicolo.xyz Bear design system (28 blocks),
   adapted for Ghost markup: native members form, active nav
   state, reading time, read-next, real tag pages, koenig cards.
   ============================================================ */

/* ---------- PART 1 · Existing theme (unchanged) ---------- */

:root {
    --width: 720px;
    --font-main: Verdana, sans-serif;
    --font-secondary: Verdana, sans-serif;
    --font-scale: 1em;
    --background-color: #fff;
    --heading-color: #222;
    --text-color: #444;
    --link-color: #3273dc;
    --visited-color:  #8b6fcb;
    --code-background-color: #f2f2f2;
    --code-color: #222;
    --blockquote-color: #222;
}
@media (prefers-color-scheme: dark) {
    :root {
        --background-color: #000a24;
        --heading-color: #eee;
        --text-color: #ddd;
        --link-color: #5e9fd1;
        --visited-color:  #8b6fcb;
        --code-background-color: #000;
        --code-color: #ddd;
        --blockquote-color: #ccc;
    }
}
body {
    font-family: var(--gh-font-body, var(--font-secondary));
    font-size: var(--font-scale);
    margin: auto;
    padding: 20px;
    max-width: var(--width);
    text-align: left;
    background-color: var(--background-color);
    word-wrap: break-word;
    overflow-wrap: break-word;
    line-height: 1.5;
    color: var(--text-color);
}
h1, h2, h3, h4, h5, h6 {
    font-family: var(--gh-font-heading, var(--font-main));
    color: var(--heading-color);
}
a {
    color: var(--link-color);
    cursor: pointer;
    text-decoration: none;
}
a:hover {
    text-decoration: underline;
}
nav a {
    margin-right: 8px;
}
strong, b {
    color: var(--heading-color);
}
button {
    margin: 0;
    cursor: pointer;
}
time {
 	font-family: monospace;
  	font-style: normal;
  	font-size: 15px;
}
main {
    line-height: 1.6;
}
table {
    width: 100%;
}
hr {
    border: 0;
    border-top: 1px dashed;
}
img {
    max-width: 100%;
}
code {
    font-family: monospace;
    padding: 2px;
    background-color: var(--code-background-color);
    color: var(--code-color);
    border-radius: 3px;
}
blockquote {
    border-left: 1px solid #999;
    color: var(--code-color);
    padding-left: 20px;
    font-style: italic;
}
footer {
    padding: 25px 0;
    text-align: center;
}
.title:hover {
    text-decoration: none;
}
.title h1 {
    font-size: 1.5em;
}
.inline {
    width: auto !important;
}
.highlight, .code {
    padding: 1px 15px;
    background-color: var(--code-background-color);
    color: var(--code-color);
    border-radius: 3px;
    margin-block-start: 1em;
    margin-block-end: 1em;
    overflow-x: auto;
}
/* blog post list */
ul.blog-posts {
    list-style-type: none;
    padding: unset;
}
ul.blog-posts li {
    display: flex;
}
ul.blog-posts li span {
    flex: 0 0 130px;
}
ul.blog-posts li main a:visited {
    color: var(--link-color);
}

main a:visited {
    color: var(--link-color);
}
/* removes powered by Bear */
footer span:last-child {
    display: none;
}
/* custom: hide upvote form */
form#upvote-form {
  display: none !important;
}

/* ---------- PART 2 · Additions (order matters: these
   deliberately override a few rules above, e.g. time size,
   nav spacing, image width) ---------- */

/* Accent colours used by link hovers, badges, selection and
   nav states. Derived from the site's link blue. */
:root {
  --accent-wash: #e4edfb;   /* light blue marker highlight (from your #3273dc) */
  --accent-ink: #2456a8;    /* darker blue for hovered/marked text */
  --meta-color: #8a8a8a;    /* grey for dates, numbers, labels */
}
@media (prefers-color-scheme: dark) {
  :root {
    --accent-wash: #16304d;  /* sits on your navy #000a24 */
    --accent-ink: #9cc4ee;
    --meta-color: #7b8293;   /* bluish grey to match the navy */
  }
}

/* ============================================================
   1 · LINK HOVER HIGHLIGHT
   Hovering a content link paints a soft wash behind it, like a
   text marker, replacing the hover underline.
   ============================================================ */

main a:hover {
  text-decoration: none;
  background: var(--accent-wash);
  color: var(--accent-ink);
  border-radius: 2px;
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
}

/* ============================================================
   2 · NUMBERED SECTION HEADINGS (01, 02, 03 …)
   Auto-numbers h2s inside a post in small grey mono, via CSS
   counters. Only appears on posts that use ## subheadings.
   ============================================================ */

main {
  counter-reset: section fnref;
}

main h2 {
  counter-increment: section;
}

main h2::before {
  content: counter(section, decimal-leading-zero);
  font-family: monospace;
  font-weight: normal;
  font-size: 0.72em;
  color: var(--meta-color);
  margin-right: 0.6em;
}

/* ============================================================
   3 · META TEXT
   Dates in small caps, grey and letter-spaced, in the post list
   and under post titles.
   ============================================================ */

time,
ul.blog-posts li span {
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: 13px;
  color: var(--meta-color);
}

/* The smaller date font would otherwise sit high next to the
   post titles — align the two columns by text baseline. */
ul.blog-posts li {
  align-items: baseline;
}

/* ============================================================
   4 · "NEW" BADGE ON THE LATEST POST
   Small rounded pill after the newest post title. Automatic —
   Bear lists posts newest first.
   ============================================================ */

ul.blog-posts li.latest a::after {
  content: "new";
  font-family: monospace;
  font-size: 0.62em;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: var(--accent-wash);
  color: var(--accent-ink);
  padding: 2px 8px;
  border-radius: 999px;
  margin-left: 0.6em;
  vertical-align: 2px;
  white-space: nowrap;
}

/* ============================================================
   5 · TERMINAL-STYLE NAV
   Nav links in mono with a "> " prompt prefix, greyed out until
   hovered.
   ============================================================ */

nav ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-wrap: wrap;
}

nav a {
  font-family: monospace;
  font-size: 1.1em;            /* mono renders small; this matches body optically */
  margin-right: 1.1em;
  color: var(--meta-color);    /* greyed out until hovered */
  text-decoration: none;
}

/* Ghost knows the current page — keep it lit */
nav .nav-current a {
  color: var(--accent-ink);
}

nav a::before {
  content: "> ";
}

nav a:hover {
  color: var(--accent-ink);
  background: var(--accent-wash);
  border-radius: 2px;
  text-decoration: none;
}

/* Note: Bear doesn't mark the current page in the nav HTML,
   so "lit when selected" means on hover — CSS alone can't
   detect which page you're on. */

/* Group the nav with the title: pull it up towards
   "Nicolo's Notes" and push the content below further away. */
.title h1 {
  margin-bottom: 0.35em;
}

.site-head nav {
  margin-bottom: 1.6em;
}

/* ============================================================
   6 · INSET IMAGES
   Images sit centred at 90% of the text column (5% breathing
   room each side) instead of full width. On small screens they
   go back to full width so they stay legible.
   ============================================================ */

main img {
  display: block;
  max-width: 90%;
  margin: 1.6em auto;
}

@media (max-width: 600px) {
  main img {
    max-width: 100%;
  }
}

/* ============================================================
   7 · QUIET EXTRAS                                  [subtle]
   Barely visible, collectively make the site feel finished:
   blue-tinted text selection, softly rounded images.
   ============================================================ */

::selection {
  background: var(--accent-wash);
}

main img {
  border-radius: 6px;
}

/* ============================================================
   8 · QUIETER FOOTNOTES
   Footnotes drop to a smaller size and a softer grey so they
   read as apparatus, not body text. Deliberately not italic:
   at small sizes italics are harder to scan, and blockquotes
   already own italics on this blog. Add font-style: italic to
   the first rule if you want to try it anyway.
   ============================================================ */

.footnotes,
.footnote {
  font-size: 0.85em;
  color: #6e6e6e;
  line-height: 1.55;
}

@media (prefers-color-scheme: dark) {
  .footnotes,
  .footnote {
    color: #9aa3b2;
  }
}

/* ============================================================
   9 · DARK-MODE SKETCH INVERSION
   Black-line sketches on transparent backgrounds vanish on the
   navy dark background. This inverts them in dark mode only:
   black lines become near-white, transparency stays transparent.

   Convention: mark a sketch by putting the word "sketch" in the
   image's alt text (or its filename), e.g.
     ![Sketch: the professional plus the tools](image.png)
   Photos and screenshots without the marker are left alone.
   invert(0.94) rather than invert(1) so lines come out as soft
   off-white instead of glaring pure white.
   ============================================================ */

@media (prefers-color-scheme: dark) {
  main img[alt*="sketch" i],
  main img[src*="sketch" i] {
    filter: invert(0.94);
  }
}

/* ============================================================
   10 · EMAIL SUBSCRIBE FORM (native Ghost members)
   Bordered rounded card that hugs its contents, centred.
   Ghost adds .loading / .success / .error to the form.
   ============================================================ */

.subscribe-card {
  width: fit-content;
  margin: 0.25em auto 1em;
  text-align: left;
  border: 1px solid rgba(128, 128, 128, 0.35);
  border-radius: 10px;
  padding: 1.4em 1.5em;
  transition: border-color 0.3s ease;
}

.subscribe-card:focus-within {
  border-color: var(--accent-ink);
}

.subscribe-card label {
  display: block;
  margin-bottom: 0.9em;
  font-family: monospace;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--meta-color);
}

.subscribe-card .sub-row {
  display: inline-flex;
  gap: 0.5em;
  max-width: 100%;
}

.subscribe-card input[type="email"] {
  width: 19em;
  min-width: 0;
  margin: 0;
  padding: 0.5em 0.75em;
  font: inherit;
  font-size: 0.9em;
  border: 1px solid rgba(128, 128, 128, 0.45);
  border-radius: 4px;
  background: transparent;
  color: var(--text-color);
}

.subscribe-card input[type="email"]::placeholder {
  color: var(--meta-color);
  opacity: 0.8;
}

.subscribe-card input[type="email"]:focus {
  outline: none;
  border-color: var(--accent-ink);
}

.subscribe-card button {
  margin: 0;
  padding: 0.5em 1.1em;
  font-family: monospace;
  font-size: 0.85em;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border: none;
  border-radius: 4px;
  background: var(--accent-wash);
  color: var(--accent-ink);
  cursor: pointer;
}

.subscribe-card button:hover {
  background: var(--accent-ink);
  color: var(--background-color);
}

.subscribe-card.loading button {
  opacity: 0.6;
  pointer-events: none;
}

.subscribe-card .sub-rss {
  margin: 0.9em 0 0;
  font-size: 0.8em;
  color: var(--meta-color);
}

.subscribe-card .sub-rss a {
  color: inherit;
  text-decoration: underline;
  border-radius: 2px;
}

.subscribe-card .sub-rss a:hover {
  background: var(--accent-wash);
  color: var(--accent-ink);
  text-decoration: none;
}

/* success / error states */
.subscribe-card .form-msg {
  display: none;
  margin: 0.9em 0 0;
  font-size: 0.85em;
}

.subscribe-card.success label,
.subscribe-card.success .sub-row,
.subscribe-card.success .sub-rss {
  display: none;
}

.subscribe-card.success .form-msg-success {
  display: block;
  margin: 0;
  font-size: 0.9em;
  color: var(--text-color);
}

.subscribe-card.success .form-msg-success::before {
  content: "\2713  ";
  color: var(--accent-ink);
}

.subscribe-card.error .form-msg-error {
  display: block;
  color: #b4432a;
}

@media (max-width: 600px) {
  .subscribe-card {
    width: auto;
  }
  .subscribe-card .sub-row {
    display: flex;
    width: 100%;
  }
  .subscribe-card input[type="email"] {
    flex: 1;
    width: auto;
  }
}

/* ============================================================
   11 · TYPE SCALE
   Site title and post titles share the same size (1.5em);
   section headings step down from there.
   ============================================================ */

.title h1 {
  font-size: 1.5em;
}

main h1 {
  font-size: 1.5em;
  line-height: 1.3;
}

main h2 {
  font-size: 1.25em;
}

main h3 {
  font-size: 1.1em;
}

/* ============================================================
   12 · FLUSH FOOTNOTES
   Removes the browser's default list indent so footnote
   numbers align with the text edge.
   ============================================================ */

.footnotes ol,
.footnote ol {
  padding-left: 1.2em;
  margin-left: 0;
}

/* ============================================================
   13 · BLOCKQUOTE ACCENT TINT
   Blockquote's left border in the accent wash instead of grey.
   ============================================================ */

blockquote {
  border-left: 3px solid var(--accent-wash);
  padding-left: 1.1em;
}

/* ============================================================
   14 · TABLES
   Mono small-caps headers, quiet row rules.
   ============================================================ */

table {
  border-collapse: collapse;
  font-size: 0.95em;
}

th {
  font-family: monospace;
  font-weight: normal;
  font-size: 0.8em;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--meta-color);
  text-align: left;
  padding: 0.5em 0.75em;
  border-bottom: 1px solid rgba(128, 128, 128, 0.45);
}

td {
  padding: 0.5em 0.75em;
  border-bottom: 1px solid rgba(128, 128, 128, 0.18);
}

/* ============================================================
   15 · TAG PILLS
   Post tags and tag-page headers as small rounded mono pills.
   ============================================================ */

.post-tags a,
.tag-pill {
  font-family: monospace;
  font-size: 0.72em;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: var(--code-background-color);
  color: var(--meta-color);
  padding: 3px 10px;
  border-radius: 999px;
  margin-right: 0.5em;
  text-decoration: none;
}

.post-tags a:hover {
  background: var(--accent-wash);
  color: var(--accent-ink);
}

.post-tags {
  margin-top: 2.5em;
}

.tag-head {
  margin-bottom: 2em;
}

.tag-head .tag-pill {
  font-size: 0.8em;
}

.tag-desc {
  font-size: 0.9em;
  color: var(--meta-color);
  margin-left: 0.4em;
}

/* ============================================================
   16 · SIDENOTES
   Margin notes for asides. In a post's markdown write:
     <span class="sidenote">Aside text here.</span>
   right after the paragraph it belongs to. Floats into the
   right margin on wide screens; folds into the column as a
   bordered aside on smaller ones.
   ============================================================ */

.sidenote {
  display: block;
  font-size: 0.8em;
  line-height: 1.5;
  color: var(--meta-color);
  margin: 1em 0;
  padding-left: 1.1em;
  border-left: 2px solid rgba(128, 128, 128, 0.3);
}

@media (min-width: 1260px) {
  .sidenote {
    float: right;
    clear: right;
    width: 220px;
    margin: 0 -260px 1em 0;
    padding-left: 0.9em;
  }
}

/* ============================================================
   17 · POST-LIST ROW HOVER
   The whole row gets the accent wash on hover.
   ============================================================ */

ul.blog-posts li {
  padding: 2px 8px;
  margin: 0 -8px;
  border-radius: 4px;
}

ul.blog-posts li:hover {
  background: var(--accent-wash);
}

/* ============================================================
   18 · SMOOTH FOOTNOTE JUMPS
   Anchor jumps (footnote refs and back-arrows) glide instead
   of teleporting.
   ============================================================ */

html {
  scroll-behavior: smooth;
}

/* ============================================================
   19 · IMAGE CAPTIONS
   In markdown, put an italic-only line directly under an image:
     ![Sketch: the old model](image.png)
     *The old model: professional plus tools.*
   That line renders as a small grey centred caption.
   ============================================================ */

main figcaption,
main p:has(> img) + p:has(> em:only-child) {
  text-align: center;
  font-size: 0.8em;
  color: var(--meta-color);
  margin-top: 0.4em;
}

main p:has(> img) + p:has(> em:only-child) em {
  font-style: normal;
}

/* ============================================================
   20 · END-OF-POST MARK
   The footnote divider becomes three quiet dots.
   ============================================================ */

.footnotes hr,
.footnote hr {
  border: none;
  height: auto;
}

.footnotes hr::after,
.footnote hr::after {
  content: "\00B7\2002\00B7\2002\00B7";
  display: block;
  text-align: center;
  color: var(--meta-color);
  font-family: monospace;
  letter-spacing: 0.1em;
  margin: 1.5em 0;
}

/* ============================================================
   21 · TEXT-STYLE RETURN ARROWS
   Footnote back-arrows render as text, not emoji, on phones
   (U+FE0E variation selector).
   ============================================================ */

.footnotes a[href^="#fnref"],
.footnote a[href^="#fnref"],
a.footnote-backref {
  font-size: 0;
  text-decoration: none;
}

.footnotes a[href^="#fnref"]::after,
.footnote a[href^="#fnref"]::after,
a.footnote-backref::after {
  content: "\21A9\FE0E";
  font-size: 0.9rem;
}

/* ============================================================
   22 · FADING CURSOR ON THE SITE TITLE
   A slim full-height bar after the wordmark: breathes twice
   (~3s) on page load, then fades out and stays gone.
   ============================================================ */

.title h1::after {
  content: "";
  display: inline-block;
  width: 3px;
  height: 1.02em;
  margin-left: 0.13em;
  background: var(--link-color);
  vertical-align: -0.12em;
  /* breathes twice (~3s), then fades out and stays gone */
  animation:
    cursor-breathe 1.5s ease-in-out 2,
    cursor-fade 0.8s ease-out 2.9s forwards;
}

@keyframes cursor-breathe {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.15; }
}

@keyframes cursor-fade {
  to { opacity: 0; }
}

/* ============================================================
   23 · STAGGERED LIST ENTRANCE
   Post-list rows fade up one after another on page load, then
   never move again.
   ============================================================ */

ul.blog-posts li {
  animation: rise-in 0.5s ease-out both;
}

ul.blog-posts li:nth-child(1) { animation-delay: 0.05s; }
ul.blog-posts li:nth-child(2) { animation-delay: 0.13s; }
ul.blog-posts li:nth-child(3) { animation-delay: 0.21s; }
ul.blog-posts li:nth-child(4) { animation-delay: 0.29s; }
ul.blog-posts li:nth-child(5) { animation-delay: 0.37s; }
ul.blog-posts li:nth-child(6) { animation-delay: 0.45s; }
ul.blog-posts li:nth-child(7) { animation-delay: 0.53s; }
ul.blog-posts li:nth-child(n+8) { animation-delay: 0.6s; }

@keyframes rise-in {
  from { opacity: 0; transform: translateY(7px); }
  to   { opacity: 1; transform: none; }
}

/* ============================================================
   24 · FOOTNOTE FLASH
   Clicking a footnote number highlights the note you land on:
   waits for the smooth scroll, holds the wash ~1s, fades.
   Covers both footnote markup variants.
   ============================================================ */

.footnotes li:target,
.footnote li:target,
sup:target {
  animation: fn-flash 2.8s ease-out 0.6s backwards;
  border-radius: 3px;
}

@keyframes fn-flash {
  0%, 35% { background: var(--accent-wash); }
  100%    { background: transparent; }
}

/* ============================================================
   25 · READING PROGRESS LINE
   Thin accent line along the top that fills as you scroll.
   Scroll-driven animation: Chrome/Edge today; simply absent
   in browsers without support, nothing breaks.
   ============================================================ */

/* Desktop only: on iOS Safari the translucent status bar lets
   scrolled text ghost above a top-fixed line, so phones skip it. */
@media (min-width: 700px) {
  body::before {
    content: "";
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: var(--link-color);
    transform-origin: 0 50%;
    transform: scaleX(0);
    animation: grow-progress auto linear;
    animation-timeline: scroll();
    z-index: 50;
  }
}

@keyframes grow-progress {
  from { transform: scaleX(0); }
  to   { transform: scaleX(1); }
}

/* ============================================================
   26 · SUBSCRIBE CARD FOCUS GLOW
   The card border tints accent blue while the email field has
   focus, then returns to grey.
   ============================================================ */

.embeddable-buttondown-form {
  transition: border-color 0.3s ease;
}

.embeddable-buttondown-form:focus-within {
  border-color: var(--accent-ink);
}

/* ============================================================
   27 · "\2191 TOP" LINK
   Quiet mono link that glides back to the top (smooth scroll
   is already on). Add this line at the end of long posts:
     <p class="top-link"><a href="#">&uarr; top</a></p>
   ============================================================ */

.top-link {
  text-align: right;
  margin: 2em 0 0;
}

.top-link a {
  font-family: monospace;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--meta-color);
  text-decoration: none;
}

.top-link a:hover {
  color: var(--accent-ink);
  background: var(--accent-wash);
  border-radius: 2px;
}

/* ============================================================
   Motion is disabled for visitors whose OS asks for it.
   ============================================================ */

@media (prefers-reduced-motion: reduce) {
  .title h1::after,
  ul.blog-posts li,
  .footnotes li:target,
  .footnote li:target,
  sup:target,
  body::before {
    animation: none;
  }
  html {
    scroll-behavior: auto;
  }
}

/* ============================================================
   28 · LETTERBIRD CONTACT FORM
   The embed is an iframe, so only its outer frame is styleable:
   shadow off, same thin border and corners as the site's cards.
   !important beats Letterbird's runtime-injected stylesheet.
   ============================================================ */

iframe.letterbird-embed {
  box-shadow: none !important;
  border: 1px solid rgba(128, 128, 128, 0.35);
  border-radius: 10px;
  display: block;
  margin: 1.5em auto;
}

/* ============================================================
   29 · GHOST EXTRAS
   Post meta line (date · reading time), read-next footer,
   pagination, koenig card widths, site footer line.
   ============================================================ */

.post-meta {
  font-family: monospace;
  font-style: normal;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--meta-color);
}

.post-meta .meta-sep {
  margin: 0 0.45em;
}

.read-next {
  margin-top: 2.5em;
  font-size: 0.95em;
}

.read-next-label {
  font-family: monospace;
  font-size: 0.72em;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--meta-color);
  margin-right: 0.8em;
}

.page-nav:not(:has(a)) {
  display: none;
}

.pagination,
.page-nav {
  font-family: monospace;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--meta-color);
  margin-top: 2em;
}

.pagination a,
.page-nav a {
  color: var(--meta-color);
  text-decoration: none;
}

.pagination a:hover,
.page-nav a:hover {
  color: var(--accent-ink);
  background: var(--accent-wash);
  border-radius: 2px;
}

.foot-line {
  display: block;
  text-align: center;
  font-size: 0.85em;
  color: var(--meta-color);
  margin-top: 2em;
}

/* koenig card widths: wide and full-bleed images */
.kg-width-wide {
  max-width: 85vw;
  width: 85vw;
  margin-left: calc(50% - 42.5vw);
}

.kg-width-full {
  max-width: 100vw;
  width: 100vw;
  margin-left: calc(50% - 50vw);
}

.kg-width-wide img,
.kg-width-full img {
  max-width: 100%;
}

/* index list heading + empty state */
.list-title {
  margin: 0 0 1em;
}

.blog-posts .list-empty {
  color: var(--text-color);
}

/* ============================================================
   31 · NATIVE SEARCH TRIGGER
   A "> search" prompt in the nav that opens Ghost's built-in
   search overlay (data-ghost-search).
   ============================================================ */

.site-head nav {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
}

.search-trigger {
  appearance: none;
  background: none;
  border: none;
  padding: 0;
  font-family: monospace;
  font-size: 1.1em;
  color: var(--meta-color);
  cursor: pointer;
}

.search-trigger::before {
  content: "> ";
}

.search-trigger:hover {
  color: var(--accent-ink);
  background: var(--accent-wash);
  border-radius: 2px;
}

/* ============================================================
   32 · THEME-STYLED SEARCH OVERLAY
   The theme's own search UI (Content API), replacing Ghost's
   default overlay when a key is configured. Same language as
   everything else: bordered card, mono labels, wash hovers.
   ============================================================ */

#nn-search-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  z-index: 100;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 12vh 20px 20px;
}

#nn-search-overlay[hidden] {
  display: none;
}

.nn-search-card {
  background: var(--background-color);
  color: var(--text-color);
  border: 1px solid rgba(128, 128, 128, 0.35);
  border-radius: 10px;
  padding: 1.4em 1.5em;
  width: 34em;
  max-width: 100%;
  max-height: 70vh;
  overflow-y: auto;
}

.nn-search-card label {
  display: block;
  margin-bottom: 0.9em;
  font-family: monospace;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--meta-color);
}

#nn-search-input {
  width: 100%;
  box-sizing: border-box;
  margin: 0 0 1em;
  padding: 0.5em 0.75em;
  font: inherit;
  font-size: 0.95em;
  border: 1px solid rgba(128, 128, 128, 0.45);
  border-radius: 4px;
  background: transparent;
  color: var(--text-color);
}

#nn-search-input:focus {
  outline: none;
  border-color: var(--accent-ink);
}

#nn-search-results {
  margin: 0;
}

#nn-search-results li {
  animation: none;
}

.nn-search-hint {
  margin: 1em 0 0;
  font-family: monospace;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--meta-color);
}

@media (prefers-color-scheme: dark) {
  #nn-search-overlay {
    background: rgba(0, 0, 0, 0.55);
  }
}

/* ============================================================
   33 · MEMBER STATE
   Signed-in members see a quiet confirmation line instead of
   the subscribe card; the account page gets a styled card.
   Deeper preference management happens in Ghost's Portal
   (accent-tinted, not theme-stylable).
   ============================================================ */

.member-line {
  text-align: center;
  font-family: monospace;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--meta-color);
  margin: 2em 0 0;
}

.member-tick {
  color: var(--accent-ink);
}

.member-line a {
  color: inherit;
  text-decoration: underline;
  border-radius: 2px;
}

.member-line a:hover {
  color: var(--accent-ink);
  background: var(--accent-wash);
  text-decoration: none;
}

.account-card .account-email {
  margin: 0 0 0.8em;
}

.account-card .account-links {
  margin: 0;
  font-family: monospace;
  font-size: 13px;
}

.account-card .account-links a {
  color: var(--meta-color);
  text-decoration: none;
  margin-right: 1.2em;
}

.account-card .account-links a::before {
  content: "> ";
}

.account-card .account-links a:hover {
  color: var(--accent-ink);
  background: var(--accent-wash);
  border-radius: 2px;
}

/* ============================================================
   34 · ANNOUNCEMENT BAR
   Ghost's native announcement bar (Settings > Announcement bar)
   restyled to the theme: wash background, ink text, mono type.
   !important beats the widget's injected styles.
   ============================================================ */

#announcement-bar-root .gh-announcement-bar,
#announcement-bar-root [class*="announcement-bar"] {
  background: var(--accent-wash) !important;
  color: var(--accent-ink) !important;
  border: none !important;
}

#announcement-bar-root .gh-announcement-bar-content,
#announcement-bar-root [class*="announcement-bar-content"] {
  font-family: monospace !important;
  font-size: 13px !important;
  letter-spacing: 0.02em !important;
}

#announcement-bar-root a {
  color: var(--accent-ink) !important;
  text-decoration: underline !important;
}

#announcement-bar-root button,
#announcement-bar-root svg {
  color: var(--accent-ink) !important;
  fill: var(--accent-ink) !important;
}

/* ============================================================
   30 · FAVOURITE NOTES SECTION
   Notes flagged as featured appear in a second list below the
   latest notes, headed "My favourite notes". The flag is used
   purely for placement — no badge, no label.
   ============================================================ */

.favourites-title {
  margin-top: 1.2em;
}

/* ============================================================
   35 · EDITOR CARDS IN HOUSE STYLE
   Ghost editor cards restyled to the theme: bookmarks, callouts,
   toggles, buttons, files. Thin borders, 10px corners, mono
   metadata, wash accents.
   ============================================================ */

/* Bookmark cards (pasted links) */
.kg-bookmark-card .kg-bookmark-container {
  border: 1px solid rgba(128, 128, 128, 0.35) !important;
  border-radius: 10px !important;
  box-shadow: none !important;
  color: var(--text-color) !important;
  text-decoration: none;
  transition: border-color 0.2s ease;
}

.kg-bookmark-card .kg-bookmark-container:hover {
  border-color: var(--accent-ink) !important;
  background: none;
  color: var(--text-color) !important;
}

.kg-bookmark-title {
  color: var(--heading-color) !important;
  font-size: 0.95em !important;
}

.kg-bookmark-description {
  color: var(--meta-color) !important;
  font-size: 0.82em !important;
}

.kg-bookmark-metadata {
  font-family: monospace;
  font-size: 0.72em !important;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--meta-color) !important;
}

.kg-bookmark-thumbnail img {
  border-radius: 0 9px 9px 0 !important;
  margin: 0 !important;
  max-width: 100% !important;
}

.kg-bookmark-icon {
  border-radius: 3px;
}

/* Callout cards */
.kg-callout-card {
  border-radius: 10px !important;
  font-size: 0.95em;
}

.kg-callout-card.kg-callout-card-accent {
  background: var(--accent-wash) !important;
  color: var(--accent-ink) !important;
}

.kg-callout-card.kg-callout-card-accent a {
  color: inherit;
}

.kg-callout-card.kg-callout-card-grey,
.kg-callout-card.kg-callout-card-white {
  background: var(--code-background-color) !important;
  color: var(--text-color) !important;
}

/* Toggle cards */
.kg-toggle-card {
  border: 1px solid rgba(128, 128, 128, 0.35) !important;
  border-radius: 10px !important;
  background: none !important;
  box-shadow: none !important;
  padding: 1.1em 1.4em !important;
  transition: border-color 0.2s ease;
}

.kg-toggle-card:hover {
  border-color: var(--accent-ink) !important;
}

.kg-toggle-heading-text {
  color: var(--heading-color) !important;
  font-size: 0.95em !important;
  font-weight: 600 !important;
}

.kg-toggle-content {
  color: var(--text-color) !important;
  font-size: 0.95em !important;
  border-top: 1px solid rgba(128, 128, 128, 0.18);
  padding-top: 0.9em !important;
  margin-top: 0.9em !important;
}

.kg-toggle-card-icon {
  color: var(--meta-color) !important;
  fill: var(--meta-color) !important;
}

.kg-toggle-card:hover .kg-toggle-card-icon {
  color: var(--accent-ink) !important;
  fill: var(--accent-ink) !important;
}

/* Button cards */
.kg-button-card .kg-btn {
  font-family: monospace !important;
  font-size: 0.85em !important;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-radius: 4px !important;
  background: var(--accent-wash) !important;
  color: var(--accent-ink) !important;
  transition: background 0.15s ease, color 0.15s ease;
}

.kg-button-card .kg-btn:hover {
  background: var(--accent-ink) !important;
  color: var(--background-color) !important;
}

/* File cards */
.kg-file-card .kg-file-card-container {
  border: 1px solid rgba(128, 128, 128, 0.35) !important;
  border-radius: 10px !important;
}

.kg-file-card-title {
  color: var(--heading-color) !important;
}

.kg-file-card-caption,
.kg-file-card-metadata {
  color: var(--meta-color) !important;
  font-size: 0.8em !important;
}

/* Alternate blockquote style from the editor */
blockquote.kg-blockquote-alt {
  border: none;
  font-size: 1.15em;
  font-style: italic;
  color: var(--blockquote-color);
  text-align: center;
  padding: 0 2em;
}

/* ============================================================
   36 · ERROR PAGE
   Big status code, plain message, one way home.
   ============================================================ */

.error-box {
  margin: 3em 0;
}

.error-status {
  font-size: 4.5em;
  margin: 0 0 0.1em;
  line-height: 1;
}

.error-message {
  color: var(--meta-color);
  margin: 0 0 1.6em;
}

/* ============================================================
   37 · ACCESSIBILITY TOUCHES
   Skip link (visible only when focused), keyboard focus
   outlines, and breathing room above anchor-jump targets.
   ============================================================ */

.skip-link {
  position: absolute;
  left: -999px;
  top: 8px;
  z-index: 200;
  font-family: monospace;
  font-size: 13px;
  background: var(--accent-wash);
  color: var(--accent-ink);
  padding: 6px 12px;
  border-radius: 4px;
  text-decoration: none;
}

.skip-link:focus {
  left: 8px;
}

a:focus-visible,
button:focus-visible,
input:focus-visible {
  outline: 2px solid var(--accent-ink);
  outline-offset: 3px;
  border-radius: 2px;
}

:target {
  scroll-margin-top: 4.5em;
}

@media (prefers-reduced-motion: reduce) {
  .error-cursor {
    animation: none;
  }
}

/* ============================================================
   38 · BARE FOOTNOTE NUMBERS
   Ghost's markdown renderer writes footnote refs as "[1]".
   Hide that text and re-draw just the number via a counter,
   matching Bear's bare superscript style.
   (Assumes each footnote is referenced once, in order — true
   of every note so far; a re-used ref would drift.)
   ============================================================ */

sup.footnote-ref {
  counter-increment: fnref;
}

sup.footnote-ref a {
  font-size: 0;
  text-decoration: none;
}

sup.footnote-ref a::after {
  content: counter(fnref);
  font-size: 0.75rem;
}
