/* staticstr default style. MIT licensed, like the rest of staticstr. */

:root {
  --bg: #f6f6f4;
  --card: #ffffff;
  --text: #1c1c1e;
  --muted: #6b6b70;
  --line: #e3e3e0;
  --accent: #7a3fd1;
  --radius: 12px;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121214;
    --card: #1c1c1f;
    --text: #ececee;
    --muted: #9a9aa2;
    --line: #2c2c31;
    --accent: #b48cf2;
  }
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

main {
  max-width: 640px;
  margin: 0 auto;
  padding: 16px;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.profile {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 16px;
}

.profile .banner {
  display: block;
  width: 100%;
  aspect-ratio: 3 / 1;
  object-fit: cover;
  background: var(--line);
}

.who {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
}

.who h1 { font-size: 1.25rem; margin: 0; line-height: 1.2; }
.who h1 a { color: var(--text); }
.nip05 { color: var(--muted); font-size: 0.9rem; overflow-wrap: anywhere; }

.avatar {
  display: block;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--line);
  flex: none;
}

.avatar.small { width: 32px; height: 32px; }

.about, .facts, .retired { padding: 0 16px; margin: 0 0 12px; }
.about { white-space: pre-wrap; overflow-wrap: anywhere; }
.facts, .retired { color: var(--muted); font-size: 0.9rem; overflow-wrap: anywhere; }
.retired summary { cursor: pointer; }
.retired p { margin: 8px 0 4px; }
.retired ul { margin: 0; padding-left: 20px; }
.retired code { font-size: 0.8rem; }

.npub { font-family: ui-monospace, monospace; font-size: 0.8rem; }

.tabs {
  display: flex;
  gap: 4px;
  margin: 0 0 16px;
  border-bottom: 1px solid var(--line);
}

.tabs a {
  padding: 8px 12px;
  color: var(--muted);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}

.tabs a.active { color: var(--text); border-bottom-color: var(--accent); font-weight: 600; }

.note {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 16px;
  margin-bottom: 12px;
}

.byline { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.byline .name { font-weight: 600; }

.context { color: var(--muted); font-size: 0.9rem; margin-bottom: 4px; }

.body { white-space: pre-wrap; overflow-wrap: anywhere; }

.body .media { display: block; margin: 8px 0; }

.body img, .body video {
  display: block;
  max-width: 100%;
  height: auto;
  max-height: 80vh;
  border-radius: 8px;
  background: var(--line);
}

.body audio { width: 100%; }

.note footer {
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.85rem;
}

.note footer a { color: var(--muted); }

.oldkey, .edited { font-style: italic; }

.pages {
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--muted);
  margin: 16px 0;
}

.empty, .back { color: var(--muted); }

footer.site {
  text-align: center;
  color: var(--muted);
  font-size: 0.85rem;
  padding: 24px 16px 40px;
}

footer.site a { color: var(--muted); text-decoration: underline; }

.quote {
  display: block;
  margin: 8px 0;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--text);
  white-space: normal;
}

.quote:hover { border-color: var(--muted); }
.quote .qlink { display: block; color: var(--text); }
.quote .qlink:hover { text-decoration: none; }
.quote .byline { margin-bottom: 4px; }
.quote time { color: var(--muted); font-size: 0.85rem; font-weight: normal; }
.quote .qtext { display: block; white-space: pre-wrap; overflow-wrap: anywhere; }
.quote img, .quote video {
  display: block;
  margin-top: 8px;
  max-width: 100%;
  max-height: 320px;
  border-radius: 8px;
  background: var(--line);
}
.quote audio { display: block; width: 100%; margin-top: 8px; }
/* More pictures than the card shows: a count on the first one. */
.quote .qpic { position: relative; display: inline-block; max-width: 100%; }
.quote .qmore {
  position: absolute;
  right: 8px;
  bottom: 8px;
  padding: 2px 10px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  font-size: 0.9rem;
  font-weight: 600;
}
.quote .qmore-line { display: inline-block; margin-top: 6px; color: var(--muted); font-size: 0.9rem; }

.gallery {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  margin: 8px 0;
}

.gallery.n3 > :first-child { grid-row: span 2; }
.gallery .media { margin: 0; }

.gallery img {
  width: 100%;
  height: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 6px;
}

.gallery.n3 > :first-child img { aspect-ratio: auto; }

.preview {
  display: block;
  margin: 8px 0 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  color: var(--text);
}

.preview:hover { text-decoration: none; border-color: var(--muted); }

.preview img {
  display: block;
  width: 100%;
  aspect-ratio: 1.91 / 1;
  object-fit: cover;
  background: var(--line);
}

.preview .ptext { display: block; padding: 8px 12px 10px; }
.preview .psite {
  display: block;
  color: var(--muted);
  font-size: 0.8rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.preview .ptitle { display: block; font-weight: 600; line-height: 1.3; overflow-wrap: anywhere; }
.preview .pdesc { display: block; color: var(--muted); font-size: 0.9rem; margin-top: 2px; }

/* Image viewer (lightbox.js). */
.lb-open { overflow: hidden; }

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.92);
}

.lightbox[hidden] { display: none; }

.lightbox img {
  max-width: 100vw;
  max-height: 100vh;
  object-fit: contain;
}

.lightbox button {
  position: absolute;
  border: 0;
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  font-size: 2rem;
  line-height: 1;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  cursor: pointer;
}

.lightbox button:hover { background: rgba(255, 255, 255, 0.3); }
.lightbox button[hidden] { display: none; }
.lightbox .lb-prev { left: 12px; top: 50%; transform: translateY(-50%); }
.lightbox .lb-next { right: 12px; top: 50%; transform: translateY(-50%); }
.lightbox .lb-close { right: 12px; top: 12px; }

.lightbox .lb-count {
  position: absolute;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  color: #fff;
  font-size: 0.9rem;
}

/* A preview with something to listen to (a podcast episode). */
.preview.listen { overflow: hidden; }
.preview.listen .plink { display: flex; gap: 12px; align-items: center; padding: 10px; color: var(--text); }
.preview.listen .plink:hover { text-decoration: none; }
.preview.listen img {
  flex: none;
  width: 88px;
  height: 88px;
  aspect-ratio: 1;
  border-radius: 8px;
}
.preview.listen .ptext { padding: 0; min-width: 0; }
.preview.listen audio { display: block; width: calc(100% - 20px); margin: 0 10px 10px; }

/* A zap (podcast "boost") quoted in a note. */
.zap {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 8px;
  align-items: baseline;
  margin: 8px 0;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--muted);
  white-space: normal;
}
.zap .zamount { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }
.zap .zcomment { flex-basis: 100%; color: var(--text); }

/* Videos. */
.video .vtitle { font-size: 1.1rem; line-height: 1.3; margin: 0 0 8px; }
.video .vtitle a { color: var(--text); }
.video .player {
  display: block;
  width: 100%;
  max-height: 80vh;
  margin: 0 auto 8px;
  border-radius: 8px;
  overflow: hidden;
  background: #000;
}
.video .player iframe { display: block; width: 100%; height: 100%; border: 0; }
/* Long descriptions are cut short in feeds; the video's page has them all. */
.body.clamp {
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Zaps a note received: a total that opens a popover with the list. */
.zaptotal {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  font-variant-numeric: tabular-nums;
}
.zaptotal:hover { color: var(--accent); }
.zaps[popover] {
  width: min(28rem, calc(100vw - 32px));
  max-height: 70vh;
  overflow: auto;
  margin: auto;
  background: var(--card);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 16px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.25);
  font-size: 1rem;
}
.zaps[popover]::backdrop { background: rgba(0, 0, 0, 0.3); }
.zaps h2 { font-size: 1rem; margin: 0 0 8px; font-variant-numeric: tabular-nums; }
.zaps ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.zaps li { overflow-wrap: anywhere; }
.zaps .zamount { color: var(--muted); font-variant-numeric: tabular-nums; }
.zaps .zcomment { display: block; }
.zaps .zothers { color: var(--muted); margin: 8px 0 0; }
.note footer .zaps[popover] a { color: var(--accent); }

/* Zap totals on a profile. */
.badges { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 16px; margin: 0 0 12px; }
.badge {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 2px 10px;
  font-size: 0.85rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.badge strong { color: var(--text); font-weight: 600; }

/* Generated avatars (minidenticons) sit on a light ground in both themes. */
.avatar.identicon { background: #f2f2f0; }
/* Avatars inside a quoted note are not the note's images. */
.quote .avatar { border-radius: 50%; margin-top: 0; max-height: none; }

/* Threads. */
/* A reply in a feed, with its context: set apart from the notes around it. */
.thread { margin: 24px 0 28px; }
.thread > .note, .thread .indent > .note { margin-bottom: 0; }
.tnote {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px 14px;
  margin-bottom: 8px;
}
.tnote .byline { margin-bottom: 4px; }
.tnote .name { font-weight: 600; color: var(--text); }
.tnote .time { color: var(--muted); font-size: 0.85rem; }
.between {
  display: inline-block;
  margin: 0 0 8px 12px;
  padding: 2px 0 6px;
  color: var(--muted);
  font-size: 0.9rem;
}
.between:hover { color: var(--accent); }
.indent { margin-left: 24px; padding-left: 12px; border-left: 2px solid var(--line); }
.gap { color: var(--muted); font-size: 0.9rem; margin: 0 0 6px 4px; }
.gap a { color: var(--muted); }
.icon {
  width: 1em;
  height: 1em;
  margin-right: 0.3em;
  vertical-align: -0.15em;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.gap a:hover { color: var(--accent); }
.replies-tree { margin-top: 4px; }
.replies-tree .children {
  margin-left: 14px;
  padding-left: 12px;
  border-left: 2px solid var(--line);
}
.replies-tree .children:empty { display: none; }
.replies-tree .children.flat { margin-left: 0; padding-left: 0; border-left: 0; }
/* A reply that starts a branch is joined to the line by a short stroke; a
   follow-up at the same level is not. */
.replies-tree .children:not(.flat) > .branch.start { position: relative; }
.replies-tree .children:not(.flat) > .branch.start::before {
  content: "";
  position: absolute;
  left: -14px;
  top: 28px;
  width: 14px;
  border-top: 2px solid var(--line);
}
.replies-tree .branch.folded > .children { display: none; }
/* A reply that follows the one above at the same level is joined to it by
   a short line in the middle. */
.replies-tree :is(.note, .tnote) { margin-bottom: 14px; }
.replies-tree .branch:not(.start) { position: relative; }
.replies-tree .branch:not(.start)::before {
  content: "";
  position: absolute;
  left: 50%;
  top: -14px;
  height: 14px;
  border-left: 2px solid var(--line);
}
/* Folding a branch: a chevron on the line, like a code editor's fold
   marker; when folded, a link under the reply brings it back. */
.replies-tree .children { position: relative; }
/* The note an address pointed to, on its thread's page. */
.replies-tree :is(.note, .tnote) { scroll-margin-top: 16px; }
.replies-tree :is(.note, .tnote):target {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 25%, transparent);
}
.fold {
  position: absolute;
  top: -6px;
  left: -12px;
  width: 22px;
  height: 22px;
  padding: 0;
  display: grid;
  place-items: center;
  color: var(--muted);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 50%;
  cursor: pointer;
}
.fold svg { width: 12px; height: 12px; }
.fold:hover, .fold:focus-visible { color: var(--accent); border-color: var(--accent); }
.unfold {
  display: block;
  margin: -2px 0 10px auto;
  font: inherit;
  font-size: 0.9rem;
  color: var(--accent);
  background: none;
  border: 0;
  padding: 2px 4px;
  cursor: pointer;
}
.unfold:hover { text-decoration: underline; }
.replies-tree .branch:not(.folded) > .unfold { display: none; }
.replies { color: inherit; }

/* Long notes, cut short until expanded (expand.js). */
.js-expand .body.long:not(.open) {
  max-height: 15em;
  overflow: hidden;
}
.js-expand .body.long.overflowing:not(.open) {
  -webkit-mask-image: linear-gradient(#000 75%, transparent);
  mask-image: linear-gradient(#000 75%, transparent);
}
.expand {
  font: inherit;
  font-size: 0.9rem;
  color: var(--accent);
  background: none;
  border: 0;
  padding: 4px 0 0;
  cursor: pointer;
}
.expand:hover { text-decoration: underline; }

/* Year and month archives. */
.period { font-size: 1.2rem; margin: 4px 0 12px; }
.period a { color: var(--muted); font-weight: normal; }
.months { list-style: none; margin: 0 0 16px; padding: 0; display: grid; gap: 6px; }
.months li { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 8px 14px; }
.months .mname { display: inline-block; min-width: 7.5em; font-weight: 600; }
.archive { color: var(--muted); font-size: 0.9rem; margin: 8px 0 16px; overflow-wrap: anywhere; }

/* "> " lines, as quotes. */
.body blockquote {
  margin: 4px 0;
  padding: 2px 0 2px 12px;
  border-left: 3px solid var(--line);
  color: var(--muted);
  white-space: pre-wrap;
}

/* Long-form articles (NIP-23). */
.atitle { display: block; font-size: 1.1rem; font-weight: 600; line-height: 1.3; overflow-wrap: anywhere; }
h2.atitle { margin: 0 0 8px; }
h2.atitle a { color: var(--text); }
.asummary { display: block; color: var(--muted); overflow-wrap: anywhere; }
p.asummary { margin: 0 0 6px; }
.amore { display: block; margin-top: 6px; font-size: 0.9rem; color: var(--accent); }
.aimage { display: block; margin: 8px 0; }
.aimage img {
  display: block;
  width: 100%;
  max-height: 60vh;
  object-fit: cover;
  border-radius: 8px;
  background: var(--line);
}
/* Someone else's article in a note: a card that unfolds to the article. */
.article {
  margin: 8px 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  white-space: normal;
}
.article:hover, .article[open] { border-color: var(--muted); }
.article > summary { display: block; padding: 10px 12px; cursor: pointer; list-style: none; }
.article > summary::-webkit-details-marker { display: none; }
.article > summary .byline { margin-bottom: 4px; }
.article > summary time { color: var(--muted); font-size: 0.85rem; }
.article > summary:hover .amore { text-decoration: underline; }
.article[open] > summary { border-bottom: 1px solid var(--line); }
.article[open] .closed, .article:not([open]) .opened { display: none; }
.article > .aimage, .article > .md, .article > .asource { margin-left: 12px; margin-right: 12px; }
.article > .md { margin-top: 12px; }
.asource { margin-top: 12px; margin-bottom: 10px; color: var(--muted); font-size: 0.85rem; }
.asource a { color: var(--muted); }
.asource a:hover { color: var(--accent); }
/* An article's text, from Markdown. */
.md { white-space: normal; overflow-wrap: anywhere; }
.md > :first-child { margin-top: 0; }
.md > :last-child { margin-bottom: 0; }
.md p, .md ul, .md ol, .md pre, .md blockquote, .md table { margin: 0 0 0.9em; }
.md h3, .md h4, .md h5, .md h6 { margin: 1.4em 0 0.5em; line-height: 1.3; }
.md h3 { font-size: 1.15rem; }
.md h4 { font-size: 1.05rem; }
.md h5, .md h6 { font-size: 1rem; }
.md ul, .md ol { padding-left: 1.5em; }
.md li { margin: 0.2em 0; }
.md li > p { margin-bottom: 0.4em; }
.md code {
  font: 0.875em/1.45 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 0.1em 0.3em;
}
.md pre {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  overflow-x: auto;
  overflow-wrap: normal;
  tab-size: 4;
}
.md pre code { background: none; border: 0; padding: 0; white-space: pre; }
.md blockquote {
  padding: 2px 0 2px 12px;
  border-left: 3px solid var(--line);
  color: var(--muted);
  white-space: normal;
}
.md hr { border: 0; border-top: 1px solid var(--line); margin: 1.4em 0; }
.md img, .md video { display: block; max-width: 100%; height: auto; max-height: 80vh; border-radius: 8px; background: var(--line); }
.md .media { display: block; margin: 8px 0; }
.md audio { width: 100%; }
.md table { display: block; max-width: 100%; overflow-x: auto; border-collapse: collapse; overflow-wrap: normal; }
.md th, .md td { border: 1px solid var(--line); padding: 4px 8px; }
.md input[type="checkbox"] { margin-right: 0.4em; }
