/* ==========================================================================
   SI homepage chat: full-height states (Unice, Nov 27 2026). Load AFTER style.css.
   Class hooks on <html>:
     .chat-full  = State B (expanded, one-way per chat session)
     .chat-pane  = State C (Work/Tools open in push mode >=1024px; works on top of A or B)
     .chat-xing  = transition in progress (JS adds/removes; WAAPI does the motion)
   ========================================================================== */

:root{
  --hdr-h:64px;            /* compact header row, B */
  --hdr-mark:32px;         /* S icon in the compact header */
  --hdr-word:20px;         /* wordmark size in the compact header */
  --foot-h:44px;           /* slim footer = one 44px row (links keep 44px targets) */
  --pane-w:clamp(380px,28vw,420px); /* C: left chat pane */
  --fh-dur:480ms;
  --fh-ease:cubic-bezier(.4,0,.2,1); /* standard ease-in-out: big layout moves read smoothly; panel slide keeps --pf-ease */
}

/* Footer tagline exists in the DOM all the time; only visible in B/C. Hero .tag hides in B/C. */
.site-foot .foot-tag{display:none}

/* Hero: the header stacks the S and wordmark the same way main used to. */
main>header{display:flex;flex-direction:column;align-items:center;gap:clamp(1rem,3vw,2rem)}

/* S1: pin the latest message during the morph (style.css uses scroll-behavior:smooth). */
html.chat-xing .chat .thread{scroll-behavior:auto}

/* N1: after expand, sit the conversation near the composer instead of leaving empty thread below. */
html.chat-full .chat .thread>:first-child{margin-top:auto}


/* Full-height composer (Gabriel, Nov 27): the starter-prompt arrow sits to the
   left of the field; the rotating prompt text is hidden; suggestions open only
   from the arrow. The follow-up chip is hidden here and lives at the bottom of
   that menu instead. Pre-full-height (State A) is unchanged. */
html.chat-full .chat{
  display:grid;
  grid-template-columns:auto minmax(0,1fr);
  grid-template-rows:minmax(0,1fr) auto auto auto;
}
html.chat-full .chat .thread{grid-column:1/-1;grid-row:1}
html.chat-full .chat .chips{grid-column:1/-1;grid-row:2}
html.chat-full .chat .bar{grid-column:1/-1;grid-row:3}
html.chat-full .chat .sugg{grid-column:1;grid-row:4;margin:0 8px 0 0;align-self:center}
html.chat-full .chat .entry{grid-column:2;grid-row:4;min-width:0}
html.chat-full .chat .sugg-one{display:none}
html.chat-full .chat .chip-followup{display:none}
html.chat-full .chat .sugg-more{width:52px;height:52px;min-width:52px;min-height:52px}
html.chat-full .chat .sugg-more svg{width:22px;height:22px}
html.chat-full .chat .sugg-follow{margin-top:.15rem}
html.chat-full .chat .sugg-list li:has(.sugg-follow){align-self:stretch;width:100%;box-sizing:border-box;border-top:1px solid #5b6570;padding-top:.35rem;margin-top:.15rem}
html.ti-done[data-theme=light].chat-full .chat .sugg-list li:has(.sugg-follow){border-top-color:#d5dbe1}
/* Full-height menu only (Gabriel, Nov 27): same width as the chat box, 30%
   frosted background, 10px blur, dotted suggestion outlines and a solid
   follow-up. State A keeps the production menu. */
html.chat-full .chat{container-type:inline-size}
html.chat-full .chat .sugg-list{background:rgba(27,33,40,.3);box-sizing:border-box;width:100cqi;max-width:none;-webkit-backdrop-filter:blur(10px);backdrop-filter:blur(10px)}
html.chat-full .chat .sugg-chip{border-style:dotted}
html.chat-full .chat .sugg-chip.sugg-follow{border-style:solid}
html.ti-done[data-theme=light].chat-full .chat .sugg-list{background:rgba(255,255,255,.3)}
html.ti-done[data-theme=light].chat-full .chat .sugg-chip{background:#fff}

/* ---------------- State B: expanded ---------------- */
html.chat-full,html.chat-full body{height:100%;overflow:hidden}
html.chat-full body{display:flex;flex-direction:column;height:var(--vvh,100dvh);min-height:0}
html.chat-full body>main{
  flex:1 1 auto;min-height:0;
  display:grid;grid-template-columns:1fr;grid-template-rows:var(--hdr-h) minmax(0,1fr);
  align-items:center;justify-content:stretch;
  padding:0 1rem;gap:0;text-align:center;
}
html.chat-full body>main>header{grid-column:1;grid-row:1;display:flex;flex-direction:row;align-items:center;justify-content:center;gap:12px;height:var(--hdr-h)}
html.chat-full .markwrap{width:var(--hdr-mark);--wm:1;transition:none;transform-origin:0 0}
html.chat-full main .word{font-size:var(--hdr-word)!important;letter-spacing:.04em;line-height:1;transform-origin:0 0;max-width:none;margin:0}
html.chat-full main .tag{position:absolute;visibility:hidden;pointer-events:none}
html.chat-full main .chat{grid-column:1;grid-row:2;justify-self:center;align-self:stretch;width:min(100%,36rem);min-height:0;margin:0;padding:4px 0 12px}
html.chat-full .chat .thread{flex:1 1 0;max-height:none;min-height:0}
html.chat-full .chat>:not(.thread),html.chat-pane .chat>:not(.thread){flex-shrink:0}
/* Screenshots: grow to the column, never past native size (width/height attrs = native px) */
html.chat-full .msg.agent:has(.shot-fig){max-width:100%}
html.chat-full .shot{width:auto;max-width:100%}
html.chat-full .shot img{width:auto;max-width:100%;height:auto}
html.chat-full .shot img.tall{max-height:70vh}
/* Slim footer: tagline first, then the existing links, one 44px row */
html.chat-full .site-foot{flex:none;padding:0 1rem env(safe-area-inset-bottom);min-height:var(--foot-h)}
html.chat-full .site-foot p{flex-wrap:nowrap;white-space:nowrap;min-height:var(--foot-h);overflow:hidden}
html.chat-full .site-foot .foot-tag{display:inline-flex;align-items:center;padding:0 .35rem;color:#d5dbe1;font-weight:300}
html.ti-done[data-theme=light].chat-full .site-foot .foot-tag{color:#121417}
@media (min-width:1024px){
  html.chat-full body{display:grid;grid-template-rows:minmax(0,1fr) auto;height:var(--vvh,100dvh);min-height:0}
  html.chat-full body>main{min-height:0;height:100%;container-type:normal}
}
/* Narrow desktop/tablet: footer keeps tagline + email + How we work; drop the two legal items */
@media (max-width:1100px){html.chat-full .site-foot .item,html.chat-full .site-foot .dot.d3,html.chat-full .site-foot .dot.d4{display:none}}
/* Phone B: lockup left (actions own the right), 56px header, footer = tagline only */
@media (max-width:599.98px){
  :root{--hdr-h:56px;--hdr-mark:28px;--hdr-word:15px;--foot-h:32px}
  html.chat-full body>main{padding:0 12px}
  html.chat-full body>main>header{justify-content:flex-start;gap:8px}
  html.chat-full main .chat{width:100%;padding-bottom:8px}
  html.chat-full .site-foot{padding:0 1rem calc(4px + env(safe-area-inset-bottom))}
  html.chat-full .site-foot p{flex-direction:row;justify-content:center}
  html.chat-full .site-foot p>:not(.foot-tag){display:none!important}
  html.chat-full .site-foot .foot-tag{font-size:.75rem}
}

/* ---------------- State C: chat pane on the left, Work/Tools on the right (push >=1024) ---------------- */
@media (min-width:1024px){
  html.chat-pane,html.chat-pane body{height:100%;overflow:hidden}
  /* Don't force a left pane: the main column is the free space left of the panel.
     The chat (and footer tagline) sits at its normal width, centered in that space.
     The wordmark stays pinned top-left and does not recenter. */
  html.chat-pane body{grid-template-columns:minmax(0,1fr) var(--panel-w,0px)!important;grid-template-rows:minmax(0,1fr) auto;height:var(--vvh,100dvh);min-height:0}
  html.chat-pane body>main{
    grid-column:1;grid-row:1;min-height:0;height:100%;
    display:grid;grid-template-columns:1fr;grid-template-rows:56px minmax(0,1fr);
    align-items:center;padding:0;gap:0;text-align:left;container-type:inline-size;container-name:chatfree;
  }
  html.chat-pane body>main>header{grid-column:1;grid-row:1;display:flex;flex-direction:row;align-items:center;justify-content:flex-start;gap:10px;height:56px;padding:0 16px}
  html.chat-pane .markwrap{width:28px;--wm:1;transition:none;transform-origin:0 0}
  html.chat-pane main .word{font-size:16px!important;line-height:1;transform-origin:0 0;max-width:none;margin:0}
  html.chat-pane main .tag{position:absolute;visibility:hidden;pointer-events:none}
  html.chat-pane main .chat{grid-column:1/-1;grid-row:2;width:min(36rem,max(360px,calc(100% - 64px)));justify-self:center;align-self:stretch;min-height:0;margin:0;padding:4px 0 12px;text-align:left;transition:width .32s var(--pf-ease)}
  @container chatfree (max-width:423.98px){html.chat-pane main .chat{width:100%;justify-self:stretch}}
  /* typical chat pane: the pane is the container, so the thread drops its box */
  html.chat-pane .chat .thread{flex:1 1 0;-webkit-mask-image:linear-gradient(to bottom,transparent 0,#000 20px);mask-image:linear-gradient(to bottom,transparent 0,#000 20px);max-height:none;min-height:0;border-color:transparent;background:transparent;padding:4px 2px 8px}
  html.chat-pane .msg.agent:has(.shot-fig){max-width:100%}
  html.chat-pane .shot{width:auto;max-width:100%}
  html.chat-pane .shot img{width:auto;max-width:100%;height:auto}
  html.chat-pane .shot img.tall{max-height:60vh}
  html.chat-pane body>.site-foot{grid-column:1;grid-row:2;padding:0 16px env(safe-area-inset-bottom);min-height:36px}
  html.chat-pane .site-foot p{min-height:36px;justify-content:center;flex-wrap:nowrap}
  html.chat-pane .site-foot p>:not(.foot-tag){display:none!important}
  html.chat-pane .site-foot .foot-tag{display:inline-flex;align-items:center;padding:0;font-size:.75rem;color:#d5dbe1;font-weight:300}
  html.ti-done[data-theme=light].chat-pane .site-foot .foot-tag{color:#121417}
  /* pane edge: hairline between chat pane and panel comes from the panel's existing border-left */
  /* Unice correction (Nov 27): the Work/Tools LIST stays a skinny single column, like today,
     docked to the right edge. Only an opened case study fills the space to the right of the chat
     pane; its text stays max 760px. */
  html.chat-pane .pf-panel{grid-column:2;grid-row:1/3;height:var(--vvh,100dvh);box-shadow:none}
  html.chat-pane.pf-case .pf-panel{grid-column:2;grid-row:1/3}
  html.chat-pane.pf-m-open main .chat{transition-duration:.32s}
  html.chat-pane.pf-m-case main .chat{transition-duration:.4s}
  html.chat-pane.pf-m-shut main .chat{transition-duration:.24s}
  @media (prefers-reduced-motion:reduce){
    html.chat-pane main .chat{transition:opacity .15s linear}
  }
  html.chat-pane .pf-list{display:block}
  html.chat-pane .pf-case-in{max-width:760px;margin:0 auto}
  /* S3: theme / Work / Tools dock into the panel header in both the list and the case study. */
  html.chat-pane.pf-open .top-actions{right:calc(.5rem + 44px + 12px + env(safe-area-inset-right))!important;top:6px;z-index:21}
  html.chat-pane.pf-open .pf-back{margin-right:156px}
  /* morph owns A↔C motion; keep the existing list↔case width transition.
     Don't zero the grid transition while the panel column is easing open
     (pf-m-open): chat-xing used to make the chat jump 160/187/200px in one frame. */
  html.chat-xing:not(.pf-m-open) body{transition:none!important}
  html.chat-pane.pf-m-case body{transition:grid-template-columns .4s var(--pf-ease)}
  /* Fade the list/Tools header in late on open and out early on close so the
     'Work' title doesn't slide under the theme and Work buttons (~100ms). */
  html.chat-pane .pf-listview .pf-head,
  html.chat-pane .pf-toolsview .pf-head{opacity:0;transition:none}
  html.chat-pane.pf-open .pf-listview .pf-head,
  html.chat-pane.pf-open .pf-toolsview .pf-head{opacity:1;transition:opacity .12s linear .12s}
  /* Close: hide instantly (no transition) so the title can't overlap the
     sliding theme/Work buttons. The delayed fade-in on open is unchanged. */
  html.chat-pane.pf-m-shut .pf-listview .pf-head,
  html.chat-pane.pf-m-shut .pf-toolsview .pf-head{opacity:0;transition:none}
  @media (prefers-reduced-motion:reduce){
    html.chat-pane .pf-listview .pf-head,
    html.chat-pane .pf-toolsview .pf-head,
    html.chat-pane.pf-open .pf-listview .pf-head,
    html.chat-pane.pf-open .pf-toolsview .pf-head,
    html.chat-pane.pf-m-shut .pf-listview .pf-head,
    html.chat-pane.pf-m-shut .pf-toolsview .pf-head{transition:none}
  }
}

/* M2: at 600–1023px the overlay panel would cover the compact lockup. Dock the
   controls into the panel header (same placement as S3). Phone (<600) keeps today's header. */
@media (min-width:600px) and (max-width:1023.98px){
  html.chat-full.pf-open .top-actions{right:calc(.5rem + 44px + 12px + env(safe-area-inset-right))!important;top:6px;z-index:32}
  html.chat-full.pf-open .pf-back{margin-right:156px}
}
/* R1: when controls sit in the panel header (list or Tools), hide the repeating
   title visually but keep it for screen readers. Same clip pattern as the phone
   header. The highlighted Work/Tools button already names the panel. Leave the
   case view's "← Work" back button as it is. Do not truncate or add margins. */
@media (min-width:600px){
  html.chat-pane.pf-open .pf-listview .pf-title,
  html.chat-pane.pf-open .pf-toolsview .pf-title,
  html.chat-full.pf-open .pf-listview .pf-title,
  html.chat-full.pf-open .pf-toolsview .pf-title{
    position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0;
  }
  /* Title is out of flow (same as the phone header); keep × on the right. */
  html.chat-pane.pf-open .pf-listview .pf-head,
  html.chat-pane.pf-open .pf-toolsview .pf-head,
  html.chat-full.pf-open .pf-listview .pf-head,
  html.chat-full.pf-open .pf-toolsview .pf-head{justify-content:flex-end}
}
/* At narrower overlay widths the compact wordmark still collides with the docked
   controls (measured at 800). It's decorative and already under the scrim. */
@media (max-width:1023.98px){
  html.chat-full.pf-open main>header,html.chat-full.pf-open main .markwrap,html.chat-full.pf-open main .word{visibility:hidden}
}
/* Case view below 1024: Work/Tools go icon-only (44×44, same as the phone
   header and the toggle/×) so "← Work" keeps a gap from the docked toggle.
   Labels stay at 1024+ and in the list and Tools views at every width. */
@media (max-width:1023.98px){
  html.pf-case .top-actions .pf-trigger .pf-label{display:none}
  html.pf-case .top-actions .pf-trigger{width:44px;height:44px;min-width:44px;min-height:44px;padding:0}
}

/* Motion-free fallback: no FLIP; the JS swaps classes and only crossfades (opacity) */
@media (prefers-reduced-motion:reduce){html.chat-xing *{transition:none!important}}
html.rm-sim.chat-xing *{transition:none!important}
.site-foot .foot-tag-dot{display:none}
html.chat-full .site-foot .foot-tag-dot{display:inline}
