/* Goopgram styles. Tokens come from the v2 mockups (design/mockups, DESIGN.md). */

@font-face { font-family: 'Bricolage Grotesque'; font-weight: 600; font-display: swap; src: url(/fonts/bricolage-grotesque-latin-600-normal.woff2) format('woff2'); }
@font-face { font-family: 'Bricolage Grotesque'; font-weight: 700; font-display: swap; src: url(/fonts/bricolage-grotesque-latin-700-normal.woff2) format('woff2'); }
@font-face { font-family: 'Bricolage Grotesque'; font-weight: 800; font-display: swap; src: url(/fonts/bricolage-grotesque-latin-800-normal.woff2) format('woff2'); }
@font-face { font-family: 'DM Mono'; font-weight: 400; font-display: swap; src: url(/fonts/dm-mono-latin-400-normal.woff2) format('woff2'); }
@font-face { font-family: 'DM Mono'; font-weight: 500; font-display: swap; src: url(/fonts/dm-mono-latin-500-normal.woff2) format('woff2'); }

:root {
  color-scheme: light;
  --bg: #f5f3ee;
  --card: #ffffff;
  --chip: #ebe9e2;
  --line: #e2dfd6;
  --text: #1b1a16;
  --muted: #6a675e;
  --accent: #a3ed62;      /* goop green fill, dark text on top */
  --accent-soft: #e6f4d3; /* selected/liked tint */
  --ink: #427825;         /* green text and icons */
  --on-pastel: #1b1a16;
  --solid: #19161f;       /* dark pill buttons ("See") */
  --on-solid: #f5c07c;
  --mention: #6b4fc4;
  --danger: #b3261e;
  --scrim: rgb(20 18 26 / 0.45);
  --tabbar: #ffffff;
  --purple: #bea3f9;
  --pink: #f1a3c9;
  --orange: #f5c07c;
  --teal: #90d9cb;
  --yellow: #f9dd80;
  --lavender: #d6c6fb;

  --display: 'Bricolage Grotesque', ui-sans-serif, system-ui, sans-serif;
  --mono: 'DM Mono', ui-monospace, monospace;
  --body: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --radius: 18px;
  --ease: cubic-bezier(0.23, 1, 0.32, 1);
  --top: env(safe-area-inset-top, 0px);
  --bottom: env(safe-area-inset-bottom, 0px);
  --tabbar-h: 64px;
}

/* Dark tokens: applied by data-theme="dark", or by the OS when the theme is Auto. */
:root[data-theme='dark'] {
  color-scheme: dark;
  --bg: #0e0d13;
  --card: #191721;
  --chip: #252231;
  --line: #2c293e;
  --text: #f3f0f9;
  --muted: #a19bb2;
  --accent-soft: #27321b;
  --ink: #a3ed62;
  --solid: #19161f;
  --on-solid: #e8b36a;
  --mention: #bfaaeb;
  --danger: #f2a39d;
  --scrim: rgb(0 0 0 / 0.6);
  --tabbar: #13111a;
  --purple: #a48cee;
  --pink: #e393bb;
  --orange: #e8b36a;
  --teal: #79c6b8;
  --yellow: #eacc6e;
  --lavender: #bfaaeb;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']):not([data-theme='dark']) {
    color-scheme: dark;
    --bg: #0e0d13;
    --card: #191721;
    --chip: #252231;
    --line: #2c293e;
    --text: #f3f0f9;
    --muted: #a19bb2;
    --accent-soft: #27321b;
    --ink: #a3ed62;
    --solid: #19161f;
    --on-solid: #e8b36a;
    --mention: #bfaaeb;
    --danger: #f2a39d;
    --scrim: rgb(0 0 0 / 0.6);
  --tabbar: #13111a;
    --purple: #a48cee;
    --pink: #e393bb;
    --orange: #e8b36a;
    --teal: #79c6b8;
    --yellow: #eacc6e;
    --lavender: #bfaaeb;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.45 var(--body);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
}
img { display: block; max-width: 100%; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }
h1, h2, h3 { font-family: var(--display); margin: 0; letter-spacing: -0.01em; text-wrap: balance; }
p { margin: 0; text-wrap: pretty; }
.mono { font-family: var(--mono); }
.muted { color: var(--muted); }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }

/* ---------- Layout ---------- */
#view {
  max-width: 560px;
  margin: 0 auto;
  padding: calc(var(--top) + 16px) 16px calc(var(--tabbar-h) + var(--bottom) + 24px);
  min-height: 100dvh;
}
body.no-tabs #view { padding-bottom: calc(var(--bottom) + 24px); }

.page-head {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 56px;
  margin: 8px 0 16px;
}
.page-head h1 { font-size: 32px; font-weight: 800; color: var(--ink); flex: 1; line-height: 1.1; }
.page-head h1.plain { color: var(--text); font-size: 28px; }
.logo { font-family: var(--display); font-weight: 800; font-size: 36px; letter-spacing: -0.02em; color: var(--ink); }

.stack { display: grid; gap: 12px; }

/* ---------- Tab bar ---------- */
.tabbar {
  position: fixed;
  inset: auto 0 0 0;
  z-index: 20;
  display: flex;
  justify-content: center;
  background: var(--tabbar);
  border-top: 1px solid var(--line);
  padding-bottom: var(--bottom);
}
.tabbar-inner { display: flex; width: 100%; max-width: 560px; }
.tab {
  flex: 1;
  height: var(--tabbar-h);
  display: grid;
  place-items: center;
  align-content: center;
  gap: 2px;
  color: var(--muted);
  font-size: 13px;
  border: 0;
  background: none;
  transition: transform 150ms var(--ease);
}
.tab svg { width: 28px; height: 28px; }
.tab[aria-current='page'] { color: var(--ink); }
.tab:active { transform: scale(0.94); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 0 20px;
  border-radius: 999px;
  border: 1.5px solid var(--line);
  background: var(--card);
  font-family: var(--display);
  font-weight: 700;
  font-size: 17px;
  transition: transform 150ms var(--ease), opacity 150ms;
}
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.5; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #1b1a16; }
.btn.solid { background: var(--solid); border-color: var(--solid); color: var(--on-solid); }
.btn.quiet { background: var(--chip); border-color: var(--chip); }
.btn.danger { color: var(--danger); }
.btn.block { width: 100%; }
.btn.small { min-height: 40px; padding: 0 16px; font-size: 15px; }
.btn svg { width: 20px; height: 20px; }

.icon-btn {
  width: 48px;
  height: 48px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 999px;
  border: 0;
  background: var(--chip);
  transition: transform 150ms var(--ease);
}
.icon-btn:active { transform: scale(0.94); }
.icon-btn svg { width: 24px; height: 24px; }
.icon-btn.primary { background: var(--accent); color: #1b1a16; }
.icon-btn.ghost { background: none; }

/* ---------- Cards ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}
.card-pad { padding: 16px 18px; }

/* ---------- Avatars, tags, chips ---------- */
.avatar {
  --size: 44px;
  width: var(--size);
  height: var(--size);
  flex: none;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--av, var(--purple));
  color: var(--on-pastel);
  font-family: var(--display);
  font-weight: 800;
  font-size: calc(var(--size) * 0.42);
  overflow: hidden;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar.lg { --size: 96px; }
.avatar.sm { --size: 32px; }

.tag {
  display: inline-block;
  padding: 2px 10px 3px;
  border-radius: 999px;
  font-family: var(--display);
  font-weight: 700;
  font-size: 13px;
  line-height: 1.4;
  white-space: nowrap;
  color: var(--on-pastel);
  background: var(--chip);
}
/* Sticker-like role tags: the one place things tilt (plan 9.1). */
.tag.role { transform: rotate(-2deg); }
.r-leader { background: var(--yellow); }
.r-goth { background: var(--purple); }
.r-death-feeder { background: var(--pink); }
.r-comedian { background: var(--orange); }
.r-leather-daddy { background: var(--teal); }
.r-monk { background: var(--lavender); }

.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  min-height: 44px;
  padding: 0 16px;
  border-radius: 999px;
  border: 0;
  background: var(--chip);
  font-family: var(--display);
  font-weight: 600;
  font-size: 16px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.chip[aria-pressed='true'] { background: var(--accent); color: #1b1a16; }
.chip:disabled { opacity: 0.45; }

/* ---------- Forms ---------- */
.field { display: grid; gap: 6px; }
.field > span { font-size: 14px; color: var(--muted); }
.input, textarea.input, select.input {
  width: 100%;
  min-height: 52px;
  padding: 12px 18px;
  border-radius: 16px;
  border: 1.5px solid var(--line);
  background: var(--card);
  font-size: 17px; /* 16px+ stops iOS zooming on focus */
}
textarea.input { resize: none; min-height: 110px; line-height: 1.45; }
.input:focus { outline: none; border-color: var(--ink); }
.form { display: grid; gap: 16px; }
.form-error { color: var(--danger); font-size: 15px; min-height: 1em; }

/* ---------- Feed ---------- */
.post-head { display: flex; gap: 12px; align-items: center; padding: 16px 18px 12px; }
.post-head .who { min-width: 0; flex: 1; }
.post-head .names { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.post-head .name { font-family: var(--display); font-weight: 700; font-size: 18px; }
.post-head .aka { color: var(--muted); font-size: 17px; }
.post-head time, .stamp { font-family: var(--mono); font-size: 14px; color: var(--muted); }
.post-media { background: var(--chip); width: 100%; }
.post-media img { width: 100%; height: 100%; object-fit: cover; }
.post-head + .post-body { padding-top: 0; }
.post-body { padding: 14px 18px 0; font-size: 17px; white-space: pre-wrap; overflow-wrap: anywhere; }
.mention { color: var(--mention); font-weight: 600; }
.post-actions { display: flex; gap: 6px; padding: 10px 10px 12px; }
.react {
  min-width: 64px;
  min-height: 44px;
  padding: 0 14px;
  border-radius: 14px;
  border: 0;
  background: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-family: var(--display);
  font-weight: 700;
  font-size: 17px;
  font-variant-numeric: tabular-nums;
  transition: transform 150ms var(--ease);
}
.react svg { width: 24px; height: 24px; }
.react:active { transform: scale(0.94); }
.react[aria-pressed='true'] { background: var(--accent-soft); color: var(--ink); }
.react.pop svg { animation: pop 220ms var(--ease); }
@keyframes pop { 50% { transform: scale(1.25) rotate(-8deg); } }

.empty {
  text-align: center;
  padding: 48px 24px;
  color: var(--muted);
  display: grid;
  gap: 16px;
  justify-items: center;
}
.empty h2 { color: var(--text); font-size: 22px; }

.skeleton { background: var(--chip); border-radius: 12px; animation: shimmer 1.2s ease-in-out infinite alternate; }
@keyframes shimmer { to { opacity: 0.55; } }

/* ---------- Post detail / comments ---------- */
.comments { display: grid; gap: 4px; margin-top: 16px; }
.comment { display: flex; gap: 12px; padding: 10px 2px; }
.comment .bubble { flex: 1; min-width: 0; }
.comment .line1 { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.comment .name { font-family: var(--display); font-weight: 700; }
.comment .text { white-space: pre-wrap; overflow-wrap: anywhere; }
.comment img { margin-top: 8px; border-radius: 14px; max-height: 320px; width: auto; }
.comment .del { width: 40px; height: 40px; margin: -6px -6px 0 0; color: var(--muted); }
.comment .del svg { width: 20px; height: 20px; }

.composer {
  position: fixed;
  left: 0;
  right: 0;
  bottom: var(--kb, 0px);
  z-index: 25;
  background: var(--card);
  border-top: 1px solid var(--line);
  padding: 10px 12px calc(10px + var(--bottom));
}
.composer-inner { max-width: 560px; margin: 0 auto; display: flex; gap: 8px; align-items: flex-end; }
.composer textarea {
  flex: 1;
  min-height: 48px;
  max-height: 140px;
  padding: 12px 16px;
  border-radius: 24px;
  border: 1.5px solid var(--line);
  background: var(--bg);
  font-size: 17px;
  resize: none;
}
.composer textarea:focus { outline: none; border-color: var(--ink); }
.composer .preview { max-width: 560px; margin: 0 auto 8px; display: flex; align-items: center; gap: 8px; }
.composer .preview img { height: 64px; border-radius: 10px; }

/* ---------- Bottom sheet ---------- */
.sheet-scrim {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: var(--scrim);
  opacity: 0;
  transition: opacity 200ms var(--ease);
}
.sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: var(--kb, 0px);
  z-index: 41;
  max-height: calc(var(--vvh, 100dvh) - var(--top) - 16px);
  overflow-y: auto;
  overscroll-behavior: contain;
  background: var(--card);
  border-top: 2px solid var(--accent);
  border-radius: 28px 28px 0 0;
  padding: 10px 20px calc(20px + var(--bottom));
  transform: translateY(100%);
  transition: transform 240ms var(--ease);
}
.sheet-wrap.open .sheet-scrim { opacity: 1; }
.sheet-wrap.open .sheet { transform: none; }
html.sheet-open, html.sheet-open body { overflow: hidden; }
/* With the keyboard up the home-indicator padding is wasted space. */
html.kb-open .sheet { padding-bottom: 16px; }
html.kb-open .composer { padding-bottom: 10px; }
.sheet .grabber { width: 40px; height: 5px; border-radius: 3px; background: var(--line); margin: 0 auto 12px; }
.sheet-inner { max-width: 560px; margin: 0 auto; display: grid; gap: 16px; }
.sheet-head { display: flex; align-items: center; gap: 12px; }
.sheet-head h2 { flex: 1; font-size: 26px; }

.attach-preview { position: relative; border-radius: 14px; overflow: hidden; background: var(--chip); }
.attach-preview img { width: 100%; max-height: 300px; object-fit: contain; }
.attach-loading { padding: 28px 18px; color: var(--muted); font-family: var(--mono); font-size: 14px; }
.attach-preview .icon-btn { position: absolute; top: 8px; right: 8px; width: 40px; height: 40px; }

.pick-list { display: grid; gap: 8px; }
.pick {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 56px;
  padding: 8px 14px;
  border-radius: 16px;
  border: 1.5px solid transparent;
  background: var(--chip);
  text-align: left;
  width: 100%;
}
.pick[aria-pressed='true'] { background: var(--accent-soft); border-color: var(--accent); }
.pick:disabled { opacity: 0.5; }
.pick .grow { flex: 1; min-width: 0; }
.pick .sub { font-size: 14px; color: var(--muted); }
.pick .title { font-family: var(--display); font-weight: 700; font-size: 17px; }

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  left: 50%;
  top: calc(var(--top) + 12px);
  z-index: 60;
  max-width: calc(100% - 32px);
  padding: 12px 18px;
  border-radius: 16px;
  background: var(--solid);
  color: #f3f0f9;
  font-family: var(--display);
  font-weight: 600;
  transform: translate(-50%, -20px);
  opacity: 0;
  transition: transform 200ms var(--ease), opacity 200ms;
  pointer-events: none;
}
.toast.show { transform: translate(-50%, 0); opacity: 1; }

/* ---------- Profile ---------- */
.profile-top { display: grid; justify-items: center; gap: 10px; text-align: center; padding: 8px 0 20px; }
.profile-top h1 { font-size: 30px; }
.profile-top .name-row { display: flex; align-items: center; justify-content: center; gap: 10px; flex-wrap: wrap; }
.profile-top .tag { font-size: 15px; }
.profile-top .handle { font-family: var(--mono); color: var(--muted); }
.settings-row { display: flex; align-items: center; gap: 12px; min-height: 56px; padding: 6px 18px; }
.settings-row + .settings-row { border-top: 1px solid var(--line); }
.settings-row .grow { flex: 1; }
.settings-row > svg { width: 24px; height: 24px; flex: none; color: var(--muted); }
.seg { display: flex; background: var(--chip); border-radius: 999px; padding: 4px; gap: 2px; }
.seg button { border: 0; background: none; min-height: 40px; padding: 0 14px; border-radius: 999px; font-weight: 600; font-size: 15px; }
.seg button[aria-pressed='true'] { background: var(--card); box-shadow: 0 0 0 1px var(--line); }

/* ---------- Cropper ---------- */
.cropper {
  position: relative;
  width: min(100%, 320px);
  aspect-ratio: 1;
  margin: 0 auto;
  overflow: hidden;
  border-radius: 16px;
  background: #000;
  touch-action: none;
  user-select: none;
}
.cropper img { position: absolute; left: 0; top: 0; max-width: none; transform-origin: 0 0; pointer-events: none; }
.cropper::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  box-shadow: 0 0 0 999px rgb(0 0 0 / 0.55);
  pointer-events: none;
}
.zoom { width: 100%; accent-color: var(--accent); }

/* ---------- Auth ---------- */
.auth { display: grid; gap: 24px; padding-top: 12vh; }
.auth .logo { font-size: 48px; text-align: center; }
.auth .tagline { text-align: center; color: var(--muted); font-family: var(--mono); font-size: 14px; margin-top: -16px; }
.switch-link { text-align: center; color: var(--muted); }
.switch-link a { color: var(--ink); font-weight: 600; text-decoration: underline; }

/* ---------- Admin ---------- */
.kv { display: flex; justify-content: space-between; gap: 12px; align-items: center; }
.code-box { font-family: var(--mono); font-size: 18px; background: var(--chip); padding: 10px 14px; border-radius: 12px; overflow-wrap: anywhere; }
.section-title { font-size: 20px; margin: 24px 0 10px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition-property: opacity !important; }
}

/* ---------- @mention suggestions ---------- */
.suggest {
  display: grid;
  gap: 2px;
  margin-top: 8px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--card);
}
.suggest-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  padding: 6px 10px;
  border: 0;
  border-radius: 12px;
  background: none;
  text-align: left;
  width: 100%;
}
.suggest-row:active, .suggest-row:hover { background: var(--chip); }
.suggest-row .grow { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.suggest-row .mono { font-size: 14px; }
.composer-suggest { max-width: 560px; margin: 0 auto; }
.composer-suggest .suggest { margin: 0 0 8px; }

/* ---------- Notifications ---------- */
.bell { position: relative; }
.bell-count {
  position: absolute;
  top: 2px;
  right: 0;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border-radius: 10px;
  background: var(--accent);
  color: #1b1a16;
  font: 700 12px/20px var(--display);
  text-align: center;
  box-shadow: 0 0 0 2px var(--bg);
}
.notif { display: flex; gap: 12px; padding: 14px 18px; align-items: flex-start; }
.notif + .notif { border-top: 1px solid var(--line); }
.notif.unread { background: var(--accent-soft); }
.notif .grow { flex: 1; min-width: 0; display: grid; gap: 2px; }
.notif-head { font-family: var(--display); font-weight: 700; }
.notif-text { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.push-nudge { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; color: var(--ink); }
.push-nudge svg { width: 24px; height: 24px; flex: none; }
.push-nudge .grow { display: grid; color: var(--text); }

/* Toggle switch (mockup: green track, dark knob when on). */
.switch {
  position: relative;
  flex: none;
  width: 56px;
  height: 34px;
  border-radius: 17px;
  border: 0;
  background: var(--chip);
  transition: background 150ms var(--ease);
}
.switch::after {
  content: '';
  position: absolute;
  top: 4px;
  left: 4px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--muted);
  transition: transform 180ms var(--ease), background 150ms;
}
.switch[aria-checked='true'] { background: var(--accent); }
.switch[aria-checked='true']::after { transform: translateX(22px); background: #1b1a16; }
