/* V7 floating "Ask Single Grain" dock. Source: ~/Developer/Singlegrain/redesign-v7/index.html, the last <style> block (#p-dock), verbatim.
   Live-site additions are at the end (leak guards, sr-only label, plus/minus icon, cookie-bar lift transition). */
@property --dock-a { syntax:'<angle>'; inherits:false; initial-value:0deg; }
@keyframes dock-spin { to { --dock-a:360deg; } }
@keyframes dock-blink { 0%,49% { opacity:1; } 50%,100% { opacity:0; } }

#p-dock { position:sticky; bottom:0; height:0; z-index:80; pointer-events:none; --dock-ph:420px; }
#p-dock .dock-wrap { position:absolute; left:0; right:0; bottom:44px; margin-inline:auto; width:min(460px, calc(100% - 32px)); height:48px;
  opacity:1; visibility:visible; transform:none; transition:opacity .45s var(--ease), transform .45s var(--ease); }
#p-dock[data-s="hidden"] .dock-wrap { opacity:0; visibility:hidden; transform:translateY(12px); transition:opacity .3s var(--ease), transform .3s var(--ease), visibility 0s linear .3s; }


/* the pill */
#p-dock .dock-form { position:absolute; inset:0; pointer-events:auto; display:flex; align-items:center; gap:12px; margin:0; padding:0 7px 0 16px;
  background:rgba(255,255,255,.76); -webkit-backdrop-filter:blur(12px) saturate(1.15); backdrop-filter:blur(12px) saturate(1.15); border:1px solid rgba(217,217,222,.9); border-radius:24px;
  box-shadow:0 8px 22px -12px rgba(11,11,12,.18), 0 1px 4px rgba(11,11,12,.04);
  opacity:1; transition:opacity .4s var(--ease), border-color .25s var(--ease), box-shadow .25s var(--ease), transform .35s var(--ease), background-color .25s var(--ease); }
/* V4 (Kriste 10-20): the bar is slightly see-through while it rides over the page; solid again once someone types or opens it */
#p-dock .dock-form:focus-within, #p-dock[data-open="1"] .dock-form { background:#fff; }
#p-dock .dock-form:hover { border-color:#BFBFC5; transform:translateY(-1px); }
/* V4 (Kriste 10-20): over the dark Single Brain panel the bar turns translucent DARK, the way it is translucent white on white */
#p-dock[data-tone="dark"] .dock-form { background:rgba(17,16,14,.6); border-color:rgba(243,239,232,.16); box-shadow:0 10px 26px -14px rgba(0,0,0,.7); }
#p-dock[data-tone="dark"] .dock-form:hover { border-color:rgba(243,239,232,.3); }
#p-dock[data-tone="dark"] .dock-in { color:#F3EFE8; }
#p-dock[data-tone="dark"] .dock-ghost, #p-dock[data-tone="dark"] .dock-ico { color:rgba(243,239,232,.66); }
#p-dock[data-tone="dark"] .dock-form:focus-within, #p-dock[data-tone="dark"][data-open="1"] .dock-form { background:#fff; border-color:var(--orange); }
#p-dock[data-tone="dark"] .dock-form:focus-within .dock-in, #p-dock[data-tone="dark"][data-open="1"] .dock-in { color:var(--ink); }
#p-dock[data-tone="dark"] .dock-form:focus-within .dock-ghost, #p-dock[data-tone="dark"] .dock-form:focus-within .dock-ico,
#p-dock[data-tone="dark"][data-open="1"] .dock-ghost, #p-dock[data-tone="dark"][data-open="1"] .dock-ico { color:var(--mute); }
#p-dock[data-tone="dark"] .dock-menu { background:rgba(17,16,14,.6); border-color:rgba(243,239,232,.16); color:#F3EFE8; }
#p-dock .dock-form:focus-within, #p-dock[data-open="1"] .dock-form { border-color:var(--orange); transform:none; box-shadow:0 8px 22px -12px rgba(11,11,12,.2), 0 0 0 3px rgba(242,112,56,.22); }
/* the orange scan light, one calm loop around the outline while idle */
#p-dock .dock-form::before { content:""; position:absolute; inset:-1px; border-radius:inherit; padding:2px; pointer-events:none;
  background:conic-gradient(from var(--dock-a), transparent 0 64%, rgba(242,112,56,0) 64%, rgba(242,112,56,.55) 90%, rgba(244,181,68,.8) 97%, transparent 100%);
  -webkit-mask:linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite:xor;
  mask:linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0); mask-composite:exclude;
  animation:dock-spin 8s linear infinite; transition:opacity .3s; }
#p-dock[data-open="1"] .dock-form::before { animation-play-state:paused; opacity:0; }
#p-dock .dock-ico { width:17px; height:17px; flex:none; color:var(--mute); }
#p-dock .dock-field { position:relative; flex:1; min-width:0; height:100%; }
#p-dock .dock-in { position:absolute; inset:0; width:100%; height:100%; background:none; border:0; outline:0; padding:0; margin:0; border-radius:0;
  color:var(--ink); font:400 14.5px/46px var(--f); letter-spacing:-.005em; }
#p-dock .dock-in:focus-visible { outline:0; }
#p-dock .dock-ghost { position:absolute; inset:0; display:flex; align-items:center; overflow:hidden; white-space:nowrap; pointer-events:none; color:var(--mute); font:400 14.5px/1 var(--f); letter-spacing:-.005em; }
#p-dock .dock-ghost span { overflow:hidden; text-overflow:ellipsis; }
#p-dock .dock-caret { flex:none; width:1.5px; height:16px; margin-left:2px; background:var(--orange); animation:dock-blink 1.05s steps(1) infinite; }
#p-dock[data-busy="1"] .dock-ghost { display:none; }
#p-dock .dock-send { flex:none; width:36px; height:36px; border-radius:50%; border:0; padding:0; background:none; color:var(--ink); display:grid; place-items:center; cursor:pointer;
  transition:background-color .25s var(--ease), transform .25s var(--ease); }
/* the Single Brain orb as a pressable 3D bubble: volume shading + a glossy highlight + a soft cast shadow (Kriste 10-16) */
#p-dock .dock-send { position:relative; isolation:isolate; transition:transform .18s var(--ease), box-shadow .18s var(--ease);
  box-shadow:0 5px 12px -3px rgba(196,91,38,.55), 0 1px 2px rgba(110,40,10,.35), inset 0 -3px 6px rgba(110,35,5,.32), inset 0 2px 3px rgba(255,255,255,.45); }
#p-dock .dock-send::before { content:""; position:absolute; inset:0; border-radius:50%; z-index:1; pointer-events:none;
  background:radial-gradient(circle at 34% 28%, rgba(255,255,255,.32), rgba(255,255,255,0) 46%), radial-gradient(circle at 70% 82%, rgba(90,25,0,.30), rgba(90,25,0,0) 58%); }
#p-dock .dock-send::after { content:""; position:absolute; left:20%; top:9%; width:44%; height:28%; border-radius:50%; z-index:2; pointer-events:none;
  background:radial-gradient(ellipse at 50% 45%, rgba(255,255,255,.9), rgba(255,255,255,0) 72%); }
#p-dock .dock-send img { position:relative; z-index:0; width:100%; height:100%; display:block; border-radius:50%; transition:transform .6s var(--ease); }
#p-dock .dock-send:hover { transform:translateY(-1px); box-shadow:0 8px 16px -4px rgba(196,91,38,.6), 0 2px 3px rgba(110,40,10,.3), inset 0 -3px 6px rgba(110,35,5,.32), inset 0 2px 3px rgba(255,255,255,.45); }
#p-dock .dock-send:hover img, #p-dock .dock-form:focus-within .dock-send img { transform:rotate(-18deg) scale(1.06); }
#p-dock .dock-send:active { transform:translateY(1px) scale(.93); box-shadow:0 2px 5px -2px rgba(196,91,38,.5), inset 0 -1px 3px rgba(110,35,5,.3), inset 0 3px 6px rgba(110,35,5,.28); }
#p-dock .dock-send:focus-visible { outline:2px solid var(--ink); outline-offset:2px; }
/* V7 r14: the orb as a lightly spinning 3D sphere (canvas); the PNG stays underneath as the fallback */
#p-dock .dock-orb { position:absolute; inset:0; z-index:0; width:100%; height:100%; display:block; border-radius:50%; opacity:0; transition:opacity .4s ease, transform .6s var(--ease); }
#p-dock .dock-send.has-3d .dock-orb { opacity:1; }
#p-dock .dock-send.has-3d img { opacity:0; }
#p-dock .dock-send.has-3d:hover .dock-orb, #p-dock .dock-form:focus-within .dock-send.has-3d .dock-orb { transform:scale(1.05); }

/* the panel, opening upward */
#p-dock .dock-panel { position:absolute; left:calc(50% - min(280px, (100cqi - 32px) / 2)); bottom:calc(100% + 10px); width:min(560px, calc(100cqi - 32px)); pointer-events:auto; background:#fff; border:1px solid #D9D9DE; border-radius:20px;
  box-shadow:0 24px 60px -24px rgba(11,11,12,.32), 0 2px 8px rgba(11,11,12,.05);
  max-height:var(--dock-ph); overflow-y:auto; overscroll-behavior:contain; padding:22px 26px 20px;
  transform-origin:50% 100%; transform:translateY(10px) scale(.985); opacity:0; visibility:hidden;
  transition:opacity .28s var(--ease), transform .4s var(--ease), visibility 0s linear .4s; }
#p-dock[data-open="1"] .dock-panel { transform:none; opacity:1; visibility:visible; transition:opacity .28s var(--ease), transform .4s var(--ease); }
#p-dock .dock-head { display:flex; align-items:flex-start; justify-content:space-between; gap:20px; }
#p-dock .dock-q { font:500 clamp(21px, 3.4cqi, 28px)/1.15 var(--f); letter-spacing:-.025em; margin:0; text-wrap:balance; color:var(--ink); }
#p-dock .dock-close { flex:none; background:none; border:0; padding:4px 0; cursor:pointer; font:500 14px/1.3 var(--f); color:var(--mute);
  text-decoration:underline; text-decoration-thickness:1px; text-underline-offset:5px; text-decoration-color:#C9C9CE; }
#p-dock .dock-close:hover { color:var(--ink); text-decoration-color:var(--orange); }
#p-dock .dock-a { margin:12px 0 0; font:400 16.5px/1.55 var(--f); color:var(--ink-2); text-wrap:pretty; max-width:40em; }
#p-dock .dock-key { margin:14px 0 0; font:500 14px/1.5 var(--f); letter-spacing:0; text-transform:none; color:var(--label); }
#p-dock .dock-key:empty, #p-dock .dock-go:empty { display:none; }
#p-dock .dock-go { margin-top:16px; display:flex; flex-wrap:wrap; align-items:baseline; gap:6px 20px; }
#p-dock .dock-lab { font:500 14px/1.4 var(--f); letter-spacing:0; text-transform:none; color:var(--mute); }
#p-dock .dock-lnk { font:500 15px/1.35 var(--f); color:var(--ink); text-decoration:underline; text-decoration-thickness:1px; text-underline-offset:5px; text-decoration-color:#B9B9BE;
  transition:text-decoration-color .2s var(--ease); cursor:pointer; }
#p-dock .dock-lnk:hover { text-decoration-color:var(--orange); }
#p-dock .dock-hr { height:1px; background:var(--line); border:0; margin:18px 0 16px; }
#p-dock .dock-chips { display:flex; flex-wrap:wrap; gap:8px; }
#p-dock .dock-chips button { background:#fff; border:1px solid #D9D9DE; border-radius:var(--r-ctl,2px); padding:9px 15px; font:400 14px/1.25 var(--f); color:var(--ink); cursor:pointer;
  transition:border-color .2s var(--ease), background-color .2s var(--ease); text-align:left; }
#p-dock .dock-chips button:hover, #p-dock .dock-chips button.is-act { border-color:var(--orange); background:#FFF6F1; }
#p-dock .dock-chips button:focus-visible { outline:2px solid var(--orange); outline-offset:2px; }
#p-dock .dock-chips:empty { display:none; }
#p-dock .dock-chips:empty + .dock-hr { display:none; }
#p-dock .dock-map { display:flex; flex-wrap:wrap; align-items:baseline; gap:6px 18px; }
#p-dock .dock-map a[aria-current="page"] { text-decoration-color:var(--orange); color:var(--label); }
#p-dock .dock-panel a:focus-visible, #p-dock .dock-close:focus-visible { outline:2px solid var(--orange); outline-offset:3px; border-radius:4px; }

@container site (max-width: 600px) {
  #p-dock .dock-wrap { bottom:28px; }
  #p-dock .dock-form { padding:0 7px 0 14px; gap:10px; }
  #p-dock .dock-panel { padding:18px 18px 16px; border-radius:18px; }
  #p-dock .dock-q { font-size:20px; }
  #p-dock .dock-a { font-size:15.5px; }
  #p-dock .dock-chips button { font-size:14px; padding:9px 13px; min-height:44px; display:inline-flex; align-items:center; }
  /* 10-23 (A6): 44px targets for Close and the site-map links, via hit areas that don't move anything */
  #p-dock .dock-close { position:relative; }
  #p-dock .dock-close::after { content:""; position:absolute; left:-12px; right:-12px; top:-9px; bottom:-9px; }
  #p-dock .dock-map { gap:14px 20px; }
  #p-dock .dock-lnk { position:relative; }
  #p-dock .dock-lnk::after { content:""; position:absolute; left:-6px; right:-6px; top:-12px; bottom:-12px; }  /* 20px line + 24 = 44px (was 42) */
}
/* ---------- phone: the bar is the one persistent control (Kriste 10-16) ----------
   Ask field + Menu. Menu opens a bottom sheet with the site navigation and Work with us. */
#p-dock .dock-menu, #p-dock .dock-sheet { display:none; }
@container site (max-width: 600px) {
  #p-dock .dock-wrap { bottom:calc(14px + env(safe-area-inset-bottom, 0px)); width:calc(100% - 24px); height:52px; }
  /* Kriste 10-22: text dissolves into a soft fade before it reaches the bar (the bar itself is unchanged);
     off over the closing band's pixel field, where a white haze would read as a smudge */
  #p-dock::before { content:""; position:absolute; left:0; right:0; bottom:0; height:calc(104px + env(safe-area-inset-bottom, 0px)); pointer-events:none;
    background:linear-gradient(to top, color-mix(in srgb, var(--bg) 94%, transparent) 0, color-mix(in srgb, var(--bg) 94%, transparent) 60%, color-mix(in srgb, var(--bg) 0%, transparent) 100%);
    transition:opacity .3s ease; }
  #p-dock[data-under="band"]::before { opacity:0; }
  #p-dock .dock-form { right:70px; }
  #p-dock .dock-form::before { animation:none; opacity:0; }
  #p-dock .dock-in, #p-dock .dock-ghost { font-size:16px; }
  /* 44px tap target, same 36px orb: the extra 4px is a transparent border the visuals sit inside */
  #p-dock .dock-send { width:44px; height:44px; border:4px solid transparent; margin:-4px; }
  #p-dock .dock-caret { display:none; }
  #p-dock .dock-panel { left:0; width:100%; }
  #p-dock .dock-menu { display:inline-flex; align-items:center; justify-content:center; position:absolute; right:0; top:0; bottom:0; width:62px; pointer-events:auto;
    background:rgba(255,255,255,.76); -webkit-backdrop-filter:blur(12px) saturate(1.15); backdrop-filter:blur(12px) saturate(1.15); border:1px solid rgba(217,217,222,.9); border-radius:24px; cursor:pointer; color:var(--ink);
    font:500 14px/1 var(--m); letter-spacing:.04em; text-transform:uppercase;  /* phone button floor 14px, like .sg-btn (was 11.5px) */
    box-shadow:0 8px 22px -12px rgba(11,11,12,.18), 0 1px 4px rgba(11,11,12,.04); transition:border-color .2s var(--ease); }
  #p-dock .dock-menu[aria-expanded="true"] { border-color:var(--ink); }
  #p-dock .dock-menu:focus-visible { outline:2px solid var(--orange); outline-offset:2px; }
  #p-dock .dock-sheet { display:block; position:absolute; left:0; right:0; bottom:calc(100% + 10px); pointer-events:auto; background:#fff; border:1px solid #D9D9DE; border-radius:18px;
    box-shadow:0 24px 60px -24px rgba(11,11,12,.32), 0 2px 8px rgba(11,11,12,.05); max-height:var(--dock-ph); overflow-y:auto; overscroll-behavior:contain; padding:6px 18px 18px;
    transform:translateY(12px); opacity:0; visibility:hidden; transition:opacity .22s var(--ease), transform .32s var(--ease), visibility 0s linear .32s; }
  #p-dock[data-menu="1"] .dock-sheet { transform:none; opacity:1; visibility:visible; transition:opacity .22s var(--ease), transform .32s var(--ease); }
  #p-dock .ds-row { display:flex; align-items:center; justify-content:space-between; width:100%; min-height:54px; padding:0; margin:0; background:none; border:0; border-bottom:1px solid var(--line-2);
    font:500 17px/1.2 var(--f); color:var(--ink); text-decoration:none; text-align:left; cursor:pointer; }
  #p-dock .ds-row .sg-nav__pm { color:var(--mute); }
  #p-dock .ds-row[aria-expanded="true"] .sg-nav__pm { color:var(--orange); }
  #p-dock .ds-row[aria-expanded="true"] .sg-nav__pm::after { transform:rotate(0deg); opacity:0; }
  #p-dock .ds-sub { display:none; padding:4px 0 10px 12px; border-bottom:1px solid var(--line-2); }
  #p-dock .ds-row[aria-expanded="true"] + .ds-sub { display:block; }
  #p-dock .ds-sub a { display:flex; align-items:center; min-height:44px; font:400 16px/1.3 var(--f); color:var(--ink-2); text-decoration:none; }
  #p-dock .ds-sub a.ds-all { color:var(--ink); text-decoration:underline; text-decoration-thickness:1px; text-underline-offset:5px; text-decoration-color:#B9B9BE; }
  #p-dock .ds-cta { margin-top:18px; }
  #p-dock .ds-sb span { display:inline-flex; align-items:center; gap:10px; }
  #p-dock .ds-sb img { width:20px; height:20px; border-radius:50%; }
  #p-dock .ds-sb em { font:400 13px/1 var(--f); font-style:normal; color:var(--mute); }
}
@media (prefers-reduced-motion: reduce) {
  #p-dock *, #p-dock *::before { animation:none !important; transition-duration:.01s !important; }
  #p-dock .dock-form::before { opacity:0 !important; }
  #p-dock .dock-caret { opacity:0 !important; }
}
/* r30 (Kriste 11-16, Eric "mobile looks very cluttered"): on phone the bar tucks away while scrolling down, back on any scroll up */
#p-dock[data-tuck="1"] .dock-wrap { opacity:0; visibility:hidden; transform:translateY(calc(100% + 56px)); transition:opacity .25s var(--ease), transform .3s var(--ease), visibility 0s linear .3s; }

/* r40 A (Kriste 11-19, 11aed26a + 29af5845): no bottom bar on phone: the Ask field, its Menu and the white fade are gone;
   the Menu lives in the logo bar */
@container site (max-width: 600px) {
  #p-dock { display:none; }
}

/* ---------- live site ---------- */
/* the dock sits outside #site (inside #page.site), so the theme CSS that #site guards against reaches it */
#p-dock .dock-sr{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap;border:0}
#p-dock{transition:bottom .3s var(--ease)}  /* the lift above the cookie bar (dock.js sets bottom) */
#p-dock h3.dock-q{margin:0}
#p-dock .dock-in,#p-dock .dock-in:focus{box-shadow:none;min-height:0;-webkit-appearance:none;appearance:none}
#p-dock .dock-lnk:hover,#p-dock .dock-lnk:focus,#p-dock .ds-row:hover,#p-dock .ds-row:focus{color:var(--ink)}
#p-dock .ds-sub a:hover,#p-dock .ds-sub a:focus{color:var(--ink-2)}
#p-dock .ds-sub a.ds-all:hover,#p-dock .ds-sub a.ds-all:focus{color:var(--ink)}
#p-dock .dock-map a[aria-current="page"]:hover{color:var(--label)}
#p-dock .sg-btn:hover,#p-dock .sg-btn:focus{color:var(--bg);text-decoration:none}
#p-dock button:focus:not(:focus-visible){outline:0}
#p-dock .dock-send img{max-width:none}
/* the +/- used by the Menu sheet rows (prototype nav CSS), scoped here so the dock does not depend on nav.css */
#p-dock .sg-nav__pm{position:relative;width:11px;height:11px;flex:none;color:var(--mute);transition:color .2s ease}
#p-dock .sg-nav__pm::before,#p-dock .sg-nav__pm::after{content:"";position:absolute;left:0;top:4.75px;width:11px;height:1.5px;border-radius:1px;background:currentColor;transition:transform .3s var(--ease),opacity .2s ease}
#p-dock .sg-nav__pm::after{transform:rotate(90deg)}

/* ---- live site: search results under the answer (assets/v7/js/dock.js, index from inc/v7/dock-index.php) ---- */
#p-dock .dock-res[hidden], #p-dock .dock-res-g[hidden] { display:none; }
#p-dock .dock-res { margin-top:16px; display:grid; gap:14px; }
#p-dock .dock-res-g { display:grid; gap:4px; }
#p-dock .dock-res-l { list-style:none; margin:0; padding:0; border-top:1px solid var(--line); }
#p-dock .dock-res-l li { margin:0; padding:0; border-bottom:1px solid var(--line); }
#p-dock .dock-rl { display:flex; align-items:baseline; justify-content:space-between; gap:16px; min-height:44px; padding:11px 0; color:var(--ink); text-decoration:none; font:400 15.5px/1.35 var(--f); transition:color .15s ease; }
#p-dock .dock-rt { min-width:0; overflow-wrap:anywhere; }
#p-dock .dock-rk { flex:none; font:500 11.5px/1 var(--m); letter-spacing:.08em; text-transform:uppercase; color:var(--mute); }
#p-dock .dock-rl:hover .dock-rt, #p-dock .dock-rl:focus-visible .dock-rt { text-decoration:underline; text-decoration-color:var(--orange); text-underline-offset:.2em; }
#p-dock .dock-rl:focus-visible { outline:2px solid var(--orange); outline-offset:2px; }
