/* The blog's palette, because this is the same person's tool. One accent, used
   only for the primary action and for focus — everything else is a hairline. */
:root {
  --ink: #f2f5fa;
  --text: #d4d9e2;
  --dim: #a2aabb;
  --line: #333c4f;
  --bg: #13171e;
  --raised: #1a1f28;
  --red: #f45757;
  --accent: #78a0ff;
  --radius: 6px;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --ui: Inter, -apple-system, system-ui, sans-serif;
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

/* The `hidden` attribute has to beat any class that sets display, or a control
   JavaScript hides stays on screen anyway — which is how the no-JS Attach
   button and the preview toggle both leaked through. */
[hidden] {
  display: none !important;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 0.9375rem/1.7 var(--ui);
  letter-spacing: -0.01em;
}

a {
  color: var(--accent);
}
.muted {
  color: var(--dim);
}
.small {
  font-size: 0.8125rem;
}

/* --- chrome ----------------------------------------------------------- */

.bar {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.9rem 1.5rem;
  border-bottom: 1px solid var(--line);
}
.wordmark {
  font: 600 0.8125rem/1 var(--mono);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink);
  text-decoration: none;
}
.who {
  margin-left: auto;
  color: var(--dim);
  font: 0.75rem/1 var(--mono);
}
.bar form {
  display: flex;
}

main {
  max-width: 44rem;
  margin: 0 auto;
  padding: 2rem 1.5rem 4rem;
}

/* --- the writing surface ---------------------------------------------- */

/* No boxes. The page is the paper: a title, a rule, and the text. Chrome
   appears at the bottom, where it cannot compete with the writing. */
.sheet {
  display: grid;
}

.title,
.body {
  width: 100%;
  background: none;
  border: 0;
  color: var(--ink);
  padding: 0;
  font: inherit;
}
.title {
  font: 700 1.75rem/1.3 var(--ui);
  letter-spacing: -0.02em;
  padding-bottom: 0.6rem;
  border-bottom: 1px solid var(--line);
}
.body {
  font: 0.9375rem/1.75 var(--mono);
  letter-spacing: 0;
  min-height: 22rem;
  padding-top: 1.1rem;
  resize: vertical;
}
.title::placeholder,
.body::placeholder {
  color: var(--dim);
  opacity: 0.5;
}
/* The caret is the focus indicator here — an outline round the whole page
   would be noise, and there is nothing to mistake these fields for. */
.title:focus,
.body:focus {
  outline: none;
}

/* --- one toolbar, one primary action ---------------------------------- */

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
}

.tool {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0.7rem;
  border: 1px solid transparent;
  border-radius: var(--radius);
  color: var(--dim);
  font: 0.8125rem/1 var(--ui);
  cursor: pointer;
  background: none;
}
.tool:hover {
  color: var(--ink);
  border-color: var(--line);
}
.tool input[type="checkbox"] {
  accent-color: var(--accent);
}

/* The file input itself is hidden behind its label, because the browser's own
   control is the ugliest thing on any page. */
.tool.file input[type="file"] {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}
.tool.file:focus-within {
  color: var(--ink);
  border-color: var(--accent);
}
.tool.file.has-file {
  color: var(--ink);
  border-color: var(--line);
}

.badge {
  background: var(--line);
  border-radius: 999px;
  color: var(--ink);
  font: 0.6875rem/1 var(--mono);
  padding: 0.2em 0.45em;
}

/* Options live in disclosures rather than permanent boxes: present when wanted,
   invisible when not, and working with no JavaScript. */
.menu {
  position: relative;
}
.menu > summary {
  list-style: none;
}
.menu > summary::-webkit-details-marker {
  display: none;
}
.menu[open] > summary {
  color: var(--ink);
  border-color: var(--line);
}
.pop {
  position: absolute;
  bottom: calc(100% + 0.4rem);
  left: 0;
  z-index: 10;
  display: grid;
  gap: 0.15rem;
  min-width: 13rem;
  max-height: 15rem;
  overflow-y: auto;
  padding: 0.5rem;
  background: var(--raised);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 12px 30px rgb(0 0 0 / 45%);
}
.tag {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.25rem 0.3rem;
  border-radius: var(--radius);
  color: var(--text);
  font-size: 0.8125rem;
  cursor: pointer;
}
.tag:hover {
  background: var(--bg);
}
.tag .count {
  margin-left: auto;
  color: var(--dim);
  font: 0.6875rem/1 var(--mono);
}

button.primary {
  margin-left: auto;
  padding: 0.5rem 1.1rem;
  background: var(--accent);
  color: #10131a;
  border: 0;
  border-radius: var(--radius);
  font: 600 0.8125rem/1.4 var(--ui);
  cursor: pointer;
}
button.primary:hover {
  filter: brightness(1.08);
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* --- attachments ------------------------------------------------------- */

.photos {
  display: grid;
  gap: 0.6rem;
  margin-top: 1.25rem;
}
.photo {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  gap: 0.75rem;
  align-items: center;
}
.photo img {
  width: 64px;
  height: 64px;
  object-fit: cover;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--raised);
}
.photo .alt span {
  display: none;
}
.photo .alt input {
  width: 100%;
  padding: 0.35rem 0.5rem;
  background: none;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--text);
  font: 0.8125rem/1.4 var(--ui);
}

/* --- syndication marks -------------------------------------------------- */

.syn {
  width: 16px;
  height: 16px;
  fill: currentColor;
  opacity: 0.28;
  transition: opacity 0.12s ease;
}
/* Lit when the matching checkbox is ticked. Static rules by index rather than
   anything generated, and eight is well past the six services Micro.blog
   syndicates to. */
.crosspost:has(input[data-syn="0"]:checked) .syn[data-syn="0"],
.crosspost:has(input[data-syn="1"]:checked) .syn[data-syn="1"],
.crosspost:has(input[data-syn="2"]:checked) .syn[data-syn="2"],
.crosspost:has(input[data-syn="3"]:checked) .syn[data-syn="3"],
.crosspost:has(input[data-syn="4"]:checked) .syn[data-syn="4"],
.crosspost:has(input[data-syn="5"]:checked) .syn[data-syn="5"],
.crosspost:has(input[data-syn="6"]:checked) .syn[data-syn="6"],
.crosspost:has(input[data-syn="7"]:checked) .syn[data-syn="7"] {
  opacity: 1;
}
/* The .tool class sits on the <details>, so its flex gap never reached the marks
   inside the <summary>. The summary has to be the flex container itself. */
.menu > summary {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* --- preview ----------------------------------------------------------- */

/* Off until asked for, and when asked for it takes the editor's place rather
   than stacking beneath it — the point is to see the piece, not to scroll
   between two versions of it. */
.composer.previewing .sheet {
  display: none;
}
.preview {
  min-height: 24rem;
}
.preview-body {
  color: var(--text);
}
.preview-body h1,
.preview-body h2,
.preview-body h3 {
  color: var(--ink);
  line-height: 1.25;
}
.preview-body img {
  max-width: 100%;
  border-radius: var(--radius);
}
.preview-body blockquote {
  border-left: 3px dotted var(--line);
  color: var(--dim);
  font-family: var(--mono);
  font-style: italic;
  font-size: 0.95em;
  margin: 1.5em 0;
  padding-left: 1.25rem;
}
.preview-body pre {
  background: var(--raised);
  border-radius: var(--radius);
  padding: 1rem;
  overflow-x: auto;
}
.preview-body code {
  font: 0.9em/1.5 var(--mono);
}

/* --- sign in ----------------------------------------------------------- */

.signin {
  max-width: 30rem;
  margin: 4rem auto;
}
.signin h1 {
  color: var(--ink);
  font: 700 1.75rem/1.25 var(--ui);
  letter-spacing: -0.02em;
  margin: 0 0 0.6rem;
}
.stack {
  display: grid;
  gap: 0.6rem;
  margin-top: 1.5rem;
}
.stack label {
  font: 0.6875rem/1 var(--mono);
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--dim);
}
.stack input {
  padding: 0.6em 0.7em;
  background: var(--raised);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink);
  font: inherit;
}
.stack button {
  justify-self: start;
  padding: 0.55rem 1.1rem;
  background: var(--accent);
  color: #10131a;
  border: 0;
  border-radius: var(--radius);
  font: 600 0.8125rem/1.4 var(--ui);
  cursor: pointer;
}

button.link {
  background: none;
  border: 0;
  padding: 0;
  color: var(--dim);
  font: 0.75rem/1 var(--mono);
  cursor: pointer;
}
button.link:hover {
  color: var(--ink);
}

/* --- recent posts ------------------------------------------------------ */

.recent {
  margin-top: 3.5rem;
}
.recent h2 {
  font: 500 0.6875rem/1 var(--mono);
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--dim);
  margin: 0 0 0.5rem;
}
.posts {
  list-style: none;
  margin: 0;
  padding: 0;
}
.posts li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.1rem 1rem;
  padding: 0.7rem 0;
  border-top: 1px solid var(--line);
}
.post-title {
  color: var(--ink);
  text-decoration: none;
}
.post-title:hover {
  text-decoration: underline;
}
.meta {
  grid-column: 1;
  color: var(--dim);
  font: 0.6875rem/1.5 var(--mono);
}
.draft-flag {
  color: var(--red);
}
.permalink {
  grid-row: 1 / span 2;
  grid-column: 2;
  align-self: center;
  color: var(--dim);
  font: 0.6875rem/1 var(--mono);
  text-decoration: none;
}
.permalink:hover {
  color: var(--ink);
}

/* --- messages ---------------------------------------------------------- */

.notice {
  padding: 0.6rem 0.8rem;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  border-left-width: 3px;
  margin: 0 0 1.25rem;
  font-size: 0.875rem;
}
.notice.error {
  border-left-color: var(--red);
}
.notice.ok {
  border-left-color: var(--accent);
}
.crumb {
  margin: 0 0 1.5rem;
  font: 0.75rem/1 var(--mono);
}
.crumb a {
  color: var(--dim);
  text-decoration: none;
}
.danger {
  margin-top: 3rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
}
.danger-link {
  color: var(--red);
}

@media (max-width: 34em) {
  main {
    padding: 1.25rem 1rem 3rem;
  }
  .title {
    font-size: 1.4rem;
  }
}

.preview-toggle.on {
  color: var(--ink);
  border-color: var(--line);
}

/* --- the metadata panel, on an existing post --------------------------- */

/* Only the edit screen has one, and only it gets the extra width — the
   composer stays where it is rather than shifting when you open a post. */
main:has(.with-meta) {
  max-width: 64rem;
}
.with-meta {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 15rem;
  gap: 3rem;
  align-items: start;
}

.meta-panel {
  font: 0.75rem/1.6 var(--mono);
  color: var(--dim);
}
.meta-panel h2 {
  font: 500 0.6875rem/1 var(--mono);
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--dim);
  margin: 0 0 0.5rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--line);
}
.meta-panel h2 ~ h2 {
  margin-top: 2rem;
}
.meta-panel dl {
  margin: 0 0 0.25rem;
}
.meta-panel .row {
  display: grid;
  grid-template-columns: 5.5rem minmax(0, 1fr);
  gap: 0.5rem;
  padding: 0.2rem 0;
}
.meta-panel dt {
  color: var(--dim);
  opacity: 0.75;
}
.meta-panel dd {
  margin: 0;
  color: var(--text);
  overflow-wrap: anywhere;
}
.meta-panel code {
  font: inherit;
  color: var(--text);
}
.meta-panel a {
  color: var(--text);
  text-decoration: none;
  overflow-wrap: anywhere;
}
.meta-panel a:hover {
  color: var(--ink);
  text-decoration: underline;
}
.syndicated {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.35rem;
}
.syndicated li {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.syn.lit {
  opacity: 1;
  flex: none;
}
.meta-panel .note {
  margin: 2rem 0 0;
  padding-top: 0.75rem;
  border-top: 1px solid var(--line);
  line-height: 1.7;
  opacity: 0.8;
}

@media (max-width: 60em) {
  .with-meta {
    grid-template-columns: minmax(0, 1fr);
    gap: 2.5rem;
  }
}

.syndicated a {
  display: grid;
  gap: 0 0.5rem;
  grid-template-columns: minmax(0, auto) minmax(0, 1fr);
  align-items: baseline;
}
.syndicated .where {
  color: var(--text);
}
.syndicated .post-id {
  color: var(--dim);
  opacity: 0.75;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.syndicated a:hover .where,
.syndicated a:hover .post-id {
  color: var(--ink);
}

/* The response as it arrived. Folded away, because it is for the times the
   formatted view above is not enough — a property with a shape this app guessed
   wrong, or one Micro.blog added since. */
.raw {
  margin-top: 2rem;
  border-top: 1px solid var(--line);
  padding-top: 0.75rem;
}
.raw > summary {
  cursor: pointer;
  list-style: none;
  color: var(--dim);
  font: 500 0.6875rem/1 var(--mono);
  letter-spacing: 0.09em;
  text-transform: uppercase;
}
.raw > summary::-webkit-details-marker {
  display: none;
}
.raw > summary::before {
  content: "▸ ";
}
.raw[open] > summary::before {
  content: "▾ ";
}
.raw > summary:hover {
  color: var(--ink);
}
.raw pre {
  margin: 0.75rem 0 0;
  padding: 0.75rem;
  max-height: 26rem;
  overflow: auto;
  background: var(--raised);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font: 0.6875rem/1.5 var(--mono);
  color: var(--text);
  overflow-wrap: normal;
  white-space: pre;
}

.syndicated .missing {
  opacity: 0.5;
  font-style: italic;
}

/* --- the insert menu ---------------------------------------------------- */

.pop.wide {
  min-width: 22rem;
  gap: 0.9rem;
}
.pop .field {
  display: grid;
  gap: 0.3rem;
}
.pop .field > span {
  color: var(--dim);
  font-size: 0.75rem;
}
.pop .field input[type="text"] {
  width: 100%;
  padding: 0.4rem 0.5rem;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink);
  font: 0.8125rem/1.4 var(--mono);
}
button.mini {
  justify-self: start;
  padding: 0.35rem 0.7rem;
  background: none;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--text);
  font: 0.75rem/1.4 var(--ui);
  cursor: pointer;
}
button.mini:hover:not(:disabled) {
  color: var(--ink);
  border-color: var(--accent);
}
button.mini:disabled {
  opacity: 0.5;
  cursor: default;
}
.insert-status {
  color: var(--dim);
  font: 0.75rem/1.4 var(--mono);
  min-height: 1.2em;
}

.pop .hint {
  margin: 0 0 0.5rem;
  color: var(--dim);
  font: 0.6875rem/1.5 var(--ui);
  opacity: 0.85;
}
.reply-row {
  display: grid;
  grid-template-columns: 4.5rem minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
}
.reply-label {
  color: var(--text);
  font-size: 0.75rem;
}
.retire {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  color: var(--dim);
  font-size: 0.6875rem;
  white-space: nowrap;
  cursor: pointer;
}
.replies-tool > span {
  display: block;
  color: var(--dim);
  font-size: 0.75rem;
  margin-bottom: 0.2rem;
}
