/* Woodstar's visual system.
 *
 * Derived from the mark: a violet hummingbird rising from an amber flame.
 * So violet carries identity and action, ember carries warmth and attention
 * (the fave, the unread), and every neutral is warmed a few degrees toward
 * the violet so the greys belong to the bird rather than sitting beside it.
 * Accent is spent sparingly — it earns its meaning by being rare.
 *
 * There is no webfont. The one-paint law (see CLAUDE.md) and the no-build
 * rule both forbid holding the first frame on someone else's server, so the
 * personality lives in scale, weight and spacing instead of in a face.
 *
 * Structure: one surface per view. The page has a tint, the view is a single
 * card on it, and everything inside is separated by hairlines — never by
 * nested boxes. That rule is what makes settings, feeds, notifications and
 * profiles read as one product.
 */

:root {
  --bg: #f2f1f6;
  --surface: #ffffff;
  --surface-2: #f6f4fa;   /* hover wash, quoted blocks */
  --ink: #16141d;
  --ink-2: #56526a;       /* secondary text */
  --ink-3: #7c7790;       /* meta: times, handles, captions */
  --line: #e3e0eb;        /* container edges */
  --hairline: #eceaf2;    /* separators inside a surface */
  --accent: #6b2fcf;      /* gorget violet */
  --accent-ink: #55229f;  /* pressed / on-wash text */
  --on-accent: #ffffff;   /* text and glyphs sitting on a filled accent */
  --accent-wash: #f2edfd;
  --ember: #c2711a;       /* the flame: faves, unread */
  --ok: #0f7a57;
  --danger: #c0362c;

  --r-sm: 9px;
  --r: 12px;
  --r-lg: 16px;
  --pill: 999px;
  --gutter: 16px;
  --rail: 264px;
  --col: 660px;
  --bar-h: 52px;    /* the phone's top bar */
  --tabs-h: 54px;   /* and its three tabs */
  --shadow: 0 10px 30px rgb(22 20 29 / 0.10), 0 2px 6px rgb(22 20 29 / 0.06);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b0a0f;
    --surface: #131119;
    --surface-2: #1b1926;
    --ink: #eceaf3;
    --ink-2: #a8a3ba;
    --ink-3: #837e96;
    --line: #272433;
    --hairline: #201e2b;
    --accent: #b39bff;
    --accent-ink: #c9b8ff;
    /* The accent lightens in the dark, so what sits on it has to darken. */
    --on-accent: #17121f;
    --accent-wash: #221d33;
    --ember: #e9a94a;
    --ok: #3fcb9b;
    --danger: #f0736a;
    --shadow: 0 12px 32px rgb(0 0 0 / 0.5), 0 2px 6px rgb(0 0 0 / 0.4);
  }
}

* { box-sizing: border-box; }

/* Double-tapping the UI must not zoom the page. A feed is a column of small
   targets and a mis-hit shouldn't leave you at 2x with no obvious way back.
   `manipulation` keeps panning and pinch-zoom — the accessibility ones —
   and drops only the double-tap gesture (and with it iOS's 300ms tap
   delay). NOT user-scalable=no on the viewport tag: that would take pinch
   away from people who need it. */
html, body { touch-action: manipulation; }
/* The gutter is reserved whether or not a scrollbar draws, so short and
   long views stop shifting sideways against each other. */
html { scrollbar-gutter: stable; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.5 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4 { font-weight: 700; letter-spacing: -0.018em; }
h2 { font-size: 20px; margin: 8px 0 12px; }
h3 { font-size: 15px; margin: 0 0 8px; letter-spacing: -0.01em; }
h2 .fine { font-weight: 400; }
a { color: var(--accent); text-underline-offset: 2px; }

/* Lucide icons (ui/dom.js icon()): sized like the surrounding text and
   seated on its baseline, the way the old font glyphs sat. */
svg.icon { width: 1em; height: 1em; vertical-align: -0.125em; }

/* One focus treatment, everywhere. */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ---------------------------------------------------------------- controls */

input, textarea, select {
  width: 100%;
  padding: 10px 12px;
  margin: 4px 0 10px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  /* 16px minimum: anything smaller makes iOS Safari zoom the viewport on focus. */
  font-size: 16px;
}
input::placeholder, textarea::placeholder { color: var(--ink-3); }
input:focus, textarea:focus {
  outline: 2px solid var(--accent);
  outline-offset: -1px;
  border-color: var(--accent);
}
/* Checkboxes are not text fields — the blanket width above used to stretch
   them across the row and orphan their label. */
input[type="checkbox"], input[type="radio"] {
  width: auto;
  margin: 0;
  accent-color: var(--accent);
}
label {
  font-size: 13px;
  color: var(--ink-2);
  font-weight: 500;
}
label.fine { display: flex; align-items: center; gap: 8px; }

button {
  font: inherit;
  cursor: pointer;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  border-radius: var(--pill);
  padding: 7px 15px;
  font-weight: 550;
  transition: background-color 0.12s ease, color 0.12s ease, border-color 0.12s ease;
}
button:hover { background: var(--surface-2); }
button.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-accent);
  font-weight: 600;
}
button.primary:hover { background: var(--accent-ink); border-color: var(--accent-ink); }
button.primary:disabled { opacity: 0.45; cursor: default; }
button.primary:disabled:hover { background: var(--accent); border-color: var(--accent); }
button.linkish {
  border: none;
  background: none;
  color: var(--ink-3);
  padding: 3px 6px;
  font-weight: inherit;
}
button.linkish:hover { color: var(--accent); background: none; }
button.linkish.faved { color: var(--ember); }
/* Destructive intent shows on approach, not at rest — a permanently red
   "remove" reads as an alarm that never stops. */
button.linkish.danger { color: var(--ink-3); }
button.linkish.danger:hover { color: var(--danger); }
button.danger:not(.linkish) {
  color: var(--danger);
  border-color: color-mix(in srgb, var(--danger) 40%, var(--line));
  background: none;
}
button.danger:not(.linkish):hover { background: color-mix(in srgb, var(--danger) 8%, transparent); }
button.big { width: 100%; padding: 12px; font-size: 16px; margin: 6px 0; }

.fine { font-size: 12.5px; color: var(--ink-3); }
.muted { color: var(--ink-2); }
.error { color: var(--danger); font-size: 13px; }
/* An error line with nothing to say takes no room — anywhere. Left to its
   default paragraph margins it was quietly holding a gap open under the DM
   composer. */
p.error:empty, p.fine:empty { display: none; }
code.keyhex, .keyhex {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  color: var(--ink-3);
  word-break: break-all;
  display: block;
  margin: 6px 0;
}
.upload-bar { width: 100%; accent-color: var(--accent); }
/* Something is still happening: a slow pulse, not a spinner — nothing is
   stuck, so nothing should look like it is spinning to catch up. */
.pulse {
  display: inline-block;
  width: 0.6em;
  height: 0.6em;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.4;
  animation: pulse 2s ease-in-out infinite;
}
@keyframes pulse { 50% { opacity: 1; } }
/* Paired with opacity:0 and a delay: a thing that admits it is waiting only
   after the wait is worth admitting. */
@keyframes fade-in { to { opacity: 1; } }

/* ------------------------------------------------------------------- shell */

.shell { display: flex; align-items: flex-start; }
/* A phantom column the width of the rail, so the reading column sits in the
   middle of the window rather than the middle of what's left over. */
.shell::after { content: ""; flex: 0 1 var(--rail); }
/* ...except where the view takes the whole window: nothing to balance then,
   and no measure to hold it to. */
.shell.wide::after { display: none; }
.shell.wide .main { max-width: none; }
/* ui/shell.js keeps all three navigations in one box; this is the box. */
.chrome {
  flex: 0 0 var(--rail);
  position: sticky;
  top: 0;
  height: 100vh;
}

.main {
  flex: 1 1 auto;
  min-width: 0;
  max-width: var(--col);
  margin: 0 auto;
  padding: 16px;
}
/* One surface per view: every view root becomes the single card the page
   carries. Nothing inside it is boxed again. */
.main > div {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  /* Its own formatting context, so a child's top margin can't escape and
     push the surface down the page. */
  display: flow-root;
  margin-bottom: 80px;
}
/* A view that is an app screen rather than a document takes the window's
   height, and its own body scrolls instead of the page. */
.main > div.fill {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 32px);
  margin-bottom: 0;
  overflow: hidden;
}
/* Status lines that have nothing to say take no room. */
.main > div > p:empty, .main > div > div:empty { display: none; }
/* ...and the ones that do sit in the middle of the space they're explaining,
   with room around them. One level down as well as one: a view's status line
   is usually its own child, but a results list keeps its own. */
.main > div > p.muted,
.main > div > div > p.muted {
  margin: 0;
  padding: 40px var(--gutter);
  color: var(--ink-3);
  text-align: center;
}

/* The rail: labelled on a wide screen, icons on a medium one, gone on a
   phone (ui/shell.js renders all three; only one is ever displayed). */
.rail {
  height: 100%;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 18px 14px 16px;
}
.rail-mark {
  display: flex;
  align-items: center;
  gap: 10px;
  border: none;
  background: none;
  padding: 8px 10px;
  margin-bottom: 10px;
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.rail-mark:hover { background: none; color: var(--accent); }
.rail-items { display: flex; flex-direction: column; gap: 2px; }
.rail-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  border: none;
  background: none;
  font-size: 15px;
  font-weight: 500;
  padding: 10px 12px;
  border-radius: var(--pill);
  text-align: left;
  color: var(--ink-2);
}
.rail-item svg.icon { width: 20px; height: 20px; flex: none; }
.rail-item:hover { background: var(--surface-2); color: var(--ink); }
.rail-item.active {
  background: var(--accent-wash);
  color: var(--accent-ink);
  font-weight: 650;
}
.rail-label { flex: 1; text-align: left; }
.compose-rail {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  margin-top: 14px;
  padding: 12px;
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-accent);
  font-weight: 650;
  font-size: 15px;
}
.compose-rail .rail-label { flex: none; }
.compose-rail:hover { background: var(--accent-ink); border-color: var(--accent-ink); }
.compose-rail svg.icon { width: 18px; height: 18px; }

/* The identity sits at the foot of the rail; its popover box is the flex
   child, so that is what the auto margin has to push down. */
.rail > .menu-anchor { margin-top: auto; width: 100%; }
.rail-you {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 10px;
  border: none;
  background: none;
  border-radius: var(--pill);
  text-align: left;
}
.rail-you:hover { background: var(--surface-2); }
.rail-you-names { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.3; }
.rail-you-names strong {
  font-size: 14.5px;
  font-weight: 650;
  letter-spacing: -0.01em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.rail-you-names .handle { font-size: 12.5px; color: var(--ink-3); font-weight: 400; }
/* The menu opens upward, so the caret points that way at rest and turns
   over when it's open — it always shows where the menu is going. */
.rail-you > svg.icon {
  color: var(--ink-3);
  flex: none;
  transform: rotate(180deg);
  transition: transform 0.16s ease;
}
.rail-you[aria-expanded="true"] > svg.icon { transform: rotate(0deg); }

/* Unread: a count where there's room for one, a dot where there isn't. */
.nav-count {
  margin-left: auto;
  background: var(--accent);
  color: var(--on-accent);
  font-size: 11.5px;
  font-weight: 650;
  border-radius: var(--pill);
  padding: 1px 7px;
}
.dot {
  position: absolute;
  top: 8px;
  right: calc(50% - 14px);
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--ember);
  border: 2px solid var(--surface);
}

/* Mobile chrome: rendered always, shown only under 700px. */
.bar, .tabbar, .compose-fab { display: none; }

/* ------------------------------------------------------------------- menus */

.menu-anchor { position: relative; display: flex; }
/* A popover is new DOM every time it opens, so this is an animation, not a
   transition — and it moves from wherever it's about to sit. */
@keyframes menu-rise { from { opacity: 0; transform: translateY(7px) scale(0.97); } }
@keyframes menu-drop { from { opacity: 0; transform: translateY(-7px) scale(0.97); } }
.menu {
  position: absolute;
  z-index: 60;
  min-width: 232px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: var(--shadow);
}
/* In the rail the trigger sits at the bottom, so its menu opens upward. */
.rail .menu {
  bottom: calc(100% + 8px);
  left: 0;
  transform-origin: bottom left;
  animation: menu-rise 0.15s ease-out;
}
.bar .menu { top: calc(100% + 8px); animation: menu-drop 0.15s ease-out; }
.bar .menu-account { transform-origin: top left; }
.bar .menu-more { transform-origin: top right; }
.bar .menu-account { left: -4px; }
.bar .menu-more { right: -4px; }
.menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 40px;
  text-align: left;
  border: none;
  background: none;
  border-radius: var(--r-sm);
  padding: 8px 10px;
  font-weight: 500;
  color: var(--ink);
}
.menu-item:hover { background: var(--surface-2); }
.menu-item svg.icon { width: 18px; height: 18px; color: var(--ink-3); flex: none; }
.menu-sep { height: 1px; background: var(--hairline); margin: 6px 4px; }
/* Who this menu belongs to — only where the trigger doesn't already say so. */
.menu-who { display: flex; align-items: center; gap: 10px; padding: 8px 10px 10px; }
.menu-who-id { display: flex; flex-direction: column; line-height: 1.3; min-width: 0; }
.menu-who-id strong { font-size: 14.5px; font-weight: 650; letter-spacing: -0.01em; }
.menu-who-id .handle { font-size: 12.5px; color: var(--ink-3); }
.rail .menu-who { display: none; }

/* ---------------------------------------------------------------- page head */

.pagehead {
  position: sticky;
  top: 0;
  z-index: 12;
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 15px var(--gutter) 13px;
  background: var(--surface);
  background: color-mix(in srgb, var(--surface) 86%, transparent);
  -webkit-backdrop-filter: blur(14px) saturate(1.6);
  backdrop-filter: blur(14px) saturate(1.6);
  /* No rule beneath: the blur already marks the head while scrolling, and
     the feed's day marks draw the only hairlines a timeline needs. */
  border-radius: var(--r-lg) var(--r-lg) 0 0;
}
.pagehead h2 { margin: 0; font-size: 20px; }
.pagehead-note { font-size: 13px; color: var(--ink-3); }
.pagehead .backlink { order: -1; align-self: center; margin-left: -6px; }

/* -------------------------------------------------------------------- feed */

/* Chronology is this product's whole argument, so the timeline says it out
   loud: one quiet rule per day, and nothing else marking time. */
.daymark {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 18px var(--gutter) 8px;
  font-size: 11.5px;
  font-weight: 650;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.daymark::after { content: ""; flex: 1; height: 1px; background: var(--hairline); }

/* A card is a block inside the view's surface: hairline below, no box. */
.card {
  padding: 14px var(--gutter);
  border-bottom: 1px solid var(--hairline);
  /* positioned so an attached .user-menu-pop anchors to the card, not the page */
  position: relative;
}
/* The surface closes itself: the last block in any list drops its rule so
   it never doubles up with the container's own edge. */
.card:last-child, .repost:last-child, .composer:last-child { border-bottom: none; }

/* A post hangs off one left edge: avatar in its own gutter, name, text and
   actions in a single column beside it. */
.card.post {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr);
  column-gap: 12px;
  align-items: start;
}
.post-main { min-width: 0; }
.card header {
  display: flex;
  align-items: baseline;
  gap: 6px;
  min-width: 0;
}
.author { display: flex; align-items: baseline; gap: 5px; min-width: 0; }
.author-name {
  border: none;
  background: none;
  padding: 0;
  font-size: 15px;
  font-weight: 650;
  letter-spacing: -0.012em;
  color: var(--ink);
  cursor: pointer;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.author-name:hover { text-decoration: underline; background: none; }
/* Bare hex never gets a name's weight, wherever it renders. */
.name.key {
  color: var(--ink-3);
  font-family: ui-monospace, Menlo, monospace;
  font-size: 13px;
  font-weight: 500;
}
/* The handle a custom name displaced — beside the name, smaller and quieter. */
.author-handle { color: var(--ink-3); font-size: 13.5px; }
.handle-sub { font-weight: 400; margin-left: 5px; color: var(--ink-3); }
/* Both quiet: the address is the signal, these only annotate it. */
.author .confirmed, .author .unconfirmed { color: var(--ink-3); font-size: 11px; }
.author .confirmed svg.icon, .author .unconfirmed svg.icon { width: 13px; height: 13px; }
.author .unconfirmed { opacity: 0.65; }

.card header .time {
  color: var(--ink-3);
  font-size: 13.5px;
  border: none;
  background: none;
  padding: 0;
  cursor: pointer;
  white-space: nowrap;
  font-weight: 400;
}
.card header .time::before { content: "·"; margin-right: 6px; }
.card header .time:hover { color: var(--accent); background: none; }
.card header .via { color: var(--ink-3); font-size: 12px; margin-left: 4px; white-space: nowrap; }
a.via { text-decoration: none; }
a.via:hover { text-decoration: underline; color: var(--accent); }

/* The kebab is on every post, in the same place — but it waits to be
   approached on pointer devices, so a feed is text and not a column of dots. */
.kebab { margin-left: auto; padding: 2px 4px; }
.card header .kebab { font-size: 15px; color: var(--ink-3); }
@media (hover: hover) and (pointer: fine) {
  .card.post .kebab { opacity: 0; transition: opacity 0.12s ease; }
  .card.post:hover .kebab,
  .card.post:focus-within .kebab { opacity: 1; }
}

.content {
  margin: 3px 0 0;
  font-size: 16px;
  line-height: 1.5;
  letter-spacing: -0.003em;
  white-space: pre-wrap;
  word-wrap: break-word;
}
.mention { color: var(--accent); font-weight: 550; }
.mention.key { color: var(--ember); font-family: ui-monospace, Menlo, monospace; font-size: 13px; }
/* A tag reads like a mention — same accent, same weight, underlined only
   when you reach for it. It links into search, so it takes the same reset. */
.hashtag { color: var(--accent); font-weight: 550; }
button.mention, button.hashtag { border: none; background: none; padding: 0; cursor: pointer; }
button.mention:hover, button.hashtag:hover { text-decoration: underline; background: none; }
.stamp { font-size: 12px; }

.repost { border-bottom: 1px solid var(--hairline); }
.repost > .card.post { border-bottom: none; padding-top: 2px; }
.repost-note, .reply-note {
  color: var(--ink-3);
  font-size: 13px;
  font-weight: 500;
  padding: 12px var(--gutter) 0 calc(var(--gutter) + 52px);
}
/* Not a flex box: flex would eat the spaces between "in reply" and the
   author's name, which arrive as separate text nodes. */
.reply-note { padding: 0; margin: 2px 0 0 -6px; }

/* Nested replies keep the parent's left edge and step in from it. */
.indent { margin-left: 0; }
.indent > .card.post { padding-left: calc(var(--gutter) + 26px); }

.card footer { display: flex; gap: 2px; margin: 8px 0 -4px -8px; }
.card footer button {
  font-size: 15px;
  padding: 6px 9px;
  border-radius: var(--r-sm);
  color: var(--ink-3);
}
.card footer button svg.icon { width: 17px; height: 17px; }
.card footer button:hover { background: var(--surface-2); color: var(--ink); }
.card footer button.faved:hover { color: var(--ember); }

/* Attachments: one image gets the column, several share a grid. */
.media { max-width: 100%; border-radius: var(--r); margin-top: 8px; }
.media-grid { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.media-thumb {
  width: 120px;
  height: 120px;
  object-fit: cover;
  border-radius: var(--r);
  cursor: zoom-in;
  border: 1px solid var(--line);
}
.media-grid > .media-thumb:only-child {
  width: 100%;
  height: auto;
  max-height: 440px;
  object-fit: cover;
}

/* Unfurl: as modest as a media thumb — a square beside clamped text, never
   a full-width hero. */
.link-card {
  display: flex;
  align-items: stretch;
  max-width: 460px;
  margin-top: 10px;
  border: 1px solid var(--line);
  border-radius: var(--r);
  overflow: hidden;
  text-decoration: none;
  color: var(--ink);
  background: var(--surface);
}
.link-card:hover { background: var(--surface-2); border-color: var(--ink-3); }
.link-card-shot { position: relative; display: flex; flex: none; }
.link-card-image { width: 108px; height: 108px; flex: none; object-fit: cover; }
/* Video cards are the square's one exception: a 16:9 still cropped square is
   mostly somebody's chin. Wider — still a thumbnail, never a hero. The still
   is letterboxed rather than cropped, so the shot keeps the card's full edge
   the way every other card image does, and the whole frame survives. */
.link-card.is-video .link-card-shot { width: 160px; background: #000; }
.link-card.is-video .link-card-image {
  width: 160px;
  height: 100%;
  min-height: 90px;
  object-fit: contain;
}
.link-card-play {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.link-card-play .icon {
  width: 36px;
  height: 36px;
  padding: 8px;
  border-radius: var(--pill);
  background: rgb(10 8 14 / 0.6);
  color: #fff;
  fill: currentColor;
  stroke: none;
  transition: background 120ms ease, transform 120ms ease;
}
.link-card.is-video:hover .link-card-play .icon {
  background: rgb(10 8 14 / 0.82);
  transform: scale(1.08);
}
.link-card-text { display: flex; flex-direction: column; justify-content: center; padding: 10px 12px; min-width: 0; }
.link-card-title {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-weight: 650;
  font-size: 14px;
  letter-spacing: -0.01em;
}
.link-card-desc {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  color: var(--ink-2);
  font-size: 13px;
  margin-top: 2px;
}
.link-card-domain { display: block; color: var(--ink-3); font-size: 12px; margin-top: 4px; }

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgb(10 8 14 / 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
}
.lightbox-img { max-width: 92vw; max-height: 92vh; border-radius: var(--r); cursor: default; }
/* The player: 16:9, as big as the viewport allows, never past either edge. */
.lightbox-embed-box {
  width: min(92vw, calc(92vh * 16 / 9));
  aspect-ratio: 16 / 9;
  border-radius: var(--r);
  overflow: hidden;
  background: #000;
}
.lightbox-embed { width: 100%; height: 100%; border: 0; display: block; }
.lightbox-close, .lightbox-nav {
  position: absolute;
  background: rgb(255 255 255 / 0.14);
  color: #fff;
  border: none;
  border-radius: var(--pill);
  width: 44px;
  height: 44px;
  font-size: 20px;
  cursor: pointer;
}
.lightbox-close { top: 20px; right: 20px; }
.lightbox-nav.prev { left: 16px; top: 50%; transform: translateY(-50%); }
.lightbox-nav.next { right: 16px; top: 50%; transform: translateY(-50%); }
.lightbox-close:hover, .lightbox-nav:hover { background: rgb(255 255 255 / 0.26); }

/* ----------------------------------------------------------- notifications */

/* Same shape as a post: a marker where the avatar would be, then the line. */
.card.note {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr);
  column-gap: 12px;
  align-items: start;
  font-size: 15px;
}
.note-mark { display: flex; justify-content: center; padding-top: 1px; color: var(--ink-3); }
.note-mark svg.icon { width: 20px; height: 20px; }
.note-fave .note-mark { color: var(--ember); }
.note-repost .note-mark { color: var(--ok); }
.note-dm .note-mark { color: var(--accent); }
.note-quote .note-mark { color: var(--ink-3); }
.note-main strong { font-weight: 650; letter-spacing: -0.01em; }

.quoted-post {
  display: block;
  width: 100%;
  text-align: left;
  margin-top: 8px;
  padding: 9px 12px;
  border: 1px solid var(--hairline);
  border-radius: var(--r);
  background: var(--surface-2);
  cursor: pointer;
  color: var(--ink-2);
  font-weight: 400;
}
.quoted-post:hover { border-color: var(--line); background: var(--surface-2); }
.quoted-post .content { margin: 0; font-size: 14.5px; }

/* A post carried inside another. Same family as .quoted-post (the
   notification snippet), with room for an author line and one thumbnail. */
.quote-card {
  display: block;
  width: 100%;
  margin-top: 10px;
  padding: 10px 12px;
  text-align: left;
  font: inherit;
  color: inherit;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 12px;
  cursor: pointer;
}
.quote-card:not(.quote-card-inert):hover { border-color: var(--ink-3); }
/* Inside the compose sheet the card is a plain div (ui/quotecard.js): there
   is nothing to press, so nothing hovers and nothing points. */
.quote-card-inert { cursor: default; }
.quote-head { display: flex; align-items: center; gap: 6px; margin-bottom: 4px; }
.quote-name { font-weight: 600; font-size: 14px; }
.quote-time { font-size: 13px; color: var(--ink-3); }
.quote-card .content { display: block; margin: 0; font-size: 14.5px; }
.quote-media {
  display: block;
  max-height: 180px;
  max-width: 100%;
  margin-top: 8px;
  border-radius: 8px;
  object-fit: cover;
}
.petname-ask input { width: 160px; margin: 0; padding: 4px 8px; }

/* "N new posts" — the one thing allowed to float over a feed, so it takes the
   accent fill and rides just under the sticky head. */
.new-posts-pill {
  display: block;
  position: sticky;
  top: 60px;
  z-index: 11;
  margin: 10px auto;
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-accent);
  font-weight: 650;
  box-shadow: var(--shadow);
}
.new-posts-pill:hover { background: var(--accent-ink); border-color: var(--accent-ink); }
.new-posts-pill[hidden] { display: none; }

/* ---------------------------------------------------------------- composer */

.composer {
  padding: 14px var(--gutter);
  border-bottom: 1px solid var(--hairline);
  position: relative;
  cursor: text;
}
.composer textarea {
  min-height: 44px;
  resize: none;
  overflow: hidden;
  border: none;
  padding: 4px 0;
  margin: 0;
  background: none;
  font-size: 16px;
  line-height: 1.5;
}
.composer textarea:focus { outline: none; border: none; }
.composer-row { display: flex; align-items: center; gap: 12px; justify-content: flex-end; }
.composer .composer-row, .composer button { cursor: default; }
/* The reply-gate dropdown sits quietly in the row — a control, not a form
   field, so the shared full-width select styling doesn't apply. */
select.gate-pick {
  width: auto;
  margin: 0;
  padding: 4px 2px;
  border: none;
  background: none;
  color: var(--ink-2);
  cursor: pointer;
}
.count { font-size: 12px; color: var(--ink-3); }
.count.over { color: var(--danger); }

/* --- attachments: the strip, the drop target, the progress ------------- */

.attach-strip { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 2px; }
.attach {
  position: relative;
  width: 88px;
  height: 88px;
  border-radius: var(--r);
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--surface-2);
}
.attach-thumb { width: 100%; height: 100%; object-fit: cover; display: block; }
/* Uploading: the picture is already there, dimmed, with the bytes crossing
   the bottom edge — nothing to read, just something visibly happening. */
.attach:has(.attach-progress) .attach-thumb { opacity: 0.55; }
.attach-progress {
  position: absolute;
  inset: auto 0 0 0;
  height: 3px;
  background: color-mix(in srgb, var(--ink) 14%, transparent);
}
.attach-bar { height: 100%; background: var(--accent); transition: width 0.14s linear; }
.attach.error { border-color: color-mix(in srgb, var(--danger) 45%, var(--line)); }
.attach.error .attach-thumb { opacity: 0.35; }
.attach-failed {
  position: absolute;
  inset: auto 0 0 0;
  padding: 3px 6px;
  font-size: 11px;
  font-weight: 600;
  text-align: center;
  color: #fff;
  background: var(--danger);
}
.attach-remove {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 22px;
  height: 22px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 50%;
  background: rgb(12 10 16 / 0.62);
  color: #fff;
}
.attach-remove svg.icon { width: 13px; height: 13px; }
.attach-remove:hover { background: rgb(12 10 16 / 0.82); }

/* Dropping: the target says so, and says it once. */
.drop-hint {
  display: none;
  position: absolute;
  inset: 6px;
  z-index: 20;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 2px dashed var(--accent);
  border-radius: var(--r);
  background: color-mix(in srgb, var(--accent-wash) 88%, transparent);
  color: var(--accent-ink);
  font-weight: 650;
  font-size: 14px;
  pointer-events: none;
}
.composer.dropping .drop-hint { display: flex; }
/* The conversation pane has no hint element of its own; it tints instead. */
.dm-thread.dropping { background: var(--accent-wash); }

.typeahead {
  position: absolute;
  left: 12px;
  min-width: 232px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  box-shadow: var(--shadow);
  padding: 5px;
  z-index: 30;
}
.typeahead button {
  display: block;
  width: 100%;
  text-align: left;
  border: none;
  background: none;
  border-radius: var(--r-sm);
  padding: 8px 10px;
  color: var(--ink);
  font-weight: 600;
}
.typeahead button.active, .typeahead button:hover { background: var(--accent-wash); color: var(--accent-ink); }
.typeahead .fine { font-weight: 400; }
.typeahead-empty { padding: 8px 10px; }

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgb(16 12 24 / 0.42);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
  display: grid;
  place-items: start center;
  padding: 12vh 12px 0;
  z-index: 70;
}
.modal-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  width: min(600px, 94vw);
  padding: 14px 18px 16px;
  box-shadow: var(--shadow);
}
.modal-card .composer { border: none; padding: 0; margin: 0; }
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.modal-head strong { letter-spacing: -0.01em; }

/* -------------------------------------------------------------------- DMs */

.dm-layout {
  display: grid;
  grid-template-columns: 252px minmax(0, 1fr);
  flex: 1;
  min-height: 0;
}
.dm-list {
  border-right: 1px solid var(--hairline);
  padding: 12px;
  overflow-y: auto;
}
.dm-new { position: relative; }
.dm-new input { margin: 0 0 10px; }
.dm-new .typeahead { top: 44px; left: 0; right: 0; }
.dm-peer {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  text-align: left;
  border: none;
  background: none;
  border-radius: var(--r-sm);
  padding: 8px 10px;
  font-weight: 400;
}
.dm-peer-id { min-width: 0; display: flex; flex-direction: column; line-height: 1.35; }
.dm-peer strong {
  font-weight: 650;
  letter-spacing: -0.01em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.dm-peer .fine { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dm-peer.active { background: var(--accent-wash); color: var(--accent-ink); }
.dm-peer:hover { background: var(--surface-2); }
.dm-peer.active:hover { background: var(--accent-wash); }
.dm-thread { display: flex; flex-direction: column; min-height: 0; }
.dm-thread > p.muted { margin: auto; padding: 0; color: var(--ink-3); }
.dm-scroll { flex: 1; overflow-y: auto; padding: 12px 16px; }
.bubble {
  background: var(--surface-2);
  border-radius: 16px;
  padding: 9px 13px;
  margin: 4px 0;
  /* A wide pane must not turn a sentence into one long line. */
  max-width: min(76%, 560px);
  width: fit-content;
  font-size: 15px;
}
.bubble.mine { background: var(--accent); color: var(--on-accent); margin-left: auto; }
/* A picture in a bubble is the bubble: it goes edge to edge, and the padding
   only comes back if there's also something to read. */
/* A picture is a picture, not a billboard: it stops well short of the
   bubble's text measure however wide the pane gets. */
.bubble:has(.bubble-media) { padding: 4px; max-width: min(76%, 400px); }
.bubble-media { display: flex; flex-direction: column; gap: 4px; }
.bubble-img { display: block; max-width: 100%; max-height: 420px; border-radius: 13px; }
.bubble:has(.bubble-media) .fine { padding: 0 8px 4px; display: inline-block; }
.bubble .fine { color: var(--ink-3); }
.bubble.mine .fine { color: color-mix(in srgb, var(--on-accent) 68%, transparent); }
/* Flush to the pane and level with itself: the field, the attach button and
   Send are one row of one height, separated from the thread by a hairline —
   not three shapes floating in a margin. */
.dm-thread > .attach-strip { margin: 0; padding: 10px 12px 0; }
.dm-compose {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--hairline);
  background: var(--surface);
}
.dm-compose input {
  margin: 0;
  height: 40px;
  border-radius: var(--pill);
  padding: 0 16px;
}
.dm-compose button { height: 40px; padding: 0 18px; flex: none; }
.dm-compose button.linkish {
  width: 40px;
  padding: 0;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}
.dm-compose button.linkish svg.icon { width: 19px; height: 19px; }
.dm-compose button.linkish:hover { background: var(--surface-2); }
.dm-back { display: none; }

/* --------------------------------------------------------- search & people */

.search-row { display: flex; gap: 8px; align-items: center; padding: 14px var(--gutter) 0; }
.search-row input { margin: 0; }
/* One tab component, wherever a view divides itself. Settings and Search had
   two near-identical ones under different names. */
.viewtabs {
  display: flex;
  gap: 4px;
  padding: 10px var(--gutter);
  overflow-x: auto;
  scrollbar-width: none;
}
.viewtabs::-webkit-scrollbar { display: none; }
.viewtabs { border-bottom: 1px solid var(--hairline); }
.viewtab {
  flex: none;
  padding: 7px 14px;
  border: none;
  background: none;
  border-radius: var(--pill);
  color: var(--ink-2);
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
}
.viewtab:hover { background: var(--surface-2); color: var(--ink); }
.viewtab[aria-selected="true"] { background: var(--accent-wash); color: var(--accent-ink); }
.discover-head {
  margin: 0;
  padding: 20px var(--gutter) 6px;
  font-size: 11.5px;
  font-weight: 650;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--ink-3);
}
/* A tag search is a page about the tag: its name leads at title size, the
   total sits beside it. Gutter-aligned with the rows beneath it. */
.tag-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 18px var(--gutter) 8px;
}
.tag-head h3 { margin: 0; font-size: 20px; letter-spacing: -0.01em; }
.tag-head .muted { font-size: 13px; color: var(--ink-3); }
/* A search in flight: nothing at all for half a second, because that is how
   long most searches take, and a wait you never see is the best kind. Past
   that it owns up. Reduced motion keeps the delay and drops the fade. */
.search-wait {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  padding: 20px var(--gutter);
  color: var(--ink-3);
  opacity: 0;
  animation: fade-in 0.25s ease 0.5s forwards;
}
.person-row {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  text-align: left;
  border: none;
  background: none;
  padding: 10px var(--gutter);
  border-radius: 0;
  cursor: pointer;
  font-weight: 400;
}
.person-row:hover { background: var(--surface-2); }
.person-id { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.person-id .addr { font-weight: 650; letter-spacing: -0.01em; }
.person-id .muted { font-size: 13px; color: var(--ink-3); }

/* ----------------------------------------------------------- profile pages */

.profile-header {
  position: relative;
  padding: 18px var(--gutter);
  border-bottom: 1px solid var(--hairline);
}
.profile-id { display: flex; align-items: flex-start; gap: 14px; }
.profile-id .spacer { flex: 1; }
.name-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.profile-header h2 { margin: 0 0 1px; font-size: 21px; }
.profile-header .addr { color: var(--ink-3); margin: 0 0 6px; font-size: 14.5px; }
.profile-header > p { margin: 10px 0 0; }
.profile-header .fine { margin: 2px 0 0; }

/* private accounts: requests row, request/member rows, feed's private card */
.requests-row {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  text-align: left;
  cursor: pointer;
}
.request-row, .member-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}
.request-body, .member-body { flex: 1; min-width: 0; }
.request-actions, .member-actions { display: flex; gap: 8px; flex-shrink: 0; }
.private-gap-card { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.following-badge {
  font-size: 11.5px;
  font-weight: 650;
  letter-spacing: 0.02em;
  color: var(--ink-2);
  background: var(--surface-2);
  border: 1px solid var(--hairline);
  border-radius: var(--pill);
  padding: 2px 9px;
}
.sug-dir .fine { color: var(--ink-3); }

/* Public (logged-out) pages get a slim bar instead of the app shell. */
.public-page { max-width: var(--col); margin: 0 auto; padding: 16px; }
.public-page > div { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); }
.public-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}
.public-bar .logo {
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--ink);
  cursor: pointer;
  padding: 0;
}
.public-bar .logo:hover { color: var(--accent); background: none; }
.logo { display: flex; align-items: center; gap: 8px; }
.logo-mark { width: 26px; height: 26px; }

/* --------------------------------------------------- avatars & identities */

.avatar {
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  line-height: 1; /* the inherited line box would float the glyph high */
  user-select: none;
  flex-shrink: 0;
  object-fit: cover;
  vertical-align: middle;
}
.av24 { width: 24px; height: 24px; font-size: 12px; }
.av30 { width: 30px; height: 30px; font-size: 14px; }
.av32 { width: 32px; height: 32px; font-size: 15px; }
.av36 { width: 36px; height: 36px; font-size: 16px; }
.av40 { width: 40px; height: 40px; font-size: 17px; }
.av56 { width: 56px; height: 56px; font-size: 24px; }

/* -------------------------------------------------------- panels & lists */

section.card h3 { margin-top: 0; }
/* A link-styled button that starts a line keeps the block's left edge. */
section.card > button.linkish { margin-left: -6px; }
.passkey-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 0;
  font-size: 14px;
}
.user-menu {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  padding: 6px;
  box-shadow: var(--shadow);
  min-width: 232px;
  z-index: 40;
}
.user-menu-pop { position: absolute; } /* top/left set by positionUnder() */
.user-menu { animation: menu-drop 0.15s ease-out; transform-origin: top left; }
.user-menu :is(button, a) {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 38px;
  text-align: left;
  border: none;
  background: none;
  border-radius: var(--r-sm);
  padding: 8px 10px;
  font-weight: 500;
  color: inherit;
  text-decoration: none;
}
.user-menu :is(button, a):hover { background: var(--surface-2); }
.user-menu :is(button, a) svg.icon { width: 17px; height: 17px; color: var(--ink-3); flex: none; }
.user-menu .danger-item { color: var(--danger); }
.user-menu .danger-item svg.icon { color: var(--danger); }

/* post editing: the inline editor and the audit trail */
.post-editor textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: none;
  color: var(--ink);
  font: inherit;
  font-size: 16px;
  padding: 9px 11px;
  margin-top: 6px;
  resize: vertical;
}
.post-editor textarea:focus { outline: none; border-color: var(--accent); }
.editor-row { display: flex; align-items: center; justify-content: flex-end; gap: 10px; margin-top: 6px; }
.edited-note { font-size: 12px; margin-left: -6px; }
.edit-trail-item {
  border-left: 2px solid var(--hairline);
  padding-left: 12px;
  margin: 8px 0;
  color: var(--ink-2);
}
.edit-trail-item .content { margin: 2px 0; font-size: 14.5px; }

/* starter packs */
.pack-card {
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 16px;
  margin: 12px var(--gutter) 16px;
  background: var(--surface-2);
}
.pack-card h3 { margin: 0 0 4px; font-size: 16px; }
.pack-members { display: flex; flex-wrap: wrap; gap: 8px 14px; margin: 12px 0; }
.pack-member { display: flex; align-items: center; gap: 6px; font-size: 14px; }
.pack-conflict { display: flex; align-items: center; gap: 8px; margin: 6px 0; }
.pack-conflict input { flex: 0 1 160px; }

/* the Mastodon & Bluesky settings card: numbered steps on a quiet rail,
   and the live name previews that answer "which handle goes here?" */
ol.steps { list-style: none; counter-reset: fedistep; margin: 14px 0 4px; padding: 0; display: grid; gap: 16px; }
ol.steps > li { counter-increment: fedistep; display: grid; grid-template-columns: 22px 1fr; gap: 12px; }
ol.steps > li::before {
  content: counter(fedistep);
  width: 22px; height: 22px; border-radius: 50%;
  border: 1px solid var(--line); color: var(--ink-3);
  font-size: 12px; font-weight: 650; line-height: 20px; text-align: center;
}
ol.steps > li > div > b { font-weight: 650; font-size: 14px; }
section.card b:not(.fedi-name) {
  display: block;
  font-size: 14px;
  font-weight: 650;
  letter-spacing: -0.005em;
  margin: 4px 0 2px;
}
ol.steps input { margin: 6px 0 2px; }
ol.steps .fine { margin: 4px 0 0; }
ol.steps button { margin-top: 8px; }
.fedi-name { font-weight: 650; overflow-wrap: anywhere; }
.fedi-bsky { margin: 12px 0; }
.fedi-toggle { display: flex; align-items: center; gap: 8px; }
.fedi-bsky .fine { margin: 4px 0 0 24px; }
.fedi-move { border: 1px solid var(--line); border-radius: var(--r); padding: 12px; margin: 12px 0; }
.fedi-move .fine { margin: 4px 0 0; }
.fedi-done { font-weight: 550; }
/* Still settling. */
.fedi-pending { color: var(--ink-2); }
.fedi-pending .pulse { margin-right: 0.5em; }

/* Your own follows, opened under your profile header — a people list, so it
   reads like every other people list. */
.follow-list { display: flex; flex-direction: column; margin-top: 12px; }
.follow-list .follow-row {
  display: flex;
  align-items: center;
  gap: 12px;
  background: none;
  border: none;
  padding: 8px 10px;
  margin: 0 -10px;
  cursor: pointer;
  border-radius: var(--r-sm);
  text-align: left;
  font: inherit;
  font-weight: 400;
  color: var(--ink);
}
.follow-list .follow-row .name { font-weight: 650; letter-spacing: -0.01em; }
.follow-list .follow-row:hover { background: var(--surface-2); }

/* -------------------------------------------------- onboarding & the gate */

.onboarding { min-height: 100vh; display: grid; place-items: center; padding: 24px 0; }
.onboarding-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 32px;
  width: min(440px, 92vw);
  box-shadow: var(--shadow);
}
.onboarding-card h1 { margin-top: 0; display: flex; align-items: center; gap: 10px; font-size: 27px; }
.onboarding-card h1 .logo-mark { width: 40px; height: 40px; }
.tagline { color: var(--ink-2); }
.tagline.pitch { font-weight: 600; color: var(--ink); }
.tabs { display: flex; gap: 8px; margin-bottom: 16px; }
.tabs button.active {
  background: var(--accent-wash);
  border-color: transparent;
  color: var(--accent-ink);
}
.signup-nudge { margin-top: 14px; }

/* Add account (ui/addaccount.js): a panel in the signed-in shell, sized to
   its content — not the .onboarding full-page takeover. It reuses the same
   pagehead + section.card language every other panel view already uses, so
   it reads as belonging rather than a bolted-on screen. */
.pagehead h1 { margin: 0; font-size: 20px; }
/* Plain labels here always introduce a control below them; block keeps a
   label from running on with whatever sits right before it (a button, in
   the "Or a recovery code" case) instead of sharing its line. */
.addaccount label { display: block; margin: 10px 0 4px; }
.addaccount .cancel { display: block; margin: 10px 0 4px var(--gutter); }

/* --------------------------------------------------- notices & boot gate */

.banner {
  position: fixed;
  bottom: 22px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--ink);
  color: var(--bg);
  border-radius: var(--pill);
  padding: 9px 20px;
  font-size: 14px;
  font-weight: 500;
  z-index: 80;
  box-shadow: var(--shadow);
}
/* a calm, non-alarming top notice (address not confirming) */
.notice {
  position: sticky;
  top: 0;
  z-index: 30;
  background: var(--accent-wash);
  color: var(--ink);
  border-bottom: 1px solid var(--line);
  padding: 9px 16px;
  font-size: 14px;
  text-align: center;
}
.notice button.linkish { color: var(--accent-ink); font-weight: 650; }

/* Boot reveal (ui/bootgate.js): the app assembles invisibly and appears in
   one paint. The loader fades in only when assembly outlasts 500ms. */
body.booting #root, body.booting .banner, body.booting .notice { visibility: hidden; }
.boot-loader {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  opacity: 0;
  animation: fade-in 0.25s ease 0.5s forwards;
}
.boot-loader .logo-mark { width: 56px; height: 56px; animation: boot-loader-pulse 1.4s ease-in-out infinite; }
@keyframes boot-loader-pulse { 50% { transform: scale(0.88); opacity: 0.65; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
  .boot-loader .logo-mark { animation: none; }
}

/* ================================================== medium: the icon rail */

@media (max-width: 1180px) {
  :root { --rail: 76px; }
  .rail { align-items: center; padding: 18px 10px 16px; }
  .rail-label { display: none; }
  .rail-mark { margin-bottom: 14px; padding: 8px; }
  .rail-item { justify-content: center; padding: 12px; border-radius: 14px; }
  .compose-rail { width: 48px; height: 48px; padding: 0; border-radius: 50%; align-self: center; }
  .rail-you { justify-content: center; padding: 8px 0; }
  .rail-you-names, .rail-you svg.icon { display: none; }
  .rail .menu { left: 0; min-width: 224px; }
  .nav-count {
    position: absolute;
    top: 6px;
    right: 6px;
    margin: 0;
    font-size: 10px;
    padding: 0 5px;
  }
  .rail-item { position: relative; }
}

/* =========================================== mobile: top bar + three tabs */

@media (max-width: 700px) {
  :root { --gutter: 14px; }
  .shell { display: block; }
  .shell::after { display: none; }
  .chrome { position: static; height: auto; }
  .rail { display: none; }
  .main {
    max-width: 100%;
    margin: 0;
    /* the tabs, plus room to see the last row clear of them */
    padding: 0 0 calc(var(--tabs-h) + 18px + env(safe-area-inset-bottom));
  }
  /* A view that fills the window owns its own bottom edge: no padding under
     it, and the floating compose button steps aside rather than landing on
     whatever that view put there. */
  .shell.wide .main { padding-bottom: 0; }
  .shell.wide .compose-fab { display: none; }
  /* Full-bleed on a phone: the surface is the screen, not a card on it. */
  .main > div { border: none; border-radius: 0; min-height: 100vh; margin-bottom: 0; }
  /* Exactly the window, less the bar above and the tabs below. */
  .main > div.fill {
    height: calc(100vh - var(--bar-h) - var(--tabs-h)
                 - env(safe-area-inset-top) - env(safe-area-inset-bottom));
    min-height: 0;
  }
  .pagehead { display: none; }

  .bar {
    display: grid;
    grid-template-columns: 40px minmax(0, 1fr) 40px;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 50;
    height: calc(var(--bar-h) + env(safe-area-inset-top));
    padding: env(safe-area-inset-top) 10px 0;
    background: var(--surface);
    background: color-mix(in srgb, var(--surface) 90%, transparent);
    -webkit-backdrop-filter: blur(16px) saturate(1.7);
    backdrop-filter: blur(16px) saturate(1.7);
    border-bottom: 1px solid var(--hairline);
  }
  .bar-you, .bar-more, .bar-back {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: none;
    background: none;
    padding: 0;
    border-radius: 50%;
    color: var(--ink-2);
  }
  .bar-more svg.icon, .bar-back svg.icon { width: 22px; height: 22px; }
  .bar-you:hover, .bar-more:hover, .bar-back:hover { background: var(--surface-2); }
  .bar-title {
    text-align: center;
    font-size: 16px;
    font-weight: 650;
    letter-spacing: -0.015em;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .bar-mark { display: flex; align-items: center; justify-content: center; gap: 7px; }
  .bar-mark .logo-mark { width: 22px; height: 22px; }
  .bar .menu { max-width: calc(100vw - 20px); }

  .tabbar {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    position: fixed;
    inset: auto 0 0 0;
    z-index: 50;
    padding: 4px 0 env(safe-area-inset-bottom);
    background: var(--surface);
    background: color-mix(in srgb, var(--surface) 93%, transparent);
    -webkit-backdrop-filter: blur(16px) saturate(1.7);
    backdrop-filter: blur(16px) saturate(1.7);
    border-top: 1px solid var(--hairline);
  }
  .tabbar-item {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 50px;
    border: none;
    background: none;
    border-radius: 0;
    color: var(--ink-3);
  }
  .tabbar-item svg.icon { width: 23px; height: 23px; }
  .tabbar-item:hover { background: none; }
  .tabbar-item.active { color: var(--accent); }

  .compose-fab {
    display: flex;
    align-items: center;
    justify-content: center;
    position: fixed;
    right: 16px;
    bottom: calc(66px + env(safe-area-inset-bottom));
    z-index: 45;
    width: 52px;
    height: 52px;
    padding: 0;
    border-radius: 50%;
    background: var(--accent);
    border-color: var(--accent);
    color: var(--on-accent);
    box-shadow: 0 6px 18px rgb(107 47 207 / 0.34);
  }
  .compose-fab:hover { background: var(--accent-ink); }
  .compose-fab svg.icon { width: 22px; height: 22px; }

  .card { padding: 13px var(--gutter); }
  .card.post { grid-template-columns: 38px minmax(0, 1fr); column-gap: 10px; }
  .indent > .card.post { padding-left: calc(var(--gutter) + 18px); }
  .repost-note { padding-left: calc(var(--gutter) + 48px); }
  .media { max-height: 60vh; }
  /* Touch has no hover to reveal it, so the kebab stays put. */
  .card.post .kebab { opacity: 1; }

  /* The profile header stacks: actions on the avatar's line, identity on
     its own, so a long name isn't squeezed into a third of the width. */
  .profile-id { flex-wrap: wrap; align-items: center; }
  .profile-id > div:not(.avatar) { order: 5; flex: 1 0 100%; margin-top: 10px; }
  .profile-id .spacer { order: 2; }
  .profile-id > button { order: 3; }

  .search-row, .viewtabs { padding-left: var(--gutter); padding-right: var(--gutter); }
  .search-row { padding-top: 12px; }

  /* Messages: one pane at a time */
  .dm-layout { grid-template-columns: 1fr; }
  .dm-list { border-right: none; }
  .dm-layout.has-peer .dm-list { display: none; }
  .dm-layout:not(.has-peer) .dm-thread { display: none; }
  .dm-back { display: inline-flex; align-self: flex-start; margin: 8px 8px 0; }
  .bubble { max-width: 86%; }

  .modal-overlay { padding-top: 6vh; }
  .pack-card { margin-inline: var(--gutter); }
  .public-page { padding: 12px; }
}

/* The quote composer: a sheet over the app, in the ui/lightbox.js mould. */
.quote-overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 8vh 16px 16px;
  background: rgb(0 0 0 / 55%);
}
.quote-sheet {
  position: relative;
  width: 100%;
  max-width: 560px;
  padding: 8px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  /* A long quoted post on a short viewport used to push Post off the bottom
     of the screen with no way to reach it. 100% is the overlay's content box
     — the viewport less its padding — so the sheet stops at the fold and
     scrolls inside instead of overflowing past it. */
  max-height: 100%;
  overflow-y: auto;
  overscroll-behavior: contain;
}
.quote-close {
  position: absolute;
  top: 8px;
  right: 8px;
  border: 0;
  background: none;
  color: var(--ink-3);
  cursor: pointer;
}

/* Communities are a posting destination, independent of the active profile. */
.community-banner { padding: 16px 20px; border-bottom: 1px solid var(--line, #ddd); }
.community-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.communities-page { padding: 20px; }
.community-list { display: grid; gap: 10px; margin: 20px 0; }
.community-list .community-choice { -webkit-appearance: none; appearance: none; border: 1px solid var(--line); border-radius: var(--r-sm); display: flex; flex-direction: column; align-items: flex-start; gap: 6px; padding: 18px; cursor: pointer; }
.community-create { display: grid; gap: 14px; padding: 20px; }
.community-create[hidden] { display: none; } /* display: grid would otherwise beat the UA hidden rule */
.community-create label { display: grid; gap: 6px; }
.community-create .community-sharing { display: flex; align-items: center; gap: 10px; }
.community-sharing input { width: auto; }
.community-destination { padding: 0 0 8px; font-weight: 600; }
