/* ============================================================================
   Deal Rooms (deal-rooms.html). Page-local styles. Shared tokens: forge.css.
   Grammar: the page is a conversation. Anchors: hero lead + object trail,
   seats split (art lead), room intro lead, the thread with marginal notes
   on the left and the room details pane on the right.
   ========================================================================== */

/* avatar: initials on the member's own split colour (data colour, never decoration) */
.av { --c: var(--ink-3); display: inline-grid; place-items: center; flex: none; width: 36px; height: 36px; border-radius: 50%;
  background: color-mix(in oklab, var(--c) 22%, var(--surface)); color: color-mix(in oklab, var(--c) 55%, var(--ink));
  font-size: 0.75rem; font-weight: 700; letter-spacing: 0.02em; box-shadow: inset 0 0 0 1px color-mix(in oklab, var(--c) 40%, transparent); }
.av--xs { width: 26px; height: 26px; font-size: 0.625rem; }
.av--f .mark { width: 62%; height: 62%; color: var(--accent-text); }
.av--f { background: var(--surface-2); }

/* ---------------------------------------------------------------- hero -- */
.dr-hero { position: relative; overflow: hidden; padding: calc(var(--nav-h) + clamp(28px, 6vh, 72px)) 0 clamp(48px, 8vh, 96px); }
.dr-hero__grid { display: grid; grid-template-columns: minmax(0, 6fr) minmax(0, 6fr); align-items: center; gap: clamp(24px, 3vw, 48px); min-height: min(78svh, 760px); }
.dr-hero__copy { position: relative; z-index: 2; }
.dr-hero__copy .lede { margin-top: var(--s-5); }
.dr-hero__copy .btn-row { margin-top: var(--s-6); }
.dr-hero__object { position: relative; aspect-ratio: 1 / 0.9; }
.dr-hero__safe { position: absolute; inset: -6% -10%; will-change: transform; }
.dr-hero__safe .vid { position: absolute; inset: 0; background: transparent;
  -webkit-mask-image: radial-gradient(closest-side, #000 58%, transparent 100%); mask-image: radial-gradient(closest-side, #000 58%, transparent 100%); }
.dr-hero__safe .vid > img, .dr-hero__safe .vid > video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.seats { position: absolute; inset: 0; pointer-events: none; }
.seat { position: absolute; display: flex; align-items: center; gap: 10px; padding: 8px 14px 8px 8px; border-radius: var(--r-md);
  background: var(--glass-strong); border: 1px solid var(--line-2); box-shadow: var(--e2), var(--edge);
  -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur); white-space: nowrap; will-change: transform;
  animation: seat-in 760ms var(--ease-out) both; }
.seat b { display: block; font-size: var(--t-sm); line-height: 1.25; color: var(--ink); }
.seat small { display: block; font-size: 0.75rem; color: var(--ink-3); }
.seat--a { left: 2%; top: 14%; animation-delay: 300ms; }
.seat--b { right: 0; top: 24%; animation-delay: 420ms; }
.seat--c { left: 6%; bottom: 16%; animation-delay: 540ms; }
.seat--d { right: 6%; bottom: 8%; animation-delay: 660ms; }
@keyframes seat-in { from { opacity: 0; translate: 0 14px; } }
.dr-hero__tag { position: absolute; left: 50%; bottom: -6px; transform: translateX(-50%); }

/* -------------------------------------------------------------- seats -- */
.seats-sec { padding-block: var(--section) calc(var(--section) * 0.8); }
.seats-sec__copy .d-1 em { white-space: nowrap; }

/* the film band between the seats and the room: the phone clip has a bright spreadsheet up top,
   so the corner scrim is a little denser than the shared default */
.dr-film .film__scrim { background: linear-gradient(0deg, rgb(7 6 13 / 0.94) 0%, rgb(7 6 13 / 0.55) 40%, rgb(7 6 13 / 0) 70%), linear-gradient(90deg, rgb(7 6 13 / 0.86) 0%, rgb(7 6 13 / 0.5) 38%, rgb(7 6 13 / 0) 62%); }
.dr-film .film__copy .d-2 { max-width: 15ch; }
.dr-film .film__media > img, .dr-film .film__media > video { object-position: 50% 78%; }
.seats-sec__grid { display: grid; grid-template-columns: minmax(0, 6fr) minmax(0, 6fr); gap: clamp(32px, 6vw, 96px); align-items: center; }
.seats-sec__art { position: relative; border-radius: var(--r-xl); overflow: hidden; background: #05030f; box-shadow: var(--e3); aspect-ratio: 1168 / 880; }
.seats-sec__art .vid { position: absolute; inset: 0; background: transparent; }
.seats-sec__art .vid > img, .seats-sec__art .vid > video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 50% 62%; }
.seats-sec__copy .body { margin-top: var(--s-5); }
.roles { margin-top: var(--s-7); border-top: 1px solid var(--line); }
.roles li { display: grid; grid-template-columns: 14px minmax(0, 13rem) minmax(0, 1fr); align-items: baseline; gap: 4px 14px; padding: 16px 0; border-bottom: 1px solid var(--line); }
.roles i { width: 10px; height: 10px; border-radius: 3px; background: var(--c); transform: translateY(-1px); }
.roles b { font-weight: 600; color: var(--ink); }
.roles span { color: var(--ink-2); font-size: var(--t-sm); }

/* --------------------------------------------------------------- room -- */
.room { position: relative; overflow-x: clip; padding-top: calc(var(--section) * 0.8); padding-bottom: calc(var(--section) * 0.6); }
.room__intro { display: grid; grid-template-columns: minmax(0, 6fr) minmax(0, 5fr); gap: var(--s-6); align-items: end; margin-bottom: var(--s-8); }
.room__intro .body { padding-bottom: 6px; }

/* the room header: sticks under the nav while you read the thread */
.room__bar { position: sticky; top: calc(var(--nav-h) + 6px); z-index: 5; margin-bottom: var(--s-6); }
.room__bar-in { display: flex; align-items: center; gap: var(--s-4); }
.room__bar-in > * { position: relative; }
.room__bar-in::before { content: ""; position: absolute; inset: 0 calc(var(--gutter) - 12px); border-radius: var(--r-md); background: color-mix(in oklab, var(--surface) 96%, transparent); border: 1px solid var(--line-2); box-shadow: var(--e2), var(--edge); -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur); }
.room__bar-in { position: relative; min-height: 60px; }
.room__name { display: flex; align-items: center; gap: 12px; margin-right: auto; }
.room__name b { display: block; font-size: var(--t-sm); color: var(--ink); line-height: 1.25; }
.room__name small { display: block; font-size: 0.75rem; color: var(--ink-3); }
.room__lock { display: grid; place-items: center; width: 34px; height: 34px; border-radius: var(--r-sm); background: var(--accent-soft); color: var(--accent-text); }
.room__lock .i { width: 17px; height: 17px; }
.room__avs { display: flex; }
.room__avs .av { width: 30px; height: 30px; margin-left: -4px; box-shadow: 0 0 0 2px var(--surface); }

.room__grid { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: clamp(24px, 3vw, 48px); align-items: start; }
.thread { min-width: 0; }

/* a beat: marginal note on the left, messages on the right */
.beat { display: grid; grid-template-columns: minmax(0, 15rem) minmax(0, 1fr); gap: clamp(20px, 3vw, 48px); padding: var(--s-5) 0; }
.note { position: sticky; top: calc(var(--nav-h) + 96px); align-self: start; padding-top: 30px; }
.note .h-5 { color: var(--ink); }
.note p { margin-top: 6px; font-size: var(--t-sm); color: var(--ink-2); line-height: 1.55; }
.note .btn--quiet { margin-top: 12px; font-size: var(--t-sm); }
.msgs { display: grid; gap: 18px; min-width: 0; }

.day { display: flex; align-items: center; gap: 14px; margin: var(--s-6) 0 var(--s-3); padding-left: calc(15rem + clamp(20px, 3vw, 48px)); font-family: var(--f-mono); font-size: var(--t-xs); letter-spacing: var(--track-label); text-transform: uppercase; color: var(--ink-3); }
.day::before, .day::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.day:first-child { margin-top: 0; }
.sys { display: flex; align-items: center; justify-content: center; gap: 8px; margin: var(--s-3) 0 var(--s-2) calc(15rem + clamp(20px, 3vw, 48px)); font-size: var(--t-sm); color: var(--ink-3); text-align: center; }
.sys .i { width: 15px; height: 15px; }
.msgs .sys { margin: 0; }
.sys--ok { color: var(--ok); font-weight: 600; }

/* message */
.m { display: flex; gap: 12px; align-items: flex-start; max-width: 600px; }
.m--wide { max-width: 640px; }
.m--r { flex-direction: row-reverse; margin-left: auto; }
.m__body { min-width: 0; display: grid; gap: 8px; }
.m--r .m__body { justify-items: end; }
.m__meta { display: flex; align-items: baseline; gap: 8px; font-size: 0.8125rem; color: var(--ink-3); }
.m__meta b { color: var(--ink); font-weight: 600; }
.m__meta time { font-family: var(--f-mono); font-size: 0.6875rem; }
.m__bub { padding: 11px 15px; border-radius: 18px; border-top-left-radius: 6px; background: var(--surface); border: 1px solid var(--line); color: var(--ink); font-size: var(--t-base); line-height: 1.5; box-shadow: var(--e1); }
.m--r .m__bub { border-radius: 18px; border-top-right-radius: 6px; background: color-mix(in oklab, var(--accent) 14%, var(--surface)); border-color: color-mix(in oklab, var(--accent) 26%, transparent); }
.m--you .m__bub { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.m--you .av { background: var(--accent); color: var(--accent-ink); box-shadow: none; }

/* side entry: each message arrives from its sender's side */
.js .m[data-in]:not(.is-in), .js .files--solo[data-in]:not(.is-in) { transform: translateX(-22px); }
.js .m--r[data-in]:not(.is-in) { transform: translateX(22px); }
.m.is-new { animation: msg-new 520ms var(--ease-out) both; }
.m--r.is-new { animation-name: msg-new-r; }
@keyframes msg-new { from { opacity: 0; transform: translateX(-16px); } }
@keyframes msg-new-r { from { opacity: 0; transform: translateX(16px); } }

/* rich cards inside messages */
.mcard { display: flex; align-items: center; gap: 14px; width: 100%; padding: 14px 16px; border-radius: var(--r-md); background: var(--surface); border: 1px solid var(--line-2); box-shadow: var(--e2), var(--edge); text-align: left; }
.mcard__ico { display: grid; place-items: center; flex: none; width: 42px; height: 42px; border-radius: var(--r-sm); background: var(--accent-soft); color: var(--accent-text); }
.mcard__main { margin-right: auto; min-width: 0; }
.mcard__main b { display: block; font-size: var(--t-base); color: var(--ink); line-height: 1.3; }
.mcard__main small { display: block; font-size: var(--t-sm); color: var(--ink-2); }
.mcard__head { display: flex; justify-content: space-between; align-items: center; gap: 10px; font-size: var(--t-sm); font-weight: 600; color: var(--ink); }
.mcard__head > span:first-child { display: inline-flex; align-items: center; gap: 8px; }
.mcard__head .i { width: 17px; height: 17px; color: var(--accent-text); }
.mcard--book { min-width: min(100%, 420px); }
.mcard--split { display: block; min-width: min(100%, 560px); padding: 20px 22px; }
.mcard--split .mcard__head { padding-bottom: 14px; margin-bottom: 18px; border-bottom: 1px solid var(--line); }
.mcard--split .calc__input { font-size: var(--t-xl); }
.mcard--split .calc { gap: var(--s-4); }
.mcard--split.is-flash { animation: card-flash 1.4s var(--ease-out); }
@keyframes card-flash { 0%, 30% { border-color: var(--accent); } }

.mcard--doc { align-items: stretch; padding: 0; overflow: hidden; min-width: min(100%, 560px); }
.mcard__docart { flex: 0 0 38%; background: #050318; }
.mcard__docart > img, .mcard__docart > video { width: 100%; height: 100%; object-fit: cover; }
.mcard__docart.vid { position: relative; min-height: 160px; }
.mcard__docbody { flex: 1; min-width: 0; padding: 16px 18px 18px; display: grid; gap: 10px; }
.mcard__title { font-family: var(--f-display); font-weight: 600; font-size: var(--t-lg); letter-spacing: -0.025em; color: var(--ink); line-height: 1.2; }
.mini-table { margin: 0; border-top: 1px solid var(--line); }
.mini-table div { display: flex; justify-content: space-between; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--line); font-size: var(--t-sm); }
.mini-table dt { display: flex; align-items: center; gap: 8px; color: var(--ink-2); }
.mini-table dt::before { content: ""; width: 8px; height: 8px; border-radius: 2px; background: var(--c); }
.mini-table dd { margin: 0; font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; }
.mini-table span { display: inline-block; padding: 0 3px; border-radius: 4px; transition: background-color 700ms var(--ease-out); }
.mini-table span.is-flash { background: color-mix(in oklab, var(--accent) 30%, transparent); transition-duration: 0ms; }
.signers { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 0.8125rem; color: var(--ink-3); }
.signers li { display: inline-flex; align-items: center; gap: 5px; }
.signers .i { width: 14px; height: 14px; }
.signers .is-signed { color: var(--ok); font-weight: 600; }
.mcard__btn { justify-self: start; display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 14px; border-radius: var(--r-sm); background: var(--accent); color: var(--accent-ink); font-size: var(--t-sm); font-weight: 600; }
.mcard__btn .i { width: 16px; height: 16px; }

.mcard--alarm { min-width: min(100%, 420px); }
.ring { position: relative; display: grid; place-items: center; flex: none; width: 42px; height: 42px; border-radius: 50%; background: color-mix(in oklab, var(--ok) 22%, var(--surface)); color: var(--ok); }
.ring .i { width: 18px; height: 18px; animation: ring-shake 2.4s var(--ease-io) infinite; }
.ring i { position: absolute; inset: 0; border-radius: 50%; border: 1px solid var(--ok); opacity: 0; animation: ring-wave 2.4s var(--ease-out) infinite; }
.ring i + i { animation-delay: 0.5s; }
@keyframes ring-wave { 0% { opacity: 0.6; transform: scale(1); } 70%, 100% { opacity: 0; transform: scale(1.7); } }
@keyframes ring-shake { 0%, 40%, 100% { transform: none; } 8%, 24% { transform: rotate(-14deg); } 16%, 32% { transform: rotate(14deg); } }

/* files */
.files { display: grid; gap: 8px; width: 100%; min-width: min(100%, 360px); }
.files--solo { max-width: 460px; margin-left: 48px; }
.file { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: var(--r-md); background: var(--surface); border: 1px solid var(--line-2); box-shadow: var(--e1); text-align: left; }
.file > span:nth-child(2) { margin-right: auto; min-width: 0; }
.file b { display: block; font-size: var(--t-sm); font-weight: 600; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file small { display: block; font-size: 0.75rem; color: var(--ink-3); }
.file__ico { display: grid; place-items: center; flex: none; width: 38px; height: 44px; border-radius: 8px; background: color-mix(in oklab, var(--hot) 16%, var(--surface)); color: var(--hot); }
.file__ico .i { width: 18px; height: 18px; }
.file__ico--img { background: linear-gradient(150deg, color-mix(in oklab, var(--seg-creator) 50%, var(--surface)), color-mix(in oklab, var(--seg-monetized) 40%, var(--surface))); }
.file__ico--ok { background: color-mix(in oklab, var(--ok) 18%, var(--surface)); color: var(--ok); }
.file__dl { color: var(--ink-3); }
.file__dl .i { width: 17px; height: 17px; }

/* quick replies, the visitor's turn */
.quick { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.quick button { min-height: 44px; padding: 0 18px; border-radius: var(--r-pill); border: 1px solid color-mix(in oklab, var(--accent) 55%, transparent); background: transparent; color: var(--accent-text); font-size: var(--t-sm); font-weight: 600; transition: background-color var(--d-1) var(--ease-out), color var(--d-1) var(--ease-out), transform var(--d-1) var(--ease-out); }
.quick button:active { transform: scale(0.97); }
@media (hover: hover) and (pointer: fine) { .quick button:hover { background: var(--accent); color: var(--accent-ink); } }
.quick button[aria-pressed="true"] { background: var(--accent-soft); }
.replies { display: grid; gap: 18px; }
.replies:empty { display: none; }

.m--final { max-width: 760px; }
.m__bub--final { padding: clamp(22px, 3vw, 36px); border-radius: var(--r-lg); border-top-right-radius: 6px; }
.m__bub--final .btn-row { margin-top: var(--s-5); }
.composer { display: flex; align-items: center; justify-content: space-between; height: 52px; margin-top: var(--s-4); padding: 0 8px 0 18px; border-radius: var(--r-md); border: 1px solid var(--line-2); background: var(--surface); color: var(--ink-3); font-size: var(--t-sm); }
.composer .i { width: 36px; height: 36px; padding: 9px; border-radius: var(--r-sm); background: var(--surface-2); color: var(--ink-3); }

/* --------------------------------------------------- room details pane -- */
.pane { position: sticky; top: calc(var(--nav-h) + 86px); }
.pane__in { padding: 18px 18px 6px; border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--line); box-shadow: var(--e2), var(--edge); }
.pane__title { display: flex; justify-content: space-between; align-items: center; padding-bottom: 12px; font-weight: 600; font-size: var(--t-sm); color: var(--ink); border-bottom: 1px solid var(--line); }
.pane__sec { padding: 12px 0; border-bottom: 1px solid var(--line); }
.pane__sec:last-child { border-bottom: 0; }
.pane__sec h3 { margin-bottom: 7px; font-family: var(--f-mono); font-size: 0.6875rem; font-weight: 500; letter-spacing: var(--track-label); text-transform: uppercase; color: var(--ink-3); }
.pane__members { display: grid; gap: 7px; }
.pane__members li { display: grid; grid-template-columns: 26px 1fr auto; align-items: center; gap: 10px; font-size: var(--t-sm); color: var(--ink); }
.pane__members small { color: var(--ink-3); font-size: 0.75rem; }
.pane__members .av { background: color-mix(in oklab, var(--c) 22%, var(--surface)); }
.pane__members .av--f { background: var(--surface-2); }
.pane__empty { font-size: var(--t-sm); color: var(--ink-3); }
.pane__list { display: grid; gap: 6px; }
.pane__list li, .pane__val { display: flex; align-items: center; gap: 8px; font-size: var(--t-sm); color: var(--ink); }
.pane__list .i, .pane__val .i { width: 15px; height: 15px; color: var(--ink-3); flex: none; }
.pane__val--ok, .pane__val--ok .i { color: var(--ok); font-weight: 600; }
.pane__bar { display: flex; gap: 2px; height: 8px; margin: 2px 0 8px; border-radius: 4px; overflow: hidden; }
.pane__bar i { width: var(--w); background: var(--c); transition: width var(--d-3) var(--ease-out); }
/* state: JS sets data-step; items show from their step, empties hide once filled */
.js .pane [data-from] { display: none; }
.js .pane [data-from].is-on { display: flex; }
.js .pane div[data-from].is-on { display: block; }
.js .pane [data-until].is-off { display: none; }
.pane .pane__empty { display: none; }
.js .pane .pane__sec:not(.is-filled) .pane__empty { display: block; }
.pane .is-on.is-fresh { animation: pane-in 620ms var(--ease-out); }
@keyframes pane-in { from { opacity: 0; transform: translateY(6px); } 40% { background: var(--accent-soft); } }

.room__foot { margin-top: var(--s-8); padding-top: var(--s-5); border-top: 1px solid var(--line); }
.room__foot .small { color: var(--ink-3); }
.room__foot a { color: var(--ink-2); }

/* ---------------------------------------------------------- responsive -- */
@media (max-width: 1180px) {
  .room__grid { grid-template-columns: minmax(0, 1fr); }
  .pane { display: none; }
}
@media (max-width: 980px) {
  .dr-hero__grid { grid-template-columns: 1fr; min-height: 0; }
  .dr-hero__object { max-width: 640px; width: 100%; margin-inline: auto; }
  .seats-sec__grid { grid-template-columns: 1fr; }
  .room__intro { grid-template-columns: 1fr; }
  .beat { grid-template-columns: 1fr; gap: 14px; }
  .note { position: static; padding-top: 0; padding-left: 48px; }
  .beat--end .note { display: none; }
  .day, .sys { padding-left: 0; margin-left: 0; }
}
@media (max-width: 640px) {
  .dr-hero { padding-top: calc(var(--nav-h) + 24px); }
  .dr-hero .d-hero { font-size: clamp(2.6rem, 13vw, 3.6rem); }
  .dr-hero__object { aspect-ratio: 1 / 1; margin-top: var(--s-4); }
  .seat { padding: 6px 10px 6px 6px; gap: 8px; }
  .seat .av { width: 30px; height: 30px; }
  .seat b { font-size: 0.8125rem; } .seat small { font-size: 0.6875rem; }
  .seat--a { left: 0; top: 6%; } .seat--b { right: 0; top: 30%; } .seat--c { left: 0; bottom: 18%; } .seat--d { right: 0; bottom: 4%; }
  .roles li { grid-template-columns: 14px 1fr; }
  .roles span { grid-column: 2; }
  .room__bar-in .tag-example { display: none; }
  .m { gap: 8px; }
  .m .av { width: 30px; height: 30px; }
  .m__bub { font-size: var(--t-sm); padding: 10px 13px; }
  .note { padding-left: 38px; }
  .mcard--split { padding: 16px; }
  .mcard--doc { flex-direction: column; }
  .mcard__docart { flex-basis: auto; height: 120px; }
  .files--solo { margin-left: 38px; min-width: 0; width: auto; }
  .quick { justify-content: flex-start; }
  .m__bub--final .btn-row .btn { width: 100%; }
  .m__bub--final .btn--quiet { justify-content: flex-start; }
  .m--final .av { display: none; }
  .mcard--alarm .chip { display: none; }
}

/* ------------------------------------------------------- reduced motion -- */
@media (prefers-reduced-motion: reduce) {
  .js .m[data-in]:not(.is-in), .js .m--r[data-in]:not(.is-in), .js .files--solo[data-in]:not(.is-in) { transform: none; }
  .seat { animation: none; }
  .ring .i, .ring i { animation: none; }
  .m.is-new, .pane .is-on.is-fresh, .mcard--split.is-flash { animation: none; }
}
