/* Control page styles. Values come from tokens.css only. */
*,
*::before,
*::after {
  box-sizing: border-box;
}
html {
  -webkit-text-size-adjust: 100%;
}
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 var(--t-16) / 1.6 var(--font);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
button,
input,
textarea {
  font: inherit;
  color: inherit;
}
button {
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
:focus-visible {
  outline: 2px solid var(--green);
  outline-offset: 2px;
}
[hidden] {
  display: none !important;
}

.page {
  max-width: 560px;
  margin-inline: auto;
  padding: var(--s4) var(--s4) var(--s7);
}

/* ---- activity entries ---- */
.entry {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  padding: var(--s3) var(--s4) var(--s4);
}
.entry + .entry {
  margin-block-start: var(--s2);
}
.entry-meta {
  display: flex;
  align-items: baseline;
  gap: var(--s2);
  font-size: var(--t-12);
  color: var(--ink-2);
}
.entry-who {
  font-weight: 600;
  color: var(--ink);
  font-size: var(--t-14);
  direction: ltr;
  unicode-bidi: isolate;
}
.entry-when {
  margin-inline-start: auto;
}
.entry-text {
  margin: var(--s1) 0 0;
  font-size: var(--t-16);
  touch-action: pan-y;
}
.entry-reply {
  margin: var(--s2) 0 0;
  padding-inline-start: var(--s3);
  border-inline-start: 2px solid var(--green);
  color: var(--ink-2);
  font-size: var(--t-14);
}
.entry-reply.hushed {
  border-inline-start-color: var(--line);
}

/* words you can press */
.w {
  position: relative;
  border-radius: 6px;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  cursor: default;
}
.w.pressing {
  color: var(--ink);
}
.w .hold,
.w .ruled-line {
  position: absolute;
  inset-inline: 0;
  inset-block-end: -2px;
  height: 2px;
  border-radius: 2px;
  background: var(--ink);
  transform-origin: right center; /* RTL: grows from the start of the word */
  pointer-events: none;
}
.w .ruled-line {
  background: var(--green);
}
.w.ruled {
  color: var(--green);
}
.w.taken {
  color: transparent;
  background: var(--hush);
}

/* ---- chips ---- */
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s2);
  margin-block: var(--s2) var(--s4);
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: var(--s1);
  min-height: 34px;
  padding: 0 var(--s3);
  border-radius: var(--r-chip);
  font-size: var(--t-14);
  line-height: 1;
  white-space: nowrap;
}
.chip.word {
  background: var(--card);
  border: 1px solid var(--ink);
  font-weight: 400; /* same weight as the word in the feed: no snap when it lands or goes home */
}
.chip.word.flying {
  border-color: transparent;
  background: rgb(255 253 249 / 0);
}
.chip-x {
  border: 0;
  background: none;
  padding: 0;
  width: 24px;
  height: 24px;
  margin-inline-end: calc(var(--s1) * -2);
  border-radius: 50%;
  color: var(--ink-2);
  font-size: var(--t-16);
  line-height: 1;
}
/* small to the eye, 44px to the finger */
.chip-x,
.chip.add {
  position: relative;
}
.chip-x::after,
.chip.add::after {
  content: "";
  position: absolute;
  inset: -10px;
}
.chip.add::after {
  inset: -5px 0;
}
.chip.add {
  border: 1px dashed var(--ink-3);
  background: none;
  color: var(--ink-2);
}
.chip-input {
  min-height: 34px;
  width: 110px;
  padding: 0 var(--s3);
  border: 1px solid var(--ink);
  border-radius: var(--r-chip);
  background: var(--card);
  font-size: var(--t-14);
}
.flyer {
  position: fixed;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}
.flyer .chip {
  width: 100%;
  height: 100%;
  justify-content: center;
}

/* ---- composer sheet ---- */
.scrim {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgb(27 26 23 / 0.14);
}
.sheet {
  position: fixed;
  z-index: 50;
  inset-inline: 0;
  inset-block-end: 0;
  max-width: 560px;
  margin-inline: auto;
  max-height: 88dvh;
  overflow-y: auto;
  background: var(--card);
  border-radius: var(--r-sheet) var(--r-sheet) 0 0;
  box-shadow: var(--sheet);
  padding: var(--s2) var(--s5) calc(var(--s5) + env(safe-area-inset-bottom));
}
.grab {
  width: 36px;
  height: 4px;
  border-radius: 2px;
  background: var(--line);
  margin: 0 auto var(--s4);
}
.sheet-title {
  margin: 0;
  font-size: var(--t-20);
  font-weight: 600;
}
.sheet-lead {
  margin: var(--s1) 0 0;
  color: var(--ink-2);
  font-size: var(--t-14);
}
.field {
  display: block;
  margin-block-end: var(--s3);
}
.field-label {
  display: block;
  font-size: var(--t-12);
  color: var(--ink-2);
  margin-block-end: var(--s1);
}
.field textarea,
.field input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--r-field);
  background: var(--paper);
  padding: var(--s2) var(--s3);
  font-size: var(--t-16); /* 16px: iOS does not zoom into the field */
  resize: none;
}
.field textarea:focus,
.field input:focus {
  outline: none;
  border-color: var(--ink);
  background: var(--card);
}
.scope {
  display: flex;
  gap: var(--s2);
  margin-block: var(--s1) var(--s4);
}
.clause-hint + .scope {
  margin-block-start: var(--s3);
}
.toggle {
  min-height: var(--touch);
  padding: 0 var(--s4);
  border-radius: var(--r-chip);
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--ink-2);
  font-size: var(--t-14);
}
/* on = green (the bot will answer there); the drawn tick says it without colour too */
.toggle[aria-pressed="true"] {
  background: var(--green-soft);
  border-color: var(--green);
  color: var(--green);
  font-weight: 500;
}
.toggle::before {
  content: "";
  display: inline-block;
  width: 0;
  height: 9px;
  margin-inline-end: 0;
  border: solid currentColor;
  border-width: 0;
  transform: rotate(45deg) translateY(-2px);
  transition: width 0.18s cubic-bezier(0.2, 0.8, 0.2, 1), margin 0.18s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.toggle[aria-pressed="true"]::before {
  width: 4px;
  margin-inline-end: var(--s2);
  border-width: 0 2px 2px 0;
}
.sheet-error {
  margin: 0 0 var(--s2);
  color: var(--warn);
  font-size: var(--t-14);
  min-height: 0;
}
.sheet-error:empty {
  display: none;
}
.sheet-actions {
  display: flex;
  gap: var(--s2);
}
.btn {
  min-height: var(--touch);
  padding: 0 var(--s5);
  border-radius: var(--r-chip);
  border: 0;
  font-size: var(--t-16);
  font-weight: 500;
}
.btn.primary {
  flex: 1;
  background: var(--green);
  color: #fff;
}
.btn.primary:active {
  transform: scale(0.98);
}
.btn.primary:disabled {
  opacity: 0.6;
}
.btn.quiet {
  background: none;
  color: var(--ink-2);
}
@media (hover: hover) {
  .btn.quiet:hover,
  .chip.add:hover {
    color: var(--ink);
  }
}

/* ================= the board ================= */
body[data-composing],
body[data-sheet] {
  overflow: hidden;
}
.board[hidden],
.login[hidden] {
  display: none;
}

/* ---- top: the status capsule (the one dark element) ---- */
.top {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--paper);
  padding: var(--s3) 0 var(--s2);
  margin-block-end: var(--s2);
}
.capsule {
  display: flex;
  gap: var(--s1);
  padding: var(--s1);
  background: var(--night);
  color: var(--night-text);
  border-radius: var(--r-chip);
}
.capsule-half {
  position: relative;
  flex: 1 1 0;
  min-width: 0;
  min-height: 56px;
  display: flex;
  align-items: center;
  gap: var(--s3);
  padding: 0 var(--s4);
  border: 0;
  border-radius: var(--r-chip);
  background: none;
  color: inherit;
  text-align: start;
  overflow: hidden;
  isolation: isolate;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  touch-action: manipulation;
}
.capsule-half + .capsule-half::before {
  content: "";
  position: absolute;
  inset-inline-start: calc(var(--s1) * -0.5 - 0.5px);
  inset-block: var(--s3);
  width: 1px;
  background: var(--night-2);
}
.capsule-half .hold-fill {
  background: var(--night-2);
}
.dot {
  flex: none;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--green-on-night);
  box-shadow: 0 0 0 4px rgb(108 199 149 / 0.16);
  transition: background-color 0.3s cubic-bezier(0.2, 0.8, 0.2, 1), box-shadow 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.capsule-half[data-on="false"] .dot {
  background: transparent;
  box-shadow: inset 0 0 0 2px var(--night-dim);
}
.capsule-text {
  display: grid;
  line-height: 1.25;
  min-width: 0;
}
.capsule-name {
  font-size: var(--t-14);
  font-weight: 500;
}
.capsule-state {
  font-size: var(--t-12);
  color: var(--night-dim);
  white-space: nowrap;
}

/* ---- hold-to-confirm fill (shared) ---- */
.hold-fill {
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: inherit;
  background: var(--hush);
  transform: scaleX(0);
  transform-origin: right center; /* RTL: fills from the start edge */
  pointer-events: none;
}
.hold-btn {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  min-height: 36px;
  padding: 0 var(--s4);
  border: 1px solid var(--line);
  border-radius: var(--r-chip);
  background: var(--card);
  color: var(--ink-2);
  font-size: var(--t-14);
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  touch-action: manipulation;
}
.hold-btn::after {
  content: "";
  position: absolute;
  inset: -4px 0;
}
.hold-btn.holding {
  color: var(--ink);
  border-color: var(--ink-3);
}

/* ---- toast: drops out of the capsule and takes the counters' line for a moment ---- */
.toast {
  position: absolute;
  inset-inline: 0;
  /* the counters' line: top padding + capsule (56 + 2×4) + gap */
  inset-block-start: calc(var(--s3) + 56px + var(--s2) + var(--s2));
  min-height: var(--touch);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  padding: 0 var(--s4);
  border-radius: var(--r-chip);
  background: var(--card);
  border: 1px solid var(--line);
  font-size: var(--t-14);
  color: var(--ink);
  text-align: center;
  -webkit-user-select: none;
  user-select: none;
}
.toast:empty {
  display: none;
}
.toast[data-kind="error"] {
  color: var(--warn);
}

/* ---- counters under the capsule ---- */
.counts {
  display: flex;
  gap: var(--s2);
  margin-block-start: var(--s2);
}
.count {
  min-height: var(--touch);
  padding: 0 var(--s4);
  border: 1px solid var(--line);
  border-radius: var(--r-chip);
  background: var(--card);
  color: var(--ink-2);
  font-size: var(--t-14);
}
.count b {
  font-weight: 600;
  color: var(--ink);
  margin-inline-start: var(--s1);
  font-variant-numeric: tabular-nums;
}
@media (hover: hover) {
  .count:hover {
    border-color: var(--ink-3);
    color: var(--ink);
  }
}

/* ---- the log ---- */
.feed-head {
  margin: var(--s4) 0 var(--s3);
}
.feed-title {
  margin: 0;
  font-size: var(--t-16);
  font-weight: 600;
}
.hint {
  margin: var(--s1) 0 0;
  font-size: var(--t-12);
  color: var(--ink-2);
}
.entry-how {
  display: block;
  margin-block-start: var(--s1);
  font-size: var(--t-12);
  color: var(--ink-2);
}
.entry-dm {
  display: block;
  margin-block-start: var(--s1);
}
.entry-dm::before {
  content: "بالخاص: ";
  color: var(--ink-2);
  font-weight: 500;
}
.entry-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: var(--s2);
  margin-block-start: var(--s3);
}
.entry-flag {
  font-size: var(--t-12);
  color: var(--ink-2);
}
.link-btn {
  position: relative;
  min-height: 36px;
  padding: 0 var(--s2);
  border: 0;
  background: none;
  color: var(--ink);
  font-size: var(--t-14);
  font-weight: 500;
  text-decoration: underline;
  text-underline-offset: 4px;
  text-decoration-color: var(--ink-3);
}
.link-btn::after {
  content: "";
  position: absolute;
  inset: -4px 0;
}
.entry.blocked {
  background: var(--paper);
}
.entry.blocked .entry-text {
  color: var(--ink-2);
}
.entry.owner {
  background: none;
  border-style: dashed;
}
.entry.owner .entry-text {
  color: var(--ink-2);
  font-size: var(--t-14);
}
.empty {
  padding: var(--s6) var(--s4);
  text-align: center;
  color: var(--ink-2);
  font-size: var(--t-14);
  border: 1px dashed var(--line);
  border-radius: var(--r-card);
}
.empty strong {
  display: block;
  color: var(--ink);
  font-size: var(--t-16);
  font-weight: 600;
  margin-block-end: var(--s1);
}
.foot {
  display: flex;
  justify-content: center;
  margin-block-start: var(--s6);
}

/* ---- list sheets (rules, people) ---- */
.list {
  list-style: none;
  margin: var(--s4) 0;
  padding: 0;
}
.list li {
  padding: var(--s3) 0;
  border-block-end: 1px solid var(--line);
}
.list li:first-child {
  border-block-start: 1px solid var(--line);
}
.list .chips {
  margin: 0 0 var(--s2);
}
.rule-line {
  margin: var(--s1) 0 0;
  font-size: var(--t-14);
  color: var(--ink);
  overflow-wrap: anywhere;
}
.rule-line span {
  color: var(--ink-2);
}
.rule-meta {
  margin: var(--s1) 0 0;
  font-size: var(--t-12);
  color: var(--ink-2);
}
.row-actions {
  display: flex;
  gap: var(--s2);
  justify-content: flex-end;
  margin-block-start: var(--s2);
}
.person {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s3);
}
.person-name {
  direction: ltr;
  unicode-bidi: isolate;
  font-weight: 500;
}
.person-note {
  font-size: var(--t-12);
  color: var(--ink-2);
}
.add-row {
  display: flex;
  gap: var(--s2);
  margin-block-start: var(--s4);
}
.add-row input {
  flex: 1;
  min-width: 0;
  min-height: var(--touch);
  border: 1px solid var(--line);
  border-radius: var(--r-field);
  background: var(--paper);
  padding: 0 var(--s3);
  font-size: var(--t-16);
  direction: ltr;
  text-align: right;
}
.add-row input:focus {
  outline: none;
  border-color: var(--ink);
  background: var(--card);
}
.add-row .btn {
  flex: none;
  padding: 0 var(--s4);
  background: var(--card);
  border: 1px solid var(--ink);
  color: var(--ink);
}
.btn.outline {
  width: 100%;
  background: var(--card);
  border: 1px solid var(--ink);
  color: var(--ink);
}
.field-error {
  margin: var(--s1) 0 0;
  font-size: var(--t-14);
  color: var(--warn);
}
.field-error:empty {
  display: none;
}
.sheet-close {
  position: absolute;
  inset-block-start: var(--s3);
  inset-inline-end: var(--s3);
  width: var(--touch);
  height: var(--touch);
  border: 0;
  border-radius: 50%;
  background: none;
  color: var(--ink-2);
}
.sheet-close::before,
.sheet-close::after {
  content: "";
  position: absolute;
  inset-block-start: 50%;
  inset-inline-start: 50%;
  width: 16px;
  height: 1.5px;
  border-radius: 1px;
  background: currentColor;
  transform: translate(-50%, -50%) rotate(45deg);
}
.sheet-close::after {
  transform: translate(-50%, -50%) rotate(-45deg);
}
[dir="rtl"] .sheet-close::before,
[dir="rtl"] .sheet-close::after {
  transform-origin: center;
}

/* ---- sign in ---- */
.login {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: var(--s5) var(--s4);
}
.login-card {
  width: 100%;
  max-width: 380px;
}
.login-mark {
  display: inline-flex;
  align-items: center;
  gap: var(--s2);
  padding: var(--s2) var(--s4);
  border-radius: var(--r-chip);
  background: var(--night);
  color: var(--night-text);
  font-size: var(--t-14);
  margin-block-end: var(--s5);
}
.login-title {
  margin: 0;
  font-size: var(--t-28);
  font-weight: 600;
  line-height: 1.3;
}
.login-lead {
  margin: var(--s2) 0 var(--s5);
  color: var(--ink-2);
}
.login .field input {
  min-height: 52px;
  direction: ltr;
}
.login .btn.primary {
  width: 100%;
  margin-block-start: var(--s2);
}
.login-error {
  margin: var(--s3) 0 0;
  color: var(--warn);
  font-size: var(--t-14);
}
.login-error:empty {
  display: none;
}

@media (min-width: 768px) {
  .page {
    padding-block-start: var(--s5);
  }
}

/* ================= posts: «the video is the button» ================= */
.reels {
  margin-block: var(--s4) 0;
}
.reels-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--s3);
}
.reels-title {
  margin: 0;
  font-size: var(--t-16);
  font-weight: 600;
}
.reels-row {
  /* a frame added at the head moves the strip along instead of the browser shifting the view */
  overflow-anchor: none;
  display: flex;
  gap: var(--s4);
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-snap-type: x proximity;
  scroll-padding-inline: var(--s4);
  margin-inline: calc(var(--s4) * -1);
  padding: var(--s3) var(--s4) var(--s1);
  scrollbar-width: none;
}
.reels-row::-webkit-scrollbar {
  display: none;
}
.reel {
  position: relative;
  flex: none;
  width: 84px;
  padding: 0;
  border: 0;
  background: none;
  text-align: center;
  scroll-snap-align: start;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  touch-action: manipulation;
}
.reel:focus-visible {
  outline: none;
}
.reel:focus-visible .reel-pic {
  outline: 2px solid var(--ink);
  outline-offset: 7px;
}
.reel-pic {
  position: relative;
  display: block;
  width: 84px;
  height: 150px;
  border-radius: 14px;
  overflow: hidden;
  background: var(--hush);
}
.reel-pic img,
.setup-pic img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: filter 0.3s cubic-bezier(0.2, 0.8, 0.2, 1), opacity 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
}
/* the next post in its card: the same waiting frame as in the strip */
.setup-pic.is-next {
  display: grid;
  place-items: center;
  padding: var(--s2);
  background: transparent;
  border: 1.5px dashed var(--ink-3);
  font-size: var(--t-12);
  line-height: 1.4;
  color: var(--ink-2);
  text-align: center;
}
.setup-pic.is-next[data-next="armed"] {
  background: var(--green-soft);
  border-color: var(--green);
  color: var(--green);
}
.no-pic {
  display: grid;
  place-items: center;
  padding: var(--s2);
  font-size: var(--t-12);
  line-height: 1.4;
  color: var(--ink-2);
  text-align: center;
}
/* while its card is open, the post leaves an empty socket in the strip */
.reel.socket .reel-pic > * {
  visibility: hidden;
}
.reel.socket .ring-base {
  opacity: 0;
}
.reel-ring {
  position: absolute;
  inset-block-start: -4px;
  left: -4px;
  overflow: visible;
  pointer-events: none;
}
.reel-ring path {
  fill: none;
  transition: opacity 0.2s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.ring-base {
  stroke: var(--line);
  stroke-width: 1.5;
}
.ring-on {
  stroke: var(--green);
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-dasharray: 1 1;
  stroke-dashoffset: 1;
  /* an empty ring with round ends still paints a dot: hidden until something shows it (paint() sets it inline) */
  opacity: 0;
}
.reel[data-state="off"] .ring-base {
  opacity: 0;
}
.reel[data-state="off"] .reel-pic img {
  filter: grayscale(1);
  opacity: 0.42;
}
.reel-state {
  display: block;
  margin-block-start: var(--s3);
  font-size: var(--t-12);
  line-height: 1.3;
  color: var(--ink-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.reel[data-state="custom"] .reel-state {
  color: var(--green);
  font-weight: 500;
}
.reel.skeleton .reel-pic {
  background: var(--hush);
}
/* ---------- the next post: an empty frame at the head of the strip ---------- */
.reel.next .reel-pic {
  background: transparent;
}
.reel.next[data-next="armed"] .reel-pic {
  background: var(--green-soft);
}
/* saving the next post's reply turns the frame green in place (the frame changes, it is not swapped) */
.reel.next .reel-pic,
.reel.next .next-face,
.reel.next .reel-state {
  transition: background-color 0.32s cubic-bezier(0.2, 0.8, 0.2, 1), color 0.32s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.reel.next .ring-base {
  transition: stroke 0.32s cubic-bezier(0.2, 0.8, 0.2, 1);
}
/* the frame is drawn by the ring's outline, dashed while it waits */
.reel.next .ring-base {
  stroke: var(--ink-3);
  stroke-dasharray: 5 6;
}
.reel.next[data-next="armed"] .ring-base,
.reel[data-filling] .ring-base {
  stroke: var(--green);
}
.reel.next .reel-state {
  color: var(--ink-2);
}
.reel.next[data-next="armed"] .reel-state {
  color: var(--green);
  font-weight: 500;
}
.next-face {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--s2);
  padding: var(--s2);
  font-size: var(--t-12);
  line-height: 1.4;
  color: var(--ink-2);
  text-align: center;
}
.reel.next[data-next="armed"] .next-face {
  color: var(--green);
}
/* a drawn plus (no icon font): two strokes in the text colour */
.next-plus {
  position: relative;
  width: 20px;
  height: 20px;
}
.next-plus::before,
.next-plus::after {
  content: "";
  position: absolute;
  inset-block-start: 9px;
  inset-inline-start: 0;
  width: 20px;
  height: 2px;
  border-radius: 1px;
  background: currentColor;
}
.next-plus::after {
  transform: rotate(90deg);
}
.reel.next[data-next="armed"] .next-plus {
  display: none;
}
.fill-layer {
  position: absolute;
  inset: 0;
}
.reels-note {
  margin: var(--s2) 0 0;
  font-size: var(--t-14);
  color: var(--ink-2);
}
/* the posts that have no setup of their own */
.others {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s3);
  margin-block-start: var(--s3);
  padding: var(--s2) var(--s2) var(--s2) var(--s4);
  border: 1px solid var(--line);
  border-radius: var(--r-chip);
  background: var(--card);
}
.others-text {
  display: grid;
  line-height: 1.3;
  font-size: var(--t-14);
}
.others-text small {
  font-size: var(--t-12);
  color: var(--ink-2);
}

/* ---- the setup card that grows out of a post ---- */
.sheet.setup {
  height: calc(100dvh - var(--s7));
  max-height: none;
  padding-block-start: var(--s5);
  padding-block-end: 0;
}
.setup-head {
  display: flex;
  align-items: flex-start;
  gap: var(--s4);
  padding-inline-end: var(--s7);
}
.setup-pic {
  flex: none;
  position: relative;
  z-index: 1;
  display: block;
  width: 72px;
  height: calc(72px * 150 / 84);
  border-radius: 12px;
  overflow: hidden;
  background: var(--hush);
  will-change: transform;
}
.setup-about {
  min-width: 0;
}
.setup-caption {
  margin: 0;
  font-size: var(--t-14);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.setup-meta {
  margin: var(--s1) 0 0;
  font-size: var(--t-12);
  color: var(--ink-2);
}
.setup-stats {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s1) var(--s3);
  margin: var(--s2) 0 0;
  font-size: var(--t-12);
  color: var(--ink-2);
}
.setup-stats b {
  color: var(--ink);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.setup-body {
  padding-block-end: var(--s5);
}

/* three states: own reply · general reply · silent */
.seg {
  position: relative;
  display: flex;
  padding: var(--s1);
  margin-block-start: var(--s5);
  border-radius: var(--r-chip);
  background: var(--paper);
  border: 1px solid var(--line);
  isolation: isolate;
}
.seg button {
  flex: 1 1 0;
  min-height: var(--touch);
  border: 0;
  border-radius: var(--r-chip);
  background: none;
  color: var(--ink-2);
  font-size: var(--t-14);
  transition: color 0.2s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.seg button[aria-checked="true"] {
  color: var(--ink);
  font-weight: 500;
}
.seg-thumb {
  position: absolute;
  z-index: -1;
  inset-block: var(--s1);
  left: var(--s1);
  border-radius: var(--r-chip);
  background: var(--card);
  border: 1px solid var(--line);
  transition: background-color 0.2s cubic-bezier(0.2, 0.8, 0.2, 1), border-color 0.2s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.setup[data-mode="custom"] .seg-thumb {
  background: var(--green-soft);
  border-color: var(--green);
}
.setup[data-mode="custom"] .seg button[aria-checked="true"] {
  color: var(--green);
}
.setup[data-mode="off"] .seg-thumb {
  background: var(--hush);
  border-color: var(--hush);
}
.seg-hint {
  margin: var(--s2) 0 0;
  font-size: var(--t-12);
  color: var(--ink-2);
}

/* the sentence: «when someone comments … I reply … and send …» */
.clauses {
  display: grid;
  grid-template-rows: 1fr;
  transition: grid-template-rows 0.34s cubic-bezier(0.2, 0.8, 0.2, 1), opacity 0.24s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.clauses-inner {
  min-height: 0;
  overflow: hidden;
}
.setup:not([data-mode="custom"]) .clauses {
  grid-template-rows: 0fr;
  opacity: 0;
}
.clause {
  padding-block: var(--s5) 0;
}
.clause-lead {
  margin: 0 0 var(--s2);
  font-size: var(--t-16);
  font-weight: 600;
}
.clause .scope {
  margin-block: 0 var(--s2);
  flex-wrap: wrap;
}
.clause .chips {
  margin-block: var(--s1) 0;
}
.clause-hint {
  margin: var(--s2) 0 0;
  font-size: var(--t-12);
  color: var(--ink-2);
}
.variant {
  display: flex;
  align-items: center;
  gap: var(--s2);
  margin-block-end: var(--s2);
}
.variant input,
.dates input {
  flex: 1;
  min-width: 0;
  min-height: var(--touch);
  border: 1px solid var(--line);
  border-radius: var(--r-field);
  background: var(--paper);
  padding: 0 var(--s3);
  font-size: var(--t-16);
}
.variant textarea {
  flex: 1;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--r-field);
  background: var(--paper);
  padding: var(--s2) var(--s3);
  font-size: var(--t-16); /* 16px: iOS does not zoom into the field */
  resize: none;
}
.variant textarea:focus,
.variant input:focus,
.dates input:focus {
  outline: none;
  border-color: var(--ink);
  background: var(--card);
}
.variant .chip-x {
  flex: none;
  margin: 0;
}
.dates {
  display: flex;
  gap: var(--s3);
}
.dates .field {
  flex: 1;
  margin: 0;
}
.dates input {
  width: 100%;
}
.setup-remove {
  display: flex;
  justify-content: center;
  margin-block-start: var(--s5);
}
.setup .sheet-actions {
  position: sticky;
  inset-block-end: 0;
  z-index: 2;
  margin-inline: calc(var(--s5) * -1);
  padding: var(--s3) var(--s5) calc(var(--s3) + env(safe-area-inset-bottom));
  background: var(--card);
  border-block-start: 1px solid var(--line);
}
/* the post's picture in flight between the strip and its card */
.pic-flyer {
  position: fixed;
  z-index: 60;
  overflow: hidden;
  border-radius: 12px;
  transform-origin: 0 0;
  pointer-events: none;
  will-change: transform;
}
.pic-flyer .setup-pic {
  width: 100%;
  height: 100%;
  border-radius: 0;
}

/* a comment's post, as a tiny picture next to the name */
.entry-pic {
  flex: none;
  align-self: center;
  width: 14px;
  height: 24px;
  border-radius: 3px;
  object-fit: cover;
  background: var(--hush);
}
