/* Weft palette: indigo #26337A, thread orange #F08A4B, off-white #EEF0FA.
   Light by default; dark follows the system, and the header's theme button can force either. */
:root {
  --indigo: #26337a; --orange: #f08a4b; --paper: #eef0fa;
  --bg: #eef0fa; --card: #fff; --text: #1a1f3d; --muted: #5b6188;
  --border: #26337a22; --shadow: 0 1px 2px #26337a1f, 0 4px 14px #26337a14;
  --link: #26337a; --warn: #b4531b; --err: #b3261e;
  --chip: #26337a12; --chip-hover: #26337a24; --soft: #26337a0f;
  --field: #fff; --field-border: #26337a40;
  --btn-bg: #26337a; --btn-text: #eef0fa; --focus-bg: #fff4ec;
  --header: #26337a; --header-text: #eef0fa;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #11142b; --card: #1b2150; --text: #eef0fa; --muted: #a4abd8;
    --border: #eef0fa1f; --shadow: 0 1px 2px #0006, 0 4px 14px #0004;
    --link: #f08a4b; --warn: #f08a4b; --err: #ff8a80;
    --chip: #eef0fa14; --chip-hover: #eef0fa28; --soft: #eef0fa14;
    --field: #141937; --field-border: #eef0fa40;
    --btn-bg: #f08a4b; --btn-text: #11142b; --focus-bg: #262e66;
    --header: #26337a; --header-text: #eef0fa;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #11142b; --card: #1b2150; --text: #eef0fa; --muted: #a4abd8;
  --border: #eef0fa1f; --shadow: 0 1px 2px #0006, 0 4px 14px #0004;
  --link: #f08a4b; --warn: #f08a4b; --err: #ff8a80;
  --chip: #eef0fa14; --chip-hover: #eef0fa28; --soft: #eef0fa14;
  --field: #141937; --field-border: #eef0fa40;
  --btn-bg: #f08a4b; --btn-text: #11142b; --focus-bg: #262e66;
  --header: #26337a; --header-text: #eef0fa;
  color-scheme: dark;
}

body { font: 16px/1.5 system-ui, sans-serif; margin: 0; background: var(--bg); color: var(--text); }
a { color: var(--link); }
.wrap { max-width: 40rem; margin: 0 auto; padding: 0 1rem; }

/* header: logo on the left; site name, theme and log in/out on the right */
.top { background: var(--header); color: var(--header-text); position: sticky; top: 0; z-index: 20; box-shadow: 0 1px 8px #0000002e; }
.top-in { padding: .6rem 1.25rem; display: flex; align-items: center; gap: .75rem; }
.brand { display: inline-flex; align-items: center; gap: .6rem; color: var(--header-text); text-decoration: none; font-weight: 700; font-size: 1.25rem; letter-spacing: .01em; }
.brand img { display: block; border-radius: 9px; box-shadow: 0 0 0 1px #eef0fa40; }
.top-l { flex: 1; }
.top-r { flex: 1; justify-content: flex-end; display: flex; align-items: center; gap: .85rem; min-width: 0; }
.top-r form { margin: 0; }
.site { color: var(--header-text); font-weight: 600; text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.site:hover { text-decoration: underline; }
.top .btn { white-space: nowrap; background: var(--orange); color: var(--indigo); border: 0; border-radius: 999px; padding: .3rem .95rem; font: inherit; font-weight: 600; text-decoration: none; cursor: pointer; }
.top .btn:hover { filter: brightness(1.08); }
.th { background: none; border: 0; color: var(--header-text); padding: .35rem; border-radius: 8px; cursor: pointer; display: inline-flex; }
.th:hover { background: #eef0fa24; }
.th svg { width: 1.2rem; height: 1.2rem; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; display: none; }
html:not([data-theme]) .th .t-auto, html[data-theme="light"] .th .t-light, html[data-theme="dark"] .th .t-dark { display: block; }
.menu { display: flex; gap: .15rem; }
.menu a { color: var(--header-text); text-decoration: none; padding: .3rem .75rem; border-radius: 999px; }
.menu a:hover { background: #eef0fa24; }
.menu a.on { text-decoration: underline var(--orange) 2px; text-underline-offset: 6px; }
.bio { color: var(--muted); margin: .75rem 0 0; }
@media (max-width: 40rem) {
  .top-in { flex-wrap: wrap; row-gap: .1rem; padding: .4rem 1rem; }
  .menu a { padding: .2rem .65rem; }
  article[id], .focus { scroll-margin-top: 6.5rem; } /* the header stays in view, so a post jumped to must clear it */
  .menu { order: 3; width: 100%; justify-content: center; overflow-x: auto; }
  .site { max-width: 9rem; }
}

/* cards */
article, .node { background: var(--card); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow); padding: .9rem 1.1rem; overflow-wrap: anywhere; }
article { margin: 1rem 0; }
time { color: var(--muted); font-size: .85em; }
/* headings written in a post. Browsers make an <h1> inside <article> smaller than usual (as small as an <h2> when
   the article is nested), so "#" came out no bigger than "##". A fixed scale keeps the order, below the post's title. */
:is(.e-content, .clip, .node, .comment, #preview-body) :is(h1, h2, h3, h4, h5, h6) { line-height: 1.25; margin: 1.1em 0 .4em; }
:is(.e-content, .clip, .node, .comment, #preview-body) h1 { font-size: 1.4rem; }
:is(.e-content, .clip, .node, .comment, #preview-body) h2 { font-size: 1.25rem; }
:is(.e-content, .clip, .node, .comment, #preview-body) h3 { font-size: 1.1rem; }
:is(.e-content, .clip, .node, .comment, #preview-body) :is(h4, h5, h6) { font-size: 1rem; }
/* the editor's preview shows the title the way a published post does (an h2 there), above any heading in the text */
#preview-title { font-size: 1.5em; line-height: 1.25; margin: 0 0 .5rem; }
article img, .node img, .comment img, #preview img { max-width: min(100%, calc(28rem * var(--r, 100))); max-height: 28rem; height: auto; object-fit: contain; border-radius: 8px; }
ul.thread, ul.thread ul { list-style: none; padding-left: 1rem; border-left: 2px solid var(--border); }
.node { margin: .75rem 0; }
.note { display: block; color: var(--warn); }
.focus { scroll-margin-top: 4rem; background: var(--focus-bg); box-shadow: 0 0 0 2px #f08a4b99, var(--shadow); }
article.likeevent { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 .75rem; color: var(--muted); font-size: .9rem; background: none; border: 0; box-shadow: none; padding: 0 1.1rem; margin: .6rem 0; }
#preview .empty { color: var(--muted); }

/* card footer: likes left, date in the middle, icon actions right */
.react { display: flex; align-items: center; gap: .25rem; margin: 0; }
.meta { display: flex; justify-content: space-between; align-items: center; gap: .5rem; margin-top: .6rem; }
.m-r { display: flex; justify-content: flex-end; gap: .15rem; }
.node-actions { display: flex; justify-content: flex-end; align-items: center; gap: .15rem; margin-top: .4rem; }
.ico .cnt { margin-left: .3rem; font-size: .85em; align-self: center; }
.pcard { display: flex; gap: .75rem; align-items: stretch; margin: .6rem 0; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; color: var(--text); text-decoration: none; background: var(--soft); }
.pcard:hover { border-color: var(--orange); }
.pcard img { width: 6rem; height: auto; flex: none; object-fit: cover; max-width: none; max-height: none; border-radius: 0; }
.pc-t { display: flex; flex-direction: column; gap: .15rem; padding: .55rem .75rem; min-width: 0; }
.pcard img + .pc-t { padding-left: 0; }
.pc-t strong { overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.pc-d { color: var(--muted); font-size: .9em; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; }
.pc-t small { color: var(--muted); }
.modes { display: flex; gap: 1rem; margin: .5rem 0 1rem; }
.modes strong { border-bottom: 2px solid var(--orange); }
.card-top { display: flex; justify-content: space-between; align-items: baseline; gap: .75rem; }
.card-top p, .card-top h2, .card-top h3 { margin: 0; }
.when { white-space: nowrap; color: var(--muted); font-size: .85em; }
.when a { color: inherit; text-decoration: none; }
.when a:hover { text-decoration: underline; }
.ico { display: inline-flex; padding: .3rem; border-radius: 8px; color: var(--muted); }
.ico:hover { background: var(--soft); color: var(--link); }
.ico svg { width: 1.15rem; height: 1.15rem; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.likebtn { display: inline-flex; align-items: center; background: none; border: 0; padding: .15rem .25rem; color: var(--muted); cursor: pointer; }
.likebtn:hover { color: var(--orange); }
.likebtn svg { width: 1.4rem; height: 1.4rem; fill: none; stroke: currentColor; stroke-width: 2; stroke-linejoin: round; }
.likebtn[aria-pressed=true] { color: var(--orange); }
.likebtn[aria-pressed=true] svg { fill: currentColor; }
.tally { cursor: help; text-decoration: underline dotted; text-underline-offset: 3px; }
.tally a { color: inherit; text-decoration: none; }
.tally a:hover { text-decoration: underline; }

/* keyword chips */
.repost { margin: .5rem 0 0; color: var(--muted); }
.kw { display: flex; flex-wrap: wrap; gap: .35rem; margin: .5rem 0 0; }
.kw span, .kw a { text-decoration: none; background: var(--chip); border-radius: 999px; padding: .05rem .65rem; font-size: .85em; color: var(--text); }
.kw a:hover { background: var(--chip-hover); }
.kwhead small { color: var(--muted); }

/* forms */
input[type=text], input[type=password], textarea { width: 100%; box-sizing: border-box; font: inherit; padding: .4rem .55rem; background: var(--field); color: var(--text); border: 1px solid var(--field-border); border-radius: 8px; }
input:focus, textarea:focus, button:focus-visible, a:focus-visible { outline: 2px solid var(--orange); outline-offset: 2px; }
textarea { min-height: 14rem; font-family: ui-monospace, monospace; }
label { display: block; margin-top: 1rem; }
button { font: inherit; background: var(--btn-bg); color: var(--btn-text); border: 0; border-radius: 8px; padding: .4rem .9rem; cursor: pointer; }
button:hover { filter: brightness(1.1); }
/* a rule between the sections of the profile page */
main > hr { border: 0; border-top: 1px solid var(--border); margin: 1.75rem 0; }
main > hr + h3 { margin-top: 0; }
/* DNS records: one value to a row, long values break anywhere and not at their hyphens */
table.dns { border-collapse: collapse; margin: .25rem 0 .75rem; }
.dns th { text-align: left; font-weight: 600; color: var(--muted); padding: .25rem 1rem .25rem 0; vertical-align: top; }
.dns td { padding: .25rem 0; }
.dns code { word-break: break-all; }
button.copy { margin-left: .6rem; padding: .15rem .6rem; font-size: .8rem; vertical-align: baseline; }
.linkbtn { background: none; border: 0; padding: 0; color: var(--link); text-decoration: underline; }
.err { color: var(--err); }
.sr { position: absolute; left: -9999px; }

footer { margin: 2rem 0 1rem; text-align: center; }
footer a { color: var(--muted); text-decoration: none; }
footer img { vertical-align: -4px; border-radius: 4px; }

/* avatars: the image, or the first letter of the name when there is none or it fails to load */
.av { display: inline-flex; align-items: center; justify-content: center; flex: none; width: 2rem; height: 2rem; border-radius: 50%; overflow: hidden; vertical-align: middle; margin-right: .55rem; background: var(--orange); color: var(--indigo); font-weight: 700; font-size: .95rem; line-height: 1; }
.av img[hidden], .av span[hidden] { display: none; }
.av img { width: 100%; height: 100%; max-width: none; max-height: none; object-fit: cover; border-radius: 0; display: block; }
.card-top .who { display: flex; align-items: center; flex-wrap: wrap; gap: 0 .3rem; min-width: 0; }
.card-top .who .av { margin-right: .25rem; }
.site { display: inline-flex; align-items: center; }
.site .av { width: 1.7rem; height: 1.7rem; font-size: .8rem; margin-right: .5rem; }
.site > span:last-child { overflow: hidden; text-overflow: ellipsis; }
article.likeevent p, article.likeevent form { margin: .2rem 0; }

/* replies under a post: a card for each, the replies to it nested beneath with a rule down the side */
.replies h3 { margin: 1.75rem 0 .25rem; }
ol.comments { list-style: none; margin: 0; padding: 0; }
ol.comments ol.comments { margin-left: .9rem; padding-left: .9rem; border-left: 2px solid var(--border); }
.comment { background: var(--card); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow); padding: .7rem 1rem; margin: .75rem 0; overflow-wrap: anywhere; }
.comment .card-top { align-items: center; }
.comment .who a { text-decoration: none; color: var(--text); }
.comment .who a:hover { text-decoration: underline; }
.comment h4 { margin: .5rem 0 0; }
.comment .p-content > :first-child { margin-top: .4rem; }
.comment .p-content > :last-child { margin-bottom: 0; }
@media (max-width: 30rem) { ol.comments ol.comments { margin-left: .4rem; padding-left: .5rem; } }

/* feeds the bookmarked page advertises */
.pfeeds { margin: .5rem 0 1rem; }
.pfeed { display: flex; justify-content: space-between; align-items: center; gap: .75rem; margin: .4rem 0; padding: .5rem .8rem; background: var(--soft); border: 1px solid var(--border); border-radius: 10px; }
.pf-t { display: flex; flex-direction: column; min-width: 0; }
.pf-t small { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pfeed form { margin: 0; }
.following { color: var(--muted); white-space: nowrap; }

/* a link back to a post on the timeline scrolls to it, clear of the header, and marks it */
article[id] { scroll-margin-top: 4.5rem; }
article[id]:target { box-shadow: 0 0 0 2px #f08a4b99, var(--shadow); }

/* the Markdown cheatsheet: below the editor, or in the margins beside it when the window is wide enough for both */
.ed { position: relative; }
.cheats { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1rem; margin-top: 1rem; }
.cheat { font-size: .85rem; color: var(--muted); background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: .6rem .8rem; box-sizing: border-box; overflow-wrap: anywhere; }
.cheat h3 { margin: 0 0 .4rem; font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.cheat dl { margin: 0; }
.cheat dt { margin: .6rem 0 .15rem; }
.cheat dt:first-child { margin-top: 0; }
.cheat dd { margin: 0 0 0 .2rem; }
.cheat dd { color: var(--text); }
.cheat dd > :first-child { margin-top: 0; }
.cheat dd > :last-child { margin-bottom: 0; }
.cheat dd h2 { font-size: 1.05rem; margin: 0; }
.cheat dd ul, .cheat dd ol { margin: 0; padding-left: 1.2rem; }
.cheat dd blockquote { margin: 0; padding-left: .6rem; border-left: 3px solid var(--border); }
.cheat dd pre { margin: 0; padding: .3rem .5rem; background: var(--soft); border: 1px solid var(--border); border-radius: 6px; overflow-x: auto; }
.cheat dd pre code { background: none; padding: 0; }
.cheat dd hr { margin: .4rem 0; }
.cheat code { white-space: pre-wrap; background: var(--chip); border-radius: 4px; padding: 0 .3rem; font-size: .95em; color: var(--text); }
.cheat p { margin: .5rem 0 0; }
@media (max-width: 40rem) { .cheats { grid-template-columns: 1fr; gap: 1rem 0; } }
@media (min-width: 72rem) {
  .cheats { display: block; margin: 0; }
  .cheat { position: absolute; top: 0; width: 14rem; }
  .cheat-l { right: 100%; margin-right: 1.25rem; }
  .cheat-r { left: 100%; margin-left: 1.25rem; }
}

/* code in posts, replies and the preview: a block scrolls sideways inside its card instead of spilling out */
article pre, .node pre, .comment pre, #preview pre { overflow-x: auto; margin: .75rem 0; padding: .7rem .9rem; background: var(--soft); border: 1px solid var(--border); border-radius: 8px; font: .88rem/1.45 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; tab-size: 4; white-space: pre; overflow-wrap: normal; }
article code, .node code, .comment code, #preview code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .9em; }
article :not(pre) > code, .node :not(pre) > code, .comment :not(pre) > code, #preview :not(pre) > code { background: var(--chip); border-radius: 4px; padding: .05rem .3rem; }
article pre code, .node pre code, .comment pre code, #preview pre code { background: none; padding: 0; font-size: inherit; }

/* the editor starts with the Markdown box alone; "Advanced" adds the title, keywords, address and Markdown help */
.ed:not(:has(#adv:checked)) .adv, .ed:not(:has(#adv:checked)) .cheats { display: none; }
.ed:not(:has(#repost:checked)) .repostfield { display: none; }
.advrow { margin: 1rem 0 .25rem; }
.advrow label { display: inline-flex; align-items: center; gap: .4rem; margin: 0; }
.advrow small { color: var(--muted); }

/* pictures in the editor and the list of images */
.imgbar{display:flex;flex-wrap:wrap;align-items:center;gap:.5rem 1rem;margin:.5rem 0 1rem}
.imgbar label{display:inline-flex;align-items:center;gap:.4rem;margin:0}
.imgbar #imgmsg{flex-basis:100%;margin:0}
.imgs{list-style:none;padding:0;margin:1rem 0}
.imgs li{display:grid;grid-template-columns:120px 1fr;gap:.25rem 1rem;align-items:start;padding:.75rem 0;border-top:1px solid var(--border)}
.imgs img{display:block;max-width:120px;height:auto;border-radius:6px}
.imgs form{grid-column:2}

/* a long post in a list is folded to about 20 lines */
.clip.clamped:not(.open) { max-height: 30em; overflow: hidden; -webkit-mask-image: linear-gradient(#000 70%, transparent); mask-image: linear-gradient(#000 70%, transparent); }
.clipbtn { display: block; margin: .25rem 0 .5rem; padding: 0; border: 0; background: none; color: var(--link, inherit); font: inherit; font-size: .9rem; text-decoration: underline; cursor: pointer; }

.pager { display: flex; gap: 1.5rem; margin: 1.5rem 0; }
