/* twixt. Oat paper and ink, a vermilion seed. Written by Opus 5.5. */
@font-face { font-family: 'Fraunces twixt'; src: url(/fraunces.woff2) format('woff2'); font-display: swap; }

:root {
  --bg: #f2ece0; --card: #fbf8f2; --ink: #231e18; --mute: #7a6e5f; --line: #e2d8c6; --soft: #ece2d0;
  --accent: #d6462a; --accent-ink: #fffaf3; --good: #2f6f52; --warn: #b3361d;
  --serif: 'Fraunces twixt', Georgia, 'Times New Roman', serif;
  --sans: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --r: 14px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #191512; --card: #221d19; --ink: #f0e8dc; --mute: #a39684; --line: #372f28; --soft: #2c251f;
    --accent: #ff6b47; --accent-ink: #1b120d; --good: #7cc3a0; --warn: #ff8a6b;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #191512; --card: #221d19; --ink: #f0e8dc; --mute: #a39684; --line: #372f28; --soft: #2c251f;
  --accent: #ff6b47; --accent-ink: #1b120d; --good: #7cc3a0; --warn: #ff8a6b;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg); color: var(--ink); font: 15px/1.42 var(--sans);
  display: flex; flex-direction: column; overflow: hidden;
  -webkit-text-size-adjust: 100%; -webkit-tap-highlight-color: transparent;
}
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
a { color: inherit; }
[hidden] { display: none !important; }
.grow { flex: 1; }

/* ---------- header ---------- */
#top {
  flex: none; display: flex; align-items: center; gap: 6px; height: 46px; padding: 0 10px;
  border-bottom: 1px solid var(--line); background: var(--bg); position: relative; z-index: 3;
}
#logo { display: flex; align-items: center; gap: 4px; text-decoration: none; margin-right: 4px; }
#logo svg { width: 26px; height: 26px; color: var(--ink); }
#logo .seed { fill: var(--accent); }
#logo span { font: 600 21px/1 var(--serif); letter-spacing: -0.01em; margin-top: -2px; }
#tabs { display: flex; gap: 2px; background: var(--soft); border-radius: 999px; padding: 3px; }
#tabs button { padding: 4px 11px; border-radius: 999px; font-size: 13.5px; color: var(--mute); }
#tabs button[aria-selected="true"] { background: var(--card); color: var(--ink); box-shadow: 0 1px 2px rgb(0 0 0 / .08); }
#b-back { font-size: 14px; color: var(--mute); padding: 6px 4px; }
#b-bell { position: relative; width: 34px; height: 34px; display: grid; place-items: center; border-radius: 50%; color: var(--mute); }
#b-bell svg { width: 21px; height: 21px; }
#unread { position: absolute; top: 3px; right: 1px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px; background: var(--accent); color: var(--accent-ink); font: 700 10px/16px var(--sans); }
#b-me { display: flex; align-items: center; gap: 6px; max-width: 120px; padding: 3px 9px 3px 3px; border-radius: 999px; border: 1px solid var(--line); font-size: 13px; background: var(--card); }
#b-me .av { width: 24px; height: 24px; font-size: 12px; border-radius: 8px; }
#b-me span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#b-tab { width: 30px; height: 30px; display: grid; place-items: center; text-decoration: none; color: var(--mute); border-radius: 50%; font-size: 16px; }
#top button:focus-visible, #top a:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

/* ---------- main column ---------- */
#main { flex: 1; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
.col { max-width: 600px; margin: 0 auto; padding-bottom: 40px; }
.foot { text-align: center; color: var(--mute); font-size: 12px; padding: 18px 12px 30px; }
.foot a { color: var(--mute); }
.empty { color: var(--mute); text-align: center; padding: 26px 18px; font-size: 14px; }
.empty b { display: block; color: var(--ink); font: 600 18px/1.3 var(--serif); margin-bottom: 4px; }

/* composer */
.compose { display: flex; gap: 10px; padding: 12px 12px 10px; border-bottom: 1px solid var(--line); background: var(--card); }
.compose .box { flex: 1; min-width: 0; }
.compose textarea {
  width: 100%; resize: none; border: 0; outline: 0; background: transparent; padding: 5px 0 4px;
  font-size: 16px; line-height: 1.38; min-height: 30px; max-height: 120px; display: block;
}
.compose textarea::placeholder { color: var(--mute); }
.compose .row { display: flex; align-items: center; gap: 8px; margin-top: 4px; min-height: 30px; }
.compose .as { font-size: 12.5px; color: var(--mute); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.compose .as button { text-decoration: underline; text-underline-offset: 2px; color: var(--mute); font-size: 12.5px; }
.compose .count { font-size: 12.5px; color: var(--mute); font-variant-numeric: tabular-nums; }
.compose .count.low { color: var(--warn); font-weight: 600; }
.compose .msg { font-size: 13px; color: var(--warn); margin-top: 6px; }
.compose.idle .row .as { display: block; }
.btn {
  background: var(--accent); color: var(--accent-ink); border-radius: 999px; padding: 6px 16px;
  font-weight: 650; font-size: 14px; white-space: nowrap; flex: none;
}
.btn:disabled { opacity: .45; cursor: default; }
.btn.ghost { background: transparent; color: var(--ink); border: 1px solid var(--line); }
.btn.quiet { background: var(--soft); color: var(--ink); }
#live { font-size: 12px; color: var(--mute); display: flex; gap: 4px; align-items: center; padding: 0 4px; font-variant-numeric: tabular-nums; }
#live i { width: 7px; height: 7px; border-radius: 50%; background: var(--good); display: inline-block; }
#live.off i { background: var(--mute); }
.vh { font: 600 18px/1.2 var(--serif); margin: 0; padding: 12px 14px 8px; border-bottom: 1px solid var(--line); }
input[type=checkbox] { accent-color: var(--accent); width: 16px; height: 16px; }

/* posts */
.post { display: flex; gap: 10px; padding: 11px 12px 6px; border-bottom: 1px solid var(--line); cursor: pointer; position: relative; }
.post:hover { background: color-mix(in srgb, var(--card) 60%, transparent); }
.post.fresh { animation: fresh 1.6s ease-out; }
@keyframes fresh { from { background: color-mix(in srgb, var(--accent) 14%, transparent); } }
.post.focus { cursor: default; background: var(--card); }
.post.focus .text { font-size: 17px; }
.post.gone .text { color: var(--mute); font-style: italic; }
.av {
  flex: none; width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center;
  font: 600 17px/1 var(--serif); color: #2a2018; text-transform: lowercase;
}
.av.g { background: transparent !important; border: 1.5px dashed var(--mute); color: var(--mute); }
.pb { flex: 1; min-width: 0; }
.ph { display: flex; align-items: baseline; gap: 5px; font-size: 13.5px; color: var(--mute); white-space: nowrap; overflow: hidden; }
.ph .dn { color: var(--ink); font: 600 15px/1.2 var(--serif); overflow: hidden; text-overflow: ellipsis; flex: 0 1 auto; min-width: 0; }
.ph .hn { overflow: hidden; text-overflow: ellipsis; flex: 0 1 auto; min-width: 0; }
.ph a { text-decoration: none; }
.ph a:hover .dn { text-decoration: underline; }
.badge { font-size: 10.5px; border: 1px dashed var(--mute); border-radius: 6px; padding: 0 5px; line-height: 16px; color: var(--mute); flex: none; }
.badge.pend { border-style: solid; }
.re { font-size: 12.5px; color: var(--mute); margin-top: 1px; }
.re a { color: var(--mute); }
.text { margin-top: 2px; white-space: pre-wrap; overflow-wrap: anywhere; word-break: break-word; }
.text a { color: var(--accent); text-decoration: none; }
.text a:hover { text-decoration: underline; }
.acts { display: flex; gap: 2px; margin: 4px 0 0 -8px; }
.acts button, .acts a {
  display: flex; align-items: center; gap: 4px; padding: 5px 8px; border-radius: 999px; color: var(--mute);
  font-size: 13px; font-variant-numeric: tabular-nums; text-decoration: none; min-width: 44px;
}
.acts svg { width: 17px; height: 17px; }
.acts button:hover { background: var(--soft); color: var(--ink); }
.acts .lk.on { color: var(--accent); }
.acts .lk.on svg path { fill: currentColor; }
.acts .more { margin-left: auto; min-width: 0; }
.nest {
  display: block; width: 100%; height: 150px; border: 1px solid var(--line); border-radius: 12px; margin-top: 8px;
  background: var(--bg); overflow: hidden;
}
.more-btn { display: block; margin: 12px auto; }

/* profile */
.prof { padding: 16px 14px 12px; border-bottom: 1px solid var(--line); background: var(--card); }
.prof .top { display: flex; gap: 12px; align-items: center; }
.prof .av { width: 58px; height: 58px; border-radius: 18px; font-size: 27px; }
.prof h1 { font: 600 22px/1.15 var(--serif); margin: 0; overflow-wrap: anywhere; }
.prof .hn { color: var(--mute); font-size: 14px; }
.prof .bio { margin: 10px 0 6px; white-space: pre-wrap; overflow-wrap: anywhere; }
.prof .meta { color: var(--mute); font-size: 13px; display: flex; gap: 12px; flex-wrap: wrap; }
.prof .meta b { color: var(--ink); }
.prof .top .grow + * { flex: none; }

/* notifications */
.note { display: flex; gap: 10px; padding: 11px 12px; border-bottom: 1px solid var(--line); cursor: pointer; }
.note .k { width: 38px; flex: none; display: grid; place-items: center; color: var(--accent); }
.note .k svg { width: 20px; height: 20px; }
.note .w { min-width: 0; }
.note .w b { font-family: var(--serif); font-weight: 600; }
.note .q { color: var(--mute); font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.note.new { background: color-mix(in srgb, var(--accent) 7%, var(--card)); }

/* new-posts pill */
#pill {
  position: fixed; top: 54px; left: 50%; transform: translateX(-50%); z-index: 4;
  background: var(--accent); color: var(--accent-ink); border-radius: 999px; padding: 5px 14px; font-size: 13px; font-weight: 650;
  box-shadow: 0 3px 12px rgb(0 0 0 / .18); cursor: pointer;
}

/* sheet */
#sheet { position: fixed; inset: 0; z-index: 10; background: rgb(20 14 8 / .42); display: flex; align-items: flex-end; justify-content: center; }
#sheet-in {
  background: var(--card); width: 100%; max-width: 460px; max-height: calc(100% - 20px); overflow-y: auto;
  border-radius: 18px 18px 0 0; padding: 16px 16px calc(16px + env(safe-area-inset-bottom));
  box-shadow: 0 -6px 30px rgb(0 0 0 / .2);
}
@media (min-height: 600px) and (min-width: 600px) { #sheet { align-items: center; } #sheet-in { border-radius: 18px; } }
#sheet h2 { font: 600 20px/1.2 var(--serif); margin: 0 0 4px; }
#sheet p { margin: 6px 0; color: var(--mute); font-size: 13.5px; }
#sheet label { display: block; font-size: 12.5px; color: var(--mute); margin: 10px 0 3px; }
#sheet input[type=text], #sheet input[type=password], #sheet textarea {
  width: 100%; border: 1px solid var(--line); background: var(--bg); border-radius: 10px; padding: 8px 10px; font-size: 16px; outline: 0;
}
#sheet input:focus, #sheet textarea:focus { border-color: var(--accent); }
#sheet .btns { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; align-items: center; }
#sheet .linkish { color: var(--mute); text-decoration: underline; font-size: 13px; text-underline-offset: 2px; }
#sheet .err { color: var(--warn); font-size: 13px; min-height: 18px; margin-top: 8px; }
#sheet .code { font: 600 20px/1.3 ui-monospace, Consolas, monospace; letter-spacing: .04em; background: var(--bg); border: 1px dashed var(--accent); border-radius: 10px; padding: 10px; text-align: center; user-select: all; margin: 10px 0; }
#sheet .list { display: flex; flex-direction: column; gap: 2px; margin-top: 8px; }
#sheet .list button, #sheet .list a { text-align: left; padding: 10px 8px; border-radius: 10px; text-decoration: none; display: block; }
#sheet .list button:hover, #sheet .list a:hover { background: var(--soft); }
#sheet .list .danger { color: var(--warn); }
#sheet .check { display: flex; gap: 8px; align-items: center; font-size: 13.5px; color: var(--mute); margin-top: 10px; }

#toast {
  position: fixed; bottom: 14px; left: 50%; transform: translateX(-50%); z-index: 12; max-width: 90%;
  background: var(--ink); color: var(--bg); border-radius: 12px; padding: 8px 14px; font-size: 13.5px; box-shadow: 0 4px 16px rgb(0 0 0 / .2);
}

/* small card (480 and phones) */
@media (max-width: 520px) {
  body { font-size: 14.5px; }
  #top { padding: 0 6px 0 8px; gap: 4px; }
  #logo span { font-size: 19px; }
  #tabs button { padding: 4px 9px; font-size: 13px; }
  #b-me { max-width: 92px; }
}
@media (max-width: 400px) {
  #logo span { display: none; }
}

/* nested embeds: twixt inside twixt */
body.embed { font-size: 13.5px; background: var(--bg); }
body.embed #top { display: none; }
body.embed #main { overflow: hidden; }
body.embed .post { padding: 8px 10px 2px; border: 0; }
body.embed .av { width: 30px; height: 30px; border-radius: 9px; font-size: 14px; }
body.embed .acts { pointer-events: none; }
body.embed .acts .more { display: none; }
body.embed .tag { display: flex; align-items: center; gap: 4px; padding: 6px 10px 0; color: var(--mute); font-size: 11.5px; }
body.embed .tag svg { width: 14px; height: 14px; color: var(--ink); }
body.embed .tag .seed { fill: var(--accent); }
body.embed .prof { padding: 10px; }
body.embed .prof .av { width: 40px; height: 40px; font-size: 19px; border-radius: 12px; }
body.embed .prof h1 { font-size: 17px; }

/* wide tab */
@media (min-width: 980px) {
  .side { position: fixed; left: calc(50% - 300px - 250px); top: 70px; width: 220px; color: var(--mute); font-size: 14px; }
  .side h2 { font: 600 26px/1.15 var(--serif); color: var(--ink); margin: 0 0 8px; }
}
@media (max-width: 979px) { .side { display: none; } }
