/* Intent and rules: docs/features/home.md, "Sheet" (read before changing). */
/*
 * The one bottom sheet (site/team/sheet.js): a modal <dialog> that rises from the bottom of the screen, the full
 * width of a phone and at most 560 px, centred on a wide screen. Three rows: the head (grab bar, title, sub, ×),
 * the body (it scrolls), the foot (pinned under it, with the result line). Linked after team.css, whose tokens,
 * .btn and .icon-btn it uses. Sizes in px like team.css, and nothing holding text has a fixed height, so it
 * holds at 125% text.
 */
.sheet {
  width: 100%;
  max-width: 560px;
  max-height: calc(100vh - 24px);
  max-height: calc(100dvh - 24px - env(safe-area-inset-top, 0px));
  margin: auto auto 0;
  padding: 0;
  border: 0;
  border-top: 1px solid var(--line-strong);
  border-radius: 20px 20px 0 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.4;
  box-shadow: 0 -16px 48px rgba(0, 0, 0, 0.45);
  overflow: hidden;
}
/* Only while open: a closed dialog keeps the browser's display: none. */
.sheet[open] { display: flex; flex-direction: column; }
.sheet::backdrop { background: rgba(8, 10, 14, 0.62); }
/* The page behind stays where it was, and a pull at the top does not reload the page mid-action (Chrome). */
html:has(#team-sheet[open]) { overflow: hidden; overscroll-behavior: none; }

.sheet-head {
  flex: none;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  column-gap: 8px;
  padding: 6px 8px 10px 16px;
  border-bottom: 1px solid var(--line);
}
.sheet-grab { grid-column: 1 / -1; justify-self: center; width: 40px; height: 4px; margin: 0 0 4px; border-radius: 2px; background: var(--line-strong); }
.sheet-titles { min-width: 0; padding-top: 8px; }
.sheet-title { margin: 0; font-family: var(--display); font-weight: 400; font-size: 21px; line-height: 1.25; overflow-wrap: anywhere; }
/* Focus lands on the title when the sheet opens (never on a field): no ring for that, a ring from the keyboard. */
.sheet-title:focus:not(:focus-visible) { outline: none; }
.sheet-sub { margin: 4px 0 0; font-size: 14px; color: var(--muted); overflow-wrap: anywhere; }
.sheet-x { font-size: 22px; line-height: 1; }

.sheet-body {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 14px 16px 16px;
  overflow-y: auto;
  overscroll-behavior: contain;
  overflow-wrap: anywhere;
}
.sheet-body:empty { display: none; }
/* The body and foot space their parts with gap: a plain paragraph or list brings no margin of its own (any class wins). */
:where(.sheet-body, .sheet-foot) > :where(p, h3, ul, ol) { margin: 0; }
.sheet-foot {
  flex: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--line);
  background: var(--paper);
}
/* A foot with nothing in it yet: only the room the phone's home bar needs. */
.sheet-foot:not(:has(> :not(.sheet-say:empty))) { padding-top: 0; border-top: 0; }
/* The result line ("Sent.", a refusal): always in the page, so a screen reader hears it when it changes. */
.sheet-say { margin: 0; font-size: 14px; font-weight: 600; color: var(--ink); overflow-wrap: anywhere; }

/* Every button, link and picker in a sheet is a 44 px tap. A link on its own line in the body or foot ("Open their
   card ›") is a 44 px line; a link inside a sentence is the builder's to size. */
.sheet :is(button, a, select) { min-height: 44px; }
:where(.sheet-body, .sheet-foot) > a { display: inline-flex; align-items: center; align-self: flex-start; }

/* The person sheet (customer-sheet.js): the newest steps as plain lines (Your call and No reply needed keep the
   card's look, team.css); on the foot Done with them (team.css .done-with) and the links to their card share a row
   (.sheet-foot-row, below), the links 44 px lines. */
.sheet-body > .journey-need { margin: 0; }
.sheet-steps { margin: 0; padding: 0 0 0 18px; display: grid; gap: 4px; font-size: 14px; color: var(--ink-2); }

/* The person sheet's Price it (price-sheet.js opens in its place), or Send a text › in its place once they said yes:
   first on the pinned foot, its full width, so it stays in reach while the context above scrolls (2026-11-24). */
.sheet-foot > :is(.sheet-price, .sheet-text, .sheet-quote) { width: 100%; justify-content: center; }

/* The foot's actions (2026-12-01, the owner's mockup: conversation first, actions at the bottom): Your call as a slim
   red line first; Send a text › and No reply needed side by side, two halves that stack when 125% text cannot fit
   them (No reply needed's hint is its description, for a screen reader). */
.sheet-foot > .sheet-ask { margin: 0; padding: 7px 12px; font-size: 14px; }
.sheet-foot-pair { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 8px; }
.sheet-foot-pair > :is(a, button) { justify-content: center; text-align: center; min-width: 0; }

/* The conversation (sheet-context.js threadPart): theirs on the left, ours on the right in gold, the newest of theirs
   with a red edge; a long one shows 3 lines until More. Nothing holding text has a fixed height. */
.sheet-thread { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 6px; }
.sheet-msg { max-width: 86%; align-self: flex-start; padding: 7px 11px; border-radius: 14px 14px 14px 4px; background: rgba(255, 255, 255, 0.07); font-size: 14px; }
.sheet-msg[data-side="us"] { align-self: flex-end; border-radius: 14px 14px 4px 14px; background: rgba(217, 180, 68, 0.16); }
.sheet-msg[data-new] { box-shadow: inset 0 0 0 1.5px rgba(240, 106, 106, 0.6); }
.sheet-msg[data-unsent] .sheet-msg-meta { color: var(--you); }
.sheet-msg-meta { margin: 0 0 2px; font-size: 12px; color: var(--muted); }
.sheet-msg-text > p { margin: 0; overflow-wrap: anywhere; }
.sheet-msg-text.is-clamped { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; overflow: hidden; }
.sheet-msg-more { font-size: 13px; color: var(--muted); }
.sheet .sheet-msg-toggle { padding: 0; font-size: 13px; }
.sheet-thread-earlier { align-self: center; font-size: 13px; }
.sheet-sec-from { font-weight: 500; letter-spacing: 0; text-transform: none; }

/* The foot's Done with them and the links to their card on one row; with Close… (two choices, and its panel) the
   links go under it, at any width. */
.sheet-foot-row { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px 16px; }
.sheet-foot-row > .done-with { flex: 1 1 180px; min-width: 0; margin-top: 0; padding-top: 0; border-top: 0; }
.sheet-foot-row > .done-with:has(.close-toggle) { flex-basis: 100%; }
/* On the sheet, Archive and Close… are slim buttons (the owner's 12-01 mockup): the "Done with them" heading and each
   hint stay for a screen reader (the group's name, each button's description) but take no room on the foot
   (customer-sheet.js gives them team.css's .visually-hidden). */
.sheet-foot-row .done-with-btn { min-height: 44px; }
.sheet-foot-links { display: flex; flex-direction: column; align-items: flex-start; }
.sheet-foot-links > a { display: inline-flex; align-items: center; padding: 0 2px; }

/* The person sheet's context (sheet-context.js, 2026-11-24; home.md, "Person sheet: the context"): small grey section
   titles, the facts as chips that wrap, their words in a quiet box, the job rows as the card's (team.css .job-rows),
   the phone and email with Copy. Nothing holding text has a fixed height, so it holds at 125% text. */
.sheet-sec { display: flex; flex-direction: column; gap: 6px; }
.sheet-sec-title { margin: 0; font-family: var(--sans); font-size: 12px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); }
.sheet-body > .sheet-dnb { margin: 0; }
.sheet-facts { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0; list-style: none; }
.sheet-fact { padding: 3px 10px; border: 1px solid var(--line-strong); border-radius: 999px; font-size: 13px; color: var(--ink-2); overflow-wrap: anywhere; }
.sheet-fact[data-tone="good"] { border-color: rgba(63, 185, 107, 0.55); color: #8FDCAB; }
.sheet-fact[data-tone="warn"] { border-color: rgba(240, 106, 106, 0.55); color: var(--you); }
.sheet-contact { display: flex; flex-direction: column; gap: 6px; font-size: 14px; color: var(--ink-2); }
.sheet-contact > .card-phone { justify-content: space-between; }
/* A short phone with Close… open (code review pass 1: 30 px of body at 320x568 with 125% text): the foot is at most
   45% of the screen and scrolls past that, Price it first at its top. The body gives way first on any phone (a far
   larger shrink), down to its floor; only then does the foot shrink and scroll (code review pass 2, and the commit
   review: a phone on its side, 568x320). The result line stays at the top of the foot as it scrolls, so a refusal is
   never said out of view. */
#sheet-customer { min-height: min(150px, 25dvh); flex-shrink: 1000; }
.sheet:has(#sheet-customer) .sheet-foot { flex: 0 1 auto; min-height: 0; max-height: 45dvh; overflow-y: auto; overscroll-behavior: contain; }
.sheet:has(#sheet-customer) .sheet-foot > .sheet-say:not(:empty) { position: sticky; top: -12px; z-index: 1; padding: 6px 0; background: var(--paper); }

/* The Price it sheet (price-sheet.js, design B PR 2): parts stacked with the body's gap, each a column of its own;
   the whole text as tall as it is (no scroll inside it, 2026-10-12); the main button the foot's width, pinned. */
.price-part { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.price-part > :where(p, h3, ul) { margin: 0; }
.price-phone { display: flex; align-items: center; min-width: 0; }
.price-day b { font-weight: 600; }
.price-photos { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.price-photos .photo-tile img { display: block; object-fit: cover; border-radius: 10px; }
.price-week { min-width: 0; padding: 10px; border: 1px solid var(--line); border-radius: 12px; background: var(--cream); }
.price-booked-head { font-size: 14px; font-weight: 600; }
.price-booked { margin: 0; padding: 0; list-style: none; display: grid; gap: 4px; font-size: 14px; color: var(--ink-2); }
.price-booked-time { font-variant-numeric: tabular-nums; color: var(--ink); }
.price-label { font-size: 13px; font-weight: 600; color: var(--muted); }
.price-amount { display: flex; align-items: center; gap: 6px; font-size: 20px; font-weight: 600; }
.price-amount input {
  flex: 1 1 auto; min-width: 0; min-height: 44px; padding: 8px 12px;
  border: 1px solid var(--line-strong); border-radius: 9px; background: var(--paper); color: var(--ink); font-size: 20px;
}
.price-suggest { font-weight: 600; }
.price-part > .price-use, .price-part > .price-why-btn, .price-part > .price-more { align-self: flex-start; }
.price-why { font-size: 14px; color: var(--ink-2); }
.price-why-list { margin: 4px 0; padding: 0 0 0 18px; display: grid; gap: 2px; }
.price-check { display: flex; align-items: center; gap: 10px; min-height: 44px; font-size: 14px; cursor: pointer; }
.price-check input { flex: none; margin: 0; accent-color: var(--gold); }
:where(.price-split, .price-suggest-note, .price-crew-line, .price-count, .price-more-line, .price-week-line) { font-size: 13px; }
.price-rates, .price-carpet { font-size: 14px; color: var(--ink-2); }
#sheet-price .crew-seg { display: flex; flex-wrap: wrap; align-items: center; padding: 3px; gap: 3px; max-width: 100%; }
#sheet-price .crew-seg .seg-label { padding: 0 6px; font-size: 13px; color: var(--muted); }
#sheet-price .crew-seg button { min-width: 44px; padding: 0 12px; font-size: 15px; }
#sheet-price .crew-seg button[disabled] { opacity: 0.55; cursor: not-allowed; }
#sheet-price .crew-seg button[data-suggested]:not([aria-pressed="true"]) { outline: 1px dashed var(--gold-deep); outline-offset: -3px; }
.price-text-head { font-size: 15px; font-weight: 600; }
.price-where { font-size: 14px; font-weight: 600; color: var(--gold-deep); }
.price-text {
  white-space: pre-wrap; padding: 10px 12px; border: 1px solid var(--line-strong); border-radius: 10px;
  background: var(--cream); font-size: 15px; color: var(--ink);
}
.price-text.is-note { white-space: normal; color: var(--muted); font-size: 14px; }
.price-edit {
  width: 100%; min-height: 120px; resize: none; padding: 10px 12px; border: 1px solid var(--gold-edge); border-radius: 10px;
  background: var(--paper); color: var(--ink); font-size: 15px; line-height: 1.4;
}
.price-links { display: flex; flex-wrap: wrap; gap: 0 14px; }
.price-ask { display: flex; flex-direction: column; gap: 8px; }
.price-ask-q { font-weight: 600; }
.price-ask-btns, .price-after { display: flex; flex-wrap: wrap; gap: 8px; }
.price-main { width: 100%; }
.price-note { font-size: 13px; }

/* A wide screen: the same 560 px sheet, in the middle of the screen. */
@media (min-width: 760px) {
  .sheet { margin: auto; border: 1px solid var(--line-strong); border-radius: 20px; max-height: calc(100dvh - 48px); }
  .sheet-grab { display: none; }
  .sheet-head { padding-top: 10px; }
}
